Package org.jnp.interfaces

Examples of org.jnp.interfaces.NamingContext


      }
  
      Name fullName = parser.parse("");
      fullName.addAll(name);
     
      return new NamingContext(null, fullName, this.getHAStub());
   }
View Full Code Here


            JndiPermission perm = new JndiPermission(prefix, JndiPermission.LOOKUP);
            sm.checkPermission(perm);
         }
        
         // Return this
         result = new NamingContext(null, (Name)(prefix.clone()), getRoot());
      }
      else if (name.size() > 1)
      {
         // Recurse to find correct context
//         System.out.println("lookup#"+name+"#");
        
         Object ctx = getObject(name);
         if (ctx instanceof NamingServer)
         {
            result = ((NamingServer)ctx).lookup(name.getSuffix(1));
         }
         else if (ctx instanceof Reference)
         {
            // Federation
            if (((Reference)ctx).get("nns") != null)
            {
               CannotProceedException cpe = new CannotProceedException();
               cpe.setResolvedObj(ctx);
               cpe.setRemainingName(name.getSuffix(1));
               throw cpe;
            }
           
            result = new ResolveResult(ctx, name.getSuffix(1));
         } else
         {
            throw new NotContextException();
         }
      }
      else
      {
         // Get object to return
         if (name.get(0).equals(""))
         {
            SecurityManager sm = getSecurityManager();
            if(sm != null)
            {
               JndiPermission perm = new JndiPermission(prefix, JndiPermission.LOOKUP);
               sm.checkPermission(perm);
            }
            result = new NamingContext(null, (Name)(prefix.clone()), getRoot());
         }
         else
         {
//            System.out.println("lookup "+name);
            SecurityManager sm = getSecurityManager();
            Name fullName = (Name)(prefix.clone());
            fullName.addAll(name);
            if(sm != null)
            {
               JndiPermission perm = new JndiPermission(fullName, JndiPermission.LOOKUP);
               sm.checkPermission(perm);
            }
           
            Object res = getObject(name);
           
            if (res instanceof NamingServer)
            {
               result = new NamingContext(null, fullName, getRoot());
            }
            else
               result = res;
         }
      }
View Full Code Here

            {
               Name n = (Name)prefix.clone();
               n.add(b.getName());
               newBindings.add(new Binding(b.getName(),
                                           b.getClassName(),
                                           new NamingContext(null, n, getRoot())));
            }
            else
            {
               newBindings.add(b);
            }
View Full Code Here

            {
               JndiPermission perm = new JndiPermission(fullName, JndiPermission.CREATE_SUBCONTEXT);
               sm.checkPermission(perm);
            }
            NamingServer subContext = createNamingServer(fullName, this);
            subCtx = new NamingContext(null, fullName, getRoot());
            setBinding(name, subContext, NamingContext.class.getName());
            // Return the NamingContext as the binding value
            Binding newb = new Binding(name.toString(), NamingContext.class.getName(), subCtx, true);
            // Notify event listeners
            if(listeners != null)
View Full Code Here

   protected Context createContext(Hashtable environment)
           throws NamingException
   {
      NamingServer srv = createServer();
      return new NamingContext(environment, null, srv);
   }
View Full Code Here

      }
  
      if (name.isEmpty())
      {
         // Return this
         return new NamingContext(null, PARSER.parse(""), this.getHAStub());
      }

      // is the name a context?
      try
      {
         Node<String, Binding> n = this.cache.getRoot().getChild(Fqn.fromRelativeFqn(FQN_ROOT, Fqn.fromString(name.toString())));
         if (n != null)
         {
            Name fullName = (Name) name.clone();
            return new NamingContext(null, fullName, this.getHAStub());
         }
      }
      catch (CacheException ce)
      {
         if (LOG.isTraceEnabled())
View Full Code Here

               for (Object obj: children)
               {
                  String child = (String) obj;
                  Name fullName = (Name) name.clone();
                  fullName.add(child);
                  NamingContext subCtx = new NamingContext(null, fullName, this.getHAStub());
                  list.add(new Binding(child, NamingContext.class.getName(), subCtx, true));
               }
            }
         }
        
View Full Code Here

      }
  
      Name fullName = PARSER.parse("");
      fullName.addAll(name);
     
      return new NamingContext(null, fullName, this.getHAStub());
   }
View Full Code Here

                                Hashtable environment)
                         throws Exception
   {
      if (obj == null)
      {
          Context urlContext = new NamingContext(environment, name, null);
          return urlContext;
      }
      else if (obj instanceof String)
      {
         String url = (String)obj;
         Context ctx = new NamingContext(environment, name, null);
        
         Name n = ctx.getNameParser(name).parse(url.substring(url.indexOf(":")+1));
         if (n.size() >= 3)
         {
            // Provider URL?
            if (n.get(0).toString().equals("") &&
                n.get(1).toString().equals(""))
            {
               ctx.addToEnvironment(Context.PROVIDER_URL, n.get(2));
            }
         }
         return ctx;
      } else
      {
View Full Code Here

                                Context nameCtx,
                                Hashtable environment)
                         throws Exception
   {
      if (obj == null)
         return new NamingContext(environment, name, (Naming)server.get());
      else if (obj instanceof String)
      {
         String url = (String)obj;
         Context ctx = new NamingContext(environment, name, (Naming)server.get());
        
         Name n = ctx.getNameParser(name).parse(url.substring(url.indexOf(":")+1));
         if (n.size() >= 3)
         {
            // Provider URL?
            if (n.get(0).toString().equals("") &&
                n.get(1).toString().equals(""))
            {
               ctx.addToEnvironment(Context.PROVIDER_URL, n.get(2));
            }
         }
         return ctx;
      } else
      {
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.