View Javadoc
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.model;
8   
9   import org.mule.api.NamedObject;
10  import org.mule.api.component.LifecycleAdapterFactory;
11  import org.mule.api.context.MuleContextAware;
12  import org.mule.api.exception.MessagingExceptionHandler;
13  import org.mule.api.lifecycle.Lifecycle;
14  import org.mule.api.lifecycle.LifecycleStateEnabled;
15  
16  /**
17   * The <code>Model</code> encapsulates and manages the runtime behaviour of a
18   * Mule Server instance. It is responsible for maintaining the Service instances and
19   * their configuration.
20   */
21  public interface Model extends Lifecycle, MuleContextAware, NamedObject, LifecycleStateEnabled
22  {
23      /**
24       * Returns the model type name. This is a friendly identifier that is used to
25       * look up the SPI class for the model
26       *
27       * @return the model type
28       */
29      String getType();
30  
31      /**
32       * The entry point resolver is used to determine the method to be called on a
33       * service when an event is received for it.
34       *
35       * @return Returns the entryPointResolver.
36       */
37      EntryPointResolverSet getEntryPointResolverSet();
38  
39      /**
40       * This will be used to build entry points on the components registered with the
41       * model.
42       *
43       * @param entryPointResolver The entryPointResolver to set. This will be used to
44       *                           build entry points on the components registered with the model.
45       */
46      void setEntryPointResolverSet(EntryPointResolverSet entryPointResolver);
47  
48      /**
49       * The lifecycle adapter is used by the model to translate Mule lifecycle event
50       * to events that components registered with the model understand. The
51       * <code>LifecycleAdapterFactory</code> is used by the model to instanciate
52       * LifecycleAdapters.
53       *
54       * @return Returns the lifecycleAdapterFactory used by this Model.
55       * @see LifecycleAdapterFactory
56       * @see org.mule.api.component.LifecycleAdapter
57       */
58      LifecycleAdapterFactory getLifecycleAdapterFactory();
59  
60      /**
61       * Sets the lifecycleAdapterFactory on the model.
62       *
63       * @param lifecycleAdapterFactory The lifecycleAdapterFactory to set on this
64       *                                model.
65       * @see LifecycleAdapterFactory
66       * @see org.mule.api.component.LifecycleAdapter
67       */
68      void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdapterFactory);
69  
70      /**
71       * The exception strategy to use by components managed by the model. The
72       * exception strategy is used when an exception occurs while processing the
73       * current event for a service. A service can define it's own exception
74       * strategy, but if it doesn't this implmentation will be used.
75       *
76       * @return the default exception strategy for this model.
77       * @see MessagingExceptionHandler
78       */
79      MessagingExceptionHandler getExceptionListener();
80  
81      /**
82       * The exception strategy to use by components managed by the model. The
83       * exception strategy is used when an exception occurs while processing the
84       * current event for a service. A service can define it's own exception
85       * strategy, but if it doesn't this implmentation will be used.
86       *
87       * @param listener the default exception strategy for this model.
88       * @see MessagingExceptionHandler
89       */
90      void setExceptionListener(MessagingExceptionHandler listener);
91  
92  }