javax.naming.spi.DirStateFactory Java Examples

The following examples show how to use javax.naming.spi.DirStateFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Obj.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #2
Source File: Obj.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #3
Source File: Obj.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #4
Source File: Obj.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #5
Source File: Obj.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #6
Source File: Obj.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #7
Source File: Obj.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #8
Source File: Obj.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #9
Source File: Obj.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #10
Source File: Obj.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #11
Source File: Obj.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #12
Source File: Obj.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}
 
Example #13
Source File: Obj.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
  * Returns the attributes to bind given an object and its attributes.
  */
static Attributes determineBindAttrs(
    char separator, Object obj, Attributes attrs, boolean cloned,
    Name name, Context ctx, Hashtable<?,?> env)
    throws NamingException {

    // Call state factories to convert object and attrs
    DirStateFactory.Result res =
        DirectoryManager.getStateToBind(obj, name, ctx, env, attrs);
    obj = res.getObject();
    attrs = res.getAttributes();

    // We're only storing attributes; no further processing required
    if (obj == null) {
        return attrs;
    }

    //if object to be bound is a DirContext extract its attributes
    if ((attrs == null) && (obj instanceof DirContext)) {
        cloned = true;
        attrs = ((DirContext)obj).getAttributes("");
    }

    boolean ocNeedsCloning = false;

    // Create "objectClass" attribute
    Attribute objectClass;
    if (attrs == null || attrs.size() == 0) {
        attrs = new BasicAttributes(LdapClient.caseIgnore);
        cloned = true;

        // No objectclasses supplied, use "top" to start
        objectClass = new BasicAttribute("objectClass", "top");

    } else {
        // Get existing objectclass attribute
        objectClass = attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = attrs.get("objectclass");
        }

        // No objectclasses supplied, use "top" to start
        if (objectClass == null) {
            objectClass =  new BasicAttribute("objectClass", "top");
        } else if (ocNeedsCloning || !cloned) {
            objectClass = (Attribute)objectClass.clone();
        }
    }

    // convert the supplied object into LDAP attributes
    attrs = encodeObject(separator, obj, attrs, objectClass, cloned);

    // System.err.println("Determined: " + attrs);
    return attrs;
}