View Javadoc

1   /*
2    * $Id: JavaComponent.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.api.component;
12  
13  import org.mule.api.model.EntryPointResolverSet;
14  import org.mule.api.object.ObjectFactory;
15  import org.mule.component.PooledJavaComponent;
16  import org.mule.object.PrototypeObjectFactory;
17  import org.mule.object.SingletonObjectFactory;
18  
19  import java.util.List;
20  
21  /**
22   * <code>JavaComponent</code> is a Java {@link Component} implementation used to
23   * invoke Java component implementations. A <code>JavaComponent</code> uses an
24   * {@link ObjectFactory} to specify the object instance's source and allows for
25   * singleton and prototype implementations to be used along with other custom
26   * {@link ObjectFactory} that allow component instances to be obtained from
27   * containers such as Spring. A <code>JavaComponent</code> uses a customizable
28   * {@link EntryPointResolverSet} in order to resolve which method should be used for
29   * invocation and allows java bindings to be configure. Java Component bindings, if
30   * implemented by the JavaComponent implementation, uses a component instance proxy
31   * to implement interface methods using calls to outbound endpoints.
32   */
33  public interface JavaComponent extends Component
34  {
35  
36      /**
37       * A {@link JavaComponent} can have a custom entry-point resolver for its own
38       * object. By default this is null. When set this resolver will override the
39       * resolver on the model
40       * 
41       * @return Null is a resolver set has not been set otherwise the resolver to use
42       *         on this service
43       */
44      EntryPointResolverSet getEntryPointResolverSet();
45  
46      /**
47       * A {@link JavaComponent} can have a custom entry-point resolver for its own
48       * object. By default this is null. When set this resolver will override the
49       * resolver on the model
50       */
51      void setEntryPointResolverSet(EntryPointResolverSet entryPointResolverSet);
52  
53      List<InterfaceBinding> getInterfaceBindings();
54  
55      void setInterfaceBindings(List<InterfaceBinding> bindgins);
56  
57      /**
58       * The object factory used to obtain the component object instance. Mule core
59       * provides two implementations: {@link SingletonObjectFactory} and
60       * {@link PrototypeObjectFactory}.<br/> The spring-config module provides an
61       * {@link ObjectFactory} implementation that delegates to spring. There is no
62       * PooledObjectFactory, the {@link PooledJavaComponent} should be used for
63       * pooling.
64       * 
65       * @param objectFactory
66       */
67      void setObjectFactory(ObjectFactory objectFactory);
68  
69      ObjectFactory getObjectFactory();
70  
71      Class<?> getObjectType();
72  
73      /**
74       * Returns the factory used create life-cycle adaptors that are used to wrap
75       * component instance.
76       */
77      LifecycleAdapterFactory getLifecycleAdapterFactory();
78  
79      /**
80       * Sets the factory used create life-cycle adaptors that are used to wrap
81       * component instance.
82       * 
83       * @param lifecycleAdaptor
84       */
85      void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdaptor);
86  }