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 [6/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-hibernate/src/com/dev/trade/bo/UserStock.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/bo/UserStock.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/bo/UserStock.java (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/bo/UserStock.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,90 @@
+/*
+* 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;
+
+import java.io.Serializable;
+
+public class UserStock implements Serializable{
+ private String id = null;
+ private String name = null;
+ private float price = 0.0f;
+ private int quantity = 0;
+ private String userId = null;
+
+ public UserStock(String id, String name, float price, int quantity,String userId) {
+ super();
+ // TODO Auto-generated constructor stub
+ this.id = id;
+ this.name = name;
+ this.price = price;
+ this.quantity = quantity;
+ this.userId = userId;
+ }
+
+ public int getQuantity() {
+ return quantity;
+ }
+
+ public void setQuantity(int quantity) {
+ this.quantity = quantity;
+ }
+
+ public UserStock() {
+ super();
+ // TODO Auto-generated constructor stub
+ }
+
+ 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 String getUserId() {
+ return userId;
+ }
+
+ public void setUserId(String userId) {
+ this.userId = userId;
+ }
+
+ public boolean equals(Object obj) {
+ if(!(obj instanceof UserStock)) return false;
+ UserStock stock = (UserStock)obj;
+ if(this.id.equals(stock.getId()) && this.userId.equals(stock.getUserId()))
+ return true;
+ return false;
+ }
+
+ public int hashCode() {
+ return this.id.hashCode() ^ this.userId.hashCode();
+ }
+
+}
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/bo/UserStock.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/bo/UserStock.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/bo/UserStock.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/dao/TradeDAO.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/dao/TradeDAO.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/dao/TradeDAO.java (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/dao/TradeDAO.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,223 @@
+/*
+* 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.SQLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+
+import com.dev.trade.bo.Stock;
+import com.dev.trade.bo.User;
+import com.dev.trade.bo.UserStock;
+import com.dev.trade.exception.DBException;
+import com.dev.trade.util.HibernateUtil;
+
+public class TradeDAO {
+
+ SessionFactory factory = null;
+ Session session = null;
+
+ public TradeDAO() throws Exception {
+
+ try {
+ InitialContext ctx = new InitialContext();
+ factory = (SessionFactory)ctx.lookup("java:hibernate/BrokerageSessionFactory");
+
+ } catch (NamingException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+ public User getUserByUserId(String userId) throws DBException {
+
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from User u where u.userId=:userId");
+ q.setString("userId", userId);
+ return (User) q.uniqueResult();
+
+ }
+
+
+ public List getUserStocks(String userId) throws DBException {
+
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from UserStock u where u.userId=:userId");
+ q.setString("userId", userId);
+ List list = q.list();
+ return list;
+
+ }
+
+ public List getStocks() throws DBException {
+
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from Stock");
+ List stocks = q.list();
+ return stocks;
+
+ }
+
+ public float getUserCash(String userId) throws DBException {
+
+ User user = null;
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from User u where u.userId=:userId");
+ q.setString("userId", userId);
+ return ((User) q.uniqueResult()).getCash();
+
+ }
+
+ 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;
+
+ if (cashAvailable >= 0 && (availableStock != 0)) {
+ availableStock = availableStock + quantity;
+ setUserCash(userId, cashAvailable);
+ setUserStock(userId, stockId, availableStock);
+
+ } else if (cashAvailable >= 0 && (availableStock == 0)) {
+ availableStock = availableStock + quantity;
+ setUserCash(userId, cashAvailable);
+ addUserStock(userId, stockId, availableStock);
+
+ } else {
+ return false;
+ }
+ 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;
+ if (availableStock >= 0) {
+
+ setUserCash(userId, cashAvailable);
+ setUserStock(userId, stockId, availableStock);
+
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ public float getStockPrice(String stockId) throws DBException {
+
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from Stock s where s.id=:id");
+ q.setString("id", stockId);
+ Stock stock = (Stock) q.uniqueResult();
+ return stock.getPrice();
+
+ }
+
+ private boolean setUserCash(String userId, float cash) throws DBException {
+
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from User u where u.userId=:userId");
+ q.setString("userId", userId);
+ User user = (User) q.uniqueResult();
+ user.setCash(cash);
+ session.save(user);
+ return true;
+
+ }
+
+ // buy = true sell = false
+ private boolean setUserStock(String userId, String stockId, int quantity)
+ throws DBException {
+
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from UserStock u where u.userId=:userId and u.id=:id");
+ q.setString("userId", userId);
+ q.setString("id", stockId);
+ UserStock userStock = (UserStock) q.uniqueResult();
+ userStock.setQuantity(quantity);
+ if(quantity != 0){
+ session.save(userStock);
+ }else{
+ session.delete(userStock);
+ }
+ return true;
+
+ }
+
+ private boolean addUserStock(String userId, String stockId, int quantity)
+ throws DBException {
+
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from Stock s where s.id=:id");
+ q.setString("id", stockId);
+ Stock stock = (Stock) q.uniqueResult();
+ UserStock userStock = new UserStock(stock.getId(), stock.getName(), stock.getPrice(),quantity,userId);
+ session.save(userStock);
+ return true;
+
+ }
+
+ public int getStockQuantityForUser(String userId, String stockId)
+ throws DBException {
+
+ session = factory.getCurrentSession();
+ Query q = session.createQuery("from UserStock u where u.userId=:userId and u.id=:id");
+ q.setString("userId", userId);
+ q.setString("id", stockId);
+ UserStock userStock = (UserStock) q.uniqueResult();
+ if(userStock == null){
+ return 0;
+ }
+ return userStock.getQuantity();
+ }
+
+ public boolean addUser(String userId, String name, String password,
+ String address, float cash) throws DBException {
+ session = factory.getCurrentSession();
+ User user = new User();
+ user.setAddress(address);
+ user.setCash(cash);
+ user.setName(name);
+ user.setPassword(password);
+ user.setUserId(userId);
+ session.save(user);
+ return true;
+ }
+
+ public void remove() throws DBException {
+
+ }
+
+}
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/dao/TradeDAO.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/dao/TradeDAO.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/dao/TradeDAO.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/exception/DBException.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/exception/DBException.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/exception/DBException.java (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/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-hibernate/src/com/dev/trade/exception/DBException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/exception/DBException.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/exception/DBException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/servlet/TradeDispatcherServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/servlet/TradeDispatcherServlet.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/servlet/TradeDispatcherServlet.java (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/servlet/TradeDispatcherServlet.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,211 @@
+/*
+* 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.naming.InitialContext;
+import javax.naming.NamingException;
+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 org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.Transaction;
+
+import com.dev.trade.bo.User;
+import com.dev.trade.dao.TradeDAO;
+import com.dev.trade.exception.DBException;
+import com.dev.trade.util.HibernateUtil;
+
+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 {
+
+ Session hsession = null;
+ try {
+ InitialContext ctx = new InitialContext();
+ SessionFactory factory = (SessionFactory)ctx.lookup("java:hibernate/BrokerageSessionFactory");
+ hsession = factory.openSession();
+ } catch (NamingException e1) {
+ e1.printStackTrace();
+ }
+
+ Transaction tr = hsession.beginTransaction();
+
+ System.out.println("****************************Starting Transaction*****************");
+ 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);
+ }
+ System.out
+ .println("****************************Before End Transaction*****************");
+ tr.commit();
+ System.out
+ .println("****************************After End Transaction*****************");
+ request.getRequestDispatcher(page + ".jsp").forward(request,
+ response);
+ } catch (DBException e) {
+ // HibernateUtil.getCurrentSession().getTransaction().rollback();
+ throw new ServletException(e.getMessage());
+
+ } catch (Exception ex) {
+ // HibernateUtil.getCurrentSession().getTransaction().rollback();
+ ex.printStackTrace(System.out);
+ // 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-hibernate/src/com/dev/trade/servlet/TradeDispatcherServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/servlet/TradeDispatcherServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/servlet/TradeDispatcherServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/util/HibernateUtil.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/util/HibernateUtil.java?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/util/HibernateUtil.java (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/util/HibernateUtil.java Fri Apr 11 13:48:31 2008
@@ -0,0 +1,86 @@
+/*
+* 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.util;
+
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+
+/**
+ * Configures and provides access to Hibernate sessions, tied to the
+ * current thread of execution. Follows the Thread Local Session
+ * pattern, see {@link http://hibernate.org/42.html}.
+ */
+public class HibernateUtil {
+
+ /** location of the Hibernate Configuration File */
+ private static String CONFIG_FILE_LOCATION = "hibernate.cfg.xml";
+
+ /** Holds a single instance of Session */
+ private static final ThreadLocal threadLocal = new ThreadLocal();
+
+ /** The single instance of hibernate configuration */
+ private static final Configuration cfg = new Configuration();
+
+ /** The single instance of hibernate SessionFactory */
+ private static org.hibernate.SessionFactory sessionFactory;
+
+ /**
+ * Returns the ThreadLocal Session instance. Lazy initialize
+ * the <code>SessionFactory</code> if needed.
+ *
+ * @return Session
+ * @throws HibernateException
+ */
+ public static Session getCurrentSession() throws HibernateException {
+ Session session = (Session) threadLocal.get();
+
+ if (session == null || ! session.isConnected()) {
+ if (sessionFactory == null) {
+ try {
+ cfg.configure(CONFIG_FILE_LOCATION);
+ sessionFactory = cfg.buildSessionFactory();
+ }
+ catch (Exception e) {
+ System.err.println("%%%% Error Creating SessionFactory %%%%");
+ e.printStackTrace();
+ }
+ }
+ session = sessionFactory.openSession();
+ threadLocal.set(session);
+ }
+
+ return session;
+ }
+
+ /**
+ * Close the single hibernate session instance.
+ *
+ * @throws HibernateException
+ */
+ public static void closeSession() throws HibernateException {
+ Session session = (Session) threadLocal.get();
+
+
+ if (session != null) {
+ session.close();
+ }
+ }
+
+
+
+}
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/util/HibernateUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/util/HibernateUtil.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/src/com/dev/trade/util/HibernateUtil.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/geronimo/geronimo-web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/geronimo/geronimo-web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/geronimo/geronimo-web.xml (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/geronimo/geronimo-web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,49 @@
+<?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>database-pool-HibernateDB</dep:artifactId>
+ <dep:version>2.0</dep:version>
+ <dep:type>car</dep:type>
+ </dep:dependency>
+ </dep:dependencies>
+
+ <dep:hidden-classes>
+ <dep:filter>org.springframework</dep:filter>
+ <dep:filter>META-INF/spring</dep:filter>
+ <!--dep:filter>antlr</dep:filter-->
+ </dep:hidden-classes>
+ </dep:environment>
+
+ <context-root>/brokerage</context-root>
+
+ <resource-ref>
+ <ref-name>jdbc/HibernateDB</ref-name>
+ <resource-link>HibernateDS</resource-link>
+ </resource-ref>
+</web-app>
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/geronimo/geronimo-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/geronimo/geronimo-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/geronimo/geronimo-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/jboss/jboss-web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/jboss/jboss-web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/jboss/jboss-web.xml (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/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/HibernateDB</res-ref-name>
+ <res-type>javax.sql.DataSource</res-type>
+ <jndi-name>jdbc/HibernateDS</jndi-name>
+ </resource-ref>
+</jboss-web>
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/jboss/jboss-web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/jboss/jboss-web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/jboss/jboss-web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/web.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/web.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/web.xml (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/web.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,69 @@
+<?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> -->
+<resource-ref>
+ <res-ref-name>jdbc/HibernateDB</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-hibernate/web/descriptors/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/web.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/descriptors/web.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/error.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/web/jsps/error.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/web/jsps/error.jsp (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/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-hibernate/web/jsps/error.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/error.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/error.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/login.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/web/jsps/login.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/web/jsps/login.jsp (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/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-hibernate/web/jsps/login.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/login.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/login.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/register.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/web/jsps/register.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/web/jsps/register.jsp (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/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-hibernate/web/jsps/register.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/register.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/register.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/stocks.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/web/jsps/stocks.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/web/jsps/stocks.jsp (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/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-hibernate/web/jsps/stocks.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/stocks.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/stocks.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/userstocks.jsp
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-hibernate/web/jsps/userstocks.jsp?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-hibernate/web/jsps/userstocks.jsp (added)
+++ geronimo/samples/branches/2.0/migration-hibernate/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.*" %>
+<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");
+ UserStock stock = null;
+ for (int i=0;i<stocks.size();i++){
+ stock = (UserStock)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>
\ No newline at end of file
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/userstocks.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/userstocks.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-hibernate/web/jsps/userstocks.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/LICENSE.txt?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/LICENSE.txt (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/LICENSE.txt Fri Apr 11 13:48:31 2008
@@ -0,0 +1,350 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] The Apache Software Foundation
+
+ Licensed 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.
+
+=========================================================================
+J2G, Commons Logging, commons-el, jasper-runtime, jasper-compiler,
+jasper-compiler-jdt, geronimo-jsp_spec, and geronimo-servlet-spec use the
+above Apache License v2.0.
+=========================================================================
+
+=========================================================================
+== Dom4j License ==
+=========================================================================
+
+Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+
+Redistribution and use of this software and associated documentation
+("Software"), with or without modification, are permitted provided
+that the following conditions are met:
+
+1. Redistributions of source code must retain copyright
+ statements and notices. Redistributions must also contain a
+ copy of this document.
+
+2. Redistributions in binary form must reproduce the
+ above copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+3. The name "DOM4J" must not be used to endorse or promote
+ products derived from this Software without prior written
+ permission of MetaStuff, Ltd. For written permission,
+ please contact dom4j-info@metastuff.com.
+
+4. Products derived from this Software may not be called "DOM4J"
+ nor may "DOM4J" appear in their names without prior written
+ permission of MetaStuff, Ltd. DOM4J is a registered
+ trademark of MetaStuff, Ltd.
+
+5. Due credit should be given to the DOM4J Project -
+ http://www.dom4j.org
+
+THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
+``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=========================================================================
+== Jaxen License ==
+=========================================================================
+
+ Copyright 2003-2006 The Werken Company. All Rights Reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the name of the Jaxen Project nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
+OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+=========================================================================
+== PullParser License ==
+=========================================================================
+
+Copyright 2002 The Trustees of Indiana University.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+1) All redistributions of source code must retain the above
+ copyright notice, the list of authors in the original source
+ code, this list of conditions and the disclaimer listed in this
+ license;
+
+2) All redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the disclaimer
+ listed in this license in the documentation and/or other
+ materials provided with the distribution;
+
+3) Any documentation included with all redistributions must include
+ the following acknowledgement:
+
+ "This product includes software developed by the Indiana
+ University Extreme! Lab. For further information please visit
+ http://www.extreme.indiana.edu/"
+
+ Alternatively, this acknowledgment may appear in the software
+ itself, and wherever such third-party acknowledgments normally
+ appear.
+
+4) The name "Indiana Univeristy" and "Indiana Univeristy
+ Extreme! Lab" shall not be used to endorse or promote
+ products derived from this software without prior written
+ permission from Indiana University. For written permission,
+ please contact http://www.extreme.indiana.edu/.
+
+5) Products derived from this software may not use "Indiana
+ Univeristy" name nor may "Indiana Univeristy" appear in their name,
+ without prior written permission of the Indiana University.
+
+Indiana University provides no reassurances that the source code
+provided does not infringe the patent or any other intellectual
+property rights of any other entity. Indiana University disclaims any
+liability to any recipient for claims brought by any other entity
+based on infringement of intellectual property rights or otherwise.
+
+LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH
+NO WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA
+UNIVERSITY GIVES NO WARRANTIES AND MAKES NO REPRESENTATION THAT
+SOFTWARE IS FREE OF INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR
+OTHER PROPRIETARY RIGHTS. INDIANA UNIVERSITY MAKES NO WARRANTIES THAT
+SOFTWARE IS FREE FROM "BUGS", "VIRUSES", "TROJAN HORSES", "TRAP
+DOORS", "WORMS", OR OTHER HARMFUL CODE. LICENSEE ASSUMES THE ENTIRE
+RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR ASSOCIATED MATERIALS,
+AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION GENERATED USING
+SOFTWARE.
+
+
+
+
+
Propchange: geronimo/samples/branches/2.0/migration-jdbc/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/LICENSE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/LICENSE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/NOTICE.txt?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/NOTICE.txt (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/NOTICE.txt Fri Apr 11 13:48:31 2008
@@ -0,0 +1,46 @@
+=========================================================================
+== NOTICE file corresponding to section 4(d) of the Apache License, ==
+== Version 2.0, in this case for the Apache Geronimo distribution. ==
+=========================================================================
+
+Apache Geronimo
+Copyright 2003-2007 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+Portions of the J2G Conversion Tool were orginally developed by International
+Business Machines Corporation and are licensed to the Apache Software
+Foundation under the "Software Grant and Corporate Contribution License
+Agreement", informally known as the "IBM Console CLA".
+
+=========================================================================
+== Commons-logging Notice ==
+=========================================================================
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+
+
+=========================================================================
+== Dom4j Notice ==
+=========================================================================
+
+Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+
+=========================================================================
+== Jaxen Notice ==
+=========================================================================
+
+Copyright 2003-2006 The Werken Company. All Rights Reserved.
+
+=========================================================================
+== PullParser Notice ==
+=========================================================================
+
+Copyright 2002 The Trustees of Indiana University.
+All rights reserved.
+
+This product includes software developed by the Indiana
+University Extreme! Lab. For further information please visit
+http://www.extreme.indiana.edu/
+
Propchange: geronimo/samples/branches/2.0/migration-jdbc/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/NOTICE.txt
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/NOTICE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/build.properties
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/build.properties?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/build.properties (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/build.properties Fri Apr 11 13:48:31 2008
@@ -0,0 +1,35 @@
+# 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 server.name with either jboss or geronimo depending on which server to deploy.
+server.name=jboss
+#Replace <JAVA_HOME> with your JDK home directory
+java.home=<JAVA_HOME>
+#Replace <JBOSS_HOME> with the root directory for your specific JBoss server <jboss_home>\servers\<server_name>
+jboss.home=<JBOSS_HOME>
+#Replace <GERONIMO_HOME> with the root directory for Geronimo
+geronimo.home=<GERONIMO_HOME>
+#fully qualified name of the JDBC driver class
+db.driver=com.mysql.jdbc.Driver
+#database URL
+db.url=jdbc:mysql://localhost:3306/tradedb
+#database userId
+db.userid=root
+#database password
+db.password=password
+#script files for creating the tables
+sql.file=sql/db.sql
+#location of the jdbc driver jar.
+driver.classpath=<JBOSS_HOME>/server/<YOUR_SERVER/lib/mysql-connector-java-3.1.14-bin.jar
Propchange: geronimo/samples/branches/2.0/migration-jdbc/build.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/build.properties
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/build.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/2.0/migration-jdbc/build.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/build.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/build.xml (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/build.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,66 @@
+<?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 the brokerage war and populate the database -->
+
+<project name="build" default="populateDB" basedir=".">
+
+ <property file="build.properties"/>
+ <property name="src.dir" value="src"/>
+ <property name="dest.dir" value="bin"/>
+
+
+ <target name="init" description="Delete all generated files">
+ <echo message="Deleting War"/>
+ <delete file="brokerage.war"/>
+ </target>
+ <target name="compile" depends="init">
+ <echo message="Creating bin directory"/>
+ <mkdir dir="${dest.dir}"/>
+ <echo message="Compiling Files"/>
+ <javac srcdir="${src.dir}" destdir="${dest.dir}">
+ <classpath path="${java.home}/lib/tools.jar"/>
+ <classpath path="${jboss.home}/lib/jboss-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">
+ <echo message="Preparing war"/>
+ <war destfile="brokerage.war" webxml="web/descriptors/web.xml">
+ <fileset dir="web/jsps"/>
+ <webinf dir="web/descriptors/${server.name}"/>
+ <lib dir="libs"/>
+ <classes dir="${dest.dir}"/>
+ </war>
+ </target>
+ <target name="populateDB" depends="war">
+ <echo message="Populating Database"/>
+ <sql
+ driver="${db.driver}"
+ url="${db.url}"
+ userid="${db.userid}"
+ password="${db.password}"
+ src="${sql.file}"
+ print="yes"
+ output="outputfile.txt"
+ >
+ <classpath>
+ <pathelement location="${driver.classpath}"/>
+ </classpath>
+ </sql>
+ </target>
+</project>
Propchange: geronimo/samples/branches/2.0/migration-jdbc/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/build.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/build.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-ds.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-ds.xml?rev=647303&view=auto
==============================================================================
--- geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-ds.xml (added)
+++ geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-ds.xml Fri Apr 11 13:48:31 2008
@@ -0,0 +1,35 @@
+<?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.
+-->
+
+<!-- $Id: mysql-ds.xml,v 1.3.2.1 2004/12/01 11:46:00 schrouf Exp $ -->
+<!-- Datasource config for MySQL using 3.0.9 available from:
+http://www.mysql.com/downloads/api-jdbc-stable.html
+-->
+
+<datasources>
+
+ <local-tx-datasource>
+ <jndi-name>jdbc/TradeDB</jndi-name>
+ <connection-url>jdbc:mysql://localhost:3306/tradedb</connection-url>
+ <driver-class>com.mysql.jdbc.Driver</driver-class>
+ <user-name>root</user-name>
+ <password>password</password>
+ <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
+ </local-tx-datasource>
+ </datasources>
+
Propchange: geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-ds.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-ds.xml
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/2.0/migration-jdbc/plan/mysql-ds.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml