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 2011/02/03 20:46:39 UTC
svn commit: r1066926 - in /directory:
apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/
apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/
apacheds/branches/m1/protocol-ldap/src/main/ja...
Author: elecharny
Date: Thu Feb 3 19:46:38 2011
New Revision: 1066926
URL: http://svn.apache.org/viewvc?rev=1066926&view=rev
Log:
Moved the SyncRequestValue control
Added:
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValue.java
- copied, changed from r1066851, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValueImpl.java
- copied, changed from r1066851, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java
Removed:
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java
Modified:
directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueFactory.java
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValueImpl.java
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncInfoValueImpl.java
directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java
directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
Modified: directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/branches/m1/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Thu Feb 3 19:46:38 2011
@@ -83,7 +83,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyResponse;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueDecorator;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.ISyncStateValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueDecorator;
@@ -120,6 +119,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.controls.SyncDoneValue;
import org.apache.directory.shared.ldap.model.message.controls.SyncInfoValue;
import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDn;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
import org.apache.directory.shared.ldap.model.name.Ava;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.name.Rdn;
@@ -187,7 +187,7 @@ public abstract class ServerContext impl
ADS_CONTROLS.put( SyncDoneValue.OID, ControlEnum.SYNC_DONE_VALUE_CONTROL );
ADS_CONTROLS.put( SyncInfoValue.OID, ControlEnum.SYNC_INFO_VALUE_CONTROL );
ADS_CONTROLS.put( SyncModifyDn.OID, ControlEnum.SYNC_MODIFY_DN_CONTROL );
- ADS_CONTROLS.put( ISyncRequestValue.OID, ControlEnum.SYNC_REQUEST_VALUE_CONTROL );
+ ADS_CONTROLS.put( SyncRequestValue.OID, ControlEnum.SYNC_REQUEST_VALUE_CONTROL );
ADS_CONTROLS.put( ISyncStateValue.OID, ControlEnum.SYNC_STATE_VALUE_CONTROL );
}
Modified: directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/m1/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Thu Feb 3 19:46:38 2011
@@ -59,7 +59,6 @@ import org.apache.directory.server.core.
import org.apache.directory.server.i18n.I18n;
import org.apache.directory.shared.ldap.model.message.controls.Cascade;
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.ISyncStateValue;
import org.apache.directory.shared.ldap.model.message.controls.EntryChange;
import org.apache.directory.shared.ldap.model.message.controls.PagedResults;
@@ -67,6 +66,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.controls.Subentries;
import org.apache.directory.shared.ldap.model.message.controls.SyncDoneValue;
import org.apache.directory.shared.ldap.model.message.controls.SyncInfoValue;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.cursor.EmptyCursor;
@@ -178,7 +178,7 @@ public class DefaultPartitionNexus exten
EntryChange.OID, Subentries.OID, ManageDsaIT.OID,
Cascade.OID, PagedResults.OID,
// Replication controls
- SyncDoneValue.OID, SyncInfoValue.OID, ISyncRequestValue.OID,
+ SyncDoneValue.OID, SyncInfoValue.OID, SyncRequestValue.OID,
ISyncStateValue.OID );
// Add the objectClasses
Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Thu Feb 3 19:46:38 2011
@@ -60,7 +60,6 @@ import org.apache.directory.server.proto
import org.apache.directory.server.protocol.shared.transport.TcpTransport;
import org.apache.directory.server.protocol.shared.transport.Transport;
import org.apache.directory.server.protocol.shared.transport.UdpTransport;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.ISyncStateValue;
import org.apache.directory.shared.ldap.message.extended.NoticeOfDisconnect;
import org.apache.directory.shared.ldap.model.constants.SaslQoP;
@@ -83,6 +82,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.controls.Subentries;
import org.apache.directory.shared.ldap.model.message.controls.SyncDoneValue;
import org.apache.directory.shared.ldap.model.message.controls.SyncInfoValue;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
import org.apache.directory.shared.util.Strings;
import org.apache.mina.core.filterchain.DefaultIoFilterChainBuilder;
import org.apache.mina.core.filterchain.IoFilterAdapter;
@@ -246,7 +246,7 @@ public class LdapServer extends Director
// Replication controls
this.supportedControls.add( SyncDoneValue.OID );
this.supportedControls.add( SyncInfoValue.OID );
- this.supportedControls.add( ISyncRequestValue.OID );
+ this.supportedControls.add( SyncRequestValue.OID );
this.supportedControls.add( ISyncStateValue.OID );
}
Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Thu Feb 3 19:46:38 2011
@@ -38,7 +38,6 @@ import org.apache.directory.server.i18n.
import org.apache.directory.server.ldap.LdapSession;
import org.apache.directory.server.ldap.handlers.controls.PagedSearchContext;
import org.apache.directory.server.ldap.replication.ReplicationProvider;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
import org.apache.directory.shared.ldap.codec.controls.search.pagedSearch.PagedResultsDecorator;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
import org.apache.directory.shared.ldap.model.entry.Entry;
@@ -70,6 +69,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.shared.ldap.model.message.controls.PagedResults;
import org.apache.directory.shared.ldap.model.message.controls.PersistentSearch;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
import org.apache.directory.shared.ldap.model.name.Dn;
import org.apache.directory.shared.ldap.model.schema.AttributeType;
import org.apache.directory.shared.util.Strings;
@@ -177,7 +177,7 @@ public class SearchHandler extends LdapR
LOG.debug( "Handling single reply request: {}", req );
// check first for the syncrepl search request decorator
- if ( req.getControls().containsKey( ISyncRequestValue.OID ) )
+ if ( req.getControls().containsKey( SyncRequestValue.OID ) )
{
handleSyncreplSearch( session, req );
}
Modified: directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java (original)
+++ directory/apacheds/branches/m1/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java Thu Feb 3 19:46:38 2011
@@ -49,7 +49,6 @@ import org.apache.directory.server.ldap.
import org.apache.directory.server.ldap.handlers.SearchTimeLimitingMonitor;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueDecorator;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueDecorator;
import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
import org.apache.directory.shared.ldap.model.constants.SchemaConstants;
@@ -84,6 +83,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
import org.apache.directory.shared.ldap.model.message.controls.SyncDoneValue;
import org.apache.directory.shared.ldap.model.message.controls.SyncInfoValue;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
import org.apache.directory.shared.ldap.model.message.controls.SyncStateTypeEnum;
import org.apache.directory.shared.ldap.model.message.controls.SynchronizationInfoEnum;
import org.apache.directory.shared.ldap.model.message.controls.SynchronizationModeEnum;
@@ -215,8 +215,8 @@ public class SyncReplProvider implements
{
try
{
- ISyncRequestValue syncControl = ( ISyncRequestValue ) req.getControls().get(
- ISyncRequestValue.OID );
+ SyncRequestValue syncControl = ( SyncRequestValue ) req.getControls().get(
+ SyncRequestValue.OID );
// cookie is in the format <replicaId>;<Csn value>
byte[] cookieBytes = syncControl.getCookie();
@@ -1004,8 +1004,8 @@ public class SyncReplProvider implements
private boolean isRefreshNPersist( SearchRequest req )
{
- ISyncRequestValue control = ( ISyncRequestValue ) req.getControls().get(
- ISyncRequestValue.OID );
+ SyncRequestValue control = ( SyncRequestValue ) req.getControls().get(
+ SyncRequestValue.OID );
return ( control.getMode() == SynchronizationModeEnum.REFRESH_AND_PERSIST ? true : false );
}
}
Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java (original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java Thu Feb 3 19:46:38 2011
@@ -34,7 +34,6 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.codec.controls.ppolicy.PasswordPolicyFactory;
import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueFactory;
import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueFactory;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueFactory;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.ISyncStateValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueFactory;
@@ -55,6 +54,7 @@ import org.apache.directory.shared.ldap.
import org.apache.directory.shared.ldap.model.message.controls.SyncDoneValue;
import org.apache.directory.shared.ldap.model.message.controls.SyncInfoValue;
import org.apache.directory.shared.ldap.model.message.controls.SyncModifyDn;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
@@ -110,7 +110,7 @@ public class DefaultLdapCodecService imp
controlFactories.put( SyncModifyDn.OID, syncModifyDnFactory );
SyncRequestValueFactory syncRequestValueFactory = new SyncRequestValueFactory( this );
- controlFactories.put( ISyncRequestValue.OID, syncRequestValueFactory );
+ controlFactories.put( SyncRequestValue.OID, syncRequestValueFactory );
SyncStateValueFactory syncStateValueFactory = new SyncStateValueFactory( this );
controlFactories.put( ISyncStateValue.OID, syncStateValueFactory );
Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java (original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java Thu Feb 3 19:46:38 2011
@@ -6,22 +6,21 @@
* 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.
- *
+ * under the License.
+ *
*/
package org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue;
import java.nio.ByteBuffer;
-import java.util.Arrays;
import org.apache.directory.shared.asn1.Asn1Object;
import org.apache.directory.shared.asn1.DecoderException;
@@ -33,36 +32,38 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.i18n.I18n;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
import org.apache.directory.shared.ldap.codec.controls.ControlDecorator;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValueImpl;
import org.apache.directory.shared.ldap.model.message.controls.SynchronizationModeEnum;
import org.apache.directory.shared.util.Strings;
/**
* A syncRequestValue object, as defined in RFC 4533
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public class SyncRequestValueDecorator extends ControlDecorator<ISyncRequestValue> implements ISyncRequestValue
+public class SyncRequestValueDecorator extends ControlDecorator<SyncRequestValue> implements SyncRequestValue
{
/** The global length for this control */
private int syncRequestValueLength;
-
+
/** An instance of this decoder */
private static final Asn1Decoder decoder = new Asn1Decoder();
-
+
public SyncRequestValueDecorator( ILdapCodecService codec )
{
- super( codec, new SyncRequestValue() );
+ super( codec, new SyncRequestValueImpl() );
}
-
- public SyncRequestValueDecorator( ILdapCodecService codec, ISyncRequestValue control )
+
+ public SyncRequestValueDecorator( ILdapCodecService codec, SyncRequestValue control )
{
super( codec, control );
}
-
+
/**
* {@inheritDoc}
*/
@@ -71,7 +72,7 @@ public class SyncRequestValueDecorator
return getDecorated().getMode();
}
-
+
/**
* {@inheritDoc}
*/
@@ -80,7 +81,7 @@ public class SyncRequestValueDecorator
getDecorated().setMode( mode );
}
-
+
/**
* {@inheritDoc}
*/
@@ -89,7 +90,7 @@ public class SyncRequestValueDecorator
return getDecorated().getCookie();
}
-
+
/**
* {@inheritDoc}
*/
@@ -108,7 +109,7 @@ public class SyncRequestValueDecorator
}
}
-
+
/**
* {@inheritDoc}
*/
@@ -117,7 +118,7 @@ public class SyncRequestValueDecorator
return getDecorated().isReloadHint();
}
-
+
/**
* {@inheritDoc}
*/
@@ -125,30 +126,31 @@ public class SyncRequestValueDecorator
{
getDecorated().setReloadHint( reloadHint );
}
-
-
+
+
/**
* Compute the SyncRequestValue length.
- *
+ *
* SyncRequestValue :
* 0x30 L1
- * |
+ * |
* +--> 0x0A 0x01 [0x00|0x01|0x02|0x03] (mode)
* [+--> 0x04 L2 abcd... (cookie)
* +--> 0x01 0x01 [0x00|0xFF] (reloadHint)
- *
+ *
*/
+ @Override
public int computeLength()
{
// The mode length
syncRequestValueLength = 1 + 1 + 1;
-
+
// The cookie length, if we have a cookie
if ( getCookie() != null )
{
syncRequestValueLength += 1 + TLV.getNbBytes( getCookie().length ) + getCookie().length;
}
-
+
// The reloadHint length, default to false
if ( isReloadHint() )
{
@@ -160,15 +162,16 @@ public class SyncRequestValueDecorator
// Call the super class to compute the global control length
return valueLength;
}
-
-
+
+
/**
* Encode the SyncRequestValue control
- *
+ *
* @param buffer The encoded sink
* @return A ByteBuffer that contains the encoded PDU
* @throws EncoderException If anything goes wrong.
*/
+ @Override
public ByteBuffer encode( ByteBuffer buffer ) throws EncoderException
{
if ( buffer == null )
@@ -176,7 +179,7 @@ public class SyncRequestValueDecorator
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
- // Encode the SEQ
+ // Encode the SEQ
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( syncRequestValueLength ) );
@@ -190,30 +193,31 @@ public class SyncRequestValueDecorator
{
Value.encode( buffer, getCookie() );
}
-
+
// The reloadHint if not false
if ( isReloadHint() )
{
Value.encode( buffer, isReloadHint() );
}
-
+
return buffer;
}
-
-
+
+
/**
* {@inheritDoc}
*/
+ @Override
public byte[] getValue()
{
if ( value == null )
{
try
- {
+ {
computeLength();
ByteBuffer buffer = ByteBuffer.allocate( valueLength );
-
- // Encode the SEQ
+
+ // Encode the SEQ
buffer.put( UniversalTag.SEQUENCE.getValue() );
buffer.put( TLV.getBytes( syncRequestValueLength ) );
@@ -227,7 +231,7 @@ public class SyncRequestValueDecorator
{
Value.encode( buffer, getCookie() );
}
-
+
// The reloadHint if not false
if ( isReloadHint() )
{
@@ -241,51 +245,12 @@ public class SyncRequestValueDecorator
return null;
}
}
-
- return value;
- }
-
-
-
-
- /**
- * @see Object#equals(Object)
- */
- public boolean equals( Object o )
- {
- if ( !super.equals( o ) )
- {
- return false;
- }
- SyncRequestValueDecorator otherControl = ( SyncRequestValueDecorator ) o;
-
- return ( getMode() == otherControl.getMode() ) &&
- ( isReloadHint() == otherControl.isReloadHint() ) &&
- ( Arrays.equals( getCookie(), otherControl.getCookie() ) );
+ return value;
}
/**
- * @see Object#toString()
- */
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
-
- sb.append( " SyncRequestValue control :\n" );
- sb.append( " oid : " ).append( getOid() ).append( '\n' );
- sb.append( " critical : " ).append( isCritical() ).append( '\n' );
- sb.append( " mode : '" ).append( getMode() ).append( "'\n" );
- sb.append( " cookie : '" ).
- append( Strings.dumpBytes( getCookie() ) ).append( "'\n" );
- sb.append( " refreshAndPersist : '" ).append( isReloadHint() ).append( "'\n" );
-
- return sb.toString();
- }
-
-
- /**
* {@inheritDoc}
*/
public Asn1Object decode( byte[] controlBytes ) throws DecoderException
Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueFactory.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueFactory.java (original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueFactory.java Thu Feb 3 19:46:38 2011
@@ -29,15 +29,17 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.ldap.codec.IControlFactory;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValueImpl;
/**
- * A {@link IControlFactory} which creates {@link ISyncRequestValue} controls.
+ * A {@link IControlFactory} which creates {@link SyncRequestValue} controls.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class SyncRequestValueFactory implements IControlFactory<ISyncRequestValue, SyncRequestValueDecorator>
+public class SyncRequestValueFactory implements IControlFactory<SyncRequestValue, SyncRequestValueDecorator>
{
private ILdapCodecService codec;
@@ -59,7 +61,7 @@ public class SyncRequestValueFactory imp
*/
public String getOid()
{
- return ISyncRequestValue.OID;
+ return SyncRequestValue.OID;
}
@@ -73,7 +75,7 @@ public class SyncRequestValueFactory imp
}
- public SyncRequestValueDecorator decorate( ISyncRequestValue control )
+ public SyncRequestValueDecorator decorate( SyncRequestValue control )
{
SyncRequestValueDecorator decorator = null;
@@ -91,13 +93,13 @@ public class SyncRequestValueFactory imp
}
- public ISyncRequestValue newControl()
+ public SyncRequestValue newControl()
{
- return new SyncRequestValue();
+ return new SyncRequestValueImpl();
}
- public Control toJndiControl( ISyncRequestValue control ) throws EncoderException
+ public Control toJndiControl( SyncRequestValue control ) throws EncoderException
{
SyncRequestValueDecorator decorator = decorate( control );
ByteBuffer bb = ByteBuffer.allocate( decorator.computeLength() );
@@ -107,7 +109,7 @@ public class SyncRequestValueFactory imp
}
- public ISyncRequestValue fromJndiControl( Control jndi ) throws DecoderException
+ public SyncRequestValue fromJndiControl( Control jndi ) throws DecoderException
{
SyncRequestValueDecorator decorator = newCodecControl();
decorator.setCritical( jndi.isCritical() );
Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValueImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValueImpl.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValueImpl.java (original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncDoneValueImpl.java Thu Feb 3 19:46:38 2011
@@ -21,12 +21,11 @@ package org.apache.directory.shared.ldap
import java.util.Arrays;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueDecorator;
import org.apache.directory.shared.util.Strings;
/**
- * TODO SyncDoneValue.
+ * A simple {@link SyncDoneValue} implementation to store control properties.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
@@ -136,10 +135,10 @@ public class SyncDoneValueImpl extends A
return false;
}
- SyncDoneValueDecorator otherControl = ( SyncDoneValueDecorator ) o;
+ SyncDoneValue otherControl = ( SyncDoneValue ) o;
- return ( isRefreshDeletes() == otherControl.isRefreshDeletes() ) &&
- ( Arrays.equals( getCookie(), otherControl.getCookie() ) &&
+ return ( refreshDeletes == otherControl.isRefreshDeletes() ) &&
+ ( Arrays.equals( cookie, otherControl.getCookie() ) &&
( isCritical() == otherControl.isCritical() ) );
}
Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncInfoValueImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncInfoValueImpl.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncInfoValueImpl.java (original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncInfoValueImpl.java Thu Feb 3 19:46:38 2011
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueDecorator;
import org.apache.directory.shared.util.Strings;
@@ -233,7 +232,7 @@ public class SyncInfoValueImpl extends A
return false;
}
- SyncInfoValueDecorator otherControl = ( SyncInfoValueDecorator ) o;
+ SyncInfoValue otherControl = ( SyncInfoValue ) o;
if ( syncUUIDs != null )
{
@@ -271,10 +270,10 @@ public class SyncInfoValueImpl extends A
}
}
- return ( isRefreshDeletes() == otherControl.isRefreshDeletes() ) &&
- ( isRefreshDone() == otherControl.isRefreshDone() ) &&
- ( getType() == otherControl.getType() ) &&
- ( Arrays.equals( getCookie(), otherControl.getCookie() ) &&
+ return ( refreshDeletes == otherControl.isRefreshDeletes() ) &&
+ ( refreshDone == otherControl.isRefreshDone() ) &&
+ ( type == otherControl.getType() ) &&
+ ( Arrays.equals( cookie, otherControl.getCookie() ) &&
( isCritical() == otherControl.isCritical() ) );
}
Modified: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java (original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncModifyDnImpl.java Thu Feb 3 19:46:38 2011
@@ -19,10 +19,6 @@
*/
package org.apache.directory.shared.ldap.model.message.controls;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnDecorator;
-
-
-
/**
* A simple {@link SyncModifyDn} implementation to hold properties.
@@ -202,7 +198,7 @@ public class SyncModifyDnImpl extends Ab
return false;
}
- SyncModifyDnDecorator otherControl = ( SyncModifyDnDecorator ) o;
+ SyncModifyDn otherControl = ( SyncModifyDn ) o;
if ( newRdn != null )
{
Copied: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValue.java (from r1066851, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValue.java?p2=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValue.java&p1=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java&r1=1066851&r2=1066926&rev=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java (original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValue.java Thu Feb 3 19:46:38 2011
@@ -17,11 +17,10 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue;
+package org.apache.directory.shared.ldap.model.message.controls;
import org.apache.directory.shared.ldap.model.message.Control;
-import org.apache.directory.shared.ldap.model.message.controls.SynchronizationModeEnum;
/**
@@ -29,7 +28,7 @@ import org.apache.directory.shared.ldap.
*
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
-public interface ISyncRequestValue extends Control
+public interface SyncRequestValue extends Control
{
/** This control OID */
Copied: directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValueImpl.java (from r1066851, directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java)
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValueImpl.java?p2=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValueImpl.java&p1=directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java&r1=1066851&r2=1066926&rev=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java (original)
+++ directory/shared/branches/m1/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SyncRequestValueImpl.java Thu Feb 3 19:46:38 2011
@@ -17,56 +17,72 @@
* under the License.
*
*/
-package org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue;
+package org.apache.directory.shared.ldap.model.message.controls;
-import org.apache.directory.shared.ldap.model.message.controls.SynchronizationModeEnum;
+import java.util.Arrays;
+
+import org.apache.directory.shared.util.Strings;
/**
- * A syncRequestValue object, as defined in RFC 4533
- *
+ * A syncRequestValue object, as defined in RFC 4533 :
+ * <pre>
+ * 2.2. Sync Request Control
+ *
+ * The Sync Request Control is an LDAP Control [RFC4511] where the
+ * controlType is the object identifier 1.3.6.1.4.1.4203.1.9.1.1 and the
+ * controlValue, an OCTET STRING, contains a BER-encoded
+ * syncRequestValue. The criticality field is either TRUE or FALSE.
+ *
+ * syncRequestValue ::= SEQUENCE {
+ * mode ENUMERATED {
+ * -- 0 unused
+ * refreshOnly (1),
+ * -- 2 reserved
+ * refreshAndPersist (3)
+ * },
+ * cookie syncCookie OPTIONAL,
+ * reloadHint BOOLEAN DEFAULT FALSE
+ * }
+ *
+ * The Sync Request Control is only applicable to the SearchRequest
+ * Message.
+ * </pre>
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
-public class SyncRequestValue implements ISyncRequestValue
+public class SyncRequestValueImpl extends AbstractControl implements SyncRequestValue
{
- private boolean isCritical;
-
/** The synchronization type */
private SynchronizationModeEnum mode;
-
+
/** The Sync cookie */
private byte[] cookie;
-
+
/** The reloadHint flag */
private boolean isReloadHint;
-
-
- /**
- * {@inheritDoc}
- */
- public String getOid()
- {
- return OID;
- }
/**
- * {@inheritDoc}
+ * Creates a new instance of SyncRequestValueImpl.
*/
- public boolean isCritical()
+ public SyncRequestValueImpl()
{
- return isCritical;
+ super( OID );
}
/**
- * {@inheritDoc}
+ *
+ * Creates a new instance of SyncRequestValueImpl.
+ *
+ * @param isCritical The critical flag
*/
- public void setCritical( boolean isCritical )
+ public SyncRequestValueImpl( boolean isCritical )
{
- this.isCritical = isCritical;
+ super( OID, isCritical );
}
@@ -122,4 +138,72 @@ public class SyncRequestValue implements
{
this.isReloadHint = reloadHint;
}
+
+
+ /**
+ * @see Object#hashCode()
+ */
+ @Override
+ public int hashCode()
+ {
+ int h = 37;
+
+ h = h*17 + super.hashCode();
+ h = h*17 + ( isReloadHint ? 1 : 0 );
+ h = h*17 + mode.getValue();
+
+ if ( cookie != null )
+ {
+ for ( byte b : cookie )
+ {
+ h = h*17 + b;
+ }
+ }
+
+ return h;
+ }
+
+
+ /**
+ * @see Object#equals(Object)
+ */
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( !super.equals( o ) )
+ {
+ return false;
+ }
+
+ if ( !( o instanceof SyncRequestValue ) )
+ {
+ return false;
+ }
+
+ SyncRequestValue otherControl = ( SyncRequestValue ) o;
+
+ return ( mode == otherControl.getMode() ) &&
+ ( isReloadHint == otherControl.isReloadHint() ) &&
+ ( Arrays.equals( cookie, otherControl.getCookie() ) );
+ }
+
+
+ /**
+ * @see Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append( " SyncRequestValue control :\n" );
+ sb.append( " oid : " ).append( getOid() ).append( '\n' );
+ sb.append( " critical : " ).append( isCritical() ).append( '\n' );
+ sb.append( " mode : '" ).append( getMode() ).append( "'\n" );
+ sb.append( " cookie : '" ).
+ append( Strings.dumpBytes( getCookie() ) ).append( "'\n" );
+ sb.append( " refreshAndPersist : '" ).append( isReloadHint() ).append( "'\n" );
+
+ return sb.toString();
+ }
}
Modified: directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java?rev=1066926&r1=1066925&r2=1066926&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java (original)
+++ directory/shared/branches/m1/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java Thu Feb 3 19:46:38 2011
@@ -33,8 +33,8 @@ import org.apache.directory.shared.asn1.
import org.apache.directory.shared.asn1.EncoderException;
import org.apache.directory.shared.ldap.codec.DefaultLdapCodecService;
import org.apache.directory.shared.ldap.codec.ILdapCodecService;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueDecorator;
+import org.apache.directory.shared.ldap.model.message.controls.SyncRequestValue;
import org.apache.directory.shared.ldap.model.message.controls.SynchronizationModeEnum;
import org.apache.directory.shared.util.Strings;
import org.junit.Test;
@@ -73,7 +73,7 @@ public class SyncRequestValueControlTest
SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec );
- ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( bb.array() );
+ SyncRequestValue syncRequestValue = (SyncRequestValue)decorator.decode( bb.array() );
assertEquals( SynchronizationModeEnum.REFRESH_ONLY, syncRequestValue.getMode() );
assertEquals( "abc", Strings.utf8ToString(syncRequestValue.getCookie()) );
@@ -125,7 +125,7 @@ public class SyncRequestValueControlTest
SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec );
- ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( bb.array() );
+ SyncRequestValue syncRequestValue = (SyncRequestValue)decorator.decode( bb.array() );
assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
assertEquals( "abc", Strings.utf8ToString(syncRequestValue.getCookie()) );
@@ -176,7 +176,7 @@ public class SyncRequestValueControlTest
SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec );
- ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( bb.array() );
+ SyncRequestValue syncRequestValue = (SyncRequestValue)decorator.decode( bb.array() );
assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
assertNull( syncRequestValue.getCookie() );
@@ -227,7 +227,7 @@ public class SyncRequestValueControlTest
SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec );
- ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( buffer.array() );
+ SyncRequestValue syncRequestValue = (SyncRequestValue)decorator.decode( buffer.array() );
assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
assertNull( syncRequestValue.getCookie() );
@@ -267,7 +267,7 @@ public class SyncRequestValueControlTest
SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec );
- ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( bb.array() );
+ SyncRequestValue syncRequestValue = (SyncRequestValue)decorator.decode( bb.array() );
assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
assertNull( syncRequestValue.getCookie() );
@@ -307,7 +307,7 @@ public class SyncRequestValueControlTest
SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec );
- ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( bb.array() );
+ SyncRequestValue syncRequestValue = (SyncRequestValue)decorator.decode( bb.array() );
assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
assertEquals( "abc", Strings.utf8ToString(syncRequestValue.getCookie()) );
@@ -347,7 +347,7 @@ public class SyncRequestValueControlTest
SyncRequestValueDecorator decorator = new SyncRequestValueDecorator( codec );
- ISyncRequestValue syncRequestValue = (ISyncRequestValue)decorator.decode( bb.array() );
+ SyncRequestValue syncRequestValue = (SyncRequestValue)decorator.decode( bb.array() );
assertEquals( SynchronizationModeEnum.REFRESH_AND_PERSIST, syncRequestValue.getMode() );
assertEquals( "", Strings.utf8ToString(syncRequestValue.getCookie()) );