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.api.client; 36 37 import org.ogf.graap.wsag.api.exceptions.NegotiationException; 38 import org.ogf.graap.wsag.api.exceptions.ResourceUnavailableException; 39 import org.ogf.graap.wsag.api.exceptions.ResourceUnknownException; 40 import org.ogf.schemas.graap.wsAgreement.AgreementTemplateType; 41 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationContextType; 42 import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationOfferType; 43 44 /** 45 * NegotiationService 46 * 47 * @author hrasheed 48 */ 49 public interface NegotiationService 50 { 51 52 /** 53 * Returns the context of this negotiation process. 54 * 55 * @return the negotiation context 56 * @throws ResourceUnknownException 57 * the remote resource is unknown 58 * @throws ResourceUnavailableException 59 * the remote resource is unavailable 60 */ 61 NegotiationContextType getNegotiationContext() 62 throws ResourceUnknownException, ResourceUnavailableException; 63 64 /** 65 * A negotiation instance supports zero or more templates that can be used to create negotiation offers. 66 * In case of a negotiation process, these templates are a subset of the templates offered by an agreement 67 * factory. Only these templates are returned for which a proper negotiation strategy is implemented. in 68 * case of agreement re negotiation, a negotiation instance may return one ore more templates to bootstrap 69 * the negotiation process. 70 * 71 * @return the negotiable templates 72 * @throws ResourceUnknownException 73 * the remote resource is unknown 74 * @throws ResourceUnavailableException 75 * the remote resource is unavailable 76 */ 77 AgreementTemplateType[] getNegotiableTemplates() 78 throws ResourceUnknownException, ResourceUnavailableException; 79 80 /** 81 * Returns a history of exchanged offers in this negotiation process. 82 * 83 * @return the offers exchanged in this negotiation 84 * @throws ResourceUnknownException 85 * the remote resource is unknown 86 * @throws ResourceUnavailableException 87 * the remote resource is unavailable 88 */ 89 NegotiationOfferType[] getNegotiationOffers() 90 throws ResourceUnknownException, ResourceUnavailableException; 91 92 /** 93 * Negotiates a set of agreement offers. 94 * 95 * @param offers 96 * the offers to negotiate 97 * @return a set of counter offers 98 * @throws NegotiationException 99 * an error occured processing the negotiation request 100 * @throws ResourceUnknownException 101 * the remote resource is unknown 102 * @throws ResourceUnavailableException 103 * the remote resource is unavailable 104 */ 105 NegotiationOfferType[] negotiate( NegotiationOfferType[] offers ) 106 throws NegotiationException, ResourceUnknownException, ResourceUnavailableException; 107 108 /** 109 * Advertises a set of negotiation offers. 110 * 111 * @param offers 112 * the offers to advertise 113 * @throws NegotiationException 114 * an error occured processing the negotiation request 115 * @throws ResourceUnknownException 116 * the remote resource is unknown 117 * @throws ResourceUnavailableException 118 * the remote resource is unavailable 119 */ 120 void advertise( NegotiationOfferType[] offers ) 121 throws NegotiationException, ResourceUnknownException, ResourceUnavailableException; 122 123 /** 124 * Terminates a negotiation process. 125 * 126 * @throws ResourceUnknownException 127 * the remote resource is unknown 128 * @throws ResourceUnavailableException 129 * the remote resource is unavailable 130 */ 131 void terminate() throws ResourceUnknownException, ResourceUnavailableException; 132 133 /** 134 * @return the web service client for this service. 135 */ 136 WsClient getWebServiceClient(); 137 138 /** 139 * Destroys this web service object. 140 * 141 * @throws ResourceUnknownException 142 * the remote resource is unknown 143 * @throws ResourceUnavailableException 144 * the remote resource is unavailable 145 */ 146 void destroy() throws ResourceUnknownException, ResourceUnavailableException; 147 148 }