org.yawlfoundation.yawl.resourcing
Class InterfaceClients

java.lang.Object
  extended by org.yawlfoundation.yawl.resourcing.InterfaceClients

public class InterfaceClients
extends Object

Handles all of the interface connections and calls for the Resource Service to the Engine and other services as needed, besides those that go through InterfaceBWebsideController

Author:
Michael Adams
Created/Last Date:
22/02/12

Constructor Summary
protected InterfaceClients(String logonName, String password)
          Initialises the class.
 
Method Summary
protected  String addExternalClient(YExternalClient client)
           
protected  String addRegisteredService(YAWLServiceReference service)
           
 void announceResourceCalendarStatusChange(String origAgent, String changeXML)
           
 void announceResourceUnavailable(AbstractResource resource, WorkItemRecord wir, boolean primary)
           
 void announceResourceUnavailable(WorkItemRecord wir)
           
protected  boolean canAddNewInstance(WorkItemRecord wir)
           
protected  String cancelCase(String caseID)
           
protected  boolean connected()
          Checks if there is a connection to the engine, and if there isn't, attempts to connect
protected  WorkItemRecord createNewWorkItemInstance(String id, String value)
           
protected  boolean engineIsAvailable()
          Check that the engine is contactable
protected  String getAdminUserPassword()
           
protected  Set<String> getAllRunningCaseIDs()
           
 XNode getAllRunningCases()
           
 String getCaseData(String caseID)
           
 CostClient getCostClient()
           
 DocStoreClient getDocStoreClient()
           
protected  String getEngineBuildProperties()
           
protected  String getEngineSessionHandle()
           
 String getEngineSpecificationStatistics(YSpecificationID specID, long from, long to)
           
protected  String getEngineURI()
          Gets the stored URI of the Engine
 String getEngineXESLog(YSpecificationID specID, boolean withData)
           
 String getExceptionServiceURI()
           
 Set<YExternalClient> getExternalClients()
           
protected  String getIABackendURI()
           
protected  List<WorkItemRecord> getLiveWorkItemsForCase(String caseID)
           
protected  org.jdom.Namespace getNamespace()
           
 Set<YAWLServiceReference> getRegisteredServices()
           
 String getRegisteredServicesAsXML()
           
 String getRunningCases(YSpecificationID specID)
           
protected  List<String> getRunningCasesAsList(YSpecificationID specID)
           
 String getServiceURI()
          Gets the Resource Service's URI, initialising it if necessary
protected  String getSpecificationDataSchema(YSpecificationID specID)
           
protected  String getTaskParamsAsXML(YSpecificationID specID, String taskID)
           
protected  List<WorkItemRecord> getWorkItemsForService()
           
 boolean hasCostClient()
           
 boolean hasDocStoreClient()
           
 boolean hasExceptionServiceEnabled()
           
 void initClients(String engineURI, String exceptionURI, String schedulingURI, String costServiceURI, String docStoreURI)
          Called on servlet startup with the various uris needed to initialise the various clients
 boolean isRunningCaseID(String caseID)
           
protected  String launchCase(YSpecificationID specID, String caseData, YLogDataItemList logList)
           
protected  String launchCase(YSpecificationID specID, String caseData, YLogDataItemList logList, Date delay)
           
protected  String launchCase(YSpecificationID specID, String caseData, YLogDataItemList logList, Duration delay)
           
protected  String launchCase(YSpecificationID specID, String caseData, YLogDataItemList logList, long delay)
           
protected  String redirectWorkItemToYawlService(WorkItemRecord wir, String serviceName)
          Dispatches a work item to a YAWL Custom Service for handling.
protected  void reestablishClients(InterfaceB_EnvironmentBasedClient client)
          Reestablishes clients when the resource service restarts
 String registerCalendarStatusChangeListener(String uri, String userID)
           
 void removeCalendarStatusChangeListener(String uri, String userID)
           
 void removeCalendarStatusChangeListeners(String userID)
           
protected  void removeCaseFromDocStore(String caseID)
           
protected  String removeExternalClient(String id)
           
protected  String removeRegisteredService(String id)
           
protected  void setInterfaceBClient(InterfaceB_EnvironmentBasedClient client)
          Assigns the IB client from InterfaceBWebsideController
protected  void setServiceURI()
          Sets the Resource Service URI as read from that stored in the Engine
protected  String skipWorkItem(String itemID)
           
protected  String suspendWorkItem(String itemID)
           
protected  String unloadSpecification(YSpecificationID specID)
           
protected  String unsuspendWorkItem(String itemID)
           
protected  String updateExternalClient(String id, String password, String doco)
           
 String uploadSpecification(String fileContents, String fileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterfaceClients

protected InterfaceClients(String logonName,
                           String password)
Initialises the class. Package access only.

Parameters:
logonName - the resource service's logon name (from web.xml)
password - the resource service's logon password (from web.xml)
Method Detail

setInterfaceBClient

protected void setInterfaceBClient(InterfaceB_EnvironmentBasedClient client)
Assigns the IB client from InterfaceBWebsideController

Parameters:
client - an IB Client instance

getNamespace

protected org.jdom.Namespace getNamespace()
Returns:
the YAWL namespace

getEngineURI

protected String getEngineURI()
Gets the stored URI of the Engine

Returns:
the engine's URI

initClients

public void initClients(String engineURI,
                        String exceptionURI,
                        String schedulingURI,
                        String costServiceURI,
                        String docStoreURI)
Called on servlet startup with the various uris needed to initialise the various clients

Parameters:
engineURI - the URI of the Engine's Interface B
exceptionURI - the URI of the Worklet Exception Service
schedulingURI - the URI of the Scheduling Service
costServiceURI - the URI of the Cost Service
docStoreURI - the URI of the Document Store

reestablishClients

protected void reestablishClients(InterfaceB_EnvironmentBasedClient client)
Reestablishes clients when the resource service restarts

Parameters:
client - the Interface B client from InterfaceBWebsideController

setServiceURI

protected void setServiceURI()
Sets the Resource Service URI as read from that stored in the Engine


getServiceURI

public String getServiceURI()
Gets the Resource Service's URI, initialising it if necessary

Returns:
the Service's URI, or a default if not found

engineIsAvailable

protected boolean engineIsAvailable()
Check that the engine is contactable

Returns:
true if Engine is contactable

connected

protected boolean connected()
Checks if there is a connection to the engine, and if there isn't, attempts to connect

Returns:
true if connected to the engine

getEngineSessionHandle

protected String getEngineSessionHandle()
Returns:
the current session handle for the engine

announceResourceUnavailable

public void announceResourceUnavailable(WorkItemRecord wir)

announceResourceUnavailable

public void announceResourceUnavailable(AbstractResource resource,
                                        WorkItemRecord wir,
                                        boolean primary)

announceResourceCalendarStatusChange

public void announceResourceCalendarStatusChange(String origAgent,
                                                 String changeXML)

registerCalendarStatusChangeListener

public String registerCalendarStatusChangeListener(String uri,
                                                   String userID)

removeCalendarStatusChangeListener

public void removeCalendarStatusChangeListener(String uri,
                                               String userID)

removeCalendarStatusChangeListeners

public void removeCalendarStatusChangeListeners(String userID)

redirectWorkItemToYawlService

protected String redirectWorkItemToYawlService(WorkItemRecord wir,
                                               String serviceName)
Dispatches a work item to a YAWL Custom Service for handling.

Parameters:
wir - the work item to be redirected.
serviceName - the name of the service to redirect it to
Returns:
a success or diagnostic error message
Precondition:
The item id refers to a work item that is currently in the list of items known to the Resource Service, and the work item has enabled or fired status, The service name refers to a service registered in the engine, The service is up and running

getEngineBuildProperties

protected String getEngineBuildProperties()

getRegisteredServices

public Set<YAWLServiceReference> getRegisteredServices()

getAdminUserPassword

protected String getAdminUserPassword()

uploadSpecification

public String uploadSpecification(String fileContents,
                                  String fileName)

unloadSpecification

protected String unloadSpecification(YSpecificationID specID)
                              throws IOException
Throws:
IOException

getRegisteredServicesAsXML

public String getRegisteredServicesAsXML()
                                  throws IOException
Throws:
IOException

addRegisteredService

protected String addRegisteredService(YAWLServiceReference service)
                               throws IOException
Throws:
IOException

removeRegisteredService

protected String removeRegisteredService(String id)
                                  throws IOException
Throws:
IOException

getExternalClients

public Set<YExternalClient> getExternalClients()
                                        throws IOException
Throws:
IOException

addExternalClient

protected String addExternalClient(YExternalClient client)
                            throws IOException
Throws:
IOException

removeExternalClient

protected String removeExternalClient(String id)
                               throws IOException
Throws:
IOException

updateExternalClient

protected String updateExternalClient(String id,
                                      String password,
                                      String doco)
                               throws IOException
Throws:
IOException

getIABackendURI

protected String getIABackendURI()

getWorkItemsForService

protected List<WorkItemRecord> getWorkItemsForService()
                                               throws IOException
Throws:
IOException

suspendWorkItem

protected String suspendWorkItem(String itemID)
                          throws IOException
Throws:
IOException

unsuspendWorkItem

protected String unsuspendWorkItem(String itemID)
                            throws IOException
Throws:
IOException

skipWorkItem

protected String skipWorkItem(String itemID)
                       throws IOException
Throws:
IOException

getRunningCases

public String getRunningCases(YSpecificationID specID)
                       throws IOException
Throws:
IOException

cancelCase

protected String cancelCase(String caseID)
                     throws IOException
Throws:
IOException

getCaseData

public String getCaseData(String caseID)
                   throws IOException
Throws:
IOException

getSpecificationDataSchema

protected String getSpecificationDataSchema(YSpecificationID specID)
                                     throws IOException
Throws:
IOException

getLiveWorkItemsForCase

protected List<WorkItemRecord> getLiveWorkItemsForCase(String caseID)

launchCase

protected String launchCase(YSpecificationID specID,
                            String caseData,
                            YLogDataItemList logList)
                     throws IOException
Throws:
IOException

launchCase

protected String launchCase(YSpecificationID specID,
                            String caseData,
                            YLogDataItemList logList,
                            long delay)
                     throws IOException
Throws:
IOException

launchCase

protected String launchCase(YSpecificationID specID,
                            String caseData,
                            YLogDataItemList logList,
                            Date delay)
                     throws IOException
Throws:
IOException

launchCase

protected String launchCase(YSpecificationID specID,
                            String caseData,
                            YLogDataItemList logList,
                            Duration delay)
                     throws IOException
Throws:
IOException

getAllRunningCases

public XNode getAllRunningCases()

getAllRunningCaseIDs

protected Set<String> getAllRunningCaseIDs()

isRunningCaseID

public boolean isRunningCaseID(String caseID)

getRunningCasesAsList

protected List<String> getRunningCasesAsList(YSpecificationID specID)

getTaskParamsAsXML

protected String getTaskParamsAsXML(YSpecificationID specID,
                                    String taskID)
                             throws IOException
Throws:
IOException

canAddNewInstance

protected boolean canAddNewInstance(WorkItemRecord wir)

createNewWorkItemInstance

protected WorkItemRecord createNewWorkItemInstance(String id,
                                                   String value)

getEngineXESLog

public String getEngineXESLog(YSpecificationID specID,
                              boolean withData)

getEngineSpecificationStatistics

public String getEngineSpecificationStatistics(YSpecificationID specID,
                                               long from,
                                               long to)

hasCostClient

public boolean hasCostClient()

getCostClient

public CostClient getCostClient()

hasDocStoreClient

public boolean hasDocStoreClient()

getDocStoreClient

public DocStoreClient getDocStoreClient()

hasExceptionServiceEnabled

public boolean hasExceptionServiceEnabled()

getExceptionServiceURI

public String getExceptionServiceURI()

removeCaseFromDocStore

protected void removeCaseFromDocStore(String caseID)


Copyright © 2004-2012 The YAWL Foundation.