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.wsrf;
36
37 import java.util.Properties;
38
39 import org.ogf.graap.wsag.api.exceptions.NegotiationException;
40 import org.ogf.graap.wsag.api.exceptions.ResourceUnavailableException;
41 import org.ogf.graap.wsag.api.exceptions.ResourceUnknownException;
42 import org.ogf.graap.wsag.api.security.ISecurityProperties;
43 import org.ogf.graap.wsag.client.api.impl.NegotiationClientImpl;
44 import org.ogf.graap.wsag.client.wsrf.impl.WsrfNegotiationService;
45 import org.ogf.graap.wsag.client.wsrf.impl.WsrfResourceClient;
46 import org.ogf.schemas.graap.wsAgreement.AgreementTemplateType;
47 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationContextType;
48 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType;
49 import org.w3.x2005.x08.addressing.EndpointReferenceType;
50
51
52
53
54
55
56
57 public class WsrfNegotiationClient extends NegotiationClientImpl
58 {
59
60 private final WsrfResourceClient client;
61
62 private final WsrfNegotiationService negotiationService;
63
64
65
66
67
68
69
70
71
72
73 public WsrfNegotiationClient( EndpointReferenceType epr, Properties properties,
74 ISecurityProperties securityProperties )
75 {
76 this( new WsrfResourceClient( epr, properties, securityProperties ) );
77 }
78
79 private WsrfNegotiationClient( WsrfResourceClient client )
80 {
81 this.client = client;
82 this.negotiationService = new WsrfNegotiationService( client );
83 }
84
85
86
87
88 public WsrfResourceClient getWebServiceClient()
89 {
90 return client;
91 }
92
93
94
95
96 @Override
97 public WsrfNegotiationClient clone() throws CloneNotSupportedException
98 {
99 Properties properties = client.getProperties();
100 ISecurityProperties securityProperties = client.getSecurityProperties().clone();
101 return new WsrfNegotiationClient( client.getEndpoint(), properties, securityProperties );
102 }
103
104
105
106
107
108
109 @Override
110 public NegotiationContextType getNegotiationContext()
111 throws ResourceUnknownException, ResourceUnavailableException
112 {
113 return negotiationService.getNegotiationContext();
114 }
115
116
117
118
119
120
121 @Override
122 public AgreementTemplateType[] getNegotiableTemplates()
123 throws ResourceUnknownException, ResourceUnavailableException
124 {
125 return negotiationService.getNegotiableTemplates();
126 }
127
128
129
130
131
132
133 @Override
134 public NegotiationOfferType[] getNegotiationOffers()
135 throws ResourceUnknownException, ResourceUnavailableException
136 {
137 return negotiationService.getNegotiationOffers();
138 }
139
140
141
142
143
144
145
146
147 @Override
148 public NegotiationOfferType[] negotiate( NegotiationOfferType[] quotes )
149 throws NegotiationException, ResourceUnknownException, ResourceUnavailableException
150 {
151 return negotiationService.negotiate( quotes );
152 }
153
154
155
156
157
158
159
160
161 @Override
162 public void advertise( NegotiationOfferType[] quotes )
163 throws NegotiationException, ResourceUnknownException, ResourceUnavailableException
164 {
165 negotiationService.advertise( quotes );
166 }
167
168
169
170
171
172
173 @Override
174 public void terminate() throws ResourceUnknownException, ResourceUnavailableException
175 {
176 negotiationService.terminate();
177 }
178
179
180
181
182
183
184 @Override
185 public void destroy() throws ResourceUnknownException, ResourceUnavailableException
186 {
187 negotiationService.destroy();
188 }
189
190
191
192
193
194
195 @Override
196 public WsrfResourceClient getRemoteClient()
197 {
198 return client;
199 }
200
201 }