org.ogf.graap.wsag.client.remote
Class RemoteAgreementFactoryClientImpl

java.lang.Object
  extended by org.ogf.graap.wsag.client.remote.RemoteAgreementFactoryClientImpl
All Implemented Interfaces:
AgreementFactoryClient, AgreementFactoryService, AgreementRegistryService, WsClient, WSDMResource

public class RemoteAgreementFactoryClientImpl
extends Object
implements AgreementFactoryClient

RemoteAgreementFactoryClientImpl

Author:
Oliver Waeldrich

Constructor Summary
RemoteAgreementFactoryClientImpl(EndpointReferenceType epr, ISecurityProperties securityProperties)
          Creates a new agreement factory client for a given endpoint using the given security properties.
 
Method Summary
 AgreementFactoryClient clone()
          Returns a copy of the client.
 AgreementClient createAgreement(AgreementOffer offer)
          Creates a new agreement instance with the SLA management server.
 AgreementClient createPendingAgreement(AgreementOffer offer)
          Creates a pending agreement instance.
 AgreementClient createPendingAgreement(AgreementOffer offer, EndpointReferenceType acceptanceEPR)
          Creates a pending agreement instance.
 EndpointReferenceType getEndpoint()
          Returns the endpoint of the client instance.
 Properties getProperties()
          Returns the properties used by the web-service client.
 String getResourceId()
          Returns the WSDM id of a web-service resource.
 ISecurityProperties getSecurityProperties()
          Returns the security properties used by the web-service client.
 AgreementTemplateType getTemplate(String name, String id)
          Returns a template with a particular name and id from the server, or null if the requested template does not exist.
 AgreementTemplateType[] getTemplates()
          Retrieves the templates for supported SLAs from the SLA management system.
 WsClient getWebServiceClient()
          Returns the web service client used for communication with the SLA management system.
 NegotiationClient initiateNegotiation(NegotiationContextType context)
          Initiates a new negotiation process with the given context.
 boolean isUsingTrace()
          Determines whether or not a client prints the web-service messages to the console.
 AgreementClient[] listAgreements()
          Lists the agreement instances of a particular agreement factory.
 void setProperties(Properties properties)
          Sets the properties used for the web-service client.
 void setTrace(boolean trace)
          Sets the clients trace mode.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteAgreementFactoryClientImpl

public RemoteAgreementFactoryClientImpl(EndpointReferenceType epr,
                                        ISecurityProperties securityProperties)
Creates a new agreement factory client for a given endpoint using the given security properties.

Parameters:
epr - the agreement factory endpoint
securityProperties - the client security properties
Method Detail

clone

public AgreementFactoryClient clone()
                             throws CloneNotSupportedException
Returns a copy of the client.

Specified by:
clone in interface AgreementFactoryClient
Overrides:
clone in class Object
Returns:
the cloned AgreementFactoryClient
Throws:
CloneNotSupportedException - indicates that the particular client implementation does not support cloning

getWebServiceClient

public WsClient getWebServiceClient()
Returns the web service client used for communication with the SLA management system.

Specified by:
getWebServiceClient in interface AgreementFactoryClient
Specified by:
getWebServiceClient in interface AgreementFactoryService
Specified by:
getWebServiceClient in interface AgreementRegistryService
Returns:
the web service client for this service.

createAgreement

public AgreementClient createAgreement(AgreementOffer offer)
                                throws AgreementFactoryException,
                                       ResourceUnknownException,
                                       ResourceUnavailableException
Creates a new agreement instance with the SLA management server.

Specified by:
createAgreement in interface AgreementFactoryService
Parameters:
offer - the agreement offer
Returns:
a client for the created agreement
Throws:
AgreementFactoryException - indicates that the agreement was rejected by the factory
ResourceUnknownException - the remote resource is unknown
ResourceUnavailableException - the remote resource is unavailable

createPendingAgreement

public AgreementClient createPendingAgreement(AgreementOffer offer)
                                       throws AgreementFactoryException,
                                              ResourceUnknownException,
                                              ResourceUnavailableException
Creates a pending agreement instance. The decision whether to accept or reject the agreement is deferred.

Specified by:
createPendingAgreement in interface AgreementFactoryService
Parameters:
offer - The agreement offer passed from the agreement initiator.
Returns:
An AgreementClient for the new created agreement.
Throws:
AgreementFactoryException - An error occurred during the the agreement creation. The agreement was rejected.
ResourceUnknownException - No pending agreement factory exists at the specified endpoint.
ResourceUnavailableException - The agreement factory at the specified endpoint is not accessible.

createPendingAgreement

public AgreementClient createPendingAgreement(AgreementOffer offer,
                                              EndpointReferenceType acceptanceEPR)
                                       throws AgreementFactoryException,
                                              ResourceUnknownException,
                                              ResourceUnavailableException
Creates a pending agreement instance. The decision whether to accept or reject the agreement is deferred. Once the decision has been made the client is notified via the given notification endpoint.

Specified by:
createPendingAgreement in interface AgreementFactoryService
Parameters:
offer - The agreement offer passed from the agreement initiator.
acceptanceEPR - An endpoint to an agreement acceptance instance.
Returns:
An AgreementClient for the new created agreement.
Throws:
AgreementFactoryException - An error occurred during the the agreement creation. The agreement was rejected.
ResourceUnknownException - No pending agreement factory exists at the specified endpoint.
ResourceUnavailableException - The agreement factory at the specified endpoint is not accessible.

getEndpoint

public EndpointReferenceType getEndpoint()
Returns the endpoint of the client instance.

Specified by:
getEndpoint in interface WsClient
Returns:
Returns the endpoint reference for this WS resource.

getProperties

public Properties getProperties()
Returns the properties used by the web-service client.

Specified by:
getProperties in interface WsClient
Returns:
a list of properties associated with the client

getResourceId

public String getResourceId()
                     throws ResourceUnknownException,
                            ResourceUnavailableException
Returns the WSDM id of a web-service resource.

Specified by:
getResourceId in interface WSDMResource
Returns:
the WSDM resource id
Throws:
ResourceUnknownException - the remote resource is unknown
ResourceUnavailableException - the remote resource is unavailable

getSecurityProperties

public ISecurityProperties getSecurityProperties()
Returns the security properties used by the web-service client.

Specified by:
getSecurityProperties in interface WsClient
Returns:
the security properties for this client

getTemplate

public AgreementTemplateType getTemplate(String name,
                                         String id)
                                  throws ResourceUnknownException,
                                         ResourceUnavailableException
Description copied from interface: AgreementFactoryClient
Returns a template with a particular name and id from the server, or null if the requested template does not exist.

Specified by:
getTemplate in interface AgreementFactoryClient
Parameters:
name - the requested template name
id - the requested template id
Returns:
the template with the specified name and id. If no template exists with these properties, null is returned.
Throws:
ResourceUnknownException - the remote resource is unknown
ResourceUnavailableException - the remote resource is unavailable
See Also:
AgreementFactoryFacade.getTemplate(String, String)

getTemplates

public AgreementTemplateType[] getTemplates()
                                     throws ResourceUnknownException,
                                            ResourceUnavailableException
Retrieves the templates for supported SLAs from the SLA management system.

Specified by:
getTemplates in interface AgreementFactoryService
Returns:
all templates exposed by this agreement factory instance
Throws:
ResourceUnknownException - the remote resource is unknown
ResourceUnavailableException - the remote resource is unavailable

isUsingTrace

public boolean isUsingTrace()
Determines whether or not a client prints the web-service messages to the console.

Specified by:
isUsingTrace in interface WsClient
Returns:
true, if the web service client traces the incoming/outgoing messages.

listAgreements

public AgreementClient[] listAgreements()
                                 throws ResourceUnknownException,
                                        ResourceUnavailableException
Lists the agreement instances of a particular agreement factory.

Specified by:
listAgreements in interface AgreementRegistryService
Returns:
a set of registered agreements
Throws:
ResourceUnknownException - the remote resource is unknown
ResourceUnavailableException - the remote resource is unavailable

setProperties

public void setProperties(Properties properties)
Sets the properties used for the web-service client.

Specified by:
setProperties in interface WsClient
Parameters:
properties - Sets the properties for this client

setTrace

public void setTrace(boolean trace)
Sets the clients trace mode.

Specified by:
setTrace in interface WsClient
Parameters:
trace - true, if the web service client should traces incoming/outgoing messages.

initiateNegotiation

public NegotiationClient initiateNegotiation(NegotiationContextType context)
                                      throws NegotiationFactoryException,
                                             ResourceUnknownException,
                                             ResourceUnavailableException
Initiates a new negotiation process with the given context.

Specified by:
initiateNegotiation in interface AgreementFactoryService
Parameters:
context - the negotiation context
Returns:
a client to the new created negotiation process
Throws:
NegotiationFactoryException - The negotiation process was not initiated.
ResourceUnknownException - the remote resource is unknown
ResourceUnavailableException - the remote resource is unavailable
See Also:
AgreementFactoryFacade.initiateNegotiation(NegotiationContextType)


Copyright © 2008-2012 Fraunhofer Institute SCAI. All Rights Reserved.