You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/08/05 12:48:48 UTC
svn commit: r562846 [2/2] - in /incubator/tuscany/java/sca:
modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/
modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/
modules/core-spring/src/...
Modified: incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/invocation/OSGiImplementationProviderFactory.java Sun Aug 5 03:48:44 2007
@@ -19,7 +19,10 @@
package org.apache.tuscany.sca.implementation.osgi.invocation;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
import org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface;
import org.apache.tuscany.sca.implementation.osgi.context.OSGiPropertyValueObjectFactory;
import org.apache.tuscany.sca.provider.ImplementationProvider;
@@ -34,14 +37,14 @@
*/
public class OSGiImplementationProviderFactory implements ImplementationProviderFactory<OSGiImplementationInterface> {
+ DataBindingExtensionPoint dataBindings;
- DataBindingExtensionPoint dataBindingRegistry;
-
- public OSGiImplementationProviderFactory(DataBindingExtensionPoint dataBindings,
- OSGiPropertyValueObjectFactory factory) {
-
- dataBindingRegistry = dataBindings;
+ public OSGiImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
+ dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = extensionPoints.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator =new MediatorImpl(dataBindings, transformers);
+ OSGiPropertyValueObjectFactory factory = new OSGiPropertyValueObjectFactory(mediator);
}
public ImplementationProvider createImplementationProvider(RuntimeComponent component,
@@ -49,7 +52,7 @@
try {
- return new OSGiImplementationProvider(component, implementation, dataBindingRegistry);
+ return new OSGiImplementationProvider(component, implementation, dataBindings);
} catch (BundleException e) {
throw new RuntimeException(e);
Modified: incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java Sun Aug 5 03:48:44 2007
@@ -29,7 +29,6 @@
import java.util.List;
import java.util.StringTokenizer;
-
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -44,6 +43,7 @@
import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -55,8 +55,6 @@
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
-import org.apache.tuscany.sca.policy.PolicyFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
@@ -86,25 +84,18 @@
private static final QName PROPERTIES_QNAME = new QName(SCA_NS, "properties");
private static final QName PROPERTY_QNAME = new QName(SCA_NS, "property");
- private JavaInterfaceIntrospector interfaceIntrospector;
private JavaInterfaceFactory javaInterfaceFactory;
private AssemblyFactory assemblyFactory;
- //private PolicyFactory policyFactory;
private static final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
static {
domFactory.setNamespaceAware(true);
}
- public OSGiImplementationProcessor(JavaInterfaceIntrospector interfaceIntrospector,
- JavaInterfaceFactory javaInterfaceFactory,
- AssemblyFactory assemblyFactory,
- PolicyFactory policyFactory) {
+ public OSGiImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
- this.interfaceIntrospector = interfaceIntrospector;
- this.assemblyFactory = assemblyFactory;
- this.javaInterfaceFactory = javaInterfaceFactory;
- //this.policyFactory = policyFactory;
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
}
public QName getArtifactType() {
@@ -289,15 +280,15 @@
// create a relative URI
service.setName(serv.getName());
- JavaInterface callInterface = interfaceIntrospector.introspect(interfaze);
+ JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(interfaze);
service.getInterfaceContract().setInterface(callInterface);
if (callbackInterfaze != null) {
- JavaInterface callbackInterface = interfaceIntrospector.introspect(callbackInterfaze);
+ JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callbackInterfaze);
service.getInterfaceContract().setCallbackInterface(callbackInterface);
}
else if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+ JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callInterface.getCallbackClass());
service.getInterfaceContract().setCallbackInterface(callbackInterface);
}
return service;
@@ -311,10 +302,10 @@
reference.setName(ref.getName());
reference.setMultiplicity(ref.getMultiplicity());
- JavaInterface callInterface = interfaceIntrospector.introspect(clazz);
+ JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(clazz);
reference.getInterfaceContract().setInterface(callInterface);
if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+ JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callInterface.getCallbackClass());
reference.getInterfaceContract().setCallbackInterface(callbackInterface);
}
Added: incubator/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?view=auto&rev=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Sun Aug 5 03:48:44 2007
@@ -0,0 +1,19 @@
+# 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.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementationProcessor;type=http://www.osoa.org/xmlns/sca/1.0#implementation.osgi,model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface
Added: incubator/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory?view=auto&rev=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory (added)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory Sun Aug 5 03:48:44 2007
@@ -0,0 +1,19 @@
+# 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.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.osgi.invocation.OSGiImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementationInterface
Modified: incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java Sun Aug 5 03:48:44 2007
@@ -35,6 +35,8 @@
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
import org.apache.tuscany.sca.assembly.xml.CompositeProcessor;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
@@ -42,16 +44,11 @@
import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestImpl;
import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
-import org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementation;
-import org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementationProcessor;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
import org.apache.tuscany.sca.policy.PolicyFactory;
import org.apache.tuscany.sca.scope.Scope;
@@ -72,24 +69,19 @@
private OSGiImplementationProcessor osgiProcessor;
public void setUp() throws Exception {
+ ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
assemblyFactory = new DefaultAssemblyFactory();
+ modelFactories.addFactory(assemblyFactory);
scaBindingFactory = new DefaultSCABindingFactory();
policyFactory = new DefaultPolicyFactory();
mapper = new InterfaceContractMapperImpl();
inputFactory = XMLInputFactory.newInstance();
staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- JavaInterfaceFactory javaInterfaceFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceFactory javaInterfaceFactory = new DefaultJavaInterfaceFactory(new DefaultJavaInterfaceIntrospectorExtensionPoint());
+ modelFactories.addFactory(javaInterfaceFactory);
- JavaInterfaceIntrospectorExtensionPoint interfaceVisitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
- JavaInterfaceIntrospector interfaceIntrospector =
- new ExtensibleJavaInterfaceIntrospector(javaInterfaceFactory, interfaceVisitors);
-
- osgiProcessor = new OSGiImplementationProcessor(
- interfaceIntrospector,
- javaInterfaceFactory,
- assemblyFactory,
- policyFactory);
+ osgiProcessor = new OSGiImplementationProcessor(modelFactories);
staxProcessors.addArtifactProcessor(osgiProcessor);
OSGiTestBundles.createBundle("target/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
Modified: incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java Sun Aug 5 03:48:44 2007
@@ -32,7 +32,6 @@
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.PolicySet;
@@ -52,8 +51,7 @@
* Constructs a new resource implementation.
*/
public ResourceImplementation(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory,
- JavaInterfaceIntrospector introspector) {
+ JavaInterfaceFactory javaFactory) {
// Resource implementation always provide a single service exposing
// the Resource interface, and have no references and properties
@@ -63,7 +61,7 @@
// Create the Java interface contract for the Resource service
JavaInterface javaInterface;
try {
- javaInterface = introspector.introspect(Resource.class);
+ javaInterface = javaFactory.createJavaInterface(Resource.class);
} catch (InvalidInterfaceException e) {
throw new IllegalArgumentException(e);
}
Modified: incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationProcessor.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationProcessor.java Sun Aug 5 03:48:44 2007
@@ -38,9 +38,6 @@
import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
/**
@@ -50,7 +47,6 @@
private static final QName IMPLEMENTATION_RESOURCE = new QName("http://www.osoa.org/xmlns/sca/1.0", "implementation.resource");
private ContributionFactory contributionFactory;
- private JavaInterfaceIntrospector introspector;
private AssemblyFactory assemblyFactory;
private JavaInterfaceFactory javaFactory;
@@ -58,7 +54,6 @@
contributionFactory = modelFactories.getFactory(ContributionFactory.class);
assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, new DefaultJavaInterfaceIntrospectorExtensionPoint());
}
public QName getArtifactType() {
@@ -81,7 +76,7 @@
String location = reader.getAttributeValue(null, "location");
// Create an initialize the resource implementationmodel
- ResourceImplementation implementation = new ResourceImplementation(assemblyFactory, javaFactory, introspector);
+ ResourceImplementation implementation = new ResourceImplementation(assemblyFactory, javaFactory);
implementation.setLocation(location);
implementation.setUnresolved(true);
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringArtifactProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringArtifactProcessor.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringArtifactProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringArtifactProcessor.java Sun Aug 5 03:48:44 2007
@@ -29,6 +29,7 @@
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.ComponentType;
import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -38,7 +39,6 @@
import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
import org.apache.tuscany.sca.implementation.spring.xml.SpringXMLComponentTypeLoader;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
import org.apache.tuscany.sca.policy.PolicyFactory;
/**
@@ -56,22 +56,14 @@
private AssemblyFactory assemblyFactory;
private JavaInterfaceFactory javaFactory;
- private JavaInterfaceIntrospector interfaceIntrospector;
private PolicyFactory policyFactory;
// TODO: runtime needs to provide a better way to get the PropertyValueObjectFactory
private JavaPropertyValueObjectFactory propertyFactory;
- public SpringArtifactProcessor(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory,
- JavaInterfaceIntrospector interfaceIntrospector,
- PolicyFactory policyFactory,
- JavaPropertyValueObjectFactory propertyFactory) {
- this.assemblyFactory = assemblyFactory;
- this.javaFactory = javaFactory;
- this.interfaceIntrospector = interfaceIntrospector;
- this.policyFactory = policyFactory;
- this.propertyFactory = propertyFactory;
-
+ public SpringArtifactProcessor(ModelFactoryExtensionPoint modelFactories) {
+ this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
+ this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
}
/*
@@ -163,7 +155,7 @@
/* Load the Spring component type by reading the Spring application context */
SpringXMLComponentTypeLoader springLoader =
- new SpringXMLComponentTypeLoader(assemblyFactory, interfaceIntrospector, javaFactory, policyFactory);
+ new SpringXMLComponentTypeLoader(assemblyFactory, javaFactory, policyFactory);
try {
// Load the Spring Implementation information from its application context file...
springLoader.load(springImplementation);
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProviderFactory.java Sun Aug 5 03:48:44 2007
@@ -18,7 +18,12 @@
*/
package org.apache.tuscany.sca.implementation.spring;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.invocation.ProxyFactory;
+import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
+import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
+import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
import org.apache.tuscany.sca.implementation.java.context.JavaPropertyValueObjectFactory;
import org.apache.tuscany.sca.provider.ImplementationProvider;
import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
@@ -38,11 +43,16 @@
* Simple constructor
*
*/
- public SpringImplementationProviderFactory(ProxyFactory proxyService,
- JavaPropertyValueObjectFactory propertyValueObjectFactory) {
+ public SpringImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
super();
- this.proxyService = proxyService;
- this.propertyFactory = propertyValueObjectFactory;
+
+ proxyService = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class);
+
+ // TODO: could the runtime have a default PropertyValueObjectFactory?
+ DataBindingExtensionPoint dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
+ TransformerExtensionPoint transformers = extensionPoints.getExtensionPoint(TransformerExtensionPoint.class);
+ MediatorImpl mediator = new MediatorImpl(dataBindings, transformers);
+ propertyFactory = new JavaPropertyValueObjectFactory(mediator);
}
/**
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java Sun Aug 5 03:48:44 2007
@@ -75,7 +75,6 @@
* @param javaFactory - a Java Interface Factory
*/
public SpringBeanIntrospector(AssemblyFactory assemblyFactory,
- JavaInterfaceIntrospector interfaceIntrospector,
JavaInterfaceFactory javaFactory,
PolicyFactory policyFactory) {
@@ -91,11 +90,11 @@
new EagerInitProcessor(assemblyFactory),
new InitProcessor(assemblyFactory),
new PropertyProcessor(assemblyFactory),
- new ReferenceProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+ new ReferenceProcessor(assemblyFactory, javaFactory),
new ResourceProcessor(assemblyFactory),
new ScopeProcessor(assemblyFactory),
- new ServiceProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
- new HeuristicPojoProcessor(assemblyFactory, javaFactory, interfaceIntrospector),
+ new ServiceProcessor(assemblyFactory, javaFactory),
+ new HeuristicPojoProcessor(assemblyFactory, javaFactory),
new PolicyProcessor(assemblyFactory, policyFactory)};
for (JavaClassVisitor extension : extensions) {
classVisitors.addClassVisitor(extension);
Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringXMLComponentTypeLoader.java Sun Aug 5 03:48:44 2007
@@ -53,7 +53,6 @@
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
import org.apache.tuscany.sca.policy.PolicyFactory;
import org.springframework.core.io.Resource;
@@ -78,7 +77,6 @@
private static final String APPLICATION_CONTEXT = "application-context.xml";
private AssemblyFactory assemblyFactory;
- private JavaInterfaceIntrospector interfaceIntrospector;
private JavaInterfaceFactory javaFactory;
private PolicyFactory policyFactory;
private ClassLoader cl;
@@ -86,16 +84,14 @@
private SpringBeanIntrospector beanIntrospector;
public SpringXMLComponentTypeLoader(AssemblyFactory assemblyFactory,
- JavaInterfaceIntrospector interfaceIntrospector,
JavaInterfaceFactory javaFactory,
PolicyFactory policyFactory) {
super();
this.assemblyFactory = assemblyFactory;
- this.interfaceIntrospector = interfaceIntrospector;
this.javaFactory = javaFactory;
this.policyFactory = policyFactory;
beanIntrospector =
- new SpringBeanIntrospector(assemblyFactory, interfaceIntrospector, javaFactory, policyFactory);
+ new SpringBeanIntrospector(assemblyFactory, javaFactory, policyFactory);
}
protected Class<SpringImplementation> getImplementationClass() {
@@ -532,10 +528,10 @@
service.setName(name);
// Set the call interface and, if present, the callback interface
- JavaInterface callInterface = interfaceIntrospector.introspect(interfaze);
+ JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
service.getInterfaceContract().setInterface(callInterface);
if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
service.getInterfaceContract().setCallbackInterface(callbackInterface);
}
return service;
@@ -556,10 +552,10 @@
reference.setMultiplicity(Multiplicity.ONE_ONE);
// Set the call interface and, if present, the callback interface
- JavaInterface callInterface = interfaceIntrospector.introspect(interfaze);
+ JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
reference.getInterfaceContract().setInterface(callInterface);
if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = interfaceIntrospector.introspect(callInterface.getCallbackClass());
+ JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
reference.getInterfaceContract().setCallbackInterface(callbackInterface);
}
Added: incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?view=auto&rev=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Sun Aug 5 03:48:44 2007
@@ -0,0 +1,19 @@
+# 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.
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.spring.SpringArtifactProcessor;type=http://www.osoa.org/xmlns/sca/1.0#implementation.spring,model=org.apache.tuscany.sca.implementation.spring.SpringImplementation
Added: incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory?view=auto&rev=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory (added)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory Sun Aug 5 03:48:44 2007
@@ -0,0 +1,19 @@
+# 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.
+
+# Implementation class for the implementation extension
+org.apache.tuscany.sca.implementation.spring.SpringImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.spring.SpringImplementation
Modified: incubator/tuscany/java/sca/modules/interface-java-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/java/module/JavaInterfaceRuntimeModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/java/module/JavaInterfaceRuntimeModuleActivator.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/java/module/JavaInterfaceRuntimeModuleActivator.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-runtime/src/main/java/org/apache/tuscany/sca/interfacedef/java/module/JavaInterfaceRuntimeModuleActivator.java Sun Aug 5 03:48:44 2007
@@ -40,8 +40,8 @@
private JavaInterfaceIntrospectorExtensionPoint visitors;
public JavaInterfaceRuntimeModuleActivator() {
- javaFactory = new DefaultJavaInterfaceFactory();
visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
+ javaFactory = new DefaultJavaInterfaceFactory(visitors);
}
public Object[] getExtensionPoints() {
@@ -56,8 +56,7 @@
// Register <interface.java> processor
StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
- JavaInterfaceProcessor javaInterfaceProcessor = new JavaInterfaceProcessor(javaFactory, introspector);
+ JavaInterfaceProcessor javaInterfaceProcessor = new JavaInterfaceProcessor(javaFactory);
processors.addArtifactProcessor(javaInterfaceProcessor);
}
Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java Sun Aug 5 03:48:44 2007
@@ -37,16 +37,13 @@
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfaceContract>, JavaConstants {
private JavaInterfaceFactory javaFactory;
- private JavaInterfaceIntrospector introspector;
- public JavaInterfaceProcessor(JavaInterfaceFactory javaFactory, JavaInterfaceIntrospector introspector) {
+ public JavaInterfaceProcessor(JavaInterfaceFactory javaFactory) {
this.javaFactory = javaFactory;
- this.introspector = introspector;
}
private JavaInterface createJavaInterface(String interfaceName) {
@@ -123,7 +120,7 @@
// Introspect the Java interface and populate the interface and
// operations
- javaInterface = introspector.introspect(javaClass);
+ javaInterface = javaFactory.createJavaInterface(javaClass);
} catch (InvalidInterfaceException e) {
throw new ContributionResolveException(e);
Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java Sun Aug 5 03:48:44 2007
@@ -46,9 +46,6 @@
import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
import org.apache.tuscany.sca.policy.PolicyFactory;
@@ -76,11 +73,9 @@
inputFactory = XMLInputFactory.newInstance();
staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- javaFactory = new DefaultJavaInterfaceFactory();
+ javaFactory = new DefaultJavaInterfaceFactory(new DefaultJavaInterfaceIntrospectorExtensionPoint());
- JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
- JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
- JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(javaFactory, introspector);
+ JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(javaFactory);
staxProcessors.addArtifactProcessor(javaProcessor);
}
Modified: incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java Sun Aug 5 03:48:44 2007
@@ -43,9 +43,6 @@
import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
import org.apache.tuscany.sca.policy.PolicyFactory;
@@ -71,15 +68,13 @@
inputFactory = XMLInputFactory.newInstance();
staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
- javaFactory = new DefaultJavaInterfaceFactory();
+ javaFactory = new DefaultJavaInterfaceFactory(new DefaultJavaInterfaceIntrospectorExtensionPoint());
staxProcessors.addArtifactProcessor(new CompositeProcessor(new ContributionFactoryImpl(), factory, policyFactory, mapper, staxProcessor));
staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
- JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
- JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
- JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(javaFactory, introspector);
+ JavaInterfaceProcessor javaProcessor = new JavaInterfaceProcessor(javaFactory);
staxProcessors.addArtifactProcessor(javaProcessor);
}
Modified: incubator/tuscany/java/sca/modules/interface-java/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/pom.xml?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/interface-java/pom.xml Sun Aug 5 03:48:44 2007
@@ -34,6 +34,12 @@
<artifactId>tuscany-interface</artifactId>
<version>1.0-incubating-SNAPSHOT</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>sca-api</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java Sun Aug 5 03:48:44 2007
@@ -19,13 +19,23 @@
package org.apache.tuscany.sca.interfacedef.java;
import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceFactoryImpl;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
/**
* A factory for the Java interface model.
*/
public class DefaultJavaInterfaceFactory extends JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
-
+
+ /**
+ * @deprecated Please use the constructor that takes a JavaInterfaceIntrospectorExtensionPoint.
+ */
public DefaultJavaInterfaceFactory() {
+ super(new DefaultJavaInterfaceIntrospectorExtensionPoint());
+ }
+
+ public DefaultJavaInterfaceFactory(JavaInterfaceIntrospectorExtensionPoint visitors) {
+ super(visitors);
}
}
Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java Sun Aug 5 03:48:44 2007
@@ -18,6 +18,8 @@
*/
package org.apache.tuscany.sca.interfacedef.java;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+
/**
* Factory for the Java interface model
*
@@ -26,11 +28,18 @@
public interface JavaInterfaceFactory {
/**
- * Creates a new Java interface.
+ * Creates a new Java interface model.
*
* @return
*/
JavaInterface createJavaInterface();
+
+ /**
+ * Creates a new Java interface model from an interface class.
+ * @param interfaceClass the interface class to introspect.
+ * @return
+ */
+ JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException;
/**
* Creates a new Java interface contract.
Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java Sun Aug 5 03:48:44 2007
@@ -18,17 +18,29 @@
*/
package org.apache.tuscany.sca.interfacedef.java.impl;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
/**
* A factory for the Java model.
*/
public abstract class JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
+
+ private JavaInterfaceIntrospectorImpl introspector;
+
+ public JavaInterfaceFactoryImpl(JavaInterfaceIntrospectorExtensionPoint visitors) {
+ introspector = new JavaInterfaceIntrospectorImpl(this, visitors);
+ }
public JavaInterface createJavaInterface() {
return new JavaInterfaceImpl();
+ }
+
+ public JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException {
+ return introspector.introspect(interfaceClass);
}
public JavaInterfaceContract createJavaInterfaceContract() {
Added: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java?view=auto&rev=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java (added)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java Sun Aug 5 03:48:44 2007
@@ -0,0 +1,149 @@
+/*
+ * 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.sca.interfacedef.java.impl;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.tuscany.sca.interfacedef.ConversationSequence;
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.InvalidOperationException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.OverloadedOperationException;
+import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
+import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
+import org.osoa.sca.annotations.Conversational;
+import org.osoa.sca.annotations.EndsConversation;
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * Default implementation of a Java interface introspector.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JavaInterfaceIntrospectorImpl {
+ public static final String IDL_INPUT = "idl:input";
+
+ private static final String UNKNOWN_DATABINDING = null;
+
+ private JavaInterfaceFactory javaFactory;
+ private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+
+ public JavaInterfaceIntrospectorImpl(JavaInterfaceFactory javaFactory, JavaInterfaceIntrospectorExtensionPoint visitors) {
+ this.javaFactory = javaFactory;
+ this.visitors = visitors.getInterfaceVisitors();
+ }
+
+ public JavaInterface introspect(Class<?> type) throws InvalidInterfaceException {
+ JavaInterface javaInterface = javaFactory.createJavaInterface();
+ javaInterface.setJavaClass(type);
+
+ boolean remotable = type.isAnnotationPresent(Remotable.class);
+ javaInterface.setRemotable(remotable);
+
+ boolean conversational = type.isAnnotationPresent(Conversational.class);
+ javaInterface.setConversational(conversational);
+
+ Class<?> callbackClass = null;
+ org.osoa.sca.annotations.Callback callback = type.getAnnotation(org.osoa.sca.annotations.Callback.class);
+ if (callback != null && !Void.class.equals(callback.value())) {
+ callbackClass = callback.value();
+ } else if (callback != null && Void.class.equals(callback.value())) {
+ throw new InvalidCallbackException("No callback interface specified on annotation");
+ }
+ javaInterface.setCallbackClass(callbackClass);
+
+ javaInterface.getOperations().addAll(getOperations(type, remotable, conversational));
+
+ for (JavaInterfaceVisitor extension : visitors) {
+ extension.visitInterface(javaInterface);
+ }
+ return javaInterface;
+ }
+
+ private <T> List<Operation> getOperations(Class<T> type, boolean remotable, boolean conversational)
+ throws InvalidInterfaceException {
+ Method[] methods = type.getMethods();
+ List<Operation> operations = new ArrayList<Operation>(methods.length);
+ Set<String> names = remotable? new HashSet<String>() : null;
+ for (Method method : methods) {
+ String name = method.getName();
+ if (remotable && names.contains(name)) {
+ throw new OverloadedOperationException(method);
+ }
+ if(remotable) {
+ names.add(name);
+ }
+
+ Class returnType = method.getReturnType();
+ Class[] paramTypes = method.getParameterTypes();
+ Class[] faultTypes = method.getExceptionTypes();
+ boolean nonBlocking = method.isAnnotationPresent(OneWay.class);
+ ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE;
+ if (method.isAnnotationPresent(EndsConversation.class)) {
+ if (!conversational) {
+ throw new InvalidOperationException(
+ "Method is marked as end conversation but contract is not conversational",
+ method);
+ }
+ conversationSequence = ConversationSequence.CONVERSATION_END;
+ } else if (conversational) {
+ conversationSequence = ConversationSequence.CONVERSATION_CONTINUE;
+ }
+
+ // Set outputType to null for void
+ DataType<Class> returnDataType = returnType == void.class ? null
+ : new DataTypeImpl<Class>(UNKNOWN_DATABINDING,
+ returnType, returnType);
+ List<DataType> paramDataTypes = new ArrayList<DataType>(paramTypes.length);
+ for (Class paramType : paramTypes) {
+ paramDataTypes.add(new DataTypeImpl<Class>(UNKNOWN_DATABINDING, paramType, paramType));
+ }
+ List<DataType> faultDataTypes = new ArrayList<DataType>(faultTypes.length);
+ for (Class faultType : faultTypes) {
+ // Only add checked exceptions
+ if (Exception.class.isAssignableFrom(faultType) && (!RuntimeException.class.isAssignableFrom(faultType))) {
+ faultDataTypes.add(new DataTypeImpl<Class>(UNKNOWN_DATABINDING, faultType, faultType));
+ }
+ }
+
+ DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class,
+ paramDataTypes);
+ Operation operation = new OperationImpl(name);
+ operation.setInputType(inputType);
+ operation.setOutputType(returnDataType);
+ operation.setFaultTypes(faultDataTypes);
+ operation.setConversationSequence(conversationSequence);
+ operation.setNonBlocking(nonBlocking);
+ operations.add(operation);
+ }
+ return operations;
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/ExtensibleJavaInterfaceIntrospector.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/ExtensibleJavaInterfaceIntrospector.java?view=diff&rev=562846&r1=562823&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/ExtensibleJavaInterfaceIntrospector.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/ExtensibleJavaInterfaceIntrospector.java Sun Aug 5 03:48:44 2007
@@ -18,130 +18,19 @@
*/
package org.apache.tuscany.sca.interfacedef.java.introspect;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.InvalidOperationException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.OverloadedOperationException;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.annotations.Conversational;
-import org.osoa.sca.annotations.EndsConversation;
-import org.osoa.sca.annotations.OneWay;
-import org.osoa.sca.annotations.Remotable;
+import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceIntrospectorImpl;
/**
* Default implementation of a Java interface introspector.
+ * @deprecated Please use DefaultJavaInterfaceFactory instead.
*
* @version $Rev$ $Date$
*/
-public class ExtensibleJavaInterfaceIntrospector implements JavaInterfaceIntrospector {
- public static final String IDL_INPUT = "idl:input";
-
- private static final String UNKNOWN_DATABINDING = null;
-
- private JavaInterfaceFactory javaFactory;
- private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
+public class ExtensibleJavaInterfaceIntrospector extends JavaInterfaceIntrospectorImpl implements JavaInterfaceIntrospector {
public ExtensibleJavaInterfaceIntrospector(JavaInterfaceFactory javaFactory, JavaInterfaceIntrospectorExtensionPoint visitors) {
- this.javaFactory = javaFactory;
- this.visitors = visitors.getInterfaceVisitors();
- }
-
- public JavaInterface introspect(Class<?> type) throws InvalidInterfaceException {
- JavaInterface javaInterface = javaFactory.createJavaInterface();
- javaInterface.setJavaClass(type);
-
- boolean remotable = type.isAnnotationPresent(Remotable.class);
- javaInterface.setRemotable(remotable);
-
- boolean conversational = type.isAnnotationPresent(Conversational.class);
- javaInterface.setConversational(conversational);
-
- Class<?> callbackClass = null;
- org.osoa.sca.annotations.Callback callback = type.getAnnotation(org.osoa.sca.annotations.Callback.class);
- if (callback != null && !Void.class.equals(callback.value())) {
- callbackClass = callback.value();
- } else if (callback != null && Void.class.equals(callback.value())) {
- throw new InvalidCallbackException("No callback interface specified on annotation");
- }
- javaInterface.setCallbackClass(callbackClass);
-
- javaInterface.getOperations().addAll(getOperations(type, remotable, conversational));
-
- for (JavaInterfaceVisitor extension : visitors) {
- extension.visitInterface(javaInterface);
- }
- return javaInterface;
- }
-
- private <T> List<Operation> getOperations(Class<T> type, boolean remotable, boolean conversational)
- throws InvalidInterfaceException {
- Method[] methods = type.getMethods();
- List<Operation> operations = new ArrayList<Operation>(methods.length);
- Set<String> names = remotable? new HashSet<String>() : null;
- for (Method method : methods) {
- String name = method.getName();
- if (remotable && names.contains(name)) {
- throw new OverloadedOperationException(method);
- }
- if(remotable) {
- names.add(name);
- }
-
- Class returnType = method.getReturnType();
- Class[] paramTypes = method.getParameterTypes();
- Class[] faultTypes = method.getExceptionTypes();
- boolean nonBlocking = method.isAnnotationPresent(OneWay.class);
- ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE;
- if (method.isAnnotationPresent(EndsConversation.class)) {
- if (!conversational) {
- throw new InvalidOperationException(
- "Method is marked as end conversation but contract is not conversational",
- method);
- }
- conversationSequence = ConversationSequence.CONVERSATION_END;
- } else if (conversational) {
- conversationSequence = ConversationSequence.CONVERSATION_CONTINUE;
- }
-
- // Set outputType to null for void
- DataType<Class> returnDataType = returnType == void.class ? null
- : new DataTypeImpl<Class>(UNKNOWN_DATABINDING,
- returnType, returnType);
- List<DataType> paramDataTypes = new ArrayList<DataType>(paramTypes.length);
- for (Class paramType : paramTypes) {
- paramDataTypes.add(new DataTypeImpl<Class>(UNKNOWN_DATABINDING, paramType, paramType));
- }
- List<DataType> faultDataTypes = new ArrayList<DataType>(faultTypes.length);
- for (Class faultType : faultTypes) {
- // Only add checked exceptions
- if (Exception.class.isAssignableFrom(faultType) && (!RuntimeException.class.isAssignableFrom(faultType))) {
- faultDataTypes.add(new DataTypeImpl<Class>(UNKNOWN_DATABINDING, faultType, faultType));
- }
- }
-
- DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class,
- paramDataTypes);
- Operation operation = new OperationImpl(name);
- operation.setInputType(inputType);
- operation.setOutputType(returnDataType);
- operation.setFaultTypes(faultDataTypes);
- operation.setConversationSequence(conversationSequence);
- operation.setNonBlocking(nonBlocking);
- operations.add(operation);
- }
- return operations;
+ super(javaFactory, visitors);
}
}
Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospector.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospector.java?view=diff&rev=562846&r1=562823&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospector.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceIntrospector.java Sun Aug 5 03:48:44 2007
@@ -23,6 +23,7 @@
/**
* Processor for creating JavaServiceContract definitions from Java Classes.
+ * @deprecated Please use JavaInterfaceFactory instead.
*
* @version $Rev$ $Date$
*/
Modified: incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java?view=diff&rev=562846&r1=562823&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java Sun Aug 5 03:48:44 2007
@@ -27,8 +27,6 @@
import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
import org.osoa.sca.annotations.Conversational;
import org.osoa.sca.annotations.EndsConversation;
@@ -37,12 +35,9 @@
*/
public class ConversationalIntrospectionTestCase extends TestCase {
private JavaInterfaceFactory javaFactory;
- private ExtensibleJavaInterfaceIntrospector introspector;
protected void setUp() throws Exception {
- javaFactory = new DefaultJavaInterfaceFactory();
- JavaInterfaceIntrospectorExtensionPoint visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
- introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
+ javaFactory = new DefaultJavaInterfaceFactory(new DefaultJavaInterfaceIntrospectorExtensionPoint());
}
private Operation getOperation(Interface i, String name) {
@@ -55,7 +50,7 @@
}
public void testServiceContractConversationalInformationIntrospection() throws Exception {
- Interface i = introspector.introspect(Foo.class);
+ Interface i = javaFactory.createJavaInterface(Foo.class);
assertNotNull(i);
assertTrue(i.isConversational());
ConversationSequence seq = getOperation(i, "operation").getConversationSequence();
@@ -66,7 +61,7 @@
public void testBadServiceContract() throws Exception {
try {
- introspector.introspect(BadFoo.class);
+ javaFactory.createJavaInterface(BadFoo.class);
fail();
} catch (InvalidOperationException e) {
// expected
@@ -74,7 +69,7 @@
}
public void testNonConversationalInformationIntrospection() throws Exception {
- Interface i = introspector.introspect(NonConversationalFoo.class);
+ Interface i = javaFactory.createJavaInterface(NonConversationalFoo.class);
assertFalse(i.isConversational());
ConversationSequence seq = getOperation(i, "operation")
.getConversationSequence();
Modified: incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java?view=diff&rev=562846&r1=562823&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java Sun Aug 5 03:48:44 2007
@@ -34,8 +34,8 @@
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
import org.easymock.EasyMock;
@@ -43,12 +43,12 @@
* @version $Rev$ $Date$
*/
public class JavaInterfaceProcessorRegistryImplTestCase extends TestCase {
- private ExtensibleJavaInterfaceIntrospector impl;
private DefaultJavaInterfaceIntrospectorExtensionPoint visitors;
+ private JavaInterfaceFactory factory;
@SuppressWarnings("unchecked")
public void testSimpleInterface() throws InvalidInterfaceException {
- JavaInterface intf = (JavaInterface)impl.introspect(Simple.class);
+ JavaInterface intf = (JavaInterface)factory.createJavaInterface(Simple.class);
assertEquals(Simple.class, intf.getJavaClass());
List<Operation> operations = intf.getOperations();
@@ -79,16 +79,16 @@
expectLastCall().once();
replay(extension);
visitors.addInterfaceVisitor(extension);
- impl.introspect(Base.class);
+ factory.createJavaInterface(Base.class);
visitors.removeInterfaceVisitor(extension);
- impl.introspect(Base.class);
+ factory.createJavaInterface(Base.class);
verify(extension);
}
protected void setUp() throws Exception {
super.setUp();
visitors = new DefaultJavaInterfaceIntrospectorExtensionPoint();
- impl = new ExtensibleJavaInterfaceIntrospector(new DefaultJavaInterfaceFactory(), visitors);
+ factory = new DefaultJavaInterfaceFactory(visitors);
}
Modified: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/impl/CRUDImplementationImpl.java Sun Aug 5 03:48:44 2007
@@ -30,7 +30,6 @@
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.PolicySet;
@@ -49,8 +48,7 @@
* Constructs a new CRUD implementation.
*/
public CRUDImplementationImpl(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory,
- JavaInterfaceIntrospector introspector) {
+ JavaInterfaceFactory javaFactory) {
// CRUD implementation always provide a single service exposing
// the CRUD interface, and have no references and properties
@@ -58,7 +56,7 @@
crudService.setName("CRUD");
JavaInterface javaInterface;
try {
- javaInterface = introspector.introspect(CRUD.class);
+ javaInterface = javaFactory.createJavaInterface(CRUD.class);
} catch (InvalidInterfaceException e) {
throw new IllegalArgumentException(e);
}
Modified: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/DefaultCRUDImplementationFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/DefaultCRUDImplementationFactory.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/DefaultCRUDImplementationFactory.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/model/DefaultCRUDImplementationFactory.java Sun Aug 5 03:48:44 2007
@@ -21,7 +21,6 @@
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
import crud.impl.CRUDImplementationImpl;
@@ -32,18 +31,15 @@
private AssemblyFactory assemblyFactory;
private JavaInterfaceFactory javaFactory;
- private JavaInterfaceIntrospector introspector;
public DefaultCRUDImplementationFactory(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory,
- JavaInterfaceIntrospector introspector) {
+ JavaInterfaceFactory javaFactory) {
this.assemblyFactory = assemblyFactory;
this.javaFactory = javaFactory;
- this.introspector = introspector;
}
public CRUDImplementation createCRUDImplementation() {
- return new CRUDImplementationImpl(assemblyFactory, javaFactory, introspector);
+ return new CRUDImplementationImpl(assemblyFactory, javaFactory);
}
}
Modified: incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/module/CRUDModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/module/CRUDModuleActivator.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/module/CRUDModuleActivator.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud-extension/src/main/java/crud/module/CRUDModuleActivator.java Sun Aug 5 03:48:44 2007
@@ -26,9 +26,7 @@
import org.apache.tuscany.sca.core.ModuleActivator;
import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
import crud.impl.CRUDImplementationProcessor;
@@ -54,10 +52,8 @@
// Create the CRUD implementation factory
ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
- JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
- JavaInterfaceIntrospectorExtensionPoint visitors = registry.getExtensionPoint(JavaInterfaceIntrospectorExtensionPoint.class);
- JavaInterfaceIntrospector introspector = new ExtensibleJavaInterfaceIntrospector(javaFactory, visitors);
- CRUDImplementationFactory crudFactory = new DefaultCRUDImplementationFactory(assemblyFactory, javaFactory, introspector);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory(new DefaultJavaInterfaceIntrospectorExtensionPoint());
+ CRUDImplementationFactory crudFactory = new DefaultCRUDImplementationFactory(assemblyFactory, javaFactory);
factories.addFactory(crudFactory);
// Add the CRUD implementation extension to the StAXArtifactProcessor
Modified: incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java Sun Aug 5 03:48:44 2007
@@ -34,8 +34,6 @@
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.PolicySet;
@@ -65,11 +63,10 @@
crudService.setName("CRUD");
// Create a Java interface model for the CRUD Java interface
- JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory(new DefaultJavaInterfaceIntrospectorExtensionPoint());
JavaInterface javaInterface;
try {
- JavaInterfaceIntrospector javaIntrospector = new ExtensibleJavaInterfaceIntrospector(javaFactory, new DefaultJavaInterfaceIntrospectorExtensionPoint());
- javaInterface = javaIntrospector.introspect(CRUD.class);
+ javaInterface = javaFactory.createJavaInterface(CRUD.class);
} catch (InvalidInterfaceException e) {
throw new IllegalArgumentException(e);
}
Modified: incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo2/extension/POJOImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo2/extension/POJOImplementationProcessor.java?view=diff&rev=562846&r1=562845&r2=562846
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo2/extension/POJOImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/samples/implementation-pojo2-extension/src/main/java/pojo2/extension/POJOImplementationProcessor.java Sun Aug 5 03:48:44 2007
@@ -39,9 +39,6 @@
import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
/**
* Implements a STAX based artifact processor for POJO implementations.
@@ -56,7 +53,6 @@
private AssemblyFactory assemblyFactory;
private JavaInterfaceFactory javaFactory;
- private JavaInterfaceIntrospector javaIntrospector;
public POJOImplementationProcessor(ModelFactoryExtensionPoint modelFactories) {
@@ -64,11 +60,6 @@
// create model objects
assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
-
- // Create an instance of the Java interface introspector utility class, as
- // we may need it to introspect the POJO, if there's no componentType file
- // describing it
- javaIntrospector = new ExtensibleJavaInterfaceIntrospector(javaFactory, new DefaultJavaInterfaceIntrospectorExtensionPoint());
}
public QName getArtifactType() {
@@ -140,7 +131,7 @@
service.setName(pojoClass.getSimpleName());
JavaInterface javaInterface;
try {
- javaInterface = javaIntrospector.introspect(pojoClass);
+ javaInterface = javaFactory.createJavaInterface(pojoClass);
} catch (InvalidInterfaceException e) {
throw new ContributionResolveException(e);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org