Commit 10c91542 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

9780596007348

0 → 120000
+1 −0
Changes for 9780596007348: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
9780596007348
 No newline at end of file

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
  
# JBoss at Work: A Practical Guide, by Tom Marrs
  
[![JBoss at Work: A Practical Guide, by Tom Marrs](http://akamaicovers.oreilly.com/images/9780596007348/cat.gif)](https://www.safaribooksonline.com/library/view/title/0596007345//)
  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.
+28 −0
Changes for jbossatwork-1.0.2/HISTORY.txt: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
=============================================
Change History for the JBoss At Work example
=============================================

--------------------------
Version 1.0.2, 2006-01-19
--------------------------
Added "colddeploy" target to top-level build script for chapters 3-5.
ch03c-webdoclet now builds web.xml with Servlet Spec 2.4
ch09 - Fixed security holes. Generating HBM files for Hibernate 3.0 (was using 2.1).
ch06-10 and appb - "colddeploy" target now depends on "deploy" target, which depends on "all" target.
ch06-10 and appb - application.xml now uses <ejb> element for EJB JAR (was using <java>).
ch06-10 and appb - Turned off Hibernate SQL logging in hibernate-service.xml.
Upgraded README.TXT

--------------------------
Version 1.0.1, 2005-11-02
--------------------------
Removed hard-coded references to /Library/xdoclet, 
  /Library/jboss, etc.

Replaced with ${env.XDOCLET_HOME}, ${env.JBOSS_HOME}

------------------------
Version 1.0, 2005-10-01
------------------------
Initial release.
+73 −0
Changes for jbossatwork-1.0.2/README.txt: 73 added lines, 0 removed lines.
Original line number Diff line number Diff line
This sample code is courtesy of the book JBoss At Work (O'Reilly).
For more information, see http://www.jbossatwork.com.

There are 10 chapters in the book. Source code for each chapter
can be found in the corresponding directory.

The examples demonstrate the following technology:
- A simple MVC (Model/View/Controller) web application using JSPs and Servlets.
- Database connectivity using a DAO (Data Access Object)
- Hibernate (an Object/Relational Mapper)
- Hypersonic (an embedded Java-based Relational Database)
- Stateless Session Beans
- JMS (Java Message Service) and MDB (Message-driven Beans)
- JavaMail
- Logins using JAAS (Java Authentication and Authorization Service)

The example web application is for a fictional car dealership --
JAW Motors. You will be able to view/create/edit/delete cars
in the dealer's inventory.

The example uses XDoclet extensively to automate the
build process. XDoclet generates a number of configuration files 
for you automatically (web.xml and jboss-web.xml, ejb-jar.xml
hibernate HBM mapping files, etc.).

The following files are copied into your JBoss distribution by 
code/build.xml:

The main application:
- code/build/distribution/jaw.ear --> $JBOSS_HOME/server/default/deploy

The database connection:
- code/sql/jaw-ds.xml --> $JBOSS_HOME/server/default/deploy

The JAAS security settings:
- code/src/META-INF/jaw-login-config.xml --> $JBOSS_HOME/server/default/conf
- code/src/META-INF/jaw-login-config-service.xml --> $JBOSS_HOME/server/default/deploy

Additionally, code/sql/build.xml shows you how to set up and refresh the 
Hypersonic database with the required tables and sample data.

To build the example yourself, make sure that you've made the following installations
and set these environment variables:
-JAVA_HOME
-JBOSS_HOME (use JBoss 4.0.2 - *JBoss 4.0.3+ users see note at bottom*)
-XDOCLET_HOME (use XDOCLET 1.2.3)
-AXIS_1_1_HOME (for Apache Axis 1.1 - http://www.apache.org/dyn/closer.cgi/ws/axis/1_1)
-AXIS_1_2_1_HOME (for Apache Axis 1.2.1 - available at: http://www.apache.org/dyn/closer.cgi/ws/axis/1_2_1)
-JWSDP_HOME (For Java Web Services Developer Pack - use version 1.5)

From each project's top-level directory:
Use "ant all" to build the project from scratch.
Use "ant colddeploy" to copy the files to JBoss.
   NOTE: it is important that JBoss not be running when colddeploy is executed.


In chapters 4-10:
Use "ant" from the sql sub-directory to create the logins and seed the database with sample data.

Two logins are used in this application:
- username: fsmith, password: fred
- username: jjones, password: john


In chapters 5-10 (for JBoss 4.0.3+ users only):
The hibernate JAR files were moved, so change the common/build.xml file as follows:
From:
<property name="hibernate.lib.dir"
value="${env.JBOSS_HOME}/server/default/deploy/jboss-hibernate.deployer"/>

To:
<property name="hibernate.lib.dir"
value="${env.JBOSS_HOME}/server/default/lib"/> 
 No newline at end of file
+143 −0
Changes for jbossatwork-1.0.2/appb/build.xml: 143 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0"?>

<project name="appb" default="all" basedir=".">
    <!-- #Load environment variables as properties. -->
    <property environment="env"/>
    
    <!-- JBoss sub-directories -->
    
    <property name="jboss.home" location="${env.JBOSS_HOME}"/>
    
    <property name="server.dir" location="${jboss.home}/server/default"/>
    <property name="server.conf.dir" location="${server.dir}/conf"/>
    <property name="server.deploy.dir" location="${server.dir}/deploy"/>
    <property name="server.log.dir" location="${server.dir}/log"/>
    <property name="server.tmp.dir" location="${server.dir}/tmp"/>
    <property name="server.work.dir" location="${server.dir}/work"/>
    
    <!-- Initialization variables -->
    <property name="app.name" value="${ant.project.name}"/>
    <property name="source.dir" value="src"/>
    <property name="build.dir" value="build"/>
    <property name="distribution.dir" value="${build.dir}/distribution"/>

    <property name="meta-inf.dir" value="${source.dir}/META-INF"/>

    <!-- subdirectories for EAR components -->
    <property name="ejb.dir" value="ejb"/>
    <property name="ejb.jar.dir" value="${ejb.dir}/build/distribution"/>
    <property name="ejb.jar.name" value="ejb.jar"/>
    
    <property name="webapp.dir" value="webapp"/>
    <property name="webapp.war.dir" value="${webapp.dir}/build/distribution"/>
    <property name="webapp.war.name" value="webapp.war"/>
    
    <property name="common.dir" value="common"/>
    <property name="common.conf.dir" location="${common.dir}/conf"/>
    <property name="log4j.extra.properties.file" location="${common.conf.dir}/log4j.extra.properties"/>
    <property name="common.jar.dir" value="${common.dir}/build/distribution"/>
    <property name="common.jar.name" value="common.jar"/>

    <property name="hibernate.har.name" value="jaw.har"/>
    
    <property file="${log4j.extra.properties.file}"/>

    <property name="sql.dir" value="sql"/>

    <property name="ear.name" value="jaw.ear"/>
        

    <!-- ============================= -->
    <target name="all" depends="cleanall, ear" description="Does the whole enchilada"/>

    <!-- ====================================== -->
    <target name="clean" description="Deletes compiled and generated code">
        <delete dir="${build.dir}"/>
    </target>

    <!-- ====================================== -->
    <target name="cleanall" depends="clean" description="Deletes compiled and generated code for the entire project">
        <echo message="##### Cleaning common #####" />
        <ant dir="${common.dir}" target="clean" />
       
        <echo message="##### Cleaning ejb #####" />
        <ant dir="${ejb.dir}" target="clean" />
      
        <echo message="##### Cleaning webapp #####" />
        <ant dir="${webapp.dir}" target="clean" />         
    </target>


    <!-- ====================================== -->
    <target name="compile" description="Compiles the Java code">
        <echo message="##### Building common #####" />
        <ant dir="${common.dir}" target="all" >
            <property name="jar.name" value="${common.jar.name}"/>
            <property name="har.name" value="${hibernate.har.name}"/>
        </ant>

        <echo message="##### Building ejb #####" />
        <ant dir="${ejb.dir}" target="all" >
            <property name="ejb.jar.name" value="${ejb.jar.name}"/>
            <property name="common.jar.dir" value="${basedir}/${common.jar.dir}"/>
        </ant>
      
        <echo message="##### Building webapp #####" />
        <ant dir="${webapp.dir}" target="all" >
            <property name="war.name" value="${webapp.war.name}"/>
            <property name="common.jar.dir" value="${basedir}/${common.jar.dir}"/>
        </ant>
    </target>

    <!-- ====================================== -->
    <target name="ear" depends="compile" description="Packages all files into an EAR file">
        <mkdir dir="${build.dir}" />
        <mkdir dir="${distribution.dir}" />

        <echo message="##### Building EAR #####" />    
        <ear destFile="${distribution.dir}/${ear.name}" appxml="${meta-inf.dir}/application.xml" >
            <!-- files to be included in / -->
            
            <fileset dir="${ejb.jar.dir}" />

            <fileset dir="${webapp.war.dir}" />
            <fileset dir="${common.jar.dir}" />
            
            <!-- include jboss-app.xml -->
            <metainf dir="${meta-inf.dir}">
                <include name="jboss-app.xml"/>
            </metainf>

        </ear>
    </target>
    
    <target name="colddeploy" depends="deploy-uninstall, deploy"
            description="Cleans up and deploys the EAR file on JBoss">
    </target>

    <target name="deploy" depends="all" description="Deploys the EAR">
        <copy file="${distribution.dir}/${ear.name}" todir="${server.deploy.dir}"/>
        <copy file="${sql.dir}/jaw-ds.xml" todir="${server.deploy.dir}"/>
        <copy file="${meta-inf.dir}/jaw-jms-destinations-service.xml" todir="${server.deploy.dir}"/>
        
        <!-- Create directory where log file resides. -->
        <mkdir dir="${log4j.log.dir}"/>
        
        <echo message="${app.name} sucessfully deployed to ${server.deploy.dir}"/>
    </target>    

    <target name="deploy-uninstall" description="Cleans up JBoss deployment area">
        <delete dir="${server.log.dir}"/>
        <delete dir="${server.tmp.dir}"/>
        <delete dir="${server.work.dir}"/>
        
        <delete>
            <fileset dir="${server.deploy.dir}">
              <include name="jaw.*ar"/>
              <include name="jaw-ds.xml"/>
              <include name="jaw-jms-destinations-service.xml"/>
            </fileset>
        </delete>
    </target>
    
</project>
 No newline at end of file
Loading