directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 47035 - in incubator/directory/seda/trunk: src/examples/org/apache/seda/examples src/java/org/apache/seda src/java/org/apache/seda/stage src/test/org/apache/seda src/test/org/apache/seda/examples xdocs
Date Wed, 22 Sep 2004 08:36:13 GMT
Author: akarasulu
Date: Wed Sep 22 01:36:12 2004
New Revision: 47035

Added:
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/DiscardProtocolProvider.java
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/NullDecoder.java
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/NullEncoder.java
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruDecoder.java
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruEncoder.java
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruHandler.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/ProtocolTestCase.java
   incubator/directory/seda/trunk/src/test/org/apache/seda/examples/
   incubator/directory/seda/trunk/src/test/org/apache/seda/examples/DiscardProtocolProviderTest.java
   incubator/directory/seda/trunk/xdocs/
   incubator/directory/seda/trunk/xdocs/router-changes.xml
Modified:
   incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/EchoProtocolProvider.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/DefaultFrontend.java
   incubator/directory/seda/trunk/src/java/org/apache/seda/stage/LoggingStageMonitor.java
   incubator/directory/seda/trunk/src/test/org/apache/seda/DefaultFrontendFactoryTest.java
Log:
Commit changes ...

 o added new discard protocol and test case
 o moved a few inner classes out which can be reused
 o added a test harness for protocol unit testing
 


Added: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/DiscardProtocolProvider.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/DiscardProtocolProvider.java
Wed Sep 22 01:36:12 2004
@@ -0,0 +1,101 @@
+/*
+ *   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.seda.examples;
+
+
+import org.apache.seda.protocol.RequestHandler;
+import org.apache.seda.protocol.ProtocolProvider;
+import org.apache.seda.protocol.NoReplyHandler;
+import org.apache.seda.protocol.HandlerTypeEnum;
+
+import org.apache.commons.codec.stateful.DecoderFactory;
+import org.apache.commons.codec.stateful.EncoderFactory;
+import org.apache.commons.codec.stateful.StatefulDecoder;
+import org.apache.commons.codec.stateful.StatefulEncoder;
+
+
+/**
+ * A protocol provider for the discard protocol.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
+ *         Project</a>
+ * @version $Rev$
+ */
+public class DiscardProtocolProvider implements ProtocolProvider,
+    DecoderFactory, EncoderFactory
+{
+    /** a null do nothing decoder that swallows all input */
+    public static final StatefulDecoder NULL_DECODER = new NullDecoder();
+    /** a null do nothing encoder that swallows all input */
+    public static final StatefulEncoder NULL_ENCODER = new NullEncoder();
+
+
+    // ------------------------------------------------------------------------
+    // ProtocolProvider Methods
+    // ------------------------------------------------------------------------
+
+
+    public String getName()
+    {
+        return "discard";
+    }
+
+
+    public DecoderFactory getDecoderFactory()
+    {
+        return this;
+    }
+
+
+    public EncoderFactory getEncoderFactory()
+    {
+        return this;
+    }
+
+
+    public RequestHandler getHandler( Object request )
+    {
+        return new NoReplyHandler()
+        {
+            public void handle( Object request )
+            {
+            }
+
+            public HandlerTypeEnum getHandlerType()
+            {
+                return HandlerTypeEnum.NOREPLY;
+            }
+        };
+    }
+
+
+    // ------------------------------------------------------------------------
+    // Factory Methods
+    // ------------------------------------------------------------------------
+
+
+    public StatefulDecoder createDecoder()
+    {
+        return NULL_DECODER;
+    }
+
+
+    public StatefulEncoder createEncoder()
+    {
+        return NULL_ENCODER;
+    }
+}

Modified: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/EchoProtocolProvider.java
==============================================================================
--- incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/EchoProtocolProvider.java
(original)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/EchoProtocolProvider.java
Wed Sep 22 01:36:12 2004
@@ -18,7 +18,6 @@
 
 
 import org.apache.seda.protocol.RequestHandler;
-import org.apache.seda.protocol.HandlerTypeEnum;
 import org.apache.seda.protocol.ProtocolProvider;
 import org.apache.seda.protocol.SingleReplyHandler;
 
@@ -37,65 +36,12 @@
     /** the authoritative service name of this internet protocol: 'echo' */
     public static final String NAME = "echo";
     /** a null decoder that triggers a callback returning the substrate as is */
-    public static final StatefulDecoder NULL_DECODER =
-        new AbstractStatefulDecoder()
-        {
-            /**
-             * Simply returns back the encoded data as is.  The codec
-             * is an identity operation.  Each decode call triggers a
-             * callback since we're presuming each chunk to be a valid
-             * PDU while streaming the request back.
-             *
-             * @param encoded the object to return which is a buffer
-             */
-            public void decode( Object encoded )
-            {
-                super.decodeOccurred( encoded );
-            }
-        };
+    public static final StatefulDecoder PASSTHRU_DECODER = new PassThruDecoder();
     /** a null encoder that triggers a callback returning the substrate as is */
-    public static final StatefulEncoder NULL_ENCODER =
-        new AbstractStatefulEncoder()
-        {
-            /**
-             * Simply returns back the decoded data as is.  The codec
-             * is an identity operation.  Each encode call triggers a
-             * callback since we're presuming each chunk to be a valid
-             * PDU while streaming the request back as the response.
-             *
-             * @param substrate the object to return which is a buffer
-             */
-            public void encode( Object substrate )
-            {
-                super.encodeOccurred( substrate );
-            }
-        };
-    public static final SingleReplyHandler NULL_HANDLER =
-        new SingleReplyHandler()
-    {
-        /**
-         * Returns the request (ByteBuffer) back without any changes to
-         * be echo'd out back to the client.
-         *
-         * @param request the buffer of data to be echo'd.
-         * @return the response to the request but resp = req here.
-         */
-        public Object handle( Object request )
-        {
-            return request;
-        }
+    public static final StatefulEncoder PASSTHRU_ENCODER = new PassThruEncoder();
+    /** echo handler where request is return back as a response */
+    public static final SingleReplyHandler PASSTHRU_HANDLER = new PassThruHandler();
 
-        /**
-         * Gets the handler type.
-         *
-         * @return a HandlerTypeEnum constant.
-         */
-        public HandlerTypeEnum getHandlerType()
-        {
-            return HandlerTypeEnum.SINGLEREPLY;
-        }
-    };
-        
     /**
      * Gets the authoritative name for the service of this provider.
      *
@@ -126,7 +72,7 @@
              */
             public StatefulDecoder createDecoder()
             {
-                return NULL_DECODER;
+                return PASSTHRU_DECODER;
             }
         };
     }
@@ -150,7 +96,7 @@
              */
             public StatefulEncoder createEncoder()
             {
-                return NULL_ENCODER;
+                return PASSTHRU_ENCODER;
             }
         };
     }
@@ -168,6 +114,6 @@
      */
     public RequestHandler getHandler( Object request )
     {
-        return NULL_HANDLER;
+        return PASSTHRU_HANDLER;
     }
 }

Added: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/NullDecoder.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/NullDecoder.java
Wed Sep 22 01:36:12 2004
@@ -0,0 +1,39 @@
+/*
+ *   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.seda.examples;
+
+
+import org.apache.commons.codec.stateful.AbstractStatefulDecoder;
+
+
+/**
+ * A decoder that does not decode throwing all data away.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NullDecoder extends AbstractStatefulDecoder
+{
+    /**
+     * Does nothing at all. 
+     *
+     * @param encoded the object
+     */
+    public void decode( Object encoded )
+    {
+    }
+}

Added: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/NullEncoder.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/NullEncoder.java
Wed Sep 22 01:36:12 2004
@@ -0,0 +1,39 @@
+/*
+ *   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.seda.examples;
+
+
+import org.apache.commons.codec.stateful.AbstractStatefulEncoder;
+
+
+/**
+ * An encoder that does not encode.  All request data is thrown away.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class NullEncoder extends AbstractStatefulEncoder
+{
+    /**
+     * Does nothing at all. 
+     *
+     * @param substrate the object to encode which is just ignored
+     */
+    public void encode( Object substrate )
+    {
+    }
+}

Added: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruDecoder.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruDecoder.java
Wed Sep 22 01:36:12 2004
@@ -0,0 +1,43 @@
+/*
+ *   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.seda.examples;
+
+
+import org.apache.commons.codec.stateful.AbstractStatefulDecoder;
+
+
+/**
+ * A decoder that does not decode but passess thru the encoded object as the
+ * decoded object effectively performing no decoding at all.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class PassThruDecoder extends AbstractStatefulDecoder
+{
+    /**
+     * Simply returns back the encoded data as is.  The codec is an identity
+     * operation.  Each decode call triggers a callback since we're presuming
+     * each chunk to be a valid PDU while streaming the request back.
+     *
+     * @param encoded the object to return which is a buffer
+     */
+    public void decode( Object encoded )
+    {
+        super.decodeOccurred( encoded );
+    }
+}

Added: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruEncoder.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruEncoder.java
Wed Sep 22 01:36:12 2004
@@ -0,0 +1,44 @@
+/*
+ *   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.seda.examples;
+
+
+import org.apache.commons.codec.stateful.AbstractStatefulEncoder;
+
+
+/**
+ * An encoder that does not encode but passess thru the decoded object as the
+ * encoded object effectively performing no encoding at all.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class PassThruEncoder extends AbstractStatefulEncoder
+{
+    /**
+     * Simply returns back the decoded data as is.  The codec is an identity
+     * operation.  Each encode call triggers a callback since we're presuming
+     * each chunk to be a valid PDU while streaming the request back as the
+     * response.
+     *
+     * @param substrate the object to return which is a buffer
+     */
+    public void encode( Object substrate )
+    {
+        super.encodeOccurred( substrate );
+    }
+}

Added: incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruHandler.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/src/examples/org/apache/seda/examples/PassThruHandler.java
Wed Sep 22 01:36:12 2004
@@ -0,0 +1,54 @@
+/*
+ *   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.seda.examples;
+
+
+import org.apache.seda.protocol.SingleReplyHandler;
+import org.apache.seda.protocol.HandlerTypeEnum;
+
+
+/**
+ * Document me.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
+ *         Project</a>
+ * @version $Rev$
+ */
+public class PassThruHandler implements SingleReplyHandler
+{
+    /**
+     * Returns the request back without any changes as a response.
+     *
+     * @param request the buffer of data to be echo'd.
+     * @return the response to the request but resp = req here.
+     */
+    public Object handle( Object request )
+    {
+        return request;
+    }
+
+
+    /**
+     * Gets the handler type.
+     *
+     * @return a HandlerTypeEnum constant.
+     */
+    public HandlerTypeEnum getHandlerType()
+    {
+        return HandlerTypeEnum.SINGLEREPLY;
+    }
+}

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/DefaultFrontend.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/DefaultFrontend.java	(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/DefaultFrontend.java	Wed Sep 22
01:36:12 2004
@@ -92,6 +92,7 @@
         ( ( DefaultEncoderManager ) encMan ).stop();
     }
 
+
     public BufferPool getBufferPool()
     {
         return bp;

Added: incubator/directory/seda/trunk/src/java/org/apache/seda/ProtocolTestCase.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/ProtocolTestCase.java	Wed Sep
22 01:36:12 2004
@@ -0,0 +1,87 @@
+/*
+ *   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.seda;
+
+
+import java.io.IOException;
+import java.net.InetAddress;
+
+import org.apache.seda.protocol.InetServiceEntry;
+import org.apache.seda.protocol.DefaultInetServicesDatabase;
+import org.apache.seda.protocol.ProtocolProvider;
+import org.apache.seda.listener.AvailablePortFinder;
+import org.apache.seda.listener.ListenerConfig;
+import org.apache.seda.listener.TCPListenerConfig;
+
+import junit.framework.TestCase;
+
+
+/**
+ * A test harness using the standalone default frontend hardwired using the
+ * DefaultFrontendFactory.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class ProtocolTestCase extends TestCase
+{
+    /** the frontend used to test the protocol */
+    protected DefaultFrontend fe = null;
+    /** the protocol provider tested */
+    protected ProtocolProvider proto = null;
+    /** the listener configuration for the protocol */
+    protected ListenerConfig config = null;
+
+
+    public ProtocolTestCase( ProtocolProvider proto ) throws IOException
+    {
+        this.proto = proto;
+    }
+
+
+    /**
+     * Stops the created frontend.
+     *
+     * @throws Exception due to super call and stop method
+     */
+    protected void tearDown() throws Exception
+    {
+        super.tearDown();
+        fe.getListenerManager().unbind( config );
+        fe.stop();
+        fe = null;
+    }
+
+
+    /**
+     * Instantiates the factory then gets a handle on the Frontend.
+     *
+     * @throws Exception due to super call and create()
+     */
+    protected void setUp() throws Exception
+    {
+        super.setUp();
+        fe = ( DefaultFrontend ) new DefaultFrontendFactory().create();
+        InetServiceEntry srvEntry = new InetServiceEntry( proto.getName(),
+            AvailablePortFinder.getNextAvailable( 6666 ) );
+        ( ( DefaultInetServicesDatabase ) fe.getInetServicesDatabase() )
+            .addEntry( srvEntry );
+        config = new TCPListenerConfig( InetAddress.getLocalHost(), srvEntry );
+        fe.getListenerManager().bind( config );
+        fe.register( proto );
+    }
+}

Modified: incubator/directory/seda/trunk/src/java/org/apache/seda/stage/LoggingStageMonitor.java
==============================================================================
--- incubator/directory/seda/trunk/src/java/org/apache/seda/stage/LoggingStageMonitor.java
(original)
+++ incubator/directory/seda/trunk/src/java/org/apache/seda/stage/LoggingStageMonitor.java
Wed Sep 22 01:36:12 2004
@@ -71,7 +71,7 @@
         }
     }
     
-    
+                                                         
     /* (non-Javadoc)
      * @see org.apache.seda.seda.StageMonitor#started(org.apache.eve.seda.Stage)
      */

Modified: incubator/directory/seda/trunk/src/test/org/apache/seda/DefaultFrontendFactoryTest.java
==============================================================================
--- incubator/directory/seda/trunk/src/test/org/apache/seda/DefaultFrontendFactoryTest.java
(original)
+++ incubator/directory/seda/trunk/src/test/org/apache/seda/DefaultFrontendFactoryTest.java
Wed Sep 22 01:36:12 2004
@@ -38,7 +38,9 @@
  */
 public class DefaultFrontendFactoryTest extends TestCase
 {
-    DefaultFrontend fe = null;
+    /** the frontend used to test the protocol */
+    protected DefaultFrontend fe = null;
+
 
     /**
      * Stops the created frontend.
@@ -119,5 +121,6 @@
         client.getInputStream().read( recieved );
         client.disconnect();
         assertEquals( new String( toSend ), new String( recieved ) );
+        fe.getListenerManager().unbind( config );
     }
 }

Added: incubator/directory/seda/trunk/src/test/org/apache/seda/examples/DiscardProtocolProviderTest.java
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/src/test/org/apache/seda/examples/DiscardProtocolProviderTest.java
Wed Sep 22 01:36:12 2004
@@ -0,0 +1,45 @@
+/*
+ *   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.seda.examples;
+
+
+import java.io.IOException;
+
+import org.apache.seda.ProtocolTestCase;
+import org.apache.commons.net.DiscardTCPClient;
+
+
+/**
+ * Document me.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org"> Apache Directory
+ *         Project</a>
+ * @version $Rev$
+ */
+public class DiscardProtocolProviderTest extends ProtocolTestCase
+{
+
+    public DiscardProtocolProviderTest() throws IOException
+    {
+        super( new DiscardProtocolProvider() );
+    }
+
+    public void testDiscardProtocol()
+    {
+        //DiscardTCPClient client = new DiscardTCPClient();
+    }
+}

Added: incubator/directory/seda/trunk/xdocs/router-changes.xml
==============================================================================
--- (empty file)
+++ incubator/directory/seda/trunk/xdocs/router-changes.xml	Wed Sep 22 01:36:12 2004
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document>
+  <properties>
+    <author email="akarasulu@apache.org">Alex Karasulu</author>
+    <title>Apache Directory Project: Changes to EventRouter Service</title>
+  </properties>
+
+  <body>
+    <section name="Standard Event Processing">
+      <p>
+        The <code>publish()</code> method follows a very simple algorithm:
+      </p>
+
+      <ol>
+        <li>start iterating through a list of Subscriptions: so for each</li>
+        <ol>
+          <li>check sub is on event type or one of its ancestor types</li>
+          <li>if not continue w/o informing, otherwise do next</li>
+          <li>check filter, if true allow call to inform, if false continue</li>
+        </ol>
+      </ol>
+
+      <p>
+        We would like to be able to effect routing based on:
+      </p>
+
+      <ul>
+        <li>Event type</li>
+        <li>Subscription filters</li>
+        <li>Event specific characteristics</li>
+        <li>Extraneous logic</li>
+        <li>All of the above</li>
+      </ul>
+
+      <p>
+        While doing all this we would like to stay within the confines of this
+        standard pub/sub notifier pattern model.  We want to stick with the
+        pattern because it is well known and hence does not have to be tought
+        repeatedly.  The pattern is already well documented.  Secondly it works
+        really well and has survived the test of time so why reinvent it.  If
+        we must, an extension to the pattern can be added.  An extension will
+        most likely be better than inventing a new one.
+      </p>
+
+      <p>
+        Using the pattern as is, we can use all the modes listed above to make
+        routing decisions.  1 and 2 are already standard mechanisms.  3 and 4
+        can both be implemented using filters that test event properties and/or
+        acquire the logic to decide on whether or not to inform the Subscriber.
+      </p>
+    </section>
+  </body>
+</document>
\ No newline at end of file

Mime
View raw message