Author: jboynes
Date: Thu Jul 20 10:16:04 2006
New Revision: 423992

URL: http://svn.apache.org/viewvc?rev=423992&view=rev
Log:
add extension properties to DeploymentContext

Added:
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
   (with props)
Modified:
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
    
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
    
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java

Added: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java?rev=423992&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
 (added)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
 Thu Jul 20 10:16:04 2006
@@ -0,0 +1,59 @@
+/*
+ *
+ * Copyright 2006 The Apache Software Foundation or its licensors as applicable
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.tuscany.core.deployer;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.spi.deployer.DeploymentContext;
+
+/**
+ * Base class for DeploymentContext implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class AbstractDeploymentContext implements DeploymentContext {
+    private final ClassLoader classLoader;
+    private final URL scdlLocation;
+    private final Map<String, Object> properties = new HashMap<String, 
Object>();
+
+    protected AbstractDeploymentContext(ClassLoader classLoader, URL 
scdlLocation) {
+        this.classLoader = classLoader;
+        this.scdlLocation = scdlLocation;
+    }
+
+    public ClassLoader getClassLoader() {
+        return classLoader;
+    }
+
+    public URL getScdlLocation() {
+        return scdlLocation;
+    }
+
+    public Object getExtension(String name) {
+        return properties.get(name);
+    }
+
+    public void putExtension(String name, Object value) {
+        if (value == null) {
+            properties.remove(name);
+        } else {
+            properties.put(name, value);
+        }
+    }
+}

Propchange: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/AbstractDeploymentContext.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java?rev=423992&r1=423991&r2=423992&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/ChildDeploymentContext.java
 Thu Jul 20 10:16:04 2006
@@ -28,10 +28,8 @@
  *
  * @version $Rev$ $Date$
  */
-public class ChildDeploymentContext implements DeploymentContext {
+public class ChildDeploymentContext extends AbstractDeploymentContext {
     private final DeploymentContext parent;
-    private final ClassLoader classLoader;
-    private final URL scdlLocation;
 
     /**
      * Constructor specifying the loader for application resources.
@@ -41,29 +39,20 @@
      * @param scdlLocation the location of the SCDL being deployed
      */
     public ChildDeploymentContext(DeploymentContext parent, ClassLoader 
classLoader, URL scdlLocation) {
+        super(classLoader, scdlLocation);
         assert parent != null;
         this.parent = parent;
-        this.classLoader = classLoader;
-        this.scdlLocation = scdlLocation;
     }
 
     public DeploymentContext getParent() {
         return parent;
     }
 
-    public ClassLoader getClassLoader() {
-        return classLoader;
-    }
-
     public XMLInputFactory getXmlFactory() {
         return parent.getXmlFactory();
     }
 
     public ScopeContainer getModuleScope() {
         return parent.getModuleScope();
-    }
-
-    public URL getScdlLocation() {
-        return scdlLocation;
     }
 }

Modified: 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java?rev=423992&r1=423991&r2=423992&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
 (original)
+++ 
incubator/tuscany/java/sca/core/src/main/java/org/apache/tuscany/core/deployer/RootDeploymentContext.java
 Thu Jul 20 10:16:04 2006
@@ -28,11 +28,10 @@
  *
  * @version $Rev: 415162 $ $Date: 2006-06-18 11:19:43 -0700 (Sun, 18 Jun 2006) 
$
  */
-public class RootDeploymentContext implements DeploymentContext {
-    private final ClassLoader classLoader;
+public class RootDeploymentContext extends AbstractDeploymentContext {
     private final XMLInputFactory xmlFactory;
     private final ScopeContainer moduleScope;
-    private final URL scdlLocation;
+
     /**
      * Constructor specifying the loader for application resources.
      *
@@ -45,29 +44,20 @@
                                  XMLInputFactory xmlFactory,
                                  ScopeContainer moduleScope,
                                  URL scdlLocation) {
-        this.classLoader = classLoader;
+        super(classLoader, scdlLocation);
         this.xmlFactory = xmlFactory;
         this.moduleScope = moduleScope;
-        this.scdlLocation = scdlLocation;
     }
 
     public DeploymentContext getParent() {
         return null;
     }
 
-    public ClassLoader getClassLoader() {
-        return classLoader;
-    }
-
     public XMLInputFactory getXmlFactory() {
         return xmlFactory;
     }
 
     public ScopeContainer getModuleScope() {
         return moduleScope;
-    }
-
-    public URL getScdlLocation() {
-        return scdlLocation;
     }
 }

Modified: 
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java?rev=423992&r1=423991&r2=423992&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
 (original)
+++ 
incubator/tuscany/java/sca/spi/src/main/java/org/apache/tuscany/spi/deployer/DeploymentContext.java
 Thu Jul 20 10:16:04 2006
@@ -63,4 +63,20 @@
      * @return the location of the SCDL definition being deployed
      */
     URL getScdlLocation();
+
+    /**
+     * Return the extension property with the supplied name.
+     *
+     * @param name the name of the property
+     * @return the property value; if null indicates that no property is 
present
+     */
+    Object getExtension(String name);
+
+    /**
+     * Set the value of an extension property.
+     *
+     * @param name the name of the property
+     * @param value the property value; if null then the extension property is 
removed
+     */
+    void putExtension(String name, Object value);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to