View Javadoc

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.AgreementOffer;
38  import org.ogf.graap.wsag.api.exceptions.AgreementFactoryException;
39  import org.ogf.graap.wsag.api.exceptions.NegotiationFactoryException;
40  import org.ogf.graap.wsag.api.exceptions.ResourceUnavailableException;
41  import org.ogf.graap.wsag.api.exceptions.ResourceUnknownException;
42  import org.ogf.schemas.graap.wsAgreement.AgreementTemplateType;
43  import org.ogf.schemas.graap.wsAgreement.negotiation.NegotiationContextType;
44  import org.w3.x2005.x08.addressing.EndpointReferenceType;
45  
46  /**
47   * {@link AgreementFactoryService} The contract of a WSAG4J agreement factory service.
48   * 
49   * @author Oliver Waeldrich
50   */
51  public interface AgreementFactoryService
52      extends WSDMResource
53  {
54  
55      /**
56       * Returns the web-service client used for communicating with the SLA management server.
57       * 
58       * @return the web service client for this service.
59       */
60      WsClient getWebServiceClient();
61  
62      /**
63       * Retrieves the templates for supported SLAs from the SLA management system.
64       * 
65       * @return all templates exposed by this agreement factory instance
66       * @throws ResourceUnknownException
67       *             the remote resource is unknown
68       * @throws ResourceUnavailableException
69       *             the remote resource is unavailable
70       */
71      AgreementTemplateType[] getTemplates() throws ResourceUnknownException, ResourceUnavailableException;
72  
73      /**
74       * Creates a new agreement instance with the SLA management server.
75       * 
76       * @param offer
77       *            the agreement offer
78       * @return a client for the created agreement
79       * @throws AgreementFactoryException
80       *             indicates that the agreement was rejected by the factory
81       * @throws ResourceUnknownException
82       *             the remote resource is unknown
83       * @throws ResourceUnavailableException
84       *             the remote resource is unavailable
85       */
86      AgreementClient createAgreement( AgreementOffer offer )
87          throws AgreementFactoryException, ResourceUnknownException, ResourceUnavailableException;
88  
89      /**
90       * Creates a pending agreement instance. The decision whether to accept or reject the agreement is
91       * deferred.
92       * 
93       * @param offer
94       *            The agreement offer passed from the agreement initiator.
95       * @return An {@link AgreementClient} for the new created agreement.
96       * @throws AgreementFactoryException
97       *             An error occurred during the the agreement creation. The agreement was rejected.
98       * @throws ResourceUnknownException
99       *             No pending agreement factory exists at the specified endpoint.
100      * @throws ResourceUnavailableException
101      *             The agreement factory at the specified endpoint is not accessible.
102      */
103     AgreementClient createPendingAgreement( AgreementOffer offer )
104         throws AgreementFactoryException, ResourceUnknownException, ResourceUnavailableException;
105 
106     /**
107      * Creates a pending agreement instance. The decision whether to accept or reject the agreement is
108      * deferred. Once the decision has been made the client is notified via the given notification endpoint.
109      * 
110      * @param offer
111      *            The agreement offer passed from the agreement initiator.
112      * @param acceptanceEPR
113      *            An endpoint to an agreement acceptance instance.
114      * @return An {@link AgreementClient} for the new created agreement.
115      * @throws AgreementFactoryException
116      *             An error occurred during the the agreement creation. The agreement was rejected.
117      * @throws ResourceUnknownException
118      *             No pending agreement factory exists at the specified endpoint.
119      * @throws ResourceUnavailableException
120      *             The agreement factory at the specified endpoint is not accessible.
121      */
122     AgreementClient createPendingAgreement( AgreementOffer offer, EndpointReferenceType acceptanceEPR )
123         throws AgreementFactoryException, ResourceUnknownException, ResourceUnavailableException;
124 
125     /**
126      * Initiates a new negotiation process.
127      * 
128      * @param context
129      *            the context for the negotiation to initialize
130      * @return the new initiated negotiation instance
131      * @throws NegotiationFactoryException
132      *             indicates that the creation of a negotiation process was rejected
133      * @throws ResourceUnknownException
134      *             the remote resource is unknown
135      * @throws ResourceUnavailableException
136      *             the remote resource is unavailable
137      */
138     NegotiationClient initiateNegotiation( NegotiationContextType context )
139         throws NegotiationFactoryException, ResourceUnknownException, ResourceUnavailableException;
140 }