You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/08/16 11:56:51 UTC

svn commit: r431871 [1/2] - in /incubator/servicemix/trunk: geronimo-1.0/ geronimo-1.1/ geronimo/ geronimo/deployer-service/ geronimo/deployer-service/src/ geronimo/deployer-service/src/main/ geronimo/deployer-service/src/main/java/ geronimo/deployer-s...

Author: gnodet
Date: Wed Aug 16 02:56:48 2006
New Revision: 431871

URL: http://svn.apache.org/viewvc?rev=431871&view=rev
Log:
SM-522: fix geronimo integration where the SL were not supported.
Also rework it so it now uses the new m2 plugin, and include the necessary
informations to make G plugins.

Added:
    incubator/servicemix/trunk/geronimo/   (with props)
    incubator/servicemix/trunk/geronimo/deployer/   (with props)
    incubator/servicemix/trunk/geronimo/deployer-service/   (with props)
    incubator/servicemix/trunk/geronimo/deployer-service/pom.xml
    incubator/servicemix/trunk/geronimo/deployer-service/src/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/apache/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/apache/servicemix/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/apache/servicemix/geronimo/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixConfigBuilder.java
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/DISCLAIMER
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/LICENSE
    incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/NOTICE
    incubator/servicemix/trunk/geronimo/deployer/pom.xml
    incubator/servicemix/trunk/geronimo/deployer/src/
    incubator/servicemix/trunk/geronimo/deployer/src/plan/
    incubator/servicemix/trunk/geronimo/deployer/src/plan/geronimo-service.xml
    incubator/servicemix/trunk/geronimo/deployer/src/resources/
    incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/
    incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/DISCLAIMER
    incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/LICENSE
    incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/NOTICE
    incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/geronimo-plugin.xml
    incubator/servicemix/trunk/geronimo/pom.xml
    incubator/servicemix/trunk/geronimo/servicemix/   (with props)
    incubator/servicemix/trunk/geronimo/servicemix-service/   (with props)
    incubator/servicemix/trunk/geronimo/servicemix-service/pom.xml
    incubator/servicemix/trunk/geronimo/servicemix-service/src/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Component.java
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Container.java
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceAssembly.java
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixGBean.java
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/SharedLibrary.java
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/resources/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/resources/META-INF/
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/resources/META-INF/DISCLAIMER
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/resources/META-INF/LICENSE
    incubator/servicemix/trunk/geronimo/servicemix-service/src/main/resources/META-INF/NOTICE
    incubator/servicemix/trunk/geronimo/servicemix/pom.xml
    incubator/servicemix/trunk/geronimo/servicemix/src/
    incubator/servicemix/trunk/geronimo/servicemix/src/plan/
    incubator/servicemix/trunk/geronimo/servicemix/src/plan/geronimo-service.xml
    incubator/servicemix/trunk/geronimo/servicemix/src/resources/
    incubator/servicemix/trunk/geronimo/servicemix/src/resources/META-INF/
    incubator/servicemix/trunk/geronimo/servicemix/src/resources/META-INF/DISCLAIMER
    incubator/servicemix/trunk/geronimo/servicemix/src/resources/META-INF/LICENSE
    incubator/servicemix/trunk/geronimo/servicemix/src/resources/META-INF/NOTICE
    incubator/servicemix/trunk/geronimo/servicemix/src/resources/META-INF/geronimo-plugin.xml
    incubator/servicemix/trunk/sandbox/geronimo-1.0/
      - copied from r431257, incubator/servicemix/trunk/geronimo-1.0/
    incubator/servicemix/trunk/sandbox/geronimo-1.1/
      - copied from r431257, incubator/servicemix/trunk/geronimo-1.1/
Removed:
    incubator/servicemix/trunk/geronimo-1.0/
    incubator/servicemix/trunk/geronimo-1.1/

Propchange: incubator/servicemix/trunk/geronimo/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 16 02:56:48 2006
@@ -0,0 +1 @@
+velocity.log

Propchange: incubator/servicemix/trunk/geronimo/deployer/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 16 02:56:48 2006
@@ -0,0 +1,3 @@
+.project
+velocity.log
+target

Propchange: incubator/servicemix/trunk/geronimo/deployer-service/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 16 02:56:48 2006
@@ -0,0 +1,3 @@
+.classpath
+.project
+target

Added: incubator/servicemix/trunk/geronimo/deployer-service/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer-service/pom.xml?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer-service/pom.xml (added)
+++ incubator/servicemix/trunk/geronimo/deployer-service/pom.xml Wed Aug 16 02:56:48 2006
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!-- $Rev: 359503 $ $Date: 2005-12-28 13:56:03 +0100 (mer., 28 déc. 2005) $ -->
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.geronimo</groupId>
+        <artifactId>geronimo</artifactId>
+        <version>3.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>deployer-service</artifactId>
+    <name>ServiceMix :: Geronimo :: Deployer service</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix.geronimo</groupId>
+            <artifactId>servicemix-service</artifactId>
+            <version>3.0-incubating-SNAPSHOT</version>
+            <type>jar</type>
+        </dependency>
+        
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${geronimo-version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-deployment</artifactId>
+            <version>${geronimo-version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-service-builder</artifactId>
+            <version>${geronimo-version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-common</artifactId>
+            <version>${geronimo-version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-j2ee</artifactId>
+            <version>${geronimo-version}</version>
+        </dependency>
+
+    </dependencies>
+
+</project>

Added: incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixConfigBuilder.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixConfigBuilder.java?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixConfigBuilder.java (added)
+++ incubator/servicemix/trunk/geronimo/deployer-service/src/main/java/org/apache/servicemix/geronimo/ServiceMixConfigBuilder.java Wed Aug 16 02:56:48 2006
@@ -0,0 +1,385 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.geronimo;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Set;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+
+import javax.management.MalformedObjectNameException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.geronimo.deployment.ConfigurationBuilder;
+import org.apache.geronimo.deployment.DeploymentContext;
+import org.apache.geronimo.deployment.ModuleIDBuilder;
+import org.apache.geronimo.deployment.service.EnvironmentBuilder;
+import org.apache.geronimo.deployment.util.DeploymentUtil;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
+import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationStore;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.repository.ArtifactResolver;
+import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.ImportType;
+import org.apache.geronimo.kernel.repository.Repository;
+import org.apache.geronimo.kernel.repository.Version;
+import org.apache.servicemix.jbi.deployment.Descriptor;
+import org.apache.servicemix.jbi.deployment.DescriptorFactory;
+import org.apache.servicemix.jbi.deployment.ServiceUnit;
+import org.apache.servicemix.jbi.deployment.SharedLibraryList;
+
+public class ServiceMixConfigBuilder implements ConfigurationBuilder {
+
+    private static final Log log = LogFactory.getLog(ServiceMixConfigBuilder.class);
+
+    private final Environment defaultEnvironment;
+
+    private final Collection repositories;
+
+    private final Kernel kernel;
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder(ServiceMixConfigBuilder.class, NameFactory.CONFIG_BUILDER);
+        infoFactory.addInterface(ConfigurationBuilder.class);
+        infoFactory.addAttribute("defaultEnvironment", Environment.class, true, true);
+        infoFactory.addAttribute("kernel", Kernel.class, false);
+        infoFactory.addReference("Repositories", Repository.class, "Repository");
+        infoFactory.setConstructor(new String[] { "defaultEnvironment", "Repositories", "kernel" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+    public ServiceMixConfigBuilder(Environment defaultEnvironment, Collection repositories, Kernel kernel) {
+        this.defaultEnvironment = defaultEnvironment;
+        this.repositories = repositories;
+        this.kernel = kernel;
+    }
+
+    /**
+     * Builds a deployment plan specific to this builder from a planFile and/or
+     * module if this builder can process it.
+     * 
+     * @param planFile
+     *            the deployment plan to examine; can be null
+     * @param module
+     *            the URL of the module to examine; can be null
+     * @return the deployment plan, or null if this builder can not handle the
+     *         module
+     * @throws org.apache.geronimo.common.DeploymentException
+     *             if there was a problem with the configuration
+     */
+    public Object getDeploymentPlan(File planFile, JarFile module, ModuleIDBuilder idBuilder)
+                    throws DeploymentException {
+        log.debug("Checking for ServiceMix deployment.");
+        System.err.println("Checking for ServiceMix deployment.");
+        if (module == null) {
+            return null;
+        }
+
+        // Check that the jbi descriptor is present
+        try {
+            URL url = DeploymentUtil.createJarURL(module, "META-INF/jbi.xml");
+            Descriptor descriptor = DescriptorFactory.buildDescriptor(url);
+            if (descriptor == null) {
+                return null;
+            }
+            DescriptorFactory.checkDescriptor(descriptor);
+            return descriptor;
+        } catch (Exception e) {
+            log.debug("Not a ServiceMix deployment: no jbi.xml found.", e);
+            // no jbi.xml, not for us
+            return null;
+        }
+    }
+
+    /**
+     * Checks what configuration URL will be used for the provided module.
+     * 
+     * @param plan
+     *            the deployment plan
+     * @param module
+     *            the module to build
+     * @return the ID that will be used for the Configuration
+     * @throws IOException
+     *             if there was a problem reading or writing the files
+     * @throws org.apache.geronimo.common.DeploymentException
+     *             if there was a problem with the configuration
+     */
+    public Artifact getConfigurationID(Object plan, JarFile module, ModuleIDBuilder idBuilder) throws IOException,
+                    DeploymentException {
+        Descriptor descriptor = (Descriptor) plan;
+        if (descriptor.getComponent() != null) {
+            return new Artifact("servicemix-components", descriptor.getComponent().getIdentification().getName(),
+                            (Version) null, "car");
+        } else if (descriptor.getServiceAssembly() != null) {
+            return new Artifact("servicemix-assemblies", descriptor.getServiceAssembly().getIdentification().getName(),
+                            (Version) null, "car");
+        } else if (descriptor.getSharedLibrary() != null) {
+            return new Artifact("servicemix-libraries", descriptor.getSharedLibrary().getIdentification().getName(),
+                            descriptor.getSharedLibrary().getVersion(), "car");
+        } else {
+            throw new DeploymentException("Unable to construct configuration ID " + module.getName()
+                            + ": unrecognized jbi package. Should be a component, assembly or library.");
+        }
+    }
+
+    /**
+     * Build a configuration from a local file
+     * 
+     * @param inPlaceDeployment
+     * @param configId
+     * @param plan
+     * @param earFile
+     * @param configurationStores
+     * @param artifactResolver
+     * @param targetConfigurationStore
+     * @return the DeploymentContext information
+     * @throws IOException
+     *             if there was a problem reading or writing the files
+     * @throws org.apache.geronimo.common.DeploymentException
+     *             if there was a problem with the configuration
+     */
+    public DeploymentContext buildConfiguration(boolean inPlaceDeployment, Artifact configId, Object plan,
+                    JarFile jarFile, Collection configurationStores, ArtifactResolver artifactResolver,
+                    ConfigurationStore targetConfigurationStore) throws IOException, DeploymentException {
+        if (plan == null) {
+            log.warn("Expected a Descriptor but received null");
+            return null;
+        }
+        if (plan instanceof Descriptor == false) {
+            log.warn("Expected a Descriptor but received a " + plan.getClass().getName());
+            return null;
+        }
+        File configurationDir;
+        try {
+            configurationDir = targetConfigurationStore.createNewConfigurationDir(configId);
+        } catch (ConfigurationAlreadyExistsException e) {
+            throw new DeploymentException(e);
+        }
+
+        Environment environment = new Environment();
+        environment.setConfigId(configId);
+        EnvironmentBuilder.mergeEnvironments(environment, defaultEnvironment);
+
+        DeploymentContext context = null;
+        try {
+            Descriptor descriptor = (Descriptor) plan;
+            context = new DeploymentContext(configurationDir,
+                            inPlaceDeployment ? DeploymentUtil.toFile(jarFile) : null, environment,
+                            ConfigurationModuleType.SERVICE, kernel.getNaming(), ConfigurationUtil
+                                            .getConfigurationManager(kernel), repositories);
+            if (descriptor.getComponent() != null) {
+                buildComponent(descriptor, context, jarFile);
+            } else if (descriptor.getServiceAssembly() != null) {
+                buildServiceAssembly(descriptor, context, jarFile);
+            } else if (descriptor.getSharedLibrary() != null) {
+                buildSharedLibrary(descriptor, context, jarFile);
+            } else {
+                throw new IllegalStateException("Invalid jbi descriptor");
+            }
+        } catch (Exception e) {
+            if (context != null) {
+                context.close();
+            }
+            DeploymentUtil.recursiveDelete(configurationDir);
+            throw new DeploymentException("Unable to deploy", e);
+        }
+
+        return context;
+    }
+
+    protected void buildComponent(Descriptor descriptor, DeploymentContext context, JarFile module) throws Exception {
+        Environment environment = context.getConfiguration().getEnvironment();
+        // Unzip the component
+        File targetDir = new File(context.getBaseDir(), "install");
+        targetDir.mkdirs();
+        unzip(context, module, new URI("install/"));
+        // Create workspace dir
+        File workDir = new File(context.getBaseDir(), "workspace");
+        workDir.mkdirs();
+        // Create the bootstrap and perform installation
+        // TODO: Create the bootstrap and perform installation
+        // Add classpath entries
+        if ("self-first".equals(descriptor.getComponent().getComponentClassLoaderDelegation())) {
+            context.getConfiguration().getEnvironment().setInverseClassLoading(true);
+        }
+        SharedLibraryList[] slList = descriptor.getComponent().getSharedLibraries();
+        if (slList != null) {
+            for (int i = 0; i < slList.length; i++) {
+                Artifact sl = new Artifact("servicemix-libraries", slList[i].getName(), slList[i].getVersion(), "car");
+                environment.addDependency(sl, ImportType.CLASSES);
+            }
+        }
+        if (descriptor.getComponent().getComponentClassPath() != null) {
+            String[] pathElements = descriptor.getComponent().getComponentClassPath().getPathElements();
+            if (pathElements != null) {
+                for (int i = 0; i < pathElements.length; i++) {
+                    // We can not add includes directly, so move the file and
+                    // include it
+                    File include = new File(targetDir, pathElements[i]);
+                    File temp = new File(workDir, pathElements[i]);
+                    if (!include.isFile()) {
+                        throw new Exception("Classpath element '" + pathElements[i] + "' not found");
+                    }
+                    temp.getParentFile().mkdirs();
+                    include.renameTo(temp);
+                    context.addInclude(new URI("install/").resolve(pathElements[i]), temp);
+                    temp.delete();
+                }
+            }
+        }
+        // Create the JBI deployment managed object
+        Properties props = new Properties();
+        props.put("jbiType", "JBIComponent");
+        props.put("name", descriptor.getComponent().getIdentification().getName());
+        AbstractName name = new AbstractName(environment.getConfigId(), props);
+        GBeanData gbeanData = new GBeanData(name, Component.GBEAN_INFO);
+        gbeanData.setAttribute("name", descriptor.getComponent().getIdentification().getName());
+        gbeanData.setAttribute("description", descriptor.getComponent().getIdentification().getDescription());
+        gbeanData.setAttribute("type", descriptor.getComponent().getType());
+        gbeanData.setAttribute("className", descriptor.getComponent().getComponentClassName());
+        gbeanData.setReferencePattern("container", getContainerObjectName());
+        context.addGBean(gbeanData);
+    }
+
+    protected void buildServiceAssembly(Descriptor descriptor, DeploymentContext context, JarFile module)
+                    throws Exception {
+        Environment environment = context.getConfiguration().getEnvironment();
+        // Unzip the component
+        File targetDir = new File(context.getBaseDir(), "install");
+        targetDir.mkdirs();
+        unzip(context, module, new URI("install/"));
+        // Unzip SUs
+        ServiceUnit[] sus = descriptor.getServiceAssembly().getServiceUnits();
+        for (int i = 0; i < sus.length; i++) {
+            String name = sus[i].getIdentification().getName();
+            String zip = sus[i].getTarget().getArtifactsZip();
+            String comp = sus[i].getTarget().getComponentName();
+            unzip(context, new JarFile(new File(targetDir, zip)), new URI("sus/" + comp + "/" + name + "/"));
+            // Deploy the SU on the component
+            // TODO: deploy
+            // Add component config as a dependency
+            Artifact sl = new Artifact("servicemix-components", comp, (Version) null, "car");
+            environment.addDependency(sl, ImportType.ALL);
+        }
+        // Create the JBI deployment managed object
+        Properties props = new Properties();
+        props.put("jbiType", "JBIServiceAssembly");
+        props.put("name", descriptor.getServiceAssembly().getIdentification().getName());
+        AbstractName name = new AbstractName(environment.getConfigId(), props);
+        GBeanData gbeanData = new GBeanData(name, ServiceAssembly.GBEAN_INFO);
+        gbeanData.setAttribute("name", descriptor.getServiceAssembly().getIdentification().getName());
+        gbeanData.setReferencePattern("container", getContainerObjectName());
+        for (int i = 0; i < sus.length; i++) {
+            String comp = sus[i].getTarget().getComponentName();
+            gbeanData.addDependency(getComponentName(comp));
+        }
+        context.addGBean(gbeanData);
+    }
+
+    protected void buildSharedLibrary(Descriptor descriptor, DeploymentContext context, JarFile module)
+                    throws Exception {
+        Environment environment = context.getConfiguration().getEnvironment();
+        // Unzip the SL
+        File targetDir = new File(context.getBaseDir(), "install");
+        targetDir.mkdirs();
+        unzip(context, module, new URI("install/"));
+        // Create workspace dir
+        File workDir = new File(context.getBaseDir(), "workspace");
+        workDir.mkdirs();
+        // Add classpath entries
+        if ("self-first".equals(descriptor.getSharedLibrary().getClassLoaderDelegation())) {
+            context.getConfiguration().getEnvironment().setInverseClassLoading(true);
+        }
+        if (descriptor.getSharedLibrary().getSharedLibraryClassPath() != null) {
+            String[] pathElements = descriptor.getSharedLibrary().getSharedLibraryClassPath().getPathElements();
+            if (pathElements != null) {
+                for (int i = 0; i < pathElements.length; i++) {
+                    log.debug("Processing pathElements[" + i + "]: " + pathElements[i]);
+                    // We can not add includes directly, so move the file and
+                    // include it
+                    File include = new File(targetDir, pathElements[i]);
+                    File temp = new File(workDir, pathElements[i]);
+                    if (!include.isFile()) {
+                        throw new Exception("Classpath element '" + pathElements[i] + "' not found");
+                    }
+                    temp.getParentFile().mkdirs();
+                    include.renameTo(temp);
+                    context.addInclude(new URI("install/").resolve(pathElements[i]), temp);
+                    temp.delete();
+                }
+            } else {
+                log.debug("SharedLibrary().getSharedLibraryClassPath().getPathElements() is null");
+            }
+        } else {
+            log.debug("SharedLibrary().getSharedLibraryClassPath() is null");
+        }
+        // Create the JBI deployment managed object
+        Properties props = new Properties();
+        props.put("jbiType", "JBISharedLibrary");
+        props.put("name", descriptor.getSharedLibrary().getIdentification().getName());
+        AbstractName name = new AbstractName(environment.getConfigId(), props);
+        GBeanData gbeanData = new GBeanData(name, SharedLibrary.GBEAN_INFO);
+        gbeanData.setAttribute("name", descriptor.getSharedLibrary().getIdentification().getName());
+        gbeanData.setAttribute("description", descriptor.getSharedLibrary().getIdentification().getDescription());
+        gbeanData.setReferencePattern("container", getContainerObjectName());
+        context.addGBean(gbeanData);
+    }
+
+    protected void unzip(DeploymentContext context, JarFile module, URI targetUri) throws IOException {
+        Enumeration entries = module.entries();
+        while (entries.hasMoreElements()) {
+            ZipEntry entry = (ZipEntry) entries.nextElement();
+            URI target = targetUri.resolve(entry.getName());
+            context.addFile(target, module, entry);
+        }
+    }
+
+    protected AbstractName getContainerObjectName() {
+        AbstractNameQuery query = new AbstractNameQuery(Container.class.getName());
+        Set names = kernel.listGBeans(query);
+        return (AbstractName) names.iterator().next();
+    }
+
+    protected AbstractNameQuery getComponentName(String name) throws MalformedObjectNameException {
+        URI uri = URI.create("servicemix-components/" + name + "//car?jbiType=JBIComponent");
+        return new AbstractNameQuery(uri);
+    }
+
+}

Added: incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/DISCLAIMER?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/DISCLAIMER (added)
+++ incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/DISCLAIMER Wed Aug 16 02:56:48 2006
@@ -0,0 +1,6 @@
+Apache ServiceMix is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Geronimo PMC. 
+Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, 
+communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. 
+
+While incubation status is not necessarily a reflection of the completeness or stability of the code, it does 
+indicate that the project has yet to be fully endorsed by the ASF.

Added: incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/LICENSE?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/LICENSE (added)
+++ incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/LICENSE Wed Aug 16 02:56:48 2006
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+

Added: incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/NOTICE?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/NOTICE (added)
+++ incubator/servicemix/trunk/geronimo/deployer-service/src/main/resources/META-INF/NOTICE Wed Aug 16 02:56:48 2006
@@ -0,0 +1,8 @@
+   =========================================================================
+   ==  NOTICE file for use with the Apache License, Version 2.0,          ==
+   ==  in this case for the Apache ServiceMix distribution.               ==
+   =========================================================================
+
+   This product contains software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+

Added: incubator/servicemix/trunk/geronimo/deployer/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer/pom.xml?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer/pom.xml (added)
+++ incubator/servicemix/trunk/geronimo/deployer/pom.xml Wed Aug 16 02:56:48 2006
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!-- $Rev: 359503 $ $Date: 2005-12-28 13:56:03 +0100 (mer., 28 déc. 2005) $ -->
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.geronimo</groupId>
+        <artifactId>geronimo</artifactId>
+        <version>3.0-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>deployer</artifactId>
+    <name>ServiceMix :: Geronimo :: Deployer plugin</name>
+    <packaging>car</packaging>
+
+    <dependencies>
+        <!-- For build ordering -->
+        <dependency>
+            <groupId>org.apache.servicemix.geronimo</groupId>
+            <artifactId>deployer-service</artifactId>
+            <version>${servicemix-plugin-version}</version>
+            <scope>provided</scope>
+            <type>jar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.servicemix.geronimo</groupId>
+            <artifactId>servicemix</artifactId>
+            <version>${servicemix-plugin-version}</version>
+            <scope>provided</scope>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-gbean-deployer</artifactId>
+            <version>${geronimo-version}</version>
+            <type>car</type>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>j2ee-server</artifactId>
+            <version>${geronimo-version}</version>
+            <type>car</type>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-j2ee-deployer</artifactId>
+            <version>${geronimo-version}</version>
+            <type>car</type>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${pom.basedir}/src/resources/META-INF</directory>
+                <includes>
+                    <include>geronimo-plugin.xml</include>
+                </includes>
+                <targetPath>META-INF</targetPath>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.geronimo.plugins</groupId>
+                <artifactId>car-maven-plugin</artifactId>
+                <version>${car-maven-plugin-version}</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <deploymentConfigs>
+                        <deploymentConfig>geronimo/geronimo-gbean-deployer/${geronimo-version}/car</deploymentConfig>
+                    </deploymentConfigs>
+                    <deployerName>geronimo/geronimo-gbean-deployer/${geronimo-version}/car?j2eeType=Deployer,name=Deployer</deployerName>
+                    <planFileName>geronimo-service.xml</planFileName>
+                    <moduleFile>${settings.localRepository}/org/apache/servicemix/geronimo/deployer-service/${pom.version}/deployer-service-${pom.version}.jar</moduleFile>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>    
+</project>

Added: incubator/servicemix/trunk/geronimo/deployer/src/plan/geronimo-service.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer/src/plan/geronimo-service.xml?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer/src/plan/geronimo-service.xml (added)
+++ incubator/servicemix/trunk/geronimo/deployer/src/plan/geronimo-service.xml Wed Aug 16 02:56:48 2006
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!-- $Rev: 388257 $ $Date: 2006-03-23 21:12:17 +0100 (jeu., 23 mars 2006) $ -->
+<!--
+Configuration for ServiceMix deployer.
+-->
+<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
+
+    <environment>
+        <moduleId>
+            <groupId>org.apache.servicemix.geronimo</groupId>
+            <artifactId>deployer</artifactId>
+            <version>${servicemix-plugin-version}</version>
+            <type>car</type>
+        </moduleId>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.servicemix.geronimo</groupId>
+                <artifactId>servicemix</artifactId>
+                <version>${servicemix-plugin-version}</version>
+                <type>car</type>
+            </dependency>
+            <dependency>
+                <groupId>geronimo</groupId>
+                <artifactId>geronimo-gbean-deployer</artifactId>
+                <version>${geronimo-version}</version>
+                <type>car</type>
+            </dependency>
+            <dependency>
+                <groupId>geronimo</groupId>
+                <artifactId>j2ee-server</artifactId>
+                <version>${geronimo-version}</version>
+                <type>car</type>
+            </dependency>
+            <dependency>
+                <groupId>geronimo</groupId>
+                <artifactId>j2ee-deployer</artifactId>
+                <version>${geronimo-version}</version>
+                <type>car</type>
+            </dependency>
+        </dependencies>
+    </environment>
+
+    <gbean name="ServiceMixConfigBuilder" class="org.apache.servicemix.geronimo.ServiceMixConfigBuilder">
+        <reference name="Repositories" />
+        <xml-attribute name="defaultEnvironment">
+            <environment>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.servicemix.geronimo</groupId>
+                        <artifactId>servicemix</artifactId>
+                        <version>${servicemix-plugin-version}</version>
+                        <type>car</type>
+                    </dependency>
+                </dependencies>
+            </environment>
+        </xml-attribute>
+    </gbean>
+
+</module>

Added: incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/DISCLAIMER?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/DISCLAIMER (added)
+++ incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/DISCLAIMER Wed Aug 16 02:56:48 2006
@@ -0,0 +1,6 @@
+Apache ServiceMix is an effort undergoing incubation at the Apache Software Foundation (ASF), sponsored by the Geronimo PMC. 
+Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, 
+communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. 
+
+While incubation status is not necessarily a reflection of the completeness or stability of the code, it does 
+indicate that the project has yet to be fully endorsed by the ASF.

Added: incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/LICENSE
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/LICENSE?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/LICENSE (added)
+++ incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/LICENSE Wed Aug 16 02:56:48 2006
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+

Added: incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/NOTICE
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/NOTICE?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/NOTICE (added)
+++ incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/NOTICE Wed Aug 16 02:56:48 2006
@@ -0,0 +1,8 @@
+   =========================================================================
+   ==  NOTICE file for use with the Apache License, Version 2.0,          ==
+   ==  in this case for the Apache ServiceMix distribution.               ==
+   =========================================================================
+
+   This product contains software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+

Added: incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/geronimo-plugin.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/geronimo-plugin.xml?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/geronimo-plugin.xml (added)
+++ incubator/servicemix/trunk/geronimo/deployer/src/resources/META-INF/geronimo-plugin.xml Wed Aug 16 02:56:48 2006
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!-- $Rev: 359503 $ $Date: 2005-12-28 13:56:03 +0100 (mer., 28 déc. 2005) $ -->
+<geronimo-plugin xmlns="http://geronimo.apache.org/xml/ns/plugins-1.1">
+  <name>Quartz Scheduler Integration</name>
+  <module-id>org.apache.servicemix.geronimo/deployer/${servicemix-plugin-version}/car</module-id>
+  <category>Integration</category>
+  <description>This plugin Apache ServiceMix JBI container to Geronimo.</description>
+  <url>http://incubator.apache.org/servicemix</url>
+  <author>The ServiceMix development team</author>
+  <license osi-approved="true">BSD -- Apache Software License (ASL) 2.0</license>
+  <geronimo-version>1.1</geronimo-version>
+  <dependency>org.apache.servicemix.geronimo/servicemix//car</dependency>
+  <dependency>geronimo/geronimo-gbean-deployer//car</dependency>
+  <dependency>geronimo/j2ee-server//car</dependency>
+  <dependency>geronimo/j2ee-deployer//car</dependency>
+  <obsoletes>org.apache.servicemix.geronimo/deployer//car</obsoletes>
+  <source-repository>http://incubator.apache.org/servicemix/dist/servicemix-3.0-M2-incubating/m2/</source-repository>
+  <source-repository>http://people.apache.org/~chirino/incubator-activemq-4.0.2-RC3/maven2/</source-repository>
+  <source-repository>http://www.ibiblio.org/maven2/</source-repository>
+  <source-repository>http://people.apache.org/maven-snapshot-repository/</source-repository>
+  <config-xml-content>
+    <gbean name="ServiceMixConfigBuilder" xmlns="http://geronimo.apache.org/xml/ns/attributes-1.1">
+    </gbean>
+  </config-xml-content>
+</geronimo-plugin>

Added: incubator/servicemix/trunk/geronimo/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/pom.xml?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/pom.xml (added)
+++ incubator/servicemix/trunk/geronimo/pom.xml Wed Aug 16 02:56:48 2006
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!-- $Rev: 359503 $ $Date: 2005-12-28 13:56:03 +0100 (mer., 28 déc. 2005) $ -->
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.servicemix</groupId>
+    <artifactId>servicemix</artifactId>
+    <version>3.0-incubating-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.servicemix.geronimo</groupId>
+  <artifactId>geronimo</artifactId>
+  <name>Servicemix :: Geronimo</name>
+  <packaging>pom</packaging>
+  
+  <repositories>
+     <repository>
+        <id>ServiceMix M2</id>
+        <url>http://incubator.apache.org/servicemix/dist/servicemix-3.0-M3-incubating/m2/</url>
+     </repository>
+  </repositories>
+  
+    <properties>
+        <servicemix-plugin-version>3.0-incubating-SNAPSHOT</servicemix-plugin-version>
+        <geronimo-version>1.1</geronimo-version>
+        <servicemix-version>3.0-incubating-SNAPSHOT</servicemix-version>
+        <car-maven-plugin-version>1.2-SNAPSHOT</car-maven-plugin-version>
+    </properties>
+    <modules>
+        <module>servicemix-service</module>
+        <module>deployer-service</module>
+        <module>servicemix</module>
+        <module>deployer</module>
+    </modules>
+    
+</project>

Propchange: incubator/servicemix/trunk/geronimo/servicemix/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 16 02:56:48 2006
@@ -0,0 +1,3 @@
+.project
+target
+velocity.log

Propchange: incubator/servicemix/trunk/geronimo/servicemix-service/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 16 02:56:48 2006
@@ -0,0 +1,3 @@
+.classpath
+.project
+target

Added: incubator/servicemix/trunk/geronimo/servicemix-service/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/servicemix-service/pom.xml?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/servicemix-service/pom.xml (added)
+++ incubator/servicemix/trunk/geronimo/servicemix-service/pom.xml Wed Aug 16 02:56:48 2006
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!-- $Rev: 359503 $ $Date: 2005-12-28 13:56:03 +0100 (mer., 28 déc. 2005) $ -->
+<project
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.servicemix.geronimo</groupId>
+        <artifactId>geronimo</artifactId>
+        <version>3.0-incubating-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>servicemix-service</artifactId>
+    <name>ServiceMix :: Geronimo :: ServiceMix service</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.servicemix</groupId>
+            <artifactId>servicemix-core</artifactId>
+            <version>${servicemix-version}</version>
+        </dependency>
+        
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${geronimo-version}</version>
+        </dependency>
+
+    </dependencies>
+
+</project>

Added: incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Component.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Component.java?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Component.java (added)
+++ incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Component.java Wed Aug 16 02:56:48 2006
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.geronimo;
+
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+
+public class Component implements GBeanLifecycle {
+
+    private static final Log log = LogFactory.getLog(Component.class);
+
+    private String name;
+
+    private String description;
+
+    private String type;
+
+    private String className;
+
+    private Container container;
+
+    private URI rootDir;
+
+    private URI installDir;
+
+    private URI workDir;
+
+    private javax.jbi.component.Component component;
+
+    private ClassLoader classLoader;
+
+    public Component(String name, String description, String type, String className, Container container,
+                    URL configurationBaseUrl, ClassLoader classLoader) throws Exception {
+        this.name = name;
+        this.description = description;
+        this.type = type;
+        this.className = className;
+        this.container = container;
+        // TODO is there a simpler way to do this?
+        if (configurationBaseUrl.getProtocol().equalsIgnoreCase("file")) {
+            this.rootDir = new URI("file", configurationBaseUrl.getPath(), null);
+        } else {
+            this.rootDir = URI.create(configurationBaseUrl.toString());
+        }
+        this.installDir = rootDir.resolve("install/");
+        this.workDir = rootDir.resolve("workspace/");
+        this.classLoader = classLoader;
+        log.info("Created JBI component: " + name);
+    }
+
+    public void doStart() throws Exception {
+        log.info("doStart called for JBI component: " + name);
+        try {
+            component = (javax.jbi.component.Component) classLoader.loadClass(className).newInstance();
+            container.register(this);
+        } catch (ClassNotFoundException e) {
+            log.error(classLoader);
+        }
+    }
+
+    public void doStop() throws Exception {
+        log.info("doStop called for JBI component: " + name);
+        container.unregister(this);
+        component = null;
+    }
+
+    public void doFail() {
+        log.info("doFail called for JBI component: " + name);
+        component = null;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public URI getInstallDir() {
+        return installDir;
+    }
+
+    public URI getWorkDir() {
+        return workDir;
+    }
+
+    public URI getRootDir() {
+        return rootDir;
+    }
+
+    public javax.jbi.component.Component getComponent() {
+        return component;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("JBIComponent", Component.class, "JBIComponent");
+        infoFactory.addAttribute("name", String.class, true);
+        infoFactory.addAttribute("description", String.class, true);
+        infoFactory.addAttribute("type", String.class, true);
+        infoFactory.addAttribute("className", String.class, true);
+        infoFactory.addReference("container", Container.class);
+        infoFactory.addAttribute("configurationBaseUrl", URL.class, true);
+        infoFactory.addAttribute("classLoader", ClassLoader.class, false);
+        infoFactory.setConstructor(new String[] { "name", "description", "type", "className", "container",
+                        "configurationBaseUrl", "classLoader" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Added: incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Container.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Container.java?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Container.java (added)
+++ incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/Container.java Wed Aug 16 02:56:48 2006
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.geronimo;
+
+
+public interface Container {
+
+    public void register(Component component) throws Exception;
+
+    public void unregister(Component component) throws Exception;
+
+    public void register(ServiceAssembly assembly) throws Exception;
+
+    public void unregister(ServiceAssembly assembly) throws Exception;
+
+}

Added: incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceAssembly.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceAssembly.java?rev=431871&view=auto
==============================================================================
--- incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceAssembly.java (added)
+++ incubator/servicemix/trunk/geronimo/servicemix-service/src/main/java/org/apache/servicemix/geronimo/ServiceAssembly.java Wed Aug 16 02:56:48 2006
@@ -0,0 +1,94 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.geronimo;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.servicemix.jbi.deployment.Descriptor;
+import org.apache.servicemix.jbi.deployment.DescriptorFactory;
+
+public class ServiceAssembly implements GBeanLifecycle {
+
+    private static final Log log = LogFactory.getLog(ServiceAssembly.class);
+    
+    private String name;
+	private Container container;
+	private URI rootDir;
+    
+	public ServiceAssembly(String name, 
+			               Container container,
+			               URL configurationBaseUrl) throws Exception {
+		this.name = name;
+		this.container = container;
+        //TODO is there a simpler way to do this?
+        if (configurationBaseUrl.getProtocol().equalsIgnoreCase("file")) {
+        	this.rootDir = new URI("file", configurationBaseUrl.getPath(), null);
+        } else {
+        	this.rootDir = URI.create(configurationBaseUrl.toString());
+        }
+        log.info("Created JBI service assembly: " + name);
+	}
+	
+	public void doStart() throws Exception {
+        log.info("doStart called for JBI service assembly: " + name);
+        container.register(this);
+	}
+
+	public void doStop() throws Exception {
+        log.info("doStop called for JBI service assembly: " + name);
+        container.unregister(this);
+	}
+
+	public void doFail() {
+        log.info("doFail called for JBI service assembly: " + name);
+	}
+	
+	public URI getRootDir() {
+		return rootDir;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public Descriptor getDescriptor() throws Exception {
+		return DescriptorFactory.buildDescriptor(new File(new File(rootDir), "install"));
+	}
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = new GBeanInfoBuilder("JBIServiceAssembly", ServiceAssembly.class, "JBIServiceAssembly");
+        infoFactory.addAttribute("name", String.class, true);
+        infoFactory.addReference("container", Container.class);
+        infoFactory.addAttribute("configurationBaseUrl", URL.class, true);
+        infoFactory.setConstructor(new String[] {"name", "container", "configurationBaseUrl" });
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+    
+}