1 /*
2 * Copyright (c) 2005-2011, Fraunhofer-Gesellschaft
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * (1) Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the disclaimer at the end.
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
14 * distribution.
15 *
16 * (2) Neither the name of Fraunhofer nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * DISCLAIMER
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
35 package org.ogf.graap.wsag.api;
36
37 import org.apache.xmlbeans.XmlObject;
38 import org.ogf.graap.wsag.api.exceptions.NegotiationException;
39 import org.ogf.schemas.graap.wsAgreement.AgreementTemplateType;
40 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationContextType;
41 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType;
42
43 /**
44 * This interface defines the contract of a concrete Negotiation implementation. <br>
45 * A negotiation instance implements the state pattern. its behavior changes depending on the negotiation
46 * type, which is either negotiation or re-negotiation.
47 *
48 * @author owaeld
49 */
50 public interface Negotiation
51 {
52
53 /**
54 * Returns the context of an negotiation instance. The context is defined when a new negotiation instance
55 * is initiated. It defines the type of the negotiation process (negotiation or re-negotiation), the
56 * liability, identifies the participating parties, defines constraints on the negotiation process, etc.
57 *
58 * @return The context of the negotiation instance.
59 */
60 NegotiationContextType getNegotiationContext();
61
62 /**
63 * Returns the templates for SLAs that are supported by this negotiation instance. Negotiable templates
64 * are dynamically generated. If an agreement factory supports negotiation for a specific SLA, it
65 * implements a corresponding negotiation strategy. For each SLA where a negotiation strategy is
66 * implemented, the corresponding template is returned by the negotiation instance. In case of SLA
67 * re-negotiation, the negotiation instance may dynamically generate a set of negotiable templates in
68 * order to guide the negotiation participator in the re-negotiation process.
69 *
70 * @return a set of negotiable templates
71 */
72 AgreementTemplateType[] getNegotiableTemplates();
73
74 /**
75 * This method returns a list of negotiation offers. These offers represent the offers exchanged in the
76 * negotiation process. Only offers that are still valid (e.g. which are not expired) are returned.
77 *
78 * @return A set of exchanged negotiation offers.
79 */
80 NegotiationOfferType[] getNegotiationOffers();
81
82 /**
83 * Negotiates acceptable agreement offers with a negotiation participator. This method implements an
84 * offer/counter-offer model for bilateral agreement negotiation.
85 *
86 * @param quotes
87 * The negotiation quotes represent offers of a negotiation participator. Each negotiation
88 * quote relates to a originating quote in this negotiation, and is based on an agreement
89 * template exposed by the agreement factory associated with this negotiation instance.
90 * @param nocriticalExtensions
91 * A negotiation implementation SHOULD obey the non-critical extensions if possible. If the
92 * extensions are not known or the implementation is not willing to support them, they can be
93 * ignored. Alternatively, the negotiation implementation MAY raise an exception.
94 * @return Returns a set of negotiation counter offers. Each counter offer must refer to a negotiation
95 * offer passed as input. For each offer, one or more counter offers are created.
96 * @throws NegotiationException
97 * indicates an exception during the negotiation process
98 */
99 NegotiationOfferType[] negotiate( NegotiationOfferType[] quotes, XmlObject[] nocriticalExtensions )
100 throws NegotiationException;
101
102 /**
103 * Advertises the state change of particular agreement offers to a negotiation participator. This method
104 * implements an notification mechanism in bilateral agreement negotiations.
105 *
106 * @param quotes
107 * The negotiation quotes represent offers of a negotiation participator. Each negotiation
108 * quote relates to a originating quote in this negotiation, and is based on an agreement
109 * template exposed by the agreement factory associated with this negotiation instance.
110 * @param nocriticalExtensions
111 * A negotiation implementation SHOULD obey the non-critical extensions if possible. If the
112 * extensions are not known or the implementation is not willing to support them, they can be
113 * ignored. Alternatively, the negotiation implementation MAY raise an exception.
114 * @throws NegotiationException
115 * indicates an exception sending the advertise message
116 */
117 void advertise( NegotiationOfferType[] quotes, XmlObject[] nocriticalExtensions )
118 throws NegotiationException;
119
120 /**
121 * terminates a negotiation process
122 */
123 void terminate();
124 }