1 /* 2 * $Id: JavaComponent.java 12269 2008-07-10 04:19:03Z dfeist $ 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.api.component; 12 13 import org.mule.api.model.EntryPointResolverSet; 14 import org.mule.api.object.ObjectFactory; 15 import org.mule.api.routing.NestedRouterCollection; 16 import org.mule.component.PooledJavaComponent; 17 import org.mule.object.PrototypeObjectFactory; 18 import org.mule.object.SingletonObjectFactory; 19 20 /** 21 * <code>JavaComponent</code> is a Java {@link Component} implementation used to 22 * invoke Java component implementations. A <code>JavaComponent</code> uses an 23 * {@link ObjectFactory} to specify the object instance's source and allows for 24 * singleton and prototype implementations to be used along with other custom 25 * {@link ObjectFactory} that allow component instances to be obtained from 26 * containers such as Spring. A <code>JavaComponent</code> uses a customizable 27 * {@link EntryPointResolverSet} in order to resolve which method should be used for 28 * invocation and allows java bindings to be configure. Java Component bindings, if 29 * implemented by the JavaComponent implementation, uses a component instance proxy 30 * to implement interface methods using calls to outbound endpoints. 31 */ 32 public interface JavaComponent extends Component 33 { 34 35 /** 36 * A {@link JavaComponent} can have a custom entry-point resolver for its own 37 * object. By default this is null. When set this resolver will override the 38 * resolver on the model 39 * 40 * @return Null is a resolver set has not been set otherwise the resolver to use 41 * on this service 42 */ 43 EntryPointResolverSet getEntryPointResolverSet(); 44 45 /** 46 * A {@link JavaComponent} can have a custom entry-point resolver for its own 47 * object. By default this is null. When set this resolver will override the 48 * resolver on the model 49 * 50 * @return Null is a resolver set has not been set otherwise the resolver to use 51 * on this service 52 */ 53 void setEntryPointResolverSet(EntryPointResolverSet entryPointResolverSet); 54 55 // TODO This should be renamed to something like "Bindings", moved up to 56 // Component. NestedRouter should also be renamed to "Binding" and made more 57 // generic so as to support other types of bindings e.g. wsdl port -> ws-endpont, 58 // or script context variable -> outbound endpoint etc. See MULE-3114 59 NestedRouterCollection getNestedRouter(); 60 61 void setNestedRouter(NestedRouterCollection nestedRouter); 62 63 /** 64 * The object factory used to obtain the component object instance. Mule core 65 * provides two implementations: {@link SingletonObjectFactory} and 66 * {@link PrototypeObjectFactory}.<br/> The spring-config module provides an 67 * {@link ObjectFactory} implementation that delegates to spring. There is no 68 * PooledObjectFactory, the {@link PooledJavaComponent} should be used for 69 * pooling. 70 * 71 * @param objectFactory 72 */ 73 void setObjectFactory(ObjectFactory objectFactory); 74 75 /** 76 * @return 77 */ 78 ObjectFactory getObjectFactory(); 79 80 /** 81 * @return 82 */ 83 Class getObjectType(); 84 85 /** 86 * Returns the factory used create life-cycle adaptors that are used to wrap 87 * component instance. 88 * 89 * @return 90 */ 91 LifecycleAdapterFactory getLifecycleAdapterFactory(); 92 93 /** 94 * Sets the factory used create life-cycle adaptors that are used to wrap 95 * component instance. 96 * 97 * @param lifecycleAdaptor 98 */ 99 void setLifecycleAdapterFactory(LifecycleAdapterFactory lifecycleAdaptor); 100 }