You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2002/12/23 11:08:10 UTC

cvs commit: jakarta-ojb/xdocs deployment.xml

arminw      2002/12/23 02:08:10

  Modified:    .        build.xml build.properties build-xdoclet.xml
               xdocs    deployment.xml
  Log:
  update jboss deployment stuff
  
  Revision  Changes    Path
  1.60      +17 -2     jakarta-ojb/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/build.xml,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- build.xml	20 Dec 2002 21:08:18 -0000	1.59
  +++ build.xml	23 Dec 2002 10:08:10 -0000	1.60
  @@ -80,12 +80,12 @@
       </target>
   
       <target name="set-archive-name-date" if="useDate">
  -    	<property name="archive" value="${project-name}-${version}-${DSTAMP}"/>
  +    	<property name="archive" value="${ojb-filename-prefix}-${DSTAMP}"/>
   	</target>
   
   
       <target name="set-archive-name" unless="useDate">
  -    	<property name="archive" value="${project-name}-${version}"/>
  +    	<property name="archive" value="${ojb-filename-prefix}"/>
   	</target>
   
       <!-- ================================================================== -->
  @@ -973,4 +973,19 @@
   		<equals arg1="${profile}" arg2="mssqldb-JNet"/>
   	</condition>
   	</target>
  +
  +
  +    <!-- ================================================================== -->
  +    <!-- Generate the sample session bean ejb-app jar                       -->
  +    <!-- ================================================================== -->
  +    <target name="ejb-examples"
  +            description="Generate the sample session bean ejb-app jar">
  +        <ant dir="."
  +             antfile="${basedir}/build-xdoclet.xml"
  +             target="jar-beans"/>
  +        <ant dir="."
  +             antfile="${basedir}/build-xdoclet.xml"
  +             target="jar-client"/>
  +    </target>
  +
   </project>
  
  
  
  1.25      +2 -1      jakarta-ojb/build.properties
  
  Index: build.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/build.properties,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- build.properties	18 Nov 2002 23:41:36 -0000	1.24
  +++ build.properties	23 Dec 2002 10:08:10 -0000	1.25
  @@ -79,6 +79,7 @@
   build=8
   version=${major}.${minor}.${build}
   versiondate=2002-11-04
  +ojb-filename-prefix=${project-name}-${version}
   
   
   #
  @@ -96,7 +97,7 @@
   # set this flag to +JDBC30 to turn on JDK1.4 compatibilty
   #JDBC=-JDBC30
   #
  -# currently maven cannot detect the JDK automatically, 
  +# currently maven cannot detect the JDK automatically,
   # so we need the following hints:
   ojbOnSwitches=JDK13 JDBC30
   ojbOffSwitches=
  
  
  
  1.6       +82 -30    jakarta-ojb/build-xdoclet.xml
  
  Index: build-xdoclet.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/build-xdoclet.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- build-xdoclet.xml	9 Oct 2002 15:08:44 -0000	1.5
  +++ build-xdoclet.xml	23 Dec 2002 10:08:10 -0000	1.6
  @@ -1,17 +1,24 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <!-- OJB ant build script for xdoclet use -->
  -<project name="OJB XDoclet" default="jar_beans" basedir=".">
  +<project name="OJB XDoclet" default="jar-beans" basedir=".">
   
       <!-- Allow any user specific values to override the defaults -->
       <property file="build.properties"/>
       <property file="${user.home}/build.properties" />
   
       <property name="java.src.dir" value="${src.dir}/ejb"/>
  -    <property name="generated.src.dir" value="${build.dir}/srcejb"/>
  +    <property name="generated.src.dir" value="${build.dir}/srcejb/generated"/>
  +    <property name="beans.src.dir" value="${build.dir}/srcejb/beans"/>
  +    <property name="client.src.dir" value="${build.dir}/srcejb/client"/>
       <property name="generated.descriptor.dir" value="${build.dir}/srcejb"/>
  -    <property name="generated.ejb.classes.dir" value="${build.dir}/classesejb"/>
  -    <property name="jar.name" value="ojb-beans"/>
  -    <property name="jar.dir" value="${build.dir}/srcejb"/>
  +    <property name="generated.ejb.classes.dir" value="${build.dir}/classesejb/bean"/>
  +    <property name="generated.ejb.classes.dir.client" value="${build.dir}/classesejb/client"/>
  +    <property name="jar.name.beans" value="${ojb-filename-prefix}-beans.jar"/>
  +    <property name="jar.name.client" value="${ojb-filename-prefix}-client.jar"/>
  +    <property name="jar.name.ejb.app" value="${ojb-filename-prefix}-ejb-app.jar"/>
  +    <property name="jar.name.junit" value="${ojb-filename-prefix}-junit.jar"/>
  +    <property name="jar.name.app" value="${ojb-filename-prefix}.jar"/>
  +    <property name="jar.dir" value="${dist}"/>
   
       <path id="ojb.classpath">
           <pathelement path="${build.dest}"/>
  @@ -22,10 +29,17 @@
           </fileset>
       </path>
   
  +    <target name="classes-exist">
  +        <available file="${build.dest}/org" property="build.classes.exist"/>
  +    </target>
  +    <target name="check" unless="build.classes.exist" depends="classes-exist">
  +        <fail message="Run target 'main-opt' before run current target"/>
  +    </target>
  +
       <!-- =================================================================== -->
   	<!-- run xdoclet                                                         -->
   	<!-- =================================================================== -->
  -	<target name="xdoclet" depends="">
  +	<target name="xdoclet" depends="check">
   		<taskdef
   				name="ejbdoclet"
   				classname="xdoclet.ejb.EjbDocletTask">
  @@ -60,17 +74,6 @@
   					typemapping="Hypersonic SQL"
   					datasource="java:/DefaultDS"
   					destdir="${generated.descriptor.dir}"/>
  -			<!-- weblogic xmlencoding="UTF-8" destdir="${build.dir}/ejb/META-INF" validatexml="true"/ -->
  -			<!--
  -			<webSphere destdir="${build.dir}/ejb/META-INF" />
  -			<orion/>
  -			-->
  -			<!-- apachesoap destdir="${build.dir}/web" / -->
  -			<!--
  -			Have struts form objects generated based on entity beans'
  -			data objects.  Will require struts.jar to compile.
  -			<strutsform />
  -			-->
   		</ejbdoclet>
   	</target>
   
  @@ -83,7 +86,7 @@
   		<mkdir dir="${generated.ejb.classes.dir}"/>
   		<mkdir dir="${generated.ejb.classes.dir}/META-INF"/>
   
  -        <copy  todir="${generated.src.dir}">
  +        <copy  todir="${beans.src.dir}">
   			<fileset dir="${java.src.dir}">
   				<include name="**/*Bean.java" />
                   <include name="**/*BeanImpl.java" />
  @@ -91,7 +94,7 @@
   			</fileset>
   		</copy>
   
  -		<javac srcdir="${generated.src.dir}"
  +		<javac srcdir="${generated.src.dir}; ${beans.src.dir}"
   			destdir="${generated.ejb.classes.dir}"
   			debug="${debug}"
   			optimize="${optimize}"
  @@ -99,30 +102,79 @@
   			<classpath refid="ojb.classpath"/>
   		</javac>
   
  -		<copy  todir="${generated.ejb.classes.dir}/META-INF">
  +		<!-- copy  todir="${generated.ejb.classes.dir}/META-INF">
   			<fileset dir="${generated.descriptor.dir}" includes="**/*.xml"/>
  -            <!-- fileset dir="${generated.base.dir}">
  -                <include name="**/*.xml" />
  -                <include name="**/*.properties" />
  -            </fileset -->
  -		</copy>
  +		</copy -->
   
  -        <delete>
  +        <!-- delete>
               <fileset dir="${generated.src.dir}">
                   <include name="**/*Bean.java" />
                   <include name="**/*BO.java" />
                   <include name="**/*BeanImpl.java" />
               </fileset>
  -		</delete>
  +		</delete -->
   	</target>
   
   
   	<!-- =================================================================== -->
   	<!-- Build deployable jar of the generated files                         -->
   	<!-- =================================================================== -->
  -	<target name="jar_beans" depends="compile_beans">
  -		<jar jarfile="${jar.dir}/${jar.name}.jar"
  -			 basedir="${generated.ejb.classes.dir}" />
  +    <target name="jar-beans" depends="compile_beans">
  +        <jar jarfile="${jar.dir}/${jar.name.beans}"
  +            basedir="${generated.ejb.classes.dir}" >
  +            <metainf dir="${generated.descriptor.dir}">
  +                <include name="**/*.xml" />
  +            </metainf>
  +            <manifest>
  +                <attribute name="classpath" value="${jar.name.junit}"/>
  +            </manifest>
  +            <fileset dir="${jar.dir}"
  +                includes="${jar.name.junit}"
  +            />
  +        </jar>
  +    </target>
  +
  +    <!-- =================================================================== -->
  +	<!-- Build the client jar                                                -->
  +	<!-- =================================================================== -->
  +    <target name="jar-client" depends="check"
  +            description="Build the client jar">
  +        <copy  todir="${client.src.dir}">
  +			<fileset dir="${java.src.dir}"
  +                excludes="**/*Bean.class,
  +			 		   **/*BO.class,
  +			 		   **/*BeanImpl.class,
  +			 		   **/*.xml,
  +			 		   **/*.properties">
  +			</fileset>
  +		</copy>
  +
  +        <javac srcdir="${client.src.dir}; ${generated.src.dir}"
  +			destdir="${generated.ejb.classes.dir}"
  +			debug="${debug}"
  +			optimize="${optimize}"
  +			deprecation="${deprecation}">
  +			<classpath refid="ojb.classpath"/>
  +		</javac>
  +
  +        <jar jarfile="${jar.dir}/${jar.name.client}"
  +			 basedir="${generated.ejb.classes.dir}"
  +			 excludes="**/*Bean.class,
  +			 		   **/*BO.class,
  +			 		   **/*BeanImpl.class,
  +			 		   **/*.xml,
  +			 		   **/*.properties">
  +        </jar>
  +
  +    </target>
  +
  +
  +    <!-- =================================================================== -->
  +	<!-- Start the OJB sample session beans                                  -->
  +	<!-- =================================================================== -->
  +	<target name="start-client"
  +            description="Start the OJB client sample tests">
  +
   	</target>
   
   </project>
  
  
  
  1.7       +138 -53   jakarta-ojb/xdocs/deployment.xml
  
  Index: deployment.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/xdocs/deployment.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- deployment.xml	4 Oct 2002 07:08:19 -0000	1.6
  +++ deployment.xml	23 Dec 2002 10:08:10 -0000	1.7
  @@ -3,32 +3,65 @@
   
     <properties>
       <author email="thma@apache.org">Thomas Mahler</author>
  +    <author>Armin Waibel</author>
       <title>OJB deployment</title>
     </properties>
   
   <body>
  +<section name="Deployment">
  +<p>
  +
  +<ul>
  +    <li>
  +        <a href="#1">Things needed for deploying OJB</a>
  +        <ul>
  +            <li><a href="#2">The OJB binary jar archive</a></li>
  +            <li><a href="#3">Configuration data</a></li>
  +            <li><a href="#4">Additional jar archives</a></li>
  +            <li><a href="#5">Don't forget the JDBC driver</a></li>
  +        </ul>
  +    </li>
  +
  +    <li>
  +        <a href="#10">Deployment in standalone applications</a>
  +    </li>
  +    <li>
  +        <a href="#20">Deployment in servlet based applications</a>
  +    </li>
  +    <li>
  +        <a href="#30">Deployment in EJB based applications</a>
  +        <ul>
  +            <li><a href="#31">Instructions for JBoss</a></li>
  +            <li><a href="#32">Build the OJB sample session beans</a></li>
  +        </ul>
  +    </li>
  +</ul>
  +</p>
  +</section>
   
  -<section name="things needed for deploying OJB">
  +<section name="Things needed for deploying OJB" anchor="1">
   <p>
  -	This section enumerates all things needed to deploy OJB. 
  +	This section enumerates all things needed to deploy OJB.
   </p>
   
  -<subsection name="1.the ojb binary jar archive">
  +
  +
  +<subsection name="1. The OJB binary jar archive" anchor="2">
   <P>
   	You need a <code>jakarta-ojb-&lt;version&gt;.jar</code> file containing the compiled OJB library.
   	<br/>This jar files contains all OJB code neccessary in
   	production level environments. It does not contain any test code. It
   	also does not contain any configuration data.
  -	
  +
   	You'll find this file in the lib directory of the binary distribution.
  -	
  -	If you are working with the source distribution you can assemble the binary jar archive 
  +
  +	If you are working with the source distribution you can assemble the binary jar archive
   	By calling <B><code>build[.sh]
   	jar </code></B>. This ant task generates the binary jar to the dist directory.
   
   </P>
   </subsection>
  -<subsection name="2. configuration data">
  +<subsection name="2. Configuration data" anchor="3">
   <P>OJB needs two kinds of configuration data:</P>
   <OL>
     <LI>configuration of the OJB runtime environment. This data is
  @@ -47,7 +80,7 @@
   	lookup and must therefore be placed on the classpath.</b>
   </P>
   </subsection>
  -<subsection name="3. additional jar archives">
  +<subsection name="3. Additional jar archives" anchor="4">
   <P>
   	OJB depends on several other jar archives. These jar files are
   	shipped in the <code>jakarta-ojb-&lt;version&gt;/lib</code> directory.
  @@ -92,7 +125,7 @@
   
   </subsection>
   
  -<subsection name="4. don't forget the JDBC driver">
  +<subsection name="4. Don't forget the JDBC driver" anchor="1">
   <P>
   	The repository.xml defines JDBC Connections
   	to your runtime databases. To use the declared JDBC drivers the
  @@ -101,14 +134,17 @@
   </P>
   </subsection>
   
  -<p>	
  +<p>
   	In the following sections I will describe how to deploy these items
   	for specific runtime environments.
   </p>
   
   </section>
   
  -<section name="deployment in standalone applications">
  +
  +
  +
  +<section name="Deployment in standalone applications" anchor="10">
   <P>
   Deploying OJB for standalone applications is most simple. If you
   follow these four steps your application will be up in a few minutes.
  @@ -132,11 +168,14 @@
   </OL>
   </section>
   
  -<section name="deployment in servlet based applications">
  +
  +
  +
  +<section name="Deployment in servlet based applications" anchor="20">
   <P>
   	Generally speaking the four steps described in the previous
   	section have to be followed also in Servlet / JSP based environments.
  -	
  +
   	The exact details may differ for your specific Servlet container, but
   	the general concepts should be quite similar.
   </P>
  @@ -156,8 +195,8 @@
   	    servlet applications WAR file.<br/>The WAR format specifies that
   	    Servlet classes are to be placed in a directory <code>WEB-INF/classes</code>.
   	    The OJB configuration files have to be in this directory.
  -	    
  -    </LI>  
  +
  +    </LI>
       <LI>
   	    Add the additional runtime
   	    jar archives to <code>WEB-INF/lib</code> too.
  @@ -181,64 +220,110 @@
   
   </section>
   
  -<section name="deployment in EJB based applications">
  +
  +
  +
  +<section name="Deployment in EJB based applications" anchor="30">
   
   <p>
  -	The above mentioned guidelines concerning
  -	jar files and placing of the OJB.properties and the repository.xml 
  -	are valid for EJB environments as well.<br/>
  -	But apart from these basic steps you'll have to perform some additional
  -	configurations to integrate OJB into the container mechanisms.
  +The above mentioned guidelines concerning
  +jar files and placing of the OJB.properties and the repository.xml
  +are valid for EJB environments as well.
  +But apart from these basic steps you'll have to perform some additional
  +configurations to integrate OJB into the container mechanisms.
  +</p>
  +<p>
  +The instructions to make OJB running within your Application Server
  +should be similar for all server. So the following instructions for JBoss
  +should be useful for all users.
   </p>
   
  -<subsection name="Instructions for JBoss">
  +<subsection name="Instructions for JBoss" anchor="31">
   
  -	<p>
  -	<b>1. Add the following MBean declaration:</b>
  +<p>
  +<b>1. Add the following MBean declaration to the user-service.xml:</b>
   <source><![CDATA[
  -<mbean code="org.jboss.ojb.odmg.ODMGFactory" 
  -       name="DefaultDomain:service=ODMG,name=ojb/defaultODMG">
  -  <attribute name="JndiName">ojb/defaultODMG</attribute>
  +<mbean code="org.jboss.ojb.pb.PBFactory"
  +        name="DefaultDomain:service=PBAPI,name=ojb/PBAPI">
  +    <attribute name="JndiName">ojb/PBAPI</attribute>
   </mbean>
  -<mbean code="org.jboss.ojb.pb.PBFactory" 
  -       name="DefaultDomain:service=PB,name=ojb/PBAPI">
  -  <attribute name="JndiName">ojb/PBAPI</attribute>
  +
  +<mbean code="org.jboss.ojb.odmg.ODMGFactory"
  +        name="DefaultDomain:service=ODMG,name=ojb/defaultODMG">
  +    <attribute name="JndiName">ojb/defaultODMG</attribute>
   </mbean>
   ]]></source>
  +This entries make OJB accessible via JNDI.
  +</p>
  +
  +<p>
  +<b>2. Make sure your OJB Properties files has the following settings:</b>
   
  -	 </p>
  -	<p>
  -	<b>2. Make sure your OJB Properties files has the following settings:</b>
  -	
   <source><![CDATA[
  -ConnectionFactoryClass=org.apache.ojb.broker.accesslayer.ConnectionFactoryPassThroughImpl
  +ConnectionFactoryClass=
  +org.apache.ojb.broker.accesslayer.ConnectionFactoryManagedImpl
   useAutoCommit=0
  -ignoreAutoCommitExceptions=true
   OJBTxManagerClass=org.apache.ojb.odmg.JTATxManager
  -JTATransactionManagerClass=org.apache.ojb.otm.transaction.factory.JBossTransactionManagerFactory
  -]]></source>	
  -	</p>
  -	
  -	<p>
  -	<b>3. inside your EJB's you can get a handle on the ODMG like this:</b>
  +JTATransactionManagerClass=
  +org.apache.ojb.otm.transaction.factory.JBossTransactionManagerFactory
  +]]></source>
  +</p>
  +
  +<p>
  +<b>3a. Inside your EJB's you can get a handle on the ODMG like this:</b>
   <source><![CDATA[
  -ODMGFactory factory = (ODMGFactory) context.lookup("java:/ojb/defaultODMG");
  +ODMGFactory factory =
  +(ODMGFactory) context.lookup("java:/ojb/defaultODMG");
   odmg = factory.getInstance();
   ]]></source>
  -	</p>
  -	
  -	<p>
  -	<b>4. inside your EJB's you can get a handle on the PB like this:</b>
  +</p>
  +
  +<p>
  +<b>3b. Inside your EJB's you can get a handle on the PB like this:</b>
   <source><![CDATA[
   context = new InitialContext();
  -pbf = ((PBFactoryIF) context.lookup(PBFactoryIF.PBFACTORY_JNDI_NAME)).getInstance();
  +pbf = ((PBFactoryIF) context.lookup(
  +    PBFactoryIF.PBFACTORY_JNDI_NAME)).getInstance();
   ]]></source>
  -	</p>
  -	<p>	
  -	Check out the ejb's provided in the OJB distro at: <code>/src/ejb/org/apache/ojb/ejb</code>
  -	for an example of working beans.
  -	</p>
  +</p>
   
  +<p>
  +Check out the ejb's provided in the OJB distro at: <code>[jakarta-ojb]/src/ejb/org/apache/ojb/ejb</code>
  +for an example of working beans.
  +</p>
  +
  +</subsection>
  +
  +<subsection name="Build the OJB sample session beans" anchor="32">
  +<p>
  +The OJB source distribution was shipped with a bunch of sample
  +beans. We are using xdoclet to build the necessary classes and deployment
  +descriptors.
  +<br/>
  +You could find the source code of the beans under
  +<code>[jakarta-ojb]/src/ejb/org/apache/ojb/ejb</code> or after
  +running the <code>ejb-examples</code> ant target you will find
  +under <code>[jakarta-ojb/]target/srcejb</code> in three sub-dirs
  +all source code of all examples including the generated files by xdoclet.
  +<br/>
  +Run the following ant target
  +<source><![CDATA[
  +bin/build.sh ejb-example
  +or
  +bin\build.bat ejb-example
  +]]></source>
  +to generate the the bean and client jars prepared for use in JBoss. If you using
  +a different application server, you have to modifiy the xdoclet ant target in
  +<code>[jakarta-ojb]/build-xdoclet.xml</code> to generate files specified for your
  +application server. See xdoclet documentation for further information.
  +</p>
  +<p>
  +After running the ant target you will find a <code>jakarta-ojb-XXX-beans.jar</code>
  +and a <code>jakarta-ojb-XXX-client.jar</code> in the [jakarta-ojb]/dist directory.
  +Put the bean jar in JBoss /deploy dir and the OJB application jar in /lib. This
  +solution is not re-deployable. If someone find a solution that makes the sample
  +beans re-deployable in jboss, please let me know.
  +</p>
   </subsection>
   
   </section>