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

项目:cn1    文件:DirectoryManagerTest.java   
public void testGetStateToBind_null_null_null_null_null()
        throws NamingException {

    Object o = null;
    Name n = null;
    Context c = null;
    Hashtable<?, ?> h = null;
    Attributes a = null;
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    assertNull(r.getObject());
    assertNull(r.getAttributes());
}
项目:cn1    文件:DirectoryManagerTest.java   
public void testGetStateToBind_null_null_null_null_attr()
        throws NamingException {

    Object o = null;
    Name n = null;
    Context c = null;
    Hashtable<?, ?> h = null;
    Attributes a = new BasicAttributes();
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    assertNull(r.getObject());
    assertSame(a, r.getAttributes());
}
项目:cn1    文件:DirectoryManagerTest.java   
private void assertGetStateResults(Object o, Name n, Context c,
        Hashtable<Object, Object> h, Attributes a) throws NamingException {
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    Hashtable<?, ?> t = (Hashtable<?, ?>) r.getObject();
    assertEquals(a, r.getAttributes());
    assertEquals(t.get("o"), o);
    assertEquals(t.get("n"), n);
    assertEquals(t.get("c"), c);
    assertEquals(t.get("h"), h);
    assertEquals(t.get("a"), a);
}
项目:cn1    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with normal values
 */
public void testConstructor_Simple() {
    Person person = Person.getInstance();
    BasicAttributes attributes = new BasicAttributes("Anyuser", person);
    String strObj = "Harmony";
    DirStateFactory.Result result =
        new DirStateFactory.Result(strObj, attributes);
    assertEquals(strObj, result.getObject());
    assertEquals(attributes, result.getAttributes());
}
项目:cn1    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with the first param o as null
 */
public void testConstructor_ObjectNull() {
    Person person = Person.getInstance();
    BasicAttributes attributes = new BasicAttributes("Anyuser", person);
    DirStateFactory.Result result =
        new DirStateFactory.Result(null, attributes);
    assertNull(result.getObject());
    assertEquals(attributes, result.getAttributes());
}
项目:cn1    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with the second param attributes as null
 */
public void testConstructor_AttributesNull() {
    String strObj = "Harmony";
    DirStateFactory.Result result =
        new DirStateFactory.Result(strObj, null);
    assertEquals(strObj, result.getObject());
    assertNull(result.getAttributes());

}
项目:freeVM    文件:DirectoryManagerTest.java   
public void testGetStateToBind_null_null_null_null_null()
        throws NamingException {

    Object o = null;
    Name n = null;
    Context c = null;
    Hashtable<?, ?> h = null;
    Attributes a = null;
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    assertNull(r.getObject());
    assertNull(r.getAttributes());
}
项目:freeVM    文件:DirectoryManagerTest.java   
public void testGetStateToBind_null_null_null_null_attr()
        throws NamingException {

    Object o = null;
    Name n = null;
    Context c = null;
    Hashtable<?, ?> h = null;
    Attributes a = new BasicAttributes();
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    assertNull(r.getObject());
    assertSame(a, r.getAttributes());
}
项目:freeVM    文件:DirectoryManagerTest.java   
private void assertGetStateResults(Object o, Name n, Context c,
        Hashtable<Object, Object> h, Attributes a) throws NamingException {
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    Hashtable<?, ?> t = (Hashtable<?, ?>) r.getObject();
    assertEquals(a, r.getAttributes());
    assertEquals(t.get("o"), o);
    assertEquals(t.get("n"), n);
    assertEquals(t.get("c"), c);
    assertEquals(t.get("h"), h);
    assertEquals(t.get("a"), a);
}
项目:freeVM    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with normal values
 */
public void testConstructor_Simple() {
    Person person = Person.getInstance();
    BasicAttributes attributes = new BasicAttributes("Anyuser", person);
    String strObj = "Harmony";
    DirStateFactory.Result result =
        new DirStateFactory.Result(strObj, attributes);
    assertEquals(strObj, result.getObject());
    assertEquals(attributes, result.getAttributes());
}
项目:freeVM    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with the first param o as null
 */
public void testConstructor_ObjectNull() {
    Person person = Person.getInstance();
    BasicAttributes attributes = new BasicAttributes("Anyuser", person);
    DirStateFactory.Result result =
        new DirStateFactory.Result(null, attributes);
    assertNull(result.getObject());
    assertEquals(attributes, result.getAttributes());
}
项目:freeVM    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with the second param attributes as null
 */
public void testConstructor_AttributesNull() {
    String strObj = "Harmony";
    DirStateFactory.Result result =
        new DirStateFactory.Result(strObj, null);
    assertEquals(strObj, result.getObject());
    assertNull(result.getAttributes());

}
项目:freeVM    文件:DirectoryManagerTest.java   
public void testGetStateToBind_null_null_null_null_null()
        throws NamingException {

    Object o = null;
    Name n = null;
    Context c = null;
    Hashtable<?, ?> h = null;
    Attributes a = null;
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    assertNull(r.getObject());
    assertNull(r.getAttributes());
}
项目:freeVM    文件:DirectoryManagerTest.java   
public void testGetStateToBind_null_null_null_null_attr()
        throws NamingException {

    Object o = null;
    Name n = null;
    Context c = null;
    Hashtable<?, ?> h = null;
    Attributes a = new BasicAttributes();
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    assertNull(r.getObject());
    assertSame(a, r.getAttributes());
}
项目:freeVM    文件:DirectoryManagerTest.java   
private void assertGetStateResults(Object o, Name n, Context c,
        Hashtable<Object, Object> h, Attributes a) throws NamingException {
    DirStateFactory.Result r = DirectoryManager.getStateToBind(o, n, c, h,
            a);
    Hashtable<?, ?> t = (Hashtable<?, ?>) r.getObject();
    assertEquals(a, r.getAttributes());
    assertEquals(t.get("o"), o);
    assertEquals(t.get("n"), n);
    assertEquals(t.get("c"), c);
    assertEquals(t.get("h"), h);
    assertEquals(t.get("a"), a);
}
项目:freeVM    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with normal values
 */
public void testConstructor_Simple() {
    Person person = Person.getInstance();
    BasicAttributes attributes = new BasicAttributes("Anyuser", person);
    String strObj = "Harmony";
    DirStateFactory.Result result =
        new DirStateFactory.Result(strObj, attributes);
    assertEquals(strObj, result.getObject());
    assertEquals(attributes, result.getAttributes());
}
项目:freeVM    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with the first param o as null
 */
public void testConstructor_ObjectNull() {
    Person person = Person.getInstance();
    BasicAttributes attributes = new BasicAttributes("Anyuser", person);
    DirStateFactory.Result result =
        new DirStateFactory.Result(null, attributes);
    assertNull(result.getObject());
    assertEquals(attributes, result.getAttributes());
}
项目:freeVM    文件:DirStateFactoryResultTest.java   
/**
 * Test Result(Object o, Attributes a) with the second param attributes as null
 */
public void testConstructor_AttributesNull() {
    String strObj = "Harmony";
    DirStateFactory.Result result =
        new DirStateFactory.Result(strObj, null);
    assertEquals(strObj, result.getObject());
    assertNull(result.getAttributes());

}
项目:OpenJSharp    文件: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;
}
项目: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;
}
项目:openjdk-jdk10    文件: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;
}
项目:openjdk9    文件: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;
}
项目: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;
}
项目:lookaside_java-1.8.0-openjdk    文件: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;
}
项目:infobip-open-jdk-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;
}
项目: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;
}
项目:jdk7-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 = (Attribute)attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = (Attribute)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;
}
项目:openjdk-source-code-learn    文件: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 = (Attribute)attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = (Attribute)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;
}
项目:OLD-OpenJDK8    文件: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;
}
项目:openjdk-jdk7u-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 = (Attribute)attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = (Attribute)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;
}
项目:openjdk-icedtea7    文件: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 = (Attribute)attrs.get("objectClass");
        if (objectClass == null && !attrs.isCaseIgnored()) {
            // %%% workaround
            objectClass = (Attribute)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;
}