directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1064981 [1/8] - in /directory: apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/ apacheds/trunk/protocol-ldap/src/main/java/org/apach...
Date Sat, 29 Jan 2011 08:23:06 GMT
Author: akarasulu
Date: Sat Jan 29 08:23:02 2011
New Revision: 1064981

URL: http://svn.apache.org/viewvc?rev=1064981&view=rev
Log:
Heavy refactoring of codec classes, revamping several concepts:

  o created codec service interface 
  o created control factory interfaces
  o created extended operation factory interface
  o created default codec service implementation
  o revamped most existing controls to this new design - some still remain
  o cleaned up lots of code
  o applied generics to decorator, codec control, and containers


Added:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ICodecControl.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IDecorator.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/Decorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IExtendedOpFactory.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeCodecControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/ISyncRequestValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValue.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueContainer.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueDecorator.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueGrammar.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueStatesEnum.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueContainer.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueDecorator.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueGrammar.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueStatesEnum.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequest.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/BasicControl.java
      - copied, changed from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/BasicControlImpl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestCodecControl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/ITestControl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestCodecControl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestControlFactory.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/TestLdapCodecService.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/UseCaseTest.java
Removed:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/AbstractControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/BasicControlImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlEnum.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlFactory.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncRequestValue/SyncRequestValueControlStatesEnum.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/replication/syncStateValue/SyncStateValueControlStatesEnum.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/Decorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecoder.java
Modified:
    directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
    directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
    directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java
    directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java
    directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapMessageGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/AttributeDescAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlValueAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ControlsInitAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ErrorMessageAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAndFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitApproxMatchFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAssertionValueFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitAttributeDescListAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitEqualityMatchFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitExtensibleMatchFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitGreaterOrEqualFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitLessOrEqualFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitNotFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitOrFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitPresentFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitReferralsAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/InitSubstringsFilterAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/MatchedDNAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ModifyAttributeValueAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ReferralAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResponseNameAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ResultCodeAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/SearchResultAttributeValueAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ServerSASLCredsAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreAnyAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreFinalAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreMatchValueAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreReferenceAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/StoreTypeMatchingRuleAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CascadeDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecoder.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ControlDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/ManageDsaITDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AbandonableResultResponseRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/AddResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/BindResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/CompareRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/CompareResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/DeleteRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/DeleteResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/ExtendedRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/ExtendedResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/IntermediateResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/LdapResultDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/MessageDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/ModifyDnRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/ModifyDnResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/ModifyRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/ModifyResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/RequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/ResponseDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/ResultResponseRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchResultDoneDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchResultEntryDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SearchResultReferenceDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/SingleReplyRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/UnbindRequestDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/entryChange/EntryChangeGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/pagedSearch/PagedResultsGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/persistentSearch/PersistentSearchGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesContainer.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesDecorator.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/subentries/SubentriesGrammar.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/MetaSchemaConstants.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/constants/SchemaConstants.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/entry/DefaultEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifControl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifEntry.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/ldif/LdifUtils.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/Control.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/Cascade.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/EntryChangeImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/ManageDsaIT.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PagedResultsImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/PersistentSearchImpl.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/model/message/controls/SubentriesImpl.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/abandon/AbandonRequestTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncRequestValueControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/codec/controls/replication/SyncStateValueControlTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/ldif/LdifReaderTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/AbstractMessageTest.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/model/message/AbstractResultResponseTest.java
    directory/shared/trunk/pom.xml

Modified: directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java (original)
+++ directory/apacheds/trunk/core-jndi/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java Sat Jan 29 08:23:02 2011
@@ -89,11 +89,13 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControlContainer;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControlDecoder;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControlContainer;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControlDecoder;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControlContainer;
+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.syncRequestValue.SyncRequestValueContainer;
+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;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueContainer;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControlDecoder;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControlContainer;
@@ -192,8 +194,8 @@ public abstract class ServerContext impl
         ADS_CONTROLS.put( SyncDoneValueControl.CONTROL_OID, ControlEnum.SYNC_DONE_VALUE_CONTROL );
         ADS_CONTROLS.put( SyncInfoValueControl.CONTROL_OID, ControlEnum.SYNC_INFO_VALUE_CONTROL );
         ADS_CONTROLS.put( SyncModifyDnControl.CONTROL_OID, ControlEnum.SYNC_MODIFY_DN_CONTROL );
-        ADS_CONTROLS.put( SyncRequestValueControl.CONTROL_OID, ControlEnum.SYNC_REQUEST_VALUE_CONTROL );
-        ADS_CONTROLS.put( SyncStateValueControl.CONTROL_OID, ControlEnum.SYNC_STATE_VALUE_CONTROL );
+        ADS_CONTROLS.put( ISyncRequestValue.OID, ControlEnum.SYNC_REQUEST_VALUE_CONTROL );
+        ADS_CONTROLS.put( ISyncStateValue.OID, ControlEnum.SYNC_STATE_VALUE_CONTROL );
     }
     
 
@@ -501,10 +503,10 @@ public abstract class ServerContext impl
                 break;
 
             case SYNC_REQUEST_VALUE_CONTROL:
-                control = new SyncRequestValueControl();
+                control = new SyncRequestValueDecorator();
                 SyncRequestValueControlDecoder syncRequestValueControlDecoder = new SyncRequestValueControlDecoder();
-                SyncRequestValueControlContainer syncRequestValueControlContainer = new SyncRequestValueControlContainer();
-                syncRequestValueControlContainer.setSyncRequestValueControl( ( SyncRequestValueControl ) control );
+                SyncRequestValueContainer syncRequestValueControlContainer = new SyncRequestValueContainer();
+                syncRequestValueControlContainer.setSyncRequestValueControl( ( SyncRequestValueDecorator ) control );
                 bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
                 bb.put( jndiControl.getEncodedValue() ).flip();
 
@@ -513,10 +515,10 @@ public abstract class ServerContext impl
                 break;
 
             case SYNC_STATE_VALUE_CONTROL:
-                control = new SyncStateValueControl();
+                control = new SyncStateValueDecorator();
                 SyncStateValueControlDecoder syncStateValueControlDecoder = new SyncStateValueControlDecoder();
-                SyncStateValueControlContainer syncStateValueControlContainer = new SyncStateValueControlContainer();
-                syncStateValueControlContainer.setSyncStateValueControl( ( SyncStateValueControl ) control );
+                SyncStateValueContainer syncStateValueControlContainer = new SyncStateValueContainer();
+                syncStateValueControlContainer.setSyncStateValueControl( ( SyncStateValueDecorator ) control );
                 bb = ByteBuffer.allocate( jndiControl.getEncodedValue().length );
                 bb.put( jndiControl.getEncodedValue() ).flip();
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Sat Jan 29 08:23:02 2011
@@ -61,8 +61,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
+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;
 import org.apache.directory.shared.ldap.model.message.controls.PersistentSearch;
@@ -178,8 +178,8 @@ public class DefaultPartitionNexus exten
             EntryChange.OID, Subentries.OID, ManageDsaIT.OID,
             Cascade.OID, PagedResults.OID,
             // Replication controls
-            SyncDoneValueControl.CONTROL_OID, SyncInfoValueControl.CONTROL_OID, SyncRequestValueControl.CONTROL_OID,
-            SyncStateValueControl.CONTROL_OID );
+            SyncDoneValueControl.CONTROL_OID, SyncInfoValueControl.CONTROL_OID, ISyncRequestValue.OID,
+            ISyncStateValue.OID );
 
         // Add the objectClasses
         rootDSE.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Sat Jan 29 08:23:02 2011
@@ -64,8 +64,8 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
+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;
 import org.apache.directory.shared.ldap.model.message.controls.PersistentSearch;
@@ -244,8 +244,8 @@ public class LdapServer extends Director
         // Replication controls
         this.supportedControls.add( SyncDoneValueControl.CONTROL_OID );
         this.supportedControls.add( SyncInfoValueControl.CONTROL_OID );
-        this.supportedControls.add( SyncRequestValueControl.CONTROL_OID );
-        this.supportedControls.add( SyncStateValueControl.CONTROL_OID );
+        this.supportedControls.add( ISyncRequestValue.OID );
+        this.supportedControls.add( ISyncStateValue.OID );
     }
 
 

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Sat Jan 29 08:23:02 2011
@@ -39,7 +39,7 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.server.ldap.handlers.controls.PagedSearchContext;
 import org.apache.directory.server.ldap.replication.ReplicationProvider;
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.ISyncRequestValue;
 import org.apache.directory.shared.ldap.model.message.controls.PagedResults;
 import org.apache.directory.shared.ldap.codec.search.controls.pagedSearch.PagedResultsDecorator;
 import org.apache.directory.shared.ldap.model.message.controls.PersistentSearch;
@@ -181,7 +181,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( SyncRequestValueControl.CONTROL_OID ) )
+        if ( req.getControls().containsKey( ISyncRequestValue.OID ) )
         {
             handleSyncreplSearch( session, req );
         }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplConsumer.java Sat Jan 29 08:23:02 2011
@@ -44,8 +44,9 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueControlDecoder;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControlDecoder;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
+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;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControlDecoder;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControlDecoder;
@@ -323,17 +324,17 @@ public class SyncReplConsumer implements
 
         LOG.debug( "------------- starting handleSearchResult ------------" );
 
-        SyncStateValueControl syncStateCtrl = new SyncStateValueControl();
+        SyncStateValueDecorator syncStateCtrl = new SyncStateValueDecorator();
 
         try
         {
             Entry remoteEntry = syncResult.getEntry();
 
-            Control ctrl = syncResult.getControls().get( SyncStateValueControl.CONTROL_OID );
+            Control ctrl = syncResult.getControls().get( ISyncStateValue.OID );
 
             try
             {
-                syncStateCtrl = ( SyncStateValueControl ) syncStateControlDecoder.decode( ctrl.getValue(),
+                syncStateCtrl = ( SyncStateValueDecorator ) syncStateControlDecoder.decode( ctrl.getValue(),
                     syncStateCtrl );
             }
             catch ( Exception e )
@@ -534,7 +535,7 @@ public class SyncReplConsumer implements
      */
     private void doSyncSearch( SynchronizationModeEnum syncType, boolean reloadHint ) throws Exception
     {
-        SyncRequestValueControl syncReq = new SyncRequestValueControl();
+        SyncRequestValueDecorator syncReq = new SyncRequestValueDecorator();
 
         syncReq.setMode( syncType );
         syncReq.setReloadHint( reloadHint );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplProvider.java Sat Jan 29 08:23:02 2011
@@ -50,8 +50,8 @@ import org.apache.directory.server.ldap.
 import org.apache.directory.shared.ldap.model.message.controls.ManageDsaIT;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncDoneValue.SyncDoneValueControl;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncInfoValue.SyncInfoValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncRequestValue.SyncRequestValueControl;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
+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.SyncModifyDnControl;
 import org.apache.directory.shared.ldap.message.control.replication.SyncStateTypeEnum;
 import org.apache.directory.shared.ldap.message.control.replication.SynchronizationInfoEnum;
@@ -213,8 +213,8 @@ public class SyncReplProvider implements
     {
         try
         {
-            SyncRequestValueControl syncControl = ( SyncRequestValueControl ) req.getControls().get(
-                SyncRequestValueControl.CONTROL_OID );
+            ISyncRequestValue syncControl = ( ISyncRequestValue ) req.getControls().get(
+                ISyncRequestValue.OID );
 
             // cookie is in the format <replicaId>;<Csn value>
             byte[] cookieBytes = syncControl.getCookie();
@@ -560,7 +560,7 @@ public class SyncReplProvider implements
     {
 
         EntryAttribute uuid = entry.get( SchemaConstants.ENTRY_UUID_AT );
-        SyncStateValueControl syncStateControl = new SyncStateValueControl();
+        SyncStateValueDecorator syncStateControl = new SyncStateValueDecorator();
         syncStateControl.setSyncStateType( syncStateType );
         syncStateControl.setEntryUUID( Strings.uuidToBytes(uuid.getString()) );
 
@@ -584,7 +584,7 @@ public class SyncReplProvider implements
     {
 
         EntryAttribute uuid = entry.get( SchemaConstants.ENTRY_UUID_AT );
-        SyncStateValueControl syncStateControl = new SyncStateValueControl();
+        SyncStateValueDecorator syncStateControl = new SyncStateValueDecorator();
         syncStateControl.setSyncStateType( SyncStateTypeEnum.MODDN );
         syncStateControl.setEntryUUID( Strings.uuidToBytes(uuid.getString()) );
 
@@ -994,8 +994,8 @@ public class SyncReplProvider implements
 
     private boolean isRefreshNPersist( SearchRequest req )
     {
-        SyncRequestValueControl control = ( SyncRequestValueControl ) req.getControls().get(
-            SyncRequestValueControl.CONTROL_OID );
+        ISyncRequestValue control = ( ISyncRequestValue ) req.getControls().get(
+            ISyncRequestValue.OID );
         return ( control.getMode() == SynchronizationModeEnum.REFRESH_AND_PERSIST ? true : false );
     }
 }

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/replication/SyncReplSearchListener.java Sat Jan 29 08:23:02 2011
@@ -30,7 +30,7 @@ import org.apache.directory.server.core.
 import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.ldap.LdapSession;
-import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueControl;
+import org.apache.directory.shared.ldap.codec.controls.replication.syncStateValue.SyncStateValueDecorator;
 import org.apache.directory.shared.ldap.codec.controls.replication.syncmodifydn.SyncModifyDnControl;
 import org.apache.directory.shared.ldap.message.control.replication.SyncModifyDnType;
 import org.apache.directory.shared.ldap.message.control.replication.SyncStateTypeEnum;
@@ -145,7 +145,7 @@ public class SyncReplSearchListener impl
                 respEntry.setObjectName( entry.getDn() );
                 respEntry.setEntry( entry );
 
-                SyncStateValueControl syncAdd = new SyncStateValueControl();
+                SyncStateValueDecorator syncAdd = new SyncStateValueDecorator();
                 syncAdd.setSyncStateType( SyncStateTypeEnum.ADD );
                 syncAdd
                     .setEntryUUID( Strings.uuidToBytes(entry.get(SchemaConstants.ENTRY_UUID_AT).getString()) );
@@ -186,7 +186,7 @@ public class SyncReplSearchListener impl
                 respEntry.setObjectName( entry.getDn() );
                 respEntry.setEntry( entry );
 
-                SyncStateValueControl syncDelete = new SyncStateValueControl();
+                SyncStateValueDecorator syncDelete = new SyncStateValueDecorator();
                 syncDelete.setSyncStateType( SyncStateTypeEnum.DELETE );
                 syncDelete.setEntryUUID( Strings.uuidToBytes(entry.get(SchemaConstants.ENTRY_UUID_AT)
                         .getString()) );
@@ -225,7 +225,7 @@ public class SyncReplSearchListener impl
                 respEntry.setObjectName( modifyContext.getDn() );
                 respEntry.setEntry( alteredEntry );
 
-                SyncStateValueControl syncModify = new SyncStateValueControl();
+                SyncStateValueDecorator syncModify = new SyncStateValueDecorator();
                 syncModify.setSyncStateType( SyncStateTypeEnum.MODIFY );
                 syncModify.setEntryUUID( Strings.uuidToBytes(alteredEntry.get(SchemaConstants.ENTRY_UUID_AT)
                         .getString()) );
@@ -273,7 +273,7 @@ public class SyncReplSearchListener impl
                 respEntry.setObjectName( moveContext.getDn() );
                 respEntry.setEntry( entry );
 
-                SyncStateValueControl syncModify = new SyncStateValueControl();
+                SyncStateValueDecorator syncModify = new SyncStateValueDecorator();
                 syncModify.setSyncStateType( SyncStateTypeEnum.MODDN );
                 syncModify.setEntryUUID( Strings.uuidToBytes(entry.get(SchemaConstants.ENTRY_UUID_AT)
                         .getString()) );
@@ -324,7 +324,7 @@ public class SyncReplSearchListener impl
                 respEntry.setObjectName( moveAndRenameContext.getModifiedEntry().getDn() );
                 respEntry.setEntry( alteredEntry );
 
-                SyncStateValueControl syncModify = new SyncStateValueControl();
+                SyncStateValueDecorator syncModify = new SyncStateValueDecorator();
                 syncModify.setSyncStateType( SyncStateTypeEnum.MODDN );
                 syncModify.setEntryUUID( Strings.uuidToBytes(alteredEntry.get(SchemaConstants.ENTRY_UUID_AT)
                         .getString()) );
@@ -368,7 +368,7 @@ public class SyncReplSearchListener impl
                 respEntry.setObjectName( entry.getDn() );
                 respEntry.setEntry( entry );
 
-                SyncStateValueControl syncModify = new SyncStateValueControl();
+                SyncStateValueDecorator syncModify = new SyncStateValueDecorator();
                 syncModify.setSyncStateType( SyncStateTypeEnum.MODDN );
                 syncModify.setEntryUUID( Strings.uuidToBytes(entry.get(SchemaConstants.ENTRY_UUID_AT)
                         .getString()) );

Modified: directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java (original)
+++ directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/AbstractContainer.java Sat Jan 29 08:23:02 2011
@@ -83,16 +83,19 @@ public abstract class AbstractContainer 
         state = TLVStateEnum.TAG_STATE_START;
     }
 
+    
     /**
      * Creates a new instance of AbstractContainer with a starting state.
      * 
      * @param stream the buffer containing the data to decode
      */
-    protected AbstractContainer(ByteBuffer stream) {
+    protected AbstractContainer( ByteBuffer stream ) 
+    {
         state = TLVStateEnum.TAG_STATE_START;
         this.stream = stream;
     }
 
+    
     /**
      * Get the current grammar
      * 
@@ -222,7 +225,7 @@ public abstract class AbstractContainer 
     {
         tlv = null;
         parentTLV = null;
-        transition = ((States)transition).getStartState();
+        transition = ( ( States ) transition ).getStartState();
         state = TLVStateEnum.TAG_STATE_START;
     }
 

Modified: directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java (original)
+++ directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Action.java Sat Jan 29 08:23:02 2011
@@ -26,11 +26,11 @@ import org.apache.directory.shared.asn1.
 
 /**
  * Action interface just contains the method 'action' which must be implemented
- * in all the implementong classes.
+ * in all the implementing classes.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface Action
+public interface Action<E extends Asn1Container>
 {
     /**
      * The action to be executed.
@@ -38,5 +38,5 @@ public interface Action
      * @param container The container which stores the current data
      * @throws DecoderException Thrown if something went wrong.
      */
-    void action( Asn1Container container ) throws DecoderException;
+    void action( E container ) throws DecoderException;
 }

Modified: directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java (original)
+++ directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/Grammar.java Sat Jan 29 08:23:02 2011
@@ -20,8 +20,8 @@
 package org.apache.directory.shared.asn1.ber.grammar;
 
 
-import org.apache.directory.shared.asn1.ber.Asn1Container;
 import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.asn1.ber.Asn1Container;
 
 
 /**

Modified: directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java (original)
+++ directory/shared/trunk/asn1-ber/src/main/java/org/apache/directory/shared/asn1/ber/grammar/GrammarAction.java Sat Jan 29 08:23:02 2011
@@ -19,14 +19,16 @@
  */
 package org.apache.directory.shared.asn1.ber.grammar;
 
+import org.apache.directory.shared.asn1.ber.Asn1Container;
+
 
 /**
  * A top level grammar class that store meta informations about the actions.
- * Those informations are not mandatory, but they can be usefull for debugging.
+ * Those informations are not mandatory, but they can be useful for debugging.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class GrammarAction implements Action
+public abstract class GrammarAction<E extends Asn1Container> implements Action<E>
 {
     /** The action's name */
     protected String name;
@@ -41,7 +43,7 @@ public abstract class GrammarAction impl
     /**
      * Creates a new GrammarAction object.
      * 
-     * @param name The name of the create daction
+     * @param name The name of the create action
      */
     public GrammarAction( String name )
     {

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/DefaultLdapCodecService.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,206 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec;
+
+
+import java.lang.reflect.Field; 
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+
+
+/**
+ * The default {@link ILdapCodecService} implementation.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class DefaultLdapCodecService implements ILdapCodecService
+{
+    Map<String,IControlFactory<?,?>> controlFactories = new HashMap<String, IControlFactory<?,?>>();
+    Map<String,IExtendedOpFactory<?,?>> extReqFactories = new HashMap<String, IExtendedOpFactory<?,?>>();
+    Map<String,IExtendedOpFactory<?,?>> extResFactories = new HashMap<String, IExtendedOpFactory<?,?>>();
+    
+
+    //-------------------------------------------------------------------------
+    // ILdapCodecService implementation methods
+    //-------------------------------------------------------------------------
+    
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void registerControl( IControlFactory<?,?> factory )
+    {
+        controlFactories.put( factory.getOid(), factory );
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> controlOids()
+    {
+        return controlFactories.keySet().iterator();
+    }
+    
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> extendedRequestOids()
+    {
+        return extReqFactories.keySet().iterator();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<String> extendedResponseOids()
+    {
+        return extResFactories.keySet().iterator();
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public void registerExtendedOp( IExtendedOpFactory<?, ?> factory )
+    {
+        extReqFactories.put( factory.getRequestOid(), factory );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public <E> E newCodecControl( Class<? extends ICodecControl<? extends Control>> clazz )
+    {
+        try
+        {
+            Field f = clazz.getField( "OID" );
+            String oid = ( String ) f.get( null );
+            IControlFactory<?,?> factory = controlFactories.get( oid );
+            return extracted2( factory );
+        }
+        catch ( IllegalAccessException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( SecurityException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( NoSuchFieldException e )
+        {
+            e.printStackTrace();
+        }
+        
+        return null;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public <E> E newControl( Class<? extends Control> clazz )
+    {
+        try
+        {
+            Field f = clazz.getField( "OID" );
+            String oid = ( String ) f.get( null );
+            IControlFactory<?,?> factory = controlFactories.get( oid );
+            return extracted( factory );
+        }
+        catch ( IllegalAccessException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( SecurityException e )
+        {
+            e.printStackTrace();
+        }
+        catch ( NoSuchFieldException e )
+        {
+            e.printStackTrace();
+        }
+        
+        return null;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public ProtocolCodecFactory newProtocolCodecFactory( boolean client )
+    {
+        return null;
+    }
+
+    
+    @SuppressWarnings("unchecked")
+    private <E> E extracted( IControlFactory<?,?> factory )
+    {
+        return ( E ) factory.newControl();
+    }
+
+    
+    @SuppressWarnings("unchecked")
+    private <E> E extracted2( IControlFactory<?,?> factory )
+    {
+        return ( E ) factory.newCodecControl();
+    }
+
+
+    public <E> E newControl( String oid )
+    {
+        try
+        {
+            IControlFactory<?,?> factory = controlFactories.get( oid );
+            return extracted( factory );
+        }
+        catch ( SecurityException e )
+        {
+            e.printStackTrace();
+        }
+        
+        return null;
+    }
+
+
+    public ICodecControl<? extends Control> decorate( Control control )
+    {
+        try
+        {
+            IControlFactory<?,?> factory = controlFactories.get( control.getOid() );
+            return factory.decorate( control );
+        }
+        catch ( SecurityException e )
+        {
+            e.printStackTrace();
+        }
+        
+        return null;
+    }
+}

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ICodecControl.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControl.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ICodecControl.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ICodecControl.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControl.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/controls/CodecControl.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ICodecControl.java Sat Jan 29 08:23:02 2011
@@ -17,11 +17,12 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.controls;
+package org.apache.directory.shared.ldap.codec;
 
-import java.nio.ByteBuffer;
 
-import org.apache.directory.shared.asn1.EncoderException;
+import org.apache.directory.shared.asn1.Asn1Object;
+import org.apache.directory.shared.asn1.DecoderException;
+import org.apache.directory.shared.ldap.model.message.Control;
 
 
 /**
@@ -29,50 +30,36 @@ import org.apache.directory.shared.asn1.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface CodecControl
+public interface ICodecControl<E extends Control> extends Control, IDecorator<E>
 {
     /**
-     * Generate the PDU which contains the Control.
-     * <pre> 
-     * Control : 
+     * Decodes raw ASN.1 encoded bytes into an Asn1Object for the control.
      * 
-     * 0x30 LL
-     *   0x04 LL type 
-     *   [0x01 0x01 criticality]
-     *   [0x04 LL value]
-     * </pre>
-     * @param buffer The encoded PDU
-     * @return A ByteBuffer that contaons the PDU
-     * @throws EncoderException If anything goes wrong.
+     * @param controlBytes the encoded control bytes
+     * @return the decoded Asn1Object for the control
+     * @throws DecoderException if anything goes wrong
      */
-    ByteBuffer encode( ByteBuffer buffer ) throws EncoderException;
+    Asn1Object decode( byte[] controlBytes ) throws DecoderException;
+
 
-    
     /**
-     * Compute the Control length
-     * <pre> 
-     * Control :
-     * 
-     * 0x30 L1
-     *  |
-     *  +--> 0x04 L2 controlType
-     * [+--> 0x01 0x01 criticality]
-     * [+--> 0x04 L3 controlValue] 
+     * Checks to see if a value is set for this {@link ICodecControl}.
+     */
+    boolean hasValue();
+
+
+    /**
+     * Get the control value
      * 
-     * Control length = Length(0x30) + length(L1) 
-     *                  + Length(0x04) + Length(L2) + L2
-     *                  [+ Length(0x01) + 1 + 1]
-     *                  [+ Length(0x04) + Length(L3) + L3]
-     * </pre>
-     * @return The computed length of the Control
+     * @return The control value
      */
-    int computeLength();
+    byte[] getValue();
 
 
     /**
-     * Get the associated decoder
-     *
-     * @return The Control decoder
+     * Set the encoded control value
+     * 
+     * @param value The encoded control value to store
      */
-    ControlDecoder getDecoder();
+    void setValue( byte[] value );
 }

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IControlFactory.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,41 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec;
+
+
+import org.apache.directory.shared.ldap.model.message.Control;
+
+
+/**
+ * The LdapCodec interface, defined by the codec API.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IControlFactory<C extends Control, D extends ICodecControl<C>>
+{
+    String getOid();
+    
+    D newCodecControl();
+    
+    D decorate( Control control );
+    
+    C newControl();
+}

Copied: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IDecorator.java (from r1064846, directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/Decorator.java)
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IDecorator.java?p2=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IDecorator.java&p1=directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/Decorator.java&r1=1064846&r2=1064981&rev=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/decorators/Decorator.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IDecorator.java Sat Jan 29 08:23:02 2011
@@ -17,22 +17,24 @@
  *  under the License. 
  *  
  */
-package org.apache.directory.shared.ldap.codec.decorators;
+package org.apache.directory.shared.ldap.codec;
+
 
 import java.nio.ByteBuffer;
 
 import org.apache.directory.shared.asn1.EncoderException;
 
 
-
-
 /**
  * A decorator interface exposing the ComputeLength and encode methods.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public interface Decorator
+public interface IDecorator<E>
 {
+    E getDecorated();
+    
+    
     /**
      * Compute the object length, which is the sum of all inner length.
      * 

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IExtendedOpFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IExtendedOpFactory.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IExtendedOpFactory.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/IExtendedOpFactory.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,42 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec;
+
+
+import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
+import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
+
+
+/**
+ * The LdapCodec interface, defined by the codec API.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface IExtendedOpFactory<Q extends ExtendedRequest, P extends ExtendedResponse>
+{
+    String getResponseOid();
+    
+    String getRequestOid();
+    
+    Q newRequest();
+    
+    P newResponse();
+}

Added: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java?rev=1064981&view=auto
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java (added)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/ILdapCodecService.java Sat Jan 29 08:23:02 2011
@@ -0,0 +1,72 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.codec;
+
+
+import java.util.Iterator;
+
+import org.apache.directory.shared.ldap.model.message.Control;
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+
+
+/**
+ * The LdapCodec interface.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public interface ILdapCodecService
+{
+    Iterator<String> controlOids();
+    
+    
+    Iterator<String> extendedRequestOids();
+    
+    
+    Iterator<String> extendedResponseOids();
+    
+    
+    void registerControl( IControlFactory<?,?> factory );
+    
+    
+    void registerExtendedOp( IExtendedOpFactory<?,?> factory );
+    
+    
+    <E> E newControl( Class<? extends Control> clazz );
+    
+    
+    <E> E newControl( String oid );
+    
+
+    ICodecControl<? extends Control> decorate( Control control );
+    
+    
+    <E> E newCodecControl( Class<? extends ICodecControl<? extends Control>> clazz );
+    
+    
+    /**
+     * Creates a new LDAP {@link ProtocolCodecFactory}.
+     *
+     * @param client if true a factory designed for clients is returned, 
+     * otherwise one for servers is returned.
+     * @return the client or server specific {@link ProtocolCodecFactory}
+     */
+    ProtocolCodecFactory newProtocolCodecFactory( boolean client );
+}

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapDecoder.java Sat Jan 29 08:23:02 2011
@@ -29,6 +29,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.Asn1Decoder;
 import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
 import org.apache.directory.shared.i18n.I18n;
+import org.apache.directory.shared.ldap.codec.decorators.MessageDecorator;
 import org.apache.directory.shared.ldap.model.exception.ResponseCarryingMessageException;
 import org.apache.directory.shared.ldap.model.message.Message;
 import org.apache.directory.shared.util.Strings;
@@ -54,7 +55,7 @@ public class LdapDecoder implements Prot
     private static final boolean IS_DEBUG = LOG.isDebugEnabled();
 
     /** The message container for this instance */
-    private LdapMessageContainer ldapMessageContainer;
+    private LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer;
 
     /** The callback to call when the decoding is done */
     private DecoderCallback decoderCallback;
@@ -196,11 +197,12 @@ public class LdapDecoder implements Prot
     }
 
 
+    @SuppressWarnings("unchecked")
     public void decode( IoSession session, IoBuffer in, ProtocolDecoderOutput out ) throws Exception
     {
         ByteBuffer buf = in.buf();
-        LdapMessageContainer messageContainer = ( LdapMessageContainer ) session
-            .getAttribute( "messageContainer" );
+        LdapMessageContainer<MessageDecorator<? extends Message>> messageContainer = 
+            ( LdapMessageContainer<MessageDecorator<? extends Message>> ) session.getAttribute( "messageContainer" );
 
         if ( session.containsAttribute( "maxPDUSize" ) )
         {
@@ -294,7 +296,7 @@ public class LdapDecoder implements Prot
     /**
      * @param ldapMessageContainer the ldapMessageContainer to set
      */
-    public void setLdapMessageContainer( LdapMessageContainer ldapMessageContainer )
+    public void setLdapMessageContainer( LdapMessageContainer<MessageDecorator<? extends Message>> ldapMessageContainer )
     {
         this.ldapMessageContainer = ldapMessageContainer;
     }

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java?rev=1064981&r1=1064980&r2=1064981&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/LdapEncoder.java Sat Jan 29 08:23:02 2011
@@ -20,7 +20,7 @@
 package org.apache.directory.shared.ldap.codec;
 
 
-import java.nio.BufferOverflowException;
+import java.nio.BufferOverflowException; 
 import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.LinkedList;
@@ -33,7 +33,7 @@ import org.apache.directory.shared.asn1.
 import org.apache.directory.shared.asn1.ber.tlv.Value;
 import org.apache.directory.shared.asn1.util.Asn1StringUtils;
 import org.apache.directory.shared.i18n.I18n;
-import org.apache.directory.shared.ldap.codec.controls.CodecControl;
+import org.apache.directory.shared.ldap.codec.decorators.AbandonRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.AddRequestDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.AddResponseDecorator;
 import org.apache.directory.shared.ldap.codec.decorators.BindRequestDecorator;
@@ -88,6 +88,10 @@ import org.apache.directory.shared.util.
  */
 public class LdapEncoder
 {
+    /** The LdapCodecService */
+    private ILdapCodecService codec;
+    
+    
     /**
      * Generate the PDU which contains the encoded object. 
      * 
@@ -114,7 +118,7 @@ public class LdapEncoder
      */
     public ByteBuffer encodeMessage( Message message ) throws EncoderException
     {
-        MessageDecorator decorator = MessageDecorator.getDecorator( message );
+        MessageDecorator<? extends Message> decorator = MessageDecorator.getDecorator( codec, message );
         int length = computeMessageLength( decorator );
         ByteBuffer buffer = ByteBuffer.allocate( length );
 
@@ -151,7 +155,7 @@ public class LdapEncoder
                 // Encode each control
                 for ( Control control : controls.values() )
                 {
-                    ( ( CodecControl ) control ).encode( buffer );
+                    ( ( ICodecControl<?> ) control ).encode( buffer );
                 }
             }
         }
@@ -182,18 +186,18 @@ public class LdapEncoder
      *
      * @param messageDecorator the decorated Message who's length is to be encoded
      */
-    private int computeMessageLength( MessageDecorator messageDecorator )
+    private int computeMessageLength( MessageDecorator<? extends Message> messageDecorator )
     {
         // The length of the MessageId. It's the sum of
         // - the tag (0x02), 1 byte
         // - the length of the Id length, 1 byte
         // - the Id length, 1 to 4 bytes
-        int ldapMessageLength = 1 + 1 + Value.getNbBytes( messageDecorator.getDecoratedMessage().getMessageId());
+        int ldapMessageLength = 1 + 1 + Value.getNbBytes( messageDecorator.getDecorated().getMessageId());
 
         // Get the protocolOp length
         ldapMessageLength += computeProtocolOpLength( messageDecorator );
 
-        Map<String, Control> controls = messageDecorator.getDecoratedMessage().getControls();
+        Map<String, Control> controls = messageDecorator.getDecorated().getControls();
 
         // Do the same thing for Controls, if any.
         if ( controls.size() > 0 )
@@ -222,7 +226,7 @@ public class LdapEncoder
             // We may have more than one control. ControlsLength is L4.
             for ( Control control : controls.values() )
             {
-                controlsSequenceLength += ( ( CodecControl ) control ).computeLength();
+                controlsSequenceLength += ( ( ICodecControl<?> ) control ).computeLength();
             }
 
             // Computes the controls length
@@ -354,7 +358,7 @@ public class LdapEncoder
      * @param buffer The buffer where to put the PDU
      * @return The PDU.
      */
-    private void encodeReferral( ByteBuffer buffer, Referral referral ) throws EncoderException
+    public static void encodeReferral( ByteBuffer buffer, Referral referral ) throws EncoderException
     {
         Collection<byte[]> ldapUrlsBytes = referral.getLdapUrlsBytes();
 
@@ -383,9 +387,9 @@ public class LdapEncoder
      * 
      * Length(AbandonRequest) = Length(0x50) + 1 + Length(abandoned MessageId)
      */
-    private int computeAbandonRequestLength( AbandonRequestImpl abandonRequest )
+    private int computeAbandonRequestLength( AbandonRequestDecorator message )
     {
-        int length = 1 + 1 + Value.getNbBytes( abandonRequest.getAbandoned() );
+        int length = 1 + 1 + Value.getNbBytes( message.getAbandoned() );
 
         return length;
     }
@@ -432,7 +436,7 @@ public class LdapEncoder
      */
     private int computeAddRequestLength( AddRequestDecorator addRequestDecorator )
     {
-        AddRequest addRequest = addRequestDecorator.getAddRequest();
+        AddRequest addRequest = addRequestDecorator.getDecorated();
         Entry entry = addRequest.getEntry();
 
         if ( entry == null )
@@ -539,7 +543,7 @@ public class LdapEncoder
      */
     private int computeBindRequestLength( BindRequestDecorator bindRequestDecorator )
     {
-        BindRequest bindRequest = bindRequestDecorator.getBindRequest();
+        BindRequest bindRequest = bindRequestDecorator.getDecorated();
         int bindRequestLength = 1 + 1 + 1; // Initialized with version
 
         // The name
@@ -605,7 +609,7 @@ public class LdapEncoder
      */
     private int computeBindResponseLength( BindResponseDecorator bindResponseDecorator )
     {
-        BindResponse bindResponse = bindResponseDecorator.getBindResponse();
+        BindResponse bindResponse = bindResponseDecorator.getDecorated();
         int ldapResultLength = computeLdapResultLength( bindResponseDecorator.getLdapResult() );
 
         int bindResponseLength = ldapResultLength;
@@ -644,7 +648,7 @@ public class LdapEncoder
      */
     private int computeCompareRequestLength( CompareRequestDecorator compareRequestDecorator )
     {
-        CompareRequest compareRequest = compareRequestDecorator.getCompareRequest();
+        CompareRequest compareRequest = compareRequestDecorator.getDecorated();
         // The entry Dn
         Dn entry = compareRequest.getName();
         int compareRequestLength = 1 + TLV.getNbBytes( Dn.getNbBytes(entry) ) + Dn.getNbBytes(entry);
@@ -757,7 +761,7 @@ public class LdapEncoder
      */
     private int computeExtendedRequestLength( ExtendedRequestDecorator extendedRequestDecorator )
     {
-        ExtendedRequest extendedRequest = extendedRequestDecorator.getExtendedRequest();
+        ExtendedRequest extendedRequest = extendedRequestDecorator.getDecorated();
         byte[] requestNameBytes = Strings.getBytesUtf8(extendedRequest.getRequestName());
 
         extendedRequestDecorator.setRequestNameBytes( requestNameBytes );
@@ -797,7 +801,7 @@ public class LdapEncoder
      */
     private int computeExtendedResponseLength( ExtendedResponseDecorator extendedResponseDecorator )
     {
-        ExtendedResponse extendedResponse = extendedResponseDecorator.getExtendedResponse();
+        ExtendedResponse extendedResponse = extendedResponseDecorator.getDecorated();
         int ldapResultLength = computeLdapResultLength( extendedResponseDecorator.getLdapResult() );
 
         int extendedResponseLength = ldapResultLength;
@@ -844,7 +848,7 @@ public class LdapEncoder
      */
     private int computeIntermediateResponseLength( IntermediateResponseDecorator intermediateResponseDecorator )
     {
-        IntermediateResponse intermediateResponse = intermediateResponseDecorator.getIntermediateResponse();
+        IntermediateResponse intermediateResponse = intermediateResponseDecorator.getDecorated();
         int intermediateResponseLength = 0;
 
         if ( !Strings.isEmpty(intermediateResponse.getResponseName()) )
@@ -911,7 +915,7 @@ public class LdapEncoder
      */
     private int computeModifyRequestLength( ModifyRequestDecorator modifyRequestDecorator )
     {
-        ModifyRequest modifyRequest = modifyRequestDecorator.getModifyRequest();
+        ModifyRequest modifyRequest = modifyRequestDecorator.getDecorated();
         // Initialized with name
         int modifyRequestLength = 1 + TLV.getNbBytes( Dn.getNbBytes( modifyRequest.getName() ) )
             + Dn.getNbBytes(modifyRequest.getName() );
@@ -1024,7 +1028,7 @@ public class LdapEncoder
      */
     private int computeModifyDnRequestLength( ModifyDnRequestDecorator modifyDnRequestDecorator )
     {
-        ModifyDnRequest modifyDnRequest = modifyDnRequestDecorator.getModifyDnRequest();
+        ModifyDnRequest modifyDnRequest = modifyDnRequestDecorator.getDecorated();
         int newRdnlength = Strings.getBytesUtf8(modifyDnRequest.getNewRdn().getName()).length;
 
         int modifyDNRequestLength = 1 + TLV.getNbBytes( Dn.getNbBytes(modifyDnRequest.getName()) )
@@ -1066,7 +1070,7 @@ public class LdapEncoder
     }
 
 
-    private int computeReferralLength( Referral referral )
+    public static int computeReferralLength( Referral referral )
     {
         if ( referral != null )
         {
@@ -1126,7 +1130,7 @@ public class LdapEncoder
      */
     private int computeSearchRequestLength( SearchRequestDecorator searchRequestDecorator )
     {
-        SearchRequest searchRequest = searchRequestDecorator.getSearchRequest();
+        SearchRequest searchRequest = searchRequestDecorator.getDecorated();
         int searchRequestLength = 0;
 
         // The baseObject
@@ -1241,7 +1245,7 @@ public class LdapEncoder
      */
     private int computeSearchResultEntryLength( SearchResultEntryDecorator searchResultEntryDecorator )
     {
-        SearchResultEntry searchResultEntry = searchResultEntryDecorator.getSearchResultEntry();
+        SearchResultEntry searchResultEntry = searchResultEntryDecorator.getDecorated();
         Dn dn = searchResultEntry.getObjectName();
 
         byte[] dnBytes = Strings.getBytesUtf8(dn.getName());
@@ -1348,7 +1352,7 @@ public class LdapEncoder
      */
     private int computeSearchResultReferenceLength( SearchResultReferenceDecorator searchResultReferenceDecorator )
     {
-        SearchResultReference searchResultReference = searchResultReferenceDecorator.getSearchResultReference();
+        SearchResultReference searchResultReference = searchResultReferenceDecorator.getDecorated();
         int searchResultReferenceLength = 0;
 
         // We may have more than one reference.
@@ -1433,7 +1437,7 @@ public class LdapEncoder
      */
     private void encodeAddRequest( ByteBuffer buffer, AddRequestDecorator decorator ) throws EncoderException
     {
-        AddRequest addRequest = decorator.getAddRequest();
+        AddRequest addRequest = decorator.getDecorated();
 
         try
         {
@@ -1539,7 +1543,7 @@ public class LdapEncoder
      */
     private void encodeBindRequest( ByteBuffer buffer, BindRequestDecorator decorator ) throws EncoderException
     {
-        BindRequest bindRequest = decorator.getBindRequest();
+        BindRequest bindRequest = decorator.getDecorated();
 
         try
         {
@@ -1634,7 +1638,7 @@ public class LdapEncoder
      */
     private void encodeBindResponse( ByteBuffer bb, BindResponseDecorator bindResponseDecorator ) throws EncoderException
     {
-        BindResponse bindResponse = bindResponseDecorator.getBindResponse();
+        BindResponse bindResponse = bindResponseDecorator.getDecorated();
 
         try
         {
@@ -1681,7 +1685,7 @@ public class LdapEncoder
      */
     private void encodeCompareRequest( ByteBuffer buffer, CompareRequestDecorator decorator ) throws EncoderException
     {
-        CompareRequest compareRequest = decorator.getCompareRequest();
+        CompareRequest compareRequest = decorator.getDecorated();
         try
         {
             // The CompareRequest Tag
@@ -1795,7 +1799,7 @@ public class LdapEncoder
     private void encodeExtendedRequest( ByteBuffer buffer, ExtendedRequestDecorator decorator )
         throws EncoderException
     {
-        ExtendedRequest extendedRequest = decorator.getExtendedRequest();
+        ExtendedRequest extendedRequest = decorator.getDecorated();
         try
         {
             // The BindResponse Tag
@@ -1850,7 +1854,7 @@ public class LdapEncoder
     private void encodeExtendedResponse( ByteBuffer buffer, ExtendedResponseDecorator extendedResponseDecorator )
         throws EncoderException
     {
-        ExtendedResponse extendedResponse = extendedResponseDecorator.getExtendedResponse();
+        ExtendedResponse extendedResponse = extendedResponseDecorator.getDecorated();
         
         try
         {
@@ -1909,7 +1913,7 @@ public class LdapEncoder
     private void encodeIntermediateResponse( ByteBuffer buffer, IntermediateResponseDecorator decorator )
         throws EncoderException
     {
-        IntermediateResponse intermediateResponse = decorator.getIntermediateResponse();
+        IntermediateResponse intermediateResponse = decorator.getDecorated();
         try
         {
             // The ExtendedResponse Tag
@@ -1955,7 +1959,7 @@ public class LdapEncoder
      * <pre>
      * 0x66 LL
      *   0x04 LL object
-     *   0x30 LL modifiations
+     *   0x30 LL modifications
      *     0x30 LL modification sequence
      *       0x0A 0x01 operation
      *       0x30 LL modification
@@ -1978,10 +1982,9 @@ public class LdapEncoder
      * @param buffer The buffer where to put the PDU
      * @return The PDU.
      */
-    private void encodeModifyRequest( ByteBuffer buffer, ModifyRequestDecorator decorator )
-            throws EncoderException
+    private void encodeModifyRequest( ByteBuffer buffer, ModifyRequestDecorator decorator ) throws EncoderException
     {
-        ModifyRequest modifyRequest = decorator.getModifyRequest();
+        ModifyRequest modifyRequest = decorator.getDecorated();
         try
         {
             // The AddRequest Tag
@@ -2096,7 +2099,7 @@ public class LdapEncoder
     private void encodeModifyDnRequest( ByteBuffer buffer, ModifyDnRequestDecorator decorator )
         throws EncoderException
     {
-        ModifyDnRequest modifyDnRequest = decorator.getModifyDnRequest();
+        ModifyDnRequest modifyDnRequest = decorator.getDecorated();
         try
         {
             // The ModifyDNRequest Tag
@@ -2184,7 +2187,7 @@ public class LdapEncoder
      */
     private void encodeSearchRequest( ByteBuffer buffer, SearchRequestDecorator decorator ) throws EncoderException
     {
-        SearchRequest searchRequest = decorator.getSearchRequest();
+        SearchRequest searchRequest = decorator.getDecorated();
         try
         {
             // The SearchRequest Tag
@@ -2287,7 +2290,7 @@ public class LdapEncoder
     private void encodeSearchResultEntry( ByteBuffer buffer, SearchResultEntryDecorator searchResultEntryDecorator )
         throws EncoderException
     {
-        SearchResultEntry searchResultEntry = searchResultEntryDecorator.getSearchResultEntry();
+        SearchResultEntry searchResultEntry = searchResultEntryDecorator.getDecorated();
         try
         {
             // The SearchResultEntry Tag
@@ -2388,7 +2391,7 @@ public class LdapEncoder
     private void encodeSearchResultReference( ByteBuffer buffer, SearchResultReferenceDecorator searchResultReferenceDecorator )
         throws EncoderException
     {
-        SearchResultReference searchResultReference = searchResultReferenceDecorator.getSearchResultReference();
+        SearchResultReference searchResultReference = searchResultReferenceDecorator.getDecorated();
         try
         {
             // The SearchResultReference Tag
@@ -2418,14 +2421,14 @@ public class LdapEncoder
     /**
      * Compute the protocolOp length 
      */
-    private int computeProtocolOpLength( MessageDecorator messageDecorator )
+    private int computeProtocolOpLength( MessageDecorator<? extends Message> messageDecorator )
     {
-        Message message = messageDecorator.getDecoratedMessage();
+        Message message = messageDecorator.getDecorated();
 
         switch ( message.getType() )
         {
             case ABANDON_REQUEST:
-                return computeAbandonRequestLength( ( AbandonRequestImpl ) message );
+                return computeAbandonRequestLength( ( AbandonRequestDecorator ) message );
 
             case ADD_REQUEST:
                 return computeAddRequestLength( ( AddRequestDecorator ) messageDecorator );
@@ -2493,9 +2496,9 @@ public class LdapEncoder
     }
 
 
-    private void encodeProtocolOp( ByteBuffer bb, MessageDecorator decorator ) throws EncoderException
+    private void encodeProtocolOp( ByteBuffer bb, MessageDecorator<? extends Message> decorator ) throws EncoderException
     {
-        Message message = decorator.getDecoratedMessage();
+        Message message = decorator.getDecorated();
 
         switch ( message.getType() )
         {



Mime
View raw message