View Javadoc

1   /*
2    * $Id: UMOMessageDispatcher.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.provider;
12  
13  import org.mule.umo.lifecycle.Disposable;
14  
15  /**
16   * <code>UMOMessageDispatcher</code> combines {@link UMOMessageDispatching} with
17   * various lifecycle methods for the actual instances doing message sending/receiving.
18   */
19  public interface UMOMessageDispatcher extends Disposable, UMOConnectable, UMOMessageDispatching
20  {
21  
22      /**
23       * This method can perform necessary state updates before any of the
24       * {@link UMOMessageDispatching} methods are invoked.
25       * 
26       * @see {@link UMOMessageDispatcherFactory#activate(org.mule.umo.endpoint.UMOImmutableEndpoint, UMOMessageDispatcher)}
27       */
28      void activate();
29  
30      /**
31       * After sending/receiving a message, the dispatcher can use this method e.g. to
32       * clean up its internal state (if it has any) or return pooled resources to
33       * whereever it got them during {@link #activate()}.
34       * 
35       * @see {@link UMOMessageDispatcherFactory#passivate(org.mule.umo.endpoint.UMOImmutableEndpoint, UMOMessageDispatcher)}
36       */
37      void passivate();
38  
39      /**
40       * Determines whether this dispatcher can be reused after message
41       * sending/receiving.
42       * 
43       * @return <code>true</code> if this dispatcher can be reused,
44       *         <code>false</code> otherwise (for example when
45       *         {@link Disposable#dispose()} has been called because an Exception was
46       *         raised)
47       */
48      boolean validate();
49  
50      /**
51       * Gets the connector for this dispatcher
52       * 
53       * @return the connector for this dispatcher
54       */
55      UMOConnector getConnector();
56  
57  }