james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject svn commit: r1720565 - in /james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve: api/commands/GetActive.java core/CoreProcessor.java transcode/ManageSieveProcessor.java
Date Thu, 17 Dec 2015 14:52:25 GMT
Author: btellier
Date: Thu Dec 17 14:52:25 2015
New Revision: 1720565

URL: http://svn.apache.org/viewvc?rev=1720565&view=rev
Log:
JAMES-1618 Add a tool for recognising commands

Modified:
    james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetActive.java
    james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
    james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java

Modified: james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetActive.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetActive.java?rev=1720565&r1=1720564&r2=1720565&view=diff
==============================================================================
--- james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetActive.java
(original)
+++ james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetActive.java
Thu Dec 17 14:52:25 2015
@@ -26,7 +26,7 @@ import org.apache.james.sieverepository.
 import org.apache.james.sieverepository.api.exception.StorageException;
 
 /**
- * <code>GetScript</code> is an extension to the commands defined by RFC 5804.
It provides a means
+ * <code>GetActive</code> is an extension to the commands defined by RFC 5804.
It provides a means
  * of retrieving a user's currently active script in a single call. The alternative using
RFC 5804
  * mandated commands is to call ListScripts, parse the result to identify the active script
and 
  * call GetScript to retrieve it. 

Modified: james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java?rev=1720565&r1=1720564&r2=1720565&view=diff
==============================================================================
--- james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
(original)
+++ james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
Thu Dec 17 14:52:25 2015
@@ -49,7 +49,7 @@ public class CoreProcessor implements Co
     
     public static final String IMPLEMENTATION_DESCRIPTION = "Apache ManageSieve v1.0";
     public static final String MANAGE_SIEVE_VERSION = "1.0";
-    
+
     private final SieveRepository sieveRepository;
     private final UsersRepository usersRepository;
     private final SieveParser parser;

Modified: james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java
URL: http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java?rev=1720565&r1=1720564&r2=1720565&view=diff
==============================================================================
--- james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java
(original)
+++ james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/ManageSieveProcessor.java
Thu Dec 17 14:52:25 2015
@@ -22,12 +22,74 @@ package org.apache.james.managesieve.tra
 
 import org.apache.james.managesieve.api.ManageSieveException;
 import org.apache.james.managesieve.api.Session;
+import org.apache.james.managesieve.api.SieveParser;
+import org.apache.james.managesieve.core.CoreProcessor;
+import org.apache.james.managesieve.jsieve.Parser;
+import org.apache.james.sieverepository.api.SieveRepository;
 import org.apache.james.sieverepository.api.exception.SieveRepositoryException;
+import org.apache.james.user.api.UsersRepository;
 
 public class ManageSieveProcessor {
 
+    public static final String AUTHENTICATE = "AUTHENTICATE";
+    public static final String CAPABILITY = "CAPABILITY";
+    public static final String CHECKSCRIPT = "CHECKSCRIPT";
+    public static final String DELETESCRIPT = "DELETESCRIPT";
+    public static final String GETACTIVE = "GETACTIVE";
+    public static final String GETSCRIPT = "GETSCRIPT";
+    public static final String HAVESPACE = "HAVESPACE";
+    public static final String LISTSCRIPTS = "LISTSCRIPTS";
+    public static final String LOGOUT = "LOGOUT";
+    public static final String NOOP = "NOOP";
+    public static final String PUTSCRIPT = "PUTSCRIPT";
+    public static final String RENAMESCRIPT = "RENAMESCRIPT";
+    public static final String SETACTIVE = "SETACTIVE";
+    public static final String STARTTLS = "STARTTLS";
+    public static final String UNAUTHENTICATE = "UNAUTHENTICATE";
+
+    private final LineToCoreToLine lineToCoreToLine;
+
+    public ManageSieveProcessor(LineToCoreToLine lineToCoreToLine) {
+        this.lineToCoreToLine = lineToCoreToLine;
+    }
+
     public String handleRequest(Session session, String request) throws ManageSieveException,
SieveRepositoryException {
-        return "Default message for " + request;
+        int firstWordEndIndex = request.indexOf(' ');
+        String command = request.substring(0, firstWordEndIndex);
+        String arguments = request.substring(firstWordEndIndex);
+        if (command.equals(AUTHENTICATE)) {
+            return "NO AUTHENTICATE command not yet implemented";
+        } else if (command.equals(CAPABILITY)) {
+            return lineToCoreToLine.capability(session, arguments);
+        } else if (command.equals(CHECKSCRIPT)) {
+            return lineToCoreToLine.checkScript(session, arguments);
+        } else if (command.equals(DELETESCRIPT)) {
+            return lineToCoreToLine.checkScript(session, arguments);
+        } else if (command.equals(GETACTIVE)) {
+            return lineToCoreToLine.getActive(session, arguments);
+        } else if (command.equals(GETSCRIPT)) {
+            return lineToCoreToLine.getScript(session, arguments);
+        } else if (command.equals(HAVESPACE)) {
+            return lineToCoreToLine.haveSpace(session, arguments);
+        } else if (command.equals(LISTSCRIPTS)) {
+            return lineToCoreToLine.listScripts(session, arguments);
+        } else if (command.equals(LOGOUT)) {
+            return "NO LOGOUT command not yet implemented";
+        } else if (command.equals(NOOP)) {
+            return "NO NOOP command not yet implemented";
+        } else if (command.equals(PUTSCRIPT)) {
+            return lineToCoreToLine.putScript(session, arguments);
+        } else if (command.equals(RENAMESCRIPT)) {
+            return lineToCoreToLine.renameScript(session, arguments);
+        } else if (command.equals(SETACTIVE)) {
+            return lineToCoreToLine.setActive(session, arguments);
+        } else if (command.equals(STARTTLS)) {
+            return "NO STARTTLS command not yet implemented";
+        } else if (command.equals(UNAUTHENTICATE)) {
+            return "NO UNAUTHENTICATE command not yet handled";
+        } else {
+            return "NO unknown " + command + " command";
+        }
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message