You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/02/14 22:42:44 UTC
svn commit: r507703 [1/9] - in /harmony/enhanced/classlib/trunk/modules:
jndi/META-INF/ jndi/make/ jndi/src/main/java/javax/naming/ldap/
jndi/src/main/java/org/apache/harmony/jndi/internal/
jndi/src/main/java/org/apache/harmony/jndi/internal/nls/ jndi/...
Author: tellison
Date: Wed Feb 14 13:42:41 2007
New Revision: 507703
URL: http://svn.apache.org/viewvc?view=rev&rev=507703
Log:
Initial commit of contribution HARMONY-1296 ([classlib][jndi] Contribution of missing javax.naming.ldap 1.4 classes)
including modifications to security and manifests to accommodate.
Added:
harmony/enhanced/classlib/trunk/modules/jndi/make/exclude.common
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ManageReferralControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsResponseControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsRequest.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsResponse.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/PagedResultSearchControlValue.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/SortResult.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/Util.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/AttributeTypeAndValuePair.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapNameParser.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapParser.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapRdnParser.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/LdapTypeAndValueList.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/parser/RelaxedDnParser.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/tls/
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/tls/config/
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/tls/config/ClassFinder.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/tls/config/ConfigFileNotFound.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/tls/config/DirFinder.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/tls/config/Finder.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/tls/config/JarFinder.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/tls/config/MergePath.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/AllTestLdap.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestBasicControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestControlFactory.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestInitialLdapContext.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestLdapName.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestManageReferralControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsControls.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestPagedResultsResponseControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestRdn.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortKey.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestSortResponseControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestStartTlsRequest.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestStartTlsResponse.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/TestUnsolicitedNotificationEvent.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/extras/
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/extras/TestRdnParser.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/extras/TestSerialization.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/integration/
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/integration/TestLdapNameIntegration.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/integration/TestRdnIntegration.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/main/
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/main/AllTestLdap.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestControlFactoryWhiteBoxDevelopment.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestInitialLdapContextWhiteBoxDevelopment.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestLdapNameWhiteBoxDevelopment.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestLdapReferralException.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestRdnWhiteBoxDevelopment.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/ldap/whitebox/TestStartTlsRequestWhiteBoxDevelopment.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContext.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockContextFactory.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControl.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockControlFactory.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockDirContext.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockInitialLdapContext.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockLdapReferralException.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockStartTlsResponse.java (with props)
harmony/enhanced/classlib/trunk/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/mock/ldap/MockUnsolicitedNotification.java (with props)
Modified:
harmony/enhanced/classlib/trunk/modules/jndi/META-INF/MANIFEST.MF
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortKey.java
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java
harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/messages.properties
harmony/enhanced/classlib/trunk/modules/security/src/main/java/common/org/apache/harmony/security/x509/DNParser.java
Modified: harmony/enhanced/classlib/trunk/modules/jndi/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/META-INF/MANIFEST.MF?view=diff&rev=507703&r1=507702&r2=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/META-INF/MANIFEST.MF Wed Feb 14 13:42:41 2007
@@ -17,6 +17,7 @@
java.io,
java.lang,
java.lang.reflect,
+ java.math,
java.net,
java.nio.charset;resolution:=optional,
java.rmi,
@@ -26,8 +27,15 @@
java.security,
java.text;resolution:=optional,
java.util,
+ java.util.concurrent.atomic;resolution:=optional,
+ java.util.jar,
+ java.util.zip;resolution:=optional,
+ javax.accessibility;resolution:=optional,
+ javax.net,
+ javax.net.ssl,
org.apache.harmony.kernel.vm,
- javax.accessibility;resolution:=optional
+ org.apache.harmony.security.asn1;version="1.0.0",
+ org.apache.harmony.security.x509;version="1.0.0"
Export-Package: javax.naming,
javax.naming.directory,
javax.naming.event,
Added: harmony/enhanced/classlib/trunk/modules/jndi/make/exclude.common
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/make/exclude.common?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/make/exclude.common (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/make/exclude.common Wed Feb 14 13:42:41 2007
@@ -0,0 +1 @@
+org/apache/harmony/jndi/tests/javax/naming/ldap/SortKeyTest.java
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java?view=diff&rev=507703&r1=507702&r2=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/BasicControl.java Wed Feb 14 13:42:41 2007
@@ -1,50 +1,82 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package javax.naming.ldap;
+import javax.naming.ldap.Control;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ * @version 0.0.1
+ * @author Osvaldo C. Demo
+ */
public class BasicControl implements Control {
+
private static final long serialVersionUID = -4233907508771791687L;
-
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
protected String id;
- protected boolean criticality;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ protected boolean criticality = false;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
protected byte[] value;
+ /**
+ * @ar.org.fitc.spec_ref
+ */
public BasicControl(String id) {
- super();
this.id = id;
}
-
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
public BasicControl(String id, boolean criticality, byte[] value) {
- super();
this.id = id;
this.criticality = criticality;
this.value = value;
}
+ /**
+ * @ar.org.fitc.spec_ref
+ */
public byte[] getEncodedValue() {
return value;
}
- public String getID() {
- return id;
- }
-
+ /**
+ * @ar.org.fitc.spec_ref
+ */
public boolean isCritical() {
return criticality;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public String getID() {
+ return id;
}
}
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,375 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.naming.InvalidNameException;
+import javax.naming.Name;
+
+import org.apache.harmony.jndi.internal.nls.Messages;
+import org.apache.harmony.jndi.internal.parser.LdapNameParser;
+
+/**
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ *
+ */
+public class LdapName implements Name {
+
+ private static final long serialVersionUID = -1595520034788997356L;
+
+ private List rdns;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public LdapName(List rdns) {
+ if (rdns == null)
+ throw new NullPointerException("rdns "+Messages.getString("ldap.00"));
+ init(rdns);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public LdapName(String name) throws InvalidNameException {
+ LdapNameParser parser = new LdapNameParser(name);
+ init(parser.getList());
+ }
+
+ private void init(List rdns) {
+ this.rdns = rdns;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name add(int posn, Rdn comp) {
+ if (comp == null)
+ throw new NullPointerException("comp "+Messages.getString("ldap.00"));
+ if (posn < 0 || posn > rdns.size())
+ throw new IndexOutOfBoundsException(
+ Messages.getString("ldap.05"));
+ getRdns().add(posn, comp);
+ return this;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name add(int posn, String comp) throws InvalidNameException {
+ return add(posn, new Rdn(comp));
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name add(Rdn comp) {
+ return add(getRdns().size(), comp);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name add(String comp) throws InvalidNameException {
+ return add(getRdns().size(), comp);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name addAll(int posn, List suffixRdns) {
+ if (suffixRdns == null)
+ throw new NullPointerException("suffixRdns "+Messages.getString("ldap.00"));
+ if (posn < 0 || posn > rdns.size())
+ throw new IndexOutOfBoundsException(Messages.getString("ldap.00"));
+ getRdns().addAll(posn, suffixRdns);
+ return this;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name addAll(int posn, Name suffix) throws InvalidNameException {
+ if (suffix instanceof LdapName) {
+ return addAll(posn, ((LdapName) suffix).getRdns());
+ } else {
+ List rdns = new ArrayList();
+ for (Enumeration iter = ((Name) suffix).getAll(); iter
+ .hasMoreElements();) {
+ rdns.add(new Rdn((String)iter.nextElement()));
+ }
+ return addAll(posn, rdns);
+ }
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name addAll(List suffixRdns) {
+ return addAll(getRdns().size(), suffixRdns);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name addAll(Name suffix) throws InvalidNameException {
+ return addAll(getRdns().size(), suffix);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Object clone() {
+ List lista = new ArrayList();
+ for (int i = 0; i < getRdns().size(); i++) {
+ lista.add(getRdns().get(i));
+ }
+ return new LdapName(lista);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public int compareTo(Object obj) {
+ LdapName ln = null;
+ if (obj == null)
+ throw new ClassCastException("obj "+Messages.getString("ldap.01"));
+ try {
+ ln = (LdapName) obj;
+ } catch (ClassCastException e) {
+ throw new ClassCastException("obj "+Messages.getString("ldap.01"));
+ }
+ String s1 = new String(), s2 = new String();
+
+ for (Iterator iter = getRdns().iterator(); iter.hasNext();) {
+ s1 = s1 + iter.next().toString() + ",";
+ }
+ for (Iterator iter = ln.getRdns().iterator(); iter.hasNext();) {
+ s2 = s2 + iter.next().toString() + ",";
+ }
+ if (s1.lastIndexOf(',') > 0)
+ s1 = s1.substring(0, s1.lastIndexOf(','));
+ if (s2.lastIndexOf(',') > 0)
+ s2 = s2.substring(0, s2.lastIndexOf(','));
+ return s1.toLowerCase().compareTo(s2.toLowerCase());
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public boolean endsWith(List rdns) {
+ try {
+ Iterator iter = rdns.iterator();
+ Iterator iter2 = ((LdapName) getSuffix(getRdns().size()
+ - rdns.size())).getRdns().iterator();
+ while (iter.hasNext()) {
+ if (!((Rdn) iter.next()).equals((Rdn) iter2.next()))
+ return false;
+ }
+ return true;
+ } catch (RuntimeException e) {
+ return false;
+ }
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public boolean endsWith(Name n) {
+ try {
+ if (n.equals(getSuffix(getRdns().size() - n.size())))
+ return true;
+ else
+ return false;
+ } catch (RuntimeException e) {
+ return false;
+ }
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public boolean equals(Object obj) {
+ LdapName ln = null;
+ if (obj == null)
+ return false;
+ try {
+ ln = (LdapName) obj;
+ } catch (ClassCastException e) {
+ return false;
+ }
+ if (ln.getRdns().size() != getRdns().size())
+ return false;
+
+ Iterator iter = ln.getRdns().iterator();
+ Iterator iter2 = getRdns().iterator();
+ while (iter.hasNext()) {
+ Rdn rdn1 = (Rdn) iter.next();
+ Rdn rdn2 = (Rdn) iter2.next();
+ if (!rdn1.equals(rdn2)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public String get(int posn) {
+ return getRdn(posn).toString();
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Enumeration getAll() {
+ final Iterator rdns = getRdns().iterator();
+ return new Enumeration() {
+ public boolean hasMoreElements() {
+ return rdns.hasNext();
+ }
+
+ public String nextElement() {
+ return rdns.next().toString();
+ }
+ };
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name getPrefix(int posn) {
+ if (posn < 0)
+ throw new IndexOutOfBoundsException(
+ Messages.getString("ldap.02"));
+ return new LdapName(getRdns().subList(0, posn));
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Rdn getRdn(int posn) {
+ return (Rdn) getRdns().get(posn);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public List getRdns() {
+ return rdns;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Name getSuffix(int posn) {
+ if (posn > getRdns().size())
+ throw new IndexOutOfBoundsException(
+ Messages.getString("ldap.02"));
+ return new LdapName(getRdns().subList(posn, getRdns().size()));
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public int hashCode() {
+ int sum = 0;
+ for (Iterator iter = getRdns().iterator(); iter.hasNext();) {
+ sum += iter.next().hashCode();
+ }
+ return sum;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public boolean isEmpty() {
+ if (getRdns().size() == 0)
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Object remove(int posn) throws InvalidNameException {
+ return getRdns().remove(posn);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public int size() {
+ return rdns.size();
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public boolean startsWith(List rdns) {
+ try {
+ Iterator iter = rdns.iterator();
+ Iterator iter2 = ((LdapName) getPrefix(rdns.size())).getRdns()
+ .iterator();
+ while (iter.hasNext()) {
+ if (!((Rdn) iter.next()).equals((Rdn) iter2.next()))
+ return false;
+ }
+ return true;
+ } catch (RuntimeException e) {
+ return false;
+ }
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public boolean startsWith(Name n) {
+ try {
+ if (n.equals(getPrefix(n.size())))
+ return true;
+ else
+ return false;
+ } catch (RuntimeException e) {
+ return false;
+ }
+
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public String toString() {
+ if (rdns.size() == 0)
+ return "";
+ StringBuffer sb = new StringBuffer();
+ sb.append(rdns.get(getRdns().size() - 1).toString());
+ for (int i = getRdns().size() - 2; i >= 0; i--) {
+ sb.append("," + rdns.get(i).toString());
+ }
+ return sb.toString();
+ }
+}
\ No newline at end of file
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/LdapName.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ManageReferralControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ManageReferralControl.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ManageReferralControl.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ManageReferralControl.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ * @author Osvaldo C. Demo
+ */
+public final class ManageReferralControl extends BasicControl {
+
+ private static final long serialVersionUID = 3017756160149982566L;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public static final String OID = "2.16.840.1.113730.3.4.2";
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public ManageReferralControl() {
+ super(OID, Control.CRITICAL, null);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public ManageReferralControl(boolean criticality) {
+ super(OID, criticality, null);
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/ManageReferralControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsControl.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsControl.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsControl.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+import java.io.IOException;
+import java.math.BigInteger;
+
+import org.apache.harmony.jndi.internal.PagedResultSearchControlValue;
+import org.apache.harmony.security.asn1.ASN1Integer;
+import org.apache.harmony.security.asn1.ASN1OctetString;
+import org.apache.harmony.security.asn1.ASN1Sequence;
+import org.apache.harmony.security.asn1.ASN1Type;
+import org.apache.harmony.security.asn1.BerInputStream;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ *
+ */
+public final class PagedResultsControl extends BasicControl {
+
+ /**
+ * static ASN1 Encoder for Paged Result Control using
+ * PagedResultSearchControlValue
+ */
+ public static ASN1Type ASN1_ENCODER = new ASN1Sequence(new ASN1Type[] {
+ ASN1Integer.getInstance(), // size
+ ASN1OctetString.getInstance(), // cookie
+ }) {
+
+ public Object getDecodedObject(BerInputStream in) {
+ Object values[] = (Object[]) in.content;
+ int size = new BigInteger((byte[]) values[0]).intValue();
+ byte[] cookie = (byte[]) values[1];
+ return new PagedResultSearchControlValue(size, cookie);
+ }
+
+ public void getValues(Object object, Object values[]) {
+ PagedResultSearchControlValue pg = (PagedResultSearchControlValue) object;
+ values[0] = BigInteger.valueOf(pg.getSize()).toByteArray();
+ if (pg.getCookie() == null) {
+ values[1] = "".getBytes();
+ } else {
+ values[1] = pg.getCookie();
+ }
+
+ }
+ };
+
+ private static final long serialVersionUID = 6684806685736844298L;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public static final String OID = "1.2.840.113556.1.4.319";
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public PagedResultsControl(int pageSize, boolean criticality)
+ throws IOException {
+ super(OID, criticality, null);
+ this.value = ASN1_ENCODER.encode(new PagedResultSearchControlValue(
+ pageSize, "".getBytes()));
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public PagedResultsControl(int pageSize, byte[] cookie, boolean criticality)
+ throws IOException {
+ super(OID, criticality, null);
+ this.value = ASN1_ENCODER.encode(new PagedResultSearchControlValue(
+ pageSize, cookie));
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsResponseControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsResponseControl.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsResponseControl.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsResponseControl.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+import java.io.IOException;
+
+import org.apache.harmony.jndi.internal.PagedResultSearchControlValue;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ * @author Osvaldo C. Demo
+ *
+ */
+public final class PagedResultsResponseControl extends BasicControl {
+
+ private PagedResultSearchControlValue pgscv;
+
+ private static final long serialVersionUID = -8819778744844514666L;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public static final String OID = "1.2.840.113556.1.4.319";
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public PagedResultsResponseControl(String id, boolean criticality,
+ byte[] value) throws IOException {
+ super(id, criticality, value);
+ this.pgscv = (PagedResultSearchControlValue) PagedResultsControl.ASN1_ENCODER
+ .decode(value);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public byte[] getCookie() {
+ if (pgscv.getCookie().length == 0) {
+ return null;
+ } else {
+ return pgscv.getCookie();
+ }
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public int getResultSize() {
+ return pgscv.getSize();
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/PagedResultsResponseControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,336 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.naming.InvalidNameException;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.BasicAttributes;
+
+import org.apache.harmony.jndi.internal.nls.Messages;
+import org.apache.harmony.jndi.internal.parser.LdapRdnParser;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 1.0
+ * @author Osvaldo C. Demo
+ *
+ */
+public class Rdn implements Serializable, Comparable {
+
+ private static final long serialVersionUID = -5994465067210009656L;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public static String escapeValue(Object val) {
+ if (val == null)
+ throw new NullPointerException("val "+Messages.getString("ldap.00"));
+ return LdapRdnParser.escapeValue(val);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public static Object unescapeValue(String val) {
+ if (val == null)
+ throw new NullPointerException("val "+Messages.getString("ldap.00"));
+ return LdapRdnParser.unescapeValue(val);
+ }
+
+ private List list = new ArrayList();
+
+ private transient LdapRdnParser parser;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Rdn(Attributes attrSet) throws InvalidNameException {
+ if (attrSet == null)
+ throw new NullPointerException("attrSet "+Messages.getString("ldap.00"));
+ if (attrSet.size() == 0)
+ throw new InvalidNameException("atrrSet "+Messages.getString("ldap.03"));
+
+ NamingEnumeration ne = attrSet.getAll();
+ while (ne.hasMoreElements()) {
+ Attribute at = (Attribute) ne.nextElement();
+ try {
+ at.get();
+ } catch (NamingException e) {
+ }
+ }
+ list = convertToAttributeArrayList((Attributes) attrSet.clone());
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Rdn(Rdn rdn) {
+ if (rdn == null)
+ throw new NullPointerException("rdn "+Messages.getString("ldap.00"));
+ list = convertToAttributeArrayList((Attributes) rdn.toAttributes()
+ .clone());
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Rdn(String rdnString) throws InvalidNameException {
+ if (rdnString == null)
+ throw new NullPointerException("rdnString "+Messages.getString("ldap.00"));
+ if (rdnString.length() != 0) {
+ parser = new LdapRdnParser(rdnString);
+ list = parser.getList();
+ }
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Rdn(String type, Object value) throws InvalidNameException {
+ if (type == null)
+ throw new NullPointerException("type "+Messages.getString("ldap.00"));
+ if (value == null)
+ throw new NullPointerException("value "+Messages.getString("ldap.00"));
+ if (type.length() == 0)
+ throw new InvalidNameException("type "+Messages.getString("ldap.04"));
+ if (value instanceof String) {
+ if (((String) value).length() == 0)
+ throw new InvalidNameException("value "+Messages.getString("ldap.04"));
+ }
+ list = convertToAttributeArrayList(new BasicAttributes(type, value,
+ true));
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public int compareTo(Object obj) {
+
+ if (!(obj instanceof Rdn)) {
+ throw new ClassCastException(
+ Messages.getString("ldap.06"));
+ }
+ Rdn rdn = (Rdn) obj;
+ String s1 = new String(), s2 = new String();
+
+ for (Enumeration iter = toAttributes().getAll(); iter.hasMoreElements();) {
+ s1 = s1 + escapeValue(iter.nextElement().toString());
+ if (iter.hasMoreElements())
+ s1 = s1 + ",";
+ }
+ for (Enumeration iter = rdn.toAttributes().getAll(); iter
+ .hasMoreElements();) {
+ s2 = s2 + escapeValue(iter.nextElement().toString());
+ if (iter.hasMoreElements())
+ s2 = s2 + ",";
+ }
+ return s1.toLowerCase().compareTo(s2.toLowerCase());
+ }
+
+ private List convertToAttributeArrayList(Attributes attrList) {
+ List myList = new ArrayList();
+ NamingEnumeration ne = attrList.getAll();
+ while (ne.hasMoreElements()) {
+ myList.add((Attribute) ne.nextElement());
+ }
+ return myList;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public boolean equals(Object obj) {
+
+ if (!(obj instanceof Rdn) || this.size() != ((Rdn) obj).size()) {
+ return false;
+ }
+ if (this == obj) {
+ return true;
+ }
+
+ NamingEnumeration iter1 = toAttributes().getAll();
+ NamingEnumeration iter2 = ((Rdn) obj).toAttributes().getAll();
+ while (iter1.hasMoreElements()) {
+ Attribute a1 = (Attribute) iter1.nextElement();
+ Attribute a2 = (Attribute) iter2.nextElement();
+ if (!(a1.getID().toLowerCase().equals(a2.getID().toLowerCase())))
+ return false;
+ Enumeration en1 = null;
+ Enumeration en2 = null;
+ try {
+ en1 = a1.getAll();
+ en2 = a2.getAll();
+ } catch (NamingException e) {
+ }
+
+ while (en1.hasMoreElements()) {
+ Object obj1 = en1.nextElement();
+ Object obj2 = en2.nextElement();
+ byte[] array1 = null;
+ byte[] array2 = null;
+
+ if (obj1 instanceof String && obj2 instanceof String) {
+ String s1 = (String) obj1;
+ String s2 = (String) obj2;
+ if (!(escapeValue(s1.toLowerCase()).equals(escapeValue(s2
+ .toLowerCase()))))
+ return false;
+ continue;
+ } else if (obj1 instanceof byte[] && obj2 instanceof byte[]) {
+ array1 = (byte[]) obj1;
+ array2 = (byte[]) obj2;
+ } else if (obj1 instanceof String && obj2 instanceof byte[]) {
+ try {
+ array1 = (byte[]) Rdn.unescapeValue((String) obj1);
+ } catch (ClassCastException e) {
+ return false;
+ }
+ array2 = (byte[]) obj2;
+ } else if (obj1 instanceof byte[] && obj2 instanceof String) {
+ array1 = (byte[]) obj1;
+ try {
+ array2 = (byte[]) Rdn.unescapeValue((String) obj2);
+ } catch (ClassCastException e) {
+ return false;
+ }
+ } else {
+ throw new ClassCastException();
+ }
+ if (array1.length == array2.length)
+ for (int i = 0; i < array1.length; i++) {
+ if (array1[i] != array2[i])
+ return false;
+ }
+ else {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public String getType() {
+ Attribute b = (Attribute) list.get(0);
+ return b.getID();
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Object getValue() {
+ Attribute b = (Attribute) list.get(0);
+ Object a = null;
+ try {
+ a = b.get();
+ } catch (NamingException e) {
+ } catch (NullPointerException e) {
+ }
+ return a;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public int hashCode() {
+ int sum = 0;
+
+ for (Iterator attr = list.iterator(); attr.hasNext();) {
+ Attribute a = (Attribute) attr.next();
+ NamingEnumeration en = null;
+ sum += a.getID().toLowerCase().hashCode();
+ try {
+ en = a.getAll();
+ } catch (NamingException e) {
+ }
+ while (en.hasMoreElements()) {
+ Object obj = en.nextElement();
+ try {
+ String s = (String) obj;
+ sum += escapeValue(s.toLowerCase()).hashCode();
+ } catch (ClassCastException e) {
+ sum += obj.hashCode();
+ }
+ }
+ }
+ return sum;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public int size() {
+ int result = 0;
+ for (Iterator iter = list.iterator(); iter.hasNext();) {
+ Attribute element = (Attribute) iter.next();
+ result += element.size();
+ }
+ return result;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public Attributes toAttributes() {
+ BasicAttributes ba = new BasicAttributes(true);
+ for (Iterator iter = list.iterator(); iter.hasNext();) {
+ Attribute element = (Attribute) iter.next();
+ ba.put((Attribute) element.clone());
+ }
+ return ba;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public String toString() {
+ StringBuffer sb = new StringBuffer();
+ for (Iterator iter = list.iterator(); iter.hasNext();) {
+ Attribute element = (Attribute) iter.next();
+ NamingEnumeration ne = null;
+ try {
+ ne = element.getAll();
+ } catch (NamingException e) {
+ }
+ while (ne.hasMoreElements()) {
+ sb
+ .append(element.getID() + "="
+ + escapeValue(ne.nextElement()));
+ if (ne.hasMoreElements())
+ sb.append("+");
+ }
+ if (iter.hasNext())
+ sb.append("+");
+ }
+ return sb.toString();
+ }
+
+}
\ No newline at end of file
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/Rdn.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortControl.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortControl.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortControl.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.apache.harmony.security.asn1.ASN1Boolean;
+import org.apache.harmony.security.asn1.ASN1Implicit;
+import org.apache.harmony.security.asn1.ASN1OctetString;
+import org.apache.harmony.security.asn1.ASN1Sequence;
+import org.apache.harmony.security.asn1.ASN1SequenceOf;
+import org.apache.harmony.security.asn1.ASN1StringType;
+import org.apache.harmony.security.asn1.ASN1Type;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ *
+ */
+public final class SortControl extends BasicControl {
+
+ /**
+ * Represents the following ASN1 Syntax:
+ *
+ * SortKey ::= SEQUENCE { attributeType AttributeDescription, orderingRule
+ * [0] MatchingRuleId OPTIONAL, reverseOrder [1] BOOLEAN DEFAULT FALSE }
+ *
+ */
+ public static ASN1Sequence ASN1_SORTKEY = new ASN1Sequence(new ASN1Type[] {
+ ASN1OctetString.getInstance(),
+ new ASN1Implicit(0, ASN1StringType.UTF8STRING),
+ new ASN1Implicit(1, ASN1Boolean.getInstance()),
+
+ }) {
+
+ {
+ setOptional(1);
+ setDefault(Boolean.FALSE, 2);
+ }
+
+ /**
+ * This method encode a <code>SortKey<code> Object
+ *
+ * @param object - a <code>SortKey<code> Object to encode
+ * @param values - a Object array to return the encoded values
+ */
+ public void getValues(Object object, Object values[]) {
+ SortKey sk = (SortKey) object;
+
+ values[0] = sk.getAttributeID().getBytes();
+ values[1] = sk.getMatchingRuleID();
+ values[2] = Boolean.valueOf(!sk.isAscending());
+ }
+ };
+
+ /**
+ * Represents the following ASN1 Syntax:
+ *
+ * SortKeyList ::= SEQUENCE OF SortKey;
+ *
+ */
+ public static ASN1SequenceOf ASN1_SORTKEYLIST = new ASN1SequenceOf(
+ ASN1_SORTKEY);
+
+ private static final long serialVersionUID = -1965961680233330744L;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public static final String OID = "1.2.840.113556.1.4.473";
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public SortControl(String sortBy, boolean criticality) throws IOException {
+ super(OID, criticality, null);
+ ArrayList list = new ArrayList();
+ if (sortBy != null) {
+ list.add(new SortKey(sortBy, true, null));
+ } else {
+ list.add(new SortKey("", true, null));
+ }
+ value = ASN1_SORTKEYLIST.encode(list);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public SortControl(String[] sortBy, boolean criticality) throws IOException {
+ super(OID, criticality, null);
+ ArrayList list = new ArrayList();
+ for (int i = 0; i < sortBy.length; i++) {
+ list.add(new SortKey(sortBy[i], true, null));
+ }
+ value = ASN1_SORTKEYLIST.encode(list);
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public SortControl(SortKey[] sortBy, boolean criticality)
+ throws IOException {
+ super(OID, criticality, null);
+
+ ArrayList list = new ArrayList();
+ for (int i = 0; i < sortBy.length; i++) {
+ list.add(sortBy[i]);
+ }
+ this.value = ASN1_SORTKEYLIST.encode(list);
+
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortKey.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortKey.java?view=diff&rev=507703&r1=507702&r2=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortKey.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortKey.java Wed Feb 14 13:42:41 2007
@@ -1,52 +1,81 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package javax.naming.ldap;
+import org.apache.harmony.jndi.internal.nls.Messages;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ *
+ */
public class SortKey {
- private final String attributeId;
- private final boolean ascending;
+ String attrID = null;
- private final String matchingRuleId;
+ String matchingRuleID = null;
- public SortKey(String attributeId) {
- super();
- this.attributeId = attributeId;
- this.ascending = true;
- this.matchingRuleId = null;
+ boolean ascendingOrder;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public SortKey(String attrID) {
+ if (attrID == null) {
+ throw new NullPointerException("attrID "+Messages.getString("ldap.00"));
+ }
+ this.attrID = attrID;
+ this.ascendingOrder = true;
}
- public SortKey(String attributeId, boolean ascending, String matchingRuleId) {
- super();
- this.attributeId = attributeId;
- this.ascending = ascending;
- this.matchingRuleId = matchingRuleId;
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public SortKey(String attrID, boolean ascendingOrder, String matchingRuleID) {
+ if (attrID == null) {
+ throw new NullPointerException("attrID "+Messages.getString("ldap.00"));
+ }
+ this.attrID = attrID;
+ this.ascendingOrder = ascendingOrder;
+ this.matchingRuleID = matchingRuleID;
}
+ /**
+ * @ar.org.fitc.spec_ref
+ */
public String getAttributeID() {
- return attributeId;
+ return attrID;
}
+ /**
+ * @ar.org.fitc.spec_ref
+ */
public String getMatchingRuleID() {
- return matchingRuleId;
+ return matchingRuleID;
}
+ /**
+ * @ar.org.fitc.spec_ref
+ */
public boolean isAscending() {
- return ascending;
+ return ascendingOrder;
}
+
}
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+import java.io.IOException;
+import java.math.BigInteger;
+
+import javax.naming.NamingException;
+
+import org.apache.harmony.jndi.internal.SortResult;
+import org.apache.harmony.jndi.internal.Util;
+import org.apache.harmony.security.asn1.ASN1Enumerated;
+import org.apache.harmony.security.asn1.ASN1OctetString;
+import org.apache.harmony.security.asn1.ASN1Sequence;
+import org.apache.harmony.security.asn1.ASN1Type;
+import org.apache.harmony.security.asn1.BerInputStream;
+
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ * @author Osvaldo C. Demo
+ *
+ */
+public final class SortResponseControl extends BasicControl {
+
+ /**
+ * Represents the following ASN1 Syntax to use with the Harmony ASN1 Parser:<br><br>
+ *
+ * SortResult ::= SEQUENCE {
+ * sortResult ENUMERATED {
+ * success (0), -- results are sorted
+ * operationsError (1), -- server internal failure
+ * timeLimitExceeded (3), -- timelimit reached before
+ * -- sorting was completed
+ * strongAuthRequired (8), -- refused to return sorted
+ * -- results via insecure
+ * -- protocol
+ * adminLimitExceeded (11), -- too many matching entries
+ * -- for the server to sort
+ * noSuchAttribute (16), -- unrecognized attribute
+ * -- type in sort key
+ * inappropriateMatching (18), -- unrecognized or
+ * -- inappropriate matching
+ * -- rule in sort key
+ * insufficientAccessRights (50), -- refused to return sorted
+ * -- results to this client
+ * busy (51), -- too busy to process
+ * unwillingToPerform (53), -- unable to sort
+ * other (80)
+ * },
+ * attributeType [0] AttributeDescription OPTIONAL }
+ *
+ */
+ public static ASN1Type ASN1_SORTRESPONSE = new ASN1Sequence(new ASN1Type[] {
+ ASN1Enumerated.getInstance(), // sortResult
+ ASN1OctetString.getInstance(), // attributeType
+ }) {
+
+ {
+ setOptional(1);
+ }
+
+ public Object getDecodedObject(BerInputStream in) {
+ Object values[] = (Object[])in.content;
+ int sortresult = new BigInteger((byte[]) values[0]).intValue();
+ String attrtype= null;
+ try {
+ attrtype = new String((byte[])values[1]);
+ } catch (NullPointerException e) {
+ }
+ return new SortResult(sortresult,attrtype);
+ }
+
+ };
+
+ private static final long serialVersionUID = 5142939176006310877L;
+
+ private SortResult sr;
+
+ private boolean sorted = false;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public static final String OID = "1.2.840.113556.1.4.474";
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public SortResponseControl(String id, boolean criticality, byte[] value) throws IOException {
+ super(OID,criticality,value);
+ this.sr = (SortResult) ASN1_SORTRESPONSE.decode(value);
+ if (getResultCode() == 0) {
+ sorted = true;
+ } else {
+ sorted = false;
+ }
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public String getAttributeID () {
+ return sr.getAttributeType();
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public int getResultCode () {
+ return sr.getSortresult();
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public boolean isSorted () {
+ return sorted;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public NamingException getException () {
+ return Util.getExceptionFromErrorCode(getResultCode());
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/SortResponseControl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsRequest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsRequest.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsRequest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsRequest.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+import javax.naming.NamingException;
+
+import org.apache.harmony.jndi.internal.nls.Messages;
+import org.apache.harmony.jndi.internal.tls.config.ClassFinder;
+import org.apache.harmony.jndi.internal.tls.config.ConfigFileNotFound;
+import org.apache.harmony.jndi.internal.tls.config.MergePath;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ *
+ * @author Osvaldo C. Demo
+ *
+ */
+public class StartTlsRequest implements ExtendedRequest {
+
+ private static final long serialVersionUID = 4441679576360753397L;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public static final String OID = "1.3.6.1.4.1.1466.20037";
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public StartTlsRequest() {
+
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public byte[] getEncodedValue() {
+ return null;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public ExtendedResponse createExtendedResponse(String id, byte[] berValue,
+ int offset, int length) throws NamingException {
+ if (!id.equals("1.3.6.1.4.1.1466.20037")) {
+ throw new NamingException(
+ Messages.getString("ldap.07") +" "+ id);
+ }
+ MergePath p = new MergePath(new String[] {
+ System.getProperty("user.dir"),
+ System.getProperty("java.home"),
+ System.getProperty("org.apache.harmony.boot.class.path") });
+ ClassFinder cf = new ClassFinder(p.getPathNames());
+ String[] classList;
+ Class retClass;
+ try {
+ classList = cf.getClassList();
+ for (int i = 0; i < classList.length; i++) {
+ try {
+ retClass = Class.forName(classList[i], true, Thread
+ .currentThread().getContextClassLoader());
+ try {
+ return (StartTlsResponse) retClass.newInstance();
+ } catch (InstantiationException e) {
+ } catch (IllegalAccessException e) {
+ } catch (ClassCastException e) {
+ }
+ } catch (ClassNotFoundException e) {
+ }
+ }
+ throw new NamingException(Messages.getString("ldap.08")+" "+ classList);
+ } catch (ConfigFileNotFound e) {
+ throw new NamingException(Messages.getString("ldap.09"));
+ // return new TlsResponseImpl(); TODO This should return a provider
+ // default implementation
+ }
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public String getID() {
+ return OID;
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsRequest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsResponse.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsResponse.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsResponse.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsResponse.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.naming.ldap;
+
+import java.io.IOException;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocketFactory;
+
+/**
+ *
+ * @ar.org.fitc.spec_ref
+ *
+ * @version 0.0.1
+ *
+ * @author Osvaldo C. Demo
+ *
+ */
+public abstract class StartTlsResponse implements ExtendedResponse {
+
+ public static final String OID = "1.3.6.1.4.1.1466.20037";
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ protected StartTlsResponse() {
+
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public byte[] getEncodedValue() {
+ return null;
+ }
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public abstract SSLSession negotiate() throws IOException;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public abstract SSLSession negotiate(SSLSocketFactory factory)
+ throws IOException;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public abstract void setEnabledCipherSuites(String[] suites);
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public abstract void setHostnameVerifier(HostnameVerifier verifier);
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public abstract void close() throws IOException;
+
+ /**
+ * @ar.org.fitc.spec_ref
+ */
+ public String getID() {
+ return OID;
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ldap/StartTlsResponse.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/PagedResultSearchControlValue.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/PagedResultSearchControlValue.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/PagedResultSearchControlValue.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/PagedResultSearchControlValue.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.jndi.internal;
+
+/**
+ * Represents the following ASN1 Syntax on java Types:
+ *
+ * realSearchControlValue ::= SEQUENCE {
+ * size INTEGER (0..maxInt),
+ * -- requested page size from client
+ * -- result set size estimate from server
+ * cookie OCTET STRING
+ * }
+ *
+ * @author Osvaldo C. Demo
+ * @author Juan Giannuzzo
+ */
+public class PagedResultSearchControlValue {
+
+ private byte[] cookie;
+ private int size;
+
+ /**
+ * Constructor
+ *
+ * @param size an int with the size
+ * @param cookie the cookie from the server
+ */
+ public PagedResultSearchControlValue(int size, byte[] cookie) {
+ this.cookie = cookie;
+ this.size = size;
+ }
+
+ /**
+ * Getter method for cookie
+ *
+ * @return the cookie
+ */
+ public byte[] getCookie() {
+ return cookie;
+ }
+
+ /**
+ * Getter method for size
+ *
+ * @return the size
+ */
+ public int getSize() {
+ return size;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/PagedResultSearchControlValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/SortResult.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/SortResult.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/SortResult.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/SortResult.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.jndi.internal;
+
+import java.io.Serializable;
+
+/**
+ * Represents the following ASN1 Syntax to use with the Harmony ASN1 Parser:<br><br>
+ *
+ * SortResult ::= SEQUENCE {
+ * sortResult ENUMERATED {
+ * success (0), -- results are sorted
+ * operationsError (1), -- server internal failure
+ * timeLimitExceeded (3), -- timelimit reached before
+ * -- sorting was completed
+ * strongAuthRequired (8), -- refused to return sorted
+ * -- results via insecure
+ * -- protocol
+ * adminLimitExceeded (11), -- too many matching entries
+ * -- for the server to sort
+ * noSuchAttribute (16), -- unrecognized attribute
+ * -- type in sort key
+ * inappropriateMatching (18), -- unrecognized or
+ * -- inappropriate matching
+ * -- rule in sort key
+ * insufficientAccessRights (50), -- refused to return sorted
+ * -- results to this client
+ * busy (51), -- too busy to process
+ * unwillingToPerform (53), -- unable to sort
+ * other (80)
+ * },
+ * attributeType [0] AttributeDescription OPTIONAL }
+ *
+ * @author Osvaldo C. Demo
+ *
+ */
+public class SortResult implements Serializable{
+
+ private static final long serialVersionUID = 3633917983682858021L;
+
+ private int sortresult;
+ private String attributeType;
+
+ public SortResult(int sortresult, String attrtype) {
+ this.sortresult = sortresult;
+ this.attributeType = attrtype;
+ }
+
+ public String getAttributeType() {
+ return attributeType;
+ }
+
+ public int getSortresult() {
+ return sortresult;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/SortResult.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/Util.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/Util.java?view=auto&rev=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/Util.java (added)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/Util.java Wed Feb 14 13:42:41 2007
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.jndi.internal;
+
+import java.util.HashMap;
+
+import javax.naming.AuthenticationNotSupportedException;
+import javax.naming.CommunicationException;
+import javax.naming.LimitExceededException;
+import javax.naming.NamingException;
+import javax.naming.NoPermissionException;
+import javax.naming.OperationNotSupportedException;
+import javax.naming.PartialResultException;
+import javax.naming.ServiceUnavailableException;
+import javax.naming.SizeLimitExceededException;
+import javax.naming.TimeLimitExceededException;
+import javax.naming.directory.InvalidSearchFilterException;
+import javax.naming.directory.NoSuchAttributeException;
+
+import org.apache.harmony.jndi.internal.nls.Messages;
+
+/**
+ * Some useful utilities
+ *
+ * @author Osvaldo C. Demo
+ *
+ */
+public class Util {
+
+ private static HashMap errorCodes = new HashMap();
+
+ static {
+ // TODO Add every needed LDAP errror code description and exception
+ errorCodes.put(1,new NamingException(Messages.getString("ldap.0A")));
+ errorCodes.put(2,new CommunicationException(Messages.getString("ldap.0B")));
+ errorCodes.put(3,new TimeLimitExceededException(Messages.getString("ldap.0C")));
+ errorCodes.put(4,new SizeLimitExceededException(Messages.getString("ldap.0D")));
+ errorCodes.put(7,new AuthenticationNotSupportedException(Messages.getString("ldap.0E")));
+ errorCodes.put(8,new AuthenticationNotSupportedException(Messages.getString("ldap.0F")));
+ errorCodes.put(9,new PartialResultException(Messages.getString("ldap.10")));
+ errorCodes.put(11,new LimitExceededException(Messages.getString("ldap.11")));
+ errorCodes.put(16,new NoSuchAttributeException(Messages.getString("ldap.12")));
+ errorCodes.put(18,new InvalidSearchFilterException(Messages.getString("ldap.13")));
+ errorCodes.put(50,new NoPermissionException(Messages.getString("ldap.14")));
+ errorCodes.put(51,new ServiceUnavailableException(Messages.getString("ldap.15")));
+ errorCodes.put(53,new OperationNotSupportedException(Messages.getString("ldap.16")));
+ errorCodes.put(80,new NamingException(Messages.getString("ldap.17")));
+ }
+
+ /**
+ * Return the correct exception for a given error code
+ *
+ * @param code error code
+ * @return the correct NamingException
+ */
+ public static NamingException getExceptionFromErrorCode(int code) {
+ if (code == 0) {
+ return null;
+ }
+ if (errorCodes.get(code) == null) {
+ return new NamingException(Messages.getString("ldap.18")+" "+code+"]");
+ } else {
+ return (NamingException)errorCodes.get(code);
+ }
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/Util.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java?view=diff&rev=507703&r1=507702&r2=507703
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/nls/Messages.java Wed Feb 14 13:42:41 2007
@@ -1,18 +1,18 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
/*
@@ -23,7 +23,6 @@
package org.apache.harmony.jndi.internal.nls;
-
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Locale;
@@ -38,7 +37,7 @@
* <p>
* It is used by the system classes to provide national language support, by
* looking up messages in the <code>
- * org.apache.harmony.jndi.internal.nls.messages
+ * org.apache.harmony.math.internal.nls.messages
* </code>
* resource bundle. Note that if this file is not available, or an invalid key
* is looked up, or resource bundle support is not available, the key itself
@@ -235,7 +234,7 @@
// Attempt to load the messages.
try {
bundle = setLocale(Locale.getDefault(),
- "org.apache.harmony.jndi.internal.nls.messages"); //$NON-NLS-1$
+ "org.apache.harmony.math.internal.nls.messages"); //$NON-NLS-1$
} catch (Throwable e) {
e.printStackTrace();
}