You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@excalibur.apache.org by bl...@apache.org on 2004/06/24 22:43:04 UTC
svn commit: rev 22083 - excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util
Author: bloritsch
Date: Thu Jun 24 13:43:03 2004
New Revision: 22083
Added:
excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util/CommandSink.java
Log:
add CommandSink to keep things compatible
Added: excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util/CommandSink.java
==============================================================================
--- (empty file)
+++ excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util/CommandSink.java Thu Jun 24 13:43:03 2004
@@ -0,0 +1,76 @@
+package org.apache.avalon.fortress.util;
+
+import org.d_haven.event.Sink;
+import org.d_haven.event.SinkException;
+import org.d_haven.event.PreparedEnqueue;
+import org.d_haven.event.command.CommandManager;
+import org.d_haven.event.command.Command;
+
+/**
+ * Created by IntelliJ IDEA. User: bloritsch Date: Jun 24, 2004 Time:
+ * 2:59:37 PM To change this template use File | Settings | File
+ * Templates.
+ */
+public class CommandSink implements Sink
+{
+ private final CommandManager m_manager;
+
+ public CommandSink(CommandManager manager)
+ {
+ if (manager == null) throw new IllegalArgumentException("manager");
+
+ m_manager = manager;
+ }
+
+ public void enqueue( Object o ) throws SinkException
+ {
+ checkValid( o );
+ m_manager.enqueueCommand( (Command)o );
+ }
+
+ private void checkValid( Object o )
+ throws SinkException
+ {
+ if ( ! (o instanceof Command) ) throw new SinkException("The object must be a command");
+ }
+
+ public void enqueue( Object[] objects ) throws SinkException
+ {
+ for (int i = 0; i < objects.length; i++)
+ {
+ checkValid( objects[i] );
+ }
+
+ for (int i = 0; i < objects.length; i++)
+ {
+ m_manager.enqueueCommand( (Command) objects[i] );
+ }
+ }
+
+ public boolean tryEnqueue( Object o )
+ {
+ boolean didEnqueue = true;
+
+ try
+ {
+ enqueue(o);
+ }
+ catch (SinkException se)
+ {
+ didEnqueue = false;
+ }
+
+ return didEnqueue;
+ }
+
+ public PreparedEnqueue prepareEnqueue( Object[] objects )
+ throws SinkException
+ {
+ throw new SinkException("Method not supported");
+ }
+
+ public int size()
+ {
+ return -1;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: scm-unsubscribe@excalibur.apache.org
For additional commands, e-mail: scm-help@excalibur.apache.org
Re: svn commit: rev 22083 - excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util
Posted by Berin Loritsch <bl...@d-haven.org>.
Leo Simons wrote:
> bloritsch@apache.org wrote:
>
>> Added:
>> excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util/CommandSink.java
>>
>> ==============================================================================
>>
>> --- (empty file)
>> +++
>> excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util/CommandSink.java
>> Thu Jun 24 13:43:03 2004
>> @@ -0,0 +1,76 @@
>> +package org.apache.avalon.fortress.util;
>
>
> license header, pleez!
Sorry. I'll take care of it soon.
--
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe trying to
produce bigger and better idiots. So far, the Universe is winning."
- Rich Cook
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/
Re: svn commit: rev 22083 - excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util
Posted by Leo Simons <ls...@jicarilla.org>.
bloritsch@apache.org wrote:
> Added: excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util/CommandSink.java
> ==============================================================================
> --- (empty file)
> +++ excalibur/trunk/fortress/container-impl/src/java/org/apache/avalon/fortress/util/CommandSink.java Thu Jun 24 13:43:03 2004
> @@ -0,0 +1,76 @@
> +package org.apache.avalon.fortress.util;
license header, pleez!
- LSD
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@excalibur.apache.org
For additional commands, e-mail: dev-help@excalibur.apache.org
Apache Excalibur Project -- URL: http://excalibur.apache.org/