1 package com.ubermq.jms.client.impl; 2 3 import com.ubermq.jms.client.*; 4 import java.util.*; 5 import javax.naming.*; 6 7 30 public final class JMSInitialContext 31 implements Context 32 { 33 public static final String CONNECTION_FACTORY_NAME = "connectionFactory", 34 TOPIC_PREFIX = "topic:", 35 QUEUE_PREFIX = "queue:"; 36 37 private Hashtable env; 38 39 public JMSInitialContext(Hashtable env) 40 { 41 this.env = env; 42 } 43 44 public Object lookup(Name name) throws NamingException 45 { 46 return lookup(name.toString()); 47 } 48 49 public Object lookup(String name) throws NamingException 50 { 51 if (name.equals(CONNECTION_FACTORY_NAME)) 52 return new URLConnectionFactory((String )env.get(InitialContext.PROVIDER_URL)); 53 else if (name.startsWith(TOPIC_PREFIX)) 54 return new LocalTopic(name.substring(TOPIC_PREFIX.length())); 55 else if (name.startsWith(QUEUE_PREFIX)) 56 return new LocalQueue(name.substring(QUEUE_PREFIX.length())); 57 else 58 throw new NamingException("not bound"); 59 } 60 61 public Hashtable getEnvironment() throws NamingException 62 { 63 return env; 64 } 65 66 public Object removeFromEnvironment(String propName) throws NamingException 67 { 68 return env.remove(propName); 69 } 70 71 public Object addToEnvironment(String propName, Object propVal) throws NamingException 72 { 73 return env.put(propName, propVal); 74 } 75 76 public NameParser getNameParser(String name) throws NamingException 77 { 78 throw new UnsupportedOperationException (); 79 } 80 81 public Context createSubcontext(Name name) throws NamingException 82 { 83 throw new UnsupportedOperationException (); 84 } 85 86 public Name composeName(Name name, Name prefix) throws NamingException 87 { 88 throw new UnsupportedOperationException (); 89 } 90 91 public void close() throws NamingException 92 { 93 } 94 95 public void rebind(Name name, Object obj) throws NamingException 96 { 97 throw new UnsupportedOperationException (); 98 } 99 100 public NamingEnumeration list(String name) throws NamingException 101 { 102 throw new UnsupportedOperationException (); 103 } 104 105 public Object lookupLink(Name name) throws NamingException 106 { 107 throw new UnsupportedOperationException (); 108 } 109 110 public void rename(String oldName, String newName) throws NamingException 111 { 112 throw new UnsupportedOperationException (); 113 } 114 115 public void bind(String name, Object obj) throws NamingException 116 { 117 throw new UnsupportedOperationException (); 118 } 119 120 public NameParser getNameParser(Name name) throws NamingException 121 { 122 throw new UnsupportedOperationException (); 123 } 124 125 public void rename(Name oldName, Name newName) throws NamingException 126 { 127 throw new UnsupportedOperationException (); 128 } 129 130 public void unbind(String name) throws NamingException 131 { 132 throw new UnsupportedOperationException (); 133 } 134 135 public NamingEnumeration listBindings(Name name) throws NamingException 136 { 137 throw new UnsupportedOperationException (); 138 } 139 140 public NamingEnumeration listBindings(String name) throws NamingException 141 { 142 throw new UnsupportedOperationException (); 143 } 144 145 public void destroySubcontext(Name name) throws NamingException 146 { 147 throw new UnsupportedOperationException (); 148 } 149 150 public String composeName(String name, String prefix) throws NamingException 151 { 152 throw new UnsupportedOperationException (); 153 } 154 155 public String getNameInNamespace() throws NamingException 156 { 157 throw new UnsupportedOperationException (); 158 } 159 160 public void destroySubcontext(String name) throws NamingException 161 { 162 throw new UnsupportedOperationException (); 163 } 164 165 public Context createSubcontext(String name) throws NamingException 166 { 167 throw new UnsupportedOperationException (); 168 } 169 170 public void unbind(Name name) throws NamingException 171 { 172 throw new UnsupportedOperationException (); 173 } 174 175 public void bind(Name name, Object obj) throws NamingException 176 { 177 throw new UnsupportedOperationException (); 178 } 179 180 public void rebind(String name, Object obj) throws NamingException 181 { 182 throw new UnsupportedOperationException (); 183 } 184 185 public NamingEnumeration list(Name name) throws NamingException 186 { 187 throw new UnsupportedOperationException (); 188 } 189 190 public Object lookupLink(String name) throws NamingException 191 { 192 throw new UnsupportedOperationException (); 193 } 194 195 } 196 | Popular Tags |