1 18 package org.apache.geronimo.interop.naming; 19 20 import java.util.HashMap ; 21 import java.util.Hashtable ; 22 import javax.naming.Context ; 23 import javax.naming.Name ; 24 import javax.naming.NameParser ; 25 import javax.naming.NamingEnumeration ; 26 import javax.naming.NamingException ; 27 import javax.naming.OperationNotSupportedException ; 28 29 public class InitialContext implements Context , java.io.Serializable { 30 private static HashMap EMPTY_MAP = new HashMap (); 31 private String prefix; 32 33 InitialContext(String prefix) { 34 this.prefix = prefix; 35 } 36 37 public HashMap getMap() { 38 NamingContext namingContext = NamingContext.getCurrent(); 39 if (namingContext == null) { 40 return EMPTY_MAP; 41 } else { 42 return namingContext.getMap(); 43 } 44 } 45 46 public Object lookup(Name name) throws NamingException { 47 return lookup(name.toString()); 48 } 49 50 public Object lookup(String name) throws NamingException { 51 NamingContext namingContext = NamingContext.getCurrent(); 52 if (namingContext == null) { 53 namingContext = NamingContext.getInstance(NameService.class); 54 } 55 return namingContext.lookup(name, prefix); 56 } 57 58 public Object lookupReturnNullIfNotFound(String name) { 59 NamingContext namingContext = NamingContext.getCurrent(); 60 if (namingContext == null) { 61 return null; 62 } else { 63 return namingContext.lookupReturnNullIfNotFound(name, prefix); 64 } 65 } 66 67 public void bind(Name name, Object obj) throws NamingException { 68 throw new OperationNotSupportedException (); 69 } 70 71 public void bind(String name, Object obj) throws NamingException { 72 throw new OperationNotSupportedException (); 73 } 74 75 public void rebind(Name name, Object obj) throws NamingException { 76 throw new OperationNotSupportedException (); 77 } 78 79 public void rebind(String name, Object obj) throws NamingException { 80 throw new OperationNotSupportedException (); 81 } 82 83 public void unbind(Name name) throws NamingException { 84 throw new OperationNotSupportedException (); 85 } 86 87 public void unbind(String name) throws NamingException { 88 throw new OperationNotSupportedException (); 89 } 90 91 public void rename(Name oldName, Name newName) throws NamingException { 92 throw new OperationNotSupportedException (); 93 } 94 95 public void rename(String oldName, String newName) throws NamingException { 96 throw new OperationNotSupportedException (); 97 } 98 99 public NamingEnumeration list(Name name) throws NamingException { 100 throw new OperationNotSupportedException (); 101 } 102 103 public NamingEnumeration list(String name) throws NamingException { 104 throw new OperationNotSupportedException (); 105 } 106 107 public NamingEnumeration listBindings(Name name) throws NamingException { 108 throw new OperationNotSupportedException (); 109 } 110 111 public NamingEnumeration listBindings(String name) throws NamingException { 112 throw new OperationNotSupportedException (); 113 } 114 115 public void destroySubcontext(Name name) throws NamingException { 116 throw new OperationNotSupportedException (); 117 } 118 119 public void destroySubcontext(String name) throws NamingException { 120 throw new OperationNotSupportedException (); 121 } 122 123 public Context createSubcontext(Name name) throws NamingException { 124 throw new OperationNotSupportedException (); 125 } 126 127 public Context createSubcontext(String name) throws NamingException { 128 throw new OperationNotSupportedException (); 129 } 130 131 public Object lookupLink(Name name) throws NamingException { 132 throw new OperationNotSupportedException (); 133 } 134 135 public Object lookupLink(String name) throws NamingException { 136 throw new OperationNotSupportedException (); 137 } 138 139 public NameParser getNameParser(Name name) throws NamingException { 140 throw new OperationNotSupportedException (); 141 } 142 143 public NameParser getNameParser(String name) throws NamingException { 144 throw new OperationNotSupportedException (); 145 } 146 147 public Name composeName(Name name, Name prefix) throws NamingException { 148 throw new OperationNotSupportedException (); 149 } 150 151 public String composeName(String name, String prefix) throws NamingException { 152 throw new OperationNotSupportedException (); 153 } 154 155 public Object addToEnvironment(String propName, Object propVal) throws NamingException { 156 throw new OperationNotSupportedException (); 157 } 158 159 public Object removeFromEnvironment(String propName) throws NamingException { 160 throw new OperationNotSupportedException (); 161 } 162 163 public Hashtable getEnvironment() throws NamingException { 164 throw new OperationNotSupportedException (); 165 } 166 167 public String getNameInNamespace() throws NamingException { 168 throw new OperationNotSupportedException (); 169 } 170 171 public void close() throws NamingException { 172 throw new OperationNotSupportedException (); 173 } 174 } 175 | Popular Tags |