Coverage Report - org.mule.umo.manager.UMOManager
 
Classes in this File Line Coverage Branch Coverage Complexity
UMOManager
N/A
N/A
1
 
 1  
 /*
 2  
  * $Id: UMOManager.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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  
 
 11  
 package org.mule.umo.manager;
 12  
 
 13  
 import org.mule.impl.internal.notifications.NotificationException;
 14  
 import org.mule.umo.UMOException;
 15  
 import org.mule.umo.UMOInterceptorStack;
 16  
 import org.mule.umo.endpoint.UMOEndpoint;
 17  
 import org.mule.umo.lifecycle.InitialisationException;
 18  
 import org.mule.umo.lifecycle.Lifecycle;
 19  
 import org.mule.umo.model.UMOModel;
 20  
 import org.mule.umo.provider.UMOConnector;
 21  
 import org.mule.umo.security.UMOSecurityManager;
 22  
 import org.mule.umo.transformer.UMOTransformer;
 23  
 import org.mule.util.queue.QueueManager;
 24  
 
 25  
 import java.util.Map;
 26  
 
 27  
 import javax.transaction.TransactionManager;
 28  
 
 29  
 /**
 30  
  * <code>UMOManager</code> maintains and provides services for a UMO server
 31  
  * instance.
 32  
  *
 33  
  */
 34  
 public interface UMOManager extends Lifecycle
 35  
 {
 36  
     /**
 37  
      * Getter for the envionment parameters declared in the mule-config.xml
 38  
      * 
 39  
      * @param key the propery name
 40  
      * @return the property value
 41  
      */
 42  
     Object getProperty(Object key);
 43  
 
 44  
     /**
 45  
      * @param logicalName the name of the endpoint to retrieve
 46  
      * @return the endpoint instnace if it exists
 47  
      */
 48  
     UMOConnector lookupConnector(String logicalName);
 49  
 
 50  
     /**
 51  
      * @param logicalName the logical mapping name for an endpointUri i.e. rather
 52  
      *            than specifing an endpointUri to be someone@my.com you can supply a
 53  
      *            more descriptive name such as <i>The System Administrator</i>
 54  
      * @param defaultName
 55  
      * @return the actual endpointUri value or null if it is not found
 56  
      * @deprecated endpoint-identifiers have been deprecated in favor of global-endpoints
 57  
      */
 58  
     String lookupEndpointIdentifier(String logicalName, String defaultName);
 59  
 
 60  
     /**
 61  
      * Getter for a global endpoint. Any endpoints returned from this method can be
 62  
      * modified, as they are clones of the registered endpoints.
 63  
      * 
 64  
      * @param logicalName the name of the endpoint
 65  
      * @return the <code>UMOEndpoint</code> or null if it doesn't exist
 66  
      */
 67  
     UMOEndpoint lookupEndpoint(String logicalName);
 68  
 
 69  
     /**
 70  
      * Getter method for a Transformer.
 71  
      * 
 72  
      * @param name the name of the transformer
 73  
      * @return the Transformer instance if found, otherwise null
 74  
      */
 75  
     UMOTransformer lookupTransformer(String name);
 76  
 
 77  
     /**
 78  
      * Registers a <code>UMOConnector</code> with the <code>MuleManager</code>.
 79  
      * 
 80  
      * @param connector the <code>UMOConnector</code> to register
 81  
      */
 82  
     void registerConnector(UMOConnector connector) throws UMOException;
 83  
 
 84  
     /**
 85  
      * UnRegisters a <code>UMOConnector</code> with the <code>MuleManager</code>.
 86  
      * 
 87  
      * @param connectorName the name of the <code>UMOConnector</code> to unregister
 88  
      */
 89  
     void unregisterConnector(String connectorName) throws UMOException;
 90  
 
 91  
     /**
 92  
      * Registers an endpointUri with a logical name
 93  
      * 
 94  
      * @param logicalName the name of the endpointUri
 95  
      * @param endpoint the physical endpointUri value
 96  
      * @deprecated endpoint-identifiers have been deprecated in favor of global-endpoints
 97  
      */
 98  
     void registerEndpointIdentifier(String logicalName, String endpoint) throws InitialisationException;
 99  
 
 100  
     /**
 101  
      * unregisters an endpointUri with a logical name
 102  
      * 
 103  
      * @param logicalName the name of the endpointUri
 104  
      * @deprecated endpoint-identifiers have been deprecated in favor of global-endpoints
 105  
      */
 106  
     void unregisterEndpointIdentifier(String logicalName);
 107  
 
 108  
     /**
 109  
      * Registers a shared/global endpoint with the <code>MuleManager</code>.
 110  
      * 
 111  
      * @param endpoint the <code>UMOEndpoint</code> to register.
 112  
      */
 113  
     void registerEndpoint(UMOEndpoint endpoint) throws InitialisationException;
 114  
 
 115  
     /**
 116  
      * unregisters a shared/global endpoint with the <code>MuleManager</code>.
 117  
      * 
 118  
      * @param endpointName the <code>UMOEndpoint</code> name to unregister.
 119  
      */
 120  
     void unregisterEndpoint(String endpointName);
 121  
 
 122  
     /**
 123  
      * Registers a transformer with the <code>MuleManager</code>.
 124  
      * 
 125  
      * @param transformer the <code>UMOTransformer</code> to register.
 126  
      */
 127  
     void registerTransformer(UMOTransformer transformer) throws InitialisationException;
 128  
 
 129  
     /**
 130  
      * UnRegisters a transformer with the <code>MuleManager</code>.
 131  
      * 
 132  
      * @param transformerName the <code>UMOTransformer</code> name to register.
 133  
      */
 134  
     void unregisterTransformer(String transformerName);
 135  
 
 136  
     /**
 137  
      * Sets an Mule environment parameter in the <code>MuleManager</code>.
 138  
      * 
 139  
      * @param key the parameter name
 140  
      * @param value the parameter value
 141  
      */
 142  
     void setProperty(Object key, Object value);
 143  
 
 144  
     /**
 145  
      * Sets the Jta Transaction Manager to use with this Mule server instance
 146  
      * 
 147  
      * @param manager the manager to use
 148  
      * @throws Exception
 149  
      */
 150  
     void setTransactionManager(TransactionManager manager) throws Exception;
 151  
 
 152  
     /**
 153  
      * Returns the Jta transaction manager used by this Mule server instance. or null
 154  
      * if a transaction manager has not been set
 155  
      * 
 156  
      * @return the Jta transaction manager used by this Mule server instance. or null
 157  
      *         if a transaction manager has not been set
 158  
      */
 159  
     TransactionManager getTransactionManager();
 160  
 
 161  
     /**
 162  
      * The model used for managing components for this server
 163  
      * 
 164  
      * @return The model used for managing components for this server
 165  
      */
 166  
     UMOModel lookupModel(String name);
 167  
 
 168  
     void registerModel(UMOModel model) throws UMOException;
 169  
 
 170  
     void unregisterModel(String name);
 171  
 
 172  
     /**
 173  
      * The model used for managing components for this server
 174  
      * 
 175  
      * @return The models set on this manager instance
 176  
      */
 177  
      Map getModels();
 178  
 
 179  
     /**
 180  
      * Gets all properties associated with the UMOManager
 181  
      * 
 182  
      * @return a map of properties on the Manager
 183  
      */
 184  
     Map getProperties();
 185  
 
 186  
     /**
 187  
      * Gets an unmodifiable collection of Connectors registered with the UMOManager
 188  
      * 
 189  
      * @return All connectors registered on the Manager
 190  
      * @see UMOConnector
 191  
      */
 192  
     Map getConnectors();
 193  
 
 194  
     /**
 195  
      * Gets an unmodifiable collection of endpoints registered with the UMOManager
 196  
      * 
 197  
      * @return All endpoints registered on the Manager
 198  
      * @deprecated endpoint-identifiers have been deprecated in favor of global-endpoints
 199  
      */
 200  
     Map getEndpointIdentifiers();
 201  
 
 202  
     /**
 203  
      * Gets an unmodifiable collection of endpoints registered with the UMOManager
 204  
      * 
 205  
      * @return All endpoints registered on the Manager
 206  
      * @see org.mule.umo.endpoint.UMOEndpoint
 207  
      */
 208  
     Map getEndpoints();
 209  
 
 210  
     /**
 211  
      * Gets an unmodifiable collection of transformers registered with the UMOManager
 212  
      * 
 213  
      * @return All transformers registered on the Manager
 214  
      * @see UMOTransformer
 215  
      */
 216  
     Map getTransformers();
 217  
 
 218  
     /**
 219  
      * registers a interceptor stack list that can be referenced by other components
 220  
      * 
 221  
      * @param name the referenceable name for this stack
 222  
      * @param stack a List of interceptors
 223  
      * @see org.mule.umo.UMOInterceptor
 224  
      */
 225  
     void registerInterceptorStack(String name, UMOInterceptorStack stack);
 226  
 
 227  
     /**
 228  
      * Retrieves a configured interceptor stack.
 229  
      * 
 230  
      * @param name the name of the stack
 231  
      * @return the interceptor stack requested or null if there wasn't one configured
 232  
      *         for the given name
 233  
      */
 234  
     UMOInterceptorStack lookupInterceptorStack(String name);
 235  
 
 236  
     /**
 237  
      * Determines if the server has been started
 238  
      * 
 239  
      * @return true if the server has been started
 240  
      */
 241  
     boolean isStarted();
 242  
 
 243  
     /**
 244  
      * Determines if the server has been initialised
 245  
      * 
 246  
      * @return true if the server has been initialised
 247  
      */
 248  
     boolean isInitialised();
 249  
 
 250  
     /**
 251  
      * Returns the long date when the server was started
 252  
      * 
 253  
      * @return the long date when the server was started
 254  
      */
 255  
     long getStartDate();
 256  
 
 257  
     /**
 258  
      * Will register an agent object on this model. Agents can be server plugins such
 259  
      * as Jms support
 260  
      * 
 261  
      * @param agent
 262  
      */
 263  
     void registerAgent(UMOAgent agent) throws UMOException;
 264  
 
 265  
     /**
 266  
      * Will find a registered agent using its name, which is unique for all
 267  
      * registered agents
 268  
      * 
 269  
      * @param name the name of the Agent to find
 270  
      * @return the Agent or null if there is not agent registered with the given name
 271  
      */
 272  
     UMOAgent lookupAgent(String name);
 273  
 
 274  
     /**
 275  
      * Removes and destroys a registered agent
 276  
      * 
 277  
      * @param name the agent name
 278  
      * @return the destroyed agent or null if the agent doesn't exist
 279  
      */
 280  
     UMOAgent unregisterAgent(String name) throws UMOException;
 281  
 
 282  
     /**
 283  
      * Registers an intenal server event listener. The listener will be notified when
 284  
      * a particular event happens within the server. Typically this is not an event
 285  
      * in the same sense as an UMOEvent (although there is nothing stopping the
 286  
      * implementation of this class triggering listeners when a UMOEvent is
 287  
      * received). The types of notifications fired is entirely defined by the
 288  
      * implementation of this class
 289  
      * 
 290  
      * @param l the listener to register
 291  
      */
 292  
     void registerListener(UMOServerNotificationListener l) throws NotificationException;
 293  
 
 294  
     /**
 295  
      * Registers an intenal server event listener. The listener will be notified when
 296  
      * a particular event happens within the server. Typically this is not an event
 297  
      * in the same sense as an UMOEvent (although there is nothing stopping the
 298  
      * implementation of this class triggering listeners when a UMOEvent is
 299  
      * received). The types of notifications fired is entirely defined by the
 300  
      * implementation of this class
 301  
      * 
 302  
      * @param l the listener to register
 303  
      * @param resourceIdentifier a particular resource name for the given type of
 304  
      *            listener For example, the resourceName could be the name of a
 305  
      *            component if the listener was a ComponentNotificationListener
 306  
      */
 307  
     void registerListener(UMOServerNotificationListener l, String resourceIdentifier)
 308  
         throws NotificationException;
 309  
 
 310  
     /**
 311  
      * Unregisters a previously registered listener. If the listener has not already
 312  
      * been registered, this method should return without exception
 313  
      * 
 314  
      * @param l the listener to unregister
 315  
      */
 316  
     void unregisterListener(UMOServerNotificationListener l);
 317  
 
 318  
     /**
 319  
      * Fires a server notification to all regiistered listeners
 320  
      * 
 321  
      * @param notification the notification to fire
 322  
      */
 323  
     void fireNotification(UMOServerNotification notification);
 324  
 
 325  
     /**
 326  
      * associates a Dependency Injector container with Mule. This can be used to
 327  
      * integrate container managed resources with Mule resources
 328  
      * 
 329  
      * @param context a Container context to use.
 330  
      */
 331  
     void setContainerContext(UMOContainerContext context) throws UMOException;
 332  
 
 333  
     /**
 334  
      * associates a Dependency Injector container with Mule. This can be used to
 335  
      * integrate container managed resources with Mule resources
 336  
      * 
 337  
      * @return the container associated with the Manager
 338  
      */
 339  
     UMOContainerContext getContainerContext();
 340  
 
 341  
     /**
 342  
      * Sets the unique Id for this Manager instance. this id can be used to assign an
 343  
      * identy to the manager so it can be identified in a network of Mule nodes
 344  
      * 
 345  
      * @param id the unique Id for this manager in the network
 346  
      */
 347  
     void setId(String id);
 348  
 
 349  
     /**
 350  
      * Gets the unique Id for this Manager instance. this id can be used to assign an
 351  
      * identy to the manager so it can be identified in a network of Mule nodes
 352  
      * 
 353  
      * @return the unique Id for this manager in the network
 354  
      */
 355  
     String getId();
 356  
 
 357  
     /**
 358  
      * Sets the security manager used by this Mule instance to authenticate and
 359  
      * authorise incoming and outgoing event traffic and service invocations
 360  
      * 
 361  
      * @param securityManager the security manager used by this Mule instance to
 362  
      *            authenticate and authorise incoming and outgoing event traffic and
 363  
      *            service invocations
 364  
      */
 365  
     void setSecurityManager(UMOSecurityManager securityManager) throws InitialisationException;
 366  
 
 367  
     /**
 368  
      * Gets the security manager used by this Mule instance to authenticate and
 369  
      * authorise incoming and outgoing event traffic and service invocations
 370  
      * 
 371  
      * @return he security manager used by this Mule instance to authenticate and
 372  
      *         authorise incoming and outgoing event traffic and service invocations
 373  
      */
 374  
     UMOSecurityManager getSecurityManager();
 375  
 
 376  
     /**
 377  
      * Obtains a workManager instance that can be used to schedule work in a thread
 378  
      * pool. This will be used primarially by UMOAgents wanting to schedule work.
 379  
      * This work Manager must <b>never</b> be used by provider implementations as
 380  
      * they have their own workManager accible on the connector.
 381  
      * 
 382  
      * @return a workManager instance used by the current MuleManager
 383  
      */
 384  
     UMOWorkManager getWorkManager();
 385  
 
 386  
     /**
 387  
      * Sets a workManager instance that can be used to schedule work in a thread
 388  
      * pool. This will be used primarially by UMOAgents wanting to schedule work.
 389  
      * This work Manager must <b>never</b> be used by provider implementations as
 390  
      * they have their own workManager accible on the connector.
 391  
      * 
 392  
      * @param workManager the workManager instance used by the current MuleManager
 393  
      */
 394  
     void setWorkManager(UMOWorkManager workManager);
 395  
 
 396  
     /**
 397  
      * Sets the queue manager used by mule for queuing events. This is used by both
 398  
      * components and vm provider.
 399  
      * 
 400  
      * @param queueManager
 401  
      */
 402  
     void setQueueManager(QueueManager queueManager);
 403  
 
 404  
     /**
 405  
      * Gets the queue manager used by mule for queuing events. This is used by both
 406  
      * components and vm provider.
 407  
      * 
 408  
      * @return
 409  
      */
 410  
     QueueManager getQueueManager();
 411  
 }