directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 9538 - in incubator/directory/eve/trunk/eve/frontend/decoder: pojo-impl pojo-impl/src/java/org/apache/eve/decoder/impl pojo-impl/src/test pojo-impl/src/test/org pojo-impl/src/test/org/apache pojo-impl/src/test/org/apache/eve pojo-impl/src/test/org/apache/eve/decoder pojo-impl/src/test/org/apache/eve/decoder/impl spi/src/java/org/apache/eve/decoder
Date Tue, 16 Mar 2004 23:14:27 GMT
Author: akarasulu
Date: Tue Mar 16 15:14:27 2004
New Revision: 9538

Added:
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/berlib.properties
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl/
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl/DefaultDecoderManagerTest.java
  (contents, props changed)
Removed:
   incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/NoOpDecoder.java
Modified:
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/project.xml
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/java/org/apache/eve/decoder/impl/DecodeStageHandler.java
   incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/java/org/apache/eve/decoder/impl/DefaultDecoderManager.java
   incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/ClientDecoder.java
   incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java
Log:
DecoderManager now works - the next steps are to get the merlin wrapper up
and running with merlin unit tests.


Added: incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/berlib.properties
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/berlib.properties	Tue Mar
16 15:14:27 2004
@@ -0,0 +1 @@
+asn.1.berlib.provider=org.apache.ldap.common.berlib.snacc.SnaccProvider

Modified: incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/project.xml
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/project.xml	(original)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/project.xml	Tue Mar 16 15:14:27
2004
@@ -10,108 +10,129 @@
     <inceptionYear>2003</inceptionYear>
       
     <shortDescription>
-    Eve's Frontend DecoderManager Implementation
+      Eve's Frontend DecoderManager Implementation
     </shortDescription>
 
     <description>
-        Eve's frontend decoder manager decodes input from client sockets 
-        bound to the server.  The decoder responds to input events generated
-        by the input manager.
+      Eve's frontend decoder manager decodes input from client sockets 
+      bound to the server.  The decoder responds to input events generated
+      by the input manager.
     </description>
       
     <dependencies>
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>ldap-common</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>codec-stateful</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>eve-frontend-common-api</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>eve-frontend-event-spi</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>snickers-ber-api</artifactId>
-            <version>SNAPSHOT</version>
-            <url>
-              http://incubator.apache.org/directory/subprojects/snickers/ber/api
-            </url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>eve-frontend-event-pojo-impl</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>eve-frontend-event-merlin-impl</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>eve-frontend-input-spi</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>eve-frontend-decoder-spi</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>eve-frontend-buffer-spi</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>incubator-directory</groupId>
-            <artifactId>eve-frontend-buffer-pojo-impl</artifactId>
-            <version>SNAPSHOT</version>
-            <url>http://directory.apache.org</url>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>3.8.1</version>
-            <url>http://junit.org</url>
-        </dependency>
+      <dependency>
+        <groupId>snacc4j</groupId>
+        <artifactId>snacc</artifactId>
+        <version>2.3</version>
+      </dependency>
+        
+      <dependency>
+        <groupId>junit</groupId>
+        <artifactId>junit</artifactId>
+        <version>3.8.1</version>
+        <url>http://junit.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>regexp</groupId>
+        <artifactId>regexp</artifactId>
+        <version>1.2</version>
+        <url>http://jakarta.apache.org/regexp</url>
+      </dependency>
+
+      <dependency>
+        <groupId>commons-codec</groupId>
+        <artifactId>commons-codec</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://jakarta.apache.org/commons/codec</url>
+      </dependency>
+        
+      <dependency>
+        <groupId>commons-lang</groupId>
+        <artifactId>commons-lang</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://jakarta.apache.org/commons/lang</url>
+      </dependency>
+        
+      <dependency>
+        <groupId>commons-primitives</groupId>
+        <artifactId>commons-primitives</artifactId>
+        <version>1.1-dev</version>
+        <url>http://jakarta.apache.org/commons/primitives</url>
+      </dependency>
+        
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>ldap-common</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>ldap-snacc-provider</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>codec-stateful</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>snickers-ber-api</artifactId>
+        <version>SNAPSHOT</version>
+        <url>
+          http://incubator.apache.org/directory/subprojects/snickers/ber/api
+        </url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>eve-frontend-common-api</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>eve-frontend-event-spi</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>eve-frontend-event-pojo-impl</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>eve-frontend-decoder-spi</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>eve-frontend-buffer-spi</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
+      <dependency>
+        <groupId>incubator-directory</groupId>
+        <artifactId>eve-frontend-buffer-pojo-impl</artifactId>
+        <version>SNAPSHOT</version>
+        <url>http://directory.apache.org</url>
+      </dependency>
+
     </dependencies>
 </project>
 

Modified: incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/java/org/apache/eve/decoder/impl/DecodeStageHandler.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/java/org/apache/eve/decoder/impl/DecodeStageHandler.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/java/org/apache/eve/decoder/impl/DecodeStageHandler.java
Tue Mar 16 15:14:27 2004
@@ -78,5 +78,8 @@
              * so we shouldn't have to do anything here but return control
              */
         }
+        
+        e.releaseInterest( this ) ;
+        e.releaseInterest( manager ) ;
     }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/java/org/apache/eve/decoder/impl/DefaultDecoderManager.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/java/org/apache/eve/decoder/impl/DefaultDecoderManager.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/java/org/apache/eve/decoder/impl/DefaultDecoderManager.java
Tue Mar 16 15:14:27 2004
@@ -21,10 +21,11 @@
 import java.util.HashMap ;
 import java.util.EventObject ;
 
-import java.math.BigInteger ;
-
 import java.nio.ByteBuffer ;
 
+import org.apache.snickers.SnickersDecoder ;
+import org.apache.ldap.common.message.Request ;
+
 import org.apache.eve.event.InputEvent ;
 import org.apache.eve.event.Subscriber ;
 import org.apache.eve.seda.StageConfig ;
@@ -32,18 +33,16 @@
 import org.apache.eve.seda.DefaultStage ;
 import org.apache.eve.listener.ClientKey ;
 import org.apache.eve.event.ConnectEvent ;
-import org.apache.eve.decoder.NoOpDecoder ;
+import org.apache.eve.event.RequestEvent ;
 import org.apache.eve.decoder.ClientDecoder ;
 import org.apache.eve.event.DisconnectEvent ;
 import org.apache.eve.event.InputSubscriber ;
 import org.apache.eve.decoder.DecoderManager ;
-import org.apache.eve.event.RequestEvent;
 import org.apache.eve.event.SubscriberMonitor ;
 import org.apache.eve.event.ConnectSubscriber ;
 import org.apache.eve.event.AbstractSubscriber ;
 import org.apache.eve.event.DisconnectSubscriber ;
 import org.apache.eve.decoder.DecoderManagerMonitor ;
-import org.apache.ldap.common.message.BindRequestImpl ;
 import org.apache.eve.decoder.DecoderManagerMonitorAdapter ;
 
 import org.apache.commons.codec.DecoderException ;
@@ -130,7 +129,14 @@
      */
     public void inform( EventObject event )
     {
-        AbstractSubscriber.inform( this, event, subscriberMonitor ) ;
+        try
+        {
+            AbstractSubscriber.inform( this, event ) ;
+        }
+        catch ( Throwable t )
+        {
+            monitor.failedOnInform( this, event, t ) ;
+        }
     }
 
     
@@ -170,8 +176,9 @@
     public void inform( ConnectEvent event )
     {
         ClientKey key = event.getClientKey() ;
-        StatefulDecoder noop = new NoOpDecoder() ;
-        StatefulDecoder decoder = new ClientDecoder( key, noop ) ; 
+        StatefulDecoder snickers = new SnickersDecoder() ;
+        StatefulDecoder decoder = new ClientDecoder( key, snickers ) ; 
+        decoder.setCallback( this ) ;
         decoders.put( key, decoder ) ;
     }
     
@@ -189,19 +196,9 @@
      */
     public void decodeOccurred( StatefulDecoder decoder, Object decoded )
     {
-        /*
-         * This is where the decoded object is really a request Message 
-         * enveloper object which we just need to package as a RequestEvent
-         * and publish on the EventRouter. 
-         */
-        BindRequestImpl bind = new BindRequestImpl( BigInteger.ONE ) ;
-        bind.setCredentials( "password".getBytes() ) ;
-        bind.setName( "uid=akarasulu,dc=example,dc=com" ) ;
-        bind.setSimple( true ) ;
-        bind.setVersion3( true ) ;
-        
+        Request req = ( Request ) decoded ;
         ClientKey key = ( ( ClientDecoder ) decoder ).getClientKey() ;
-        RequestEvent event = new RequestEvent( this, key, bind ) ;
+        RequestEvent event = new RequestEvent( this, key, ( Request ) decoded );
         router.publish( event ) ;
     }
     
@@ -253,7 +250,7 @@
     public void decode( ClientKey key, ByteBuffer buffer ) 
         throws DecoderException
     {
-        StatefulDecoder decoder = ( StatefulDecoder ) decoders.remove( key ) ;
+        StatefulDecoder decoder = ( StatefulDecoder ) decoders.get( key ) ;
         decoder.decode( buffer ) ;
     }
 
@@ -264,7 +261,7 @@
     public Object decode( ByteBuffer buffer ) throws DecoderException
     {
         // replace this decoder with a real one later
-        StatefulDecoder decoder = new NoOpDecoder() ;
+        StatefulDecoder decoder = new SnickersDecoder() ;
         // used array to set a value on final variable and get by compiler
         final Object[] decoded = new Object[1] ;
         

Added: incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl/DefaultDecoderManagerTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/pojo-impl/src/test/org/apache/eve/decoder/impl/DefaultDecoderManagerTest.java
Tue Mar 16 15:14:27 2004
@@ -0,0 +1,270 @@
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed 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.eve.decoder.impl ;
+
+
+import java.math.BigInteger ;
+
+import java.nio.ByteBuffer ;
+import java.util.EventObject ;
+
+import org.apache.eve.buffer.BufferPool;
+import org.apache.eve.buffer.BufferPoolConfig;
+import org.apache.eve.buffer.DefaultBufferPool;
+import org.apache.eve.buffer.DefaultBufferPoolConfig;
+import org.apache.eve.event.AbstractSubscriber;
+import org.apache.eve.event.ConnectEvent;
+import org.apache.eve.event.EventRouter ;
+import org.apache.eve.event.DefaultEventRouter ;
+import org.apache.eve.event.InputEvent;
+import org.apache.eve.event.RequestEvent;
+import org.apache.eve.event.RequestSubscriber;
+
+import org.apache.eve.seda.DefaultStageConfig ;
+import org.apache.eve.thread.ThreadPool;
+import org.apache.ldap.common.message.AbandonRequest;
+import org.apache.ldap.common.message.AbandonRequestImpl;
+import org.apache.ldap.common.message.MessageEncoder;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the decoder manager pojo.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultDecoderManagerTest extends TestCase implements 
+    RequestSubscriber
+{
+    private ThreadPool tpool = null ;
+    private EventRouter router = null ;
+    private BufferPoolConfig bpConfig = null ; 
+    private DefaultStageConfig config = null ;
+    private DecodeStageHandler handler = null ;
+    private BufferPool bp = null ;
+    private DefaultDecoderManager decodeMan = null ;
+    private RequestEvent event = null ;
+    
+
+    public static void main( String[] args )
+    {
+        junit.textui.TestRunner.run( DefaultDecoderManagerTest.class ) ;
+    }
+
+    
+    /*
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp() ;
+        
+        bpConfig = new DefaultBufferPoolConfig( "default", 10, 100, 10, 1024 ) ;
+        bp = new DefaultBufferPool( bpConfig ) ;
+        router = new DefaultEventRouter() ;
+        router.subscribe( RequestEvent.class, this ) ;
+        tpool = new ThreadPool()
+        {
+            /* (non-Javadoc)
+             * @see org.apache.eve.thread.ThreadPool#execute(java.lang.Runnable)
+             */
+            public void execute( Runnable runnable )
+            {
+                // fake it out
+                runnable.run() ;
+            }
+        } ;
+        
+        config = new DefaultStageConfig( "default", tpool ) ;
+        decodeMan = new DefaultDecoderManager( router, config ) ;
+        config.setHandler( new DecodeStageHandler( decodeMan ) ) ;
+        decodeMan.start() ;
+    }
+
+    
+    /*
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown() ;
+        
+        tpool = null ;
+        router = null ;
+        bpConfig = null ; 
+        config = null ;
+        handler = null ;
+        bp = null ;
+        decodeMan.stop() ;
+        decodeMan = null ;
+        event = null ;
+    }
+
+    
+    /**
+     * Constructor for DefaultDecoderManagerTest.
+     * @param arg0
+     */
+    public DefaultDecoderManagerTest(String arg0)
+    {
+        super( arg0 ) ;
+    }
+
+    
+    public void testDefaultDecoderManager() throws Exception
+    {
+        AbandonRequest request = new AbandonRequestImpl( new BigInteger("6") ) ;
+        request.setAbandoned( new BigInteger("44") ) ;
+        MessageEncoder encoder = new MessageEncoder() ;
+        
+        byte [] encoded = encoder.encode( request ) ;
+        ByteBuffer buf = bp.getBuffer( this ) ;
+        buf.put( encoded ) ;
+        buf.flip() ;
+        
+        final BufferPool pool = bp ;
+        InputEvent e = new InputEvent( this, null, buf ) 
+        {
+            public ByteBuffer claimInterest(Object party)
+            {
+                pool.claimInterest(getBuffer(), party) ;
+                return getBuffer().asReadOnlyBuffer() ;
+            }
+
+            public void releaseInterest(Object party)
+            {
+                pool.releaseClaim(getBuffer(), party) ;
+            }
+        } ;
+        
+        bp.releaseClaim(buf, this) ;
+        router.publish( new ConnectEvent(this, null) ) ;
+        router.publish( e ) ;
+        decodeMan.stop() ;
+        assertNotNull( this.event ) ;
+    }
+    
+    
+    public void inform( RequestEvent event )
+    {
+        System.out.println( "\n\nRequestEvent Set!!!\n\n" ) ;
+        this.event = event ;
+    }
+
+    
+    
+    /* (non-Javadoc)
+     * @see org.apache.eve.event.Subscriber#inform(java.util.EventObject)
+     */
+    public void inform( EventObject event )
+    {
+        try
+        {
+            AbstractSubscriber.inform( this, event ) ;
+        }
+        catch ( Exception e )
+        {
+            fail( "we should be able to inform just fine" ) ;
+        }
+    }
+
+    
+    /*
+     * Class to test for void inform(EventObject)
+     */
+    public void testInformEventObject()
+    {
+    }
+
+    
+    /*
+     * Class to test for void inform(InputEvent)
+     */
+    public void testInformInputEvent()
+    {
+    }
+
+    
+    /*
+     * Class to test for void inform(DisconnectEvent)
+     */
+    public void testInformDisconnectEvent()
+    {
+    }
+
+    
+    /*
+     * Class to test for void inform(ConnectEvent)
+     */
+    public void testInformConnectEvent()
+    {
+    }
+
+    
+    public void testDecodeOccurred()
+    {
+    }
+
+    
+    public void testSetCallback()
+    {
+    }
+
+    
+    public void testSetDecoderMonitor()
+    {
+    }
+
+    
+    public void testDisable()
+    {
+    }
+
+    
+    /*
+     * Class to test for void decode(ClientKey, ByteBuffer)
+     */
+    public void testDecodeClientKeyByteBuffer()
+    {
+    }
+
+    
+    /*
+     * Class to test for Object decode(ByteBuffer)
+     */
+    public void testDecodeByteBuffer()
+    {
+    }
+
+    
+    public void testGetMonitor()
+    {
+    }
+
+    
+    public void testSetMonitor()
+    {
+    }
+
+    
+    public void testGetDecoder()
+    {
+    }
+}

Modified: incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/ClientDecoder.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/ClientDecoder.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/ClientDecoder.java
Tue Mar 16 15:14:27 2004
@@ -32,13 +32,15 @@
  * Apache Directory Project</a>
  * @version $Rev$
  */
-public class ClientDecoder implements StatefulDecoder
+public class ClientDecoder implements StatefulDecoder, DecoderCallback
 {
     /** the key of the client this decoder is associated with */ 
     private final ClientKey key ;
     /** the actual decoder doing the work for us */
     private final StatefulDecoder decoder ;
-
+    /** the callback used by this decoder */
+    private DecoderCallback cb ;
+    
     
     /**
      * Creates a client dedicated stateful decoder.
@@ -50,6 +52,7 @@
     {
         this.key = key ;
         this.decoder = decoder ;
+        this.decoder.setCallback( this ) ;
     }
     
 
@@ -69,7 +72,7 @@
      */
     public void setCallback( DecoderCallback cb )
     {
-        decoder.setCallback( cb ) ;
+        this.cb = cb ;
     }
     
 
@@ -91,5 +94,15 @@
     public ClientKey getClientKey()
     {
         return key ;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.commons.codec.stateful.DecoderCallback#decodeOccurred(
+     * org.apache.commons.codec.stateful.StatefulDecoder, java.lang.Object)
+     */
+    public void decodeOccurred( StatefulDecoder decoder, Object decoded )
+    {
+        cb.decodeOccurred( this, decoded ) ;
     }
 }

Modified: incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java
==============================================================================
--- incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java
(original)
+++ incubator/directory/eve/trunk/eve/frontend/decoder/spi/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java
Tue Mar 16 15:14:27 2004
@@ -23,7 +23,8 @@
 
 
 /**
- * An adapter for decoder manager monitors.
+ * An adapter for decoder manager monitors where all failures actually throw
+ * a wrapped runtime exception of the throwables they encounter.
  *
  * @author <a href="mailto:directory-dev@incubator.apache.org">
  * Apache Directory Project</a>
@@ -39,5 +40,6 @@
     public void 
         failedOnInform( Subscriber subscriber, EventObject event, Throwable t )
     {
+        throw new RuntimeException( t ) ;
     }
 }

Mime
View raw message