Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*    */ package org.jnp.interfaces.jnp;
 /*    */ 
 /*    */ 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.NamingContext;
 /*    */ 
/*    */ public class jnpURLContextFactory
/*    */   implements ObjectFactory
/*    */ {
/*    */   public Object getObjectInstance(Object objName nameContext nameCtxHashtable environment)
/*    */     throws Exception
/*    */   {
/* 57 */     if (obj == null)
/*    */     {
/* 59 */       Context urlContext = new NamingContext(environmentnamenull);
/* 60 */       return urlContext;
/*    */     }
/* 62 */     if ((obj instanceof String))
/*    */     {
/* 64 */       String url = (String)obj;
/* 65 */       Context ctx = new NamingContext(environmentnamenull);
/*    */ 
/* 67 */       Name n = ctx.getNameParser(name).parse(url.substring(url.indexOf(":") + 1));
/* 68 */       if (n.size() >= 3)
/*    */       {
/* 71 */         if ((n.get(0).toString().equals("")) && (n.get(1).toString().equals("")))
/*    */         {
/* 74 */           ctx.addToEnvironment("java.naming.provider.url"n.get(2));
/*    */         }
/*    */       }
/* 77 */       return ctx;
/*    */     }
/*    */ 
/* 80 */     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.jnp.jnpURLContextFactory
 * JD-Core Version:    0.6.0
 */
New to GrepCode? Check out our FAQ X