Package javax.naming

Examples of javax.naming.Name


     */
    @Override
    protected List<NamingEntry> doListBindings(String strName)
        throws NamingException {
       
        Name name = getEscapedJndiName(strName);

        if (name.isEmpty())
            return list(entries);

        Entry entry = treeLookup(name);
        if (entry == null)
            return null;
View Full Code Here


                // This fixes a bug for war files that don't record separate
                // zip entries for the directories.
                int currentPos = -1;
                int lastPos = 0;
                while ((currentPos = name.indexOf('/', lastPos)) != -1) {
                    Name parentName = getEscapedJndiName(name.substring(0, lastPos));
                    Name childName = getEscapedJndiName(name.substring(0, currentPos));
                    String entryName = name.substring(lastPos, currentPos);
                    // Parent should have been created in last cycle through
                    // this loop
                    Entry parent = treeLookup(parentName);
                    Entry child = treeLookup(childName);
                    if (child == null) {
                        // Create a new entry for missing entry and strip off
                        // the leading '/' character and appended on by the
                        // normalize method and add '/' character to end to
                        // signify that it is a directory entry
                        String zipName = name.substring(1, currentPos) + "/";
                        child = new Entry(entryName, new ZipEntry(zipName));
                        if (parent != null)
                            parent.addChild(child);
                    }
                    // Increment lastPos
                    lastPos = currentPos + 1;
                }
                String entryName = name.substring(pos + 1, name.length());
                Name compositeName = getEscapedJndiName(name.substring(0, pos));
                Entry parent = treeLookup(compositeName);
                Entry child = new Entry(entryName, entry);
                if (parent != null)
                    parent.addChild(child);
               
View Full Code Here

            if (results.hasMore()) {
                //ignore for now
            }
            NameParser parser = context.getNameParser("");
            Name contextName = parser.parse(context.getNameInNamespace());
            Name baseName = parser.parse(userBase);
            Name entryName = parser.parse(result.getName());
            Name name = contextName.addAll(baseName);
            name = name.addAll(entryName);
            String dn = name.toString();

            Attributes attrs = result.getAttributes();
            if (attrs == null) {
                return false;
            }
View Full Code Here

            if (results.hasMore()) {
                //ignore for now
            }
            NameParser parser = context.getNameParser("");
            Name contextName = parser.parse(context.getNameInNamespace());
            Name baseName = parser.parse(userBase);
            Name entryName = parser.parse(result.getName());
            Name name = contextName.addAll(baseName);
            name = name.addAll(entryName);
            String dn = name.toString();

            Attributes attrs = result.getAttributes();
            if (attrs == null) {
                return false;
            }
View Full Code Here

        }

        // bind the value
        for (Iterator iterator = bindings.entrySet().iterator(); iterator.hasNext();) {
            Map.Entry entry = (Map.Entry) iterator.next();
            Name name = (Name) entry.getKey();
            Object value = entry.getValue();
            addBinding(abstractName, name, value);
        }

        // remember where we bound this value
View Full Code Here

    protected synchronized void removeBinding(AbstractName abstractName) {
        Set bindingNames = (Set) bindingsByAbstractName.remove(abstractName);
        if (bindingNames == null) return;

        for (Iterator iterator = bindingNames.iterator(); iterator.hasNext();) {
            Name name = (Name) iterator.next();

            LinkedHashMap bindings = (LinkedHashMap) bindingsByName.get(name);
            if (bindings == null) continue;

            if (first(bindings).getKey().equals(abstractName)) {
View Full Code Here

        return (Map.Entry) map.entrySet().iterator().next();
    }

    protected Map createBindings(AbstractName abstractName, Object value) throws NamingException {
        // generate a name for this binding
        Name name = createBindingName(abstractName, value);
        if (name == null) return null;

        // give sub classes a chance to preprocess the value
        value = preprocessVaue(abstractName, name, value);
        if (value == null) return null;
View Full Code Here

    try {
      log.trace("binding: " + name);
      ctx.rebind(name, val);
    }
    catch (Exception e) {
      Name n = ctx.getNameParser("").parse(name);
      while ( n.size() > 1 ) {
        String ctxName = n.get(0);

        Context subctx=null;
        try {
          log.trace("lookup: " + ctxName);
          subctx = (Context) ctx.lookup(ctxName);
        }
        catch (NameNotFoundException nfe) {}

        if (subctx!=null) {
          log.debug("Found subcontext: " + ctxName);
          ctx = subctx;
        }
        else {
          log.info("Creating subcontext: " + ctxName);
          ctx = ctx.createSubcontext(ctxName);
        }
        n = n.getSuffix(1);
      }
      log.trace("binding: " + n);
      ctx.rebind(n, val);
    }
    log.debug("Bound name: " + name);
View Full Code Here

            return (null);
        }

        // Get the entry's distinguished name
        NameParser parser = context.getNameParser("");
        Name contextName = parser.parse(context.getNameInNamespace());
        Name baseName = parser.parse(userBase);

        // Bugzilla 32267
        Name entryName = parser.parse(new CompositeName(result.getName()).get(0));

        Name name = contextName.addAll(baseName);
        name = name.addAll(entryName);
        String dn = name.toString();

        if (containerLog.isTraceEnabled())
            containerLog.trace("  entry found for " + username + " with dn " + dn);

        // Get the entry's attributes
View Full Code Here

    try {
      log.trace("binding: " + name);
      ctx.rebind(name, val);
    }
    catch (Exception e) {
      Name n = ctx.getNameParser("").parse(name);
      while ( n.size() > 1 ) {
        String ctxName = n.get(0);

        Context subctx=null;
        try {
          log.trace("lookup: " + ctxName);
          subctx = (Context) ctx.lookup(ctxName);
        }
        catch (NameNotFoundException nfe) {}

        if (subctx!=null) {
          log.debug("Found subcontext: " + ctxName);
          ctx = subctx;
        }
        else {
          log.info("Creating subcontext: " + ctxName);
          ctx = ctx.createSubcontext(ctxName);
        }
        n = n.getSuffix(1);
      }
      log.trace("binding: " + n);
      ctx.rebind(n, val);
    }
    log.debug("Bound name: " + name);
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.