001: /*
002: * $Id: MuleContext.java 11371 2008-03-15 03:12:09Z tcarlson $
003: * --------------------------------------------------------------------------------------
004: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
005: *
006: * The software in this package is published under the terms of the CPAL v1.0
007: * license, a copy of which has been included with this distribution in the
008: * LICENSE.txt file.
009: */
010: package org.mule.api;
011:
012: import org.mule.api.config.MuleConfiguration;
013: import org.mule.api.config.ThreadingProfile;
014: import org.mule.api.context.WorkManager;
015: import org.mule.api.context.notification.ServerNotification;
016: import org.mule.api.context.notification.ServerNotificationListener;
017: import org.mule.api.lifecycle.InitialisationException;
018: import org.mule.api.lifecycle.Lifecycle;
019: import org.mule.api.lifecycle.LifecycleManager;
020: import org.mule.api.registry.RegistrationException;
021: import org.mule.api.registry.Registry;
022: import org.mule.api.security.SecurityManager;
023: import org.mule.api.transport.ConnectionStrategy;
024: import org.mule.context.notification.NotificationException;
025: import org.mule.context.notification.ServerNotificationManager;
026: import org.mule.management.stats.AllStatistics;
027: import org.mule.util.queue.QueueManager;
028:
029: import javax.resource.spi.work.WorkListener;
030: import javax.transaction.TransactionManager;
031:
032: public interface MuleContext extends Lifecycle {
033: /**
034: * Sets the Jta Transaction Manager to use with this Mule server instance
035: *
036: * @param manager the manager to use
037: * @throws Exception
038: */
039: void setTransactionManager(TransactionManager manager)
040: throws Exception;
041:
042: /**
043: * Returns the Jta transaction manager used by this Mule server instance. or
044: * null if a transaction manager has not been set
045: *
046: * @return the Jta transaction manager used by this Mule server instance. or
047: * null if a transaction manager has not been set
048: */
049: TransactionManager getTransactionManager();
050:
051: ServerNotificationManager getNotificationManager();
052:
053: /**
054: * Determines if the server has been started
055: *
056: * @return true if the server has been started
057: */
058: boolean isStarted();
059:
060: /**
061: * Determines if the server has been initialised
062: *
063: * @return true if the server has been initialised
064: */
065: boolean isInitialised();
066:
067: /**
068: * Determines if the server is being initialised
069: *
070: * @return true if the server is beening initialised
071: */
072: boolean isInitialising();
073:
074: boolean isDisposed();
075:
076: boolean isDisposing();
077:
078: /**
079: * Registers an intenal server event listener. The listener will be notified
080: * when a particular event happens within the server. Typically this is not
081: * an event in the same sense as an MuleEvent (although there is nothing
082: * stopping the implementation of this class triggering listeners when a
083: * MuleEvent is received).
084: * <p/>
085: * The types of notifications fired is entirely defined by the implementation of
086: * this class
087: *
088: * @param l the listener to register
089: */
090: void registerListener(ServerNotificationListener l)
091: throws NotificationException;
092:
093: /**
094: * Registers an intenal server event listener. The listener will be notified
095: * when a particular event happens within the server. Typically this is not
096: * an event in the same sense as an MuleEvent (although there is nothing
097: * stopping the implementation of this class triggering listeners when a
098: * MuleEvent is received).
099: * <p/>
100: * The types of notifications fired is entirely defined by the implementation of
101: * this class
102: *
103: * @param l the listener to register
104: * @param resourceIdentifier a particular resource name for the given type
105: * of listener For example, the resourceName could be the name of
106: * a service if the listener was a ServiceNotificationListener
107: */
108: void registerListener(ServerNotificationListener l,
109: 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)
136: throws InitialisationException, RegistrationException;
137:
138: /**
139: * Gets the security manager used by this Mule instance to authenticate and
140: * authorise incoming and outgoing event traffic and service invocations
141: *
142: * @return he security manager used by this Mule instance to authenticate
143: * and authorise incoming and outgoing event traffic and service
144: * invocations
145: */
146: SecurityManager getSecurityManager();
147:
148: /**
149: * Obtains a workManager instance that can be used to schedule work in a
150: * thread pool. This will be used primarially by UMOAgents wanting to
151: * schedule work. This work Manager must <b>never</b> be used by provider
152: * implementations as they have their own workManager accible on the
153: * connector.
154: *
155: * @return a workManager instance used by the current MuleManager
156: */
157: WorkManager getWorkManager();
158:
159: WorkListener getWorkListener();
160:
161: /**
162: * Sets the queue manager used by mule for queuing events. This is used for
163: * service queues
164: *
165: * @param queueManager
166: * @throws RegistrationException
167: *
168: */
169: void setQueueManager(QueueManager queueManager)
170: throws RegistrationException;
171:
172: /**
173: * Gets the queue manager used by mule for queuing events. This is used for
174: * service queues.
175: *
176: * @return
177: *
178: */
179: QueueManager getQueueManager();
180:
181: public AllStatistics getStatistics();
182:
183: LifecycleManager getLifecycleManager();
184:
185: Registry getRegistry();
186:
187: void applyLifecycle(Object object) throws MuleException;
188:
189: MuleConfiguration getConfiguration();
190:
191: ThreadingProfile getDefaultMessageDispatcherThreadingProfile();
192:
193: ThreadingProfile getDefaultMessageRequesterThreadingProfile();
194:
195: ThreadingProfile getDefaultMessageReceiverThreadingProfile();
196:
197: ThreadingProfile getDefaultComponentThreadingProfile();
198:
199: ThreadingProfile getDefaultThreadingProfile();
200:
201: ConnectionStrategy getDefaultConnectionStrategy();
202:
203: /**
204: * Returns the date when the server was started.
205: */
206: long getStartDate();
207: }
|