You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/05/01 07:09:48 UTC
svn commit: r533944 [2/4] - in /incubator/tuscany/java/sca/modules:
core-spring/src/main/java/org/apache/tuscany/implementation/java/bean/impl/
core/src/main/java/org/apache/tuscany/core/builder/
databinding-sdo/src/main/java/org/apache/tuscany/databin...
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractPropertyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractPropertyProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractPropertyProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractPropertyProcessor.java Mon Apr 30 22:09:44 2007
@@ -26,9 +26,9 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.Property;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Parameter;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.implementation.java.impl.JavaParameterImpl;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.DuplicatePropertyException;
import org.apache.tuscany.implementation.java.introspect.IllegalPropertyException;
@@ -49,7 +49,7 @@
this.annotationClass = annotationClass;
}
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
A annotation = method.getAnnotation(annotationClass);
if (annotation == null) {
return;
@@ -71,12 +71,12 @@
}
}
- Map<String, JavaElement> properties = type.getPropertyMembers();
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
if (properties.containsKey(name)) {
throw new DuplicatePropertyException(name);
}
- JavaElement element = new JavaElement(method, 0);
+ JavaElementImpl element = new JavaElementImpl(method, 0);
Property property = createProperty(name, element);
// add databinding available as annotations, as extensions
@@ -86,7 +86,7 @@
properties.put(name, element);
}
- public void visitField(Field field, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
A annotation = field.getAnnotation(annotationClass);
if (annotation == null) {
@@ -101,22 +101,22 @@
name = field.getName();
}
- Map<String, JavaElement> properties = type.getPropertyMembers();
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
if (properties.containsKey(name)) {
throw new DuplicatePropertyException(name);
}
- JavaElement element = new JavaElement(field);
+ JavaElementImpl element = new JavaElementImpl(field);
Property property = createProperty(name, element);
initProperty(property, annotation);
type.getProperties().add(property);
properties.put(name, element);
}
- public void visitConstructorParameter(Parameter parameter, JavaImplementationDefinition type)
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
throws IntrospectionException {
- Map<String, JavaElement> properties = type.getPropertyMembers();
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
A annotation = parameter.getAnnotation(annotationClass);
if (annotation != null) {
String name = getName(annotation);
@@ -150,7 +150,7 @@
protected abstract void initProperty(Property property, A annotation) throws IntrospectionException;
@SuppressWarnings("unchecked")
- protected Property createProperty(String name, JavaElement element) throws IntrospectionException {
+ protected Property createProperty(String name, JavaElementImpl element) throws IntrospectionException {
Property property = assemblyFactory.createProperty();
property.setName(name);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java Mon Apr 30 22:09:44 2007
@@ -21,7 +21,7 @@
import java.lang.reflect.Method;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.osoa.sca.annotations.AllowsPassByReference;
@@ -37,12 +37,12 @@
super(factory);
}
- public <T> void visitClass(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
type.setAllowsPassByReference(clazz.isAnnotationPresent(AllowsPassByReference.class));
}
@Override
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
boolean pbr = method.isAnnotationPresent(AllowsPassByReference.class);
if (pbr) {
type.getAllowsPassByReferenceMethods().add(method);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorProcessor.java Mon Apr 30 22:09:44 2007
@@ -21,9 +21,9 @@
import java.lang.reflect.Constructor;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Parameter;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.implementation.java.impl.JavaParameterImpl;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
@@ -40,35 +40,35 @@
super(factory);
}
- public <T> void visitClass(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
Constructor[] ctors = clazz.getConstructors();
boolean found = false;
for (Constructor constructor : ctors) {
- ConstructorDefinition<?> definition = new ConstructorDefinition(constructor);
+ JavaConstructorImpl<?> definition = new JavaConstructorImpl(constructor);
type.getConstructors().put(constructor, definition);
if (constructor.getAnnotation(org.osoa.sca.annotations.Constructor.class) != null) {
if (found) {
throw new DuplicateConstructorException("Multiple constructors marked with @Constructor", constructor);
}
found = true;
- type.setConstructorDefinition(definition);
+ type.setConstructor(definition);
}
}
}
- public <T> void visitConstructor(Constructor<T> constructor, JavaImplementationDefinition type)
+ public <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type)
throws IntrospectionException {
org.osoa.sca.annotations.Constructor annotation = constructor
.getAnnotation(org.osoa.sca.annotations.Constructor.class);
if (annotation == null) {
return;
}
- ConstructorDefinition<?> definition = type.getConstructorDefinition();
+ JavaConstructorImpl<?> definition = type.getConstructor();
if (definition == null) {
- definition = new ConstructorDefinition(constructor);
- type.setConstructorDefinition(definition);
+ definition = new JavaConstructorImpl(constructor);
+ type.setConstructor(definition);
}
- Parameter[] parameters = definition.getParameters();
+ JavaParameterImpl[] parameters = definition.getParameters();
String[] value = annotation.value();
boolean isDefault = value.length == 0 || (value.length == 1 && "".equals(value[0]));
if (!isDefault && value.length != parameters.length) {
@@ -77,6 +77,6 @@
for (int i = 0; i < parameters.length; i++) {
parameters[i].setName(i < value.length ? value[i] : "");
}
- type.setConstructorDefinition(definition);
+ type.setConstructor(definition);
}
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ContextProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ContextProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ContextProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ContextProcessor.java Mon Apr 30 22:09:44 2007
@@ -22,9 +22,9 @@
import java.lang.reflect.Method;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Resource;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.implementation.java.impl.JavaResourceImpl;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.osoa.sca.ComponentContext;
@@ -44,7 +44,7 @@
super(factory);
}
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
if (method.getAnnotation(Context.class) == null) {
return;
}
@@ -54,25 +54,25 @@
Class<?> paramType = method.getParameterTypes()[0];
String name = JavaIntrospectionHelper.toPropertyName(method.getName());
if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType)) {
- JavaElement element = new JavaElement(method, 0);
+ JavaElementImpl element = new JavaElementImpl(method, 0);
element.setName(name);
element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
- Resource resource = new Resource(element);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
type.getResources().put(resource.getName(), resource);
} else {
throw new UnknownContextTypeException(paramType.getName());
}
}
- public void visitField(Field field, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
if (field.getAnnotation(Context.class) == null) {
return;
}
Class<?> paramType = field.getType();
if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType)) {
- JavaElement element = new JavaElement(field);
+ JavaElementImpl element = new JavaElementImpl(field);
element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
- Resource resource = new Resource(element);
+ JavaResourceImpl resource = new JavaResourceImpl(element);
type.getResources().put(resource.getName(), resource);
} else {
throw new UnknownContextTypeException(paramType.getName());
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ConversationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ConversationProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ConversationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ConversationProcessor.java Mon Apr 30 22:09:44 2007
@@ -22,7 +22,7 @@
import java.lang.reflect.Method;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.osoa.sca.annotations.ConversationAttributes;
@@ -43,7 +43,7 @@
super(factory);
}
- public <T> void visitClass(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
ConversationAttributes conversation = clazz.getAnnotation(ConversationAttributes.class);
if (conversation == null) {
@@ -52,7 +52,7 @@
Scope scope = clazz.getAnnotation(Scope.class);
if (scope == null) {
// implicitly assume conversation
- type.setScope(org.apache.tuscany.implementation.java.impl.Scope.CONVERSATION);
+ type.setJavaScope(org.apache.tuscany.implementation.java.impl.JavaScopeImpl.CONVERSATION);
} else if (scope != null && !"CONVERSATION".equals(scope.value().toUpperCase())) {
throw new InvalidConversationalImplementation(
"Service is marked with @ConversationAttributes but the scope is not @Scope(\"CONVERSATION\")"
@@ -86,7 +86,7 @@
}
public void visitMethod(Method method,
- JavaImplementationDefinition type) throws IntrospectionException {
+ JavaImplementation type) throws IntrospectionException {
ConversationID conversationID = method.getAnnotation(ConversationID.class);
if (conversationID == null) {
return;
@@ -95,7 +95,7 @@
}
public void visitField(Field field,
- JavaImplementationDefinition type) throws IntrospectionException {
+ JavaImplementation type) throws IntrospectionException {
ConversationID conversationID = field.getAnnotation(ConversationID.class);
if (conversationID == null) {
return;
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/DestroyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/DestroyProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/DestroyProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/DestroyProcessor.java Mon Apr 30 22:09:44 2007
@@ -22,7 +22,7 @@
import java.lang.reflect.Modifier;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.osoa.sca.annotations.Destroy;
@@ -39,7 +39,7 @@
super(factory);
}
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
Destroy annotation = method.getAnnotation(Destroy.class);
if (annotation == null) {
return;
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/EagerInitProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/EagerInitProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/EagerInitProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/EagerInitProcessor.java Mon Apr 30 22:09:44 2007
@@ -19,7 +19,7 @@
package org.apache.tuscany.implementation.java.introspect.impl;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.osoa.sca.annotations.EagerInit;
@@ -36,7 +36,7 @@
}
public <T> void visitClass(Class<T> clazz,
- JavaImplementationDefinition type) throws IntrospectionException {
+ JavaImplementation type) throws IntrospectionException {
super.visitClass(clazz, type);
EagerInit annotation = clazz.getAnnotation(EagerInit.class);
if (annotation == null) {
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicPojoProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicPojoProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicPojoProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicPojoProcessor.java Mon Apr 30 22:09:44 2007
@@ -43,10 +43,10 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.Contract;
import org.apache.tuscany.assembly.Multiplicity;
-import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Parameter;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.implementation.java.impl.JavaParameterImpl;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.apache.tuscany.interfacedef.Interface;
@@ -84,7 +84,7 @@
this.javaFactory = javaFactory;
}
- public <T> void visitEnd(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
List<org.apache.tuscany.assembly.Service> services = type.getServices();
if (services.isEmpty()) {
// heuristically determine the service
@@ -114,7 +114,7 @@
evaluateConstructor(type, clazz);
}
- private void addService(JavaImplementationDefinition type, Class<?> clazz) throws IntrospectionException {
+ private void addService(JavaImplementation type, Class<?> clazz) throws IntrospectionException {
try {
org.apache.tuscany.assembly.Service service = createService(clazz);
type.getServices().add(service);
@@ -137,7 +137,7 @@
private <T> void calcPropRefs(Set<Method> methods,
List<org.apache.tuscany.assembly.Service> services,
- JavaImplementationDefinition type,
+ JavaImplementation type,
Class<T> clazz) throws IntrospectionException {
// heuristically determine the properties references
// make a first pass through all public methods with one param
@@ -156,10 +156,10 @@
Type genericType = method.getGenericParameterTypes()[0];
if (isReferenceType(param, genericType)) {
type.getReferences().add(createReference(name, param));
- type.getReferenceMembers().put(name, new JavaElement(method, 0));
+ type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
} else {
type.getProperties().add(createProperty(name, param));
- type.getPropertyMembers().put(name, new JavaElement(method, 0));
+ type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
}
}
}
@@ -176,10 +176,10 @@
if (!type.getPropertyMembers().containsKey(name) && !type.getReferenceMembers().containsKey(name)) {
if (isReferenceType(param, method.getGenericParameterTypes()[0])) {
type.getReferences().add(createReference(name, param));
- type.getReferenceMembers().put(name, new JavaElement(method, 0));
+ type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
} else {
type.getProperties().add(createProperty(name, param));
- type.getPropertyMembers().put(name, new JavaElement(method, 0));
+ type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
}
}
}
@@ -196,10 +196,10 @@
Class<?> paramType = field.getType();
if (isReferenceType(paramType, field.getGenericType())) {
type.getReferences().add(createReference(name, paramType));
- type.getReferenceMembers().put(name, new JavaElement(field));
+ type.getReferenceMembers().put(name, new JavaElementImpl(field));
} else {
type.getProperties().add(createProperty(name, paramType));
- type.getPropertyMembers().put(name, new JavaElement(field));
+ type.getPropertyMembers().put(name, new JavaElementImpl(field));
}
}
}
@@ -215,9 +215,9 @@
* cannot be unambiguously mapped to references and properties
*/
@SuppressWarnings("unchecked")
- private <T> void evaluateConstructor(JavaImplementationDefinition type, Class<T> clazz) throws IntrospectionException {
+ private <T> void evaluateConstructor(JavaImplementation type, Class<T> clazz) throws IntrospectionException {
// determine constructor if one is not annotated
- ConstructorDefinition<?> definition = type.getConstructorDefinition();
+ JavaConstructorImpl<?> definition = type.getConstructor();
Constructor constructor;
boolean explict = false;
if (definition != null && definition.getConstructor()
@@ -255,18 +255,18 @@
}
constructor = selected;
definition = type.getConstructors().get(selected);
- type.setConstructorDefinition(definition);
+ type.setConstructor(definition);
// return;
}
definition = type.getConstructors().get(constructor);
- type.setConstructorDefinition(definition);
+ type.setConstructor(definition);
}
- Parameter[] parameters = definition.getParameters();
+ JavaParameterImpl[] parameters = definition.getParameters();
if (parameters.length == 0) {
return;
}
- Map<String, JavaElement> props = type.getPropertyMembers();
- Map<String, JavaElement> refs = type.getReferenceMembers();
+ Map<String, JavaElementImpl> props = type.getPropertyMembers();
+ Map<String, JavaElementImpl> refs = type.getReferenceMembers();
Annotation[][] annotations = constructor.getParameterAnnotations();
if (!explict) {
// the constructor wasn't defined by an annotation, so check to see
@@ -299,21 +299,21 @@
}
}
- private void calcParamNames(Parameter[] parameters, Map<String, JavaElement> props, Map<String, JavaElement> refs)
+ private void calcParamNames(JavaParameterImpl[] parameters, Map<String, JavaElementImpl> props, Map<String, JavaElementImpl> refs)
throws AmbiguousConstructorException {
// the constructor param types must unambiguously match defined
// reference or property types
- for (Parameter param : parameters) {
+ for (JavaParameterImpl param : parameters) {
if (!findReferenceOrProperty(param, props, refs)) {
throw new AmbiguousConstructorException(param.getName());
}
}
}
- private void heuristicParamNames(JavaImplementationDefinition type, Parameter[] parameters)
+ private void heuristicParamNames(JavaImplementation type, JavaParameterImpl[] parameters)
throws IntrospectionException {
// heuristically determine refs and props from the parameter types
- for (Parameter p : parameters) {
+ for (JavaParameterImpl p : parameters) {
String name = p.getType().getSimpleName().toLowerCase();
if (isReferenceType(p.getType(), p.getGenericType())) {
type.getReferences().add(createReference(name, p.getType()));
@@ -337,15 +337,15 @@
* Returns true if the union of the given collections of properties and
* references have unique Java types
*/
- private boolean calcPropRefUniqueness(Collection<JavaElement> props, Collection<JavaElement> refs) {
+ private boolean calcPropRefUniqueness(Collection<JavaElementImpl> props, Collection<JavaElementImpl> refs) {
Class[] classes = new Class[props.size() + refs.size()];
int i = 0;
- for (JavaElement property : props) {
+ for (JavaElementImpl property : props) {
classes[i] = property.getType();
i++;
}
- for (JavaElement reference : refs) {
+ for (JavaElementImpl reference : refs) {
classes[i] = reference.getType();
i++;
}
@@ -360,25 +360,25 @@
* @throws AmbiguousConstructorException if the constructor parameter cannot
* be resolved to a property or reference
*/
- private boolean findReferenceOrProperty(Parameter parameter,
- Map<String, JavaElement> props,
- Map<String, JavaElement> refs) throws AmbiguousConstructorException {
+ private boolean findReferenceOrProperty(JavaParameterImpl parameter,
+ Map<String, JavaElementImpl> props,
+ Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
boolean found = false;
if (!"".equals(parameter.getName())) {
// Match by name
- JavaElement prop = props.get(parameter.getName());
+ JavaElementImpl prop = props.get(parameter.getName());
if (prop != null && prop.getType() == parameter.getType()) {
parameter.setClassifer(Property.class);
return true;
}
- JavaElement ref = refs.get(parameter.getName());
+ JavaElementImpl ref = refs.get(parameter.getName());
if (ref != null && ref.getType() == parameter.getType()) {
parameter.setClassifer(Reference.class);
return true;
}
}
- for (JavaElement property : props.values()) {
+ for (JavaElementImpl property : props.values()) {
if (property.getType() == parameter.getType()) {
if (found) {
throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
@@ -391,7 +391,7 @@
// than one prop or ref of the same type
}
}
- for (JavaElement reference : refs.values()) {
+ for (JavaElementImpl reference : refs.values()) {
if (reference.getType() == parameter.getType()) {
if (found) {
throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
@@ -498,12 +498,12 @@
* @param type the component type
* @param methods all methods in the class to examine
*/
- private void calculateServiceInterface(Class<?> clazz, JavaImplementationDefinition type, Set<Method> methods)
+ private void calculateServiceInterface(Class<?> clazz, JavaImplementation type, Set<Method> methods)
throws IntrospectionException {
List<Method> nonPropRefMethods = new ArrayList<Method>();
// Map<String, Service> services = type.getServices();
- Map<String, JavaElement> references = type.getReferenceMembers();
- Map<String, JavaElement> properties = type.getPropertyMembers();
+ Map<String, JavaElementImpl> references = type.getReferenceMembers();
+ Map<String, JavaElementImpl> properties = type.getPropertyMembers();
// calculate methods that are not properties or references
for (Method method : methods) {
String name = toPropertyName(method.getName());
@@ -552,7 +552,7 @@
return true;
}
- private boolean isAnnotated(Parameter parameter) {
+ private boolean isAnnotated(JavaParameterImpl parameter) {
for (Annotation annotation : parameter.getAnnotations()) {
Class<? extends Annotation> annotType = annotation.annotationType();
if (annotType.equals(Property.class) || annotType.equals(Reference.class)
@@ -563,9 +563,9 @@
return false;
}
- public boolean areUnique(Parameter[] parameters) {
+ public boolean areUnique(JavaParameterImpl[] parameters) {
Set<Class> set = new HashSet<Class>(parameters.length);
- for (Parameter p : parameters) {
+ for (JavaParameterImpl p : parameters) {
if (!set.add(p.getType())) {
return false;
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/InitProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/InitProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/InitProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/InitProcessor.java Mon Apr 30 22:09:44 2007
@@ -22,7 +22,7 @@
import java.lang.reflect.Modifier;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.osoa.sca.annotations.Init;
@@ -39,7 +39,7 @@
super(factory);
}
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
Init annotation = method.getAnnotation(Init.class);
if (annotation == null) {
return;
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/PolicyProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/PolicyProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/PolicyProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/PolicyProcessor.java Mon Apr 30 22:09:44 2007
@@ -26,7 +26,7 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.Callback;
import org.apache.tuscany.assembly.Service;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.apache.tuscany.interfacedef.InterfaceContract;
@@ -108,7 +108,7 @@
}
}
- public <T> void visitClass(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
// Read intents on the Java implementation class
readIntents(clazz, type.getRequiredIntents());
@@ -157,7 +157,7 @@
}
}
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
// Read the intents specified on the given implementation method
readIntents(method, type.getRequiredIntents());
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ReferenceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ReferenceProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ReferenceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ReferenceProcessor.java Mon Apr 30 22:09:44 2007
@@ -27,9 +27,9 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.Multiplicity;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Parameter;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.implementation.java.impl.JavaParameterImpl;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.apache.tuscany.interfacedef.InvalidInterfaceException;
@@ -56,7 +56,7 @@
this.interfaceIntrospector = interfaceIntrospector;
}
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
Reference annotation = method.getAnnotation(Reference.class);
if (annotation == null) {
return; // Not a reference annotation.
@@ -72,13 +72,13 @@
throw new DuplicateReferenceException(name);
}
- JavaElement element = new JavaElement(method, 0);
+ JavaElementImpl element = new JavaElementImpl(method, 0);
org.apache.tuscany.assembly.Reference reference = createReference(element, name);
type.getReferences().add(reference);
type.getReferenceMembers().put(name, element);
}
- public void visitField(Field field, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
Reference annotation = field.getAnnotation(Reference.class);
if (annotation == null) {
return;
@@ -90,13 +90,13 @@
if (type.getReferenceMembers().get(name) != null) {
throw new DuplicateReferenceException(name);
}
- JavaElement element = new JavaElement(field);
+ JavaElementImpl element = new JavaElementImpl(field);
org.apache.tuscany.assembly.Reference reference = createReference(element, name);
type.getReferences().add(reference);
type.getReferenceMembers().put(name, element);
}
- public void visitConstructorParameter(Parameter parameter, JavaImplementationDefinition type)
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
throws IntrospectionException {
Reference refAnnotation = parameter.getAnnotation(Reference.class);
if (refAnnotation == null) {
@@ -128,7 +128,7 @@
}
}
- private org.apache.tuscany.assembly.Reference createReference(JavaElement element, String name) throws IntrospectionException {
+ private org.apache.tuscany.assembly.Reference createReference(JavaElementImpl element, String name) throws IntrospectionException {
org.apache.tuscany.assembly.Reference reference = assemblyFactory.createReference();
JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
reference.setInterfaceContract(interfaceContract);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ResourceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ResourceProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ResourceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ResourceProcessor.java Mon Apr 30 22:09:44 2007
@@ -23,16 +23,16 @@
import java.lang.reflect.Method;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Parameter;
-import org.apache.tuscany.implementation.java.impl.Resource;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.implementation.java.impl.JavaResourceImpl;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
/**
* Processes an {@link @Resource} annotation, updating the component type with
- * corresponding {@link org.apache.tuscany.spi.implementation.java.Resource}
+ * corresponding {@link org.apache.tuscany.spi.implementation.java.JavaResourceImpl}
*
* @version $Rev$ $Date$
*/
@@ -42,7 +42,7 @@
super(factory);
}
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
org.apache.tuscany.api.annotation.Resource annotation = method
.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
if (annotation == null) {
@@ -60,7 +60,7 @@
}
String mappedName = annotation.mappedName();
- Resource resource = createResource(name, new JavaElement(method, 0));
+ JavaResourceImpl resource = createResource(name, new JavaElementImpl(method, 0));
resource.setOptional(annotation.optional());
if (mappedName.length() > 0) {
resource.setMappedName(mappedName);
@@ -68,7 +68,7 @@
type.getResources().put(resource.getName(), resource);
}
- public void visitField(Field field, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
org.apache.tuscany.api.annotation.Resource annotation = field
.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
@@ -85,7 +85,7 @@
String mappedName = annotation.mappedName();
- Resource resource = createResource(name, new JavaElement(field));
+ JavaResourceImpl resource = createResource(name, new JavaElementImpl(field));
resource.setOptional(annotation.optional());
if (mappedName.length() > 0) {
resource.setMappedName(mappedName);
@@ -94,13 +94,13 @@
}
@SuppressWarnings("unchecked")
- public Resource createResource(String name, JavaElement element) {
+ public JavaResourceImpl createResource(String name, JavaElementImpl element) {
element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
element.setName(name);
- return new Resource(element);
+ return new JavaResourceImpl(element);
}
- public void visitConstructorParameter(Parameter parameter, JavaImplementationDefinition type)
+ public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
throws IntrospectionException {
org.apache.tuscany.api.annotation.Resource resourceAnnotation = parameter
.getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
@@ -123,7 +123,7 @@
String mappedName = resourceAnnotation.mappedName();
- Resource resource = createResource(name, parameter);
+ JavaResourceImpl resource = createResource(name, parameter);
resource.setOptional(resourceAnnotation.optional());
if (mappedName.length() > 0) {
resource.setMappedName(mappedName);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ScopeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ScopeProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ScopeProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ScopeProcessor.java Mon Apr 30 22:09:44 2007
@@ -19,13 +19,13 @@
package org.apache.tuscany.implementation.java.introspect.impl;
import org.apache.tuscany.assembly.AssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Scope;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaScopeImpl;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
/**
- * Processes the {@link Scope} annotation and updates the component type with the corresponding implmentation scope
+ * Processes the {@link JavaScopeImpl} annotation and updates the component type with the corresponding implmentation scope
*
* @version $Rev$ $Date$
*/
@@ -36,28 +36,26 @@
}
public <T> void visitClass(Class<T> clazz,
- JavaImplementationDefinition type)
+ JavaImplementation type)
throws IntrospectionException {
org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class);
if (annotation == null) {
- type.setScope(Scope.STATELESS);
+ type.setJavaScope(JavaScopeImpl.STATELESS);
return;
}
String name = annotation.value();
- Scope scope;
+ JavaScopeImpl scope;
if ("COMPOSITE".equals(name)) {
- scope = Scope.COMPOSITE;
+ scope = JavaScopeImpl.COMPOSITE;
} else if ("SESSION".equals(name)) {
- scope = Scope.SESSION;
+ scope = JavaScopeImpl.SESSION;
} else if ("CONVERSATION".equals(name)) {
- scope = Scope.CONVERSATION;
+ scope = JavaScopeImpl.CONVERSATION;
} else if ("REQUEST".equals(name)) {
- scope = Scope.REQUEST;
- } else if ("SYSTEM".equals(name)) {
- scope = Scope.SYSTEM;
+ scope = JavaScopeImpl.REQUEST;
} else {
- scope = new Scope(name);
+ scope = new JavaScopeImpl(name);
}
- type.setScope(scope);
+ type.setJavaScope(scope);
}
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceProcessor.java Mon Apr 30 22:09:44 2007
@@ -27,8 +27,8 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.Service;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
import org.apache.tuscany.implementation.java.introspect.BaseJavaClassIntrospectorExtension;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.apache.tuscany.interfacedef.InvalidInterfaceException;
@@ -56,7 +56,7 @@
this.interfaceIntrospector = interfaceIntrospector;
}
- public <T> void visitClass(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
org.osoa.sca.annotations.Service annotation = clazz.getAnnotation(org.osoa.sca.annotations.Service.class);
if (annotation == null) {
// scan intefaces for remotable
@@ -98,7 +98,7 @@
}
}
- public void visitMethod(Method method, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
Callback annotation = method.getAnnotation(Callback.class);
if (annotation == null) {
@@ -119,10 +119,10 @@
if (callbackService == null) {
throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface");
}
- type.getCallbackMembers().put(callbackClass.getName(), new JavaElement(method, 0));
+ type.getCallbackMembers().put(callbackClass.getName(), new JavaElementImpl(method, 0));
}
- public void visitField(Field field, JavaImplementationDefinition type) throws IntrospectionException {
+ public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
Callback annotation = field.getAnnotation(Callback.class);
if (annotation == null) {
@@ -140,7 +140,7 @@
if (callbackService == null) {
throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface");
}
- type.getCallbackMembers().put(callbackClass.getName(), new JavaElement(field));
+ type.getCallbackMembers().put(callbackClass.getName(), new JavaElementImpl(field));
}
public Service createService(Class<?> interfaze) throws InvalidInterfaceException {
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/implementation/java/xml/JavaImplementationProcessor.java Mon Apr 30 22:09:44 2007
@@ -38,7 +38,6 @@
import org.apache.tuscany.contribution.service.ContributionWriteException;
import org.apache.tuscany.implementation.java.JavaImplementation;
import org.apache.tuscany.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.apache.tuscany.implementation.java.introspect.JavaClassIntrospector;
import org.apache.tuscany.policy.PolicyFactory;
@@ -109,9 +108,9 @@
javaImplementation.setUnresolved(false);
//FIXME JavaImplementationDefinition should not be mandatory
- if (javaImplementation instanceof JavaImplementationDefinition) {
+ if (javaImplementation instanceof JavaImplementation) {
try {
- introspector.introspect(javaImplementation.getJavaClass(), (JavaImplementationDefinition)javaImplementation);
+ introspector.introspect(javaImplementation.getJavaClass(), javaImplementation);
} catch (IntrospectionException e) {
throw new ContributionResolveException(e);
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/DefaultJavaClassIntrospectorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/DefaultJavaClassIntrospectorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/DefaultJavaClassIntrospectorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/DefaultJavaClassIntrospectorTestCase.java Mon Apr 30 22:09:44 2007
@@ -24,9 +24,12 @@
import junit.framework.TestCase;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.introspect.DefaultJavaClassIntrospector;
-import org.apache.tuscany.implementation.java.introspect.JavaClassIntrospectorExtension;
+import org.apache.tuscany.assembly.AssemblyFactory;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaImplementationImpl;
import org.easymock.EasyMock;
/**
@@ -51,12 +54,12 @@
public void testWalk() throws Exception {
DefaultJavaClassIntrospector introspector = new DefaultJavaClassIntrospector();
JavaClassIntrospectorExtension extension = EasyMock.createMock(JavaClassIntrospectorExtension.class);
- extension.visitClass(EasyMock.eq(Bar.class), EasyMock.isA(JavaImplementationDefinition.class));
- extension.visitConstructor(EasyMock.isA(Constructor.class), EasyMock.isA(JavaImplementationDefinition.class));
- extension.visitMethod(EasyMock.isA(Method.class), EasyMock.isA(JavaImplementationDefinition.class));
- extension.visitField(EasyMock.isA(Field.class), EasyMock.isA(JavaImplementationDefinition.class));
- extension.visitSuperClass(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementationDefinition.class));
- extension.visitEnd(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementationDefinition.class));
+ extension.visitClass(EasyMock.eq(Bar.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitConstructor(EasyMock.isA(Constructor.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitMethod(EasyMock.isA(Method.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitField(EasyMock.isA(Field.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitSuperClass(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementation.class));
+ extension.visitEnd(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementation.class));
// mock.expects(once()).method("visitClass");
// mock.expects(once()).method("visitMethod");
@@ -66,7 +69,9 @@
// mock.expects(once()).method("visitEnd");
EasyMock.replay(extension);
introspector.addExtension(extension);
- introspector.introspect(Bar.class, new JavaImplementationDefinition());
+ AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(assemblyFactory);
+ introspector.introspect(Bar.class, javaImplementationFactory.createJavaImplementation());
EasyMock.verify(extension);
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractProcessorTest.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractProcessorTest.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractProcessorTest.java Mon Apr 30 22:09:44 2007
@@ -24,9 +24,9 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Parameter;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.implementation.java.impl.JavaParameterImpl;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.apache.tuscany.interfacedef.java.JavaFactory;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
@@ -59,14 +59,14 @@
}
protected <T> void visitConstructor(Constructor<T> constructor,
- JavaImplementationDefinition type) throws IntrospectionException {
+ JavaImplementation type) throws IntrospectionException {
constructorProcessor.visitConstructor(constructor, type);
- ConstructorDefinition<?> definition = type.getConstructorDefinition();
+ JavaConstructorImpl<?> definition = type.getConstructor();
if (definition == null) {
- definition = new ConstructorDefinition<T>(constructor);
+ definition = new JavaConstructorImpl<T>(constructor);
type.getConstructors().put(constructor, definition);
}
- Parameter[] parameters = definition.getParameters();
+ JavaParameterImpl[] parameters = definition.getParameters();
for (int i = 0; i < parameters.length; i++) {
referenceProcessor.visitConstructorParameter(parameters[i], type);
propertyProcessor.visitConstructorParameter(parameters[i], type);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -30,9 +30,11 @@
import org.apache.tuscany.assembly.Property;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Parameter;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.implementation.java.impl.JavaParameterImpl;
import org.apache.tuscany.implementation.java.introspect.DuplicatePropertyException;
import org.apache.tuscany.implementation.java.introspect.IllegalPropertyException;
import org.apache.tuscany.implementation.java.introspect.JavaClassIntrospectorExtension;
@@ -44,10 +46,11 @@
public class AbstractPropertyProcessorTestCase extends TestCase {
private JavaClassIntrospectorExtension extension;
+ private JavaImplementationFactory javaImplementationFactory;
public void testVisitMethod() throws Exception {
Method method = Foo.class.getMethod("setBar", String.class);
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
extension.visitMethod(method, type);
Property prop = getProperty(type, "test");
assertNotNull(prop);
@@ -55,7 +58,7 @@
public void testVisitNoParamsMethod() throws Exception {
Method method = Foo.class.getMethod("setNoParamsBar");
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
extension.visitMethod(method, type);
fail();
@@ -66,7 +69,7 @@
public void testVisitNonVoidMethod() throws Exception {
Method method = Foo.class.getMethod("setBadBar", String.class);
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
extension.visitMethod(method, type);
fail();
@@ -77,7 +80,7 @@
public void testDuplicateMethod() throws Exception {
Method method = Foo.class.getMethod("setBar", String.class);
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
extension.visitMethod(method, type);
try {
extension.visitMethod(method, type);
@@ -89,7 +92,7 @@
public void testVisitField() throws Exception {
Field field = Foo.class.getDeclaredField("d");
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
extension.visitField(field, type);
Property prop = getProperty(type, "test");
assertNotNull(prop);
@@ -97,9 +100,9 @@
public void testVisitConstructor() throws Exception {
Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
- JavaImplementationDefinition type = new JavaImplementationDefinition();
- ConstructorDefinition<Foo> def = new ConstructorDefinition<Foo>(ctor);
- Parameter parameter = def.getParameters()[0];
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+ JavaConstructorImpl<Foo> def = new JavaConstructorImpl<Foo>(ctor);
+ JavaParameterImpl parameter = def.getParameters()[0];
extension.visitConstructorParameter(parameter, type);
assertEquals("test", def.getParameters()[0].getName());
assertNotNull(getProperty(type, "test"));
@@ -109,6 +112,7 @@
protected void setUp() throws Exception {
super.setUp();
extension = new TestProcessor();
+ javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
}
@Retention(RUNTIME)
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -23,8 +23,9 @@
import junit.framework.TestCase;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.osoa.sca.annotations.AllowsPassByReference;
/**
@@ -32,8 +33,9 @@
*/
public class AllowsPassByReferenceProcessorTestCase extends TestCase {
- JavaImplementationDefinition type;
+ JavaImplementation type;
AllowsPassByReferenceProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
public void testClassAnnotation() throws Exception {
processor.visitClass(Foo.class, type);
@@ -49,7 +51,8 @@
protected void setUp() throws Exception {
super.setUp();
- type = new JavaImplementationDefinition();
+ javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
+ type = javaImplementationFactory.createJavaImplementation();
processor = new AllowsPassByReferenceProcessor(new DefaultAssemblyFactory());
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -31,13 +31,10 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.Multiplicity;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Parameter;
-import org.apache.tuscany.implementation.java.introspect.impl.ConstructorProcessor;
-import org.apache.tuscany.implementation.java.introspect.impl.DuplicateConstructorException;
-import org.apache.tuscany.implementation.java.introspect.impl.InvalidConstructorException;
-import org.apache.tuscany.implementation.java.introspect.impl.PropertyProcessor;
-import org.apache.tuscany.implementation.java.introspect.impl.ReferenceProcessor;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaParameterImpl;
import org.apache.tuscany.interfacedef.java.JavaFactory;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
@@ -49,9 +46,11 @@
*/
public class ConstructorProcessorTestCase extends TestCase {
private ConstructorProcessor processor = new ConstructorProcessor(new DefaultAssemblyFactory());
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
public void testDuplicateConstructor() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
processor.visitClass(BadFoo.class, type);
fail();
@@ -61,21 +60,21 @@
}
public void testConstructorAnnotation() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor1 = Foo.class.getConstructor(String.class);
processor.visitConstructor(ctor1, type);
- assertEquals("foo", type.getConstructorDefinition().getParameters()[0].getName());
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
}
public void testNoAnnotation() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<NoAnnotation> ctor1 = NoAnnotation.class.getConstructor();
processor.visitConstructor(ctor1, type);
- assertNull(type.getConstructorDefinition());
+ assertNull(type.getConstructor());
}
public void testBadAnnotation() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadAnnotation> ctor1 = BadAnnotation.class.getConstructor(String.class, Foo.class);
try {
processor.visitConstructor(ctor1, type);
@@ -86,7 +85,7 @@
}
public void testMixedParameters() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Mixed> ctor1 = Mixed.class.getConstructor(String.class, String.class, String.class);
processor.visitConstructor(ctor1, type);
@@ -94,7 +93,7 @@
JavaFactory javaFactory = new DefaultJavaFactory();
ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory, new DefaultJavaInterfaceIntrospector(javaFactory));
PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
- Parameter[] parameters = type.getConstructorDefinition().getParameters();
+ JavaParameterImpl[] parameters = type.getConstructor().getParameters();
for (int i = 0; i < parameters.length; i++) {
referenceProcessor.visitConstructorParameter(parameters[i], type);
propertyProcessor.visitConstructorParameter(parameters[i], type);
@@ -157,7 +156,7 @@
}
public void testMultiplicity() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Multiple> ctor1 = Multiple.class.getConstructor(Collection.class,
String[].class,
List.class,
@@ -168,7 +167,7 @@
JavaFactory javaFactory = new DefaultJavaFactory();
ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory, new DefaultJavaInterfaceIntrospector(javaFactory));
PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
- Parameter[] parameters = type.getConstructorDefinition().getParameters();
+ JavaParameterImpl[] parameters = type.getConstructor().getParameters();
for (int i = 0; i < parameters.length; i++) {
referenceProcessor.visitConstructorParameter(parameters[i], type);
propertyProcessor.visitConstructorParameter(parameters[i], type);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorPropertyTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorPropertyTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorPropertyTestCase.java Mon Apr 30 22:09:44 2007
@@ -23,20 +23,22 @@
import java.lang.reflect.Constructor;
import java.util.List;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.apache.tuscany.implementation.java.introspect.DuplicatePropertyException;
-import org.apache.tuscany.implementation.java.introspect.impl.InvalidConstructorException;
-import org.apache.tuscany.implementation.java.introspect.impl.InvalidPropertyException;
import org.osoa.sca.annotations.Property;
/**
* @version $Rev$ $Date$
*/
public class ConstructorPropertyTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
public void testProperty() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
visitConstructor(ctor, type);
org.apache.tuscany.assembly.Property property = getProperty(type, "myProp");
@@ -45,8 +47,7 @@
}
public void testTwoPropertiesSameType() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
visitConstructor(ctor, type);
assertNotNull(getProperty(type, "myProp1"));
@@ -54,8 +55,7 @@
}
public void testDuplicateProperty() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
try {
visitConstructor(ctor, type);
@@ -66,8 +66,7 @@
}
public void testNoName() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class);
try {
visitConstructor(ctor, type);
@@ -78,16 +77,14 @@
}
public void testNamesOnConstructor() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
visitConstructor(ctor, type);
assertNotNull(getProperty(type, "myProp"));
}
public void testInvalidNumberOfNames() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
try {
visitConstructor(ctor, type);
@@ -98,8 +95,7 @@
}
public void testNoMatchingNames() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
try {
visitConstructor(ctor, type);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorReferenceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorReferenceTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorReferenceTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorReferenceTestCase.java Mon Apr 30 22:09:44 2007
@@ -24,19 +24,21 @@
import java.util.List;
import org.apache.tuscany.assembly.Multiplicity;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.introspect.impl.DuplicateReferenceException;
-import org.apache.tuscany.implementation.java.introspect.impl.InvalidConstructorException;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.osoa.sca.annotations.Reference;
/**
* @version $Rev$ $Date$
*/
public class ConstructorReferenceTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
public void testReference() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
visitConstructor(ctor, type);
org.apache.tuscany.assembly.Reference reference = getReference(type, "myRef");
@@ -45,8 +47,7 @@
}
public void testTwoReferencesSameType() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
visitConstructor(ctor, type);
assertNotNull(getReference(type, "myRef1"));
@@ -54,8 +55,7 @@
}
public void testDuplicateProperty() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
try {
visitConstructor(ctor, type);
@@ -66,24 +66,21 @@
}
public void testNoName() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<NoNameFoo> ctor = NoNameFoo.class.getConstructor(String.class);
visitConstructor(ctor, type);
assertNotNull(getReference(type, "_ref0"));
}
public void testNamesOnConstructor() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
visitConstructor(ctor, type);
assertNotNull(getReference(type, "myRef"));
}
public void testInvalidNumberOfNames() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
try {
visitConstructor(ctor, type);
@@ -94,8 +91,7 @@
}
public void testNoMatchingNames() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
try {
visitConstructor(ctor, type);
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org