Package org.jnp.interfaces

Examples of org.jnp.interfaces.NamingContext


         {
            Name fullName = (Name) prefix.clone();
            fullName.addAll(name);
            NamingServer subContext = new NamingServer(fullName, this);
            setBinding(name, subContext, NamingContext.class.getName());
            subCtx = new NamingContext(null, fullName, getRoot());
         }
      }
      return subCtx;
   }
View Full Code Here


         throw ex;
      }

      // Copy the context env
      env = (Hashtable) env.clone();
      return new NamingContext(env, null, namingServer);
   }
View Full Code Here

/*     */   {
/*     */     Object result;
/*     */     Object result;
/* 258 */     if (name.isEmpty())
/*     */     {
/* 261 */       result = new NamingContext(null, (Name)(Name)this.prefix.clone(), getRoot());
/*     */     }
/*     */     else
/*     */     {
/*     */       Object result;
/* 262 */       if (name.size() > 1)
/*     */       {
/* 267 */         Object ctx = getObject(name);
/*     */         Object result;
/* 268 */         if ((ctx instanceof NamingServer))
/*     */         {
/* 270 */           result = ((NamingServer)ctx).lookup(name.getSuffix(1));
/*     */         }
/*     */         else
/*     */         {
/*     */           Object result;
/* 271 */           if ((ctx instanceof Reference))
/*     */           {
/* 274 */             if (((Reference)ctx).get("nns") != null)
/*     */             {
/* 276 */               CannotProceedException cpe = new CannotProceedException();
/* 277 */               cpe.setResolvedObj(ctx);
/* 278 */               cpe.setRemainingName(name.getSuffix(1));
/* 279 */               throw cpe;
/*     */             }
/*     */
/* 282 */             result = new ResolveResult(ctx, name.getSuffix(1));
/*     */           }
/*     */           else {
/* 285 */             throw new NotContextException();
/*     */           }
/*     */         }
/*     */       }
/*     */       else
/*     */       {
/*     */         Object result;
/* 290 */         if (name.get(0).equals(""))
/*     */         {
/* 292 */           result = new NamingContext(null, this.prefix, getRoot());
/*     */         }
/*     */         else
/*     */         {
/* 296 */           Object res = getObject(name);
/*     */           Object result;
/* 298 */           if ((res instanceof NamingServer))
/*     */           {
/* 300 */             Name fullName = (Name)(Name)this.prefix.clone();
/* 301 */             fullName.addAll(name);
/* 302 */             result = new NamingContext(null, fullName, getRoot());
/*     */           }
/*     */           else {
/* 305 */             result = res;
/*     */           }
/*     */         }
View Full Code Here

/* 368 */         Binding b = (Binding)iter.next();
/* 369 */         if ((b.getObject() instanceof NamingServer))
/*     */         {
/* 371 */           Name n = (Name)this.prefix.clone();
/* 372 */           n.add(b.getName());
/* 373 */           newBindings.add(new Binding(b.getName(), b.getClassName(), new NamingContext(null, n, getRoot())));
/*     */         }
/*     */         else
/*     */         {
/* 378 */           newBindings.add(b);
/*     */         }
View Full Code Here

/*     */
/* 472 */       Name fullName = (Name)this.prefix.clone();
/* 473 */       fullName.addAll(name);
/* 474 */       NamingServer subContext = new NamingServer(fullName, this);
/* 475 */       setBinding(name, subContext, NamingContext.class.getName());
/* 476 */       subCtx = new NamingContext(null, fullName, getRoot());
/*     */     }
/*     */
/* 479 */     return subCtx;
/*     */   }
View Full Code Here

/*    */
/*    */   public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment)
/*    */     throws Exception
/*    */   {
/* 72 */     if (obj == null)
/* 73 */       return new NamingContext(environment, name, (Naming)server.get());
/* 74 */     if ((obj instanceof String))
/*    */     {
/* 76 */       String url = (String)obj;
/* 77 */       Context ctx = new NamingContext(environment, name, (Naming)server.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;
/*    */     }
/*    */
View Full Code Here

/*    */   {
/* 55 */     Object value = invocation.nextInterceptor().invoke(invocation);
/* 56 */     if ((value instanceof NamingContext))
/*    */     {
/* 58 */       initNamingProxy();
/* 59 */       NamingContext ctx = (NamingContext)value;
/* 60 */       ctx.setNaming(this.proxy);
/*    */     }
/* 62 */     return value;
/*    */   }
View Full Code Here

/*     */
/*     */   protected Context createContext(Hashtable environment)
/*     */     throws NamingException
/*     */   {
/* 151 */     NamingServer srv = new NamingServer();
/* 152 */     Context compCtx = new NamingContext(environment, null, srv);
/* 153 */     return compCtx;
/*     */   }
View Full Code Here

/*     */     {
/* 149 */       Interceptor[] tmp = { IsLocalInterceptor.singleton, InvokeRemoteInterceptor.singleton };
/* 150 */       interceptors = tmp;
/*     */     }
/*     */
/* 153 */     if (NamingContext.localServer != null) return new NamingContext(env, null, NamingContext.localServer);
/*     */
/* 155 */     String providerUrl = (String)env.get("java.naming.provider.url");
/* 156 */     if (providerUrl == null)
/*     */     {
/* 158 */       throw new RuntimeException("PROVIDER_URL not provided in jndi.properties.  Automatic discovery not implemented yet.");
/*     */     }Naming naming;
/*     */     try {
/* 162 */       naming = (Naming)Remoting.createPojiProxy("JNDI", interfaces, providerUrl, interceptors);
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 166 */       throw new RuntimeException("Unable to create Naming proxy", e);
/*     */     }
/*     */
/* 169 */     return new NamingContext(env, null, naming);
/*     */   }
View Full Code Here

/*  85 */       ex.setRootCause(e);
/*  86 */       throw ex;
/*     */     }
/*     */
/*  90 */     env = (Hashtable)env.clone();
/*  91 */     return new NamingContext(env, null, namingServer);
/*     */   }
View Full Code Here

TOP

Related Classes of org.jnp.interfaces.NamingContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.