directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: rev 37468 - in incubator/directory/eve/branches/multi-listener: . api/src/java/org/apache/eve/decoder api/src/java/org/apache/eve/processor api/src/java/org/apache/eve/protocol impl/src/java/org/apache/eve/processor
Date Fri, 03 Sep 2004 10:28:13 GMT
Author: akarasulu
Date: Fri Sep  3 03:28:12 2004
New Revision: 37468

Added:
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/processor/HandlerTypeEnum.java
      - copied unchanged from rev 37462, incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/processor/HandlerTypeEnum.java
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/processor/ManyReplyHandler.java
      - copied unchanged from rev 37462, incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/processor/ManyReplyHandler.java
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/processor/NoReplyHandler.java
      - copied unchanged from rev 37462, incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/processor/NoReplyHandler.java
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/processor/SingleReplyHandler.java
      - copied unchanged from rev 37462, incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/processor/SingleReplyHandler.java
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/InetServiceEntry.java
  (contents, props changed)
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/InetServicesDatabase.java
  (contents, props changed)
Removed:
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/ProtocolRegistry.java
   incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/processor/HandlerTypeEnum.java
   incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/processor/ManyReplyHandler.java
   incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/processor/NoReplyHandler.java
   incubator/directory/eve/branches/multi-listener/impl/src/java/org/apache/eve/processor/SingleReplyHandler.java
   incubator/directory/eve/branches/multi-listener/maven.xml
Modified:
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/decoder/ClientDecoder.java
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/ProtocolProvider.java
   incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/RequestHandler.java
Log:
Commit changes ...

 o added services database interface
 o added service entry class
 o blew away bogus ProtocolRegistry object which was to be the serv db 
 o moved stuff in impl that should really go into the api
 


Modified: incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/decoder/ClientDecoder.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/decoder/ClientDecoder.java
(original)
+++ incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/decoder/ClientDecoder.java
Fri Sep  3 03:28:12 2004
@@ -14,15 +14,15 @@
  *   limitations under the License.
  *
  */
-package org.apache.eve.decoder ;
+package org.apache.eve.decoder;
 
 
-import org.apache.commons.codec.DecoderException ;
-import org.apache.commons.codec.stateful.DecoderMonitor ;
-import org.apache.commons.codec.stateful.StatefulDecoder ;
-import org.apache.commons.codec.stateful.DecoderCallback ;
+import org.apache.commons.codec.DecoderException;
+import org.apache.commons.codec.stateful.DecoderMonitor;
+import org.apache.commons.codec.stateful.StatefulDecoder;
+import org.apache.commons.codec.stateful.DecoderCallback;
 
-import org.apache.eve.listener.ClientKey ;
+import org.apache.eve.listener.ClientKey;
 
 
 /**
@@ -35,11 +35,11 @@
 public class ClientDecoder implements StatefulDecoder, DecoderCallback
 {
     /** the key of the client this decoder is associated with */ 
-    private final ClientKey key ;
+    private final ClientKey key;
     /** the actual decoder doing the work for us */
-    private final StatefulDecoder decoder ;
+    private final StatefulDecoder decoder;
     /** the callback used by this decoder */
-    private DecoderCallback cb ;
+    private DecoderCallback cb;
     
     
     /**
@@ -50,9 +50,9 @@
      */
     public ClientDecoder( ClientKey key, StatefulDecoder decoder )
     {
-        this.key = key ;
-        this.decoder = decoder ;
-        this.decoder.setCallback( this ) ;
+        this.key = key;
+        this.decoder = decoder;
+        this.decoder.setCallback( this );
     }
     
 
@@ -62,7 +62,7 @@
      */
     public void decode( Object encoded ) throws DecoderException
     {
-        decoder.decode( encoded ) ;
+        decoder.decode( encoded );
     }
 
     
@@ -72,7 +72,7 @@
      */
     public void setCallback( DecoderCallback cb )
     {
-        this.cb = cb ;
+        this.cb = cb;
     }
     
 
@@ -82,7 +82,7 @@
      */
     public void setDecoderMonitor( DecoderMonitor monitor )
     {
-        decoder.setDecoderMonitor( monitor ) ;
+        decoder.setDecoderMonitor( monitor );
     }
 
 
@@ -93,7 +93,7 @@
      */
     public ClientKey getClientKey()
     {
-        return key ;
+        return key;
     }
 
 
@@ -103,6 +103,6 @@
      */
     public void decodeOccurred( StatefulDecoder decoder, Object decoded )
     {
-        cb.decodeOccurred( this, decoded ) ;
+        cb.decodeOccurred( this, decoded );
     }
 }

Added: incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/InetServiceEntry.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/InetServiceEntry.java
Fri Sep  3 03:28:12 2004
@@ -0,0 +1,152 @@
+/*
+ *   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.protocol;
+
+/**
+ * An internet service entry from the services database.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public class InetServiceEntry
+{
+    /** constant for tcp transport protocol */
+    public static final int TCP_TRANS = 0;
+    /** constant for udp transport protocol */
+    public static final int UDP_TRANS = 1;
+
+    /** an empty string array for no aliases */
+    private static final String[] EMPTY_ALIASES = new String[0];
+
+    /** the authoritative name of the service */
+    private final String name;
+    /** the port the service runs on */
+    private final int port;
+    /** alternative names for the service */
+    private final String[] aliases;
+    /** the transport protocol used by the service */
+    private final int proto;
+
+
+    /**
+     * Creates an internet service entry without any aliases using TCP as the
+     * transport protocol.
+     *
+     * @param name the authoritative name of the service
+     * @param port the port the service runs on
+     */
+    public InetServiceEntry( String name, int port )
+    {
+        this( name, port, TCP_TRANS, null );
+    }
+
+
+    /**
+     * Creates an internet service entry without any aliases.
+     *
+     * @param name the authoritative name of the service
+     * @param port the port the service runs on
+     * @param proto the transport protocol used by the service
+     */
+    public InetServiceEntry( String name, int port, int proto )
+    {
+        this( name, port, proto, null );
+    }
+
+
+    /**
+     * Creates an internet service entry.
+     *
+     * @param name the authoritative name of the service
+     * @param port the port the service runs on
+     * @param proto the transport protocol used by the service
+     * @param aliases alternative names for the service
+     */
+    public InetServiceEntry( String name, int port, int proto, String[] aliases )
+    {
+        if ( name == null )
+        {
+            throw new NullPointerException( "an entry name can't be null" );
+        }
+
+        this.name = name;
+        this.port = port;
+        this.proto = proto;
+
+        switch( proto )
+        {
+            case TCP_TRANS: break;
+            case UDP_TRANS: break;
+            default:
+                throw new IllegalArgumentException(
+                        "Unrecognized transport protocol: " + proto );
+        }
+
+        if ( aliases == null )
+        {
+            this.aliases = EMPTY_ALIASES;
+        }
+        else
+        {
+            this.aliases = aliases;
+        }
+    }
+
+
+    /**
+     * Gets the authoritative name of the service.
+     *
+     * @return the authoritative name of the service
+     */
+    public String getName()
+    {
+        return name;
+    }
+
+
+    /**
+     * Gets the port this entry's service runs on.
+     *
+     * @return the port this entry's service runs on
+     */
+    public int getPort()
+    {
+        return port;
+    }
+
+
+    /**
+     * Gets the alternative names for this entry's service.
+     *
+     * @return the alternative names for this entry's service
+     */
+    public String[] getAliases()
+    {
+        return aliases;
+    }
+
+
+    /**
+     * Gets the transport protocol used for this service.
+     *
+     * @return the transport protocol used for this service
+     */
+    public int getProtocol()
+    {
+        return proto;
+    }
+}

Added: incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/InetServicesDatabase.java
==============================================================================
--- (empty file)
+++ incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/InetServicesDatabase.java
Fri Sep  3 03:28:12 2004
@@ -0,0 +1,69 @@
+/*
+ *   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.protocol;
+
+
+import java.util.Iterator;
+
+
+/**
+ * Interface for the internet services database.  The database is used by
+ * jinetd to associate services with ports and transport protocols.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface InetServicesDatabase
+{
+    /**
+     * Gets an iteration over all the entries for a service by the name of the
+     * service.
+     *
+     * @param name the authoritative name of the service
+     * @return an Iterator over InetServiceEntry objects
+     */
+    Iterator getByName( String name );
+
+    /**
+     * Gets an iteration over all the entries for a service by port number.
+     * This method returns an Iterator over the set of InetServiceEntry objects
+     * since more than one transport protocol can be used on the same port.
+     *
+     * @param port the port one which the service resides
+     * @return an Iterator over InetServiceEntry objects
+     */
+    Iterator getByPort( String port );
+
+    /**
+     * Gets the service entry by name using the authoritative service name and
+     * a transport protocol.
+     *
+     * @param name the authoritative name of the service
+     * @param proto the transport protocol used for the service
+     * @return the internet service entry
+     */
+    InetServiceEntry getByName( String name, String proto );
+
+    /**
+     * Gets the service entry by port using the port and a transport protocol.
+     *
+     * @param port the port on which the service resides
+     * @param proto the transport protocol used for the service
+     * @return the internet service entry
+     */
+    InetServiceEntry getByPort( String port, String proto );
+}

Modified: incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/ProtocolProvider.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/ProtocolProvider.java
(original)
+++ incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/ProtocolProvider.java
Fri Sep  3 03:28:12 2004
@@ -30,10 +30,7 @@
  */
 public interface ProtocolProvider
 {
-    StatefulDecoder getDecoder();
-    StatefulEncoder getEncoder();
-    boolean isNoReply( Object request );
-    boolean isSingleReply( Object request );
-    boolean isMultiReply( Object request );
-    
+    StatefulDecoder newDecoder();
+    StatefulEncoder newEncoder();
+    RequestHandler getHandler( Object obj );
 }

Modified: incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/RequestHandler.java
==============================================================================
--- incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/RequestHandler.java
(original)
+++ incubator/directory/eve/branches/multi-listener/api/src/java/org/apache/eve/protocol/RequestHandler.java
Fri Sep  3 03:28:12 2004
@@ -1,30 +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.protocol ;
-
-
-
-/**
- * Root of all request handler types.
- *
- * @author <a href="mailto:directory-dev@incubator.apache.org">
- * Apache Directory Project</a>
- * @version $Rev$
- */
-public interface RequestHandler
-{
-}
+/*
+ *   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.protocol ;
+
+import org.apache.eve.processor.HandlerTypeEnum;
+
+
+/**
+ * Root of all request handler types.
+ *
+ * @author <a href="mailto:directory-dev@incubator.apache.org">
+ * Apache Directory Project</a>
+ * @version $Rev$
+ */
+public interface RequestHandler
+{
+    /**
+     * Gets the handler type.
+     *
+     * @return a HandlerTypeEnum constant.
+     */
+    HandlerTypeEnum getHandlerType() ;
+}

Mime
View raw message