Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*    */ package org.jnp.interfaces.java;
 /*    */ 
 /*    */ import java.util.Hashtable;
 /*    */ import javax.naming.Context;
 /*    */ import javax.naming.Name;
 /*    */ import javax.naming.NameParser;
 /*    */ import javax.naming.spi.ObjectFactory;
 /*    */ import org.jnp.interfaces.Naming;
 /*    */ import org.jnp.interfaces.NamingContext;
/*    */ 
/*    */ public class javaURLContextFactory
/*    */   implements ObjectFactory
/*    */ {
/* 47 */   private static ThreadLocal server = new ThreadLocal();
/*    */ 
/*    */   public static void setRoot(Naming srv)
/*    */   {
/* 52 */     .set(srv);
/*    */   }
/*    */ 
/*    */   public static Naming getRoot()
/*    */   {
/* 58 */     return (Naming).get();
/*    */   }
/*    */ 
/*    */   public Object getObjectInstance(Object objName nameContext nameCtxHashtable environment)
/*    */     throws Exception
/*    */   {
/* 72 */     if (obj == null)
/* 73 */       return new NamingContext(environmentname, (Naming).get());
/* 74 */     if ((obj instanceof String))
/*    */     {
/* 76 */       String url = (String)obj;
/* 77 */       Context ctx = new NamingContext(environmentname, (Naming).get());
/*    */ 
/* 79 */       Name n = ctx.getNameParser(name).parse(url.substring(url.indexOf(":") + 1));
/* 80 */       if (n.size() >= 3)
/*    */       {
/* 83 */         if ((n.get(0).toString().equals("")) && (n.get(1).toString().equals("")))
/*    */         {
/* 86 */           ctx.addToEnvironment("java.naming.provider.url"n.get(2));
/*    */         }
/*    */       }
/* 89 */       return ctx;
/*    */     }
/*    */ 
/* 92 */     return null;
/*    */   }
/*    */ }
/* Location:           /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
 * Qualified Name:     org.jnp.interfaces.java.javaURLContextFactory
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X