edu.isi.pegasus.planner.catalog

## Interface TransformationCatalog

All Superinterfaces:
  Catalog

All Known Implementing Classes:
  Abstract, Database, File, Text

    public interface TransformationCatalog
    extends Catalog

This class is an interface to the various TxCatalog implementations that Pegasus will use. It defines the basic functionality for interfacing with various transformation Catalogs It defines api's for the querying, adding and deleting transformation and associated mappings from the implementing Tx Catalog By implementing this inteface a user can easily use his own TX Catalog with Pegasus.

Version:
  $Revision$
Author:
  Gaurang Mehta, Karan Vahi

### Field Summary

Fields
`static java.lang.String` `MODIFY_FOR_FILE_URLS_KEY` Property specify whether to modify file url or not.
`static java.lang.String` `VERSION` The version of the API

### Fields inherited from interface edu.isi.pegasus.planner.catalog.Catalog

`DB_ALL_PREFIX`

### Method Summary

All Methods Instance Methods Abstract Methods
`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 .
`int` `addPFNProfile(java.lang.String pfn, TCType type, java.lang.String resourcename, java.util.List profiles)` Add additional profile to a physical transformation.
`int` `clear()` Deletes the entire transformation catalog.
`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.
`java.util.List<TransformationCatalogEntry>` `getContents()` List all the contents of the TC
`java.lang.String` `getDescription()` Returns the TC implementation being used
`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(java.util.List<TransformationCatalogEntry> tcentry)` Add multiple TCEntries to the 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 sysinfo)` Add an single entry into the transformation catalog.
`int` `insert(TransformationCatalogEntry tcentry)` Add single TCEntry to the Catalog.
`int` `insert(TransformationCatalogEntry tcentry, boolean write)` Add single TCEntry object temporarily to the in memory Catalog.
`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<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<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 interface edu.isi.pegasus.planner.catalog.Catalog

`close, connect, isClosed`

### Field Detail

#### VERSION

    static final java.lang.String VERSION

The version of the API

See Also:
  Constant Field Values

#### MODIFY_FOR_FILE_URLS_KEY

    static final java.lang.String MODIFY_FOR_FILE_URLS_KEY

Property specify whether to modify file url or not.

See Also:
  Constant Field Values

### Method Detail

#### initialize

    void initialize(PegasusBag bag)

Initialize the implementation, and return an instance of the implementation.

Parameters:
  `bag` - the bag of Pegasus initialization objects.

#### lookup

    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.

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

    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.

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`

#### lookupSites

    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.

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

    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;

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 <TransformationCatalongEntry> objects with the profiles not populated.
Throws:
  `java.lang.Exception` - NotImplementedException if not implemented.
See Also:
  `TCType`

#### getTCLogicalNames

    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.

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 source, binary, dynamic-binary, pacman, 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

    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.

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 assocaited 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

    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.

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 assocaited with the transformation. Returns NULL if no profiless found.
Throws:
  `java.lang.Exception` - NotImplementedException if not implemented.
See Also:
  `org.griphyn.cPlanner.classes.Profile`

#### getContents

    java.util.List<TransformationCatalogEntry> getContents()
                                                    throws java.lang.Exception

List all the contents of the TC

Returns:
  List Returns a List of TransformationCatalogEntry objects.
Throws:
  `java.lang.Exception`

#### insert

    int insert(java.util.List<TransformationCatalogEntry> tcentry)
        throws java.lang.Exception

Add multiple TCEntries to the Catalog.

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

    int insert(TransformationCatalogEntry tcentry)
        throws java.lang.Exception

Add single TCEntry to the Catalog.

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

    int insert(TransformationCatalogEntry tcentry,
               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

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

    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 sysinfo)
        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)
  `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`

#### addLFNProfile

    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 .

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

    int addPFNProfile(java.lang.String pfn,
                      TCType type,
                      java.lang.String resourcename,
                      java.util.List profiles)
               throws java.lang.Exception

Add additional profile to a physical transformation.

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

    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

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

    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.

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`

#### removeByType

    int removeByType(TCType type,
                     java.lang.String resourceid)
              throws java.lang.Exception

Delete a particular type of transformation, and/or on a particular resource

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

    int removeBySiteID(java.lang.String resourceid)
                throws java.lang.Exception

Delete all entries on a particular resource from the transformation catalog.

Parameters:
  `resourceid` - String The resource which you want to remove.
Returns:
  the number of removed entries.
Throws:
  `java.lang.Exception`

#### removeBySysInfo

    int removeBySysInfo(SysInfo sysinfo)
                 throws java.lang.Exception

Deletes entries from the catalog which have a particular system information.

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`

#### clear

    int clear()
       throws java.lang.Exception

Deletes the entire transformation catalog. CLEAN............. USE WITH CAUTION.

Returns:
  the number of removed entries.
Throws:
  `java.lang.Exception`

#### deletePFNProfiles

    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.

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

    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.

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

    java.lang.String getDescription()

Returns the TC implementation being used

Returns:
  String