1 /* 2 * Copyright (c) 2007, 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.client.api; 36 37 import org.ogf.graap.wsag.api.exceptions.ResourceUnavailableException; 38 import org.ogf.graap.wsag.api.exceptions.ResourceUnknownException; 39 import org.ogf.schemas.graap.wsAgreement.AgreementContextType; 40 import org.ogf.schemas.graap.wsAgreement.AgreementPropertiesType; 41 import org.ogf.schemas.graap.wsAgreement.AgreementStateType; 42 import org.ogf.schemas.graap.wsAgreement.GuaranteeTermStateType; 43 import org.ogf.schemas.graap.wsAgreement.ServiceTermStateType; 44 import org.ogf.schemas.graap.wsAgreement.TermTreeType; 45 import org.ogf.schemas.graap.wsAgreement.TerminateInputType; 46 47 /** 48 * Client interface of a agreement service implementation. Each implementation uses a specific remote 49 * technology, depending on the technology a specific remote client is returned. 50 * 51 * @author Oliver Waeldrich 52 */ 53 public interface AgreementClient 54 { 55 56 /** 57 * Default builder. 58 */ 59 ClientLocator<AgreementClient> FACTORY = new ClientLocator<AgreementClient>( AgreementClient.class ); 60 61 /** 62 * Returns the web-service client used for communication with the SLA management server. 63 * 64 * @return the web service client for this service. 65 */ 66 RemoteClient getRemoteClient(); 67 68 // 69 // from the ArgreementPortType 70 // 71 72 /** 73 * Returns the name of the agreement instance. 74 * 75 * @return the agreement name 76 * @throws ResourceUnknownException 77 * the remote resource is unknown 78 * @throws ResourceUnavailableException 79 * the remote resource is unavailable 80 */ 81 String getName() throws ResourceUnknownException, ResourceUnavailableException; 82 83 /** 84 * Returns the id of the agreement instance. 85 * 86 * @return the agreement id 87 * @throws ResourceUnknownException 88 * the remote resource is unknown 89 * @throws ResourceUnavailableException 90 * the remote resource is unavailable 91 */ 92 String getAgreementId() throws ResourceUnknownException, ResourceUnavailableException; 93 94 /** 95 * Returns the context of the agreement instance. 96 * 97 * @return the agreement context 98 * @throws ResourceUnknownException 99 * the remote resource is unknown 100 * @throws ResourceUnavailableException 101 * the remote resource is unavailable 102 */ 103 AgreementContextType getContext() throws ResourceUnknownException, ResourceUnavailableException; 104 105 /** 106 * Returns the terms of the agreement instance. 107 * 108 * @return the agreement terms 109 * @throws ResourceUnknownException 110 * the remote resource is unknown 111 * @throws ResourceUnavailableException 112 * the remote resource is unavailable 113 */ 114 TermTreeType getTerms() throws ResourceUnknownException, ResourceUnavailableException; 115 116 /** 117 * Terminates the agreement instance. 118 * 119 * @param reason 120 * a domain-specific termination reason 121 * @throws ResourceUnknownException 122 * the remote resource is unknown 123 * @throws ResourceUnavailableException 124 * the remote resource is unavailable 125 */ 126 void terminate( TerminateInputType reason ) throws ResourceUnknownException, ResourceUnavailableException; 127 128 // 129 // from the ArgreementStatePortType 130 // 131 132 /** 133 * Returns the state of the agreement instance. 134 * 135 * @return the agreement state 136 * @throws ResourceUnknownException 137 * the remote resource is unknown 138 * @throws ResourceUnavailableException 139 * the remote resource is unavailable 140 */ 141 AgreementStateType getState() throws ResourceUnknownException, ResourceUnavailableException; 142 143 /** 144 * Returns the state for the individual guarantee terms of the agreement instance. 145 * 146 * @return the guarantee term states 147 * 148 * @throws ResourceUnknownException 149 * the remote resource is unknown 150 * @throws ResourceUnavailableException 151 * the remote resource is unavailable 152 */ 153 GuaranteeTermStateType[] getGuaranteeTermStates() 154 throws ResourceUnknownException, ResourceUnavailableException; 155 156 /** 157 * Returns the state for the individual service terms of the agreement instance. 158 * 159 * @return the service term states 160 * 161 * @throws ResourceUnknownException 162 * the remote resource is unknown 163 * @throws ResourceUnavailableException 164 * the remote resource is unavailable 165 */ 166 ServiceTermStateType[] getServiceTermStates() 167 throws ResourceUnknownException, ResourceUnavailableException; 168 169 // 170 // from WS resource specification 171 // 172 173 /** 174 * Destroys agreement instance. 175 * 176 * @throws ResourceUnknownException 177 * the remote resource is unknown 178 * @throws ResourceUnavailableException 179 * the remote resource is unavailable 180 */ 181 void destroy() throws ResourceUnknownException, ResourceUnavailableException; 182 183 /** 184 * Returns the service description term with the given name. 185 * 186 * @param name 187 * the name of the service description term to retrieve 188 * @return the service description term with the given name 189 * @throws ResourceUnknownException 190 * the remote resource is unknown 191 * @throws ResourceUnavailableException 192 * the remote resource is unavailable 193 */ 194 ServiceTermStateType getServiceTermState( String name ) 195 throws ResourceUnknownException, ResourceUnavailableException; 196 197 /** 198 * Returns the guarantee term with the given name. 199 * 200 * @param name 201 * the name of the guarantee term to retrieve 202 * @return the guarantee term with the given name 203 * @throws ResourceUnknownException 204 * the remote resource is unknown 205 * @throws ResourceUnavailableException 206 * the remote resource is unavailable 207 */ 208 GuaranteeTermStateType getGuaranteeTermState( String name ) 209 throws ResourceUnknownException, ResourceUnavailableException; 210 211 /** 212 * Returns the resource properties of the agreement instance. 213 * 214 * @return the agreement resource properties 215 * 216 * @throws ResourceUnknownException 217 * the remote resource is unknown 218 * @throws ResourceUnavailableException 219 * the remote resource is unavailable 220 */ 221 AgreementPropertiesType getResourceProperties() 222 throws ResourceUnknownException, ResourceUnavailableException; 223 224 /** 225 * Terminates an agreement. 226 * 227 * @throws ResourceUnknownException 228 * the remote resource is unknown 229 * @throws ResourceUnavailableException 230 * the remote resource is unavailable 231 */ 232 void terminate() throws ResourceUnknownException, ResourceUnavailableException; 233 234 /** 235 * Returns a copy of the client. 236 * 237 * @return the cloned AgreementClient 238 * 239 * @throws CloneNotSupportedException 240 * indicates that the client implementation does not support cloning 241 */ 242 AgreementClient clone() throws CloneNotSupportedException; 243 }