tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r653107 - in /incubator/tuscany/java/sca/modules: domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/ domain-manager/src/main/resources/ domai...
Date Sat, 03 May 2008 19:14:57 GMT
Author: jsdelfino
Date: Sat May  3 12:14:57 2008
New Revision: 653107

URL: http://svn.apache.org/viewvc?rev=653107&view=rev
Log:
Allow the domain manager launcher to specify the domain configuration root directory. Added
a component to the domain management app to hold that configuration information.

Added:
    incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfiguration.java
  (with props)
    incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfigurationImpl.java
  (with props)
Modified:
    incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
    incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java
    incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java
    incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java
    incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.java
    incubator/tuscany/java/sca/modules/domain-manager/src/main/resources/DomainManager.composite
    incubator/tuscany/java/sca/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java
    incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
    incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
Sat May  3 12:14:57 2008
@@ -88,6 +88,7 @@
 import org.osoa.sca.ServiceRuntimeException;
 import org.osoa.sca.annotations.Init;
 import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
 import org.osoa.sca.annotations.Scope;
 import org.osoa.sca.annotations.Service;
 import org.w3c.dom.Document;
@@ -110,6 +111,9 @@
     @Property
     public String deploymentContributionDirectory;
     
+    @Reference
+    public LauncherConfiguration launcherConfiguration;
+    
     private ExtensionPointRegistry extensionPoints;
     private Monitor monitor;
     private ContributionFactory contributionFactory;
@@ -134,27 +138,26 @@
         MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
         monitor = monitorFactory.createMonitor();
         
-        
         // Create model factories
-        ModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
+        ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
         outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
         outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
         contributionFactory = modelFactories.getFactory(ContributionFactory.class);
         workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
         
         // Create model resolvers
-        ModelResolverExtensionPoint modelResolvers = new DefaultModelResolverExtensionPoint();
+        ModelResolverExtensionPoint modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
 
         // Create artifact processors
         inputFactory = modelFactories.getFactory(XMLInputFactory.class);
-        StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
+        StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
         staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory,
outputFactory);
 
-        URLArtifactProcessorExtensionPoint urlProcessors = new DefaultURLArtifactProcessorExtensionPoint(extensionPoints);
+        URLArtifactProcessorExtensionPoint urlProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
         urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors);
         
         // Create contribution info processor
-        contributionInfoProcessor = new ContributionInfoProcessor(modelFactories, modelResolvers,
urlProcessor);
+        contributionInfoProcessor = urlProcessors.getProcessor("contribution/info");
 
         // Create a document builder (used to pretty print XML)
         documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
@@ -425,8 +428,10 @@
      * @return
      */
     private Workspace readWorkspace() {
+        String rootDirectory = launcherConfiguration.getRootDirectory();
+        
         Workspace workspace;
-        File file = new File(workspaceFile);
+        File file = new File(rootDirectory + "/" + workspaceFile);
         if (file.exists()) {
             try {
                 FileInputStream is = new FileInputStream(file);
@@ -452,7 +457,7 @@
         if (cloudContribution == null) {
             Contribution contribution = contributionFactory.createContribution();
             contribution.setURI(DEPLOYMENT_CONTRIBUTION_URI);
-            File cloudDirectory = new File(deploymentContributionDirectory);
+            File cloudDirectory = new File(rootDirectory + "/" + deploymentContributionDirectory);
             contribution.setLocation(cloudDirectory.toURI().toString());
             workspace.getContributions().add(contribution);
         }
@@ -466,6 +471,8 @@
      */
     private void writeWorkspace(Workspace workspace) {
         try {
+            String rootDirectory = launcherConfiguration.getRootDirectory();
+            
             // First write to a byte stream
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
@@ -478,7 +485,7 @@
             format.setIndent(2);
             
             // Write to workspace.xml
-            FileOutputStream os = new FileOutputStream(new File(workspaceFile));
+            FileOutputStream os = new FileOutputStream(new File(rootDirectory + "/" + workspaceFile));
             XMLSerializer serializer = new XMLSerializer(os, format);
             serializer.serialize(document);
             os.close();

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java
Sat May  3 12:14:57 2008
@@ -108,6 +108,9 @@
     @Reference(required=false)
     public LocalItemCollection processCollection;
 
+    @Reference
+    public LauncherConfiguration launcherConfiguration;
+    
     private ExtensionPointRegistry extensionPoints;
     private ModelFactoryExtensionPoint modelFactories;
     private AssemblyFactory assemblyFactory;
@@ -252,7 +255,9 @@
         // under the deployment composites directory, if that directory is
         // configured on this component
         if (deploymentContributionDirectory != null && item.getContents() != null)
{
-            File directory = new File(deploymentContributionDirectory);
+            String rootDirectory = launcherConfiguration.getRootDirectory();
+            
+            File directory = new File(rootDirectory + "/" + deploymentContributionDirectory);
             if (!directory.exists()) {
                 directory.mkdirs();
             }
@@ -329,7 +334,9 @@
 
         // Delete the file too if it is in the deployment contribution directory
         if (deploymentContributionDirectory != null && contributionURI.equals(DEPLOYMENT_CONTRIBUTION_URI))
{
-            File file = new File(deploymentContributionDirectory, qname.getLocalPart() +
".composite");
+            String rootDirectory = launcherConfiguration.getRootDirectory();
+            
+            File file = new File(rootDirectory + "/" + deploymentContributionDirectory, qname.getLocalPart()
+ ".composite");
             if (file.exists()) {
                 file.delete();
             }
@@ -351,8 +358,10 @@
      * @throws ServiceRuntimeException
      */
     private Composite readCompositeCollection() throws ServiceRuntimeException {
+        String rootDirectory = launcherConfiguration.getRootDirectory();
+        
         Composite compositeCollection;
-        File file = new File(compositeFile);
+        File file = new File(rootDirectory + "/" + compositeFile);
         if (file.exists()) {
             XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
             try {
@@ -383,6 +392,8 @@
      */
     private void writeCompositeCollection(Composite compositeCollection) {
         try {
+            String rootDirectory = launcherConfiguration.getRootDirectory();
+            
             // First write to a byte stream
             ByteArrayOutputStream bos = new ByteArrayOutputStream();
             XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
@@ -395,7 +406,7 @@
             format.setIndent(2);
             
             // Write to domain.composite
-            FileOutputStream os = new FileOutputStream(new File(compositeFile));
+            FileOutputStream os = new FileOutputStream(new File(rootDirectory + "/" + compositeFile));
             XMLSerializer serializer = new XMLSerializer(os, format);
             serializer.serialize(document);
         } catch (Exception e) {

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java
Sat May  3 12:14:57 2008
@@ -31,6 +31,7 @@
 import org.apache.tuscany.sca.implementation.data.collection.NotFoundException;
 import org.osoa.sca.annotations.Init;
 import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
 import org.osoa.sca.annotations.Scope;
 import org.osoa.sca.annotations.Service;
 
@@ -48,6 +49,9 @@
     @Property
     public String directoryName;
 
+    @Reference
+    public LauncherConfiguration launcherConfiguration;
+    
     /**
      * Initialize the component.
      */
@@ -58,9 +62,11 @@
     public Entry<String, Item>[] getAll() {
         logger.fine("getAll");
         
+        String rootDirectory = launcherConfiguration.getRootDirectory();
+        
         // Return all the files
         List<Entry<String, Item>> entries = new ArrayList<Entry<String,
Item>>();
-        File directory = new File(directoryName);
+        File directory = new File(rootDirectory + "/" + directoryName);
         if (directory.exists()) {
             for (File file: directory.listFiles()) {
                 if (file.getName().startsWith(".")) {
@@ -88,7 +94,8 @@
     public void delete(String key) throws NotFoundException {
         logger.fine("delete " + key);
 
-        File directory = new File(directoryName);
+        String rootDirectory = launcherConfiguration.getRootDirectory();
+        File directory = new File(rootDirectory + "/" + directoryName);
         File file = new File(directory, key);
         if (file.exists()) {
             file.delete();

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java
Sat May  3 12:14:57 2008
@@ -41,6 +41,7 @@
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
 import org.osoa.sca.annotations.Init;
 import org.osoa.sca.annotations.Property;
+import org.osoa.sca.annotations.Reference;
 import org.osoa.sca.annotations.Scope;
 import org.osoa.sca.annotations.Service;
 
@@ -59,6 +60,9 @@
     @Property
     public String directoryName;
     
+    @Reference
+    public LauncherConfiguration launcherConfiguration;
+    
     private ServletFileUpload upload;
     
     /**
@@ -73,10 +77,11 @@
     public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException
{
 
         // Upload files
+        String rootDirectory = launcherConfiguration.getRootDirectory();
         try {
             for (FileItem item: (List<FileItem>)upload.parseRequest(request)) {
                 if (!item.isFormField()) {
-                    File directory = new File(directoryName);
+                    File directory = new File(rootDirectory + "/" + directoryName);
                     if (!directory.exists()) {
                         directory.mkdirs();
                     }
@@ -113,7 +118,8 @@
 
                 // If no scheme is specified then the path identifies file
                 // inside our directory
-                uri = new File(directoryName, path).toURI();
+                String rootDirectory = launcherConfiguration.getRootDirectory();
+                uri = new File(rootDirectory + "/" + directoryName, path).toURI();
                 
             } else if (!scheme.equals("file")) {
                 

Added: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfiguration.java?rev=653107&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfiguration.java
(added)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfiguration.java
Sat May  3 12:14:57 2008
@@ -0,0 +1,43 @@
+/*
+ * 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.domain.manager.impl;
+
+/**
+ * Domain manager configuration service interface.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface LauncherConfiguration {
+    
+    /**
+     * Sets the domain manager root directory.
+     * 
+     * @param rootDirectory
+     */
+    void setRootDirectory(String rootDirectory);
+    
+    /**
+     * Returns the domain manager root directory.
+     * 
+     * @return the domain manager root directory
+     */
+    String getRootDirectory();
+
+}

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

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

Propchange: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfigurationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfigurationImpl.java?rev=653107&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfigurationImpl.java
(added)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfigurationImpl.java
Sat May  3 12:14:57 2008
@@ -0,0 +1,43 @@
+/*
+ * 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.domain.manager.impl;
+
+import org.osoa.sca.annotations.Scope;
+import org.osoa.sca.annotations.Service;
+
+/**
+ * Implementation of a domain manager configuration component.
+ *
+ * @version $Rev$ $Date$
+ */
+@Scope("COMPOSITE")
+@Service(LauncherConfiguration.class)
+public class LauncherConfigurationImpl implements LauncherConfiguration {
+
+    private String rootDirectory = ".";
+    
+    public String getRootDirectory() {
+        return rootDirectory;
+    }
+    
+    public void setRootDirectory(String rootDirectory) {
+        this.rootDirectory = rootDirectory;
+    }
+}

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

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

Propchange: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/LauncherConfigurationImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.java?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.java
(original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.java
Sat May  3 12:14:57 2008
@@ -19,6 +19,7 @@
 
 package org.apache.tuscany.sca.domain.manager.launcher;
 
+import org.apache.tuscany.sca.domain.manager.impl.LauncherConfiguration;
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 import org.apache.tuscany.sca.node.SCANode2;
 
@@ -37,8 +38,10 @@
         private ClassLoader threadContextClassLoader;
         private ClassLoader runtimeClassLoader;
         private SCADomain domainManager;
+        private String rootDirectory;
         
-        private NodeFacade() {
+        private NodeFacade(String rootDirectory) {
+            this.rootDirectory = rootDirectory;
             runtimeClassLoader = Thread.currentThread().getContextClassLoader();
         }
         
@@ -48,6 +51,11 @@
             try {
                 Thread.currentThread().setContextClassLoader(runtimeClassLoader);
                 domainManager = SCADomain.newInstance("DomainManager.composite");
+
+                // Set the domain manager's root directory
+                LauncherConfiguration launcherConfiguration = domainManager.getService(LauncherConfiguration.class,
"LauncherConfigurationComponent");
+                launcherConfiguration.setRootDirectory(rootDirectory);
+                
                 started = true;
             } finally {
                 if (!started) {
@@ -69,8 +77,8 @@
     /**
      * Constructs a new domain manager bootstrap.
      */
-    public DomainManagerLauncherBootstrap() throws Exception {
-        node = new NodeFacade();
+    public DomainManagerLauncherBootstrap(String rootDirectory) throws Exception {
+        node = new NodeFacade(rootDirectory);
     }
 
     /**

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/main/resources/DomainManager.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/main/resources/DomainManager.composite?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/main/resources/DomainManager.composite
(original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/main/resources/DomainManager.composite
Sat May  3 12:14:57 2008
@@ -22,7 +22,7 @@
 	targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
     name="DomainManager">
 
-    <component name="AdminUI">
+    <component name="HomeUI">
         <t:implementation.widget location="home.html"/>
         <service name="Widget">
         	<t:binding.http uri="http://localhost:9990/ui/home"/>
@@ -88,6 +88,7 @@
    		<service name="Servlet">
    	 		<t:binding.http uri="http://localhost:9990/contribution"/>
    		</service>
+   		<reference name="launcherConfiguration" target="LauncherConfigurationComponent"/>
     </component>
 
     <component name="FileCollectionComponent">
@@ -96,6 +97,7 @@
    		<service name="ItemCollection">
    	 		<t:binding.atom uri="http://localhost:9990/feed/files" title="Files"/>
    		</service>
+   		<reference name="launcherConfiguration" target="LauncherConfigurationComponent"/>
     </component>
 
     <component name="FileServiceComponent">
@@ -104,6 +106,7 @@
    		<service name="Servlet">
    	 		<t:binding.http uri="http://localhost:9990/files"/>
    		</service>
+   		<reference name="launcherConfiguration" target="LauncherConfigurationComponent"/>
     </component>
 
     <component name="DomainCompositeCollectionComponent">
@@ -116,6 +119,7 @@
    	 		<t:binding.http uri="http://localhost:9990/composite-source"/>
    		</service>
         <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
+   		<reference name="launcherConfiguration" target="LauncherConfigurationComponent"/>
     </component>
 
     <component name="DeployableCompositeCollectionComponent">
@@ -143,6 +147,7 @@
    		</service>
         <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
         <reference name="processCollection" target="NodeProcessCollectionFacadeComponent/LocalItemCollection"/>
+   		<reference name="launcherConfiguration" target="LauncherConfigurationComponent"/>
     </component>
 
     <component name="CompositeConfigurationCollectionComponent">
@@ -190,5 +195,9 @@
    	 		<t:binding.http uri="http://localhost:9990/ping"/>
    		</service>
     </component>
+    
+    <component name="LauncherConfigurationComponent">
+        <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.LauncherConfigurationImpl"/>
+    </component>
 
 </composite>

Modified: incubator/tuscany/java/sca/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java
(original)
+++ incubator/tuscany/java/sca/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java
Sat May  3 12:14:57 2008
@@ -42,6 +42,7 @@
     
     private ContributionCollectionImpl contributionCollection;
     private DeployableCompositeCollectionImpl deployableCollection;
+    private LauncherConfigurationImpl launcherConfiguration;
     
     private final static String WORKSPACE_XML =
         "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
@@ -62,9 +63,14 @@
         writer.close();
         
         // Create a workspace collection component
+        launcherConfiguration = new LauncherConfigurationImpl();
+        String root = url.getFile();
+        root = root.substring(0, root.lastIndexOf('/'));
+        launcherConfiguration.setRootDirectory(root);
         contributionCollection = new ContributionCollectionImpl();
-        contributionCollection.workspaceFile = url.getFile();
+        contributionCollection.workspaceFile = "workspace.xml";
         contributionCollection.deploymentContributionDirectory = "cloud";
+        contributionCollection.launcherConfiguration = launcherConfiguration;
         deployableCollection = new DeployableCompositeCollectionImpl();
         deployableCollection.contributionCollection = contributionCollection;
         contributionCollection.initialize();

Modified: incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
(original)
+++ incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
Sat May  3 12:14:57 2008
@@ -56,7 +56,19 @@
      * @throws LauncherException
      */
     public <T> T createDomainManager() throws LauncherException {
-        return (T)domainManager();
+        return (T)domainManager(".");
+    }
+    
+    /**
+     * Creates a new DomainManager.
+     * 
+     * @param rootDirectory the domain's root configuration directory 
+     * 
+     * @return a new DomainManager
+     * @throws LauncherException
+     */
+    public <T> T createDomainManager(String rootDirectory) throws LauncherException
{
+        return (T)domainManager(rootDirectory);
     }
     
     public static void main(String[] args) throws Exception {

Modified: incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java?rev=653107&r1=653106&r2=653107&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
(original)
+++ incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
Sat May  3 12:14:57 2008
@@ -375,7 +375,7 @@
      * 
      * @throws LauncherException
      */
-    static Object domainManager() throws LauncherException {
+    static Object domainManager(String rootDirectory) throws LauncherException {
         ClassLoader tccl = Thread.currentThread().getContextClassLoader();
         try {
             // Set up runtime ClassLoader
@@ -394,7 +394,8 @@
             } else {
                 bootstrapClass = Class.forName(className);
             }
-            Object bootstrap = bootstrapClass.getConstructor().newInstance();
+            Constructor<?> constructor = bootstrapClass.getConstructor(String.class);
+            Object bootstrap = constructor.newInstance(rootDirectory);
             
             Object domainManager = bootstrapClass.getMethod("getNode").invoke(bootstrap);
             return domainManager;



Mime
View raw message