Class MetaDataServiceDB


  • public final class MetaDataServiceDB
    extends Object
    MetaData data base.
    • Constructor Detail

      • MetaDataServiceDB

        public MetaDataServiceDB​(SQLiteDataSource dataSource)
        MetaDataServiceDB constructor.
        Parameters:
        dataSource - data source
    • Method Detail

      • createTables

        public void createTables()
        Create tables of MDS.
      • dropTables

        public void dropTables()
        Delete the tables of MDS. Just the other way around of createTables --much simpler.
      • store

        public void store​(ObjectMetaData objectMD)
        Store ObjectMetaData into database
        Parameters:
        objectMD - ObjectMetaData
      • getByID

        public ObjectMetaData getByID​(ObjectID objectID)
        Get object metadata by ID
        Parameters:
        objectID - ID of the object
        Returns:
        The ObjectMetaData or null if it does not exist
      • getAllObjectIDs

        public Set<ObjectID> getAllObjectIDs()
        Get all objects registered in system
        Returns:
        The id of all objects registered
      • existsByID

        public boolean existsByID​(ObjectID objectID)
        Check if there is an object object metadata identified by ID provided
        Parameters:
        objectID - ID of the object
        Returns:
        TRUE if exists. FALSE otherwise
      • existsByDataSetID

        public boolean existsByDataSetID​(DataSetID datasetID)
        Check if there is any ObjectMetaData with DataSetID provided
        Parameters:
        datasetID - DataSetID
        Returns:
        TRUE if there is any ObjectMetaData with DataSetID provided. FALSE otherwise.
      • deleteByID

        public void deleteByID​(ObjectID objectID)
                        throws DbHandlerException
        Delete object metadata identified by ID provided (ignored if object does not exist)
        Parameters:
        objectID - ID of the object
        Throws:
        DbHandlerException
      • updateReadOnlyByID

        public void updateReadOnlyByID​(ObjectID objectID,
                                       boolean newisreadonly)
                                throws DbObjectNotExistException
        Update object metadata by ID
        Parameters:
        objectID - ID of object to update
        newisreadonly - new is read only value
        Throws:
        DbObjectNotExistException - if object does not exist
      • getByClass

        public ArrayList<ObjectMetaData> getByClass​(MetaClassID classID)
        Get a set of objects metadata by its Class ID
        Parameters:
        classID - Class ID of the objects
        Returns:
        The ObjectMetaDatas with class id provided
      • getByAlias

        public ObjectMetaData getByAlias​(String alias)
        Get anb object by class - alias (null if it does not exist)
        Parameters:
        alias - alias of the object
        Returns:
        object instancing specified class and aliased with given alias. null if there is none.
      • insertFederatedObject

        public boolean insertFederatedObject​(ObjectID objectID,
                                             DataClayInstanceID dataClayID)
        Registers an object to be federated with an external dataClay instance
        Parameters:
        objectID - id of the object to be federated
        dataClayID - id of the external dataClay instance
        Returns:
        true if the object has been successfully registered, false if it was already registered previously
      • deleteFederatedObject

        public boolean deleteFederatedObject​(ObjectID objectID,
                                             DataClayInstanceID dataClayID)
        Delete federated object
        Parameters:
        objectID - id of the object to be deleted
        dataClayID - id of the external dataClay instance
        Returns:
        true if the object has been successfully deleted, false otherwise
      • existsFederatedObjectWithDC

        public boolean existsFederatedObjectWithDC​(ObjectID objectID,
                                                   DataClayInstanceID dataClayID)
        Checks if the object is already federated with given external dataClay instance.
        Parameters:
        objectID - id of the object to be checked
        dataClayID - id of the external dataClay id
        Returns:
        true if the object is already registered as federated object with given external dataClay instance. false otherwise.
      • existsFederatedObject

        public boolean existsFederatedObject​(ObjectID objectID)
        Checks if the object is already federated.
        Parameters:
        objectID - id of the object to be checked
        Returns:
        true if the object is already registered as federated object with given external dataClay instance. false otherwise.
      • getDataClaysOurObjectIsFederatedWith

        public Set<DataClayInstanceID> getDataClaysOurObjectIsFederatedWith​(ObjectID objectID)
        Retrieves external target dataClays ids which the given object is federated with
        Parameters:
        objectID - id of the object to be checked
        Returns:
        ids of external dataClays which the object is federated with
      • getObjectsFederatedWithDataClay

        public Set<ObjectID> getObjectsFederatedWithDataClay​(DataClayInstanceID extDataClayInstanceID)
        Method that retrieves all the objects federated/belonging to dataClay with ID provided.
        Parameters:
        extDataClayInstanceID - id of dataclay
        Returns:
        all the objects federated/belonging to dataClay with ID provided.
      • insertExternalObject

        public void insertExternalObject​(ObjectID objectID,
                                         DataClayInstanceID srcDataClayID,
                                         boolean unregisteredFlag)
        Registers an object that has been federated from an external dataClay instance.
        Parameters:
        objectID - ID of the external object
        srcDataClayID - id of the source dataClay instance federating this object
        unregisteredFlag - Indicates object is unregistered
      • deleteExternalObject

        public void deleteExternalObject​(ObjectID objectID)
        Delete a federated object from an external dataClay instance.
        Parameters:
        objectID - ID of the external object
      • existsExternalObject

        public boolean existsExternalObject​(ObjectID objectID,
                                            boolean unregisteredFlag)
        Checks whether the given object is externally federated
        Parameters:
        objectID - id of the object to be checked
        unregisteredFlag - Indicates if object is unregistered or not
        Returns:
        true if it is an external object federated. false otherwise.
      • getUnregisteredExternalObjects

        public Set<ObjectID> getUnregisteredExternalObjects()
        Get unregistered external objects.
        Returns:
        id of external objects unregistered
      • updateUnregisteredFlagExternalObject

        public void updateUnregisteredFlagExternalObject​(ObjectID objectID,
                                                         boolean unregisteredFlag)
                                                  throws DbObjectNotExistException
        Update external object flag unregistered
        Parameters:
        objectID - ID of the object to update
        unregisteredFlag - Value of flag unregistered
        Throws:
        DbObjectNotExistException - if object does not exist
      • getExternalDataClayOfObject

        public DataClayInstanceID getExternalDataClayOfObject​(ObjectID objectID)
        Retrieves external source dataClay id owning the given object.
        Parameters:
        objectID - id of the object to be checked
        Returns:
        id of the external source dataClay
      • vacuum

        public void vacuum()
        Vacuum database.
      • close

        public void close()
        Close DB.