uk.ac.soton.itinnovation.grid.service.job
Class JobServiceModule

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
      extended by uk.ac.soton.itinnovation.grid.service.job.JobServiceModule
All Implemented Interfaces:
DataEventListener, JobResource, JobService, JobServiceSOAP, ManagedGridService, ReportAPI, WebAdmin, WSResourceLifetime, WSRFService, Cleanable, GridService, PolicyManagement, ResourceMetadata, Signallable

public class JobServiceModule
extends GridServiceLite
implements JobServiceSOAP, Cleanable, DataEventListener


Field Summary
static String JOB_SERVICE_RESOURCE_TYPE
           
 
Fields inherited from class uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
management, NO_ACCOUNT_NEEDED, pdp, thisServiceAddress
 
Fields inherited from interface uk.ac.soton.itinnovation.grid.comms.job.JobResource
JOB_RESOURCE_TYPE
 
Fields inherited from interface uk.ac.soton.itinnovation.grid.comms.management.ManagedGridService
FREE_SERVICE
 
Constructor Summary
JobServiceModule()
           
 
Method Summary
 void cancelJob()
          Cancel a job that has been started.
 void cancelJobLocal(String resourceID)
           
protected  void checkContinueActivity(Job job, JobDescription jobDescription)
          Checks with SLA service that continuing a job activity is possible.
 JobStatus checkJob()
          Check the current status of a job.
 JobStatus checkJobInternal(String conversationID)
          Used by web admin tool.
 void clean()
          Called by the cleanup processing thread in order to do any specialised garbage collection on the implementing class.
 JobStatus createJob(String applicationURI, MatchRule owner)
          Deprecated.  
 Document createJobJSDL(Document jsdl, MatchPattern owner)
          Create a new job.
 void dataStagerAddCumulativeUsageReport(DataStagerManager manager, Metric metric, double value)
          Called when a data stager generates a cumulative usage report such as an update in the amount of data transfer used.
 void dataStagerContinueActivity(DataStagerManager manager, org.apache.axis.message.addressing.EndpointReferenceType stagerEPR, Constraint[] constraints)
          Called when a data stager makes a continueActivity request.
 void dataStagerInstantaneousUsageChanged(DataStagerManager manager, Metric metric)
          Called when a data stager generates an instantaneous usage report.
 void dataStagerStartActivity(DataStagerManager manager, Constraint[] constraints, UsageReport[] usageReports)
          Called when a data stager makes a startActivity request.
 void destroy()
          WSResource lifetime destroy For a job this is implemented by requesting cancelJob() followed by finishJob().
 void destroyLocal(String resourceId)
          Called by web admin interface
 void ensurePoliciesDeployed()
          Ensure that any required PBAC policies are deployed.
 void finishJob()
          Finish the job conversation.
 void finishJobLocal(String resourceID)
           
protected  org.apache.axis.message.addressing.EndpointReferenceType generateEPR(GridResource bean)
          Generate an EPR from a resource's bean.
 Application getApplication(org.hibernate.Session session, String applicationURI)
           
 Application getApplication(String applicationURI)
           
 Document getApplicationDescription(String applicationURI)
          Get the 5.1 style meta-data for a particular application.
 Document getApplicationMetadata(String applicationURI)
          Get the meta-data for a particular application.
 Document getApplicationMetadataDetailed(String applicationURI)
          Get the 5.2 style meta-data for a particular application.
 String[] getApplications()
          List the applications available on this service.
 Document getAtomFeed(String atomFeed, String serviceBase)
          Return notices from the service as an Atom feed.
 Job getJob(org.hibernate.Session session, String resourceID)
           
 Job getJob(String resourceID)
           
 String getJSDL()
          Retrieves the original JSDL Document used to create the job
 NotificationMessage[] getMessages()
          Returns all usage messages
 NotificationMessage[] getMessagesN(int MaximumNumber)
          Returns usage messages
 List<RMConnectorPlugin> getResourceManagerList()
           
 org.apache.axis.message.addressing.EndpointReferenceType[] getResources()
          List the resources managed by this service for which the caller has some role.
protected  Class<? extends GridResource> getResourceType(String resourceID)
          Return the class of this resource's bean.
 boolean isConfigured()
           
 void reloadConfiguration()
          Reload the configuration.
 void startJob(String[] args)
          Deprecated.  
 void submitJob(Document jobConstraints, String[] args)
          Deprecated.  
 void submitJobJSDL()
          Submit the job (already defined by a JSDL document) to the queue, via the platform scripts.
 
Methods inherited from class uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
addHibernatedObject, addPolicyRule, addTrustedAccountService, deleteHibernatedObject, getAvailableSignals, getConversationFromContext, getCurrentUser, getEPR, getEPR, getManagingConversation, getPolicyRules, getPrivateKey, getResourceFromEPR, GetResourceProperty, getResources, getResources, getResourcesFromEPRs, getServiceFromEPR, getServiceProviderCertificate, getServiceProviderID, getServiceProviderIssuer, getTrustedAccountServices, getValidRoles, removePolicyRule, removeTrustedAccountService, RequestSecurityToken_Issuance, RequestSecurityToken_Validation, RequestSecurityToken, setLabel, setLabel, signal, validateOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.PolicyManagement
addPolicyRule, getPolicyRules, getValidRoles, removePolicyRule
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.ResourceMetadata
getEPR, setLabel
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.Signallable
getAvailableSignals, signal
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.comms.management.ManagedGridService
addTrustedAccountService, getTrustedAccountServices, removeTrustedAccountService
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.comms.wsrf.WSRFService
GetResourceProperty
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.GridService
getServiceProviderID, getServiceProviderIssuer
 

Field Detail

JOB_SERVICE_RESOURCE_TYPE

public static final String JOB_SERVICE_RESOURCE_TYPE
See Also:
Constant Field Values
Constructor Detail

JobServiceModule

public JobServiceModule()
Method Detail

ensurePoliciesDeployed

public void ensurePoliciesDeployed()
Description copied from interface: WebAdmin
Ensure that any required PBAC policies are deployed.

Specified by:
ensurePoliciesDeployed in interface WebAdmin

reloadConfiguration

public void reloadConfiguration()
                         throws Exception
Reload the configuration. Used by the admin tool.

Throws:
Exception - if the configuration is not yet valid

generateEPR

protected org.apache.axis.message.addressing.EndpointReferenceType generateEPR(GridResource bean)
Generate an EPR from a resource's bean. Adds the application uri to the EPR.

Overrides:
generateEPR in class GridServiceLite

createJob

public JobStatus createJob(String applicationURI,
                           MatchRule owner)
                    throws RemoteException
Deprecated. 

Specified by:
createJob in interface JobService
Parameters:
applicationURI - the type of the application to be run
owner - A rule to allow access for the owner role
Returns:
a JobStatus including the EPR of the job and its inputs and outputs
Throws:
RemoteException

createJobJSDL

public Document createJobJSDL(Document jsdl,
                              MatchPattern owner)
                       throws RemoteException
Description copied from interface: JobService
Create a new job. Billing information should be passed in a SOAP header.

Specified by:
createJobJSDL in interface JobService
Parameters:
jsdl - a JSDL document describing the job
owner - a rule to allow access for the owner role
Returns:
an updated JSDL document including the EPR of the job and its inputs and outputs (data stagers). The EPR for the job is stored as an additional element within the . The EPR for each data stager is stored as an additional element within a element. In addition, each element will include either a or element, containing the fully qualified Conversation ID of the data stager.
Throws:
RemoteException

getResources

public org.apache.axis.message.addressing.EndpointReferenceType[] getResources()
                                                                        throws GridFailureException
Description copied from interface: GridService
List the resources managed by this service for which the caller has some role.

Specified by:
getResources in interface GridService
Throws:
GridFailureException

startJob

public void startJob(String[] args)
              throws RemoteException
Deprecated. 

Specified by:
startJob in interface JobResource
Throws:
RemoteException

submitJob

public void submitJob(Document jobConstraints,
                      String[] args)
               throws RemoteException
Deprecated. 

Specified by:
submitJob in interface JobResource
Parameters:
jobConstraints - job constraints to be passed to the platform scripts
args - arguments to pass to the application
Throws:
RemoteException

submitJobJSDL

public void submitJobJSDL()
                   throws RemoteException
Description copied from interface: JobResource
Submit the job (already defined by a JSDL document) to the queue, via the platform scripts. All inputs must already have been uploaded before this is called. Job execution is controlled by the underlying resource manager.

Specified by:
submitJobJSDL in interface JobResource
Throws:
RemoteException

checkJob

public JobStatus checkJob()
                   throws RemoteException
Description copied from interface: JobResource
Check the current status of a job.

Specified by:
checkJob in interface JobResource
Returns:
The current status of the job
Throws:
RemoteException

checkJobInternal

public JobStatus checkJobInternal(String conversationID)
                           throws RemoteException
Used by web admin tool. Resource must be locked by PBAC. Must not hold a hibernate session.

Throws:
RemoteException

cancelJob

public void cancelJob()
               throws RemoteException
Description copied from interface: JobResource
Cancel a job that has been started.

Specified by:
cancelJob in interface JobResource
Throws:
RemoteException

cancelJobLocal

public void cancelJobLocal(String resourceID)
                    throws RemoteException
Throws:
RemoteException

finishJob

public void finishJob()
               throws RemoteException
Description copied from interface: JobResource
Finish the job conversation.

Specified by:
finishJob in interface JobResource
Throws:
RemoteException

finishJobLocal

public void finishJobLocal(String resourceID)
                    throws RemoteException
Throws:
RemoteException

getApplications

public String[] getApplications()
                         throws GridFailureException
Description copied from interface: JobService
List the applications available on this service.

Specified by:
getApplications in interface JobService
Throws:
GridFailureException

getJob

public Job getJob(String resourceID)
           throws GridFailureException
Throws:
GridFailureException

getResourceType

protected Class<? extends GridResource> getResourceType(String resourceID)
Description copied from class: GridServiceLite
Return the class of this resource's bean. Override this in subclasses if your service is contextualised. Often, resourceID can be ignored as each service only manages one type of bean anyway.

Overrides:
getResourceType in class GridServiceLite

getJob

public Job getJob(org.hibernate.Session session,
                  String resourceID)
           throws GridFailureException
Throws:
GridFailureException

clean

public void clean()
Description copied from interface: Cleanable
Called by the cleanup processing thread in order to do any specialised garbage collection on the implementing class.

Specified by:
clean in interface Cleanable

getApplication

public Application getApplication(String applicationURI)
                           throws AppNotFoundException
Throws:
AppNotFoundException

getApplication

public Application getApplication(org.hibernate.Session session,
                                  String applicationURI)
                           throws AppNotFoundException
Throws:
AppNotFoundException

isConfigured

public boolean isConfigured()

getAtomFeed

public Document getAtomFeed(String atomFeed,
                            String serviceBase)
                     throws GridFailureException
Return notices from the service as an Atom feed.

Specified by:
getAtomFeed in interface WebAdmin
Parameters:
atomFeed - the URL of the feed
serviceBase - the service administration URL (for creating hyperlinks)
Throws:
GridFailureException
See Also:
AtomUtils

getMessagesN

public NotificationMessage[] getMessagesN(int MaximumNumber)
Description copied from interface: ReportAPI
Returns usage messages

Specified by:
getMessagesN in interface ReportAPI
Parameters:
MaximumNumber - of messages. If more available returns the first.
Returns:
an array containing usage messages.

getMessages

public NotificationMessage[] getMessages()
Description copied from interface: ReportAPI
Returns all usage messages

Specified by:
getMessages in interface ReportAPI
Returns:
an array containing all usage messages.

destroy

public void destroy()
             throws ResourceUnknownFault,
                    ResourceNotDestroyedFault
WSResource lifetime destroy For a job this is implemented by requesting cancelJob() followed by finishJob(). cancelJob is asynchronous from JobService->Platform scripts. Furthermore, cancelling a job could take a long time. Therefore, implementing a synchronous destroy that guarantees the resource is destroyed on returning is impractical. Instead, a flag is set to indicate that the job should be finished as soon is it completes, whether as a result of the cancel or due to normal completion.

Specified by:
destroy in interface WSResourceLifetime
Throws:
ResourceUnknownFault
ResourceNotDestroyedFault

destroyLocal

public void destroyLocal(String resourceId)
                  throws GridFailureException
Called by web admin interface

Throws:
GridFailureException

getApplicationMetadata

public Document getApplicationMetadata(String applicationURI)
                                throws GridFailureException
Description copied from interface: JobService
Get the meta-data for a particular application.

Specified by:
getApplicationMetadata in interface JobService
Parameters:
applicationURI - the globally unique identifier for the application type
Returns:
a document containing the contents of the ApplicationMetadata.xml file.
Throws:
GridFailureException

getApplicationMetadataDetailed

public Document getApplicationMetadataDetailed(String applicationURI)
                                        throws GridFailureException
Description copied from interface: JobService
Get the 5.2 style meta-data for a particular application. If the application is a legacy 5.1 application, the metadata will be converted into the new 5.2 format before it is returned.

Specified by:
getApplicationMetadataDetailed in interface JobService
Parameters:
applicationURI - the globally unique identifier for the application type
Returns:
a document containing the contents of the ApplicationMetadata.xml file.
Throws:
GridFailureException

getApplicationDescription

public Document getApplicationDescription(String applicationURI)
                                   throws GridFailureException
Description copied from interface: JobService
Get the 5.1 style meta-data for a particular application. If the application is a newer 5.2 style application, the metadata will be converted into the older 5.1 format before it is returned.

Specified by:
getApplicationDescription in interface JobService
Parameters:
applicationURI - the globally unique identifier for the application type
Returns:
a document containing the contents of the ApplicationMetadata.xml file.
Throws:
GridFailureException

checkContinueActivity

protected void checkContinueActivity(Job job,
                                     JobDescription jobDescription)
                              throws RemoteException
Checks with SLA service that continuing a job activity is possible.

Throws:
RemoteException

dataStagerStartActivity

public void dataStagerStartActivity(DataStagerManager manager,
                                    Constraint[] constraints,
                                    UsageReport[] usageReports)
Description copied from interface: DataEventListener
Called when a data stager makes a startActivity request. This would usually be called on the SLA service.

Specified by:
dataStagerStartActivity in interface DataEventListener
Parameters:
manager - The DataStagerManager that is responsible for the stager.
constraints - An array of constraints that must be satisfied if the stager is to be created successfully.
usageReports - An array of initial usage reports.

dataStagerContinueActivity

public void dataStagerContinueActivity(DataStagerManager manager,
                                       org.apache.axis.message.addressing.EndpointReferenceType stagerEPR,
                                       Constraint[] constraints)
                                throws RemoteException
Description copied from interface: DataEventListener
Called when a data stager makes a continueActivity request. This would usually be called on the SLA service.

Specified by:
dataStagerContinueActivity in interface DataEventListener
Parameters:
manager - The DataStagerManager that is responsible for the stager.
constraints - An array of constraints that must be satisfied.
Throws:
RemoteException

dataStagerAddCumulativeUsageReport

public void dataStagerAddCumulativeUsageReport(DataStagerManager manager,
                                               Metric metric,
                                               double value)
Description copied from interface: DataEventListener
Called when a data stager generates a cumulative usage report such as an update in the amount of data transfer used.

Specified by:
dataStagerAddCumulativeUsageReport in interface DataEventListener
Parameters:
manager - The DataStagerManager that is responsible for the stager.
metric - The metric type of the resource being used
value - The cumulative increase in use of the metric

dataStagerInstantaneousUsageChanged

public void dataStagerInstantaneousUsageChanged(DataStagerManager manager,
                                                Metric metric)
                                         throws GridFailureException
Description copied from interface: DataEventListener
Called when a data stager generates an instantaneous usage report. This method does not include a value parameter as the implementation is supposed to total up the combined usage of this metric from all data stagers and send a single usage report.

Specified by:
dataStagerInstantaneousUsageChanged in interface DataEventListener
Parameters:
manager - The DataStagerManager that is responsible for the stager.
metric - The metric type of the resource being used
Throws:
GridFailureException

getResourceManagerList

public List<RMConnectorPlugin> getResourceManagerList()
                                               throws GridFailureException
Throws:
GridFailureException

getJSDL

public String getJSDL()
               throws RemoteException
Description copied from interface: JobResource
Retrieves the original JSDL Document used to create the job

Specified by:
getJSDL in interface JobResource
Throws:
RemoteException


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.