001: /*
002: * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions
006: * are met:
007: *
008: * - Redistributions of source code must retain the above copyright
009: * notice, this list of conditions and the following disclaimer.
010: *
011: * - Redistribution in binary form must reproduce the above copyright
012: * notice, this list of conditions and the following disclaimer in
013: * the documentation and/or other materials provided with the
014: * distribution.
015: *
016: * Neither the name of Sun Microsystems, Inc. or the names of
017: * contributors may be used to endorse or promote products derived
018: * from this software without specific prior written permission.
019: *
020: * This software is provided "AS IS," without a warranty of any
021: * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
022: * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
023: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
024: * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES
025: * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
026: * DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
027: * OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
028: * FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
029: * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
030: * LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE,
031: * EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
032: *
033: * You acknowledge that Software is not designed, licensed or intended
034: * for use in the design, construction, operation or maintenance of
035: * any nuclear facility.
036: */
037:
038: package com.sun.j2ee.blueprints.address.ejb;
039:
040: import javax.ejb.EntityBean;
041: import javax.ejb.EntityContext;
042: import javax.ejb.RemoveException;
043: import javax.ejb.CreateException;
044: import javax.naming.NamingException;
045: import javax.naming.InitialContext;
046:
047: public abstract class AddressEJB implements EntityBean {
048:
049: private EntityContext context = null;
050:
051: // getters and setters for CMP fields
052: //====================================
053: public abstract String getStreetName1();
054:
055: public abstract void setStreetName1(String streetName1);
056:
057: public abstract String getStreetName2();
058:
059: public abstract void setStreetName2(String streetName2);
060:
061: public abstract String getCity();
062:
063: public abstract void setCity(String city);
064:
065: public abstract String getState();
066:
067: public abstract void setState(String state);
068:
069: public abstract String getZipCode();
070:
071: public abstract void setZipCode(String zipCode);
072:
073: public abstract String getCountry();
074:
075: public abstract void setCountry(String country);
076:
077: // EJB create method
078: //===================
079: public Object ejbCreate(String streetName1, String streetName2,
080: String city, String state, String zipCode, String country)
081: throws CreateException {
082: setStreetName1(streetName1);
083: setStreetName2(streetName2);
084: setCity(city);
085: setState(state);
086: setZipCode(zipCode);
087: setCountry(country);
088: return null;
089: }
090:
091: public void ejbPostCreate(String streetName1, String streetName2,
092: String city, String state, String zipCode, String country)
093: throws CreateException {
094: }
095:
096: public Object ejbCreate(Address address) throws CreateException {
097: setStreetName1(address.getStreetName1());
098: setStreetName2(address.getStreetName2());
099: setCity(address.getCity());
100: setState(address.getState());
101: setZipCode(address.getZipCode());
102: setCountry(address.getCountry());
103: return null;
104: }
105:
106: public void ejbPostCreate(Address address) throws CreateException {
107: }
108:
109: public Object ejbCreate() throws CreateException {
110: return null;
111: }
112:
113: public void ejbPostCreate() throws CreateException {
114: }
115:
116: public Address getData() {
117: Address address = new Address();
118: address.setStreetName1(getStreetName1());
119: address.setStreetName2(getStreetName2());
120: address.setCity(getCity());
121: address.setState(getState());
122: address.setZipCode(getZipCode());
123: address.setCountry(getCountry());
124: return address;
125: }
126:
127: // Misc Method
128: //=============
129: public void setEntityContext(EntityContext c) {
130: context = c;
131: }
132:
133: public void unsetEntityContext() {
134: context = null;
135: }
136:
137: public void ejbRemove() throws RemoveException {
138: }
139:
140: public void ejbActivate() {
141: }
142:
143: public void ejbPassivate() {
144: }
145:
146: public void ejbStore() {
147: }
148:
149: public void ejbLoad() {
150: }
151: }
|