You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/12/26 10:40:46 UTC
svn commit: r490275 [1/2] - in /incubator/tuscany/java/sca:
kernel/core/src/main/java/org/apache/tuscany/core/implementation/
kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/
kernel/core/src/main/java/org/apache/tuscany/core/...
Author: jmarino
Date: Tue Dec 26 01:40:44 2006
New Revision: 490275
URL: http://svn.apache.org/viewvc?view=rev&rev=490275
Log:
refactor JDKOutboundInvocationHandler and WireService to allow client specificaton of the proxy type
Added:
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java (with props)
Modified:
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBindlessBuilder.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeReference.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeService.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java
incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeReferenceTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java
incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java
incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java
incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java
incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceExtensionTestCase.java
incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/wire/WireObjectFactoryTestCase.java
incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiBindingBuilder.java
incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiReference.java
incubator/tuscany/java/sca/runtime/osgi/src/main/java/org/apache/tuscany/osgi/binding/OSGiService.java
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2BindingBuilder.java
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Reference.java
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/main/java/org/apache/tuscany/binding/axis2/Axis2Service.java
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ReferenceTestCase.java
incubator/tuscany/java/sca/services/bindings/binding.axis2/src/test/java/org/apache/tuscany/binding/axis2/Axis2ServiceTestCase.java
incubator/tuscany/java/sca/services/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixBindingBuilder.java
incubator/tuscany/java/sca/services/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixReference.java
incubator/tuscany/java/sca/services/bindings/binding.celtix/src/main/java/org/apache/tuscany/binding/celtix/CeltixService.java
incubator/tuscany/java/sca/services/bindings/binding.celtix/src/test/java/org/apache/tuscany/binding/celtix/CeltixServiceTestCase.java
incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSReference.java
incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSService.java
incubator/tuscany/java/sca/services/bindings/binding.jsonrpc/src/main/java/org/apache/tuscany/binding/jsonrpc/JSONRPCService.java
incubator/tuscany/java/sca/services/bindings/binding.rmi/src/main/java/org/apache/tuscany/binding/rmi/RMIBindingBuilder.java
incubator/tuscany/java/sca/services/bindings/binding.rmi/src/main/java/org/apache/tuscany/binding/rmi/RMIReference.java
incubator/tuscany/java/sca/services/bindings/binding.rmi/src/main/java/org/apache/tuscany/binding/rmi/RMIService.java
incubator/tuscany/java/sca/services/bindings/binding.rmi/src/test/java/org/apache/tuscany/binding/rmi/RMIReferenceTestCase.java
incubator/tuscany/java/sca/services/bindings/binding.rmi/src/test/java/org/apache/tuscany/binding/rmi/RMIServiceTestCase.java
incubator/tuscany/java/sca/services/containers/container.groovy/src/main/java/org/apache/tuscany/container/groovy/GroovyAtomicComponent.java
incubator/tuscany/java/sca/services/containers/container.javascript/src/main/java/org/apache/tuscany/container/javascript/JavaScriptComponent.java
incubator/tuscany/java/sca/services/containers/container.ruby/src/main/java/org/apache/tuscany/container/ruby/RubyComponent.java
incubator/tuscany/java/sca/services/containers/container.script/src/main/java/org/apache/tuscany/container/script/ScriptComponent.java
incubator/tuscany/java/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/SpringTestUtils.java
incubator/tuscany/java/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/ServiceInvocationTestCase.java
incubator/tuscany/java/sca/services/containers/container.spring/src/test/java/org/apache/tuscany/container/spring/impl/SpringCompositeBuilderTestCase.java
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestBindingBuilder.java
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestBindingReference.java
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestBindingService.java
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingBuilder.java
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingReference.java
incubator/tuscany/java/sca/test/src/main/java/org/apache/tuscany/test/binding/TestSocketBindingService.java
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoAtomicComponent.java Tue Dec 26 01:40:44 2006
@@ -52,7 +52,6 @@
* @version $$Rev$$ $$Date$$
*/
public abstract class PojoAtomicComponent extends AtomicComponentExtension {
-
protected EventInvoker<Object> initInvoker;
protected EventInvoker<Object> destroyInvoker;
protected PojoObjectFactory<?> instanceFactory;
@@ -64,6 +63,7 @@
protected Map<String, Member> callbackSites;
protected List<Injector<Object>> injectors;
protected Class implementationClass;
+ private List<Class<?>> constructorParamTypes = new ArrayList<Class<?>>();
public PojoAtomicComponent(PojoConfiguration configuration) {
super(configuration.getName(),
@@ -81,6 +81,7 @@
destroyInvoker = configuration.getDestroyInvoker();
instanceFactory = configuration.getInstanceFactory();
constructorParamNames = configuration.getConstructorParamNames();
+ constructorParamTypes = configuration.getConstructorParamTypes();
serviceInterfaces = configuration.getServiceInterfaces();
injectors = new ArrayList<Injector<Object>>();
referenceSites = configuration.getReferenceSite() != null ? configuration.getReferenceSite()
@@ -192,7 +193,7 @@
for (int i = 0; i < constructorParamNames.size(); i++) {
if (name.equals(constructorParamNames.get(i))) {
ObjectFactory[] initializerFactories = instanceFactory.getInitializerFactories();
- initializerFactories[i] = createWireFactory(wire);
+ initializerFactories[i] = createWireFactory(constructorParamTypes.get(i), wire);
break;
}
}
@@ -227,10 +228,13 @@
}
protected Injector<Object> createInjector(Member member, OutboundWire wire) {
- ObjectFactory<?> factory = createWireFactory(wire);
if (member instanceof Field) {
+ Class<?> type = ((Field) member).getType();
+ ObjectFactory<?> factory = createWireFactory(type, wire);
return new FieldInjector<Object>((Field) member, factory);
} else if (member instanceof Method) {
+ Class<?> type = ((Method) member).getParameterTypes()[0];
+ ObjectFactory<?> factory = createWireFactory(type, wire);
return new MethodInjector<Object>((Method) member, factory);
} else {
throw new InvalidAccessorException("Member must be a field or method", member.getName());
@@ -242,7 +246,7 @@
List<OutboundWire> wireFactories) {
List<ObjectFactory<?>> factories = new ArrayList<ObjectFactory<?>>();
for (OutboundWire wire : wireFactories) {
- factories.add(createWireFactory(wire));
+ factories.add(createWireFactory(interfaceType, wire));
}
if (member instanceof Field) {
Field field = (Field) member;
@@ -263,6 +267,6 @@
}
}
- protected abstract ObjectFactory<?> createWireFactory(OutboundWire wire);
+ protected abstract ObjectFactory<?> createWireFactory(Class<?> interfaze, OutboundWire wire);
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/PojoConfiguration.java Tue Dec 26 01:40:44 2006
@@ -27,9 +27,9 @@
import org.apache.tuscany.spi.component.CompositeComponent;
import org.apache.tuscany.spi.component.ScopeContainer;
import org.apache.tuscany.spi.component.WorkContext;
+import org.apache.tuscany.spi.extension.ExecutionMonitor;
import org.apache.tuscany.spi.services.work.WorkScheduler;
import org.apache.tuscany.spi.wire.WireService;
-import org.apache.tuscany.spi.extension.ExecutionMonitor;
import org.apache.tuscany.core.injection.EventInvoker;
import org.apache.tuscany.core.injection.Injector;
@@ -41,12 +41,12 @@
* @version $Rev$ $Date$
*/
public class PojoConfiguration {
-
private String name;
private CompositeComponent parent;
private ScopeContainer scopeContainer;
private PojoObjectFactory<?> instanceFactory;
private List<String> constructorParamNames = new ArrayList<String>();
+ private List<Class<?>> constructorParamTypes = new ArrayList<Class<?>>();
private int initLevel;
private EventInvoker<Object> initInvoker;
private EventInvoker<Object> destroyInvoker;
@@ -114,6 +114,18 @@
public void addConstructorParamName(String name) {
constructorParamNames.add(name);
+ }
+
+ public List<Class<?>> getConstructorParamTypes() {
+ return constructorParamTypes;
+ }
+
+ public void setConstructorParamTypes(List<Class<?>> constructorParamTypes) {
+ this.constructorParamTypes = constructorParamTypes;
+ }
+
+ public void addConstructorParamType(Class<?> type) {
+ constructorParamTypes.add(type);
}
public int getInitLevel() {
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBindlessBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBindlessBuilder.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBindlessBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBindlessBuilder.java Tue Dec 26 01:40:44 2006
@@ -61,8 +61,8 @@
DeploymentContext deploymentContext) {
return new CompositeService(definition.getName(),
definition.getServiceContract().getInterfaceClass(),
- parent,
- wireService);
+ parent
+ );
}
public Reference build(CompositeComponent parent,
@@ -70,7 +70,6 @@
DeploymentContext deploymentContext) {
return new CompositeReference(definition.getName(),
parent,
- wireService,
definition.getServiceContract());
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeReference.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeReference.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeReference.java Tue Dec 26 01:40:44 2006
@@ -23,7 +23,6 @@
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.model.ServiceContract;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireService;
/**
* A bindless reference to a target service in the parent composite
@@ -34,9 +33,8 @@
public CompositeReference(String name,
CompositeComponent parent,
- WireService wireService,
ServiceContract contract) {
- super(name, contract.getInterfaceClass(), parent, wireService);
+ super(name, contract.getInterfaceClass(), parent);
}
public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeService.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeService.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeService.java Tue Dec 26 01:40:44 2006
@@ -23,22 +23,21 @@
import org.apache.tuscany.spi.model.Operation;
import org.apache.tuscany.spi.model.ServiceContract;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireService;
public class CompositeService extends ServiceExtension {
public CompositeService(String name,
Class<?> interfaze,
- CompositeComponent parent,
- WireService wireService) {
- super(name, interfaze, parent, wireService);
+ CompositeComponent parent
+ ) {
+ super(name, interfaze, parent);
}
/**
* A service for a remote binding does not need a target invoker, but a bindless service does because it gets wired
- * localy from a reference (or from a parent service?!) We just reuse CompositeTargetInvoker for now since
- * it seems the target invoker we need does the same thing, if this is confirmed we should give it a common name
- * FIXME !!! Notice that this method is not defined in the SPI !!!
+ * localy from a reference (or from a parent service?!) We just reuse CompositeTargetInvoker for now since it seems
+ * the target invoker we need does the same thing, if this is confirmed we should give it a common name FIXME !!!
+ * Notice that this method is not defined in the SPI !!!
*/
public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
return new CompositeTargetInvoker(operation, outboundWire);
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaAtomicComponent.java Tue Dec 26 01:40:44 2006
@@ -77,22 +77,25 @@
}
}
- protected Injector<Object> createCallbackInjector(Member member, ServiceContract<?> contract,
+ protected Injector<Object> createCallbackInjector(Member member,
+ ServiceContract<?> contract,
InboundWire inboundWire) {
if (member instanceof Field) {
Field field = (Field) member;
- ObjectFactory<?> factory = new CallbackWireObjectFactory(contract, wireService, inboundWire);
+ ObjectFactory<?> factory = new CallbackWireObjectFactory(field.getType(), wireService, inboundWire);
return new FieldInjector<Object>(field, factory);
} else if (member instanceof Method) {
Method method = (Method) member;
- ObjectFactory<?> factory = new CallbackWireObjectFactory(contract, wireService, inboundWire);
+ Class<?> type = method.getParameterTypes()[0];
+ ObjectFactory<?> factory = new CallbackWireObjectFactory(type, wireService, inboundWire);
return new MethodInjector<Object>(method, factory);
} else {
throw new InvalidAccessorException("Member must be a field or method", member.getName());
}
}
- protected ObjectFactory<?> createWireFactory(OutboundWire wire) {
- return new WireObjectFactory(wire, wireService);
+ @SuppressWarnings({"unchecked"})
+ protected ObjectFactory<?> createWireFactory(Class<?> interfaze, OutboundWire wire) {
+ return new WireObjectFactory(interfaze, wire, wireService);
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/java/JavaComponentBuilder.java Tue Dec 26 01:40:44 2006
@@ -102,7 +102,6 @@
configuration.setWireService(wireService);
configuration.setWorkContext(workContext);
configuration.setScheduler(workScheduler);
-
configuration.setImplementationClass(definition.getImplementation().getImplementationClass());
// setup property injection sites
@@ -133,6 +132,9 @@
PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
configuration.setInstanceFactory(instanceFactory);
configuration.getConstructorParamNames().addAll(ctorDef.getInjectionNames());
+ for (Class<?> clazz : constr.getParameterTypes()) {
+ configuration.addConstructorParamType(clazz);
+ }
configuration.setMonitor(monitor);
configuration.setName(definition.getName());
JavaAtomicComponent component = new JavaAtomicComponent(configuration);
@@ -147,7 +149,6 @@
// handle resources
for (Resource resource : componentType.getResources().values()) {
-
ObjectFactory<?> objectFactory = resource.getObjectFactory();
if (objectFactory != null) {
component.addResourceFactory(resource.getName(), objectFactory);
@@ -165,7 +166,6 @@
}
component.addResourceFactory(name, factory);
}
-
}
for (JavaMappedService service : componentType.getServices().values()) {
@@ -178,7 +178,7 @@
}
component.setAllowsPassByReference(componentType.isAllowsPassByReference());
-
+
if (componentType.getConversationIDMember() != null) {
component.addConversationIDFactory(componentType.getConversationIDMember());
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/builder/SystemComponentBuilder.java Tue Dec 26 01:40:44 2006
@@ -118,6 +118,9 @@
PojoObjectFactory<?> instanceFactory = new PojoObjectFactory(constr);
configuration.setInstanceFactory(instanceFactory);
configuration.getConstructorParamNames().addAll(ctorDef.getInjectionNames());
+ for (Class<?> clazz : constr.getParameterTypes()) {
+ configuration.addConstructorParamType(clazz);
+ }
configuration.setName(definition.getName());
SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
// handle properties
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentImpl.java Tue Dec 26 01:40:44 2006
@@ -48,7 +48,7 @@
return true;
}
- protected ObjectFactory<?> createWireFactory(OutboundWire wire) {
+ protected ObjectFactory<?> createWireFactory(Class<?> interfaze, OutboundWire wire) {
return new WireObjectFactory(wire);
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemReferenceImpl.java Tue Dec 26 01:40:44 2006
@@ -26,7 +26,6 @@
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireInvocationHandler;
/**
* Default implementation of a reference configured with the
@@ -73,10 +72,6 @@
public void setInterface(Class<?> referenceInterface) {
this.referenceInterface = referenceInterface;
- }
-
- public WireInvocationHandler getHandler() {
- throw new UnsupportedOperationException();
}
public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/system/component/SystemServiceImpl.java Tue Dec 26 01:40:44 2006
@@ -27,7 +27,6 @@
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireInvocationHandler;
/**
* Default implementation for services configured with the
@@ -68,11 +67,6 @@
public Class<?> getInterface() {
return inboundWire.getServiceContract().getInterfaceClass();
- }
-
- public WireInvocationHandler getHandler() {
- // system services do not proxy
- throw new UnsupportedOperationException();
}
public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation) {
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CallbackWireObjectFactory.java Tue Dec 26 01:40:44 2006
@@ -20,7 +20,6 @@
import org.apache.tuscany.spi.ObjectCreationException;
import org.apache.tuscany.spi.ObjectFactory;
-import org.apache.tuscany.spi.model.ServiceContract;
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.WireService;
@@ -32,17 +31,17 @@
public class CallbackWireObjectFactory implements ObjectFactory {
private WireService wireService;
- private ServiceContract<?> contract;
+ private Class<?> interfaze;
private InboundWire wire;
- public CallbackWireObjectFactory(ServiceContract<?> contract, WireService wireService, InboundWire wire) {
- this.contract = contract;
+ public CallbackWireObjectFactory(Class<?> interfaze, WireService wireService, InboundWire wire) {
+ this.interfaze = interfaze;
this.wireService = wireService;
this.wire = wire;
}
public Object getInstance() throws ObjectCreationException {
- return wireService.createCallbackProxy(contract, wire);
+ return wireService.createCallbackProxy(interfaze, wire);
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandler.java Tue Dec 26 01:40:44 2006
@@ -80,6 +80,7 @@
private transient String convIdForRemotableTarget;
private transient String convIdFromThread;
private String referenceName;
+ private Class<?> interfaze;
/**
* Constructor used for deserialization only
@@ -87,15 +88,11 @@
public JDKOutboundInvocationHandler() {
}
- public JDKOutboundInvocationHandler(OutboundWire wire) {
- this(wire, null);
- referenceName = wire.getReferenceName();
- }
-
- public JDKOutboundInvocationHandler(OutboundWire wire, WorkContext workContext)
+ public JDKOutboundInvocationHandler(Class<?> interfaze, OutboundWire wire, WorkContext workContext)
throws NoMethodForOperationException {
this.workContext = workContext;
- init(wire);
+ this.interfaze = interfaze;
+ init(interfaze, wire);
}
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
@@ -157,12 +154,10 @@
}
Object result = invoke(chain, invoker, args, null, null);
-
if (contractIsConversational && contractIsRemotable) {
// Make sure we restore the remembered conv id to continue propagating
workContext.setIdentifier(Scope.CONVERSATION, convIdFromThread);
}
-
return result;
}
@@ -180,10 +175,12 @@
public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(referenceName);
+ out.writeObject(interfaze);
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
referenceName = (String) in.readObject();
+ interfaze = (Class<?>) in.readObject();
}
public void reactivate() throws ReactivationException {
@@ -198,13 +195,13 @@
// TODO handle multiplicity
OutboundWire wire = wires.get(0);
try {
- init(wire);
+ init(interfaze, wire);
} catch (NoMethodForOperationException e) {
throw new ReactivationException(e);
}
}
- private void init(OutboundWire wire) {
+ private void init(Class<?> interfaze, OutboundWire wire) throws NoMethodForOperationException {
ServiceContract contract = wire.getServiceContract();
this.referenceName = wire.getReferenceName();
SCAObject wireContainer = wire.getContainer();
@@ -227,7 +224,7 @@
Map<Operation<?>, OutboundInvocationChain> invocationChains = wire.getInvocationChains();
this.chains = new HashMap<Method, ChainHolder>(invocationChains.size());
// TODO optimize this
- Method[] methods = contract.getInterfaceClass().getMethods();
+ Method[] methods = interfaze.getMethods();
for (Map.Entry<Operation<?>, OutboundInvocationChain> entry : invocationChains.entrySet()) {
Operation operation = entry.getKey();
Method method = findMethod(operation, methods);
Modified: incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/main/java/org/apache/tuscany/core/wire/jdk/JDKWireService.java Tue Dec 26 01:40:44 2006
@@ -25,7 +25,6 @@
import org.apache.tuscany.spi.annotation.Autowire;
import org.apache.tuscany.spi.component.WorkContext;
-import org.apache.tuscany.spi.model.ServiceContract;
import org.apache.tuscany.spi.policy.PolicyBuilderRegistry;
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.OutboundWire;
@@ -55,54 +54,40 @@
public void init() {
}
- public <T> T createProxy(Class<T> interfaze, InboundWire wire) throws ProxyCreationException {
- JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(wire, context);
- ClassLoader cl = interfaze.getClassLoader();
- return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
- }
-
- public Object createProxy(RuntimeWire wire) throws ProxyCreationException {
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
assert wire != null : "Wire was null";
if (wire instanceof InboundWire) {
InboundWire inbound = (InboundWire) wire;
- Class<?> interfaze = wire.getServiceContract().getInterfaceClass();
JDKInboundInvocationHandler handler = new JDKInboundInvocationHandler(inbound, context);
ClassLoader cl = interfaze.getClassLoader();
- //FIXME
- return Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler);
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
} else if (wire instanceof OutboundWire) {
OutboundWire outbound = (OutboundWire) wire;
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(outbound, context);
- Class<?> interfaze = outbound.getServiceContract().getInterfaceClass();
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(interfaze, outbound, context);
ClassLoader cl = interfaze.getClassLoader();
- return Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler);
+ return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
} else {
throw new ProxyCreationException("Invalid wire type", wire.getClass().getName());
}
}
- public Object createCallbackProxy(ServiceContract<?> contract, InboundWire wire) throws ProxyCreationException {
- Class<?> interfaze = contract.getCallbackClass();
+ public Object createCallbackProxy(Class<?> interfaze, InboundWire wire) throws ProxyCreationException {
ClassLoader cl = interfaze.getClassLoader();
JDKCallbackInvocationHandler handler = new JDKCallbackInvocationHandler(wire, context);
return interfaze.cast(Proxy.newProxyInstance(cl, new Class[]{interfaze}, handler));
}
- public WireInvocationHandler createHandler(RuntimeWire wire) {
- assert wire != null : "Wire was null";
+ public WireInvocationHandler createHandler(Class<?> interfaze, RuntimeWire wire) {
+ assert wire != null;
if (wire instanceof InboundWire) {
InboundWire inbound = (InboundWire) wire;
return new JDKInboundInvocationHandler(inbound, context);
} else if (wire instanceof OutboundWire) {
OutboundWire outbound = (OutboundWire) wire;
- return new JDKOutboundInvocationHandler(outbound, context);
+ return new JDKOutboundInvocationHandler(interfaze, outbound, context);
} else {
throw new ProxyCreationException("Invalid wire type", wire.getClass().getName());
}
- }
-
- public WireInvocationHandler createCallbackHandler(InboundWire wire) {
- return new JDKCallbackInvocationHandler(wire, context);
}
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeComponentImplBasicTestCase.java Tue Dec 26 01:40:44 2006
@@ -53,13 +53,13 @@
public void testGetChildren() throws Exception {
CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
- composite.register(new ServiceExtension("foo", null, null, null));
+ composite.register(new ServiceExtension("foo", null, null));
Assert.assertEquals(1, composite.getChildren().size());
}
public void testGetServices() throws Exception {
CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
- ServiceExtension extension = new ServiceExtension("foo", null, null, null);
+ ServiceExtension extension = new ServiceExtension("foo", null, null);
InboundWire wire = TestUtils.createInboundWire(Foo.class);
wire.setContainer(extension);
extension.setInboundWire(wire);
@@ -70,14 +70,14 @@
public void testGetService() throws Exception {
CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
- composite.register(new ServiceExtension("foo", null, null, null));
+ composite.register(new ServiceExtension("foo", null, null));
composite.start();
assertNotNull(composite.getService("foo"));
}
public void testServiceNotFound() throws Exception {
CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
- composite.register(new ServiceExtension("foo", null, null, null));
+ composite.register(new ServiceExtension("foo", null, null));
composite.start();
assertNull(composite.getService("bar"));
}
@@ -91,7 +91,7 @@
public void testReferencesServices() throws Exception {
CompositeComponent composite = new CompositeComponentImpl("parent", null, null, null);
- composite.register(new ServiceExtension("foo", null, null, null));
+ composite.register(new ServiceExtension("foo", null, null));
composite.register(getReference("bar"));
Assert.assertEquals(1, composite.getReferences().size());
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeReferenceTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/composite/CompositeReferenceTestCase.java Tue Dec 26 01:40:44 2006
@@ -42,7 +42,6 @@
MyServiceContract serviceContract = new MyServiceContract();
CompositeReference compositeReference = new CompositeReference("testCompositeReferemce",
null,
- null,
serviceContract);
Operation operation = new Operation<Type>("sayHi", null, null, null, false, null, NO_CONVERSATION);
OutboundInvocationChain chain = EasyMock.createMock(OutboundInvocationChain.class);
@@ -63,7 +62,6 @@
MyServiceContract serviceContract = new MyServiceContract();
CompositeReference compositeReference = new CompositeReference("testCompositeReferemce",
- null,
null,
serviceContract);
Operation operation = new Operation<Type>("sayHi", null, null, null, false, null, NO_CONVERSATION);
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/JavaReferenceWireTestCase.java Tue Dec 26 01:40:44 2006
@@ -60,14 +60,15 @@
EasyMock.expect(wire.getReferenceName()).andReturn("target").atLeastOnce();
EasyMock.replay(wire);
WireService service = EasyMock.createMock(WireService.class);
- EasyMock.expect(service.createProxy(EasyMock.eq(wire))).andAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
- OutboundWire wire = (OutboundWire) EasyMock.getCurrentArguments()[0];
- wire.getInvocationChains();
- return target;
- }
+ EasyMock.expect(service.createProxy(EasyMock.eq(Target.class), EasyMock.eq(wire)))
+ .andAnswer(new IAnswer<Target>() {
+ public Target answer() throws Throwable {
+ OutboundWire wire = (OutboundWire) EasyMock.getCurrentArguments()[1];
+ wire.getInvocationChains();
+ return target;
+ }
- }).atLeastOnce();
+ }).atLeastOnce();
EasyMock.replay(service);
configuration.setWireService(service);
configuration.setName("source");
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/java/integration/OutboundWireToJavaTestCase.java Tue Dec 26 01:40:44 2006
@@ -79,7 +79,7 @@
StatelessScopeContainer scope = new StatelessScopeContainer(workContext, null);
scope.start();
final OutboundWire wire = getWire(scope);
- Target service = (Target) wireService.createProxy(wire);
+ Target service = wireService.createProxy(Target.class, wire);
assertNotNull(service);
service.setString("foo");
assertEquals(null, service.getString());
@@ -93,7 +93,7 @@
scope.onEvent(new RequestStart(this));
final OutboundWire wire = getWire(scope);
- Target service = (Target) wireService.createProxy(wire);
+ Target service = wireService.createProxy(Target.class, wire);
assertNotNull(service);
service.setString("foo");
@@ -102,8 +102,8 @@
FutureTask<Void> future = new FutureTask<Void>(new Runnable() {
public void run() {
scope.onEvent(new RequestStart(this));
- Target service2 = (Target) wireService.createProxy(wire);
- Target target2 = (Target) wireService.createProxy(wire);
+ Target service2 = wireService.createProxy(Target.class, wire);
+ Target target2 = wireService.createProxy(Target.class, wire);
assertEquals(null, service2.getString());
service2.setString("bar");
assertEquals("bar", service2.getString());
@@ -127,8 +127,8 @@
scope.onEvent(new HttpSessionStart(this, session1));
final OutboundWire wire = getWire(scope);
- Target service = (Target) wireService.createProxy(wire);
- Target target = (Target) wireService.createProxy(wire);
+ Target service = wireService.createProxy(Target.class, wire);
+ Target target = wireService.createProxy(Target.class, wire);
assertNotNull(service);
service.setString("foo");
assertEquals("foo", service.getString());
@@ -141,10 +141,10 @@
workContext.setIdentifier(Scope.SESSION, session2);
scope.onEvent(new HttpSessionStart(this, session2));
- Target service2 = (Target) wireService.createProxy(wire);
+ Target service2 = wireService.createProxy(Target.class, wire);
assertNotNull(service2);
assertNull(service2.getString());
- Target target2 = (Target) wireService.createProxy(wire);
+ Target target2 = wireService.createProxy(Target.class, wire);
service2.setString("bar");
assertEquals("bar", service2.getString());
assertEquals("bar", target2.getString());
@@ -165,8 +165,8 @@
scope.start();
scope.onEvent(new CompositeStart(this, null));
final OutboundWire wire = getWire(scope);
- Target service = (Target) wireService.createProxy(wire);
- Target target = (Target) wireService.createProxy(wire);
+ Target service = wireService.createProxy(Target.class, wire);
+ Target target = wireService.createProxy(Target.class, wire);
assertNotNull(service);
service.setString("foo");
assertEquals("foo", service.getString());
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/implementation/system/component/SystemAtomicComponentTestCase.java Tue Dec 26 01:40:44 2006
@@ -71,7 +71,9 @@
configuration.setInstanceFactory(factory);
configuration.setInitInvoker(initInvoker);
configuration.addConstructorParamName("foo");
+ configuration.addConstructorParamType(String.class);
configuration.addConstructorParamName("ref");
+ configuration.addConstructorParamType(Foo.class);
configuration.setName("foo");
SystemAtomicComponentImpl component = new SystemAtomicComponentImpl(configuration);
component.addPropertyFactory("foo", new SingletonObjectFactory<String>("baz"));
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/injection/CallbackWireObjectFactoryTestCase.java Tue Dec 26 01:40:44 2006
@@ -18,7 +18,6 @@
*/
package org.apache.tuscany.core.injection;
-import org.apache.tuscany.spi.idl.java.JavaServiceContract;
import org.apache.tuscany.spi.wire.WireService;
import junit.framework.TestCase;
@@ -33,13 +32,11 @@
public class CallbackWireObjectFactoryTestCase extends TestCase {
public void testCreateInstance() throws Exception {
- JavaServiceContract contract = new JavaServiceContract();
- contract.setCallbackClass(Foo.class);
WireService service = createMock(WireService.class);
- service.createCallbackProxy(contract, null);
+ service.createCallbackProxy(Foo.class, null);
expectLastCall().andReturn(null);
replay(service);
- CallbackWireObjectFactory factory = new CallbackWireObjectFactory(contract, service, null);
+ CallbackWireObjectFactory factory = new CallbackWireObjectFactory(Foo.class, service, null);
factory.getInstance();
verify(service);
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationIdleExpireTestCase.java Tue Dec 26 01:40:44 2006
@@ -61,7 +61,7 @@
}
// verify the instance was expired
assertNull(store.readRecord(target, "12345A"));
- // continue the conversation - should throw an error
+ // continue the conversation - should throw an error
try {
handler.invoke(operation2, null);
fail();
@@ -94,7 +94,7 @@
InboundWire iwire = MockFactory.createInboundWire("foo", Foo.class);
iwire.setContainer(target);
connector.connect(owire, iwire, false);
- handler = new JDKOutboundInvocationHandler(owire, workContext);
+ handler = new JDKOutboundInvocationHandler(Foo.class, owire, workContext);
operation1 = Foo.class.getMethod("operation1");
operation2 = Foo.class.getMethod("operation2");
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationMaxAgeExpireTestCase.java Tue Dec 26 01:40:44 2006
@@ -88,13 +88,13 @@
EasyMock.expect(source.getName()).andReturn("source").atLeastOnce();
EasyMock.replay(source);
- owire = MockFactory.createOutboundWire("foo", ConversationMaxAgeExpireTestCase.Foo.class);
+ owire = MockFactory.createOutboundWire("foo", Foo.class);
owire.setContainer(source);
owire.setTargetName(new QualifiedName("foo/bar"));
- InboundWire iwire = MockFactory.createInboundWire("foo", ConversationMaxAgeExpireTestCase.Foo.class);
+ InboundWire iwire = MockFactory.createInboundWire("foo", Foo.class);
iwire.setContainer(target);
connector.connect(owire, iwire, false);
- handler = new JDKOutboundInvocationHandler(owire, workContext);
+ handler = new JDKOutboundInvocationHandler(Foo.class, owire, workContext);
operation1 = Foo.class.getMethod("operation1");
operation2 = Foo.class.getMethod("operation2");
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/integration/conversation/ConversationStartStopEndTestCase.java Tue Dec 26 01:40:44 2006
@@ -94,7 +94,7 @@
InboundWire iwire = MockFactory.createInboundWire("foo", Foo.class);
iwire.setContainer(target);
connector.connect(owire, iwire, false);
- handler = new JDKOutboundInvocationHandler(owire, workContext);
+ handler = new JDKOutboundInvocationHandler(Foo.class, owire, workContext);
operation1 = Foo.class.getMethod("operation1");
operation2 = Foo.class.getMethod("operation2");
endOperation = Foo.class.getMethod("end");
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/BasicReferenceInvocationHandlerTestCase.java Tue Dec 26 01:40:44 2006
@@ -56,7 +56,7 @@
OutboundWire wire = new OutboundWireImpl();
wire.addInvocationChain(operation, chain);
wire.setServiceContract(contract);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
assertEquals("foo", handler.invoke(null, echo, new String[]{"foo"}));
assertEquals(1, interceptor.getCount());
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/ContractCompatibilityTestCase.java Tue Dec 26 01:40:44 2006
@@ -353,24 +353,16 @@
super(null, null);
}
- public <T> T createProxy(Class<T> interfaze, InboundWire wire) throws ProxyCreationException {
+ public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
throw new UnsupportedOperationException();
}
- public Object createProxy(RuntimeWire wire) throws ProxyCreationException {
+ public Object createCallbackProxy(Class<?> interfaze, InboundWire wire) throws ProxyCreationException {
throw new UnsupportedOperationException();
}
- public Object createCallbackProxy(ServiceContract<?> contract, InboundWire wire) throws ProxyCreationException {
- throw new UnsupportedOperationException();
- }
-
-
- public WireInvocationHandler createHandler(RuntimeWire wire) {
- throw new UnsupportedOperationException();
- }
- public WireInvocationHandler createCallbackHandler(InboundWire wire) {
+ public WireInvocationHandler createHandler(Class<?> interfaze, RuntimeWire wire) {
throw new UnsupportedOperationException();
}
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationErrorTestCase.java Tue Dec 26 01:40:44 2006
@@ -28,7 +28,6 @@
import org.apache.tuscany.spi.wire.OutboundWire;
import junit.framework.TestCase;
-
import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
import org.apache.tuscany.core.mock.wire.MockStaticInvoker;
import org.apache.tuscany.core.mock.wire.MockSyncInterceptor;
@@ -67,7 +66,7 @@
wire.setServiceContract(contract);
Operation operation = contract.getOperations().get("checkedException");
wire.addInvocationChain(operation, createChain(checkedMethod, operation));
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(TestBean.class, wire, null);
try {
TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class[]{TestBean.class}, handler);
@@ -85,7 +84,7 @@
Operation operation = contract.getOperations().get("runtimeException");
OutboundInvocationChain chain = createChain(runtimeMethod, operation);
wire.addInvocationChain(operation, chain);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(TestBean.class, wire, null);
try {
TestBean proxy = (TestBean) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class[]{TestBean.class}, handler);
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/OutboundInvocationHandlerTestCase.java Tue Dec 26 01:40:44 2006
@@ -61,7 +61,7 @@
Operation operation = contract.getOperations().get("hello");
wire.addInvocationChain(operation, createChain(operation));
wire.setServiceContract(contract);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
assertEquals("foo", handler.invoke(hello, new Object[]{"foo"}));
}
@@ -70,7 +70,7 @@
Operation operation = contract.getOperations().get("hello");
wire.addInvocationChain(operation, createChain(operation));
wire.setServiceContract(contract);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
try {
handler.invoke(hello, new Object[]{});
fail("Expected " + IllegalArgumentException.class.getName());
@@ -88,7 +88,7 @@
OutboundWire wire = new OutboundWireImpl();
wire.setServiceContract(contract);
wire.addInvocationChain(operation, source);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
try {
assertEquals("foo", handler.invoke(hello, new Object[]{}));
fail("Expected " + IllegalArgumentException.class.getName());
@@ -106,7 +106,7 @@
OutboundWire wire = new OutboundWireImpl();
wire.setServiceContract(contract);
wire.addInvocationChain(operation, source);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(SimpleTarget.class, wire, null);
assertEquals("foo", handler.invoke(hello, new Object[]{"foo"}));
}
Added: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java?view=auto&rev=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java (added)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java Tue Dec 26 01:40:44 2006
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.wire.jdk;
+
+import java.lang.reflect.Method;
+
+import org.apache.tuscany.spi.idl.java.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.spi.idl.java.JavaServiceContract;
+import org.apache.tuscany.spi.model.Operation;
+import org.apache.tuscany.spi.wire.MessageImpl;
+import org.apache.tuscany.spi.wire.OutboundInvocationChain;
+import org.apache.tuscany.spi.wire.OutboundWire;
+import org.apache.tuscany.spi.wire.TargetInvoker;
+
+import junit.framework.TestCase;
+import org.apache.tuscany.core.idl.java.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.core.wire.OutboundInvocationChainImpl;
+import org.apache.tuscany.core.wire.OutboundWireImpl;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JDKOutboundInvocationHandlerProxyTestCase extends TestCase {
+
+ private JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+ private OutboundWire wire;
+ private Method clientHello;
+ private TargetInvoker targetInvoker;
+
+ public void testDifferentInterface() throws Throwable {
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Client.class, wire, null);
+ handler.invoke(null, clientHello, null);
+ EasyMock.verify(targetInvoker);
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ wire = new OutboundWireImpl();
+ JavaServiceContract contract = registry.introspect(Target.class);
+ for (Operation<?> operation : contract.getOperations().values()) {
+ OutboundInvocationChain chain = new OutboundInvocationChainImpl(operation);
+ wire.addInvocationChain(operation, chain);
+ targetInvoker = EasyMock.createMock(TargetInvoker.class);
+ EasyMock.expect(targetInvoker.invokeTarget(EasyMock.isNull(), EasyMock.eq(TargetInvoker.NONE)))
+ .andReturn(new MessageImpl());
+ EasyMock.expect(targetInvoker.isCacheable()).andReturn(false);
+ EasyMock.replay(targetInvoker);
+ chain.setTargetInvoker(targetInvoker);
+ }
+ wire.setServiceContract(contract);
+ clientHello = Client.class.getMethod("hello");
+
+ }
+
+ private interface Target {
+ String hello();
+ }
+
+ private interface Client {
+ String hello();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerProxyTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerSerializationTestCase.java Tue Dec 26 01:40:44 2006
@@ -55,7 +55,8 @@
private TargetInvoker invoker;
public void testSerializeDeserialize() throws Throwable {
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire, workContext);
+ JDKOutboundInvocationHandler handler =
+ new JDKOutboundInvocationHandler(Foo.class, wire, workContext);
handler.invoke(Foo.class.getMethod("invoke"), null);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
ObjectOutputStream ostream = new ObjectOutputStream(stream);
Modified: incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/core/src/test/java/org/apache/tuscany/core/wire/jdk/JDKOutboundInvocationHandlerTestCase.java Tue Dec 26 01:40:44 2006
@@ -58,7 +58,7 @@
ServiceContract contract = new JavaServiceContract(Foo.class);
contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
wire.setServiceContract(contract);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Foo.class, wire, null);
Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
assertNotNull(foo.toString());
}
@@ -68,7 +68,7 @@
ServiceContract contract = new JavaServiceContract(Foo.class);
contract.setInteractionScope(InteractionScope.NONCONVERSATIONAL);
wire.setServiceContract(contract);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(wire);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Foo.class, wire, null);
Foo foo = (Foo) Proxy.newProxyInstance(getClass().getClassLoader(), new Class[]{Foo.class}, handler);
assertNotNull(foo.hashCode());
}
@@ -106,16 +106,16 @@
outboundContract.setRemotable(true);
invoker.setRemotableTest(true);
- JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(outboundWire, wc);
- handler.invoke(Foo.class.getMethod("test", new Class[]{String.class}), new Object[]{"bar"});
- String currentConvID = (String)wc.getIdentifier(Scope.CONVERSATION);
+ JDKOutboundInvocationHandler handler = new JDKOutboundInvocationHandler(Foo.class, outboundWire, wc);
+ handler.invoke(Foo.class.getMethod("test", String.class), new Object[]{"bar"});
+ String currentConvID = (String) wc.getIdentifier(Scope.CONVERSATION);
assertSame(convID, currentConvID);
outboundContract.setRemotable(false);
invoker.setRemotableTest(false);
- JDKOutboundInvocationHandler handler2 = new JDKOutboundInvocationHandler(outboundWire, wc);
- handler2.invoke(Foo.class.getMethod("test", new Class[]{String.class}), new Object[]{"bar"});
- currentConvID = (String)wc.getIdentifier(Scope.CONVERSATION);
+ JDKOutboundInvocationHandler handler2 = new JDKOutboundInvocationHandler(Foo.class, outboundWire, wc);
+ handler2.invoke(Foo.class.getMethod("test", String.class), new Object[]{"bar"});
+ currentConvID = (String) wc.getIdentifier(Scope.CONVERSATION);
assertSame(convID, currentConvID);
}
@@ -143,7 +143,7 @@
public Object invokeTarget(final Object payload, final short sequence) throws InvocationTargetException {
assertEquals("bar", Array.get(payload, 0));
- String convID = (String)wc.getIdentifier(Scope.CONVERSATION);
+ String convID = (String) wc.getIdentifier(Scope.CONVERSATION);
if (remotableTest) {
assertNotSame(convID, currentConversationID);
} else {
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Reference.java Tue Dec 26 01:40:44 2006
@@ -23,7 +23,6 @@
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireInvocationHandler;
/**
* Manages an SCA reference configured with a binding
@@ -36,13 +35,6 @@
* Returns the service interface configured for the reference
*/
Class<?> getInterface();
-
- /**
- * Returns the handler responsible for flowing a request through the reference
- *
- * @throws TargetException
- */
- WireInvocationHandler getHandler();
/**
* Returns the inbound wire for flowing a request through the reference
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/component/Service.java Tue Dec 26 01:40:44 2006
@@ -23,7 +23,6 @@
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireInvocationHandler;
/**
* The runtime instantiation of an SCA service configured with a binding.
@@ -46,11 +45,6 @@
* @param serviceContract the binding contract
*/
void setBindingServiceContract(ServiceContract<?> serviceContract);
-
- /**
- * Returns the handler responsible for flowing a request through the service
- */
- WireInvocationHandler getHandler();
/**
* Returns the service interface configured for the service
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ReferenceExtension.java Tue Dec 26 01:40:44 2006
@@ -28,8 +28,6 @@
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireInvocationHandler;
-import org.apache.tuscany.spi.wire.WireService;
/**
* The default implementation of an SCA reference
@@ -37,20 +35,17 @@
* @version $Rev$ $Date$
*/
public abstract class ReferenceExtension extends AbstractSCAObject implements Reference {
-
protected InboundWire inboundWire;
protected OutboundWire outboundWire;
protected Class<?> referenceInterface;
- protected WireService wireService;
protected ServiceContract<?> bindingServiceContract;
protected ReferenceExtension(String name,
Class<?> referenceInterface,
- CompositeComponent parent,
- WireService wireService) {
+ CompositeComponent parent
+ ) {
super(name, parent);
this.referenceInterface = referenceInterface;
- this.wireService = wireService;
}
public Scope getScope() {
@@ -75,10 +70,6 @@
public Class<?> getInterface() {
return referenceInterface;
- }
-
- public WireInvocationHandler getHandler() {
- return wireService.createHandler(inboundWire);
}
public TargetInvoker createCallbackTargetInvoker(ServiceContract contract, Operation operation)
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/extension/ServiceExtension.java Tue Dec 26 01:40:44 2006
@@ -29,8 +29,6 @@
import org.apache.tuscany.spi.wire.InboundWire;
import org.apache.tuscany.spi.wire.OutboundWire;
import org.apache.tuscany.spi.wire.TargetInvoker;
-import org.apache.tuscany.spi.wire.WireInvocationHandler;
-import org.apache.tuscany.spi.wire.WireService;
/**
* The default implementation of an SCA service
@@ -41,14 +39,12 @@
protected Class<?> interfaze;
protected InboundWire inboundWire;
protected OutboundWire outboundWire;
- protected WireService wireService;
protected ServiceContract<?> bindingServiceContract;
- public ServiceExtension(String name, Class<?> interfaze, CompositeComponent parent, WireService wireService)
+ public ServiceExtension(String name, Class<?> interfaze, CompositeComponent parent)
throws CoreRuntimeException {
super(name, parent);
this.interfaze = interfaze;
- this.wireService = wireService;
}
public Scope getScope() {
@@ -69,10 +65,6 @@
public void setOutboundWire(OutboundWire outboundWire) {
this.outboundWire = outboundWire;
- }
-
- public WireInvocationHandler getHandler() {
- return wireService.createHandler(inboundWire);
}
public Class<?> getInterface() {
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireObjectFactory.java Tue Dec 26 01:40:44 2006
@@ -26,17 +26,19 @@
*
* @version $Rev$ $Date$
*/
-public class WireObjectFactory implements ObjectFactory {
+public class WireObjectFactory<T> implements ObjectFactory<T> {
+ private Class<T> interfaze;
private RuntimeWire wire;
private WireService wireService;
- public WireObjectFactory(RuntimeWire wire, WireService wireService) {
+ public WireObjectFactory(Class<T> interfaze, RuntimeWire wire, WireService wireService) {
+ this.interfaze = interfaze;
this.wire = wire;
this.wireService = wireService;
}
- public Object getInstance() throws ObjectCreationException {
- return wireService.createProxy(wire);
+ public T getInstance() throws ObjectCreationException {
+ return interfaze.cast(wireService.createProxy(interfaze, wire));
}
}
Modified: incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/main/java/org/apache/tuscany/spi/wire/WireService.java Tue Dec 26 01:40:44 2006
@@ -33,49 +33,33 @@
*/
public interface WireService {
- /**
- * Create a proxy for the supplied wire that implements the supplied interface.
- *
- * @param interfaze the interface that the proxy class must implement
- * @param wire the wire to connect the proxy to
- * @return a proxy that allows invocation of the wire
- * @throws ProxyCreationException if there was a problem creating the proxy
- */
- <T> T createProxy(Class<T> interfaze, InboundWire wire) throws ProxyCreationException;
/**
* Creates a Java proxy for the given wire
*
- * @param wire the wire to proxy
- * @return the proxy
+ * @param interfaze the interface the proxy implements
+ * @param wire the wire to proxy @return the proxy
* @throws ProxyCreationException
*/
- Object createProxy(RuntimeWire wire) throws ProxyCreationException;
+ <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException;
/**
* Creates a Java proxy for the service contract callback
*
- * @param contract the service contract
+ * @param interfaze the interface the proxy should implement
* @return the proxy
* @throws ProxyCreationException
*/
- Object createCallbackProxy(ServiceContract<?> contract, InboundWire wire) throws ProxyCreationException;
-
+ Object createCallbackProxy(Class<?> interfaze, InboundWire wire) throws ProxyCreationException;
/**
* Creates an {@link WireInvocationHandler} for the given wire
*
+ * @param interfaze the client side interface
* @param wire the wire to create the invocation handler for
* @return the invocation handler
*/
- WireInvocationHandler createHandler(RuntimeWire wire);
-
- /**
- * Creates a wire invocation handler for flowing invocations through a callback
- *
- * @return the invocation handler for flowing invocations through a callback
- */
- WireInvocationHandler createCallbackHandler(InboundWire wire);
+ WireInvocationHandler createHandler(Class<?> interfaze, RuntimeWire wire);
/**
* Creates an outbound invocation chain for a given operation
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ReferenceTestCase.java Tue Dec 26 01:40:44 2006
@@ -83,7 +83,7 @@
private class TestReference<T> extends ReferenceExtension {
public TestReference(Class<T> clazz) {
- super(null, clazz, null, null);
+ super(null, clazz, null);
}
public TargetInvoker createTargetInvoker(ServiceContract contract, Operation operation) {
Modified: incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceExtensionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceExtensionTestCase.java?view=diff&rev=490275&r1=490274&r2=490275
==============================================================================
--- incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceExtensionTestCase.java (original)
+++ incubator/tuscany/java/sca/kernel/spi/src/test/java/org/apache/tuscany/spi/extension/ServiceExtensionTestCase.java Tue Dec 26 01:40:44 2006
@@ -33,7 +33,7 @@
public class ServiceExtensionTestCase extends TestCase {
public void testScope() throws Exception {
- ServiceExtension service = new ServiceExtension(null, null, null, null);
+ ServiceExtension service = new ServiceExtension(null, null, null);
assertEquals(Scope.SYSTEM, service.getScope());
}
@@ -42,14 +42,14 @@
JavaServiceContract contract = new JavaServiceContract(getClass());
expect(wire.getServiceContract()).andReturn(contract);
replay(wire);
- ServiceExtension service = new ServiceExtension(null, null, null, null);
+ ServiceExtension service = new ServiceExtension(null, null, null);
service.setInboundWire(wire);
service.getInterface();
}
public void testPrepare() throws Exception {
- ServiceExtension service = new ServiceExtension(null, null, null, null);
+ ServiceExtension service = new ServiceExtension(null, null, null);
service.prepare();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org