[jboss-cvs] JBossAS SVN: r83770 - in projects/ejb3/trunk/docs/tutorial: partial_deployment_descriptor and 8 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Feb 2 05:45:41 EST 2009


Author: jaikiran
Date: 2009-02-02 05:45:41 -0500 (Mon, 02 Feb 2009)
New Revision: 83770

Added:
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/ejb-jar.xml
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/jboss.xml
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/build.xml
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/jndi.properties
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/log4j.xml
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/pom.xml
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/roles.properties
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/CompleteXMLDD.java
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/CompleteXMLDDBean.java
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/ExternalCallbackListener.java
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/FirstInterceptor.java
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/PartialXMLDD.java
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/PartialXMLDDBean.java
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/SecondInterceptor.java
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/client/
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/client/Client.java
   projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/users.properties
Log:
EJBTHREE-1710 Tutorial demonstrating the usage of partial deployment descriptors for EJB3 in JBoss

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/ejb-jar.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/ejb-jar.xml	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar
+        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/ejb-jar_3_0.xsd"
+        version="3.0">
+	<description>Partial deployment descriptors for EJB in JBoss</description>
+   	<display-name>Partial deployment descriptors</display-name>
+   	<enterprise-beans>
+      <session>
+         <ejb-name>CompleteXMLDD</ejb-name>
+         <business-remote>org.jboss.tutorial.partial_deployment_descriptor.bean.CompleteXMLDD</business-remote>
+         <ejb-class>org.jboss.tutorial.partial_deployment_descriptor.bean.CompleteXMLDDBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+         <ejb-ref>
+            <ejb-ref-name>ejb/PartialXMLDD</ejb-ref-name>
+            <ejb-ref-type>Session</ejb-ref-type>
+            <mapped-name>PartialXMLDD/remote</mapped-name>
+            <injection-target>
+             	<injection-target-class>org.jboss.tutorial.partial_deployment_descriptor.bean.CompleteXMLDDBean</injection-target-class>
+             	<injection-target-name>partialXMLDDBean</injection-target-name>
+             </injection-target>
+         </ejb-ref>
+         <resource-ref>
+             <res-ref-name>TimerService</res-ref-name>
+             <res-type>javax.ejb.TimerService</res-type>
+             <res-auth>Container</res-auth>
+             <res-sharing-scope>Shareable</res-sharing-scope>
+             <injection-target>
+             	<injection-target-class>org.jboss.tutorial.partial_deployment_descriptor.bean.CompleteXMLDDBean</injection-target-class>
+             	<injection-target-name>timerService</injection-target-name>
+             </injection-target>
+         </resource-ref>
+         <post-construct>
+         	<lifecycle-callback-class>org.jboss.tutorial.partial_deployment_descriptor.bean.ExternalCallbackListener</lifecycle-callback-class>
+         	<lifecycle-callback-method>postConstruct</lifecycle-callback-method>
+         </post-construct>
+         
+         <security-identity>
+            <run-as>
+               <role-name>admin</role-name>
+            </run-as>
+         </security-identity>
+      </session>
+      <session>
+         <ejb-name>PartialXMLDD</ejb-name>
+         <business-remote>org.jboss.tutorial.partial_deployment_descriptor.bean.PartialXMLDD</business-remote>
+         <ejb-class>org.jboss.tutorial.partial_deployment_descriptor.bean.PartialXMLDDBean</ejb-class>
+         <session-type>Stateful</session-type>
+         <init-method>
+         	<create-method>
+         		<method-name>create</method-name>
+         	</create-method>
+         	<bean-method>
+         		<method-name>init</method-name>
+         	</bean-method>
+         </init-method>
+         <remove-method>
+         	<bean-method>
+         		<method-name>remove</method-name>
+         	</bean-method>
+         </remove-method>
+         <transaction-type>Container</transaction-type>
+         
+         <env-entry>
+            <env-entry-name>id</env-entry-name>
+            <env-entry-type>java.lang.String</env-entry-type>
+            <env-entry-value>5678</env-entry-value>
+         </env-entry>
+         <resource-ref>
+            <res-ref-name>DefaultDS</res-ref-name>
+            <res-type>javax.sql.DataSource</res-type>
+            <res-auth>Container</res-auth>
+            <res-sharing-scope>Shareable</res-sharing-scope>
+            <injection-target>
+            	<injection-target-class>org.jboss.tutorial.partial_deployment_descriptor.bean.PartialXMLDDBean</injection-target-class>
+            	<injection-target-name>ds</injection-target-name>
+            </injection-target>
+         </resource-ref>
+      </session>
+   </enterprise-beans>
+   <interceptors>
+   	<interceptor>
+   		<interceptor-class>org.jboss.tutorial.partial_deployment_descriptor.bean.FirstInterceptor</interceptor-class>
+   		<around-invoke>
+   			<method-name>interceptorMethod</method-name>
+   		</around-invoke>
+   	</interceptor>
+   	<interceptor>
+   		<interceptor-class>org.jboss.tutorial.partial_deployment_descriptor.bean.SecondInterceptor</interceptor-class>
+   	</interceptor>
+   </interceptors>
+   <assembly-descriptor>
+   	  <security-role>
+         <role-name>admin</role-name>
+      </security-role>
+      <security-role>
+         <role-name>normal</role-name>
+      </security-role>
+      <method-permission>
+         <role-name>normal</role-name>
+         <method>
+            <ejb-name>CompleteXMLDD</ejb-name>
+            <method-name>sayHello</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <unchecked/>
+         <method>
+            <ejb-name>CompleteXMLDD</ejb-name>
+            <method-name>sayBye</method-name>
+         </method>
+      </method-permission>
+      <method-permission>
+         <role-name>admin</role-name>
+         <method>
+            <ejb-name>PartialXMLDD</ejb-name>
+            <method-name>echoMessage</method-name>
+         </method>
+         <method>
+            <ejb-name>PartialXMLDD</ejb-name>
+            <method-name>changeMessage</method-name>
+         </method>
+      </method-permission>
+      <container-transaction>
+         <method>
+            <ejb-name>CompleteXMLDD</ejb-name>
+            <method-name>greetWithNotSupportedTransaction</method-name>
+         </method>
+         <trans-attribute>NotSupported</trans-attribute>
+      </container-transaction>
+      <container-transaction>
+         <method>
+            <ejb-name>CompleteXMLDD</ejb-name>
+            <method-name>greetWithRequiredTransaction</method-name>
+            <method-params>
+               <method-param>java.lang.String</method-param>
+            </method-params>
+         </method>
+         <trans-attribute>Required</trans-attribute>
+      </container-transaction>
+      <interceptor-binding>
+      	<ejb-name>CompleteXMLDD</ejb-name>
+      	<interceptor-class>org.jboss.tutorial.partial_deployment_descriptor.bean.FirstInterceptor</interceptor-class>
+      	<interceptor-class>org.jboss.tutorial.partial_deployment_descriptor.bean.SecondInterceptor</interceptor-class>
+   	  </interceptor-binding>
+      <exclude-list>
+         <method>
+            <ejb-name>CompleteXMLDD</ejb-name>
+            <method-name>uncallableMethod</method-name>
+         </method>
+      </exclude-list>
+      
+      
+   </assembly-descriptor>
+	
+        
+</ejb-jar>
\ No newline at end of file

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/jboss.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/jboss.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/META-INF/jboss.xml	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jboss
+        xmlns="http://www.jboss.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee
+                            http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
+        version="3.0">
+
+<security-domain>other</security-domain>
+	<enterprise-beans>
+		<session>
+			<ejb-name>PartialXMLDD</ejb-name>
+			<resource-ref>
+				<res-ref-name>DefaultDS</res-ref-name>
+				<mapped-name>java:/DefaultDS</mapped-name>
+			</resource-ref>
+		</session>
+	</enterprise-beans>
+        
+</jboss>        
\ No newline at end of file

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/build.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/build.xml	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,91 @@
+<?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="jboss.home" value="${env.JBOSS_HOME}"/>
+   <property name="jboss.server.config" value="default"/>
+   <property name="build.dir" value="${basedir}/build"/>
+   <property name="build.classes.dir" value="${build.dir}/classes"/>
+   <property name="build.artifact" value="jboss-ejb3-tutorial-partial_deployment_descriptor.jar"/>
+
+   <!-- 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>
+	<!-- javax.persistence.* -->
+		<fileset dir="${jboss.home}/common/lib">
+	   			<include name="ejb3-persistence.jar"/>
+	   	</fileset>
+   	
+      <pathelement location="${build.classes.dir}"/>
+   </path>
+
+   <property name="build.classpath" refid="classpath"/>
+
+   <!-- =================================================================== -->
+   <!-- 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="classpath"/>
+      </javac>
+   </target>
+
+   <target name="ejbjar" depends="compile">
+      <jar jarfile="build/${build.artifact}">
+         <fileset dir="${build.classes.dir}">
+            <include name="**/*.class"/>
+         </fileset>
+         <fileset dir=".">
+            <include name="META-INF/*.xml"/>
+         	<include name="roles.properties"/>
+         	<include name="users.properties"/>
+         </fileset>
+      </jar>
+      <copy file="build/${build.artifact}" todir="${jboss.home}/server/${jboss.server.config}/deploy"/>
+   </target>
+
+   <target name="run" depends="ejbjar">
+      <java classname="org.jboss.tutorial.partial_deployment_descriptor.client.Client" fork="yes" dir=".">
+         <classpath refid="classpath"/>
+      </java>
+   </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="${build.dir}"/>
+      <delete file="${jboss.home}/server/${jboss.server.config}/deploy/${build.artifact}"/>
+   </target>
+
+
+</project>
+

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/jndi.properties
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/jndi.properties	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=localhost

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/log4j.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/log4j.xml	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 82558 2008-12-29 10:19:41Z jaikiran $ -->
+
+<!--
+   | For more configuration infromation and examples see the Jakarta Log4j
+   | owebsite: http://jakarta.apache.org/log4j
+ -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+   
+<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/>
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Messagen -->
+         <!--
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+         -->
+         <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L)  -%m%n"/>
+      </layout>
+</appender>
+
+   <root>
+      <appender-ref ref="CONSOLE"/>
+   </root>
+
+</log4j:configuration>

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/pom.xml	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,37 @@
+<?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-common</artifactId>
+    <version>0.1.0-SNAPSHOT</version>
+    <relativePath>../common/</relativePath>
+  </parent>
+
+  <properties>
+    <ejb3.tutorial.client>org.jboss.tutorial.partial_deployment_descriptor.client.Client</ejb3.tutorial.client>
+    
+  </properties>
+
+
+  <artifactId>jboss-ejb3-tutorial-partial_deployment_descriptor</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>Partial deployment descriptor usage to define a EJB</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+Usage of partial deployment descriptors
+  </description>
+  
+ 
+  	
+</project>


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

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/roles.properties
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/roles.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/roles.properties	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,2 @@
+jai=normal
+bill=normal,admin

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/CompleteXMLDD.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/CompleteXMLDD.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/CompleteXMLDD.java	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.partial_deployment_descriptor.bean;
+
+/**
+ * CompleteXMLDD
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface CompleteXMLDD
+{
+   /**
+    * Say hello
+    */
+   String sayHello(String name);
+   
+   /**
+    * Say bye
+    * @param name
+    * @return
+    */
+   String sayBye(String name);
+   
+   /**
+    * Welcome the user
+    * @param name
+    * @return
+    */
+   String greetWithNotSupportedTransaction(String name);
+   
+   /**
+    * Welcome the user
+    * @param name
+    * @return
+    */
+   String greetWithRequiredTransaction(String name);
+   
+   /**
+    * No one can call this method
+    */
+   void uncallableMethod();
+}

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/CompleteXMLDDBean.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/CompleteXMLDDBean.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/CompleteXMLDDBean.java	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.partial_deployment_descriptor.bean;
+
+import javax.ejb.TimerService;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+
+import org.jboss.logging.Logger;
+
+/**
+ * CompleteXMLDDBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class CompleteXMLDDBean implements CompleteXMLDD
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(CompleteXMLDDBean.class);
+
+   private PartialXMLDD partialXMLDDBean;
+
+   private TimerService timerService;
+
+   /**
+    * @see CompleteXMLDD#greetWithNotSupportedTransaction(String)
+    * 
+    * Note : The transaction attribute of this method is overriden
+    * through xml file
+    */
+   @TransactionAttribute (TransactionAttributeType.REQUIRES_NEW)
+   public String greetWithNotSupportedTransaction(String name)
+   {
+      String message = "Welcome " + name + ", you are in a method with no transaction supported";
+      logger.info(message);
+      return message;
+   }
+
+   /**
+    * @see CompleteXMLDD#greetWithRequiredTransaction(String)
+    */
+   public String greetWithRequiredTransaction(String name)
+   {
+      String message = "Welcome " + name + ", you are in a method with a REQUIRED transaction";
+      logger.info(message);
+      return message;
+   }
+
+   /**
+    * @see CompleteXMLDD#sayBye(String)
+    */
+   public String sayBye(String name)
+   {
+      String message = "Bye, " + name + ". Hope to see you again";
+      logger.info(message);
+      return message;
+   }
+
+   /**
+    * @see CompleteXMLDD#sayHello(String)
+    */
+   public String sayHello(String name)
+   {
+      String message = "Hello, " + name + ". I am the " + this.getClass().getSimpleName()
+            + ". I have the following resources with me:\n" + "Timer Service : " + this.timerService + "\n"
+            + "PartialXMLDD Bean : " + this.partialXMLDDBean + "\n";
+
+      logger.info(message);
+      return message;
+   }
+
+   /**
+    * @see CompleteXMLDD#uncallableMethod()
+    */
+   public void uncallableMethod()
+   {
+      logger.info("Why is it that no one can call me?");
+   }
+
+}

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/ExternalCallbackListener.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/ExternalCallbackListener.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/ExternalCallbackListener.java	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.partial_deployment_descriptor.bean;
+
+import javax.interceptor.InvocationContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * ExternalCallbackListener
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class ExternalCallbackListener
+{
+
+   /**
+    * Logger
+    */
+   private Logger logger = Logger.getLogger(ExternalCallbackListener.class);
+   
+   public Object postConstruct(InvocationContext invocationContext) throws Exception
+   {
+      logger.info("Post-construct invoked for bean " + invocationContext.getTarget());
+      return invocationContext.proceed();
+   }
+}

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/FirstInterceptor.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/FirstInterceptor.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/FirstInterceptor.java	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.partial_deployment_descriptor.bean;
+
+import javax.interceptor.InvocationContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * FirstInterceptor
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class FirstInterceptor
+{
+
+   private static Logger logger = Logger.getLogger(FirstInterceptor.class);
+   
+   public Object interceptorMethod(InvocationContext context) throws Exception
+   {
+      logger.info(this.getClass().getSimpleName() + " intercepted " + context.getTarget() + "'s " + context.getMethod());
+      return context.proceed();
+   }
+}

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/PartialXMLDD.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/PartialXMLDD.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/PartialXMLDD.java	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.partial_deployment_descriptor.bean;
+
+/**
+ * PartialXMLDD
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public interface PartialXMLDD
+{
+   /**
+    * Echo message
+    * @param message
+    * @return
+    */
+   String echoMessage(String message);
+   
+   /**
+    * Change the message
+    * @param message
+    * @return
+    */
+   String changeMessage(String message);
+   
+   /**
+    * Remove the bean
+    */
+   public void remove();
+}

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/PartialXMLDDBean.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/PartialXMLDDBean.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/PartialXMLDDBean.java	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.partial_deployment_descriptor.bean;
+
+import javax.annotation.security.DenyAll;
+import javax.ejb.Stateful;
+import javax.interceptor.Interceptors;
+import javax.sql.DataSource;
+
+import org.jboss.logging.Logger;
+
+/**
+ * PartialXMLDDBean
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateful
+ at Interceptors ({FirstInterceptor.class,SecondInterceptor.class})
+public class PartialXMLDDBean implements PartialXMLDD
+{
+
+   /**
+    * Logger
+    */
+   private static Logger logger = Logger.getLogger(PartialXMLDDBean.class);
+   
+   private String id;
+   
+   private DataSource ds;
+   
+   public void create()
+   {
+      logger.info(this.getClass().getSimpleName() + " is created. Id is = " + this.id);
+   }
+   
+   public void init()
+   {
+      logger.info(this.getClass().getSimpleName() + " is inited");
+   }
+   
+   public void remove()
+   {
+      logger.info(this.getClass().getSimpleName() + " is removed");
+   }
+   
+   public String changeMessage(String message)
+   {
+      return "This message has been changed";
+      
+   }
+
+
+   public String echoMessage(String message)
+   {
+      logger.info(message);
+      return message;
+   }
+
+}

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/SecondInterceptor.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/SecondInterceptor.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/bean/SecondInterceptor.java	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.partial_deployment_descriptor.bean;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * SecondInterceptor
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SecondInterceptor
+{
+
+   private static Logger logger = Logger.getLogger(FirstInterceptor.class);
+   
+   @AroundInvoke
+   public Object someMethod(InvocationContext context) throws Exception
+   {
+      logger.info(this.getClass().getSimpleName() + " intercepted " + context.getTarget() + "'s " + context.getMethod());
+      return context.proceed();
+   }
+
+}

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/client/Client.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/client/Client.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/src/org/jboss/tutorial/partial_deployment_descriptor/client/Client.java	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.partial_deployment_descriptor.client;
+
+import javax.ejb.EJBAccessException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.jboss.security.client.SecurityClient;
+import org.jboss.security.client.SecurityClientFactory;
+import org.jboss.tutorial.partial_deployment_descriptor.bean.CompleteXMLDD;
+import org.jboss.tutorial.partial_deployment_descriptor.bean.PartialXMLDD;
+
+/**
+ * Client
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class Client
+{
+   public static void main(String args[]) throws Exception
+   {
+      Context ctx = new InitialContext();
+      CompleteXMLDD completeXMLDDBean = (CompleteXMLDD) ctx.lookup("CompleteXMLDD/remote");
+      SecurityClient securityClient = SecurityClientFactory.getSecurityClient();
+      securityClient.setSimple("jai", "jai123");
+      securityClient.login();
+      
+      System.out.println("jai is a normal user");
+      // call sayHello
+      System.out.println(completeXMLDDBean.sayHello("jai"));
+
+      // call greet methods
+      System.out.println(completeXMLDDBean.greetWithNotSupportedTransaction("jai"));
+      System.out.println(completeXMLDDBean.greetWithRequiredTransaction("jai"));
+
+      // bye
+      System.out.println(completeXMLDDBean.sayBye("jai"));
+
+      // let's try the uncallable method
+      System.out.println("We'll try calling an uncallable method");
+      try
+      {
+         completeXMLDDBean.uncallableMethod();
+         throw new RuntimeException("Bean method in <excluded-list> was allowed to be invoked");
+      }
+      catch (EJBAccessException e)
+      {
+         System.out.println("Caught expected exception : " + e.getMessage());
+      }
+      securityClient.logout();
+      
+      // let's login with other user
+      securityClient.setSimple("bill", "bill123");
+      securityClient.login();
+      System.out.println("bill is an admin");
+      // Now work on the other bean
+      PartialXMLDD partialXMLDDBean = (PartialXMLDD) ctx.lookup("PartialXMLDD/remote");
+      System.out.println("Sending Hello World message to bean. We expect the bean to change it");
+      System.out.println(partialXMLDDBean.changeMessage("Hello world"));
+
+      System.out.println("Now calling echo message");
+      System.out.println(partialXMLDDBean.echoMessage("Hello World"));
+
+      //let's remove the bean
+      System.out.println("We are done with the bean, let's remove it");
+      partialXMLDDBean.remove();
+      System.out.println("Bean removed");
+
+   }
+}

Added: projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/users.properties
===================================================================
--- projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/users.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/partial_deployment_descriptor/users.properties	2009-02-02 10:45:41 UTC (rev 83770)
@@ -0,0 +1,2 @@
+jai=jai123
+bill=bill123
\ No newline at end of file




More information about the jboss-cvs-commits mailing list