public class ExchangeFactory
extends java.lang.Object
ExchangeFactory
also incorporates functionality to access
various data elements within an exchange.Modifier and Type | Method and Description |
---|---|
DeploymentMessage |
createDeploymentResponse(java.lang.String jobIdentifier,
java.lang.String taskIdentifier,
int exchangeSubType,
int conditionFlag,
java.lang.String description)
Creates a deployment response, to a previously issued request.
|
DeploymentMessage |
createDeploymentStatusOrAbortRequest(java.lang.String jobIdentifier,
java.lang.String taskIdentifier,
java.lang.String respondTo,
int exchangeSubType)
Creates a DeploymentMessage that is a request for either getting the
STATUS or ABORTing a previously deployment operation.
|
DeploymentMessage |
createDepoymentRequest(java.lang.String jobIdentifier,
Operation operation,
java.lang.String respondTo)
Creates a deployment request based on the specified parameters.
|
ExecutionStatus |
createExecutionStatusRequest(java.lang.String jobIdentifier,
java.lang.String taskIdentifier,
java.lang.String respondTo)
Creates an
ExecutionStatus REQUEST based on the specified
parameters |
ExecutionStatus |
createExecutionStatusResponse(java.lang.String jobIdentifier,
java.lang.String taskIdentifier,
int conditionFlag,
java.lang.String description,
TaskLifecycleMetrics taskLifecycleMetrics,
java.lang.String respondTo)
Creates an
ExecutionStatus RESPONSE based on the specified
parameters |
ResourceDiscovery |
createResourceDiscoveryRequest(int resourceType,
java.lang.String respondTo)
Create a ResourceDiscovery request
|
ResourceDiscovery |
createResourceDiscoveryResponse(int conditionFlag,
java.lang.String description,
ResourceMetrics resourceMetrics,
java.lang.String respondTo)
Creates a
ResourceDiscovery response |
DeploymentMessage |
getDeploymentMessage(byte[] exchangeBytes)
Reconstructs the Deployment Message from a stream of bytes
|
int |
getExchangeType(byte[] exchangeBytes)
Retrieves the exchange type information from a stream of bytes.
|
ExecutionStatus |
getExecutionStatus(byte[] exchangeBytes)
Reconstruct the execution status object from a byte[].
|
static ExchangeFactory |
getInstance()
Retrieve the singleton instance for this factory.
|
ResourceDiscovery |
getResourceDiscovery(byte[] exchangeBytes)
Reconstructs the
ResourceDiscovery from a stream of bytes |
boolean |
isValidExchangeType(int exchangeType)
Checks to see if a given exchange type is a valid one.
|
static void |
main(java.lang.String[] args) |
public static ExchangeFactory getInstance()
public boolean isValidExchangeType(int exchangeType)
exchangeType
- true
if the exchange is a valid one;
false
otherwise.public int getExchangeType(byte[] exchangeBytes)
exchangeBytes
- The marshalled representation of the exchangeMarshallingException
- if there are problems with the exchange bytespublic DeploymentMessage createDepoymentRequest(java.lang.String jobIdentifier, Operation operation, java.lang.String respondTo) throws DeploymentException
jobIdentifier
- The ID to be associated with the deploymentoperation
- The operation being deployedrespondTo
- the stream over which responses need to be sent.DeploymentException
- If problems are encountered with the specified parameters, or
if any of them are NULL.public DeploymentMessage createDeploymentStatusOrAbortRequest(java.lang.String jobIdentifier, java.lang.String taskIdentifier, java.lang.String respondTo, int exchangeSubType) throws DeploymentException
jobIdentifier
- The ID to be associated with the deploymenttaskIdentifier
- The task identifier that was assigned to one of the
constituent tasks that comprises the system-wide deployment.respondTo
- The stream over which responses need to be sent.exchangeSubType
- This should be either the STATUS or ABORT exchange subTypes.DeploymentException
- If problems are encountered with the specified parameters, or
if any of them are NULL or if the exchangeSubType is
something other than DeploymentMessage.STATUS or
DeploymentMessage.ABORTpublic DeploymentMessage createDeploymentResponse(java.lang.String jobIdentifier, java.lang.String taskIdentifier, int exchangeSubType, int conditionFlag, java.lang.String description) throws DeploymentException
jobIdentifier
- The ID to be associated with the deploymenttaskIdentifier
- The task identifier that was assigned to one of the
constituent tasks that comprises the system-wide deployment.exchangeSubType
- Indicates whether this is a response to a previously issued
DEPLOY, STATUS or ABORTconditionFlag
- Indicates the status of processing the previously issued
request.description
- A detailed description or reason for the responseDeploymentException
- If there are problems creating this exchange.public DeploymentMessage getDeploymentMessage(byte[] exchangeBytes) throws java.io.IOException, MarshallingException
exchangeBytes
- The marshalled representation of the exchangeDeploymentMessage
java.io.IOException
- If there are problems reconstructing elements of the exchangeMarshallingException
- If there are problems reconstructing specialized elements of
the exchangepublic ExecutionStatus createExecutionStatusRequest(java.lang.String jobIdentifier, java.lang.String taskIdentifier, java.lang.String respondTo)
ExecutionStatus
REQUEST based on the specified
parametersjobIdentifier
- The job identifier that the task is a part oftaskIdentifier
- The identifier of the task in questionrespondTo
- The stream to which the responses should be sentpublic ExecutionStatus createExecutionStatusResponse(java.lang.String jobIdentifier, java.lang.String taskIdentifier, int conditionFlag, java.lang.String description, TaskLifecycleMetrics taskLifecycleMetrics, java.lang.String respondTo)
ExecutionStatus
RESPONSE based on the specified
parametersjobIdentifier
- The job identifier that the task is a part oftaskIdentifier
- The identifier of the task in questionconditionFlag
- The status of the execution (based on constants in the
ConditionFlag
)description
- A description of the responsetaskLifecycleMetrics
- The metrics associated with the execution.respondTo
- The stream to which the responses should be sentpublic ExecutionStatus getExecutionStatus(byte[] exchangeBytes) throws java.io.IOException, MarshallingException
exchangeBytes
- The byte[] representation of the execution status.java.io.IOException
- If there are problems reconstructing elements of the exchangeMarshallingException
- If there are problems reconstructing specialized elements of
the exchangepublic ResourceDiscovery createResourceDiscoveryRequest(int resourceType, java.lang.String respondTo)
resourceType
- The type of the resource the node is looking forrespondTo
- The stream over which responses need to be sent.public ResourceDiscovery createResourceDiscoveryResponse(int conditionFlag, java.lang.String description, ResourceMetrics resourceMetrics, java.lang.String respondTo)
ResourceDiscovery
responseresourceMetrics
- The metrics associated with the resource.respondTo
- The stream over which the resource listens to deployment
requestsResourceDiscovery
response.public ResourceDiscovery getResourceDiscovery(byte[] exchangeBytes) throws java.io.IOException, MarshallingException
ResourceDiscovery
from a stream of bytesexchangeBytes
- The marshalled representation of the exchangeResourceDiscovery
java.io.IOException
- If there are problems reconstructing elements of the exchangeMarshallingException
- If there are problems reconstructing specialized elements of
the exchangepublic static void main(java.lang.String[] args)
args
-