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