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.api.impl;
36
37 import org.ogf.graap.wsag.api.exceptions.ResourceUnavailableException;
38 import org.ogf.graap.wsag.api.exceptions.ResourceUnknownException;
39 import org.ogf.graap.wsag.client.api.AgreementClient;
40 import org.ogf.schemas.graap.wsAgreement.AgreementContextType;
41 import org.ogf.schemas.graap.wsAgreement.AgreementPropertiesType;
42 import org.ogf.schemas.graap.wsAgreement.AgreementStateType;
43 import org.ogf.schemas.graap.wsAgreement.GuaranteeTermStateType;
44 import org.ogf.schemas.graap.wsAgreement.ServiceTermStateType;
45 import org.ogf.schemas.graap.wsAgreement.TermTreeType;
46 import org.ogf.schemas.graap.wsAgreement.TerminateInputType;
47
48
49
50
51
52
53
54 public abstract class AgreementClientImpl extends AbstractClient
55 implements AgreementClient
56 {
57
58
59
60
61
62
63
64
65
66
67
68 public abstract AgreementContextType getContext()
69 throws ResourceUnknownException, ResourceUnavailableException;
70
71
72
73
74 public abstract GuaranteeTermStateType[] getGuaranteeTermStates()
75 throws ResourceUnknownException, ResourceUnavailableException;
76
77
78
79
80 public GuaranteeTermStateType getGuaranteeTermState( String name )
81 throws ResourceUnknownException, ResourceUnavailableException
82 {
83
84 GuaranteeTermStateType[] states = getGuaranteeTermStates();
85 for ( int i = 0; i < states.length; i++ )
86 {
87 GuaranteeTermStateType state = states[i];
88 if ( name.equals( state.getTermName() ) )
89 {
90 return state;
91 }
92 }
93
94 return null;
95 }
96
97
98
99
100 public abstract String getAgreementId() throws ResourceUnknownException, ResourceUnavailableException;
101
102
103
104
105 public abstract String getName() throws ResourceUnknownException, ResourceUnavailableException;
106
107
108
109
110 public abstract ServiceTermStateType[] getServiceTermStates()
111 throws ResourceUnknownException, ResourceUnavailableException;
112
113
114
115
116 public ServiceTermStateType getServiceTermState( String name )
117 throws ResourceUnknownException, ResourceUnavailableException
118 {
119
120 ServiceTermStateType[] states = getServiceTermStates();
121 for ( int i = 0; i < states.length; i++ )
122 {
123 ServiceTermStateType state = states[i];
124 if ( name.equals( state.getTermName() ) )
125 {
126 return state;
127 }
128 }
129
130 return null;
131 }
132
133
134
135
136 public abstract AgreementStateType getState()
137 throws ResourceUnknownException, ResourceUnavailableException;
138
139
140
141
142 public abstract TermTreeType getTerms() throws ResourceUnknownException, ResourceUnavailableException;
143
144
145
146
147 public abstract AgreementPropertiesType getResourceProperties()
148 throws ResourceUnknownException, ResourceUnavailableException;
149
150
151
152
153 public void terminate() throws ResourceUnknownException, ResourceUnavailableException
154 {
155 terminate( TerminateInputType.Factory.newInstance() );
156 }
157
158
159
160
161 public abstract void terminate( TerminateInputType reason )
162 throws ResourceUnknownException, ResourceUnavailableException;
163
164
165
166
167 public abstract void destroy() throws ResourceUnknownException, ResourceUnavailableException;
168
169
170
171
172 @Override
173 public abstract AgreementClient clone() throws CloneNotSupportedException;
174 }