类javax.naming.spi.DirStateFactory源码实例Demo

下面列出了怎么用javax.naming.spi.DirStateFactory的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: Obj.java
/**
  * 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;
}
 
源代码2 项目: TencentKona-8   文件: Obj.java
/**
  * 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;
}
 
源代码3 项目: jdk8u60   文件: Obj.java
/**
  * 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;
}
 
源代码4 项目: openjdk-jdk8u   文件: Obj.java
/**
  * 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;
}
 
源代码5 项目: openjdk-jdk8u-backup   文件: Obj.java
/**
  * 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;
}
 
源代码6 项目: openjdk-jdk9   文件: Obj.java
/**
  * 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;
}
 
源代码7 项目: jdk8u-jdk   文件: Obj.java
/**
  * 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;
}
 
源代码8 项目: hottub   文件: Obj.java
/**
  * 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;
}
 
源代码9 项目: openjdk-8-source   文件: Obj.java
/**
  * 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;
}
 
源代码10 项目: openjdk-8   文件: Obj.java
/**
  * 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;
}
 
源代码11 项目: jdk8u_jdk   文件: Obj.java
/**
  * 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;
}
 
源代码12 项目: jdk8u-jdk   文件: Obj.java
/**
  * 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;
}
 
源代码13 项目: jdk8u-dev-jdk   文件: Obj.java
/**
  * 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;
}
 
 类所在包
 类方法
 同包方法