Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
MuleContext |
|
| 1.0;1 |
1 | /* | |
2 | * $Id: MuleContext.java 20385 2010-11-29 20:25:26Z dfeist $ | |
3 | * -------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | package org.mule.api; | |
11 | ||
12 | import org.mule.api.client.LocalMuleClient; | |
13 | import org.mule.api.config.MuleConfiguration; | |
14 | import org.mule.api.config.ThreadingProfile; | |
15 | import org.mule.api.context.WorkManager; | |
16 | import org.mule.api.context.notification.ServerNotification; | |
17 | import org.mule.api.context.notification.ServerNotificationListener; | |
18 | import org.mule.api.endpoint.EndpointFactory; | |
19 | import org.mule.api.exception.SystemExceptionHandler; | |
20 | import org.mule.api.expression.ExpressionManager; | |
21 | import org.mule.api.lifecycle.InitialisationException; | |
22 | import org.mule.api.lifecycle.Lifecycle; | |
23 | import org.mule.api.lifecycle.LifecycleManager; | |
24 | import org.mule.api.registry.MuleRegistry; | |
25 | import org.mule.api.registry.RegistrationException; | |
26 | import org.mule.api.registry.Registry; | |
27 | import org.mule.api.security.SecurityManager; | |
28 | import org.mule.context.notification.NotificationException; | |
29 | import org.mule.context.notification.ServerNotificationManager; | |
30 | import org.mule.management.stats.AllStatistics; | |
31 | import org.mule.util.queue.QueueManager; | |
32 | ||
33 | import javax.resource.spi.work.WorkListener; | |
34 | import javax.transaction.TransactionManager; | |
35 | ||
36 | public interface MuleContext extends Lifecycle | |
37 | { | |
38 | /** | |
39 | * Sets the Jta Transaction Manager to use with this Mule server instance | |
40 | * | |
41 | * @param manager the manager to use | |
42 | * @throws Exception | |
43 | */ | |
44 | void setTransactionManager(TransactionManager manager) throws Exception; | |
45 | ||
46 | /** | |
47 | * Returns the Jta transaction manager used by this Mule server instance. or | |
48 | * null if a transaction manager has not been set | |
49 | * | |
50 | * @return the Jta transaction manager used by this Mule server instance. or | |
51 | * null if a transaction manager has not been set | |
52 | */ | |
53 | TransactionManager getTransactionManager(); | |
54 | ||
55 | ServerNotificationManager getNotificationManager(); | |
56 | ||
57 | /** | |
58 | * Determines if the server has been started | |
59 | * | |
60 | * @return true if the server has been started | |
61 | */ | |
62 | boolean isStarted(); | |
63 | ||
64 | /** | |
65 | * Determines if the server has been initialised | |
66 | * | |
67 | * @return true if the server has been initialised | |
68 | */ | |
69 | boolean isInitialised(); | |
70 | ||
71 | /** | |
72 | * Determines if the server is being initialised | |
73 | * | |
74 | * @return true if the server is beening initialised | |
75 | */ | |
76 | boolean isInitialising(); | |
77 | ||
78 | boolean isDisposed(); | |
79 | ||
80 | boolean isDisposing(); | |
81 | ||
82 | /** | |
83 | * Registers an intenal server event listener. The listener will be notified | |
84 | * when a particular event happens within the server. Typically this is not | |
85 | * an event in the same sense as an MuleEvent (although there is nothing | |
86 | * stopping the implementation of this class triggering listeners when a | |
87 | * MuleEvent is received). | |
88 | * <p/> | |
89 | * The types of notifications fired is entirely defined by the implementation of | |
90 | * this class | |
91 | * | |
92 | * @param l the listener to register | |
93 | */ | |
94 | void registerListener(ServerNotificationListener l) throws NotificationException; | |
95 | ||
96 | /** | |
97 | * Registers an intenal server event listener. The listener will be notified | |
98 | * when a particular event happens within the server. Typically this is not | |
99 | * an event in the same sense as an MuleEvent (although there is nothing | |
100 | * stopping the implementation of this class triggering listeners when a | |
101 | * MuleEvent is received). | |
102 | * <p/> | |
103 | * The types of notifications fired is entirely defined by the implementation of | |
104 | * this class | |
105 | * | |
106 | * @param l the listener to register | |
107 | * @param resourceIdentifier a particular resource name for the given type | |
108 | * of listener For example, the resourceName could be the name of | |
109 | * a service if the listener was a ServiceNotificationListener | |
110 | */ | |
111 | void registerListener(ServerNotificationListener l, String resourceIdentifier) throws NotificationException; | |
112 | ||
113 | /** | |
114 | * Unregisters a previously registered listener. If the listener has not | |
115 | * already been registered, this method should return without exception | |
116 | * | |
117 | * @param l the listener to unregister | |
118 | */ | |
119 | void unregisterListener(ServerNotificationListener l); | |
120 | ||
121 | /** | |
122 | * Fires a server notification to all regiistered listeners | |
123 | * | |
124 | * @param notification the notification to fire | |
125 | */ | |
126 | void fireNotification(ServerNotification notification); | |
127 | ||
128 | /** | |
129 | * Sets the security manager used by this Mule instance to authenticate and | |
130 | * authorise incoming and outgoing event traffic and service invocations | |
131 | * | |
132 | * @param securityManager the security manager used by this Mule instance to | |
133 | * authenticate and authorise incoming and outgoing event traffic | |
134 | * and service invocations | |
135 | * @throws RegistrationException | |
136 | */ | |
137 | void setSecurityManager(SecurityManager securityManager) throws InitialisationException, RegistrationException; | |
138 | ||
139 | /** | |
140 | * Gets the security manager used by this Mule instance to authenticate and | |
141 | * authorise incoming and outgoing event traffic and service invocations | |
142 | * | |
143 | * @return he security manager used by this Mule instance to authenticate | |
144 | * and authorise incoming and outgoing event traffic and service | |
145 | * invocations | |
146 | */ | |
147 | SecurityManager getSecurityManager(); | |
148 | ||
149 | /** | |
150 | * Obtains a workManager instance that can be used to schedule work in a | |
151 | * thread pool. This will be used primarially by Agents wanting to | |
152 | * schedule work. This work Manager must <b>never</b> be used by provider | |
153 | * implementations as they have their own workManager accible on the | |
154 | * connector. | |
155 | * | |
156 | * @return a workManager instance used by the current MuleManager | |
157 | */ | |
158 | WorkManager getWorkManager(); | |
159 | ||
160 | WorkListener getWorkListener(); | |
161 | ||
162 | /** | |
163 | * Sets the queue manager used by mule for queuing events. This is used for | |
164 | * service queues | |
165 | * | |
166 | * @param queueManager | |
167 | * @throws RegistrationException | |
168 | * | |
169 | */ | |
170 | void setQueueManager(QueueManager queueManager) throws RegistrationException; | |
171 | ||
172 | /** | |
173 | * Gets the queue manager used by mule for queuing events. This is used for | |
174 | * service queues. | |
175 | */ | |
176 | QueueManager getQueueManager(); | |
177 | ||
178 | AllStatistics getStatistics(); | |
179 | ||
180 | LifecycleManager getLifecycleManager(); | |
181 | ||
182 | MuleRegistry getRegistry(); | |
183 | ||
184 | MuleConfiguration getConfiguration(); | |
185 | ||
186 | ThreadingProfile getDefaultMessageDispatcherThreadingProfile(); | |
187 | ||
188 | ThreadingProfile getDefaultMessageRequesterThreadingProfile(); | |
189 | ||
190 | ThreadingProfile getDefaultMessageReceiverThreadingProfile(); | |
191 | ||
192 | ThreadingProfile getDefaultServiceThreadingProfile(); | |
193 | ||
194 | ThreadingProfile getDefaultThreadingProfile(); | |
195 | ||
196 | // TODO This should ideally only be available via an Admin interface | |
197 | void addRegistry(Registry registry); | |
198 | ||
199 | // TODO This should ideally only be available via an Admin interface | |
200 | void removeRegistry(Registry registry); | |
201 | ||
202 | /** | |
203 | * Returns the date when the server was started. | |
204 | * @return the date when the server was started. | |
205 | */ | |
206 | long getStartDate(); | |
207 | ||
208 | /** | |
209 | * Returns the Expression Manager configured for this instance of Mule | |
210 | * @return the Expression Manager configured for this instance of Mule | |
211 | * @see org.mule.api.expression.ExpressionManager | |
212 | */ | |
213 | ExpressionManager getExpressionManager(); | |
214 | ||
215 | /** | |
216 | * Returns the EndpointFactory configured for this instance of Mule | |
217 | * @return the EndpointFactory configured for this instance of Mule | |
218 | * @see EndpointFactory | |
219 | */ | |
220 | EndpointFactory getEndpointFactory(); | |
221 | ||
222 | void setExecutionClassLoader(ClassLoader cl); | |
223 | ||
224 | ClassLoader getExecutionClassLoader(); | |
225 | ||
226 | boolean isStopped(); | |
227 | ||
228 | boolean isStopping(); | |
229 | ||
230 | boolean isStarting(); | |
231 | ||
232 | LocalMuleClient getClient(); | |
233 | ||
234 | SystemExceptionHandler getExceptionListener(); | |
235 | ||
236 | void setExceptionListener(SystemExceptionHandler exceptionListener); | |
237 | } |