| Commit in servicemix/tooling/jboss-deployer on MAIN | |||
| src/site/apt/index.apt | +6 | added 1.1 | |
| src/main/java/org/servicemix/jboss/deployment/.cvsignore | +2 | added 1.1 | |
| /JBIService.java | +186 | added 1.1 | |
| /JBIDeployer.java | +205 | added 1.1 | |
| maven.xml | +18 | added 1.1 | |
| project.xml | +284 | added 1.1 | |
| project.properties | +15 | added 1.1 | |
| src/sar/META-INF/jboss-service.xml | +17 | added 1.1 | |
| +733 | |||
Initial checkin
servicemix/tooling/jboss-deployer/src/site/apt
index.apt added at 1.1
diff -N index.apt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ index.apt 2 Aug 2005 19:09:26 -0000 1.1 @@ -0,0 +1,6 @@
+JBoss ServiceMix Deployer + + This project creates a simple deployer and service which works together to enable integration with a + JBoss 4.0.x Application Server. This allows you to drop installers in the /deploy directory of the + application server and then if the jar contains a META-INF/jbi.xml it will be passed to the + JBIService which will hand the archive to the JBIContainer to install.
\ No newline at end of file
servicemix/tooling/jboss-deployer/src/main/java/org/servicemix/jboss/deployment
.cvsignore added at 1.1
diff -N .cvsignore --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ .cvsignore 2 Aug 2005 19:09:26 -0000 1.1 @@ -0,0 +1,2 @@
+JBIDeployerMBean.java +JBIServiceMBean.java
servicemix/tooling/jboss-deployer/src/main/java/org/servicemix/jboss/deployment
JBIService.java added at 1.1
diff -N JBIService.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ JBIService.java 2 Aug 2005 19:09:26 -0000 1.1 @@ -0,0 +1,186 @@
+/**
+ *
+ * Copyright 2005 Unity Systems, LLC. http://www.unity-systems.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ **/
+package org.servicemix.jboss.deployment;
+
+import java.io.File;
+
+import javax.jbi.JBIException;
+import javax.jbi.management.DeploymentException;
+import javax.naming.InitialContext;
+
+import org.jboss.system.ServiceMBeanSupport;
+import org.servicemix.jbi.container.JBIContainer;
+
+/**
+ * This is the deployer that handles picking up and deploying a JBI package out
+ * to the ServiceMix container.
+ *
+ * @author <a href="">Philip Dodds</a>
+ *
+ * @jmx.mbean name="jboss.system:service=ServiceMixJBIContainer"
+ * extends="org.jboss.system.ServiceMBean"
+ *
+ */
+public class JBIService extends ServiceMBeanSupport implements JBIServiceMBean {
+
+ private JBIContainer jbiContainer = new JBIContainer();
+
+ private String transactionManager = "java:/TransactionManager";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.system.ServiceMBeanSupport#createService()
+ */
+ public void createService() throws Exception {
+ super.create();
+ }
+
+ /**
+ * Helper method that performs recursive deletes on a directory
+ *
+ * @param dir
+ * The directory to delete
+ * @return True, if successful
+ */
+ private boolean deleteDir(File dir) {
+ if (dir.isDirectory()) {
+ String[] children = dir.list();
+ for (int i = 0; i < children.length; i++) {
+ boolean success = deleteDir(new File(dir, children[i]));
+ if (!success) {
+ return false;
+ }
+ }
+ }
+
+ // The directory is now empty so delete it
+ return dir.delete();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.system.ServiceMBeanSupport#destroyService()
+ */
+ public void destroyService() {
+ log.info("Destroying ServiceMixJBIContainer");
+ super.destroy();
+ }
+
+ /**
+ * Gets the location of the transaction manager to use
+ *
+ * @return The transaction manager
+ *
+ * @jmx.managed-attribute
+ */
+ public String getTransactionManager() {
+ return transactionManager;
+ }
+
+ /**
+ * Request the JBI Container install the given archive
+ *
+ * @param archive
+ * The name of the archive to install
+ *
+ * @jmx.managed-operation
+ */
+ public void installArchive(String archive) {
+ try {
+ jbiContainer.installArchive(archive);
+ } catch (DeploymentException e) {
+ throw new RuntimeException(
+ "ServiceMix JBIContainer unable to install archive ["
+ + archive + "]", e);
+ }
+ }
+
+ /**
+ * Sets the location of the transaction manager to use
+ *
+ * @param transactionManager
+ *
+ * @jmx.managed-attribute
+ */
+ public void setTransactionManager(String transactionManager) {
+ this.transactionManager = transactionManager;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.system.ServiceMBeanSupport#startService()
+ */
+ public void startService() throws Exception {
+
+ jbiContainer = new JBIContainer();
+ jbiContainer.setCreateMBeanServer(false);
+ jbiContainer.setMonitorInstallationDirectory(false);
+ jbiContainer.setMBeanServer(getServer());
+
+ // TODO Keeping the service mix configuration directory in place is a
+ // problem?
+ File rootDir = new File(System.getProperty("jboss.server.data.dir")
+ + "/ServiceMix");
+ log.debug("Checking whether ServiceMix root directory exists ["
+ + rootDir.getAbsolutePath() + "] exists[" + rootDir.exists()
+ + "]");
+
+ if (rootDir.exists() && !deleteDir(rootDir)) {
+ throw new Exception(
+ "Unable to delete the ServiceMix root directory at start-up ["
+ + rootDir.getAbsolutePath()
+ + "], check permissions.");
+ }
+ if (!rootDir.mkdir()) {
+ throw new Exception(
+ "Unable to create the ServiceMix root directory at start-up ["
+ + rootDir.getAbsolutePath()
+ + "], check permissions.");
+ }
+ jbiContainer.setRootDir(rootDir.getAbsolutePath());
+
+ // Lets get the transaction manager from JNDI
+ InitialContext initCtxt = new InitialContext();
+ Object transactionManager = initCtxt.lookup(this.transactionManager);
+ jbiContainer.setTransactionManager(transactionManager);
+
+ jbiContainer.init();
+ jbiContainer.start();
+ super.start();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.system.ServiceMBeanSupport#stopService()
+ */
+ public void stopService() {
+ try {
+ jbiContainer.stop();
+ } catch (JBIException e) {
+ log.error("Unable to stop ServiceMixJBIContainer ["
+ + e.getMessage() + "]");
+ }
+ super.stop();
+ }
+
+}
servicemix/tooling/jboss-deployer/src/main/java/org/servicemix/jboss/deployment
JBIDeployer.java added at 1.1
diff -N JBIDeployer.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ JBIDeployer.java 2 Aug 2005 19:09:26 -0000 1.1 @@ -0,0 +1,205 @@
+/**
+ *
+ * Copyright 2005 Unity Systems, LLC. http://www.unity-systems.com
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ **/
+package org.servicemix.jboss.deployment;
+
+import java.net.URL;
+
+import javax.management.ObjectName;
+
+import org.jboss.deployment.DeploymentException;
+import org.jboss.deployment.DeploymentInfo;
+import org.jboss.deployment.SubDeployer;
+import org.jboss.deployment.SubDeployerSupport;
+
+/**
+ * This is the deployer that handles picking up and deploying a JBI package out
+ * to the ServiceMix container.
+ *
+ * @author <a href="">Philip Dodds</a>
+ *
+ * @jmx.mbean name="jboss.system:service=ServiceMixDeployer"
+ * extends="org.jboss.deployment.SubDeployerMBean"
+ */
+public class JBIDeployer extends SubDeployerSupport implements
+ SubDeployer, JBIDeployerMBean {
+
+ private ObjectName jbiContainerMBean = null;
+
+ /**
+ * Returns true if this deployer can deploy the given DeploymentInfo, for
+ * the time being we look for the extension iar.
+ *
+ * @return True if this deployer can deploy the given DeploymentInfo.
+ *
+ * @jmx.managed-operation
+ */
+ public boolean accepts(DeploymentInfo di) {
+ // To be accepted the deployment's root name must end in jar
+ String urlStr = di.url.getFile();
+ if (!urlStr.endsWith(".jar") && !urlStr.endsWith(".jar/")) {
+ return false;
+ }
+
+ // However the jar must also contain an META-INF/application-client.xml
+ boolean accepts = false;
+ try {
+ URL dd = di.localCl.findResource("META-INF/jbi.xml");
+ if (dd != null) {
+ log.debug("Found a META-INF/jbi.xml file, di: " + di);
+ accepts = true;
+ }
+ } catch (Exception ignore) {
+ }
+
+ return accepts;
+ }
+
+ /**
+ * Describe <code>create</code> method here.
+ *
+ * @param di
+ * a <code>DeploymentInfo</code> value
+ * @exception DeploymentException
+ * if an error occurs
+ * @jmx.managed-operation
+ */
+ public void create(DeploymentInfo di) throws DeploymentException {
+ try {
+ if (jbiContainerMBean == null) {
+ throw new DeploymentException(
+ "The ServiceMix JBI container is not defined in Deployer");
+ }
+ log
+ .info("ServiceMix deployer passing deployment to JBI container ["
+ + di.url.toExternalForm() + "]");
+ getServer().invoke(jbiContainerMBean, "installArchive",
+ new Object[] { di.url.toExternalForm() },
+ new String[] { "java.lang.String" });
+ } catch (Exception e) {
+ throw new DeploymentException(
+ "ServiceMix deployer unable to deploy: " + di, e);
+ }
+ }
+
+ public void destroy() {
+ log.info("Destroying ServiceMix deployer");
+ super.destroy();
+ }
+
+ /**
+ * The destroy method invokes destroy on the mbeans associated with the
+ * deployment in reverse order relative to create.
+ *
+ * @param di
+ * a <code>DeploymentInfo</code> value
+ * @jmx.managed-operation
+ */
+ public void destroy(DeploymentInfo di) {
+
+ }
+
+ /**
+ * Gets the ObjectName of the JBI Container's MBean
+ *
+ * @return The ObjectName of the JBI Container MBean
+ *
+ * @jmx.managed-attribute
+ */
+ public ObjectName getJBIContainer() {
+ return jbiContainerMBean;
+ }
+
+ /**
+ * The destroy method invokes destroy on the mbeans associated with the
+ * deployment in reverse order relative to create.
+ *
+ * @param serviceName
+ * a service object name
+ * @return The associated service DeploymentInfo if found, null otherwise
+ * @jmx.managed-operation
+ */
+ public DeploymentInfo getService(ObjectName serviceName) {
+ return null;
+ }
+
+ /**
+ * Describe <code>init</code> method here.
+ *
+ * @param di
+ * a <code>DeploymentInfo</code> value
+ * @exception DeploymentException
+ * if an error occurs
+ * @jmx.managed-operation
+ */
+ public void init(DeploymentInfo di) throws DeploymentException {
+ try {
+ if (di.url.getPath().endsWith("/")) {
+ // the URL is a unpacked collection, watch the deployment
+ // descriptor
+ di.watch = new URL(di.url, "META-INF/jbi.xml");
+ } else {
+ // just watch the original URL
+ di.watch = di.url;
+ }
+ } catch (Exception e) {
+ throw new DeploymentException(e);
+ }
+
+ // invoke super-class initialization
+ super.init(di);
+ }
+
+ /**
+ * Sets the ObjectName of the JBI Container's MBean
+ *
+ * @param jbiContainerMBean
+ * The ObjectName of the JBI Container's MBean
+ *
+ * @jmx.managed-attribute
+ */
+ public void setJBIContainer(ObjectName jbiContainerMBean) {
+ this.jbiContainerMBean = jbiContainerMBean;
+ }
+
+ /**
+ * The <code>start</code> method starts all the mbeans in this
+ * DeploymentInfo..
+ *
+ * @param di
+ * a <code>DeploymentInfo</code> value
+ * @exception DeploymentException
+ * if an error occurs
+ * @jmx.managed-operation
+ */
+ public void start(DeploymentInfo di) throws DeploymentException {
+
+ }
+
+ /**
+ * The stop method invokes stop on the mbeans associatedw ith the deployment
+ * in reverse order relative to create.
+ *
+ * @param di
+ * the <code>DeploymentInfo</code> value to stop.
+ * @jmx.managed-operation
+ */
+ public void stop(DeploymentInfo di) {
+
+ }
+
+}
servicemix/tooling/jboss-deployer
maven.xml added at 1.1
diff -N maven.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ maven.xml 2 Aug 2005 19:09:26 -0000 1.1 @@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<project xmlns:j="jelly:core" xmlns:maven="jelly:maven">
+ <preGoal name="java:compile">
+ <attainGoal name="xdoclet:jmxdoclet" />
+ </preGoal>
+
+ <!-- Quick testing goal -->
+ <goal name="mytest" prereqs="sar">
+ <copy
+ file="${basedir}/target/${pom.artifactId}-${pom.currentVersion}.sar"
+ todir="/jboss-4.0.2/server/default/deploy" />
+ </goal>
+
+ <!-- Include the conversion of APT docs, as per Maven2 -->
+ <preGoal name="xdoc:jelly-transform">
+ <attainGoal name="apt:generate" />
+ </preGoal>
+</project>
\ No newline at end of file
servicemix/tooling/jboss-deployer
project.xml added at 1.1
diff -N project.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ project.xml 2 Aug 2005 19:09:26 -0000 1.1 @@ -0,0 +1,284 @@
+<?xml version="1.0" encoding="UTF-8"?> + +<project> + <pomVersion>3</pomVersion> + <name>ServiceMix JBoss Deployer</name> + <id>jboss-deployer</id> + <currentVersion>1.0-SNAPSHOT</currentVersion> + + <organization> + <name>ServiceMix.</name> + <url>http://www.servicemix.co.com</url> + <logo> + http://www.logicblaze.com/images/logos/products/ServiceMix/ServiceMix_logo_150.jpg + </logo> + </organization> + <logo></logo> + + <inceptionYear>2005</inceptionYear> + + <shortDescription> + JBoss compatible deployer that allows your to hot-deploy JBI + packages to a ServiceMix container. + </shortDescription> + + <description> + JBoss compatible deployer that allows your to hot-deploy JBI + packages to a ServiceMix container. + </description> + + <developers> + <developer> + <name>Philip Dodds</name> + <id>pdodds</id> + <email>[EMAIL PROTECTED]</email> + <organization>Unity Systems</organization> + </developer> + </developers> + + <contributors></contributors> + + <dependencies> + <dependency> + <groupId>servicemix</groupId> + <artifactId>servicemix</artifactId> + <version>1.0-SNAPSHOT</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <!-- JBoss 4.0.2 libs --> + <dependency> + <groupId>jboss</groupId> + <artifactId>jboss-system</artifactId> + <version>4.0.2</version> + </dependency> + <dependency> + <groupId>jboss</groupId> + <artifactId>jboss-jmx</artifactId> + <version>4.0.2</version> + </dependency> + <dependency> + <groupId>jboss</groupId> + <artifactId>jboss-common</artifactId> + <version>4.0.2</version> + </dependency> + + <!-- Required to support XDoclet gen --> + <dependency> + <id>xjavadoc</id> + <groupId>xdoclet</groupId> + <artifactId>xjavadoc</artifactId> + <version>1.0.3</version> + <type>jar</type> + <url>http://xdoclet.sf.net</url> + </dependency> + <dependency> + <id>xdoclet</id> + <groupId>xdoclet</groupId> + <artifactId>xdoclet</artifactId> + <version>1.2</version> + <type>jar</type> + <url>http://xdoclet.sf.net</url> + </dependency> + <dependency> + <groupId>xdoclet</groupId> + <artifactId>xdoclet-jmx-module</artifactId> + <version>1.2</version> + <type>jar</type> + <url>http://xdoclet.sourceforge.net</url> + </dependency> + + <!-- Pulled over from ServiceMix --> + <dependency> + <groupId>mx4j</groupId> + <artifactId>mx4j</artifactId> + <version>2.1.1</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + <dependency> + <groupId>mx4j</groupId> + <artifactId>mx4j-jmx</artifactId> + <version>2.1.1</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <dependency> + <groupId>mx4j</groupId> + <artifactId>mx4j-remote</artifactId> + <version>2.1.1</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <dependency> + <groupId>mx4j</groupId> + <artifactId>mx4j-tools</artifactId> + <version>2.1.1</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <dependency> + <groupId>mx4j</groupId> + <artifactId>mx4j-impl</artifactId> + <version>2.1.1</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <!--For remote management tasks--> + + <dependency> + <id>ant</id> + <version>1.6</version> + <properties> + <lib>true</lib> + </properties> + </dependency> + + <dependency> + <groupId>commons-logging</groupId> + <artifactId>commons-logging</artifactId> + <version>1.0.3</version> + <url>http://jakarta.apache.org/commons/logging/</url> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <dependency> + <id>concurrent</id> + <version>1.3.4</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <dependency> + <id>commons-beanutils</id> + <version>1.7.0</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + + <!-- for DOM, SAX, StAX and XPath support --> + + <dependency> + <groupId>servicemix</groupId> + <artifactId>jaxp</artifactId> + <version>1.3</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <dependency> + <id>stax+api</id> + <version>1.0</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <!-- possible StAX implementations: START --> + + <!-- fast implementation of StAX --> + <dependency> + <groupId>woodstox</groupId> + <artifactId>wstx-asl</artifactId> + <version>2.0</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.6.2</version> + <properties> + <lib>true</lib> + </properties> + </dependency> + <dependency> + <groupId>xerces</groupId> + <artifactId>xmlParserAPIs</artifactId> + <version>2.6.2</version> + <properties> + <lib>true</lib> + </properties> + </dependency> + + <!-- mostly included for some DOM/SAX tools we could maybe replace with JAXP versions --> + <dependency> + <id>xalan</id> + <version>2.6.0</version> + <properties> + <lib>true</lib> + </properties> + </dependency> + + <dependency> + <groupId>servicemix</groupId> + <artifactId>spring</artifactId> + <version>1.2.2-dev-2</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + + <!-- utility library for adapting StAX to SAX and JAXP Source --> + <dependency> + <id>stax-utils</id> + <version>snapshot-20040917</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <dependency> + <id>activemq</id> + <version>3.1-M6</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <!-- JCA container --> + <dependency> + <id>activemq+container</id> + <version>3.1-M6</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + <!-- JCA RA for testing --> + <dependency> + <id>activemq+ra</id> + <version>3.1-M6</version> + <properties> + <sar.bundle>true</sar.bundle> + </properties> + </dependency> + + </dependencies> + + <build> + <sourceDirectory>src/main/java</sourceDirectory> + <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory> + </build> +</project>
servicemix/tooling/jboss-deployer
project.properties added at 1.1
diff -N project.properties --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ project.properties 2 Aug 2005 19:09:26 -0000 1.1 @@ -0,0 +1,15 @@
+#------------------------------------------------------------------
+# X D O C L E T G E N E R A T I O N O F J M X
+#------------------------------------------------------------------
+maven.xdoclet.jmxdoclet.destDir=${basedir}/src/main/java
+maven.xdoclet.jmxdoclet.fileset.0=true
+maven.xdoclet.jmxdoclet.fileset.0.include=**/*.java
+maven.xdoclet.jmxdoclet.mbeaninterface.0=true
+maven.xdoclet.jmxdoclet.jbossxmlservicetemplate.0=true
+maven.xdoclet.jmxdoclet.jbossxmlservicetemplate.0.servicefile=jboss
+maven.xdoclet.jmxdoclet.jbossxmlservicetemplate.0.destDir=${basedir}/src/sar/META-INF
+
+#------------------------------------------------------------------
+# A P T S E T T I N G S
+#------------------------------------------------------------------
+maven.aptdoc.src.dir = ${basedir}/src/site/apt
\ No newline at end of file
servicemix/tooling/jboss-deployer/src/sar/META-INF
jboss-service.xml added at 1.1
diff -N jboss-service.xml --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ jboss-service.xml 2 Aug 2005 19:09:26 -0000 1.1 @@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?> + +<!-- The J2EE application client deployer service +--> +<server> + <mbean code="org.servicemix.jboss.deployment.JBIDeployer" + name="org.servicemix:service=Deployer"> + <depends optional-attribute-name="JBIContainer"> + org.servicemix:service=JBIService + </depends> + </mbean> + + <mbean code="org.servicemix.jboss.deployment.JBIService" + name="org.servicemix:service=JBIService"> + </mbean> +</server> +
