You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2012/01/24 18:44:32 UTC
svn commit: r1235374 [8/27] - in /directory/shared/trunk:
ldap/model/src/main/java/org/apache/directory/shared/ldap/model/constants/
ldap/model/src/main/java/org/apache/directory/shared/ldap/model/csn/
ldap/model/src/main/java/org/apache/directory/shar...
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchParams.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchParams.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchParams.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchParams.java Tue Jan 24 17:44:03 2012
@@ -314,7 +314,7 @@ public class SearchParams
if ( returningAttributesStr.size() != 0 )
{
- sb.append( " returning attributes : " ).append( Strings.setToString(returningAttributesStr) )
+ sb.append( " returning attributes : " ).append( Strings.setToString( returningAttributesStr ) )
.append( "\n" );
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchRequest.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchRequest.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchRequest.java Tue Jan 24 17:44:03 2012
@@ -248,20 +248,20 @@ public interface SearchRequest extends M
* {@inheritDoc}
*/
SearchRequest setMessageId( int messageId );
-
-
+
+
/**
* {@inheritDoc}
*/
SearchRequest addControl( Control control ) throws MessageException;
-
-
+
+
/**
* {@inheritDoc}
*/
SearchRequest addAllControls( Control[] controls ) throws MessageException;
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchRequestImpl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchRequestImpl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchRequestImpl.java Tue Jan 24 17:44:03 2012
@@ -89,7 +89,6 @@ public class SearchRequestImpl extends A
// SearchRequest Interface Method Implementations
// ------------------------------------------------------------------------
-
/**
* {@inheritDoc}
*/
@@ -116,7 +115,7 @@ public class SearchRequestImpl extends A
public SearchRequest setBase( Dn base )
{
baseDn = base;
-
+
return this;
}
@@ -136,7 +135,7 @@ public class SearchRequestImpl extends A
public SearchRequest setDerefAliases( AliasDerefMode aliasDerefAliases )
{
this.aliasDerefMode = aliasDerefAliases;
-
+
return this;
}
@@ -174,7 +173,7 @@ public class SearchRequestImpl extends A
String msg = "The filter" + filter + " is invalid.";
throw new LdapProtocolErrorException( msg, pe );
}
-
+
return this;
}
@@ -203,7 +202,7 @@ public class SearchRequestImpl extends A
public SearchRequest setScope( SearchScope scope )
{
this.scope = scope;
-
+
return this;
}
@@ -223,7 +222,7 @@ public class SearchRequestImpl extends A
public SearchRequest setSizeLimit( long entriesMax )
{
sizeLimit = entriesMax;
-
+
return this;
}
@@ -243,7 +242,7 @@ public class SearchRequestImpl extends A
public SearchRequest setTimeLimit( int secondsMax )
{
timeLimit = secondsMax;
-
+
return this;
}
@@ -263,7 +262,7 @@ public class SearchRequestImpl extends A
public SearchRequest setTypesOnly( boolean typesOnly )
{
this.typesOnly = typesOnly;
-
+
return this;
}
@@ -274,7 +273,7 @@ public class SearchRequestImpl extends A
public SearchRequest addAttributes( String... attributesToAdd )
{
this.attributes.addAll( Arrays.asList( attributesToAdd ) );
-
+
return this;
}
@@ -285,7 +284,7 @@ public class SearchRequestImpl extends A
public SearchRequest removeAttribute( String attribute )
{
attributes.remove( attribute );
-
+
return this;
}
@@ -302,43 +301,43 @@ public class SearchRequestImpl extends A
return response;
}
-
-
+
+
/**
* {@inheritDoc}
*/
public SearchRequest setMessageId( int messageId )
{
super.setMessageId( messageId );
-
+
return this;
}
-
+
/**
* {@inheritDoc}
*/
public SearchRequest addControl( Control control ) throws MessageException
{
- return (SearchRequest)super.addControl( control );
+ return ( SearchRequest ) super.addControl( control );
}
-
-
+
+
/**
* {@inheritDoc}
*/
public SearchRequest addAllControls( Control[] controls ) throws MessageException
{
- return (SearchRequest)super.addAllControls( controls );
+ return ( SearchRequest ) super.addAllControls( controls );
}
-
-
+
+
/**
* {@inheritDoc}
*/
public SearchRequest removeControl( Control control ) throws MessageException
{
- return (SearchRequest)super.removeControl( control );
+ return ( SearchRequest ) super.removeControl( control );
}
@@ -400,7 +399,7 @@ public class SearchRequestImpl extends A
return true;
}
- if ( ! super.equals( obj ) )
+ if ( !super.equals( obj ) )
{
return false;
}
@@ -456,7 +455,7 @@ public class SearchRequestImpl extends A
for ( String attribute : attributes )
{
- if ( ! req.getAttributes().contains( attribute ) )
+ if ( !req.getAttributes().contains( attribute ) )
{
return false;
}
@@ -575,10 +574,10 @@ public class SearchRequestImpl extends A
}
else
{
- sb.append(", ");
+ sb.append( ", " );
}
- sb.append('\'').append( attribute ).append('\'');
+ sb.append( '\'' ).append( attribute ).append( '\'' );
}
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchResultEntryImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchResultEntryImpl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchResultEntryImpl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchResultEntryImpl.java Tue Jan 24 17:44:03 2012
@@ -148,7 +148,7 @@ public class SearchResultEntryImpl exten
return false;
}
- if ( !( obj instanceof SearchResultEntry) )
+ if ( !( obj instanceof SearchResultEntry ) )
{
return false;
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchResultReferenceImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchResultReferenceImpl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchResultReferenceImpl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchResultReferenceImpl.java Tue Jan 24 17:44:03 2012
@@ -59,7 +59,6 @@ public class SearchResultReferenceImpl e
// SearchResponseReference Interface Method Implementations
// ------------------------------------------------------------------------
-
/**
* Gets the sequence of LdapUrls as a Referral instance.
*
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchScope.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchScope.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchScope.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/SearchScope.java Tue Jan 24 17:44:03 2012
@@ -19,8 +19,10 @@
*/
package org.apache.directory.shared.ldap.model.message;
+
import org.apache.directory.shared.i18n.I18n;
+
/**
* A search scope enumerated type.
*
@@ -28,16 +30,16 @@ import org.apache.directory.shared.i18n.
*/
public enum SearchScope
{
- OBJECT( 0, "base" ),
- ONELEVEL( 1, "one" ),
- SUBTREE( 2, "sub" );
-
+ OBJECT(0, "base"),
+ ONELEVEL(1, "one"),
+ SUBTREE(2, "sub");
+
/**
* The corresponding LDAP scope constant value as defined in
* RFC 4511
- */
+ */
private final int scope;
-
+
/**
* The LDAP URL string value of either base, one or sub as defined in RFC
* 2255.
@@ -45,7 +47,7 @@ public enum SearchScope
* @see <a href="http://www.faqs.org/rfcs/rfc2255.html">RFC 2255</a>
*/
private final String ldapUrlValue;
-
+
/**
* Creates a new instance of SearchScope based on the respective
@@ -60,7 +62,7 @@ public enum SearchScope
this.ldapUrlValue = ldapUrlValue;
}
-
+
/**
* Gets the LDAP URL value for the scope: according to RFC 2255 this is
* either base, one, or sub.
@@ -71,7 +73,7 @@ public enum SearchScope
{
return ldapUrlValue;
}
-
+
/**
* Gets the corresponding scope constant value as defined in
@@ -83,8 +85,8 @@ public enum SearchScope
{
return scope;
}
-
-
+
+
/**
* Gets the SearchScope enumerated type for the corresponding
* scope numeric value.
@@ -94,17 +96,17 @@ public enum SearchScope
*/
public static SearchScope getSearchScope( int scope )
{
- switch( scope )
+ switch ( scope )
{
- case 0 :
+ case 0:
return OBJECT;
-
- case 1 :
+
+ case 1:
return ONELEVEL;
-
- case 2 :
+
+ case 2:
return SUBTREE;
-
+
default:
throw new IllegalArgumentException( I18n.err( I18n.ERR_04160, scope ) );
}
@@ -137,8 +139,8 @@ public enum SearchScope
throw new IllegalArgumentException( I18n.err( I18n.ERR_04161, ldapUrlValue ) );
}
}
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/UnbindRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/UnbindRequest.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/UnbindRequest.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/UnbindRequest.java Tue Jan 24 17:44:03 2012
@@ -19,6 +19,7 @@
*/
package org.apache.directory.shared.ldap.model.message;
+
import org.apache.directory.shared.ldap.model.exception.MessageException;
@@ -37,20 +38,20 @@ public interface UnbindRequest extends R
* {@inheritDoc}
*/
UnbindRequest setMessageId( int messageId );
-
-
+
+
/**
* {@inheritDoc}
*/
UnbindRequest addControl( Control control ) throws MessageException;
-
-
+
+
/**
* {@inheritDoc}
*/
UnbindRequest addAllControls( Control[] controls ) throws MessageException;
-
-
+
+
/**
* {@inheritDoc}
*/
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/UnbindRequestImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/UnbindRequestImpl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/UnbindRequestImpl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/UnbindRequestImpl.java Tue Jan 24 17:44:03 2012
@@ -55,43 +55,43 @@ public class UnbindRequestImpl extends A
{
throw new UnsupportedOperationException( I18n.err( I18n.ERR_04185 ) );
}
-
-
+
+
/**
* {@inheritDoc}
*/
public UnbindRequest setMessageId( int messageId )
{
super.setMessageId( messageId );
-
+
return this;
}
-
+
/**
* {@inheritDoc}
*/
public UnbindRequest addControl( Control control ) throws MessageException
{
- return (UnbindRequest)super.addControl( control );
+ return ( UnbindRequest ) super.addControl( control );
}
-
-
+
+
/**
* {@inheritDoc}
*/
public UnbindRequest addAllControls( Control[] controls ) throws MessageException
{
- return (UnbindRequest)super.addAllControls( controls );
+ return ( UnbindRequest ) super.addAllControls( controls );
}
-
-
+
+
/**
* {@inheritDoc}
*/
public UnbindRequest removeControl( Control control ) throws MessageException
{
- return (UnbindRequest)super.removeControl( control );
+ return ( UnbindRequest ) super.removeControl( control );
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/AbstractControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/AbstractControl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/AbstractControl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/AbstractControl.java Tue Jan 24 17:44:03 2012
@@ -74,7 +74,7 @@ public abstract class AbstractControl im
return oid == null ? "" : oid;
}
-
+
/**
* Get the criticality
*
@@ -95,21 +95,21 @@ public abstract class AbstractControl im
{
this.criticality = criticality;
}
-
-
+
+
/**
* @see Object#hashCode()
*/
public int hashCode()
{
int h = 17;
- h = h*37 + ( criticality ? 1 : 0 );
- h = h*37 + ( oid == null ? 0 : oid.hashCode() );
-
+ h = h * 37 + ( criticality ? 1 : 0 );
+ h = h * 37 + ( oid == null ? 0 : oid.hashCode() );
+
return h;
}
-
+
/**
* @see Object#equals(Object)
*/
@@ -125,7 +125,7 @@ public abstract class AbstractControl im
return false;
}
- if ( !( o instanceof Control) )
+ if ( !( o instanceof Control ) )
{
return false;
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/CascadeImpl.java Tue Jan 24 17:44:03 2012
@@ -47,7 +47,7 @@ public class CascadeImpl extends Abstrac
}
- public void setValue( byte [] value )
+ public void setValue( byte[] value )
{
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java Tue Jan 24 17:44:03 2012
@@ -115,8 +115,8 @@ public class EntryChangeImpl extends Abs
EntryChange otherControl = ( EntryChange ) o;
return ( changeNumber == otherControl.getChangeNumber() ) &&
- ( changeType == otherControl.getChangeType() ) &&
- ( previousDn.equals( otherControl.getPreviousDn() ) );
+ ( changeType == otherControl.getChangeType() ) &&
+ ( previousDn.equals( otherControl.getPreviousDn() ) );
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/OpaqueControl.java Tue Jan 24 17:44:03 2012
@@ -37,7 +37,8 @@ public final class OpaqueControl extends
{
/** The opaque encoded value */
private byte[] value;
-
+
+
/**
* Creates a Control with a specific OID.
*
@@ -57,7 +58,7 @@ public final class OpaqueControl extends
*/
public OpaqueControl( String oid, boolean criticality )
{
- super( oid, criticality);
+ super( oid, criticality );
}
@@ -68,8 +69,8 @@ public final class OpaqueControl extends
{
return value;
}
-
-
+
+
/**
* Stores an opaque value into the control.
*
@@ -79,8 +80,8 @@ public final class OpaqueControl extends
{
this.value = Strings.copy( value );
}
-
-
+
+
/**
* Tells if the control has a stored value. Note that if the
* control has an empty value, this method will return true.
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResults.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResults.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResults.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResults.java Tue Jan 24 17:44:03 2012
@@ -65,6 +65,7 @@ public interface PagedResults extends Co
*/
int getSize();
+
/**
* Set the number of entry requested or returned
*
@@ -72,11 +73,13 @@ public interface PagedResults extends Co
*/
void setSize( int size );
+
/**
* @return The stored cookie
*/
byte[] getCookie();
+
/**
* Set the cookie
*
@@ -84,6 +87,7 @@ public interface PagedResults extends Co
*/
void setCookie( byte[] cookie );
+
/**
* @return The integer value for the current cookie
*/
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearch.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearch.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearch.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearch.java Tue Jan 24 17:44:03 2012
@@ -36,23 +36,31 @@ public interface PersistentSearch extend
int CHANGE_TYPES_MIN = ChangeType.ADD.getValue();
int CHANGE_TYPES_MAX = ChangeType.ADD.getValue()
- | ChangeType.DELETE.getValue()
- | ChangeType.MODIFY.getValue()
- | ChangeType.MODDN.getValue();
+ | ChangeType.DELETE.getValue()
+ | ChangeType.MODIFY.getValue()
+ | ChangeType.MODDN.getValue();
+
void setChangesOnly( boolean changesOnly );
+
boolean isChangesOnly();
+
void setReturnECs( boolean returnECs );
+
boolean isReturnECs();
+
void setChangeTypes( int changeTypes );
+
int getChangeTypes();
+
boolean isNotificationEnabled( ChangeType changeType );
+
void enableNotification( ChangeType changeType );
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java Tue Jan 24 17:44:03 2012
@@ -20,8 +20,6 @@
package org.apache.directory.shared.ldap.model.message.controls;
-
-
/**
* A persistence search object
*
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Subentries.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Subentries.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Subentries.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Subentries.java Tue Jan 24 17:44:03 2012
@@ -57,6 +57,7 @@ public interface Subentries extends Cont
/** The control OID */
String OID = "1.3.6.1.4.1.4203.1.10.1";
+
/**
* Check if the subEntry is visible
*
@@ -64,6 +65,7 @@ public interface Subentries extends Cont
*/
boolean isVisible();
+
/**
* Set the visibility flag
*
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java Tue Jan 24 17:44:03 2012
@@ -20,8 +20,6 @@
package org.apache.directory.shared.ldap.model.message.controls;
-
-
/**
* A simple Subentries Control implementation. This control is described in
* RFC 3672 :
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Ava.java Tue Jan 24 17:44:03 2012
@@ -70,7 +70,7 @@ public class Ava implements Externalizab
/** The normalized Name type */
private String normType;
-
+
/** The user provided Name type */
private String upType;
@@ -88,10 +88,11 @@ public class Ava implements Externalizab
/** the schema manager */
private SchemaManager schemaManager;
-
+
/** The computed hashcode */
private volatile int h;
+
/**
* Constructs an empty Ava
*/
@@ -100,7 +101,7 @@ public class Ava implements Externalizab
this( null );
}
-
+
/**
* Constructs an empty schema aware Ava.
*
@@ -116,8 +117,8 @@ public class Ava implements Externalizab
this.schemaManager = schemaManager;
this.attributeType = null;
}
-
-
+
+
/**
* Construct an Ava containing a binary value.
* <p>
@@ -134,7 +135,7 @@ public class Ava implements Externalizab
this( null, upType, upValue );
}
-
+
/**
* Construct a schema aware Ava containing a binary value. The AttributeType
* and value will be normalized accordingly to the given SchemaManager.
@@ -151,25 +152,25 @@ public class Ava implements Externalizab
public Ava( SchemaManager schemaManager, String upType, byte[] upValue ) throws LdapInvalidDnException
{
if ( schemaManager != null )
- {
+ {
try
{
attributeType = schemaManager.lookupAttributeTypeRegistry( upType );
}
catch ( LdapException le )
{
- String message = I18n.err( I18n.ERR_04188 );
+ String message = I18n.err( I18n.ERR_04188 );
LOG.error( message );
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, le );
}
-
+
try
- {
+ {
createAva( schemaManager, upType, new BinaryValue( attributeType, upValue ) );
}
catch ( LdapInvalidAttributeValueException liave )
{
- String message = I18n.err( I18n.ERR_04188 );
+ String message = I18n.err( I18n.ERR_04188 );
LOG.error( message );
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, liave );
}
@@ -180,7 +181,7 @@ public class Ava implements Externalizab
}
}
-
+
/**
* Construct an Ava with a String value.
* <p>
@@ -196,8 +197,8 @@ public class Ava implements Externalizab
{
this( null, upType, upValue );
}
-
-
+
+
/**
* Construct a schema aware Ava with a String value.
* <p>
@@ -213,25 +214,25 @@ public class Ava implements Externalizab
public Ava( SchemaManager schemaManager, String upType, String upValue ) throws LdapInvalidDnException
{
if ( schemaManager != null )
- {
+ {
try
{
attributeType = schemaManager.lookupAttributeTypeRegistry( upType );
}
catch ( LdapException le )
{
- String message = I18n.err( I18n.ERR_04188 );
+ String message = I18n.err( I18n.ERR_04188 );
LOG.error( message );
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, le );
}
-
+
try
- {
+ {
createAva( schemaManager, upType, new StringValue( attributeType, upValue ) );
}
catch ( LdapInvalidAttributeValueException liave )
{
- String message = I18n.err( I18n.ERR_04188 );
+ String message = I18n.err( I18n.ERR_04188 );
LOG.error( message );
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, liave );
}
@@ -242,7 +243,7 @@ public class Ava implements Externalizab
}
}
-
+
/**
* Construct a schema aware Ava. The AttributeType and value will be checked accordingly
* to the SchemaManager.
@@ -256,15 +257,16 @@ public class Ava implements Externalizab
*
* @throws LdapInvalidDnException If the given type or value are invalid
*/
- private void createAva( SchemaManager schemaManager, String upType, Value<?> upValue ) throws LdapInvalidDnException
+ private void createAva( SchemaManager schemaManager, String upType, Value<?> upValue )
+ throws LdapInvalidDnException
{
normType = attributeType.getOid();
this.upType = upType;
-
+
try
{
MatchingRule equalityMatchingRule = attributeType.getEquality();
-
+
if ( equalityMatchingRule != null )
{
this.normValue = equalityMatchingRule.getNormalizer().normalize( upValue );
@@ -276,18 +278,18 @@ public class Ava implements Externalizab
}
catch ( LdapException le )
{
- String message = I18n.err( I18n.ERR_04188 );
+ String message = I18n.err( I18n.ERR_04188 );
LOG.error( message );
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, le );
}
this.upValue = upValue;
-
+
upName = this.upType + '=' + ( this.upValue == null ? "" : this.upValue.getString() );
hashCode();
}
-
+
/**
* Construct an Ava. The type and value are normalized :
* <li> the type is trimmed and lowercased </li>
@@ -303,14 +305,14 @@ public class Ava implements Externalizab
*/
private void createAva( String upType, Value<?> upValue ) throws LdapInvalidDnException
{
- String upTypeTrimmed = Strings.trim(upType);
- String normTypeTrimmed = Strings.trim(normType);
-
- if ( Strings.isEmpty(upTypeTrimmed) )
+ String upTypeTrimmed = Strings.trim( upType );
+ String normTypeTrimmed = Strings.trim( normType );
+
+ if ( Strings.isEmpty( upTypeTrimmed ) )
{
- if ( Strings.isEmpty(normTypeTrimmed) )
+ if ( Strings.isEmpty( normTypeTrimmed ) )
{
- String message = I18n.err( I18n.ERR_04188 );
+ String message = I18n.err( I18n.ERR_04188 );
LOG.error( message );
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message );
}
@@ -321,7 +323,7 @@ public class Ava implements Externalizab
this.upType = normType;
}
}
- else if ( Strings.isEmpty(normTypeTrimmed) )
+ else if ( Strings.isEmpty( normTypeTrimmed ) )
{
// In this case, we will use the upType instead
this.normType = Strings.lowerCaseAscii( upTypeTrimmed );
@@ -331,12 +333,12 @@ public class Ava implements Externalizab
{
this.normType = Strings.lowerCaseAscii( normTypeTrimmed );
this.upType = upType;
-
+
}
-
+
this.normValue = upValue;
this.upValue = upValue;
-
+
upName = this.upType + '=' + ( this.upValue == null ? "" : this.upValue.getString() );
hashCode();
}
@@ -361,7 +363,8 @@ public class Ava implements Externalizab
// WARNING : The protection level is left unspecified intentionally.
// We need this method to be visible from the DnParser class, but not
// from outside this package.
- /* Unspecified protection */ Ava( SchemaManager schemaManager, String upType, String normType, Value<?> upValue, Value<?> normValue )
+ /* Unspecified protection */Ava( SchemaManager schemaManager, String upType, String normType, Value<?> upValue,
+ Value<?> normValue )
throws LdapInvalidDnException
{
this.upType = upType;
@@ -369,7 +372,7 @@ public class Ava implements Externalizab
this.upValue = upValue;
this.normValue = normValue;
upName = this.upType + '=' + ( this.upValue == null ? "" : this.upValue.getString() );
-
+
if ( schemaManager != null )
{
apply( schemaManager );
@@ -398,7 +401,8 @@ public class Ava implements Externalizab
// WARNING : The protection level is left unspecified intentionally.
// We need this method to be visible from the DnParser class, but not
// from outside this package.
- /* Unspecified protection */ Ava( String upType, String normType, Value<?> upValue, Value<?> normValue, String upName )
+ /* Unspecified protection */Ava( String upType, String normType, Value<?> upValue, Value<?> normValue,
+ String upName )
throws LdapInvalidDnException
{
String upTypeTrimmed = Strings.trim( upType );
@@ -437,7 +441,7 @@ public class Ava implements Externalizab
hashCode();
}
-
+
/**
* Apply a SchemaManager to the Ava. It will normalize the Ava.<br/>
* If the Ava already had a SchemaManager, then the new SchemaManager will be
@@ -450,23 +454,23 @@ public class Ava implements Externalizab
public void apply( SchemaManager schemaManager ) throws LdapInvalidDnException
{
if ( schemaManager != null )
- {
+ {
this.schemaManager = schemaManager;
-
+
AttributeType attributeType = null;
-
+
try
{
attributeType = schemaManager.lookupAttributeTypeRegistry( normType );
}
catch ( LdapException le )
{
- String message = I18n.err( I18n.ERR_04188 );
+ String message = I18n.err( I18n.ERR_04188 );
LOG.error( message );
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, le );
}
-
- if ( this.attributeType == attributeType )
+
+ if ( this.attributeType == attributeType )
{
// No need to normalize again
return;
@@ -475,9 +479,9 @@ public class Ava implements Externalizab
{
this.attributeType = attributeType;
}
-
+
normType = attributeType.getOid();
-
+
if ( normValue != null )
{
return;
@@ -487,7 +491,7 @@ public class Ava implements Externalizab
{
// We use the Equality matching rule to normalize the value
MatchingRule equalityMatchingRule = attributeType.getEquality();
-
+
if ( equalityMatchingRule != null )
{
this.normValue = equalityMatchingRule.getNormalizer().normalize( upValue );
@@ -499,15 +503,15 @@ public class Ava implements Externalizab
}
catch ( LdapException le )
{
- String message = I18n.err( I18n.ERR_04188 );
+ String message = I18n.err( I18n.ERR_04188 );
LOG.error( message );
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, message, le );
}
-
+
hashCode();
}
}
-
+
/**
* Get the normalized type of a Ava
@@ -519,6 +523,7 @@ public class Ava implements Externalizab
return normType;
}
+
/**
* Get the user provided type of a Ava
*
@@ -540,6 +545,7 @@ public class Ava implements Externalizab
return normValue.clone();
}
+
/**
* Get the User Provided Value of a Ava
*
@@ -550,6 +556,7 @@ public class Ava implements Externalizab
return upValue.clone();
}
+
/**
* Get the normalized Name of a Ava
*
@@ -581,10 +588,10 @@ public class Ava implements Externalizab
{
try
{
- Ava clone = (Ava) super.clone();
+ Ava clone = ( Ava ) super.clone();
clone.upValue = upValue.clone();
clone.normValue = normValue.clone();
-
+
return clone;
}
catch ( CloneNotSupportedException cnse )
@@ -593,28 +600,132 @@ public class Ava implements Externalizab
}
}
-
private static final boolean[] DN_ESCAPED_CHARS = new boolean[]
{
- true, true, true, true, true, true, true, true, // 0x00 -> 0x07
- true, true, true, true, true, true, true, true, // 0x08 -> 0x0F
- true, true, true, true, true, true, true, true, // 0x10 -> 0x17
- true, true, true, true, true, true, true, true, // 0x18 -> 0x1F
- true, false, true, true, false, false, false, false, // 0x20 -> 0x27 ' ', '"', '#'
- false, false, false, true, true, false, false, false, // 0x28 -> 0x2F '+', ','
- false, false, false, false, false, false, false, false, // 0x30 -> 0x37
- false, false, false, true, true, false, true, false, // 0x38 -> 0x3F ';', '<', '>'
- false, false, false, false, false, false, false, false, // 0x40 -> 0x47
- false, false, false, false, false, false, false, false, // 0x48 -> 0x4F
- false, false, false, false, false, false, false, false, // 0x50 -> 0x57
- false, false, false, false, true, false, false, false, // 0x58 -> 0x5F
- false, false, false, false, false, false, false, false, // 0x60 -> 0x67
- false, false, false, false, false, false, false, false, // 0x68 -> 0x6F
- false, false, false, false, false, false, false, false, // 0x70 -> 0x77
- false, false, false, false, false, false, false, false, // 0x78 -> 0x7F
+ true, true, true, true, true, true, true, true, // 0x00 -> 0x07
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true, // 0x08 -> 0x0F
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true, // 0x10 -> 0x17
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ true, // 0x18 -> 0x1F
+ true,
+ false,
+ true,
+ true,
+ false,
+ false,
+ false,
+ false, // 0x20 -> 0x27 ' ', '"', '#'
+ false,
+ false,
+ false,
+ true,
+ true,
+ false,
+ false,
+ false, // 0x28 -> 0x2F '+', ','
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false, // 0x30 -> 0x37
+ false,
+ false,
+ false,
+ true,
+ true,
+ false,
+ true,
+ false, // 0x38 -> 0x3F ';', '<', '>'
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false, // 0x40 -> 0x47
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false, // 0x48 -> 0x4F
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false, // 0x50 -> 0x57
+ false,
+ false,
+ false,
+ false,
+ true,
+ false,
+ false,
+ false, // 0x58 -> 0x5F
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false, // 0x60 -> 0x67
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false, // 0x68 -> 0x6F
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false, // 0x70 -> 0x77
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false, // 0x78 -> 0x7F
};
-
-
+
+
/**
* Normalize the value in order to be able to use it in a DN as a String. Some
* characters will be escaped (prefixed with '\'),
@@ -625,8 +736,8 @@ public class Ava implements Externalizab
{
// The result will be gathered in a stringBuilder
StringBuilder sb = new StringBuilder();
-
- String normalizedValue = normValue.getString();
+
+ String normalizedValue = normValue.getString();
int valueLength = normalizedValue.length();
if ( normalizedValue.length() > 0 )
@@ -638,7 +749,7 @@ public class Ava implements Externalizab
{
char c = chars[i];
- if ( ( c >= 0 ) && ( c < DN_ESCAPED_CHARS.length ) && DN_ESCAPED_CHARS[ c ] )
+ if ( ( c >= 0 ) && ( c < DN_ESCAPED_CHARS.length ) && DN_ESCAPED_CHARS[c] )
{
// Some chars need to be escaped even if they are US ASCII
// Just prefix them with a '\'
@@ -646,7 +757,7 @@ public class Ava implements Externalizab
// treatment.
switch ( c )
{
- case ' ' :
+ case ' ':
if ( ( i == 0 ) || ( i == valueLength - 1 ) )
{
sb.append( "\\ " );
@@ -655,10 +766,10 @@ public class Ava implements Externalizab
{
sb.append( ' ' );
}
-
+
break;
-
- case '#' :
+
+ case '#':
if ( i == 0 )
{
sb.append( "\\#" );
@@ -668,10 +779,10 @@ public class Ava implements Externalizab
{
sb.append( '#' );
}
-
+
break;
- default :
+ default:
sb.append( '\\' ).append( c );
}
}
@@ -682,10 +793,10 @@ public class Ava implements Externalizab
}
}
}
-
+
return sb.toString();
}
-
+
/**
* A Normalized String representation of a Ava :
@@ -703,23 +814,23 @@ public class Ava implements Externalizab
{
// The result will be gathered in a stringBuilder
StringBuilder sb = new StringBuilder();
-
+
// First, store the type and the '=' char
sb.append( normType ).append( '=' );
-
+
String normalizedValue = normValue.getString();
-
+
if ( normalizedValue.length() > 0 )
{
sb.append( normalizeValue() );
}
-
+
return sb.toString();
}
else
{
return normType + "=#"
- + Strings.dumpHexPairs( normValue .getBytes() );
+ + Strings.dumpHexPairs( normValue.getBytes() );
}
}
@@ -735,14 +846,14 @@ public class Ava implements Externalizab
if ( h == 0 )
{
h = 37;
-
- h = h*17 + ( normType != null ? normType.hashCode() : 0 );
- h = h*17 + ( normValue != null ? normValue.hashCode() : 0 );
+
+ h = h * 17 + ( normType != null ? normType.hashCode() : 0 );
+ h = h * 17 + ( normValue != null ? normValue.hashCode() : 0 );
}
return h;
}
-
+
/**
* @see Object#equals(Object)
@@ -753,14 +864,14 @@ public class Ava implements Externalizab
{
return true;
}
-
- if ( !( obj instanceof Ava) )
+
+ if ( !( obj instanceof Ava ) )
{
return false;
}
-
- Ava instance = (Ava)obj;
-
+
+ Ava instance = ( Ava ) obj;
+
// Compare the type
if ( normType == null )
{
@@ -769,14 +880,14 @@ public class Ava implements Externalizab
return false;
}
}
- else
+ else
{
if ( !normType.equals( instance.normType ) )
{
return false;
}
}
-
+
// Compare the values
if ( normValue.isNull() )
{
@@ -787,12 +898,13 @@ public class Ava implements Externalizab
if ( schemaManager != null )
{
MatchingRule equalityMatchingRule = attributeType.getEquality();
-
+
if ( equalityMatchingRule != null )
{
- return equalityMatchingRule.getLdapComparator().compare( normValue.getValue(), instance.normValue.getValue() ) == 0;
+ return equalityMatchingRule.getLdapComparator().compare( normValue.getValue(),
+ instance.normValue.getValue() ) == 0;
}
-
+
return false;
}
else
@@ -802,7 +914,7 @@ public class Ava implements Externalizab
}
}
-
+
/**
*
* An Ava is composed of a type and a value.
@@ -867,16 +979,16 @@ public class Ava implements Externalizab
|| ( normValue.isNull() ) )
{
String message = "Cannot serialize an wrong ATAV, ";
-
- if ( Strings.isEmpty(upName) )
+
+ if ( Strings.isEmpty( upName ) )
{
message += "the upName should not be null or empty";
}
- else if ( Strings.isEmpty(upType) )
+ else if ( Strings.isEmpty( upType ) )
{
message += "the upType should not be null or empty";
}
- else if ( Strings.isEmpty(normType) )
+ else if ( Strings.isEmpty( normType ) )
{
message += "the normType should not be null or empty";
}
@@ -888,11 +1000,11 @@ public class Ava implements Externalizab
{
message += "the value should not be null";
}
-
+
LOG.error( message );
throw new IOException( message );
}
-
+
if ( upName != null )
{
out.writeBoolean( true );
@@ -900,9 +1012,9 @@ public class Ava implements Externalizab
}
else
{
- out.writeBoolean( false);
+ out.writeBoolean( false );
}
-
+
if ( upType != null )
{
out.writeBoolean( true );
@@ -910,9 +1022,9 @@ public class Ava implements Externalizab
}
else
{
- out.writeBoolean( false);
+ out.writeBoolean( false );
}
-
+
if ( normType != null )
{
out.writeBoolean( true );
@@ -920,23 +1032,23 @@ public class Ava implements Externalizab
}
else
{
- out.writeBoolean( false);
+ out.writeBoolean( false );
}
-
+
boolean isHR = normValue.isHumanReadable();
-
+
out.writeBoolean( isHR );
-
+
upValue.writeExternal( out );
normValue.writeExternal( out );
-
+
// Write the hashCode
out.writeInt( h );
-
+
out.flush();
}
-
-
+
+
/**
* We read back the data to create a new ATAV. The structure
* read is exposed in the {@link Ava#writeExternal(ObjectOutput)}
@@ -950,26 +1062,26 @@ public class Ava implements Externalizab
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
{
boolean hasUpName = in.readBoolean();
-
+
if ( hasUpName )
{
upName = in.readUTF();
}
-
+
boolean hasUpType = in.readBoolean();
if ( hasUpType )
{
upType = in.readUTF();
}
-
+
boolean hasNormType = in.readBoolean();
if ( hasNormType )
{
normType = in.readUTF();
}
-
+
if ( schemaManager != null )
{
if ( !Strings.isEmpty( upType ) )
@@ -981,7 +1093,7 @@ public class Ava implements Externalizab
attributeType = schemaManager.getAttributeType( normType );
}
}
-
+
boolean isHR = in.readBoolean();
if ( isHR )
@@ -1002,8 +1114,8 @@ public class Ava implements Externalizab
attributeType = schemaManager.getAttributeType( upType );
}
}
-
-
+
+
/**
* Tells if the Ava is schema aware or not.
*
@@ -1022,8 +1134,8 @@ public class Ava implements Externalizab
{
return attributeType;
}
-
-
+
+
/**
* A String representation of an Ava, as provided by the user.
*
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/ComplexDnParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/ComplexDnParser.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/ComplexDnParser.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/ComplexDnParser.java Tue Jan 24 17:44:03 2012
@@ -32,7 +32,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-/* No protection*/ class ComplexDnParser
+/* No protection*/class ComplexDnParser
{
/**
@@ -43,10 +43,10 @@ import org.apache.directory.shared.ldap.
*
* @throws LdapInvalidDnException the invalid name exception
*/
- /* No protection*/ void parseDn( String name, List<Rdn> rdns ) throws LdapInvalidDnException
+ /* No protection*/void parseDn( String name, List<Rdn> rdns ) throws LdapInvalidDnException
{
AntlrDnParser dnParser = new AntlrDnParser( new AntlrDnLexer( new StringReader( name ) ) );
-
+
try
{
dnParser.relativeDistinguishedNames( rdns );
@@ -66,10 +66,10 @@ import org.apache.directory.shared.ldap.
*
* @throws LdapInvalidDnException the invalid name exception
*/
- /* No protection*/ void parseRdn( String name, Rdn rdn ) throws LdapInvalidDnException
+ /* No protection*/void parseRdn( String name, Rdn rdn ) throws LdapInvalidDnException
{
AntlrDnParser dnParser = new AntlrDnParser( new AntlrDnLexer( new StringReader( name ) ) );
-
+
try
{
dnParser.relativeDistinguishedName( rdn );
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Dn.java Tue Jan 24 17:44:03 2012
@@ -114,7 +114,7 @@ public class Dn implements Iterable<Rdn>
/** the schema manager */
private SchemaManager schemaManager;
-
+
/**
* An iterator over RDNs
*/
@@ -123,6 +123,7 @@ public class Dn implements Iterable<Rdn>
// The current index
int index;
+
private RdnIterator()
{
index = rdns != null ? rdns.size() - 1 : -1;
@@ -202,7 +203,7 @@ public class Dn implements Iterable<Rdn>
* @param upRdns The list of String composing the Dn
* @throws LdapInvalidDnException If the resulting Dn is invalid
*/
- public Dn(String... upRdns) throws LdapInvalidDnException
+ public Dn( String... upRdns ) throws LdapInvalidDnException
{
this( null, upRdns );
}
@@ -243,7 +244,7 @@ public class Dn implements Iterable<Rdn>
{
continue;
}
-
+
if ( isFirst )
{
isFirst = false;
@@ -269,7 +270,7 @@ public class Dn implements Iterable<Rdn>
valueExpected = false;
}
}
-
+
if ( !isFirst && valueExpected )
{
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04202 ) );
@@ -294,7 +295,7 @@ public class Dn implements Iterable<Rdn>
* @param normName the normalized name
* @param rdns the list of RDNs for this Dn
*/
- /* No protection */ Dn( SchemaManager schemaManager, String upName, String normName, Rdn... rdns )
+ /* No protection */Dn( SchemaManager schemaManager, String upName, String normName, Rdn... rdns )
{
this.schemaManager = schemaManager;
this.upName = upName;
@@ -316,8 +317,8 @@ public class Dn implements Iterable<Rdn>
{
return;
}
-
- for ( Rdn rdn : rdns)
+
+ for ( Rdn rdn : rdns )
{
this.rdns.add( rdn.clone() );
}
@@ -340,12 +341,12 @@ public class Dn implements Iterable<Rdn>
{
throw new IllegalArgumentException( "Either the dn or the rdn is null" );
}
-
+
for ( Rdn rdnParent : dn )
{
rdns.add( 0, rdnParent );
}
-
+
rdns.add( 0, rdn );
apply( dn.schemaManager );
@@ -366,8 +367,8 @@ public class Dn implements Iterable<Rdn>
{
return;
}
-
- for ( Rdn rdn : rdns)
+
+ for ( Rdn rdn : rdns )
{
this.rdns.add( rdn.clone() );
}
@@ -385,8 +386,8 @@ public class Dn implements Iterable<Rdn>
{
return schemaManager;
}
-
-
+
+
/**
* Return the User Provided Dn as a String,
*
@@ -422,8 +423,8 @@ public class Dn implements Iterable<Rdn>
return upName;
}
-
-
+
+
/**
* Gets the hash code of this Dn.
*
@@ -462,7 +463,7 @@ public class Dn implements Iterable<Rdn>
*
* @param upName the new up name
*/
- /* No qualifier */ void setUpName( String upName )
+ /* No qualifier */void setUpName( String upName )
{
this.upName = upName;
}
@@ -661,7 +662,7 @@ public class Dn implements Iterable<Rdn>
{
return null;
}
-
+
if ( ( posn < 0 ) || ( posn >= rdns.size() ) )
{
throw new IllegalArgumentException( "Invalid position : " + posn );
@@ -684,7 +685,7 @@ public class Dn implements Iterable<Rdn>
{
return Rdn.EMPTY_RDN;
}
-
+
return rdns.get( 0 ).clone();
}
@@ -719,9 +720,8 @@ public class Dn implements Iterable<Rdn>
{
return getDescendantOf( new Dn( schemaManager, ancestor ) );
}
-
-
+
/**
* Get the descendant of a given DN, using the ancestr DN. Assuming that
* a DN has two parts :<br/>
@@ -742,14 +742,14 @@ public class Dn implements Iterable<Rdn>
{
return this;
}
-
+
if ( rdns.size() == 0 )
{
return EMPTY_DN;
}
-
+
int length = ancestor.size();
-
+
if ( length > rdns.size() )
{
String message = I18n.err( I18n.ERR_04206, length, rdns.size() );
@@ -759,12 +759,12 @@ public class Dn implements Iterable<Rdn>
Dn newDn = new Dn( schemaManager );
List<Rdn> rdnsAncestor = ancestor.getRdns();
-
+
for ( int i = 0; i < ancestor.size(); i++ )
{
- Rdn rdn = rdns.get( size() -1 - i );
+ Rdn rdn = rdns.get( size() - 1 - i );
Rdn rdnDescendant = rdnsAncestor.get( ancestor.size() - 1 - i );
-
+
if ( !rdn.equals( rdnDescendant ) )
{
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX );
@@ -783,6 +783,7 @@ public class Dn implements Iterable<Rdn>
return newDn;
}
+
/**
* Get the ancestor of a given DN, using the descendant DN. Assuming that
* a DN has two parts :<br/>
@@ -801,7 +802,7 @@ public class Dn implements Iterable<Rdn>
{
return getAncestorOf( new Dn( schemaManager, descendant ) );
}
-
+
/**
* Get the ancestor of a given DN, using the descendant DN. Assuming that
@@ -823,14 +824,14 @@ public class Dn implements Iterable<Rdn>
{
return this;
}
-
+
if ( rdns.size() == 0 )
{
return EMPTY_DN;
}
-
+
int length = descendant.size();
-
+
if ( length > rdns.size() )
{
String message = I18n.err( I18n.ERR_04206, length, rdns.size() );
@@ -840,12 +841,12 @@ public class Dn implements Iterable<Rdn>
Dn newDn = new Dn( schemaManager );
List<Rdn> rdnsDescendant = descendant.getRdns();
-
+
for ( int i = 0; i < descendant.size(); i++ )
{
Rdn rdn = rdns.get( i );
Rdn rdnDescendant = rdnsDescendant.get( i );
-
+
if ( !rdn.equals( rdnDescendant ) )
{
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX );
@@ -886,7 +887,7 @@ public class Dn implements Iterable<Rdn>
if ( clonedDn.size() != 0 )
{
clonedDn.normName = suffix.getNormName() + "," + normName;
- clonedDn.bytes = Strings.getBytesUtf8(normName);
+ clonedDn.bytes = Strings.getBytesUtf8( normName );
clonedDn.upName = suffix.getName() + "," + upName;
}
}
@@ -930,13 +931,13 @@ public class Dn implements Iterable<Rdn>
* @param newRdn the Rdn to add
* @return the updated cloned Dn
*/
- public Dn add( Rdn newRdn ) throws LdapInvalidDnException
+ public Dn add( Rdn newRdn ) throws LdapInvalidDnException
{
if ( ( newRdn == null ) || ( newRdn.size() == 0 ) )
{
return this;
}
-
+
Dn clonedDn = copy();
clonedDn.rdns.add( 0, newRdn.clone() );
@@ -960,7 +961,7 @@ public class Dn implements Iterable<Rdn>
{
return this;
}
-
+
int posn = rdns.size() - 1;
Dn newDn = new Dn( schemaManager );
@@ -1008,7 +1009,7 @@ public class Dn implements Iterable<Rdn>
* @return <code>true</code> if the two instances are equals
*/
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "EQ_CHECK_FOR_OPERAND_NOT_COMPATIBLE_WITH_THIS",
- justification = "String is a special case")
+ justification = "String is a special case")
@Override
public boolean equals( Object obj )
{
@@ -1016,9 +1017,9 @@ public class Dn implements Iterable<Rdn>
{
return normName.equals( obj );
}
- else if ( obj instanceof Dn)
+ else if ( obj instanceof Dn )
{
- Dn name = (Dn) obj;
+ Dn name = ( Dn ) obj;
if ( name.size() != this.size() )
{
@@ -1063,9 +1064,9 @@ public class Dn implements Iterable<Rdn>
{
return atav;
}
-
+
type = Strings.toLowerCase( type );
-
+
// Check that we have an existing AttributeType for this type
if ( !oidsMap.containsKey( type ) )
{
@@ -1088,7 +1089,7 @@ public class Dn implements Iterable<Rdn>
oidNormalizer.getNormalizer().normalize( atav.getNormValue() ),
atav.getUpName() );
newAva.apply( schemaManager );
-
+
return newAva;
}
catch ( LdapException le )
@@ -1155,7 +1156,7 @@ public class Dn implements Iterable<Rdn>
{
bytes = null;
normName = "";
-
+
return this;
}
@@ -1182,7 +1183,7 @@ public class Dn implements Iterable<Rdn>
if ( ( normName == null ) || !normName.equals( newNormName ) )
{
- bytes = Strings.getBytesUtf8(newNormName);
+ bytes = Strings.getBytesUtf8( newNormName );
normName = newNormName;
}
@@ -1219,12 +1220,12 @@ public class Dn implements Iterable<Rdn>
if ( ( normName == null ) || !normName.equals( newNormName ) )
{
- bytes = Strings.getBytesUtf8(newNormName);
+ bytes = Strings.getBytesUtf8( newNormName );
normName = newNormName;
}
}
}
-
+
return this;
}
@@ -1276,8 +1277,8 @@ public class Dn implements Iterable<Rdn>
{
return ( dn == null ) || dn.isEmpty();
}
-
-
+
+
/**
* Check if a DistinguishedName is syntactically valid.
*
@@ -1288,7 +1289,7 @@ public class Dn implements Iterable<Rdn>
public static boolean isValid( String name )
{
Dn dn = new Dn();
-
+
try
{
parseInternal( name, dn.rdns );
@@ -1300,7 +1301,7 @@ public class Dn implements Iterable<Rdn>
}
}
-
+
/**
* Parse a Dn.
*
@@ -1343,9 +1344,9 @@ public class Dn implements Iterable<Rdn>
// Read the RDNs. Is it's null, the number will be -1.
int nbRdns = in.readInt();
-
+
rdns = new ArrayList<Rdn>( nbRdns );
-
+
for ( int i = 0; i < nbRdns; i++ )
{
Rdn rdn = new Rdn( schemaManager );
@@ -1353,8 +1354,8 @@ public class Dn implements Iterable<Rdn>
rdns.add( rdn );
}
}
-
-
+
+
/**
* {@inheritDoc}
*/
@@ -1389,11 +1390,11 @@ public class Dn implements Iterable<Rdn>
{
rdn.writeExternal( out );
}
-
+
out.flush();
}
-
-
+
+
/**
* Return the user provided Dn as a String. It returns the same value as the
* getName method
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/DnUtils.java Tue Jan 24 17:44:03 2012
@@ -20,7 +20,6 @@
package org.apache.directory.shared.ldap.model.name;
-
/**
* Utility class used to manipulate Dn or Rdn elements.
*
@@ -41,6 +40,7 @@ public final class DnUtils
return rdn.substring( 0, index );
}
+
/**
* Gets the value of a RDN ( the right part of the RDN). The RDN is supposed
* to contain only one AVA.
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/FastDnParser.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/FastDnParser.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/FastDnParser.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/FastDnParser.java Tue Jan 24 17:44:03 2012
@@ -37,7 +37,7 @@ import org.apache.directory.shared.util.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-/* No protection*/ enum FastDnParser
+/* No protection*/enum FastDnParser
{
INSTANCE;
@@ -48,7 +48,7 @@ import org.apache.directory.shared.util.
* @return A valid Dn
* @throws org.apache.directory.shared.ldap.model.exception.LdapException If the Dn was invalid
*/
- /* No protection*/ static Dn parse( String name ) throws LdapException
+ /* No protection*/static Dn parse( String name ) throws LdapException
{
Dn dn = new Dn();
parseDn( name, dn );
@@ -64,15 +64,15 @@ import org.apache.directory.shared.util.
*
* @throws LdapInvalidDnException the invalid name exception
*/
- /* No protection*/ static void parseDn( String name, Dn dn ) throws LdapInvalidDnException
+ /* No protection*/static void parseDn( String name, Dn dn ) throws LdapInvalidDnException
{
- parseDn(name, dn.rdns);
+ parseDn( name, dn.rdns );
dn.setUpName( name );
dn.apply( null );
}
-
-
- /* No protection*/ static void parseDn( String name, List<Rdn> rdns ) throws LdapInvalidDnException
+
+
+ /* No protection*/static void parseDn( String name, List<Rdn> rdns ) throws LdapInvalidDnException
{
if ( ( name == null ) || ( name.trim().length() == 0 ) )
{
@@ -104,7 +104,8 @@ import org.apache.directory.shared.util.
break;
default:
- throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04192, c, pos.start) );
+ throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04192, c,
+ pos.start ) );
}
}
}
@@ -118,13 +119,13 @@ import org.apache.directory.shared.util.
*
* @throws LdapInvalidDnException the invalid name exception
*/
- /* No protection*/ static void parseRdn( String name, Rdn rdn ) throws LdapInvalidDnException
+ /* No protection*/static void parseRdn( String name, Rdn rdn ) throws LdapInvalidDnException
{
if ( name == null || name.length() == 0 )
{
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04193 ) );
}
- if( rdn == null )
+ if ( rdn == null )
{
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04194 ) );
}
@@ -159,7 +160,7 @@ import org.apache.directory.shared.util.
// here we only match "simple" values
// stops at \ + # " -> Too Complex Exception
String upValue = matchValue( name, pos );
- String value = Strings.trimRight(upValue);
+ String value = Strings.trimRight( upValue );
// TODO: trim, normalize, etc
// SPACE*
@@ -282,7 +283,8 @@ import org.apache.directory.shared.util.
default:
// error
- throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04195, c, pos.start) );
+ throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04195, c,
+ pos.start ) );
}
}
@@ -382,7 +384,8 @@ import org.apache.directory.shared.util.
default:
// error
- throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04196, c, pos.start ) );
+ throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04196, c,
+ pos.start ) );
}
}
return descr.toString();
@@ -423,7 +426,8 @@ import org.apache.directory.shared.util.
pos.start--;
break;
default:
- throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04197, c, pos.start ) );
+ throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err(
+ I18n.ERR_04197, c, pos.start ) );
}
break;
@@ -465,7 +469,8 @@ import org.apache.directory.shared.util.
numericOid.append( c );
break;
default:
- throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04197, c, pos.start ) );
+ throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err(
+ I18n.ERR_04197, c, pos.start ) );
}
}
break;
@@ -481,7 +486,8 @@ import org.apache.directory.shared.util.
throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04198 ) );
}
default:
- throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04199, c, pos.start ) );
+ throw new LdapInvalidDnException( ResultCodeEnum.INVALID_DN_SYNTAX, I18n.err( I18n.ERR_04199, c,
+ pos.start ) );
}
}
}
Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java?rev=1235374&r1=1235373&r2=1235374&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java (original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/shared/ldap/model/name/Rdn.java Tue Jan 24 17:44:03 2012
@@ -188,7 +188,7 @@ public class Rdn implements Cloneable, E
/** the schema manager */
private SchemaManager schemaManager;
-
+
/** The computed hashcode */
private volatile int h;
@@ -230,7 +230,7 @@ public class Rdn implements Cloneable, E
*/
public Rdn( SchemaManager schemaManager, String rdn ) throws LdapInvalidDnException
{
- if ( Strings.isNotEmpty(rdn) )
+ if ( Strings.isNotEmpty( rdn ) )
{
// Parse the string. The Rdn will be updated.
parse( rdn, this );
@@ -292,7 +292,7 @@ public class Rdn implements Cloneable, E
upName = upType + '=' + upValue;
- if( schemaManager != null )
+ if ( schemaManager != null )
{
this.schemaManager = schemaManager;
apply( schemaManager );
@@ -347,7 +347,7 @@ public class Rdn implements Cloneable, E
return;
case 1:
- this.ava = (Ava) rdn.ava.clone();
+ this.ava = ( Ava ) rdn.ava.clone();
hashCode();
return;
@@ -359,7 +359,7 @@ public class Rdn implements Cloneable, E
for ( Ava currentAva : rdn.avas )
{
- avas.add( (Ava) currentAva.clone() );
+ avas.add( ( Ava ) currentAva.clone() );
avaTypes.put( currentAva.getNormType(), currentAva );
}
@@ -455,8 +455,8 @@ public class Rdn implements Cloneable, E
return this;
}
-
-
+
+
/**
* Add an Ava to the current Rdn
*
@@ -472,19 +472,19 @@ public class Rdn implements Cloneable, E
{
// First, let's normalize the type
Value<?> normalizedValue = value;
- String normalizedType = Strings.lowerCaseAscii(type);
+ String normalizedType = Strings.lowerCaseAscii( type );
this.schemaManager = schemaManager;
if ( schemaManager != null )
{
OidNormalizer oidNormalizer = schemaManager.getNormalizerMapping().get( normalizedType );
normalizedType = oidNormalizer.getAttributeTypeOid();
-
+
try
{
normalizedValue = oidNormalizer.getNormalizer().normalize( value );
}
- catch( LdapException e )
+ catch ( LdapException e )
{
throw new LdapInvalidDnException( e.getMessage(), e );
}
@@ -589,7 +589,7 @@ public class Rdn implements Cloneable, E
// WARNING : The protection level is left unspecified intentionally.
// We need this method to be visible from the DnParser class, but not
// from outside this package.
- /* No protection */ void clear()
+ /* No protection */void clear()
{
ava = null;
avas = null;
@@ -615,15 +615,15 @@ public class Rdn implements Cloneable, E
{
// First, let's normalize the type
String normalizedType = Strings.lowerCaseAscii( Strings.trim( type ) );
-
+
if ( schemaManager != null )
{
- AttributeType attributeType = schemaManager.getAttributeType( normalizedType );
-
- if ( attributeType != null )
- {
+ AttributeType attributeType = schemaManager.getAttributeType( normalizedType );
+
+ if ( attributeType != null )
+ {
normalizedType = attributeType.getOid();
- }
+ }
}
switch ( nbAvas )
@@ -681,7 +681,7 @@ public class Rdn implements Cloneable, E
public Ava getAva( String type )
{
// First, let's normalize the type
- String normalizedType = Strings.lowerCaseAscii(Strings.trim(type));
+ String normalizedType = Strings.lowerCaseAscii( Strings.trim( type ) );
switch ( nbAvas )
{
@@ -761,7 +761,7 @@ public class Rdn implements Cloneable, E
{
try
{
- Rdn rdn = (Rdn) super.clone();
+ Rdn rdn = ( Rdn ) super.clone();
rdn.normalized = normalized;
// The Ava is immutable. We won't clone it
@@ -772,7 +772,7 @@ public class Rdn implements Cloneable, E
break;
case 1:
- rdn.ava = (Ava) this.ava.clone();
+ rdn.ava = ( Ava ) this.ava.clone();
rdn.avaTypes = avaTypes;
break;
@@ -783,7 +783,7 @@ public class Rdn implements Cloneable, E
for ( Ava currentAva : this.avas )
{
- rdn.avas.add( (Ava) currentAva.clone() );
+ rdn.avas.add( ( Ava ) currentAva.clone() );
rdn.avaTypes.put( currentAva.getNormType(), currentAva );
}
@@ -953,12 +953,12 @@ public class Rdn implements Cloneable, E
return true;
}
- if ( !( that instanceof Rdn) )
+ if ( !( that instanceof Rdn ) )
{
return false;
}
-
- Rdn rdn = (Rdn)that;
+
+ Rdn rdn = ( Rdn ) that;
if ( rdn.nbAvas != nbAvas )
{
@@ -995,7 +995,7 @@ public class Rdn implements Cloneable, E
while ( paramIterator.hasNext() )
{
Ava paramAva = paramIterator.next();
-
+
if ( localAva.equals( paramAva ) )
{
equals = true;
@@ -1042,7 +1042,7 @@ public class Rdn implements Cloneable, E
*/
public static Object unescapeValue( String value ) throws IllegalArgumentException
{
- if ( Strings.isEmpty(value) )
+ if ( Strings.isEmpty( value ) )
{
return "";
}
@@ -1068,9 +1068,9 @@ public class Rdn implements Cloneable, E
for ( int i = 1; i < chars.length; i += 2 )
{
- if ( Chars.isHex(chars, i) && Chars.isHex(chars, i + 1) )
+ if ( Chars.isHex( chars, i ) && Chars.isHex( chars, i + 1 ) )
{
- hexValue[pos++] = Hex.getHexValue(chars[i], chars[i + 1]);
+ hexValue[pos++] = Hex.getHexValue( chars[i], chars[i + 1] );
}
else
{
@@ -1111,10 +1111,10 @@ public class Rdn implements Cloneable, E
break;
default:
- if ( Chars.isHex(chars, i) )
+ if ( Chars.isHex( chars, i ) )
{
isHex = true;
- pair = ( ( byte ) ( Hex.getHexValue(chars[i]) << 4 ) );
+ pair = ( ( byte ) ( Hex.getHexValue( chars[i] ) << 4 ) );
}
break;
@@ -1124,9 +1124,9 @@ public class Rdn implements Cloneable, E
{
if ( isHex )
{
- if ( Chars.isHex(chars, i) )
+ if ( Chars.isHex( chars, i ) )
{
- pair += Hex.getHexValue(chars[i]);
+ pair += Hex.getHexValue( chars[i] );
bytes[pos++] = pair;
}
}
@@ -1175,7 +1175,7 @@ public class Rdn implements Cloneable, E
}
else
{
- byte[] result = Unicode.charToBytes(chars[i]);
+ byte[] result = Unicode.charToBytes( chars[i] );
System.arraycopy( result, 0, bytes, pos, result.length );
pos += result.length;
}
@@ -1186,7 +1186,7 @@ public class Rdn implements Cloneable, E
}
}
- return Strings.utf8ToString(bytes, pos);
+ return Strings.utf8ToString( bytes, pos );
}
}
@@ -1199,7 +1199,7 @@ public class Rdn implements Cloneable, E
*/
public static String escapeValue( String value )
{
- if ( Strings.isEmpty(value) )
+ if ( Strings.isEmpty( value ) )
{
return "";
}
@@ -1318,12 +1318,12 @@ public class Rdn implements Cloneable, E
*/
public static String escapeValue( byte[] attrValue )
{
- if ( Strings.isEmpty(attrValue) )
+ if ( Strings.isEmpty( attrValue ) )
{
return "";
}
- String value = Strings.utf8ToString(attrValue);
+ String value = Strings.utf8ToString( attrValue );
return escapeValue( value );
}
@@ -1364,7 +1364,7 @@ public class Rdn implements Cloneable, E
}
}
-
+
/**
* Parse a NameComponent : <br>
* <p>
@@ -1402,26 +1402,26 @@ public class Rdn implements Cloneable, E
if ( h == 0 )
{
h = 37;
-
+
switch ( nbAvas )
{
case 0:
// An empty Rdn
break;
-
+
case 1:
// We have a single Ava
h = h * 17 + ava.hashCode();
break;
-
+
default:
// We have more than one Ava
-
+
for ( Ava ata : avas )
{
h = h * 17 + ata.hashCode();
}
-
+
break;
}
}
@@ -1501,9 +1501,9 @@ public class Rdn implements Cloneable, E
break;
}
-
+
out.writeInt( h );
-
+
out.flush();
}
@@ -1529,7 +1529,7 @@ public class Rdn implements Cloneable, E
// Read the normName
normName = in.readUTF();
- if ( Strings.isEmpty(normName) )
+ if ( Strings.isEmpty( normName ) )
{
normName = upName;
}
@@ -1565,11 +1565,11 @@ public class Rdn implements Cloneable, E
break;
}
-
+
h = in.readInt();
}
-
-
+
+
/**
* @return a String representation of the Rdn. The caller will get back the user
* provided Rdn