Package org.apache.harmony.jndi.provider.ldap.asn1

Examples of org.apache.harmony.jndi.provider.ldap.asn1.ASN1Encodable


        Object[] values = new Object[] { Integer.valueOf(index), value };
        byte[] encoded = choice.encode(values);
        Object decoded = choice.decode(encoded);

        assertTrue(decoded instanceof ChosenValue);
        ChosenValue chosen = (ChosenValue) decoded;

        assertEquals(index, chosen.getIndex());
        assertEquals(value, chosen.getValue());
    }
View Full Code Here


        public String getType() {
            return type;
        }

        public void addInitial(String initial) {
            substrings.add(new ChosenValue(0, initial));
        }
View Full Code Here

        public void addInitial(String initial) {
            substrings.add(new ChosenValue(0, initial));
        }

        public void addAny(String any) {
            substrings.add(new ChosenValue(1, any));
        }
View Full Code Here

        public void addAny(String any) {
            substrings.add(new ChosenValue(1, any));
        }

        public void addFinal(String initial) {
            substrings.add(new ChosenValue(2, initial));
        }
View Full Code Here

            values[0] = Utils.getBytes(type);
            ArrayList<ChosenValue> encoded = new ArrayList<ChosenValue>(
                    substrings.size());
            for (ChosenValue value : substrings) {
                // FIXME: deal with binary value
                encoded.add(new ChosenValue(value.getIndex(), Utils
                        .getBytes((String) value.getValue())));
            }
            values[1] = encoded;
        }
View Full Code Here

            if (index == 0) {
                value = Utils.getBytes(password);
            } else {
                value = sasl;
            }
            values[0] = new ChosenValue(index, value);

        }
View Full Code Here

    public void setAddress(String address) {
        this.address = address;
    }

    public void decodeSearchResponse(Object[] values) {
        ChosenValue chosen = (ChosenValue) values[0];
        switch (chosen.getIndex()) {
        case LdapASN1Constant.OP_SEARCH_RESULT_ENTRY:
            decodeEntry(chosen.getValue());
            break;
        case LdapASN1Constant.OP_SEARCH_RESULT_REF:
            decodeRef(chosen.getValue());
            break;
        case LdapASN1Constant.OP_SEARCH_RESULT_DONE:
            decodeDone(chosen.getValue());
            break;
        }
    }
View Full Code Here

        messageId = ASN1Integer.toIntValue(values[0]);
        if (values[1] == null) {
            return;
        }

        ChosenValue chosen = (ChosenValue) values[1];
        opIndex = chosen.getIndex();
        // failed to retrieve responseOp
        responseOp = getResponseOp();
        if (responseOp == null) {
            return;
        }

        if (opIndex == LdapASN1Constant.OP_SEARCH_RESULT_DONE
                || opIndex == LdapASN1Constant.OP_SEARCH_RESULT_ENTRY
                || opIndex == LdapASN1Constant.OP_SEARCH_RESULT_REF) {
            /*
             * we use LdapSearchResult to decode all types of search responses,
             * so we need index to determine which type of response to decode
             */
            responseOp.decodeValues(new Object[] { chosen });
        } else {
            responseOp.decodeValues((Object[]) chosen.getValue());
        }

        if (values[2] != null) {
            Collection<Object[]> list = (Collection<Object[]>) values[2];
            controls = new Control[list.size()];
View Full Code Here

                || opIndex == LdapASN1Constant.OP_DEL_REQUEST
                || opIndex == LdapASN1Constant.OP_UNBIND_REQUEST
                || opIndex == LdapASN1Constant.OP_SEARCH_RESULT_REF) {
            Object[] objs = new Object[1];
            requestOp.encodeValues(objs);
            values[1] = new ChosenValue(opIndex, objs[0]);
        } else {
            values[1] = new ChosenValue(opIndex, requestOp);
        }

        // encode controls, wrap to LdapControl, so it could be encoded
        if (controls != null) {
            List<LdapControl> list = new ArrayList<LdapControl>(controls.length);
View Full Code Here

        if (type == null) {
            type = (ASN1Choice) LdapASN1Constant.Filter;
        }
        // has not been decoded
        if (!(out.content instanceof byte[])) {
            ChosenValue chosen = (ChosenValue) out.content;
            int index = chosen.getIndex();
            byte[] bytes = type.type[index].encode(chosen.getValue());
            out.content = bytes;
            out.length = bytes.length;
        }

        out.encodeANY();
View Full Code Here

TOP

Related Classes of org.apache.harmony.jndi.provider.ldap.asn1.ASN1Encodable

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.