tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r526364 - in /incubator/tuscany/java/sca/modules: ./ contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ contribution-impl/src/test/java/org/apache/tuscany/services/contribution/ core-spi/src/main/java/org/apache/tusca...
Date Sat, 07 Apr 2007 05:31:35 GMT
Author: rfeng
Date: Fri Apr  6 22:31:34 2007
New Revision: 526364

URL: http://svn.apache.org/viewvc?view=rev&rev=526364
Log:
Bring up the CRUD component type with quite a few hacks :-)

Removed:
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/builder/Connector.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/ConnectorImpl.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/builder/ConnectorImplTestCase.java
Modified:
    incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java
    incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/services/contribution/ContributionServiceImplTestCase.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
    incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java
    incubator/tuscany/java/sca/modules/pom.xml
    incubator/tuscany/java/sca/modules/runtime-embedded/pom.xml
    incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java
    incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java
    incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDComponentBuilder.java
    incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDImpl.java
    incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/services/contribution/ContributionServiceImpl.java
Fri Apr  6 22:31:34 2007
@@ -65,7 +65,7 @@
      * Registry of available artifact processors
      */
 
-    protected ArtifactProcessor artifactProcessor;
+    protected URLArtifactProcessor<?> artifactProcessor;
 
     /**
      * xml factory used to create reader instance to load contribution metadata
@@ -86,7 +86,7 @@
 
     public ContributionServiceImpl(ContributionRepository repository,
                                    ContributionPackageProcessor packageProcessor,
-                                   ArtifactProcessor artifactProcessor,
+                                   URLArtifactProcessor artifactProcessor,
                                    ArtifactResolverRegistry resolverRegistry) {
         super();
         this.contributionRepository = repository;
@@ -256,10 +256,10 @@
             contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
         }
 
-        //processReadPhase(contribution, contributionArtifacts);
-        //processResolvePhase(contribution);
-        //processOptimizationPhase();
-        
+         processReadPhase(contribution, contributionArtifacts);
+        // processResolvePhase(contribution);
+        // processOptimizationPhase();
+
         // store the contribution on the registry
         this.contributionRegistry.put(contribution.getUri(), contribution);
     }
@@ -268,31 +268,32 @@
         MalformedURLException {
         for (URI a : artifacts) {
             URL artifactURL = packageProcessor.getArtifactURL(contribution.getLocation(),
a);
-            Object model = ((URLArtifactProcessor)this.artifactProcessor).read(artifactURL);
+            Object model = this.artifactProcessor.read(artifactURL);
 
             if (model != null) {
                 URI artifactURI = contribution.getUri().resolve(a);
                 DeployedArtifact artifact = new DeployedArtifact(artifactURI);
                 artifact.setLocation(artifactURL);
                 contribution.addArtifact(artifact);
+                artifact.addModelObject(Object.class, "*", model);
             }
         }
     }
-    
-    private void processResolvePhase(Contribution contribution){
-        //for each artifact that was processed on the contribution
-        for(DeployedArtifact artifact : contribution.getArtifacts().values()){
-            //for each model object for the artifact
-            for(Object model : artifact.getModelObjects(Class.class).values()){
-                //resolve it
-                
+
+    private void processResolvePhase(Contribution contribution) {
+        // for each artifact that was processed on the contribution
+        for (DeployedArtifact artifact : contribution.getArtifacts().values()) {
+            // for each model object for the artifact
+            for (Object model : artifact.getModelObjects(Class.class).values()) {
+                // resolve it
+
             }
         }
-        
+
     }
-    
-    private void processOptimizationPhase(){
-        //TODO
+
+    private void processOptimizationPhase() {
+        // TODO
     }
 
 }

Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/services/contribution/ContributionServiceImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/services/contribution/ContributionServiceImplTestCase.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/services/contribution/ContributionServiceImplTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/services/contribution/ContributionServiceImplTestCase.java
Fri Apr  6 22:31:34 2007
@@ -31,6 +31,7 @@
 import org.apache.tuscany.services.spi.contribution.ContributionService;
 import org.apache.tuscany.services.spi.contribution.DefaultURLArtifactProcessorRegistry;
 import org.apache.tuscany.services.spi.contribution.TypeDescriber;
+import org.apache.tuscany.services.spi.contribution.URLArtifactProcessor;
 
 /**
  * This is more intended to be a integration test then a unit test. *
@@ -41,7 +42,7 @@
     
     private TypeDescriber contentTypeDescriber;
     private ContributionPackageProcessorRegistry packageProcessorRegistry;
-    private ArtifactProcessorRegistry artifactProcessorRegistry;
+    private URLArtifactProcessor artifactProcessorRegistry;
     private ContributionService contributionService;
     
     protected void setUp() throws Exception {
@@ -58,7 +59,7 @@
         this.artifactProcessorRegistry = new DefaultURLArtifactProcessorRegistry();
         //new CompositeDocumentProcessor(this.artifactProcessorRegistry);
         
-        this.contributionService = new ContributionServiceImpl(null, this.packageProcessorRegistry,
null, null);
+        this.contributionService = new ContributionServiceImpl(null, this.packageProcessorRegistry,
artifactProcessorRegistry, null);
     }
 
     public void testContributeURL() throws Exception {

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
(original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/Deployer.java
Fri Apr  6 22:31:34 2007
@@ -40,11 +40,9 @@
      * of the component definition is a composite then typically a
      * CompositeComponent would be returned.
      * 
-     * @param parent the parent context
      * @param componentDefinition the component definition as parsed from an
      *            assembly
      * @return the newly deployed component
      */
-    Collection<Component> deploy(Component parent, Composite composite)
-        throws BuilderException, ComponentException, ResolutionException;
+    Collection<Component> deploy(Composite composite) throws BuilderException, ComponentException,
ResolutionException;
 }

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
(original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
Fri Apr  6 22:31:34 2007
@@ -19,8 +19,8 @@
 package org.apache.tuscany.spi.deployer;
 
 import java.net.URI;
-import java.net.URL;
 import java.util.Map;
+
 import javax.xml.stream.XMLInputFactory;
 
 import org.apache.tuscany.spi.component.Component;
@@ -69,32 +69,11 @@
     URI getGroupId();
 
     /**
-     * Returns the location of the SCDL definition being deployed.
-     *
-     * @return the location of the SCDL definition being deployed
-     */
-    URL getScdlLocation();
-
-    /**
      * Returns the URI of the composite component currently being deployed.
      *
      * @return the URI of the composite component currently being deployed
      */
     URI getComponentId();
-
-    /**
-     * Returns true if the autowire is enabled for the current deployment.
-     *
-     * @return true if the autowire is enabled for the current deployment
-     */
-    boolean isAutowire();
-
-    /**
-     * Sets if the autowire is enabled for the current deployment.
-     *
-     * @param autowire true if autowire is enabled
-     */
-    void setAutowire(boolean autowire);
 
     @Deprecated
     Map<URI, Component> getComponents();

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/builder/BuilderRegistryImpl.java
Fri Apr  6 22:31:34 2007
@@ -40,6 +40,7 @@
 import org.apache.tuscany.spi.builder.ComponentBuilder;
 import org.apache.tuscany.spi.builder.ScopeNotFoundException;
 import org.apache.tuscany.spi.component.Component;
+import org.apache.tuscany.spi.component.ComponentManager;
 import org.apache.tuscany.spi.component.Reference;
 import org.apache.tuscany.spi.component.ReferenceBinding;
 import org.apache.tuscany.spi.component.ScopeContainer;
@@ -56,12 +57,12 @@
 @EagerInit
 public class BuilderRegistryImpl implements BuilderRegistry {
     private ScopeRegistry scopeRegistry;
+    private ComponentManager componentManager;
 
     private final Map<Class<? extends Implementation>, ComponentBuilder> componentBuilders
= new HashMap<Class<? extends Implementation>, ComponentBuilder>();
     private final Map<Class<? extends Binding>, BindingBuilder<? extends Binding>>
bindingBuilders = new HashMap<Class<? extends Binding>, BindingBuilder<? extends
Binding>>();
 
-    public BuilderRegistryImpl(@org.osoa.sca.annotations.Reference
-    ScopeRegistry scopeRegistry) {
+    public BuilderRegistryImpl(@org.osoa.sca.annotations.Reference ScopeRegistry scopeRegistry)
{
         this.scopeRegistry = scopeRegistry;
     }
 
@@ -90,7 +91,7 @@
     @SuppressWarnings("unchecked")
     public Component build(org.apache.tuscany.assembly.Component componentDef, DeploymentContext
context)
         throws BuilderException {
-        Class<?> implClass = getImplementationType(componentDef.getImplementation().getClass());
+        Class<? extends Implementation> implClass = getImplementationType(componentDef.getImplementation().getClass());
         // noinspection SuspiciousMethodCalls
         ComponentBuilder componentBuilder = componentBuilders.get(implClass);
         if (componentBuilder == null) {

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
Fri Apr  6 22:31:34 2007
@@ -19,7 +19,6 @@
 package org.apache.tuscany.core.deployer;
 
 import java.net.URI;
-import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -28,53 +27,41 @@
 
 /**
  * Base class for DeploymentContext implementations.
- *
+ * 
  * @version $Rev$ $Date$
  */
 public abstract class AbstractDeploymentContext implements DeploymentContext {
     private final URI componentId;
-    private boolean autowire;
     private final ClassLoader classLoader;
-    private final URL scdlLocation;
     private final Map<URI, Component> components = new HashMap<URI, Component>();
 
     /**
      * Constructor defining properties of this context.
-     *
-     * @param classLoader  the classloader for loading application resources
+     * 
+     * @param classLoader the classloader for loading application resources
      * @param scdlLocation the location of the SCDL defining this composite
-     * @param componentId  the id of the component being deployed
-     * @param autowire     if autowire is enabled
+     * @param componentId the id of the component being deployed
+     * @param autowire if autowire is enabled
      */
-    protected AbstractDeploymentContext(ClassLoader classLoader, URL scdlLocation, URI componentId,
boolean autowire) {
+    protected AbstractDeploymentContext(ClassLoader classLoader, URI componentId) {
         this.classLoader = classLoader;
-        this.scdlLocation = scdlLocation;
         this.componentId = componentId;
-        this.autowire = autowire;
     }
 
     public ClassLoader getClassLoader() {
         return classLoader;
     }
 
-    public URL getScdlLocation() {
-        return scdlLocation;
-    }
-
     public URI getComponentId() {
         return componentId;
     }
 
-    public boolean isAutowire() {
-        return autowire;
-    }
-
-    public void setAutowire(boolean autowire) {
-        this.autowire = autowire;
-    }
-
     @Deprecated
     public Map<URI, Component> getComponents() {
-        return components;
+        if (getParent() != null) {
+            return getParent().getComponents();
+        } else {
+            return components;
+        }
     }
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
Fri Apr  6 22:31:34 2007
@@ -19,7 +19,6 @@
 package org.apache.tuscany.core.deployer;
 
 import java.net.URI;
-import java.net.URL;
 import javax.xml.stream.XMLInputFactory;
 
 import org.apache.tuscany.spi.component.ScopeContainer;
@@ -39,16 +38,12 @@
      *
      * @param parent       the parent of this context
      * @param classLoader  the classloader for loading application resources
-     * @param scdlLocation the location of the SCDL defining this composite
      * @param componentId  the id of the component being deployed
-     * @param autowire     if autowire is enabled
      */
     public ChildDeploymentContext(DeploymentContext parent,
                                   ClassLoader classLoader,
-                                  URL scdlLocation,
-                                  URI componentId,
-                                  boolean autowire) {
-        super(classLoader, scdlLocation, componentId, autowire);
+                                  URI componentId) {
+        super(classLoader, componentId);
         assert parent != null;
         this.parent = parent;
     }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/DeployerImpl.java
Fri Apr  6 22:31:34 2007
@@ -52,9 +52,7 @@
     private ComponentManager componentManager;
     private ScopeRegistry scopeRegistry;
 
-    public DeployerImpl(XMLInputFactory xmlFactory,
-                        Builder builder,
-                        ComponentManager componentManager) {
+    public DeployerImpl(XMLInputFactory xmlFactory, Builder builder, ComponentManager componentManager)
{
         this.xmlFactory = xmlFactory;
         this.builder = builder;
         this.componentManager = componentManager;
@@ -79,20 +77,20 @@
         this.scopeRegistry = scopeRegistry;
     }
 
-    public Collection<Component> deploy(Component parent, Composite composite)
-        throws BuilderException, ResolutionException {
+    public Collection<Component> deploy(Composite composite) throws BuilderException,
ResolutionException {
         @SuppressWarnings("unchecked")
         ScopeContainer<URI> scopeContainer = scopeRegistry.getScopeContainer(Scope.COMPOSITE);
-        URI groupId = parent != null ? parent.getUri() : URI.create("/");
-        DeploymentContext deploymentContext = new RootDeploymentContext(null, null, groupId,
xmlFactory,
-                                                                        scopeContainer, false);
-        
+        URI groupId = URI.create(composite.getName().getLocalPart());
+        URI componentId = URI.create("/");
+        DeploymentContext deploymentContext = new RootDeploymentContext(null, groupId, componentId,
xmlFactory,
+                                                                        scopeContainer);
+
         org.apache.tuscany.assembly.Component componentDef = new DefaultAssemblyFactory().createComponent();
         componentDef.setName(composite.getName().getLocalPart());
         componentDef.setImplementation(composite);
-        
+
         // build runtime artifacts
-        build(parent, componentDef, deploymentContext);
+        build(componentDef, deploymentContext);
 
         Collection<Component> components = deploymentContext.getComponents().values();
         for (Component toRegister : components) {
@@ -113,8 +111,7 @@
      * @param deploymentContext the current deployment context
      * @return the new runtime context
      */
-    protected SCAObject build(Component parent,
-                              org.apache.tuscany.assembly.Component componentDefinition,
+    protected SCAObject build(org.apache.tuscany.assembly.Component componentDefinition,
                               DeploymentContext deploymentContext) throws BuilderException
{
         return builder.build(componentDefinition, deploymentContext);
     }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
Fri Apr  6 22:31:34 2007
@@ -19,7 +19,6 @@
 package org.apache.tuscany.core.deployer;
 
 import java.net.URI;
-import java.net.URL;
 import javax.xml.stream.XMLInputFactory;
 
 import org.apache.tuscany.spi.component.ScopeContainer;
@@ -34,24 +33,23 @@
 public class RootDeploymentContext extends AbstractDeploymentContext {
     private final XMLInputFactory xmlFactory;
     private final ScopeContainer scopeContainer;
+    private URI groupId;
 
     /**
      * Constructor defining properties of this context.
      *
      * @param classLoader    the classloader for loading application resources
-     * @param scdlLocation   the location of the SCDL defining this composite
      * @param componentId    the id of the component being deployed
      * @param xmlFactory     a factory that can be used to obtain an StAX XMLStreamReader
      * @param scopeContainer the scope context representing this deployment's COMPOSITE scope
-     * @param autowire       if autowire is enabled
      */
     public RootDeploymentContext(ClassLoader classLoader,
-                                 URL scdlLocation,
+                                 URI groupId,
                                  URI componentId,
                                  XMLInputFactory xmlFactory,
-                                 ScopeContainer scopeContainer,
-                                 boolean autowire) {
-        super(classLoader, scdlLocation, componentId, autowire);
+                                 ScopeContainer scopeContainer) {
+        super(classLoader, componentId);
+        this.groupId = groupId;
         this.xmlFactory = xmlFactory;
         this.scopeContainer = scopeContainer;
     }
@@ -69,6 +67,6 @@
     }
 
     public URI getGroupId() {
-        return getComponentId();
+        return groupId;
     }
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/implementation/composite/CompositeBuilder.java
Fri Apr  6 22:31:34 2007
@@ -22,26 +22,29 @@
 
 import org.apache.tuscany.assembly.Composite;
 import org.apache.tuscany.core.component.CompositeComponentImpl;
+import org.apache.tuscany.core.deployer.ChildDeploymentContext;
 import org.apache.tuscany.spi.builder.BuilderException;
 import org.apache.tuscany.spi.component.Component;
 import org.apache.tuscany.spi.deployer.DeploymentContext;
 
 /**
  * Instantiates a composite component from an assembly definition
- *
+ * 
  * @version $Rev$ $Date$
  */
 public class CompositeBuilder extends AbstractCompositeBuilder<Composite> {
 
-    public Component build(org.apache.tuscany.assembly.Component definition,
-        DeploymentContext deploymentContext) throws BuilderException {
+    public Component build(org.apache.tuscany.assembly.Component definition, DeploymentContext
context)
+        throws BuilderException {
 
-        Composite composite = (Composite) definition.getImplementation();
-        // FIXME
-        URI name = URI.create(composite.getName().getLocalPart());
+        Composite composite = (Composite)definition.getImplementation();
+        URI id = URI.create(context.getComponentId() + definition.getName() + "/");
+        ChildDeploymentContext childContext = new ChildDeploymentContext(context, context.getClassLoader(),
id);
+
+        URI name = URI.create(context.getComponentId() + definition.getName());
         Component component = new CompositeComponentImpl(name);
 
-        return build(component, composite, deploymentContext);
+        return build(component, composite, childContext);
     }
 
     protected Class<Composite> getImplementationType() {

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/core/runtime/AbstractRuntime.java
Fri Apr  6 22:31:34 2007
@@ -232,8 +232,8 @@
         }
     }
 
-    public ComponentContext getComponentContext(URI componentId) {
-        Component component = componentManager.getComponent(componentId);
+    public ComponentContext getComponentContext(URI componentName) {
+        Component component = componentManager.getComponent(URI.create(tuscanySystem.getUri()
+ "/" + componentName));
         if (component == null) {
             return null;
         }

Modified: incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/core/src/test/java/org/apache/tuscany/core/builder/BuilderRegistryTestCase.java
Fri Apr  6 22:31:34 2007
@@ -150,6 +150,7 @@
         assertEquals(2, reference.getReferenceBindings().size());
     }
 
+    /*
     @SuppressWarnings({"unchecked"})
     public void testNoConversationalContract() throws Exception {
         ScopeRegistry scopeRegistry = EasyMock.createMock(ScopeRegistry.class);
@@ -187,6 +188,7 @@
             // expected
         }
     }
+    */
 
     @SuppressWarnings({"unchecked"})
     protected void setUp() throws Exception {

Modified: incubator/tuscany/java/sca/modules/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/pom.xml?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/pom.xml Fri Apr  6 22:31:34 2007
@@ -46,9 +46,8 @@
                 -->
                 <module>contribution</module>
                 <module>contribution-impl</module>
-                <!--
+                <module>runtime-embedded</module>
                 <module>core</module>
-                -->
                 <module>core-spi</module>
                 <module>core-spring</module>
                 <module>databinding</module>

Modified: incubator/tuscany/java/sca/modules/runtime-embedded/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-embedded/pom.xml?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-embedded/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/runtime-embedded/pom.xml Fri Apr  6 22:31:34 2007
@@ -36,6 +36,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-assembly-xml</artifactId>
+            <version>1.0-incubating-SNAPSHOT</version>
+        </dependency>        
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-contribution-impl</artifactId>
             <version>1.0-incubating-SNAPSHOT</version>
         </dependency>

Modified: incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java
(original)
+++ incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/DefaultSCARuntime.java
Fri Apr  6 22:31:34 2007
@@ -60,7 +60,7 @@
 
     @Override
     protected ComponentContext getContext(String componentName) {
-        return runtime.getComponentContext(URI.create(SimpleRuntimeInfo.DEFAULT_COMPOSITE
+ "/" + componentName));
+        return runtime.getComponentContext(URI.create(componentName));
     }
 
     @Override

Modified: incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/runtime-embedded/src/main/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImpl.java
Fri Apr  6 22:31:34 2007
@@ -145,9 +145,10 @@
 
         // FIXME: Need to getDeployables() as list of Composites
         DeployedArtifact artifact = contribution.getArtifact(URI.create(uri + runtimeInfo.getCompositePath()));
-        Composite composite = (Composite)artifact.getModelObjects(Composite.class).get(0);
+        Composite composite = (Composite)artifact.getModelObjects().values().iterator().next().values().iterator()
+            .next();
 
-        Collection<Component> components = getDeployer().deploy(null, composite);
+        Collection<Component> components = getDeployer().deploy(composite);
         for (Component component : components) {
             component.start();
         }
@@ -156,7 +157,8 @@
         WorkContext workContext = new SimpleWorkContext();
         workContext.setIdentifier(Scope.COMPOSITE, DEFAULT_COMPOSITE);
         PojoWorkContextTunnel.setThreadWorkContext(workContext);
-        return getComponentManager().getComponent(URI.create(composite.getName().getLocalPart()));
+        tuscanySystem = getComponentManager().getComponent(URI.create("/" + composite.getName().getLocalPart()));
+        return tuscanySystem;
     }
 
     @SuppressWarnings("deprecation")

Modified: incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDComponentBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDComponentBuilder.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDComponentBuilder.java
(original)
+++ incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDComponentBuilder.java
Fri Apr  6 22:31:34 2007
@@ -36,7 +36,8 @@
 
     @SuppressWarnings("unchecked")
     public AtomicComponent build(Component definition, DeploymentContext context) throws
BuilderConfigException {
-        CRUDAtomicComponent component = new CRUDAtomicComponent(URI.create(definition.getName()),
context.getGroupId(),
+        URI id = URI.create(context.getComponentId() + definition.getName());
+        CRUDAtomicComponent component = new CRUDAtomicComponent(id, context.getGroupId(),
                                                                 (CRUDImplementation)definition.getImplementation());
         return component;
     }

Modified: incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDImpl.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/container/crud/CRUDImpl.java
Fri Apr  6 22:31:34 2007
@@ -40,20 +40,24 @@
     }
 
     public String create(Object resource) {
+        System.out.println("create(" + resource + ")");
         String key = String.valueOf(counter++);
         STORE.put(key, resource);
         return key;
     }
 
     public void delete(String id) {
+        System.out.println("delete(" + id + ")");
         STORE.remove(id);
     }
 
     public Object retrieve(String id) {
+        System.out.println("retrieve(" + id + ")");
         return STORE.get(id);
     }
 
     public Object update(String id, Object resource) {
+        System.out.println("update(" + id + ")");
         return STORE.put(id, resource);
     }
 

Modified: incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java?view=diff&rev=526364&r1=526363&r2=526364
==============================================================================
--- incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/runtime-embedded/src/test/java/org/apache/tuscany/runtime/embedded/SimpleRuntimeImplTestCase.java
Fri Apr  6 22:31:34 2007
@@ -41,8 +41,7 @@
     }
 
     public void testStart() throws Exception {
-        ComponentContext context = runtime.getComponentContext(URI
-            .create("sca://root.application/default/CRUDServiceComponent"));
+        ComponentContext context = runtime.getComponentContext(URI.create("CRUDServiceComponent"));
         assertNotNull(context);
     }
 



---------------------------------------------------------------------
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