Author: rajith
Date: Tue Oct  9 22:58:49 2012
New Revision: 1396394

URL: http://svn.apache.org/viewvc?rev=1396394&view=rev
Log:
PROTON-66 Added license headers and comments to the driver API classes.

Modified:
    
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java
    
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java
    
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java

Modified: 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java?rev=1396394&r1=1396393&r2=1396394&view=diff
==============================================================================
--- 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java
 (original)
+++ 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Connector.java
 Tue Oct  9 22:58:49 2012
@@ -1,77 +1,104 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.qpid.proton.driver;
 
 import org.apache.qpid.proton.engine.Connection;
 import org.apache.qpid.proton.engine.Sasl;
 
+/**
+ * Client API
+ *
+ * @param <C> application supplied context
+ */
 public interface Connector<C>
 {
     /** Service the given connector.
-         *
-         * Handle any inbound data, outbound data, or timing events pending on
-         * the connector.
-         *
-         */
-        void process();
-
-        /** Access the listener which opened this connector.
-         *
-         * @return the listener which created this connector, or NULL if the
-         *         connector has no listener (e.g. an outbound client
-         *         connection)
-         */
-        Listener listener();
-
-        /** Access the Authentication and Security context of the connector.
-         *
-         * @return the Authentication and Security context for the connector,
-         *         or NULL if none
-         */
-        Sasl sasl();
-
-        /** Access the AMQP Connection associated with the connector.
-         *
-         * @return the connection context for the connector, or NULL if none
-         */
-        Connection getConnection();
-
-        /** Assign the AMQP Connection associated with the connector.
-         *
-         * @param connection the connection to associate with the
-         *                       connector
-         */
-        void setConnection(Connection connection);
-
-        /** Access the application context that is associated with the
-         *  connector.
-         *
-         * @return the application context that was passed to pn_connector()
-         *         or pn_connector_fd()
-         */
-        C getContext();
-
-        /** Assign a new application context to the connector.
-         *
-         * @param[in] context new application context to associate with the
-         *                    connector
-         */
-        void setContext(C context);
-
-        /** Close the socket used by the connector.
-         *
-        */
-        void close();
-
-        /** Determine if the connector is closed.
-         *
-         * @return True if closed, otherwise false
-         */
-        boolean isClosed();
-
-        /** Destructor for the given connector.
-         *
-         * Assumes the connector's socket has been closed prior to call.
-         *
-         */
-        void destroy();
-
+     *
+     * Handle any inbound data, outbound data, or timing events pending on
+     * the connector.
+     *
+     */
+    void process();
+
+    /** Access the listener which opened this connector.
+     *
+     * @return the listener which created this connector, or NULL if the
+     *         connector has no listener (e.g. an outbound client
+     *         connection).
+     */
+    @SuppressWarnings("rawtypes")
+    Listener listener();
+
+    /** Access the Authentication and Security context of the connector.
+     *
+     * @return the Authentication and Security context for the connector,
+     *         or NULL if none.
+     */
+    Sasl sasl();
+
+    /** Access the AMQP Connection associated with the connector.
+     *
+     * @return the connection context for the connector, or NULL if none.
+     */
+    Connection getConnection();
+
+    /** Assign the AMQP Connection associated with the connector.
+     *
+     * @param connection the connection to associate with the connector.
+     */
+    void setConnection(Connection connection);
+
+    /**
+     * Access the application context that is associated with the connector.
+     *
+     * @return the application context that was passed when creating this
+     *         connector. See
+     *         {@link Driver#createConnector(String, int, Object)
+     *         createConnector(String, int, Object)} and
+     *         {@link 
Driver#createConnector(java.nio.channels.SelectableChannel, Object)
+     *         createConnector(java.nio.channels.SelectableChannel, Object)}.
+     */
+    C getContext();
+
+    /** Assign a new application context to the connector.
+     *
+     * @param context new application context to associate with the connector
+     */
+    void setContext(C context);
+
+    /** Close the socket used by the connector.
+     *
+     */
+    void close();
+
+    /** Determine if the connector is closed.
+     *
+     * @return True if closed, otherwise false
+     */
+    boolean isClosed();
+
+    /** Destructor for the given connector.
+     *
+     * Assumes the connector's socket has been closed prior to call.
+     *
+     */
+    void destroy();
 }

Modified: 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java?rev=1396394&r1=1396393&r2=1396394&view=diff
==============================================================================
--- 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java
 (original)
+++ 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Driver.java
 Tue Oct  9 22:58:49 2012
@@ -1,88 +1,123 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.qpid.proton.driver;
 
 import java.nio.channels.SelectableChannel;
 import java.nio.channels.ServerSocketChannel;
 
+/**
+ * The Driver interface provides an abstraction for an implementation of
+ * a driver for the proton engine.
+ * A driver is responsible for providing input, output, and tick events,
+ * to the bottom half of the engine API. TODO See ::pn_input, ::pn_output, and
+ * ::pn_tick.
+ * The driver also provides an interface for the application to access,
+ * the top half of the API when the state of the engine may have changed
+ * due to I/O or timing events. Additionally the driver incorporates the SASL
+ * engine as well in order to provide a complete network stack: AMQP over SASL
+ * over TCP.
+ */
+
 public interface Driver
 {
-    /** Force pn_driver_wait() to return
+    /**
+     * Force wait() to return
      *
      */
     void wakeup();
 
-    /** Wait for an active connector or listener
+    /**
+     * Wait for an active connector or listener
      *
-     * @param[in] timeout maximum time in milliseconds to wait, -1 means
-     *                    infinite wait
+     * @param timeout maximum time in milliseconds to wait.
+     *                0 means infinite wait
      */
     void doWait(int timeout);
 
-    /** Get the next listener with pending data in the driver.
+    /**
+     * Get the next listener with pending data in the driver.
      *
      * @return NULL if no active listener available
      */
+    @SuppressWarnings("rawtypes")
     Listener listener();
 
-    /** Get the next active connector in the driver.
+    /**
+     * Get the next active connector in the driver.
      *
-     * Returns the next connector with pending inbound data, available
-     * capacity for outbound data, or pending tick.
+     * Returns the next connector with pending inbound data, available capacity
+     * for outbound data, or pending tick.
      *
      * @return NULL if no active connector available
      */
+    @SuppressWarnings("rawtypes")
     Connector connector();
 
-    /** Destruct the driver and all associated
-     *  listeners and connectors.
+    /**
+     * Destruct the driver and all associated listeners, connectors and other 
resources.
      */
     void destroy();
 
-
-
-    /** Construct a listener for the given address.
+    /**
+     * Construct a listener for the given address.
      *
      * @param host local host address to listen on
      * @param port local port to listen on
      * @param context application-supplied, can be accessed via
-     *                    pn_listener_context()
+     *                {@link Listener#getContext() getContext()} method on a 
listener.
      * @return a new listener on the given host:port, NULL if error
      */
     <C> Listener<C> createListener(String host, int port, C context);
 
-    /** Create a listener using the existing channel.
+    /**
+     * Create a listener using the existing channel.
      *
-     * @param c existing file descriptor for listener to listen on
+     * @param c   existing SocketChannel for listener to listen on
      * @param context application-supplied, can be accessed via
-     *                    pn_listener_context()
+     *                {@link Listener#getContext() getContext()} method on a 
listener.
      * @return a new listener on the given channel, NULL if error
      */
-    <C> Listener<C>  createListener(ServerSocketChannel c, C context);
+    <C> Listener<C> createListener(ServerSocketChannel c, C context);
 
-
-    /** Construct a connector to the given remote address.
+    /**
+     * Construct a connector to the given remote address.
      *
      * @param host remote host to connect to.
      * @param port remote port to connect to.
-     * @param context application supplied, can be accessed via
-     *                    pn_connector_context() @return a new connector
-     *                    to the given remote, or NULL on error.
+     * @param context application-supplied, can be accessed via
+     *                {@link Connector#getContext() getContext()} method on a 
listener.
+     *
+     * @return a new connector to the given remote, or NULL on error.
      */
     <C> Connector<C> createConnector(String host, int port, C context);
 
-    /** Create a connector using the existing file descriptor.
+    /**
+     * Create a connector using the existing file descriptor.
      *
-     * @param fd existing file descriptor to use for this connector.
+     * @param c   existing SocketChannel for listener to listen on
      * @param context application-supplied, can be accessed via
-     *                    pn_connector_context()
+     *                {@link Connector#getContext() getContext()} method on a 
listener.
+     *
      * @return a new connector to the given host:port, NULL if error.
      */
     <C> Connector<C> createConnector(SelectableChannel fd, C context);
-
-    /** Set the tracing level for the given connector.
-     *
-     * @param trace the trace level to use.
-     */
-    //void pn_connector_trace(pn_connector_t *connector, pn_trace_t trace);
-
-
 }

Modified: 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java
URL: 
http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java?rev=1396394&r1=1396393&r2=1396394&view=diff
==============================================================================
--- 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java
 (original)
+++ 
qpid/proton/trunk/proton-j/src/main/java/org/apache/qpid/proton/driver/Listener.java
 Tue Oct  9 22:58:49 2012
@@ -1,44 +1,61 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.qpid.proton.driver;
 
+/**
+ * Server API.
+ *
+ * @param <C> application supplied context
+ */
 public interface Listener<C>
 {
-    /** pn_listener - the server API **/
-
-
     /**
-     * @todo pn_listener_trace needs documentation
-     */
-    //void pn_listener_trace(pn_listener_t *listener, pn_trace_t trace);
-
-    /** Accept a connection that is pending on the listener.
+     * Accept a connection that is pending on the listener.
      *
-     * @param[in] listener the listener to accept the connection on
-     * @return a new connector for the remote, or NULL on error
+     * @return a new connector for the remote, or NULL on error.
      */
-    Connector accept();
+    Connector<C> accept();
 
-    /** Access the application context that is associated with the listener.
+    /**
+     * Access the application context that is associated with the listener.
      *
-     * @param[in] listener the listener whose context is to be returned
-     * @return the application context that was passed to pn_listener() or
-     *         pn_listener_fd()
+     * @return the application context that was passed when creating this
+     *         listener. See {@link Driver#createListener(String, int, Object)
+     *         createListener(String, int, Object)} and
+     *         {@link 
Driver#createConnector(java.nio.channels.SelectableChannel, Object)
+     *         createConnector(java.nio.channels.SelectableChannel, Object)}
      */
     C getContext();
 
-    /** Close the socket used by the listener.
+    /**
+     * Close the socket used by the listener.
      *
-     * @param[in] listener the listener whose socket will be closed.
      */
     void close();
 
-    /** Destructor for the given listener.
+    /**
+     * Destructor for the given listener.
      *
      * Assumes the listener's socket has been closed prior to call.
      *
-     * @param[in] listener the listener object to destroy, no longer valid
-     *            on return
      */
     void destroy();
-
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to