net.kwfgrid.gwes
Class XMLDB

java.lang.Object
  extended by net.kwfgrid.gwes.XMLDB

public class XMLDB
extends Object

Singleton pattern. Assumes that workflows and resources are in the same eXist database.

Version:
$Id: XMLDB.java 1540 2011-08-17 13:30:37Z hoheisel $
Author:
Andreas Hoheisel (www.andreas-hoheisel.de), Dietmar Sommerfeld / GWDG (part of quality calculation)

Method Summary
protected  String connectAdmin()
          Used by the XMLDBSessionManager.
protected  String connectQuery()
          Used by the XMLDBSessionManager.
protected  void disconnectAdmin(String sessionId)
          Used by the XMLDBSessionManager.
protected  void disconnectQuery(String sessionId)
          Used by the XMLDBSessionManager.
 String[] getAvailableResources(String ofClass)
          Get a list of all available resources.
 String[] getCheckpoints(String workflowID)
           
 String[] getData(String workflowID, String placeID)
           
 String getDescription(String workflowID)
           
 String getEarliestWorkflowXML(String workflowID)
           
 String[] getFaultToleranceStatistics()
           
static XMLDB getFirstInstance(String xmldbUrl, String user, String password)
          Create a new xmldb instance with url, username and password.
 ActivityDescription getGRAMActivityDescription(net.kwfgrid.gworkflowdl.structure.OperationCandidate op)
          Lookup GRAM activity description for specific hardware/software.
 float getHardwareQuality(String resourceUri)
           
static XMLDB getInstance()
          Get the xmldb instance or create a new one if null.
 String getLatestWorkflowDocument(String collectionStr)
           
 String getLatestWorkflowXML(String workflowID)
           
 String[][] getProperties(String workflowID)
           
 String getProperty(String workflowID, String name)
           
 String getResourceDescription(String resourceUri)
           
 DistributionSet getResourceDurationStatistics(String operationName, String resourceName)
           
 String getSpecificWorkflowXML(String resourcePath)
           
 int getStatus(String workflowID)
           
 String[] getTemporaryWorkflowDirectories(String workflowID)
           
 String[] getWorkflowIDs()
           
 String[] getWorkflowStatistics()
           
 Map<String,String[]> getWorkflowStatusMap()
           
 String getWSActivityDescription(net.kwfgrid.gworkflowdl.structure.OperationCandidate op)
          Lookup WS activity description for specific WSOperation.
 void incrementResourceScore(String resourceUri, int increment)
          Increment or decrement the score of a resource.
 String lookupManagedJobFactoryService(String resourceUri)
           
 void removeWorkflow(String workflowID)
           
 void setDescription(String workflowID, String description)
           
 void setProperty(String workflowID, String name, String value)
           
 void storeTemporaryWorkflowDirectory(String resourceUri, String host, String directory, String workflowID, String activityID)
           
 void storeTokenData(String workflowID, String placeID, net.kwfgrid.gworkflowdl.structure.Token token, String[] owls)
          Store a data token in the XML database.
 String storeWorkflow(net.kwfgrid.gworkflowdl.structure.Workflow workflow)
           
 void updateResourceDurationStatistics(String operationName, String resourceName, DistributionSet distSet)
           
 QueryServiceStub.QueryResponse xQueryResponse(String xquery)
           
 String[] xQueryResult(String xquery)
           
 String xQueryResult0(String xquery)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static XMLDB getInstance()
                         throws DatabaseException
Get the xmldb instance or create a new one if null.

Returns:
The current XMLDB instance or null if there an exception occurs.
Throws:
DatabaseException

getFirstInstance

public static XMLDB getFirstInstance(String xmldbUrl,
                                     String user,
                                     String password)
                              throws DatabaseException
Create a new xmldb instance with url, username and password.

Returns:
The XMLDB instance.
Throws:
DatabaseException

connectQuery

protected String connectQuery()
                       throws DatabaseException
Used by the XMLDBSessionManager.

Returns:
query session ID.
Throws:
DatabaseException

disconnectQuery

protected void disconnectQuery(String sessionId)
                        throws DatabaseException
Used by the XMLDBSessionManager.

Parameters:
sessionId -
Throws:
DatabaseException

connectAdmin

protected String connectAdmin()
                       throws DatabaseException
Used by the XMLDBSessionManager.

Returns:
admin session ID.
Throws:
DatabaseException

disconnectAdmin

protected void disconnectAdmin(String sessionId)
                        throws DatabaseException
Used by the XMLDBSessionManager.

Parameters:
sessionId -
Throws:
DatabaseException

xQueryResult

public String[] xQueryResult(String xquery)
                      throws DatabaseException
Throws:
DatabaseException

xQueryResult0

public String xQueryResult0(String xquery)
                     throws DatabaseException
Throws:
DatabaseException

xQueryResponse

public QueryServiceStub.QueryResponse xQueryResponse(String xquery)
                                              throws DatabaseException
Throws:
DatabaseException

storeWorkflow

public String storeWorkflow(net.kwfgrid.gworkflowdl.structure.Workflow workflow)
                     throws DatabaseException
Throws:
DatabaseException

getStatus

public int getStatus(String workflowID)
              throws DatabaseException,
                     NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

getCheckpoints

public String[] getCheckpoints(String workflowID)
                        throws DatabaseException
Throws:
DatabaseException

getSpecificWorkflowXML

public String getSpecificWorkflowXML(String resourcePath)
                              throws DatabaseException
Throws:
DatabaseException

getLatestWorkflowXML

public String getLatestWorkflowXML(String workflowID)
                            throws DatabaseException,
                                   NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

getEarliestWorkflowXML

public String getEarliestWorkflowXML(String workflowID)
                              throws DatabaseException
Throws:
DatabaseException

storeTokenData

public void storeTokenData(String workflowID,
                           String placeID,
                           net.kwfgrid.gworkflowdl.structure.Token token,
                           String[] owls)
                    throws DatabaseException
Store a data token in the XML database.

Parameters:
workflowID -
placeID -
token -
owls -
Throws:
DatabaseException

getWSActivityDescription

public String getWSActivityDescription(net.kwfgrid.gworkflowdl.structure.OperationCandidate op)
                                throws DatabaseException
Lookup WS activity description for specific WSOperation.

Parameters:
op -
Returns:
Throws:
DatabaseException

getGRAMActivityDescription

public ActivityDescription getGRAMActivityDescription(net.kwfgrid.gworkflowdl.structure.OperationCandidate op)
                                               throws DatabaseException
Lookup GRAM activity description for specific hardware/software.

Parameters:
op -
Returns:
Throws:
DatabaseException

lookupManagedJobFactoryService

public String lookupManagedJobFactoryService(String resourceUri)
                                      throws DatabaseException
Throws:
DatabaseException

getWorkflowStatistics

public String[] getWorkflowStatistics()
                               throws DatabaseException
Throws:
DatabaseException

getHardwareQuality

public float getHardwareQuality(String resourceUri)
                         throws DatabaseException
Throws:
DatabaseException

incrementResourceScore

public void incrementResourceScore(String resourceUri,
                                   int increment)
                            throws DatabaseException
Increment or decrement the score of a resource.

Parameters:
resourceUri - The URI of the resource.
increment - can be positive to increase or negative to decrease the score.
Throws:
DatabaseException

getResourceDurationStatistics

public DistributionSet getResourceDurationStatistics(String operationName,
                                                     String resourceName)
                                              throws DatabaseException
Throws:
DatabaseException

updateResourceDurationStatistics

public void updateResourceDurationStatistics(String operationName,
                                             String resourceName,
                                             DistributionSet distSet)
                                      throws DatabaseException
Throws:
DatabaseException

storeTemporaryWorkflowDirectory

public void storeTemporaryWorkflowDirectory(String resourceUri,
                                            String host,
                                            String directory,
                                            String workflowID,
                                            String activityID)
                                     throws DatabaseException
Throws:
DatabaseException

getTemporaryWorkflowDirectories

public String[] getTemporaryWorkflowDirectories(String workflowID)
                                         throws DatabaseException
Throws:
DatabaseException

removeWorkflow

public void removeWorkflow(String workflowID)
                    throws DatabaseException,
                           NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

getWorkflowIDs

public String[] getWorkflowIDs()
                        throws DatabaseException
Throws:
DatabaseException

getData

public String[] getData(String workflowID,
                        String placeID)
                 throws DatabaseException,
                        NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

getWorkflowStatusMap

public Map<String,String[]> getWorkflowStatusMap()
                                          throws DatabaseException
Throws:
DatabaseException

getDescription

public String getDescription(String workflowID)
                      throws DatabaseException,
                             NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

setDescription

public void setDescription(String workflowID,
                           String description)
                    throws DatabaseException,
                           NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

setProperty

public void setProperty(String workflowID,
                        String name,
                        String value)
                 throws DatabaseException,
                        NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

getProperty

public String getProperty(String workflowID,
                          String name)
                   throws DatabaseException,
                          NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

getProperties

public String[][] getProperties(String workflowID)
                         throws DatabaseException,
                                NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

getFaultToleranceStatistics

public String[] getFaultToleranceStatistics()
                                     throws DatabaseException,
                                            NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException

getAvailableResources

public String[] getAvailableResources(String ofClass)
                               throws DatabaseException
Get a list of all available resources. The information is returned in an Array of XML Strings: Example:
 String[] resources = getAvailableResources("urn:dgrdl:software");
 resources[0]=
 <resource>
   <uri>software:cat-fhrg</uri>                     // Operation URI
   <classUri>urn:dgrdl:software:cat</classUri>      // Operation Class URI (workflow: operationClass name="...")
   <name>cat</name>                                 // Operation Name
   <description>Program that concatenates two files<description> // Operation Description
 </resource>
 

Parameters:
ofClass - The class which this resource should be part of. This method only checkes whether the class starts with the given ofClass parameter, e.g., "urn:dgrdl:software" would match both classes: "urn:dgrdl:software:A" as well as "urn:dgrdl:software:B". If ofClass is null then all classes of resources are returned.
Returns:
The list of resources of a certain class as array of XML strings.
Throws:
DatabaseException

getResourceDescription

public String getResourceDescription(String resourceUri)
                              throws DatabaseException
Throws:
DatabaseException

getLatestWorkflowDocument

public String getLatestWorkflowDocument(String collectionStr)
                                 throws DatabaseException,
                                        NoSuchWorkflowException
Throws:
DatabaseException
NoSuchWorkflowException


Copyright © 2005-2011 Fraunhofer FIRST. All Rights Reserved.