1 package org.acme.movie; 2 3 import javax.ejb.SessionBean ; 4 import javax.ejb.CreateException ; 5 import javax.ejb.EJBException ; 6 import javax.ejb.SessionContext ; 7 import javax.naming.Name ; 8 import javax.naming.NamingException ; 9 import javax.naming.NamingEnumeration ; 10 import javax.naming.Context ; 11 import javax.naming.NameParser ; 12 import javax.naming.InitialContext ; 13 import java.util.Hashtable ; 14 import java.rmi.RemoteException ; 15 16 22 public class JndiContextBean implements SessionBean , JndiContext { 23 public java.lang.Object lookup(Name name) throws NamingException { 24 return context.lookup(name); 25 } 26 27 public java.lang.Object lookup(String name) throws NamingException { 28 return context.lookup(name); 29 } 30 31 public void bind(Name name, java.lang.Object obj) throws NamingException { 32 context.bind(name, obj); 33 } 34 35 public void bind(String name, java.lang.Object obj) throws NamingException { 36 context.bind(name, obj); 37 } 38 39 public void rebind(Name name, java.lang.Object obj) throws NamingException { 40 context.rebind(name, obj); 41 } 42 43 public void rebind(String name, java.lang.Object obj) throws NamingException { 44 context.rebind(name, obj); 45 } 46 47 public void unbind(Name name) throws NamingException { 48 context.unbind(name); 49 } 50 51 public void unbind(String name) throws NamingException { 52 context.unbind(name); 53 } 54 55 public void rename(Name oldName, Name newName) throws NamingException { 56 context.rename(oldName, newName); 57 } 58 59 public void rename(String oldName, String newName) throws NamingException { 60 context.rename(oldName, newName); 61 } 62 63 public NamingEnumeration list(Name name) throws NamingException { 64 return context.list(name); 65 } 66 67 public NamingEnumeration list(String name) throws NamingException { 68 return context.list(name); 69 } 70 71 public NamingEnumeration listBindings(Name name) throws NamingException { 72 return context.listBindings(name); 73 } 74 75 public NamingEnumeration listBindings(String name) throws NamingException { 76 return context.listBindings(name); 77 } 78 79 public void destroySubcontext(Name name) throws NamingException { 80 context.destroySubcontext(name); 81 } 82 83 public void destroySubcontext(String name) throws NamingException { 84 context.destroySubcontext(name); 85 } 86 87 public Context createSubcontext(Name name) throws NamingException { 88 return context.createSubcontext(name); 89 } 90 91 public Context createSubcontext(String name) throws NamingException { 92 return context.createSubcontext(name); 93 } 94 95 public java.lang.Object lookupLink(Name name) throws NamingException { 96 return context.lookupLink(name); 97 } 98 99 public java.lang.Object lookupLink(String name) throws NamingException { 100 return context.lookupLink(name); 101 } 102 103 public NameParser getNameParser(Name name) throws NamingException { 104 return context.getNameParser(name); 105 } 106 107 public NameParser getNameParser(String name) throws NamingException { 108 return context.getNameParser(name); 109 } 110 111 public Name composeName(Name name, Name prefix) throws NamingException { 112 return context.composeName(name, prefix); 113 } 114 115 public String composeName(String name, String prefix) 116 throws NamingException { 117 return context.composeName(name, prefix); 118 } 119 120 public java.lang.Object addToEnvironment(String propName, java.lang.Object propVal) 121 throws NamingException { 122 return context.addToEnvironment(propName, propVal); 123 } 124 125 public java.lang.Object removeFromEnvironment(String propName) 126 throws NamingException { 127 return context.removeFromEnvironment(propName); 128 } 129 130 public Hashtable getEnvironment() throws NamingException { 131 return context.getEnvironment(); 132 } 133 134 public void close() throws NamingException { 135 context.close(); 136 } 137 138 public String getNameInNamespace() throws NamingException { 139 return context.getNameInNamespace(); 140 } 141 142 private Context context; 143 public void ejbCreate() throws CreateException { 144 try { 145 context = new InitialContext (); 146 context = (Context ) context.lookup("java:comp/env"); 147 } catch (NamingException e) { 148 throw (CreateException )new CreateException ().initCause(e); 149 } 150 } 151 152 public void ejbActivate() throws EJBException , RemoteException { 153 } 154 155 public void ejbPassivate() throws EJBException , RemoteException { 156 } 157 158 public void ejbRemove() throws EJBException , RemoteException { 159 } 160 161 public void setSessionContext(SessionContext sessionContext) throws EJBException , RemoteException { 162 } 163 } 164 | Popular Tags |