OPENJPA-2189. Build script updates to allow OpenBooks to run on Liberty Profile in WebSphere. Also, some general updates to the OpenBooks application to correct missing links, pics, and formatting issues.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1336408 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kevin W. Sutter 2012-05-09 21:18:06 +00:00
parent 6df8fa909a
commit 0c4b201e8f
18 changed files with 206 additions and 14 deletions

View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- ====================================================================== -->
<!-- -->
<!-- Ant build script for JEE version of OpenBooks for -->
<!-- WebSphere Application Server with Liberty Profile -->
<!-- -->
<!-- ====================================================================== -->
<project name="OpenBooks.JEE.Liberty">
<!-- Location of WebSphere Application Server Liberty Profile home/install dir -->
<property name="liberty.home" value="/was8.5/gm1216.05/WebSphere/AppServer/wlp"/>
<!-- WebSphere Liberty Server name (IP name or address) -->
<property name="liberty.server" value=""/>
<!-- Location of WebSphere Application Server Liberty Profile bin dir -->
<property name="liberty.bin" value="${liberty.home}/bin"/>
<!-- WebSphere Liberty Server dropins directory -->
<property name="liberty.dropins" value="${liberty.home}/usr/servers/${liberty.server}/dropins"/>
<target name="pre-package">
<echo message="In Liberty pre-package"/>
<copy file="${rsrc.dir}/META-INF/persistence.jee.liberty.xml" tofile="${classes.dir}/META-INF/persistence.xml"/>
</target>
<target name="uninstall"
description="Uninstall OpenBooks from the WebSphere Application Server, Liberty Profile">
<echo message="Uninstall is a no-op in Liberty, just copy in a new war during the install process..."/>
</target>
<target name="install"
description="Deploy OpenBooks as a WAR application in WebSphere Application Server, Liberty Profile">
<condition property="default.deploy">
<length string="${liberty.server}" length="0"/>
</condition>
<antcall target="liberty.deploy"/>
<antcall target="liberty.deploy.server"/>
</target>
<!-- Default simple deployment if Liberty server is not specified -->
<target name="liberty.deploy" if="default.deploy">
<echo>
--------------------------------------------
Creating Derby JDBC provider and data source
WAS Liberty Home: ${liberty.home}
WAS Liberty Server: ${liberty.server}
Nothing to do since "liberty.server" is not set...
</echo>
</target>
<!-- Target for installation and deployment of the application when a -->
<!-- Liberty server IP name is provided. This type of deployment -->
<!-- requires server IP name liberty.home, liberty.server, liberty.dropins, -->
<!-- to be provided. -->
<target name="liberty.deploy.server" unless="default.deploy">
<echo>
-------------------------------------------
Creating Derby JDBC Provider and DataSource
WAS Home: ${liberty.home}
WAS Server: ${liberty.server}
Have to figure out how to configure datasources in server.xml...
</echo>
<echo>
-------------------------------------
Deploying OpenBooks demo application
Copying openbooks.war to dropins directory...
Liberty server ${liberty.server} should automatically restart application...
</echo>
<copy file="${target.dir}/openbooks.war" todir="${liberty.dropins}/"/>
<exec osfamily="windows" dir="${liberty.bin}" executable="cmd">
<arg line="/c server.bat start ${liberty.server}"/>
</exec>
<exec osfamily="unix" dir="${liberty.bin}" executable="server">
<arg line="start ${liberty.server}"/>
</exec>
<echo>
-------------------------------------
Start OpenBooks via http://localhost:9080/openbooks
</echo>
</target>
</project>

View File

@ -121,7 +121,7 @@
Deploying OpenBooks demo application
</echo>
<wsInstallApp wasHome="${was.home}"
ear="openbooks.war"
ear="${target.dir}/openbooks.war"
options="-usedefaultbindings -contextroot OpenBooks -appname OpenBooks"/>
<echo>
@ -164,7 +164,7 @@
</echo>
<wsInstallApp wasHome="${was.home}"
ear="openbooks.war"
ear="${target.dir}/openbooks.war"
conntype="${was.conntype}"
host="${was.server}"
port="${was.port}"

View File

@ -34,7 +34,7 @@
<antcall target="jee.uninstall"/>
<mkdir dir="${classes.dir}/META-INF"/>
<antcall target="jee.pre-package"/>
<war destfile="openbooks.war" webxml="${rsrc.dir}/META-INF/web.xml" filesonly="true">
<war destfile="${target.dir}/openbooks.war" webxml="${rsrc.dir}/META-INF/web.xml" filesonly="true">
<fileset dir="${web.dir}"/>
<classes dir="${classes.dir}">
<include name="META-INF/persistence.xml"/>
@ -96,7 +96,7 @@
<target name="install"
description="Default application installation">
<move file="openbooks.war" todir="${deploy.dir}" overwrite="true"/>
<move file="${target.dir}/openbooks.war" todir="${deploy.dir}" overwrite="true"/>
</target>
<target name="compile"

View File

@ -93,6 +93,7 @@
<target name="clean" description="Removes all *.class and generated metamodel source files">
<delete dir="${target.dir}" failonerror="false"/>
<mkdir dir="${deploy.dir}"/>
<delete>
<fileset refid="canonical.metamodel"/>
</delete>
@ -130,7 +131,6 @@
<condition property="build.mode.is.jee">
<equals arg1="${build.mode}" arg2="jee" casesensitive="true" trim="true"/>
</condition>
<mkdir dir="${deploy.dir}"/>
<available file="${antlr.lib}" property="antlr.exists"/>
<!--

View File

@ -0,0 +1,2 @@
# set variable for apache derby install location
derbyInstallDir=c:/derby10.8.2.2/

View File

@ -0,0 +1,24 @@
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>jsp-2.2</feature>
<feature>jpa-2.0</feature>
<feature>jdbc-4.0</feature>
</featureManager>
<httpEndpoint id="defaultHttpEndpoint"
host="localhost"
httpPort="9080"
httpsPort="9443" />
<jdbcDriver id="DerbyEmbedded" libraryRef="DerbyLib" />
<library id="DerbyLib" filesetRef="DerbyFileset" />
<fileset id="DerbyFileset" dir="${derbyInstallDir}/lib" includes="derby.jar"/>
<dataSource id="OpenBooks" jndiName="jdbc/OpenBooks" jdbcDriverRef="DerbyEmbedded">
<properties databaseName="OpenBooks" createDatabase="create" />
</dataSource>
<dataSource id="OpenBooksNoTx" jndiName="jdbc/NonTxOpenBooks" jdbcDriverRef="DerbyEmbedded">
<properties databaseName="OpenBooks" createDatabase="create" />
</dataSource>
</server>

View File

@ -26,6 +26,7 @@ public class Range<N extends Number> {
private N max;
private final Class<N> type;
@SuppressWarnings("unchecked")
public Range(Object min, Object max) {
this((N)min, (N)max);
}
@ -36,6 +37,7 @@ public class Range<N extends Number> {
* @param min non-null minimum value.
* @param max non-null maximum value.
*/
@SuppressWarnings("unchecked")
public Range(N min, N max) {
if (min == null || max == null)
throw new IllegalArgumentException("Supplied Min or Max is null");

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="1.0">
<persistence-unit name="OpenBooks">
<jta-data-source>java:comp/env/jdbc/OpenBooks</jta-data-source>
<non-jta-data-source>java:comp/env/jdbc/NonTxOpenBooks</non-jta-data-source>
<class>openbook.domain.Book</class>
<class>openbook.domain.Inventory</class>
<class>openbook.domain.PurchaseOrder</class>
<class>openbook.domain.LineItem</class>
<class>openbook.domain.Customer</class>
<class>openbook.domain.Author</class>
<properties>
<property name="openjpa.DataCache" value="true"/>
<property name="openjpa.RemoteCommitProvider" value="sjvm"/>
<property name="openjpa.DynamicEnhancementAgent" value="false"/>
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.jdbc.QuerySQLCache" value="true(EnableStatistics=true)"/>
</properties>
</persistence-unit>
</persistence>

View File

@ -24,4 +24,16 @@
<welcome-file>intro.jsp</welcome-file>
</welcome-file-list>
<distributable/>
<resource-ref>
<res-ref-name>jdbc/NonTxOpenBooks</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/OpenBooks</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

View File

@ -45,7 +45,7 @@
it to the server when a Purchase Order is to be placed.
</div>
<div id="content" style="display: block">
<div id="content" style="width: 600px; display: block">
<%
OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE);

View File

@ -74,7 +74,7 @@
</div>
<div id="content" style="display: block">
<div id="content" style="width: 600px; display: block">
<%
OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE);
ShoppingCart cart = (ShoppingCart)session.getAttribute(KEY_CART);

View File

@ -85,7 +85,7 @@
if (activeSession) {
%>
<div style="float:right;text-align: right;margin-right:1em">
<%= currentUser.toString() %>&nbsp;&nbsp;
Hello, <%= currentUser.toString() %>&nbsp;&nbsp;
<A HREF="cart.jsp"><img src="images/Add2Cart.jpg"
border="0" width="25px" height="25px"></A>
</div>

View File

@ -47,7 +47,7 @@ corresponding Java code</a> executed on the server side.
</div>
<div id="content" style="display: block">
<div id="content" style="width: 600px; display: block">
<%
Object service = session.getAttribute(KEY_SERVICE);

View File

@ -59,7 +59,7 @@ are no more available.
</ul>
</div>
<div id="content" style="display: block">
<div id="content" style="width: 600px; display: block">
<%
OpenBookService service = (OpenBookService)session.getAttribute(KEY_SERVICE);

View File

@ -51,7 +51,7 @@
</div>
<div id="content" style="display: block">
<div id="content" style="width: 600px; display: block">
<%!
/**
* Concatenates the names of the given list of Authors.

View File

@ -23,7 +23,7 @@
<%@page import="openbook.domain.Customer"%>
<%@page import="java.util.List"%>
<div id="content" style="display: block">
<div id="content" style="width: 600px; display: block">
<%-- ==================================================================== --%>
<%-- Associates the current session with OpenBookService, if the request --%>

View File

@ -59,7 +59,7 @@
<A href="http://www.ibm.com/developerworks/java/library/j-typesafejpa/" target="_blank">here</A>.
</div>
<div id="content" style="display: block">
<div id="content" style="width: 600px; display: block">
<%!
public static String getParameter(HttpServletRequest request, String param) {
return getParameter(request, param, true);
@ -92,7 +92,7 @@ Fill in the details for a book you are searching for.
<input type="text" name="<%= FORM_PRICE_MAX %>" value="<%= getParameter(request, FORM_PRICE_MIN) %>"
style="width:6em"><br>
<br>
<input type="image" src="images/search.gif" width="60px" height="22px" border="0">
<input type="submit" src="images/search.gif" width="60px" height="22px" border="0">
</form>
<p></p>
<b>Search Tips</b>: