You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/04/06 19:30:47 UTC

svn commit: r526232 [5/5] - in /incubator/tuscany/java/sca/modules: ./ idl/src/main/java/org/apache/tuscany/idl/util/ impl-java-xml/src/main/java/org/apache/tuscany/api/ impl-java-xml/src/main/java/org/apache/tuscany/api/annotation/ impl-java-xml/src/m...

Added: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java?view=auto&rev=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java Fri Apr  6 10:30:44 2007
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.core.implementation.processor;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.impl.Resource;
+import org.apache.tuscany.implementation.java.processor.DuplicateResourceException;
+import org.apache.tuscany.implementation.java.processor.IllegalResourceException;
+import org.apache.tuscany.implementation.java.processor.ResourceProcessor;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceProcessorTestCase extends TestCase {
+
+    JavaImplementationDefinition type;
+    ResourceProcessor processor = new ResourceProcessor();
+
+    public void testVisitField() throws Exception {
+        Field field = Foo.class.getDeclaredField("bar");
+        processor.visitField(field, type);
+        Resource resource = type.getResources().get("bar");
+        assertFalse(resource.isOptional());
+        assertNull(resource.getMappedName());
+        assertEquals(field.getType(), resource.getType());
+    }
+
+    public void testVisitMethod() throws Exception {
+        Method method = Foo.class.getMethod("setBar", Bar.class);
+        processor.visitMethod(method, type);
+        Resource resource = type.getResources().get("bar");
+        assertFalse(resource.isOptional());
+        assertNull(resource.getMappedName());
+        assertEquals(method.getParameterTypes()[0], resource.getType());
+    }
+
+    public void testVisitNamedMethod() throws Exception {
+        Method method = Foo.class.getMethod("setBar2", Bar.class);
+        processor.visitMethod(method, type);
+        Resource resource = type.getResources().get("someName");
+        assertFalse(resource.isOptional());
+        assertEquals("mapped", resource.getMappedName());
+    }
+
+    public void testVisitBadMethod() throws Exception {
+        Method method = Foo.class.getMethod("setBad");
+        try {
+            processor.visitMethod(method, type);
+            fail();
+        } catch (IllegalResourceException e) {
+            // expected
+        }
+    }
+
+    public void testDuplicateResources() throws Exception {
+        Field field = Foo.class.getDeclaredField("bar");
+        processor.visitField(field, type);
+        try {
+            processor.visitField(field, type);
+            fail();
+        } catch (DuplicateResourceException e) {
+            //expected
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        type = new JavaImplementationDefinition();
+    }
+
+    private class Foo {
+
+        @org.apache.tuscany.api.annotation.Resource
+        protected Bar bar;
+
+        @org.apache.tuscany.api.annotation.Resource(optional = true)
+        protected Bar barNotRequired;
+
+        @org.apache.tuscany.api.annotation.Resource
+        public void setBar(Bar bar) {
+        }
+
+        @org.apache.tuscany.api.annotation.Resource(name = "someName", mappedName = "mapped")
+        public void setBar2(Bar bar) {
+        }
+
+        @org.apache.tuscany.api.annotation.Resource
+        public void setBad() {
+        }
+
+    }
+
+    private interface Bar {
+
+    }
+}

Propchange: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ResourceProcessorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java?view=auto&rev=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java Fri Apr  6 10:30:44 2007
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.core.implementation.processor;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.assembly.Component;
+import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.impl.Scope;
+import org.apache.tuscany.implementation.java.introspection.ProcessingException;
+import org.apache.tuscany.implementation.java.processor.ScopeProcessor;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ScopeProcessorTestCase extends TestCase {
+
+    Component parent;
+
+    public void testCompositeScope() throws ProcessingException {
+        ScopeProcessor processor = new ScopeProcessor();
+        JavaImplementationDefinition type =
+            new JavaImplementationDefinition();
+
+        processor.visitClass(Composite.class, type);
+        assertEquals(Scope.COMPOSITE, type.getScope());
+    }
+
+    public void testSessionScope() throws ProcessingException {
+        ScopeProcessor processor = new ScopeProcessor();
+        JavaImplementationDefinition type =
+            new JavaImplementationDefinition();
+        processor.visitClass(Session.class, type);
+        assertEquals(Scope.SESSION, type.getScope());
+    }
+
+    public void testConversationalScope() throws ProcessingException {
+        ScopeProcessor processor = new ScopeProcessor();
+        JavaImplementationDefinition type =
+            new JavaImplementationDefinition();
+        processor.visitClass(Conversation.class, type);
+        assertEquals(Scope.CONVERSATION, type.getScope());
+    }
+
+    public void testRequestScope() throws ProcessingException {
+        ScopeProcessor processor = new ScopeProcessor();
+        JavaImplementationDefinition type =
+            new JavaImplementationDefinition();
+        processor.visitClass(Request.class, type);
+        assertEquals(Scope.REQUEST, type.getScope());
+    }
+
+    public void testSystemScope() throws ProcessingException {
+        ScopeProcessor processor = new ScopeProcessor();
+        JavaImplementationDefinition type =
+            new JavaImplementationDefinition();
+        processor.visitClass(System.class, type);
+        assertEquals(Scope.SYSTEM, type.getScope());
+    }
+
+    public void testStatelessScope() throws ProcessingException {
+        ScopeProcessor processor = new ScopeProcessor();
+        JavaImplementationDefinition type =
+            new JavaImplementationDefinition();
+        processor.visitClass(Stateless.class, type);
+        assertEquals(Scope.STATELESS, type.getScope());
+    }
+
+    public void testNoScope() throws ProcessingException {
+        ScopeProcessor processor = new ScopeProcessor();
+        JavaImplementationDefinition type =
+            new JavaImplementationDefinition();
+        processor.visitClass(None.class, type);
+        assertEquals(Scope.STATELESS, type.getScope());
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        parent = EasyMock.createNiceMock(Component.class);
+    }
+
+    @org.osoa.sca.annotations.Scope("COMPOSITE")
+    private class Composite {
+    }
+
+    @org.osoa.sca.annotations.Scope("SESSION")
+    private class Session {
+    }
+
+    @org.osoa.sca.annotations.Scope("CONVERSATION")
+    private class Conversation {
+    }
+
+    @org.osoa.sca.annotations.Scope("REQUEST")
+    private class Request {
+    }
+
+    @org.osoa.sca.annotations.Scope("SYSTEM")
+    private class System {
+    }
+
+    @org.osoa.sca.annotations.Scope("STATELESS")
+    private class Stateless {
+    }
+
+    private class None {
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ScopeProcessorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java?view=auto&rev=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java Fri Apr  6 10:30:44 2007
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.core.implementation.processor;
+
+import static org.apache.tuscany.core.implementation.processor.ModelHelper.getService;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.idl.InvalidCallbackException;
+import org.apache.tuscany.idl.java.introspection.impl.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.introspection.ProcessingException;
+import org.apache.tuscany.implementation.java.processor.IllegalCallbackReferenceException;
+import org.apache.tuscany.implementation.java.processor.ServiceProcessor;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceCallbackTestCase extends TestCase {
+    private ServiceProcessor processor;
+
+    @Override
+    protected void setUp() throws Exception {
+        processor = new ServiceProcessor();
+        processor.setInterfaceProcessorRegistry(new JavaInterfaceProcessorRegistryImpl());
+    }
+
+    public void testMethodCallbackInterface() throws Exception {
+        JavaImplementationDefinition type = new JavaImplementationDefinition();
+        processor.visitClass(FooImpl.class, type);
+        org.apache.tuscany.assembly.Service service = getService(type, Foo.class.getSimpleName());
+        assertNotNull(service);
+        Method method = FooImpl.class.getMethod("setCallback", FooCallback.class);
+        processor.visitMethod(method, type);
+        assertEquals(method, type.getCallbackMembers().get("callback").getAnchor());
+    }
+
+    public void testFieldCallbackInterface() throws Exception {
+        JavaImplementationDefinition type = new JavaImplementationDefinition();
+        processor.visitClass(FooImpl.class, type);
+        org.apache.tuscany.assembly.Service service = getService(type, Foo.class.getSimpleName());
+        assertNotNull(service);
+        Field field = FooImpl.class.getDeclaredField("callback");
+        processor.visitField(field, type);
+        assertEquals(field, type.getCallbackMembers().get(field.getName()).getAnchor());
+    }
+
+    public void testMethodDoesNotMatchCallback() throws Exception {
+        JavaImplementationDefinition type = new JavaImplementationDefinition();
+        processor.visitClass(BadBarImpl.class, type);
+        Method method = BadBarImpl.class.getMethod("setWrongInterfaceCallback", String.class);
+        try {
+            processor.visitMethod(method, type);
+            fail();
+        } catch (IllegalCallbackReferenceException e) {
+            // expected
+        }
+    }
+
+    public void testNoParamCallback() throws Exception {
+        JavaImplementationDefinition type = new JavaImplementationDefinition();
+        processor.visitClass(BadBarImpl.class, type);
+        Method method = BadBarImpl.class.getMethod("setNoParamCallback");
+        try {
+            processor.visitMethod(method, type);
+            fail();
+        } catch (IllegalCallbackReferenceException e) {
+            // expected
+        }
+    }
+
+    public void testFieldDoesNotMatchCallback() throws Exception {
+        JavaImplementationDefinition type = new JavaImplementationDefinition();
+        processor.visitClass(BadBarImpl.class, type);
+        Field field = BadBarImpl.class.getDeclaredField("wrongInterfaceCallback");
+        try {
+            processor.visitField(field, type);
+            fail();
+        } catch (IllegalCallbackReferenceException e) {
+            // expected
+        }
+    }
+
+    public void testBadCallbackInterfaceAnnotation() throws Exception {
+        JavaImplementationDefinition type = new JavaImplementationDefinition();
+        try {
+            processor.visitClass(BadFooImpl.class, type);
+            fail();
+        } catch (ProcessingException e) {
+            // expected
+            assertTrue(e.getCause() instanceof InvalidCallbackException);
+        }
+    }
+
+    @Callback(FooCallback.class)
+    private interface Foo {
+
+    }
+
+    private interface FooCallback {
+
+    }
+
+    @Service(Foo.class)
+    private static class FooImpl implements Foo {
+
+        @Callback
+        protected FooCallback callback;
+
+        @Callback
+        public void setCallback(FooCallback cb) {
+
+        }
+    }
+
+    private static class BadBarImpl implements Foo {
+        @Callback
+        protected String wrongInterfaceCallback;
+
+        @Callback
+        public void setWrongInterfaceCallback(String cb) {
+
+        }
+
+        @Callback
+        public void setNoParamCallback() {
+
+        }
+
+    }
+
+    @Callback
+    private interface BadFoo {
+
+    }
+
+    @Service(BadFoo.class)
+    private static class BadFooImpl implements BadFoo {
+
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceCallbackTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java?view=auto&rev=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java (added)
+++ incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java Fri Apr  6 10:30:44 2007
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.core.implementation.processor;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.idl.java.JavaInterface;
+import org.apache.tuscany.idl.java.introspection.JavaInterfaceProcessorRegistry;
+import org.apache.tuscany.idl.java.introspection.impl.JavaInterfaceProcessorRegistryImpl;
+import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.processor.IllegalServiceDefinitionException;
+import org.apache.tuscany.implementation.java.processor.InvalidServiceType;
+import org.apache.tuscany.implementation.java.processor.ServiceProcessor;
+import org.osoa.sca.annotations.Callback;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ServiceProcessorTestCase extends TestCase {
+    private ServiceProcessor processor;
+    private JavaImplementationDefinition type;
+
+    public void testMultipleInterfaces() throws Exception {
+        processor.visitClass(FooMultiple.class, type);
+        assertEquals(2, type.getServices().size());
+        org.apache.tuscany.assembly.Service service = ModelHelper.getService(type, Baz.class.getSimpleName());
+        assertEquals(Baz.class, ((JavaInterface)service.getInterface()).getJavaClass());
+        assertEquals(Bar.class, ((JavaInterface)service.getCallbackInterface()).getJavaClass());
+        assertNotNull(ModelHelper.getService(type, Bar.class.getSimpleName()));
+    }
+
+    public void testSingleInterfaces() throws Exception {
+        processor.visitClass(FooSingle.class, type);
+        assertEquals(1, type.getServices().size());
+        assertNotNull(ModelHelper.getService(type, Baz.class.getSimpleName()));
+    }
+
+    public void testMultipleNoService() throws Exception {
+        processor.visitClass(FooMultipleNoService.class, type);
+        assertEquals(0, type.getServices().size());
+    }
+
+    /**
+     * Verifies a service with a callback annotation is recognized
+     */
+    public void testMultipleWithCallbackAnnotation() throws Exception {
+        processor.visitClass(FooMultipleWithCalback.class, type);
+        assertEquals(1, type.getServices().size());
+    }
+
+    public void testRemotableNoService() throws Exception {
+        processor.visitClass(FooRemotableNoService.class, type);
+        assertEquals(1, type.getServices().size());
+        org.apache.tuscany.assembly.Service service = ModelHelper.getService(type, BazRemotable.class.getSimpleName());
+        assertEquals(BazRemotable.class, ((JavaInterface)service.getInterface()).getJavaClass());
+    }
+
+    public void testNonInterface() throws Exception {
+        try {
+            processor.visitClass(BadImpl.class, type);
+            fail();
+        } catch (InvalidServiceType e) {
+            //expected
+        }
+    }
+
+    public void testNoInterfaces() throws Exception {
+        try {
+            processor.visitClass(BadDefinition.class, type);
+            fail();
+        } catch (IllegalServiceDefinitionException e) {
+            //expected
+        }
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        JavaInterfaceProcessorRegistry registry = new JavaInterfaceProcessorRegistryImpl();
+        processor = new ServiceProcessor();
+        processor.setInterfaceProcessorRegistry(registry);
+        type = new JavaImplementationDefinition();
+    }
+
+    @Callback(Bar.class)
+    private interface Baz {
+    }
+
+    private interface Bar {
+    }
+
+    private interface Bar2 {
+    }
+
+    @Remotable
+    private interface BazRemotable {
+    }
+
+    @Service(interfaces = {Baz.class, Bar.class})
+    private class FooMultiple implements Baz, Bar {
+
+    }
+
+    @Service(Baz.class)
+    private class FooSingle implements Baz, Bar {
+
+    }
+
+    private class FooMultipleNoService implements Bar, Bar2 {
+
+    }
+
+    private class FooMultipleWithCalback implements Baz, Bar {
+
+    }
+
+    private class FooRemotableNoService implements BazRemotable, Bar {
+
+    }
+
+    @Service(FooSingle.class)
+    private class BadImpl extends FooSingle {
+
+    }
+
+
+    @Service()
+    private class BadDefinition extends FooSingle {
+
+    }
+
+}

Propchange: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/modules/impl-java-xml/src/test/java/org/apache/tuscany/core/implementation/processor/ServiceProcessorTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaElement.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaElement.java?view=diff&rev=526232&r1=526231&r2=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaElement.java (original)
+++ incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaElement.java Fri Apr  6 10:30:44 2007
@@ -63,22 +63,6 @@
         this.name = field.getName();
     }
 
-    public JavaElement(Method method) {
-        this.anchor = method;
-        this.elementType = ElementType.METHOD;
-        this.type = method.getReturnType();
-        this.genericType = method.getGenericReturnType();
-        this.name = method.getName();
-    }
-
-    public JavaElement(Constructor<?> constructor) {
-        this.anchor = constructor;
-        this.elementType = ElementType.CONSTRUCTOR;
-        this.type = null;
-        this.genericType = null;
-        this.name = constructor.getName();
-    }
-
     public JavaElement(Constructor<?> constructor, int index) {
         this.anchor = constructor;
         this.elementType = ElementType.PARAMETER;
@@ -97,6 +81,18 @@
         this.name = "";
     }
 
+    /**
+     * For testing purpose
+     * @param elementType
+     * @param type
+     * @param name
+     */
+    public JavaElement(String name, Class<?> type) {
+        super();
+        this.type = type;
+        this.name = name;
+    }
+    
     /**
      * @return the anchor
      */

Modified: incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationDefinition.java?view=diff&rev=526232&r1=526231&r2=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationDefinition.java (original)
+++ incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationDefinition.java Fri Apr  6 10:30:44 2007
@@ -31,17 +31,22 @@
  *
  * @version $$Rev$$ $$Date$$
  */
-public class JavaImplementationDefinition {
-    private Class<?> implClass;
+public class JavaImplementationDefinition extends JavaImplementationImpl {
     private ConstructorDefinition<?> constructorDefinition;
     private Map<Constructor, ConstructorDefinition> constructors = new HashMap<Constructor, ConstructorDefinition>();
     private Method initMethod;
     private Method destroyMethod;
     private final Map<String, Resource> resources = new HashMap<String, Resource>();
+    private final Map<String, JavaElement> propertyMembers = new HashMap<String, JavaElement>();
+    private final Map<String, JavaElement> referenceMembers = new HashMap<String, JavaElement>();
+    private final Map<String, JavaElement> callbackMembers = new HashMap<String, JavaElement>();
     private Member conversationIDMember;
-    
+    private boolean eagerInit;
     private boolean allowsPassByReference;
     private List<Method> allowsPassByReferenceMethods = new ArrayList<Method>();
+    private long maxAge = -1;
+    private long maxIdleTime = -1;
+    private Scope scope = Scope.STATELESS;
 
     /**
      * Constructor specifying the java class for the POJO this is describing.
@@ -49,26 +54,13 @@
      * @param implClass the java class for the POJO this is describing
      */
     public JavaImplementationDefinition(Class<?> implClass) {
-        this.implClass = implClass;
-    }
-
-    /**
-     * Returns the java class for the POJO this is describing.
-     *
-     * @return the java class for the POJO this is describing
-     */
-    public Class<?> getImplClass() {
-        return implClass;
-    }
-
-    /**
-     * Sets the java class for the POJO this is describing.
-     *
-     * @param implClass the java class for the POJO this is describing
-     */
-    public void setImplClass(Class<?> implClass) {
-        this.implClass = implClass;
+        super();
+        setJavaClass(implClass);
     }
+    
+    public JavaImplementationDefinition() {
+        super();
+    }    
 
     /**
      * Returns the constructor used to instantiate implementation instances.
@@ -170,5 +162,82 @@
      */
     public Map<Constructor, ConstructorDefinition> getConstructors() {
         return constructors;
+    }
+
+    /**
+     * @return the eagerInit
+     */
+    public boolean isEagerInit() {
+        return eagerInit;
+    }
+
+    /**
+     * @param eagerInit the eagerInit to set
+     */
+    public void setEagerInit(boolean eagerInit) {
+        this.eagerInit = eagerInit;
+    }
+
+    /**
+     * @return the callbacks
+     */
+    public Map<String, JavaElement> getCallbackMembers() {
+        return callbackMembers;
+    }
+
+    /**
+     * @return the properties
+     */
+    public Map<String, JavaElement> getPropertyMembers() {
+        return propertyMembers;
+    }
+
+    /**
+     * @return the references
+     */
+    public Map<String, JavaElement> getReferenceMembers() {
+        return referenceMembers;
+    }
+
+    /**
+     * @return the scope
+     */
+    public Scope getScope() {
+        return scope;
+    }
+
+    /**
+     * @param scope the scope to set
+     */
+    public void setScope(Scope scope) {
+        this.scope = scope;
+    }
+
+    /**
+     * @return the maxAge
+     */
+    public long getMaxAge() {
+        return maxAge;
+    }
+
+    /**
+     * @param maxAge the maxAge to set
+     */
+    public void setMaxAge(long maxAge) {
+        this.maxAge = maxAge;
+    }
+
+    /**
+     * @return the maxIdleTime
+     */
+    public long getMaxIdleTime() {
+        return maxIdleTime;
+    }
+
+    /**
+     * @param maxIdleTime the maxIdleTime to set
+     */
+    public void setMaxIdleTime(long maxIdleTime) {
+        this.maxIdleTime = maxIdleTime;
     }
 }

Modified: incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java?view=diff&rev=526232&r1=526231&r2=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java (original)
+++ incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/JavaImplementationImpl.java Fri Apr  6 10:30:44 2007
@@ -52,6 +52,9 @@
 
     public void setJavaClass(Class<?> javaClass) {
         this.javaClass = javaClass;
+        if (this.className == null) {
+            this.className = javaClass.getName();
+        }
     }
 
     @Override

Added: incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/Scope.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/Scope.java?view=auto&rev=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/Scope.java (added)
+++ incubator/tuscany/java/sca/modules/impl-java/src/main/java/org/apache/tuscany/implementation/java/impl/Scope.java Fri Apr  6 10:30:44 2007
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.implementation.java.impl;
+
+/**
+ * The default implementation scopes supported by assemblies.
+ *
+ * @version $Rev$ $Date$
+ */
+public class Scope {
+    public static final Scope STATELESS = new Scope("STATELESS");
+    public static final Scope REQUEST = new Scope("REQUEST");
+    public static final Scope SESSION = new Scope("SESSION");
+    public static final Scope CONVERSATION = new Scope("CONVERSATION");
+    public static final Scope COMPOSITE = new Scope("COMPOSITE");
+    public static final Scope SYSTEM = new Scope("SYSTEM");
+    public static final Scope UNDEFINED = new Scope("UNDEFINED");
+
+    private String scope;
+
+    public Scope(String scope) {
+        this.scope = scope.toUpperCase().intern();
+    }
+
+    public String getScope() {
+        return scope;
+    }
+
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        final Scope scope1 = (Scope) o;
+        return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null);
+    }
+
+    public int hashCode() {
+        return scope != null ? scope.hashCode() : 0;
+    }
+
+    public String toString() {
+        return scope;
+    }
+}

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

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

Modified: incubator/tuscany/java/sca/modules/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/pom.xml?view=diff&rev=526232&r1=526231&r2=526232
==============================================================================
--- incubator/tuscany/java/sca/modules/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/pom.xml Fri Apr  6 10:30:44 2007
@@ -90,6 +90,65 @@
 
     </profiles>
 
+    <!-- dependencies used by the kernel -->
+    <dependencyManagement>
+        <dependencies>
+            <!-- org.osoa.sca API -->
+            <dependency>
+                <groupId>org.osoa</groupId>
+                <artifactId>sca-api-r1.0</artifactId>
+                <version>1.0.1-incubating-SNAPSHOT</version>
+                <scope>compile</scope>
+            </dependency>
+
+            <!-- javax.servlet API -->
+            <dependency>
+                <groupId>javax.servlet</groupId>
+                <artifactId>servlet-api</artifactId>
+                <version>2.4</version>
+                <scope>provided</scope>
+            </dependency>
+
+            <!-- java.xml.stream API -->
+            <dependency>
+                <groupId>stax</groupId>
+                <artifactId>stax-api</artifactId>
+                <version>1.0.1</version>
+                <scope>compile</scope>
+            </dependency>
+
+            <!-- StAX implementation -->
+            <dependency>
+                <groupId>org.codehaus.woodstox</groupId>
+                <artifactId>wstx-asl</artifactId>
+                <version>3.2.0</version>
+                <scope>runtime</scope>
+            </dependency>
+
+            <!-- junit version -->
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>4.2</version>
+                <scope>test</scope>
+            </dependency>
+
+            <!-- EasyMock version -->
+            <dependency>
+                <groupId>org.easymock</groupId>
+                <artifactId>easymock</artifactId>
+                <version>2.2</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.easymock</groupId>
+                <artifactId>easymockclassextension</artifactId>
+                <version>2.2</version>
+                <scope>test</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
     <dependencies>
         <dependency>
             <groupId>junit</groupId>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org