Class InterfaceManager

  • All Implemented Interfaces:
    CommonManager

    public final class InterfaceManager
    extends AbstractManager
    This class is responsible to manage interfaces: add, remove and modify.
    • 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 ids
        operationsIDs - the set of operations
        propertiesIDs - 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 class
        metaClassID - 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 checked
        metaClassesIDs - 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 namespace
        interfacesIDs - 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 interface
        namespace - Namespace of the class of the interface
        classname - Classname of the class of the interface
        propertiesInIface - Properties in interface
        operationsSignatureInIface - 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 interface
        namespace - Namespace of the class of the interface
        classname - Classname of the class of the interface
        propertiesInIface - Properties in interface
        operationsSignatureInIface - 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.