[jboss-cvs] JBossAS SVN: r68733 - in projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment: src/main/assembly and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jan 9 10:03:42 EST 2008
Author: newtonm
Date: 2008-01-09 10:03:42 -0500 (Wed, 09 Jan 2008)
New Revision: 68733
Added:
projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/bean-xml.xml
Removed:
projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/pojo.xml
Modified:
projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/pom.xml
projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/config/deployer-beans.xml
projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/java/org/jboss/example/client/Client.java
projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/java/org/jboss/example/client/ConsoleInput.java
projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/resources/log4j.properties
Log:
Reorganized files to create multiple distributions.
Modified: projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/pom.xml
===================================================================
--- projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/pom.xml 2008-01-09 15:02:51 UTC (rev 68732)
+++ projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/pom.xml 2008-01-09 15:03:42 UTC (rev 68733)
@@ -106,7 +106,7 @@
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
- <descriptor>src/main/assembly/pojo.xml</descriptor>
+ <descriptor>src/main/assembly/bean-xml.xml</descriptor>
<!--<descriptor>src/main/assembly/aop.xml</descriptor>
<descriptor>src/main/assembly/classloader.xml</descriptor>-->
</descriptors>
Copied: projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/bean-xml.xml (from rev 68682, projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/pojo.xml)
===================================================================
--- projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/bean-xml.xml (rev 0)
+++ projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/bean-xml.xml 2008-01-09 15:03:42 UTC (rev 68733)
@@ -0,0 +1,30 @@
+<assembly>
+ <id>bean-xml</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <files>
+ <file>
+ <source>src/main/config/deployer-beans.xml</source>
+ <!--<destName>jboss-beans.xml</destName>-->
+ </file>
+ <file>
+ <source>src/main/config/hrService-beans.xml</source>
+ <!--<destName>jboss-beans.xml</destName>-->
+ </file>
+ </files>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/lib</outputDirectory>
+ <unpack>false</unpack>
+ <scope>runtime</scope>
+ <includes>
+ <include>org.jboss.microcontainer.examples:humanResourcesService</include>
+ </includes>
+ </dependencySet>
+ </dependencySets>
+ <componentDescriptors>
+ <componentDescriptor>src/main/assembly/common.xml</componentDescriptor>
+ </componentDescriptors>
+</assembly>
Deleted: projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/pojo.xml
===================================================================
--- projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/pojo.xml 2008-01-09 15:02:51 UTC (rev 68732)
+++ projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/assembly/pojo.xml 2008-01-09 15:03:42 UTC (rev 68733)
@@ -1,30 +0,0 @@
-<assembly>
- <id>pojo</id>
- <formats>
- <format>zip</format>
- </formats>
- <includeBaseDirectory>false</includeBaseDirectory>
- <files>
- <file>
- <source>src/main/config/deployer-beans.xml</source>
- <!--<destName>jboss-beans.xml</destName>-->
- </file>
- <file>
- <source>src/main/config/hrService-beans.xml</source>
- <!--<destName>jboss-beans.xml</destName>-->
- </file>
- </files>
- <dependencySets>
- <dependencySet>
- <outputDirectory>/lib</outputDirectory>
- <unpack>false</unpack>
- <scope>runtime</scope>
- <includes>
- <include>org.jboss.microcontainer.examples:humanResourcesService</include>
- </includes>
- </dependencySet>
- </dependencySets>
- <componentDescriptors>
- <componentDescriptor>src/main/assembly/common.xml</componentDescriptor>
- </componentDescriptors>
-</assembly>
Modified: projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/config/deployer-beans.xml
===================================================================
--- projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/config/deployer-beans.xml 2008-01-09 15:02:51 UTC (rev 68732)
+++ projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/config/deployer-beans.xml 2008-01-09 15:03:42 UTC (rev 68733)
@@ -27,43 +27,6 @@
<uncallback method="removeDeployer"/>
</bean>
- <!-- 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>
- </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 -->
Modified: projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/java/org/jboss/example/client/Client.java
===================================================================
--- projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/java/org/jboss/example/client/Client.java 2008-01-09 15:02:51 UTC (rev 68732)
+++ projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/java/org/jboss/example/client/Client.java 2008-01-09 15:03:42 UTC (rev 68733)
@@ -2,7 +2,6 @@
import java.io.File;
import java.io.IOException;
-import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
import java.util.Date;
@@ -17,7 +16,6 @@
import org.jboss.example.service.Employee;
import org.jboss.example.service.HRManager;
import org.jboss.example.service.util.SalaryStrategy;
-import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.registry.KernelBus;
import org.jboss.virtual.VFS;
@@ -36,15 +34,15 @@
private URL deployerBeansUrl, hrServiceBeansUrl;
private UserInterface userInterface;
private HRManager manager;
+ private MainDeployerImpl mainDeployer;
+ private Deployment deployment;
private EmbeddedBootstrap bootstrap;
- private Kernel kernel;
private KernelController controller;
private KernelBus bus;
- private MainDeployerImpl mainDeployer;
- private Deployment deployment;
private final static String MAIN_DEPLOYER = "MainDeployer";
+ private final static String DEPLOYMENT = "org.jboss.deployers.client.spi.Deployment";
private final static String HRSERVICE = "HRService";
private final static String EMPLOYEE = "org.jboss.example.service.Employee";
@@ -65,13 +63,18 @@
deployerBeansUrl = cl.getResource("deployer-beans.xml");
hrServiceBeansUrl = cl.getResource("hrService-beans.xml");
+ // Create VFSDeployment to use with aspectized deployers
+ File hrServiceBeans = new File(hrServiceBeansUrl.getFile());
+ VirtualFile root = VFS.getRoot(hrServiceBeans.toURI());
+ VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
+ deployment = deploymentFactory.createVFSDeployment(root);
+
// Start JBoss Microcontainer
bootstrap = new EmbeddedBootstrap();
bootstrap.run();
- kernel = bootstrap.getKernel();
- controller = kernel.getController();
- bus = kernel.getBus();
+ controller = bootstrap.getKernel().getController();
+ bus = bootstrap.getKernel().getBus();
}
public void setUserInterface(UserInterface userInterface) {
@@ -79,55 +82,62 @@
}
void deploy() {
- bootstrap.deploy(deployerBeansUrl);
-
- ControllerContext context = controller.getInstalledContext(MAIN_DEPLOYER);
- if (context != null) {
- mainDeployer = (MainDeployerImpl) context.getTarget();
+ bootstrap.deploy(deployerBeansUrl);
+ if (!useBus && mainDeployer == null) {
+ ControllerContext context = controller.getInstalledContext(MAIN_DEPLOYER);
+ if (context != null) { mainDeployer = (MainDeployerImpl) context.getTarget(); }
}
}
-
- /**
- * Check whether the MainDeployer has already deployed the hrService-beans.xml file.
- * If not then create a VFSDeployment and deploy it. Cache the resulting HRManager service.
- *
- * @throws IOException
- * @throws URISyntaxException
- * @throws DeploymentException
- */
- void deployService() throws IOException, URISyntaxException, DeploymentException {
- if (mainDeployer != null) {
- File hrServiceBeans = new File(hrServiceBeansUrl.getFile());
- VirtualFile root = VFS.getRoot(hrServiceBeans.toURI());
- String deploymentName = root.toURI().toString();
- deployment = mainDeployer.getDeployment(deploymentName);
-
- if (deployment == null) {
- VFSDeploymentFactory deploymentFactory = VFSDeploymentFactory.getInstance();
- deployment = deploymentFactory.createVFSDeployment(root);
- mainDeployer.addDeployment(deployment);
- mainDeployer.process();
-
- if (!useBus && manager == null) {
- ControllerContext hrServiceCtx = controller.getInstalledContext(HRSERVICE);
- if (hrServiceCtx != null) { manager = (HRManager) hrServiceCtx.getTarget(); }
- }
+
+ void undeploy() {
+ bootstrap.undeploy(deployerBeansUrl);
+ }
+
+ void deployService() throws DeploymentException {
+ if (useBus) {
+ if (invoke(MAIN_DEPLOYER, "getDeployment", new Object[] {deployment.getName()}, new String[] {"java.lang.String"}) != null) {
+ System.out.println("Service is already deployed.");
+ return;
+ }
+
+ invoke(MAIN_DEPLOYER, "addDeployment", new Object[] {deployment}, new String[] {DEPLOYMENT});
+ invoke(MAIN_DEPLOYER, "process", new Object[] {}, new String[] {});
+ } else {
+ if (mainDeployer.getDeployment(deployment.getName()) != null) {
+ System.out.println("Service is already deployed.");
+ return;
}
+
+ mainDeployer.addDeployment(deployment);
+ mainDeployer.process();
+
+ if (manager == null) {
+ ControllerContext hrServiceCtx = controller.getInstalledContext(HRSERVICE);
+ if (hrServiceCtx != null) { manager = (HRManager) hrServiceCtx.getTarget(); }
+ }
}
}
- void undeployService() throws IOException, URISyntaxException, DeploymentException {
- if (mainDeployer != null && deployment != null) {
+ void undeployService() throws DeploymentException {
+ if (useBus) {
+ if (invoke(MAIN_DEPLOYER, "getDeployment", new Object[] {deployment.getName()}, new String[] {"java.lang.String"}) == null) {
+ System.out.println("Service is already undeployed.");
+ return;
+ }
+
+ invoke(MAIN_DEPLOYER, "removeDeployment", new Object[] {deployment}, new String[] {DEPLOYMENT});
+ invoke(MAIN_DEPLOYER, "process", new Object[] {}, new String[] {});
+ } else {
+ if (mainDeployer.getDeployment(deployment.getName()) == null) {
+ System.out.println("Service is already undeployed.");
+ return;
+ }
+
mainDeployer.removeDeployment(deployment);
- mainDeployer.process();
- manager = null;
+ mainDeployer.process();
}
}
-
- void undeploy() {
- bootstrap.undeploy(deployerBeansUrl);
- }
-
+
private Object invoke(String serviceName, String methodName, Object[] args, String[] types) {
Object result = null;
try {
Modified: projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/java/org/jboss/example/client/ConsoleInput.java
===================================================================
--- projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/java/org/jboss/example/client/ConsoleInput.java 2008-01-09 15:02:51 UTC (rev 68732)
+++ projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/java/org/jboss/example/client/ConsoleInput.java 2008-01-09 15:03:42 UTC (rev 68733)
@@ -50,7 +50,7 @@
System.out.println("Aspectized deployers have not been deployed yet.");
continue;
} else if (hrServiceDeployed == false &&
- (option == 'u' || option == 'a' || option == 'l' || option == 'r' ||
+ (option == 'U' || option == 'a' || option == 'l' || option == 'r' ||
option == 'g' || option == 's' || option == 't' || option == 'p')) {
System.out.println("Service has not been deployed yet.");
continue;
@@ -80,10 +80,8 @@
System.out.println(e.getMessage());
} catch (IOException e) {
e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
} catch (DeploymentException e) {
- e.printStackTrace();
+ System.out.println("Error during deployment/undeployment: " + e.getMessage());
}
}
}
Modified: projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/resources/log4j.properties
===================================================================
--- projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/resources/log4j.properties 2008-01-09 15:02:51 UTC (rev 68732)
+++ projects/microcontainer/trunk/docs/examples/User_Guide/gettingStarted/advDeployment/src/main/resources/log4j.properties 2008-01-09 15:03:42 UTC (rev 68733)
@@ -4,4 +4,4 @@
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
-log4j.appender.stdout.layout.ConversionPattern=Client %5p [%d{dd-MM-yyyy HH:mm:ss}] %c{1} - %m%n
+log4j.appender.stdout.layout.ConversionPattern=AdvDeployment %5p [%d{dd-MM-yyyy HH:mm:ss}] %c{1} - %m%n
More information about the jboss-cvs-commits
mailing list