You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2008/12/05 00:08:50 UTC

svn commit: r723484 - in /tuscany/java/sca/modules: implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/ impleme...

Author: lresende
Date: Thu Dec  4 15:08:49 2008
New Revision: 723484

URL: http://svn.apache.org/viewvc?rev=723484&view=rev
Log:
Java implementation clean up in preparation for some refactoring
  - removal of unused code
  - review of code visibility
  - renaming of exception to follow best practices naming convention
  - etc

Added:
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementationException.java   (contents, props changed)
      - copied, changed from r723084, tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceTypeException.java   (contents, props changed)
      - copied, changed from r723084, tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java
Removed:
    tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java
Modified:
    tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java
    tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
    tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
    tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
    tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java

Modified: tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java (original)
+++ tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java Thu Dec  4 15:08:49 2008
@@ -25,8 +25,9 @@
  * @version $Rev$ $Date$
  */
 public abstract class InjectionRuntimeException extends RuntimeException {
+	private static final long serialVersionUID = -2264137603099898773L;
 
-    public InjectionRuntimeException() {
+	public InjectionRuntimeException() {
         super();
     }
 

Modified: tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java (original)
+++ tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java Thu Dec  4 15:08:49 2008
@@ -98,8 +98,8 @@
 
         }
     }
-
-    public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
+    
+    public ObjectFactory createValueFactory(Property property, Object propertyValue, Class<?> javaType) {
         isSimpleType = isSimpleType(property);
         Document doc = (Document)propertyValue;
         Element rootElement = doc.getDocumentElement();
@@ -133,61 +133,24 @@
         }
     } 
 
-    private boolean isSimpleType(Property property) {
-        if (property.getXSDType() != null) {
-            return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
-        } else {
-            if (property instanceof Document) {
-                Document doc = (Document)property;
-                Element element = doc.getDocumentElement();
-                if (element.getChildNodes().getLength() == 1 && element.getChildNodes().item(0).getNodeType() == Element.TEXT_NODE) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
 
-    private List<String> getSimplePropertyValues(String concatenatedValue, Class<?> javaType) {
-        List<String> propValues = new ArrayList<String>();
-        StringTokenizer st = null;
-        if (javaType.getName().equals("java.lang.String")) {
-            st = new StringTokenizer(concatenatedValue, "\"");
-        } else {
-            st = new StringTokenizer(concatenatedValue);
-        }
-        String aToken = null;
-        while (st.hasMoreTokens()) {
-            aToken = st.nextToken();
-            if (aToken.trim().length() > 0) {
-                propValues.add(aToken);
-            }
-        }
-        return propValues;
+    public <B> B createPropertyValue(ComponentProperty property, Class<B> type)
+    {
+        ObjectFactory<B> factory = this.createValueFactory(property, property.getValue(), type);
+        return factory.getInstance();
     }
 
-    private List<Node> getComplexPropertyValues(Document document) {
-        Element rootElement = document.getDocumentElement();
-        List<Node> propValues = new ArrayList<Node>();
-        NodeList nodes = rootElement.getChildNodes();
-        for (int count = 0; count < nodes.getLength(); ++count) {
-            if (nodes.item(count).getNodeType() == Document.ELEMENT_NODE) {
-                propValues.add(DOMHelper.promote(nodes.item(count)));
-            }
-        }
-        return propValues;
-    }
 
-    public abstract class ObjectFactoryImplBase implements ObjectFactory {
+    abstract class ObjectFactoryImplBase implements ObjectFactory {
         protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
         protected Property property;
         protected Object propertyValue;
-        protected Class javaType;
+        protected Class<?> javaType;
         protected DataType<XMLType> sourceDataType;
         protected DataType<?> targetDataType;
         boolean isSimpleType;
 
-        public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+        public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class<?> javaType) {
             this.isSimpleType = isSimpleType;
             this.property = property;
             this.propertyValue = propertyValue;
@@ -216,8 +179,8 @@
         }
     }
 
-    public class ObjectFactoryImpl extends ObjectFactoryImplBase {
-        public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
+    class ObjectFactoryImpl extends ObjectFactoryImplBase {
+        public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class<?> javaType) {
             super(property, propertyValue, isSimpleType, javaType);
         }
 
@@ -239,8 +202,8 @@
         }
     }
 
-    public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
-        public ListObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
+    class ListObjectFactoryImpl extends ObjectFactoryImplBase {
+        public ListObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class<?> javaType) {
             super(property, propertyValues, isSimpleType, javaType);
         }
 
@@ -272,8 +235,8 @@
         }
     }
     
-    public class ArrayObjectFactoryImpl extends ObjectFactoryImplBase {
-        public ArrayObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
+    class ArrayObjectFactoryImpl extends ObjectFactoryImplBase {
+        public ArrayObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class<?> javaType) {
             super(property, propertyValues, isSimpleType, javaType);
         }
 
@@ -307,18 +270,71 @@
         }
     }
 
+    
+
+    /**
+     * Utility methods
+     */
+    
     /**
-     * This method will create an instance of the value for the specified Property.
-     * 
-     * @param property The Property from which to retrieve the property value
-     * @param type The type of the property value being retrieved from the Property
-     * @param <B> Type type of the property value being looked up
      * 
-     * @return the value for the Property
+     * @param property
+     * @return
      */
-    public <B> B createPropertyValue(ComponentProperty property, Class<B> type)
-    {
-        ObjectFactory<B> factory = this.createValueFactory(property, property.getValue(), type);
-        return factory.getInstance();
+    private static boolean isSimpleType(Property property) {
+        if (property.getXSDType() != null) {
+            return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
+        } else {
+            if (property instanceof Document) {
+                Document doc = (Document)property;
+                Element element = doc.getDocumentElement();
+                if (element.getChildNodes().getLength() == 1 && element.getChildNodes().item(0).getNodeType() == Element.TEXT_NODE) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+
+    /**
+     * Retrieve list of simple property values
+     * @param concatenatedValue
+     * @param javaType
+     * @return
+     */
+    private static List<String> getSimplePropertyValues(String concatenatedValue, Class<?> javaType) {
+        List<String> propValues = new ArrayList<String>();
+        StringTokenizer st = null;
+        if (javaType.getName().equals("java.lang.String")) {
+            st = new StringTokenizer(concatenatedValue, "\"");
+        } else {
+            st = new StringTokenizer(concatenatedValue);
+        }
+        String aToken = null;
+        while (st.hasMoreTokens()) {
+            aToken = st.nextToken();
+            if (aToken.trim().length() > 0) {
+                propValues.add(aToken);
+            }
+        }
+        return propValues;
+    }
+
+    /**
+     * Retrieve the list of complex property values
+     * @param document
+     * @return
+     */
+    private static List<Node> getComplexPropertyValues(Document document) {
+        Element rootElement = document.getDocumentElement();
+        List<Node> propValues = new ArrayList<Node>();
+        NodeList nodes = rootElement.getChildNodes();
+        for (int count = 0; count < nodes.getLength(); ++count) {
+            if (nodes.item(count).getNodeType() == Document.ELEMENT_NODE) {
+                propValues.add(DOMHelper.promote(nodes.item(count)));
+            }
+        }
+        return propValues;
     }
 }

Modified: tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java (original)
+++ tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java Thu Dec  4 15:08:49 2008
@@ -30,7 +30,7 @@
  *
  * @version $Rev$ $Date$
  */
-public class ListMultiplicityObjectFactory implements ObjectFactory<List> {
+public class ListMultiplicityObjectFactory implements ObjectFactory<List<?>> {
 
     private ObjectFactory[] factories;
 
@@ -39,7 +39,7 @@
         this.factories = factories.toArray(new ObjectFactory[factories.size()]);
     }
 
-    public List getInstance() throws ObjectCreationException {
+    public List<?> getInstance() throws ObjectCreationException {
         List<Object> list = new ArrayList<Object>();
         for (ObjectFactory factory : factories) {
             list.add(factory.getInstance());

Modified: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java Thu Dec  4 15:08:49 2008
@@ -50,7 +50,7 @@
         this.annotationClass = annotationClass;
     }
     
-    private boolean removeProperty(JavaElementImpl prop, JavaImplementation type) {
+    private static boolean removeProperty(JavaElementImpl prop, JavaImplementation type) {
         if(prop==null) {
             return false;
         }

Modified: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java Thu Dec  4 15:08:49 2008
@@ -65,7 +65,7 @@
                     type.setMaxAge(maxAge);
                 }
             } catch (NumberFormatException e) {
-                throw new InvalidConversationalImplementation("Invalid maximum age", e);
+                throw new InvalidConversationalImplementationException("Invalid maximum age", e);
             }
             try {
                 if (maxIdleTimeVal.length() > 0) {
@@ -73,7 +73,7 @@
                     type.setMaxIdleTime(maxIdleTime);
                 }
             } catch (NumberFormatException e) {
-                throw new InvalidConversationalImplementation("Invalid maximum idle time", e);
+                throw new InvalidConversationalImplementationException("Invalid maximum idle time", e);
             }
         }
 
@@ -99,7 +99,7 @@
         type.addConversationIDMember(field);
     }
 
-    protected long convertTimeMillis(String expr) throws NumberFormatException {
+    static long convertTimeMillis(String expr) throws NumberFormatException {
         expr = expr.trim().toUpperCase();
         int i = expr.lastIndexOf(SECONDS);
         if (i >= 0) {

Modified: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java Thu Dec  4 15:08:49 2008
@@ -134,17 +134,6 @@
         }
     }
 
-    private boolean isPublicSetter(Method method) {
-        return method.getParameterTypes().length == 1 && Modifier.isPublic(method.getModifiers())
-            && method.getName().startsWith("set")
-            && method.getReturnType() == void.class;
-    }
-
-    private boolean isProtectedSetter(Method method) {
-        return method.getParameterTypes().length == 1 && Modifier.isProtected(method.getModifiers())
-            && method.getName().startsWith("set")
-            && method.getReturnType() == void.class;
-    }
 
     private <T> void calcPropRefs(Set<Method> methods,
                                   List<org.apache.tuscany.sca.assembly.Service> services,
@@ -360,10 +349,7 @@
         }
     }
 
-    private static boolean areUnique(Class<?>[] collection) {
-        Set<Class<?>> set = new HashSet<Class<?>>(Arrays.asList(collection));
-        return set.size() == collection.length;
-    }
+
 
     /**
      * Returns true if the union of the given collections of properties and
@@ -440,6 +426,119 @@
     }
 
     /**
+     * Creates a mapped property.
+     * 
+     * @param name the property name
+     * @param paramType the property type
+     */
+    private org.apache.tuscany.sca.assembly.Property createProperty(String name, Class<?> paramType) {
+        org.apache.tuscany.sca.assembly.Property property = assemblyFactory.createProperty();
+        property.setName(name);
+        property.setXSDType(JavaXMLMapper.getXMLType(paramType));
+        return property;
+    }
+
+     private org.apache.tuscany.sca.assembly.Reference createReference(String name, Class<?> paramType)
+        throws IntrospectionException {
+        org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
+        reference.setName(name);
+        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+        reference.setInterfaceContract(interfaceContract);
+        try {
+            JavaInterface callInterface = javaFactory.createJavaInterface(paramType);
+            reference.getInterfaceContract().setInterface(callInterface);
+            if (callInterface.getCallbackClass() != null) {
+                JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+                reference.getInterfaceContract().setCallbackInterface(callbackInterface);
+            }
+            reference.setMultiplicity(Multiplicity.ZERO_ONE);
+        } catch (InvalidInterfaceException e1) {
+            throw new IntrospectionException(e1);
+        }
+
+        // FIXME:  This part seems to have already been taken care above!!
+        try {
+            processCallback(paramType, reference);
+        } catch (InvalidServiceTypeException e) {
+            throw new IntrospectionException(e);
+        }
+        return reference;
+    }
+
+    private org.apache.tuscany.sca.assembly.Service createService(Class<?> interfaze) throws InvalidInterfaceException {
+        org.apache.tuscany.sca.assembly.Service service = assemblyFactory.createService();
+        service.setName(interfaze.getSimpleName());
+
+        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+        service.setInterfaceContract(interfaceContract);
+
+        JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
+        service.getInterfaceContract().setInterface(callInterface);
+        if (callInterface.getCallbackClass() != null) {
+            JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+            service.getInterfaceContract().setCallbackInterface(callbackInterface);
+        }
+
+        Interface javaInterface = service.getInterfaceContract().getInterface();
+        javaInterface.setRemotable(interfaze.getAnnotation(Remotable.class) != null);
+        service.getInterfaceContract().setInterface(javaInterface);
+        return service;
+    }
+
+    private void processCallback(Class<?> interfaze, Contract contract) throws InvalidServiceTypeException {
+        Callback callback = interfaze.getAnnotation(Callback.class);
+        if (callback != null && !Void.class.equals(callback.value())) {
+            Class<?> callbackClass = callback.value();
+            JavaInterface javaInterface;
+            try {
+                javaInterface = javaFactory.createJavaInterface(callbackClass);
+                contract.getInterfaceContract().setCallbackInterface(javaInterface);
+            } catch (InvalidInterfaceException e) {
+                throw new InvalidServiceTypeException("Invalid callback interface "+callbackClass, interfaze);
+            }
+        } else if (callback != null && Void.class.equals(callback.value())) {
+            throw new InvalidServiceTypeException("No callback interface specified on annotation", interfaze);
+        }
+    }
+
+
+    /**
+     * Utility methods
+     */
+    
+    
+    /**
+     * Verify if the method is a public setter
+     * @param method
+     * @return
+     */
+    private static boolean isPublicSetter(Method method) {
+        return method.getParameterTypes().length == 1 && Modifier.isPublic(method.getModifiers())
+            && method.getName().startsWith("set")
+            && method.getReturnType() == void.class;
+    }
+
+    /**
+     * Verify if the method is a protected setter
+     * @param method
+     * @return
+     */
+    private static boolean isProtectedSetter(Method method) {
+        return method.getParameterTypes().length == 1 && Modifier.isProtected(method.getModifiers())
+            && method.getName().startsWith("set")
+            && method.getReturnType() == void.class;
+    }
+
+    /**
+     * @param collection
+     * @return
+     */
+    private static boolean areUnique(Class<?>[] collection) {
+        Set<Class<?>> set = new HashSet<Class<?>>(Arrays.asList(collection));
+        return set.size() == collection.length;
+    }
+
+    /**
      * Returns true if a given type is reference according to the SCA
      * specification rules for determining reference types The following rules
      * are used to determine whether an unannotated field or setter method is a
@@ -462,7 +561,7 @@
      *          The name of the reference or of the property is derived from the
      *          name found on the setter method or on the field.
      */
-    private boolean isReferenceType(Class<?> cls, Type genericType) {
+    private static boolean isReferenceType(Class<?> cls, Type genericType) {
         Class<?> baseType = JavaIntrospectionHelper.getBaseType(cls, genericType);
         return baseType.isInterface() && baseType.isAnnotationPresent(Remotable.class);
     }
@@ -470,8 +569,11 @@
     /**
      * Returns true if the given operation is defined in the collection of
      * service interfaces
+     * @param operation
+     * @param services
+     * @return
      */
-    private boolean isInServiceInterface(Method operation, List<org.apache.tuscany.sca.assembly.Service> services) {
+    private static boolean isInServiceInterface(Method operation, List<org.apache.tuscany.sca.assembly.Service> services) {
         for (org.apache.tuscany.sca.assembly.Service service : services) {
             Interface interface1 = service.getInterfaceContract().getInterface();
             if (interface1 instanceof JavaInterface) {
@@ -492,7 +594,7 @@
      * @param method
      * @return
      */
-    private boolean isMethodMatched(Class<?> clazz, Method method) {
+    private static boolean isMethodMatched(Class<?> clazz, Method method) {
         if (method.getDeclaringClass() == clazz) {
             return true;
         }
@@ -506,19 +608,11 @@
     }
 
     /**
-     * Creates a mapped property.
-     * 
-     * @param name the property name
-     * @param paramType the property type
+     * Verify if there is any SCA annotation on the parameter
+     * @param parameter
+     * @return
      */
-    private org.apache.tuscany.sca.assembly.Property createProperty(String name, Class<?> paramType) {
-        org.apache.tuscany.sca.assembly.Property property = assemblyFactory.createProperty();
-        property.setName(name);
-        property.setXSDType(JavaXMLMapper.getXMLType(paramType));
-        return property;
-    }
-
-    private boolean isAnnotated(JavaParameterImpl parameter) {
+    private static boolean isAnnotated(JavaParameterImpl parameter) {
         for (Annotation annotation : parameter.getAnnotations()) {
             Class<? extends Annotation> annotType = annotation.annotationType();
             if (annotType.equals(Property.class) || annotType.equals(Reference.class)
@@ -529,7 +623,12 @@
         return false;
     }
 
-    public boolean areUnique(JavaParameterImpl[] parameters) {
+    /**
+     * Verify if the parameters are unique
+     * @param parameters
+     * @return
+     */
+    private static boolean areUnique(JavaParameterImpl[] parameters) {
         Set<Class<?>> set = new HashSet<Class<?>>(parameters.length);
         for (JavaParameterImpl p : parameters) {
             if (!set.add(p.getType())) {
@@ -538,71 +637,13 @@
         }
         return true;
     }
-
-    public org.apache.tuscany.sca.assembly.Reference createReference(String name, Class<?> paramType)
-        throws IntrospectionException {
-        org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
-        reference.setName(name);
-        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
-        reference.setInterfaceContract(interfaceContract);
-        try {
-            JavaInterface callInterface = javaFactory.createJavaInterface(paramType);
-            reference.getInterfaceContract().setInterface(callInterface);
-            if (callInterface.getCallbackClass() != null) {
-                JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
-                reference.getInterfaceContract().setCallbackInterface(callbackInterface);
-            }
-            reference.setMultiplicity(Multiplicity.ZERO_ONE);
-        } catch (InvalidInterfaceException e1) {
-            throw new IntrospectionException(e1);
-        }
-
-        // FIXME:  This part seems to have already been taken care above!!
-        try {
-            processCallback(paramType, reference);
-        } catch (InvalidServiceType e) {
-            throw new IntrospectionException(e);
-        }
-        return reference;
-    }
-
-    public org.apache.tuscany.sca.assembly.Service createService(Class<?> interfaze) throws InvalidInterfaceException {
-        org.apache.tuscany.sca.assembly.Service service = assemblyFactory.createService();
-        service.setName(interfaze.getSimpleName());
-
-        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
-        service.setInterfaceContract(interfaceContract);
-
-        JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
-        service.getInterfaceContract().setInterface(callInterface);
-        if (callInterface.getCallbackClass() != null) {
-            JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
-            service.getInterfaceContract().setCallbackInterface(callbackInterface);
-        }
-
-        Interface javaInterface = service.getInterfaceContract().getInterface();
-        javaInterface.setRemotable(interfaze.getAnnotation(Remotable.class) != null);
-        service.getInterfaceContract().setInterface(javaInterface);
-        return service;
-    }
-
-    public void processCallback(Class<?> interfaze, Contract contract) throws InvalidServiceType {
-        Callback callback = interfaze.getAnnotation(Callback.class);
-        if (callback != null && !Void.class.equals(callback.value())) {
-            Class<?> callbackClass = callback.value();
-            JavaInterface javaInterface;
-            try {
-                javaInterface = javaFactory.createJavaInterface(callbackClass);
-                contract.getInterfaceContract().setCallbackInterface(javaInterface);
-            } catch (InvalidInterfaceException e) {
-                throw new InvalidServiceType("Invalid callback interface "+callbackClass, interfaze);
-            }
-        } else if (callback != null && Void.class.equals(callback.value())) {
-            throw new InvalidServiceType("No callback interface specified on annotation", interfaze);
-        }
-    }
-
-    public boolean injectionAnnotationsPresent(Annotation[][] annots) {
+    
+    /**
+     * Verify if the annotations are SCA annotation
+     * @param annots
+     * @return
+     */
+    private static boolean injectionAnnotationsPresent(Annotation[][] annots) {
         for (Annotation[] annotations : annots) {
             for (Annotation annotation : annotations) {
                 Class<? extends Annotation> annotType = annotation.annotationType();

Copied: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementationException.java (from r723084, tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementationException.java?p2=tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementationException.java&p1=tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java&r1=723084&r2=723484&rev=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementationException.java Thu Dec  4 15:08:49 2008
@@ -25,14 +25,14 @@
  *
  * @version $Rev$ $Date$
  */
-public class InvalidConversationalImplementation extends IntrospectionException {
+public class InvalidConversationalImplementationException extends IntrospectionException {
     private static final long serialVersionUID = -5487291552769408149L;
 
-    public InvalidConversationalImplementation(String message) {
+    public InvalidConversationalImplementationException(String message) {
         super(message);
     }
 
-    public InvalidConversationalImplementation(String message, Throwable cause) {
+    public InvalidConversationalImplementationException(String message, Throwable cause) {
         super(message, cause);
     }
 

Propchange: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementationException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementationException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementationException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Dec  4 15:08:49 2008
@@ -0,0 +1,3 @@
+/tuscany/branches/sca-java-1.3/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java:671193
+/tuscany/branches/sca-java-1.x/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java:713805-714043
+/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java:694816-713804

Copied: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceTypeException.java (from r723084, tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceTypeException.java?p2=tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceTypeException.java&p1=tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java&r1=723084&r2=723484&rev=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceTypeException.java Thu Dec  4 15:08:49 2008
@@ -26,15 +26,15 @@
  *
  * @version $Rev$ $Date$
  */
-public class InvalidServiceType extends IntrospectionException {
+public class InvalidServiceTypeException extends IntrospectionException {
     private static final long serialVersionUID = -1076466639416644386L;
     private Class<?> serviceType;
 
-    public InvalidServiceType(String message) {
+    public InvalidServiceTypeException(String message) {
         super(message);
     }
     
-    public InvalidServiceType(String message, Class<?> clazz) {
+    public InvalidServiceTypeException(String message, Class<?> clazz) {
         super(message);
         this.serviceType = clazz;
     }

Propchange: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceTypeException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceTypeException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceTypeException.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Dec  4 15:08:49 2008
@@ -0,0 +1,3 @@
+/tuscany/branches/sca-java-1.3/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java:671193
+/tuscany/branches/sca-java-1.x/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java:713805-714043
+/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java:694816-713804

Modified: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java Thu Dec  4 15:08:49 2008
@@ -58,93 +58,45 @@
         this.policyFactory = policyFactory;
     }
 
-    private QName getQName(String intentName) {
-        QName qname;
-        if (intentName.startsWith("{")) {
-            int i = intentName.indexOf('}');
-            if (i != -1) {
-                qname = new QName(intentName.substring(1, i), intentName.substring(i + 1));
-            } else {
-                qname = new QName("", intentName);
-            }
-        } else {
-            qname = new QName("", intentName);
-        }
-        return qname;
-    }
 
-    /**
-     * Read policy intents on the given interface or class 
-     * @param clazz
-     * @param requiredIntents
-     */
-    private void readIntentsAndPolicySets(Class<?> clazz, 
-                                          List<Intent> requiredIntents, 
-                                          List<PolicySet> policySets) {
-        Requires intentAnnotation = clazz.getAnnotation(Requires.class);
-        if (intentAnnotation != null) {
-            String[] intentNames = intentAnnotation.value();
-            if (intentNames.length != 0) {
-                for (String intentName : intentNames) {
-
-                    // Add each intent to the list
-                    Intent intent = policyFactory.createIntent();
-                    intent.setName(getQName(intentName));
-                    requiredIntents.add(intent);
-                }
-            }
+    @Override
+    public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
+        org.osoa.sca.annotations.Reference annotation = 
+            field.getAnnotation( org.osoa.sca.annotations.Reference.class);
+        if (annotation == null) {
+            return;
+        }
+        String name = annotation.name();
+        if ("".equals(name)) {
+            name = field.getName();
         }
         
-        PolicySets policySetAnnotation = clazz.getAnnotation(PolicySets.class);
-        if (policySetAnnotation != null) {
-            String[] policySetNames = policySetAnnotation.value();
-            if (policySetNames.length != 0) {
-                for (String policySetName : policySetNames) {
-
-                    // Add each intent to the list
-                    PolicySet policySet = policyFactory.createPolicySet();
-                    policySet.setName(getQName(policySetName));
-                    policySets.add(policySet);
-                }
-            }
+        Reference reference = null;
+        if ( (reference = getReferenceByName(name, type)) != null ) {
+            readIntents(field.getAnnotation(Requires.class), reference.getRequiredIntents());
+            readPolicySets(field.getAnnotation(PolicySets.class), reference.getPolicySets());
         }
     }
-    
-    private void readIntents(Requires intentAnnotation, List<Intent> requiredIntents) {
-        //Requires intentAnnotation = method.getAnnotation(Requires.class);
-        if (intentAnnotation != null) {
-            String[] intentNames = intentAnnotation.value();
-            if (intentNames.length != 0) {
-                //Operation operation = assemblyFactory.createOperation();
-                //operation.setName(method.getName());
-                //operation.setUnresolved(true);
-                for (String intentName : intentNames) {
 
-                    // Add each intent to the list, associated with the
-                    // operation corresponding to the annotated method
-                    Intent intent = policyFactory.createIntent();
-                    intent.setName(getQName(intentName));
-                    //intent.getOperations().add(operation);
-                    requiredIntents.add(intent);
-                }
-            }
-        }
-    }
-    
-    private void readPolicySets(PolicySets policySetAnnotation, List<PolicySet> policySets) {
-        if (policySetAnnotation != null) {
-            String[] policySetNames = policySetAnnotation.value();
-            if (policySetNames.length != 0) {
-                //Operation operation = assemblyFactory.createOperation();
-                //operation.setName(method.getName());
-                //operation.setUnresolved(true);
-                for (String policySetName : policySetNames) {
-                    // Add each intent to the list, associated with the
-                    // operation corresponding to the annotated method
-                    PolicySet policySet = policyFactory.createPolicySet();
-                    policySet.setName(getQName(policySetName));
-                    //intent.getOperations().add(operation);
-                    policySets.add(policySet);
+    @Override
+    public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
+        Reference reference = null;
+        if ( (reference = getReference(method, type)) != null ) {
+            readIntents(method.getAnnotation(Requires.class), reference.getRequiredIntents());
+            readPolicySets(method.getAnnotation(PolicySets.class), reference.getPolicySets());
+        } else {
+            if ( type instanceof OperationsConfigurator ) {
+                //Read the intents specified on the given implementation method
+                if ( (method.getAnnotation(Requires.class) != null || 
+                        method.getAnnotation(PolicySets.class) != null ) && 
+                            (type instanceof PolicySetAttachPoint )) {
+                    ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
+                    confOp.setName(method.getName());
+                    ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
+            
+                
+                    readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
+                    readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
                 }
             }
         }
@@ -223,24 +175,126 @@
         }
     }
 
-    private Reference getReference(Method method, JavaImplementation type) {
-        //since the ReferenceProcessor is called ahead of the PolicyProcessor the type should have
-        //picked up the reference setter method
-        org.osoa.sca.annotations.Reference annotation = 
-                                        method.getAnnotation(org.osoa.sca.annotations.Reference.class);
-        if (annotation != null) {
-            if (JavaIntrospectionHelper.isSetter(method)) {
-                String name = annotation.name();
-                if ("".equals(name)) {
-                    name = JavaIntrospectionHelper.toPropertyName(method.getName());
+    /**
+     * Read policy intents on the given interface or class 
+     * @param clazz
+     * @param requiredIntents
+     */
+    private void readIntentsAndPolicySets(Class<?> clazz, 
+                                          List<Intent> requiredIntents, 
+                                          List<PolicySet> policySets) {
+        Requires intentAnnotation = clazz.getAnnotation(Requires.class);
+        if (intentAnnotation != null) {
+            String[] intentNames = intentAnnotation.value();
+            if (intentNames.length != 0) {
+                for (String intentName : intentNames) {
+
+                    // Add each intent to the list
+                    Intent intent = policyFactory.createIntent();
+                    intent.setName(getQName(intentName));
+                    requiredIntents.add(intent);
+                }
+            }
+        }
+        
+        PolicySets policySetAnnotation = clazz.getAnnotation(PolicySets.class);
+        if (policySetAnnotation != null) {
+            String[] policySetNames = policySetAnnotation.value();
+            if (policySetNames.length != 0) {
+                for (String policySetName : policySetNames) {
+
+                    // Add each intent to the list
+                    PolicySet policySet = policyFactory.createPolicySet();
+                    policySet.setName(getQName(policySetName));
+                    policySets.add(policySet);
                 }
-                return getReferenceByName(name, type);
             }
         }
-        return null;
     }
     
-    private Reference getReferenceByName(String name, JavaImplementation type) {
+    /**
+     * Read intent annotations on the given interface or class
+     * @param intentAnnotation
+     * @param requiredIntents
+     */
+    private void readIntents(Requires intentAnnotation, List<Intent> requiredIntents) {
+        //Requires intentAnnotation = method.getAnnotation(Requires.class);
+        if (intentAnnotation != null) {
+            String[] intentNames = intentAnnotation.value();
+            if (intentNames.length != 0) {
+                //Operation operation = assemblyFactory.createOperation();
+                //operation.setName(method.getName());
+                //operation.setUnresolved(true);
+                for (String intentName : intentNames) {
+
+                    // Add each intent to the list, associated with the
+                    // operation corresponding to the annotated method
+                    Intent intent = policyFactory.createIntent();
+                    intent.setName(getQName(intentName));
+                    //intent.getOperations().add(operation);
+                    requiredIntents.add(intent);
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Read policy set annotations on a given interface or class
+     * @param policySetAnnotation
+     * @param policySets
+     */
+    private void readPolicySets(PolicySets policySetAnnotation, List<PolicySet> policySets) {
+        if (policySetAnnotation != null) {
+            String[] policySetNames = policySetAnnotation.value();
+            if (policySetNames.length != 0) {
+                //Operation operation = assemblyFactory.createOperation();
+                //operation.setName(method.getName());
+                //operation.setUnresolved(true);
+                for (String policySetName : policySetNames) {
+                    // Add each intent to the list, associated with the
+                    // operation corresponding to the annotated method
+                    PolicySet policySet = policyFactory.createPolicySet();
+                    policySet.setName(getQName(policySetName));
+                    //intent.getOperations().add(operation);
+                    policySets.add(policySet);
+                }
+            }
+        }
+    }
+
+    /**
+     * Utility methods
+     */
+    
+    /**
+     * 
+     * @param intentName
+     * @return
+     */
+    private static QName getQName(String intentName) {
+        QName qname;
+        if (intentName.startsWith("{")) {
+            int i = intentName.indexOf('}');
+            if (i != -1) {
+                qname = new QName(intentName.substring(1, i), intentName.substring(i + 1));
+            } else {
+                qname = new QName("", intentName);
+            }
+        } else {
+            qname = new QName("", intentName);
+        }
+        return qname;
+    }
+    
+
+    /**
+     * 
+     * @param name
+     * @param type
+     * @return
+     */
+    private static Reference getReferenceByName(String name, JavaImplementation type) {
         for ( Reference reference : type.getReferences() ) {
             if ( reference.getName().equals(name) ) {
                 return reference;
@@ -249,46 +303,27 @@
         return null;
     }
     
-    @Override
-    public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
-        org.osoa.sca.annotations.Reference annotation = 
-            field.getAnnotation( org.osoa.sca.annotations.Reference.class);
-        if (annotation == null) {
-            return;
-        }
-        String name = annotation.name();
-        if ("".equals(name)) {
-            name = field.getName();
-        }
-        
-        Reference reference = null;
-        if ( (reference = getReferenceByName(name, type)) != null ) {
-            readIntents(field.getAnnotation(Requires.class), reference.getRequiredIntents());
-            readPolicySets(field.getAnnotation(PolicySets.class), reference.getPolicySets());
-        }
-    }
 
-    @Override
-    public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
-        Reference reference = null;
-        if ( (reference = getReference(method, type)) != null ) {
-            readIntents(method.getAnnotation(Requires.class), reference.getRequiredIntents());
-            readPolicySets(method.getAnnotation(PolicySets.class), reference.getPolicySets());
-        } else {
-            if ( type instanceof OperationsConfigurator ) {
-                //Read the intents specified on the given implementation method
-                if ( (method.getAnnotation(Requires.class) != null || 
-                        method.getAnnotation(PolicySets.class) != null ) && 
-                            (type instanceof PolicySetAttachPoint )) {
-                    ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
-                    confOp.setName(method.getName());
-                    ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
-            
-                
-                    readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
-                    readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
+    /**
+     * 
+     * @param method
+     * @param type
+     * @return
+     */
+    private static Reference getReference(Method method, JavaImplementation type) {
+        //since the ReferenceProcessor is called ahead of the PolicyProcessor the type should have
+        //picked up the reference setter method
+        org.osoa.sca.annotations.Reference annotation = 
+                                        method.getAnnotation(org.osoa.sca.annotations.Reference.class);
+        if (annotation != null) {
+            if (JavaIntrospectionHelper.isSetter(method)) {
+                String name = annotation.name();
+                if ("".equals(name)) {
+                    name = JavaIntrospectionHelper.toPropertyName(method.getName());
                 }
+                return getReferenceByName(name, type);
             }
         }
+        return null;
     }
 }

Modified: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java Thu Dec  4 15:08:49 2008
@@ -83,19 +83,6 @@
         type.getReferenceMembers().put(name, element);
     }
 
-    private boolean removeReference(JavaElementImpl ref, JavaImplementation type) {
-        if (ref == null) {
-            return false;
-        }
-        List<org.apache.tuscany.sca.assembly.Reference> refs = type.getReferences();
-        for (int i = 0; i < refs.size(); i++) {
-            if (refs.get(i).getName().equals(ref.getName())) {
-                refs.remove(i);
-                return true;
-            }
-        }
-        return false;
-    }
 
     @Override
     public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
@@ -145,20 +132,13 @@
         parameter.setName(name);
     }
 
-    private String getReferenceName(String paramName, int pos, String name) throws InvalidConstructorException {
-        if ("".equals(name)) {
-            name = paramName;
-        }
-        if ("".equals(name)) {
-            return "_ref" + pos;
-        }
-        if (!"".equals(paramName) && !name.equals(paramName)) {
-            throw new InvalidConstructorException("Mismatching names specified for reference parameter " + pos);
-        } else {
-            return name;
-        }
-    }
-
+    /**
+     * Create a SCA reference for a java Element
+     * @param element
+     * @param name
+     * @return
+     * @throws IntrospectionException
+     */
     private org.apache.tuscany.sca.assembly.Reference createReference(JavaElementImpl element, String name)
         throws IntrospectionException {
         org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
@@ -207,4 +187,53 @@
         }
         return reference;
     }
+
+
+    /**
+     * Utility methods
+     */
+
+    /**
+     * 
+     * @param paramName
+     * @param pos
+     * @param name
+     * @return
+     * @throws InvalidConstructorException
+     */
+    private static String getReferenceName(String paramName, int pos, String name) throws InvalidConstructorException {
+        if ("".equals(name)) {
+            name = paramName;
+        }
+        if ("".equals(name)) {
+            return "_ref" + pos;
+        }
+        if (!"".equals(paramName) && !name.equals(paramName)) {
+            throw new InvalidConstructorException("Mismatching names specified for reference parameter " + pos);
+        } else {
+            return name;
+        }
+    }
+    
+    /**
+     * 
+     * @param ref
+     * @param type
+     * @return
+     */
+    private static boolean removeReference(JavaElementImpl ref, JavaImplementation type) {
+        if (ref == null) {
+            return false;
+        }
+        List<org.apache.tuscany.sca.assembly.Reference> refs = type.getReferences();
+        for (int i = 0; i < refs.size(); i++) {
+            if (refs.get(i).getName().equals(ref.getName())) {
+                refs.remove(i);
+                return true;
+            }
+        }
+        return false;
+    }
+
+
 }

Modified: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java Thu Dec  4 15:08:49 2008
@@ -96,12 +96,6 @@
         type.getResources().put(resource.getName(), resource);
     }
 
-    public JavaResourceImpl createResource(String name, JavaElementImpl element) {
-        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
-        element.setName(name);
-        return new JavaResourceImpl(element);
-    }
-
     @Override
     public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
         throws IntrospectionException {
@@ -135,4 +129,20 @@
         }
     }
 
+
+    /**
+     * Utility methods
+     */
+    
+    /**
+     * 
+     * @param name
+     * @param element
+     * @return
+     */
+    private static JavaResourceImpl createResource(String name, JavaElementImpl element) {
+        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
+        element.setName(name);
+        return new JavaResourceImpl(element);
+    }
 }

Modified: tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java Thu Dec  4 15:08:49 2008
@@ -135,12 +135,34 @@
         createCallback(type, element);
     }
 
+    public Service createService(Class<?> interfaze) throws InvalidInterfaceException {
+        Service service = assemblyFactory.createService();
+        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+        service.setInterfaceContract(interfaceContract);
+
+        // create a relative URI
+        service.setName(interfaze.getSimpleName());
+
+        JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
+        service.getInterfaceContract().setInterface(callInterface);
+        if (callInterface.getCallbackClass() != null) {
+            JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
+            service.getInterfaceContract().setCallbackInterface(callbackInterface);
+        }
+        return service;
+    }
+    
+    /**
+     * Utility methods
+     */
+
+
     /**
      * @param type
      * @param element
      * @throws IllegalCallbackReferenceException
      */
-    private void createCallback(JavaImplementation type, JavaElementImpl element)
+    private static void createCallback(JavaImplementation type, JavaElementImpl element)
         throws IllegalCallbackReferenceException {
         Service callbackService = null;
         Class<?> callbackClass = element.getType();
@@ -165,22 +187,4 @@
         }
         type.getCallbackMembers().get(baseType.getName()).add(element);
     }
-
-    public Service createService(Class<?> interfaze) throws InvalidInterfaceException {
-        Service service = assemblyFactory.createService();
-        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
-        service.setInterfaceContract(interfaceContract);
-
-        // create a relative URI
-        service.setName(interfaze.getSimpleName());
-
-        JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
-        service.getInterfaceContract().setInterface(callInterface);
-        if (callInterface.getCallbackClass() != null) {
-            JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
-            service.getInterfaceContract().setCallbackInterface(callbackInterface);
-        }
-        return service;
-    }
-
 }

Modified: tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java?rev=723484&r1=723483&r2=723484&view=diff
==============================================================================
--- tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java (original)
+++ tuscany/java/sca/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java Thu Dec  4 15:08:49 2008
@@ -22,21 +22,19 @@
 import static org.junit.Assert.fail;
 
 import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.junit.Before;
 import org.junit.Test;
 
 /**
  * @version $Rev$ $Date$
  */
 public class ConvertTimeMillisTestCase {
-    private MockProcessor registy;
 
-    @Test
+	@Test
     public void testConvertSeconds() throws Exception {
-        assertEquals(10000L, registy.convertTimeMillis("10 seconds"));
-        assertEquals(10000L, registy.convertTimeMillis("10 SECONDS"));
+        assertEquals(10000L, MockProcessor.convertTimeMillis("10 seconds"));
+        assertEquals(10000L, MockProcessor.convertTimeMillis("10 SECONDS"));
         try {
-            registy.convertTimeMillis("10seconds");
+        	MockProcessor.convertTimeMillis("10seconds");
             fail();
         } catch (NumberFormatException e) {
             // expected
@@ -45,10 +43,10 @@
 
     @Test
     public void testConvertMinutes() throws Exception {
-        assertEquals(600000L, registy.convertTimeMillis("10 minutes"));
-        assertEquals(600000L, registy.convertTimeMillis("10 MINUTES"));
+        assertEquals(600000L, MockProcessor.convertTimeMillis("10 minutes"));
+        assertEquals(600000L, MockProcessor.convertTimeMillis("10 MINUTES"));
         try {
-            registy.convertTimeMillis("10minutes");
+        	MockProcessor.convertTimeMillis("10minutes");
             fail();
         } catch (NumberFormatException e) {
             // expected
@@ -57,10 +55,10 @@
 
     @Test
     public void testConvertHours() throws Exception {
-        assertEquals(36000000L, registy.convertTimeMillis("10 hours"));
-        assertEquals(36000000L, registy.convertTimeMillis("10 HOURS"));
+        assertEquals(36000000L, MockProcessor.convertTimeMillis("10 hours"));
+        assertEquals(36000000L, MockProcessor.convertTimeMillis("10 HOURS"));
         try {
-            registy.convertTimeMillis("10hours");
+        	MockProcessor.convertTimeMillis("10hours");
             fail();
         } catch (NumberFormatException e) {
             // expected
@@ -69,10 +67,10 @@
 
     @Test
     public void testConvertDays() throws Exception {
-        assertEquals(864000000L, registy.convertTimeMillis("10 days"));
-        assertEquals(864000000L, registy.convertTimeMillis("10 DAYS"));
+        assertEquals(864000000L, MockProcessor.convertTimeMillis("10 days"));
+        assertEquals(864000000L, MockProcessor.convertTimeMillis("10 DAYS"));
         try {
-            registy.convertTimeMillis("10days");
+        	MockProcessor.convertTimeMillis("10days");
             fail();
         } catch (NumberFormatException e) {
             // expected
@@ -81,10 +79,10 @@
 
     @Test
     public void testConvertYears() throws Exception {
-        assertEquals(315569260000L, registy.convertTimeMillis("10 years"));
-        assertEquals(315569260000L, registy.convertTimeMillis("10 YEARS"));
+        assertEquals(315569260000L, MockProcessor.convertTimeMillis("10 years"));
+        assertEquals(315569260000L, MockProcessor.convertTimeMillis("10 YEARS"));
         try {
-            registy.convertTimeMillis("10years");
+        	MockProcessor.convertTimeMillis("10years");
             fail();
         } catch (NumberFormatException e) {
             // expected
@@ -93,34 +91,24 @@
 
     @Test
     public void testConvertDefault() throws Exception {
-        assertEquals(10000L, registy.convertTimeMillis("10 "));
-        assertEquals(10000L, registy.convertTimeMillis("10"));
+        assertEquals(10000L, MockProcessor.convertTimeMillis("10 "));
+        assertEquals(10000L, MockProcessor.convertTimeMillis("10"));
     }
 
     @Test
     public void testInvalid() throws Exception {
         try {
-            registy.convertTimeMillis("foo");
+        	MockProcessor.convertTimeMillis("foo");
             fail();
         } catch (NumberFormatException e) {
             // expected
         }
     }
 
-    @Before
-    public void setUp() throws Exception {
-        registy = new MockProcessor();
-    }
-
     private class MockProcessor extends ConversationProcessor {
         
         public MockProcessor() {
             super(new DefaultAssemblyFactory());
         }
-
-        @Override
-        protected long convertTimeMillis(String expr) throws NumberFormatException {
-            return super.convertTimeMillis(expr);
-        }
     }
 }