Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 7, 2016
0 parents commit 1f243f9
Show file tree
Hide file tree
Showing 1,457 changed files with 43,634 additions and 0 deletions.
Binary file added 2806.pdf
Binary file not shown.
Binary file added 2807.pdf
Binary file not shown.
Binary file added 9781590596456.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions GettingStarted.txt
@@ -0,0 +1,13 @@
- Assume you've downloaded the examples and unzipped them to <EXAMPLES_HOME>.

- download a copy of glassfish from https://glassfish.dev.java.net/public/downloadsindex.html

- copy the downloaded .jar file to <EXAMPLES_HOME>

- edit <EXAMPLES_HOME>/config/setenv.bat to point to your JDK 5.0 directory. The JDK is available for download at http://java.sun.com/j2se/1.5.0/download.jsp

- edit <EXAMPLES_HOME>/config/common.properties and set the EXAMPLES_HOME variable (location where you unzipped the examples jar). NOTE: make sure you use '/' and NOT '\'

- run <EXAMPLES_HOME>/bin/installserver.bat to install glassfish. Read and accept the licensing agreement that pops up.

- you can now run the examples. Double-click <EXAMPLES_HOME>/examples/examples.html to get started
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,27 @@
Freeware License, some rights reserved

Copyright (c) 2006 Mike Keith and Merrick Schincariol

Permission is hereby granted, free of charge, to anyone obtaining a copy
of this software and associated documentation files (the "Software"),
to work with the Software within the limits of freeware distribution and fair use.
This includes the rights to use, copy, and modify the Software for personal use.
Users are also allowed and encouraged to submit corrections and modifications
to the Software for the benefit of other users.

It is not allowed to reuse, modify, or redistribute the Software for
commercial use in any way, or for a user�s educational materials such as books
or blog articles without prior permission from the copyright holder.

The above copyright notice and this permission notice need to be included
in all copies or substantial portions of the software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS OR APRESS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


15 changes: 15 additions & 0 deletions README.md
@@ -0,0 +1,15 @@
#Apress Source Code

This repository accompanies [*Pro EJB 3*](http://www.apress.com/9781590596456) by Mike Keith and Merrick Schincariol (Apress, 2006).

![Cover image](9781590596456.jpg)

Download the files as a zip using the green button, or clone the repository to your machine using Git.

##Releases

Release v1.0 corresponds to the code in the published book, without corrections or updates.

##Contributions

See the file Contributing.md for more information on how you can contribute to this repository.
10 changes: 10 additions & 0 deletions bin/installserver.bat
@@ -0,0 +1,10 @@
call ../config/setenv

cd ..
%JAVA_HOME%/bin/java -Xmx256m -jar glassfish-installer*.jar

cd glassfish
xcopy ..\lib\junit-4.0.jar ..\glassfish\lib\ant\lib
call ../glassfish/lib/ant/bin/ant -f setup.xml

pause
6 changes: 6 additions & 0 deletions bin/startserver.bat
@@ -0,0 +1,6 @@
call ../config/setenv

call ../glassfish/lib/ant/bin/ant -f ../config/common.xml start_db
call ../glassfish/lib/ant/bin/ant -f ../config/common.xml start_server

pause
6 changes: 6 additions & 0 deletions bin/stopserver.bat
@@ -0,0 +1,6 @@
call ../config/setenv

call ../glassfish/lib/ant/bin/ant -f ../config/common.xml stop_server
call ../glassfish/lib/ant/bin/ant -f ../config/common.xml stop_db

pause
26 changes: 26 additions & 0 deletions config/common.properties
@@ -0,0 +1,26 @@
EXAMPLES_HOME=d:/book/examples

##################################################
# properties for the Glassfish application server
##################################################
SERVER_HOME=${EXAMPLES_HOME}/glassfish
ADMIN_USER=admin
PASSWORD_FILE="${EXAMPLES_HOME}/config/password.txt"

##################################################
# properties for the Derby Database
##################################################
DERBY_INSTALL=${SERVER_HOME}/javadb
DERBY_PORT=1527
DERBY_HOST=localhost
DERBY_USER=APP
DERBY_PWD=APP
DERBY_SYSTEM_HOME=${EXAMPLES_HOME}/database
DERBY_CLASSPATH=${DERBY_INSTALL}/lib/derby.jar;${DERBY_INSTALL}/lib/derbynet.jar;${DERBY_INSTALL}/lib/derbyclient.jar;${DERBY_INSTALL}/lib/derbytools.jar



ESSENTIALS_CLASSPATH=${SERVER_HOME}/lib/toplink-essentials.jar
SPRING_CLASSPATH=${EXAMPLES_HOME}/lib/spring.jar;${EXAMPLES_HOME}/lib/commons-logging.jar
J2EE_CLASSPATH=${SERVER_HOME}/lib/javaee.jar
CLIENT_CLASSPATH="${ESSENTIALS_CLASSPATH};${J2EE_CLASSPATH};${DERBY_CLASSPATH}
142 changes: 142 additions & 0 deletions config/common.xml
@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="iso-8859-1"?>

<project name="common">
<property file="common.properties"/>

<target name="clean">
<delete dir="build"/>
<delete dir="dist"/>
</target>

<target name="setup">
<mkdir dir="build/model"/>
<mkdir dir="build/client"/>
<mkdir dir="build/test"/>
<mkdir dir="build/servlet/WEB-INF/classes"/>
<mkdir dir="dist"/>
<available property="modelSrcExists" file="src/model" />
<available property="servletSrcExists" file="src/servlet" />
</target>

<target name="build_ear" depends="setup,build_jar,build_war">
<jar jarfile="dist/${example_name}.ear" update="yes">
<fileset file="dist/${example_name}.war"/>
<fileset file="dist/${example_name}.jar"/>
</jar>
</target>

<target name="build_jar" depends="setup" if="modelSrcExists">
<javac srcdir="src/model" destdir="build/model" debug="on">
<classpath>
<pathelement path="${CLIENT_CLASSPATH}" />
</classpath>
</javac>
<copy todir="build/model" failonerror="false">
<fileset dir="etc/persistence"/>
</copy>
<jar jarfile="dist/${example_name}.jar" update="yes">
<fileset dir="build/model"/>
</jar>
</target>

<target name="build_war" depends="setup" if="servletSrcExists">
<javac srcdir="src/servlet" destdir="build/servlet/WEB-INF/classes" debug="on">
<classpath>
<pathelement path="${CLIENT_CLASSPATH}" />
<pathelement location="dist/${example_name}.jar" />
</classpath>
</javac>
<jar jarfile="dist/${example_name}.war" update="yes">
<fileset dir="build/servlet"/>
<fileset dir="etc/web"/>
</jar>
</target>

<target name="build_tests" depends="setup,build_jar">
<javac srcdir="src/test" destdir="build/test" debug="on">
<classpath>
<pathelement path="${J2EE_CLASSPATH}" />
<pathelement path="${SPRING_CLASSPATH}" />
<pathelement location="dist/${example_name}.jar" />
</classpath>
</javac>
</target>


<target name="start_server">
<exec executable="${SERVER_HOME}/bin/asadmin" failonerror="true" vmlauncher="false">
<arg line="start-domain --verbose=true domain1"/>
</exec>
</target>

<target name="stop_server" >
<exec executable="${SERVER_HOME}/bin/asadmin" failonerror="true" vmlauncher="false">
<arg line="stop-domain domain1"/>
</exec>
</target>

<target name="start_db" >
<java classname="org.apache.derby.drda.NetworkServerControl"
classpath="${DERBY_CLASSPATH}"
spawn="true"
fork="true">
<arg line="start -h ${DERBY_HOST} -p ${DERBY_PORT}"/>
<sysproperty key="derby.system.home" value="${DERBY_SYSTEM_HOME}"/>
</java>
</target>

<target name="stop_db" >
<java classname="org.apache.derby.drda.NetworkServerControl"
classpath="${DERBY_CLASSPATH}"
fork="true">
<arg line="shutdown -h ${DERBY_HOST} -p ${DERBY_PORT}"/>
<sysproperty key="derby.system.home" value="${DERBY_SYSTEM_HOME}"/>
</java>
</target>

<target name="run_sql">
<sql driver="org.apache.derby.jdbc.ClientDriver"
url="jdbc:derby://${DERBY_HOST}:${DERBY_PORT}/${DB_NAME};create=true"
userid="${DERBY_USER}"
password="${DERBY_PWD}"
src="etc/sql/db.sql"
onerror="continue">
<classpath>
<pathelement path="${DERBY_CLASSPATH}"/>
</classpath>
</sql>
</target>

<target name="deploy_ear">
<exec executable="${SERVER_HOME}/bin/asadmin" failonerror="true" vmlauncher="false">
<arg line="deploy --user ${ADMIN_USER} --passwordfile ${PASSWORD_FILE} dist/${example_name}.ear"/>
</exec>
</target>

<target name="undeploy_ear">
<exec executable="${SERVER_HOME}/bin/asadmin" failonerror="true" vmlauncher="false">
<arg line="undeploy --user ${ADMIN_USER} --passwordfile ${PASSWORD_FILE} ${example_name}"/>
</exec>
</target>

<target name="create_datasource">
<exec executable="${SERVER_HOME}/bin/asadmin" failonerror="true" vmlauncher="false">
<arg line="create-jdbc-connection-pool --user ${ADMIN_USER} --passwordfile ${PASSWORD_FILE}
--datasourceclassname org.apache.derby.jdbc.ClientXADataSource
--restype javax.sql.XADataSource --property portNumber=${DERBY_PORT}:password=${DERBY_PWD}:user=${DERBY_USER}:serverName=${DERBY_HOST}:databaseName=${DB_NAME}:connectionAttributes=\;create\=true ${DB_NAME}" />
</exec>
<exec executable="${SERVER_HOME}/bin/asadmin" failonerror="true" vmlauncher="false">
<arg line="create-jdbc-resource --user ${ADMIN_USER} --passwordfile ${PASSWORD_FILE}
--connectionpoolid ${DB_NAME} jdbc/${DB_NAME}" />
</exec>
</target>

<target name="remove_datasource">
<exec executable="${SERVER_HOME}/bin/asadmin" failonerror="true" vmlauncher="false">
<arg line="delete-jdbc-resource --user ${ADMIN_USER} --passwordfile ${PASSWORD_FILE} jdbc/${DB_NAME}" />
</exec>
<exec executable="${SERVER_HOME}/bin/asadmin" failonerror="true" vmlauncher="false">
<arg line="delete-jdbc-connection-pool --user ${ADMIN_USER} --passwordfile ${PASSWORD_FILE} ${DB_NAME}" />
</exec>
</target>
</project>
1 change: 1 addition & 0 deletions config/password.txt
@@ -0,0 +1 @@
AS_ADMIN_PASSWORD=adminadmin
1 change: 1 addition & 0 deletions config/setenv.bat
@@ -0,0 +1 @@
set JAVA_HOME=c:\jdk1.5.0
14 changes: 14 additions & 0 deletions contributing.md
@@ -0,0 +1,14 @@
# Contributing to Apress Source Code

Copyright for Apress source code belongs to the author(s). However, under fair use you are encouraged to fork and contribute minor corrections and updates for the benefit of the author(s) and other readers.

## How to Contribute

1. Make sure you have a GitHub account.
2. Fork the repository for the relevant book.
3. Create a new branch on which to make your change, e.g.
`git checkout -b my_code_contribution`
4. Commit your change. Include a commit message describing the correction. Please note that if your commit message is not clear, the correction will not be accepted.
5. Submit a pull request.

Thank you for your contribution!
15 changes: 15 additions & 0 deletions examples/Chapter10/xmlMappings/build.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="iso-8859-1"?>

<project name="example" default="deploy">

<property file="../../../config/common.properties"/>
<import file="../../../config/common.xml" />

<target name="deploy" depends="init,build_ear,create_datasource,run_sql,deploy_ear" />
<target name="undeploy" depends="init,undeploy_ear,remove_datasource,clean" />

<target name="init">
<property name="example_name" value="xmlMappings" />
<property name="DB_NAME" value="xmlMappings" />
</target>
</project>
5 changes: 5 additions & 0 deletions examples/Chapter10/xmlMappings/deploy.bat
@@ -0,0 +1,5 @@
call ../../../config/setenv.bat

call ../../../glassfish/lib/ant/bin/ant

pause

0 comments on commit 1f243f9

Please sign in to comment.