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/03/22 22:28:59 UTC
svn commit: r640084 - in /geronimo/samples/branches/1.0/migration-ejb-bmp:
./ dd/ dd/META-INF/ src/com/ src/org/ src/org/apache/
src/org/apache/geronimo/ src/org/apache/geronimo/entity/
src/org/apache/geronimo/entity/bmp/ src/org/apache/geronimo/entity...
Author: ecraig
Date: Sat Mar 22 14:28:58 2008
New Revision: 640084
URL: http://svn.apache.org/viewvc?rev=640084&view=rev
Log:
Removed IBM references from classnames and code
Added:
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerBean.java (with props)
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerHomeRemote.java (with props)
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerRemote.java (with props)
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/EntityBeanClient.java (with props)
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/
geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/PublisherServlet.java (with props)
Removed:
geronimo/samples/branches/1.0/migration-ejb-bmp/src/com/
Modified:
geronimo/samples/branches/1.0/migration-ejb-bmp/dd/META-INF/ejb-jar.xml
geronimo/samples/branches/1.0/migration-ejb-bmp/dd/customer-ejb.xml
geronimo/samples/branches/1.0/migration-ejb-bmp/maven.xml
Modified: geronimo/samples/branches/1.0/migration-ejb-bmp/dd/META-INF/ejb-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/1.0/migration-ejb-bmp/dd/META-INF/ejb-jar.xml?rev=640084&r1=640083&r2=640084&view=diff
==============================================================================
--- geronimo/samples/branches/1.0/migration-ejb-bmp/dd/META-INF/ejb-jar.xml (original)
+++ geronimo/samples/branches/1.0/migration-ejb-bmp/dd/META-INF/ejb-jar.xml Sat Mar 22 14:28:58 2008
@@ -28,16 +28,16 @@
This bean represents customer
</description>
<ejb-name>CustomerEJB</ejb-name>
- <home>com.ibm.demo.entity.bmp.CustomerHomeRemote</home>
- <remote>com.ibm.demo.entity.bmp.CustomerRemote</remote>
- <ejb-class>com.ibm.demo.entity.bmp.CustomerBean</ejb-class>
+ <home>org.apache.geronimo.demo.entity.bmp.CustomerHomeRemote</home>
+ <remote>org.apache.geronimo.demo.entity.bmp.CustomerRemote</remote>
+ <ejb-class>org.apache.geronimo.demo.entity.bmp.CustomerBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<reentrant>False</reentrant>
<security-identity><use-caller-identity/></security-identity>
<resource-ref>
<description>DataSource for Demo Database</description>
- <res-ref-name>jdbc/ibm-demo</res-ref-name>
+ <res-ref-name>jdbc/geronimo-demo</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Modified: geronimo/samples/branches/1.0/migration-ejb-bmp/dd/customer-ejb.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/1.0/migration-ejb-bmp/dd/customer-ejb.xml?rev=640084&r1=640083&r2=640084&view=diff
==============================================================================
--- geronimo/samples/branches/1.0/migration-ejb-bmp/dd/customer-ejb.xml (original)
+++ geronimo/samples/branches/1.0/migration-ejb-bmp/dd/customer-ejb.xml Sat Mar 22 14:28:58 2008
@@ -29,7 +29,7 @@
<jndi-name>CustomerHomeRemote</jndi-name>
<local-jndi-name>CustomerRemote</local-jndi-name>
<resource-ref>
- <ref-name>jdbc/ibm-demo</ref-name>
+ <ref-name>jdbc/geronimo-demo</ref-name>
<resource-link>SystemDatasource</resource-link>
</resource-ref>
</entity>
Modified: geronimo/samples/branches/1.0/migration-ejb-bmp/maven.xml
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/1.0/migration-ejb-bmp/maven.xml?rev=640084&r1=640083&r2=640084&view=diff
==============================================================================
--- geronimo/samples/branches/1.0/migration-ejb-bmp/maven.xml (original)
+++ geronimo/samples/branches/1.0/migration-ejb-bmp/maven.xml Sat Mar 22 14:28:58 2008
@@ -51,7 +51,7 @@
<goal name="run:client">
<!--<attainGoal name="jboss:start"/>-->
- <ant:java classname="com.ibm.demo.entity.client.EntityBeanClient"
+ <ant:java classname="org.apache.geronimo.demo.entity.client.EntityBeanClient"
fork="true"
failonerror="true"
classpathref="client.classpath">
Added: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerBean.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerBean.java?rev=640084&view=auto
==============================================================================
--- geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerBean.java (added)
+++ geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerBean.java Sat Mar 22 14:28:58 2008
@@ -0,0 +1,543 @@
+/*
+ * 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.
+ */
+/*
+ * Created on Sep 26, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.geronimo.entity.bmp;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Date;
+import java.util.Collection;
+import java.util.ArrayList;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBException;
+import javax.ejb.EntityBean;
+import javax.ejb.EntityContext;
+import javax.ejb.FinderException;
+import javax.ejb.ObjectNotFoundException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+/**
+ * @author cpineda
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class CustomerBean implements EntityBean {
+
+ public Integer id;
+
+ public String name;
+
+ public String address;
+
+ public Date birthdate;
+
+ public String sssNo;
+
+ public Double annualSalary;
+
+ public Double loanAmount;
+
+ public EntityContext context;
+
+ /**
+ *
+ * @param id
+ * @param name
+ * @param sssNo
+ * @param address
+ * @param birthdate
+ * @param annualSalary
+ * @param loanAmount
+ * @return
+ * @throws CreateException
+ */
+ public Integer ejbCreate(Integer id, String name, String sssNo,
+ String address, Date birthdate, Double annualSalary,
+ Double loanAmount) throws CreateException {
+ String insertQuery = "INSERT INTO CUSTOMER "
+ + "(ID,NAME,SSS_NO,BIRTHDATE,ADDRESS,ANNUAL_SALARY,LOAN_AMOUNT)"
+ + " VALUES (?,?,?,?,?,?,?)";
+ this.id = id;
+ this.name = name;
+ this.birthdate = birthdate;
+ this.sssNo = sssNo;
+ this.address = address;
+ this.annualSalary = annualSalary;
+ this.loanAmount = loanAmount;
+ Connection conn = null;
+ PreparedStatement ps = null;
+ try {
+ conn = this.getConnection();
+ ps = conn.prepareStatement(insertQuery);
+ ps.setInt(1, id.intValue());
+ ps.setString(2, name);
+ ps.setString(3, sssNo);
+ ps.setDate(4, new java.sql.Date(birthdate.getTime()));
+ ps.setString(5, address);
+ ps.setDouble(6, annualSalary.doubleValue());
+ ps.setDouble(7, loanAmount.doubleValue());
+ if (ps.executeUpdate() != 1) {
+ throw new CreateException("Failed to Add Customer");
+ }
+ } catch (SQLException se) {
+ throw new EJBException(se);
+ } finally {
+ try {
+ ps.close();
+ } catch (Exception e) {
+ }
+ try {
+ conn.close();
+ } catch (Exception e) {
+ }
+ }
+ return id;
+ }
+
+ /**
+ *
+ * @param id
+ * @return
+ * @throws CreateException
+ */
+ public Integer ejbCreate(Integer id) throws CreateException {
+ String insertQuery = "INSERT INTO CUSTOMER " + "(ID)" + " VALUES (?)";
+ this.id = id;
+ Connection conn = null;
+ PreparedStatement ps = null;
+ try {
+ conn = this.getConnection();
+ ps = conn.prepareStatement(insertQuery);
+ ps.setInt(1, id.intValue());
+ if (ps.executeUpdate() != 1) {
+ throw new CreateException("Failed to Add Customer");
+ }
+ } catch (SQLException se) {
+ se.printStackTrace();
+ throw new EJBException(se);
+ } finally {
+ try {
+ ps.close();
+ } catch (Exception e) {
+ }
+ try {
+ conn.close();
+ } catch (Exception e) {
+ }
+ }
+ return id;
+ }
+
+ /**
+ *
+ * @param id
+ * @param name
+ * @param sssNo
+ * @param address
+ * @param birthdate
+ * @param annualSalary
+ * @param loanAmount
+ */
+ public void ejbPostCreate(Integer id, String name, String sssNo,
+ String address, Date birthdate, Double annualSalary,
+ Double loanAmount) {
+
+ }
+
+ /**
+ *
+ * @param id
+ */
+ public void ejbPostCreate(Integer id) {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
+ */
+ public void setEntityContext(EntityContext context) {
+ this.context = context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see javax.ejb.EntityBean#unsetEntityContext()
+ */
+ public void unsetEntityContext() {
+ this.context = null;
+ }
+
+ /**
+ *
+ * @param primaryKey
+ * @return
+ * @throws FinderException
+ */
+ public Integer ejbFindByPrimaryKey(Integer primaryKey)
+ throws FinderException {
+ Connection conn = null;
+ PreparedStatement ps = null;
+ ResultSet result = null;
+ String query = "SELECT ID FROM CUSTOMER WHERE ID=?";
+
+ try {
+ conn = this.getConnection();
+ ps = conn.prepareStatement(query);
+ ps.setInt(1, primaryKey.intValue());
+ result = ps.executeQuery();
+ if (!result.next()) {
+ throw new ObjectNotFoundException(
+ "Customer not found with ID: " + primaryKey);
+ }
+ } catch (SQLException se) {
+ throw new EJBException(se);
+ } finally {
+ try {
+ result.close();
+ } catch (Exception e) {
+ }
+ try {
+ ps.close();
+ } catch (Exception e) {
+ }
+ try {
+ conn.close();
+ } catch (Exception e) {
+ }
+ }
+ return primaryKey;
+ }
+
+ /**
+ *
+ * @param sssNo
+ * @return
+ * @throws FinderException
+ */
+ public Integer ejbFindBySssNo(String sssNo) throws FinderException {
+ Connection conn = null;
+ PreparedStatement ps = null;
+ ResultSet result = null;
+ String query = "SELECT ID FROM CUSTOMER WHERE SSS_NO=?";
+ int customerId;
+
+ try {
+ conn = this.getConnection();
+ ps = conn.prepareStatement(query);
+ ps.setString(1, sssNo);
+ result = ps.executeQuery();
+ if (!result.next()) {
+ throw new ObjectNotFoundException(
+ "Customer not found with SSS_NO:" + sssNo);
+ } else {
+ customerId = result.getInt(1);
+ }
+ if (result.next()) {
+ // Invalid state duplicate entry for unique index
+ throw new SQLException(
+ "Invalid database state.Duplicate entries for unique index SSS_NO");
+ }
+ } catch (SQLException se) {
+ throw new EJBException(se);
+ } finally {
+ try {
+ result.close();
+ } catch (Exception e) {
+ }
+ try {
+ ps.close();
+ } catch (Exception e) {
+ }
+ try {
+ conn.close();
+ } catch (Exception e) {
+ }
+ }
+ return new Integer(customerId);
+ }
+
+ /**
+ *
+ * @return
+ * @throws FinderException
+ */
+ public Collection ejbFindAll() throws FinderException {
+ Collection ret = new ArrayList();
+ Connection conn = null;
+ PreparedStatement ps = null;
+ ResultSet result = null;
+ String query = "SELECT ID FROM CUSTOMER";
+
+ try {
+ conn = this.getConnection();
+ ps = conn.prepareStatement(query);
+ result = ps.executeQuery();
+ while (result.next()) {
+ ret.add(new Integer(result.getInt(1)));
+ }
+ } catch (SQLException se) {
+ throw new EJBException(se);
+ } finally {
+ try {
+ result.close();
+ } catch (Exception e) {
+ }
+ try {
+ ps.close();
+ } catch (Exception e) {
+ }
+ try {
+ conn.close();
+ } catch (Exception e) {
+ }
+ }
+ return ret;
+ }
+
+ public void ejbActivate() {
+ // Not implemented.
+ }
+
+ public void ejbPassivate() {
+ // Not implemented.
+ }
+
+ public void ejbLoad() {
+
+ Integer primaryKey = (Integer) context.getPrimaryKey();
+ Connection conn = null;
+ PreparedStatement ps = null;
+ ResultSet result = null;
+ String query = "SELECT NAME,BIRTHDATE,SSS_NO,ADDRESS,ANNUAL_SALARY,LOAN_AMOUNT"
+ + " FROM CUSTOMER WHERE ID=?";
+ try {
+ conn = this.getConnection();
+ ps = conn.prepareStatement(query);
+ ps.setInt(1, primaryKey.intValue());
+ result = ps.executeQuery();
+
+ if (result.next()) {
+ this.id = primaryKey;
+ this.name = result.getString(1);
+ this.birthdate = new Date(result.getDate(2).getTime());
+ this.sssNo = result.getString(3);
+ this.address = result.getString(4);
+ this.annualSalary = new Double(result.getDouble(5));
+ this.loanAmount = new Double(result.getDouble(6));
+
+ } else {
+ throw new EJBException();
+ }
+ } catch (SQLException se) {
+ throw new EJBException(se);
+ } finally {
+ try {
+ result.close();
+ } catch (Exception e) {
+ }
+ try {
+ ps.close();
+ } catch (Exception e) {
+ }
+ try {
+ conn.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ public void ejbStore() {
+ String updateQuery = "UPDATE CUSTOMER SET NAME=?, BIRTHDATE=?, SSS_NO=?, ADDRESS=?,ANNUAL_SALARY=?,LOAN_AMOUNT=? WHERE ID=?";
+ Connection conn = null;
+ PreparedStatement ps = null;
+ try {
+ conn = this.getConnection();
+ ps = conn.prepareStatement(updateQuery);
+ ps.setString(1, name);
+ ps.setDate(2, new java.sql.Date(birthdate.getTime()));
+ ps.setString(3, sssNo);
+ ps.setString(4, address);
+ ps.setDouble(5, annualSalary.doubleValue());
+ ps.setDouble(6, loanAmount.doubleValue());
+ ps.setInt(7, id.intValue());
+ ps.executeUpdate();
+ /*
+ * if (ps.executeUpdate() != 1) { throw new EJBException("ejbStore
+ * unable to update table"); }
+ */
+ } catch (SQLException se) {
+ se.printStackTrace();
+ throw new EJBException(se);
+ } finally {
+ try {
+ ps.close();
+ } catch (Exception e) {
+ }
+ try {
+ conn.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ public void ejbRemove() {
+ String deleteQuery = "DELETE FROM CUSTOMER WHERE ID=?";
+ Connection conn = null;
+ PreparedStatement ps = null;
+ try {
+ conn = this.getConnection();
+ ps = conn.prepareStatement(deleteQuery);
+ ps.setInt(1, id.intValue());
+ if (ps.executeUpdate() != 1) {
+ throw new EJBException("ejbStore unable to update table");
+ }
+ } catch (SQLException se) {
+ throw new EJBException(se);
+ } finally {
+ try {
+ ps.close();
+ } catch (Exception e) {
+ }
+ try {
+ conn.close();
+ } catch (Exception e) {
+ }
+ }
+ }
+
+ /**
+ *
+ * @return
+ * @throws SQLException
+ */
+ private Connection getConnection() throws SQLException {
+ try {
+ Context jndiCntx = new InitialContext();
+ DataSource ds = (DataSource) jndiCntx
+ .lookup("java:comp/env/jdbc/geronimo-demo");
+ return ds.getConnection();
+ } catch (NamingException ne) {
+ ne.printStackTrace();
+ throw new EJBException(ne);
+ }
+ }
+
+ /**
+ * @return Returns the address.
+ */
+ public String getAddress() {
+ return address;
+ }
+
+ /**
+ * @param address
+ * The address to set.
+ */
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ /**
+ * @return Returns the annualSalary.
+ */
+ public Double getAnnualSalary() {
+ return annualSalary;
+ }
+
+ /**
+ * @param annualSalary
+ * The annualSalary to set.
+ */
+ public void setAnnualSalary(Double annualSalary) {
+ this.annualSalary = annualSalary;
+ }
+
+ /**
+ * @return Returns the birthdate.
+ */
+ public Date getBirthdate() {
+ return birthdate;
+ }
+
+ /**
+ * @param birthdate
+ * The birthdate to set.
+ */
+ public void setBirthdate(Date birthdate) {
+ this.birthdate = birthdate;
+ }
+
+ /**
+ * @return Returns the loanAmount.
+ */
+ public Double getLoanAmount() {
+ return loanAmount;
+ }
+
+ /**
+ * @param loanAmount
+ * The loanAmount to set.
+ */
+ public void setLoanAmount(Double loanAmount) {
+ this.loanAmount = loanAmount;
+ }
+
+ /**
+ * @return Returns the name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name
+ * The name to set.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @return Returns the sssNo.
+ */
+ public String getSssNo() {
+ return sssNo;
+ }
+
+ /**
+ * @param sssNo
+ * The sssNo to set.
+ */
+ public void setSssNo(String sssNo) {
+ this.sssNo = sssNo;
+ }
+}
\ No newline at end of file
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerBean.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerBean.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerHomeRemote.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerHomeRemote.java?rev=640084&view=auto
==============================================================================
--- geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerHomeRemote.java (added)
+++ geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerHomeRemote.java Sat Mar 22 14:28:58 2008
@@ -0,0 +1,89 @@
+/*
+* 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.
+*/
+/*
+ * Created on Sep 26, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.geronimo.entity.bmp;
+
+import java.rmi.RemoteException;
+import java.util.Date;
+import java.util.Collection;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+import javax.ejb.FinderException;
+
+/**
+ * @author cpineda
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public interface CustomerHomeRemote extends EJBHome {
+
+ /**
+ *
+ * @param id
+ * @param name
+ * @param sssNo
+ * @param address
+ * @param birthdate
+ * @param annualSalary
+ * @param loanAmount
+ * @return
+ * @throws CreateException
+ * @throws RemoteException
+ */
+ public CustomerRemote create(Integer id,String name,String sssNo,String address,Date birthdate,
+ Double annualSalary,Double loanAmount) throws CreateException,RemoteException;
+
+ /**
+ *
+ * @param primaryKey
+ * @return
+ * @throws CreateException
+ * @throws RemoteException
+ */
+ public CustomerRemote create(Integer primaryKey)throws CreateException,RemoteException;
+
+ /**
+ *
+ * @param pk
+ * @return @throws
+ * FinderException
+ * @throws RemoteException
+ */
+ public CustomerRemote findByPrimaryKey(Integer pk) throws FinderException,
+ RemoteException;
+
+ public Collection findAll() throws FinderException,
+ RemoteException;
+
+ /**
+ *
+ * @param sssNo
+ * @return @throws
+ * FinderException
+ * @throws RemoteException
+ */
+ public CustomerRemote findBySssNo(String sssNo) throws FinderException,
+ RemoteException;
+
+}
\ No newline at end of file
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerHomeRemote.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerHomeRemote.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerHomeRemote.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerRemote.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerRemote.java?rev=640084&view=auto
==============================================================================
--- geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerRemote.java (added)
+++ geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerRemote.java Sat Mar 22 14:28:58 2008
@@ -0,0 +1,58 @@
+/*
+* 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.
+*/
+/*
+ * Created on Sep 26, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.geronimo.entity.bmp;
+
+import java.util.Date;
+
+import javax.ejb.EJBObject;
+import java.rmi.RemoteException;
+
+/**
+ * @author cpineda
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public interface CustomerRemote extends EJBObject {
+
+
+ public void setName(String name) throws RemoteException;
+ public String getName() throws RemoteException;
+
+ public void setSssNo(String sssNo) throws RemoteException;
+ public String getSssNo() throws RemoteException;
+
+ public void setAddress(String address) throws RemoteException;
+ public String getAddress() throws RemoteException;
+
+ public void setBirthdate(Date birthdate) throws RemoteException;
+ public Date getBirthdate() throws RemoteException;
+
+ public void setAnnualSalary(Double annualSalary) throws RemoteException;
+ public Double getAnnualSalary() throws RemoteException;
+
+ public void setLoanAmount(Double loanAmount) throws RemoteException;
+ public Double getLoanAmount() throws RemoteException;
+
+
+}
\ No newline at end of file
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerRemote.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerRemote.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/bmp/CustomerRemote.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/EntityBeanClient.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/EntityBeanClient.java?rev=640084&view=auto
==============================================================================
--- geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/EntityBeanClient.java (added)
+++ geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/EntityBeanClient.java Sat Mar 22 14:28:58 2008
@@ -0,0 +1,93 @@
+/*
+* 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.
+*/
+/*
+ * Created on Sep 27, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.geronimo.entity.client;
+
+/**
+ * @author cpineda
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+import java.rmi.RemoteException;
+import java.util.Date;
+
+import javax.naming.InitialContext;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.geronimo.entity.bmp.*;
+
+public class EntityBeanClient {
+
+ public static void main(String[] arg) {
+ try {
+ Context jndiContext = getInitialContext();
+
+ String name = "CustomerHomeRemote";
+
+ Object ref = jndiContext.lookup(name);
+ CustomerHomeRemote home = (CustomerHomeRemote) PortableRemoteObject
+ .narrow(ref, CustomerHomeRemote.class);
+ CustomerRemote customerRemote = null;
+ System.out.println("creating customer...");
+ try{
+ customerRemote = home.create(new Integer(1),"Customer 1","2323232","NO INFO",new Date(),new Double(0.0),new Double(0.0));
+ }catch(Exception e){/* this will most likely be because the customer already exists in the database. */ }
+ System.out.print("done.");
+
+ System.out.println("findByPrimaryKeyTest... 1");
+ customerRemote = null;
+ customerRemote = home.findByPrimaryKey(new Integer(1));
+ System.out.println("customer name: "+customerRemote.getName());
+ System.out.println("customer sss no: "+customerRemote.getSssNo());
+ System.out.println("customer loan amount: "+customerRemote.getLoanAmount());
+ System.out.println("customer annual salary: "+customerRemote.getAnnualSalary());
+ System.out.println("customer birthdate: "+customerRemote.getBirthdate());
+
+ System.out.println("updating ejb...");
+ customerRemote.setName("Customer 2");
+ System.out.print("done.");
+
+ System.out.println("findBySssNoTest... 2323232");
+ customerRemote = null;
+ customerRemote = home.findBySssNo("2323232");
+ System.out.println("customer name: "+customerRemote.getName());
+ System.out.println("customer sss no: "+customerRemote.getSssNo());
+ System.out.println("customer loan amount: "+customerRemote.getLoanAmount());
+ System.out.println("customer annual salary: "+customerRemote.getAnnualSalary());
+ System.out.println("customer birthdate: "+customerRemote.getBirthdate());
+
+ customerRemote.remove();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+
+ public static Context getInitialContext()
+ throws javax.naming.NamingException {
+ return new javax.naming.InitialContext();
+ }
+}
\ No newline at end of file
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/EntityBeanClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/EntityBeanClient.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/client/EntityBeanClient.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/PublisherServlet.java
URL: http://svn.apache.org/viewvc/geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/PublisherServlet.java?rev=640084&view=auto
==============================================================================
--- geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/PublisherServlet.java (added)
+++ geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/PublisherServlet.java Sat Mar 22 14:28:58 2008
@@ -0,0 +1,89 @@
+/*
+* 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 org.apache.geronimo.entity.servlet;
+
+
+import javax.servlet.ServletException;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+
+import org.apache.geronimo.entity.bmp.*;
+
+import java.text.SimpleDateFormat;
+
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: simon
+ * Date: Nov 13, 2004
+ * Time: 10:07:03 AM
+ * To change this template use File | Settings | File Templates.
+ */
+public class PublisherServlet extends javax.servlet.http.HttpServlet {
+
+ private ServletContext ctx;
+
+ public void init() throws ServletException {
+
+ this.ctx = getServletContext();
+ }
+
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ doGet(request, response);
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ RequestDispatcher rd = null;
+
+ try {
+ InitialContext jndiContext = new InitialContext();
+
+ String name = "java:comp/env/ejb/CustomerHome";
+
+ Object ref = jndiContext.lookup(name);
+ CustomerHomeRemote home = (CustomerHomeRemote) PortableRemoteObject.narrow(ref, CustomerHomeRemote.class);
+ CustomerRemote customerRemote = null;
+ System.out.println("creating customer...");
+ try{
+ Integer customerID = new Integer(request.getParameter("clientID"));
+ String customerName = request.getParameter("clientName");
+ String customerSSS = request.getParameter("clientSSS");
+ String customerAddress = request.getParameter("clientSSS");
+ String birthdate = request.getParameter("clientBirthdate");
+ Double customerSalary = new Double(request.getParameter("clientSalary"));
+ Double customerLoan = new Double(request.getParameter("loanAmt"));
+
+ customerRemote = home.create(customerID,customerName,customerSSS,customerAddress,new SimpleDateFormat("mm/dd/yyyy").parse(birthdate),customerSalary,customerLoan);
+ }catch(Exception e){/* this will most likely be because the customer already exists in the database. */ }
+
+ rd = ctx.getRequestDispatcher("/list.jsp");
+ rd.forward(request, response);
+ }
+ catch(Exception e) {
+ throw new ServletException(e);
+ }
+ }
+}
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/PublisherServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/PublisherServlet.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/samples/branches/1.0/migration-ejb-bmp/src/org/apache/geronimo/entity/servlet/PublisherServlet.java
------------------------------------------------------------------------------
svn:mime-type = text/plain