Added: 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/ConnectHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/ConnectHandler.java?rev=900731&view=auto
==============================================================================
--- 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/ConnectHandler.java
 (added)
+++ 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/ConnectHandler.java
 Tue Jan 19 11:34:58 2010
@@ -0,0 +1,36 @@
+/****************************************************************
+ * 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.james.api.protocol;
+
+/**
+ * Custom connect handlers must implement this interface
+ * The connect handlers will be server-wide common to all the Handlers ,
+ * therefore the handlers must store all the state information
+ * in the Session object
+ */
+public interface ConnectHandler<Session extends ProtocolSession> {
+    /**
+     * Handle connection
+    **/
+    public void onConnect(Session session);
+
+}

Added: 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java?rev=900731&view=auto
==============================================================================
--- 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java
 (added)
+++ 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LineHandler.java
 Tue Jan 19 11:34:58 2010
@@ -0,0 +1,34 @@
+/****************************************************************
+ * 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.james.api.protocol;
+
+/**
+ * Custom line handlers must implement this interface
+ */
+public interface LineHandler<Session extends ProtocolSession> {
+     
+    /**
+     * Handle the command.
+     * @param session not null
+     * @param line not null 
+     */
+    public void onLine(Session session, String line);
+    
+}

Copied: 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/ProtocolSession.java
 (from r900284, 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LogEnabledSession.java)
URL: 
http://svn.apache.org/viewvc/james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/ProtocolSession.java?p2=james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/ProtocolSession.java&p1=james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LogEnabledSession.java&r1=900284&r2=900731&rev=900731&view=diff
==============================================================================
--- 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/LogEnabledSession.java
 (original)
+++ 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/ProtocolSession.java
 Tue Jan 19 11:34:58 2010
@@ -23,7 +23,13 @@
 
 import org.apache.commons.logging.Log;
 
-public interface LogEnabledSession {
+/**
+ * Session for a protcol. Every new connection generates a new session
+ * 
+ *
+ */
+public interface ProtocolSession {
+   
     /**
      * Gets the context sensitive log for this session.
      * @return log, not null
@@ -42,4 +48,25 @@
      * Reset the state
      */
     public void resetState();
+    
+    /**
+     * Write the response back to the client
+     * 
+     * @param response
+     */
+    public void writeResponse(Response response);
+    
+    /**
+     * Returns host name of the client
+     *
+     * @return hostname of the client
+     */
+    public String getRemoteHost();
+
+    /**
+     * Returns host ip address of the client
+     *
+     * @return host ip address of the client
+     */
+    public String getRemoteIPAddress();
 }

Added: 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/Request.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/Request.java?rev=900731&view=auto
==============================================================================
--- 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/Request.java
 (added)
+++ 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/Request.java
 Tue Jan 19 11:34:58 2010
@@ -0,0 +1,43 @@
+/****************************************************************
+ * 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.james.api.protocol;
+
+/**
+ * Request received from the client
+ * 
+ *
+ */
+public interface Request {
+
+    
+    /**
+     * Return the current argument. If there is no argument null is returned
+     * 
+     * @return argument
+     */
+    public String getArgument();
+
+    /**
+     * Return the current command
+     * 
+     * @return command
+     */
+    public String getCommand();
+}

Added: 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/Response.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/Response.java?rev=900731&view=auto
==============================================================================
--- 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/Response.java
 (added)
+++ 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/Response.java
 Tue Jan 19 11:34:58 2010
@@ -0,0 +1,66 @@
+/****************************************************************
+ * 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.james.api.protocol;
+
+import java.util.List;
+
+/**
+ * Protocol response to send to the client
+ * 
+ *
+ */
+public interface Response {
+
+    
+    /**
+     * Append line to response
+     * 
+     * @param line 
+     */
+    public void appendLine(CharSequence line);
+   
+    /**
+     * Return a List of all response lines stored in this Response
+     * 
+     * @return all responseLines
+     */
+    public List<CharSequence> getLines();
+
+    /**
+     * Return the raw representation of the stored Response
+     * 
+     * @return rawLine the raw Response
+     */
+    public String getRawLine();
+
+    /**
+     * Return true if the session is ended
+     * 
+     * @return true if session is ended
+     */
+    public boolean isEndSession();
+    /**
+     * Set to true to end the session
+     * 
+     * @param endSession
+     */
+    public void setEndSession(boolean endSession);
+
+}

Added: 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/RetCodeResponse.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/RetCodeResponse.java?rev=900731&view=auto
==============================================================================
--- 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/RetCodeResponse.java
 (added)
+++ 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/RetCodeResponse.java
 Tue Jan 19 11:34:58 2010
@@ -0,0 +1,42 @@
+/****************************************************************
+ * 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.james.api.protocol;
+
+/**
+ * Response which use return code 
+ * 
+ *
+ */
+public interface RetCodeResponse extends Response{
+
+    /**
+     * Return return-code
+     * @return
+     */
+    public String getRetCode();
+
+
+    /**
+     * Set the return-code used for this response
+     * 
+     * @param retCode
+     */
+    public void setRetCode(String retCode);
+}

Modified: 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/TLSSupportedSession.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/TLSSupportedSession.java?rev=900731&r1=900730&r2=900731&view=diff
==============================================================================
--- 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/TLSSupportedSession.java
 (original)
+++ 
james/server/trunk/socket-api/src/main/java/org/apache/james/api/protocol/TLSSupportedSession.java
 Tue Jan 19 11:34:58 2010
@@ -27,7 +27,7 @@
  * 
  *
  */
-public interface TLSSupportedSession extends LogEnabledSession{
+public interface TLSSupportedSession extends ProtocolSession{
     /**
      * Returns the user name associated with this interaction.
      *
@@ -43,19 +43,7 @@
     void setUser(String user);
     
 
-    /**
-     * Returns host name of the client
-     *
-     * @return hostname of the client
-     */
-    String getRemoteHost();
-
-    /**
-     * Returns host ip address of the client
-     *
-     * @return host ip address of the client
-     */
-    String getRemoteIPAddress();
+  
        /**
         * Return true if StartTLS is supported by the configuration
         * 



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

Reply via email to