Class InterfaceManager
- java.lang.Object
-
- es.bsc.dataclay.util.management.AbstractManager
-
- es.bsc.dataclay.logic.interfacemgr.InterfaceManager
-
- All Implemented Interfaces:
CommonManager
public final class InterfaceManager extends AbstractManager
This class is responsible to manage interfaces: add, remove and modify.
-
-
Field Summary
-
Fields inherited from class es.bsc.dataclay.util.management.AbstractManager
dataSource
-
-
Constructor Summary
Constructors Constructor Description InterfaceManager(SQLiteDataSource dataSource)
Instantiates an Interface Manager that uses the Interface DB in the provided path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
checkPropertiesAndOperationsInAnyOfInterfaces(Set<InterfaceID> interfacesIDs, Set<OperationID> operationsIDs, Set<PropertyID> propertiesIDs)
This operation verifies that all operations and properties can be accessed given the set of interfaces providedvoid
cleanCaches()
Method that cleans the caches of the manager.boolean
existsInterface(String providerAccount, String namespace, String classname, Set<String> propertiesInIface, Set<String> operationsSignatureInIface)
Check if exists interface with specifications provided.InterfaceManagerDB
getDbHandler()
Method used for unit testing.InterfaceID
getInterfaceID(String providerAccount, String namespace, String classname, Set<String> propertiesInIface, Set<String> operationsSignatureInIface)
Get ID of interface with specifications provided.Interface
getInterfaceInfo(InterfaceID ifaceID)
This operation returns all the information of the given interfaceHashSet<InterfaceID>
getInterfacesAccessingOperation(NamespaceID namespaceID, MetaClassID metaClassID, OperationID operationID)
This operation retrieves all the interfaces accessing a specific operationMap<InterfaceID,Interface>
getInterfacesInfo(Set<InterfaceID> interfacesIDs)
This operation returns all the information of the given interfacesHashSet<InterfaceID>
getInterfacesOfClass(NamespaceID namespaceID, MetaClassID metaClassID)
This operation retrieves the interfaces of a specific class.Map<InterfaceID,Interface>
getInterfacesOfNamespaceInfo(NamespaceID namespaceID, Set<InterfaceID> interfacesIDs)
This operation returns all the information of a set of interfaces that belong to a specific namespaceMetaClassID
getMetaClassOfInterface(InterfaceID interfaceID)
This operation returns a reference to the metaclass associated with a specific interfaceSet<InterfaceID>
getSubsetInterfacesOfClasses(Set<InterfaceID> interfacesIDs, Set<MetaClassID> metaClassesIDs)
This operation retrieves the subset of interfaces (fromt he set specified) that belong to any of the given classesInterfaceID
newInterface(Interface newInterface)
This operation allows to register a new interfacevoid
removeInterface(NamespaceID namespaceID, InterfaceID interfaceID)
This operation removes a specific interface.
-
-
-
Constructor Detail
-
InterfaceManager
public InterfaceManager(SQLiteDataSource dataSource)
Instantiates an Interface Manager that uses the Interface DB in the provided path.
-
-
Method Detail
-
newInterface
public InterfaceID newInterface(Interface newInterface)
This operation allows to register a new interface- Parameters:
newInterface
- Interface to register- Returns:
- ID of the new interface created
- Throws:
Exception
- if an exception occurs.
-
removeInterface
public void removeInterface(NamespaceID namespaceID, InterfaceID interfaceID)
This operation removes a specific interface.- Parameters:
interfaceID
- The id of the interface to be removed.namespaceID
- the ID of the namespace where interface is created- Throws:
Exception
- if an exception occurs:
InterfaceNotExistsException: if the interface does not exist
-
checkPropertiesAndOperationsInAnyOfInterfaces
public boolean checkPropertiesAndOperationsInAnyOfInterfaces(Set<InterfaceID> interfacesIDs, Set<OperationID> operationsIDs, Set<PropertyID> propertiesIDs)
This operation verifies that all operations and properties can be accessed given the set of interfaces provided- Parameters:
interfacesIDs
- the interfaces idsoperationsIDs
- the set of operationspropertiesIDs
- the set of properties- Returns:
- TRUE if all he properties and operations can be accessed from any of the specified interfaces. FALSE otherwise.
- Throws:
Exception
- if an exception occurs:
InterfaceNotExistsException: if the interface does not exist
-
getInterfacesOfClass
public HashSet<InterfaceID> getInterfacesOfClass(NamespaceID namespaceID, MetaClassID metaClassID)
This operation retrieves the interfaces of a specific class.- Parameters:
namespaceID
- The id of the namespace of the classmetaClassID
- The id of the metaClass- Returns:
- the list of interface ids related with the provided class
- Throws:
Exception
- if an exception occurs.
-
getInterfacesAccessingOperation
public HashSet<InterfaceID> getInterfacesAccessingOperation(NamespaceID namespaceID, MetaClassID metaClassID, OperationID operationID)
This operation retrieves all the interfaces accessing a specific operation- Parameters:
namespaceID
- The id of the namespace of the metaclass (and the interface)metaClassID
- The id of the metaclass of the operation (and the interface)operationID
- The id of the operation to be looked for.- Returns:
- The set of interfaces that access the provided operation.
- Throws:
Exception
- if an exception occurs.
-
getSubsetInterfacesOfClasses
public Set<InterfaceID> getSubsetInterfacesOfClasses(Set<InterfaceID> interfacesIDs, Set<MetaClassID> metaClassesIDs)
This operation retrieves the subset of interfaces (fromt he set specified) that belong to any of the given classes- Parameters:
interfacesIDs
- the set of interfaces to be checkedmetaClassesIDs
- the set of metaclasses to be checked- Returns:
- The subset of interfaces that refer to any of the provided metaclasses.
- Throws:
Exception
- if an exception occurs.
-
getMetaClassOfInterface
public MetaClassID getMetaClassOfInterface(InterfaceID interfaceID)
This operation returns a reference to the metaclass associated with a specific interface- Parameters:
interfaceID
- The id of the interface- Returns:
- The id of the associated metaclass
- Throws:
Exception
- if an exception occurs:
InterfaceNotExistsException: if the interface does not exist
-
getInterfacesOfNamespaceInfo
public Map<InterfaceID,Interface> getInterfacesOfNamespaceInfo(NamespaceID namespaceID, Set<InterfaceID> interfacesIDs)
This operation returns all the information of a set of interfaces that belong to a specific namespace- Parameters:
namespaceID
- the id of the namespaceinterfacesIDs
- the ids of the interfaces- Returns:
- the interfaces info
- Throws:
Exception
- if an exception occurs:
InterfaceNotExistsException: if the interface does not exist
-
getInterfacesInfo
public Map<InterfaceID,Interface> getInterfacesInfo(Set<InterfaceID> interfacesIDs)
This operation returns all the information of the given interfaces- Parameters:
interfacesIDs
- the ids of the interfaces- Returns:
- the interfaces info
- Throws:
Exception
- if an exception occurs:
InterfaceNotExistsException: if the interface does not exist
-
getInterfaceInfo
public Interface getInterfaceInfo(InterfaceID ifaceID)
This operation returns all the information of the given interface- Parameters:
ifaceID
- the id of the interfaces- Returns:
- the interface info
- Throws:
Exception
- if an exception occurs:
InterfaceNotExistsException: if the interface does not exist
-
getInterfaceID
public InterfaceID getInterfaceID(String providerAccount, String namespace, String classname, Set<String> propertiesInIface, Set<String> operationsSignatureInIface)
Get ID of interface with specifications provided.- Parameters:
providerAccount
- Name of the account providing the interfacenamespace
- Namespace of the class of the interfaceclassname
- Classname of the class of the interfacepropertiesInIface
- Properties in interfaceoperationsSignatureInIface
- Operations in interface- Returns:
- ID of the interface
-
existsInterface
public boolean existsInterface(String providerAccount, String namespace, String classname, Set<String> propertiesInIface, Set<String> operationsSignatureInIface)
Check if exists interface with specifications provided.- Parameters:
providerAccount
- Name of the account providing the interfacenamespace
- Namespace of the class of the interfaceclassname
- Classname of the class of the interfacepropertiesInIface
- Properties in interfaceoperationsSignatureInIface
- Operations in interface- Returns:
- TRUE if exists. FALSE otherwise.
-
getDbHandler
public InterfaceManagerDB getDbHandler()
Method used for unit testing.- Returns:
- The db handler reference of this manager.
-
cleanCaches
public void cleanCaches()
Description copied from interface:CommonManager
Method that cleans the caches of the manager. Used on testing.- Specified by:
cleanCaches
in interfaceCommonManager
- Specified by:
cleanCaches
in classAbstractManager
-
-