[jboss-cvs] JBossAS SVN: r82360 - in projects/ejb3/trunk/docs/tutorial: common and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Dec 18 05:42:00 EST 2008
Author: jaikiran
Date: 2008-12-18 05:42:00 -0500 (Thu, 18 Dec 2008)
New Revision: 82360
Added:
projects/ejb3/trunk/docs/tutorial/common/
projects/ejb3/trunk/docs/tutorial/common/pom.xml
projects/ejb3/trunk/docs/tutorial/common/src/
projects/ejb3/trunk/docs/tutorial/init/
projects/ejb3/trunk/docs/tutorial/init/pom.xml
projects/ejb3/trunk/docs/tutorial/shutdown/
projects/ejb3/trunk/docs/tutorial/shutdown/pom.xml
Modified:
projects/ejb3/trunk/docs/tutorial/pom.xml
projects/ejb3/trunk/docs/tutorial/stateless/pom.xml
projects/ejb3/trunk/docs/tutorial/stateless/src/org/jboss/tutorial/stateless/bean/CalculatorBean.java
Log:
Initial working stateless tutorial - Introduced a JBossAS Server Maven plugin to start/stop JBossAS and deploy the tutorials
Added: projects/ejb3/trunk/docs/tutorial/common/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/common/pom.xml (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/common/pom.xml 2008-12-18 10:42:00 UTC (rev 82360)
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ The common parent pom that will be used by the EJB3 tutorials.
+
+-->
+<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">
+
+ <!-- The JBoss server profile which will be used by the tutorials for
+ deploying the application. Individual tutorials can override this value
+ in their pom.xml depending on their need. For ex: The "Clustering" tutorial
+ does not require clustering, so it's pom.xml is going to override this property
+ with "all" server profile -->
+ <properties>
+ <!-- The jboss.home "intermediate" property would not have been necessary, if
+ Maven's enforcer plugin supported enforcing setting of a "System" environment variable.
+ Details here http://markmail.org/message/jwfmtrjesuyag7bh
+
+ This intermediate property is a workaround to use in the enforcer plugin to ensure that
+ the JBOSS_HOME is set. And now that we have an intermediate jboss.home, let's use this throughout
+ the pom instead of JBOSS_HOME.
+ -->
+ <jboss.home>${JBOSS_HOME}</jboss.home>
+ <jboss.server.config>default</jboss.server.config>
+ </properties>
+
+ <!-- Parent - The jboss-ejb3-tutorial-parent (Aggregator) will act as a parent
+
+ -->
+
+ <parent>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-tutorial-parent</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../</relativePath>
+ </parent>
+
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-tutorial-common</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss EJB3 Tutorial Common Parent POM</name>
+ <url>http://labs.jboss.com/jbossejb3/</url>
+ <description>
+ Common Parent POM for JBoss EJB3 Tutorials
+ </description>
+
+
+ <build>
+ <!-- The project is current not in the Maven standard structure. So
+ let's tell Maven where the source resides for each module -->
+ <sourceDirectory>./src</sourceDirectory>
+
+ <plugins>
+ <!-- JBossAS Maven plugin for startup/shutdown
+ and other AS control -->
+ <plugin>
+ <groupId>org.jboss.maven.plugins.jbossas</groupId>
+ <artifactId>maven-jboss-as-control-plugin</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <!-- Executions -->
+ <!--
+ Deploy the tutorial
+ -->
+
+ <executions>
+ <execution>
+ <id>deploy-tutorial</id>
+ <goals>
+ <goal>deploy</goal>
+ </goals>
+ <phase>install</phase>
+ <configuration>
+ <serverConfigName>${jboss.server.config}</serverConfigName>
+ <files>
+ ${pom.build.directory}/${pom.artifactId}.${pom.packaging}
+ </files>
+ <jboss.test.run>true</jboss.test.run>
+ </configuration>
+ </execution>
+
+
+
+ </executions>
+
+ </plugin>
+
+ <!-- Ant plugin to run Ant tasks -->
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <!-- Run the tutorial (client) -->
+ <executions>
+ <execution>
+ <id>run-tutorial</id>
+ <phase>install</phase>
+ <configuration>
+ <!-- Individual child tutorials, will provide the ${ejb3.tutorial.client} property value -->
+ <tasks>
+ <!-- The classpath for the tutorial client -->
+ <path id="ejb3.tutorial.classpath">
+ <!-- Only the jbossall-client.jar should ideally be sufficient -->
+ <fileset dir="${jboss.home}/client">
+ <include name="**/jbossall-client.jar"/>
+ </fileset>
+ <pathelement location="${build.outputDirectory}"/>
+ </path>
+ <echo message="*********************************** JBoss EJB3 Tutorials ***********************************" />
+ <echo message="**** Running ${ejb3.tutorial.client}" />
+ <java classname="${ejb3.tutorial.client}" fork="yes" dir=".">
+ <classpath refid="ejb3.tutorial.classpath"/>
+ </java>
+ <echo message="********************************************************************************************" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- Plugin to enforce JBOSS_HOME is set -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>enforce-property</id>
+ <phase>install</phase>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>jboss.home</property>
+ <message>"Please set JBOSS_HOME"</message>
+ </requireProperty>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ </plugins>
+
+ <!-- Include the jndi.properties and the log4j.xml in the classpath -->
+ <resources>
+ <resource>
+ <!-- Relative to each child tutorial -->
+ <directory>./</directory>
+ <includes>
+ <include>jndi.properties</include>
+ <include>log4j.xml</include>
+ </includes>
+ </resource>
+ </resources>
+ </build>
+
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-persistence-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jms-api</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
Property changes on: projects/ejb3/trunk/docs/tutorial/common/pom.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: projects/ejb3/trunk/docs/tutorial/init/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/init/pom.xml (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/init/pom.xml 2008-12-18 10:42:00 UTC (rev 82360)
@@ -0,0 +1,80 @@
+<?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">
+
+
+
+
+
+ <!-- Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-tutorial-parent</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../common/</relativePath>
+ </parent>
+
+
+
+
+ <artifactId>jboss-ejb3-tutorial-init</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>EJB3 Tutorial Init</name>
+ <url>http://labs.jboss.com/jbossejb3/</url>
+ <description>
+ Initializes the environment required for running the EJB3 tutorials
+ </description>
+
+ <build>
+
+ <plugins>
+ <!-- JBossAS Maven plugin for startup/shutdown
+ and other AS control -->
+ <plugin>
+ <groupId>org.jboss.maven.plugins.jbossas</groupId>
+ <artifactId>maven-jboss-as-control-plugin</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <!-- Executions -->
+ <!--
+ Start the server
+ -->
+
+ <executions>
+ <execution>
+ <id>start-jbossas</id>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <phase>install</phase>
+ <configuration>
+ <serverConfigName>${jboss.server.config}</serverConfigName>
+ <jvmArgs>
+ <jvmArg>-Xms128m</jvmArg>
+ <jvmArg>-Xmx512m</jvmArg>
+ <jvmArg>-XX:MaxPermSize=256m</jvmArg>
+ <jvmArg>-Dorg.jboss.resolver.warning=true</jvmArg>
+ <jvmArg>-Dsun.rmi.dgc.client.gcInterval=3600000</jvmArg>
+ <jvmArg>-Dsun.rmi.dgc.server.gcInterval=3600000</jvmArg>
+ </jvmArgs>
+ <jboss.test.run>true</jboss.test.run>
+ </configuration>
+ </execution>
+
+ </executions>
+
+ </plugin>
+
+
+
+ </plugins>
+
+
+ </build>
+
+
+</project>
Property changes on: projects/ejb3/trunk/docs/tutorial/init/pom.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: projects/ejb3/trunk/docs/tutorial/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/pom.xml 2008-12-18 10:33:27 UTC (rev 82359)
+++ projects/ejb3/trunk/docs/tutorial/pom.xml 2008-12-18 10:42:00 UTC (rev 82360)
@@ -22,6 +22,7 @@
<parent>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-build</artifactId>
+ <!-- TODO: Use 1.0.0-Beta11 once its available http://www.jboss.com/index.html?module=bb&op=viewtopic&t=147117 -->
<version>1.0.0-Beta8</version>
</parent>
@@ -37,111 +38,30 @@
Tutorial for JBoss EJB3
</description>
+<modules>
+ <!-- The init module is responsible for starting up the JBossAS.
+ This is a bit ugly, since the init project does nothing other than triggering
+ a server start. Maven doesn't have a "init" phase where we could have added
+ this server start activity. And we don't want to start the server for
+ every module (tutorial), hence this separate init module.
+ The shutdown is similarly handled by a separate "shutdown" module which is
+ the last module to be called. If something fails before the shutdown module is
+ invoked, there's a Java Shutdownhook in the jbossas-server-manager which cleanly
+ shuts down the JBossAS -->
+ <module>init</module>
+ <!-- The tutorials go here -->
+ <module>stateless</module>
+
+ <!-- Responsible for JBossAS shutdown -->
+ <module>shutdown</module>
- <build>
- <!-- The project is current not in the Maven standard structure. So
- let's tell Maven where the source resides for each module -->
- <sourceDirectory>./src</sourceDirectory>
-
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <!-- The client/* files are meant for the EJB client. No
- need to include them in packaging -->
- <excludes>
- <!-- <exclude>**/client/**/*.java</exclude> -->
- </excludes>
- </configuration>
- </plugin>
-
- <!-- Run specific Ant tasks through this plugin -->
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
-
- <execution>
- <id>deploy-tutorial</id>
- <!-- We want to copy the packaged jar files to the JBoss deploy folder during package -->
- <phase>package</phase>
- <configuration>
- <!-- Copy the deployable to the deploy folder of the appropriate server
- profile in JBoss.
- - The JBOSS_HOME is expected to be set as a environment variable by the user.
- - The jboss.server.config is set at the pom level and can be overriden by the pom.xml of
- individual modules (tutorials) -->
- <tasks>
- <copy file="${pom.build.directory}/${pom.artifactId}.${pom.packaging}" todir="${JBOSS_HOME}/server/${jboss.server.config}/deploy"/>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- <execution>
- <id>run-tutorial</id>
- <!-- Run the client -->
- <phase>install</phase>
- <configuration>
- <!-- Individual child tutorials, will provide the ${ejb3.tutorial.client} property value -->
- <tasks>
- <!-- The classpath for the tutorial client -->
- <path id="ejb3.tutorial.classpath">
- <!-- Only the jbossall-client.jar should ideally be sufficient -->
- <fileset dir="${JBOSS_HOME}/client">
- <include name="**/jbossall-client.jar"/>
- </fileset>
- <pathelement location="${build.outputDirectory}"/>
- </path>
- <echo message="*********************************** JBoss EJB3 Tutorials ***********************************" />
- <echo message="**** Running ${ejb3.tutorial.client}" />
- <java classname="${ejb3.tutorial.client}" fork="yes" dir=".">
- <classpath refid="ejb3.tutorial.classpath"/>
- </java>
- <echo message="**** Successful completion of tutorial!" />
- <echo message="********************************************************************************************" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- </executions>
- </plugin>
-
- </plugins>
- <!-- Include the jndi.properties and the log4j.xml in the classpath -->
- <resources>
- <resource>
- <directory>./</directory>
- <includes>
- <include>jndi.properties</include>
- <include>log4j.xml</include>
- </includes>
- </resource>
- </resources>
- </build>
+ </modules>
+
+
+
+
- <dependencies>
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-ejb-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-persistence-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-jms-api</artifactId>
- </dependency>
-
- </dependencies>
-
</project>
Added: projects/ejb3/trunk/docs/tutorial/shutdown/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/shutdown/pom.xml (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/shutdown/pom.xml 2008-12-18 10:42:00 UTC (rev 82360)
@@ -0,0 +1,72 @@
+<?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">
+
+
+
+
+
+ <!-- Model Version -->
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-tutorial-parent</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <relativePath>../common/</relativePath>
+ </parent>
+
+
+
+
+ <artifactId>jboss-ejb3-tutorial-shutdown</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>EJB3 Tutorial Cleanup</name>
+ <url>http://labs.jboss.com/jbossejb3/</url>
+ <description>
+ Initializes the environment required for running the EJB3 tutorials
+ </description>
+
+ <build>
+
+ <plugins>
+ <!-- JBossAS Maven plugin for startup/shutdown
+ and other AS control -->
+ <plugin>
+ <groupId>org.jboss.maven.plugins.jbossas</groupId>
+ <artifactId>maven-jboss-as-control-plugin</artifactId>
+ <version>0.1.0-SNAPSHOT</version>
+
+ <!-- Executions -->
+ <!--
+ Stop the server
+ -->
+
+ <executions>
+ <execution>
+ <id>stop-jbossas</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ <phase>install</phase>
+ <configuration>
+ <serverConfigName>${jboss.server.config}</serverConfigName>
+ <jboss.test.run>true</jboss.test.run>
+ </configuration>
+ </execution>
+
+ </executions>
+
+ </plugin>
+
+
+
+ </plugins>
+
+
+ </build>
+
+
+</project>
Property changes on: projects/ejb3/trunk/docs/tutorial/shutdown/pom.xml
___________________________________________________________________
Name: svn:executable
+ *
Modified: projects/ejb3/trunk/docs/tutorial/stateless/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/stateless/pom.xml 2008-12-18 10:33:27 UTC (rev 82359)
+++ projects/ejb3/trunk/docs/tutorial/stateless/pom.xml 2008-12-18 10:42:00 UTC (rev 82360)
@@ -12,9 +12,9 @@
<parent>
<groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3-tutorial-parent</artifactId>
+ <artifactId>jboss-ejb3-tutorial-common</artifactId>
<version>0.1.0-SNAPSHOT</version>
- <relativePath>../</relativePath>
+ <relativePath>../common/</relativePath>
</parent>
<properties>
Modified: projects/ejb3/trunk/docs/tutorial/stateless/src/org/jboss/tutorial/stateless/bean/CalculatorBean.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/stateless/src/org/jboss/tutorial/stateless/bean/CalculatorBean.java 2008-12-18 10:33:27 UTC (rev 82359)
+++ projects/ejb3/trunk/docs/tutorial/stateless/src/org/jboss/tutorial/stateless/bean/CalculatorBean.java 2008-12-18 10:42:00 UTC (rev 82360)
@@ -22,23 +22,12 @@
package org.jboss.tutorial.stateless.bean;
import javax.ejb.Stateless;
-import javax.sql.DataSource;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
@Stateless
public class CalculatorBean implements CalculatorRemote, CalculatorLocal
{
public int add(int x, int y)
{
- try
- {
- DataSource ds = (DataSource)new InitialContext().lookup("java:/DefaultDS");
- }
- catch (NamingException e)
- {
- throw new RuntimeException(e);
- }
return x + y;
}
More information about the jboss-cvs-commits
mailing list