tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r557289 - in /incubator/tuscany/java/sca/modules: core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/ implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ implementation-java-runt...
Date Wed, 18 Jul 2007 15:14:02 GMT
Author: jsdelfino
Date: Wed Jul 18 08:14:00 2007
New Revision: 557289

URL: http://svn.apache.org/viewvc?view=rev&rev=557289
Log:
Fix for TUSCANY-1271 and TUSCANY-1174. Cleaned up obsolete annotations, added missing support
for @ComponentName.

Added:
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentNameFactory.java
  (with props)
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java
      - copied, changed from r557091, incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Resource.java
Removed:
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingMonitorFactory.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/monitor/ProxyMonitorFactory.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/monitor/JavaLoggingTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/
Modified:
    incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
    incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
    incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
    incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java

Modified: incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java
(original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/main/java/org/apache/tuscany/sca/core/spring/context/SCADomainContext.java
Wed Jul 18 08:14:00 2007
@@ -50,6 +50,7 @@
 import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
@@ -107,6 +108,7 @@
         BaseJavaClassVisitor[] extensions = new BaseJavaClassVisitor[] {
             new ConstructorProcessor(assemblyFactory),
             new AllowsPassByReferenceProcessor(assemblyFactory),
+            new ComponentNameProcessor(assemblyFactory),
             new ContextProcessor(assemblyFactory),
             new ConversationProcessor(assemblyFactory),
             new DestroyProcessor(assemblyFactory),

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
Wed Jul 18 08:14:00 2007
@@ -23,7 +23,7 @@
 
 /**
  * Resolves a runtime resource to be injected on a field or method of a Java component type
marked with {@link
- * org.apache.tuscany.api.annotation.Resource}. If the mapped name of the resource is an
absolute URI such as
+ * javax.annotation.Resource}. If the mapped name of the resource is an absolute URI such
as
  * <code>sca://localhost</code> or <code>jndi://localhost</code>
the host container namespace is searched; otherwise the
  * URI is assumed to be relative and the parent composite is searched. If a mapped name is
not provided, i.e. resolution
  * is by type, the parent composite is first searched followed by the host namespace.

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
Wed Jul 18 08:14:00 2007
@@ -107,6 +107,8 @@
             Class<?> type = resource.getElement().getType();
             if (ComponentContext.class.equals(type)) {
                 objectFactory = new PojoComponentContextFactory(component);
+            } else if (String.class.equals(type)) {
+                objectFactory = new PojoComponentNameFactory(component);
             } else {
                 boolean optional = resource.isOptional();
                 String mappedName = resource.getMappedName();

Added: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentNameFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentNameFactory.java?view=auto&rev=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentNameFactory.java
(added)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PojoComponentNameFactory.java
Wed Jul 18 08:14:00 2007
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.tuscany.sca.implementation.java.invocation;
+
+import org.apache.tuscany.sca.factory.ObjectCreationException;
+import org.apache.tuscany.sca.factory.ObjectFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PojoComponentNameFactory implements ObjectFactory<String> {
+    private final JavaComponentInfo component;
+
+
+    public PojoComponentNameFactory(JavaComponentInfo component) {
+        this.component = component;
+    }
+
+
+    public String getInstance() throws ObjectCreationException {
+        String uri = component.getUri().toString();
+        return uri.substring(uri.lastIndexOf('/')+1);
+    }
+}

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

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

Modified: incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
Wed Jul 18 08:14:00 2007
@@ -39,6 +39,7 @@
 import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
@@ -93,6 +94,7 @@
         BaseJavaClassVisitor[] extensions = new BaseJavaClassVisitor[] {
             new ConstructorProcessor(assemblyFactory),
             new AllowsPassByReferenceProcessor(assemblyFactory),
+            new ComponentNameProcessor(assemblyFactory),
             new ContextProcessor(assemblyFactory),
             new ConversationProcessor(assemblyFactory),
             new DestroyProcessor(assemblyFactory),

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java
Wed Jul 18 08:14:00 2007
@@ -55,7 +55,7 @@
         if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType))
{
             JavaElementImpl element = new JavaElementImpl(method, 0);
             element.setName(name);
-            element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
+            element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
             JavaResourceImpl resource = new JavaResourceImpl(element);
             type.getResources().put(resource.getName(), resource);
         } else {
@@ -70,7 +70,7 @@
         Class<?> paramType = field.getType();
         if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType))
{
             JavaElementImpl element = new JavaElementImpl(field);
-            element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
+            element.setClassifer(Resource.class);
             JavaResourceImpl resource = new JavaResourceImpl(element);
             type.getResources().put(resource.getName(), resource);
         } else {

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
Wed Jul 18 08:14:00 2007
@@ -37,8 +37,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.tuscany.api.annotation.Monitor;
-import org.apache.tuscany.api.annotation.Resource;
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.Contract;
 import org.apache.tuscany.sca.assembly.Multiplicity;
@@ -595,8 +593,7 @@
             for (Annotation annotation : annotations) {
                 Class<? extends Annotation> annotType = annotation.annotationType();
                 if (annotType.equals(Property.class) || annotType.equals(Reference.class)
-                    || annotType.equals(Resource.class)
-                    || annotType.equals(Monitor.class)) {
+                    || annotType.equals(Resource.class)) {
                     return true;
                 }
             }

Copied: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java
(from r557091, incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Resource.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java?view=diff&rev=557289&p1=incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Resource.java&r1=557091&p2=incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/api/annotation/Resource.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java
Wed Jul 18 08:14:00 2007
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.tuscany.api.annotation;
+package org.apache.tuscany.sca.implementation.java.introspect.impl;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
Wed Jul 18 08:14:00 2007
@@ -42,8 +42,8 @@
     }
 
     public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException
{
-        org.apache.tuscany.api.annotation.Resource annotation = method
-            .getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+        org.apache.tuscany.sca.implementation.java.introspect.impl.Resource annotation =
method
+            .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
         if (annotation == null) {
             return;
         }
@@ -69,8 +69,8 @@
 
     public void visitField(Field field, JavaImplementation type) throws IntrospectionException
{
 
-        org.apache.tuscany.api.annotation.Resource annotation = field
-            .getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+        org.apache.tuscany.sca.implementation.java.introspect.impl.Resource annotation =
field
+            .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
         if (annotation == null) {
             return;
         }
@@ -94,15 +94,15 @@
 
     @SuppressWarnings("unchecked")
     public JavaResourceImpl createResource(String name, JavaElementImpl element) {
-        element.setClassifer(org.apache.tuscany.api.annotation.Resource.class);
+        element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
         element.setName(name);
         return new JavaResourceImpl(element);
     }
 
     public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation
type)
         throws IntrospectionException {
-        org.apache.tuscany.api.annotation.Resource resourceAnnotation = parameter
-            .getAnnotation(org.apache.tuscany.api.annotation.Resource.class);
+        org.apache.tuscany.sca.implementation.java.introspect.impl.Resource resourceAnnotation
= parameter
+            .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
         if (resourceAnnotation != null) {
             String name = resourceAnnotation.name();
             if ("".equals(name)) {

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
Wed Jul 18 08:14:00 2007
@@ -21,7 +21,6 @@
 import java.lang.reflect.Constructor;
 import java.util.List;
 
-import org.apache.tuscany.api.annotation.Resource;
 import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
 import org.apache.tuscany.sca.implementation.java.JavaImplementation;
 import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
Wed Jul 18 08:14:00 2007
@@ -23,14 +23,13 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.Component;
 import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
 import org.apache.tuscany.sca.implementation.java.JavaImplementation;
 import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.easymock.EasyMock;
 import org.osoa.sca.ComponentContext;
 import org.osoa.sca.RequestContext;
+import org.osoa.sca.annotations.ComponentName;
 import org.osoa.sca.annotations.Context;
 
 /**
@@ -38,30 +37,22 @@
  */
 public class ContextProcessorTestCase extends TestCase {
     private ContextProcessor processor;
-    private Component composite;
+    private ComponentNameProcessor nameProcessor;
     private JavaImplementationFactory javaImplementationFactory;
 
-    // FIXME: resurrect to test ComponentContext injection
-/*
-    public void testCompositeContextMethod() throws Exception {
+    public void testComponentContextMethod() throws Exception {
         Method method = Foo.class.getMethod("setContext", ComponentContext.class);
-        JavaImplementationDefinition type =
-            new JavaImplementationDefinition();
-        processor.visitMethod(composite, method, type);
+        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+        processor.visitMethod(method, type);
         assertNotNull(type.getResources().get("context"));
     }
-*/
 
-    // FIXME: resurrect to test ComponentContext injection
-/*
-    public void testCompositeContextField() throws Exception {
+    public void testComponentContextField() throws Exception {
         Field field = Foo.class.getDeclaredField("context");
-        JavaImplementationDefinition type =
-            new JavaImplementationDefinition();
-        processor.visitField(composite, field, type);
+        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+        processor.visitField(field, type);
         assertNotNull(type.getResources().get("context"));
     }
-*/
 
     public void testRequestContextMethod() throws Exception {
         Method method = Foo.class.getMethod("setRequestContext", RequestContext.class);
@@ -77,6 +68,20 @@
         assertNotNull(type.getResources().get("requestContext"));
     }
 
+    public void testComponentNameMethod() throws Exception {
+        Method method = Foo.class.getMethod("setName", String.class);
+        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+        nameProcessor.visitMethod(method, type);
+        assertNotNull(type.getResources().get("name"));
+    }
+
+    public void testComponentNameField() throws Exception {
+        Field field = Foo.class.getDeclaredField("name");
+        JavaImplementation type = javaImplementationFactory.createJavaImplementation();
+        nameProcessor.visitField(field, type);
+        assertNotNull(type.getResources().get("name"));
+    }
+
     public void testInvalidParamType() throws Exception {
         Method method = Foo.class.getMethod("setContext", String.class);
         JavaImplementation type = javaImplementationFactory.createJavaImplementation();
@@ -140,14 +145,16 @@
         super.setUp();
         javaImplementationFactory = new DefaultJavaImplementationFactory();
         processor = new ContextProcessor(new DefaultAssemblyFactory());
-        // processor.setWorkContext(EasyMock.createNiceMock(WorkContext.class));
-        composite = EasyMock.createNiceMock(Component.class);
+        nameProcessor = new ComponentNameProcessor(new DefaultAssemblyFactory());
     }
 
     private class Foo {
         @Context
         protected ComponentContext context;
 
+        @ComponentName
+        protected String name;
+
         @Context
         protected Object badContext;
 
@@ -158,6 +165,11 @@
 
         @Context
         public void setContext(ComponentContext context) {
+
+        }
+
+        @ComponentName
+        public void setName(String name) {
 
         }
 

Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
Wed Jul 18 08:14:00 2007
@@ -92,21 +92,21 @@
 
     private class Foo {
 
-        @org.apache.tuscany.api.annotation.Resource
+        @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
         protected Bar bar;
 
-        @org.apache.tuscany.api.annotation.Resource(optional = true)
+        @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource(optional = true)
         protected Bar barNotRequired;
 
-        @org.apache.tuscany.api.annotation.Resource
+        @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
         public void setBar(Bar bar) {
         }
 
-        @org.apache.tuscany.api.annotation.Resource(name = "someName", mappedName = "mapped")
+        @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource(name = "someName",
mappedName = "mapped")
         public void setBar2(Bar bar) {
         }
 
-        @org.apache.tuscany.api.annotation.Resource
+        @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
         public void setBad() {
         }
 

Modified: incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java?view=diff&rev=557289&r1=557288&r2=557289
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java
(original)
+++ incubator/tuscany/java/sca/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringBeanIntrospector.java
Wed Jul 18 08:14:00 2007
@@ -19,18 +19,16 @@
 package org.apache.tuscany.sca.implementation.spring.xml;
 
 import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Service;
 import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
 import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
 import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
 import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
 import org.apache.tuscany.sca.implementation.java.introspect.DefaultJavaClassIntrospectorExtensionPoint;
 import org.apache.tuscany.sca.implementation.java.introspect.ExtensibleJavaClassIntrospector;
 import org.apache.tuscany.sca.implementation.java.introspect.IntrospectionException;
@@ -39,6 +37,7 @@
 import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
+import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
@@ -52,12 +51,10 @@
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;
 import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
 import org.apache.tuscany.sca.policy.PolicyFactory;
 
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-
 /**
  * Provides introspection functions for Spring beans
  * This version leans heavily on the implementation-java classes
@@ -87,6 +84,7 @@
     	BaseJavaClassVisitor[] extensions = new BaseJavaClassVisitor[] {
                 new ConstructorProcessor(assemblyFactory),
                 new AllowsPassByReferenceProcessor(assemblyFactory),
+                new ComponentNameProcessor(assemblyFactory),
                 new ContextProcessor(assemblyFactory),
                 new ConversationProcessor(assemblyFactory),
                 new DestroyProcessor(assemblyFactory),



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


Mime
View raw message