org.ogf.graap.wsag.server.engine
Class GenericNegotiation

java.lang.Object
  extended by org.ogf.graap.wsag.server.engine.GenericNegotiation
All Implemented Interfaces:
Negotiation

public class GenericNegotiation
extends Object
implements Negotiation

GenericNegotiation implements the default negotiation behavior in the WSAG4J framework. It validates incoming offers with respect to adherence to creation constraints defined in the originating templates, with respect to negotiation constraints defined in the parent offers, and invokes the appropriate negotiation strategies for incoming offers.

Author:
owaeld

Field Summary
static String CRITICAL_EXTENSIONS
          Critical extensions key
static String NEGOTIATION_CONTEXT
          Negotiation context key
static String NON_CRITICAL_EXTENSIONS
          Non-critical extensions key
 
Constructor Summary
GenericNegotiation(IAgreementFactory factory, TemplateRegistry registry, NegotiationContextType context)
           
GenericNegotiation(IAgreementFactory factory, TemplateRegistry registry, NegotiationContextType context, Map<String,Object> negotiationProperties)
           
 
Method Summary
 void advertise(NegotiationOfferType[] quotes, org.apache.xmlbeans.XmlObject[] noncriticalExtensions)
          Advertises the state change of particular agreement offers to a negotiation participator.
 AgreementTemplateType[] getNegotiableTemplates()
          Default implementation for retrieving negotiable templates from the associated agreement factory.
 NegotiationContextType getNegotiationContext()
          Returns the context of an negotiation instance.
 NegotiationOfferType[] getNegotiationOffers()
          This method returns a list of negotiation offers.
 AgreementFactoryAction loadAction(NegotiationOfferType quote)
          Loads the appropriate negotiation strategy for an incoming quote.
 NegotiationOfferType[] negotiate(NegotiationOfferType[] counterOffers, org.apache.xmlbeans.XmlObject[] noncriticalExtensions)
          Negotiates acceptable agreement offers with a negotiation participator.
 void terminate()
          terminates a negotiation process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRITICAL_EXTENSIONS

public static final String CRITICAL_EXTENSIONS
Critical extensions key

See Also:
Constant Field Values

NON_CRITICAL_EXTENSIONS

public static final String NON_CRITICAL_EXTENSIONS
Non-critical extensions key

See Also:
Constant Field Values

NEGOTIATION_CONTEXT

public static final String NEGOTIATION_CONTEXT
Negotiation context key

See Also:
Constant Field Values
Constructor Detail

GenericNegotiation

public GenericNegotiation(IAgreementFactory factory,
                          TemplateRegistry registry,
                          NegotiationContextType context)
Parameters:
factory - The factory that agreement offers are negotiated for.
registry - The registry to lookup the factory actions.
context - The context in which the negotiation is created in.

GenericNegotiation

public GenericNegotiation(IAgreementFactory factory,
                          TemplateRegistry registry,
                          NegotiationContextType context,
                          Map<String,Object> negotiationProperties)
Parameters:
factory - The factory that agreement offers are negotiated for.
registry - The registry to lookup the factory actions.
context - The context in which the negotiation is created in.
negotiationProperties - Additional parameters that were passed from the negotiation factory.
Method Detail

advertise

public void advertise(NegotiationOfferType[] quotes,
                      org.apache.xmlbeans.XmlObject[] noncriticalExtensions)
               throws NegotiationException
Advertises the state change of particular agreement offers to a negotiation participator. This method implements an notification mechanism in bilateral agreement negotiations.

Specified by:
advertise in interface Negotiation
Parameters:
quotes - The negotiation quotes represent offers of a negotiation participator. Each negotiation quote relates to a originating quote in this negotiation, and is based on an agreement template exposed by the agreement factory associated with this negotiation instance.
noncriticalExtensions - A negotiation implementation SHOULD obey the non-critical extensions if possible. If the extensions are not known or the implementation is not willing to support them, they can be ignored. Alternatively, the negotiation implementation MAY raise an exception.
Throws:
NegotiationException - indicates an exception sending the advertise message
See Also:
Negotiation.advertise(NegotiationOfferType[], XmlObject[])

negotiate

public NegotiationOfferType[] negotiate(NegotiationOfferType[] counterOffers,
                                        org.apache.xmlbeans.XmlObject[] noncriticalExtensions)
                                 throws NegotiationException
Negotiates acceptable agreement offers with a negotiation participator. This method implements an offer/counter-offer model for bilateral agreement negotiation.

Specified by:
negotiate in interface Negotiation
Parameters:
counterOffers - The negotiation quotes represent offers of a negotiation participator. Each negotiation quote relates to a originating quote in this negotiation, and is based on an agreement template exposed by the agreement factory associated with this negotiation instance.
noncriticalExtensions - A negotiation implementation SHOULD obey the non-critical extensions if possible. If the extensions are not known or the implementation is not willing to support them, they can be ignored. Alternatively, the negotiation implementation MAY raise an exception.
Returns:
Returns a set of negotiation counter offers. Each counter offer must refer to a negotiation offer passed as input. For each offer, one or more counter offers are created.
Throws:
NegotiationException - indicates an exception during the negotiation process
See Also:
Negotiation.negotiate(NegotiationOfferType[], XmlObject[])

getNegotiationContext

public NegotiationContextType getNegotiationContext()
Returns the context of an negotiation instance. The context is defined when a new negotiation instance is initiated. It defines the type of the negotiation process (negotiation or re-negotiation), the liability, identifies the participating parties, defines constraints on the negotiation process, etc.

Specified by:
getNegotiationContext in interface Negotiation
Returns:
The context of the negotiation instance.
See Also:
Negotiation.getNegotiationContext()

getNegotiationOffers

public NegotiationOfferType[] getNegotiationOffers()
This method returns a list of negotiation offers. These offers represent the offers exchanged in the negotiation process. Only offers that are still valid (e.g. which are not expired) are returned.

Specified by:
getNegotiationOffers in interface Negotiation
Returns:
A set of exchanged negotiation offers.
See Also:
Negotiation.getNegotiationOffers()

terminate

public void terminate()
Description copied from interface: Negotiation
terminates a negotiation process

Specified by:
terminate in interface Negotiation
See Also:
Negotiation.terminate()

loadAction

public AgreementFactoryAction loadAction(NegotiationOfferType quote)
Loads the appropriate negotiation strategy for an incoming quote. The negotiation strategy is identified by the template the incoming offer is based on.

Parameters:
quote - negotiation offer
Returns:
the AgreementFactoryAction for this quote

getNegotiableTemplates

public AgreementTemplateType[] getNegotiableTemplates()
Default implementation for retrieving negotiable templates from the associated agreement factory. Returns the templates for SLAs that are supported by this negotiation instance. Negotiable templates are dynamically generated. If an agreement factory supports negotiation for a specific SLA, it implements a corresponding negotiation strategy. For each SLA where a negotiation strategy is implemented, the corresponding template is returned by the negotiation instance. In case of SLA re-negotiation, the negotiation instance may dynamically generate a set of negotiable templates in order to guide the negotiation participator in the re-negotiation process.

Specified by:
getNegotiableTemplates in interface Negotiation
Returns:
a set of negotiable templates
See Also:
Negotiation.getNegotiableTemplates(), TemplateRegistry.getNegotiableTemplates()


Copyright © 2008-2012. All Rights Reserved.