directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r1072211 - in /directory/shared/branches/m1: ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/ ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ ldap-codec/src/main/java/org/apache/dir...
Date Sat, 19 Feb 2011 00:31:28 GMT
Author: akarasulu
Date: Sat Feb 19 00:31:27 2011
New Revision: 1072211

URL: http://svn.apache.org/viewvc?rev=1072211&view=rev
Log:
DIRSHARED-86: Added the cancel request/response extras extended op factory.

 o no need for the response OID which is the same as the request OID
 o no need to have the additional methods for response and the additional
   generic type argument which was removed
 o some cleanup to get rid of warnings in the IDE
 o added the CancelRequest extended operation factory


Added:
    directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelExtendedOpFactory.java
Modified:
    directory/shared/branches/m1/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java
    directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedOpFactory.java
    directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
    directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java
    directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/ExtrasBundleActivator.java
    directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java
    directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreGraceAuthsRemaining.java
    directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java
    directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncDoneValueGrammar.java
    directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelRequest.java

Modified: directory/shared/branches/m1/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java
(original)
+++ directory/shared/branches/m1/ldap-codec-standalone/src/main/java/org/apache/directory/shared/ldap/codec/standalone/StandaloneLdapCodecService.java
Sat Feb 19 00:31:27 2011
@@ -112,10 +112,7 @@ public class StandaloneLdapCodecService 
     private Map<String,ControlFactory<?,?>> controlFactories = new HashMap<String,
ControlFactory<?,?>>();
 
     /** The map of registered {@link org.apache.directory.shared.ldap.codec.api.ExtendedOpFactory}'s
by request OID */
-    private Map<String,ExtendedOpFactory<?,?>> extReqFactories = new HashMap<String,
ExtendedOpFactory<?,?>>();
-    
-    /** The map of registered {@link ExtendedOpFactory}'s by response OID */
-    private Map<String,ExtendedOpFactory<?,?>> extResFactories = new HashMap<String,
ExtendedOpFactory<?,?>>();
+    private Map<String,ExtendedOpFactory<?>> extReqFactories = new HashMap<String,
ExtendedOpFactory<?>>();
     
     /** The codec's {@link BundleActivator} */
     private CodecHostActivator activator;
@@ -550,18 +547,9 @@ public class StandaloneLdapCodecService 
     /**
      * {@inheritDoc}
      */
-    public Iterator<String> registeredExtendedResponses()
-    {
-        return Collections.unmodifiableSet( extResFactories.keySet() ).iterator();
-    }
-
-    
-    /**
-     * {@inheritDoc}
-     */
-    public void registerExtendedOp( ExtendedOpFactory<?, ?> factory )
+    public void registerExtendedOp( ExtendedOpFactory<?> factory )
     {
-        extReqFactories.put( factory.getRequestOid(), factory );
+        extReqFactories.put( factory.getOid(), factory );
     }
 
     

Modified: directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedOpFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedOpFactory.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedOpFactory.java
(original)
+++ directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/ExtendedOpFactory.java
Sat Feb 19 00:31:27 2011
@@ -21,7 +21,6 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.ldap.model.message.ExtendedRequest;
-import org.apache.directory.shared.ldap.model.message.ExtendedResponse;
 
 
 /**
@@ -30,13 +29,18 @@ import org.apache.directory.shared.ldap.
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public interface ExtendedOpFactory<Q extends ExtendedRequest, P extends ExtendedResponse>
+public interface ExtendedOpFactory<Q extends ExtendedRequest>
 {
-    String getResponseOid();
+    /**
+     * Gets the OID of the extended requests this factory generates.
+     *
+     * @return the extended request OID
+     */
+    String getOid();
     
-    String getRequestOid();
     
+    /**
+     *  @return A new instance of the ExtendedRequest.
+     */
     Q newRequest();
-    
-    P newResponse();
 }

Modified: directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
(original)
+++ directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/api/LdapCodecService.java
Sat Feb 19 00:31:27 2011
@@ -63,15 +63,6 @@ public interface LdapCodecService
     
     
     /**
-     * Returns an Iterator over the OID Strings of registered extended 
-     * responses.
-     *
-     * @return The registered extended response OID Strings
-     */
-    Iterator<String> registeredExtendedResponses();
-    
-    
-    /**
      * Registers an {@link ControlFactory} with this service.
      * 
      * @param factory The control factory
@@ -93,7 +84,7 @@ public interface LdapCodecService
      * 
      * @param factory The extended operation factory
      */
-    void registerExtendedOp( ExtendedOpFactory<?,?> factory );
+    void registerExtendedOp( ExtendedOpFactory<?> factory );
     
     
     /**

Modified: directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java
(original)
+++ directory/shared/branches/m1/ldap-codec/src/main/java/org/apache/directory/shared/ldap/codec/osgi/DefaultLdapCodecService.java
Sat Feb 19 00:31:27 2011
@@ -67,10 +67,7 @@ public class DefaultLdapCodecService imp
     private Map<String,ControlFactory<?,?>> controlFactories = new HashMap<String,
ControlFactory<?,?>>();
 
     /** The map of registered {@link org.apache.directory.shared.ldap.codec.api.ExtendedOpFactory}'s
by request OID */
-    private Map<String,ExtendedOpFactory<?,?>> extReqFactories = new HashMap<String,
ExtendedOpFactory<?,?>>();
-
-    /** The map of registered {@link ExtendedOpFactory}'s by response OID */
-    private Map<String,ExtendedOpFactory<?,?>> extResFactories = new HashMap<String,
ExtendedOpFactory<?,?>>();
+    private Map<String,ExtendedOpFactory<?>> extReqFactories = new HashMap<String,
ExtendedOpFactory<?>>();
 
 
     /**
@@ -166,18 +163,9 @@ public class DefaultLdapCodecService imp
     /**
      * {@inheritDoc}
      */
-    public Iterator<String> registeredExtendedResponses()
-    {
-        return Collections.unmodifiableSet( extResFactories.keySet() ).iterator();
-    }
-
-
-    /**
-     * {@inheritDoc}
-     */
-    public void registerExtendedOp( ExtendedOpFactory<?, ?> factory )
+    public void registerExtendedOp( ExtendedOpFactory<?> factory )
     {
-        extReqFactories.put( factory.getRequestOid(), factory );
+        extReqFactories.put( factory.getOid(), factory );
     }
 
 

Modified: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/ExtrasBundleActivator.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/ExtrasBundleActivator.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/ExtrasBundleActivator.java
(original)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/ExtrasBundleActivator.java
Sat Feb 19 00:31:27 2011
@@ -21,6 +21,7 @@ package org.apache.directory.shared.ldap
 
 
 import org.apache.directory.shared.ldap.codec.api.ControlFactory;
+import org.apache.directory.shared.ldap.codec.api.ExtendedOpFactory;
 import org.apache.directory.shared.ldap.codec.api.LdapCodecService;
 import org.apache.directory.shared.ldap.extras.controls.ppolicy_impl.PasswordPolicyFactory;
 import org.apache.directory.shared.ldap.extras.controls.syncrepl_impl.SyncDoneValueFactory;
@@ -28,6 +29,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.extras.controls.syncrepl_impl.SyncModifyDnFactory;
 import org.apache.directory.shared.ldap.extras.controls.syncrepl_impl.SyncRequestValueFactory;
 import org.apache.directory.shared.ldap.extras.controls.syncrepl_impl.SyncStateValueFactory;
+import org.apache.directory.shared.ldap.extras.extended.CancelExtendedOpFactory;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -41,13 +43,27 @@ import org.osgi.framework.ServiceReferen
  */
 public class ExtrasBundleActivator implements BundleActivator
 {
+    /**
+     * {@inheritDoc}
+     */
     public void start( BundleContext context ) throws Exception
     {
         ServiceReference reference = 
             context.getServiceReference( LdapCodecService.class.getName() );
         
         LdapCodecService codec = ( LdapCodecService ) context.getService( reference );
-        
+        registerExtrasControls( codec );
+        registerExtrasExtendedOps( codec );
+    }
+    
+    
+    /**
+     * Registers all the extras controls present in this control pack.
+     *
+     * @param codec The codec service.
+     */
+    private void registerExtrasControls( LdapCodecService codec )
+    {
         ControlFactory<?,?> factory = new SyncDoneValueFactory( codec );
         codec.registerControl( factory );
         
@@ -68,8 +84,21 @@ public class ExtrasBundleActivator imple
     }
 
 
-    /* (non-Javadoc)
-     * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+    /**
+     * Registers all the extras extended operations present in this control pack.
+     *
+     * @param codec The codec service.
+     */
+    private void registerExtrasExtendedOps( LdapCodecService codec )
+    {
+        ExtendedOpFactory<?> factory = new CancelExtendedOpFactory();
+        codec.registerExtendedOp( factory );
+    }
+    
+    
+    
+    /**
+     * {@inheritDoc}
      */
     public void stop( BundleContext context ) throws Exception
     {

Modified: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java
(original)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/PasswordPolicyGrammar.java
Sat Feb 19 00:31:27 2011
@@ -55,6 +55,7 @@ public class PasswordPolicyGrammar exten
     private static final PasswordPolicyGrammar INSTANCE = new PasswordPolicyGrammar();
 
 
+    @SuppressWarnings({ "unchecked", "rawtypes" })
     private PasswordPolicyGrammar()
     {
         setName( PasswordPolicyGrammar.class.getName() );
@@ -112,7 +113,7 @@ public class PasswordPolicyGrammar exten
     }
 
 
-    public static Grammar getInstance()
+    public static Grammar<PasswordPolicyContainer> getInstance()
     {
         return INSTANCE;
     }

Modified: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreGraceAuthsRemaining.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreGraceAuthsRemaining.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreGraceAuthsRemaining.java
(original)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreGraceAuthsRemaining.java
Sat Feb 19 00:31:27 2011
@@ -29,6 +29,7 @@ import org.apache.directory.shared.asn1.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
+@SuppressWarnings("rawtypes")
 public class StoreGraceAuthsRemaining extends AbstractReadInteger
 {
 

Modified: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java
(original)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/ppolicy_impl/StoreTimeBeforeExpiration.java
Sat Feb 19 00:31:27 2011
@@ -29,6 +29,7 @@ import org.apache.directory.shared.asn1.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
+@SuppressWarnings("rawtypes")
 public class StoreTimeBeforeExpiration extends AbstractReadInteger
 {
 

Modified: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncDoneValueGrammar.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncDoneValueGrammar.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncDoneValueGrammar.java
(original)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/controls/syncrepl_impl/SyncDoneValueGrammar.java
Sat Feb 19 00:31:27 2011
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
  *  
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class SyncDoneValueGrammar extends AbstractGrammar
+public final class SyncDoneValueGrammar extends AbstractGrammar<SyncDoneValueContainer>
 {
 
     /** the logger */
@@ -68,6 +68,7 @@ public final class SyncDoneValueGrammar 
      * Creates a new instance of SyncDoneValueControlGrammar.
      *
      */
+    @SuppressWarnings("unchecked")
     private SyncDoneValueGrammar()
     {
         setName( SyncDoneValueGrammar.class.getName() );
@@ -81,7 +82,7 @@ public final class SyncDoneValueGrammar 
          *     
          * Initialize the syncDoneValue object
          */
-        super.transitions[SyncDoneValueStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()]
= new GrammarTransition(
+        super.transitions[SyncDoneValueStatesEnum.START_STATE.ordinal()][UniversalTag.SEQUENCE.getValue()]
= new GrammarTransition<SyncDoneValueContainer>(
             SyncDoneValueStatesEnum.START_STATE, SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE,
UniversalTag.SEQUENCE.getValue(),
             new GrammarAction<SyncDoneValueContainer>( "Initialization" )
             {
@@ -99,9 +100,9 @@ public final class SyncDoneValueGrammar 
          *    ....
          * }
          */
-        super.transitions[SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()]
= new GrammarTransition(
-            SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE, SyncDoneValueStatesEnum.COOKIE_STATE,
-            UniversalTag.OCTET_STRING.getValue(), 
+        super.transitions[SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.OCTET_STRING.getValue()]
= 
+            new GrammarTransition<SyncDoneValueContainer>( SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE,

+                SyncDoneValueStatesEnum.COOKIE_STATE, UniversalTag.OCTET_STRING.getValue(),

             new GrammarAction<SyncDoneValueContainer>( "Set SyncDoneValueControl cookie"
)
             {
                 public void action( SyncDoneValueContainer container ) throws DecoderException
@@ -158,7 +159,8 @@ public final class SyncDoneValueGrammar 
          *    refreshDeletes BOOLEAN DEFAULT FALSE
          * }
          */
-        super.transitions[SyncDoneValueStatesEnum.COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()]
= new GrammarTransition(
+        super.transitions[SyncDoneValueStatesEnum.COOKIE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()]
= 
+            new GrammarTransition<SyncDoneValueContainer>(
             SyncDoneValueStatesEnum.COOKIE_STATE, SyncDoneValueStatesEnum.REFRESH_DELETES_STATE,
             UniversalTag.BOOLEAN.getValue(), refreshDeletesTagAction );
         
@@ -169,17 +171,16 @@ public final class SyncDoneValueGrammar 
          *    refreshDeletes BOOLEAN DEFAULT FALSE
          * }
          */
-        super.transitions[SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()]
= new GrammarTransition(
-            SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE, SyncDoneValueStatesEnum.REFRESH_DELETES_STATE,
-            UniversalTag.BOOLEAN.getValue(), refreshDeletesTagAction );
-
+        super.transitions[SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE.ordinal()][UniversalTag.BOOLEAN.getValue()]
= 
+            new GrammarTransition<SyncDoneValueContainer>( SyncDoneValueStatesEnum.SYNC_DONE_VALUE_SEQUENCE_STATE,

+                SyncDoneValueStatesEnum.REFRESH_DELETES_STATE, UniversalTag.BOOLEAN.getValue(),
refreshDeletesTagAction );
     }
 
 
     /**
      * @return the singleton instance of the SyncDoneValueControlGrammar
      */
-    public static Grammar getInstance()
+    public static Grammar<SyncDoneValueContainer> getInstance()
     {
         return INSTANCE;
     }

Added: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelExtendedOpFactory.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelExtendedOpFactory.java?rev=1072211&view=auto
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelExtendedOpFactory.java
(added)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelExtendedOpFactory.java
Sat Feb 19 00:31:27 2011
@@ -0,0 +1,50 @@
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.shared.ldap.extras.extended;
+
+
+import org.apache.directory.shared.ldap.codec.api.ExtendedOpFactory;
+
+
+/**
+ * An {@link ExtendedOpFactory} for creating cancel extended request response 
+ * pairs.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CancelExtendedOpFactory implements ExtendedOpFactory<CancelRequest>
+{
+    /**
+     * {@inheritDoc}
+     */
+    public String getOid()
+    {
+        return CancelRequest.EXTENSION_OID;
+    }
+
+    
+    /**
+     * {@inheritDoc}
+     */
+    public CancelRequest newRequest()
+    {
+        return new CancelRequest();
+    }
+}

Modified: directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelRequest.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelRequest.java?rev=1072211&r1=1072210&r2=1072211&view=diff
==============================================================================
--- directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelRequest.java
(original)
+++ directory/shared/branches/m1/ldap-extras/codec/src/main/java/org/apache/directory/shared/ldap/extras/extended/CancelRequest.java
Sat Feb 19 00:31:27 2011
@@ -62,7 +62,6 @@ public class CancelRequest extends Exten
 
 
     /**
-     * 
      * Creates a new instance of CancelRequest.
      *
      * @param messageId the message id
@@ -78,6 +77,15 @@ public class CancelRequest extends Exten
 
 
     /**
+     * Creates a new instance of CancelRequest.
+     */
+    public CancelRequest()
+    {
+        setRequestName( EXTENSION_OID );
+    }
+
+
+    /**
      * Sets the extended request's <b>requestValue</b> portion of the PDU.
      * 
      * @param payload byte array of data encapsulating ext. req. parameters
@@ -116,6 +124,32 @@ public class CancelRequest extends Exten
         return ( ExtendedResponse ) getResultResponse();
     }
 
+    
+    /**
+     *  @return The id of the Message to cancel.
+     */
+    public int getCancelId()
+    {
+        return cancelId;
+    }
+    
+    
+    /**
+     * Sets the message to cancel by id.
+     *
+     * @param cancelId The id of the message to cancel.
+     */
+    public void setCancelId( int cancelId )
+    {
+        this.cancelId = cancelId;
+        
+        // clear the request value if it was previously computed for the old value
+        if ( requestValue != null )
+        {
+            requestValue = null;
+        }
+    }
+    
 
     /**
      * {@inheritDoc}



Mime
View raw message