From 5b2c0562e87008db1d69ddb3b8e3769d561aa37d Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 22 Sep 2008 00:58:11 +0000 Subject: Started to refactor implementation-java to avoid having the SPI interfaces reference implementation classes as it doesn't work with OSGi imports/exports. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@697649 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/context/InstanceFactoryProvider.java | 2 +- .../injection/JavaPropertyValueObjectFactory.java | 4 +- .../invocation/JavaComponentContextProvider.java | 8 +- .../invocation/JavaImplementationProvider.java | 2 +- .../invocation/JavaInstanceFactoryProvider.java | 6 +- .../JavaPropertyValueObjectFactoryTestCase.java | 2 +- .../java/util/JavaIntrospectionHelperTestCase.java | 2 +- .../java/xml/JavaImplementationProcessor.java | 4 +- .../modules/implementation-java/pom.xml | 5 +- .../implementation/java/BaseJavaClassVisitor.java | 63 +++ .../implementation/java/JavaConstructorImpl.java | 54 ++ .../sca/implementation/java/JavaElementImpl.java | 218 ++++++++ .../implementation/java/JavaImplementation.java | 4 - .../java/JavaImplementationActivator.java | 85 +++ .../java/JavaIntrospectionHelper.java | 577 +++++++++++++++++++++ .../sca/implementation/java/JavaParameterImpl.java | 36 ++ .../sca/implementation/java/JavaResourceImpl.java | 86 +++ .../sca/implementation/java/JavaScopeImpl.java | 66 +++ .../java/impl/JavaClassIntrospectorImpl.java | 4 +- .../java/impl/JavaConstructorImpl.java | 53 -- .../implementation/java/impl/JavaElementImpl.java | 224 -------- .../java/impl/JavaImplementationActivator.java | 86 --- .../java/impl/JavaImplementationImpl.java | 4 + .../java/impl/JavaParameterImpl.java | 35 -- .../implementation/java/impl/JavaResourceImpl.java | 85 --- .../implementation/java/impl/JavaScopeImpl.java | 66 --- .../java/introspect/JavaClassVisitor.java | 2 +- .../introspect/impl/AbstractPropertyProcessor.java | 6 +- .../impl/AllowsPassByReferenceProcessor.java | 1 + .../java/introspect/impl/BaseJavaClassVisitor.java | 64 --- .../introspect/impl/ComponentNameProcessor.java | 6 +- .../java/introspect/impl/ConstructorProcessor.java | 5 +- .../java/introspect/impl/ContextProcessor.java | 6 +- .../introspect/impl/ConversationIDProcessor.java | 6 +- .../introspect/impl/ConversationProcessor.java | 3 +- .../java/introspect/impl/DestroyProcessor.java | 1 + .../java/introspect/impl/EagerInitProcessor.java | 1 + .../introspect/impl/HeuristicPojoProcessor.java | 16 +- .../java/introspect/impl/InitProcessor.java | 1 + .../introspect/impl/JavaIntrospectionHelper.java | 577 --------------------- .../java/introspect/impl/PolicyProcessor.java | 2 + .../java/introspect/impl/ReferenceProcessor.java | 8 +- .../java/introspect/impl/ResourceProcessor.java | 8 +- .../java/introspect/impl/ScopeProcessor.java | 3 +- .../java/introspect/impl/ServiceProcessor.java | 6 +- .../org.apache.tuscany.sca.core.ModuleActivator | 2 +- .../introspect/impl/AbstractProcessorTest.java | 4 +- .../impl/AbstractPropertyProcessorTestCase.java | 4 +- .../impl/ConstructorProcessorTestCase.java | 2 +- .../impl/ConstructorResourceTestCase.java | 2 +- .../impl/ConversationProcessorTestCase.java | 4 +- .../impl/HeuristicAndPropertyTestCase.java | 2 +- .../impl/HeuristicConstructorTestCase.java | 2 +- .../impl/HeuristicPojoProcessorTestCase.java | 4 +- .../HeutisticExtensibleConstructorTestCase.java | 4 +- .../introspect/impl/PropertyProcessorTestCase.java | 3 +- .../introspect/impl/ResourceProcessorTestCase.java | 2 +- .../introspect/impl/ScopeProcessorTestCase.java | 2 +- .../spring/SpringImplementationProcessor.java | 5 +- .../spring/xml/SpringBeanIntrospector.java | 45 +- .../spring/xml/SpringXMLComponentTypeLoader.java | 6 +- 61 files changed, 1294 insertions(+), 1302 deletions(-) create mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaClassVisitor.java create mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaConstructorImpl.java create mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaElementImpl.java create mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationActivator.java create mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaIntrospectionHelper.java create mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaParameterImpl.java create mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaResourceImpl.java create mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaScopeImpl.java delete mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java delete mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java delete mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java delete mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java delete mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java delete mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java delete mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java delete mode 100644 branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java (limited to 'branches/sca-equinox') diff --git a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java index a93710d266..df21e013f1 100644 --- a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java +++ b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java @@ -19,7 +19,7 @@ package org.apache.tuscany.sca.implementation.java.context; import org.apache.tuscany.sca.core.factory.ObjectFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; /** * @version $Rev$ $Date$ diff --git a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java index 695dea3343..40aefed219 100644 --- a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java +++ b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java @@ -33,8 +33,8 @@ import org.apache.tuscany.sca.databinding.SimpleTypeMapper; import org.apache.tuscany.sca.databinding.impl.DOMHelper; import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl; import org.apache.tuscany.sca.databinding.xml.DOMDataBinding; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.apache.tuscany.sca.interfacedef.DataType; import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl; import org.apache.tuscany.sca.interfacedef.util.TypeInfo; diff --git a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java index e585b3d46f..0e35e32f01 100644 --- a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java +++ b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java @@ -50,13 +50,13 @@ import org.apache.tuscany.sca.core.invocation.WireObjectFactory; import org.apache.tuscany.sca.core.scope.ScopeContainer; import org.apache.tuscany.sca.core.scope.TargetResolutionException; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; +import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; import org.apache.tuscany.sca.implementation.java.injection.ConversationIDObjectFactory; import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException; import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory; -import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil; import org.apache.tuscany.sca.invocation.Invoker; diff --git a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java index e9eea607c9..b83dba42cc 100644 --- a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java +++ b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java @@ -32,7 +32,7 @@ import org.apache.tuscany.sca.core.scope.Scope; import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider; import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory; import org.apache.tuscany.sca.implementation.java.injection.RequestContextObjectFactory; import org.apache.tuscany.sca.implementation.java.injection.ResourceHost; diff --git a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java index 95a9f63688..0200fcf385 100644 --- a/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java +++ b/branches/sca-equinox/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java @@ -30,19 +30,19 @@ import java.util.Map; import org.apache.tuscany.sca.core.factory.ObjectFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactory; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.context.InstanceFactory; import org.apache.tuscany.sca.implementation.java.context.InstanceFactoryProvider; import org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.injection.ArrayMultiplicityObjectFactory; import org.apache.tuscany.sca.implementation.java.injection.FieldInjector; import org.apache.tuscany.sca.implementation.java.injection.Injector; import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException; import org.apache.tuscany.sca.implementation.java.injection.ListMultiplicityObjectFactory; import org.apache.tuscany.sca.implementation.java.injection.MethodInjector; -import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; /** * Encapsulates configuration for a Java-based atomic component diff --git a/branches/sca-equinox/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java b/branches/sca-equinox/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java index d502462688..366f21d9f0 100644 --- a/branches/sca-equinox/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java +++ b/branches/sca-equinox/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java @@ -33,7 +33,7 @@ import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint; import org.apache.tuscany.sca.databinding.Mediator; import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.easymock.EasyMock; import org.junit.Assert; import org.junit.BeforeClass; diff --git a/branches/sca-equinox/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java b/branches/sca-equinox/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java index ed6bf7ddc4..b104f1a6c0 100644 --- a/branches/sca-equinox/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java +++ b/branches/sca-equinox/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java @@ -27,7 +27,7 @@ import java.util.Set; import junit.framework.TestCase; -import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; /** * diff --git a/branches/sca-equinox/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/branches/sca-equinox/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java index 11934ec6bb..8c9dbaf3d5 100644 --- a/branches/sca-equinox/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java +++ b/branches/sca-equinox/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java @@ -52,10 +52,10 @@ import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.contribution.service.ContributionWriteException; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.monitor.Monitor; diff --git a/branches/sca-equinox/modules/implementation-java/pom.xml b/branches/sca-equinox/modules/implementation-java/pom.xml index 19adeeaf46..f426d36247 100644 --- a/branches/sca-equinox/modules/implementation-java/pom.xml +++ b/branches/sca-equinox/modules/implementation-java/pom.xml @@ -74,7 +74,10 @@ ${tuscany.version} org.apache.tuscany.sca.implementation.java ${pom.name} - org.apache.tuscany.sca.implementation.java* + + org.apache.tuscany.sca.implementation.java, + org.apache.tuscany.sca.implementation.java.introspect + diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaClassVisitor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaClassVisitor.java new file mode 100644 index 0000000000..39b20d41eb --- /dev/null +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaClassVisitor.java @@ -0,0 +1,63 @@ +/* + * 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.implementation.java.introspect; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; + +/** + * A convenience class for annotation processors which alleviates the need to + * implement unused callbacks + * + * @version $Rev$ $Date$ + */ +public abstract class BaseJavaClassVisitor implements JavaClassVisitor { + protected AssemblyFactory assemblyFactory; + + protected BaseJavaClassVisitor(AssemblyFactory factory) { + this.assemblyFactory = factory; + } + + public void visitClass(Class clazz, JavaImplementation type) throws IntrospectionException { + } + + public void visitSuperClass(Class clazz, JavaImplementation type) throws IntrospectionException { + } + + public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException { + } + + public void visitConstructor(Constructor constructor, JavaImplementation type) throws IntrospectionException { + } + + public void visitField(Field field, JavaImplementation type) throws IntrospectionException { + } + + public void visitEnd(Class clazz, JavaImplementation type) throws IntrospectionException { + } + + public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type) throws IntrospectionException { + } +} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaConstructorImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaConstructorImpl.java new file mode 100644 index 0000000000..4d53c45f1f --- /dev/null +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaConstructorImpl.java @@ -0,0 +1,54 @@ +/* + * 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.implementation.java; + +import java.lang.reflect.Constructor; + + +/** + * Hold injection information for the constructor used to instantiate a + * component implementation instance + * + * @version $Rev$ $Date$ + */ +public class JavaConstructorImpl { + + private Constructor constructor; + private JavaParameterImpl[] parameters; + + public JavaConstructorImpl(Constructor constructor) { + this.constructor = constructor; + int size = constructor.getParameterTypes().length; + parameters = new JavaParameterImpl[size]; + for (int i = 0; i < size; i++) { + parameters[i] = new JavaParameterImpl(constructor, i); + } + } + + public Constructor getConstructor() { + return constructor; + } + + /** + * @return the parameters + */ + public JavaParameterImpl[] getParameters() { + return parameters; + } +} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaElementImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaElementImpl.java new file mode 100644 index 0000000000..c3709efb0a --- /dev/null +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaElementImpl.java @@ -0,0 +1,218 @@ +/* + * 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.implementation.java; + +import java.lang.annotation.Annotation; +import java.lang.annotation.ElementType; +import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Type; + +/** + * This class represents a java element such as a Package, Class, Constructor, + * Field, Method or Parameter. + * + * @version $Rev$ $Date$ + */ +public class JavaElementImpl { + private AnnotatedElement anchor; + private ElementType elementType; + private Class type; + private Type genericType; + private int index = -1; + private String name; + private Class classifer; + + public JavaElementImpl(Class cls) { + this.anchor = cls; + this.elementType = ElementType.TYPE; + this.type = cls; + this.genericType = cls; + this.name = cls.getName(); + } + + public JavaElementImpl(Field field) { + this.anchor = field; + this.elementType = ElementType.FIELD; + this.type = field.getType(); + this.genericType = field.getGenericType(); + this.name = field.getName(); + } + + public JavaElementImpl(Constructor constructor, int index) { + this.anchor = constructor; + this.elementType = ElementType.PARAMETER; + this.type = constructor.getParameterTypes()[index]; + this.genericType = constructor.getGenericParameterTypes()[index]; + this.index = index; + this.name = ""; + } + + public JavaElementImpl(Method method, int index) { + this.anchor = method; + this.elementType = ElementType.PARAMETER; + this.type = method.getParameterTypes()[index]; + this.genericType = method.getGenericParameterTypes()[index]; + this.index = index; + this.name = ""; + } + + /** + * For testing purpose + * + * @param name + * @param type + * @param classifer TODO + * @param elementType + */ + public JavaElementImpl(String name, Class type, Class classifer) { + super(); + this.type = type; + this.name = name; + this.classifer = classifer; + } + + /** + * @return the anchor + */ + public AnnotatedElement getAnchor() { + return anchor; + } + + /** + * @return the elementType + */ + public ElementType getElementType() { + return elementType; + } + + /** + * @return the genericType + */ + public Type getGenericType() { + return genericType; + } + + /** + * @return the index + */ + public int getIndex() { + return index; + } + + /** + * @return the type + */ + public Class getType() { + return type; + } + + public Annotation[] getAnnotations() { + if (elementType == ElementType.PARAMETER) { + if (anchor instanceof Method) { + // We only care about the method-level annotations + return ((Method)anchor).getAnnotations(); + } + if (anchor instanceof Constructor) { + return ((Constructor)anchor).getParameterAnnotations()[index]; + } + } + return anchor.getAnnotations(); + } + + public T getAnnotation(Class annotationType) { + for (Annotation a : getAnnotations()) { + if (a.annotationType() == annotationType) { + return annotationType.cast(a); + } + } + return null; + } + + @Override + public String toString() { + return anchor.toString() + (elementType == ElementType.PARAMETER ? "[" + index + "]" : ""); + } + + @Override + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = PRIME * result + ((anchor == null) ? 0 : anchor.hashCode()); + result = PRIME * result + index; + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final JavaElementImpl other = (JavaElementImpl)obj; + if (anchor == null) { + if (other.anchor != null) { + return false; + } + } else if (!anchor.equals(other.anchor)) { + return false; + } + if (index != other.index) { + return false; + } + return true; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the classifier + */ + public Class getClassifer() { + return classifer; + } + + /** + * @param classifer the classifier to set + */ + public void setClassifer(Class classifer) { + this.classifer = classifer; + } + +} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java index 2ad7edbd6f..cfb8aed338 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java @@ -26,10 +26,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl; import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationActivator.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationActivator.java new file mode 100644 index 0000000000..441b1b8fb9 --- /dev/null +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationActivator.java @@ -0,0 +1,85 @@ +/* + * 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.implementation.java; + +import org.apache.tuscany.sca.assembly.AssemblyFactory; +import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; +import org.apache.tuscany.sca.core.ExtensionPointRegistry; +import org.apache.tuscany.sca.core.ModuleActivator; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationIDProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor; +import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor; +import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; +import org.apache.tuscany.sca.policy.PolicyFactory; + +/** + * A module activator for the Java implementation model. + * + * @version $Rev$ $Date$ + */ +public class JavaImplementationActivator implements ModuleActivator { + + public void start(ExtensionPointRegistry registry) { + ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class); + AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); + JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); + PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class); + + BaseJavaClassVisitor[] extensions = + new BaseJavaClassVisitor[] {new ConstructorProcessor(assemblyFactory), + new AllowsPassByReferenceProcessor(assemblyFactory), + new ComponentNameProcessor(assemblyFactory), + new ContextProcessor(assemblyFactory), + new ConversationIDProcessor(assemblyFactory), + new ConversationProcessor(assemblyFactory), + new DestroyProcessor(assemblyFactory), new EagerInitProcessor(assemblyFactory), + new InitProcessor(assemblyFactory), new PropertyProcessor(assemblyFactory), + new ReferenceProcessor(assemblyFactory, javaFactory), + new ResourceProcessor(assemblyFactory), new ScopeProcessor(assemblyFactory), + new ServiceProcessor(assemblyFactory, javaFactory), + new HeuristicPojoProcessor(assemblyFactory, javaFactory), + new PolicyProcessor(assemblyFactory, policyFactory)}; + + JavaImplementationFactory javaImplementationFactory = modelFactories.getFactory(JavaImplementationFactory.class); + for (JavaClassVisitor extension : extensions) { + javaImplementationFactory.addClassVisitor(extension); + } + + } + + public void stop(ExtensionPointRegistry registry) { + } + +} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaIntrospectionHelper.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaIntrospectionHelper.java new file mode 100644 index 0000000000..d36bf7397e --- /dev/null +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaIntrospectionHelper.java @@ -0,0 +1,577 @@ +/* + * 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.implementation.java.introspect; + +import java.beans.Introspector; +import java.lang.annotation.Annotation; +import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.GenericArrayType; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; +import java.lang.reflect.WildcardType; +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Logger; + +import org.osoa.sca.CallableReference; + +/** + * Implements various reflection-related operations + * + * @version $Rev$ $Date$ + */ +public final class JavaIntrospectionHelper { + private static final Logger logger = Logger.getLogger(JavaIntrospectionHelper.class.getName()); + private static final Class[] EMPTY_CLASS_ARRY = new Class[0]; + + /** + * Hide the constructor + */ + private JavaIntrospectionHelper() { + } + + /** + * Returns a collection of public, and protected fields declared by a class + * or one of its supertypes + */ + public static Set getAllPublicAndProtectedFields(Class clazz, boolean validating) { + return getAllPublicAndProtectedFields(clazz, new HashSet(), validating); + } + + private static void checkInvalidAnnotations(AnnotatedElement element) { + for (Annotation a : element.getAnnotations()) { + if (a.annotationType().getName().startsWith("org.osoa.sca.annotations.")) { + logger.warning("Invalid annotation " + a + " is found on " + element); + } + } + } + + /** + * Recursively evaluates the type hierarchy to return all fields that are + * public or protected + */ + private static Set getAllPublicAndProtectedFields(Class clazz, Set fields, boolean validating) { + if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) { + return fields; + } + fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields, validating); + Field[] declaredFields = clazz.getDeclaredFields(); + for (final Field field : declaredFields) { + int modifiers = field.getModifiers(); + if ((Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) && !Modifier.isStatic(modifiers)) { + // Allow privileged access to set accessibility. Requires ReflectPermission + // in security policy. + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + field.setAccessible(true); // ignore Java accessibility + return null; + } + }); + fields.add(field); + } else { + if (validating) { + checkInvalidAnnotations(field); + } + } + } + return fields; + } + + /** + * Returns a collection of public and protected methods declared by a class + * or one of its supertypes. Note that overridden methods will not be + * returned in the collection (i.e. only the method override will be).

+ * This method can potentially be expensive as reflection information is not + * cached. It is assumed that this method will be used during a + * configuration phase. + */ + public static Set getAllUniquePublicProtectedMethods(Class clazz, boolean validating) { + return getAllUniqueMethods(clazz, new HashSet(), validating); + } + + /** + * Recursively evaluates the type hierarchy to return all unique methods + */ + private static Set getAllUniqueMethods(Class pClass, Set methods, boolean validating) { + if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) { + return methods; + } + // we first evaluate methods of the subclass and then move to the parent + Method[] declaredMethods = pClass.getDeclaredMethods(); + for (final Method declaredMethod : declaredMethods) { + int modifiers = declaredMethod.getModifiers(); + if ((!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) || Modifier.isStatic(modifiers)) { + if (validating) { + checkInvalidAnnotations(declaredMethod); + } + continue; + } + if (methods.size() == 0) { + methods.add(declaredMethod); + } else { + List temp = new ArrayList(); + boolean matched = false; + for (Method method : methods) { + // only add if not already in the set from a superclass (i.e. + // the method is not overridden) + if (exactMethodMatch(declaredMethod, method)) { + matched = true; + break; + } + } + if (!matched) { + // Allow privileged access to set accessibility. Requires ReflectPermission + // in security policy. + AccessController.doPrivileged(new PrivilegedAction() { + public Object run() { + declaredMethod.setAccessible(true); + return null; + } + }); + temp.add(declaredMethod); + } + methods.addAll(temp); + temp.clear(); + } + } + // evaluate class hierarchy - this is done last to track inherited + // methods + methods = getAllUniqueMethods(pClass.getSuperclass(), methods, validating); + return methods; + } + + /** + * Finds the closest matching field with the given name, that is, a field of + * the exact specified type or, alternately, of a supertype. + * + * @param name the name of the field + * @param type the field type + * @param fields the collection of fields to search + * @return the matching field or null if not found + */ + public static Field findClosestMatchingField(String name, Class type, Set fields) { + Field candidate = null; + for (Field field : fields) { + if (field.getName().equals(name)) { + if (field.getType().equals(type)) { + return field; // exact match + } else if (field.getType().isAssignableFrom(type) || (field.getType().isPrimitive() && primitiveAssignable(field + .getType(), + type))) { + // We could have the situation where a field parameter is a + // primitive and the demarshalled value is + // an object counterpart (e.g. Integer and int) + // @spec issue + // either an interface or super class, so keep a reference + // until + // we know there are no closer types + candidate = field; + } + } + } + if (candidate != null) { + return candidate; + } else { + return null; + } + } + + /** + * Finds the closest matching method with the given name, that is, a method + * taking the exact parameter types or, alternately, parameter supertypes. + * + * @param name the name of the method + * @param types the method parameter types + * @param methods the collection of methods to search + * @return the matching method or null if not found + */ + public static Method findClosestMatchingMethod(String name, Class[] types, Set methods) { + if (types == null) { + types = EMPTY_CLASS_ARRY; + } + Method candidate = null; + for (Method method : methods) { + if (method.getName().equals(name) && method.getParameterTypes().length == types.length) { + Class[] params = method.getParameterTypes(); + boolean disqualify = false; + boolean exactMatch = true; + for (int i = 0; i < params.length; i++) { + if (!params[i].equals(types[i]) && !params[i].isAssignableFrom(types[i])) { + // no match + disqualify = true; + exactMatch = false; + break; + } else if (!params[i].equals(types[i]) && params[i].isAssignableFrom(types[i])) { + // not exact match + exactMatch = false; + } + } + if (disqualify) { + continue; + } else if (exactMatch) { + return method; + } else { + candidate = method; + } + } + } + if (candidate != null) { + return candidate; + } else { + return null; + } + } + + /** + * Determines if two methods "match" - that is, they have the same method + * names and exact parameter types (one is not a supertype of the other) + */ + public static boolean exactMethodMatch(Method method1, Method method2) { + if (!method1.getName().equals(method2.getName())) { + return false; + } + Class[] types1 = method1.getParameterTypes(); + Class[] types2 = method2.getParameterTypes(); + if (types1.length != types2.length) { + return false; + } + boolean matched = true; + for (int i = 0; i < types1.length; i++) { + if (types1[i] != types2[i]) { + matched = false; + break; + } + } + return matched; + } + + public static Constructor getDefaultConstructor(Class clazz) throws NoSuchMethodException { + return clazz.getConstructor((Class[])null); + } + + /** + * Returns the simple name of a class - i.e. the class name devoid of its + * package qualifier + * + * @param implClass the implementation class + */ + public static String getBaseName(Class implClass) { + return implClass.getSimpleName(); + } + + public static boolean isImmutable(Class clazz) { + return String.class == clazz || clazz.isPrimitive() + || Number.class.isAssignableFrom(clazz) + || Boolean.class.isAssignableFrom(clazz) + || Character.class.isAssignableFrom(clazz) + || Byte.class.isAssignableFrom(clazz); + } + + /** + * Takes a property name and converts it to a getter method name according + * to JavaBean conventions. For example, property + * foo is returned as getFoo + */ + public static String toGetter(String name) { + return "get" + name.toUpperCase().substring(0, 1) + name.substring(1); + } + + /** + * Takes a setter or getter method name and converts it to a property name + * according to JavaBean conventions. For example, setFoo(var) + * is returned as property foo + */ + public static String toPropertyName(String name) { + if (!name.startsWith("set")) { + return name; + } + return Introspector.decapitalize(name.substring(3)); + } + + public static Class getErasure(Type type) { + if (type instanceof Class) { + return (Class)type; + } else if (type instanceof GenericArrayType) { + // FIXME: How to deal with the []? + GenericArrayType arrayType = (GenericArrayType)type; + return getErasure(arrayType.getGenericComponentType()); + } else if (type instanceof ParameterizedType) { + ParameterizedType pType = (ParameterizedType)type; + return getErasure(pType.getRawType()); + } else if (type instanceof WildcardType) { + WildcardType wType = (WildcardType)type; + Type[] types = wType.getUpperBounds(); + return getErasure(types[0]); + } else if (type instanceof TypeVariable) { + TypeVariable var = (TypeVariable)type; + Type[] types = var.getBounds(); + return getErasure(types[0]); + } + return null; + } + + public static Class getBaseType(Class cls, Type genericType) { + if (cls.isArray()) { + return cls.getComponentType(); + } else if (Collection.class.isAssignableFrom(cls)) { + if (genericType instanceof ParameterizedType) { + // Collection + ParameterizedType parameterizedType = (ParameterizedType)genericType; + Type baseType = parameterizedType.getActualTypeArguments()[0]; + if (baseType instanceof GenericArrayType) { + // Base is array + return cls; + } else { + return getErasure(baseType); + } + } else { + return cls; + } + } else { + return cls; + } + } + + public static Type getParameterType(Type type) { + if (type instanceof ParameterizedType) { + // Collection + ParameterizedType parameterizedType = (ParameterizedType)type; + Type baseType = parameterizedType.getActualTypeArguments()[0]; + return baseType; + } else { + return Object.class; + } + } + + public static Class getBusinessInterface(Class cls, Type callableReferenceType) { + if (CallableReference.class.isAssignableFrom(cls) && callableReferenceType instanceof ParameterizedType) { + // Collection + ParameterizedType parameterizedType = (ParameterizedType)callableReferenceType; + Type baseType = parameterizedType.getActualTypeArguments()[0]; + if (baseType instanceof GenericArrayType) { + // Base is array + return cls; + } else { + return getErasure(baseType); + } + } + return Object.class; + } + + /** + * Takes a property name and converts it to a setter method name according + * to JavaBean conventions. For example, the property + * foo is returned as setFoo(var) + */ + public static String toSetter(String name) { + return "set" + name.toUpperCase().substring(0, 1) + name.substring(1); + } + + /** + * Compares a two types, assuming one is a primitive, to determine if the + * other is its object counterpart + */ + private static boolean primitiveAssignable(Class memberType, Class param) { + if (memberType == Integer.class) { + return param == Integer.TYPE; + } else if (memberType == Double.class) { + return param == Double.TYPE; + } else if (memberType == Float.class) { + return param == Float.TYPE; + } else if (memberType == Short.class) { + return param == Short.TYPE; + } else if (memberType == Character.class) { + return param == Character.TYPE; + } else if (memberType == Boolean.class) { + return param == Boolean.TYPE; + } else if (memberType == Byte.class) { + return param == Byte.TYPE; + } else if (param == Integer.class) { + return memberType == Integer.TYPE; + } else if (param == Double.class) { + return memberType == Double.TYPE; + } else if (param == Float.class) { + return memberType == Float.TYPE; + } else if (param == Short.class) { + return memberType == Short.TYPE; + } else if (param == Character.class) { + return memberType == Character.TYPE; + } else if (param == Boolean.class) { + return memberType == Boolean.TYPE; + } else if (param == Byte.class) { + return memberType == Byte.TYPE; + } else { + return false; + } + } + + /** + * Returns the generic types represented in the given type. Usage as + * follows: + * JavaIntrospectionHelper.getGenerics(field.getGenericType()); + *

+ * JavaIntrospectionHelper.getGenerics(m.getGenericParameterTypes()[0];); + * + * @return the generic types in order of declaration or an empty array if + * the type is not genericized + */ + public static List getGenerics(Type genericType) { + List classes = new ArrayList(); + if (genericType instanceof ParameterizedType) { + ParameterizedType ptype = (ParameterizedType)genericType; + // get the type arguments + Type[] targs = ptype.getActualTypeArguments(); + for (Type targ : targs) { + classes.add(targ); + } + } + return classes; + } + + /** + * Returns the generic type specified by the class at the given position as + * in:

public class Foo{ //.. } + *

+ * JavaIntrospectionHelper.introspectGeneric(Foo.class,1); + *

+ * will return Baz. + */ + public static Class introspectGeneric(Class clazz, int pos) { + assert clazz != null : "No class specified"; + Type type = clazz.getGenericSuperclass(); + if (type instanceof ParameterizedType) { + Type[] args = ((ParameterizedType)type).getActualTypeArguments(); + if (args.length <= pos) { + throw new IllegalArgumentException("Invalid index value for generic class " + clazz.getName()); + } + return (Class)((ParameterizedType)type).getActualTypeArguments()[pos]; + } else { + Type[] interfaces = clazz.getGenericInterfaces(); + for (Type itype : interfaces) { + if (!(itype instanceof ParameterizedType)) { + continue; + } + ParameterizedType interfaceType = (ParameterizedType)itype; + return (Class)interfaceType.getActualTypeArguments()[0]; + } + } + return null; + } + + /** + * Returns the set of interfaces implemented by the given class and its + * ancestors or a blank set if none + */ + public static Set getAllInterfaces(Class clazz) { + Set implemented = new HashSet(); + getAllInterfaces(clazz, implemented); + return implemented; + } + + private static void getAllInterfaces(Class clazz, Set implemented) { + Class[] interfaces = clazz.getInterfaces(); + for (Class interfaze : interfaces) { + implemented.add(interfaze); + } + Class superClass = clazz.getSuperclass(); + // Object has no superclass so check for null + if (superClass != null && !superClass.equals(Object.class)) { + getAllInterfaces(superClass, implemented); + } + } + + public static boolean isSetter(Method method) { + return (void.class == method.getReturnType() && method.getParameterTypes().length == 1 && method.getName() + .startsWith("set")); + } + + public static boolean isGetter(Method method) { + return (void.class != method.getReturnType() && method.getParameterTypes().length == 0 && method.getName() + .startsWith("get")); + } + + private final static Map signatures = new HashMap(); + static { + signatures.put(boolean.class, "Z"); + signatures.put(byte.class, "B"); + signatures.put(char.class, "C"); + signatures.put(short.class, "S"); + signatures.put(int.class, "I"); + signatures.put(long.class, "J"); + signatures.put(float.class, "F"); + signatures.put(double.class, "D"); + }; + + public static String getSignature(Class cls) { + if (cls.isPrimitive()) { + return signatures.get(cls); + } + if (cls.isArray()) { + return "[" + getSignature(cls.getComponentType()); + } + return "L" + cls.getName().replace('.', '/') + ";"; + } + + public static Class getArrayType(Class componentType, int dims) throws ClassNotFoundException { + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < dims; i++) { + buf.append('['); + } + buf.append(getSignature(componentType)); + return Class.forName(buf.toString(), false, componentType.getClassLoader()); + } + + public static Set getPrivateMethods(Class clazz) { + Set methods = new HashSet(); + Method[] declaredMethods = clazz.getDeclaredMethods(); + for (final Method declaredMethod : declaredMethods) { + int modifiers = declaredMethod.getModifiers(); + if(Modifier.isPrivate(modifiers)) { + methods.add(declaredMethod); + } + } + + return methods; + } + + public static Set getPrivateFields(Class clazz) { + Set fields = new HashSet(); + Field[] declaredFields = clazz.getDeclaredFields(); + for (final Field declaredField : declaredFields) { + int modifiers = declaredField.getModifiers(); + if(Modifier.isPrivate(modifiers)) { + fields.add(declaredField); + } + } + + return fields; + } +} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaParameterImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaParameterImpl.java new file mode 100644 index 0000000000..80911a9552 --- /dev/null +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaParameterImpl.java @@ -0,0 +1,36 @@ +/* + * 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.implementation.java; + +import java.lang.reflect.Constructor; + + +/** + * @version $Rev$ $Date$ + */ +public class JavaParameterImpl extends JavaElementImpl { + /** + * @param constructor + * @param index + */ + public JavaParameterImpl(Constructor constructor, int index) { + super(constructor, index); + } +} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaResourceImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaResourceImpl.java new file mode 100644 index 0000000000..19a9f38549 --- /dev/null +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaResourceImpl.java @@ -0,0 +1,86 @@ +/* + * 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.implementation.java; + + + +/** + * A resource dependency declared by a Java component implementation + * + * @version $Rev$ $Date$ + */ +public class JavaResourceImpl { + private JavaElementImpl element; + private String mappedName; + private boolean optional; + + public JavaResourceImpl(JavaElementImpl element) { + this.element = element; + } + + /** + * The name of the resource + * + * @return the name of the resource + */ + public String getName() { + return element.getName(); + } + + /** + * Returns the URI of the resource + * + * @return the URI of the resource + */ + public String getMappedName() { + return mappedName; + } + + /** + * Sets the resource URI + */ + public void setMappedName(String mappedName) { + this.mappedName = mappedName; + } + + /** + * If true, the resource is optional + * + * @return true if the resource is optional + */ + public boolean isOptional() { + return optional; + } + + /** + * Sets whether the resource is optional + */ + public void setOptional(boolean optional) { + this.optional = optional; + } + + /** + * @return the element + */ + public JavaElementImpl getElement() { + return element; + } + + +} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaScopeImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaScopeImpl.java new file mode 100644 index 0000000000..b3ee8e8b2b --- /dev/null +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaScopeImpl.java @@ -0,0 +1,66 @@ +/* + * 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.implementation.java; + +/** + * The default implementation scopes supported by assemblies. + * + * @version $Rev$ $Date$ + */ +public class JavaScopeImpl { + public static final JavaScopeImpl STATELESS = new JavaScopeImpl("STATELESS"); + public static final JavaScopeImpl REQUEST = new JavaScopeImpl("REQUEST"); + public static final JavaScopeImpl SESSION = new JavaScopeImpl("SESSION"); + public static final JavaScopeImpl CONVERSATION = new JavaScopeImpl("CONVERSATION"); + public static final JavaScopeImpl COMPOSITE = new JavaScopeImpl("COMPOSITE"); + public static final JavaScopeImpl SYSTEM = new JavaScopeImpl("SYSTEM"); + public static final JavaScopeImpl UNDEFINED = new JavaScopeImpl("UNDEFINED"); + + private String scope; + + public JavaScopeImpl(String scope) { + this.scope = scope.toUpperCase().intern(); + } + + public String getScope() { + return scope; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final JavaScopeImpl scope1 = (JavaScopeImpl) o; + return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null); + } + + @Override + public int hashCode() { + return scope != null ? scope.hashCode() : 0; + } + + @Override + public String toString() { + return scope; + } +} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java index 0bcec3c78f..6503aa2889 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java @@ -25,9 +25,11 @@ import java.util.List; import java.util.Set; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; /** * An extensible Java class introspector implementation. diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java deleted file mode 100644 index c0b04b4b4e..0000000000 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.implementation.java.impl; - -import java.lang.reflect.Constructor; - -/** - * Hold injection information for the constructor used to instantiate a - * component implementation instance - * - * @version $Rev$ $Date$ - */ -public class JavaConstructorImpl { - - private Constructor constructor; - private JavaParameterImpl[] parameters; - - public JavaConstructorImpl(Constructor constructor) { - this.constructor = constructor; - int size = constructor.getParameterTypes().length; - parameters = new JavaParameterImpl[size]; - for (int i = 0; i < size; i++) { - parameters[i] = new JavaParameterImpl(constructor, i); - } - } - - public Constructor getConstructor() { - return constructor; - } - - /** - * @return the parameters - */ - public JavaParameterImpl[] getParameters() { - return parameters; - } -} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java deleted file mode 100644 index 2365298f71..0000000000 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * 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.implementation.java.impl; - -import java.lang.annotation.Annotation; -import java.lang.annotation.ElementType; -import java.lang.reflect.AnnotatedElement; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; - -/** - * This class represents a java element such as a Package, Class, Constructor, - * Field, Method or Parameter. - * - * @version $Rev$ $Date$ - */ -public class JavaElementImpl { - private AnnotatedElement anchor; - private ElementType elementType; - private Class type; - private Type genericType; - private int index = -1; - private String name; - private Class classifer; - - public JavaElementImpl(Package pkg) { - this.anchor = pkg; - this.elementType = ElementType.PACKAGE; - this.name = pkg.getName(); - } - - public JavaElementImpl(Class cls) { - this.anchor = cls; - this.elementType = ElementType.TYPE; - this.type = cls; - this.genericType = cls; - this.name = cls.getName(); - } - - public JavaElementImpl(Field field) { - this.anchor = field; - this.elementType = ElementType.FIELD; - this.type = field.getType(); - this.genericType = field.getGenericType(); - this.name = field.getName(); - } - - public JavaElementImpl(Constructor constructor, int index) { - this.anchor = constructor; - this.elementType = ElementType.PARAMETER; - this.type = constructor.getParameterTypes()[index]; - this.genericType = constructor.getGenericParameterTypes()[index]; - this.index = index; - this.name = ""; - } - - public JavaElementImpl(Method method, int index) { - this.anchor = method; - this.elementType = ElementType.PARAMETER; - this.type = method.getParameterTypes()[index]; - this.genericType = method.getGenericParameterTypes()[index]; - this.index = index; - this.name = ""; - } - - /** - * For testing purpose - * - * @param name - * @param type - * @param classifer TODO - * @param elementType - */ - public JavaElementImpl(String name, Class type, Class classifer) { - super(); - this.type = type; - this.name = name; - this.classifer = classifer; - } - - /** - * @return the anchor - */ - public AnnotatedElement getAnchor() { - return anchor; - } - - /** - * @return the elementType - */ - public ElementType getElementType() { - return elementType; - } - - /** - * @return the genericType - */ - public Type getGenericType() { - return genericType; - } - - /** - * @return the index - */ - public int getIndex() { - return index; - } - - /** - * @return the type - */ - public Class getType() { - return type; - } - - public Annotation[] getAnnotations() { - if (elementType == ElementType.PARAMETER) { - if (anchor instanceof Method) { - // We only care about the method-level annotations - return ((Method)anchor).getAnnotations(); - } - if (anchor instanceof Constructor) { - return ((Constructor)anchor).getParameterAnnotations()[index]; - } - } - return anchor.getAnnotations(); - } - - public T getAnnotation(Class annotationType) { - for (Annotation a : getAnnotations()) { - if (a.annotationType() == annotationType) { - return annotationType.cast(a); - } - } - return null; - } - - @Override - public String toString() { - return anchor.toString() + (elementType == ElementType.PARAMETER ? "[" + index + "]" : ""); - } - - @Override - public int hashCode() { - final int PRIME = 31; - int result = 1; - result = PRIME * result + ((anchor == null) ? 0 : anchor.hashCode()); - result = PRIME * result + index; - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final JavaElementImpl other = (JavaElementImpl)obj; - if (anchor == null) { - if (other.anchor != null) { - return false; - } - } else if (!anchor.equals(other.anchor)) { - return false; - } - if (index != other.index) { - return false; - } - return true; - } - - /** - * @return the name - */ - public String getName() { - return name; - } - - /** - * @param name the name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the classifier - */ - public Class getClassifer() { - return classifer; - } - - /** - * @param classifer the classifier to set - */ - public void setClassifer(Class classifer) { - this.classifer = classifer; - } - -} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java deleted file mode 100644 index 46594e0f50..0000000000 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.implementation.java.impl; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.ModuleActivator; -import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationIDProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor; -import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor; -import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; -import org.apache.tuscany.sca.policy.PolicyFactory; - -/** - * A module activator for the Java implementation model. - * - * @version $Rev$ $Date$ - */ -public class JavaImplementationActivator implements ModuleActivator { - - public void start(ExtensionPointRegistry registry) { - ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class); - AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class); - JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class); - PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class); - - BaseJavaClassVisitor[] extensions = - new BaseJavaClassVisitor[] {new ConstructorProcessor(assemblyFactory), - new AllowsPassByReferenceProcessor(assemblyFactory), - new ComponentNameProcessor(assemblyFactory), - new ContextProcessor(assemblyFactory), - new ConversationIDProcessor(assemblyFactory), - new ConversationProcessor(assemblyFactory), - new DestroyProcessor(assemblyFactory), new EagerInitProcessor(assemblyFactory), - new InitProcessor(assemblyFactory), new PropertyProcessor(assemblyFactory), - new ReferenceProcessor(assemblyFactory, javaFactory), - new ResourceProcessor(assemblyFactory), new ScopeProcessor(assemblyFactory), - new ServiceProcessor(assemblyFactory, javaFactory), - new HeuristicPojoProcessor(assemblyFactory, javaFactory), - new PolicyProcessor(assemblyFactory, policyFactory)}; - - JavaImplementationFactory javaImplementationFactory = modelFactories.getFactory(JavaImplementationFactory.class); - for (JavaClassVisitor extension : extensions) { - javaImplementationFactory.addClassVisitor(extension); - } - - } - - public void stop(ExtensionPointRegistry registry) { - } - -} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java index 375896cf26..a0b8b1dba0 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java @@ -27,7 +27,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.JavaScopeImpl; import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java deleted file mode 100644 index c4c528f4f2..0000000000 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.implementation.java.impl; - -import java.lang.reflect.Constructor; - -/** - * @version $Rev$ $Date$ - */ -public class JavaParameterImpl extends JavaElementImpl { - /** - * @param constructor - * @param index - */ - public JavaParameterImpl(Constructor constructor, int index) { - super(constructor, index); - } -} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java deleted file mode 100644 index 1aca15ebb8..0000000000 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.implementation.java.impl; - - -/** - * A resource dependency declared by a Java component implementation - * - * @version $Rev$ $Date$ - */ -public class JavaResourceImpl { - private JavaElementImpl element; - private String mappedName; - private boolean optional; - - public JavaResourceImpl(JavaElementImpl element) { - this.element = element; - } - - /** - * The name of the resource - * - * @return the name of the resource - */ - public String getName() { - return element.getName(); - } - - /** - * Returns the URI of the resource - * - * @return the URI of the resource - */ - public String getMappedName() { - return mappedName; - } - - /** - * Sets the resource URI - */ - public void setMappedName(String mappedName) { - this.mappedName = mappedName; - } - - /** - * If true, the resource is optional - * - * @return true if the resource is optional - */ - public boolean isOptional() { - return optional; - } - - /** - * Sets whether the resource is optional - */ - public void setOptional(boolean optional) { - this.optional = optional; - } - - /** - * @return the element - */ - public JavaElementImpl getElement() { - return element; - } - - -} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java deleted file mode 100644 index 85c2f73f75..0000000000 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.implementation.java.impl; - -/** - * The default implementation scopes supported by assemblies. - * - * @version $Rev$ $Date$ - */ -public class JavaScopeImpl { - public static final JavaScopeImpl STATELESS = new JavaScopeImpl("STATELESS"); - public static final JavaScopeImpl REQUEST = new JavaScopeImpl("REQUEST"); - public static final JavaScopeImpl SESSION = new JavaScopeImpl("SESSION"); - public static final JavaScopeImpl CONVERSATION = new JavaScopeImpl("CONVERSATION"); - public static final JavaScopeImpl COMPOSITE = new JavaScopeImpl("COMPOSITE"); - public static final JavaScopeImpl SYSTEM = new JavaScopeImpl("SYSTEM"); - public static final JavaScopeImpl UNDEFINED = new JavaScopeImpl("UNDEFINED"); - - private String scope; - - public JavaScopeImpl(String scope) { - this.scope = scope.toUpperCase().intern(); - } - - public String getScope() { - return scope; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - final JavaScopeImpl scope1 = (JavaScopeImpl) o; - return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null); - } - - @Override - public int hashCode() { - return scope != null ? scope.hashCode() : 0; - } - - @Override - public String toString() { - return scope; - } -} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java index 4fa40dee4b..4b0f5bea55 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java @@ -24,7 +24,7 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; /** * Implementations process class-level metadata, typically parsing annotations diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java index 9596fe0808..9e1d8c8b0c 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java @@ -29,9 +29,11 @@ import java.util.Map; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Property; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java index 4a3ce0c343..16de6d951a 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java @@ -23,6 +23,7 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; import org.osoa.sca.annotations.AllowsPassByReference; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java deleted file mode 100644 index bc6551d45d..0000000000 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.implementation.java.introspect.impl; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.implementation.java.IntrospectionException; -import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; -import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor; - -/** - * A convenience class for annotation processors which alleviates the need to - * implement unused callbacks - * - * @version $Rev$ $Date$ - */ -public abstract class BaseJavaClassVisitor implements JavaClassVisitor { - protected AssemblyFactory assemblyFactory; - - protected BaseJavaClassVisitor(AssemblyFactory factory) { - this.assemblyFactory = factory; - } - - public void visitClass(Class clazz, JavaImplementation type) throws IntrospectionException { - } - - public void visitSuperClass(Class clazz, JavaImplementation type) throws IntrospectionException { - } - - public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException { - } - - public void visitConstructor(Constructor constructor, JavaImplementation type) throws IntrospectionException { - } - - public void visitField(Field field, JavaImplementation type) throws IntrospectionException { - } - - public void visitEnd(Class clazz, JavaImplementation type) throws IntrospectionException { - } - - public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type) throws IntrospectionException { - } -} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java index 556f0b77e9..69798be864 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java @@ -23,9 +23,11 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.osoa.sca.annotations.ComponentName; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java index 17e28479d3..1421adc3d6 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java @@ -22,9 +22,10 @@ import java.lang.reflect.Constructor; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; /** * Handles processing of a constructor decorated with diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java index 177ceaa57c..f43b1fa22b 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java @@ -23,9 +23,11 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.osoa.sca.ComponentContext; import org.osoa.sca.RequestContext; import org.osoa.sca.annotations.Context; diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java index 985f8baa82..d4f7ee0bce 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java @@ -23,9 +23,11 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.osoa.sca.annotations.ConversationID; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java index efd04262dd..327bd97564 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java @@ -24,6 +24,7 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; import org.osoa.sca.annotations.ConversationAttributes; import org.osoa.sca.annotations.ConversationID; import org.osoa.sca.annotations.Scope; @@ -52,7 +53,7 @@ public class ConversationProcessor extends BaseJavaClassVisitor { Scope scope = clazz.getAnnotation(Scope.class); if (scope == null) { // implicitly assume conversation - type.setJavaScope(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION); + type.setJavaScope(org.apache.tuscany.sca.implementation.java.JavaScopeImpl.CONVERSATION); } else if (conversation != null) { long maxAge; long maxIdleTime; diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java index 50e4d46e97..7f26846969 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java @@ -24,6 +24,7 @@ import java.lang.reflect.Modifier; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; import org.osoa.sca.annotations.Destroy; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java index 5619275b82..650d6dd251 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.implementation.java.introspect.impl; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; import org.osoa.sca.annotations.EagerInit; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java index b7f6748ed2..7d1d6c83ce 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java @@ -18,10 +18,10 @@ */ package org.apache.tuscany.sca.implementation.java.introspect.impl; -import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces; -import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllPublicAndProtectedFields; -import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods; -import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.toPropertyName; +import static org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper.getAllInterfaces; +import static org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper.getAllPublicAndProtectedFields; +import static org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods; +import static org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper.toPropertyName; import java.lang.annotation.Annotation; import java.lang.reflect.Constructor; @@ -43,10 +43,12 @@ import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Contract; import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.apache.tuscany.sca.interfacedef.Interface; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java index 583ccc86cd..927c7f1565 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java @@ -24,6 +24,7 @@ import java.lang.reflect.Modifier; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; import org.osoa.sca.annotations.Init; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java deleted file mode 100644 index 6039bd91f8..0000000000 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java +++ /dev/null @@ -1,577 +0,0 @@ -/* - * 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.implementation.java.introspect.impl; - -import java.beans.Introspector; -import java.lang.annotation.Annotation; -import java.lang.reflect.AnnotatedElement; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.lang.reflect.WildcardType; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.logging.Logger; - -import org.osoa.sca.CallableReference; - -/** - * Implements various reflection-related operations - * - * @version $Rev$ $Date$ - */ -public final class JavaIntrospectionHelper { - private static final Logger logger = Logger.getLogger(JavaIntrospectionHelper.class.getName()); - private static final Class[] EMPTY_CLASS_ARRY = new Class[0]; - - /** - * Hide the constructor - */ - private JavaIntrospectionHelper() { - } - - /** - * Returns a collection of public, and protected fields declared by a class - * or one of its supertypes - */ - public static Set getAllPublicAndProtectedFields(Class clazz, boolean validating) { - return getAllPublicAndProtectedFields(clazz, new HashSet(), validating); - } - - private static void checkInvalidAnnotations(AnnotatedElement element) { - for (Annotation a : element.getAnnotations()) { - if (a.annotationType().getName().startsWith("org.osoa.sca.annotations.")) { - logger.warning("Invalid annotation " + a + " is found on " + element); - } - } - } - - /** - * Recursively evaluates the type hierarchy to return all fields that are - * public or protected - */ - private static Set getAllPublicAndProtectedFields(Class clazz, Set fields, boolean validating) { - if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) { - return fields; - } - fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields, validating); - Field[] declaredFields = clazz.getDeclaredFields(); - for (final Field field : declaredFields) { - int modifiers = field.getModifiers(); - if ((Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) && !Modifier.isStatic(modifiers)) { - // Allow privileged access to set accessibility. Requires ReflectPermission - // in security policy. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - field.setAccessible(true); // ignore Java accessibility - return null; - } - }); - fields.add(field); - } else { - if (validating) { - checkInvalidAnnotations(field); - } - } - } - return fields; - } - - /** - * Returns a collection of public and protected methods declared by a class - * or one of its supertypes. Note that overridden methods will not be - * returned in the collection (i.e. only the method override will be).

- * This method can potentially be expensive as reflection information is not - * cached. It is assumed that this method will be used during a - * configuration phase. - */ - public static Set getAllUniquePublicProtectedMethods(Class clazz, boolean validating) { - return getAllUniqueMethods(clazz, new HashSet(), validating); - } - - /** - * Recursively evaluates the type hierarchy to return all unique methods - */ - private static Set getAllUniqueMethods(Class pClass, Set methods, boolean validating) { - if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) { - return methods; - } - // we first evaluate methods of the subclass and then move to the parent - Method[] declaredMethods = pClass.getDeclaredMethods(); - for (final Method declaredMethod : declaredMethods) { - int modifiers = declaredMethod.getModifiers(); - if ((!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) || Modifier.isStatic(modifiers)) { - if (validating) { - checkInvalidAnnotations(declaredMethod); - } - continue; - } - if (methods.size() == 0) { - methods.add(declaredMethod); - } else { - List temp = new ArrayList(); - boolean matched = false; - for (Method method : methods) { - // only add if not already in the set from a superclass (i.e. - // the method is not overridden) - if (exactMethodMatch(declaredMethod, method)) { - matched = true; - break; - } - } - if (!matched) { - // Allow privileged access to set accessibility. Requires ReflectPermission - // in security policy. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - declaredMethod.setAccessible(true); - return null; - } - }); - temp.add(declaredMethod); - } - methods.addAll(temp); - temp.clear(); - } - } - // evaluate class hierarchy - this is done last to track inherited - // methods - methods = getAllUniqueMethods(pClass.getSuperclass(), methods, validating); - return methods; - } - - /** - * Finds the closest matching field with the given name, that is, a field of - * the exact specified type or, alternately, of a supertype. - * - * @param name the name of the field - * @param type the field type - * @param fields the collection of fields to search - * @return the matching field or null if not found - */ - public static Field findClosestMatchingField(String name, Class type, Set fields) { - Field candidate = null; - for (Field field : fields) { - if (field.getName().equals(name)) { - if (field.getType().equals(type)) { - return field; // exact match - } else if (field.getType().isAssignableFrom(type) || (field.getType().isPrimitive() && primitiveAssignable(field - .getType(), - type))) { - // We could have the situation where a field parameter is a - // primitive and the demarshalled value is - // an object counterpart (e.g. Integer and int) - // @spec issue - // either an interface or super class, so keep a reference - // until - // we know there are no closer types - candidate = field; - } - } - } - if (candidate != null) { - return candidate; - } else { - return null; - } - } - - /** - * Finds the closest matching method with the given name, that is, a method - * taking the exact parameter types or, alternately, parameter supertypes. - * - * @param name the name of the method - * @param types the method parameter types - * @param methods the collection of methods to search - * @return the matching method or null if not found - */ - public static Method findClosestMatchingMethod(String name, Class[] types, Set methods) { - if (types == null) { - types = EMPTY_CLASS_ARRY; - } - Method candidate = null; - for (Method method : methods) { - if (method.getName().equals(name) && method.getParameterTypes().length == types.length) { - Class[] params = method.getParameterTypes(); - boolean disqualify = false; - boolean exactMatch = true; - for (int i = 0; i < params.length; i++) { - if (!params[i].equals(types[i]) && !params[i].isAssignableFrom(types[i])) { - // no match - disqualify = true; - exactMatch = false; - break; - } else if (!params[i].equals(types[i]) && params[i].isAssignableFrom(types[i])) { - // not exact match - exactMatch = false; - } - } - if (disqualify) { - continue; - } else if (exactMatch) { - return method; - } else { - candidate = method; - } - } - } - if (candidate != null) { - return candidate; - } else { - return null; - } - } - - /** - * Determines if two methods "match" - that is, they have the same method - * names and exact parameter types (one is not a supertype of the other) - */ - public static boolean exactMethodMatch(Method method1, Method method2) { - if (!method1.getName().equals(method2.getName())) { - return false; - } - Class[] types1 = method1.getParameterTypes(); - Class[] types2 = method2.getParameterTypes(); - if (types1.length != types2.length) { - return false; - } - boolean matched = true; - for (int i = 0; i < types1.length; i++) { - if (types1[i] != types2[i]) { - matched = false; - break; - } - } - return matched; - } - - public static Constructor getDefaultConstructor(Class clazz) throws NoSuchMethodException { - return clazz.getConstructor((Class[])null); - } - - /** - * Returns the simple name of a class - i.e. the class name devoid of its - * package qualifier - * - * @param implClass the implementation class - */ - public static String getBaseName(Class implClass) { - return implClass.getSimpleName(); - } - - public static boolean isImmutable(Class clazz) { - return String.class == clazz || clazz.isPrimitive() - || Number.class.isAssignableFrom(clazz) - || Boolean.class.isAssignableFrom(clazz) - || Character.class.isAssignableFrom(clazz) - || Byte.class.isAssignableFrom(clazz); - } - - /** - * Takes a property name and converts it to a getter method name according - * to JavaBean conventions. For example, property - * foo is returned as getFoo - */ - public static String toGetter(String name) { - return "get" + name.toUpperCase().substring(0, 1) + name.substring(1); - } - - /** - * Takes a setter or getter method name and converts it to a property name - * according to JavaBean conventions. For example, setFoo(var) - * is returned as property foo - */ - public static String toPropertyName(String name) { - if (!name.startsWith("set")) { - return name; - } - return Introspector.decapitalize(name.substring(3)); - } - - public static Class getErasure(Type type) { - if (type instanceof Class) { - return (Class)type; - } else if (type instanceof GenericArrayType) { - // FIXME: How to deal with the []? - GenericArrayType arrayType = (GenericArrayType)type; - return getErasure(arrayType.getGenericComponentType()); - } else if (type instanceof ParameterizedType) { - ParameterizedType pType = (ParameterizedType)type; - return getErasure(pType.getRawType()); - } else if (type instanceof WildcardType) { - WildcardType wType = (WildcardType)type; - Type[] types = wType.getUpperBounds(); - return getErasure(types[0]); - } else if (type instanceof TypeVariable) { - TypeVariable var = (TypeVariable)type; - Type[] types = var.getBounds(); - return getErasure(types[0]); - } - return null; - } - - public static Class getBaseType(Class cls, Type genericType) { - if (cls.isArray()) { - return cls.getComponentType(); - } else if (Collection.class.isAssignableFrom(cls)) { - if (genericType instanceof ParameterizedType) { - // Collection - ParameterizedType parameterizedType = (ParameterizedType)genericType; - Type baseType = parameterizedType.getActualTypeArguments()[0]; - if (baseType instanceof GenericArrayType) { - // Base is array - return cls; - } else { - return getErasure(baseType); - } - } else { - return cls; - } - } else { - return cls; - } - } - - public static Type getParameterType(Type type) { - if (type instanceof ParameterizedType) { - // Collection - ParameterizedType parameterizedType = (ParameterizedType)type; - Type baseType = parameterizedType.getActualTypeArguments()[0]; - return baseType; - } else { - return Object.class; - } - } - - public static Class getBusinessInterface(Class cls, Type callableReferenceType) { - if (CallableReference.class.isAssignableFrom(cls) && callableReferenceType instanceof ParameterizedType) { - // Collection - ParameterizedType parameterizedType = (ParameterizedType)callableReferenceType; - Type baseType = parameterizedType.getActualTypeArguments()[0]; - if (baseType instanceof GenericArrayType) { - // Base is array - return cls; - } else { - return getErasure(baseType); - } - } - return Object.class; - } - - /** - * Takes a property name and converts it to a setter method name according - * to JavaBean conventions. For example, the property - * foo is returned as setFoo(var) - */ - public static String toSetter(String name) { - return "set" + name.toUpperCase().substring(0, 1) + name.substring(1); - } - - /** - * Compares a two types, assuming one is a primitive, to determine if the - * other is its object counterpart - */ - private static boolean primitiveAssignable(Class memberType, Class param) { - if (memberType == Integer.class) { - return param == Integer.TYPE; - } else if (memberType == Double.class) { - return param == Double.TYPE; - } else if (memberType == Float.class) { - return param == Float.TYPE; - } else if (memberType == Short.class) { - return param == Short.TYPE; - } else if (memberType == Character.class) { - return param == Character.TYPE; - } else if (memberType == Boolean.class) { - return param == Boolean.TYPE; - } else if (memberType == Byte.class) { - return param == Byte.TYPE; - } else if (param == Integer.class) { - return memberType == Integer.TYPE; - } else if (param == Double.class) { - return memberType == Double.TYPE; - } else if (param == Float.class) { - return memberType == Float.TYPE; - } else if (param == Short.class) { - return memberType == Short.TYPE; - } else if (param == Character.class) { - return memberType == Character.TYPE; - } else if (param == Boolean.class) { - return memberType == Boolean.TYPE; - } else if (param == Byte.class) { - return memberType == Byte.TYPE; - } else { - return false; - } - } - - /** - * Returns the generic types represented in the given type. Usage as - * follows: - * JavaIntrospectionHelper.getGenerics(field.getGenericType()); - *

- * JavaIntrospectionHelper.getGenerics(m.getGenericParameterTypes()[0];); - * - * @return the generic types in order of declaration or an empty array if - * the type is not genericized - */ - public static List getGenerics(Type genericType) { - List classes = new ArrayList(); - if (genericType instanceof ParameterizedType) { - ParameterizedType ptype = (ParameterizedType)genericType; - // get the type arguments - Type[] targs = ptype.getActualTypeArguments(); - for (Type targ : targs) { - classes.add(targ); - } - } - return classes; - } - - /** - * Returns the generic type specified by the class at the given position as - * in:

public class Foo{ //.. } - *

- * JavaIntrospectionHelper.introspectGeneric(Foo.class,1); - *

- * will return Baz. - */ - public static Class introspectGeneric(Class clazz, int pos) { - assert clazz != null : "No class specified"; - Type type = clazz.getGenericSuperclass(); - if (type instanceof ParameterizedType) { - Type[] args = ((ParameterizedType)type).getActualTypeArguments(); - if (args.length <= pos) { - throw new IllegalArgumentException("Invalid index value for generic class " + clazz.getName()); - } - return (Class)((ParameterizedType)type).getActualTypeArguments()[pos]; - } else { - Type[] interfaces = clazz.getGenericInterfaces(); - for (Type itype : interfaces) { - if (!(itype instanceof ParameterizedType)) { - continue; - } - ParameterizedType interfaceType = (ParameterizedType)itype; - return (Class)interfaceType.getActualTypeArguments()[0]; - } - } - return null; - } - - /** - * Returns the set of interfaces implemented by the given class and its - * ancestors or a blank set if none - */ - public static Set getAllInterfaces(Class clazz) { - Set implemented = new HashSet(); - getAllInterfaces(clazz, implemented); - return implemented; - } - - private static void getAllInterfaces(Class clazz, Set implemented) { - Class[] interfaces = clazz.getInterfaces(); - for (Class interfaze : interfaces) { - implemented.add(interfaze); - } - Class superClass = clazz.getSuperclass(); - // Object has no superclass so check for null - if (superClass != null && !superClass.equals(Object.class)) { - getAllInterfaces(superClass, implemented); - } - } - - public static boolean isSetter(Method method) { - return (void.class == method.getReturnType() && method.getParameterTypes().length == 1 && method.getName() - .startsWith("set")); - } - - public static boolean isGetter(Method method) { - return (void.class != method.getReturnType() && method.getParameterTypes().length == 0 && method.getName() - .startsWith("get")); - } - - private final static Map signatures = new HashMap(); - static { - signatures.put(boolean.class, "Z"); - signatures.put(byte.class, "B"); - signatures.put(char.class, "C"); - signatures.put(short.class, "S"); - signatures.put(int.class, "I"); - signatures.put(long.class, "J"); - signatures.put(float.class, "F"); - signatures.put(double.class, "D"); - }; - - public static String getSignature(Class cls) { - if (cls.isPrimitive()) { - return signatures.get(cls); - } - if (cls.isArray()) { - return "[" + getSignature(cls.getComponentType()); - } - return "L" + cls.getName().replace('.', '/') + ";"; - } - - public static Class getArrayType(Class componentType, int dims) throws ClassNotFoundException { - StringBuffer buf = new StringBuffer(); - for (int i = 0; i < dims; i++) { - buf.append('['); - } - buf.append(getSignature(componentType)); - return Class.forName(buf.toString(), false, componentType.getClassLoader()); - } - - public static Set getPrivateMethods(Class clazz) { - Set methods = new HashSet(); - Method[] declaredMethods = clazz.getDeclaredMethods(); - for (final Method declaredMethod : declaredMethods) { - int modifiers = declaredMethod.getModifiers(); - if(Modifier.isPrivate(modifiers)) { - methods.add(declaredMethod); - } - } - - return methods; - } - - public static Set getPrivateFields(Class clazz) { - Set fields = new HashSet(); - Field[] declaredFields = clazz.getDeclaredFields(); - for (final Field declaredField : declaredFields) { - int modifiers = declaredField.getModifiers(); - if(Modifier.isPrivate(modifiers)) { - fields.add(declaredField); - } - } - - return fields; - } -} diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java index 954a3abbc8..c2e1e33432 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java @@ -32,6 +32,8 @@ import org.apache.tuscany.sca.assembly.Reference; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.apache.tuscany.sca.interfacedef.InterfaceContract; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java index a1f8a766ae..911f1f1bb9 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java @@ -18,7 +18,7 @@ */ package org.apache.tuscany.sca.implementation.java.introspect.impl; -import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getBaseType; +import static org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper.getBaseType; import java.lang.annotation.ElementType; import java.lang.reflect.Field; @@ -30,9 +30,11 @@ import java.util.List; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java index e15f9a0d6a..dbb59d558a 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java @@ -24,10 +24,12 @@ import java.lang.reflect.Method; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; /** * Processes an {@link @Resource} annotation, updating the component type with diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java index a3d3889d30..7d7e0df7fc 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java @@ -21,7 +21,8 @@ package org.apache.tuscany.sca.implementation.java.introspect.impl; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl; +import org.apache.tuscany.sca.implementation.java.JavaScopeImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; /** * Processes the {@link JavaScopeImpl} annotation and updates the component type with the corresponding implmentation scope diff --git a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java index 6854acdc2a..3d5faf4f54 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java +++ b/branches/sca-equinox/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java @@ -18,7 +18,7 @@ */ package org.apache.tuscany.sca.implementation.java.introspect.impl; -import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces; +import static org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper.getAllInterfaces; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -33,8 +33,10 @@ import javax.jws.WebService; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.Service; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; +import org.apache.tuscany.sca.implementation.java.introspect.BaseJavaClassVisitor; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract; diff --git a/branches/sca-equinox/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-equinox/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator index df60d57cf9..856d4e55b2 100644 --- a/branches/sca-equinox/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator +++ b/branches/sca-equinox/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator @@ -15,4 +15,4 @@ # specific language governing permissions and limitations # under the License. -org.apache.tuscany.sca.implementation.java.impl.JavaImplementationActivator +org.apache.tuscany.sca.implementation.java.JavaImplementationActivator diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java index fe93424d28..805ea494b2 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java @@ -25,9 +25,9 @@ import junit.framework.TestCase; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java index 5beb31f0f9..2383f1ba60 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java @@ -31,10 +31,10 @@ import junit.framework.TestCase; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.assembly.Property; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor; diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java index fa1527fbe5..a3c87afe63 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java @@ -34,7 +34,7 @@ import org.apache.tuscany.sca.assembly.Multiplicity; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl; +import org.apache.tuscany.sca.implementation.java.JavaParameterImpl; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.osoa.sca.annotations.Property; diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java index 365fb12afe..b3bfee40e8 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java @@ -36,7 +36,7 @@ public class ConstructorResourceTestCase extends AbstractProcessorTest { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); Constructor ctor = Foo.class.getConstructor(String.class); visitConstructor(ctor, type); - org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl resource = type.getResources().get("myResource"); + org.apache.tuscany.sca.implementation.java.JavaResourceImpl resource = type.getResources().get("myResource"); assertFalse(resource.isOptional()); } diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java index 4555736813..a682f8b2f0 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java @@ -55,7 +55,7 @@ public class ConversationProcessorTestCase extends TestCase { public void testImplicitScope() throws Exception { JavaImplementation type = javaImplementationFactory.createJavaImplementation(); processor.visitClass(ImplicitFooScope.class, type); - assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope()); + assertEquals(org.apache.tuscany.sca.implementation.java.JavaScopeImpl.CONVERSATION, type.getJavaScope()); } /* TUSCANY-1999 - apply conversation properties to all scopes @@ -81,7 +81,7 @@ public class ConversationProcessorTestCase extends TestCase { // TODO do we want these semantics JavaImplementation type = javaImplementationFactory.createJavaImplementation(); processor.visitClass(FooJustConversation.class, type); - assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope()); + assertEquals(org.apache.tuscany.sca.implementation.java.JavaScopeImpl.CONVERSATION, type.getJavaScope()); assertEquals(-1, type.getMaxAge()); assertEquals(-1, type.getMaxIdleTime()); } diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java index c7f340bd46..58ff81a06c 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java @@ -25,9 +25,9 @@ import junit.framework.TestCase; import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.osoa.sca.annotations.Property; diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java index e98a8fec1f..7a6fcbaacf 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java @@ -26,9 +26,9 @@ import org.apache.tuscany.sca.assembly.AssemblyFactory; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.osoa.sca.annotations.Property; diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java index ff267cd938..fbc971a3e2 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java @@ -28,10 +28,10 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper; import org.osoa.sca.annotations.Property; diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java index ed0527d3d7..315c99c06c 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java @@ -24,10 +24,10 @@ import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.assembly.Property; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; import org.apache.tuscany.sca.implementation.java.IntrospectionException; +import org.apache.tuscany.sca.implementation.java.JavaConstructorImpl; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java index 8d5e816a08..ad8edd83ea 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java @@ -27,9 +27,10 @@ import junit.framework.TestCase; import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; +import org.apache.tuscany.sca.implementation.java.JavaElementImpl; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl; +import org.apache.tuscany.sca.implementation.java.introspect.JavaIntrospectionHelper; import org.osoa.sca.annotations.Property; /** diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java index 7bb8e15696..207d00e945 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java @@ -27,7 +27,7 @@ import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl; +import org.apache.tuscany.sca.implementation.java.JavaResourceImpl; /** * @version $Rev$ $Date$ diff --git a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java index d7de4e522e..bb2b2f8ec9 100644 --- a/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java +++ b/branches/sca-equinox/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java @@ -26,7 +26,7 @@ import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFacto import org.apache.tuscany.sca.implementation.java.IntrospectionException; import org.apache.tuscany.sca.implementation.java.JavaImplementation; import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; -import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl; +import org.apache.tuscany.sca.implementation.java.JavaScopeImpl; import org.easymock.EasyMock; /** diff --git a/branches/sca-equinox/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java b/branches/sca-equinox/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java index c886c0390c..0ce9596ad4 100644 --- a/branches/sca-equinox/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java +++ b/branches/sca-equinox/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationProcessor.java @@ -37,6 +37,7 @@ import org.apache.tuscany.sca.contribution.resolver.ModelResolver; import org.apache.tuscany.sca.contribution.service.ContributionReadException; import org.apache.tuscany.sca.contribution.service.ContributionResolveException; import org.apache.tuscany.sca.contribution.service.ContributionWriteException; +import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory; import org.apache.tuscany.sca.implementation.spring.xml.SpringXMLComponentTypeLoader; import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory; import org.apache.tuscany.sca.monitor.Monitor; @@ -59,6 +60,7 @@ public class SpringImplementationProcessor implements StAXArtifactProcessor getImplementationClass() { -- cgit v1.2.3