You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2011/04/27 01:16:58 UTC

svn commit: r1096950 [1/4] - in /geronimo/server/trunk: ./ framework/buildsupport/car-maven-plugin/ framework/buildsupport/car-maven-plugin/src/main/filtered-resources/resources/etc/ framework/buildsupport/car-maven-plugin/src/main/java/org/apache/gero...

Author: djencks
Date: Tue Apr 26 23:16:56 2011
New Revision: 1096950

URL: http://svn.apache.org/viewvc?rev=1096950&view=rev
Log:
deployer as DS component

Added:
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployerImpl.java
      - copied, changed from r1096949, geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/ArtifactType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/AttributeType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/BeanPropertyType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/EmptyType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/EnvironmentType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/GbeanType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/JavabeanType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/JaxbUtil.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/ModuleType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/ObjectFactory.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/PatternType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/PropertyType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/ReferenceType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/ReferencesType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/XmlAttributeType.java   (with props)
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/plan/package-info.java   (with props)
Removed:
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/jsr88/Artifact.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/jsr88/EnvironmentData.java
Modified:
    geronimo/server/trunk/.gitignore
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/filtered-resources/resources/etc/startup.properties
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojoTest.java
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-empty-plan.xml
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-no-env-plan.xml
    geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/plan/plan.xml
    geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/main/plan/plan.xml
    geronimo/server/trunk/framework/configs/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/DeploymentContextTest.java
    geronimo/server/trunk/framework/modules/geronimo-deployment/src/test/java/org/apache/geronimo/deployment/SingleFileHotDeployerTest.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/Configuration.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/pom.xml
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/EnvironmentBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/GBeanBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeEditor.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/ServiceConfigBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/SingleGBeanBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/java/org/apache/geronimo/deployment/service/XmlAttributeBuilder.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/xsd/geronimo-module-1.2.xsd
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/DummyJavaBean.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/EnvironmentBuilderTest.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/JavaBeanXmlAttributeEditorTest.java
    geronimo/server/trunk/framework/modules/geronimo-service-builder/src/test/java/org/apache/geronimo/deployment/service/ServiceConfigBuilderTest.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/BaseCommandSupport.java
    geronimo/server/trunk/framework/modules/geronimo-shell-base/src/main/java/org/apache/geronimo/shell/deploy/ConnectCommand.java
    geronimo/server/trunk/framework/modules/geronimo-system/src/main/java/org/apache/geronimo/system/configuration/ConfigurationExtender.java
    geronimo/server/trunk/pom.xml

Modified: geronimo/server/trunk/.gitignore
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/.gitignore?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/.gitignore (original)
+++ geronimo/server/trunk/.gitignore Tue Apr 26 23:16:56 2011
@@ -4,4 +4,5 @@
 .settings
 target
 eclipse-classes
-bin
\ No newline at end of file
+bin
+*.log

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/pom.xml Tue Apr 26 23:16:56 2011
@@ -269,6 +269,10 @@
             <artifactId>org.apache.karaf.jaas.boot</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.apache.karaf</groupId>
+            <artifactId>org.apache.karaf.main</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.ops4j.pax.url</groupId>
             <artifactId>pax-url-mvn</artifactId>
         </dependency>

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/filtered-resources/resources/etc/startup.properties
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/filtered-resources/resources/etc/startup.properties?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/filtered-resources/resources/etc/startup.properties (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/filtered-resources/resources/etc/startup.properties Tue Apr 26 23:16:56 2011
@@ -75,7 +75,7 @@ org.apache.karaf.deployer\:org.apache.ka
 org.apache.karaf.deployer\:org.apache.karaf.deployer.wrap\:${karaf.version}=30
 
 # geronimo additions
-org.apache.felix\:org.apache.felix.scr\:1.6.0=15
+org.apache.felix\:org.apache.felix.scr\:1.6.1-SNAPSHOT=15
 org.apache.felix\:org.apache.felix.shell\:1.5.0-SNAPSHOT=15
 org.apache.geronimo.bundles\:jaxb-impl\:2.2.3_1-SNAPSHOT=15
 org.apache.geronimo.specs\:geronimo-stax-api_1.2_spec\:1.1-SNAPSHOT=15
@@ -94,4 +94,7 @@ org.apache.geronimo.framework\:geronimo-
 org.apache.geronimo.framework\:geronimo-pax-logging\:${geronimo.version}=40
 org.apache.geronimo.framework\:geronimo-main\:${geronimo.version}=40
 org.apache.servicemix.bundles\:org.apache.servicemix.bundles.commons-jexl\:1.1_3=40
-org.apache.xbean\:xbean-bundleutils\:${xbeanVersion}=40
\ No newline at end of file
+org.apache.xbean\:xbean-bundleutils\:${xbeanVersion}=40
+
+mvn\:org.apache.geronimo.framework/geronimo-deployment/${geronimo.version}=50
+mvn\:org.apache.geronimo.framework/geronimo-service-builder/${geronimo.version}=50

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/AbstractFrameworkMojo.java Tue Apr 26 23:16:56 2011
@@ -22,9 +22,12 @@ package org.apache.geronimo.mavenplugins
 
 import java.io.File;
 import java.lang.Override;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.geronimo.deployment.ConfigurationBuilder;
+import org.apache.geronimo.deployment.Deployer;
 import org.apache.karaf.features.FeaturesService;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.AbstractMojo;
@@ -82,20 +85,24 @@ public class AbstractFrameworkMojo exten
     private String karafHome;
 
     private Framework framework;
+    private long timeout = 20000L;
+    private List<ServiceReference> services = new ArrayList<ServiceReference>();
 
 
     @java.lang.Override
     public void execute() throws MojoExecutionException, MojoFailureException {
         initializeFramework();
-        try {
-            Thread.sleep(5000);
-        } catch (InterruptedException e) {
+        getService(FeaturesService.class);
+        getService(Deployer.class);
+        getService(ConfigurationBuilder.class);
+        listBundles();
 
-        }
-        ServiceReference sr = framework.getBundleContext().getServiceReference(FeaturesService.class.getName());
-        Object o = framework.getBundleContext().getService(sr);
-        if (o == null) {
-            throw new RuntimeException("no feature service found");
+        done();
+    }
+
+    protected void done() throws MojoExecutionException {
+        for (ServiceReference sr: services) {
+            framework.getBundleContext().ungetService(sr);
         }
         try {
             framework.stop();
@@ -104,6 +111,24 @@ public class AbstractFrameworkMojo exten
         }
     }
 
+    protected <T> T getService(Class<T> clazz) throws MojoExecutionException {
+        long timeout = this.timeout;
+        while (timeout > 0) {
+            ServiceReference sr = framework.getBundleContext().getServiceReference(clazz.getName());
+            if (sr != null) {
+                services.add(sr);
+                return (T)framework.getBundleContext().getService(sr);
+            }
+            try {
+                Thread.sleep(100L);
+            } catch (InterruptedException e) {
+                throw new MojoExecutionException("Interrupted waiting for service " + clazz.getName() + " at " + (this.timeout - timeout)/1000 + " seconds");
+            }
+            timeout = timeout - 100;
+        }
+        throw new MojoExecutionException("Could not get service " + clazz.getName() + " in " + this.timeout/1000 + " seconds");
+    }
+
     void initializeFramework() throws MojoFailureException {
         FrameworkHelper helper = new FrameworkHelper(karafHome, new AetherResolver(), Collections.<Artifact>emptyList());
         try {

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojo.java Tue Apr 26 23:16:56 2011
@@ -20,27 +20,19 @@
 package org.apache.geronimo.mavenplugins.car;
 
 import java.io.File;
-import java.util.Collections;
-import java.util.LinkedHashSet;
-import java.util.List;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+import java.io.InputStream;
+import java.io.Writer;
 
 import javax.xml.namespace.QName;
-
-import org.apache.geronimo.deployment.service.EnvironmentBuilder;
-import org.apache.geronimo.deployment.xbeans.ArtifactType;
-import org.apache.geronimo.deployment.xbeans.EnvironmentType;
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.Environment;
-import org.apache.geronimo.system.osgi.BootActivator;
-import org.apache.geronimo.system.plugin.model.DependencyType;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
+import org.apache.geronimo.deployment.service.plan.ArtifactType;
+import org.apache.geronimo.deployment.service.plan.EnvironmentType;
+import org.apache.geronimo.deployment.service.plan.JaxbUtil;
+import org.apache.geronimo.deployment.service.plan.ModuleType;
+import org.apache.geronimo.deployment.service.plan.ObjectFactory;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
 
 //
 // TODO: Rename to PreparePlanMojo
@@ -84,22 +76,6 @@ public class PlanProcessorMojo
     protected File targetFile = null;
 
     /**
-     * Dependencies explicitly listed in the car-maven-plugin configuration
-     *
-     * @parameter
-     */
-    private List<Dependency> dependencies = Collections.emptyList();
-
-    /**
-     * Configuration of use of maven dependencies.  If missing or if value element is false, use the explicit list in the car-maven-plugin configuration.
-     * If present and true, use the maven dependencies in the current pom file of scope null, runtime, or compile.  In addition, the version of the maven
-     * dependency can be included or not depending on the includeVersion element.
-     *
-     * @parameter
-     */
-    UseMavenDependencies useMavenDependencies = new UseMavenDependencies(true, false, true);
-
-    /**
      * we copy the plan here for filtering, then add env stuff.
      *
      * @parameter expression="${project.build.directory}/work/filteredplan.xml"
@@ -122,13 +98,26 @@ public class PlanProcessorMojo
         try {
             filter(sourceFile, filteredPlanFile);
 
-            XmlObject doc = XmlObject.Factory.parse(filteredPlanFile);
-            XmlCursor xmlCursor = doc.newCursor();
-            LinkedHashSet<org.apache.geronimo.kernel.repository.Dependency> dependencies = toKernelDependencies(useMavenDependencies);
-            Artifact configId = new Artifact(project.getGroupId(), project.getArtifactId(), project.getVersion(), "car");
-
+            InputStream in = new FileInputStream(filteredPlanFile);
+            ModuleType moduleType;
             try {
-                mergeEnvironment(xmlCursor, configId, dependencies);
+                moduleType = JaxbUtil.unmarshalModule(in, false);
+            } finally {
+                in.close();
+            }
+            EnvironmentType environmentType = moduleType.getEnvironment();
+            if (environmentType == null) {
+                environmentType = new ObjectFactory().createEnvironmentType();
+                moduleType.setEnvironment(environmentType);
+            }
+            ArtifactType artifactType = new ObjectFactory().createArtifactType();
+            artifactType.setGroupId(project.getGroupId());
+            artifactType.setArtifactId(project.getArtifactId());
+            artifactType.setVersion(project.getVersion());
+            artifactType.setType("car");
+            environmentType.setModuleId(artifactType);
+
+
 
                 if (targetDir.exists()) {
                     if (!targetDir.isDirectory()) {
@@ -138,113 +127,19 @@ public class PlanProcessorMojo
                     targetDir.mkdirs();
                 }
 
-                XmlOptions xmlOptions = new XmlOptions();
-                xmlOptions.setSavePrettyPrint();
-                doc.save(targetFile, xmlOptions);
+                Writer out = new FileWriter(targetFile);
+            try {
+                JaxbUtil.marshal(ModuleType.class, moduleType, out);
+            } finally {
+                out.close();
+            }
 
-                if (getLog() != null) {
+            if (getLog() != null) {
                     getLog().info("Generated: " + targetFile);
                 }
-            }
-            finally {
-                xmlCursor.dispose();
-            }
         } catch (Exception e) {
             throw new MojoExecutionException("Could not process plan", e);
         }
     }
 
-    void mergeEnvironment(final XmlCursor xmlCursor, final Artifact configId, final LinkedHashSet<org.apache.geronimo.kernel.repository.Dependency> dependencies) {
-        moveToFirstStartElement(xmlCursor);
-
-        boolean atLeastOneChild = xmlCursor.toFirstChild();
-        if (!atLeastOneChild) {
-            // this is an empty element. Move to EndToken such XmlCursor.beginElement inserts an element inside it.
-            xmlCursor.toEndToken();
-        }
-        QName childName = xmlCursor.getName();
-        Environment oldEnvironment;
-
-        if (childName != null && childName.getLocalPart().equals(ENVIRONMENT_LOCAL_NAME)) {
-            convertElement(xmlCursor, ENVIRONMENT_QNAME.getNamespaceURI());
-            XmlObject xmlObject = xmlCursor.getObject();
-            EnvironmentType environmentType = (EnvironmentType) xmlObject.copy().changeType(EnvironmentType.type);
-            oldEnvironment = EnvironmentBuilder.buildEnvironment(environmentType);
-            xmlCursor.removeXml();
-        } else {
-            oldEnvironment = new Environment();
-        }
-
-        Environment newEnvironment = new Environment();
-        newEnvironment.setConfigId(configId);
-//        newEnvironment.setDependencies(dependencies);
-        if (boot) {
-            newEnvironment.setBundleActivator(BootActivator.class.getName());
-        }
-
-        EnvironmentBuilder.mergeEnvironments(oldEnvironment, newEnvironment);
-        EnvironmentType environmentType = EnvironmentBuilder.buildEnvironmentType(oldEnvironment);
-
-        xmlCursor.beginElement(ENVIRONMENT_QNAME);
-        XmlCursor element = environmentType.newCursor();
-
-        try {
-            element.copyXmlContents(xmlCursor);
-        }
-        finally {
-            element.dispose();
-        }
-    }
-
-    private void moveToFirstStartElement(XmlCursor xmlCursor) throws AssertionError {
-        xmlCursor.toStartDoc();
-        xmlCursor.toFirstChild();
-        while (!xmlCursor.currentTokenType().isStart()) {
-            if (!xmlCursor.toNextSibling()) {
-                break;
-            }
-        }
-        if (!xmlCursor.currentTokenType().isStart()) {
-            throw new AssertionError("Cannot find first start element");
-        }
-    }
-
-    private void convertElement(final XmlCursor cursor, final String namespace) {
-        cursor.push();
-        XmlCursor end = cursor.newCursor();
-
-        try {
-            end.toCursor(cursor);
-            end.toEndToken();
-
-            while (cursor.hasNextToken() && cursor.isLeftOf(end)) {
-                if (cursor.isStart()) {
-                    if (!namespace.equals(cursor.getName().getNamespaceURI())) {
-                        cursor.setName(new QName(namespace, cursor.getName().getLocalPart()));
-                    }
-                }
-
-                cursor.toNextToken();
-            }
-
-            cursor.pop();
-        }
-        finally {
-            end.dispose();
-        }
-    }
-
-    protected LinkedHashSet<org.apache.geronimo.kernel.repository.Dependency> toKernelDependencies(UseMavenDependencies useMavenDependencies) throws InvalidDependencyVersionException, ArtifactResolutionException, ProjectBuildingException, MojoExecutionException {
-        LinkedHashSet<org.apache.geronimo.kernel.repository.Dependency> kernelDependencies = new LinkedHashSet<org.apache.geronimo.kernel.repository.Dependency>();
-        LinkedHashSet<DependencyType> dependencies = toDependencies(this.dependencies, useMavenDependencies, true);
-        for (DependencyType dependency: dependencies) {
-            kernelDependencies.add(Dependency.toKernelDependency(dependency));
-        }
-        return kernelDependencies;
-    }
-
-
-    interface Inserter {
-        ArtifactType insert(EnvironmentType environmentType);
-    }
 }

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/PluginBootstrap2.java Tue Apr 26 23:16:56 2011
@@ -90,7 +90,8 @@ public class PluginBootstrap2 {
         bundleContext.registerService(DependencyManager.class.getName(), dependencyManager, new Hashtable());
 
         GBeanBuilder gBeanBuilder = new GBeanBuilder(null, null);
-        ServiceConfigBuilder builder = new ServiceConfigBuilder(null, Collections.<Repository>singleton(repository), Collections.<NamespaceDrivenBuilder>singleton(gBeanBuilder), new Jsr77Naming(), bundleContext);
+        ServiceConfigBuilder builder = new ServiceConfigBuilder();
+        builder.activate(bundleContext);
         ConfigurationStore targetConfigurationStore = new NullConfigurationStore() {
             public File createNewConfigurationDir(Artifact configId) throws ConfigurationAlreadyExistsException {
                 StringBuilder configurationPathBuilder = new StringBuilder("repository");

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/resources/META-INF/plexus/components.xml Tue Apr 26 23:16:56 2011
@@ -52,8 +52,7 @@
                                 org.apache.geronimo.buildsupport:car-maven-plugin:archive-car
                             </package>
                             <install>
-                                org.apache.maven.plugins:maven-install-plugin:install,
-                                org.apache.geronimo.buildsupport:car-maven-plugin:update-pluginlist
+                                org.apache.maven.plugins:maven-install-plugin:install
                             </install>
                             <deploy>
                                 org.apache.maven.plugins:maven-deploy-plugin:deploy

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojoTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojoTest.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojoTest.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/java/org/apache/geronimo/mavenplugins/car/PlanProcessorMojoTest.java Tue Apr 26 23:16:56 2011
@@ -45,7 +45,7 @@ public class PlanProcessorMojoTest exten
     protected void setUp() throws Exception {
         super.setUp();
         processorMojo = new PlanProcessorMojo();
-        processorMojo.useMavenDependencies = new UseMavenDependencies(false, false, false);
+//        processorMojo.useMavenDependencies = new UseMavenDependencies(false, false, false);
         Model model = new Model();
         MavenProject mavenProject = new MavenProject(model);
         mavenProject.setGroupId("dummy-group");

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-empty-plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-empty-plan.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-empty-plan.xml (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-empty-plan.xml Tue Apr 26 23:16:56 2011
@@ -28,8 +28,5 @@
             <dep:version>dummy-version</dep:version>
             <dep:type>car</dep:type>
         </dep:moduleId>
-        <dep:dependencies/>
-        <dep:hidden-classes/>
-        <dep:non-overridable-classes/>
     </dep:environment>
 </module>
\ No newline at end of file

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-no-env-plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-no-env-plan.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-no-env-plan.xml (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/test/resources/expected-no-env-plan.xml Tue Apr 26 23:16:56 2011
@@ -28,9 +28,6 @@
             <dep:version>dummy-version</dep:version>
             <dep:type>car</dep:type>
         </dep:moduleId>
-        <dep:dependencies/>
-        <dep:hidden-classes/>
-        <dep:non-overridable-classes/>
     </dep:environment>
     <node/>
 </module>
\ No newline at end of file

Modified: geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/plan/plan.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/geronimo-gbean-deployer-bootstrap/src/main/plan/plan.xml Tue Apr 26 23:16:56 2011
@@ -16,7 +16,7 @@
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
     <!--Deployer used to process modules and plans-->
 
-    <gbean name="Deployer" class="org.apache.geronimo.deployment.Deployer">
+    <gbean name="Deployer" class="org.apache.geronimo.deployment.DeployerImpl">
         <reference name="Store">
         </reference>
         <reference name="Builders"></reference>

Modified: geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/main/plan/plan.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/framework/configs/geronimo-gbean-deployer/src/main/plan/plan.xml Tue Apr 26 23:16:56 2011
@@ -15,7 +15,7 @@
     limitations under the License.-->
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
 
-    <gbean name="Deployer" class="org.apache.geronimo.deployment.Deployer">
+    <gbean name="Deployer" class="org.apache.geronimo.deployment.DeployerImpl">
         <attribute name="remoteDeployAddress">localhost:8080</attribute>
         <reference name="Store">
         </reference>

Modified: geronimo/server/trunk/framework/configs/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/configs/pom.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/configs/pom.xml (original)
+++ geronimo/server/trunk/framework/configs/pom.xml Tue Apr 26 23:16:56 2011
@@ -34,7 +34,7 @@
 
     <modules>
         <module>geronimo-gbean-deployer</module>
-        <module>geronimo-gbean-deployer-bootstrap</module>
+        <!--<module>geronimo-gbean-deployer-bootstrap</module>-->
         <module>client-system</module>
         <module>j2ee-security</module>
         <module>j2ee-system</module>

Modified: geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/StreamConsoleReader.java Tue Apr 26 23:16:56 2011
@@ -98,8 +98,8 @@ public class StreamConsoleReader impleme
     @Override
     public void println(String s) throws IOException {
         if (jlineConsoleEnabled) {
-            jlineConsoleReader.print(s);
-            jlineConsoleReader.println();
+            jlineConsoleReader.println(s);
+
         } else {
             console.println(s);
             console.println();
@@ -148,7 +148,11 @@ public class StreamConsoleReader impleme
     @Override
     public void flushConsole() throws IOException {
         if (jlineConsoleEnabled) {
+<<<<<<< HEAD
              jlineConsoleReader.flush();
+=======
+            jlineConsoleReader.flush();
+>>>>>>> d253307... ServiceConfigBuilder as a service.  Remove use of xmlbeans from ServiceConfigBuilder
         } else {
             console.flush();
         }

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/pom.xml?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/pom.xml (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/pom.xml Tue Apr 26 23:16:56 2011
@@ -75,5 +75,28 @@
 
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <configuration>
+                    <instructions>
+                        <Import-Package>
+                            org.apache.xml.resolver.*;resolution:=optional,
+                            org.apache.xmlbeans.*;resolution:=optional,
+                            *
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+
+        </plugins>
+    </build>
+
 </project>
 

Modified: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java?rev=1096950&r1=1096949&r2=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java Tue Apr 26 23:16:56 2011
@@ -1,636 +1,48 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
+/*
+ * 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
+ *  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.
+ * 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.geronimo.deployment;
 
 import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-import javax.management.ObjectName;
 
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.ConfigurationData;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.DeploymentWatcher;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.xbean.osgi.bundle.util.BundleClassLoader;
-import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ArtifactResolver;
-import org.apache.geronimo.kernel.util.FileUtils;
-import org.apache.geronimo.kernel.util.JarUtils;
-import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
-import org.apache.geronimo.system.main.CommandLineManifest;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
- * GBean that knows how to deploy modules (by consulting available module builders)
- *
- * @version $Rev$ $Date$
+ * @version $Rev:$ $Date:$
  */
-public class Deployer implements GBeanLifecycle {
-    private static final Logger log = LoggerFactory.getLogger(Deployer.class);
-
-    private final int REAPER_INTERVAL = 60 * 1000;
-    private DeployerReaper reaper;
-    private final String remoteDeployAddress;
-    private final Collection builders;
-    private final Collection stores;
-    private final Collection watchers;
-    private final ArtifactResolver artifactResolver;
-    private final Kernel kernel;
-    private static final URI PLAN_LOCATION = URI.create("META-INF/plan.xml");
-
-    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection watchers, Kernel kernel) throws GBeanNotFoundException {
-        this(remoteDeployAddress, builders, stores, watchers, getArtifactResolver(kernel), kernel);
-    }
-
-    private static ArtifactResolver getArtifactResolver(Kernel kernel) throws GBeanNotFoundException {
-        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
-        return configurationManager.getArtifactResolver();
-    }
-
-    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection watchers, ArtifactResolver artifactResolver, Kernel kernel) {
-        this.remoteDeployAddress = remoteDeployAddress;
-        this.builders = builders;
-        this.stores = stores;
-        this.watchers = watchers;
-        this.artifactResolver = artifactResolver;
-        this.kernel = kernel;
-
-        // Create and start the reaper...
-        this.reaper = new DeployerReaper(REAPER_INTERVAL);
-
-    }
-
-    public List deploy(boolean inPlace, File moduleFile, File planFile) throws DeploymentException {
-        return deploy(inPlace, moduleFile, planFile, null);
-    }
-
-    public List deploy(boolean inPlace, File moduleFile, File planFile, String targetConfigStore) throws DeploymentException {
-        File originalModuleFile = moduleFile;
-        File tmpDir = null;
-        if (moduleFile != null && !moduleFile.isDirectory()) {
-            // todo jar url handling with Sun's VM on Windows leaves a lock on the module file preventing rebuilds
-            // to address this we use a gross hack and copy the file to a temporary directory
-            // the lock on the file will prevent that being deleted properly until the URLJarFile has
-            // been GC'ed.
-            boolean cleanup = true;
-            try {
-                tmpDir = File.createTempFile("geronimo-deployer", ".tmpdir");
-                tmpDir.delete();
-                tmpDir.mkdir();
-                File tmpFile = new File(tmpDir, moduleFile.getName());
-                FileUtils.copyFile(moduleFile, tmpFile);
-                moduleFile = tmpFile;
-                cleanup = false;
-            } catch (IOException e) {
-                throw new DeploymentException(e);
-            } finally {
-                // If an Exception is thrown in the try block above, we will need to cleanup here.
-                if(cleanup && tmpDir != null && !FileUtils.recursiveDelete(tmpDir)) {
-                    reaper.delete(tmpDir.getAbsolutePath(), "delete");
-                }
-            }
-        }
-
-        try {
-            return deploy(inPlace, moduleFile, planFile, null, true, null, null, null, null, null, null, null, targetConfigStore);
-        } catch (DeploymentException e) {
-            log.debug("Deployment failed: plan=" + planFile + ", module=" + originalModuleFile, e);
-            throw e.cleanse();
-        } finally {
-            if (tmpDir != null) {
-                if (!FileUtils.recursiveDelete(tmpDir)) {
-                    reaper.delete(tmpDir.getAbsolutePath(), "delete");
-                }
-            }
-        }
-    }
-
-    /**
-     * Gets a URL that a remote deploy client can use to upload files to the
-     * server. Looks up a remote deploy web application by searching for a
-     * particular GBean and figuring out a reference to the web application
-     * based on that.  Then constructs a URL pointing to that web application
-     * based on available connectors for the web container and the context
-     * root for the web application.
-     *
-     * @return The URL that clients should use for deployment file uploads.
-     */
-    public String getRemoteDeployUploadURL() {
-        // Get the token GBean from the remote deployment configuration
-        Set set = kernel.listGBeans(new AbstractNameQuery("org.apache.geronimo.deployment.remote.RemoteDeployToken"));
-        if (set.size() == 0) {
-            return null;
-        }
-        AbstractName token = (AbstractName) set.iterator().next();
-        // Identify the parent configuration for that GBean
-        set = kernel.getDependencyManager().getParents(token);
-        ObjectName config = null;
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            if (Configuration.isConfigurationObjectName(name.getObjectName())) {
-                config = name.getObjectName();
-                break;
-            }
-        }
-        if (config == null) {
-            log.warn("Unable to find remote deployment configuration; is the remote deploy web application running?");
-            return null;
-        }
-        // Generate the URL based on the remote deployment configuration
-        Map<String, String> hash = new HashMap<String, String>();
-        hash.put("J2EEApplication", token.getObjectName().getKeyProperty("J2EEApplication"));
-        hash.put("j2eeType", "WebModule");
-        try {
-            hash.put("name", Configuration.getConfigurationID(config).toString());
-            Set<AbstractName> names = kernel.listGBeans(new AbstractNameQuery(null, hash));
-            if (names.size() != 1) {
-                log.error("Unable to look up remote deploy upload URL");
-                return null;
-            }
-            AbstractName module = names.iterator().next();
-            String contextPath = (String) kernel.getAttribute(module, "contextPath");
-            if (null == contextPath) {
-                throw new IllegalStateException("Cannot find contextPath attribute for [" + module + "]");
-            }
-            String temp = remoteDeployAddress + "/" + contextPath + "/upload";
-            return URI.create(temp).normalize().toString();
-        } catch (Exception e) {
-            log.error("Unable to look up remote deploy upload URL", e);
-            return null;
-        }
-    }
-
-    public List deploy(boolean inPlace,
-            File moduleFile,
-            File planFile,
-            File targetFile,
-            boolean install,
-            String mainClass,
-            String mainGBean, String mainMethod, String manifestConfigurations, String classPath,
-            String endorsedDirs,
-            String extensionDirs,
-            String targetConfigurationStore) throws DeploymentException {
-        if (planFile == null && moduleFile == null) {
-            throw new DeploymentException("No plan or module specified");
-        } else if (stores.isEmpty()) {
-            throw new DeploymentException("No ConfigurationStores!");
-        }
-        validatePlanFile(planFile);
-
-        JarFile module = getModule(inPlace, moduleFile);
-
-        ModuleIDBuilder idBuilder = new ModuleIDBuilder();
-
-        DeploymentContext context = null;
-        try {
-            Object plan = null;
-            ConfigurationBuilder builder = null;
-            for (Iterator i = builders.iterator(); i.hasNext();) {
-                ConfigurationBuilder candidate = (ConfigurationBuilder) i.next();
-                plan = candidate.getDeploymentPlan(planFile, module, idBuilder);
-                if (plan != null) {
-                    builder = candidate;
-                    break;
-                }
-            }
-            if (builder == null) {
-                throw new DeploymentException("Cannot deploy the requested application module because no deployer is able to handle it. " +
-                        " This can happen if you have omitted the J2EE deployment descriptor, disabled a deployer module, or if, for example, you are trying to deploy an" +
-                        " EJB module on a minimal Geronimo server that does not have EJB support installed.  (" +
-                        (planFile == null ? "" : "planFile=" + planFile.getAbsolutePath()) +
-                        (moduleFile == null ? "" : (planFile == null ? "" : ", ") + "moduleFile=" + moduleFile.getAbsolutePath()) + ")");
-            }
-
-            Artifact configID = getConfigID(module, idBuilder, plan, builder);
-
-            ConfigurationStore store = getConfigurationStore(targetConfigurationStore);
-
-            // It's our responsibility to close this context, once we're done with it...
-            context = builder.buildConfiguration(inPlace, configID, plan, module, stores, artifactResolver, store);
-            // Copy the external plan to the META-INF folder with the uniform name plan.xml if there is nothing there already
-            if (planFile != null && !context.getTargetFile(PLAN_LOCATION).exists()) {
-                context.addFile(PLAN_LOCATION, planFile);
-            }
-            // install the configuration
-            // create the manifest
-            Manifest manifest = createManifest(mainClass,
-                mainGBean,
-                mainMethod,
-                manifestConfigurations,
-                classPath,
-                endorsedDirs,
-                extensionDirs);
-
-            return install(targetFile, install, manifest, store, context);
-        } catch (Throwable e) {
-            //TODO not clear all errors will result in total cleanup
-//            File configurationDir = configurationData.getConfigurationDir();
-//            if (!DeploymentUtil.recursiveDelete(configurationDir)) {
-//                pendingDeletionIndex.setProperty(configurationDir.getName(), new String("delete"));
-//                log.debug("Queued deployment directory to be reaped " + configurationDir);
-//            }
-//            if (targetFile != null) {
-//                targetFile.delete();
-//            }
-
-            //Clean Up the created deploymentContext, as some initial work might be done in the buildConfiguration invocation
-            if (context != null) {
-                try {
-                    context.close();
-                } catch (Exception ingore) {
-                }
-            }
-
-            if (e instanceof Error) {
-                log.error("Deployment failed due to ", e);
-                throw (Error) e;
-            } else if (e instanceof DeploymentException) {
-                throw (DeploymentException) e;
-            } else if (e instanceof Exception) {
-                log.error("Deployment failed due to ", e);
-                throw new DeploymentException(e);
-            }
-            throw new Error(e);
-        } finally {
-            JarUtils.close(module);
-        }
-    }
-
-    private ConfigurationStore getConfigurationStore(String targetConfigurationStore)
-            throws URISyntaxException, GBeanNotFoundException {
-        if (targetConfigurationStore != null) {
-            AbstractName targetStoreName = new AbstractName(new URI(targetConfigurationStore));
-            return (ConfigurationStore) kernel.getGBean(targetStoreName);
-        } else {
-            return (ConfigurationStore) stores.iterator().next();
-        }
-    }
-
-    private Artifact getConfigID(JarFile module,
-            ModuleIDBuilder idBuilder,
-            Object plan,
-            ConfigurationBuilder builder) throws IOException, DeploymentException, InvalidConfigException {
-        Artifact configID = builder.getConfigurationID(plan, module, idBuilder);
-        // If the Config ID isn't fully resolved, populate it with defaults
-        if (!configID.isResolved()) {
-            configID = idBuilder.resolve(configID, "car");
-        }
-
-        // Make sure this configuration doesn't already exist
-        try {
-            kernel.getGBeanState(Configuration.getConfigurationAbstractName(configID));
-            throw new DeploymentException("Module " + configID + " already exists in the server.  Try to undeploy it first or use the redeploy command.");
-        } catch (GBeanNotFoundException e) {
-            // this is good
-        }
-        return configID;
-    }
-
-    private List install(File targetFile,
-            boolean install,
-            Manifest manifest,
-            ConfigurationStore store,
-            DeploymentContext context) throws DeploymentException, IOException, Throwable {
-        List<ConfigurationData> configurationDatas = new ArrayList<ConfigurationData>();
-
-        boolean configsCleanupRequired = false;
-
-        // Set TCCL to the classloader for the configuration being deployed
-        // so that any static blocks invoked during the loading of classes
-        // during serialization of the configuration have the correct TCCL
-        // ( a TCCL that is consistent with what is set when the same
-        // classes are loaded when the configuration is started.
-        Thread thread = Thread.currentThread();
-        ClassLoader oldCl = thread.getContextClassLoader();
-        //TODO OSGI fixme
-        thread.setContextClassLoader( new BundleClassLoader(context.getConfiguration().getBundle()));
-        try {
-            try {
-                configurationDatas.add(context.getConfigurationData());
-            } catch (DeploymentException e) {
-                Configuration configuration = context.getConfiguration();
-                if (configuration != null) {
-                    ConfigurationData dumbConfigurationData = new ConfigurationData(null, null, null,
-                            configuration.getEnvironment(), context.getBaseDir(), null, context.getNaming());
-                    configurationDatas.add(dumbConfigurationData);
-                }
-                configurationDatas.addAll(context.getAdditionalDeployment());
-                throw e;
-            }
-
-            configurationDatas.addAll(context.getAdditionalDeployment());
-
-            if (configurationDatas.isEmpty()) {
-                throw new DeploymentException("Deployer did not create any configurations");
-            }
-
-            if (targetFile != null) {
-                if (configurationDatas.size() > 1) {
-                    throw new DeploymentException("Deployer created more than one configuration");
-                }
-                ConfigurationData configurationData = configurationDatas.get(0);
-                ExecutableConfigurationUtil.createExecutableConfiguration(configurationData, manifest, targetFile);
-            }
-            if (install) {
-                List<String> deployedURIs = new ArrayList<String>();
-                for (ConfigurationData configurationData : configurationDatas) {
-                    store.install(configurationData);
-                    deployedURIs.add(configurationData.getId().toString());
-                }
-                notifyWatchers(deployedURIs);
-                return deployedURIs;
-            } else {
-                configsCleanupRequired = true;
-                return Collections.EMPTY_LIST;
-            }
-        } catch (DeploymentException e) {
-            configsCleanupRequired = true;
-            throw e;
-        } catch (IOException e) {
-            configsCleanupRequired = true;
-            throw e;
-        } catch (InvalidConfigException e) {
-            configsCleanupRequired = true;
-            // unlikely as we just built this
-            throw new DeploymentException(e);
-        } catch (Throwable e) {
-            // Could get here if serialization of the configuration failed (GERONIMO-1996)
-            configsCleanupRequired = true;
-            throw e;
-        } finally {
-            thread.setContextClassLoader(oldCl);
-            context.close();
-            if (configsCleanupRequired) {
-                // We do this after context is closed so the module jar isn't open
-                cleanupConfigurations(configurationDatas);
-            }
-        }
-    }
-
-    private Manifest createManifest(String mainClass,
-            String mainGBean,
-            String mainMethod,
-            String manifestConfigurations,
-            String classPath,
-            String endorsedDirs,
-            String extensionDirs) {
-        if (mainClass == null) {
-            return null;
-        }
-        Manifest manifest = new Manifest();
-        Attributes mainAttributes = manifest.getMainAttributes();
-        mainAttributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
-        if (mainClass != null) {
-            mainAttributes.putValue(Attributes.Name.MAIN_CLASS.toString(), mainClass);
-        }
-        if (mainGBean != null) {
-            mainAttributes.putValue(CommandLineManifest.MAIN_GBEAN.toString(), mainGBean);
-        }
-        if (mainMethod != null) {
-            mainAttributes.putValue(CommandLineManifest.MAIN_METHOD.toString(), mainMethod);
-        }
-        if (manifestConfigurations != null) {
-            mainAttributes.putValue(CommandLineManifest.CONFIGURATIONS.toString(), manifestConfigurations);
-        }
-        if (classPath != null) {
-            mainAttributes.putValue(Attributes.Name.CLASS_PATH.toString(), classPath);
-        }
-        if (endorsedDirs != null) {
-            mainAttributes.putValue(CommandLineManifest.ENDORSED_DIRS.toString(), endorsedDirs);
-        }
-        if (extensionDirs != null) {
-            mainAttributes.putValue(CommandLineManifest.EXTENSION_DIRS.toString(), extensionDirs);
-        }
-        return manifest;
-    }
-
-    private JarFile getModule(boolean inPlace, File moduleFile) throws DeploymentException {
-        JarFile module = null;
-        if (moduleFile != null) {
-            if (inPlace && !moduleFile.isDirectory()) {
-                throw new DeploymentException("In place deployment is not allowed for packed module");
-            }
-            if (!moduleFile.exists()) {
-                throw new DeploymentException("Module file does not exist: " + moduleFile.getAbsolutePath());
-            }
-            try {
-                module = JarUtils.createJarFile(moduleFile);
-            } catch (IOException e) {
-                throw new DeploymentException("Cound not open module file: " + moduleFile.getAbsolutePath(), e);
-            }
-        }
-        return module;
-    }
-
-    private void validatePlanFile(File planFile) throws DeploymentException {
-        if (planFile != null) {
-            if (!planFile.exists()) {
-                throw new DeploymentException("Plan file does not exist: " + planFile.getAbsolutePath());
-            }
-            if (!planFile.isFile()) {
-                throw new DeploymentException("Plan file is not a regular file: " + planFile.getAbsolutePath());
-            }
-        }
-    }
-
-    private void notifyWatchers(List list) {
-        Artifact[] arts = new Artifact[list.size()];
-        for (int i = 0; i < list.size(); i++) {
-            String s = (String) list.get(i);
-            arts[i] = Artifact.create(s);
-        }
-        for (Iterator it = watchers.iterator(); it.hasNext();) {
-            DeploymentWatcher watcher = (DeploymentWatcher) it.next();
-            for (int i = 0; i < arts.length; i++) {
-                Artifact art = arts[i];
-                watcher.deployed(art);
-            }
-        }
-    }
-
-    private void cleanupConfigurations(List configurations) {
-        for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
-            ConfigurationData configurationData = (ConfigurationData) iterator.next();
-            File configurationDir = configurationData.getConfigurationDir();
-            if (!FileUtils.recursiveDelete(configurationDir)) {
-                reaper.delete(configurationDir.getAbsolutePath(), "delete");
-            }
-        }
-    }
-
-    public void doStart() throws Exception {
-    }
-
-    public void doFail() {
-        if (reaper != null) {
-            reaper.close();
-        }
-    }
-
-    public void doStop() throws Exception {
-    }
-
-    /**
-     * Thread to cleanup unused temporary Deployer directories (and files).
-     * On Windows, open files can't be deleted. Until MultiParentClassLoaders
-     * are GC'ed, we won't be able to delete Config Store directories/files.
-     */
-    class DeployerReaper implements Runnable {
-        private final int reaperInterval;
-        private final Properties pendingDeletionIndex = new Properties();
-        private volatile boolean done = false;
-        private Thread thread;
-
-        public DeployerReaper(int reaperInterval) {
-            this.reaperInterval = reaperInterval;
-        }
-
-        public void delete(String dir, String type) {
-            pendingDeletionIndex.setProperty(dir, type);
-            log.debug("Queued deployment directory to be reaped " + dir);
-            startThread();
-        }
-
-        private synchronized void startThread() {
-            if (this.thread == null) {
-                this.thread = new Thread(this, "Geronimo Config Store Reaper");
-                this.thread.setDaemon(true);
-                this.thread.start();
-            }
-        }
-
-        public void close() {
-            this.done = true;
-        }
-
-        public void run() {
-            log.debug("ConfigStoreReaper started");
-
-            // DeployerReaper in offline deployment does not get a chance to reap the temporary
-            // directories. Reap any temporary directories left behind by previous runs here.
-            reapBacklog();
-
-            while (!done) {
-                try {
-                    Thread.sleep(reaperInterval);
-                } catch (InterruptedException e) {
-                    continue;
-                }
-                reap();
-            }
-        }
-
-        /**
-         * Reap any temporary directories left behind by previous runs.
-         */
-        private void reapBacklog() {
-            try {
-                File tempFile = File.createTempFile("geronimo-deployer", ".tmpdir");
-                File tempDir = tempFile.getParentFile();
-                tempFile.delete();
-                String[] backlog = tempDir.list(new FilenameFilter(){
-                    public boolean accept(File dir, String name) {
-                        return name.startsWith("geronimo-deployer") && name.endsWith(".tmpdir") && new File(dir, name).isDirectory();
-                    }});
-                for(String dir: backlog) {
-                    File deleteDir = new File(tempDir, dir);
-                    FileUtils.recursiveDelete(deleteDir);
-                    log.debug("Reaped deployment directory from previous runs " + deleteDir);
-                }
-            } catch (IOException ignored) {
-            }
-        }
-
-        /**
-         * For every directory in the pendingDeletionIndex, attempt to delete all
-         * sub-directories and files.
-         */
-        public void reap() {
-            // return, if there's nothing to do
-            if (pendingDeletionIndex.size() == 0)
-                return;
-            // Otherwise, attempt to delete all of the directories
-            Enumeration list = pendingDeletionIndex.propertyNames();
-            while (list.hasMoreElements()) {
-                String dirName = (String) list.nextElement();
-                File deleteDir = new File(dirName);
-
-                if (FileUtils.recursiveDelete(deleteDir)) {
-                    pendingDeletionIndex.remove(dirName);
-                    log.debug("Reaped deployment directory " + deleteDir);
-                }
-            }
-        }
-    }
-
-    public static final GBeanInfo GBEAN_INFO;
-
-    private static final String DEPLOYER = "Deployer";
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Deployer.class, DEPLOYER);
-
-        infoFactory.addAttribute("kernel", Kernel.class, false);
-        infoFactory.addAttribute("remoteDeployAddress", String.class, true, true);
-        infoFactory.addAttribute("remoteDeployUploadURL", String.class, false);
-//        infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class});
-//        infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class, String.class});
-//        infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class, File.class, boolean.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class});
-
-        infoFactory.addReference("Builders", ConfigurationBuilder.class, "ConfigBuilder");
-        infoFactory.addReference("Store", ConfigurationStore.class, "ConfigurationStore");
-        infoFactory.addReference("Watchers", DeploymentWatcher.class);
-
-        infoFactory.setConstructor(new String[]{"remoteDeployAddress", "Builders", "Store", "Watchers", "kernel"});
+public interface Deployer {
+    List deploy(boolean inPlace, File moduleFile, File planFile) throws DeploymentException;
 
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
+    List deploy(boolean inPlace, File moduleFile, File planFile, String targetConfigStore) throws DeploymentException;
 
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
+    String getRemoteDeployUploadURL();
 
+    List deploy(boolean inPlace,
+                File moduleFile,
+                File planFile,
+                File targetFile,
+                boolean install,
+                String mainClass,
+                String mainGBean, String mainMethod, String manifestConfigurations, String classPath,
+                String endorsedDirs,
+                String extensionDirs,
+                String targetConfigurationStore) throws DeploymentException;
 }

Copied: geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployerImpl.java (from r1096949, geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployerImpl.java?p2=geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployerImpl.java&p1=geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java&r1=1096949&r2=1096950&rev=1096950&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/Deployer.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeployerImpl.java Tue Apr 26 23:16:56 2011
@@ -26,40 +26,35 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.Set;
 import java.util.jar.Attributes;
 import java.util.jar.JarFile;
 import java.util.jar.Manifest;
 
-import javax.management.ObjectName;
-
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
 import org.apache.geronimo.common.DeploymentException;
-import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.AbstractNameQuery;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
-import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.config.ConfigurationData;
-import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.ConfigurationStore;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
 import org.apache.geronimo.kernel.config.DeploymentWatcher;
 import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.xbean.osgi.bundle.util.BundleClassLoader;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.ArtifactResolver;
 import org.apache.geronimo.kernel.util.FileUtils;
 import org.apache.geronimo.kernel.util.JarUtils;
 import org.apache.geronimo.system.configuration.ExecutableConfigurationUtil;
 import org.apache.geronimo.system.main.CommandLineManifest;
+import org.apache.xbean.osgi.bundle.util.BundleClassLoader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -68,45 +63,115 @@ import org.slf4j.LoggerFactory;
  *
  * @version $Rev$ $Date$
  */
-public class Deployer implements GBeanLifecycle {
-    private static final Logger log = LoggerFactory.getLogger(Deployer.class);
+@Component(immediate = true, metatype = true)
+@Service
+public class DeployerImpl implements Deployer {
+    private static final Logger log = LoggerFactory.getLogger(DeployerImpl.class);
+    private static final URI PLAN_LOCATION = URI.create("META-INF/plan.xml");
 
     private final int REAPER_INTERVAL = 60 * 1000;
-    private DeployerReaper reaper;
-    private final String remoteDeployAddress;
-    private final Collection builders;
-    private final Collection stores;
-    private final Collection watchers;
-    private final ArtifactResolver artifactResolver;
-    private final Kernel kernel;
-    private static final URI PLAN_LOCATION = URI.create("META-INF/plan.xml");
+    private final DeployerReaper reaper = new DeployerReaper(REAPER_INTERVAL) ;
+
+    @Property(value = "localhost:8080")
+    private static final String REMOTE_DEPLOY_ADDRESS = "remoteDeployAddress";
 
-    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection watchers, Kernel kernel) throws GBeanNotFoundException {
-        this(remoteDeployAddress, builders, stores, watchers, getArtifactResolver(kernel), kernel);
+    private String remoteDeployAddress;
+    
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, referenceInterface = ConfigurationBuilder.class)
+    private final Collection<ConfigurationBuilder> configurationBuilders = new ArrayList<ConfigurationBuilder>();
+
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, referenceInterface = ConfigurationStore.class)
+    private final Collection<ConfigurationStore> configurationStores = new ArrayList<ConfigurationStore>();
+
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE, referenceInterface = DeploymentWatcher.class)
+    private final Collection<DeploymentWatcher> deploymentWatchers = new ArrayList<DeploymentWatcher>();
+
+    @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY)
+    private ArtifactResolver artifactResolver;
+//    private final Kernel kernel;
+
+
+//    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection watchers, Kernel kernel) throws GBeanNotFoundException {
+//        this(remoteDeployAddress, builders, stores, watchers, getArtifactResolver(kernel), kernel);
+//    }
+//
+//    private static ArtifactResolver getArtifactResolver(Kernel kernel) throws GBeanNotFoundException {
+//        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
+//        return configurationManager.getArtifactResolver();
+//    }
+//
+//    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection watchers, ArtifactResolver artifactResolver, Kernel kernel) {
+//        this.remoteDeployAddress = remoteDeployAddress;
+//        this.builders = builders;
+//        this.stores = stores;
+//        this.watchers = watchers;
+//        this.artifactResolver = artifactResolver;
+////        this.kernel = kernel;
+//
+//        // Create and start the reaper...
+//        this.reaper = new DeployerReaper(REAPER_INTERVAL);
+//
+//    }
+
+    public DeployerImpl() {
+    }
+
+    @Activate
+    public void activate(Map context) {
+        String remoteDeployAddress = (String) context.get(REMOTE_DEPLOY_ADDRESS);
+        if (remoteDeployAddress != null) {
+            this.remoteDeployAddress = remoteDeployAddress;
+        }
     }
 
-    private static ArtifactResolver getArtifactResolver(Kernel kernel) throws GBeanNotFoundException {
-        ConfigurationManager configurationManager = ConfigurationUtil.getConfigurationManager(kernel);
-        return configurationManager.getArtifactResolver();
+    @Deactivate
+    public void doStop() throws Exception {
+        reaper.close();
     }
 
-    public Deployer(String remoteDeployAddress, Collection builders, Collection stores, Collection watchers, ArtifactResolver artifactResolver, Kernel kernel) {
-        this.remoteDeployAddress = remoteDeployAddress;
-        this.builders = builders;
-        this.stores = stores;
-        this.watchers = watchers;
+    public void bindConfigurationStore(ConfigurationStore store) {
+        configurationStores.add(store);
+    }
+    
+    public void unbindConfigurationStore(ConfigurationStore store) {
+        configurationStores.remove(store);
+    }
+    
+    public void bindConfigurationBuilder(ConfigurationBuilder builder) {
+        configurationBuilders.add(builder);
+    }
+    
+    public void unbindConfigurationBuilder(ConfigurationBuilder builder) {
+        configurationBuilders.remove(builder);
+    }
+    
+    public void bindDeploymentWatcher(DeploymentWatcher watcher) {
+        deploymentWatchers.add(watcher);
+    }
+    
+    public void unbindDeploymentWatcher(DeploymentWatcher watcher) {
+        deploymentWatchers.remove(watcher);
+    }
+    
+    public void setArtifactResolver(ArtifactResolver artifactResolver) {
         this.artifactResolver = artifactResolver;
-        this.kernel = kernel;
-
-        // Create and start the reaper...
-        this.reaper = new DeployerReaper(REAPER_INTERVAL);
+    }
+    public void unsetArtifactResolver(ArtifactResolver artifactResolver) {
+        if (this.artifactResolver == artifactResolver) {
+            this.artifactResolver = null;
+        }
+    }
 
+    public void setRemoteDeployAddress(String remoteDeployAddress) {
+        this.remoteDeployAddress = remoteDeployAddress;
     }
 
+    @Override
     public List deploy(boolean inPlace, File moduleFile, File planFile) throws DeploymentException {
         return deploy(inPlace, moduleFile, planFile, null);
     }
 
+    @Override
     public List deploy(boolean inPlace, File moduleFile, File planFile, String targetConfigStore) throws DeploymentException {
         File originalModuleFile = moduleFile;
         File tmpDir = null;
@@ -158,64 +223,68 @@ public class Deployer implements GBeanLi
      *
      * @return The URL that clients should use for deployment file uploads.
      */
+    @Override
     public String getRemoteDeployUploadURL() {
         // Get the token GBean from the remote deployment configuration
-        Set set = kernel.listGBeans(new AbstractNameQuery("org.apache.geronimo.deployment.remote.RemoteDeployToken"));
-        if (set.size() == 0) {
-            return null;
-        }
-        AbstractName token = (AbstractName) set.iterator().next();
-        // Identify the parent configuration for that GBean
-        set = kernel.getDependencyManager().getParents(token);
-        ObjectName config = null;
-        for (Iterator it = set.iterator(); it.hasNext();) {
-            AbstractName name = (AbstractName) it.next();
-            if (Configuration.isConfigurationObjectName(name.getObjectName())) {
-                config = name.getObjectName();
-                break;
-            }
-        }
-        if (config == null) {
-            log.warn("Unable to find remote deployment configuration; is the remote deploy web application running?");
-            return null;
-        }
-        // Generate the URL based on the remote deployment configuration
-        Map<String, String> hash = new HashMap<String, String>();
-        hash.put("J2EEApplication", token.getObjectName().getKeyProperty("J2EEApplication"));
-        hash.put("j2eeType", "WebModule");
-        try {
-            hash.put("name", Configuration.getConfigurationID(config).toString());
-            Set<AbstractName> names = kernel.listGBeans(new AbstractNameQuery(null, hash));
-            if (names.size() != 1) {
-                log.error("Unable to look up remote deploy upload URL");
-                return null;
-            }
-            AbstractName module = names.iterator().next();
-            String contextPath = (String) kernel.getAttribute(module, "contextPath");
-            if (null == contextPath) {
-                throw new IllegalStateException("Cannot find contextPath attribute for [" + module + "]");
-            }
-            String temp = remoteDeployAddress + "/" + contextPath + "/upload";
-            return URI.create(temp).normalize().toString();
-        } catch (Exception e) {
-            log.error("Unable to look up remote deploy upload URL", e);
-            return null;
-        }
+        //TODO osgi-gbean
+        return null;
+//        Set set = kernel.listGBeans(new AbstractNameQuery("org.apache.geronimo.deployment.remote.RemoteDeployToken"));
+//        if (set.size() == 0) {
+//            return null;
+//        }
+//        AbstractName token = (AbstractName) set.iterator().next();
+//        // Identify the parent configuration for that GBean
+//        set = kernel.getDependencyManager().getParents(token);
+//        ObjectName config = null;
+//        for (Iterator it = set.iterator(); it.hasNext();) {
+//            AbstractName name = (AbstractName) it.next();
+//            if (Configuration.isConfigurationObjectName(name.getObjectName())) {
+//                config = name.getObjectName();
+//                break;
+//            }
+//        }
+//        if (config == null) {
+//            log.warn("Unable to find remote deployment configuration; is the remote deploy web application running?");
+//            return null;
+//        }
+//        // Generate the URL based on the remote deployment configuration
+//        Map<String, String> hash = new HashMap<String, String>();
+//        hash.put("J2EEApplication", token.getObjectName().getKeyProperty("J2EEApplication"));
+//        hash.put("j2eeType", "WebModule");
+//        try {
+//            hash.put("name", Configuration.getConfigurationID(config).toString());
+//            Set<AbstractName> names = kernel.listGBeans(new AbstractNameQuery(null, hash));
+//            if (names.size() != 1) {
+//                log.error("Unable to look up remote deploy upload URL");
+//                return null;
+//            }
+//            AbstractName module = names.iterator().next();
+//            String contextPath = (String) kernel.getAttribute(module, "contextPath");
+//            if (null == contextPath) {
+//                throw new IllegalStateException("Cannot find contextPath attribute for [" + module + "]");
+//            }
+//            String temp = remoteDeployAddress + "/" + contextPath + "/upload";
+//            return URI.create(temp).normalize().toString();
+//        } catch (Exception e) {
+//            log.error("Unable to look up remote deploy upload URL", e);
+//            return null;
+//        }
     }
 
+    @Override
     public List deploy(boolean inPlace,
-            File moduleFile,
-            File planFile,
-            File targetFile,
-            boolean install,
-            String mainClass,
-            String mainGBean, String mainMethod, String manifestConfigurations, String classPath,
-            String endorsedDirs,
-            String extensionDirs,
-            String targetConfigurationStore) throws DeploymentException {
+                       File moduleFile,
+                       File planFile,
+                       File targetFile,
+                       boolean install,
+                       String mainClass,
+                       String mainGBean, String mainMethod, String manifestConfigurations, String classPath,
+                       String endorsedDirs,
+                       String extensionDirs,
+                       String targetConfigurationStore) throws DeploymentException {
         if (planFile == null && moduleFile == null) {
             throw new DeploymentException("No plan or module specified");
-        } else if (stores.isEmpty()) {
+        } else if (configurationStores.isEmpty()) {
             throw new DeploymentException("No ConfigurationStores!");
         }
         validatePlanFile(planFile);
@@ -228,7 +297,7 @@ public class Deployer implements GBeanLi
         try {
             Object plan = null;
             ConfigurationBuilder builder = null;
-            for (Iterator i = builders.iterator(); i.hasNext();) {
+            for (Iterator i = configurationBuilders.iterator(); i.hasNext();) {
                 ConfigurationBuilder candidate = (ConfigurationBuilder) i.next();
                 plan = candidate.getDeploymentPlan(planFile, module, idBuilder);
                 if (plan != null) {
@@ -249,7 +318,7 @@ public class Deployer implements GBeanLi
             ConfigurationStore store = getConfigurationStore(targetConfigurationStore);
 
             // It's our responsibility to close this context, once we're done with it...
-            context = builder.buildConfiguration(inPlace, configID, plan, module, stores, artifactResolver, store);
+            context = builder.buildConfiguration(inPlace, configID, plan, module, configurationStores, artifactResolver, store);
             // Copy the external plan to the META-INF folder with the uniform name plan.xml if there is nothing there already
             if (planFile != null && !context.getTargetFile(PLAN_LOCATION).exists()) {
                 context.addFile(PLAN_LOCATION, planFile);
@@ -301,12 +370,12 @@ public class Deployer implements GBeanLi
 
     private ConfigurationStore getConfigurationStore(String targetConfigurationStore)
             throws URISyntaxException, GBeanNotFoundException {
-        if (targetConfigurationStore != null) {
-            AbstractName targetStoreName = new AbstractName(new URI(targetConfigurationStore));
-            return (ConfigurationStore) kernel.getGBean(targetStoreName);
-        } else {
-            return (ConfigurationStore) stores.iterator().next();
-        }
+//        if (targetConfigurationStore != null) {
+//            AbstractName targetStoreName = new AbstractName(new URI(targetConfigurationStore));
+//            return (ConfigurationStore) kernel.getGBean(targetStoreName);
+//        } else {
+            return (ConfigurationStore) configurationStores.iterator().next();
+//        }
     }
 
     private Artifact getConfigID(JarFile module,
@@ -320,12 +389,13 @@ public class Deployer implements GBeanLi
         }
 
         // Make sure this configuration doesn't already exist
-        try {
-            kernel.getGBeanState(Configuration.getConfigurationAbstractName(configID));
-            throw new DeploymentException("Module " + configID + " already exists in the server.  Try to undeploy it first or use the redeploy command.");
-        } catch (GBeanNotFoundException e) {
-            // this is good
-        }
+        //TODO osgi-gbean
+//        try {
+//            kernel.getGBeanState(Configuration.getConfigurationAbstractName(configID));
+//            throw new DeploymentException("Module " + configID + " already exists in the server.  Try to undeploy it first or use the redeploy command.");
+//        } catch (GBeanNotFoundException e) {
+//            // this is good
+//        }
         return configID;
     }
 
@@ -482,7 +552,7 @@ public class Deployer implements GBeanLi
             String s = (String) list.get(i);
             arts[i] = Artifact.create(s);
         }
-        for (Iterator it = watchers.iterator(); it.hasNext();) {
+        for (Iterator it = deploymentWatchers.iterator(); it.hasNext();) {
             DeploymentWatcher watcher = (DeploymentWatcher) it.next();
             for (int i = 0; i < arts.length; i++) {
                 Artifact art = arts[i];
@@ -501,18 +571,6 @@ public class Deployer implements GBeanLi
         }
     }
 
-    public void doStart() throws Exception {
-    }
-
-    public void doFail() {
-        if (reaper != null) {
-            reaper.close();
-        }
-    }
-
-    public void doStop() throws Exception {
-    }
-
     /**
      * Thread to cleanup unused temporary Deployer directories (and files).
      * On Windows, open files can't be deleted. Until MultiParentClassLoaders
@@ -606,31 +664,4 @@ public class Deployer implements GBeanLi
         }
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    private static final String DEPLOYER = "Deployer";
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(Deployer.class, DEPLOYER);
-
-        infoFactory.addAttribute("kernel", Kernel.class, false);
-        infoFactory.addAttribute("remoteDeployAddress", String.class, true, true);
-        infoFactory.addAttribute("remoteDeployUploadURL", String.class, false);
-//        infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class});
-//        infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class, String.class});
-//        infoFactory.addOperation("deploy", new Class[]{boolean.class, File.class, File.class, File.class, boolean.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class, String.class});
-
-        infoFactory.addReference("Builders", ConfigurationBuilder.class, "ConfigBuilder");
-        infoFactory.addReference("Store", ConfigurationStore.class, "ConfigurationStore");
-        infoFactory.addReference("Watchers", DeploymentWatcher.class);
-
-        infoFactory.setConstructor(new String[]{"remoteDeployAddress", "Builders", "Store", "Watchers", "kernel"});
-
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }