[jboss-svn-commits] JBL Code SVN: r24102 - in labs/jbossesb/workspace/skeagh/container/microcontainer/src: main/resources/META-INF and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Nov 25 16:58:11 EST 2008
Author: beve
Date: 2008-11-25 16:58:11 -0500 (Tue, 25 Nov 2008)
New Revision: 24102
Added:
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbRuntimeDeployer.java
Removed:
labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbDeployer.java
Modified:
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/META-INF/esb-deployers-jboss-beans.xml
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
Log:
Renamed EsbDeployer to EsbRuntimeDeployer.
Deleted: 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 2008-11-25 21:35:43 UTC (rev 24101)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbDeployer.java 2008-11-25 21:58:11 UTC (rev 24102)
@@ -1,132 +0,0 @@
-/*
- * 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.net.URL;
-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.api.context.ResourceLocator;
-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 ResourceLocator resourceLocator = new DeploymentUnitResourceLocator(deploymentUnit.getClassLoader());
- final URL esbConfigURL = esbMetaData.getFileURL();
- final DeploymentRuntime runtime = DeploymentUtil.createRuntime(esbConfigURL.openStream(), resourceLocator);
- runtime.setDeploymentName(deploymentName);
- return runtime;
- }
-}
Modified: 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 2008-11-25 21:35:43 UTC (rev 24101)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbParserDeployer.java 2008-11-25 21:58:11 UTC (rev 24102)
@@ -84,7 +84,7 @@
@Override
protected EsbMetaData parse(final VFSDeploymentUnit deploymentUnit, final VirtualFile file, final EsbMetaData metaData) throws Exception
{
- log.info("Found ESB File :" + file);
+ log.info("Found ESB File '" + file.toURL() + "'");
return new EsbMetaData(file.toURL(), getDefaultName(file));
}
Added: labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbRuntimeDeployer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbRuntimeDeployer.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/java/org/jboss/esb/microcontainer/deployers/EsbRuntimeDeployer.java 2008-11-25 21:58:11 UTC (rev 24102)
@@ -0,0 +1,132 @@
+/*
+ * 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.net.URL;
+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.api.context.ResourceLocator;
+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 EsbRuntimeDeployer extends AbstractSimpleRealDeployer<EsbMetaData>
+{
+ /**
+ * Logger.
+ */
+ private Logger log = Logger.getLogger(EsbRuntimeDeployer.class);
+
+ /**
+ * Holds the deployment runtimes.
+ */
+ private ConcurrentHashMap<String, DeploymentRuntime> runtimes = new ConcurrentHashMap<String, DeploymentRuntime>();
+
+ /**
+ * No args constructor.
+ */
+ public EsbRuntimeDeployer()
+ {
+ 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 ResourceLocator resourceLocator = new DeploymentUnitResourceLocator(deploymentUnit.getClassLoader());
+ final URL esbConfigURL = esbMetaData.getFileURL();
+ final DeploymentRuntime runtime = DeploymentUtil.createRuntime(esbConfigURL.openStream(), resourceLocator);
+ runtime.setDeploymentName(deploymentName);
+ return runtime;
+ }
+}
Modified: 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 2008-11-25 21:35:43 UTC (rev 24101)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/main/resources/META-INF/esb-deployers-jboss-beans.xml 2008-11-25 21:58:11 UTC (rev 24102)
@@ -7,6 +7,6 @@
<!-- ESB deployer -->
<bean name="EsbParserDeployer" class="org.jboss.esb.microcontainer.deployers.EsbParserDeployer"/>
- <bean name="EsbDeployer" class="org.jboss.esb.microcontainer.deployers.EsbDeployer"/>
+ <bean name="EsbRuntimeDeployer" class="org.jboss.esb.microcontainer.deployers.EsbRuntimeDeployer"/>
</deployment>
Modified: 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 2008-11-25 21:35:43 UTC (rev 24101)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.java 2008-11-25 21:58:11 UTC (rev 24102)
@@ -37,7 +37,7 @@
import org.jboss.virtual.spi.VirtualFileHandler;
/**
- * Test for {@link EsbDeployer}.
+ * Test for {@link EsbRuntimeDeployer}.
*
* @author <a href="mailto:dbevenius at jboss.com">Daniel Bevenius</a>
*
@@ -64,10 +64,10 @@
public void testEsbDeployer() throws Throwable
{
- final Object bean = assertDeployed("EsbDeployer");
- assertTrue(bean instanceof EsbDeployer);
+ final Object bean = assertDeployed("EsbRuntimeDeployer");
+ assertTrue(bean instanceof EsbRuntimeDeployer);
- EsbDeployer deployer = (EsbDeployer)bean;
+ EsbRuntimeDeployer deployer = (EsbRuntimeDeployer)bean;
deployer.deploy(deploymentUnit, new EsbMetaData(esbConfigFile.toURL(), "jbossesb"));
}
Modified: 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 2008-11-25 21:35:43 UTC (rev 24101)
+++ labs/jbossesb/workspace/skeagh/container/microcontainer/src/test/java/org/jboss/esb/microcontainer/deployers/EsbDeployerTest.xml 2008-11-25 21:58:11 UTC (rev 24102)
@@ -5,7 +5,7 @@
<property name="esbFileSuffix">-esb.xml</property>
<property name="esbArchiveSuffix">.esb</property>
</bean>
- <bean name="EsbDeployer" class="org.jboss.esb.microcontainer.deployers.EsbDeployer"/>
+ <bean name="EsbRuntimeDeployer" class="org.jboss.esb.microcontainer.deployers.EsbRuntimeDeployer"/>
<bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
<property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
More information about the jboss-svn-commits
mailing list