1 23 package com.sun.ejb.containers; 24 25 import com.sun.ejb.*; 26 import com.sun.ejb.portable.*; 27 import com.sun.enterprise.*; 28 import com.sun.enterprise.deployment.*; 29 import java.lang.reflect.Method ; 30 31 import javax.ejb.*; 32 33 import java.rmi.Remote ; 34 import java.rmi.RemoteException ; 35 import java.rmi.NoSuchObjectException ; 36 37 import java.util.Hashtable ; 38 import java.util.Properties ; 39 40 import java.util.logging.*; 41 import com.sun.logging.*; 42 43 51 52 public abstract class EJBHomeImpl 53 implements javax.ejb.EJBHome 54 { 55 56 private static Logger _logger; 57 static { 58 _logger=LogDomains.getLogger(LogDomains.EJB_LOGGER); 59 } 60 61 private BaseContainer container; 62 63 66 protected EJBHomeImpl() 67 throws RemoteException 68 { 69 } 70 71 74 protected final Container getContainer() { 75 return container; 76 } 77 78 79 82 final void setContainer(BaseContainer c) { 83 container = c; 84 } 85 86 94 protected EJBHome getEJBHome() { 95 return this; 96 } 97 98 103 public final EJBObjectImpl createEJBObjectImpl() 104 throws RemoteException , CreateException 105 { 106 return container.createEJBObjectImpl(); 107 } 108 109 public EJBObjectImpl createRemoteBusinessObjectImpl() 110 throws RemoteException , CreateException 111 { 112 return container.createRemoteBusinessObjectImpl(); 113 } 114 115 116 120 121 125 public final void remove(Handle handle) 126 throws RemoteException , RemoveException 127 { 128 container.authorizeRemoteMethod(BaseContainer.EJBHome_remove_Handle); 129 130 EJBObject ejbo; 131 try { 132 ejbo = handle.getEJBObject(); 133 } catch ( RemoteException ex ) { 134 _logger.log(Level.FINE, "Exception in method remove()", ex); 135 NoSuchObjectException nsoe = 136 new NoSuchObjectException (ex.toString()); 137 nsoe.initCause(ex); 138 throw nsoe; 139 } 140 ejbo.remove(); 141 } 142 143 144 148 public final void remove(Object primaryKey) 149 throws RemoteException , RemoveException 150 { 151 if ( !(container instanceof EntityContainer) ) { 152 throw new RemoveException("Invalid remove operation."); 154 } 155 156 container.authorizeRemoteMethod(BaseContainer.EJBHome_remove_Pkey); 157 158 Method method=null; 159 try { 160 method = EJBHome.class.getMethod("remove", 161 new Class []{Object .class}); 162 } catch ( NoSuchMethodException e ) { 163 _logger.log(Level.FINE, "Exception in method remove()", e); 164 } 165 166 ((EntityContainer)container).removeBean(primaryKey, method, false); 167 } 168 169 170 173 public final EJBMetaData getEJBMetaData() 174 throws RemoteException 175 { 176 container.authorizeRemoteMethod(BaseContainer.EJBHome_getEJBMetaData); 177 178 return container.getEJBMetaData(); 179 } 180 181 185 public final HomeHandle getHomeHandle() 186 throws RemoteException 187 { 188 container.authorizeRemoteMethod(BaseContainer.EJBHome_getHomeHandle); 189 190 return new HomeHandleImpl(container.getEJBHomeStub()); 191 } 192 } 193 | Popular Tags |