Class Database

    • Constructor Summary

      Constructors 
      Constructor Description
      Database()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      int addLFNProfile​(java.lang.String namespace, java.lang.String name, java.lang.String version, java.util.List profiles)
      Add additional profile to a logical transformation .
      private long addLogicalTr​(java.lang.String namespace, java.lang.String name, java.lang.String version)
      Adds a logical entry to the logicaltx table
      int addPFNProfile​(java.lang.String pfn, TCType type, java.lang.String resourceid, java.util.List profiles)
      Add additional profile to a physical transformation.
      private long addPhysicalTr​(java.lang.String physicalname, java.lang.String resourceid, TCType type, long archid)
      Adds a physical entry to the physicaltxtable
      private boolean addProfile​(Profile p, long id, boolean pfn)
      Add a lfn or pfn profile to the TC
      private long addSysInfo​(VDSSysInfo system)
      Adds a system information entry into the TC.
      protected boolean addTCEntry​(java.lang.String namespace, java.lang.String name, java.lang.String version, java.lang.String physicalname, TCType type, java.lang.String resourceid, java.util.List lfnprofiles, java.util.List pfnprofiles, SysInfo system, Notifications invokes, boolean write)
      Add an single entry into the transformation catalog.
      private long checkLfnPfnMap​(long lfnid, long pfnid)
      Checks if a lfn,pfn exist in the map.
      private long checkProfile​(java.lang.String namespace, java.lang.String name, java.lang.String value, long id, boolean pfn)
      Checks if a given profile exists
      int clear()
      Deletes the entire transformation catalog.
      void close()
      Disassociate from the database driver before finishing.
      boolean connect​(java.util.Properties props)
      Establishes a link between the implementation and the thing the implementation is build upon.
      int deleteLFNProfiles​(java.lang.String namespace, java.lang.String name, java.lang.String version, java.util.List profiles)
      Delete a list of profiles or all the profiles associated with a logical transformation.
      int deletePFNProfiles​(java.lang.String physicalname, TCType type, java.lang.String resourceid, java.util.List profiles)
      Delete a list of profiles or all the profiles associated with a pfn on a resource and of a type.
      private boolean deleteProfile​(Profile p, long id, boolean pfn)
      Delete a given lfn or pfn profile
      java.util.List<TransformationCatalogEntry> getContents()
      List all the contents of the TC
      java.lang.String getDescription()
      Returns the TC implementation being used
      static TransformationCatalog getInstance()
      Deprecated. 
      private long getLogicalId​(java.lang.String namespace, java.lang.String name, java.lang.String version)
      Returns the id associated with the logical transformation.
      private long getPhysicalId​(java.lang.String pfn, TCType type, java.lang.String resourceid)
      Returns the id of the physical transformation
      private long[] getPhysicalIds​(java.lang.String pfn, TCType type, java.lang.String resourceid)
      Returns a list of pfnid for a given pfn on any resource, and of any type.
      private long getSysInfoId​(VDSSysInfo system)
      Gets the id for the system information entry.
      java.util.List<java.lang.String[]> getTCLogicalNames​(java.lang.String resourceid, TCType type)
      Get the list of LogicalNames available on a particular resource.
      void initialize​(PegasusBag bag)
      Initialize the implementation, and return an instance of the implementation.
      int insert​(TransformationCatalogEntry entry)
      Add single TCEntry to the Catalog.
      int insert​(TransformationCatalogEntry entry, boolean write)
      Add single TCEntry object temporarily to the in memory Catalog.
      int insert​(java.lang.String namespace, java.lang.String name, java.lang.String version, java.lang.String physicalname, TCType type, java.lang.String resourceid, java.util.List lfnprofiles, java.util.List pfnprofiles, SysInfo system)
      Add an single entry into the transformation catalog.
      int insert​(java.util.List<TransformationCatalogEntry> tcentry)
      Add multiple TCEntries to the Catalog.
      boolean isClosed()
      Predicate to check, if the connection with the catalog's implementation is still active.
      java.util.List<TransformationCatalogEntry> lookup​(java.lang.String namespace, java.lang.String name, java.lang.String version, java.lang.String resourceid, TCType type)
      Returns TC entries for a particular logical transformation and/or on a particular resource and/or of a particular type.
      java.util.List<TransformationCatalogEntry> lookup​(java.lang.String namespace, java.lang.String name, java.lang.String version, java.util.List resourceids, TCType type)
      Returns TC entries for a particular logical transformation and/or on a number of resources and/or of a particular type.
      java.util.List<Profile> lookupLFNProfiles​(java.lang.String namespace, java.lang.String name, java.lang.String version)
      Get the list of Profiles associated with a particular logical transformation.
      java.util.List<TransformationCatalogEntry> lookupNoProfiles​(java.lang.String namespace, java.lang.String name, java.lang.String version, java.lang.String resourceid, TCType type)
      Get the list of PhysicalNames for a particular transformation on a site/sites for a particular type/types;
      java.util.List<Profile> lookupPFNProfiles​(java.lang.String pfn, java.lang.String resourceid, TCType type)
      Get the list of Profiles associated with a particular physical transformation.
      java.util.List<java.lang.String> lookupSites​(java.lang.String namespace, java.lang.String name, java.lang.String version, TCType type)
      Get the list of Resource ID's where a particular transformation may reside.
      int removeByLFN​(java.lang.String namespace, java.lang.String name, java.lang.String version, java.lang.String resourceid, TCType type)
      Delete all entries in the transformation catalog for a give logical transformation and/or on a resource and/or of a particular type
      int removeByPFN​(java.lang.String physicalname, java.lang.String namespace, java.lang.String name, java.lang.String version, java.lang.String resourceid, TCType type)
      Delete all entries in the transformation catalog for pair of logical and physical transformation.
      int removeBySiteID​(java.lang.String resourceid)
      Delete all entries on a particular resource from the transformation catalog.
      int removeBySysInfo​(SysInfo sysinfo)
      Deletes entries from the catalog which have a particular system information.
      int removeByType​(TCType type, java.lang.String resourceid)
      Delete a particular type of transformation, and/or on a particular resource
      • Methods inherited from class org.griphyn.vdl.dbschema.DatabaseSchema

        cachingMakesSense, finalize, loadSchema, loadSchema, longOrNull, makeNotNull, stringOrNull
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mLogger

        protected static LogManager mLogger
        The LogManager object which is used to log all the messages. It's values are set in the CPlanner class.
      • mDatabaseTC

        private static Database mDatabaseTC
      • modifyURL

        private boolean modifyURL
        Boolean indicating whether to modify the file URL or not
    • Constructor Detail

      • Database

        public Database()
                 throws java.lang.ClassNotFoundException,
                        java.lang.NoSuchMethodException,
                        java.lang.InstantiationException,
                        java.lang.IllegalAccessException,
                        java.lang.reflect.InvocationTargetException,
                        java.sql.SQLException,
                        java.io.IOException
        Throws:
        java.lang.ClassNotFoundException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        java.sql.SQLException
        java.io.IOException
    • Method Detail

      • getInstance

        public static TransformationCatalog getInstance()
        Deprecated.
        Used for a singleton access to the implementation
        Returns:
        instance to TransformationCatalog.
      • initialize

        public void initialize​(PegasusBag bag)
        Initialize the implementation, and return an instance of the implementation.
        Specified by:
        initialize in interface TransformationCatalog
        Parameters:
        bag - the bag of Pegasus initialization objects.
      • lookup

        public java.util.List<TransformationCatalogEntry> lookup​(java.lang.String namespace,
                                                                 java.lang.String name,
                                                                 java.lang.String version,
                                                                 java.lang.String resourceid,
                                                                 TCType type)
                                                          throws java.lang.Exception
        Returns TC entries for a particular logical transformation and/or on a particular resource and/or of a particular type.
        Specified by:
        lookup in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the logical transformation.
        name - String the name of the logical transformation.
        version - String The version of the logical transformation.
        resourceid - String The resourceid where the transformation is located. If NULL it returns all resources.
        type - TCType The type of the transformation to search for. If NULL it returns all types.
        Returns:
        List Returns a list of TransformationCatalogEntry objects containing the corresponding entries from the TC. Returns null if no entry found.
        Throws:
        java.lang.Exception
        See Also:
        TCType, edu.isi.pegasus.planner.catalog.TransformationCatalogEntry
      • lookup

        public java.util.List<TransformationCatalogEntry> lookup​(java.lang.String namespace,
                                                                 java.lang.String name,
                                                                 java.lang.String version,
                                                                 java.util.List resourceids,
                                                                 TCType type)
                                                          throws java.lang.Exception
        Returns TC entries for a particular logical transformation and/or on a number of resources and/or of a particular type.
        Specified by:
        lookup in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the logical transformation.
        name - String the name of the logical transformation.
        version - String The version of the logical transformation.
        resourceids - List The List resourceid where the transformation is located. If NULL it returns all resources.
        type - TCType The type of the transformation to search for. If NULL it returns all types.
        Returns:
        List Returns a list of TransformationCatalogEntry objects containing the corresponding entries from the TC. Returns null if no entry found.
        Throws:
        java.lang.Exception
        See Also:
        TCType, edu.isi.pegasus.planner.catalog.TransformationCatalogEntry
      • getContents

        public java.util.List<TransformationCatalogEntry> getContents()
                                                               throws java.lang.Exception
        List all the contents of the TC
        Specified by:
        getContents in interface TransformationCatalog
        Returns:
        List Returns a List of TransformationCatalogEntry objects.
        Throws:
        java.lang.Exception
      • lookupSites

        public java.util.List<java.lang.String> lookupSites​(java.lang.String namespace,
                                                            java.lang.String name,
                                                            java.lang.String version,
                                                            TCType type)
                                                     throws java.lang.Exception
        Get the list of Resource ID's where a particular transformation may reside.
        Specified by:
        lookupSites in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the transformation to search for.
        name - String The name of the transformation to search for.
        version - String The version of the transformation to search for.
        type - TCType The type of the transformation to search for.
        (Enumerated type includes SOURCE, STATIC-BINARY, DYNAMIC-BINARY, PACMAN, INSTALLED, SCRIPT)
        If NULL it returns all types.
        Returns:
        List Returns a list of Resource Id's as strings. Returns NULL if no results found.
        Throws:
        java.lang.Exception - NotImplementedException if not implemented
        See Also:
        TCType
      • lookupNoProfiles

        public java.util.List<TransformationCatalogEntry> lookupNoProfiles​(java.lang.String namespace,
                                                                           java.lang.String name,
                                                                           java.lang.String version,
                                                                           java.lang.String resourceid,
                                                                           TCType type)
                                                                    throws java.lang.Exception
        Get the list of PhysicalNames for a particular transformation on a site/sites for a particular type/types;
        Specified by:
        lookupNoProfiles in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the transformation to search for.
        name - String The name of the transformation to search for.
        version - String The version of the transformation to search for.
        resourceid - String The id of the resource on which you want to search.
        If NULL then returns entries on all resources
        type - TCType The type of the transformation to search for.
        (Enumerated type includes source, binary, dynamic-binary, pacman, installed)
        If NULL then returns entries of all types.
        Returns:
        List Returns a List of objects with the profiles not populated.
        Throws:
        java.lang.Exception - NotImplementedException if not implemented.
        See Also:
        TCType
      • getTCLogicalNames

        public java.util.List<java.lang.String[]> getTCLogicalNames​(java.lang.String resourceid,
                                                                    TCType type)
                                                             throws java.lang.Exception
        Get the list of LogicalNames available on a particular resource.
        Specified by:
        getTCLogicalNames in interface TransformationCatalog
        Parameters:
        resourceid - String The id of the resource on which you want to search
        type - TCType The type of the transformation to search for.
        (Enumerated type includes stageable and installed)
        If NULL then return logical name for all types.
        Returns:
        List Returns a list of String Arrays. Each array contains the resourceid, logical transformation in the format namespace::name:version and type. Returns NULL if no results found.
        Throws:
        java.lang.Exception - NotImplementedException if not implemented.
      • lookupLFNProfiles

        public java.util.List<Profile> lookupLFNProfiles​(java.lang.String namespace,
                                                         java.lang.String name,
                                                         java.lang.String version)
                                                  throws java.lang.Exception
        Get the list of Profiles associated with a particular logical transformation.
        Specified by:
        lookupLFNProfiles in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the transformation to search for.
        name - String The name of the transformation to search for.
        version - String The version of the transformation to search for.
        Returns:
        List Returns a list of Profile Objects containing profiles associated with the transformation. Returns NULL if no profiles found.
        Throws:
        java.lang.Exception - NotImplementedException if not implemented.
        See Also:
        org.griphyn.cPlanner.classes.Profile
      • lookupPFNProfiles

        public java.util.List<Profile> lookupPFNProfiles​(java.lang.String pfn,
                                                         java.lang.String resourceid,
                                                         TCType type)
                                                  throws java.lang.Exception
        Get the list of Profiles associated with a particular physical transformation.
        Specified by:
        lookupPFNProfiles in interface TransformationCatalog
        Parameters:
        pfn - The physical file name to search the transformation by.
        resourceid - String The id of the resource on which you want to search.
        type - TCType The type of the transformation to search for.
        (Enumerated type includes source, binary, dynamic-binary, pacman, installed)
        Returns:
        List Returns a list of Profile Objects containing profiles associated with the transformation. Returns NULL if no profiles found.
        Throws:
        java.lang.Exception - NotImplementedException if not implemented.
        See Also:
        org.griphyn.cPlanner.classes.Profile
      • insert

        public int insert​(java.util.List<TransformationCatalogEntry> tcentry)
                   throws java.lang.Exception
        Add multiple TCEntries to the Catalog.
        Specified by:
        insert in interface TransformationCatalog
        Parameters:
        tcentry - List Takes a list of TransformationCatalogEntry objects as input
        Returns:
        number of insertions On failure,throw an exception, don't use zero.
        Throws:
        java.lang.Exception
        See Also:
        edu.isi.pegasus.planner.catalog.TransformationCatalogEntry
      • insert

        public int insert​(TransformationCatalogEntry entry)
                   throws java.lang.Exception
        Add single TCEntry to the Catalog.
        Specified by:
        insert in interface TransformationCatalog
        Parameters:
        tcentry - Takes a single TransformationCatalogEntry object as input
        Returns:
        number of insertions, should always be 1. On failure, throw an exception, don't use zero.
        Throws:
        java.lang.Exception
        See Also:
        edu.isi.pegasus.planner.catalog.TransformationCatalogEntry
      • insert

        public int insert​(TransformationCatalogEntry entry,
                          boolean write)
                   throws java.lang.Exception
        Add single TCEntry object temporarily to the in memory Catalog. This is a hack to get around for adding soft state entries to the TC
        Specified by:
        insert in interface TransformationCatalog
        Parameters:
        tcentry - Takes a single TransformationCatalogEntry object as input
        write - boolean enable write commits to backed catalog or not.
        Returns:
        number of insertions, should always be 1. On failure, throw an exception, don't use zero.
        Throws:
        java.lang.Exception
        See Also:
        edu.isi.pegasus.planner.catalog.TransformationCatalogEntry
      • insert

        public int insert​(java.lang.String namespace,
                          java.lang.String name,
                          java.lang.String version,
                          java.lang.String physicalname,
                          TCType type,
                          java.lang.String resourceid,
                          java.util.List lfnprofiles,
                          java.util.List pfnprofiles,
                          SysInfo system)
                   throws java.lang.Exception
        Add an single entry into the transformation catalog.
        Specified by:
        insert in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the transformation to be added (Can be null)
        name - String The name of the transformation to be added.
        version - String The version of the transformation to be added. (Can be null)
        physicalname - String The physical name/location of the transformation to be added.
        type - TCType The type of the physical transformation.
        resourceid - String The resource location id where the transformation is located.
        lfnprofiles - List The List of Profile objects associated with a Logical Transformation. (can be null)
        pfnprofiles - List The List of Profile objects associated with a Physical Transformation. (can be null)
        sysinfo - SysInfo The System information associated with a physical transformation.
        Returns:
        number of insertions, should always be 1. On failure, throw an exception, don't use zero.
        Throws:
        java.lang.Exception
        See Also:
        edu.isi.pegasus.planner.catalog.TransformationCatalogEntry, SysInfo, org.griphyn.cPlanner.classes.Profile
      • addTCEntry

        protected boolean addTCEntry​(java.lang.String namespace,
                                     java.lang.String name,
                                     java.lang.String version,
                                     java.lang.String physicalname,
                                     TCType type,
                                     java.lang.String resourceid,
                                     java.util.List lfnprofiles,
                                     java.util.List pfnprofiles,
                                     SysInfo system,
                                     Notifications invokes,
                                     boolean write)
                              throws java.lang.Exception
        Add an single entry into the transformation catalog.
        Parameters:
        namespace - String The namespace of the transformation to be added (Can be null)
        name - String The name of the transformation to be added.
        version - String The version of the transformation to be added. (Can be null)
        physicalname - String The physical name/location of the transformation to be added.
        type - TCType The type of the physical transformation.
        resourceid - String The resource location id where the transformation is located.
        lfnprofiles - List The List of Profile objects associated with a Logical Transformation. (can be null)
        pfnprofiles - List The List of Profile objects associated with a Physical Transformation. (can be null)
        system - SysInfo The System information associated with a physical transformation.
        invokes - the Notifications associated with the transformation.
        write - boolean to commit changes to the backend catalog
        Returns:
        boolean Returns true if succesfully added, returns false if error and throws exception.
        Throws:
        java.lang.Exception
        See Also:
        org.griphyn.common.catalog.TransformationCatalogEntry, SysInfo, org.griphyn.cPlanner.classes.Profile
      • addLFNProfile

        public int addLFNProfile​(java.lang.String namespace,
                                 java.lang.String name,
                                 java.lang.String version,
                                 java.util.List profiles)
                          throws java.lang.Exception
        Add additional profile to a logical transformation .
        Specified by:
        addLFNProfile in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the transformation to be added. (can be null)
        name - String The name of the transformation to be added.
        version - String The version of the transformation to be added. (can be null)
        profiles - List The List of Profile objects that are to be added to the transformation.
        Returns:
        number of insertions. On failure, throw an exception, don't use zero.
        Throws:
        java.lang.Exception
        See Also:
        org.griphyn.cPlanner.classes.Profile
      • addPFNProfile

        public int addPFNProfile​(java.lang.String pfn,
                                 TCType type,
                                 java.lang.String resourceid,
                                 java.util.List profiles)
                          throws java.lang.Exception
        Add additional profile to a physical transformation.
        Specified by:
        addPFNProfile in interface TransformationCatalog
        Parameters:
        pfn - String The physical name of the transformation
        type - TCType The type of transformation that the profile is associated with.
        resourcename - String The resource on which the physical transformation exists
        profiles - The List of Profile objects that are to be added to the transformation.
        Returns:
        number of insertions. On failure, throw an exception, don't use zero.
        Throws:
        java.lang.Exception
        See Also:
        org.griphyn.cPlanner.classes.Profile
      • removeByLFN

        public int removeByLFN​(java.lang.String namespace,
                               java.lang.String name,
                               java.lang.String version,
                               java.lang.String resourceid,
                               TCType type)
                        throws java.lang.Exception
        Delete all entries in the transformation catalog for a give logical transformation and/or on a resource and/or of a particular type
        Specified by:
        removeByLFN in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the transformation to be deleted. (can be null)
        name - String The name of the transformation to be deleted.
        version - String The version of the transformation to be deleted. ( can be null)
        resourceid - String The resource id for which the transformation is to be deleted. If NULL then transformation on all resource are deleted
        type - TCType The type of the transformation. If NULL then all types are deleted for the transformation.
        Returns:
        the number of removed entries.
        Throws:
        java.lang.Exception
        See Also:
        TCType
      • removeByPFN

        public int removeByPFN​(java.lang.String physicalname,
                               java.lang.String namespace,
                               java.lang.String name,
                               java.lang.String version,
                               java.lang.String resourceid,
                               TCType type)
                        throws java.lang.Exception
        Delete all entries in the transformation catalog for pair of logical and physical transformation.
        Specified by:
        removeByPFN in interface TransformationCatalog
        Parameters:
        physicalname - String The physical name of the transformation
        namespace - String The namespace associated in the logical name of the transformation.
        name - String The name of the logical transformation.
        version - String The version number of the logical transformation.
        resourceid - String The resource on which the transformation is to be deleted. If NULL then it searches all the resource id.
        type - TCType The type of transformation. If NULL then it search and deletes entries for all types.
        Returns:
        the number of removed entries.
        Throws:
        java.lang.Exception
        See Also:
        TCType
      • removeBySysInfo

        public int removeBySysInfo​(SysInfo sysinfo)
                            throws java.lang.Exception
        Deletes entries from the catalog which have a particular system information.
        Specified by:
        removeBySysInfo in interface TransformationCatalog
        Parameters:
        sysinfo - SysInfo The System Information by which you want to delete
        Returns:
        the number of removed entries.
        Throws:
        java.lang.Exception
        See Also:
        SysInfo
      • removeByType

        public int removeByType​(TCType type,
                                java.lang.String resourceid)
                         throws java.lang.Exception
        Delete a particular type of transformation, and/or on a particular resource
        Specified by:
        removeByType in interface TransformationCatalog
        Parameters:
        type - TCType The type of the transformation
        resourceid - String The resource on which the transformation exists. If NULL then that type of transformation is deleted from all the resources.
        Returns:
        the number of removed entries.
        Throws:
        java.lang.Exception
        See Also:
        TCType
      • removeBySiteID

        public int removeBySiteID​(java.lang.String resourceid)
                           throws java.lang.Exception
        Delete all entries on a particular resource from the transformation catalog.
        Specified by:
        removeBySiteID in interface TransformationCatalog
        Parameters:
        resourceid - String The resource which you want to remove.
        Returns:
        the number of removed entries.
        Throws:
        java.lang.Exception
      • clear

        public int clear()
                  throws java.lang.Exception
        Deletes the entire transformation catalog. CLEAN............. USE WITH CAUTION.
        Specified by:
        clear in interface TransformationCatalog
        Returns:
        the number of removed entries.
        Throws:
        java.lang.Exception
      • deletePFNProfiles

        public int deletePFNProfiles​(java.lang.String physicalname,
                                     TCType type,
                                     java.lang.String resourceid,
                                     java.util.List profiles)
                              throws java.lang.Exception
        Delete a list of profiles or all the profiles associated with a pfn on a resource and of a type.
        Specified by:
        deletePFNProfiles in interface TransformationCatalog
        Parameters:
        physicalname - String The physical name of the transformation.
        type - TCType The type of the transformation.
        resourceid - String The resource of the transformation.
        profiles - List The list of profiles to be deleted. If NULL then all profiles for that pfn+resource+type are deleted.
        Returns:
        the number of removed entries.
        Throws:
        java.lang.Exception
        See Also:
        org.griphyn.cPlanner.classes.Profile
      • deleteLFNProfiles

        public int deleteLFNProfiles​(java.lang.String namespace,
                                     java.lang.String name,
                                     java.lang.String version,
                                     java.util.List profiles)
                              throws java.lang.Exception
        Delete a list of profiles or all the profiles associated with a logical transformation.
        Specified by:
        deleteLFNProfiles in interface TransformationCatalog
        Parameters:
        namespace - String The namespace of the logical transformation.
        name - String The name of the logical transformation.
        version - String The version of the logical transformation.
        profiles - List The List of profiles to be deleted. If NULL then all profiles for the logical transformation are deleted.
        Returns:
        the number of removed entries.
        Throws:
        java.lang.Exception
        See Also:
        org.griphyn.cPlanner.classes.Profile
      • getDescription

        public java.lang.String getDescription()
        Returns the TC implementation being used
        Specified by:
        getDescription in interface TransformationCatalog
        Returns:
        String
      • close

        public void close()
        Description copied from class: org.griphyn.vdl.dbschema.DatabaseSchema
        Disassociate from the database driver before finishing. Mind that performing this action may throw NullPointerException in later stages!
        Specified by:
        close in interface Catalog
        Overrides:
        close in class org.griphyn.vdl.dbschema.DatabaseSchema
      • connect

        public boolean connect​(java.util.Properties props)
        Description copied from interface: Catalog
        Establishes a link between the implementation and the thing the implementation is build upon.

        FIXME: The cause for failure is lost without exceptions.

        Specified by:
        connect in interface Catalog
        Parameters:
        props - contains all necessary data to establish the link.
        Returns:
        true if connected now, or false to indicate a failure.
      • isClosed

        public boolean isClosed()
        Description copied from interface: Catalog
        Predicate to check, if the connection with the catalog's implementation is still active. This helps determining, if it makes sense to call close().
        Specified by:
        isClosed in interface Catalog
        Returns:
        true, if the implementation is disassociated, false otherwise.
        See Also:
        Catalog.close()
      • getLogicalId

        private long getLogicalId​(java.lang.String namespace,
                                  java.lang.String name,
                                  java.lang.String version)
                           throws java.lang.Exception
        Returns the id associated with the logical transformation.
        Parameters:
        namespace - String
        name - String
        version - String
        Returns:
        long Returns -1 if entry does not exist
        Throws:
        java.lang.Exception
      • checkLfnPfnMap

        private long checkLfnPfnMap​(long lfnid,
                                    long pfnid)
                             throws java.lang.Exception
        Checks if a lfn,pfn exist in the map.
        Parameters:
        lfnid - long
        pfnid - long
        Returns:
        long Returns 1 if exists, -1 if not exists
        Throws:
        java.lang.Exception
      • checkProfile

        private long checkProfile​(java.lang.String namespace,
                                  java.lang.String name,
                                  java.lang.String value,
                                  long id,
                                  boolean pfn)
                           throws java.lang.Exception
        Checks if a given profile exists
        Parameters:
        namespace - String
        name - String
        value - String
        id - long
        pfn - boolean
        Returns:
        long Returns 1 if exists , -1 if does not exist.
        Throws:
        java.lang.Exception
      • getSysInfoId

        private long getSysInfoId​(VDSSysInfo system)
                           throws java.lang.Exception
        Gets the id for the system information entry.
        Parameters:
        system - VDSSysInfo
        Returns:
        long Returns -1 if it does not exist
        Throws:
        java.lang.Exception
        See Also:
        org.griphyn.common.classes.VDSSysInfo
      • addSysInfo

        private long addSysInfo​(VDSSysInfo system)
                         throws java.lang.Exception
        Adds a system information entry into the TC.
        Parameters:
        system - VDSSysInfo
        Returns:
        boolean Returns true if success, false if error occurs.
        Throws:
        java.lang.Exception
      • addLogicalTr

        private long addLogicalTr​(java.lang.String namespace,
                                  java.lang.String name,
                                  java.lang.String version)
                           throws java.lang.Exception
        Adds a logical entry to the logicaltx table
        Parameters:
        namespace - String The namespace of the transformation
        name - String The name of the transformation
        version - String The version of the transformation
        Returns:
        long The position in table at which the entry is added. If there is an error -1 is returned.
        Throws:
        java.lang.Exception
      • addPhysicalTr

        private long addPhysicalTr​(java.lang.String physicalname,
                                   java.lang.String resourceid,
                                   TCType type,
                                   long archid)
                            throws java.lang.Exception
        Adds a physical entry to the physicaltxtable
        Parameters:
        physicalname - String The physical name of the transformation
        resourceid - String The resource on which the transformation exists
        type - TCType The type of the transformation
        archid - long The architecture id from the sysinfo table for the tr.
        Returns:
        long The position in the physicaltx table at which the entry is stored. If there is an error -1 is returned.
        Throws:
        java.lang.Exception
      • addProfile

        private boolean addProfile​(Profile p,
                                   long id,
                                   boolean pfn)
                            throws java.lang.Exception
        Add a lfn or pfn profile to the TC
        Parameters:
        p - Profile The profile to be added
        id - long The lfn or pfn id to which the profile is associated.
        pfn - boolean if true entry is added to the pfn, false to the lfn.
        Returns:
        boolean Returns true if success, false if error occurs.
        Throws:
        java.lang.Exception
      • deleteProfile

        private boolean deleteProfile​(Profile p,
                                      long id,
                                      boolean pfn)
                               throws java.lang.Exception
        Delete a given lfn or pfn profile
        Parameters:
        p - Profile The profile to be deleted
        id - long The lfn or pfnid with which the profile is associated
        pfn - boolean If true the pfn profile is deleted, if false lfn profile is deleted
        Returns:
        boolean Returns true if success, false if any error occurs.
        Throws:
        java.lang.Exception
      • getPhysicalId

        private long getPhysicalId​(java.lang.String pfn,
                                   TCType type,
                                   java.lang.String resourceid)
                            throws java.lang.Exception
        Returns the id of the physical transformation
        Parameters:
        pfn - String the physical transformation
        type - TCType The type of the transformation
        resourceid - String The resource on which the transformation exists.
        Returns:
        long Returns -1 if entry does not exist.
        Throws:
        java.lang.Exception
      • getPhysicalIds

        private long[] getPhysicalIds​(java.lang.String pfn,
                                      TCType type,
                                      java.lang.String resourceid)
                               throws java.lang.Exception
        Returns a list of pfnid for a given pfn on any resource, and of any type.
        Parameters:
        pfn - String The physical transformation to search for.
        type - TCType The type to search for. If NULL then all types are searched.
        resourceid - String The resource to search for. If NULL then all resources are searched.
        Returns:
        long[] Returns -1 is no entry exist.
        Throws:
        java.lang.Exception