You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ec...@apache.org on 2008/04/11 22:48:42 UTC
svn commit: r647303 [7/8] - in /geronimo/samples/branches/2.0:
migration-ejb-bmp/ migration-ejb-bmp/config/
migration-ejb-bmp/config/geronimo/ migration-ejb-bmp/config/jboss/
migration-ejb-bmp/src/ migration-ejb-bmp/src/META-INF/
migration-ejb-bmp/src/...
Added: geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-geronimo-plan.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-geronimo-plan.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-geronimo-plan.xml (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-geronimo-plan.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,82 @@
+<?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.
+-->
+
+<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2">
+ <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
+ <dep:moduleId>
+ <dep:groupId>user</dep:groupId>
+ <dep:artifactId>jdbcdatasource</dep:artifactId>
+ <dep:version>2.0</dep:version>
+ <dep:type>car</dep:type>
+ </dep:moduleId>
+ <dep:dependencies>
+ <dep:dependency>
+ <dep:groupId>mysql</dep:groupId>
+ <dep:artifactId>mysql-connector-java</dep:artifactId>
+ <dep:version>3.1.14-bin</dep:version>
+ <dep:type>jar</dep:type>
+ </dep:dependency>
+ </dep:dependencies>
+ </dep:environment>
+<resourceadapter>
+ <outbound-resourceadapter>
+ <connection-definition>
+ <connectionfactory-interface>
+ javax.sql.DataSource
+ </connectionfactory-interface>
+ <connectiondefinition-instance>
+ <name>TradeDS</name>
+ <config-property-setting name="UserName">
+ root
+ </config-property-setting>
+ <config-property-setting name="Password">
+ password
+ </config-property-setting>
+ <config-property-setting name="Driver">
+ com.mysql.jdbc.Driver
+ </config-property-setting>
+ <config-property-setting name="ConnectionURL">
+ jdbc:mysql://localhost:3306/tradedb
+ </config-property-setting>
+ <config-property-setting name="CommitBeforeAutocommit">
+ false
+ </config-property-setting>
+ <config-property-setting name="ExceptionSorterClass">
+ org.tranql.connector.NoExceptionsAreFatalSorter
+ </config-property-setting>
+
+ <connectionmanager>
+ <local-transaction/>
+ <single-pool>
+ <max-size>10</max-size>
+ <min-size>0</min-size>
+ <blocking-timeout-milliseconds>
+ 5000
+ </blocking-timeout-milliseconds>
+ <idle-timeout-minutes>
+ 30
+ </idle-timeout-minutes>
+ <match-one/>
+ </single-pool>
+ </connectionmanager>
+ </connectiondefinition-instance>
+ </connection-definition>
+ </outbound-resourceadapter>
+</resourceadapter>
+</connector>
+
Propchange: geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-geronimo-plan.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-geronimo-plan.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-geronimo-plan.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-jdbc/sql/db.sql
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/sql/db.sql?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/sql/db.sql (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/sql/db.sql Fri Apr 11 13:48:31 2008
@@ -0,0 +1,118 @@
+-- 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.
+
+
+
+
+
+CREATE TABLE IF NOT EXISTS users
+
+(userid VARCHAR(15) PRIMARY KEY CHECK (NOT NULL),
+
+name VARCHAR(50),
+
+password VARCHAR(24),
+
+address VARCHAR(96),
+
+cash FLOAT) ;
+
+
+
+
+
+CREATE TABLE IF NOT EXISTS TradingAccount
+
+(userid VARCHAR(15),
+
+ stockid VARCHAR(8),
+
+ quantity INT);
+
+
+
+
+
+CREATE TABLE IF NOT EXISTS stocks
+
+(id VARCHAR(8) PRIMARY KEY CHECK (NOT NULL),
+
+ name VARCHAR(100),
+
+ price FLOAT);
+
+
+
+DELETE FROM users;
+
+DELETE FROM TradingAccount;
+
+DELETE FROM stocks;
+
+
+
+INSERT INTO users VALUES('srini', '6 Inch',
+
+ 'cheemu','Madivala Bangalore',10000);
+
+
+
+INSERT INTO users VALUES('j2ee', 'Lee Whittaker',
+
+ 'password','Tampa Florida',100000);
+
+
+
+INSERT INTO TradingAccount VALUES('j2ee','00000002',10);
+
+INSERT INTO TradingAccount VALUES('srini','00000001',100);
+
+
+
+INSERT INTO stocks VALUES('00000001',"BTDA",1.00);
+
+INSERT INTO stocks VALUES('00000002',"Hitech Software",2.00);
+
+INSERT INTO stocks VALUES('00000003',"Bill's Cold Storage",3.00);
+
+INSERT INTO stocks VALUES('00000004',"Colonel's Fried Chicken",300.00);
+
+INSERT INTO stocks VALUES('00000005',"Toyo Motors",30.00);
+
+INSERT INTO stocks VALUES('00000006',"Timbuctoo Airlines",53.00);
+
+INSERT INTO stocks VALUES('00000007',"Happy Undertakers",73.00);
+
+INSERT INTO stocks VALUES('00000008',"Wacko Brothers",54.00);
+
+INSERT INTO stocks VALUES('00000009',"Mental Studios",456.00);
+
+INSERT INTO stocks VALUES('00000013',"ASFG",54.89);
+
+INSERT INTO stocks VALUES('00000023',"BFG",564.50);
+
+INSERT INTO stocks VALUES('00000033',"Mack",3444.50);
+
+INSERT INTO stocks VALUES('00000043',"Ronan & Sons",7.50);
+
+INSERT INTO stocks VALUES('00000053',"Bulls & Bears",553.40);
+
+INSERT INTO stocks VALUES('00000343',"HGHU",456.00);
+
+INSERT INTO stocks VALUES('00000603',"TTTM",77.00);
+
+INSERT INTO stocks VALUES('00000463',"GRASF",88.00);
+
+commit;
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-jdbc/sql/db.sql
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/sql/db.sql
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/sql/db.sql
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/Stock.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/Stock.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/Stock.java (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/Stock.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,56 @@
+/*
+* 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.
+*/
+package com.dev.trade.bo;
+
+public class Stock {
+ private String id = null;
+ private String name = null;
+ private float price = 0.0f;
+ private int quantity = 0;
+
+ public Stock(String id, String name, float price, int quantity) {
+ this.id = id;
+ this.name = name;
+ this.price = price;
+ this.quantity = quantity;
+ }
+ public String getId() {
+ return id;
+ }
+ public void setId(String id) {
+ this.id = id;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public float getPrice() {
+ return price;
+ }
+ public void setPrice(float price) {
+ this.price = price;
+ }
+ public int getQuantity() {
+ return quantity;
+ }
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+}
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/Stock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/Stock.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/Stock.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/User.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/User.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/User.java (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/User.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,68 @@
+/*
+* 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.
+*/
+package com.dev.trade.bo;
+
+public class User {
+
+ private String userId = null;
+ private String name = null;
+ private String password = null;
+ private String address = null;
+ private float cash = 0f;
+
+ public User(String userId,String name,String password,String address,float cash){
+ this.userId = userId;
+ this.name = name;
+ this.password = password;
+ this.address = address;
+ this.cash = cash;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+ public void setAddress(String address) {
+ this.address = address;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String getPassword() {
+ return password;
+ }
+ public void setPassword(String password) {
+ this.password = password;
+ }
+ public String getUserId() {
+ return userId;
+ }
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public float getCash() {
+ return cash;
+ }
+
+ public void setCash(float cash) {
+ this.cash = cash;
+ }
+
+}
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/User.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/User.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/bo/User.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/dao/TradeDAO.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/dao/TradeDAO.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/dao/TradeDAO.java (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/dao/TradeDAO.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,493 @@
+/*
+* 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.
+*/
+package com.dev.trade.dao;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+import com.dev.trade.bo.Stock;
+import com.dev.trade.bo.User;
+import com.dev.trade.exception.DBException;
+
+public class TradeDAO {
+ private Connection con;
+
+ public TradeDAO() throws Exception {
+
+ }
+
+ public User getUserByUserId(String userId) throws DBException {
+
+ User user = null;
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+ try {
+ String query = "select * from users where userid = ?";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setString(1, userId);
+ ResultSet rs = pStmt.executeQuery();
+ while (rs.next()) {
+ user = new User(rs.getString(1), rs.getString(2), rs
+ .getString(3), rs.getString(4), rs.getFloat(5));
+ }
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return user;
+ }
+
+ public List getUserStocks(String userId) throws DBException {
+ List stocks = new ArrayList();
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+ try {
+ String query = "select A.quantity,A.stockid,B.name,B.price from TradingAccount A,stocks B where A.userid = ? and A.stockid = B.id";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setString(1, userId);
+ Stock stock = null;
+ ResultSet rs = pStmt.executeQuery();
+ while (rs.next()) {
+ stock = new Stock(rs.getString(2), rs.getString(3), rs
+ .getFloat(4), rs.getInt(1));
+ stocks.add(stock);
+ }
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return stocks;
+ }
+
+ public List getStocks() throws DBException {
+ List stocks = new ArrayList();
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+ try {
+ String query = "select * from stocks";
+ PreparedStatement pStmt = con.prepareStatement(query);
+
+ Stock stock = null;
+ ResultSet rs = pStmt.executeQuery();
+ while (rs.next()) {
+ stock = new Stock(rs.getString(1), rs.getString(2), rs
+ .getFloat(3), 0);
+ stocks.add(stock);
+ }
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return stocks;
+ }
+
+ public float getUserCash(String userId) throws DBException {
+ float cash = 0;
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+ try {
+ String query = "select cash from users where userid = ?";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setString(1, userId);
+ ResultSet rs = pStmt.executeQuery();
+ while (rs.next()) {
+ cash = rs.getFloat("cash");
+ }
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return cash;
+ }
+
+ public boolean buyStock(String userId, String stockId, int quantity)
+ throws DBException {
+ float cashAvailable = getUserCash(userId);
+ float costOfStock = getStockPrice(stockId);
+ float totalCost = costOfStock * quantity;
+ int availableStock = getStockQuantityForUser(userId, stockId);
+ cashAvailable = cashAvailable - totalCost;
+ availableStock = availableStock + quantity;
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+
+ if (cashAvailable >= 0 && (availableStock != quantity)) {
+ try {
+ con.setAutoCommit(false);
+ if (setUserCash(userId, cashAvailable)
+ && setUserStock(userId, stockId, availableStock)) {
+ con.commit();
+ } else {
+ con.rollback();
+ }
+ con.setAutoCommit(true);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new DBException(e.getMessage());
+ }
+ } else if (cashAvailable >= 0 && (availableStock == quantity)) {
+ try {
+ con.setAutoCommit(false);
+ if (setUserCash(userId, cashAvailable)
+ && addUserStock(userId, stockId, availableStock)) {
+ con.commit();
+ } else {
+ con.rollback();
+ }
+ con.setAutoCommit(true);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new DBException(e.getMessage());
+ }
+ } else {
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return false;
+ }
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return true;
+ }
+
+ public boolean sellStock(String userId, String stockId, int quantity)
+ throws DBException {
+ float cashAvailable = getUserCash(userId);
+ float costOfStock = getStockPrice(stockId);
+ float totalCost = costOfStock * quantity;
+ int availableStock = getStockQuantityForUser(userId, stockId);
+ cashAvailable = cashAvailable + totalCost;
+ availableStock = availableStock - quantity;
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+ if (availableStock >= 0) {
+ try {
+ con.setAutoCommit(false);
+ if (setUserCash(userId, cashAvailable)
+ && setUserStock(userId, stockId, availableStock)) {
+ con.commit();
+ } else {
+ con.rollback();
+ }
+ con.setAutoCommit(true);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ throw new DBException(e.getMessage());
+ }
+
+ } else {
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return false;
+ }
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return true;
+ }
+
+ public float getStockPrice(String stockId) throws DBException {
+ float stockPrice = 0f;
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+ try {
+ String query = "select price from stocks where id = ?";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setString(1, stockId);
+ ResultSet rs = pStmt.executeQuery();
+ while (rs.next()) {
+ stockPrice = rs.getFloat("price");
+ }
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return stockPrice;
+ }
+
+ private boolean setUserCash(String userId, float cash) throws DBException {
+ int status = 0;
+ try {
+ String query = "update users set cash = ? where userid = ?";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setFloat(1, cash);
+ pStmt.setString(2, userId);
+ status = pStmt.executeUpdate();
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ if (status == 0) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+
+ // buy = true sell = false
+ private boolean setUserStock(String userId, String stockId, int quantity)
+ throws DBException {
+ int existingQuantity = 0;
+ int status = 0;
+
+ try {
+ String query = "update TradingAccount set quantity = ? where stockid = ? and userid = ?";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setInt(1, quantity);
+ pStmt.setString(2, stockId);
+ pStmt.setString(3, userId);
+ status = pStmt.executeUpdate();
+ pStmt.close();
+ query = "delete from TradingAccount where quantity = ?";
+ pStmt = con.prepareStatement(query);
+ pStmt.setInt(1, 0);
+ pStmt.executeUpdate();
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ if (status == 0) {
+ return false;
+ } else {
+ return true;
+ }
+
+ }
+
+ private boolean addUserStock(String userId, String stockId, int quantity)
+ throws DBException {
+
+ int status = 0;
+ try {
+ String query = "insert into TradingAccount values (?,?,?)";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setInt(3, quantity);
+ pStmt.setString(2, stockId);
+ pStmt.setString(1, userId);
+ status = pStmt.executeUpdate();
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ if (status == 0) {
+ return false;
+ } else {
+ return true;
+ }
+
+ }
+
+ public int getStockQuantityForUser(String userId, String stockId)
+ throws DBException {
+ int existingQuantity = 0;
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+
+ try {
+ String query = "select quantity from TradingAccount where userid = ? and stockid = ?";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setString(1, userId);
+ pStmt.setString(2, stockId);
+ ResultSet rs = pStmt.executeQuery();
+ while (rs.next()) {
+ existingQuantity = rs.getInt("quantity");
+ }
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return existingQuantity;
+ }
+
+ public boolean addUser(String userId, String name, String password,
+ String address, float cash) throws DBException {
+ int status = 0;
+ try {
+ InitialContext initialContext = new InitialContext();
+ Context envCtx = (Context) initialContext.lookup("java:comp/env");
+ DataSource ds = (DataSource) envCtx.lookup("jdbc/TradeDB");
+ con = ds.getConnection();
+ } catch (Exception ex) {
+
+ ex.getMessage();
+ }
+
+ try {
+ String query = "insert into users values (?,?,?,?,?)";
+ PreparedStatement pStmt = con.prepareStatement(query);
+ pStmt.setString(1, userId);
+ pStmt.setString(2, name);
+ pStmt.setString(3, password);
+ pStmt.setString(4, address);
+ pStmt.setFloat(5, cash);
+ status = pStmt.executeUpdate();
+ pStmt.close();
+ } catch (SQLException ex) {
+ ex.printStackTrace();
+ throw new DBException(ex.getMessage());
+ }
+ if (status == 0) {
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return false;
+ } else {
+ try {
+ con.close();
+ } catch (SQLException ex) {
+
+ throw new DBException(ex.getMessage());
+ }
+ return true;
+ }
+
+ }
+
+ public void remove() throws DBException {
+
+ }
+
+}
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/dao/TradeDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/dao/TradeDAO.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/dao/TradeDAO.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/exception/DBException.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/exception/DBException.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/exception/DBException.java (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/exception/DBException.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,26 @@
+/*
+* 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.
+*/
+package com.dev.trade.exception;
+
+public class DBException extends Exception {
+public DBException(){
+super();
+}
+public DBException(String message){
+ super(message);
+ }
+}
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/exception/DBException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/exception/DBException.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/exception/DBException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/servlet/TradeDispatcherServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/servlet/TradeDispatcherServlet.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/servlet/TradeDispatcherServlet.java (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/servlet/TradeDispatcherServlet.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,183 @@
+/*
+* 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.
+*/
+package com.dev.trade.servlet;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import com.dev.trade.bo.User;
+import com.dev.trade.dao.TradeDAO;
+import com.dev.trade.exception.DBException;
+
+public class TradeDispatcherServlet extends HttpServlet {
+
+ private TradeDAO tradeDAO = null;
+
+ private HttpSession session = null;
+
+ public void init() throws ServletException {
+ // TODO Auto-generated method stub
+ super.init();
+ try {
+ tradeDAO = new TradeDAO();
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ protected void doGet(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+ try {
+ session = request.getSession(true);
+ session.removeAttribute("status");
+ String page = request.getServletPath();
+ if ("/login".equals(page)) {
+ String userId = (String) request.getParameter("user");
+ String password = (String) request.getParameter("password");
+ if (userId != null && password != null) {
+ User user = tradeDAO.getUserByUserId(userId);
+ session.setAttribute("user", user);
+ if (user != null && password.equals(user.getPassword())) {
+ page = "/stocks";
+ session.setAttribute("userId", userId);
+ session.setAttribute("password", password);
+ List stocks = tradeDAO.getStocks();
+ session.setAttribute("stocks", stocks);
+ } else {
+ page = "/login";
+ session.setAttribute("status",
+ "Logon Failed Please Try Again!");
+ }
+ } else {
+ page = "/login";
+ }
+
+ } else if ("/stocks".equals(page)) {
+ List stocks = tradeDAO.getStocks();
+ session.setAttribute("stocks", stocks);
+ } else if ("/userstocks".equals(page)) {
+ String userId = (String) session.getAttribute("userId");
+ List userStocks = tradeDAO.getUserStocks(userId);
+ session.setAttribute("userStocks", userStocks);
+ } else if ("/register".equals(page)) {
+ String userId = request.getParameter("user");
+ String name = request.getParameter("name");
+ String password = request.getParameter("password");
+ String address = request.getParameter("address");
+ float cash = Float
+ .parseFloat((request.getParameter("cash") == null) ? "0"
+ : request.getParameter("cash"));
+ if (userId != null && name != null && password != null
+ && address != null && cash != 0) {
+ User user = tradeDAO.getUserByUserId(userId);
+ if (user == null) {
+ boolean status = tradeDAO.addUser(userId, name,
+ password, address, cash);
+ if (status) {
+ page = "/login";
+ } else {
+ page = "/register";
+ session.setAttribute("status",
+ "Registration Failed Please Try Again!");
+ }
+ } else {
+ page = "/register";
+ session.setAttribute("status",
+ "Registration Failed User Already Exists!");
+ }
+
+ }else if (userId != null && name != null && password != null
+ && address != null && cash == 0) {
+ session.setAttribute("status",
+ "Registration Failed Not enough Cash!");
+ page = "/register";
+
+ }else {
+ page = "/register";
+ }
+
+ } else if ("/sell".equals(page)) {
+ page = "/userstocks";
+ String userId = (String) session.getAttribute("userId");
+ String stockId = request.getParameter("select");
+ int quantity = Integer.parseInt(request
+ .getParameter("sellQuantity"));
+ boolean status = tradeDAO.sellStock(userId, stockId, quantity);
+ if (!status) {
+ session
+ .setAttribute("status",
+ "Not Enough Stocks or Operation Failed Please Try Again!");
+ }
+ List userStocks = tradeDAO.getUserStocks(userId);
+ session.setAttribute("userStocks", userStocks);
+ User user = tradeDAO.getUserByUserId(userId);
+ session.setAttribute("user", user);
+ } else if ("/buy".equals(page)) {
+ page = "/stocks";
+ String userId = (String) session.getAttribute("userId");
+ String stockId = request.getParameter("select");
+ int quantity = Integer.parseInt(request
+ .getParameter("buyQuantity"));
+ boolean status = tradeDAO.buyStock(userId, stockId, quantity);
+ if (!status) {
+ session
+ .setAttribute("status",
+ "Not Enough Money or Operation Failed Please Try Again!");
+ }
+ List userStocks = tradeDAO.getUserStocks(userId);
+ session.setAttribute("userStocks", userStocks);
+ User user = tradeDAO.getUserByUserId(userId);
+ session.setAttribute("user", user);
+ }
+
+ request.getRequestDispatcher(page + ".jsp").forward(request,
+ response);
+ } catch (DBException e) {
+ throw new ServletException(e.getMessage());
+ } catch (Exception ex) {
+ throw new ServletException(ex.getMessage());
+ }
+
+ }
+
+ protected void doPost(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException, IOException {
+ // TODO Auto-generated method stub
+
+ doGet(request, response);
+ }
+
+ public void destroy() {
+ // TODO Auto-generated method stub
+ super.destroy();
+ try {
+ tradeDAO.remove();
+ } catch (DBException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+}
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/servlet/TradeDispatcherServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/servlet/TradeDispatcherServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/src/com/dev/trade/servlet/TradeDispatcherServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/geronimo/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/geronimo/geronimo-web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/geronimo/geronimo-web.xml (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/geronimo/geronimo-web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1">
+ <dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
+ <dep:moduleId>
+ <dep:groupId>BrokerageApp</dep:groupId>
+ <dep:artifactId>MySqlDS</dep:artifactId>
+ <dep:version>2.0</dep:version>
+ <dep:type>car</dep:type>
+ </dep:moduleId>
+
+ <dep:dependencies>
+ <dep:dependency>
+ <dep:groupId>user</dep:groupId>
+ <dep:artifactId>jdbcdatasource</dep:artifactId>
+ <dep:version>2.0</dep:version>
+ <dep:type>car</dep:type>
+ </dep:dependency>
+ </dep:dependencies>
+
+ </dep:environment>
+<context-root>/brokerage</context-root>
+
+<resource-ref>
+ <ref-name>jdbc/TradeDB</ref-name>
+ <resource-link>TradeDS</resource-link>
+</resource-ref>
+</web-app>
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/geronimo/geronimo-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/geronimo/geronimo-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/geronimo/geronimo-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss-web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss-web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss-web.xml (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss-web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,25 @@
+<?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.
+-->
+<jboss-web>
+ <context-root>/brokerage</context-root>
+ <resource-ref>
+ <res-ref-name>jdbc/TradeDB</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <jndi-name>java:jdbc/TradeDB</jndi-name>
+ </resource-ref>
+</jboss-web>
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss/jboss-web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss/jboss-web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss/jboss-web.xml (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss/jboss-web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,25 @@
+<?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.
+-->
+<jboss-web>
+ <context-root>/brokerage</context-root>
+ <resource-ref>
+ <res-ref-name>jdbc/TradeDB</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <jndi-name>java:jdbc/TradeDB</jndi-name>
+ </resource-ref>
+</jboss-web>
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss/jboss-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss/jboss-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/jboss/jboss-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/web.xml (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,63 @@
+<?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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+<display-name>brokerage</display-name>
+<servlet>
+<display-name>Trade-Dispatcher</display-name>
+<servlet-name>TradeDispatcher</servlet-name>
+<servlet-class>com.dev.trade.servlet.TradeDispatcherServlet</servlet-class>
+</servlet>
+<servlet-mapping>
+<servlet-name>TradeDispatcher</servlet-name>
+<url-pattern>/login</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+<servlet-name>TradeDispatcher</servlet-name>
+<url-pattern>/stocks</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+<servlet-name>TradeDispatcher</servlet-name>
+<url-pattern>/userstocks</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+<servlet-name>TradeDispatcher</servlet-name>
+<url-pattern>/buy</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+<servlet-name>TradeDispatcher</servlet-name>
+<url-pattern>/sell</url-pattern>
+</servlet-mapping>
+<servlet-mapping>
+<servlet-name>TradeDispatcher</servlet-name>
+<url-pattern>/register</url-pattern>
+</servlet-mapping>
+<welcome-file-list>
+ <welcome-file>/login.jsp</welcome-file>
+</welcome-file-list>
+
+<error-page>
+ <exception-type>javax.servlet.ServletException</exception-type>
+ <location>/error.jsp</location>
+</error-page>
+<resource-ref>
+<res-ref-name>jdbc/TradeDB</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>
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/descriptors/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/error.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/jsps/error.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/jsps/error.jsp (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/jsps/error.jsp Fri Apr 11 13:48:31 2008
@@ -0,0 +1,30 @@
+<!--
+ 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.
+-->
+<%@ page language="java" isErrorPage="true" %>
+<html>
+<head>
+<Title>An Error Has Occurred</Title>
+</head>
+<body>
+
+<table align="center">
+<tr align="center"><Font size="6" color="red"><nobr>An Error Has Occurred. The Error is <%=exception.getMessage()%></nobr> </Font></tr>
+
+</table>
+
+</body>
+</html>
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/error.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/error.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/error.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/login.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/jsps/login.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/jsps/login.jsp (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/jsps/login.jsp Fri Apr 11 13:48:31 2008
@@ -0,0 +1,42 @@
+<!--
+ 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.
+-->
+<%@page language="java"%>
+<html>
+<head>
+<Title>Trader Login</Title>
+</head>
+<body>
+<form action="login" method="post">
+<table align="center" height="100%">
+<tr><td align="center"><font size="6">Online Brokerage</font></td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td><font size="4" color="red"><%=(session.getAttribute("status")==null)?"":session.getAttribute("status")%></font><td></tr>
+<tr><td valign="center">User Name</td><td><input type="text" name="user" value="<%=(request.getParameter("user")==null)?"":request.getParameter("user")%>"/></td></tr>
+<tr><td valign="center">Password</td><td><input type="password" name="password" value="<%=(request.getParameter("password")==null)?"":request.getParameter("password")%>"/></td></tr>
+<tr><td valign="center"><input type="submit" value="Login"/></td><td><input type="button" value="Register" onClick="window.location.href='register'"/></td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+</table>
+</form>
+</body>
+</html>
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/login.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/login.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/login.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/register.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/jsps/register.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/jsps/register.jsp (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/jsps/register.jsp Fri Apr 11 13:48:31 2008
@@ -0,0 +1,82 @@
+<!--
+ 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.
+-->
+<%@page language="java" import="com.dev.trade.bo.*" %>
+<html>
+<head>
+<Title>Trader Registration</Title>
+<script language="javascript">
+function verifyAndSubmit(){
+if(document.forms[0].user.value != "" && document.forms[0].name.value != "" &&
+ document.forms[0].password.value != "" && document.forms[0].address.value != "" &&
+ checkFloat(document.forms[0].cash.value))
+ {
+ document.forms[0].submit();
+ }else{
+ alert("Invalid Input");
+ }
+}
+function checkFloat(inp)
+{
+ var digits = "0123456789.";
+ var isNumber=true;
+ var digit;
+
+
+ for (i = 0; i < inp.length && isNumber == true; i++)
+ {
+ digit = inp.charAt(i);
+ if (digits.indexOf(digit) == -1)
+ {
+ isNumber = false;
+ }
+ }
+ return isNumber;
+
+}
+</script>
+</head>
+<body>
+<form action="register" method="post">
+<table align="center" height="100%" >
+<% if(request.getParameter("action")==null){
+ session.removeAttribute("user");
+ }
+%>
+<tr><td align="center"><font size="6">Online Brokerage - Registration</font></td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td><font size="4" color="red"><%=(session.getAttribute("status")==null)?"":session.getAttribute("status")%></font><td></tr>
+<%
+User user = (User)session.getAttribute("user");
+%>
+<tr><td>User Id</td><td><input type="text" name="user" value="<%=(user==null)?"":user.getUserId()%>" maxlength=15/></td></tr>
+<tr><td>User Name</td><td><input type="text" name="name" value="<%=(user==null)?"":user.getName()%>" maxlength=50/></td></tr>
+<tr><td>Password</td><td><input type="text" name="password" value="<%=(user==null)?"":user.getPassword()%>" maxlength=24/></td></tr>
+<tr><td>Address</td><td><input type="text" name="address" value="<%=(user==null)?"":user.getAddress()%>" maxlength=96/></td></tr>
+<tr><td>Cash</td><td><input type="text" name="cash" value="<%=(user==null)?0:user.getCash()%>" maxlength=9/></td></tr>
+
+<tr><td><input type="<%=(request.getParameter("action")==null)?"button":"hidden"%>" value="Register" onClick="verifyAndSubmit()"/></td><td></td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+</table>
+</form>
+</body>
+</html>
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/register.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/register.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/register.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/stocks.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/jsps/stocks.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/jsps/stocks.jsp (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/jsps/stocks.jsp Fri Apr 11 13:48:31 2008
@@ -0,0 +1,106 @@
+<!--
+ 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.
+-->
+<%@page language="java" import="java.util.List,com.dev.trade.bo.Stock" %>
+<html>
+<head>
+<Title>Available Stocks</Title>
+<script language="javascript">
+function setValues(index){
+if(typeof document.forms[0].buyQty[index] != "undefined"){
+document.forms[0].buyQuantity.value=document.forms[0].buyQty[index].value;
+document.forms[0].select.value=document.forms[0].sel[index].value;
+}else
+{
+document.forms[0].buyQuantity.value=document.forms[0].buyQty[index].value;
+document.forms[0].select.value=document.forms[0].sel[index].value;
+}
+
+//alert(document.forms[0].select.value);
+//alert(document.forms[0].buyQuantity.value);
+}
+function verify()
+{
+ if(document.forms[0].select.value == "" || document.forms[0].buyQuantity.value == "")
+ {
+ alert("Required field is empty");
+ }
+ else if(checkNumeric(document.forms[0].buyQuantity.value) == false)
+ {
+ alert("Quantity should be an integer");
+ }else if(document.forms[0].select.value != "" && document.forms[0].buyQuantity.value != ""){
+ document.forms[0].submit();
+ }
+
+
+}
+function checkNumeric(inp)
+
+{
+ var digits = "0123456789";
+ var isNumber=true;
+ var digit;
+
+
+ for (i = 0; i < inp.length && isNumber == true; i++)
+ {
+ digit = inp.charAt(i);
+ if (digits.indexOf(digit) == -1)
+ {
+ isNumber = false;
+ }
+ }
+ return isNumber;
+
+}
+function unselect(index)
+{
+if(typeof document.forms[0].buyQty[index] != "undefined"){
+document.forms[0].sel[index].checked = false;
+}else
+{
+document.forms[0].sel.checked = false;
+}
+}
+</script>
+</head>
+<body>
+<form action="buy" method="post" >
+<table align="center">
+<tr><td align="center"><font size="6">Online Brokerage - Available Stocks</font></td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td><font size="4" color="red"><%=(session.getAttribute("status")==null)?"":session.getAttribute("status")%></font><td></tr>
+<tr><td>Stock Name</td><td>Stock Price</td><td>Quantity</td><td>Buy</td></tr>
+<% List stocks = (List)session.getAttribute("stocks");
+ Stock stock = null;
+ for (int i=0;i<stocks.size();i++){
+ stock = (Stock)stocks.get(i);
+%>
+
+<tr><td><%=stock.getName()%></td><td><%=stock.getPrice()%></td><td><input type="text" name="buyQty" value="" onClick="javascript:unselect(<%=i%>)" maxlength=5/></td><td><input type="radio" name="sel" value="<%=stock.getId()%>" onClick="javascript:setValues(<%=i%>)"/></td></tr>
+<% }
+ %>
+<tr><td><input type="button" value="Buy Stock" onClick="verify()"/></td><td><input type="button" value="User Info" onClick="window.location.href='register?action=1'"/></td></tr>
+<tr><td><a href="userstocks">View your Portfolio</a></td></tr>
+</table>
+
+<input type="hidden" name="buyQuantity">
+<input type="hidden" name="select">
+</form>
+</body>
+</html>
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/stocks.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/stocks.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/stocks.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/userstocks.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/web/jsps/userstocks.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/web/jsps/userstocks.jsp (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/web/jsps/userstocks.jsp Fri Apr 11 13:48:31 2008
@@ -0,0 +1,109 @@
+<!--
+ 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.
+-->
+<%@page language="java" import="java.util.List,com.dev.trade.bo.*,com.dev.trade.dao.*" %>
+<html>
+<head>
+<Title>Portfolio</Title>
+<script language="javascript">
+
+function setValues(index){
+
+if(typeof document.forms[0].sellQty[index] != "undefined"){
+document.forms[0].sellQuantity.value=document.forms[0].sellQty[index].value;
+document.forms[0].select.value=document.forms[0].sel[index].value;
+}else
+{
+document.forms[0].sellQuantity.value=document.forms[0].sellQty.value;
+document.forms[0].select.value=document.forms[0].sel.value;
+}
+//alert(document.forms[0].select.value);
+//alert(document.forms[0].sellQuantity.value);
+}
+function verify()
+{
+ if(document.forms[0].select.value == "" || document.forms[0].sellQuantity.value == "")
+ {
+ alert("Required field is empty");
+ }
+ else if(checkNumeric(document.forms[0].sellQuantity.value) == false)
+ {
+ alert("Quantity should be an integer");
+ }else if(document.forms[0].select.value != "" && document.forms[0].sellQuantity.value != ""){
+ document.forms[0].submit();
+ }
+
+
+}
+function checkNumeric(inp)
+{
+ var digits = "0123456789";
+ var isNumber=true;
+ var digit;
+
+
+ for (i = 0; i < inp.length && isNumber == true; i++)
+ {
+ digit = inp.charAt(i);
+ if (digits.indexOf(digit) == -1)
+ {
+ isNumber = false;
+ }
+ }
+ return isNumber;
+
+}
+function unselect(index)
+{
+if(typeof document.forms[0].sellQty[index] != "undefined"){
+document.forms[0].sel[index].checked = false;
+}else
+{
+document.forms[0].sel.checked = false;
+}
+}
+</script>
+</head>
+<body>
+<form action="sell" method="post">
+<table align="center">
+
+<tr><td align="center"><font size="6">Online Brokerage - Portfolio</font></td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td> </td></tr>
+<tr><td><font size="4" color="red"><%=(session.getAttribute("status")==null)?"":session.getAttribute("status")%></font><td></tr>
+<tr><td>User Cash:</td><td><% User user = (User)session.getAttribute("user");
+ out.print(user.getCash() );%></td><tr>
+<tr><td>Stock Name</td><td>Stock Price</td><td>Quantity</td><td>Quantity to Sell</td><td>Select</td></tr>
+<% List stocks = (List)session.getAttribute("userStocks");
+ Stock stock = null;
+ for (int i=0;i<stocks.size();i++){
+ stock = (Stock)stocks.get(i);
+%>
+
+<tr><td><%=stock.getName()%></td><td><%=stock.getPrice()%></td><td><input type="text" name="quantity" value="<%=stock.getQuantity()%>" /></td><td><input type="text" name="sellQty" value="" onClick="javascript:unselect(<%=i%>)" maxlength=5/></td><td><input type="radio" name="sel" value="<%=stock.getId()%>" onClick="javascript:setValues(<%=i%>)"/></td></tr>
+<% }
+ %>
+<tr><td><input type="button" value="Sell Stock" onClick="verify()"/></td><td><input type="button" value="User Info" onClick="window.location.href='register?action=1'"/></td></tr>
+<tr><td><a href="stocks">View Available Stocks</a></td></tr>
+</table>
+
+<input type="hidden" name="sellQuantity">
+<input type="hidden" name="select">
+</form>
+</body>
+</html>
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/userstocks.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/userstocks.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/web/jsps/userstocks.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-servlets/WEB-INF/geronimo-web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-servlets/WEB-INF/geronimo-web.xml (added)
+++ geronimo/samples/branches/2.0/migration-servlets/WEB-INF/geronimo-web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,30 @@
+<?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.
+-->
+
+<web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/web-1.1" xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1" xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1" xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1">
+ <sys:environment>
+ <sys:moduleId>
+ <sys:groupId>j2g</sys:groupId>
+ <sys:artifactId>web-module</sys:artifactId>
+ <sys:version>1.0</sys:version>
+ <sys:type>war</sys:type>
+ </sys:moduleId>
+ <sys:dependencies/>
+ </sys:environment>
+ <context-root>college_fest</context-root>
+</web-app>
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/geronimo-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/jboss-web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-servlets/WEB-INF/jboss-web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-servlets/WEB-INF/jboss-web.xml (added)
+++ geronimo/samples/branches/2.0/migration-servlets/WEB-INF/jboss-web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,25 @@
+<?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.
+-->
+
+<jboss-web>
+
+ <context-root>college_fest</context-root>
+ <context-priority-classloader>
+ false
+ </context-priority-classloader>
+</jboss-web>
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/jboss-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/jboss-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/jboss-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-servlets/WEB-INF/web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-servlets/WEB-INF/web.xml (added)
+++ geronimo/samples/branches/2.0/migration-servlets/WEB-INF/web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,47 @@
+<?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.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <display-name>College Fest</display-name>
+
+
+ <servlet>
+ <display-name>WelcomeServlet</display-name>
+ <servlet-name>WelcomeServlet</servlet-name>
+ <servlet-class>servlets.WelcomeServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <display-name>PersonalServlet</display-name>
+ <servlet-name>PersonalServlet</servlet-name>
+ <servlet-class>servlets.PersonalServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>WelcomeServlet</servlet-name>
+ <url-pattern>/welcome</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>PersonalServlet</servlet-name>
+ <url-pattern>/personal</url-pattern>
+ </servlet-mapping>
+
+<welcome-file-list>
+ <welcome-file>jsp/index.html</welcome-file>
+</welcome-file-list>
+
+
+
+</web-app>
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-servlets/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-servlets/build.properties
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-servlets/build.properties?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-servlets/build.properties (added)
+++ geronimo/samples/branches/2.0/migration-servlets/build.properties Fri Apr 11 13:48:31 2008
@@ -0,0 +1,26 @@
+# 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.
+
+#Replace java.home with your jdk directory
+java.home=C:/Program Files/Java/jdk1.5.0_11
+
+#Replace j2ee.home with the parent directory of lib/j2ee.jar
+j2ee.home=C:/jboss-4.2.1.GA/server/default
+
+#Replace with jboss home directory
+jboss.server=C:/jboss-4.2.1.GA/server/default
+
+#geronimo home
+geronimo.home=C:/geronimo-jetty6-jee5-2.0.1
Propchange: geronimo/samples/branches/2.0/migration-servlets/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-servlets/build.properties
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-servlets/build.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-servlets/build.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-servlets/build.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-servlets/build.xml (added)
+++ geronimo/samples/branches/2.0/migration-servlets/build.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<!-- build file for building a war -->
+
+<project name="build" default="war" basedir=".">
+
+ <property file="build.properties"/>
+ <property name="src.dir" value="src"/>
+ <property name="dest.dir" value="bin"/>
+
+
+ <target name="clean" description="Delete all generated files.">
+ <echo message="Deleting bin folder" />
+ <delete dir="bin"/>
+ </target>
+
+ <target name="compile">
+ <mkdir dir="${dest.dir}"/>
+
+ <javac srcdir="${src.dir}" destdir="${dest.dir}">
+ <classpath path="${java.home}/lib/tools.jar"/>
+ <!--classpath path="${j2ee.home}/lib/j2ee.jar"/-->
+ <classpath path="${geronimo.home}/repository/org/apache/geronimo/specs/geronimo-servlet_2.5_spec/1.1/geronimo-servlet_2.5_spec-1.1.jar" />
+ </javac>
+ </target>
+
+ <target name="war" depends="compile">
+ <war destfile="college_fest.war" webxml="WEB-INF/web.xml">
+ <zipfileset dir="jsp" prefix="jsp"/>
+ <zipfileset dir="pix" prefix="pix"/>
+ <classes dir="${dest.dir}"/>
+ <webinf dir="WEB-INF" />
+ </war>
+</target>
+
+
+</project>
Propchange: geronimo/samples/branches/2.0/migration-servlets/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-servlets/build.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-servlets/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-servlets/jboss-build.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-servlets/jboss-build.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-servlets/jboss-build.xml (added)
+++ geronimo/samples/branches/2.0/migration-servlets/jboss-build.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<!-- build file for building a war -->
+
+<project name="build" default="war" basedir=".">
+
+ <property file="build.properties"/>
+ <property name="src.dir" value="src"/>
+ <property name="dest.dir" value="bin"/>
+
+ <target name="clean" description="Delete all generated files">
+ <echo message="Deleting bin directory" />
+ <delete dir="bin" />
+ </target>
+
+ <target name="compile">
+ <mkdir dir="${dest.dir}"/>
+ <javac srcdir="${src.dir}" destdir="${dest.dir}">
+ <classpath path="${java.home}/lib/tools.jar"/>
+ <classpath path="${j2ee.home}/lib/j2ee.jar"/>
+ </javac>
+ </target>
+
+ <target name="war" depends="compile">
+ <war destfile="college_fest.war" webxml="WEB-INF/web.xml">
+ <zipfileset dir="jsp" prefix="jsp"/>
+ <zipfileset dir="pix" prefix="pix"/>
+ <classes dir="${dest.dir}"/>
+ </war>
+ </target>
+
+ <target name="deploy" depends="war">
+ <copy file="college_fest.war" todir="${jboss.server}/deploy"/>
+ </target>
+
+ <target name="undeploy">
+ <delete file="${jboss.server}/deploy/college_fest.war"/>
+ </target>
+</project>
Propchange: geronimo/samples/branches/2.0/migration-servlets/jboss-build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-servlets/jboss-build.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-servlets/jboss-build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml