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.server.monitoring;
36  
37  import java.util.Map;
38  
39  import org.apache.xmlbeans.XmlObject;
40  import org.ogf.graap.wsag.server.accounting.IAccountingSystem;
41  import org.ogf.schemas.graap.wsAgreement.ServiceTermStateType;
42  
43  /**
44   * IMonitoringContext
45   * 
46   * The monitoring context holds the current service term states of the monitoring process. It is used by the @see
47   * ServiceTermStateMonitor to update the service term states, and by the @see AgreementMonitor to retrieve the
48   * actual service term states.
49   * 
50   * @author Oliver Waeldrich
51   * 
52   */
53  public interface IMonitoringContext
54  {
55      /**
56       * Key to look up the {@link IAgreementContext} from the transient monitoring properties.
57       * 
58       * @see #getTransientProperties()
59       */
60      String WSAG4J_AGREEMENT_EXECUTION_CONTEXT = "wsag4j.context.agreement.execution";
61  
62      /**
63       * 
64       * @return the properties defined for this monitoring context
65       */
66      Map<String, XmlObject> getProperties();
67  
68      /**
69       * @param properties
70       *            the monitoring properties to set
71       */
72      void setProperties( Map<String, XmlObject> properties );
73  
74      /**
75       * 
76       * @return the transient properties defined for this monitoring context
77       */
78      Map<String, Object> getTransientProperties();
79  
80      /**
81       * @param properties
82       *            the monitoring transient properties to set
83       */
84      void setTransientProperties( Map<String, Object> properties );
85  
86      /**
87       * Adds the given service term state for monitoring to the context.
88       * 
89       * @param state
90       *            the state to add
91       */
92      void addServiceTemState( ServiceTermStateType state );
93  
94      /**
95       * Adds a new service term state with the given name for monitoring to the context.
96       * 
97       * @param name
98       *            the name of the service term state
99       */
100     void addServiceTemState( String name );
101 
102     /**
103      * Retrieves all ServiceTermStates monitored in this context.
104      * 
105      * @return an array of ServiceTermStates monitored in this context
106      */
107     ServiceTermStateType[] getServiceTermStates();
108 
109     /**
110      * Retrieves a ServiceTermState identified by the given name.
111      * 
112      * @param name
113      *            the name of the ServiceTerm
114      * 
115      * @return the state of the ServiceTerm
116      */
117     ServiceTermStateType getServiceTermStateByName( String name );
118 
119     /**
120      * Adds the given service term state for monitoring to the context.
121      * 
122      * @param states
123      *            the state array to set
124      */
125     void setServiceTemState( ServiceTermStateType[] states );
126 
127     /**
128      * Adds a service term monitoring handler to this context.
129      * 
130      * @param handler
131      *            the handler to add
132      */
133     void addMonitoringHandler( IServiceTermMonitoringHandler handler );
134 
135     /**
136      * Sets the service term monitoring handler for this context.
137      * 
138      * @param handler
139      *            the handlers to set
140      */
141     void setMonitoringHandler( IServiceTermMonitoringHandler[] handler );
142 
143     /**
144      * Removes a service term monitoring handler from this context.
145      * 
146      * @param handler
147      *            the handler to remove
148      */
149     void removeMonitoringHandler( IServiceTermMonitoringHandler handler );
150 
151     /**
152      * Gets all service term monitoring handler for this context.
153      * 
154      * @return the service term monitoring handler for this context
155      */
156     IServiceTermMonitoringHandler[] getMonitoringHandler();
157 
158     /**
159      * Creates and returns a copy of this object.
160      * 
161      * @return a coned copy of this instance
162      * 
163      * @throws CloneNotSupportedException
164      *             indicates that the implementation does not support cloning
165      */
166     Object clone() throws CloneNotSupportedException;
167 
168     /**
169      * Sets the accounting system that is used with this monitoring context.
170      * 
171      * @param system
172      *            the accounting system to set
173      */
174     void setAccountingSystem( IAccountingSystem system );
175 
176     /**
177      * Retrieves the accounting system that is used with this monitoring context.
178      * 
179      * @return the registered accounting systems
180      */
181     IAccountingSystem getAccountingSystem();
182 }