[jboss-svn-commits] JBL Code SVN: r24097 - in labs/jbossesb/workspace/skeagh: container/microcontainer and 22 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 25 12:09:25 EST 2008
Author: beve
Date: 2008-11-25 12:09:24 -0500 (Tue, 25 Nov 2008)
New Revision: 24097
Added:
labs/jbossesb/workspace/skeagh/container/microcontainer/
labs/jbossesb/workspace/skeagh/container/microcontainer/pom.xml
labs/jbossesb/workspace/skeagh/container/microcontainer/readme.txt
labs/jbossesb/workspace/skeagh/container/microcontainer/src/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/DeploymentUnitResourceLocator.java
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbDeployer.java
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/deployers.xml
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/log4j.xml
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/jboss-esb.xml
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/osgi/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/
labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/log4j.xml
Removed:
labs/jbossesb/workspace/skeagh/examples/file-router/activemq.xml
labs/jbossesb/workspace/skeagh/examples/file-router/src/main/resources/jndi.properties
labs/jbossesb/workspace/skeagh/runtime/src/main/resources/jndi.properties
Modified:
labs/jbossesb/workspace/skeagh/container/pom.xml
labs/jbossesb/workspace/skeagh/examples/file-router/pom.xml
labs/jbossesb/workspace/skeagh/examples/file-router/src/main/resources/jboss-esb.xml
Log:
Adding a first impl of a Deployer for JBoss5
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/pom.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/pom.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,261 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-container</artifactId>
+ <version>5.0-SNAPSHOT</version>
+ </parent>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-microcontainer-runtime</artifactId>
+ <packaging>jar</packaging>
+ <version>${jboss.esb.version}</version>
+ <name>JBoss ESB Microcontainer Runtime</name>
+ <url>http://www.jboss.org/jbossesb/</url>
+
+ <properties>
+ <!-- deployment properties -->
+ <jboss.as.server.home>/opt/jboss/as/jboss-5.0.0.CR2</jboss.as.server.home>
+ <jboss.as.server.profile>default</jboss.as.server.profile>
+
+ <jboss.as.server>${jboss.as.server.home}/server/${jboss.as.server.profile}</jboss.as.server>
+ <jboss.as.deployers.dir>${jboss.as.server}/deployers</jboss.as.deployers.dir>
+ <jboss.esb.deployer.dir>${jboss.as.deployers.dir}/esb.deployer</jboss.esb.deployer.dir>
+ <jboss.as.conf.dir>${jboss.as.server}/conf</jboss.as.conf.dir>
+ <jboss.as.deploy.dir>${jboss.as.server}/deploy</jboss.as.deploy.dir>
+
+ <!-- jar version properties -->
+ <version.jboss.as>5.0.0.CR2</version.jboss.as>
+ <version.jboss.microcontainer>2.0.0.CR2</version.jboss.microcontainer>
+ <version.jboss.deployers>2.0.0.CR2</version.jboss.deployers>
+ <version.jboss.vfs>2.0.0.CR2</version.jboss.vfs>
+ <version.jboss.aop>2.0.0.CR17</version.jboss.aop>
+ <version.jboss.common>2.0.0.CR17</version.jboss.common>
+ <version.jboss.common.core>2.2.8.GA</version.jboss.common.core>
+ <version.jboss.logging>2.0.5.GA</version.jboss.logging>
+ <version.jboss.javaee.ejb-api>3.0.0.GA</version.jboss.javaee.ejb-api>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop-jdk50</artifactId>
+ <version>${version.jboss.aop}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>${version.jboss.vfs}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>${version.jboss.common.core}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-j2se</artifactId>
+ <version>${version.jboss.as}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-system-jmx</artifactId>
+ <version>${version.jboss.as}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>${version.jboss.logging}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api</artifactId>
+ <version>${version.jboss.javaee.ejb-api}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ <version>${version.jboss.microcontainer}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>${version.jboss.microcontainer}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>trove</groupId>
+ <artifactId>trove</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JBossESB File Routing bundle -->
+ <dependency>
+ <groupId>jboss.jbossesb</groupId>
+ <artifactId>jbossesb-routing-file</artifactId>
+ <version>${jboss.esb.version}</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources/META-INF</directory>
+ <filtering>false</filtering>
+ <excludes>
+ <!-- Excluding the deployers as they are not intended to go inte to generated jar. -->
+ <exclude>esb-deployers-jboss-beans.xml</exclude>
+ <exclude>deployers.xml</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <testResources>
+ <testResource>
+ <directory>${basedir}/src/test/java</directory>
+ <excludes>
+ <exclude>**/*.java</exclude>
+ </excludes>
+ </testResource>
+ </testResources>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <excludeTransitive>false</excludeTransitive>
+ <excludeScope>provided</excludeScope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>deploy</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ <file>
+ <exists>${jboss.as.server.home}</exists>
+ </file>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>prepare-dependencies-repackage-copy</id>
+ <phase>package</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <mkdir dir="${jboss.esb.deployer.dir}/META-INF"/>
+ <copy todir="${jboss.esb.deployer.dir}" overwrite="true">
+ <fileset dir="${project.build.directory}/dependencies" includes="*.jar" />
+ </copy>
+ <copy todir="${jboss.esb.deployer.dir}" overwrite="true" file="${project.build.directory}/${project.build.finalName}.jar" />
+ <copy todir="${jboss.as.conf.dir}" overwrite="true">
+ <fileset dir="${basedir}/src/main/resources" includes="deployers.xml" />
+ </copy>
+ <copy todir="${jboss.esb.deployer.dir}/META-INF" overwrite="true">
+ <fileset dir="${basedir}/src/main/resources/META-INF" includes="esb-deployers-jboss-beans.xml" />
+ </copy>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+
+ </repositories>
+
+</project>
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/readme.txt
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/readme.txt (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/readme.txt 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,24 @@
+**********************************
+* JBossESB Microcontainer README *
+**********************************
+
+INTRODUCTION
+This project contains a deployer for JBoss AS 5.
+
+DEPLOYMENT
+1. Update the following properties in pom.xml:
+ a) 'jboss.as.server.home' should point to you jboss5 installation directory, for example:
+ <jboss.as.server.home>/opt/jboss/as/jboss-5.0.0.CR2</jboss.as.server.home>
+ b) 'jboss.as.server.profile' should be the name of the profile/configuration, for example:
+ <jboss.as.server.profile>default</jboss.as.server.profile>
+
+2. Run 'mvn install -P deploy'
+ This will copy out the required esb deployers files. The deployer can be found here:
+ ${jboss.as.server.home}/server/${jboss.as.server.profile}/deployers/esb.deployer
+
+3. Start JBossAS
+
+4. Copy any .esb archive to the server deploy directory and it will be deployed.
+
+
+
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/DeploymentUnitResourceLocator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/DeploymentUnitResourceLocator.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/config/DeploymentUnitResourceLocator.java 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,119 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.esb.microcontainer.config;
+
+import org.jboss.esb.classpath.ClassUtil;
+import org.jboss.esb.util.AssertArgument;
+import org.jboss.esb.api.context.ResourceLocator;
+
+import java.io.InputStream;
+
+
+/**
+ * DeploymentUnitResourceLocator is a resource locator for JBossAS
+ * deployement unit.
+ * <p/>
+ * This gives the ESB runtime access to classes and recourec that exist in the .esb archive.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 5.0
+ */
+public class DeploymentUnitResourceLocator implements ResourceLocator
+{
+ /**
+ * The classloader of the deployment unit. This will make
+ * classes and recources in a .esb archive available.
+ */
+ private ClassLoader deploymentUnitClassloader;
+
+ /**
+ * Sole contructor
+ * @param classloader The deployment units classloader.
+ */
+ public DeploymentUnitResourceLocator(final ClassLoader classloader)
+ {
+ AssertArgument.isNotNull(classloader, "classloader");
+ this.deploymentUnitClassloader = classloader;
+ }
+
+ /**
+ * Uses the deployment units classloader to load the class.
+ *
+ * @param className - the class to load.
+ * @return Class - the loaded class.
+ * @throws ClassNotFoundException - if the class could not be found.
+ */
+ public final Class<?> forName(final String className) throws ClassNotFoundException
+ {
+ return deploymentUnitClassloader.loadClass(className);
+ }
+
+ /**
+ * First tries the deployment units classloader and falls back to
+ * {@link ClassUtil#forName(String, Class)} if not successful.
+ *
+ * @param className - the class to load.
+ * @return Class - the loaded class.
+ * @param caller - the class which should be used as the callers class.
+ * @throws ClassNotFoundException - if the class could not be found.
+ */
+ public final Class<?> forName(final String className, final Class<?> caller) throws ClassNotFoundException
+ {
+ try
+ {
+ return forName(className);
+ }
+ catch(final ClassNotFoundException e)
+ {
+ // fallback to normal classloading
+ return ClassUtil.forName(className, caller);
+ }
+ }
+
+ /**
+ * First tries the deployment units classloader and falls back to
+ * {@link ClassUtil#forName(String, Class)} if not successful.
+ *
+ * @param resourceName - the name of the resource to locate.
+ * @param caller - the class which should be used as the callers class.
+ * @return InputStream - the input stream for the resource.
+ *
+ */
+ public final InputStream getResourceAsStream(final String resourceName, final Class<?> caller)
+ {
+ InputStream resourceAsStream = deploymentUnitClassloader.getResourceAsStream(resourceName);
+ if (resourceAsStream == null)
+ {
+ resourceAsStream = ClassUtil.getResourceAsStream(resourceName, caller);
+ }
+ return resourceAsStream;
+ }
+
+ /**
+ * Get the underlying classloader.
+ * @return The underlying ClassLoader.
+ */
+ public final ClassLoader getClassLoader()
+ {
+ return deploymentUnitClassloader;
+ }
+
+}
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbDeployer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbDeployer.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbDeployer.java 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.esb.microcontainer.deployers;
+
+import java.io.IOException;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.log4j.Logger;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.microcontainer.config.DeploymentUnitResourceLocator;
+
+/**
+ * EsbDeployer takes care of the deployment of an esb archive or a single jboss-esb.xml
+ * configuration file.
+ * <p/>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 5.0
+ */
+public class EsbDeployer extends AbstractSimpleRealDeployer<EsbMetaData>
+{
+ /**
+ * Logger.
+ */
+ private Logger log = Logger.getLogger(EsbDeployer.class);
+
+ /**
+ * Holds the deployment runtimes.
+ */
+ private ConcurrentHashMap<String, DeploymentRuntime> runtimes = new ConcurrentHashMap<String, DeploymentRuntime>();
+
+ /**
+ * No args constructor.
+ */
+ public EsbDeployer()
+ {
+ super(EsbMetaData.class);
+ log.info("Created EsbDeployer");
+ }
+
+ /**
+ * Deploys the an ESB Runtime.
+ * If the deployment is already deploy it will first be undeployed.
+ *
+ * @param deploymentUnit The deployment unit to deploy.
+ * @param esbMetaData The ESB MetaData that is associated with the deployment unit.
+ */
+ @Override
+ public void deploy(final DeploymentUnit deploymentUnit, final EsbMetaData esbMetaData) throws DeploymentException
+ {
+ final String deploymentName = deploymentUnit.getName();
+
+ try
+ {
+ log.info("Deploying DeploymentName '" + deploymentName + "'");
+
+ final DeploymentRuntime runtime = createRuntime(deploymentUnit, esbMetaData, deploymentName);
+ runtime.deploy();
+ runtimes.putIfAbsent(deploymentName, runtime);
+ }
+ catch (org.jboss.esb.deploy.DeploymentException e)
+ {
+ throw new DeploymentException(e.getMessage(), e);
+ }
+ catch (final IOException e)
+ {
+ throw new DeploymentException(e.getMessage(), e);
+ }
+ }
+
+ /**
+ * Undeploys the deploymentunit.
+ *
+ * @param deploymentUnit The deployment unit to undeploy.
+ * @param esbMetaData The ESB MetaData that is associated with the deployment unit.
+ */
+ @Override
+ public void undeploy(final DeploymentUnit deploymentUnit, final EsbMetaData esbMetaData)
+ {
+ final String deploymentName = deploymentUnit.getName();
+ final DeploymentRuntime runtime = runtimes.get(deploymentName);
+ if (runtime != null)
+ {
+ try
+ {
+ log.info("Undeploying '" + deploymentName + "'");
+ runtime.undeploy();
+ }
+ catch (final org.jboss.esb.deploy.DeploymentException e)
+ {
+ log.error("DeploymentException while trying to undeploy '" + deploymentName + "' : ", e);
+ }
+ finally
+ {
+ runtimes.remove(deploymentName);
+ }
+ }
+ }
+
+ private DeploymentRuntime createRuntime(final DeploymentUnit deploymentUnit, final EsbMetaData esbMetaData, final String deploymentName) throws org.jboss.esb.deploy.DeploymentException, IOException
+ {
+ final DeploymentUnitResourceLocator resourceLocator = new DeploymentUnitResourceLocator(deploymentUnit.getClassLoader());
+ final DeploymentRuntime runtime = DeploymentUtil.createRuntime(esbMetaData.getFileURL().openStream(), resourceLocator);
+ runtime.setDeploymentName(deploymentName);
+ return runtime;
+ }
+}
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbMetaData.java 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.esb.microcontainer.deployers;
+
+import java.io.Serializable;
+import java.net.URL;
+
+/**
+ * Metadata for an ESB deployment.
+ * </p>
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ * @since 5.0
+ */
+public class EsbMetaData implements Serializable
+{
+ private static final long serialVersionUID = 0L;
+
+ private URL fileURL;
+ private String defaultName;
+ private String name;
+
+ public EsbMetaData()
+ {
+ }
+
+ public EsbMetaData(final URL fileURL, final String defaultName)
+ {
+ this.fileURL = fileURL;
+ this.defaultName = defaultName;
+ }
+
+ public URL getFileURL()
+ {
+ return fileURL;
+ }
+
+ public void setFileURL(final URL fileURL)
+ {
+ this.fileURL = fileURL;
+ }
+
+ public String getDefaultName()
+ {
+ return defaultName;
+ }
+
+ public String getName()
+ {
+ return name != null ? name : defaultName;
+ }
+
+ public void setName(final String name)
+ {
+ this.name = name;
+ }
+
+ @Override
+ public String toString()
+ {
+ final StringBuilder builder = new StringBuilder();
+ builder.append("fileURL=").append(fileURL);
+ builder.append(", defaultName=").append(defaultName);
+ return builder.toString();
+ }
+}
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.esb.microcontainer.deployers;
+
+import org.apache.log4j.Logger;
+import org.jboss.deployers.vfs.spi.deployer.AbstractVFSParsingDeployer;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * Esb deployer that picks up jboss-esb.xml files and .esb archives..
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class EsbParserDeployer extends AbstractVFSParsingDeployer<EsbMetaData>
+{
+ /**
+ * Logger.
+ */
+ private Logger log = Logger.getLogger(EsbParserDeployer.class);
+
+ /**
+ * The suffix of JBossESB configuration files that should be picked up.
+ */
+ private static final String ESB_FILE_SUFFIX = "-esb.xml";
+
+ /**
+ * The suffix of JBossESB archives that should be accepted.
+ */
+ private static final String ESB_JAR_SUFFIX = ".esb";
+
+ public EsbParserDeployer()
+ {
+ super(EsbMetaData.class);
+ setSuffix(ESB_FILE_SUFFIX);
+ setJarExtension(ESB_JAR_SUFFIX);
+ }
+
+ @Override
+ protected EsbMetaData parse(final VFSDeploymentUnit deploymentUnit, final VirtualFile file, final EsbMetaData metaData) throws Exception
+ {
+ log.info("Found ESB File :" + file);
+ return new EsbMetaData(file.toURL(), getDefaultName(file));
+ }
+
+ protected String getDefaultName(final VirtualFile file)
+ {
+ final String shortName = file.getName();
+ return shortName.substring(0, shortName.indexOf(ESB_FILE_SUFFIX));
+ }
+
+}
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- JBoss ESB + JBossAS integration -->
+
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <!-- ESB deployer -->
+ <bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer"/>
+
+ <bean name="EsbDeployer" class="org.jboss.esb.microcontainer.deployers.EsbDeployer"/>
+
+</deployment>
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/deployers.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/deployers.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/deployers.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ The base deployers
+-->
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <classloader><inject bean="deployers-classloader:0.0.0"/></classloader>
+
+ <classloader name="deployers-classloader" xmlns="urn:jboss:classloader:1.0" export-all="NON_EMPTY" import-all="true">
+ <!-- FIXME
+ <root>${jboss.lib.url}/jboss-deployers-core-spi.jar</root>
+ <root>${jboss.lib.url}/jboss-deployers-core.jar</root>
+ <root>${jboss.lib.url}/jboss-deployers-client-spi.jar</root>
+ <root>${jboss.lib.url}/jboss-deployers-client.jar</root>
+ <root>${jboss.lib.url}/jboss-deployers-structure-spi.jar</root>
+ <root>${jboss.lib.url}/jboss-deployers-spi.jar</root>
+ <root>${jboss.lib.url}/jboss-deployers-impl.jar</root>
+ <root>${jboss.lib.url}/jboss-deployers-vfs-spi.jar</root>
+ <root>${jboss.lib.url}/jboss-deployers-vfs.jar</root>
+ -->
+ </classloader>
+
+ <!-- use legacy ordering -->
+ <bean name="topContextComparator">
+ <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/>
+ </bean>
+
+ <!-- The MainDeployer -->
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+ <property name="deployers"><inject bean="Deployers"/></property>
+ <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
+ <property name="comparator"><inject bean="topContextComparator"/></property>
+ </bean>
+
+ <!-- The ManagedDeploymentCreator implementation that supports mapping
+ attachment types to ManagedDeployment#getTypes
+ -->
+ <bean name="ManagedDeploymentCreator" class="org.jboss.deployers.plugins.managed.TypedManagedDeploymentCreator" />
+
+ <!-- The holder for deployers that determine structure -->
+ <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+ <property name="structureBuilder">
+ <!-- The consolidator of the structure information -->
+ <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
+ </property>
+ <!-- Accept any implementor of structure deployer -->
+ <incallback method="addDeployer"/>
+ <uncallback method="removeDeployer"/>
+ </bean>
+
+ <!-- The holder for deployers that do real deployment -->
+ <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+ <!-- Accept any implementor of deployer -->
+ <incallback method="addDeployer"/>
+ <uncallback method="removeDeployer"/>
+ </bean>
+
+ <!-- A declared structure descriptor deployer -->
+ <bean name="DeclaredStructure" class="org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure"/>
+
+ <!-- JAR Structure -->
+ <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
+ <!-- Unless specified the default list of suffixes is .zip, .ear, .jar, ,.rar, .war, .sar, .har, .aop -->
+ <constructor>
+ <parameter>
+ <set elementClass="java.lang.String">
+ <value>.zip</value>
+ <value>.ear</value>
+ <value>.jar</value>
+ <value>.rar</value>
+ <value>.war</value>
+ <value>.sar</value>
+ <value>.har</value>
+ <value>.aop</value>
+ <value>.deployer</value>
+ <value>.beans</value>
+ <value>.esb</value>
+ </set>
+ </parameter>
+ </constructor>
+ <property name="candidateStructureVisitorFactory">
+ <!-- Any file that is not an ordinary directory is a candidate -->
+ <bean name="JARStructureCandidates" class="org.jboss.deployers.vfs.spi.structure.helpers.DefaultCandidateStructureVisitorFactory">
+ <!-- A filter to exclude some obvious non-subdeployments -->
+ <property name="filter">
+ <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
+ <constructor><parameter>
+ <list elementClass="java.lang.String">
+ <!-- Exclude class files as subdeployments -->
+ <value>.class</value>
+ </list>
+ </parameter></constructor>
+ </bean>
+ </property>
+ </bean>
+ </property>
+ </bean>
+
+ <!-- File Structure -->
+ <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure">
+ <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml -->
+ <constructor>
+ <parameter>
+ <set elementClass="java.lang.String">
+ <value>-service.xml</value>
+ <value>-beans.xml</value>
+ <value>-ds.xml</value>
+ <value>-aop.xml</value>
+ </set>
+ </parameter>
+ </constructor>
+ </bean>
+
+ <!-- AOP deployment -->
+ <bean name="AspectAppParsingDeployer" class="org.jboss.aop.asintegration.jboss5.AspectAppParsingDeployer"/>
+ <bean name="AspectDeployer" class="org.jboss.aop.deployers.AspectDeployer">
+ <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
+ </bean>
+
+ <!-- Use these instead of AspectDeployer
+ <bean name="AOPXMLMetaDataParserDeployer" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.aop.microcontainer.beans.metadata.AOPDeployment</parameter>
+ </constructor>
+ <property name="suffix">-aop.xml</property>
+ </bean>
+ <bean name="AOPAnnotationMetaDataParserDeployer" class="org.jboss.aop.asintegration.jboss5.AOPAnnotationMetaDataParserDeployer">
+ <constructor>
+ <parameter><inject bean="AOPXMLMetaDataParserDeployer" property="relativeOrder"/></parameter>
+ </constructor>
+ </bean>
+ <bean name="AOPClassLoaderDeployer" class="org.jboss.aop.asintegration.jboss5.AOPClassLoaderDeployer">
+ <constructor>
+ <parameter><inject bean="ClassLoaderDeployer" property="relativeOrder"/></parameter>
+ </constructor>
+ <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
+ </bean>
+ <bean name="AOPDeploymentAopMetaDataDeployer" class="org.jboss.aop.asintegration.jboss5.AOPDeploymentAopMetaDataDeployer">
+ <property name="kernel"><inject bean="jboss.kernel:service=Kernel"/></property>
+ <property name="aspectManager"><inject bean="AspectManager" property="aspectManager"/></property>
+ </bean>
+ -->
+
+ <!-- POJO Deployment -->
+ <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer">
+ <property name="suffix">jboss-beans.xml</property>
+ </bean>
+ <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer">
+ <install bean="ManagedDeploymentCreator" method="addAttachmentType">
+ <parameter>
+ <value>org.jboss.kernel.spi.deployment.KernelDeployment</value>
+ </parameter>
+ <parameter>
+ <value>beans</value>
+ </parameter>
+ </install>
+ <uninstall bean="ManagedDeploymentCreator" method="removeAttachmentType">
+ <parameter>
+ <value>org.jboss.kernel.spi.deployment.KernelDeployment</value>
+ </parameter>
+ </uninstall>
+ </bean>
+ <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
+ <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
+ </bean>
+
+ <!-- JMX Deployment -->
+ <bean name="ServiceMetaDataICF" class="org.jboss.system.deployers.managed.ServiceMetaDataICF">
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ </bean>
+ <bean name="SARDeployer" class="org.jboss.system.deployers.SARDeployer">
+ <property name="icf"><inject bean="ServiceMetaDataICF"/></property>
+ </bean>
+ <bean name="ServiceDeploymentDeployer" class="org.jboss.system.deployers.ServiceDeploymentDeployer">
+ </bean>
+ <bean name="ServiceDeployer" class="org.jboss.system.deployers.ServiceDeployer">
+ <constructor><parameter><inject bean="JMXKernel" property="serviceController"/></parameter></constructor>
+ </bean>
+
+ <!-- FIXME Remove this -->
+ <bean name="HackClassLoaderMetaDataDeployer" class="org.jboss.system.deployers.HackClassloaderMetaDataDeployer"/>
+ <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
+ <constructor>
+ <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
+ </constructor>
+ <property name="name">jboss-classloading.xml</property>
+ <property name="buildManagedObject">true</property>
+ </bean>
+ <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+ <property name="defaultMetaData">
+ <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
+ </property>
+ </bean>
+ <bean name="InMemoryClassesDeployer" class="org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer"/>
+ <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
+ <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
+ <property name="classLoading"><inject bean="ClassLoading"/></property>
+ </bean>
+ <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+ <property name="classLoading"><inject bean="ClassLoading"/></property>
+ <property name="system"><inject bean="ClassLoaderSystem"/></property>
+ </bean>
+
+</deployment>
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/log4j.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/log4j.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+
+ <category name="org.jboss">
+ <priority value="debug"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
+
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,227 @@
+/*
+ * JBoss, Home of Professional Open Source Copyright 2008, Red Hat Middleware
+ * LLC, and individual contributors by the @authors tag. See the copyright.txt
+ * in the distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This software is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this software; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA, or see the FSF
+ * site: http://www.fsf.org.
+ */
+package org.jboss.esb.microcontainer.deployers;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSDeploymentContext;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.spi.VFSContext;
+import org.jboss.virtual.spi.VirtualFileHandler;
+
+/**
+ * Test for {@link EsbDeployer}.
+ *
+ * @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
+ *
+ */
+public class EsbDeployerTest extends MicrocontainerTest
+{
+ private DeploymentUnit deploymentUnit;
+ private File esbConfigFile;
+ private VirtualFile esbConfigVF;
+
+ public EsbDeployerTest(final String name)
+ {
+ super(name);
+ }
+
+ public void testParserDeployer() throws Throwable
+ {
+ final Object bean = assertDeployed("EsbParserDeployer");
+ assertTrue(bean instanceof EsbParserDeployer);
+
+ EsbParserDeployer esbParserDeployer = (EsbParserDeployer)bean;
+ esbParserDeployer.deploy(deploymentUnit);
+ }
+
+ public void testEsbDeployer() throws Throwable
+ {
+ final Object bean = assertDeployed("EsbDeployer");
+ assertTrue(bean instanceof EsbDeployer);
+
+ EsbDeployer deployer = (EsbDeployer)bean;
+ deployer.deploy(deploymentUnit, new EsbMetaData(esbConfigFile.toURL(), "jbossesb"));
+ }
+
+ @Override
+ public void setUp() throws Exception
+ {
+ super.setUp();
+ esbConfigFile = createEsbConfigFile("jboss-esb.xml");
+ esbConfigVF = getMockVF(esbConfigFile);
+ deploymentUnit = createDeploymentUnit(esbConfigVF);
+ }
+
+ private Object assertDeployed(final String beanName)
+ {
+ final Object bean = getBean(beanName);
+ assertNotNull(bean);
+ return bean;
+ }
+
+ private DeploymentUnit createDeploymentUnit(final VirtualFile esbConfigVF)
+ {
+ AbstractVFSDeploymentContext context = new AbstractVFSDeploymentContext("esbTest", "esbTest", esbConfigVF, esbConfigVF.getPathName());
+ context.setClassLoader(getClass().getClassLoader());
+ DeploymentUnit unit = context.getDeploymentUnit();
+ unit.addAttachment(EsbMetaData.class.getName() + ".altDD", esbConfigVF);
+ return unit;
+ }
+
+ private File createEsbConfigFile(final String fileName)
+ {
+ return new File(getClass().getResource(fileName).getFile());
+ }
+
+ private static VirtualFile getMockVF(final File esbFile)
+ {
+ VirtualFile file = new VirtualFile(new VirtualFileHandler()
+ {
+ private static final long serialVersionUID = 1L;
+
+ public void close()
+ {
+ }
+
+ public boolean exists() throws IOException
+ {
+ return false;
+ }
+
+ public VirtualFileHandler getChild(String arg0) throws IOException
+ {
+ return null;
+ }
+
+ public List<VirtualFileHandler> getChildren(boolean arg0) throws IOException
+ {
+ return null;
+ }
+
+ public long getLastModified() throws IOException
+ {
+ return 0;
+ }
+
+ public String getName()
+ {
+ return esbFile.getName();
+ }
+
+ public VirtualFileHandler getParent() throws IOException
+ {
+ return null;
+ }
+
+ public String getPathName()
+ {
+ return esbFile.getAbsolutePath();
+ }
+
+ public long getSize() throws IOException
+ {
+ return 0;
+ }
+
+ public VFSContext getVFSContext()
+ {
+ return null;
+ }
+
+ public VirtualFile getVirtualFile()
+ {
+ return null;
+ }
+
+ public boolean hasBeenModified() throws IOException
+ {
+ return false;
+ }
+
+ public boolean isHidden() throws IOException
+ {
+ return false;
+ }
+
+ public boolean isLeaf() throws IOException
+ {
+ return false;
+ }
+
+ public String getLocalPathName()
+ {
+ return null;
+ }
+
+ public boolean isNested() throws IOException
+ {
+ return false;
+ }
+
+ public InputStream openStream() throws IOException
+ {
+ return null;
+ }
+
+ public URI toURI() throws URISyntaxException
+ {
+ return null;
+ }
+
+ public URL toURL() throws MalformedURLException, URISyntaxException
+ {
+ return null;
+ }
+
+ public URL toVfsUrl() throws MalformedURLException, URISyntaxException
+ {
+ return null;
+ }
+
+ public void replaceChild(VirtualFileHandler original, VirtualFileHandler replacement)
+ {
+ }
+
+ public boolean removeChild(String name) throws IOException
+ {
+ return false;
+ }
+
+ public boolean delete(int gracePeriod) throws IOException
+ {
+ return false;
+ }
+ });
+
+ return file;
+ }
+
+}
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
+
+ <bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer"/>
+ <bean name="EsbDeployer" class="org.jboss.esb.microcontainer.deployers.EsbDeployer"/>
+
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
+ <property name="deployers"><inject bean="Deployers"/></property>
+ </bean>
+
+ <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
+ <property name="structureBuilder">
+ <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder"/>
+ </property>
+ <incallback method="addDeployer"/>
+ <uncallback method="removeDeployer"/>
+ </bean>
+
+ <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
+ <incallback method="addDeployer"/>
+ <uncallback method="removeDeployer"/>
+ </bean>
+
+</deployment>
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/jboss-esb.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/jboss-esb.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,10 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+ <resources>
+ <resource id="schedule1" class="org.jboss.esb.schedule.SimpleSchedule">
+ <property name="frequency">100</property>
+ <property name="execCount">1</property>
+ </resource>
+ </resources>
+
+</jbossesb>
\ No newline at end of file
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/log4j.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/log4j.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/resources/log4j.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!--
+ | For more configuration infromation and examples see the Jakarta Log4j
+ | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%t][%c{1}] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+
+ <category name="org.jboss">
+ <priority value="debug"/>
+ </category>
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <appender-ref ref="CONSOLE"/>
+ </root>
+
+</log4j:configuration>
Modified: labs/jbossesb/workspace/skeagh/container/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/container/pom.xml 2008-11-25 16:53:42 UTC (rev 24096)
+++ labs/jbossesb/workspace/skeagh/container/pom.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -16,6 +16,7 @@
<modules>
<module>osgi</module>
+ <module>microcontainer</module>
</modules>
<dependencies>
Deleted: labs/jbossesb/workspace/skeagh/examples/file-router/activemq.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/file-router/activemq.xml 2008-11-25 16:53:42 UTC (rev 24096)
+++ labs/jbossesb/workspace/skeagh/examples/file-router/activemq.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -1,20 +0,0 @@
-<beans
- xmlns="http://www.springframework.org/schema/beans"
- xmlns:amq="http://activemq.org/config/1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://activemq.org/config/1.0 http://activemq.apache.org/schema/activemq-core.xsd
- http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
-
- <!-- Allows us to use system properties as variables in this configuration file -->
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
-
- <broker xmlns="http://activemq.org/config/1.0" useJmx="false" dataDirectory="${activemq.base}/target/activemq">
-
- <transportConnectors>
- <transportConnector uri="tcp://localhost:61717"/>
- </transportConnectors>
-
- </broker>
-
-</beans>
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/examples/file-router/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/file-router/pom.xml 2008-11-25 16:53:42 UTC (rev 24096)
+++ labs/jbossesb/workspace/skeagh/examples/file-router/pom.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -14,7 +14,9 @@
<packaging>bundle</packaging>
<properties>
- <felix.log.level>1</felix.log.level><!-- 4=debug -->
+ <!-- Felix debug level. 4 = debug -->
+ <felix.log.level>4</felix.log.level>
+ <example.work.dir>${basedir}/target</example.work.dir>
</properties>
<dependencies>
@@ -29,51 +31,6 @@
<artifactId>org.apache.felix.main</artifactId>
<version>1.2.1</version>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
- <version>4.1.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.1.1.0</version>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- <version>3.0.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
- <version>1.0-M1</version>
- </dependency>
- <dependency>
- <groupId>javax.jms</groupId>
- <artifactId>jms</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>mx4j</groupId>
- <artifactId>mx4j-tools</artifactId>
- <version>3.0.1</version>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
<!-- JBossESB OSGi bundle -->
<dependency>
@@ -102,16 +59,13 @@
</dependencies>
<build>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources/</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
<plugins>
- <plugin>
- <groupId>org.apache.activemq.tooling</groupId>
- <artifactId>maven-activemq-plugin</artifactId>
- <version>4.1.2</version>
- <configuration>
- <configFile>./activemq.xml</configFile>
- <fork>false</fork>
- </configuration>
- </plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
@@ -143,9 +97,9 @@
<extensions>true</extensions>
<configuration>
<instructions>
- <Export-Package>org.jboss.esb.examples.filerouter, org.apache.activemq.jndi</Export-Package>
- <Import-Package>org.jboss.esb.file, org.jboss.esb.schedule,org.jboss.esb.api.routing, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
- <Embed-Dependency>activemq-core, backport-util-concurrent, log4j, commons-logging, geronimo-j2ee-management_1.1_spec</Embed-Dependency>
+ <Export-Package>org.jboss.esb.examples.filerouter</Export-Package>
+ <Import-Package>org.jboss.esb.file, org.jboss.esb.schedule, org.jboss.esb.api.*, *;resolution:=optional</Import-Package> <!-- TODO: Replace global import with explicit package imports? -->
+ <Embed-Dependency>log4j</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
Modified: labs/jbossesb/workspace/skeagh/examples/file-router/src/main/resources/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/file-router/src/main/resources/jboss-esb.xml 2008-11-25 16:53:42 UTC (rev 24096)
+++ labs/jbossesb/workspace/skeagh/examples/file-router/src/main/resources/jboss-esb.xml 2008-11-25 17:09:24 UTC (rev 24097)
@@ -10,14 +10,14 @@
<service serviceCategory="examples" serviceName="InboundRouter-File" serviceDescription="First Example" class="org.jboss.esb.examples.filerouter.MyTestService">
<inRouter name="fileRouter" class="org.jboss.esb.file.FileInboundRouter">
<property name="scheduleResourceId">schedule1</property>
- <property name="fileSelectorPattern">../target/input/*.txt</property>
- <property name="workingRenamePattern">../target/working/${name}-${timestamp}.working</property>
- <property name="processedRenamePattern">../target/output/${name}-${timestamp}.done</property>
- <property name="errrorRenamePattern">../target/error/${name}-${timestamp}.error</property>
+ <property name="fileSelectorPattern">${example.work.dir}/input/*.txt</property>
+ <property name="workingRenamePattern">${example.work.dir}/working/${name}-${timestamp}.working</property>
+ <property name="processedRenamePattern">${example.work.dir}/output/${name}-${timestamp}.done</property>
+ <property name="errrorRenamePattern">${example.work.dir}/error/${name}-${timestamp}.error</property>
<property name="messageComposer">org.jboss.esb.file.composers.FileStringMessageComposer</property>
</inRouter>
<outRouter name="fileOutboundRouter" class="org.jboss.esb.file.FileOutboundRouter">
- <property name="fileNamePattern">../target/another-service-pickup-dir/${name}.out</property>
+ <property name="fileNamePattern">${example.work.dir}/another-service-pickup-dir/${name}.out</property>
</outRouter>
</service>
</services>
Deleted: labs/jbossesb/workspace/skeagh/examples/file-router/src/main/resources/jndi.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/examples/file-router/src/main/resources/jndi.properties 2008-11-25 16:53:42 UTC (rev 24096)
+++ labs/jbossesb/workspace/skeagh/examples/file-router/src/main/resources/jndi.properties 2008-11-25 17:09:24 UTC (rev 24097)
@@ -1,16 +0,0 @@
-java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:61717
-
-# use the following property to specify the JNDI name the connection factory
-# should appear as.
-connectionFactoryNames = connectionFactory, ConnectionFactory, queueConnectionFactory, topicConnectionFactory
-
-# register some queues in JNDI using the form
-# queue.[jndiName] = [physicalName]
-queue.jbossesb.TestQueue = jbossesb.TestQueue
-
-queue.jbossesb.jms.bus = jbossesb.jms.bus
-
-# register some topics in JNDI using the form
-# topic.[jndiName] = [physicalName]
-topic.jbossesb.deployment.coordintation.topic = jbossesb.deployment.coordintation.topic
Deleted: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/jndi.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/jndi.properties 2008-11-25 16:53:42 UTC (rev 24096)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/jndi.properties 2008-11-25 17:09:24 UTC (rev 24097)
@@ -1,16 +0,0 @@
-java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
-java.naming.provider.url=tcp://localhost:61717
-
-# use the following property to specify the JNDI name the connection factory
-# should appear as.
-#connectionFactoryNames = connectionFactory, queueConnectionFactory, topicConnectionFactry
-
-# register some queues in JNDI using the form
-# queue.[jndiName] = [physicalName]
-queue.jbossesb.TestQueue = jbossesb.TestQueue
-
-queue.jbossesb.jms.bus = jbossesb.jms.bus
-
-# register some topics in JNDI using the form
-# topic.[jndiName] = [physicalName]
-topic.jbossesb.deployment.coordintation.topic = jbossesb.deployment.coordintation.topic
More information about the jboss-svn-commits
mailing list