org.ogf.graap.wsag.client.impl
Class AgreementFactoryFacade

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

public class AgreementFactoryFacade
extends Object
implements AgreementFactoryClient

A client side facade to an agreement factory service and the associated agreement registry.

Author:
Oliver Waeldrich

Constructor Summary
AgreementFactoryFacade(AgreementFactoryService factoryClient, AgreementRegistryService registryClient, ISecurityProperties securityProperties)
          Creates a new instance of the facade.
 
Method Summary
 AgreementFactoryClient clone()
          Creates s copy of this AgreementFactoryClient.
 AgreementClient createAgreement(AgreementOffer offer)
          Creates a new agreement instance.
 AgreementClient createPendingAgreement(AgreementOffer offer)
          Creates a new pending agreement instance.
 AgreementClient createPendingAgreement(AgreementOffer offer, EndpointReferenceType acceptanceEPR)
          Creates a new pending agreement instance.
 AgreementFactoryService getAgreementFactoryClient()
           
 AgreementRegistryService getAgreementRegistryClient()
           
 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()
          Returns the templates supported by this factory.
 WsClient getWebServiceClient()
          Returns the web service client used for communication with the SLA management system.
 NegotiationClient initiateNegotiation(NegotiationContextType context)
          Initiates a Negotiation.
 boolean isUsingTrace()
          Determines whether or not a client prints the web-service messages to the console.
 AgreementClient[] listAgreements()
          Lists all agreements of this factory.
 void setProperties(Properties properties)
          Sets the properties used for the web-service client.
 void setTrace(boolean trace)
          Turns trace on/off.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgreementFactoryFacade

public AgreementFactoryFacade(AgreementFactoryService factoryClient,
                              AgreementRegistryService registryClient,
                              ISecurityProperties securityProperties)
Creates a new instance of the facade.

Parameters:
factoryClient - the factory client instance
registryClient - the registry client instance
securityProperties - the security properties to use
Method Detail

getTemplates

public AgreementTemplateType[] getTemplates()
                                     throws ResourceUnknownException,
                                            ResourceUnavailableException
Returns the templates supported by this factory. 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

createAgreement

public AgreementClient createAgreement(AgreementOffer offer)
                                throws AgreementFactoryException,
                                       ResourceUnknownException,
                                       ResourceUnavailableException
Creates a new agreement instance.

Specified by:
createAgreement in interface AgreementFactoryService
Parameters:
offer - the offer to create the agreement for
Returns:
the created agreement
Throws:
AgreementFactoryException - the agreement offer was rejected by the factory
ResourceUnavailableException - the requested agreement factory resource is unavailable
ResourceUnknownException - the requested agreement factory resource is unknown

createPendingAgreement

public AgreementClient createPendingAgreement(AgreementOffer offer)
                                       throws AgreementFactoryException,
                                              ResourceUnknownException,
                                              ResourceUnavailableException
Creates a new pending agreement instance. 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 new pending agreement instance. 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.

initiateNegotiation

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

Specified by:
initiateNegotiation in interface AgreementFactoryService
Parameters:
context - the context for the negotiation to initialize
Returns:
the new initiated negotiation instance
Throws:
NegotiationFactoryException - indicates that the creation of a negotiation process was rejected
ResourceUnknownException - the remote resource is unknown
ResourceUnavailableException - the remote resource is unavailable

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

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 name of the requested template
id - the id of the requested template
Returns:
a template with the given name and id, or null if no appropriate template was found. a template with the given name and id, or null if no appropriate template was found.
Throws:
ResourceUnknownException - the remote resource is unknown
ResourceUnavailableException - the remote resource is unavailable

clone

public AgreementFactoryClient clone()
                             throws CloneNotSupportedException
Creates s copy of this AgreementFactoryClient.

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

listAgreements

public AgreementClient[] listAgreements()
                                 throws ResourceUnknownException,
                                        ResourceUnavailableException
Lists all agreements of this factory.

Specified by:
listAgreements in interface AgreementRegistryService
Returns:
all agreement clients known by this factory
Throws:
ResourceUnavailableException - the requested agreement factory resource is unavailable
ResourceUnknownException - the requested agreement factory resource is unknown

setTrace

public void setTrace(boolean trace)
Turns trace on/off.

Specified by:
setTrace in interface WsClient
Parameters:
trace - turns trace on/off.

isUsingTrace

public boolean isUsingTrace()
Description copied from interface: WsClient
Determines whether or not a client prints the web-service messages to the console.

Specified by:
isUsingTrace in interface WsClient
Returns:
the trace level

getProperties

public Properties getProperties()
Description copied from interface: WsClient
Returns the properties used by the web-service client.

Specified by:
getProperties in interface WsClient
Returns:
Returns the properties.

setProperties

public void setProperties(Properties properties)
Description copied from interface: WsClient
Sets the properties used for the web-service client.

Specified by:
setProperties in interface WsClient
Parameters:
properties - The properties to set.

getEndpoint

public EndpointReferenceType getEndpoint()
Description copied from interface: WsClient
Returns the endpoint of the client instance.

Specified by:
getEndpoint in interface WsClient
Returns:
Returns the endpoint reference for the service.

getSecurityProperties

public ISecurityProperties getSecurityProperties()
Description copied from interface: WsClient
Returns the security properties used by the web-service client.

Specified by:
getSecurityProperties in interface WsClient
Returns:
the securityProperties

getWebServiceClient

public WsClient getWebServiceClient()
Description copied from interface: AgreementFactoryClient
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 webservice client.

getAgreementFactoryClient

public AgreementFactoryService getAgreementFactoryClient()
Returns:
Returns the agreement factory client.

getAgreementRegistryClient

public AgreementRegistryService getAgreementRegistryClient()
Returns:
Returns the agreement registry client.


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