Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Apress committed Oct 11, 2016
0 parents commit 4f9d11b
Show file tree
Hide file tree
Showing 639 changed files with 10,343 additions and 0 deletions.
Binary file added 4146.pdf
Binary file not shown.
Binary file added 4147.pdf
Binary file not shown.
Binary file added 9781430209638.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions LICENSE.txt
@@ -0,0 +1,27 @@
Freeware License, some rights reserved

Copyright (c) 2008 Yuli Vasiliev

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 [*Beginning Database-Driven Application Development in Java EE*](http://www.apress.com/9781430209638) by Yuli Vasiliev (Apress, 2008).

![Cover image](9781430209638.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.
5 changes: 5 additions & 0 deletions ch1/HelloWorld/WEB-INF/sun-web.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
<context-root>/HelloWorld</context-root>
</sun-web-app>
12 changes: 12 additions & 0 deletions ch1/HelloWorld/WEB-INF/web.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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/web-app_2_5.xsd"
version="2.5">
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
</web-app>
Binary file added ch1/HelloWorld/helloworld.war
Binary file not shown.
10 changes: 10 additions & 0 deletions ch1/HelloWorld/index.jsp
@@ -0,0 +1,10 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<head>
<title>Hello World Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
66 changes: 66 additions & 0 deletions ch1/HelloWorldWithIDE/build.xml
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="HelloWorldWithIDE" default="default" basedir=".">
<description>Builds, tests, and runs the project HelloWorldWithIDE.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-dist: called before jar building
-post-dist: called after jar building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying
Example of pluging an obfuscator after the compilation could look like
<target name="post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Other way how to customize the build is by overriding existing main targets.
The target of interest are:
init-macrodef-javac: defines macro for javac compilation
init-macrodef-junit: defines macro for junit execution
init-macrodef-debug: defines macro for class debugging
do-dist: jar archive building
run: execution of project
javadoc-build: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>
2 changes: 2 additions & 0 deletions ch1/HelloWorldWithIDE/build/web/META-INF/MANIFEST.MF
@@ -0,0 +1,2 @@
Manifest-Version: 1.0

14 changes: 14 additions & 0 deletions ch1/HelloWorldWithIDE/build/web/WEB-INF/sun-web.xml
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
<context-root>/HelloWorldWithIDE</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="classdebuginfo" value="true">
<description>Enable debug info compilation in the generated servlet class</description>
</property>
<property name="mappedfile" value="true">
<description>Maintain a one-to-one correspondence between static content and the generated servlet class' java code</description>
</property>
</jsp-config>
</sun-web-app>
17 changes: 17 additions & 0 deletions ch1/HelloWorldWithIDE/build/web/WEB-INF/web.xml
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>

<web-app 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/web-app_2_5.xsd"
version="2.5">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
</web-app>
36 changes: 36 additions & 0 deletions ch1/HelloWorldWithIDE/build/web/index.jsp
@@ -0,0 +1,36 @@
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%--
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library... action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
--%>
<%--
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>

<h1>Hello World!!!</h1>

<%--
This example uses JSTL, uncomment the taglib directive above.
To test, display the page like this: index.jsp?sayHello=true&name=Murphy
--%>
<%--
<c:if test="${param.sayHello}">
<!-- Let's welcome the user ${param.name} -->
Hello ${param.name}!
</c:if>
--%>

</body>
</html>
Binary file added ch1/HelloWorldWithIDE/dist/HelloWorldWithIDE.war
Binary file not shown.
97 changes: 97 additions & 0 deletions ch1/HelloWorldWithIDE/nbproject/ant-deploy.xml
@@ -0,0 +1,97 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="-deploy-ant" basedir=".">
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
<property file="${deploy.ant.properties.file}" />
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
<tempfile prefix="sjsas" property="sjsas.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<echo message="AS_ADMIN_PASSWORD=${sjsas.password}" file="${sjsas.password.file}"/>
</target>

<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
<tempfile prefix="sjsas" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.sun.web}" validate="false">
</xmlproperty>
<delete file="${temp.sun.web}"/>
<property name="deploy.ant.client.url" value="${sjsas.url}${sun-web-app.context-root}"/>
</target>
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
<tempfile prefix="sjsas" property="sjsas.resources.dir" destdir="${java.io.tmpdir}"/>
<mkdir dir="${sjsas.resources.dir}"/>
<mkdir dir="${sjsas.resources.dir}/META-INF"/>
<property name="sjsas.resources.file" value="${sjsas.resources.dir}/META-INF/sun-resources.xml"/>
<property name="lefty" value="&lt;"/>

<property name="righty" value="&gt;"/>
<concat destfile="${sjsas.resources.file}">${lefty}?xml version="1.0" encoding="UTF-8"?${righty}
${lefty}!DOCTYPE resources PUBLIC
"-//Sun Microsystems Inc.//DTD Application Server 9.0 Resource Definitions //EN"
"${sjsas.root}/lib/dtds/sun-resources_1_2.dtd"${righty}
${lefty}resources${righty}
${lefty}/resources${righty}
</concat>
<concat append="true" destfile="${sjsas.resources.file}">
<fileset dir="${deploy.ant.resource.dir}"/>
</concat>
<replace file="${sjsas.resources.file}" value="">
<replacetoken><![CDATA[</resources>
<?xml version="1.0" encoding="UTF-8"?>
<resources>]]></replacetoken>
</replace>
<replace file="${sjsas.resources.file}" value="">
<replacetoken><![CDATA[</resources>
<?xml version="1.0" encoding="UTF-8"?>
<resources>]]></replacetoken>
</replace>
<replace file="${sjsas.resources.file}" value="">
<replacetoken><![CDATA[transaction-isolation-level="JDBC Driver Default"]]></replacetoken>
</replace>
<!-- work-around 434 and its variants -->
<replace file="${sjsas.resources.file}" value="">
<replacetoken><![CDATA[<description/>]]></replacetoken>
</replace>
<!-- do the right thing for Topics and Queues.
Need fix for TopicConnectionFactory and QueueConnectionfactory -->
<replace file="${sjsas.resources.file}">
<replacetoken><![CDATA[<jms-resource ]]></replacetoken>
<replacevalue><![CDATA[<admin-object-resource res-adapter="jmsra" ]]></replacevalue>
</replace>
<replace file="${sjsas.resources.file}">
<replacetoken><![CDATA[</jms-resource>]]></replacetoken>
<replacevalue><![CDATA[</admin-object-resource>]]></replacevalue>
</replace>
<jar destfile="${deploy.ant.archive}" update="true">
<fileset dir="${sjsas.resources.dir}"/>
</jar>
<delete dir="${sjsas.resources.dir}"/>
</target>
<target name="-deploy-ant" depends="-parse-sun-web,-add-resources" if="deploy.ant.enabled">
<echo message="Deploying ${deploy.ant.archive}"/>
<taskdef name="sun-appserv-deploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.DeployTask"
classpath="${sjsas.root}/lib/sun-appserv-ant.jar" />
<sun-appserv-deploy user="${sjsas.username}"
passwordfile="${sjsas.password.file}"
host="${sjsas.host}" port="${sjsas.port}"
file="${deploy.ant.archive}" asinstalldir="${sjsas.root}"/>
<delete file="${sjsas.password.file}"/>
</target>
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
<taskdef name="sun-appserv-undeploy" classname="org.apache.tools.ant.taskdefs.optional.sun.appserv.UndeployTask"
classpath="${sjsas.root}/lib/sun-appserv-ant.jar" />
<sun-appserv-undeploy user="${sjsas.username}"
passwordfile="${sjsas.password.file}"
host="${sjsas.host}" port="${sjsas.port}"
file="${deploy.ant.archive}" asinstalldir="${sjsas.root}"/>
<delete file="${sjsas.password.file}"/>
</target>
</project>

0 comments on commit 4f9d11b

Please sign in to comment.