You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/02/12 06:51:22 UTC
svn commit: r377135 [15/36] - in /directory/sandbox/akarasulu/rc1:
apacheds/core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/
apacheds/core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/
apacheds/core-shared/...
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolCodecFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolCodecFactory.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolCodecFactory.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolCodecFactory.java Sat Feb 11 21:50:03 2006
@@ -1,54 +1,54 @@
-/*
- * Copyright 2005 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.directory.server.ntp.protocol;
-
-
-import org.apache.mina.filter.codec.ProtocolCodecFactory;
-import org.apache.mina.filter.codec.ProtocolDecoder;
-import org.apache.mina.filter.codec.ProtocolEncoder;
-
-
-public class NtpProtocolCodecFactory implements ProtocolCodecFactory
-{
- private static final NtpProtocolCodecFactory INSTANCE = new NtpProtocolCodecFactory();
-
-
- public static NtpProtocolCodecFactory getInstance()
- {
- return INSTANCE;
- }
-
-
- private NtpProtocolCodecFactory()
- {
- }
-
-
- public ProtocolEncoder getEncoder()
- {
- // Create a new encoder.
- return new NtpEncoder();
- }
-
-
- public ProtocolDecoder getDecoder()
- {
- // Create a new decoder.
- return new NtpDecoder();
- }
-}
+/*
+ * Copyright 2005 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.directory.server.ntp.protocol;
+
+
+import org.apache.mina.filter.codec.ProtocolCodecFactory;
+import org.apache.mina.filter.codec.ProtocolDecoder;
+import org.apache.mina.filter.codec.ProtocolEncoder;
+
+
+public class NtpProtocolCodecFactory implements ProtocolCodecFactory
+{
+ private static final NtpProtocolCodecFactory INSTANCE = new NtpProtocolCodecFactory();
+
+
+ public static NtpProtocolCodecFactory getInstance()
+ {
+ return INSTANCE;
+ }
+
+
+ private NtpProtocolCodecFactory()
+ {
+ }
+
+
+ public ProtocolEncoder getEncoder()
+ {
+ // Create a new encoder.
+ return new NtpEncoder();
+ }
+
+
+ public ProtocolDecoder getDecoder()
+ {
+ // Create a new decoder.
+ return new NtpDecoder();
+ }
+}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolCodecFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolCodecFactory.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolHandler.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolHandler.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolHandler.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolHandler.java Sat Feb 11 21:50:03 2006
@@ -1,105 +1,105 @@
-/*
- * Copyright 2005 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.directory.server.ntp.protocol;
-
-
-import org.apache.directory.server.ntp.NtpService;
-import org.apache.directory.server.ntp.messages.NtpMessage;
-import org.apache.directory.server.ntp.service.NtpServiceImpl;
-import org.apache.mina.common.IdleStatus;
-import org.apache.mina.common.IoHandler;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.codec.ProtocolCodecFilter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class NtpProtocolHandler implements IoHandler
-{
- /** the log for this class */
- private static final Logger log = LoggerFactory.getLogger( NtpProtocolHandler.class );
-
- private NtpService ntpService = new NtpServiceImpl();
-
-
- public void sessionCreated( IoSession session ) throws Exception
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( session.getRemoteAddress() + " CREATED" );
- }
-
- session.getFilterChain().addFirst( "codec", new ProtocolCodecFilter( NtpProtocolCodecFactory.getInstance() ) );
- }
-
-
- public void sessionOpened( IoSession session )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( session.getRemoteAddress() + " OPENED" );
- }
- }
-
-
- public void sessionClosed( IoSession session )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( session.getRemoteAddress() + " CLOSED" );
- }
- }
-
-
- public void sessionIdle( IoSession session, IdleStatus status )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( session.getRemoteAddress() + " IDLE(" + status + ")" );
- }
- }
-
-
- public void exceptionCaught( IoSession session, Throwable cause )
- {
- log.error( session.getRemoteAddress() + " EXCEPTION", cause );
- session.close();
- }
-
-
- public void messageReceived( IoSession session, Object message )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( session.getRemoteAddress() + " RCVD: " + message );
- }
-
- NtpMessage reply = ntpService.getReplyFor( ( NtpMessage ) message );
-
- session.write( reply );
- }
-
-
- public void messageSent( IoSession session, Object message )
- {
- if ( log.isDebugEnabled() )
- {
- log.debug( session.getRemoteAddress() + " SENT: " + message );
- }
- }
-}
+/*
+ * Copyright 2005 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.directory.server.ntp.protocol;
+
+
+import org.apache.directory.server.ntp.NtpService;
+import org.apache.directory.server.ntp.messages.NtpMessage;
+import org.apache.directory.server.ntp.service.NtpServiceImpl;
+import org.apache.mina.common.IdleStatus;
+import org.apache.mina.common.IoHandler;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class NtpProtocolHandler implements IoHandler
+{
+ /** the log for this class */
+ private static final Logger log = LoggerFactory.getLogger( NtpProtocolHandler.class );
+
+ private NtpService ntpService = new NtpServiceImpl();
+
+
+ public void sessionCreated( IoSession session ) throws Exception
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( session.getRemoteAddress() + " CREATED" );
+ }
+
+ session.getFilterChain().addFirst( "codec", new ProtocolCodecFilter( NtpProtocolCodecFactory.getInstance() ) );
+ }
+
+
+ public void sessionOpened( IoSession session )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( session.getRemoteAddress() + " OPENED" );
+ }
+ }
+
+
+ public void sessionClosed( IoSession session )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( session.getRemoteAddress() + " CLOSED" );
+ }
+ }
+
+
+ public void sessionIdle( IoSession session, IdleStatus status )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( session.getRemoteAddress() + " IDLE(" + status + ")" );
+ }
+ }
+
+
+ public void exceptionCaught( IoSession session, Throwable cause )
+ {
+ log.error( session.getRemoteAddress() + " EXCEPTION", cause );
+ session.close();
+ }
+
+
+ public void messageReceived( IoSession session, Object message )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( session.getRemoteAddress() + " RCVD: " + message );
+ }
+
+ NtpMessage reply = ntpService.getReplyFor( ( NtpMessage ) message );
+
+ session.write( reply );
+ }
+
+
+ public void messageSent( IoSession session, Object message )
+ {
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( session.getRemoteAddress() + " SENT: " + message );
+ }
+ }
+}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/protocol/NtpProtocolHandler.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/service/NtpServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/main/java/org/apache/directory/server/ntp/service/NtpServiceImpl.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/test/java/org/apache/directory/server/ntp/AbstractNtpTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/test/java/org/apache/directory/server/ntp/AbstractNtpTestCase.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpMessageDecoderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpMessageDecoderTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpMessageEncoderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-ntp/src/test/java/org/apache/directory/server/ntp/NtpMessageEncoderTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/AbstractBackingStoreTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/LdapLoader.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/LoadStrategy.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/MapAdapter.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/PropsLoader.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ServiceConfiguration.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/Catalog.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/catalog/GetCatalog.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -0,0 +1,4 @@
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Chain.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Chain.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Chain.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Chain.java Sat Feb 11 21:50:03 2006
@@ -1,113 +1,113 @@
-/*
- * Copyright 2003-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.directory.server.protocol.shared.chain;
-
-
-/**
- * <p>A {@link Chain} represents a configured list of
- * {@link Command}s that will be executed in order to perform processing
- * on a specified {@link Context}. Each included {@link Command} will be
- * executed in turn, until either one of them returns <code>true</code>,
- * one of the executed {@link Command}s throws an exception,
- * or the end of the chain has been reached. The {@link Chain} itself will
- * return the return value of the last {@link Command} that was executed
- * (if no exception was thrown), or rethrow the thrown exception.</p>
- *
- * <p>Note that {@link Chain} extends {@link Command}, so that the two can
- * be used interchangeably when a {@link Command} is expected. This makes it
- * easy to assemble workflows in a hierarchical manner by combining subchains
- * into an overall processing chain.</p>
- *
- * <p>To protect applications from evolution of this interface, specialized
- * implementations of {@link Chain} should generally be created by extending
- * the provided base class {@link org.apache.directory.server.protocol.shared.chain.impl.ChainBase})
- * rather than directly implementing this interface.</p>
- *
- * <p>{@link Chain} implementations should be designed in a thread-safe
- * manner, suitable for execution on multiple threads simultaneously. In
- * general, this implies that the state information identifying which
- * {@link Command} is currently being executed should be maintained in a
- * local variable inside the <code>execute()</code> method, rather than
- * in an instance variable. The {@link Command}s in a {@link Chain} may be
- * configured (via calls to <code>addCommand()</code>) at any time before
- * the <code>execute()</code> method of the {@link Chain} is first called.
- * After that, the configuration of the {@link Chain} is frozen.</p>
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-public interface Chain extends Command
-{
- /**
- * <p>Add a {@link Command} to the list of {@link Command}s that will
- * be called in turn when this {@link Chain}'s <code>execute()</code>
- * method is called. Once <code>execute()</code> has been called
- * at least once, it is no longer possible to add additional
- * {@link Command}s; instead, an exception will be thrown.</p>
- *
- * @param command The {@link Command} to be added
- *
- * @exception IllegalArgumentException if <code>command</code>
- * is <code>null</code>
- * @exception IllegalStateException if this {@link Chain} has already
- * been executed at least once, so no further configuration is allowed
- */
- void addCommand( Command command );
-
-
- /**
- * <p>Execute the processing represented by this {@link Chain} according
- * to the following algorithm.</p>
- * <ul>
- * <li>If there are no configured {@link Command}s in the {@link Chain},
- * return <code>false</code>.</li>
- * <li>Call the <code>execute()</code> method of each {@link Command}
- * configured on this chain, in the order they were added via calls
- * to the <code>addCommand()</code> method, until the end of the
- * configured {@link Command}s is encountered, or until one of
- * the executed {@link Command}s returns <code>true</code>
- * or throws an exception.</li>
- * <li>Walk backwards through the {@link Command}s whose
- * <code>execute()</code> methods, starting with the last one that
- * was executed. If this {@link Command} instance is also a
- * {@link Filter}, call its <code>postprocess()</code> method,
- * discarding any exception that is thrown.</li>
- * <li>If the last {@link Command} whose <code>execute()</code> method
- * was called threw an exception, rethrow that exception.</li>
- * <li>Otherwise, return the value returned by the <code>execute()</code>
- * method of the last {@link Command} that was executed. This will be
- * <code>true</code> if the last {@link Command} indicated that
- * processing of this {@link Context} has been completed, or
- * <code>false</code> if none of the called {@link Command}s
- * returned <code>true</code>.</li>
- * </ul>
- *
- * @param context The {@link Context} to be processed by this
- * {@link Chain}
- *
- * @exception Exception if thrown by one of the {@link Command}s
- * in this {@link Chain} but not handled by a <code>postprocess()</code>
- * method of a {@link Filter}
- * @exception IllegalArgumentException if <code>context</code>
- * is <code>null</code>
- *
- * @return <code>true</code> if the processing of this {@link Context}
- * has been completed, or <code>false</code> if the processing
- * of this {@link Context} should be delegated to a subsequent
- * {@link Command} in an enclosing {@link Chain}
- */
- boolean execute( Context context ) throws Exception;
+/*
+ * Copyright 2003-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.directory.server.protocol.shared.chain;
+
+
+/**
+ * <p>A {@link Chain} represents a configured list of
+ * {@link Command}s that will be executed in order to perform processing
+ * on a specified {@link Context}. Each included {@link Command} will be
+ * executed in turn, until either one of them returns <code>true</code>,
+ * one of the executed {@link Command}s throws an exception,
+ * or the end of the chain has been reached. The {@link Chain} itself will
+ * return the return value of the last {@link Command} that was executed
+ * (if no exception was thrown), or rethrow the thrown exception.</p>
+ *
+ * <p>Note that {@link Chain} extends {@link Command}, so that the two can
+ * be used interchangeably when a {@link Command} is expected. This makes it
+ * easy to assemble workflows in a hierarchical manner by combining subchains
+ * into an overall processing chain.</p>
+ *
+ * <p>To protect applications from evolution of this interface, specialized
+ * implementations of {@link Chain} should generally be created by extending
+ * the provided base class {@link org.apache.directory.server.protocol.shared.chain.impl.ChainBase})
+ * rather than directly implementing this interface.</p>
+ *
+ * <p>{@link Chain} implementations should be designed in a thread-safe
+ * manner, suitable for execution on multiple threads simultaneously. In
+ * general, this implies that the state information identifying which
+ * {@link Command} is currently being executed should be maintained in a
+ * local variable inside the <code>execute()</code> method, rather than
+ * in an instance variable. The {@link Command}s in a {@link Chain} may be
+ * configured (via calls to <code>addCommand()</code>) at any time before
+ * the <code>execute()</code> method of the {@link Chain} is first called.
+ * After that, the configuration of the {@link Chain} is frozen.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+public interface Chain extends Command
+{
+ /**
+ * <p>Add a {@link Command} to the list of {@link Command}s that will
+ * be called in turn when this {@link Chain}'s <code>execute()</code>
+ * method is called. Once <code>execute()</code> has been called
+ * at least once, it is no longer possible to add additional
+ * {@link Command}s; instead, an exception will be thrown.</p>
+ *
+ * @param command The {@link Command} to be added
+ *
+ * @exception IllegalArgumentException if <code>command</code>
+ * is <code>null</code>
+ * @exception IllegalStateException if this {@link Chain} has already
+ * been executed at least once, so no further configuration is allowed
+ */
+ void addCommand( Command command );
+
+
+ /**
+ * <p>Execute the processing represented by this {@link Chain} according
+ * to the following algorithm.</p>
+ * <ul>
+ * <li>If there are no configured {@link Command}s in the {@link Chain},
+ * return <code>false</code>.</li>
+ * <li>Call the <code>execute()</code> method of each {@link Command}
+ * configured on this chain, in the order they were added via calls
+ * to the <code>addCommand()</code> method, until the end of the
+ * configured {@link Command}s is encountered, or until one of
+ * the executed {@link Command}s returns <code>true</code>
+ * or throws an exception.</li>
+ * <li>Walk backwards through the {@link Command}s whose
+ * <code>execute()</code> methods, starting with the last one that
+ * was executed. If this {@link Command} instance is also a
+ * {@link Filter}, call its <code>postprocess()</code> method,
+ * discarding any exception that is thrown.</li>
+ * <li>If the last {@link Command} whose <code>execute()</code> method
+ * was called threw an exception, rethrow that exception.</li>
+ * <li>Otherwise, return the value returned by the <code>execute()</code>
+ * method of the last {@link Command} that was executed. This will be
+ * <code>true</code> if the last {@link Command} indicated that
+ * processing of this {@link Context} has been completed, or
+ * <code>false</code> if none of the called {@link Command}s
+ * returned <code>true</code>.</li>
+ * </ul>
+ *
+ * @param context The {@link Context} to be processed by this
+ * {@link Chain}
+ *
+ * @exception Exception if thrown by one of the {@link Command}s
+ * in this {@link Chain} but not handled by a <code>postprocess()</code>
+ * method of a {@link Filter}
+ * @exception IllegalArgumentException if <code>context</code>
+ * is <code>null</code>
+ *
+ * @return <code>true</code> if the processing of this {@link Context}
+ * has been completed, or <code>false</code> if the processing
+ * of this {@link Context} should be delegated to a subsequent
+ * {@link Command} in an enclosing {@link Chain}
+ */
+ boolean execute( Context context ) throws Exception;
}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Chain.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Chain.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Command.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Command.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Command.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Command.java Sat Feb 11 21:50:03 2006
@@ -1,101 +1,101 @@
-/*
- * Copyright 2003-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.directory.server.protocol.shared.chain;
-
-
-/**
- * <p>A {@link Command} encapsulates a unit of processing work to be
- * performed, whose purpose is to examine and/or modify the state of a
- * transaction that is represented by a {@link Context}. Individual
- * {@link Command}s can be assembled into a {@link Chain}, which allows
- * them to either complete the required processing or delegate further
- * processing to the next {@link Command} in the {@link Chain}.</p>
- *
- * <p>{@link Command} implementations should be designed in a thread-safe
- * manner, suitable for inclusion in multiple {@link Chain}s that might be
- * processed by different threads simultaneously. In general, this implies
- * that {@link Command} classes should not maintain state information in
- * instance variables. Instead, state information should be maintained via
- * suitable modifications to the attributes of the {@link Context} that is
- * passed to the <code>execute()</code> command.</p>
- *
- * <p>{@link Command} implementations typically retrieve and store state
- * information in the {@link Context} instance that is passed as a parameter
- * to the <code>execute()</code> method, using particular keys into the
- * <code>Map</code> that can be acquired via
- * <code>Context.getAttributes()</code>. To improve interoperability of
- * {@link Command} implementations, a useful design pattern is to expose the
- * key values used as JavaBeans properties of the {@link Command}
- * implementation class itself. For example, a {@link Command} that requires
- * an input and an output key might implement the following properties:</p>
- *
- * <pre>
- * private String inputKey = "input";
- * public String getInputKey() {
- * return (this.inputKey);
- * }
- * public void setInputKey(String inputKey) {
- * this.inputKey = inputKey;
- * }
- *
- * private String outputKey = "output";
- * public String getOutputKey() {
- * return (this.outputKey);
- * }
- * public void setOutputKey(String outputKey) {
- * this.outputKey = outputKey;
- * }
- * </pre>
- *
- * <p>And the operation of accessing the "input" information in the context
- * would be executed by calling:</p>
- *
- * <pre>
- * String input = (String) context.get(getInputKey());
- * </pre>
- *
- * <p>instead of hard coding the attribute name. The use of the "Key"
- * suffix on such property names is a useful convention to identify properties
- * being used in this fashion, as opposed to JavaBeans properties that simply
- * configure the internal operation of this {@link Command}.</p>
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-public interface Command
-{
- /**
- * <p>Execute a unit of processing work to be performed. This
- * {@link Command} may either complete the required processing
- * and return <code>true</code>, or delegate remaining processing
- * to the next {@link Command} in a {@link Chain} containing this
- * {@link Command} by returning <code>false</code>
- *
- * @param context The {@link Context} to be processed by this
- * {@link Command}
- *
- * @exception Exception general purpose exception return
- * to indicate abnormal termination
- * @exception IllegalArgumentException if <code>context</code>
- * is <code>null</code>
- *
- * @return <code>true</code> if the processing of this {@link Context}
- * has been completed, or <code>false</code> if the processing
- * of this {@link Context} should be delegated to a subsequent
- * {@link Command} in an enclosing {@link Chain}
- */
- boolean execute( Context context ) throws Exception;
+/*
+ * Copyright 2003-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.directory.server.protocol.shared.chain;
+
+
+/**
+ * <p>A {@link Command} encapsulates a unit of processing work to be
+ * performed, whose purpose is to examine and/or modify the state of a
+ * transaction that is represented by a {@link Context}. Individual
+ * {@link Command}s can be assembled into a {@link Chain}, which allows
+ * them to either complete the required processing or delegate further
+ * processing to the next {@link Command} in the {@link Chain}.</p>
+ *
+ * <p>{@link Command} implementations should be designed in a thread-safe
+ * manner, suitable for inclusion in multiple {@link Chain}s that might be
+ * processed by different threads simultaneously. In general, this implies
+ * that {@link Command} classes should not maintain state information in
+ * instance variables. Instead, state information should be maintained via
+ * suitable modifications to the attributes of the {@link Context} that is
+ * passed to the <code>execute()</code> command.</p>
+ *
+ * <p>{@link Command} implementations typically retrieve and store state
+ * information in the {@link Context} instance that is passed as a parameter
+ * to the <code>execute()</code> method, using particular keys into the
+ * <code>Map</code> that can be acquired via
+ * <code>Context.getAttributes()</code>. To improve interoperability of
+ * {@link Command} implementations, a useful design pattern is to expose the
+ * key values used as JavaBeans properties of the {@link Command}
+ * implementation class itself. For example, a {@link Command} that requires
+ * an input and an output key might implement the following properties:</p>
+ *
+ * <pre>
+ * private String inputKey = "input";
+ * public String getInputKey() {
+ * return (this.inputKey);
+ * }
+ * public void setInputKey(String inputKey) {
+ * this.inputKey = inputKey;
+ * }
+ *
+ * private String outputKey = "output";
+ * public String getOutputKey() {
+ * return (this.outputKey);
+ * }
+ * public void setOutputKey(String outputKey) {
+ * this.outputKey = outputKey;
+ * }
+ * </pre>
+ *
+ * <p>And the operation of accessing the "input" information in the context
+ * would be executed by calling:</p>
+ *
+ * <pre>
+ * String input = (String) context.get(getInputKey());
+ * </pre>
+ *
+ * <p>instead of hard coding the attribute name. The use of the "Key"
+ * suffix on such property names is a useful convention to identify properties
+ * being used in this fashion, as opposed to JavaBeans properties that simply
+ * configure the internal operation of this {@link Command}.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+public interface Command
+{
+ /**
+ * <p>Execute a unit of processing work to be performed. This
+ * {@link Command} may either complete the required processing
+ * and return <code>true</code>, or delegate remaining processing
+ * to the next {@link Command} in a {@link Chain} containing this
+ * {@link Command} by returning <code>false</code>
+ *
+ * @param context The {@link Context} to be processed by this
+ * {@link Command}
+ *
+ * @exception Exception general purpose exception return
+ * to indicate abnormal termination
+ * @exception IllegalArgumentException if <code>context</code>
+ * is <code>null</code>
+ *
+ * @return <code>true</code> if the processing of this {@link Context}
+ * has been completed, or <code>false</code> if the processing
+ * of this {@link Context} should be delegated to a subsequent
+ * {@link Command} in an enclosing {@link Chain}
+ */
+ boolean execute( Context context ) throws Exception;
}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Command.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Command.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Context.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Context.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Context.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Context.java Sat Feb 11 21:50:03 2006
@@ -1,64 +1,64 @@
-/*
- * Copyright 2003-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.directory.server.protocol.shared.chain;
-
-
-import java.util.Map;
-
-
-/**
- * <p>A {@link Context} represents the state information that is
- * accessed and manipulated by the execution of a {@link Command} or a
- * {@link Chain}. Specialized implementations of {@link Context} will
- * typically add JavaBeans properties that contain typesafe accessors
- * to information that is relevant to a particular use case for this
- * context, and/or add operations that affect the state information
- * that is saved in the context.</p>
- *
- * <p>Implementations of {@link Context} must also implement all of the
- * required and optional contracts of the <code>java.util.Map</code>
- * interface.</p>
- *
- * <p>It is strongly recommended, but not required, that JavaBeans
- * properties added to a particular {@link Context} implementation exhibit
- * <em>Attribute-Property Transparency</em>. In other words,
- * a value stored via a call to <code>setFoo(value)</code> should be visible
- * by calling <code>get("foo")</code>, and a value stored
- * via a call to <code>put("foo", value)</code> should be
- * visible by calling <code>getFoo()</code>. If your {@link Context}
- * implementation class exhibits this featue, it becomes easier to reuse the
- * implementation in multiple environments, without the need to cast to a
- * particular implementation class in order to access the property getter
- * and setter methods.</p>
- *
- * <p>To protect applications from evolution of this interface, specialized
- * implementations of {@link Context} should generally be created by extending
- * the provided base class ({@link org.apache.directory.server.protocol.shared.chain.impl.ContextBase})
- * rather than directly implementing this interface.</p>
- *
- * <p>Applications should <strong>NOT</strong> assume that
- * {@link Context} implementations, or the values stored in its
- * attributes, may be accessed from multiple threads
- * simultaneously unless this is explicitly documented for a particular
- * implementation.</p>
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-public interface Context extends Map
-{
-
+/*
+ * Copyright 2003-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.directory.server.protocol.shared.chain;
+
+
+import java.util.Map;
+
+
+/**
+ * <p>A {@link Context} represents the state information that is
+ * accessed and manipulated by the execution of a {@link Command} or a
+ * {@link Chain}. Specialized implementations of {@link Context} will
+ * typically add JavaBeans properties that contain typesafe accessors
+ * to information that is relevant to a particular use case for this
+ * context, and/or add operations that affect the state information
+ * that is saved in the context.</p>
+ *
+ * <p>Implementations of {@link Context} must also implement all of the
+ * required and optional contracts of the <code>java.util.Map</code>
+ * interface.</p>
+ *
+ * <p>It is strongly recommended, but not required, that JavaBeans
+ * properties added to a particular {@link Context} implementation exhibit
+ * <em>Attribute-Property Transparency</em>. In other words,
+ * a value stored via a call to <code>setFoo(value)</code> should be visible
+ * by calling <code>get("foo")</code>, and a value stored
+ * via a call to <code>put("foo", value)</code> should be
+ * visible by calling <code>getFoo()</code>. If your {@link Context}
+ * implementation class exhibits this featue, it becomes easier to reuse the
+ * implementation in multiple environments, without the need to cast to a
+ * particular implementation class in order to access the property getter
+ * and setter methods.</p>
+ *
+ * <p>To protect applications from evolution of this interface, specialized
+ * implementations of {@link Context} should generally be created by extending
+ * the provided base class ({@link org.apache.directory.server.protocol.shared.chain.impl.ContextBase})
+ * rather than directly implementing this interface.</p>
+ *
+ * <p>Applications should <strong>NOT</strong> assume that
+ * {@link Context} implementations, or the values stored in its
+ * attributes, may be accessed from multiple threads
+ * simultaneously unless this is explicitly documented for a particular
+ * implementation.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+public interface Context extends Map
+{
+
}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Context.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Context.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Filter.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Filter.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Filter.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Filter.java Sat Feb 11 21:50:03 2006
@@ -1,63 +1,63 @@
-/*
- * Copyright 2003-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.directory.server.protocol.shared.chain;
-
-
-/**
- * <p>A {@link Filter} is a specialized {@link Command} that also expects
- * the {@link Chain} that is executing it to call the
- * <code>postprocess()</code> method if it called the <code>execute()</code>
- * method. This promise must be fulfilled in spite of any possible
- * exceptions thrown by the <code>execute()</code> method of this
- * {@link Command}, or any subsequent {@link Command} whose
- * <code>execute()</code> method was called. The owning {@link Chain}
- * must call the <code>postprocess()</code> method of each {@link Filter}
- * in a {@link Chain} in reverse order of the invocation of their
- * <code>execute()</code> methods.</p>
- *
- * <p>The most common use case for a {@link Filter}, as opposed to a
- * {@link Command}, is where potentially expensive resources must be acquired
- * and held until the processing of a particular request has been completed,
- * even it execution is delegated to a subsequent {@link Command} via the
- * <code>execute()</code> returning <code>false</code>. A {@link Filter}
- * can reliably release such resources in the <code>postprocess()</code>
- * method, which is guaranteed to be called by the owning {@link Chain}.</p>
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-public interface Filter extends Command
-{
- /**
- * <p>Execute any cleanup activities, such as releasing resources that
- * were acquired during the <code>execute()</code> method of this
- * {@link Filter} instance.</p>
- *
- * @param context The {@link Context} to be processed by this
- * {@link Filter}
- * @param exception The <code>Exception</code> (if any) that was thrown
- * by the last {@link Command} that was executed; otherwise
- * <code>null</code>
- *
- * @exception IllegalArgumentException if <code>context</code>
- * is <code>null</code>
- *
- * @return If a non-null <code>exception</code> was "handled" by this
- * method (and therefore need not be rethrown), return <code>true</code>;
- * otherwise return <code>false</code>
- */
- boolean postprocess( Context context, Exception exception );
+/*
+ * Copyright 2003-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.directory.server.protocol.shared.chain;
+
+
+/**
+ * <p>A {@link Filter} is a specialized {@link Command} that also expects
+ * the {@link Chain} that is executing it to call the
+ * <code>postprocess()</code> method if it called the <code>execute()</code>
+ * method. This promise must be fulfilled in spite of any possible
+ * exceptions thrown by the <code>execute()</code> method of this
+ * {@link Command}, or any subsequent {@link Command} whose
+ * <code>execute()</code> method was called. The owning {@link Chain}
+ * must call the <code>postprocess()</code> method of each {@link Filter}
+ * in a {@link Chain} in reverse order of the invocation of their
+ * <code>execute()</code> methods.</p>
+ *
+ * <p>The most common use case for a {@link Filter}, as opposed to a
+ * {@link Command}, is where potentially expensive resources must be acquired
+ * and held until the processing of a particular request has been completed,
+ * even it execution is delegated to a subsequent {@link Command} via the
+ * <code>execute()</code> returning <code>false</code>. A {@link Filter}
+ * can reliably release such resources in the <code>postprocess()</code>
+ * method, which is guaranteed to be called by the owning {@link Chain}.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+public interface Filter extends Command
+{
+ /**
+ * <p>Execute any cleanup activities, such as releasing resources that
+ * were acquired during the <code>execute()</code> method of this
+ * {@link Filter} instance.</p>
+ *
+ * @param context The {@link Context} to be processed by this
+ * {@link Filter}
+ * @param exception The <code>Exception</code> (if any) that was thrown
+ * by the last {@link Command} that was executed; otherwise
+ * <code>null</code>
+ *
+ * @exception IllegalArgumentException if <code>context</code>
+ * is <code>null</code>
+ *
+ * @return If a non-null <code>exception</code> was "handled" by this
+ * method (and therefore need not be rethrown), return <code>true</code>;
+ * otherwise return <code>false</code>
+ */
+ boolean postprocess( Context context, Exception exception );
}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Filter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/Filter.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/ChainBase.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/ChainBase.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/ChainBase.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/ChainBase.java Sat Feb 11 21:50:03 2006
@@ -1,233 +1,233 @@
-/*
- * Copyright 1999-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.directory.server.protocol.shared.chain.impl;
-
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.directory.server.protocol.shared.chain.Chain;
-import org.apache.directory.server.protocol.shared.chain.Command;
-import org.apache.directory.server.protocol.shared.chain.Context;
-import org.apache.directory.server.protocol.shared.chain.Filter;
-
-
-/**
- * <p>Convenience base class for {@link Chain} implementations.</p>
- *
- * @author Craig R. McClanahan
- * @version $Revision$ $Date$
- */
-public class ChainBase implements Chain
-{
- // ----------------------------------------------------------- Constructors
-
- /**
- * <p>Construct a {@link Chain} with no configured {@link Command}s.</p>
- */
- public ChainBase()
- {
-
- }
-
-
- /**
- * <p>Construct a {@link Chain} configured with the specified
- * {@link Command}.</p>
- *
- * @param command The {@link Command} to be configured
- *
- * @exception IllegalArgumentException if <code>command</code>
- * is <code>null</code>
- */
- public ChainBase(Command command)
- {
- addCommand( command );
- }
-
-
- /**
- * <p>Construct a {@link Chain} configured with the specified
- * {@link Command}s.</p>
- *
- * @param commands The {@link Command}s to be configured
- *
- * @exception IllegalArgumentException if <code>commands</code>,
- * or one of the individual {@link Command} elements,
- * is <code>null</code>
- */
- public ChainBase(Command[] commands)
- {
- if ( commands == null )
- {
- throw new IllegalArgumentException();
- }
-
- for ( int i = 0; i < commands.length; i++ )
- {
- addCommand( commands[i] );
- }
- }
-
-
- /**
- * <p>Construct a {@link Chain} configured with the specified
- * {@link Command}s.</p>
- *
- * @param commands The {@link Command}s to be configured
- *
- * @exception IllegalArgumentException if <code>commands</code>,
- * or one of the individual {@link Command} elements,
- * is <code>null</code>
- */
- public ChainBase(Collection commands)
- {
- if ( commands == null )
- {
- throw new IllegalArgumentException();
- }
-
- Iterator elements = commands.iterator();
- while ( elements.hasNext() )
- {
- addCommand( ( Command ) elements.next() );
- }
- }
-
- // ----------------------------------------------------- Instance Variables
-
- /**
- * <p>The list of {@link Command}s configured for this {@link Chain}, in
- * the order in which they may delegate processing to the remainder of
- * the {@link Chain}.</p>
- */
- protected Command[] commands = new Command[0];
-
- /**
- * <p>Flag indicating whether the configuration of our commands list
- * has been frozen by a call to the <code>execute()</code> method.</p>
- */
- protected boolean frozen = false;
-
-
- // ---------------------------------------------------------- Chain Methods
-
- // Documented in Chain interface
- public void addCommand( Command command )
- {
- if ( command == null )
- {
- throw new IllegalArgumentException();
- }
-
- if ( frozen )
- {
- throw new IllegalStateException();
- }
-
- Command[] results = new Command[commands.length + 1];
- System.arraycopy( commands, 0, results, 0, commands.length );
- results[commands.length] = command;
- commands = results;
- }
-
-
- // Documented in Chain interface
- public boolean execute( Context context ) throws Exception
- {
- // Verify our parameters
- if ( context == null )
- {
- throw new IllegalArgumentException();
- }
-
- // Freeze the configuration of the command list
- frozen = true;
-
- // Execute the commands in this list until one returns true
- // or throws an exception
- boolean saveResult = false;
- Exception saveException = null;
- int i = 0;
- int n = commands.length;
- ;
- for ( i = 0; i < n; i++ )
- {
- try
- {
- saveResult = commands[i].execute( context );
- if ( saveResult )
- {
- break;
- }
- }
- catch ( Exception e )
- {
- saveException = e;
- break;
- }
- }
-
- // Call postprocess methods on Filters in reverse order
- if ( i >= n )
- { // Fell off the end of the chain
- i--;
- }
- boolean handled = false;
- boolean result = false;
- for ( int j = i; j >= 0; j-- )
- {
- if ( commands[j] instanceof Filter )
- {
- try
- {
- result = ( ( Filter ) commands[j] ).postprocess( context, saveException );
- if ( result )
- {
- handled = true;
- }
- }
- catch ( Exception e )
- {
- ; // Silently ignore
- }
- }
- }
-
- // Return the exception or result state from the last execute()
- if ( ( saveException != null ) && !handled )
- {
- throw saveException;
- }
- else
- {
- return ( saveResult );
- }
- }
-
-
- // -------------------------------------------------------- Package Methods
-
- /**
- * <p>Return an array of the configured {@link Command}s for this
- * {@link Chain}. This method is package private, and is used only
- * for the unit tests.</p>
- */
- Command[] getCommands()
- {
- return ( commands );
- }
+/*
+ * Copyright 1999-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.directory.server.protocol.shared.chain.impl;
+
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.directory.server.protocol.shared.chain.Chain;
+import org.apache.directory.server.protocol.shared.chain.Command;
+import org.apache.directory.server.protocol.shared.chain.Context;
+import org.apache.directory.server.protocol.shared.chain.Filter;
+
+
+/**
+ * <p>Convenience base class for {@link Chain} implementations.</p>
+ *
+ * @author Craig R. McClanahan
+ * @version $Revision$ $Date$
+ */
+public class ChainBase implements Chain
+{
+ // ----------------------------------------------------------- Constructors
+
+ /**
+ * <p>Construct a {@link Chain} with no configured {@link Command}s.</p>
+ */
+ public ChainBase()
+ {
+
+ }
+
+
+ /**
+ * <p>Construct a {@link Chain} configured with the specified
+ * {@link Command}.</p>
+ *
+ * @param command The {@link Command} to be configured
+ *
+ * @exception IllegalArgumentException if <code>command</code>
+ * is <code>null</code>
+ */
+ public ChainBase(Command command)
+ {
+ addCommand( command );
+ }
+
+
+ /**
+ * <p>Construct a {@link Chain} configured with the specified
+ * {@link Command}s.</p>
+ *
+ * @param commands The {@link Command}s to be configured
+ *
+ * @exception IllegalArgumentException if <code>commands</code>,
+ * or one of the individual {@link Command} elements,
+ * is <code>null</code>
+ */
+ public ChainBase(Command[] commands)
+ {
+ if ( commands == null )
+ {
+ throw new IllegalArgumentException();
+ }
+
+ for ( int i = 0; i < commands.length; i++ )
+ {
+ addCommand( commands[i] );
+ }
+ }
+
+
+ /**
+ * <p>Construct a {@link Chain} configured with the specified
+ * {@link Command}s.</p>
+ *
+ * @param commands The {@link Command}s to be configured
+ *
+ * @exception IllegalArgumentException if <code>commands</code>,
+ * or one of the individual {@link Command} elements,
+ * is <code>null</code>
+ */
+ public ChainBase(Collection commands)
+ {
+ if ( commands == null )
+ {
+ throw new IllegalArgumentException();
+ }
+
+ Iterator elements = commands.iterator();
+ while ( elements.hasNext() )
+ {
+ addCommand( ( Command ) elements.next() );
+ }
+ }
+
+ // ----------------------------------------------------- Instance Variables
+
+ /**
+ * <p>The list of {@link Command}s configured for this {@link Chain}, in
+ * the order in which they may delegate processing to the remainder of
+ * the {@link Chain}.</p>
+ */
+ protected Command[] commands = new Command[0];
+
+ /**
+ * <p>Flag indicating whether the configuration of our commands list
+ * has been frozen by a call to the <code>execute()</code> method.</p>
+ */
+ protected boolean frozen = false;
+
+
+ // ---------------------------------------------------------- Chain Methods
+
+ // Documented in Chain interface
+ public void addCommand( Command command )
+ {
+ if ( command == null )
+ {
+ throw new IllegalArgumentException();
+ }
+
+ if ( frozen )
+ {
+ throw new IllegalStateException();
+ }
+
+ Command[] results = new Command[commands.length + 1];
+ System.arraycopy( commands, 0, results, 0, commands.length );
+ results[commands.length] = command;
+ commands = results;
+ }
+
+
+ // Documented in Chain interface
+ public boolean execute( Context context ) throws Exception
+ {
+ // Verify our parameters
+ if ( context == null )
+ {
+ throw new IllegalArgumentException();
+ }
+
+ // Freeze the configuration of the command list
+ frozen = true;
+
+ // Execute the commands in this list until one returns true
+ // or throws an exception
+ boolean saveResult = false;
+ Exception saveException = null;
+ int i = 0;
+ int n = commands.length;
+ ;
+ for ( i = 0; i < n; i++ )
+ {
+ try
+ {
+ saveResult = commands[i].execute( context );
+ if ( saveResult )
+ {
+ break;
+ }
+ }
+ catch ( Exception e )
+ {
+ saveException = e;
+ break;
+ }
+ }
+
+ // Call postprocess methods on Filters in reverse order
+ if ( i >= n )
+ { // Fell off the end of the chain
+ i--;
+ }
+ boolean handled = false;
+ boolean result = false;
+ for ( int j = i; j >= 0; j-- )
+ {
+ if ( commands[j] instanceof Filter )
+ {
+ try
+ {
+ result = ( ( Filter ) commands[j] ).postprocess( context, saveException );
+ if ( result )
+ {
+ handled = true;
+ }
+ }
+ catch ( Exception e )
+ {
+ ; // Silently ignore
+ }
+ }
+ }
+
+ // Return the exception or result state from the last execute()
+ if ( ( saveException != null ) && !handled )
+ {
+ throw saveException;
+ }
+ else
+ {
+ return ( saveResult );
+ }
+ }
+
+
+ // -------------------------------------------------------- Package Methods
+
+ /**
+ * <p>Return an array of the configured {@link Command}s for this
+ * {@link Chain}. This method is package private, and is used only
+ * for the unit tests.</p>
+ */
+ Command[] getCommands()
+ {
+ return ( commands );
+ }
}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/ChainBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/ChainBase.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id
Modified: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/CommandBase.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/CommandBase.java?rev=377135&r1=377134&r2=377135&view=diff
==============================================================================
--- directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/CommandBase.java (original)
+++ directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/CommandBase.java Sat Feb 11 21:50:03 2006
@@ -1,33 +1,33 @@
-/*
- * Copyright 2005 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.directory.server.protocol.shared.chain.impl;
-
-
-import org.apache.directory.server.protocol.shared.chain.Command;
-
-
-/**
- * <p>Convenience base class for {@link Command} implementations.</p>
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$
- */
-public abstract class CommandBase implements Command
-{
- public static final boolean STOP_CHAIN = true;
- public static final boolean CONTINUE_CHAIN = false;
+/*
+ * Copyright 2005 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.directory.server.protocol.shared.chain.impl;
+
+
+import org.apache.directory.server.protocol.shared.chain.Command;
+
+
+/**
+ * <p>Convenience base class for {@link Command} implementations.</p>
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public abstract class CommandBase implements Command
+{
+ public static final boolean STOP_CHAIN = true;
+ public static final boolean CONTINUE_CHAIN = false;
}
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/CommandBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: directory/sandbox/akarasulu/rc1/apacheds/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/chain/impl/CommandBase.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sat Feb 11 21:50:03 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id