[jboss-cvs] JBossAS SVN: r82863 - in projects/ejb3/trunk/docs/tutorial: enterprise_app_ejb_injection and 25 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 14 06:34:53 EST 2009


Author: jaikiran
Date: 2009-01-14 06:34:49 -0500 (Wed, 14 Jan 2009)
New Revision: 82863

Added:
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/build.xml
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/META-INF/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/META-INF/application.xml
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/pom.xml
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/src/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/src/main/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/src/main/resources/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/src/main/resources/application.xml
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/pom.xml
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/Calculator.java
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorBean.java
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorLocal.java
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorRemote.java
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/resources/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/pom.xml
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/pom.xml
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/tutorial/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/servlet/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/servlet/CalculatorActionServlet.java
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/WEB-INF/
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/WEB-INF/web.xml
   projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/index.html
Log:
Working version of Injecting EJB in Servlet tutorial for JBossAS-5.0 GA

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/build.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/build.xml	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,123 @@
+<?xml version="1.0"?>
+
+<!-- ======================================================================= -->
+<!-- JBoss build file                                                       -->
+<!-- ======================================================================= -->
+
+<project name="JBoss" default="ejbjar" basedir=".">
+
+   	<property environment="env"/>
+	<property name="ejbapp.home" value="${basedir}/ejbapp"/>
+	<property name="webapp.home" value="${basedir}/webapp"/>
+  	<property name="ejbapp.src.dir" value="${ejbapp.home}/src/main/java"/>
+	<property name="webapp.src.dir" value="${webapp.home}/src/main/java"/>
+   	<property name="ejbapp.build.dir" value="${ejbapp.home}/build"/>
+   	<property name="ejbapp.build.classes.dir" value="${ejbapp.build.dir}/classes"/>
+   	<property name="webapp.build.dir" value="${webapp.home}/build"/>
+  	<property name="webapp.build.classes.dir" value="${webapp.build.dir}/classes"/>
+	<property name="ear.home" value="${basedir}/ear"/>
+	<property name="ear.build.dir" value="${ear.home}/build"/>
+   	<property name="build.war.artifact" value="jboss-ejb3-tutorial-enterprise_webapp.war"/>
+	<property name="build.ear.artifact" value="jboss-ejb3-tutorial-ejb_injection.ear"/>
+	<property name="build.jar.artifact" value="jboss-ejb3-tutorial-enterprise_ejb3app.jar"/>
+	<property name="jboss.home" value="${env.JBOSS_HOME}"/>
+	<property name="jboss.server.config" value="default"/>
+   <!-- Build classpath -->
+   <path id="classpath">
+      <!-- So that we can get jndi.properties for InitialContext -->
+      <pathelement location="${basedir}"/>
+   		<!-- Only the jbossall-client.jar should ideally be sufficient -->
+      <fileset dir="${jboss.home}/client">
+         <include name="**/jbossall-client.jar"/>
+      </fileset>
+      <pathelement location="${ejbapp.build.classes.dir}"/>
+   	  <pathelement location="${webapp.build.classes.dir}"/>
+   </path>
+
+   <property name="build.classpath" refid="classpath"/>
+
+   <!-- =================================================================== -->
+   <!-- Prepares the build directory                                        -->
+   <!-- =================================================================== -->
+   <target name="prepare">
+      	<mkdir dir="${ejbapp.build.dir}"/>
+      	<mkdir dir="${ejbapp.build.classes.dir}"/>
+   		<mkdir dir="${webapp.build.dir}"/>
+   		<mkdir dir="${webapp.build.classes.dir}"/>
+   		<mkdir dir="${ear.build.dir}"/>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Compiles the source code                                            -->
+   <!-- =================================================================== -->
+   <target name="compile" depends="prepare">
+    <!-- First compile EJB related classes -->
+   	<javac srcdir="${ejbapp.src.dir}"
+         destdir="${ejbapp.build.classes.dir}"
+         debug="on"
+         deprecation="on"
+         optimize="off"
+         includes="**">
+         <classpath refid="classpath"/>
+      </javac>
+   	<!-- Now the web app classes -->
+   	<javac srcdir="${webapp.src.dir}"
+   	         destdir="${webapp.build.classes.dir}"
+   	         debug="on"
+   	         deprecation="on"
+   	         optimize="off"
+   	         includes="**">
+   	         <classpath refid="classpath"/>
+   	</javac>
+   	
+   </target>
+
+   <target name="ejbjar" depends="compile">
+   	 <!-- The EJB jar -->
+      <jar jarfile="${ejbapp.build.dir}/${build.jar.artifact}">
+         <fileset dir="${ejbapp.build.classes.dir}">
+            <include name="**/*.class"/>
+         </fileset>
+      </jar>
+   	 <!-- The war -->
+      <zip zipfile="${webapp.build.dir}/${build.war.artifact}">
+         <zipfileset dir="${webapp.build.classes.dir}" prefix="WEB-INF/classes">
+            <include name="**/*.class"/>
+         </zipfileset>
+         <zipfileset dir="${webapp.home}/src/main/webapp">
+         	<include name="WEB-INF/web.xml"/>
+            <include name="index.html"/>
+         </zipfileset>
+      </zip>
+   		<!-- Finally the EAR -->
+      <zip zipfile="${ear.build.dir}/${build.ear.artifact}">
+         <zipfileset dir="${webapp.build.dir}">
+            <include name="${build.war.artifact}"/>
+         </zipfileset>
+         <zipfileset dir="${ear.home}">
+            <include name="META-INF/application.xml"/>
+         </zipfileset>
+         <zipfileset dir="${ejbapp.build.dir}">
+            <include name="${build.jar.artifact}"/>
+         </zipfileset>
+      </zip>
+      <copy file="${ear.build.dir}/${build.ear.artifact}" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+   </target>
+
+   <!-- =================================================================== -->
+   <!-- Cleans up generated stuff                                           -->
+   <!-- =================================================================== -->
+   <target name="clean.db">
+      <delete dir="${jboss.home}/server/${jboss.server.config}/data/hypersonic"/>
+   </target>
+
+   <target name="clean">
+      	<delete dir="${webapp.build.dir}"/>
+   		<delete dir="${ejbapp.build.dir}"/>
+   		<delete dir="${ear.build.dir}"/>
+      	<delete file="${jboss.home}/server/${jboss.server.config}/deploy/${build.ear.artifact}"/>
+   </target>
+
+
+</project>
+


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/build.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/META-INF/application.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/META-INF/application.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/META-INF/application.xml	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE application PUBLIC
+	"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+	"http://java.sun.com/dtd/application_1_3.dtd">
+<application>
+  <display-name>jboss-ejb3-tutorial-ejb_injection</display-name>
+  <description>Enterprise application showing injection of EJB in Servlet</description>
+  <module>
+    <web>
+      <web-uri>jboss-ejb3-tutorial-enterprise_webapp.war</web-uri>
+      <context-root>/jboss-ejb3-tutorial-enterprise_webapp</context-root>
+    </web>
+  </module>
+  <module>
+    <ejb>jboss-ejb3-tutorial-enterprise_ejb3app.jar</ejb>
+  </module>
+</application>

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/pom.xml	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,66 @@
+<?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">
+
+  
+	<properties>
+		
+	  	<!--  Versions -->
+	    <version.org.jboss.ejb3_jboss-ejb3-tutorial-enterprise_webapp>0.1.0-SNAPSHOT</version.org.jboss.ejb3_jboss-ejb3-tutorial-enterprise_webapp>
+	    <version.org.jboss.ejb3_jboss-ejb3-tutorial-enterprise_ejb3app>0.1.0-SNAPSHOT</version.org.jboss.ejb3_jboss-ejb3-tutorial-enterprise_ejb3app>
+  	</properties>
+  	
+  
+   
+  <!-- Model Version -->
+  <modelVersion>4.0.0</modelVersion>
+  
+  
+  <parent>
+    <groupId>org.jboss.ejb3</groupId>
+    <artifactId>jboss-ejb3-tutorial-enterprise_app_ejb_injection</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../</relativePath>
+  </parent>
+
+  
+
+	
+  <artifactId>jboss-ejb3-tutorial-ejb_injection</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>ear</packaging>
+  <name>EAR for EJB injection in Servlet</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+	Enterprise application showing injection of EJB in Servlet
+  </description>
+  
+ 
+	
+  
+  
+	<!-- Dependencies -->
+	<dependencies>
+  		
+      
+      <dependency>
+            <groupId>org.jboss.ejb3</groupId>
+            <artifactId>jboss-ejb3-tutorial-enterprise_webapp</artifactId>
+            <version>${version.org.jboss.ejb3_jboss-ejb3-tutorial-enterprise_webapp}</version>
+			<type>war</type>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.ejb3</groupId>
+            <artifactId>jboss-ejb3-tutorial-enterprise_ejb3app</artifactId>
+            <version>${version.org.jboss.ejb3_jboss-ejb3-tutorial-enterprise_ejb3app}</version>
+			<type>ejb</type>
+        </dependency>
+    
+	</dependencies>	 
+
+
+	
+ 
+
+</project>


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/src/main/resources/application.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/src/main/resources/application.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/src/main/resources/application.xml	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE application PUBLIC
+   "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
+   "http://java.sun.com/dtd/application_1_3.dtd">
+
+<application>
+   <display-name>EJB3 Ear tutorial</display-name>
+
+   <module>
+      <web>
+         <web-uri>jboss-ejb3-tutorial-enterprise_webapp.war</web-uri>
+         <context-root>/tutorial</context-root>
+      </web>
+   </module>
+   <module>
+      <ejb>jboss-ejb3-tutorial-enterprise_ejb3app.jar</ejb>
+   </module>
+</application>


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ear/src/main/resources/application.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/pom.xml	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,38 @@
+<?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-enterprise_app_ejb_injection
+		</artifactId>
+		<version>0.1.0-SNAPSHOT</version>
+		<relativePath>../</relativePath>
+	</parent>
+
+
+
+
+	<artifactId>jboss-ejb3-tutorial-enterprise_ejb3app
+	</artifactId>
+	<version>0.1.0-SNAPSHOT</version>
+	<packaging>jar</packaging>
+	<name>EJB3 application for "enterprise_app" tutorial</name>
+	<url>http://labs.jboss.com/jbossejb3/
+	</url>
+	<description>
+		An sample EJB3 application to be used in "enterprise_app" tutorial
+	</description>
+
+
+
+</project>


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/Calculator.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/Calculator.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/Calculator.java	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,29 @@
+/*
+ * 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.tutorial.enterprise_app_ejb_injection.bean;
+
+public interface Calculator
+{
+   int add(int x, int y);
+
+   int subtract(int x, int y);
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/Calculator.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorBean.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorBean.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorBean.java	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,42 @@
+/*
+ * 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.tutorial.enterprise_app_ejb_injection.bean;
+
+import javax.ejb.Stateless;
+import javax.ejb.Remote;
+import javax.ejb.Local;
+
+ at Stateless(name="calculator")
+ at Remote(CalculatorRemote.class)
+ at Local(CalculatorLocal.class)
+public class CalculatorBean implements CalculatorRemote, CalculatorLocal
+{
+   public int add(int x, int y)
+   {
+      return x + y;
+   }
+
+   public int subtract(int x, int y)
+   {
+      return x - y;
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorBean.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorLocal.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorLocal.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorLocal.java	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,28 @@
+/*
+ * 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.tutorial.enterprise_app_ejb_injection.bean;
+
+
+
+public interface CalculatorLocal extends Calculator
+{
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorLocal.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorRemote.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorRemote.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorRemote.java	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,29 @@
+/*
+ * 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.tutorial.enterprise_app_ejb_injection.bean;
+
+
+
+public interface CalculatorRemote extends Calculator
+{
+
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/ejbapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/bean/CalculatorRemote.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/pom.xml	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,59 @@
+<?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">
+
+  
+
+  <properties>
+		
+	  	<!--  Versions -->
+	    
+	    <version.org.jboss.jbossas_jboss-as-client>5.0.0.GA</version.org.jboss.jbossas_jboss-as-client>
+  	</properties>
+   
+  <!-- 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>../</relativePath>
+  </parent>
+
+  
+
+
+  <artifactId>jboss-ejb3-tutorial-enterprise_app_ejb_injection</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>Injecting EJB in a Servlet</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+    Tutorial showing the injection of EJBs in servlet
+  </description>
+  
+  <modules>
+  	<module>ejbapp</module>
+   	<module>webapp</module>
+	<module>ear</module>
+  </modules>
+ 
+ 	<!-- Dependencies -->
+	<dependencies>
+  		
+      
+      <dependency>
+            <groupId>org.jboss.jbossas</groupId>
+            <artifactId>jboss-as-client</artifactId>
+            <version>${version.org.jboss.jbossas_jboss-as-client}</version>
+            <type>pom</type>
+            <scope>provided</scope>
+        </dependency>
+      
+  	
+	</dependencies>
+  
+
+</project>


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/pom.xml	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,51 @@
+<?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-enterprise_app_ejb_injection
+		</artifactId>
+		<version>0.1.0-SNAPSHOT</version>
+		<relativePath>../</relativePath>
+	</parent>
+
+
+
+
+	<artifactId>jboss-ejb3-tutorial-enterprise_webapp
+	</artifactId>
+	<version>0.1.0-SNAPSHOT</version>
+	<packaging>war</packaging>
+	<name>Web application for "enterprise_app" tutorial</name>
+	<url>http://labs.jboss.com/jbossejb3/
+	</url>
+	<description>
+		An sample web application to be used in "enterprise_app" tutorial
+	</description>
+
+
+
+	<dependencies>
+		<dependency>
+			<groupId>org.jboss.ejb3</groupId>
+			<artifactId>jboss-ejb3-tutorial-enterprise_ejb3app
+			</artifactId>
+			<version>0.1.0-SNAPSHOT</version>
+			<scope>provided</scope>
+
+		</dependency>
+
+
+	</dependencies>
+
+</project>


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/pom.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/servlet/CalculatorActionServlet.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/servlet/CalculatorActionServlet.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/servlet/CalculatorActionServlet.java	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,111 @@
+/*
+ * 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.tutorial.enterprise_app_ejb_injection.servlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.ejb.EJB;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.tutorial.enterprise_app_ejb_injection.bean.CalculatorLocal;
+
+/**
+ * comment
+ *
+ * @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author Jaikiran Pai
+ */
+public class CalculatorActionServlet extends HttpServlet
+{
+
+   private CalculatorLocal calculator;
+
+   /**
+    * Injecting the EJB
+    */
+   @EJB(name = "calculator")
+   public void setCalculator(CalculatorLocal calculator)
+   {
+      this.calculator = calculator;
+   }
+
+   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+   {
+      doit(req, resp);
+   }
+
+   protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+   {
+      doit(req, resp);
+   }
+
+   /**
+    * Use the Calculator bean to perform the operation
+    * 
+    * @param req
+    * @param resp
+    * @throws ServletException
+    * @throws IOException
+    */
+   protected void doit(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+   {
+      int op1;
+      int op2;
+      try {
+         op1 = Integer.parseInt(req.getParameter("op1"));
+         op2 = Integer.parseInt(req.getParameter("op2"));
+      } catch (NumberFormatException nfe)
+      {
+         printMessage(resp, "Only integers are allowed in input");
+         return;
+      }
+      String action = req.getParameter("action");
+
+      System.out.println("Using the injected calculator bean to perform " + action + " on " + op1 + " and " + op2);
+
+      int result = 0;
+      if (action.equals("Add"))
+         result = calculator.add(op1, op2);
+      else if (action.equals("Subtract"))
+         result = calculator.subtract(op1, op2);
+
+      System.out.println("Result returned by Calculator bean = " + result);
+      
+      printMessage(resp, "Answer = " + result);
+      
+   }
+   
+   private void printMessage(HttpServletResponse resp, String msg) throws IOException
+   {
+      resp.setContentType("text/html");
+      PrintWriter writer = resp.getWriter();
+      writer.println("<html>");
+      writer.println("<body>");
+      writer.println("<h1> " + msg + "</h1>");
+      writer.println("</body");
+      writer.println("</html>");
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/java/org/jboss/tutorial/enterprise_app_ejb_injection/servlet/CalculatorActionServlet.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/WEB-INF/web.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/WEB-INF/web.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/WEB-INF/web.xml	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" 
+	xmlns="http://java.sun.com/xml/ns/javaee" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+   <description>EJB3 Injection in Servlet tutorial</description>
+
+   <!-- ### Servlets -->
+   <servlet>
+      <servlet-name>CalculatorActionServlet</servlet-name>
+      <servlet-class>org.jboss.tutorial.enterprise_app_ejb_injection.servlet.CalculatorActionServlet</servlet-class>
+   </servlet>
+
+   <!-- The servlet and jsp page mappings -->
+   <servlet-mapping>
+      <servlet-name>CalculatorActionServlet</servlet-name>
+      <url-pattern>/CalculatorAction</url-pattern>
+   </servlet-mapping>
+
+	<welcome-file-list>
+		<welcome-file>index.html</welcome-file>
+	</welcome-file-list>
+</web-app>


Property changes on: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/WEB-INF/web.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/index.html
===================================================================
--- projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/index.html	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/enterprise_app_ejb_injection/webapp/src/main/webapp/index.html	2009-01-14 11:34:49 UTC (rev 82863)
@@ -0,0 +1,13 @@
+<html>
+	<body>
+		<form action="CalculatorAction" method="post">
+			Operand 1:  <input type="text" name="op1" value="0" size="35">
+			<br/>
+			Operand 2:  <input type="text" name="op2" value="0" size="35">
+			<br/>
+			<input type="submit" name="action" value="Add">
+			<input type="submit" name="action" value="Subtract">
+		</form>
+	</body>
+
+</html>
\ No newline at end of file




More information about the jboss-cvs-commits mailing list