View Javadoc

1   /*
2    * $Id: UMODescriptor.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;
12  
13  import org.mule.MuleException;
14  import org.mule.umo.endpoint.UMOEndpoint;
15  import org.mule.umo.routing.UMOInboundRouterCollection;
16  import org.mule.umo.routing.UMONestedRouterCollection;
17  import org.mule.umo.routing.UMOOutboundRouterCollection;
18  import org.mule.umo.routing.UMOResponseRouterCollection;
19  import org.mule.umo.transformer.UMOTransformer;
20  
21  import java.beans.ExceptionListener;
22  import java.util.List;
23  import java.util.Map;
24  
25  /**
26   * <code>UMODescriptor</code> describes all the properties for a Mule UMO. New Mule
27   * Managed components can be initialised as needed from their descriptor.
28   *
29   */
30  public interface UMODescriptor extends UMOImmutableDescriptor
31  {
32      /**
33       * Interceptors are executable objects that can be chained together. Interceptors
34       * are executed in the order they are added, for example if INTERCEPTOR_1 is
35       * added and then INTERCEPTOR_2 is added to UMO_A the execution order will be:
36       * INTERCEPTOR_1 -> INTERCEPTOR_2 -> UMO_A.
37       *
38       * @param interceptor the interceptor to add.
39       */
40      void addInterceptor(UMOInterceptor interceptor);
41  
42      /**
43       * Interceptors are executable objects that can be chained together. Interceptors
44       * are executed in the order they are added, for example if INTERCEPTOR_1 is
45       * added and then INTERCEPTOR_2 is added to UMO_A the execution order will be:
46       * INTERCEPTOR_1 -> INTERCEPTOR_2 -> UMO_A.
47       *
48       * @param interceptorList A list of interceptors to associate.
49       */
50      void setInterceptors(List interceptorList);
51  
52      /**
53       * The exception strategy to use to handle exceptions in the Mule UMO.
54       *
55       * @param listener the exception strategy to use. If none has been set or
56       *            argument is null a default
57       */
58      void setExceptionListener(ExceptionListener listener);
59  
60      /**
61       * The inbound endpointUri to use when receiveing an event.
62       *
63       * @param endpoint the inbound endpoint to use
64       * @throws MuleException if the Provider is not valid i.e. the proivder is not a
65       *             receiver
66       * @see org.mule.umo.endpoint.UMOEndpoint
67       * @deprecated use setInboundRouter() instead (see MULE-506)
68       */
69      void setInboundEndpoint(UMOEndpoint endpoint) throws MuleException;
70  
71      /**
72       * sets the identifier for the Mule UMO created from the descriptor
73       *
74       * @param newName the identifier for the Mule UMO created from the descriptor
75       */
76      void setName(String newName);
77  
78      /**
79       * The outbound Provider to use when sending an event.
80       *
81       * @param endpoint the outbound endpoint to use
82       * @throws MuleException if the Provider is not valid i.e. the proivder is a
83       *             receiver
84       * @see UMOEndpoint
85       * @deprecated use setOutboundRouter() instead (see MULE-506)
86       */
87      void setOutboundEndpoint(UMOEndpoint endpoint) throws MuleException;
88  
89      /**
90       * @param props the properties for the descriptor. These will be passed to the
91       *            UMO when it's initialise method is called or set as bean properties
92       *            whe the UMO is created
93       */
94      void setProperties(Map props);
95  
96      /**
97       * The version on the Mule UMO. This is currently not used by the mule run-time
98       * but may be used in future.
99       *
100      * @param ver the version of the Mule descriptor
101      */
102     void setVersion(String ver);
103 
104     /**
105      * The String used to instanciate create the object, this can be a FQ class name
106      * or a reference to an object in a configured container
107      *
108      * @param reference The String object reference
109      */
110     void setImplementation(Object reference);
111 
112     /**
113      * Inbound Routers control how events are received by a component. If no router
114      * is set. A default will be used that uses the inboundProvider set on his
115      * descriptor.
116      *
117      * @param router the inbound router for this component
118      * @see UMOInboundRouterCollection
119      */
120     void setInboundRouter(UMOInboundRouterCollection router);
121 
122     /**
123      * Outbound Routers control how events are published by a component once. the
124      * event has been processed. If no router is set. A default will be used that
125      * uses the outboundProvider set on his descriptor to route the event.
126      *
127      * @param router the outbound router for this component
128      * @see UMOOutboundRouterCollection
129      */
130     void setOutboundRouter(UMOOutboundRouterCollection router);
131 
132     void setNestedRouter(UMONestedRouterCollection router);
133 
134     /**
135      * Response Routers control how events are returned in a request/response call.
136      * It cn be use to aggregate response events before returning, thus acting as a
137      * Join in a forked process. This can be used to make request/response calls a
138      * lot more efficient as independent tasks can be forked, execute concurrently
139      * and then join before the request completes
140      *
141      * @param router the response router for this component
142      * @see org.mule.umo.routing.UMOResponseRouterCollection
143      */
144     void setResponseRouter(UMOResponseRouterCollection router);
145 
146     /**
147      * @param transformer the transformer to use.
148      * @see UMOTransformer
149      * @see org.mule.transformers.AbstractTransformer
150      * @deprecated use setInboundRouter() instead (see MULE-506)
151      */
152     void setInboundTransformer(UMOTransformer transformer);
153 
154     /**
155      * The transformer to use when sending events or data.
156      *
157      * @param transformer the transformer to use.
158      * @see UMOTransformer
159      * @see org.mule.transformers.AbstractTransformer
160      * @deprecated use setOutboundRouter() instead (see MULE-506)
161      */
162     void setOutboundTransformer(UMOTransformer transformer);
163 
164     /**
165      * Determines if only a single instance of this component is created. This is
166      * useful when a component hands off event processing to another engine such as
167      * Rules processing or Bpel and the processing engine allocates and manages its
168      * own threads.
169      *
170      * @param singleton true if this component is a singleton
171      */
172     void setSingleton(boolean singleton);
173 
174     /**
175      * Sets the initial state of this component
176      *
177      * @param state the initial state of this component
178      * @see org.mule.impl.ImmutableMuleDescriptor#INITIAL_STATE_STARTED
179      * @see org.mule.impl.ImmutableMuleDescriptor#INITIAL_STATE_STOPPED
180      * @see org.mule.impl.ImmutableMuleDescriptor#INITIAL_STATE_PAUSED
181      */
182     void setInitialState(String state);
183 
184     void setEncoding(String encoding);
185 
186     /**
187      * Sets the name of the contaier where the object for this descriptor resides. If
188      * this value is 'none' the 'implementaiton' attributed is expected to be a fully
189      * qualified class name that will be instanciated.
190      *
191      * @param containerName the container name, or null if it is not known - in which
192      *            case each container will be queried for the component
193      *            implementation.
194      */
195     void setContainer(String containerName);
196 
197     /**
198      * Sets the Model name that this descriptor is registered within.
199      * @param modelName name of the model
200      */
201     void setModelName(String modelName);
202 }