Author: akarasulu
Date: Sun Sep 5 21:13:34 2004
New Revision: 43402
Added:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/
- copied from rev 43401,
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/
- copied from rev 43379,
incubator/directory/seda/trunk/impl/src/test/org/apache/eve/
Removed:
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/
incubator/directory/seda/trunk/impl/src/test/org/apache/eve/
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/DefaultFrontend.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/BufferPoolMonitorAdapter.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/DefaultBufferPool.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/LoggingBufferMonitor.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecodeStageHandler.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecoderManagerMonitorAdapter.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DefaultDecoderManager.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/DefaultEncoderManager.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/EncoderManagerMonitorAdapter.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/AbstractSubscriber.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/DefaultEventRouter.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/DefaultInputManager.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/InputManagerMonitorAdapter.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultListenerManager.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultServerListener.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/ListenerManagerMonitorAdapter.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/DefaultOutputManager.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/LoggingOutputMonitor.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/OutputMonitorAdapter.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/DefaultRequestProcessor.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/RequestHandler.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/RequestProcessorMonitorAdapter.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/DefaultStage.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/DefaultStageConfig.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/LoggingStageMonitor.java
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/StageMonitorAdapter.java
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/buffer/DefaultBufferPoolTest.java
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/AbstractSubscriberTest.java
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/DefaultStageTest.java
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/listener/DefaultListenerManagerTest.java
Log:
moving packages around
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/DefaultFrontend.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/DefaultFrontend.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/DefaultFrontend.java
Sun Sep 5 21:13:34 2004
@@ -1,34 +1,34 @@
-/*
- * 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 ;
-
-import org.apache.seda.Frontend;
-
-
-/**
- * A container neutral implementation of the Eve frontend. There really is
- * nothing here but this will evolve as we determine the use cases for
- * applications embedding the frontend and accessing it outside of the
- * container.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultFrontend implements Frontend
-{
-}
+/*
+ * 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 ;
+
+import org.apache.seda.Frontend;
+
+
+/**
+ * A container neutral implementation of the Eve frontend. There really is
+ * nothing here but this will evolve as we determine the use cases for
+ * applications embedding the frontend and accessing it outside of the
+ * container.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultFrontend implements Frontend
+{
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/BufferPoolMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/buffer/BufferPoolMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/BufferPoolMonitorAdapter.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.buffer ;
+package org.apache.seda.buffer ;
import org.apache.seda.buffer.BufferPoolMonitor;
@@ -35,8 +35,8 @@
{
/* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#augmented(
- * org.apache.eve.buffer.BufferPool)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#augmented(
+ * org.apache.seda.buffer.BufferPool)
*/
public void augmented( BufferPool bp )
{
@@ -44,8 +44,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#bufferTaken(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#bufferTaken(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
*/
public void bufferTaken( BufferPool bp, ByteBuffer buffer,
Object taker )
@@ -54,8 +54,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#bufferReleased(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#bufferReleased(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
*/
public void bufferReleased( BufferPool bp, ByteBuffer buffer,
Object releaser )
@@ -64,8 +64,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#interestClaimed(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#interestClaimed(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
*/
public void interestClaimed( BufferPool bp, ByteBuffer buffer,
Object claimer )
@@ -74,8 +74,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#interestReleased(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#interestReleased(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
*/
public void interestReleased( BufferPool bp, ByteBuffer buffer,
Object releaser )
@@ -84,8 +84,8 @@
/*
* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#resourceUnavailable(
- * org.apache.eve.buffer.BufferPool, java.lang.Object)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#resourceUnavailable(
+ * org.apache.seda.buffer.BufferPool, java.lang.Object)
*/
public void resourceUnavailable( BufferPool bp, Object party )
{
@@ -93,8 +93,8 @@
/*
* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#unregisteredParty(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#unregisteredParty(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
*/
public void unregisteredParty( BufferPool bp, ByteBuffer buffer,
Object party )
@@ -103,8 +103,8 @@
/*
* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#nonPooledBuffer(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#nonPooledBuffer(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
*/
public void nonPooledBuffer( BufferPool bp, ByteBuffer buffer,
Object party )
@@ -113,8 +113,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#releaseOfUnclaimed(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#releaseOfUnclaimed(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
*/
public void releaseOfUnclaimed( BufferPool bp, ByteBuffer buffer,
Object
releaser )
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/DefaultBufferPool.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/buffer/DefaultBufferPool.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/DefaultBufferPool.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.buffer ;
+package org.apache.seda.buffer ;
import java.nio.ByteBuffer ;
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/LoggingBufferMonitor.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/buffer/LoggingBufferMonitor.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/buffer/LoggingBufferMonitor.java
Sun Sep 5 21:13:34 2004
@@ -1,196 +1,196 @@
-/*
- * 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.buffer ;
-
-
-import java.nio.ByteBuffer ;
-
-import org.apache.commons.logging.Log ;
-import org.apache.commons.logging.LogFactory ;
-import org.apache.seda.buffer.BufferPool;
-import org.apache.seda.buffer.BufferPoolMonitor;
-
-
-/**
- * Logging monitor for a BufferPool.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class LoggingBufferMonitor implements BufferPoolMonitor
-{
- /** the default name for the logging channel */
- private final String DEFAULT = "BufferPool" ;
- /** the log - can be any implementation */
- private final Log log ;
-
-
- /**
- * Creates a buffer pool logging monitor.
- */
- public LoggingBufferMonitor()
- {
- log = LogFactory.getLog( DEFAULT ) ;
- }
-
-
- /**
- * Creates a buffer pool logging monitor.
- *
- * @param name the logging channel name
- */
- public LoggingBufferMonitor( String name )
- {
- log = LogFactory.getLog( name ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#
- * augmented(org.apache.eve.buffer.BufferPool)
- */
- public void augmented( BufferPool bp )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( "Just augmented the buffer pool" ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#bufferReleased(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
- */
- public void bufferReleased( BufferPool bp, ByteBuffer buffer,
- Object releaser)
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( releaser + " released " + buffer
- + " from pool " + bp ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#bufferTaken(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
- */
- public void bufferTaken( BufferPool bp, ByteBuffer buffer,
- Object taker )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( taker + " took " + buffer + " from pool " + bp ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#interestClaimed(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
- */
- public void interestClaimed( BufferPool bp, ByteBuffer buffer,
- Object claimer )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( claimer + " claimed interest in " + buffer
- + " from pool " + bp ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#interestReleased(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
- */
- public void interestReleased( BufferPool bp, ByteBuffer buffer,
- Object
releaser )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( releaser + " released interest in " + buffer
- + " from pool " + bp ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#nonPooledBuffer(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
- */
- public void nonPooledBuffer( BufferPool bp, ByteBuffer buffer,
- Object party )
- {
- if ( log.isErrorEnabled() )
- {
- log.error( party + " tried to release interest in "
- + buffer + " from pool " + bp
- + " but resouce was not from this pool.") ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#resourceUnavailable(
- * org.apache.eve.buffer.BufferPool, java.lang.Object)
- */
- public void resourceUnavailable( BufferPool bp, Object party )
- {
- if ( log.isErrorEnabled() )
- {
- log.error( "BufferPool " + bp
- + " is at capacity - cannot allocate buffer resouce to "
- + party ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#unregisteredParty(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
- */
- public void unregisteredParty( BufferPool bp, ByteBuffer buffer,
- Object party )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( party
- + " has not registered as claiming interest on " + buffer
- + " from pool " + bp ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.buffer.BufferPoolMonitor#releaseOfUnclaimed(
- * org.apache.eve.buffer.BufferPool, java.nio.ByteBuffer, java.lang.Object)
- */
- public void releaseOfUnclaimed( BufferPool bp, ByteBuffer buffer,
- Object
releaser )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( releaser + " attempted to release interest in "
- + buffer + " from pool "
- + bp + " when the buffer was not claimed." ) ;
- }
- }
-}
+/*
+ * 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.buffer ;
+
+
+import java.nio.ByteBuffer ;
+
+import org.apache.commons.logging.Log ;
+import org.apache.commons.logging.LogFactory ;
+import org.apache.seda.buffer.BufferPool;
+import org.apache.seda.buffer.BufferPoolMonitor;
+
+
+/**
+ * Logging monitor for a BufferPool.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class LoggingBufferMonitor implements BufferPoolMonitor
+{
+ /** the default name for the logging channel */
+ private final String DEFAULT = "BufferPool" ;
+ /** the log - can be any implementation */
+ private final Log log ;
+
+
+ /**
+ * Creates a buffer pool logging monitor.
+ */
+ public LoggingBufferMonitor()
+ {
+ log = LogFactory.getLog( DEFAULT ) ;
+ }
+
+
+ /**
+ * Creates a buffer pool logging monitor.
+ *
+ * @param name the logging channel name
+ */
+ public LoggingBufferMonitor( String name )
+ {
+ log = LogFactory.getLog( name ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#
+ * augmented(org.apache.seda.buffer.BufferPool)
+ */
+ public void augmented( BufferPool bp )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Just augmented the buffer pool" ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#bufferReleased(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
+ */
+ public void bufferReleased( BufferPool bp, ByteBuffer buffer,
+ Object releaser)
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( releaser + " released " + buffer
+ + " from pool " + bp ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#bufferTaken(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
+ */
+ public void bufferTaken( BufferPool bp, ByteBuffer buffer,
+ Object taker )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( taker + " took " + buffer + " from pool " + bp ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#interestClaimed(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
+ */
+ public void interestClaimed( BufferPool bp, ByteBuffer buffer,
+ Object claimer )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( claimer + " claimed interest in " + buffer
+ + " from pool " + bp ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#interestReleased(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
+ */
+ public void interestReleased( BufferPool bp, ByteBuffer buffer,
+ Object
releaser )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( releaser + " released interest in " + buffer
+ + " from pool " + bp ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#nonPooledBuffer(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
+ */
+ public void nonPooledBuffer( BufferPool bp, ByteBuffer buffer,
+ Object party )
+ {
+ if ( log.isErrorEnabled() )
+ {
+ log.error( party + " tried to release interest in "
+ + buffer + " from pool " + bp
+ + " but resouce was not from this pool.") ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#resourceUnavailable(
+ * org.apache.seda.buffer.BufferPool, java.lang.Object)
+ */
+ public void resourceUnavailable( BufferPool bp, Object party )
+ {
+ if ( log.isErrorEnabled() )
+ {
+ log.error( "BufferPool " + bp
+ + " is at capacity - cannot allocate buffer resouce to "
+ + party ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#unregisteredParty(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
+ */
+ public void unregisteredParty( BufferPool bp, ByteBuffer buffer,
+ Object party )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( party
+ + " has not registered as claiming interest on " + buffer
+ + " from pool " + bp ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.buffer.BufferPoolMonitor#releaseOfUnclaimed(
+ * org.apache.seda.buffer.BufferPool, java.nio.ByteBuffer,
java.lang.Object)
+ */
+ public void releaseOfUnclaimed( BufferPool bp, ByteBuffer buffer,
+ Object
releaser )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( releaser + " attempted to release interest in "
+ + buffer + " from pool "
+ + bp + " when the buffer was not claimed." ) ;
+ }
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecodeStageHandler.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/decoder/DecodeStageHandler.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecodeStageHandler.java
Sun Sep 5 21:13:34 2004
@@ -1,85 +1,85 @@
-/*
- * 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 ;
-
-
-import java.nio.ByteBuffer ;
-import java.util.EventObject ;
-
-import org.apache.commons.codec.DecoderException ;
-import org.apache.commons.codec.stateful.StatefulDecoder ;
-
-import org.apache.seda.event.InputEvent ;
-import org.apache.seda.stage.StageHandler ;
-import org.apache.seda.listener.ClientKey ;
-
-
-/**
- * A decoder manager's decodeNonBlocking StageHandler for use only with
enqueued
- * InputEvents.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DecodeStageHandler implements StageHandler
-{
- /** reference to the decoder manager this handler is used by */
- private final DefaultDecoderManager manager ;
-
-
- /**
- * Creates the decoder manager's decodeNonBlocking stage handler.
- *
- * @param manager the decoder manager this handler is for
- */
- public DecodeStageHandler( DefaultDecoderManager manager )
- {
- this.manager = manager ;
- }
-
-
- /**
- * Uses the client key to have the decoder manager lookup the client's
- * stateful decoder. The decoder's decodeNonBlocking method is called and
control is
- * returned. Error handling is left upto the decoder's monitor.
- *
- * @see
org.apache.seda.stage.StageHandler#handleEvent(java.util.EventObject)
- */
- public void handleEvent( EventObject event )
- {
- InputEvent e = ( InputEvent ) event ;
- ClientKey key = e.getClientKey() ;
- ByteBuffer buf = e.claimInterest( this ) ;
- StatefulDecoder decoder = ( StatefulDecoder ) manager.getDecoder( key
);
-
- try
- {
- decoder.decode( buf ) ;
- }
- catch( DecoderException ex )
- {
- /*
- * monitor should be handling errors already for us and rethrowing
- * so we shouldn't have to do anything here but return control
- */
- }
-
- e.releaseInterest( this ) ;
- e.releaseInterest( manager ) ;
- }
-}
+/*
+ * 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.decoder ;
+
+
+import java.nio.ByteBuffer ;
+import java.util.EventObject ;
+
+import org.apache.commons.codec.DecoderException ;
+import org.apache.commons.codec.stateful.StatefulDecoder ;
+
+import org.apache.seda.event.InputEvent ;
+import org.apache.seda.stage.StageHandler ;
+import org.apache.seda.listener.ClientKey ;
+
+
+/**
+ * A decoder manager's decodeNonBlocking StageHandler for use only with
enqueued
+ * InputEvents.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DecodeStageHandler implements StageHandler
+{
+ /** reference to the decoder manager this handler is used by */
+ private final DefaultDecoderManager manager ;
+
+
+ /**
+ * Creates the decoder manager's decodeNonBlocking stage handler.
+ *
+ * @param manager the decoder manager this handler is for
+ */
+ public DecodeStageHandler( DefaultDecoderManager manager )
+ {
+ this.manager = manager ;
+ }
+
+
+ /**
+ * Uses the client key to have the decoder manager lookup the client's
+ * stateful decoder. The decoder's decodeNonBlocking method is called and
control is
+ * returned. Error handling is left upto the decoder's monitor.
+ *
+ * @see
org.apache.seda.stage.StageHandler#handleEvent(java.util.EventObject)
+ */
+ public void handleEvent( EventObject event )
+ {
+ InputEvent e = ( InputEvent ) event ;
+ ClientKey key = e.getClientKey() ;
+ ByteBuffer buf = e.claimInterest( this ) ;
+ StatefulDecoder decoder = ( StatefulDecoder ) manager.getDecoder( key
);
+
+ try
+ {
+ decoder.decode( buf ) ;
+ }
+ catch( DecoderException ex )
+ {
+ /*
+ * monitor should be handling errors already for us and rethrowing
+ * so we shouldn't have to do anything here but return control
+ */
+ }
+
+ e.releaseInterest( this ) ;
+ e.releaseInterest( manager ) ;
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecoderManagerMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/decoder/DecoderManagerMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DecoderManagerMonitorAdapter.java
Sun Sep 5 21:13:34 2004
@@ -1,48 +1,48 @@
-/*
- * 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 ;
-
-
-import java.util.EventObject ;
-
-import org.apache.seda.event.Subscriber ;
-import org.apache.seda.decoder.DecoderManagerMonitor;
-
-
-/**
- * An adapter for decoder manager monitors where all failures actually throw
- * a wrapped runtime exception of the throwables they encounter.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
- * @version $Rev$
- */
-public class DecoderManagerMonitorAdapter implements DecoderManagerMonitor
-{
- /* (non-Javadoc)
- * @see org.apache.eve.event.SubscriberMonitor#failedOnInform(
- * org.apache.eve.event.Subscriber,
- * java.util.EventObject, java.lang.Throwable)
- */
- public void failedOnInform( Subscriber subscriber, EventObject event,
- Throwable t )
- {
- if ( t != null )
- {
- t.printStackTrace();
- }
- }
-}
+/*
+ * 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.decoder ;
+
+
+import java.util.EventObject ;
+
+import org.apache.seda.event.Subscriber ;
+import org.apache.seda.decoder.DecoderManagerMonitor;
+
+
+/**
+ * An adapter for decoder manager monitors where all failures actually throw
+ * a wrapped runtime exception of the throwables they encounter.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DecoderManagerMonitorAdapter implements DecoderManagerMonitor
+{
+ /* (non-Javadoc)
+ * @see org.apache.seda.event.SubscriberMonitor#failedOnInform(
+ * org.apache.seda.event.Subscriber,
+ * java.util.EventObject, java.lang.Throwable)
+ */
+ public void failedOnInform( Subscriber subscriber, EventObject event,
+ Throwable t )
+ {
+ if ( t != null )
+ {
+ t.printStackTrace();
+ }
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DefaultDecoderManager.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/decoder/DefaultDecoderManager.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/decoder/DefaultDecoderManager.java
Sun Sep 5 21:13:34 2004
@@ -1,279 +1,276 @@
-/*
- * 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;
-
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EventObject;
-
-import java.nio.ByteBuffer;
-
-import org.apache.seda.event.InputEvent;
-import org.apache.seda.stage.StageConfig;
-import org.apache.seda.event.EventRouter;
-import org.apache.seda.listener.ClientKey;
-import org.apache.seda.event.ConnectEvent;
-import org.apache.seda.event.RequestEvent;
-import org.apache.seda.event.DisconnectEvent;
-import org.apache.seda.event.InputSubscriber;
-import org.apache.seda.event.ConnectSubscriber;
-import org.apache.eve.seda.LoggingStageMonitor;
-import org.apache.eve.seda.DefaultStage;
-import org.apache.eve.event.AbstractSubscriber;
-import org.apache.seda.event.DisconnectSubscriber;
-import org.apache.seda.decoder.DecoderManager;
-import org.apache.seda.decoder.DecoderManagerMonitor;
-import org.apache.seda.decoder.ClientDecoder;
-
-import org.apache.commons.codec.DecoderException;
-import org.apache.commons.codec.stateful.DecoderCallback;
-import org.apache.commons.codec.stateful.StatefulDecoder;
-
-import org.apache.commons.lang.NotImplementedException;
-
-
-/**
- * Default decoder managing component implementation.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultDecoderManager extends DefaultStage
- implements
- DecoderManager,
- InputSubscriber,
- ConnectSubscriber,
- DisconnectSubscriber
-{
- /** event router or bus this component subscribes and publishes events on
*/
- private final EventRouter router;
- /** map of decoders for client keys */
- private final Map decoders = new HashMap();
- /** the monitor used for this decoder manager */
- private DecoderManagerMonitor monitor;
-
-
- /**
- * Creates a instance of the default decoder manager implementation.
- *
- * @param router the event bus or router component depended upon
- * @param config the stage configuration
- */
- public DefaultDecoderManager( EventRouter router, StageConfig config )
- {
- super( config );
-
- this.router = router;
- this.monitor = new DecoderManagerMonitorAdapter();
- super.setMonitor( new LoggingStageMonitor( getClass() ) );
-
- router.subscribe( InputEvent.class, this );
- router.subscribe( ConnectEvent.class, this );
- router.subscribe( DisconnectEvent.class, this );
- }
-
-
- // ------------------------------------------------------------------------
- // Subscriber Methods
- // ------------------------------------------------------------------------
-
-
- /**
- * Routes the event to the appropriate typed <code>inform()</code> method.
- *
- * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
- * @see org.apache.seda.event.AbstractSubscriber#inform(
- * org.apache.seda.event.Subscriber, java.util.EventObject)
- */
- public void inform( EventObject event )
- {
- try
- {
- AbstractSubscriber.inform( this, event );
- }
- catch ( Throwable t )
- {
- monitor.failedOnInform( this, event, t );
- }
- }
-
-
- /**
- * Enqueues the event onto this Stages event queue for processing.
- *
- * @see org.apache.seda.event.InputSubscriber#inform(
- * org.apache.seda.event.InputEvent)
- */
- public void inform( InputEvent event )
- {
- // claim interest and release after asynchronous processing of event
- event.claimInterest( this );
- enqueue( event );
- }
-
-
- /**
- * Removes the clients decoder from the map of decoders.
- *
- * @see org.apache.seda.event.DisconnectSubscriber#inform(
- * org.apache.seda.event.DisconnectEvent)
- */
- public void inform( DisconnectEvent event )
- {
- decoders.remove( event.getClientKey() );
- }
-
-
- /**
- * Temporary place holder for functionality that looks up a protocol
- * specific StatefulDecoder.
- *
- * @param key the client key used to determine associated protocol
- * @return the new stateful nonblocking protocol specific decoder
- */
- private StatefulDecoder createClientDecoder( ClientKey key )
- {
- if ( key == null )
- {
- throw new NullPointerException(
- "non null client key required to create decoder" );
- }
- throw new NotImplementedException( "create new decoder for client" );
- }
-
-
- /**
- * We basically create a new client decoder and put it into a map for
- * use later when we are processing input events from the client.
- *
- * @see org.apache.seda.event.ConnectSubscriber#inform(
- * org.apache.seda.event.ConnectEvent)
- */
- public void inform( ConnectEvent event )
- {
- StatefulDecoder decoder;
- ClientKey key = event.getClientKey();
- decoder = new ClientDecoder( key, createClientDecoder( key ) );
-
- /*
- * Here the decoder informs us that a unit of data is decoded. In the
- * case of the snickers decoder we're decoding an LDAP message envelope
- * for a request. We use this request to create a RequestEvent and
- * publish the event on the queue.
- */
- decoder.setCallback( new DecoderCallback()
- {
- public void decodeOccurred( StatefulDecoder decoder,
- Object decoded )
- {
- ClientKey key = ( ( ClientDecoder ) decoder ).getClientKey();
- RequestEvent event = new RequestEvent( this, key, decoded );
- router.publish( event );
- }
- });
- decoders.put( key, decoder );
- }
-
-
- // ------------------------------------------------------------------------
- // Service Interface Methods
- // ------------------------------------------------------------------------
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.decoder.DecoderManager#decodeNonBlocking(
- * org.apache.eve.listener.ClientKey, java.nio.ByteBuffer)
- */
- public void decodeNonBlocking( ClientKey key, ByteBuffer buffer )
- throws DecoderException
- {
- StatefulDecoder decoder = ( StatefulDecoder ) decoders.get( key );
- decoder.decode( buffer );
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.decoder.DecoderManager#
- * decodeNonBlocking(java.nio.ByteBuffer)
- */
- public Object decodeBlocking( ClientKey key, ByteBuffer buffer )
- throws DecoderException
- {
- // replace this decoder with a real one later
- StatefulDecoder decoder = createClientDecoder( key );
- // used array to set a value on final variable and get by compiler
- final Object[] decoded = new Object[1];
-
- decoder.setCallback( new DecoderCallback()
- {
- public void decodeOccurred( StatefulDecoder decoder, Object obj )
- {
- decoded[0] = obj;
- }
- });
-
- // force synchronous callback
- decoder.decode( buffer );
-
- // the decoded value should be set
- if ( decoded[0] == null )
- {
- throw new DecoderException( "Expected a complete encoded unit of "
- + "data but got a partial encoding in buffer arg" );
- }
-
- return decoded[0];
- }
-
-
- // ------------------------------------------------------------------------
- // Additional Methods
- // ------------------------------------------------------------------------
-
-
- /**
- * Gets the monitor for this DecoderManager.
- *
- * @return the monitor
- */
- public DecoderManagerMonitor getMonitor()
- {
- return monitor;
- }
-
-
- /**
- * @param monitor the monitor to set
- */
- public void setMonitor( DecoderManagerMonitor monitor )
- {
- this.monitor = monitor;
- }
-
-
- /**
- * Gets a stateful decoder for a particular client.
- *
- * @param key the client's key
- * @return the stateful decoder for the client
- */
- StatefulDecoder getDecoder( ClientKey key )
- {
- return ( StatefulDecoder ) decoders.get( key );
- }
-}
+/*
+ * 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.decoder;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EventObject;
+
+import java.nio.ByteBuffer;
+
+import org.apache.seda.event.InputEvent;
+import org.apache.seda.stage.StageConfig;
+import org.apache.seda.event.EventRouter;
+import org.apache.seda.listener.ClientKey;
+import org.apache.seda.event.ConnectEvent;
+import org.apache.seda.event.RequestEvent;
+import org.apache.seda.event.DisconnectEvent;
+import org.apache.seda.event.InputSubscriber;
+import org.apache.seda.event.ConnectSubscriber;
+import org.apache.seda.seda.LoggingStageMonitor;
+import org.apache.seda.seda.DefaultStage;
+import org.apache.seda.event.AbstractSubscriber;
+import org.apache.seda.event.DisconnectSubscriber;
+
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.stateful.DecoderCallback;
+import org.apache.commons.codec.stateful.StatefulDecoder;
+
+import org.apache.commons.lang.NotImplementedException;
+
+
+/**
+ * Default decoder managing component implementation.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultDecoderManager extends DefaultStage
+ implements
+ DecoderManager,
+ InputSubscriber,
+ ConnectSubscriber,
+ DisconnectSubscriber
+{
+ /** event router or bus this component subscribes and publishes events on
*/
+ private final EventRouter router;
+ /** map of decoders for client keys */
+ private final Map decoders = new HashMap();
+ /** the monitor used for this decoder manager */
+ private DecoderManagerMonitor monitor;
+
+
+ /**
+ * Creates a instance of the default decoder manager implementation.
+ *
+ * @param router the event bus or router component depended upon
+ * @param config the stage configuration
+ */
+ public DefaultDecoderManager( EventRouter router, StageConfig config )
+ {
+ super( config );
+
+ this.router = router;
+ this.monitor = new DecoderManagerMonitorAdapter();
+ super.setMonitor( new LoggingStageMonitor( getClass() ) );
+
+ router.subscribe( InputEvent.class, this );
+ router.subscribe( ConnectEvent.class, this );
+ router.subscribe( DisconnectEvent.class, this );
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Subscriber Methods
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Routes the event to the appropriate typed <code>inform()</code> method.
+ *
+ * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
+ * @see org.apache.seda.event.AbstractSubscriber#inform(
+ * org.apache.seda.event.Subscriber, java.util.EventObject)
+ */
+ public void inform( EventObject event )
+ {
+ try
+ {
+ AbstractSubscriber.inform( this, event );
+ }
+ catch ( Throwable t )
+ {
+ monitor.failedOnInform( this, event, t );
+ }
+ }
+
+
+ /**
+ * Enqueues the event onto this Stages event queue for processing.
+ *
+ * @see org.apache.seda.event.InputSubscriber#inform(
+ * org.apache.seda.event.InputEvent)
+ */
+ public void inform( InputEvent event )
+ {
+ // claim interest and release after asynchronous processing of event
+ event.claimInterest( this );
+ enqueue( event );
+ }
+
+
+ /**
+ * Removes the clients decoder from the map of decoders.
+ *
+ * @see org.apache.seda.event.DisconnectSubscriber#inform(
+ * org.apache.seda.event.DisconnectEvent)
+ */
+ public void inform( DisconnectEvent event )
+ {
+ decoders.remove( event.getClientKey() );
+ }
+
+
+ /**
+ * Temporary place holder for functionality that looks up a protocol
+ * specific StatefulDecoder.
+ *
+ * @param key the client key used to determine associated protocol
+ * @return the new stateful nonblocking protocol specific decoder
+ */
+ private StatefulDecoder createClientDecoder( ClientKey key )
+ {
+ if ( key == null )
+ {
+ throw new NullPointerException(
+ "non null client key required to create decoder" );
+ }
+ throw new NotImplementedException( "create new decoder for client" );
+ }
+
+
+ /**
+ * We basically create a new client decoder and put it into a map for
+ * use later when we are processing input events from the client.
+ *
+ * @see org.apache.seda.event.ConnectSubscriber#inform(
+ * org.apache.seda.event.ConnectEvent)
+ */
+ public void inform( ConnectEvent event )
+ {
+ StatefulDecoder decoder;
+ ClientKey key = event.getClientKey();
+ decoder = new ClientDecoder( key, createClientDecoder( key ) );
+
+ /*
+ * Here the decoder informs us that a unit of data is decoded. In the
+ * case of the snickers decoder we're decoding an LDAP message envelope
+ * for a request. We use this request to create a RequestEvent and
+ * publish the event on the queue.
+ */
+ decoder.setCallback( new DecoderCallback()
+ {
+ public void decodeOccurred( StatefulDecoder decoder,
+ Object decoded )
+ {
+ ClientKey key = ( ( ClientDecoder ) decoder ).getClientKey();
+ RequestEvent event = new RequestEvent( this, key, decoded );
+ router.publish( event );
+ }
+ });
+ decoders.put( key, decoder );
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Service Interface Methods
+ // ------------------------------------------------------------------------
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.decoder.DecoderManager#decodeNonBlocking(
+ * org.apache.seda.listener.ClientKey, java.nio.ByteBuffer)
+ */
+ public void decodeNonBlocking( ClientKey key, ByteBuffer buffer )
+ throws DecoderException
+ {
+ StatefulDecoder decoder = ( StatefulDecoder ) decoders.get( key );
+ decoder.decode( buffer );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.decoder.DecoderManager#
+ * decodeNonBlocking(java.nio.ByteBuffer)
+ */
+ public Object decodeBlocking( ClientKey key, ByteBuffer buffer )
+ throws DecoderException
+ {
+ // replace this decoder with a real one later
+ StatefulDecoder decoder = createClientDecoder( key );
+ // used array to set a value on final variable and get by compiler
+ final Object[] decoded = new Object[1];
+
+ decoder.setCallback( new DecoderCallback()
+ {
+ public void decodeOccurred( StatefulDecoder decoder, Object obj )
+ {
+ decoded[0] = obj;
+ }
+ });
+
+ // force synchronous callback
+ decoder.decode( buffer );
+
+ // the decoded value should be set
+ if ( decoded[0] == null )
+ {
+ throw new DecoderException( "Expected a complete encoded unit of "
+ + "data but got a partial encoding in buffer arg" );
+ }
+
+ return decoded[0];
+ }
+
+
+ // ------------------------------------------------------------------------
+ // Additional Methods
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Gets the monitor for this DecoderManager.
+ *
+ * @return the monitor
+ */
+ public DecoderManagerMonitor getMonitor()
+ {
+ return monitor;
+ }
+
+
+ /**
+ * @param monitor the monitor to set
+ */
+ public void setMonitor( DecoderManagerMonitor monitor )
+ {
+ this.monitor = monitor;
+ }
+
+
+ /**
+ * Gets a stateful decoder for a particular client.
+ *
+ * @param key the client's key
+ * @return the stateful decoder for the client
+ */
+ StatefulDecoder getDecoder( ClientKey key )
+ {
+ return ( StatefulDecoder ) decoders.get( key );
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/DefaultEncoderManager.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/encoder/DefaultEncoderManager.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/DefaultEncoderManager.java
Sun Sep 5 21:13:34 2004
@@ -1,139 +1,139 @@
-/*
- * 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.encoder;
-
-
-import java.nio.ByteBuffer;
-import java.util.EventObject;
-
-import org.apache.commons.codec.EncoderException;
-import org.apache.commons.lang.NotImplementedException;
-
-import org.apache.seda.event.EventRouter;
-import org.apache.seda.event.OutputEvent;
-import org.apache.seda.event.ResponseEvent;
-import org.apache.seda.event.ResponseSubscriber;
-
-import org.apache.seda.stage.StageHandler;
-
-import org.apache.seda.listener.ClientKey;
-import org.apache.seda.encoder.EncoderManager;
-import org.apache.seda.encoder.EncoderManagerMonitor;
-import org.apache.eve.seda.DefaultStage;
-import org.apache.eve.seda.DefaultStageConfig;
-import org.apache.eve.seda.LoggingStageMonitor;
-import org.apache.eve.event.AbstractSubscriber;
-
-
-/**
- * The default EncoderManager. For now we're modeling this as a simple one
- * shot encode module but this will change as well build stateful encoders
which
- * will fragment a response into multiple output events.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultEncoderManager extends DefaultStage
- implements EncoderManager, ResponseSubscriber
-{
- /** the event router used to publish and subscribe to events on */
- private final EventRouter router;
- private EncoderManagerMonitor monitor;
-
-
- /**
- * Creates the default EncoderManager.
- *
- * @param router the event router used to publish and subscribe to events
on
- */
- public DefaultEncoderManager( EventRouter router,
- DefaultStageConfig config )
- {
- super( config );
- super.setMonitor( new LoggingStageMonitor( this.getClass() ) );
- monitor = new EncoderManagerMonitorAdapter();
- config.setHandler( new EncoderStageHandler() );
- this.router = router;
- this.router.subscribe( ResponseEvent.class, this );
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
- */
- public void inform( EventObject event )
- {
- try
- {
- AbstractSubscriber.inform( this, event );
- }
- catch( Throwable t )
- {
- monitor.failedOnInform( this, event, t );
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.event.ResponseSubscriber#inform(
- * org.apache.seda.event.ResponseEvent)
- */
- public void inform( ResponseEvent event )
- {
- super.enqueue( event );
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.encoder.EncoderManager#encode(ClientKey, Object)
- */
- public ByteBuffer encode( ClientKey key, Object response )
- throws EncoderException
- {
-// MessageEncoder encoder = new MessageEncoder();
-// return encoder.encode( response );
- throw new NotImplementedException( "need to delegate to encoder" );
- }
-
-
- class EncoderStageHandler implements StageHandler
- {
- /* (non-Javadoc)
- * @see org.apache.eve.seda.StageHandler#handleEvent(
- * java.util.EventObject)
- */
- public void handleEvent( EventObject generic )
- {
- ByteBuffer buf = null;
- ResponseEvent event = ( ResponseEvent ) generic;
-
- try
- {
- buf = encode( event.getClientKey(), event.getResponse() );
- }
- catch ( EncoderException e )
- {
- monitor.failedOnEncode( DefaultEncoderManager.this, event, e );
- }
-
- OutputEvent outEvent = new OutputEvent(
DefaultEncoderManager.this,
- event.getClientKey(), buf );
- router.publish( outEvent );
- }
- }
-}
+/*
+ * 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.encoder;
+
+
+import java.nio.ByteBuffer;
+import java.util.EventObject;
+
+import org.apache.commons.codec.EncoderException;
+import org.apache.commons.lang.NotImplementedException;
+
+import org.apache.seda.event.EventRouter;
+import org.apache.seda.event.OutputEvent;
+import org.apache.seda.event.ResponseEvent;
+import org.apache.seda.event.ResponseSubscriber;
+
+import org.apache.seda.stage.StageHandler;
+
+import org.apache.seda.listener.ClientKey;
+import org.apache.seda.encoder.EncoderManager;
+import org.apache.seda.encoder.EncoderManagerMonitor;
+import org.apache.seda.seda.DefaultStage;
+import org.apache.seda.seda.DefaultStageConfig;
+import org.apache.seda.seda.LoggingStageMonitor;
+import org.apache.seda.event.AbstractSubscriber;
+
+
+/**
+ * The default EncoderManager. For now we're modeling this as a simple one
+ * shot encode module but this will change as well build stateful encoders
which
+ * will fragment a response into multiple output events.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultEncoderManager extends DefaultStage
+ implements EncoderManager, ResponseSubscriber
+{
+ /** the event router used to publish and subscribe to events on */
+ private final EventRouter router;
+ private EncoderManagerMonitor monitor;
+
+
+ /**
+ * Creates the default EncoderManager.
+ *
+ * @param router the event router used to publish and subscribe to events
on
+ */
+ public DefaultEncoderManager( EventRouter router,
+ DefaultStageConfig config )
+ {
+ super( config );
+ super.setMonitor( new LoggingStageMonitor( this.getClass() ) );
+ monitor = new EncoderManagerMonitorAdapter();
+ config.setHandler( new EncoderStageHandler() );
+ this.router = router;
+ this.router.subscribe( ResponseEvent.class, this );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
+ */
+ public void inform( EventObject event )
+ {
+ try
+ {
+ AbstractSubscriber.inform( this, event );
+ }
+ catch( Throwable t )
+ {
+ monitor.failedOnInform( this, event, t );
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.event.ResponseSubscriber#inform(
+ * org.apache.seda.event.ResponseEvent)
+ */
+ public void inform( ResponseEvent event )
+ {
+ super.enqueue( event );
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.encoder.EncoderManager#encode(ClientKey, Object)
+ */
+ public ByteBuffer encode( ClientKey key, Object response )
+ throws EncoderException
+ {
+// MessageEncoder encoder = new MessageEncoder();
+// return encoder.encode( response );
+ throw new NotImplementedException( "need to delegate to encoder" );
+ }
+
+
+ class EncoderStageHandler implements StageHandler
+ {
+ /* (non-Javadoc)
+ * @see org.apache.seda.seda.StageHandler#handleEvent(
+ * java.util.EventObject)
+ */
+ public void handleEvent( EventObject generic )
+ {
+ ByteBuffer buf = null;
+ ResponseEvent event = ( ResponseEvent ) generic;
+
+ try
+ {
+ buf = encode( event.getClientKey(), event.getResponse() );
+ }
+ catch ( EncoderException e )
+ {
+ monitor.failedOnEncode( DefaultEncoderManager.this, event, e );
+ }
+
+ OutputEvent outEvent = new OutputEvent(
DefaultEncoderManager.this,
+ event.getClientKey(), buf );
+ router.publish( outEvent );
+ }
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/EncoderManagerMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/encoder/EncoderManagerMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/encoder/EncoderManagerMonitorAdapter.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.encoder;
+package org.apache.seda.encoder;
import org.apache.seda.encoder.EncoderManagerMonitor;
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/AbstractSubscriber.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/event/AbstractSubscriber.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/AbstractSubscriber.java
Sun Sep 5 21:13:34 2004
@@ -1,195 +1,195 @@
-/*
- * 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.event ;
-
-
-import java.util.List ;
-import java.util.HashMap ;
-import java.util.EventObject ;
-
-import java.lang.reflect.Method ;
-import java.lang.reflect.InvocationTargetException ;
-
-import org.apache.commons.lang.Validate ;
-import org.apache.commons.lang.ClassUtils ;
-import org.apache.seda.event.Subscriber;
-import org.apache.seda.event.SubscriberMonitor;
-
-
-/**
- * An abstract Subscriber that calls the provided type-specific inform method
- * of Subscriber sub-interface. This way their is no need to downcast the
- * event. Reflection is used by the abstract subscriber's inform method to
- * determine at run time which inform method of a concrete subscriber to
invoke.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class AbstractSubscriber implements Subscriber
-{
- /** cached inform methods for subscribers */
- private static final HashMap methods = new HashMap() ;
-
- /** monitor for this Subscriber */
- private final SubscriberMonitor monitor ;
-
-
- /**
- * Creates a Subscriber that does not monitor failures to inform.
- */
- public AbstractSubscriber()
- {
- monitor = null ;
- }
-
-
- /**
- * Creates a Subscriber that does monitor failures on inform.
- *
- * @param monitor the monitor to use on failures
- */
- public AbstractSubscriber( SubscriberMonitor monitor )
- {
- this.monitor = monitor ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.event.Subscriber#inform(java.util.EventObject)
- */
- public void inform( EventObject event )
- {
- try
- {
- inform( this, event ) ;
- }
- catch ( Throwable t )
- {
- if ( monitor != null )
- {
- monitor.failedOnInform( this, event, t ) ;
- }
- else
- {
- System.err.println( "Failed to inform this Subscriber " +
- this + " about event " + event ) ;
- System.err.println( "To prevent the above println use a non "
- + "null SubscriberMonitor" ) ;
- }
- }
- }
-
-
- /**
- * Searches for the most event type specific inform method on the target
- * subscriber to call and invokes that method. The class of the event
- * and all its superclasses are used in succession to find a specific
inform
- * method. If a more specific inform method other than
- * <code>inform(EventObject)</code> cannot be found then a
- * NoSuchMethodException is raised.
- *
- * @param subscriber the subscriber to inform
- * @param event the event that is the argument to inform
- */
- public static void inform( Subscriber subscriber, EventObject event )
throws
- NoSuchMethodException, IllegalAccessException,
InvocationTargetException
- {
- Validate.notNull( subscriber, "subscriber arg cannot be null" ) ;
- Validate.notNull( event, "event arg cannot be null" ) ;
-
- Method method = getSpecificInformMethod( subscriber, event ) ;
- Object params[] = { event } ;
- method.invoke( subscriber, params ) ;
- }
-
-
- /**
- * Gets the specific inform method of a subscriber class that takes the
- * event class as its sole argument.
- *
- * @param subscr the subscriber
- * @param event the event
- * @return the specific inform Method to invoke
- * @throws NoSuchMethodException if an inform method other than <code>
- * inform(EventObject)</code> cannot be found
- */
- public static Method getSpecificInformMethod( Subscriber subscr,
- EventObject event )
- throws NoSuchMethodException
- {
- Method method = null ;
-
- /*
- * attempt a lookup into the signature cache to see if we can find
- * the method there if not then we need to search for the method
- */
- StringBuffer signature = new StringBuffer() ;
- signature.append( subscr.getClass().getName() ) ;
- signature.append( '.' ) ;
- signature.append( "inform(" ) ;
- signature.append( event.getClass().getName() ) ;
- signature.append( ')' ) ;
-
- String key = signature.toString() ;
- if ( methods.containsKey( key ) )
- {
- return ( Method ) methods.get( key ) ;
- }
-
- /*
- * we could not find the method in the cache so we need to find it
- * and add it to the cache if it exists at all
- */
- List list = ClassUtils.getAllSuperclasses( event.getClass() ) ;
- list.removeAll( ClassUtils.getAllSuperclasses( EventObject.class ) ) ;
- list.add( 0, event.getClass() ) ;
-
- // there may be two EventObject class references in the list
- while( list.contains( EventObject.class ) )
- {
- list.remove( EventObject.class ) ;
- }
-
- Method[] all = subscr.getClass().getMethods() ;
- for ( int ii = 0; ii < all.length; ii++ )
- {
- method = all[ii] ;
-
- if ( method.getName().equals( "inform" ) )
- {
- Class[] paramTypes = method.getParameterTypes() ;
-
- if ( paramTypes.length == 1 )
- {
- for ( int jj = 0; jj < list.size(); jj++ )
- {
- if ( paramTypes[0] == list.get( jj ) )
- {
- methods.put( key, method ) ;
- return method ;
- }
- }
- }
- }
- }
-
- throw new NoSuchMethodException( "Could not find a more specific "
- + "inform method other than " + subscr.getClass().getName()
- + ".inform(EventObject)" ) ;
- }
-}
+/*
+ * 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.event ;
+
+
+import java.util.List ;
+import java.util.HashMap ;
+import java.util.EventObject ;
+
+import java.lang.reflect.Method ;
+import java.lang.reflect.InvocationTargetException ;
+
+import org.apache.commons.lang.Validate ;
+import org.apache.commons.lang.ClassUtils ;
+import org.apache.seda.event.Subscriber;
+import org.apache.seda.event.SubscriberMonitor;
+
+
+/**
+ * An abstract Subscriber that calls the provided type-specific inform method
+ * of Subscriber sub-interface. This way their is no need to downcast the
+ * event. Reflection is used by the abstract subscriber's inform method to
+ * determine at run time which inform method of a concrete subscriber to
invoke.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class AbstractSubscriber implements Subscriber
+{
+ /** cached inform methods for subscribers */
+ private static final HashMap methods = new HashMap() ;
+
+ /** monitor for this Subscriber */
+ private final SubscriberMonitor monitor ;
+
+
+ /**
+ * Creates a Subscriber that does not monitor failures to inform.
+ */
+ public AbstractSubscriber()
+ {
+ monitor = null ;
+ }
+
+
+ /**
+ * Creates a Subscriber that does monitor failures on inform.
+ *
+ * @param monitor the monitor to use on failures
+ */
+ public AbstractSubscriber( SubscriberMonitor monitor )
+ {
+ this.monitor = monitor ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
+ */
+ public void inform( EventObject event )
+ {
+ try
+ {
+ inform( this, event ) ;
+ }
+ catch ( Throwable t )
+ {
+ if ( monitor != null )
+ {
+ monitor.failedOnInform( this, event, t ) ;
+ }
+ else
+ {
+ System.err.println( "Failed to inform this Subscriber " +
+ this + " about event " + event ) ;
+ System.err.println( "To prevent the above println use a non "
+ + "null SubscriberMonitor" ) ;
+ }
+ }
+ }
+
+
+ /**
+ * Searches for the most event type specific inform method on the target
+ * subscriber to call and invokes that method. The class of the event
+ * and all its superclasses are used in succession to find a specific
inform
+ * method. If a more specific inform method other than
+ * <code>inform(EventObject)</code> cannot be found then a
+ * NoSuchMethodException is raised.
+ *
+ * @param subscriber the subscriber to inform
+ * @param event the event that is the argument to inform
+ */
+ public static void inform( Subscriber subscriber, EventObject event )
throws
+ NoSuchMethodException, IllegalAccessException,
InvocationTargetException
+ {
+ Validate.notNull( subscriber, "subscriber arg cannot be null" ) ;
+ Validate.notNull( event, "event arg cannot be null" ) ;
+
+ Method method = getSpecificInformMethod( subscriber, event ) ;
+ Object params[] = { event } ;
+ method.invoke( subscriber, params ) ;
+ }
+
+
+ /**
+ * Gets the specific inform method of a subscriber class that takes the
+ * event class as its sole argument.
+ *
+ * @param subscr the subscriber
+ * @param event the event
+ * @return the specific inform Method to invoke
+ * @throws NoSuchMethodException if an inform method other than <code>
+ * inform(EventObject)</code> cannot be found
+ */
+ public static Method getSpecificInformMethod( Subscriber subscr,
+ EventObject event )
+ throws NoSuchMethodException
+ {
+ Method method = null ;
+
+ /*
+ * attempt a lookup into the signature cache to see if we can find
+ * the method there if not then we need to search for the method
+ */
+ StringBuffer signature = new StringBuffer() ;
+ signature.append( subscr.getClass().getName() ) ;
+ signature.append( '.' ) ;
+ signature.append( "inform(" ) ;
+ signature.append( event.getClass().getName() ) ;
+ signature.append( ')' ) ;
+
+ String key = signature.toString() ;
+ if ( methods.containsKey( key ) )
+ {
+ return ( Method ) methods.get( key ) ;
+ }
+
+ /*
+ * we could not find the method in the cache so we need to find it
+ * and add it to the cache if it exists at all
+ */
+ List list = ClassUtils.getAllSuperclasses( event.getClass() ) ;
+ list.removeAll( ClassUtils.getAllSuperclasses( EventObject.class ) ) ;
+ list.add( 0, event.getClass() ) ;
+
+ // there may be two EventObject class references in the list
+ while( list.contains( EventObject.class ) )
+ {
+ list.remove( EventObject.class ) ;
+ }
+
+ Method[] all = subscr.getClass().getMethods() ;
+ for ( int ii = 0; ii < all.length; ii++ )
+ {
+ method = all[ii] ;
+
+ if ( method.getName().equals( "inform" ) )
+ {
+ Class[] paramTypes = method.getParameterTypes() ;
+
+ if ( paramTypes.length == 1 )
+ {
+ for ( int jj = 0; jj < list.size(); jj++ )
+ {
+ if ( paramTypes[0] == list.get( jj ) )
+ {
+ methods.put( key, method ) ;
+ return method ;
+ }
+ }
+ }
+ }
+ }
+
+ throw new NoSuchMethodException( "Could not find a more specific "
+ + "inform method other than " + subscr.getClass().getName()
+ + ".inform(EventObject)" ) ;
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/DefaultEventRouter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/event/DefaultEventRouter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/event/DefaultEventRouter.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.event ;
+package org.apache.seda.event ;
import org.apache.seda.event.*;
@@ -41,8 +41,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.event.EventRouter#subscribe(java.lang.Class,
- * org.apache.eve.event.Subscriber)
+ * @see org.apache.seda.event.EventRouter#subscribe(java.lang.Class,
+ * org.apache.seda.event.Subscriber)
*/
public void subscribe( Class type, Subscriber subscriber )
{
@@ -51,8 +51,8 @@
/*
- * @see org.apache.eve.event.EventRouter#subscribe(java.lang.Class,
- * org.apache.eve.event.Filter, org.apache.eve.event.Subscriber)
+ * @see org.apache.seda.event.EventRouter#subscribe(java.lang.Class,
+ * org.apache.seda.event.Filter, org.apache.eve.event.Subscriber)
*/
public void subscribe( Class type, Filter filter, Subscriber subscriber )
{
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/DefaultInputManager.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/input/DefaultInputManager.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/DefaultInputManager.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.input ;
+package org.apache.seda.input ;
import java.util.Iterator ;
@@ -38,7 +38,7 @@
import org.apache.seda.event.ConnectSubscriber ;
import org.apache.seda.event.DisconnectSubscriber ;
import org.apache.seda.listener.KeyExpiryException ;
-import org.apache.eve.event.AbstractSubscriber;
+import org.apache.seda.event.AbstractSubscriber;
/**
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/InputManagerMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/input/InputManagerMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/input/InputManagerMonitorAdapter.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.input ;
+package org.apache.seda.input ;
import java.io.IOException ;
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultListenerManager.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/listener/DefaultListenerManager.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultListenerManager.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.listener ;
+package org.apache.seda.listener ;
import java.util.Set ;
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultServerListener.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/listener/DefaultServerListener.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/DefaultServerListener.java
Sun Sep 5 21:13:34 2004
@@ -1,155 +1,155 @@
-/*
- * 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.listener;
-
-
-import org.apache.seda.protocol.InetServiceEntry;
-import org.apache.seda.listener.InetServiceListenerConfig;
-
-
-/**
- * A default server listener.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a>
- * @author $LastChangedBy$
- * @version $LastChangedRevision$
- */
-public class DefaultServerListener implements InetServiceListenerConfig
-{
- /** the connection backlog */
- private int backlog;
- /** the interface address or hostname of the server */
- private byte[] address;
- /** whether or not ssl is used to secure connections */
- private boolean isSecure;
- /** the inet service provided by this listener */
- private InetServiceEntry servEnt;
-
- /**
- * Creates a default listener with all the supplied properties.
- *
- * @param a_address the interface address or hostname of the server
- * @param a_backlog the connection backlog
- * @param a_isSecure whether or not ssl is used to secure connections
- * @param servEnt the inet service entry for the service this listner
- * provides
- */
- public DefaultServerListener( byte[] a_address, int a_backlog,
- boolean a_isSecure, InetServiceEntry servEnt
)
- {
- this.backlog = a_backlog;
- this.address = a_address;
- this.isSecure = a_isSecure;
- this.servEnt = servEnt;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.listener.ServerListener#getAddress()
- */
- public byte[] getAddress()
- {
- return this.address;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.listener.ServerListener#getBacklog()
- */
- public int getBacklog()
- {
- return this.backlog;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.listener.ServerListener#isSecure()
- */
- public boolean isSecure()
- {
- return this.isSecure;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.listener.ServerListener#getURL()
- */
- public String getURL()
- {
- StringBuffer l_buf = new StringBuffer();
-
- l_buf.append( servEnt.getName() );
- l_buf.append( "://" );
- l_buf.append( this.address );
- l_buf.append( ':' );
- l_buf.append( servEnt.getPort() );
-
- return l_buf.toString();
- }
-
-
- /**
- * Gets the Inet service entry for the service this config's listner
- * provides.
- *
- * @return the served service's entry
- */
- public InetServiceEntry getInetServiceEntry()
- {
- return servEnt;
- }
-
-
- /**
- * Sets the address for the
- *
- * @param a_address The address to set.
- */
- protected void setAddress( byte[] a_address )
- {
- this.address = a_address;
- }
-
-
- /**
- * @param a_backlog The backlog to set.
- */
- protected void setBacklog( int a_backlog )
- {
- this.backlog = a_backlog;
- }
-
-
- /**
- * @param a_isSecure The isSecure to set.
- */
- protected void setSecure( boolean a_isSecure )
- {
- this.isSecure = a_isSecure;
- }
-
-
- /**
- * Set's the inet service entry.
- *
- * @param servEnt the service entry of the service this listener provides
- */
- protected void setInetServiceEntry( InetServiceEntry servEnt )
- {
- this.servEnt = servEnt;
- }
-}
+/*
+ * 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.listener;
+
+
+import org.apache.seda.protocol.InetServiceEntry;
+import org.apache.seda.listener.InetServiceListenerConfig;
+
+
+/**
+ * A default server listener.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Alex Karasulu</a>
+ * @author $LastChangedBy$
+ * @version $LastChangedRevision$
+ */
+public class DefaultServerListener implements InetServiceListenerConfig
+{
+ /** the connection backlog */
+ private int backlog;
+ /** the interface address or hostname of the server */
+ private byte[] address;
+ /** whether or not ssl is used to secure connections */
+ private boolean isSecure;
+ /** the inet service provided by this listener */
+ private InetServiceEntry servEnt;
+
+ /**
+ * Creates a default listener with all the supplied properties.
+ *
+ * @param a_address the interface address or hostname of the server
+ * @param a_backlog the connection backlog
+ * @param a_isSecure whether or not ssl is used to secure connections
+ * @param servEnt the inet service entry for the service this listner
+ * provides
+ */
+ public DefaultServerListener( byte[] a_address, int a_backlog,
+ boolean a_isSecure, InetServiceEntry servEnt
)
+ {
+ this.backlog = a_backlog;
+ this.address = a_address;
+ this.isSecure = a_isSecure;
+ this.servEnt = servEnt;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.listener.ServerListener#getAddress()
+ */
+ public byte[] getAddress()
+ {
+ return this.address;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.listener.ServerListener#getBacklog()
+ */
+ public int getBacklog()
+ {
+ return this.backlog;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.listener.ServerListener#isSecure()
+ */
+ public boolean isSecure()
+ {
+ return this.isSecure;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.listener.ServerListener#getURL()
+ */
+ public String getURL()
+ {
+ StringBuffer l_buf = new StringBuffer();
+
+ l_buf.append( servEnt.getName() );
+ l_buf.append( "://" );
+ l_buf.append( this.address );
+ l_buf.append( ':' );
+ l_buf.append( servEnt.getPort() );
+
+ return l_buf.toString();
+ }
+
+
+ /**
+ * Gets the Inet service entry for the service this config's listner
+ * provides.
+ *
+ * @return the served service's entry
+ */
+ public InetServiceEntry getInetServiceEntry()
+ {
+ return servEnt;
+ }
+
+
+ /**
+ * Sets the address for the
+ *
+ * @param a_address The address to set.
+ */
+ protected void setAddress( byte[] a_address )
+ {
+ this.address = a_address;
+ }
+
+
+ /**
+ * @param a_backlog The backlog to set.
+ */
+ protected void setBacklog( int a_backlog )
+ {
+ this.backlog = a_backlog;
+ }
+
+
+ /**
+ * @param a_isSecure The isSecure to set.
+ */
+ protected void setSecure( boolean a_isSecure )
+ {
+ this.isSecure = a_isSecure;
+ }
+
+
+ /**
+ * Set's the inet service entry.
+ *
+ * @param servEnt the service entry of the service this listener provides
+ */
+ protected void setInetServiceEntry( InetServiceEntry servEnt )
+ {
+ this.servEnt = servEnt;
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/ListenerManagerMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/listener/ListenerManagerMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/listener/ListenerManagerMonitorAdapter.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.listener ;
+package org.apache.seda.listener ;
import java.io.IOException ;
@@ -35,7 +35,7 @@
{
/*
* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#started()
+ * @see org.apache.seda.listener.ListenerManagerMonitor#started()
*/
public void started()
{
@@ -44,7 +44,7 @@
/*
* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#stopped()
+ * @see org.apache.seda.listener.ListenerManagerMonitor#stopped()
*/
public void stopped()
{
@@ -52,8 +52,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#bindOccured(
- * org.apache.eve.listener.ServerListener)
+ * @see org.apache.seda.listener.ListenerManagerMonitor#bindOccured(
+ * org.apache.seda.listener.ServerListener)
*/
public void bindOccured( ServerListener listener )
{
@@ -61,8 +61,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#unbindOccured(
- * org.apache.eve.listener.ServerListener)
+ * @see org.apache.seda.listener.ListenerManagerMonitor#unbindOccured(
+ * org.apache.seda.listener.ServerListener)
*/
public void unbindOccured( ServerListener listener )
{
@@ -71,7 +71,7 @@
/*
* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#acceptOccured(
+ * @see org.apache.seda.listener.ListenerManagerMonitor#acceptOccured(
* java.nio.channels.SelectionKey)
*/
public void acceptOccured( SelectionKey key )
@@ -81,7 +81,7 @@
/*
* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#selectOccured(
+ * @see org.apache.seda.listener.ListenerManagerMonitor#selectOccured(
* java.nio.channels.Selector)
*/
public void selectOccured( Selector selector )
@@ -90,8 +90,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#failedToBind(
- * org.apache.eve.listener.ServerListener, java.io.IOException)
+ * @see org.apache.seda.listener.ListenerManagerMonitor#failedToBind(
+ * org.apache.seda.listener.ServerListener, java.io.IOException)
*/
public void failedToBind( ServerListener listener, IOException fault )
{
@@ -100,8 +100,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#failedToUnbind(
- * org.apache.eve.listener.ServerListener, java.io.IOException)
+ * @see org.apache.seda.listener.ListenerManagerMonitor#failedToUnbind(
+ * org.apache.seda.listener.ServerListener, java.io.IOException)
*/
public void failedToUnbind( ServerListener listener,
IOException fault )
@@ -111,8 +111,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#failedToExpire(
- * org.apache.eve.listener.ClientKey, java.io.IOException)
+ * @see org.apache.seda.listener.ListenerManagerMonitor#failedToExpire(
+ * org.apache.seda.listener.ClientKey, java.io.IOException)
*/
public void failedToExpire( ClientKey key, IOException fault )
{
@@ -121,7 +121,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#failedToAccept(
+ * @see org.apache.seda.listener.ListenerManagerMonitor#failedToAccept(
* java.nio.channels.SelectionKey, java.io.IOException)
*/
public void failedToAccept( SelectionKey key, IOException fault )
@@ -131,7 +131,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#failedToSelect(
+ * @see org.apache.seda.listener.ListenerManagerMonitor#failedToSelect(
* java.nio.channels.Selector, java.io.IOException)
*/
public void failedToSelect( Selector selector, IOException fault )
@@ -141,7 +141,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#selectTimedOut(
+ * @see org.apache.seda.listener.ListenerManagerMonitor#selectTimedOut(
* java.nio.channels.Selector)
*/
public void selectTimedOut( Selector selector )
@@ -150,7 +150,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.listener.ListenerManagerMonitor#enteringSelect(
+ * @see org.apache.seda.listener.ListenerManagerMonitor#enteringSelect(
* java.nio.channels.Selector)
*/
public void enteringSelect( Selector selector )
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/DefaultOutputManager.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/output/DefaultOutputManager.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/DefaultOutputManager.java
Sun Sep 5 21:13:34 2004
@@ -1,240 +1,240 @@
-/*
- * 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.output ;
-
-
-import java.io.IOException ;
-
-import java.nio.ByteBuffer ;
-import java.nio.channels.SocketChannel ;
-
-import java.util.Map ;
-import java.util.HashMap ;
-import java.util.EventObject ;
-
-import org.apache.seda.event.EventRouter ;
-import org.apache.seda.event.OutputEvent ;
-import org.apache.seda.stage.DefaultStage ;
-import org.apache.seda.stage.StageHandler ;
-import org.apache.seda.listener.ClientKey ;
-import org.apache.seda.event.ConnectEvent ;
-import org.apache.seda.output.OutputManager ;
-import org.apache.seda.output.OutputMonitor ;
-import org.apache.seda.event.DisconnectEvent ;
-import org.apache.seda.event.OutputSubscriber ;
-import org.apache.seda.event.ConnectSubscriber ;
-import org.apache.seda.stage.DefaultStageConfig ;
-import org.apache.seda.event.AbstractSubscriber ;
-import org.apache.seda.stage.LoggingStageMonitor ;
-import org.apache.seda.event.DisconnectSubscriber ;
-import org.apache.seda.output.LoggingOutputMonitor ;
-import org.apache.seda.listener.KeyExpiryException ;
-import org.apache.eve.seda.DefaultStageConfig;
-import org.apache.eve.seda.LoggingStageMonitor;
-import org.apache.eve.seda.DefaultStage;
-import org.apache.eve.event.AbstractSubscriber;
-
-
-/**
- * The default OutputManager implementation.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultOutputManager extends DefaultStage
- implements
- OutputManager,
- OutputSubscriber,
- ConnectSubscriber,
- DisconnectSubscriber
-{
- /** the router we subscribe for OutputEvents on */
- private final EventRouter router ;
- /** the monitor used to track notable events in this OutputManager */
- private OutputMonitor monitor ;
- /** a map of channels by ClientKey */
- private Map channels = new HashMap() ;
-
-
- // ------------------------------------------------------------------------
- // constructors
- // ------------------------------------------------------------------------
-
-
- /**
- * Creates a defualt OutputManager.
- *
- * @param router the router we subscribe for OutputEvents on
- * @param config the configuration for this Stage
- */
- public DefaultOutputManager( EventRouter router, DefaultStageConfig config
)
- {
- super( config ) ;
- this.router = router ;
- this.router.subscribe( OutputEvent.class, this ) ;
- this.router.subscribe( ConnectEvent.class, this ) ;
- this.router.subscribe( DisconnectEvent.class, this ) ;
- config.setHandler( new OutputStageHandler() ) ;
- this.setMonitor( new LoggingStageMonitor() ) ;
- this.setOutputMonitor( new LoggingOutputMonitor() ) ;
- }
-
-
- // ------------------------------------------------------------------------
- // subscriber inform methods
- // ------------------------------------------------------------------------
-
-
- /*
- * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
- */
- public void inform( EventObject event )
- {
- try
- {
- AbstractSubscriber.inform( this, event ) ;
- }
- catch( Throwable t )
- {
- monitor.failedOnInform( this, event, t ) ;
- }
- }
-
-
- /*
- * @see org.apache.seda.event.OutputSubscriber#inform(
- * org.apache.seda.event.OutputEvent)
- */
- public void inform( OutputEvent event )
- {
- enqueue( event ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.event.ConnectSubscriber#inform(
- * org.apache.seda.event.ConnectEvent)
- */
- public void inform( ConnectEvent event )
- {
- ClientKey key = event.getClientKey() ;
-
- try
- {
- channels.put( key, key.getSocket().getChannel() ) ;
- }
- catch( KeyExpiryException e )
- {
- monitor.keyExpired( this, key, e ) ;
- }
-
- monitor.addedClient( this, event ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.event.DisconnectSubscriber#inform(
- * org.apache.seda.event.DisconnectEvent)
- */
- public void inform( DisconnectEvent event )
- {
- channels.remove( event.getClientKey() ) ;
- monitor.removedClient( this, event ) ;
- }
-
-
- // ------------------------------------------------------------------------
- // OutputManager method
- // ------------------------------------------------------------------------
-
-
- /*
- * (non-Javadoc)
- * @see org.apache.seda.output.OutputManager#write(
- * org.apache.seda.listener.ClientKey, java.nio.ByteBuffer)
- */
- public void write( ClientKey key, ByteBuffer buf )
- throws IOException
- {
- Object lock = null ;
- SocketChannel channel = ( SocketChannel ) channels.get( key ) ;
-
- if ( null == channel )
- {
- monitor.channelMissing( this, key ) ;
- return ;
- }
-
- // Obtain output lock for write to client.
- try
- {
- lock = key.getOutputLock() ;
- }
- catch ( KeyExpiryException e )
- {
- monitor.keyExpired( this, key, e ) ;
- return ;
- }
-
- // synchronize on client output stream lock object.
- synchronized( lock )
- {
- monitor.writeLockAcquired( this, key ) ;
- channel.write( buf ) ;
- lock.notifyAll() ;
- }
-
- monitor.writeOccurred( this, key ) ;
- }
-
-
- /**
- * Sets the output manager's monitor.
- *
- * @param monitor the monitor used by this output manager
- */
- public void setOutputMonitor( OutputMonitor monitor )
- {
- this.monitor = monitor ;
- }
-
-
- /**
- * EventHandler designed for processing output events.
- */
- class OutputStageHandler implements StageHandler
- {
- public void handleEvent( EventObject generic )
- {
- if ( generic instanceof OutputEvent )
- {
- OutputEvent event = ( OutputEvent ) generic ;
-
- try
- {
- write( event.getClientKey(), event.getBuffer() ) ;
- }
- catch ( IOException e )
- {
- monitor.failedOnWrite( DefaultOutputManager.this,
- event.getClientKey(), e ) ;
- }
- }
- }
- }
-}
+/*
+ * 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.output ;
+
+
+import java.io.IOException ;
+
+import java.nio.ByteBuffer ;
+import java.nio.channels.SocketChannel ;
+
+import java.util.Map ;
+import java.util.HashMap ;
+import java.util.EventObject ;
+
+import org.apache.seda.event.EventRouter ;
+import org.apache.seda.event.OutputEvent ;
+import org.apache.seda.stage.DefaultStage ;
+import org.apache.seda.stage.StageHandler ;
+import org.apache.seda.listener.ClientKey ;
+import org.apache.seda.event.ConnectEvent ;
+import org.apache.seda.output.OutputManager ;
+import org.apache.seda.output.OutputMonitor ;
+import org.apache.seda.event.DisconnectEvent ;
+import org.apache.seda.event.OutputSubscriber ;
+import org.apache.seda.event.ConnectSubscriber ;
+import org.apache.seda.stage.DefaultStageConfig ;
+import org.apache.seda.event.AbstractSubscriber ;
+import org.apache.seda.stage.LoggingStageMonitor ;
+import org.apache.seda.event.DisconnectSubscriber ;
+import org.apache.seda.output.LoggingOutputMonitor ;
+import org.apache.seda.listener.KeyExpiryException ;
+import org.apache.seda.seda.DefaultStageConfig;
+import org.apache.seda.seda.LoggingStageMonitor;
+import org.apache.seda.seda.DefaultStage;
+import org.apache.seda.event.AbstractSubscriber;
+
+
+/**
+ * The default OutputManager implementation.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultOutputManager extends DefaultStage
+ implements
+ OutputManager,
+ OutputSubscriber,
+ ConnectSubscriber,
+ DisconnectSubscriber
+{
+ /** the router we subscribe for OutputEvents on */
+ private final EventRouter router ;
+ /** the monitor used to track notable events in this OutputManager */
+ private OutputMonitor monitor ;
+ /** a map of channels by ClientKey */
+ private Map channels = new HashMap() ;
+
+
+ // ------------------------------------------------------------------------
+ // constructors
+ // ------------------------------------------------------------------------
+
+
+ /**
+ * Creates a defualt OutputManager.
+ *
+ * @param router the router we subscribe for OutputEvents on
+ * @param config the configuration for this Stage
+ */
+ public DefaultOutputManager( EventRouter router, DefaultStageConfig config
)
+ {
+ super( config ) ;
+ this.router = router ;
+ this.router.subscribe( OutputEvent.class, this ) ;
+ this.router.subscribe( ConnectEvent.class, this ) ;
+ this.router.subscribe( DisconnectEvent.class, this ) ;
+ config.setHandler( new OutputStageHandler() ) ;
+ this.setMonitor( new LoggingStageMonitor() ) ;
+ this.setOutputMonitor( new LoggingOutputMonitor() ) ;
+ }
+
+
+ // ------------------------------------------------------------------------
+ // subscriber inform methods
+ // ------------------------------------------------------------------------
+
+
+ /*
+ * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
+ */
+ public void inform( EventObject event )
+ {
+ try
+ {
+ AbstractSubscriber.inform( this, event ) ;
+ }
+ catch( Throwable t )
+ {
+ monitor.failedOnInform( this, event, t ) ;
+ }
+ }
+
+
+ /*
+ * @see org.apache.seda.event.OutputSubscriber#inform(
+ * org.apache.seda.event.OutputEvent)
+ */
+ public void inform( OutputEvent event )
+ {
+ enqueue( event ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.event.ConnectSubscriber#inform(
+ * org.apache.seda.event.ConnectEvent)
+ */
+ public void inform( ConnectEvent event )
+ {
+ ClientKey key = event.getClientKey() ;
+
+ try
+ {
+ channels.put( key, key.getSocket().getChannel() ) ;
+ }
+ catch( KeyExpiryException e )
+ {
+ monitor.keyExpired( this, key, e ) ;
+ }
+
+ monitor.addedClient( this, event ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.event.DisconnectSubscriber#inform(
+ * org.apache.seda.event.DisconnectEvent)
+ */
+ public void inform( DisconnectEvent event )
+ {
+ channels.remove( event.getClientKey() ) ;
+ monitor.removedClient( this, event ) ;
+ }
+
+
+ // ------------------------------------------------------------------------
+ // OutputManager method
+ // ------------------------------------------------------------------------
+
+
+ /*
+ * (non-Javadoc)
+ * @see org.apache.seda.output.OutputManager#write(
+ * org.apache.seda.listener.ClientKey, java.nio.ByteBuffer)
+ */
+ public void write( ClientKey key, ByteBuffer buf )
+ throws IOException
+ {
+ Object lock = null ;
+ SocketChannel channel = ( SocketChannel ) channels.get( key ) ;
+
+ if ( null == channel )
+ {
+ monitor.channelMissing( this, key ) ;
+ return ;
+ }
+
+ // Obtain output lock for write to client.
+ try
+ {
+ lock = key.getOutputLock() ;
+ }
+ catch ( KeyExpiryException e )
+ {
+ monitor.keyExpired( this, key, e ) ;
+ return ;
+ }
+
+ // synchronize on client output stream lock object.
+ synchronized( lock )
+ {
+ monitor.writeLockAcquired( this, key ) ;
+ channel.write( buf ) ;
+ lock.notifyAll() ;
+ }
+
+ monitor.writeOccurred( this, key ) ;
+ }
+
+
+ /**
+ * Sets the output manager's monitor.
+ *
+ * @param monitor the monitor used by this output manager
+ */
+ public void setOutputMonitor( OutputMonitor monitor )
+ {
+ this.monitor = monitor ;
+ }
+
+
+ /**
+ * EventHandler designed for processing output events.
+ */
+ class OutputStageHandler implements StageHandler
+ {
+ public void handleEvent( EventObject generic )
+ {
+ if ( generic instanceof OutputEvent )
+ {
+ OutputEvent event = ( OutputEvent ) generic ;
+
+ try
+ {
+ write( event.getClientKey(), event.getBuffer() ) ;
+ }
+ catch ( IOException e )
+ {
+ monitor.failedOnWrite( DefaultOutputManager.this,
+ event.getClientKey(), e ) ;
+ }
+ }
+ }
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/LoggingOutputMonitor.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/output/LoggingOutputMonitor.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/LoggingOutputMonitor.java
Sun Sep 5 21:13:34 2004
@@ -1,158 +1,158 @@
-/*
- * 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.output ;
-
-
-import java.util.EventObject ;
-
-import org.apache.commons.logging.Log ;
-import org.apache.commons.logging.LogFactory ;
-import org.apache.commons.lang.exception.ExceptionUtils ;
-
-import org.apache.seda.event.ConnectEvent ;
-import org.apache.seda.listener.ClientKey ;
-import org.apache.seda.event.DisconnectEvent ;
-import org.apache.seda.listener.KeyExpiryException ;
-import org.apache.seda.output.OutputMonitor;
-import org.apache.seda.output.OutputManager;
-
-
-/**
- * A logging monitor for any OutputManager.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class LoggingOutputMonitor implements OutputMonitor
-{
- private final Log log = LogFactory.getLog( "OutputManager" ) ;
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#failedOnWrite(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey,
- * java.lang.Throwable)
- */
- public void failedOnWrite( OutputManager manager, ClientKey key,
- Throwable t )
- {
- if ( log.isErrorEnabled() )
- {
- log.error( manager + " failed while trying to write to client "
- + key + ":\n"
- + ExceptionUtils.getFullStackTrace( t ) ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#writeOccurred(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
- */
- public void writeOccurred( OutputManager manager, ClientKey key )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( manager + " wrote to client " + key ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#writeLockAcquired(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
- */
- public void writeLockAcquired( OutputManager manager, ClientKey key )
- {
- if ( log.isTraceEnabled() )
- {
- log.trace( manager + " locked channel for client " + key ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#channelMissing(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
- */
- public void channelMissing( OutputManager manager, ClientKey key )
- {
- if ( log.isWarnEnabled() )
- {
- log.warn( manager + " could not find channel for client " + key ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#keyExpired(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey,
- * org.apache.seda.listener.KeyExpiryException)
- */
- public void keyExpired( OutputManager manager, ClientKey key,
- KeyExpiryException e )
- {
- if ( log.isWarnEnabled() )
- {
- log.warn( manager + " cannot use expired key for client " + key
- + ":\n" + ExceptionUtils.getFullStackTrace( e ) ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#failedOnInform(
- * org.apache.seda.output.OutputManager, java.util.EventObject,
- * java.lang.Throwable)
- */
- public void failedOnInform( OutputManager manager, EventObject event,
- Throwable fault
)
- {
- if ( log.isErrorEnabled() )
- {
- log.error( manager + " failed to be informed of " + event ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#addedClient(
- * org.apache.seda.output.OutputManager,
org.apache.seda.event.ConnectEvent)
- */
- public void addedClient( OutputManager manager, ConnectEvent event )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( manager + " added client " + event.getClientKey() ) ;
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#removedClient(
- * org.apache.seda.output.OutputManager,
- * org.apache.seda.event.DisconnectEvent)
- */
- public void removedClient( OutputManager manager, DisconnectEvent event )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( manager + " removed client " + event.getClientKey() ) ;
- }
- }
-}
+/*
+ * 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.output ;
+
+
+import java.util.EventObject ;
+
+import org.apache.commons.logging.Log ;
+import org.apache.commons.logging.LogFactory ;
+import org.apache.commons.lang.exception.ExceptionUtils ;
+
+import org.apache.seda.event.ConnectEvent ;
+import org.apache.seda.listener.ClientKey ;
+import org.apache.seda.event.DisconnectEvent ;
+import org.apache.seda.listener.KeyExpiryException ;
+import org.apache.seda.output.OutputMonitor;
+import org.apache.seda.output.OutputManager;
+
+
+/**
+ * A logging monitor for any OutputManager.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class LoggingOutputMonitor implements OutputMonitor
+{
+ private final Log log = LogFactory.getLog( "OutputManager" ) ;
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#failedOnWrite(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey,
+ * java.lang.Throwable)
+ */
+ public void failedOnWrite( OutputManager manager, ClientKey key,
+ Throwable t )
+ {
+ if ( log.isErrorEnabled() )
+ {
+ log.error( manager + " failed while trying to write to client "
+ + key + ":\n"
+ + ExceptionUtils.getFullStackTrace( t ) ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#writeOccurred(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
+ */
+ public void writeOccurred( OutputManager manager, ClientKey key )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( manager + " wrote to client " + key ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#writeLockAcquired(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
+ */
+ public void writeLockAcquired( OutputManager manager, ClientKey key )
+ {
+ if ( log.isTraceEnabled() )
+ {
+ log.trace( manager + " locked channel for client " + key ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#channelMissing(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
+ */
+ public void channelMissing( OutputManager manager, ClientKey key )
+ {
+ if ( log.isWarnEnabled() )
+ {
+ log.warn( manager + " could not find channel for client " + key ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#keyExpired(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey,
+ * org.apache.seda.listener.KeyExpiryException)
+ */
+ public void keyExpired( OutputManager manager, ClientKey key,
+ KeyExpiryException e )
+ {
+ if ( log.isWarnEnabled() )
+ {
+ log.warn( manager + " cannot use expired key for client " + key
+ + ":\n" + ExceptionUtils.getFullStackTrace( e ) ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#failedOnInform(
+ * org.apache.seda.output.OutputManager, java.util.EventObject,
+ * java.lang.Throwable)
+ */
+ public void failedOnInform( OutputManager manager, EventObject event,
+ Throwable fault
)
+ {
+ if ( log.isErrorEnabled() )
+ {
+ log.error( manager + " failed to be informed of " + event ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#addedClient(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.event.ConnectEvent)
+ */
+ public void addedClient( OutputManager manager, ConnectEvent event )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( manager + " added client " + event.getClientKey() ) ;
+ }
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#removedClient(
+ * org.apache.seda.output.OutputManager,
+ * org.apache.seda.event.DisconnectEvent)
+ */
+ public void removedClient( OutputManager manager, DisconnectEvent event )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( manager + " removed client " + event.getClientKey() ) ;
+ }
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/OutputMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/output/OutputMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/output/OutputMonitorAdapter.java
Sun Sep 5 21:13:34 2004
@@ -1,127 +1,127 @@
-/*
- * 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.output ;
-
-
-import java.util.EventObject ;
-
-import org.apache.commons.lang.exception.ExceptionUtils ;
-
-import org.apache.seda.event.ConnectEvent ;
-import org.apache.seda.listener.ClientKey ;
-import org.apache.seda.event.DisconnectEvent ;
-import org.apache.seda.listener.KeyExpiryException ;
-import org.apache.seda.output.OutputMonitor;
-import org.apache.seda.output.OutputManager;
-
-
-/**
- * A do nothing output monitor adapter. For safety's sake error conditions are
- * printed to the console.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class OutputMonitorAdapter implements OutputMonitor
-{
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#
- * failedOnWrite(org.apache.seda.output.OutputManager,
- * org.apache.seda.listener.ClientKey, java.lang.Throwable)
- */
- public void failedOnWrite( OutputManager manager, ClientKey key,
- Throwable t )
- {
- System.err.println( "Failed on write to client " + key + ":\n"
- + ExceptionUtils.getFullStackTrace( t ) ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#writeOccurred(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
- */
- public void writeOccurred( OutputManager manager, ClientKey key )
- {
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#writeLockAcquired(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
- */
- public void writeLockAcquired( OutputManager manager, ClientKey key )
- {
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#channelMissing(
- * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
- */
- public void channelMissing( OutputManager manager, ClientKey key )
- {
- System.err.println( "Channel for client " + key + " missing." ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#keyExpired(
- * org.apache.seda.output.OutputManager,
- * org.apache.seda.listener.KeyExpiryException)
- */
- public void keyExpired( OutputManager manager, ClientKey key,
- KeyExpiryException e )
- {
- System.err.println( "Key for client " + key + ":\n"
- + ExceptionUtils.getFullStackTrace( e ) ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#failedOnInform(
- * org.apache.seda.output.OutputManager, java.util.EventObject,
- * java.lang.Throwable)
- */
- public void failedOnInform( OutputManager manager, EventObject event,
- Throwable fault )
- {
- System.err.println( "Failed to inform of " + event + ":\n"
- + ExceptionUtils.getFullStackTrace( fault ) ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#addedClient(
- * org.apache.seda.output.OutputManager,
org.apache.seda.event.ConnectEvent)
- */
- public void addedClient( OutputManager manager, ConnectEvent event )
- {
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.seda.output.OutputMonitor#removedClient(
- * org.apache.seda.output.OutputManager,
- * org.apache.seda.event.DisconnectEvent)
- */
- public void removedClient( OutputManager manager, DisconnectEvent event )
- {
- }
-}
+/*
+ * 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.output ;
+
+
+import java.util.EventObject ;
+
+import org.apache.commons.lang.exception.ExceptionUtils ;
+
+import org.apache.seda.event.ConnectEvent ;
+import org.apache.seda.listener.ClientKey ;
+import org.apache.seda.event.DisconnectEvent ;
+import org.apache.seda.listener.KeyExpiryException ;
+import org.apache.seda.output.OutputMonitor;
+import org.apache.seda.output.OutputManager;
+
+
+/**
+ * A do nothing output monitor adapter. For safety's sake error conditions are
+ * printed to the console.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class OutputMonitorAdapter implements OutputMonitor
+{
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#
+ * failedOnWrite(org.apache.seda.output.OutputManager,
+ * org.apache.seda.listener.ClientKey, java.lang.Throwable)
+ */
+ public void failedOnWrite( OutputManager manager, ClientKey key,
+ Throwable t )
+ {
+ System.err.println( "Failed on write to client " + key + ":\n"
+ + ExceptionUtils.getFullStackTrace( t ) ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#writeOccurred(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
+ */
+ public void writeOccurred( OutputManager manager, ClientKey key )
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#writeLockAcquired(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
+ */
+ public void writeLockAcquired( OutputManager manager, ClientKey key )
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#channelMissing(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.listener.ClientKey)
+ */
+ public void channelMissing( OutputManager manager, ClientKey key )
+ {
+ System.err.println( "Channel for client " + key + " missing." ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#keyExpired(
+ * org.apache.seda.output.OutputManager,
+ * org.apache.seda.listener.KeyExpiryException)
+ */
+ public void keyExpired( OutputManager manager, ClientKey key,
+ KeyExpiryException e )
+ {
+ System.err.println( "Key for client " + key + ":\n"
+ + ExceptionUtils.getFullStackTrace( e ) ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#failedOnInform(
+ * org.apache.seda.output.OutputManager, java.util.EventObject,
+ * java.lang.Throwable)
+ */
+ public void failedOnInform( OutputManager manager, EventObject event,
+ Throwable fault )
+ {
+ System.err.println( "Failed to inform of " + event + ":\n"
+ + ExceptionUtils.getFullStackTrace( fault ) ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#addedClient(
+ * org.apache.seda.output.OutputManager,
org.apache.seda.event.ConnectEvent)
+ */
+ public void addedClient( OutputManager manager, ConnectEvent event )
+ {
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.output.OutputMonitor#removedClient(
+ * org.apache.seda.output.OutputManager,
+ * org.apache.seda.event.DisconnectEvent)
+ */
+ public void removedClient( OutputManager manager, DisconnectEvent event )
+ {
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/DefaultRequestProcessor.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/processor/DefaultRequestProcessor.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/DefaultRequestProcessor.java
Sun Sep 5 21:13:34 2004
@@ -1,224 +1,224 @@
-/*
- * 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.processor ;
-
-
-import java.util.Iterator ;
-import java.util.EventObject ;
-
-import org.apache.commons.lang.NotImplementedException;
-
-import org.apache.eve.event.EventRouter ;
-import org.apache.eve.event.RequestEvent ;
-import org.apache.eve.event.ResponseEvent ;
-import org.apache.eve.event.RequestSubscriber ;
-import org.apache.eve.event.AbstractSubscriber ;
-
-import org.apache.eve.listener.ClientKey ;
-
-import org.apache.eve.seda.StageConfig ;
-import org.apache.eve.seda.DefaultStage ;
-import org.apache.eve.seda.StageHandler ;
-import org.apache.eve.seda.DefaultStageConfig ;
-import org.apache.eve.seda.LoggingStageMonitor;
-import org.apache.eve.protocol.*;
-
-
-/**
- * Default RequestProcessor service implemented as a POJO.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultRequestProcessor extends DefaultStage
- implements RequestProcessor, RequestSubscriber
-{
- private final EventRouter router ;
- private RequestProcessorMonitor monitor = null ;
-
-
- /**
- * Creates a default RequestProcessor.
- *
- * @param router the event router we subscribe and publish to
- * @param config the configuration for this stage
- */
- public DefaultRequestProcessor( EventRouter router, StageConfig config )
- {
- super( config ) ;
-
- DefaultStageConfig defaultConfig = ( DefaultStageConfig ) config ;
- defaultConfig.setHandler( new ProcessorStageHandler() ) ;
- super.setMonitor( new LoggingStageMonitor( getClass() ) ) ;
-
- this.router = router ;
- this.router.subscribe( RequestEvent.class, this ) ;
- this.monitor = new RequestProcessorMonitorAdapter() ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.event.RequestSubscriber#inform(
- * org.apache.eve.event.RequestEvent)
- */
- public void inform( RequestEvent event )
- {
- enqueue( event ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.event.Subscriber#inform(java.util.EventObject)
- */
- public void inform( EventObject event )
- {
- try
- {
- AbstractSubscriber.inform( this, event ) ;
- }
- catch ( Throwable t )
- {
- monitor.failedOnInform( this, event, t ) ;
- }
- }
-
-
- class ProcessorStageHandler implements StageHandler
- {
- /**
- * Event handler method for processing RequestEvents.
- *
- * @param nonspecific the RequestEvent to process.
- */
- public void handleEvent( EventObject nonspecific )
- {
- RequestEvent event = ( RequestEvent ) nonspecific ;
- ClientKey key = event.getClientKey() ;
-
- RequestHandler handler = getProtocolHandler( event.getClientKey(),
- event.getRequest() );
-
- switch( handler.getHandlerType().getValue() )
- {
- case( HandlerTypeEnum.NOREPLY_VAL ):
- NoReplyHandler noreply = ( NoReplyHandler ) handler ;
- noreply.handle( event.getRequest() ) ;
- break ;
- case( HandlerTypeEnum.SINGLEREPLY_VAL ):
- SingleReplyHandler single = ( SingleReplyHandler ) handler ;
- reply( single, event.getRequest(), key ) ;
- break ;
- case( HandlerTypeEnum.MANYREPLY_VAL ):
- ManyReplyHandler many = ( ManyReplyHandler ) handler ;
- reply( many, event.getRequest(), key ) ;
- break ;
- default:
- throw new IllegalArgumentException(
- "Unrecognized handler type: "
- + handler.getHandlerType() ) ;
- }
- }
- }
-
-
- private RequestHandler getProtocolHandler( ClientKey key, Object request )
- {
- if ( key == null || request == null )
- {
- throw new NullPointerException(
- "both key and request must not be null" );
- }
- throw new NotImplementedException( "need mech to acquire handler" );
- }
-
-
- /**
- * Handles the generation and return of multiple responses.
- *
- * @param handler the handler that generates the responses
- * @param request the request responded to
- */
- private void reply( ManyReplyHandler handler,
- Object request,
- ClientKey key )
- {
- Object response = null ;
-
- try
- {
- Iterator list = handler.handle( request ) ;
-
- if ( handler.isSequential() )
- {
- while ( list.hasNext() )
- {
- response = list.next() ;
-
- // @todo: need to force serialized response processing
- // perhaps we need to add an isResponseOrdered or a
- // response sequence number for multi-part responses
-
- throw new NotImplementedException(
- "need response serialization" );
- }
- }
- else
- {
- while ( list.hasNext() )
- {
- response = list.next() ;
- router.publish( new ResponseEvent( this, key, response )
);
- }
- }
- }
-
- catch( Throwable t )
- {
- monitor.failedOnSingleReply( key, request, t ) ;
- }
- }
-
-
- /**
- * Handles the generation and return of a single response.
- *
- * @param handler the handler that generates the single response
- * @param request the request responded to
- */
- private void reply( SingleReplyHandler handler, Object request,
- ClientKey key )
- {
- Object response = null ;
-
- try
- {
- response = handler.handle( request ) ;
- }
-
- // If the individual handlers do not do a global catch and report this
- // will sheild the server from complete failure on a request reporting
- // at a minimum the stack trace that cause the request to fail.
- catch( Throwable t )
- {
- monitor.failedOnSingleReply( key, request, t ) ;
- return;
- }
-
- router.publish( new ResponseEvent( this, key, response ) ) ;
- }
-}
+/*
+ * 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.processor ;
+
+
+import java.util.Iterator ;
+import java.util.EventObject ;
+
+import org.apache.commons.lang.NotImplementedException;
+
+import org.apache.seda.event.EventRouter ;
+import org.apache.seda.event.RequestEvent ;
+import org.apache.seda.event.ResponseEvent ;
+import org.apache.seda.event.RequestSubscriber ;
+import org.apache.seda.event.AbstractSubscriber ;
+
+import org.apache.seda.listener.ClientKey ;
+
+import org.apache.seda.seda.StageConfig ;
+import org.apache.seda.seda.DefaultStage ;
+import org.apache.seda.seda.StageHandler ;
+import org.apache.seda.seda.DefaultStageConfig ;
+import org.apache.seda.seda.LoggingStageMonitor;
+import org.apache.seda.protocol.*;
+
+
+/**
+ * Default RequestProcessor service implemented as a POJO.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultRequestProcessor extends DefaultStage
+ implements RequestProcessor, RequestSubscriber
+{
+ private final EventRouter router ;
+ private RequestProcessorMonitor monitor = null ;
+
+
+ /**
+ * Creates a default RequestProcessor.
+ *
+ * @param router the event router we subscribe and publish to
+ * @param config the configuration for this stage
+ */
+ public DefaultRequestProcessor( EventRouter router, StageConfig config )
+ {
+ super( config ) ;
+
+ DefaultStageConfig defaultConfig = ( DefaultStageConfig ) config ;
+ defaultConfig.setHandler( new ProcessorStageHandler() ) ;
+ super.setMonitor( new LoggingStageMonitor( getClass() ) ) ;
+
+ this.router = router ;
+ this.router.subscribe( RequestEvent.class, this ) ;
+ this.monitor = new RequestProcessorMonitorAdapter() ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.event.RequestSubscriber#inform(
+ * org.apache.seda.event.RequestEvent)
+ */
+ public void inform( RequestEvent event )
+ {
+ enqueue( event ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
+ */
+ public void inform( EventObject event )
+ {
+ try
+ {
+ AbstractSubscriber.inform( this, event ) ;
+ }
+ catch ( Throwable t )
+ {
+ monitor.failedOnInform( this, event, t ) ;
+ }
+ }
+
+
+ class ProcessorStageHandler implements StageHandler
+ {
+ /**
+ * Event handler method for processing RequestEvents.
+ *
+ * @param nonspecific the RequestEvent to process.
+ */
+ public void handleEvent( EventObject nonspecific )
+ {
+ RequestEvent event = ( RequestEvent ) nonspecific ;
+ ClientKey key = event.getClientKey() ;
+
+ RequestHandler handler = getProtocolHandler( event.getClientKey(),
+ event.getRequest() );
+
+ switch( handler.getHandlerType().getValue() )
+ {
+ case( HandlerTypeEnum.NOREPLY_VAL ):
+ NoReplyHandler noreply = ( NoReplyHandler ) handler ;
+ noreply.handle( event.getRequest() ) ;
+ break ;
+ case( HandlerTypeEnum.SINGLEREPLY_VAL ):
+ SingleReplyHandler single = ( SingleReplyHandler ) handler ;
+ reply( single, event.getRequest(), key ) ;
+ break ;
+ case( HandlerTypeEnum.MANYREPLY_VAL ):
+ ManyReplyHandler many = ( ManyReplyHandler ) handler ;
+ reply( many, event.getRequest(), key ) ;
+ break ;
+ default:
+ throw new IllegalArgumentException(
+ "Unrecognized handler type: "
+ + handler.getHandlerType() ) ;
+ }
+ }
+ }
+
+
+ private RequestHandler getProtocolHandler( ClientKey key, Object request )
+ {
+ if ( key == null || request == null )
+ {
+ throw new NullPointerException(
+ "both key and request must not be null" );
+ }
+ throw new NotImplementedException( "need mech to acquire handler" );
+ }
+
+
+ /**
+ * Handles the generation and return of multiple responses.
+ *
+ * @param handler the handler that generates the responses
+ * @param request the request responded to
+ */
+ private void reply( ManyReplyHandler handler,
+ Object request,
+ ClientKey key )
+ {
+ Object response = null ;
+
+ try
+ {
+ Iterator list = handler.handle( request ) ;
+
+ if ( handler.isSequential() )
+ {
+ while ( list.hasNext() )
+ {
+ response = list.next() ;
+
+ // @todo: need to force serialized response processing
+ // perhaps we need to add an isResponseOrdered or a
+ // response sequence number for multi-part responses
+
+ throw new NotImplementedException(
+ "need response serialization" );
+ }
+ }
+ else
+ {
+ while ( list.hasNext() )
+ {
+ response = list.next() ;
+ router.publish( new ResponseEvent( this, key, response )
);
+ }
+ }
+ }
+
+ catch( Throwable t )
+ {
+ monitor.failedOnSingleReply( key, request, t ) ;
+ }
+ }
+
+
+ /**
+ * Handles the generation and return of a single response.
+ *
+ * @param handler the handler that generates the single response
+ * @param request the request responded to
+ */
+ private void reply( SingleReplyHandler handler, Object request,
+ ClientKey key )
+ {
+ Object response = null ;
+
+ try
+ {
+ response = handler.handle( request ) ;
+ }
+
+ // If the individual handlers do not do a global catch and report this
+ // will sheild the server from complete failure on a request reporting
+ // at a minimum the stack trace that cause the request to fail.
+ catch( Throwable t )
+ {
+ monitor.failedOnSingleReply( key, request, t ) ;
+ return;
+ }
+
+ router.publish( new ResponseEvent( this, key, response ) ) ;
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/RequestHandler.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/processor/RequestHandler.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/RequestHandler.java
Sun Sep 5 21:13:34 2004
@@ -1,37 +1,37 @@
-/*
- * 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.processor ;
-
-import org.apache.eve.protocol.HandlerTypeEnum;
-
-
-/**
- * Root of all request handler types.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public interface RequestHandler
-{
- /**
- * Gets the handler type.
- *
- * @return a HandlerTypeEnum constant.
- */
- HandlerTypeEnum getHandlerType() ;
-}
+/*
+ * 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.processor ;
+
+import org.apache.seda.protocol.HandlerTypeEnum;
+
+
+/**
+ * Root of all request handler types.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface RequestHandler
+{
+ /**
+ * Gets the handler type.
+ *
+ * @return a HandlerTypeEnum constant.
+ */
+ HandlerTypeEnum getHandlerType() ;
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/RequestProcessorMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/processor/RequestProcessorMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/processor/RequestProcessorMonitorAdapter.java
Sun Sep 5 21:13:34 2004
@@ -1,71 +1,71 @@
-/*
- * 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.processor ;
-
-
-import java.util.EventObject ;
-
-import org.apache.commons.lang.exception.ExceptionUtils ;
-
-import org.apache.eve.event.Subscriber ;
-import org.apache.eve.listener.ClientKey ;
-import org.apache.eve.protocol.RequestProcessorMonitor;
-
-
-/**
- * A convenient adapter for request processors monitors. Exceptional
conditions
- * are transformed into and reported as runtime exceptions.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class RequestProcessorMonitorAdapter implements RequestProcessorMonitor
-{
-
- /* @see org.apache.eve.protocol.RequestProcessorMonitor#failedOnInform(
- * org.apache.eve.event.Subscriber, java.util.EventObject,
- * java.lang.Throwable)
- */
- public void failedOnInform( Subscriber subscriber, EventObject event,
- Throwable t )
- {
- System.err.println( ExceptionUtils.getFullStackTrace( t ) ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.protocol.RequestProcessorMonitor#failedOnSingleReply
- * (org.apache.eve.listener.ClientKey,
- * org.apache.ldap.common.message.Request, java.lang.Throwable)
- */
- public void failedOnSingleReply( ClientKey key, Object request,
- Throwable t )
- {
- // @todo We should be able to email this or even post it to JIRA.
- // if some of error reporting configuration parameters are set. Or
- // perhaps this is something best left to a logger customization.
-
- StringBuffer buf = new StringBuffer() ;
- buf.append( "Encountered an operational error while processing " ) ;
- buf.append( request ) ;
- buf.append( " request. Please report the the following server stack" );
- buf.append( " trace to the Apache Directory Project.\n" ) ;
- System.err.println( buf.toString() ) ;
- t.printStackTrace();
- }
-}
+/*
+ * 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.processor ;
+
+
+import java.util.EventObject ;
+
+import org.apache.commons.lang.exception.ExceptionUtils ;
+
+import org.apache.seda.event.Subscriber ;
+import org.apache.seda.listener.ClientKey ;
+import org.apache.seda.protocol.RequestProcessorMonitor;
+
+
+/**
+ * A convenient adapter for request processors monitors. Exceptional
conditions
+ * are transformed into and reported as runtime exceptions.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class RequestProcessorMonitorAdapter implements RequestProcessorMonitor
+{
+
+ /* @see org.apache.seda.protocol.RequestProcessorMonitor#failedOnInform(
+ * org.apache.seda.event.Subscriber, java.util.EventObject,
+ * java.lang.Throwable)
+ */
+ public void failedOnInform( Subscriber subscriber, EventObject event,
+ Throwable t )
+ {
+ System.err.println( ExceptionUtils.getFullStackTrace( t ) ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see
org.apache.seda.protocol.RequestProcessorMonitor#failedOnSingleReply
+ * (org.apache.seda.listener.ClientKey,
+ * org.apache.ldap.common.message.Request, java.lang.Throwable)
+ */
+ public void failedOnSingleReply( ClientKey key, Object request,
+ Throwable t )
+ {
+ // @todo We should be able to email this or even post it to JIRA.
+ // if some of error reporting configuration parameters are set. Or
+ // perhaps this is something best left to a logger customization.
+
+ StringBuffer buf = new StringBuffer() ;
+ buf.append( "Encountered an operational error while processing " ) ;
+ buf.append( request ) ;
+ buf.append( " request. Please report the the following server stack" );
+ buf.append( " trace to the Apache Directory Project.\n" ) ;
+ System.err.println( buf.toString() ) ;
+ t.printStackTrace();
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/DefaultStage.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/seda/DefaultStage.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/DefaultStage.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.seda ;
+package org.apache.seda.seda ;
import org.apache.seda.stage.Stage;
@@ -83,7 +83,7 @@
/**
* @see org.apache.seda.stage.Stage#addPredicate(
* org.apache.seda.stage.EnqueuePredicate)
- * addPredicate(org.apache.eve.seda.EnqueuePredicate)
+ * addPredicate(org.apache.seda.seda.EnqueuePredicate)
*/
public void addPredicate( EnqueuePredicate predicate )
{
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/DefaultStageConfig.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/seda/DefaultStageConfig.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/DefaultStageConfig.java
Sun Sep 5 21:13:34 2004
@@ -1,137 +1,137 @@
-/*
- * 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.seda ;
-
-
-import java.util.List ;
-import java.util.ArrayList ;
-
-import org.apache.eve.thread.ThreadPool ;
-
-
-/**
- * The default bean implementation for a stage's configuration.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultStageConfig implements StageConfig
-{
- /** the name of this Stage */
- private final String name ;
- /** this Stage's handler */
- private StageHandler handler ;
- /** the enqueue predicates for this Stage */
- private final List predicates ;
- /** the thread pool used for this Stages workers */
- private final ThreadPool tp ;
-
-
- /**
- * Creates a default stage configuration bean.
- *
- * @param name the name of this Stage
- * @param handler this Stage's handler
- * @param predicates the enqueue predicates for this Stage
- * @param tp the thread pool used for this Stages workers
- */
- public DefaultStageConfig( String name, StageHandler handler,
- List predicates, ThreadPool tp )
- {
- this.tp = tp ;
- this.name = name ;
- this.handler = handler ;
-
- if ( predicates == null )
- {
- this.predicates = new ArrayList() ;
- }
- else
- {
- this.predicates = predicates ;
- }
- }
-
-
- /**
- * Creates a default stage configuration bean.
- *
- * @param name the name of this Stage
- * @param handler this Stage's handler
- * @param predicates the enqueue predicates for this Stage
- * @param tp the thread pool used for this Stages workers
- */
- public DefaultStageConfig( String name, List predicates, ThreadPool tp )
- {
- this( name, null, predicates, tp ) ;
- }
-
-
- /**
- * Creates a default stage configuration bean.
- *
- * @param name the name of this Stage
- * @param tp the thread pool used for this Stage's workers
- */
- public DefaultStageConfig( String name, ThreadPool tp )
- {
- this( name, null, null, tp ) ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.seda.StageConfig#getName()
- */
- public String getName()
- {
- return name ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.seda.StageConfig#getHandler()
- */
- public StageHandler getHandler()
- {
- return handler ;
- }
-
-
- public void setHandler( StageHandler handler )
- {
- this.handler = handler ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.seda.StageConfig#getPredicates()
- */
- public List getPredicates()
- {
- return predicates ;
- }
-
-
- /* (non-Javadoc)
- * @see org.apache.eve.seda.StageConfig#getThreadPool()
- */
- public ThreadPool getThreadPool()
- {
- return tp ;
- }
-}
+/*
+ * 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.seda ;
+
+
+import java.util.List ;
+import java.util.ArrayList ;
+
+import org.apache.seda.thread.ThreadPool ;
+
+
+/**
+ * The default bean implementation for a stage's configuration.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultStageConfig implements StageConfig
+{
+ /** the name of this Stage */
+ private final String name ;
+ /** this Stage's handler */
+ private StageHandler handler ;
+ /** the enqueue predicates for this Stage */
+ private final List predicates ;
+ /** the thread pool used for this Stages workers */
+ private final ThreadPool tp ;
+
+
+ /**
+ * Creates a default stage configuration bean.
+ *
+ * @param name the name of this Stage
+ * @param handler this Stage's handler
+ * @param predicates the enqueue predicates for this Stage
+ * @param tp the thread pool used for this Stages workers
+ */
+ public DefaultStageConfig( String name, StageHandler handler,
+ List predicates, ThreadPool tp )
+ {
+ this.tp = tp ;
+ this.name = name ;
+ this.handler = handler ;
+
+ if ( predicates == null )
+ {
+ this.predicates = new ArrayList() ;
+ }
+ else
+ {
+ this.predicates = predicates ;
+ }
+ }
+
+
+ /**
+ * Creates a default stage configuration bean.
+ *
+ * @param name the name of this Stage
+ * @param handler this Stage's handler
+ * @param predicates the enqueue predicates for this Stage
+ * @param tp the thread pool used for this Stages workers
+ */
+ public DefaultStageConfig( String name, List predicates, ThreadPool tp )
+ {
+ this( name, null, predicates, tp ) ;
+ }
+
+
+ /**
+ * Creates a default stage configuration bean.
+ *
+ * @param name the name of this Stage
+ * @param tp the thread pool used for this Stage's workers
+ */
+ public DefaultStageConfig( String name, ThreadPool tp )
+ {
+ this( name, null, null, tp ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.seda.StageConfig#getName()
+ */
+ public String getName()
+ {
+ return name ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.seda.StageConfig#getHandler()
+ */
+ public StageHandler getHandler()
+ {
+ return handler ;
+ }
+
+
+ public void setHandler( StageHandler handler )
+ {
+ this.handler = handler ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.seda.StageConfig#getPredicates()
+ */
+ public List getPredicates()
+ {
+ return predicates ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.apache.seda.seda.StageConfig#getThreadPool()
+ */
+ public ThreadPool getThreadPool()
+ {
+ return tp ;
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/LoggingStageMonitor.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/seda/LoggingStageMonitor.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/LoggingStageMonitor.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.seda ;
+package org.apache.seda.seda ;
import java.util.EventObject ;
@@ -64,8 +64,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#
- * handlerMissing(org.apache.eve.seda.Stage)
+ * @see org.apache.seda.seda.StageMonitor#
+ * handlerMissing(org.apache.seda.seda.Stage)
*/
public void handlerMissing( Stage stage )
{
@@ -78,7 +78,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#started(org.apache.eve.seda.Stage)
+ * @see
org.apache.seda.seda.StageMonitor#started(org.apache.eve.seda.Stage)
*/
public void started( Stage stage )
{
@@ -90,7 +90,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#stopped(org.apache.eve.seda.Stage)
+ * @see
org.apache.seda.seda.StageMonitor#stopped(org.apache.eve.seda.Stage)
*/
public void stopped( Stage stage )
{
@@ -102,8 +102,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#startedDriver(
- * org.apache.eve.seda.Stage)
+ * @see org.apache.seda.seda.StageMonitor#startedDriver(
+ * org.apache.seda.seda.Stage)
*/
public void startedDriver( Stage stage )
{
@@ -116,8 +116,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#enqueueOccurred(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#enqueueOccurred(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void enqueueOccurred( Stage stage, EventObject event )
{
@@ -130,8 +130,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#enqueueRejected(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#enqueueRejected(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void enqueueRejected( Stage stage, EventObject event )
{
@@ -144,8 +144,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#lockedQueue(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#lockedQueue(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void lockedQueue( Stage stage, EventObject event )
{
@@ -158,8 +158,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#lockedQueue(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#lockedQueue(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void lockedQueue( Stage stage )
{
@@ -172,7 +172,7 @@
/* (non-Javadoc)
- * @see
org.apache.eve.seda.StageMonitor#notified(org.apache.eve.seda.Stage)
+ * @see
org.apache.seda.seda.StageMonitor#notified(org.apache.eve.seda.Stage)
*/
public void notified( Stage stage )
{
@@ -185,7 +185,7 @@
/* (non-Javadoc)
- * @see
org.apache.eve.seda.StageMonitor#stopping(org.apache.eve.seda.Stage)
+ * @see
org.apache.seda.seda.StageMonitor#stopping(org.apache.eve.seda.Stage)
*/
public void stopping( Stage stage )
{
@@ -198,7 +198,7 @@
/* (non-Javadoc)
- * @see
org.apache.eve.seda.StageMonitor#stopping(org.apache.eve.seda.Stage,
+ * @see
org.apache.seda.seda.StageMonitor#stopping(org.apache.eve.seda.Stage,
* long)
*/
public void stopping( Stage stage, long millis )
@@ -212,8 +212,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#lockedQueue(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#lockedQueue(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void waiting( Stage stage )
{
@@ -226,8 +226,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#eventDequeued(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#eventDequeued(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void eventDequeued( Stage stage, EventObject event )
{
@@ -240,8 +240,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#eventHandled(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#eventHandled(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void eventHandled( Stage stage, EventObject event )
{
@@ -254,8 +254,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#driverFailed(
- * org.apache.eve.seda.Stage, java.lang.InterruptedException)
+ * @see org.apache.seda.seda.StageMonitor#driverFailed(
+ * org.apache.seda.seda.Stage, java.lang.InterruptedException)
*/
public void driverFailed( Stage stage, InterruptedException fault )
{
@@ -268,8 +268,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#handlerFailed(
- * org.apache.eve.seda.Stage, java.util.EventObject, java.lang.Throwable)
+ * @see org.apache.seda.seda.StageMonitor#handlerFailed(
+ * org.apache.seda.seda.Stage, java.util.EventObject, java.lang.Throwable)
*/
public void handlerFailed( Stage stage, EventObject event, Throwable fault
)
{
Modified:
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/StageMonitorAdapter.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/java/org/apache/eve/seda/StageMonitorAdapter.java
(original)
+++
incubator/directory/seda/trunk/impl/src/java/org/apache/seda/seda/StageMonitorAdapter.java
Sun Sep 5 21:13:34 2004
@@ -14,7 +14,7 @@
* limitations under the License.
*
*/
-package org.apache.eve.seda ;
+package org.apache.seda.seda ;
import java.util.EventObject ;
@@ -34,8 +34,8 @@
public class StageMonitorAdapter implements StageMonitor
{
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#handlerMissing(
- * org.apache.eve.seda.Stage)
+ * @see org.apache.seda.seda.StageMonitor#handlerMissing(
+ * org.apache.seda.seda.Stage)
*/
public void handlerMissing( Stage stage )
{
@@ -43,7 +43,7 @@
/* (non-Javadoc)
- * @see
org.apache.eve.seda.StageMonitor#stopping(org.apache.eve.seda.Stage)
+ * @see
org.apache.seda.seda.StageMonitor#stopping(org.apache.eve.seda.Stage)
*/
public void stopping( Stage stage )
{
@@ -51,7 +51,7 @@
/* (non-Javadoc)
- * @see
org.apache.eve.seda.StageMonitor#stopping(org.apache.eve.seda.Stage,
+ * @see
org.apache.seda.seda.StageMonitor#stopping(org.apache.eve.seda.Stage,
* long)
*/
public void stopping( Stage stage, long millis )
@@ -60,7 +60,7 @@
/* (non-Javadoc)
- * @see
org.apache.eve.seda.StageMonitor#notified(org.apache.eve.seda.Stage)
+ * @see
org.apache.seda.seda.StageMonitor#notified(org.apache.eve.seda.Stage)
*/
public void notified( Stage stage )
{
@@ -68,7 +68,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#waiting( Stage )
+ * @see org.apache.seda.seda.StageMonitor#waiting( Stage )
*/
public void waiting( Stage stage )
{
@@ -76,7 +76,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#started(org.apache.eve.seda.Stage)
+ * @see
org.apache.seda.seda.StageMonitor#started(org.apache.eve.seda.Stage)
*/
public void started( Stage stage )
{
@@ -84,7 +84,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#stopped(org.apache.eve.seda.Stage)
+ * @see
org.apache.seda.seda.StageMonitor#stopped(org.apache.eve.seda.Stage)
*/
public void stopped( Stage stage )
{
@@ -92,8 +92,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#startedDriver(
- * org.apache.eve.seda.Stage)
+ * @see org.apache.seda.seda.StageMonitor#startedDriver(
+ * org.apache.seda.seda.Stage)
*/
public void startedDriver( Stage stage )
{
@@ -101,8 +101,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#enqueueOccurred(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#enqueueOccurred(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void enqueueOccurred( Stage stage, EventObject event )
{
@@ -110,8 +110,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#enqueueRejected(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#enqueueRejected(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void enqueueRejected( Stage stage, EventObject event )
{
@@ -119,8 +119,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#lockedQueue(
- * org.apache.eve.seda.Stage)
+ * @see org.apache.seda.seda.StageMonitor#lockedQueue(
+ * org.apache.seda.seda.Stage)
*/
public void lockedQueue( Stage stage )
{
@@ -128,8 +128,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#lockedQueue(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#lockedQueue(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void lockedQueue( Stage stage, EventObject event )
{
@@ -137,8 +137,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#eventDequeued(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#eventDequeued(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void eventDequeued( Stage stage, EventObject event )
{
@@ -146,8 +146,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#eventHandled(
- * org.apache.eve.seda.Stage, java.util.EventObject)
+ * @see org.apache.seda.seda.StageMonitor#eventHandled(
+ * org.apache.seda.seda.Stage, java.util.EventObject)
*/
public void eventHandled( Stage stage, EventObject event )
{
@@ -155,8 +155,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#driverFailed(
- * org.apache.eve.seda.Stage, java.lang.InterruptedException)
+ * @see org.apache.seda.seda.StageMonitor#driverFailed(
+ * org.apache.seda.seda.Stage, java.lang.InterruptedException)
*/
public void driverFailed( Stage stage, InterruptedException fault )
{
@@ -165,8 +165,8 @@
/* (non-Javadoc)
- * @see org.apache.eve.seda.StageMonitor#handlerFailed(
- * org.apache.eve.seda.Stage, java.util.EventObject, java.lang.Throwable)
+ * @see org.apache.seda.seda.StageMonitor#handlerFailed(
+ * org.apache.seda.seda.Stage, java.util.EventObject, java.lang.Throwable)
*/
public void handlerFailed( Stage stage, EventObject event, Throwable fault
)
{
Modified:
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/buffer/DefaultBufferPoolTest.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/test/org/apache/eve/buffer/DefaultBufferPoolTest.java
(original)
+++
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/buffer/DefaultBufferPoolTest.java
Sun Sep 5 21:13:34 2004
@@ -1,238 +1,238 @@
-/*
- * 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.buffer ;
-
-
-import java.nio.ByteBuffer;
-
-import org.apache.eve.ResourceException;
-
-import junit.framework.TestCase ;
-
-
-/**
- * Tests the default buffer pool implementation.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultBufferPoolTest extends TestCase
-{
-
- public static void main( String[] args )
- {
- junit.textui.TestRunner.run( DefaultBufferPoolTest.class ) ;
- }
-
-
- /**
- * Constructor for DefaultBufferPoolTest.
- * @param arg0
- */
- public DefaultBufferPoolTest( String arg0 )
- {
- super( arg0 ) ;
- }
-
-
- DefaultBufferPool m_bp = null ;
-
-
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- public void setUp() throws Exception
- {
- super.setUp() ;
- DefaultBufferPoolConfig l_config = new DefaultBufferPoolConfig(
- "default", 4, 10, 2, 4096 ) ;
- m_bp = new DefaultBufferPool( l_config ) ;
- m_bp.setMonitor( new LoggingBufferMonitor() ) ;
- }
-
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- public void tearDown() throws Exception
- {
- m_bp = null ;
- super.tearDown() ;
- }
-
-
- public void testGetConfig() throws Exception
- {
- BufferPoolConfig l_config = m_bp.getConfig() ;
- assertNotNull( "Configuration was null", l_config ) ;
- }
-
-
- public void testGetBuffer() throws Exception
- {
- final int l_max = m_bp.getConfig().getMaximumSize() ;
- ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
-
- for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
- {
- l_buffers[ii] = m_bp.getBuffer( this ) ;
- assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
- }
-
- ByteBuffer l_buf = null ;
- try
- {
- l_buf = m_bp.getBuffer( this ) ;
- }
- catch( ResourceException e )
- {
- assertNull( l_buf ) ;
- assertNotNull( e ) ;
- }
- }
-
-
- public void testGetFreeCount() throws Exception
- {
- final int l_max = m_bp.getConfig().getMaximumSize() ;
- ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
-
- for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
- {
- l_buffers[ii] = m_bp.getBuffer( this ) ;
- assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
- assertEquals( "Free count was off", m_bp.size() - ii - 1,
- m_bp.getFreeCount() ) ;
- }
-
- ByteBuffer l_buf = null ;
- try
- {
- l_buf = m_bp.getBuffer( this ) ;
- }
- catch( ResourceException e )
- {
- assertNull( l_buf ) ;
- assertNotNull( e ) ;
- }
- }
-
-
- public void testGetInUseCount() throws Exception
- {
- final int l_max = m_bp.getConfig().getMaximumSize() ;
- ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
-
- for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
- {
- l_buffers[ii] = m_bp.getBuffer( this ) ;
- assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
- assertEquals( "In use count was off", ii+1,
- m_bp.getInUseCount() ) ;
- }
-
- ByteBuffer l_buf = null ;
- try
- {
- l_buf = m_bp.getBuffer( this ) ;
- }
- catch( ResourceException e )
- {
- assertNull( l_buf ) ;
- assertNotNull( e ) ;
- }
- }
-
-
- public void testGetInterestedCount()
- throws Exception
- {
- final int l_max = m_bp.getConfig().getMaximumSize() ;
- ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
-
- for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
- {
- l_buffers[ii] = m_bp.getBuffer( this ) ;
- assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
- assertEquals( "In use count was off", ii+1,
- m_bp.getInUseCount() ) ;
- assertEquals( "Interest count was off",
- 1, m_bp.getInterestedCount( l_buffers[ii] ) ) ;
- }
-
- ByteBuffer l_buf = null ;
- try
- {
- l_buf = m_bp.getBuffer( this ) ;
- }
- catch( ResourceException e )
- {
- assertNull( l_buf ) ;
- assertNotNull( e ) ;
- }
- }
-
-
- public void testReleaseClaim()
- throws Exception
- {
- }
-
-
- public void testSize()
- throws Exception
- {
- final int l_max = m_bp.getConfig().getMaximumSize() ;
- ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
-
- for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
- {
- l_buffers[ii] = m_bp.getBuffer( this ) ;
- assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
-
- if ( ii < 2 )
- {
- assertEquals( "size was off", 2, m_bp.size() ) ;
- }
- else if ( ii >= 2 && ii < 6 )
- {
- assertEquals( "size was off", 6, m_bp.size() ) ;
- }
- else if ( ii >= 6 && ii < 10 )
- {
- assertEquals( "size was off", 10, m_bp.size() ) ;
- }
- else
- {
- throw new IllegalStateException( "should never get here!" ) ;
- }
- }
-
- ByteBuffer l_buf = null ;
- try
- {
- l_buf = m_bp.getBuffer( this ) ;
- }
- catch( ResourceException e )
- {
- assertNull( l_buf ) ;
- assertNotNull( e ) ;
- }
- }
-}
+/*
+ * 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.buffer ;
+
+
+import java.nio.ByteBuffer;
+
+import org.apache.seda.ResourceException;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the default buffer pool implementation.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultBufferPoolTest extends TestCase
+{
+
+ public static void main( String[] args )
+ {
+ junit.textui.TestRunner.run( DefaultBufferPoolTest.class ) ;
+ }
+
+
+ /**
+ * Constructor for DefaultBufferPoolTest.
+ * @param arg0
+ */
+ public DefaultBufferPoolTest( String arg0 )
+ {
+ super( arg0 ) ;
+ }
+
+
+ DefaultBufferPool m_bp = null ;
+
+
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ public void setUp() throws Exception
+ {
+ super.setUp() ;
+ DefaultBufferPoolConfig l_config = new DefaultBufferPoolConfig(
+ "default", 4, 10, 2, 4096 ) ;
+ m_bp = new DefaultBufferPool( l_config ) ;
+ m_bp.setMonitor( new LoggingBufferMonitor() ) ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception
+ {
+ m_bp = null ;
+ super.tearDown() ;
+ }
+
+
+ public void testGetConfig() throws Exception
+ {
+ BufferPoolConfig l_config = m_bp.getConfig() ;
+ assertNotNull( "Configuration was null", l_config ) ;
+ }
+
+
+ public void testGetBuffer() throws Exception
+ {
+ final int l_max = m_bp.getConfig().getMaximumSize() ;
+ ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+
+ for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+ {
+ l_buffers[ii] = m_bp.getBuffer( this ) ;
+ assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+ }
+
+ ByteBuffer l_buf = null ;
+ try
+ {
+ l_buf = m_bp.getBuffer( this ) ;
+ }
+ catch( ResourceException e )
+ {
+ assertNull( l_buf ) ;
+ assertNotNull( e ) ;
+ }
+ }
+
+
+ public void testGetFreeCount() throws Exception
+ {
+ final int l_max = m_bp.getConfig().getMaximumSize() ;
+ ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+
+ for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+ {
+ l_buffers[ii] = m_bp.getBuffer( this ) ;
+ assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+ assertEquals( "Free count was off", m_bp.size() - ii - 1,
+ m_bp.getFreeCount() ) ;
+ }
+
+ ByteBuffer l_buf = null ;
+ try
+ {
+ l_buf = m_bp.getBuffer( this ) ;
+ }
+ catch( ResourceException e )
+ {
+ assertNull( l_buf ) ;
+ assertNotNull( e ) ;
+ }
+ }
+
+
+ public void testGetInUseCount() throws Exception
+ {
+ final int l_max = m_bp.getConfig().getMaximumSize() ;
+ ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+
+ for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+ {
+ l_buffers[ii] = m_bp.getBuffer( this ) ;
+ assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+ assertEquals( "In use count was off", ii+1,
+ m_bp.getInUseCount() ) ;
+ }
+
+ ByteBuffer l_buf = null ;
+ try
+ {
+ l_buf = m_bp.getBuffer( this ) ;
+ }
+ catch( ResourceException e )
+ {
+ assertNull( l_buf ) ;
+ assertNotNull( e ) ;
+ }
+ }
+
+
+ public void testGetInterestedCount()
+ throws Exception
+ {
+ final int l_max = m_bp.getConfig().getMaximumSize() ;
+ ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+
+ for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+ {
+ l_buffers[ii] = m_bp.getBuffer( this ) ;
+ assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+ assertEquals( "In use count was off", ii+1,
+ m_bp.getInUseCount() ) ;
+ assertEquals( "Interest count was off",
+ 1, m_bp.getInterestedCount( l_buffers[ii] ) ) ;
+ }
+
+ ByteBuffer l_buf = null ;
+ try
+ {
+ l_buf = m_bp.getBuffer( this ) ;
+ }
+ catch( ResourceException e )
+ {
+ assertNull( l_buf ) ;
+ assertNotNull( e ) ;
+ }
+ }
+
+
+ public void testReleaseClaim()
+ throws Exception
+ {
+ }
+
+
+ public void testSize()
+ throws Exception
+ {
+ final int l_max = m_bp.getConfig().getMaximumSize() ;
+ ByteBuffer[] l_buffers = new ByteBuffer[ l_max ] ;
+
+ for ( int ii = 0; ii < m_bp.getConfig().getMaximumSize(); ii++ )
+ {
+ l_buffers[ii] = m_bp.getBuffer( this ) ;
+ assertNotNull( "Got null ByteBuffer", l_buffers[ii] ) ;
+
+ if ( ii < 2 )
+ {
+ assertEquals( "size was off", 2, m_bp.size() ) ;
+ }
+ else if ( ii >= 2 && ii < 6 )
+ {
+ assertEquals( "size was off", 6, m_bp.size() ) ;
+ }
+ else if ( ii >= 6 && ii < 10 )
+ {
+ assertEquals( "size was off", 10, m_bp.size() ) ;
+ }
+ else
+ {
+ throw new IllegalStateException( "should never get here!" ) ;
+ }
+ }
+
+ ByteBuffer l_buf = null ;
+ try
+ {
+ l_buf = m_bp.getBuffer( this ) ;
+ }
+ catch( ResourceException e )
+ {
+ assertNull( l_buf ) ;
+ assertNotNull( e ) ;
+ }
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/test/org/apache/eve/decoder/DefaultDecoderManagerTest.java
(original)
+++
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/decoder/DefaultDecoderManagerTest.java
Sun Sep 5 21:13:34 2004
@@ -14,23 +14,23 @@
* limitations under the License.
*
*/
-package org.apache.eve.decoder ;
+package org.apache.seda.decoder ;
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.EventRouter ;
-import org.apache.eve.event.DefaultEventRouter ;
-import org.apache.eve.event.RequestEvent;
-import org.apache.eve.event.RequestSubscriber;
+import org.apache.seda.buffer.BufferPool;
+import org.apache.seda.buffer.BufferPoolConfig;
+import org.apache.seda.buffer.DefaultBufferPool;
+import org.apache.seda.buffer.DefaultBufferPoolConfig;
+import org.apache.seda.event.AbstractSubscriber;
+import org.apache.seda.event.EventRouter ;
+import org.apache.seda.event.DefaultEventRouter ;
+import org.apache.seda.event.RequestEvent;
+import org.apache.seda.event.RequestSubscriber;
-import org.apache.eve.seda.DefaultStageConfig ;
-import org.apache.eve.thread.ThreadPool;
+import org.apache.seda.seda.DefaultStageConfig ;
+import org.apache.seda.thread.ThreadPool;
import junit.framework.TestCase ;
@@ -74,7 +74,7 @@
tpool = new ThreadPool()
{
/* (non-Javadoc)
- * @see
org.apache.eve.thread.ThreadPool#execute(java.lang.Runnable)
+ * @see
org.apache.seda.thread.ThreadPool#execute(java.lang.Runnable)
*/
public void execute( Runnable runnable )
{
@@ -127,7 +127,7 @@
/* (non-Javadoc)
- * @see org.apache.eve.event.Subscriber#inform(java.util.EventObject)
+ * @see org.apache.seda.event.Subscriber#inform(java.util.EventObject)
*/
public void inform( EventObject event )
{
Modified:
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/AbstractSubscriberTest.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/test/org/apache/eve/event/AbstractSubscriberTest.java
(original)
+++
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/AbstractSubscriberTest.java
Sun Sep 5 21:13:34 2004
@@ -14,13 +14,13 @@
* limitations under the License.
*
*/
-package org.apache.eve.event ;
+package org.apache.seda.event ;
import java.nio.ByteBuffer ;
import java.util.EventObject ;
-import org.apache.eve.listener.ClientKey ;
+import org.apache.seda.listener.ClientKey ;
import junit.framework.TestCase ;
@@ -101,7 +101,7 @@
}
/* (non-Javadoc)
- * @see org.apache.eve.event.InputEvent#claimInterest(java.lang.Object)
+ * @see
org.apache.seda.event.InputEvent#claimInterest(java.lang.Object)
*/
public ByteBuffer claimInterest( Object party )
{
@@ -109,7 +109,7 @@
}
/* (non-Javadoc)
- * @see
org.apache.eve.event.InputEvent#releaseInterest(java.lang.Object)
+ * @see
org.apache.seda.event.InputEvent#releaseInterest(java.lang.Object)
*/
public void releaseInterest( Object party )
{
Modified:
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/DefaultStageTest.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/test/org/apache/eve/event/DefaultStageTest.java
(original)
+++
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/event/DefaultStageTest.java
Sun Sep 5 21:13:34 2004
@@ -1,150 +1,150 @@
-/*
- * 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.event ;
-
-
-import java.util.ArrayList ;
-import java.util.EventObject ;
-
-import org.apache.eve.seda.DefaultStage ;
-import org.apache.eve.seda.StageHandler ;
-import org.apache.eve.thread.ThreadPool ;
-import org.apache.eve.seda.EnqueuePredicate ;
-import org.apache.eve.seda.DefaultStageConfig ;
-import org.apache.eve.seda.LoggingStageMonitor ;
-
-import junit.framework.TestCase ;
-
-
-/**
- * Tests the DefaultStage class.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultStageTest extends TestCase
-{
- DefaultStage stage = null ;
- ThreadPool pool = null ;
- DefaultStageConfig config = null ;
- StageHandler handler = null ;
- ArrayList events = null ;
-
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception
- {
- // @todo Auto-generated method stub
- super.tearDown();
-
- events = null ;
- handler = null ;
- config = null ;
- pool = null ;
- stage.stop() ;
- stage = null ;
- }
-
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- super.setUp() ;
-
- pool = new ThreadPool()
- {
- /* (non-Javadoc)
- * @see
org.apache.eve.thread.ThreadPool#execute(java.lang.Runnable)
- */
- public void execute( Runnable runnable )
- {
- runnable.run() ;
- }
- };
-
- events = new ArrayList() ;
-
- handler = new StageHandler()
- {
- public void handleEvent( EventObject event )
- {
- events.add( event ) ;
- }
- } ;
-
- config = new DefaultStageConfig( "test", pool ) ;
- config.setHandler( handler ) ;
- stage = new DefaultStage( config ) ;
- stage.setMonitor( new LoggingStageMonitor(stage.getClass()) ) ;
- stage.start() ;
- }
-
-
- public void testAddPredicateAccept() throws Exception
- {
- stage.addPredicate( new EnqueuePredicate()
- {
- public boolean accept( EventObject event )
- {
- return true ;
- }
- } ) ;
-
- stage.enqueue( new EventObject( this ) ) ;
- stage.stop() ;
- assertEquals( 1, events.size() ) ;
- }
-
-
- public void testAddPredicateDeny() throws Exception
- {
- stage.addPredicate( new EnqueuePredicate()
- {
- public boolean accept( EventObject event )
- {
- return false ;
- }
- } ) ;
-
- stage.enqueue( new EventObject( this ) ) ;
- stage.stop() ;
- assertEquals( 0, events.size() ) ;
- }
-
-
- public void testGetConfig()
- {
- assertEquals( config, stage.getConfig() ) ;
- }
-
-
- public void testEnqueue()
- {
-
- }
-
-
- public void testSetMonitor()
- {
-
- }
-}
+/*
+ * 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.event ;
+
+
+import java.util.ArrayList ;
+import java.util.EventObject ;
+
+import org.apache.seda.seda.DefaultStage ;
+import org.apache.seda.seda.StageHandler ;
+import org.apache.seda.thread.ThreadPool ;
+import org.apache.seda.seda.EnqueuePredicate ;
+import org.apache.seda.seda.DefaultStageConfig ;
+import org.apache.seda.seda.LoggingStageMonitor ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the DefaultStage class.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultStageTest extends TestCase
+{
+ DefaultStage stage = null ;
+ ThreadPool pool = null ;
+ DefaultStageConfig config = null ;
+ StageHandler handler = null ;
+ ArrayList events = null ;
+
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception
+ {
+ // @todo Auto-generated method stub
+ super.tearDown();
+
+ events = null ;
+ handler = null ;
+ config = null ;
+ pool = null ;
+ stage.stop() ;
+ stage = null ;
+ }
+
+
+ /* (non-Javadoc)
+ * @see junit.framework.TestCase#setUp()
+ */
+ protected void setUp() throws Exception
+ {
+ super.setUp() ;
+
+ pool = new ThreadPool()
+ {
+ /* (non-Javadoc)
+ * @see
org.apache.seda.thread.ThreadPool#execute(java.lang.Runnable)
+ */
+ public void execute( Runnable runnable )
+ {
+ runnable.run() ;
+ }
+ };
+
+ events = new ArrayList() ;
+
+ handler = new StageHandler()
+ {
+ public void handleEvent( EventObject event )
+ {
+ events.add( event ) ;
+ }
+ } ;
+
+ config = new DefaultStageConfig( "test", pool ) ;
+ config.setHandler( handler ) ;
+ stage = new DefaultStage( config ) ;
+ stage.setMonitor( new LoggingStageMonitor(stage.getClass()) ) ;
+ stage.start() ;
+ }
+
+
+ public void testAddPredicateAccept() throws Exception
+ {
+ stage.addPredicate( new EnqueuePredicate()
+ {
+ public boolean accept( EventObject event )
+ {
+ return true ;
+ }
+ } ) ;
+
+ stage.enqueue( new EventObject( this ) ) ;
+ stage.stop() ;
+ assertEquals( 1, events.size() ) ;
+ }
+
+
+ public void testAddPredicateDeny() throws Exception
+ {
+ stage.addPredicate( new EnqueuePredicate()
+ {
+ public boolean accept( EventObject event )
+ {
+ return false ;
+ }
+ } ) ;
+
+ stage.enqueue( new EventObject( this ) ) ;
+ stage.stop() ;
+ assertEquals( 0, events.size() ) ;
+ }
+
+
+ public void testGetConfig()
+ {
+ assertEquals( config, stage.getConfig() ) ;
+ }
+
+
+ public void testEnqueue()
+ {
+
+ }
+
+
+ public void testSetMonitor()
+ {
+
+ }
+}
Modified:
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/listener/DefaultListenerManagerTest.java
==============================================================================
---
incubator/directory/seda/trunk/impl/src/test/org/apache/eve/listener/DefaultListenerManagerTest.java
(original)
+++
incubator/directory/seda/trunk/impl/src/test/org/apache/seda/listener/DefaultListenerManagerTest.java
Sun Sep 5 21:13:34 2004
@@ -1,92 +1,92 @@
-/*
- * 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.listener ;
-
-
-import org.apache.eve.event.EventRouter ;
-import org.apache.eve.event.DefaultEventRouter ;
-
-import junit.framework.TestCase ;
-
-
-/**
- * Tests the default ListenerManager's operations.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public class DefaultListenerManagerTest extends TestCase
-{
- /** An event router to use for testing */
- private EventRouter router = null ;
- /** the defualt ListenerManager to test */
- private DefaultListenerManager listener = null ;
-
-
-
- /*
- * @see TestCase#setUp()
- */
- protected void setUp() throws Exception
- {
- super.setUp() ;
-
- router = new DefaultEventRouter() ;
- listener = new DefaultListenerManager( router ) ;
- listener.start() ;
- }
-
-
- /*
- * @see TestCase#tearDown()
- */
- protected void tearDown() throws Exception
- {
- super.tearDown() ;
-
- router = null ;
- listener.stop() ;
- listener = null ;
- }
-
-
- /**
- * Constructor for DefaultListenerManagerTest.
- * @param arg0
- */
- public DefaultListenerManagerTest( String arg0 )
- {
- super( arg0 ) ;
- }
-
-
- public void testBind() throws Exception
- {
- listener.bind( new
- LdapServerListener( "localhost", 10389, 100, false ) ) ;
- }
-
-
- public void testUnbind() throws Exception
- {
- ServerListener sl = new
- LdapServerListener( "localhost", 10389, 100, false ) ;
- listener.bind( sl ) ;
- listener.unbind( sl ) ;
- }
-}
+/*
+ * 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.listener ;
+
+
+import org.apache.seda.event.EventRouter ;
+import org.apache.seda.event.DefaultEventRouter ;
+
+import junit.framework.TestCase ;
+
+
+/**
+ * Tests the default ListenerManager's operations.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class DefaultListenerManagerTest extends TestCase
+{
+ /** An event router to use for testing */
+ private EventRouter router = null ;
+ /** the defualt ListenerManager to test */
+ private DefaultListenerManager listener = null ;
+
+
+
+ /*
+ * @see TestCase#setUp()
+ */
+ protected void setUp() throws Exception
+ {
+ super.setUp() ;
+
+ router = new DefaultEventRouter() ;
+ listener = new DefaultListenerManager( router ) ;
+ listener.start() ;
+ }
+
+
+ /*
+ * @see TestCase#tearDown()
+ */
+ protected void tearDown() throws Exception
+ {
+ super.tearDown() ;
+
+ router = null ;
+ listener.stop() ;
+ listener = null ;
+ }
+
+
+ /**
+ * Constructor for DefaultListenerManagerTest.
+ * @param arg0
+ */
+ public DefaultListenerManagerTest( String arg0 )
+ {
+ super( arg0 ) ;
+ }
+
+
+ public void testBind() throws Exception
+ {
+ listener.bind( new
+ LdapServerListener( "localhost", 10389, 100, false ) ) ;
+ }
+
+
+ public void testUnbind() throws Exception
+ {
+ ServerListener sl = new
+ LdapServerListener( "localhost", 10389, 100, false ) ;
+ listener.bind( sl ) ;
+ listener.unbind( sl ) ;
+ }
+}