1 package net.walend.somnifugi; 2 3 import java.util.Hashtable ; 4 import java.util.Set ; 5 6 import javax.naming.Context ; 7 import javax.naming.NamingException ; 8 import javax.naming.Name ; 9 import javax.naming.NamingEnumeration ; 10 import javax.naming.NameParser ; 11 import javax.naming.OperationNotSupportedException ; 12 import javax.naming.InvalidNameException ; 13 import javax.naming.CompositeName ; 14 15 16 22 23 public class SomniQueueContext 24 extends SomniContext 25 { 26 SomniQueueContext(String name,Hashtable <Object ,Object > environment) 27 { 28 super(name,environment); 29 } 30 31 34 public Object lookup(String name) 35 throws NamingException 36 { 37 try 38 { 39 if (name.equalsIgnoreCase(SomniProperties.CONNECTION)) 40 { 41 return new SomniQueueConnectionFactory().createQueueConnection(this); 42 } 43 else if (name.equalsIgnoreCase(SomniProperties.CONNECTIONFACTORY)) 44 { 45 return new SomniQueueConnectionFactory(); 46 } 47 else 48 { 49 return SomniQueueCache.IT.getQueue(name,this); 50 } 51 } 52 catch(SomniNamingException sne) 53 { 54 NamingException ne = new NamingException (); 55 ne.initCause(sne); 56 throw ne; 57 } 58 } 59 60 public Set <String > getNames() 61 { 62 return SomniQueueCache.IT.getNames(); 63 } 64 65 } 66 88 | Popular Tags |