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