edu.isi.pegasus.planner.catalog.transformation.impl
public class Database extends org.griphyn.vdl.dbschema.DatabaseSchema implements TransformationCatalog
| Modifier and Type | Field and Description |
|---|---|
private static Database |
mDatabaseTC |
protected static LogManager |
mLogger
The LogManager object which is
used to log all the messages.
|
private boolean |
modifyURL
Boolean indicating whether to modify the file URL or not
|
MODIFY_FOR_FILE_URLS_KEY, VERSIONDB_ALL_PREFIX| Constructor and Description |
|---|
Database() |
| Modifier and Type | Method and Description |
|---|---|
int |
addLFNProfile(String namespace,
String name,
String version,
List profiles)
Add additional profile to a logical transformation .
|
private long |
addLogicalTr(String namespace,
String name,
String version)
Adds a logical entry to the logicaltx table
|
int |
addPFNProfile(String pfn,
TCType type,
String resourceid,
List profiles)
Add additional profile to a physical transformation.
|
private long |
addPhysicalTr(String physicalname,
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(String namespace,
String name,
String version,
String physicalname,
TCType type,
String resourceid,
List lfnprofiles,
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(String namespace,
String name,
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(Properties props)
Establishes a link between the implementation and the thing the
implementation is build upon.
|
int |
deleteLFNProfiles(String namespace,
String name,
String version,
List profiles)
Delete a list of profiles or all the profiles associated with a logical
transformation.
|
int |
deletePFNProfiles(String physicalname,
TCType type,
String resourceid,
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
|
List<TransformationCatalogEntry> |
getContents()
List all the contents of the TC
|
String |
getDescription()
Returns the TC implementation being used
|
static TransformationCatalog |
getInstance()
Deprecated.
|
private long |
getLogicalId(String namespace,
String name,
String version)
Returns the id associated with the logical transformation.
|
private long |
getPhysicalId(String pfn,
TCType type,
String resourceid)
Returns the id of the physical transformation
|
private long[] |
getPhysicalIds(String pfn,
TCType type,
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.
|
List<String[]> |
getTCLogicalNames(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(List<TransformationCatalogEntry> tcentry)
Add multiple TCEntries to the Catalog.
|
int |
insert(String namespace,
String name,
String version,
String physicalname,
TCType type,
String resourceid,
List lfnprofiles,
List pfnprofiles,
SysInfo system)
Add an single entry into the transformation catalog.
|
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.
|
boolean |
isClosed()
Predicate to check, if the connection with the catalog's
implementation is still active.
|
List<TransformationCatalogEntry> |
lookup(String namespace,
String name,
String version,
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.
|
List<TransformationCatalogEntry> |
lookup(String namespace,
String name,
String version,
String resourceid,
TCType type)
Returns TC entries for a particular logical transformation and/or on a
particular resource and/or of a particular type.
|
List<Profile> |
lookupLFNProfiles(String namespace,
String name,
String version)
Get the list of Profiles associated with a particular logical transformation.
|
List<TransformationCatalogEntry> |
lookupNoProfiles(String namespace,
String name,
String version,
String resourceid,
TCType type)
Get the list of PhysicalNames for a particular transformation on a site/sites
for a particular type/types;
|
List<Profile> |
lookupPFNProfiles(String pfn,
String resourceid,
TCType type)
Get the list of Profiles associated with a particular physical transformation.
|
List<String> |
lookupSites(String namespace,
String name,
String version,
TCType type)
Get the list of Resource ID's where a particular transformation may reside.
|
int |
removeByLFN(String namespace,
String name,
String version,
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(String physicalname,
String namespace,
String name,
String version,
String resourceid,
TCType type)
Delete all entries in the transformation catalog for pair of logical and physical transformation.
|
int |
removeBySiteID(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,
String resourceid)
Delete a particular type of transformation, and/or on a particular resource
|
protected static LogManager mLogger
private static Database mDatabaseTC
private boolean modifyURL
public Database()
throws ClassNotFoundException,
NoSuchMethodException,
InstantiationException,
IllegalAccessException,
InvocationTargetException,
SQLException,
IOException
public static TransformationCatalog getInstance()
public void initialize(PegasusBag bag)
initialize in interface TransformationCatalogbag - the bag of Pegasus initialization objects.public List<TransformationCatalogEntry> lookup(String namespace, String name, String version, String resourceid, TCType type) throws Exception
lookup in interface TransformationCatalognamespace - 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.ExceptionTCType,
edu.isi.pegasus.planner.catalog.TransformationCatalogEntrypublic List<TransformationCatalogEntry> lookup(String namespace, String name, String version, List resourceids, TCType type) throws Exception
lookup in interface TransformationCatalognamespace - 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.ExceptionTCType,
edu.isi.pegasus.planner.catalog.TransformationCatalogEntrypublic List<TransformationCatalogEntry> getContents() throws Exception
getContents in interface TransformationCatalogExceptionpublic List<String> lookupSites(String namespace, String name, String version, TCType type) throws Exception
lookupSites in interface TransformationCatalognamespace - 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.Exception - NotImplementedException if not implementedTCTypepublic List<TransformationCatalogEntry> lookupNoProfiles(String namespace, String name, String version, String resourceid, TCType type) throws Exception
lookupNoProfiles in interface TransformationCatalognamespace - 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. type - TCType The type of the transformation to search for. Exception - NotImplementedException if not implemented.TCTypepublic List<String[]> getTCLogicalNames(String resourceid, TCType type) throws Exception
getTCLogicalNames in interface TransformationCatalogresourceid - String The id of the resource on which you want to searchtype - TCType The type of the transformation to search for. Exception - NotImplementedException if not implemented.public List<Profile> lookupLFNProfiles(String namespace, String name, String version) throws Exception
lookupLFNProfiles in interface TransformationCatalognamespace - 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.Exception - NotImplementedException if not implemented.org.griphyn.cPlanner.classes.Profilepublic List<Profile> lookupPFNProfiles(String pfn, String resourceid, TCType type) throws Exception
lookupPFNProfiles in interface TransformationCatalogpfn - 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. Exception - NotImplementedException if not implemented.org.griphyn.cPlanner.classes.Profilepublic int insert(List<TransformationCatalogEntry> tcentry) throws Exception
insert in interface TransformationCatalogtcentry - List Takes a list of TransformationCatalogEntry objects as inputExceptionedu.isi.pegasus.planner.catalog.TransformationCatalogEntrypublic int insert(TransformationCatalogEntry entry) throws Exception
insert in interface TransformationCatalogtcentry - Takes a single TransformationCatalogEntry object as inputExceptionedu.isi.pegasus.planner.catalog.TransformationCatalogEntrypublic int insert(TransformationCatalogEntry entry, boolean write) throws Exception
insert in interface TransformationCatalogtcentry - Takes a single TransformationCatalogEntry object as inputwrite - boolean enable write commits to backed catalog or not.Exceptionedu.isi.pegasus.planner.catalog.TransformationCatalogEntrypublic int insert(String namespace, String name, String version, String physicalname, TCType type, String resourceid, List lfnprofiles, List pfnprofiles, SysInfo system) throws Exception
insert in interface TransformationCatalognamespace - 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.Exceptionedu.isi.pegasus.planner.catalog.TransformationCatalogEntry,
SysInfo,
org.griphyn.cPlanner.classes.Profileprotected boolean addTCEntry(String namespace, String name, String version, String physicalname, TCType type, String resourceid, List lfnprofiles, List pfnprofiles, SysInfo system, Notifications invokes, boolean write) throws Exception
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 catalogExceptionorg.griphyn.common.catalog.TransformationCatalogEntry,
SysInfo,
org.griphyn.cPlanner.classes.Profilepublic int addLFNProfile(String namespace, String name, String version, List profiles) throws Exception
addLFNProfile in interface TransformationCatalognamespace - 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.Exceptionorg.griphyn.cPlanner.classes.Profilepublic int addPFNProfile(String pfn, TCType type, String resourceid, List profiles) throws Exception
addPFNProfile in interface TransformationCatalogpfn - String The physical name of the transformationtype - TCType The type of transformation that the profile is
associated with.resourcename - String The resource on which the physical transformation existsprofiles - The List of Profile objects that are to be added
to the transformation.Exceptionorg.griphyn.cPlanner.classes.Profilepublic int removeByLFN(String namespace, String name, String version, String resourceid, TCType type) throws Exception
removeByLFN in interface TransformationCatalognamespace - 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 deletedtype - TCType The type of the transformation. If NULL then all types are deleted for the transformation.ExceptionTCTypepublic int removeByPFN(String physicalname, String namespace, String name, String version, String resourceid, TCType type) throws Exception
removeByPFN in interface TransformationCatalogphysicalname - String The physical name of the transformationnamespace - 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.ExceptionTCTypepublic int removeBySysInfo(SysInfo sysinfo) throws Exception
removeBySysInfo in interface TransformationCatalogsysinfo - SysInfo The System Information by which you want to deleteExceptionSysInfopublic int removeByType(TCType type, String resourceid) throws Exception
removeByType in interface TransformationCatalogtype - TCType The type of the transformationresourceid - String The resource on which the transformation exists.
If NULL then that type of transformation is deleted from all the resources.ExceptionTCTypepublic int removeBySiteID(String resourceid) throws Exception
removeBySiteID in interface TransformationCatalogresourceid - String The resource which you want to remove.Exceptionpublic int clear()
throws Exception
clear in interface TransformationCatalogExceptionpublic int deletePFNProfiles(String physicalname, TCType type, String resourceid, List profiles) throws Exception
deletePFNProfiles in interface TransformationCatalogphysicalname - 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.Exceptionorg.griphyn.cPlanner.classes.Profilepublic int deleteLFNProfiles(String namespace, String name, String version, List profiles) throws Exception
deleteLFNProfiles in interface TransformationCatalognamespace - 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.Exceptionorg.griphyn.cPlanner.classes.Profilepublic String getDescription()
getDescription in interface TransformationCatalogpublic void close()
org.griphyn.vdl.dbschema.DatabaseSchemaclose in class org.griphyn.vdl.dbschema.DatabaseSchemapublic boolean connect(Properties props)
CatalogFIXME: The cause for failure is lost without exceptions.
props - contains all necessary data to establish the link.public boolean isClosed()
Catalogclose().Catalog.close()private long getLogicalId(String namespace, String name, String version) throws Exception
namespace - Stringname - Stringversion - StringExceptionprivate long checkLfnPfnMap(long lfnid,
long pfnid)
throws Exception
lfnid - longpfnid - longExceptionprivate long checkProfile(String namespace, String name, String value, long id, boolean pfn) throws Exception
namespace - Stringname - Stringvalue - Stringid - longpfn - booleanExceptionprivate long getSysInfoId(VDSSysInfo system) throws Exception
system - VDSSysInfoExceptionorg.griphyn.common.classes.VDSSysInfoprivate long addSysInfo(VDSSysInfo system) throws Exception
system - VDSSysInfoExceptionprivate long addLogicalTr(String namespace, String name, String version) throws Exception
namespace - String The namespace of the transformationname - String The name of the transformationversion - String The version of the transformationExceptionprivate long addPhysicalTr(String physicalname, String resourceid, TCType type, long archid) throws Exception
physicalname - String The physical name of the transformationresourceid - String The resource on which the transformation existstype - TCType The type of the transformationarchid - long The architecture id from the sysinfo table for the tr.Exceptionprivate boolean addProfile(Profile p, long id, boolean pfn) throws Exception
p - Profile The profile to be addedid - 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.Exceptionprivate boolean deleteProfile(Profile p, long id, boolean pfn) throws Exception
p - Profile The profile to be deletedid - long The lfn or pfnid with which the profile is associatedpfn - boolean If true the pfn profile is deleted, if false lfn profile is deletedExceptionprivate long getPhysicalId(String pfn, TCType type, String resourceid) throws Exception
pfn - String the physical transformationtype - TCType The type of the transformationresourceid - String The resource on which the transformation exists.Exceptionprivate long[] getPhysicalIds(String pfn, TCType type, String resourceid) throws Exception
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.Exception