1 57 58 package ejb.service; 59 60 import java.util.*; 61 import org.w3c.dom.*; 62 import javax.xml.parsers.*; 63 64 import java.rmi.RemoteException ; 65 import javax.ejb.CreateException ; 66 import javax.ejb.EJBException ; 67 import javax.ejb.FinderException ; 68 import javax.ejb.RemoveException ; 69 import javax.ejb.SessionBean ; 70 import javax.ejb.SessionContext ; 71 import javax.naming.Context ; 72 import javax.naming.InitialContext ; 73 import javax.naming.NamingException ; 74 import javax.rmi.PortableRemoteObject ; 75 76 import ejb.service.addressbook.wsiftypes.Address; 77 78 103 public class AddressBookSessionBean implements SessionBean { 104 private HashMap name2AddressTable = new HashMap(); 105 private SessionContext mContext; 106 107 110 public void addEntry(String name, Address address) 111 { 112 name2AddressTable.put(name, address); 113 } 114 115 118 public void addEntry(String firstName, String lastName, Address address) 119 { 120 name2AddressTable.put(firstName+" "+lastName, address); 121 } 122 123 126 public Address getAddressFromName(String name) 127 throws IllegalArgumentException 128 { 129 return (Address)name2AddressTable.get(name); 130 } 131 132 139 public void ejbCreate() 140 throws 141 CreateException 142 { 143 System.out.println( "AddressBookSessionBean.ejbCreate()" ); 144 } 145 146 151 public String toString() 152 { 153 return "AddressBookSessionBean [ " + " ]"; 154 } 155 156 157 161 public void setSessionContext( SessionContext aContext ) 162 throws 163 EJBException 164 { 165 mContext = aContext; 166 } 167 168 public void ejbActivate() 169 throws 170 EJBException 171 { 172 } 173 174 public void ejbPassivate() 175 throws 176 EJBException 177 { 178 } 179 180 public void ejbRemove() 181 throws 182 EJBException 183 { 184 } 185 } 186 187 | Popular Tags |