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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Jan 21 02:46:31 EST 2009


Author: jaikiran
Date: 2009-01-21 02:46:31 -0500 (Wed, 21 Jan 2009)
New Revision: 83141

Added:
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/ejb-jar.xml
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/jboss.xml
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/build.xml
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/jndi.properties
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/log4j.xml
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/pom.xml
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOne.java
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneLocal.java
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneManagement.java
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneRemote.java
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThree.java
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThreeManagement.java
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwo.java
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwoManagement.java
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/client/
   projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/client/Client.java
Log:
EJBTHREE-1678 Working version of the @Service configuration with deployment descriptors, tutorial. Needs a patched (through EJB3 plugin) version of JBoss-5.0 GA

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/ejb-jar.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/ejb-jar.xml	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,8 @@
+<?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">
+</ejb-jar>

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/jboss.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/jboss.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/jboss.xml	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<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">
+   <enterprise-beans>
+      <service>
+	     <ejb-name>ServiceOne</ejb-name>
+         <ejb-class>org.jboss.tutorial.service_deployment_descriptor.bean.ServiceOne</ejb-class>
+         <business-local>org.jboss.tutorial.service_deployment_descriptor.bean.ServiceOneLocal</business-local>
+         <business-remote>org.jboss.tutorial.service_deployment_descriptor.bean.ServiceOneRemote</business-remote>
+         <object-name>tutorial:service=serviceOne</object-name>  
+         <management>org.jboss.tutorial.service_deployment_descriptor.bean.ServiceOneManagement</management>
+         <jndi-name>serviceOne/remote</jndi-name>
+         <local-jndi-name>serviceOne/local</local-jndi-name>
+      </service>
+      <service>
+		 <ejb-name>ServiceTwo</ejb-name>
+         <ejb-class>org.jboss.tutorial.service_deployment_descriptor.bean.ServiceTwo</ejb-class>
+         <object-name>tutorial:service=serviceTwo</object-name> 
+         <management>org.jboss.tutorial.service_deployment_descriptor.bean.ServiceTwoManagement</management>
+      </service>
+      <service>
+		 <ejb-name>ServiceThree</ejb-name>
+         <ejb-class>org.jboss.tutorial.service_deployment_descriptor.bean.ServiceThree</ejb-class>
+         <object-name>tutorial:service=serviceThree</object-name> 
+         <management>org.jboss.tutorial.service_deployment_descriptor.bean.ServiceThreeManagement</management>
+      </service>
+   </enterprise-beans>
+</jboss>


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/META-INF/jboss.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/build.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/build.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/build.xml	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,84 @@
+<?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-service_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>
+      <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"/>
+         </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.service_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>
+


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

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/jndi.properties
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/jndi.properties	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/jndi.properties	2009-01-21 07:46:31 UTC (rev 83141)
@@ -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


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/jndi.properties
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/log4j.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/log4j.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/log4j.xml	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!--                                                                       -->
+<!--  Log4j Configuration                                                  -->
+<!--                                                                       -->
+<!-- ===================================================================== -->
+
+<!-- $Id: log4j.xml 36983 2005-10-12 23:12:56Z bdecoste $ -->
+
+<!--
+   | 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>


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

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/pom.xml
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/pom.xml	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/pom.xml	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,40 @@
+<?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.service_deployment_descriptor.client.Client</ejb3.tutorial.client>
+    
+  </properties>
+
+
+  <artifactId>jboss-ejb3-tutorial-service_deployment_descriptor</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+  <name>@Service Bean (JBoss specific) using deployment descriptors</name>
+  <url>http://labs.jboss.com/jbossejb3/</url>
+  <description>
+    Tutorial about configuring JBoss specific @Service beans through deployment descriptors
+  </description>
+  
+  
+  
+ 
+
+
+</project>


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

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOne.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOne.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOne.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,67 @@
+/*
+ * 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.service_deployment_descriptor.bean;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 61136 $
+ */
+public class ServiceOne implements ServiceOneLocal, ServiceOneRemote, ServiceOneManagement
+{
+   int attribute;
+
+   public void setAttribute(int attribute)
+   {
+      this.attribute = attribute;
+   }
+
+   public int getAttribute()
+   {
+      return this.attribute;
+   }
+
+   public String sayHello()
+   {
+      return "Hello from service One";
+   }
+
+   // Lifecycle methods
+   public void create() throws Exception
+   {
+      System.out.println("ServiceOne - Created");
+   }
+
+   public void start() throws Exception
+   {
+      System.out.println("ServiceOne - Started");
+   }
+
+   public void stop()
+   {
+      System.out.println("ServiceOne - Stopped");
+   }
+
+   public void destroy()
+   {
+      System.out.println("ServiceOne - Destroyed");
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOne.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneLocal.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneLocal.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneLocal.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,34 @@
+/*
+ * 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.service_deployment_descriptor.bean;
+
+
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 61136 $
+ */
+public interface ServiceOneLocal
+{
+   public void setAttribute(int attribute);
+   public int getAttribute();
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneLocal.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneManagement.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneManagement.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneManagement.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -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.tutorial.service_deployment_descriptor.bean;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 61136 $
+ */
+public interface ServiceOneManagement
+{
+   void setAttribute(int attribute);
+   int getAttribute();
+   String sayHello();
+
+   void create() throws Exception;
+   void start() throws Exception;
+   void stop();
+   void destroy();
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneManagement.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneRemote.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneRemote.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneRemote.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,34 @@
+/*
+ * 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.service_deployment_descriptor.bean;
+
+
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 61136 $
+ */
+public interface ServiceOneRemote
+{
+   public void setAttribute(int attribute);
+   public int getAttribute();
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceOneRemote.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThree.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThree.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThree.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,83 @@
+/*
+ * 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.service_deployment_descriptor.bean;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import org.jboss.ejb3.annotation.Depends;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 61136 $
+ */
+public class ServiceThree implements ServiceThreeManagement
+{
+   @Depends("tutorial:service=serviceOne")
+   public ObjectName serviceOneName;
+
+   private ServiceTwoManagement service2;
+
+   @Depends("tutorial:service=serviceTwo")
+   public void setServiceTwo(ServiceTwoManagement service2)
+   {
+      this.service2 = service2;
+   }
+
+   public String serviceOneHello() throws Exception
+   {
+      Object[] args = new Object[0];
+      String[] signature = new String[0];
+      System.out.println("ServiceThree - Calling ServiceOne.sayHello() via JMX server");
+      MBeanServer server = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
+      return (String) server.invoke(serviceOneName, "sayHello", args, signature);
+   }
+
+   public String serviceTwoHello()
+   {
+      System.out.println("ServiceThree - Calling ServiceTwo.sayHello() via MBean proxy");
+      return service2.sayHello();
+   }
+
+   // Interceptors
+   @AroundInvoke
+   public Object intercept(InvocationContext ctx) throws Exception
+   {
+      System.out.println("ServiceThree - Interceptor");
+      return ctx.proceed();
+   }
+
+   // Lifecycle methods
+   public void start() throws Exception
+   {
+      System.out.println("ServiceThree - Started");
+   }
+
+   public void stop()
+   {
+      System.out.println("ServiceThree - Stopped");
+   }
+
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThree.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThreeManagement.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThreeManagement.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThreeManagement.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -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.tutorial.service_deployment_descriptor.bean;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 61136 $
+ */
+public interface ServiceThreeManagement
+{
+   String serviceOneHello()throws Exception;
+   String serviceTwoHello();
+
+   void start() throws Exception;
+   void stop();
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceThreeManagement.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwo.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwo.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwo.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,48 @@
+/*
+ * 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.service_deployment_descriptor.bean;
+
+import org.jboss.ejb3.annotation.Depends;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 61136 $
+ */
+ at Depends("tutorial:service=serviceOne")
+public class ServiceTwo implements ServiceTwoManagement
+{
+   public String sayHello()
+   {
+      return "Hello from service Two";
+   }
+
+   // Lifecycle methods
+   public void start() throws Exception
+   {
+      System.out.println("ServiceTwo - Started");
+   }
+
+   public void stop()
+   {
+      System.out.println("ServiceTwo - Stopped");
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwo.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwoManagement.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwoManagement.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwoManagement.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,33 @@
+/*
+ * 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.service_deployment_descriptor.bean;
+
+/**
+ * @author <a href="mailto:kabir.khan at jboss.org">Kabir Khan</a>
+ * @version $Revision: 61136 $
+ */
+public interface ServiceTwoManagement
+{
+   String sayHello();
+   void start() throws Exception;
+   void stop() throws Exception;
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/bean/ServiceTwoManagement.java
___________________________________________________________________
Name: svn:executable
   + *

Added: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/client/Client.java
===================================================================
--- projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/client/Client.java	                        (rev 0)
+++ projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/client/Client.java	2009-01-21 07:46:31 UTC (rev 83141)
@@ -0,0 +1,66 @@
+/*
+ * 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.service_deployment_descriptor.client;
+
+import org.jboss.tutorial.service_deployment_descriptor.bean.ServiceOneRemote;
+import org.jboss.tutorial.service_deployment_descriptor.bean.ServiceOne;
+import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
+
+import javax.naming.InitialContext;
+import javax.management.ObjectName;
+
+
+public class Client
+{
+   public static void main(String[] args) throws Exception
+   {
+      try {
+      InitialContext ctx = new InitialContext();
+      //Get hold of the MBean server invoker
+      RMIAdaptor server = (RMIAdaptor)ctx.lookup("jmx/invoker/RMIAdaptor");
+
+      //Set attribute on singleton ServiceOne via remote interface
+      ServiceOneRemote serviceOne = (ServiceOneRemote) ctx.lookup("serviceOne/remote");
+      serviceOne.setAttribute(100);
+
+      //Create object name for ServiceOne
+      ObjectName service1 = new ObjectName("tutorial:service=serviceOne");
+      //Get attribute of singleton ServiceOne via JMX
+      int attr1 = (Integer)server.getAttribute(service1, "Attribute");
+      System.out.println("attribute value for singleton obtained via JMX is what we set via remote interface: " + attr1);
+
+      //Create object name for ServiceThree
+      ObjectName service3 = new ObjectName("tutorial:service=serviceThree");
+      //Call serviceOneHello() and serviceTwoHello() on ServiceThree
+      Object[] noArgs = new Object[0];//No arguments
+      String[] noSig = new String[0];//No parameters in signature
+
+      String service1Hello = (String)server.invoke(service3, "serviceOneHello", noArgs, noSig);
+      System.out.println(service1Hello);
+      String service2Hello = (String)server.invoke(service3, "serviceTwoHello", noArgs, noSig);
+      System.out.println(service2Hello);
+      } catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+}


Property changes on: projects/ejb3/trunk/docs/tutorial/service_deployment_descriptor/src/org/jboss/tutorial/service_deployment_descriptor/client/Client.java
___________________________________________________________________
Name: svn:executable
   + *




More information about the jboss-cvs-commits mailing list