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

svn commit: r513144 - in /incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core: implementation/processor/ContextProcessor.java injection/CompositeContextObjectFactory.java

Author: jsdelfino
Date: Wed Feb 28 21:09:29 2007
New Revision: 513144

URL: http://svn.apache.org/viewvc?view=rev&rev=513144
Log:
Added CompositeContextObjectFactory from the pre-spec-changes branch, this is temporary until ComponentContext is supported in all scenarios.

Added:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java   (with props)
Modified:
    incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java

Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java?view=diff&rev=513144&r1=513143&r2=513144
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/processor/ContextProcessor.java Wed Feb 28 21:09:29 2007
@@ -21,6 +21,7 @@
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 
+import org.osoa.sca.CompositeContext;
 import org.osoa.sca.RequestContext;
 import org.osoa.sca.ComponentContext;
 import org.osoa.sca.annotations.Context;
@@ -38,6 +39,7 @@
 import org.apache.tuscany.spi.implementation.java.Resource;
 import org.apache.tuscany.spi.wire.WireService;
 
+import org.apache.tuscany.core.injection.CompositeContextObjectFactory;
 import org.apache.tuscany.core.injection.RequestContextObjectFactory;
 import org.apache.tuscany.core.util.JavaIntrospectionHelper;
 
@@ -116,6 +118,13 @@
             resource.setObjectFactory(new CompositeContextObjectFactory(parent, wireService));
             type.getResources().put(name, resource);
 */
+        } else if (CompositeContext.class.equals(paramType)) {
+            String name = field.getName();
+            Resource resource = new Resource();
+            resource.setName(name);
+            resource.setMember(field);
+            resource.setObjectFactory(new CompositeContextObjectFactory(parent, wireService));
+            type.getResources().put(name, resource);
         } else if (RequestContext.class.equals(paramType)) {
             String name = field.getName();
             name = JavaIntrospectionHelper.toPropertyName(name);

Added: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java?view=auto&rev=513144
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java Wed Feb 28 21:09:29 2007
@@ -0,0 +1,48 @@
+/*
+ * 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.injection;
+
+import org.apache.tuscany.core.launcher.CompositeContextImpl;
+import org.apache.tuscany.spi.ObjectCreationException;
+import org.apache.tuscany.spi.ObjectFactory;
+import org.apache.tuscany.spi.component.CompositeComponent;
+import org.apache.tuscany.spi.wire.WireService;
+import org.osoa.sca.CompositeContext;
+
+/**
+ * Creates instances of {@link org.apache.tuscany.core.implementation.composite.ManagedCompositeContext} for injection
+ * on component implementation instances
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeContextObjectFactory implements ObjectFactory<CompositeContext> {
+    private CompositeComponent composite;
+    private WireService wireService;
+
+    public CompositeContextObjectFactory(CompositeComponent composite, WireService wireService) {
+        assert composite != null;
+        assert wireService != null;
+        this.composite = composite;
+        this.wireService = wireService;
+    }
+
+    public CompositeContext getInstance() throws ObjectCreationException {
+        return new CompositeContextImpl(composite, wireService);
+    }
+}

Propchange: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/injection/CompositeContextObjectFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



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


Re: svn commit: r513144

Posted by Jim Marino <jm...@myromatours.com>.
On Feb 28, 2007, at 9:09 PM, jsdelfino@apache.org wrote:
> Added CompositeContextObjectFactory from the pre-spec-changes  
> branch, this is temporary until ComponentContext is supported in  
> all scenarios.
>
Sebastien,

Do you have any plans to integrate upgrade the integration branch  
with a later revision of trunk? It seems effort is being duplicated  
and the integration branch kernel is diverging from trunk, which  
already supports ComponentContext injection.

Jim

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