1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 package org.ogf.graap.wsag.client.impl;
36
37 import java.util.Properties;
38
39 import org.ogf.graap.wsag.api.client.NegotiationClient;
40 import org.ogf.graap.wsag.api.client.NegotiationService;
41 import org.ogf.graap.wsag.api.exceptions.NegotiationException;
42 import org.ogf.graap.wsag.api.exceptions.ResourceUnavailableException;
43 import org.ogf.graap.wsag.api.exceptions.ResourceUnknownException;
44 import org.ogf.graap.wsag.api.security.ISecurityProperties;
45 import org.ogf.schemas.graap.wsAgreement.AgreementTemplateType;
46 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationContextType;
47 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType;
48 import org.w3.x2005.x08.addressing.EndpointReferenceType;
49
50
51
52
53
54
55
56 public abstract class NegotiationClientImpl implements NegotiationClient
57 {
58
59 private NegotiationService negotiationClient;
60
61
62
63
64
65
66
67 protected NegotiationClientImpl( NegotiationService negotiationClient )
68 {
69 this.negotiationClient = negotiationClient;
70 }
71
72
73
74
75 public abstract NegotiationClient clone() throws CloneNotSupportedException;
76
77
78
79
80 public NegotiationContextType getNegotiationContext()
81 throws ResourceUnknownException, ResourceUnavailableException
82 {
83 return negotiationClient.getNegotiationContext();
84 }
85
86
87
88
89 public AgreementTemplateType[] getNegotiableTemplates()
90 throws ResourceUnknownException, ResourceUnavailableException
91 {
92 return negotiationClient.getNegotiableTemplates();
93 }
94
95
96
97
98 public NegotiationOfferType[] getNegotiationOffers()
99 throws ResourceUnknownException, ResourceUnavailableException
100 {
101 return negotiationClient.getNegotiationOffers();
102 }
103
104
105
106
107 public NegotiationOfferType[] negotiate( NegotiationOfferType[] quotes )
108 throws NegotiationException, ResourceUnknownException, ResourceUnavailableException
109 {
110 return negotiationClient.negotiate( quotes );
111 }
112
113
114
115
116 public void advertise( NegotiationOfferType[] quotes )
117 throws NegotiationException, ResourceUnknownException, ResourceUnavailableException
118 {
119 negotiationClient.advertise( quotes );
120 }
121
122
123
124
125 public NegotiationOfferType getNegotiationOffer( String offerID )
126 throws ResourceUnknownException, ResourceUnavailableException
127 {
128 NegotiationOfferType[] offers = getNegotiationOffers();
129 for ( int i = 0; i < offers.length; i++ )
130 {
131 NegotiationOfferType offer = offers[i];
132 if ( offerID.equals( offer.getOfferId() ) )
133 {
134 return offer;
135 }
136 }
137
138 throw new ResourceUnavailableException( "no negotiationoffer found for offer id: " + offerID );
139 }
140
141
142
143
144 public void terminate() throws ResourceUnknownException, ResourceUnavailableException
145 {
146 negotiationClient.terminate();
147 }
148
149
150
151
152 public void destroy() throws ResourceUnknownException, ResourceUnavailableException
153 {
154 negotiationClient.destroy();
155 }
156
157
158
159
160 public EndpointReferenceType getEndpoint()
161 {
162 return negotiationClient.getWebServiceClient().getEndpoint();
163 }
164
165
166
167
168 public Properties getProperties()
169 {
170 return negotiationClient.getWebServiceClient().getProperties();
171 }
172
173
174
175
176 public void setProperties( Properties properties )
177 {
178 negotiationClient.getWebServiceClient().setProperties( properties );
179 }
180
181
182
183
184 public boolean isUsingTrace()
185 {
186 return negotiationClient.getWebServiceClient().isUsingTrace();
187 }
188
189
190
191
192 public void setTrace( boolean trace )
193 {
194 negotiationClient.getWebServiceClient().setTrace( trace );
195 }
196
197
198
199
200
201
202
203 public ISecurityProperties getSecurityProperties()
204 {
205 return negotiationClient.getWebServiceClient().getSecurityProperties();
206 }
207
208 }