tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r828293 - in /tuscany/java/sca/modules: ./ deployment/ deployment/META-INF/ deployment/src/main/java/org/apache/tuscany/sca/deployment/ deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/ deployment/src/main/java/org/apache/tus...
Date Thu, 22 Oct 2009 03:49:38 GMT
Author: rfeng
Date: Thu Oct 22 03:49:37 2009
New Revision: 828293

URL: http://svn.apache.org/viewvc?rev=828293&view=rev
Log:
Refactor the deployer into tuscany-deployment module

Added:
    tuscany/java/sca/modules/deployment/
      - copied from r828081, tuscany/java/sca/modules/node-impl/
    tuscany/java/sca/modules/deployment/META-INF/MANIFEST.MF
      - copied, changed from r828250, tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/
      - copied from r828248, tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/deployment/
    tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/Contributions.java
      - copied unchanged from r828250, tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/deployment/impl/Contributions.java
    tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
      - copied, changed from r828250, tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
    tuscany/java/sca/modules/deployment/src/main/resources/META-INF/services/org.apache.tuscany.sca.deployment.Deployer
      - copied unchanged from r828250, tuscany/java/sca/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.deployment.Deployer
    tuscany/java/sca/modules/deployment/src/main/resources/org/
      - copied from r828248, tuscany/java/sca/modules/node-impl/src/main/resources/org/
    tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/
    tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/impl/
    tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/impl/deployer-impl-validation-messages.properties
  (with props)
    tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/
    tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorld.java
      - copied, changed from r828081, tuscany/java/sca/modules/node-impl/src/test/java/hello/HelloWorld.java
    tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorldImpl.java
      - copied, changed from r828081, tuscany/java/sca/modules/node-impl/src/test/java/hello/HelloWorldImpl.java
    tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/
    tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/impl/
    tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/impl/DeployerImplTestCase.java
  (with props)
    tuscany/java/sca/modules/deployment/src/test/resources/org/apache/tuscany/sca/deployment/
    tuscany/java/sca/modules/deployment/src/test/resources/org/apache/tuscany/sca/deployment/impl/
    tuscany/java/sca/modules/deployment/src/test/resources/org/apache/tuscany/sca/deployment/impl/HelloWorld.composite
      - copied, changed from r828081, tuscany/java/sca/modules/node-impl/src/test/resources/HelloWorld.composite
Removed:
    tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/node/configuration/xml/
    tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/node/impl/
    tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/node/management/
    tuscany/java/sca/modules/deployment/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    tuscany/java/sca/modules/deployment/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.NodeFactory
    tuscany/java/sca/modules/deployment/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.configuration.NodeConfigurationFactory
    tuscany/java/sca/modules/deployment/src/main/resources/node-impl-validation-messages.properties
    tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/node/
    tuscany/java/sca/modules/deployment/src/test/java/hello/HelloWorld.java
    tuscany/java/sca/modules/deployment/src/test/java/hello/HelloWorldImpl.java
    tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/node/configuration/xml/
    tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/node/impl/
    tuscany/java/sca/modules/deployment/src/test/resources/HelloWorld.composite
    tuscany/java/sca/modules/deployment/src/test/resources/org/apache/tuscany/sca/node/configuration/
    tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java
    tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/deployment/impl/
    tuscany/java/sca/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.deployment.Deployer
Modified:
    tuscany/java/sca/modules/deployment/pom.xml
    tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java
    tuscany/java/sca/modules/deployment/src/test/resources/META-INF/sca-contribution.xml
    tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF
    tuscany/java/sca/modules/node-impl/pom.xml
    tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
    tuscany/java/sca/modules/pom.xml

Copied: tuscany/java/sca/modules/deployment/META-INF/MANIFEST.MF (from r828250, tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/META-INF/MANIFEST.MF?p2=tuscany/java/sca/modules/deployment/META-INF/MANIFEST.MF&p1=tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF&r1=828250&r2=828293&rev=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/deployment/META-INF/MANIFEST.MF Thu Oct 22 03:49:37 2009
@@ -18,10 +18,9 @@
    javax.xml.stream,
    org.apache.tuscany.sca.contribution.resolver,
    org.apache.tuscany.sca.contribution.processor,
-   org.apache.tuscany.sca.assembly.builder",
- org.apache.tuscany.sca.node.impl;version="2.0.0"
+   org.apache.tuscany.sca.assembly.builder"
 Tool: Bnd-0.0.255
-Bundle-Name: Apache Tuscany SCA Node Implementation
+Bundle-Name: Apache Tuscany SCA Deployment
 Created-By: 1.6.0_07 (Sun Microsystems Inc.)
 Bundle-Vendor: The Apache Software Foundation
 Bundle-Version: 2.0.0
@@ -29,34 +28,22 @@
 Bundle-ManifestVersion: 2
 Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
 Bundle-Description: Apache Tuscany SCA Node Implementation
-Import-Package: javax.management;resolution:=optional,
- javax.xml.namespace,
+Import-Package: javax.xml.namespace,
  javax.xml.stream,
  org.apache.tuscany.sca.assembly;version="2.0.0",
  org.apache.tuscany.sca.assembly.builder;version="2.0.0",
  org.apache.tuscany.sca.common.java.io;version="2.0.0",
  org.apache.tuscany.sca.common.xml.stax;version="2.0.0",
- org.apache.tuscany.sca.context;version="2.0.0",
  org.apache.tuscany.sca.contribution;version="2.0.0",
  org.apache.tuscany.sca.contribution.processor;version="2.0.0",
  org.apache.tuscany.sca.contribution.resolver;version="2.0.0",
  org.apache.tuscany.sca.core;version="2.0.0",
- org.apache.tuscany.sca.core.assembly;version="2.0.0",
- org.apache.tuscany.sca.core.invocation;version="2.0.0",
  org.apache.tuscany.sca.definitions;version="2.0.0",
  org.apache.tuscany.sca.definitions.util;version="2.0.0",
  org.apache.tuscany.sca.definitions.xml;version="2.0.0",
  org.apache.tuscany.sca.deployment;version="2.0.0",
- org.apache.tuscany.sca.extensibility;version="2.0.0",
- org.apache.tuscany.sca.management;version="2.0.0",
  org.apache.tuscany.sca.monitor;version="2.0.0",
- org.apache.tuscany.sca.node;version="2.0.0",
- org.apache.tuscany.sca.node.configuration;version="2.0.0",
- org.apache.tuscany.sca.node.impl;version="2.0.0",
- org.apache.tuscany.sca.runtime;version="2.0.0",
- org.apache.tuscany.sca.work;version="2.0.0",
- org.oasisopen.sca;version="2.0.0",
  org.oasisopen.sca.annotation;version="2.0.0";resolution:=optional
-Bundle-SymbolicName: org.apache.tuscany.sca.node.impl
+Bundle-SymbolicName: org.apache.tuscany.sca.deployment
 Bundle-DocURL: http://www.apache.org/
 Bundle-RequiredExecutionEnvironment: J2SE-1.5,JavaSE-1.6

Modified: tuscany/java/sca/modules/deployment/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/pom.xml?rev=828293&r1=828081&r2=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/deployment/pom.xml (original)
+++ tuscany/java/sca/modules/deployment/pom.xml Thu Oct 22 03:49:37 2009
@@ -27,8 +27,8 @@
         <relativePath>../pom.xml</relativePath>
     </parent>
 
-    <artifactId>tuscany-node-impl</artifactId>
-    <name>Apache Tuscany SCA Node Implementation</name>
+    <artifactId>tuscany-deployment</artifactId>
+    <name>Apache Tuscany SCA Deployment</name>
 
     <dependencies>
  
@@ -46,18 +46,6 @@
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-node-api</artifactId>
-            <version>2.0-SNAPSHOT</version>
-        </dependency>          
-        
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-core</artifactId>
-            <version>2.0-SNAPSHOT</version>
-        </dependency>
-        
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-assembly-xml</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>
@@ -71,28 +59,14 @@
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-binding-sca-runtime</artifactId>
-            <version>2.0-SNAPSHOT</version>
-            <scope>runtime</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-core-databinding</artifactId>
-            <version>2.0-SNAPSHOT</version>
-            <scope>runtime</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.tuscany.sca</groupId>
             <artifactId>tuscany-assembly-xsd</artifactId>
             <version>2.0-SNAPSHOT</version>
-            <scope>runtime</scope>
+            <scope>test</scope>
         </dependency>
                
        <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <artifactId>tuscany-implementation-java</artifactId>
             <version>2.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>  

Modified: tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java?rev=828293&r1=828248&r2=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java
(original)
+++ tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/Deployer.java
Thu Oct 22 03:49:37 2009
@@ -68,6 +68,8 @@
     Composite build(List<Contribution> contributions, Map<QName, List<String>>
bindingBaseURIs, Monitor monitor)
         throws ContributionResolveException, CompositeBuilderException;
 
+    Monitor createMonitor();
+    
     /**
      * Create an instance of {@link BuilderContext}
      * @return

Copied: tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
(from r828250, tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java?p2=tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java&p1=tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java&r1=828250&r2=828293&rev=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
(original)
+++ tuscany/java/sca/modules/deployment/src/main/java/org/apache/tuscany/sca/deployment/impl/DeployerImpl.java
Thu Oct 22 03:49:37 2009
@@ -19,8 +19,6 @@
 
 package org.apache.tuscany.sca.deployment.impl;
 
-import static java.lang.System.currentTimeMillis;
-
 import java.io.Reader;
 import java.io.Writer;
 import java.net.URI;
@@ -31,7 +29,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
@@ -102,8 +99,8 @@
 
     protected MonitorFactory monitorFactory;
 
-    protected static final String NODE_IMPL_VALIDATION_MESSAGES =
-        "org.apache.tuscany.sca.node.impl.node-impl-validation-messages";
+    protected static final String DEPLOYER_IMPL_VALIDATION_MESSAGES =
+        "org.apache.tuscany.sca.deployment.impl.deployer-impl-validation-messages";
 
     /**
      * @param registry
@@ -112,7 +109,12 @@
         super();
         this.registry = registry;
     }
-    
+
+    public Monitor createMonitor() {
+        init();
+        return monitorFactory.createMonitor();
+    }
+
     public synchronized void stop() {
         if (inited) {
             staxHelper = null;
@@ -135,10 +137,10 @@
      * Analyze a contribution and add its dependencies to the given dependency set.
      */
     protected void addContributionDependencies(Contribution contribution,
-                                             List<Contribution> contributions,
-                                             List<Contribution> dependencies,
-                                             Set<Contribution> set,
-                                             Monitor monitor) {
+                                               List<Contribution> contributions,
+                                               List<Contribution> dependencies,
+                                               Set<Contribution> set,
+                                               Monitor monitor) {
 
         // Go through the contribution imports
         for (Import import_ : contribution.getImports()) {
@@ -180,7 +182,7 @@
                 if (!(import_ instanceof DefaultImport)) {
                     // Add the (empty) matchingExports List and report a warning
                     import_.setModelResolver(new DefaultImportModelResolver(matchingExports));
-                    Monitor.error(monitor, this, NODE_IMPL_VALIDATION_MESSAGES, "UnresolvedImport",
import_);
+                    Monitor.error(monitor, this, DEPLOYER_IMPL_VALIDATION_MESSAGES, "UnresolvedImport",
import_);
                 }
             } // end if
         }
@@ -208,8 +210,8 @@
      * @throws ContributionResolveException
      */
     protected void contributionsPreresolve(List<Contribution> contributions,
-                                         ModelResolver resolver,
-                                         ProcessorContext context) throws ContributionResolveException
{
+                                           ModelResolver resolver,
+                                           ProcessorContext context) throws ContributionResolveException
{
 
         for (Contribution contribution : contributions) {
             contributionProcessor.preResolve(contribution, resolver, context);
@@ -219,17 +221,19 @@
     public ExtensionPointRegistry getExtensionPointRegistry() {
         return registry;
     }
+
+    public void start() {
+        // Defer to the init() method
+    }
     
-    public synchronized void start() {
+    public synchronized void init() {
         if (inited) {
             return;
         }
-        long start = currentTimeMillis();
 
         // Enable schema validation only of the logger level is FINE or higher
         if (isSchemaValidationEnabled()) {
-            ValidationSchemaExtensionPoint schemas =
-                registry.getExtensionPoint(ValidationSchemaExtensionPoint.class);
+            ValidationSchemaExtensionPoint schemas = registry.getExtensionPoint(ValidationSchemaExtensionPoint.class);
             if (schemas != null) {
                 schemas.setEnabled(true);
             }
@@ -259,7 +263,7 @@
         URLArtifactProcessorExtensionPoint docProcessorExtensions =
             registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
         artifactProcessor = new ExtensibleURLArtifactProcessor(docProcessorExtensions);
-        
+
         contributionProcessor =
             (ExtendedURLArtifactProcessor<Contribution>)docProcessorExtensions.getProcessor(Contribution.class);
 
@@ -275,10 +279,6 @@
 
         inited = true;
 
-        if (logger.isLoggable(Level.FINE)) {
-            long end = currentTimeMillis();
-            logger.fine("The tuscany runtime started in " + (end - start) + " ms.");
-        }
     }
 
     protected void loadSystemContribution(Monitor monitor) {
@@ -314,9 +314,9 @@
         artifact.setModel(systemDefinitions);
         artifacts.add(artifact);
     }
-    
+
     protected Contribution cloneSystemContribution(Monitor monitor) {
-        start();
+        init();
         Contribution contribution = contributionFactory.createContribution();
         contribution.setURI(systemContribution.getURI());
         contribution.setLocation(systemContribution.getLocation());
@@ -339,7 +339,7 @@
     }
 
     public void attachDeploymentComposite(Contribution contribution, Composite composite,
boolean appending) {
-        start();
+        init();
         // Create an artifact for the deployment composite
         Artifact artifact = contributionFactory.createArtifact();
         String uri = composite.getName().getLocalPart() + ".composite";
@@ -359,8 +359,11 @@
         contribution.getDeployables().add(composite);
     }
 
-    public Composite build(List<Contribution> contributions, Map<QName, List<String>>
bindingMap, Monitor monitor) throws ContributionResolveException, CompositeBuilderException
{
-        start();
+    public Composite build(List<Contribution> contributions, Map<QName, List<String>>
bindingMap, Monitor monitor)
+        throws ContributionResolveException, CompositeBuilderException {
+        init();
+        List<Contribution> contributionList = new ArrayList<Contribution>(contributions);
+        
         Contribution systemContribution = cloneSystemContribution(monitor);
         Definitions systemDefinitions = systemContribution.getArtifacts().get(0).getModel();
         // Build an aggregated SCA definitions model. Must be done before we try and
@@ -372,7 +375,7 @@
         // each contribution so that for unresolved items the resolution
         // processing will look in the system contribution
         ProcessorContext context = new ProcessorContext(monitor);
-        for (Contribution contribution : contributions) {
+        for (Contribution contribution : contributionList) {
             monitor.pushContext("Contribution: " + contribution.getURI());
             try {
                 // aggregate definitions
@@ -401,19 +404,19 @@
         }
 
         ExtensibleModelResolver modelResolver =
-            new ExtensibleModelResolver(new Contributions(contributions), modelResolvers,
modelFactories);
+            new ExtensibleModelResolver(new Contributions(contributionList), modelResolvers,
modelFactories);
 
         // now resolve and add the system contribution
         contributionProcessor.resolve(systemContribution, modelResolver, context);
-        contributions.add(systemContribution);
+        contributionList.add(systemContribution);
 
         // pre-resolve the contributions
-        contributionsPreresolve(contributions, modelResolver, context);
+        contributionsPreresolve(contributionList, modelResolver, context);
 
         // Build the contribution dependencies
         Set<Contribution> resolved = new HashSet<Contribution>();
-        for (Contribution contribution : contributions) {
-            buildDependencies(contribution, contributions, monitor);
+        for (Contribution contribution : contributionList) {
+            buildDependencies(contribution, contributionList, monitor);
 
             // Resolve contributions
             for (Contribution dependency : contribution.getDependencies()) {
@@ -430,7 +433,7 @@
         domainComposite.setName(Composite.DOMAIN_COMPOSITE);
         domainComposite.setURI(Base.SCA11_NS);
 
-        for (Contribution contribution : contributions) {
+        for (Contribution contribution : contributionList) {
             for (Composite composite : contribution.getDeployables()) {
                 // Include the node composite in the top-level composite
                 domainComposite.getIncludes().add(composite);
@@ -446,7 +449,7 @@
     }
 
     public Artifact loadArtifact(URI uri, URL location, Monitor monitor) throws ContributionReadException
{
-        start();
+        init();
         Artifact artifact = contributionFactory.createArtifact();
         artifact.setLocation(location.toString());
         artifact.setURI(uri.toString());
@@ -457,16 +460,16 @@
         artifact.setModel(model);
         return artifact;
     }
-    
+
     @SuppressWarnings("unchecked")
     public <T> T loadDocument(URI uri, URL location, Monitor monitor) throws ContributionReadException
{
-        start();
+        init();
         Object model = artifactProcessor.read(null, uri, location, new ProcessorContext(monitor));
-        return (T) model;
+        return (T)model;
     }
 
     public <T> T loadXMLDocument(URL document, Monitor monitor) throws XMLStreamException,
ContributionReadException {
-        start();
+        init();
         XMLStreamReader reader = staxHelper.createXMLStreamReader(document);
         reader.nextTag();
         ValidatingXMLInputFactory.setMonitor(reader, monitor);
@@ -476,29 +479,29 @@
             reader.close();
         }
     }
-    
+
     public void saveXMLDocument(Object model, Writer writer, Monitor monitor) throws XMLStreamException,
         ContributionWriteException {
-        start();
+        init();
         XMLStreamWriter streamWriter = staxHelper.createXMLStreamWriter(writer);
         staxProcessor.write(model, streamWriter, new ProcessorContext(monitor));
     }
 
-    public void saveXMLElement(Object model, XMLStreamWriter writer, Monitor monitor)
-        throws XMLStreamException, ContributionWriteException {
-        start();
+    public void saveXMLElement(Object model, XMLStreamWriter writer, Monitor monitor) throws
XMLStreamException,
+        ContributionWriteException {
+        init();
         staxProcessor.write(model, writer, new ProcessorContext(monitor));
     }
 
     @SuppressWarnings("unchecked")
     public <T> T loadXMLElement(XMLStreamReader reader, Monitor monitor) throws ContributionReadException,
         XMLStreamException {
-        start();
+        init();
         return (T)staxProcessor.read(reader, new ProcessorContext(monitor));
     }
-    
+
     public <T> T loadXMLDocument(Reader document, Monitor monitor) throws XMLStreamException,
ContributionReadException {
-        start();
+        init();
         XMLStreamReader reader = staxHelper.createXMLStreamReader(document);
         ValidatingXMLInputFactory.setMonitor(reader, monitor);
         reader.nextTag();
@@ -510,20 +513,20 @@
     }
 
     public Contribution loadContribution(URI uri, URL location, Monitor monitor) throws ContributionReadException
{
-        start();
+        init();
         ProcessorContext context = new ProcessorContext(monitor);
         // Load the contribution
         Contribution contribution = contributionProcessor.read(null, uri, location, context);
         return contribution;
     }
-    
+
     public ProcessorContext createProcessorContext() {
-        start();
+        init();
         return new ProcessorContext(monitorFactory.createMonitor());
     }
-    
+
     public BuilderContext createBuilderContext() {
-        start();
+        init();
         return new BuilderContext(monitorFactory.createMonitor());
     }
 

Added: tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/impl/deployer-impl-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/impl/deployer-impl-validation-messages.properties?rev=828293&view=auto
==============================================================================
--- tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/impl/deployer-impl-validation-messages.properties
(added)
+++ tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/impl/deployer-impl-validation-messages.properties
Thu Oct 22 03:49:37 2009
@@ -0,0 +1,22 @@
+#
+#
+#    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.
+#
+#
+
+UnresolvedImport = Unresolved import: Import = {0}

Propchange: tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/impl/deployer-impl-validation-messages.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/deployment/src/main/resources/org/apache/tuscany/sca/deployment/impl/deployer-impl-validation-messages.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorld.java (from
r828081, tuscany/java/sca/modules/node-impl/src/test/java/hello/HelloWorld.java)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorld.java?p2=tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorld.java&p1=tuscany/java/sca/modules/node-impl/src/test/java/hello/HelloWorld.java&r1=828081&r2=828293&rev=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/src/test/java/hello/HelloWorld.java (original)
+++ tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorld.java Thu Oct
22 03:49:37 2009
@@ -17,7 +17,7 @@
  * under the License.    
  */
 
-package hello;
+package hello.deployer;
 
 import org.oasisopen.sca.annotation.Remotable;
 

Copied: tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorldImpl.java
(from r828081, tuscany/java/sca/modules/node-impl/src/test/java/hello/HelloWorldImpl.java)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorldImpl.java?p2=tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorldImpl.java&p1=tuscany/java/sca/modules/node-impl/src/test/java/hello/HelloWorldImpl.java&r1=828081&r2=828293&rev=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/src/test/java/hello/HelloWorldImpl.java (original)
+++ tuscany/java/sca/modules/deployment/src/test/java/hello/deployer/HelloWorldImpl.java Thu
Oct 22 03:49:37 2009
@@ -17,7 +17,7 @@
  * under the License.    
  */
 
-package hello;
+package hello.deployer;
 
 /**
  * HelloWorldImpl

Added: tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/impl/DeployerImplTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/impl/DeployerImplTestCase.java?rev=828293&view=auto
==============================================================================
--- tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/impl/DeployerImplTestCase.java
(added)
+++ tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/impl/DeployerImplTestCase.java
Thu Oct 22 03:49:37 2009
@@ -0,0 +1,135 @@
+/*
+ * 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.deployment.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Arrays;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.contribution.Artifact;
+import org.apache.tuscany.sca.contribution.Contribution;
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.deployment.Deployer;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class DeployerImplTestCase {
+    private static ExtensionPointRegistry registry;
+    private static Deployer deployer;
+
+    private static URL contributionURL;
+    private static URL compositeURL;
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception {
+        compositeURL = DeployerImplTestCase.class.getResource("HelloWorld.composite");
+        contributionURL = new URL(compositeURL, "../");
+        registry = new DefaultExtensionPointRegistry();
+        deployer = new DeployerImpl(registry);
+        deployer.start();
+    }
+
+    /**
+     * @throws java.lang.Exception
+     */
+    @AfterClass
+    public static void tearDownAfterClass() throws Exception {
+        deployer.stop();
+    }
+
+    /**
+     * Test method for {@link org.apache.tuscany.sca.deployment.impl.DeployerImpl#build(java.util.List,
java.util.Map, org.apache.tuscany.sca.monitor.Monitor)}.
+     */
+    @Test
+    public void testBuild() throws Exception {
+        Monitor monitor = deployer.createMonitor();
+        Contribution contribution = deployer.loadContribution(contributionURL.toURI(), contributionURL,
monitor);
+        Composite composite = deployer.build(Arrays.asList(contribution), null, monitor);
+        assertTrue(composite != null);
+    }
+
+    /**
+     * Test method for {@link org.apache.tuscany.sca.deployment.impl.DeployerImpl#loadArtifact(java.net.URI,
java.net.URL, org.apache.tuscany.sca.monitor.Monitor)}.
+     */
+    @Test
+    public void testLoadArtifact() throws Exception {
+        Monitor monitor = deployer.createMonitor();
+        Artifact artifact = deployer.loadArtifact(compositeURL.toURI(), compositeURL, monitor);
+        assertTrue(artifact.getModel() instanceof Composite);
+        Composite composite = artifact.getModel();
+        assertEquals(composite.getName(), new QName("http://sample/composite", "HelloWorld1"));
+    }
+
+    /**
+     * Test method for {@link org.apache.tuscany.sca.deployment.impl.DeployerImpl#loadDocument(java.net.URI,
java.net.URL, org.apache.tuscany.sca.monitor.Monitor)}.
+     */
+    @Test
+    public void testLoadDocument() throws Exception {
+        Monitor monitor = deployer.createMonitor();
+        Composite composite = deployer.loadDocument(compositeURL.toURI(), compositeURL, monitor);
+        assertEquals(composite.getName(), new QName("http://sample/composite", "HelloWorld1"));
+    }
+
+    /**
+     * Test method for {@link org.apache.tuscany.sca.deployment.impl.DeployerImpl#loadXMLDocument(java.net.URL,
org.apache.tuscany.sca.monitor.Monitor)}.
+     */
+    @Test
+    public void testLoadXMLDocumentURLMonitor() throws Exception {
+        Monitor monitor = deployer.createMonitor();
+        Composite composite = deployer.loadXMLDocument(compositeURL, monitor);
+        assertEquals(composite.getName(), new QName("http://sample/composite", "HelloWorld1"));
+        Writer sw = new StringWriter();
+        deployer.saveXMLDocument(composite, sw, monitor);
+        assertTrue(sw.toString() != null);
+    }
+
+    /**
+     * Test method for {@link org.apache.tuscany.sca.deployment.impl.DeployerImpl#loadContribution(java.net.URI,
java.net.URL, org.apache.tuscany.sca.monitor.Monitor)}.
+     * @throws URISyntaxException 
+     * @throws ContributionReadException 
+     */
+    @Test
+    public void testLoadContribution() throws Exception {
+        Monitor monitor = deployer.createMonitor();
+        Contribution contribution = deployer.loadContribution(contributionURL.toURI(), contributionURL,
monitor);
+        Composite composite = contribution.getDeployables().get(0);
+        assertEquals(composite.getName(), new QName("http://sample/composite", "HelloWorld1"));
+        assertTrue(contribution.getArtifacts().size() >= 2);
+    }
+
+}

Propchange: tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/impl/DeployerImplTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/java/sca/modules/deployment/src/test/java/org/apache/tuscany/sca/deployment/impl/DeployerImplTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/java/sca/modules/deployment/src/test/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/src/test/resources/META-INF/sca-contribution.xml?rev=828293&r1=828081&r2=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/deployment/src/test/resources/META-INF/sca-contribution.xml (original)
+++ tuscany/java/sca/modules/deployment/src/test/resources/META-INF/sca-contribution.xml Thu
Oct 22 03:49:37 2009
@@ -20,5 +20,5 @@
 
 <contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" 
               xmlns:sc="http://sample/composite">
-    <deployable composite="sc:HelloWorld" />
+    <deployable composite="sc:HelloWorld1" />
 </contribution>

Copied: tuscany/java/sca/modules/deployment/src/test/resources/org/apache/tuscany/sca/deployment/impl/HelloWorld.composite
(from r828081, tuscany/java/sca/modules/node-impl/src/test/resources/HelloWorld.composite)
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/deployment/src/test/resources/org/apache/tuscany/sca/deployment/impl/HelloWorld.composite?p2=tuscany/java/sca/modules/deployment/src/test/resources/org/apache/tuscany/sca/deployment/impl/HelloWorld.composite&p1=tuscany/java/sca/modules/node-impl/src/test/resources/HelloWorld.composite&r1=828081&r2=828293&rev=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/src/test/resources/HelloWorld.composite (original)
+++ tuscany/java/sca/modules/deployment/src/test/resources/org/apache/tuscany/sca/deployment/impl/HelloWorld.composite
Thu Oct 22 03:49:37 2009
@@ -20,11 +20,10 @@
 <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903"
     xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
 	targetNamespace="http://sample/composite"
-	xmlns:sc="http://sample/composite"
-	name="HelloWorld">
+	name="HelloWorld1">
 
-    <component name="HelloWorld">
-        <implementation.java class="hello.HelloWorldImpl"/>
+    <component name="HelloWorld1">
+        <implementation.java class="hello.deployer.HelloWorldImpl"/>
     </component>
 
 </composite>

Modified: tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF?rev=828293&r1=828292&r2=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF (original)
+++ tuscany/java/sca/modules/node-impl/META-INF/MANIFEST.MF Thu Oct 22 03:49:37 2009
@@ -1,25 +1,5 @@
 Manifest-Version: 1.0
-Export-Package: org.apache.tuscany.sca.deployment;version="2.0.0";
-  uses:="javax.xml.stream,
-   org.apache.tuscany.sca.assembly,
-   org.apache.tuscany.sca.contribution.processor,
-   org.apache.tuscany.sca.core,
-   org.apache.tuscany.sca.contribution,
-   org.apache.tuscany.sca.monitor,
-   org.apache.tuscany.sca.assembly.builder",
- org.apache.tuscany.sca.deployment.impl;version="2.0.0";
-  uses:="org.apache.tuscany.sca.assembly,
-   org.apache.tuscany.sca.definitions,
-   org.apache.tuscany.sca.common.xml.stax,
-   org.apache.tuscany.sca.contribution,
-   org.apache.tuscany.sca.core,
-   org.apache.tuscany.sca.deployment,
-   org.apache.tuscany.sca.monitor,
-   javax.xml.stream,
-   org.apache.tuscany.sca.contribution.resolver,
-   org.apache.tuscany.sca.contribution.processor,
-   org.apache.tuscany.sca.assembly.builder",
- org.apache.tuscany.sca.node.impl;version="2.0.0"
+Export-Package: org.apache.tuscany.sca.node.impl;version="2.0.0"
 Tool: Bnd-0.0.255
 Bundle-Name: Apache Tuscany SCA Node Implementation
 Created-By: 1.6.0_07 (Sun Microsystems Inc.)

Modified: tuscany/java/sca/modules/node-impl/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl/pom.xml?rev=828293&r1=828292&r2=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/pom.xml (original)
+++ tuscany/java/sca/modules/node-impl/pom.xml Thu Oct 22 03:49:37 2009
@@ -61,6 +61,12 @@
             <artifactId>tuscany-assembly-xml</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-deployment</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>

Modified: tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java?rev=828293&r1=828292&r2=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
(original)
+++ tuscany/java/sca/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
Thu Oct 22 03:49:37 2009
@@ -61,7 +61,6 @@
 import org.apache.tuscany.sca.core.invocation.ProxyFactory;
 import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
 import org.apache.tuscany.sca.deployment.Deployer;
-import org.apache.tuscany.sca.deployment.impl.DeployerImpl;
 import org.apache.tuscany.sca.monitor.Monitor;
 import org.apache.tuscany.sca.monitor.MonitorFactory;
 import org.apache.tuscany.sca.monitor.Problem;
@@ -215,16 +214,14 @@
         AssemblyFactory assemblyFactory = new RuntimeAssemblyFactory(registry);
         modelFactories.addFactory(assemblyFactory);
 
-        deployer = new DeployerImpl(registry);
+        UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
+        monitorFactory = utilities.getUtility(MonitorFactory.class);
+        
+        // Load the Deployer
+        deployer = utilities.getUtility(Deployer.class);
 
         // Enable schema validation only of the logger level is FINE or higher
         deployer.setSchemaValidationEnabled(isSchemaValidationEnabled());
-        deployer.start();
-
-        // Create a monitor
-        UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
-
-        monitorFactory = utilities.getUtility(MonitorFactory.class);
 
         // Initialize the Tuscany module activators
         // The module activators will be started

Modified: tuscany/java/sca/modules/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/pom.xml?rev=828293&r1=828292&r2=828293&view=diff
==============================================================================
--- tuscany/java/sca/modules/pom.xml (original)
+++ tuscany/java/sca/modules/pom.xml Thu Oct 22 03:49:37 2009
@@ -66,6 +66,7 @@
         <module>databinding-jaxb</module>
         <module>databinding-jaxb-axiom</module>
         <module>databinding-json</module>
+        <module>deployment</module>
         <module>domain-node</module>
         <module>endpoint-tribes</module>
         <module>extensibility</module>



Mime
View raw message