uk.ac.ncl.cs.instantsoap.wsapi.impl
Class WebServiceDispatcherImpl

java.lang.Object
  extended by uk.ac.ncl.cs.instantsoap.wsapi.impl.WebServiceDispatcherImpl
All Implemented Interfaces:
WebServiceDispatcher

public class WebServiceDispatcherImpl
extends Object
implements WebServiceDispatcher

Implementation of the web service dispatcher, using the strategy dispatcher stack.

Author:
Matthew Pocock, Cheng-Yang(Louis) Tang

Constructor Summary
WebServiceDispatcherImpl()
           
 
Method Summary
 MetaData describeApplication(String appName)
          Describe an application.
 AsynchronousServiceDispatcher getAsyncDispatcher()
           
 List<MetaData> getInputs(String application)
          Describe the inputs of an application.
 List<MetaData> getOutputs(String application)
          Describe the outputs of an application.
 BlockedInvocationResponse invokeAndBlock(JobSpecification jobSpec)
          Invoke the jobManager, and return the result.
 NonBlockingInvocationResponse invokeNonBlocking(JobSpecification jobSpec)
          Invoke the jobManager, returning immediately.
 List<String> listApplications()
          List all of the applications known by this service.
static WebServiceDispatcher loggingDispatcher(WebServiceDispatcher dispatcher)
           
static InvocationHandler loggingHandler(WebServiceDispatcher dispatcher)
           
 NonBlockingInvocationResponse pollForResult(UUID uuid)
          Poll the jobManager for completion.
 void setAsyncDispatcher(AsynchronousServiceDispatcher asyncDispatcher)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebServiceDispatcherImpl

public WebServiceDispatcherImpl()
Method Detail

getAsyncDispatcher

public AsynchronousServiceDispatcher getAsyncDispatcher()

setAsyncDispatcher

public void setAsyncDispatcher(AsynchronousServiceDispatcher asyncDispatcher)

listApplications

public List<String> listApplications()
Description copied from interface: WebServiceDispatcher
List all of the applications known by this service.

Specified by:
listApplications in interface WebServiceDispatcher
Returns:
a List of Strings of names of applications

describeApplication

public MetaData describeApplication(String appName)
                             throws UnknownApplicationException
Description copied from interface: WebServiceDispatcher
Describe an application.

Specified by:
describeApplication in interface WebServiceDispatcher
Parameters:
appName - the name of the application to describe
Returns:
a MetaData instance capturing the name, and potentially description and semantic annotation of the application
Throws:
UnknownApplicationException

getInputs

public List<MetaData> getInputs(String application)
                         throws UnknownApplicationException
Description copied from interface: WebServiceDispatcher
Describe the inputs of an application.

Specified by:
getInputs in interface WebServiceDispatcher
Parameters:
application - the name of the application to find inputs for
Returns:
a List of MetaData objects describing the inputs of the application
Throws:
UnknownApplicationException

getOutputs

public List<MetaData> getOutputs(String application)
                          throws UnknownApplicationException
Description copied from interface: WebServiceDispatcher
Describe the outputs of an application.

Specified by:
getOutputs in interface WebServiceDispatcher
Parameters:
application - the name of the application to find outputs for
Returns:
a List of MetaData objects describing the outputs of the application
Throws:
UnknownApplicationException

invokeAndBlock

public BlockedInvocationResponse invokeAndBlock(JobSpecification jobSpec)
                                         throws InvalidJobSpecificationException,
                                                JobExecutionException,
                                                OperationUnavailableException
Description copied from interface: WebServiceDispatcher
Invoke the jobManager, and return the result. This will block for as long as necessary to run the jobManager, or until one of the intermediate components times out.

Specified by:
invokeAndBlock in interface WebServiceDispatcher
Parameters:
jobSpec - specify the jobManager to run
Returns:
an BlockedInvocationResponse containing the SerializableUuid and result of the jobManager
Throws:
InvalidJobSpecificationException - if the service is unable to process jobSpecification
JobExecutionException - if there was a failure from execution of the jobManager
OperationUnavailableException - if this operation is not supported by this dispatcher

invokeNonBlocking

public NonBlockingInvocationResponse invokeNonBlocking(JobSpecification jobSpec)
                                                throws InvalidJobSpecificationException,
                                                       JobExecutionException
Description copied from interface: WebServiceDispatcher
Invoke the jobManager, returning immediately.

This will either return the result directly or when to poll for the result. The SerializableUuid for this response will be unique to this invocation.

Specified by:
invokeNonBlocking in interface WebServiceDispatcher
Parameters:
jobSpec - specify the jobManager to run
Returns:
a NonBlockingInvocationResponse either containing the result or the poll information
Throws:
InvalidJobSpecificationException - if the service is unable to process jobSpecification
JobExecutionException - if there was a failure from execution of the jobManager

pollForResult

public NonBlockingInvocationResponse pollForResult(UUID uuid)
                                            throws UnknownUuidException,
                                                   JobExecutionException
Description copied from interface: WebServiceDispatcher
Poll the jobManager for completion.

The SerializableUuid will be a value returned previously via invokeNonBlocking. This will either return the result directly or when to poll again for the result.

Specified by:
pollForResult in interface WebServiceDispatcher
Parameters:
uuid - the SerializableUuid of the jobManager to poll
Returns:
a NonBlockingInvocationResponse either containing the result or the poll information
Throws:
UnknownUuidException - if the SerializableUuid is not known
JobExecutionException - if there was a failure from execution of the jobSpecification

loggingDispatcher

public static WebServiceDispatcher loggingDispatcher(WebServiceDispatcher dispatcher)

loggingHandler

public static InvocationHandler loggingHandler(WebServiceDispatcher dispatcher)


Copyright © 2006-2008. All Rights Reserved.