Package javax.naming

Examples of javax.naming.Name


   @Override
   protected void startService() throws Exception
   {
      InitialContext context = new InitialContext();
      delegate = (ConnectionFactory) context.lookup(reference);
      Name name = context.getNameParser("").parse(jndiName);
      NonSerializableFactory.rebind(name, this, true);
   }
View Full Code Here


            return "Client ENC(" + clientName + ")";

         if (methodName.equals("lookup") == false)
            throw new OperationNotSupportedException("Only lookup is supported, op=" + method);
         NameParser parser = lookupCtx.getNameParser("");
         Name name = null;
         if (args[0] instanceof String)
            name = parser.parse((String) args[0]);
         else
            name = (Name) args[0];

         // Check for special objects not in the env
         if (name.size() < 2 || "java:comp".equals(name.get(0)) == false || "env".equals(name.get(1)) == false)
            return getSpecialObject(name);
         // Lookup the client application context from the server
         Context clientCtx = (Context) lookupCtx.lookup(clientName);
        
         // JBAS-3967: EJB3 Client container hack
         try
         {
            clientCtx = (Context) clientCtx.lookup("env");
         }
         catch(NamingException e)
         {
            // ignore
            log.trace("No env sub context found", e);
         }
        
         // Strip the comp/env prefix
         Name bindingName = name.getSuffix(2);
         Object binding = clientCtx.lookup(bindingName);
        
         return binding;
      }
View Full Code Here

   protected void bind(String jndiName, Object who, Class<?> classType, Context ctx) throws Exception
   {
      // Ah ! This service isn't serializable, so we use a helper class
      //
      NonSerializableFactory.bind(jndiName, who);
      Name n = ctx.getNameParser("").parse(jndiName);
      while (n.size () > 1)
      {
         String ctxName = n.get (0);
         try
         {
            ctx = (Context)ctx.lookup (ctxName);
         }
         catch (NameNotFoundException e)
         {
            this.log.debug ("creating Subcontext " + ctxName);
            ctx = ctx.createSubcontext (ctxName);
         }
         n = n.getSuffix (1);
      }

      // The helper class NonSerializableFactory uses address type nns, we go on to
      // use the helper class to bind the service object in JNDI
      //
      StringRefAddr addr = new StringRefAddr("nns", jndiName);
      Reference ref = new Reference(classType.getName (), addr, NonSerializableFactory.class.getName (), null);
      ctx.rebind (n.get (0), ref);
   }
View Full Code Here

   public Object invoke(Object obj, Method method, Object[] args) throws Throwable
   {
      Context ctx = new InitialContext();
      NameParser parser = ctx.getNameParser("");
      String securityDomain = null;
      Name name = null;
     
     
      String methodName = method.getName();
      if( methodName.equals("toString") == true )
         return SecurityConstants.JAAS_CONTEXT_ROOT + " Context proxy";

      if( methodName.equals("list") == true )
         return new DomainEnumeration(JNDIBasedSecurityManagement.securityMgrMap.keys(),
               JNDIBasedSecurityManagement.securityMgrMap);
     
      if(methodName.equals("bind") || methodName.equals("rebind"))
      {
         if( args[0] instanceof String )
            name = parser.parse((String) args[0]);
         else
            name = (Name)args[0];
         securityDomain = name.get(0);
         SecurityDomainContext val = (SecurityDomainContext)args[1];
         JNDIBasedSecurityManagement.securityMgrMap.put(securityDomain, val);
         return obj;
      }
      if( methodName.equals("lookup") == false )
         throw new OperationNotSupportedException("Only lookup is supported, op="+method);
      if( args[0] instanceof String )
         name = parser.parse((String) args[0]);
      else
         name = (Name)args[0];
      securityDomain = name.get(0);
      SecurityDomainContext securityDomainCtx = lookupSecurityDomain(securityDomain);
      //TODO: Legacy expectation was subjectsecuritymgr
      Object binding = securityDomainCtx.getSecurityManager();
      // Look for requests against the security domain context
      if( name.size() == 2 )
      {
         String request = name.get(1);
         binding = securityDomainCtx.lookup(request);
      }
      return binding;
   }
View Full Code Here

   {
      InitialContext ic = null;
      try
      {
         ic = new InitialContext();
         Name name = ic.getNameParser("").parse(bindName);
         NonSerializableFactory.rebind(name, this, true);
         log.debug("bound to JNDI name " + bindName);
      }
      finally
      {
View Full Code Here

        File storeFile = new File(fileName);
        store = new SerialObjectStore(storeFile);
        log.info("Created SerialObjectStore at: "+storeFile.getAbsolutePath());
        // Bind a reference to store using NonSerializableFactory as the ObjectFactory
        InitialContext ctx = new InitialContext();
        Name name = ctx.getNameParser("").parse(jndiName);
        NonSerializableFactory.rebind(name, store, true);
    }
View Full Code Here

         // Not found, default to a TimedCachePolicy
         cachePolicy = new TimedCachePolicy(cacheTimeout, true, cacheResolution);
         cachePolicy.create();
         cachePolicy.start();
         // Bind a reference to store using NonSerializableFactory as the ObjectFactory
         Name name = ctx.getNameParser("").parse(cacheJndiName);
         NonSerializableFactory.rebind(name, cachePolicy, true);
         log.debug("Bound AuthenticationCache at "+cacheJndiName);
      }

      // Build the SRPRemoteServerInterface method map
View Full Code Here

    }
   
    int i = 0;
    Any param;

    Name name = null;
    String sname = null;
    Attributes attributes = null;
    ModificationItem[] modifications = null;
    int modop = DirContext.REPLACE_ATTRIBUTE;
   
View Full Code Here

   */
  protected String extractSlice(String nameAsString, NameParser nameParser,
      int startIndex, int endIndex) throws NamingException {
    int startI = startIndex;
    int endI = endIndex;
    Name name = nameParser.parse(nameAsString);
    if (startI < 0) {
      startI = name.size() + startI;
    }
    if (endI < 0) {
      endI = name.size() + endI;
    }
    return name.getPrefix(endI).getSuffix(startI).toString();
  }
View Full Code Here

 
  if (jndiName != null)
  {
      // Thanks to David D. Kilzer for this code to auto-create
      // subcontext paths!
      Name name = ictx.getNameParser( jndiName ).parse( jndiName );
      Context ctx = ictx;
      for (int i = 0, max = name.size() - 1; i < max; i++)
      {
    try
    { ctx = ctx.createSubcontext( name.get( i ) ); }
    catch (NameAlreadyBoundException ignore)
    { ctx = (Context) ctx.lookup( name.get( i ) ); }
      }

       ictx.rebind( jndiName, combods );
  }
View Full Code Here

TOP

Related Classes of javax.naming.Name

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.