[jboss-cvs] JBossAS SVN: r62164 - in trunk/embedded: docs/tutorial/tomcat and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Apr 6 12:39:00 EDT 2007


Author: bill.burke at jboss.com
Date: 2007-04-06 12:39:00 -0400 (Fri, 06 Apr 2007)
New Revision: 62164

Added:
   trunk/embedded/docs/tutorial/tomcat/build.xml
   trunk/embedded/docs/tutorial/tomcat/resources/
   trunk/embedded/docs/tutorial/tomcat/resources/META-INF/
   trunk/embedded/docs/tutorial/tomcat/resources/META-INF/persistence.xml
   trunk/embedded/docs/tutorial/tomcat/resources/builtin.web.xml
   trunk/embedded/docs/tutorial/tomcat/resources/finegrain.web.xml
   trunk/embedded/docs/tutorial/tomcat/resources/scan.webinf.lib.xml
   trunk/embedded/docs/tutorial/tomcat/src/
   trunk/embedded/docs/tutorial/tomcat/src/EmbeddedJBoss.jsp
   trunk/embedded/docs/tutorial/tomcat/src/org/
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/Customer.java
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAOBean.java
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAOLocal.java
   trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAORemote.java
Modified:
   trunk/embedded/build.xml
   trunk/embedded/src/main/java/org/jboss/embedded/tomcat/WebinfScanner.java
Log:
expand tomcat tutorial

Modified: trunk/embedded/build.xml
===================================================================
--- trunk/embedded/build.xml	2007-04-06 16:32:52 UTC (rev 62163)
+++ trunk/embedded/build.xml	2007-04-06 16:39:00 UTC (rev 62164)
@@ -327,7 +327,7 @@
       <jar jarfile="${build.lib}/embedded-jboss/lib/jboss-embedded-tomcat-bootstrap.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/embedded/tomcat/EmbeddedJBossBootstrapListener.class"/>
-            <include name="org/jboss/embedded/tomcat/TomcatWebinfScanner.class"/>
+            <include name="org/jboss/embedded/tomcat/WebinfScanner.class"/>
             <include name="org/jboss/embedded/tomcat/security/*.class"/>
          </fileset>
       </jar>
@@ -336,7 +336,7 @@
          <fileset dir="${build.classes}">
             <include name="org/jboss/**"/>
             <exclude name="org/jboss/embedded/tomcat/EmbeddedJBossBootstrapListener.class"/>
-            <exclude name="org/jboss/embedded/tomcat/TomcatWebinfScanner.class"/>
+            <exclude name="org/jboss/embedded/tomcat/WebinfScanner.class"/>
             <exclude name="org/jboss/embedded/tomcat/security/*.class"/>
          </fileset>
          <fileset dir="../ejb3/src/resources">
@@ -444,6 +444,9 @@
       </javadoc>
       <property name="embedded.version" value="embedded-jboss-beta2"/>
       <zip zipfile="${embedded.version}.zip">
+         <zipfileset dir="." prefix="${embedded.version}">
+            <include name="install-tomcat55.xml"/>
+         </zipfileset>
          <zipfileset dir="output/api" prefix="${embedded.version}/docs/api">
             <include name="**"/>
          </zipfileset>

Added: trunk/embedded/docs/tutorial/tomcat/build.xml
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/build.xml	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/build.xml	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================= -->
+<!-- JBoss build file                                                       -->
+<!-- ======================================================================= -->
+
+<project name="JBoss" default="ejbjar" basedir=".">
+
+   <property environment="env"/>
+   <property name="src.dir" value="${basedir}/src"/>
+   <property name="build.dir" value="${basedir}/build"/>
+   <property name="build.classes.dir" value="${build.dir}/classes"/>
+   <property name="lib.dir" value="../../../lib"/>
+   <property name="conf.dir" value="../../../bootstrap"/>
+
+   <!-- Build classpath -->
+   <path id="build.classpath">
+      <fileset dir="${lib.dir}">
+         <include name="*.jar"/>
+      </fileset>
+      <pathelement location="${conf.dir}"/>
+   </path>
+
+   <!-- =================================================================== -->
+   <!-- Prepares the build directory                                        -->
+   <!-- =================================================================== -->
+   <target name="prepare">
+      <mkdir dir="${build.dir}"/>
+      <mkdir dir="${build.classes.dir}"/>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Compiles the source code                                            -->
+   <!-- =================================================================== -->
+   <target name="compile" depends="prepare">
+      <javac srcdir="${src.dir}"
+         destdir="${build.classes.dir}"
+         debug="on"
+         deprecation="on"
+         optimize="off"
+         includes="**">
+         <classpath refid="build.classpath"/>
+      </javac>
+   </target>
+
+   <target name="ejbjar" depends="compile">
+      <jar jarfile="${build.dir}/tutorial.jar">
+         <fileset dir="${build.classes.dir}">
+            <include name="**/*.class"/>
+         </fileset>
+         <fileset dir="resources">
+            <include name="META-INF/persistence.xml"/>
+         </fileset>
+      </jar>
+   </target>
+   <target name="scan.webinf.lib.war" depends="ejbjar">
+      <delete file="${build.dir}/embedded-jboss.war"/>
+      <war warfile="${build.dir}/embedded-jboss.war"
+         webxml="resources/scan.webinf.lib.xml">
+         <lib dir="${build.dir}">
+            <include name="tutorial.jar"/>
+         </lib>
+         <fileset dir="${src.dir}">
+            <include name="EmbeddedJBoss.jsp"/>
+         </fileset>
+      </war>
+   </target>
+   <target name="finegrain.war" depends="ejbjar">
+      <delete file="${build.dir}/embedded-jboss.war"/>
+      <war warfile="${build.dir}/embedded-jboss.war"
+         webxml="resources/finegrain.web.xml">
+         <lib dir="${build.dir}">
+            <include name="tutorial.jar"/>
+         </lib>
+         <fileset dir="${src.dir}">
+            <include name="EmbeddedJBoss.jsp"/>
+         </fileset>
+      </war>
+   </target>
+   <target name="builtin.war" depends="ejbjar">
+      <delete file="${build.dir}/embedded-jboss.war"/>
+      <war warfile="${build.dir}/embedded-jboss.war"
+         webxml="resources/builtin.web.xml">
+         <lib dir="${build.dir}">
+            <include name="tutorial.jar"/>
+         </lib>
+         <fileset dir="${src.dir}">
+            <include name="EmbeddedJBoss.jsp"/>
+         </fileset>
+      </war>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Cleans up generated stuff                                           -->
+   <!-- =================================================================== -->
+   <target name="clean">
+      <delete dir="${build.dir}"/>
+   </target>
+
+
+</project>
+

Added: trunk/embedded/docs/tutorial/tomcat/resources/META-INF/persistence.xml
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/resources/META-INF/persistence.xml	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/resources/META-INF/persistence.xml	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+   <persistence-unit name="custdb">
+      <jta-data-source>java:/DefaultDS</jta-data-source>
+      <properties>
+         <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+      </properties>
+   </persistence-unit>
+</persistence>

Added: trunk/embedded/docs/tutorial/tomcat/resources/builtin.web.xml
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/resources/builtin.web.xml	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/resources/builtin.web.xml	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app>
+   <description>Embedded JBoss</description>
+</web-app>

Added: trunk/embedded/docs/tutorial/tomcat/resources/finegrain.web.xml
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/resources/finegrain.web.xml	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/resources/finegrain.web.xml	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app>
+   <description>Embedded JBoss</description>
+
+   <context-param>
+      <param-name>jboss.embedded.resources</param-name>
+      <param-value>/WEB-INF/lib/tutorial.jar</param-value>
+   </context-param>
+
+   <listener>
+      <listener-class>org.jboss.embedded.ServletContextResourceScanner</listener-class>
+   </listener>
+
+</web-app>

Added: trunk/embedded/docs/tutorial/tomcat/resources/scan.webinf.lib.xml
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/resources/scan.webinf.lib.xml	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/resources/scan.webinf.lib.xml	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app>
+   <description>Embedded JBoss</description>
+
+   <listener>
+      <listener-class>org.jboss.embedded.WebInfLibScanner</listener-class>
+   </listener>
+
+</web-app>

Added: trunk/embedded/docs/tutorial/tomcat/src/EmbeddedJBoss.jsp
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/src/EmbeddedJBoss.jsp	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/src/EmbeddedJBoss.jsp	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,30 @@
+<%@ page import="javax.naming.InitialContext" %>
+<%@ page import="org.jboss.embedded.tutorial.war.beans.Customer" %>
+<%@ page import="org.jboss.embedded.tutorial.war.beans.CustomerDAOLocal" %>
+<%@ page import="org.jboss.embedded.tutorial.war.beans.CustomerDAORemote" %>
+
+<html>
+<body>
+<%
+   InitialContext ctx = new InitialContext();
+   CustomerDAOLocal local = (CustomerDAOLocal) ctx.lookup("CustomerDAOBean/local");
+   CustomerDAORemote remote = (CustomerDAORemote) ctx.lookup("CustomerDAOBean/remote");
+
+   int id = local.createCustomer("Gavin");
+   Customer cust = local.findCustomer(id);
+%>
+<p>
+   Successfully created and found Gavin from @Local interface: <%=cust.getName()%>
+</p>
+<%
+   id = remote.createCustomer("Emmanuel");
+   cust = remote.findCustomer(id);
+%>
+
+<p>
+   Successfully created and found Emmanuel from @Remote interface
+</p>
+
+DONE!
+</body>
+</html>
\ No newline at end of file

Added: trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/Customer.java
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/Customer.java	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/Customer.java	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.embedded.tutorial.war.beans;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue; import javax.persistence.GenerationType;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 61136 $
+ */
+ at Entity
+public class Customer implements Serializable
+{
+   private int id;
+   private String name;
+
+   @Id @GeneratedValue(strategy=GenerationType.AUTO)
+   public int getId()
+   {
+      return id;
+   }
+
+   public void setId(int id)
+   {
+      this.id = id;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+
+   public void setName(String name)
+   {
+      this.name = name;
+   }
+
+}

Added: trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAOBean.java
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAOBean.java	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAOBean.java	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.embedded.tutorial.war.beans;
+
+import javax.ejb.Stateless;
+import javax.persistence.PersistenceContext;
+import javax.persistence.EntityManager;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 61136 $
+ */
+ at Stateless
+public class CustomerDAOBean implements CustomerDAOLocal, CustomerDAORemote
+{
+   @PersistenceContext(unitName="custdb") private EntityManager em;
+
+   public int createCustomer(String name)
+   {
+      Customer cust = new Customer();
+      cust.setName(name);
+      em.persist(cust);
+      return cust.getId();
+   }
+
+   public Customer findCustomer(int id)
+   {
+      return em.find(Customer.class, id);
+   }
+}

Added: trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAOLocal.java
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAOLocal.java	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAOLocal.java	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.embedded.tutorial.war.beans;
+
+import javax.ejb.Local;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 61136 $
+ */
+ at Local
+public interface CustomerDAOLocal
+{
+   int createCustomer(String name);
+
+   Customer findCustomer(int id);
+}

Added: trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAORemote.java
===================================================================
--- trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAORemote.java	                        (rev 0)
+++ trunk/embedded/docs/tutorial/tomcat/src/org/jboss/embedded/tutorial/war/beans/CustomerDAORemote.java	2007-04-06 16:39:00 UTC (rev 62164)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.embedded.tutorial.war.beans;
+
+import javax.ejb.Remote;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @version $Revision: 61136 $
+ */
+ at Remote
+public interface CustomerDAORemote
+{
+   int createCustomer(String name);
+
+   Customer findCustomer(int id);
+}

Modified: trunk/embedded/src/main/java/org/jboss/embedded/tomcat/WebinfScanner.java
===================================================================
--- trunk/embedded/src/main/java/org/jboss/embedded/tomcat/WebinfScanner.java	2007-04-06 16:32:52 UTC (rev 62163)
+++ trunk/embedded/src/main/java/org/jboss/embedded/tomcat/WebinfScanner.java	2007-04-06 16:39:00 UTC (rev 62164)
@@ -21,25 +21,17 @@
 */
 package org.jboss.embedded.tomcat;
 
-import org.apache.catalina.LifecycleListener;
-import org.apache.catalina.LifecycleEvent;
 import org.apache.catalina.Lifecycle;
-import org.apache.catalina.Container;
-import org.apache.catalina.Pipeline;
+import org.apache.catalina.LifecycleEvent;
+import org.apache.catalina.LifecycleListener;
 import org.apache.catalina.core.StandardContext;
-import org.jboss.embedded.tomcat.security.SecurityAssociationValve;
-import org.jboss.embedded.Bootstrap;
-import org.jboss.embedded.DeploymentGroup;
-import org.jboss.deployers.plugins.structure.AbstractDeploymentContext;
 import org.jboss.deployers.spi.DeploymentException;
 import org.jboss.deployers.spi.structure.DeploymentContext;
+import org.jboss.embedded.Bootstrap;
+import org.jboss.embedded.DeploymentGroup;
 
-import javax.naming.directory.DirContext;
-import java.net.URL;
-import java.net.MalformedURLException;
 import java.io.File;
 import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
 
 /**
  * Searches for WAR's WEB-INF directory and deploys that directory.




More information about the jboss-cvs-commits mailing list