Author: btellier
Date: Wed Nov 25 16:01:15 2015
New Revision: 1716451
URL: http://svn.apache.org/viewvc?rev=1716451&view=rev
Log:
PROTOCOLS-68 Add a Protocols ManageSieve project
Added:
james/project/trunk/protocols/managesieve/
james/project/trunk/protocols/managesieve/pom.xml
james/project/trunk/protocols/managesieve/src/
james/project/trunk/protocols/managesieve/src/main/
james/project/trunk/protocols/managesieve/src/main/java/
james/project/trunk/protocols/managesieve/src/main/java/org/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ArgumentException.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationException.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationRequiredException.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ConfigurationError.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveError.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveException.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveRuntimeException.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/Session.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SieveParser.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SyntaxException.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Authenticate.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Capability.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CheckScript.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CoreCommands.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/DeleteScript.java
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/api/commands/GetScript.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/HaveSpace.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/LineCommands.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/ListScripts.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Logout.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Noop.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/PutScript.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/RenameScript.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/SetActive.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/StartTLS.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Unauthenticate.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/
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/jsieve/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/jsieve/Parser.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCoreToLine.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/util/
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/util/ParserUtils.java
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/util/SettableSession.java
james/project/trunk/protocols/managesieve/src/test/
james/project/trunk/protocols/managesieve/src/test/java/
james/project/trunk/protocols/managesieve/src/test/java/org/
james/project/trunk/protocols/managesieve/src/test/java/org/apache/
james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/
james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/
james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/core/
james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/core/CoreProcessorTestCase.java
james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/mock/
james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/mock/MockSession.java
james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/mock/MockSieveParser.java
james/project/trunk/protocols/managesieve/src/test/java/org/apache/james/managesieve/mock/MockSieveRepository.java
Modified:
james/project/trunk/protocols/pom.xml
james/project/trunk/server/app/pom.xml
james/project/trunk/server/container/spring/pom.xml
james/project/trunk/server/pom.xml
Added: james/project/trunk/protocols/managesieve/pom.xml
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/pom.xml?rev=1716451&view=auto
==============================================================================
--- james/project/trunk/protocols/managesieve/pom.xml (added)
+++ james/project/trunk/protocols/managesieve/pom.xml Wed Nov 25 16:01:15 2015
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>protocols</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>1.6.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.james.protocols</groupId>
+ <artifactId>protocols-managesieve</artifactId>
+ <packaging>bundle</packaging>
+
+ <name>Apache James :: Protocols :: ManageSieve</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>apache-jsieve-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-data-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ArgumentException.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ArgumentException.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ArgumentException.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ArgumentException.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,65 @@
+/*
+ * 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.managesieve.api;
+
+/**
+ * <code>ArgumentException</code>
+ */
+public class ArgumentException extends ManageSieveException {
+
+ private static final long serialVersionUID = -7407426714052613820L;
+
+ /**
+ * Creates a new instance of ArgumentException.
+ *
+ */
+ public ArgumentException() {
+ }
+
+ /**
+ * Creates a new instance of ArgumentException.
+ *
+ * @param message
+ * @param cause
+ */
+ public ArgumentException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Creates a new instance of ArgumentException.
+ *
+ * @param message
+ */
+ public ArgumentException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new instance of ArgumentException.
+ *
+ * @param cause
+ */
+ public ArgumentException(Throwable cause) {
+ super(cause);
+ }
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationException.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationException.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationException.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationException.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,26 @@
+/*
+ * 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.managesieve.api;
+
+public class AuthenticationException extends ManageSieveException
+{
+ private static final long serialVersionUID = -7564649071256099047L;
+}
\ No newline at end of file
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationRequiredException.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationRequiredException.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationRequiredException.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/AuthenticationRequiredException.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,26 @@
+/*
+ * 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.managesieve.api;
+
+public class AuthenticationRequiredException extends ManageSieveException
+{
+ private static final long serialVersionUID = 4992598322874189613L;
+}
\ No newline at end of file
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ConfigurationError.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ConfigurationError.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ConfigurationError.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ConfigurationError.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,68 @@
+/*
+ * 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.managesieve.api;
+
+/**
+ * <code>ConfigurationError</code>
+ */
+public class ConfigurationError extends ManageSieveError {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 5350261185844873258L;
+
+ /**
+ * Creates a new instance of ConfigurationError.
+ *
+ */
+ public ConfigurationError() {
+ }
+
+ /**
+ * Creates a new instance of ConfigurationError.
+ *
+ * @param message
+ */
+ public ConfigurationError(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new instance of ConfigurationError.
+ *
+ * @param cause
+ */
+ public ConfigurationError(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates a new instance of ConfigurationError.
+ *
+ * @param message
+ * @param cause
+ */
+ public ConfigurationError(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveError.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveError.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveError.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveError.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,65 @@
+/*
+ * 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.managesieve.api;
+
+/**
+ * <code>ManageSieveError</code>
+ */
+public class ManageSieveError extends Error {
+
+ private static final long serialVersionUID = 1488887751782386767L;
+
+ /**
+ * Creates a new instance of ManageSieveError.
+ *
+ */
+ public ManageSieveError() {
+ }
+
+ /**
+ * Creates a new instance of ManageSieveError.
+ *
+ * @param message
+ */
+ public ManageSieveError(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new instance of ManageSieveError.
+ *
+ * @param cause
+ */
+ public ManageSieveError(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates a new instance of ManageSieveError.
+ *
+ * @param message
+ * @param cause
+ */
+ public ManageSieveError(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveException.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveException.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveException.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveException.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,62 @@
+/*
+ * 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.managesieve.api;
+
+public class ManageSieveException extends Exception
+{
+ /**
+ * Creates a new instance of ManageSieveException.
+ *
+ */
+ public ManageSieveException() {
+ super();
+ }
+
+ /**
+ * Creates a new instance of ManageSieveException.
+ *
+ * @param message
+ * @param cause
+ */
+ public ManageSieveException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Creates a new instance of ManageSieveException.
+ *
+ * @param message
+ */
+ public ManageSieveException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new instance of ManageSieveException.
+ *
+ * @param cause
+ */
+ public ManageSieveException(Throwable cause) {
+ super(cause);
+ }
+
+ private static final long serialVersionUID = -1446993382609775076L;
+}
\ No newline at end of file
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveRuntimeException.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveRuntimeException.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveRuntimeException.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/ManageSieveRuntimeException.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,65 @@
+/*
+ * 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.managesieve.api;
+
+/**
+ * <code>ManageSieveRuntimeException</code>
+ */
+public class ManageSieveRuntimeException extends RuntimeException {
+
+ private static final long serialVersionUID = 6344283243541187693L;
+
+ /**
+ * Creates a new instance of ManageSieveRuntimeException.
+ *
+ */
+ public ManageSieveRuntimeException() {
+ }
+
+ /**
+ * Creates a new instance of ManageSieveRuntimeException.
+ *
+ * @param message
+ */
+ public ManageSieveRuntimeException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new instance of ManageSieveRuntimeException.
+ *
+ * @param cause
+ */
+ public ManageSieveRuntimeException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates a new instance of ManageSieveRuntimeException.
+ *
+ * @param message
+ * @param cause
+ */
+ public ManageSieveRuntimeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/Session.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/Session.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/Session.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/Session.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,50 @@
+/*
+ * 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.managesieve.api;
+
+/**
+ * <code>Session</code>
+ */
+public interface Session {
+
+ public interface UserListener
+ {
+ abstract public void notifyChange(String user);
+ }
+
+ abstract public String getUser();
+
+ abstract public void addUserListener(UserListener listener);
+
+ abstract public void removeUserListener(UserListener listener);
+
+ public interface AuthenticationListener
+ {
+ abstract public void notifyChange(boolean isAuthenticated);
+ }
+
+ abstract public boolean isAuthenticated();
+
+ abstract public void addAuthenticationListener(AuthenticationListener
listener);
+
+ abstract public void removeAuthenticationListener(AuthenticationListener
listener);
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SieveParser.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SieveParser.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SieveParser.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SieveParser.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,35 @@
+/*
+ * 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.managesieve.api;
+
+import java.util.List;
+
+
+/**
+ * <code>SieveParser</code>
+ */
+public interface SieveParser {
+
+ abstract List<String> parse(String content) throws SyntaxException;
+
+ abstract List<String> getExtensions();
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SyntaxException.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SyntaxException.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SyntaxException.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/SyntaxException.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,63 @@
+/*
+ * 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.managesieve.api;
+
+public class SyntaxException extends ManageSieveException
+{
+ private static final long serialVersionUID = 2336683565743503262L;
+
+ /**
+ * Creates a new instance of SyntaxException.
+ *
+ */
+ public SyntaxException() {
+ super();
+ }
+
+ /**
+ * Creates a new instance of SyntaxException.
+ *
+ * @param message
+ * @param cause
+ */
+ public SyntaxException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Creates a new instance of SyntaxException.
+ *
+ * @param message
+ */
+ public SyntaxException(String message) {
+ super(message);
+ }
+
+ /**
+ * Creates a new instance of SyntaxException.
+ *
+ * @param cause
+ */
+ public SyntaxException(Throwable cause) {
+ super(cause);
+ }
+
+}
\ No newline at end of file
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Authenticate.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Authenticate.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Authenticate.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Authenticate.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,38 @@
+/*
+ * 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.managesieve.api.commands;
+
+import org.apache.james.managesieve.api.AuthenticationException;
+
+
+/**
+ * <code>Authenticate</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.1>RFC 5804
AUTHENTICATE Command</a>
+ *
+ */
+public interface Authenticate {
+
+ abstract public void authenticate(String mechanism) throws
AuthenticationException;
+
+ abstract public void authenticate(String mechanism, String initialData)
throws AuthenticationException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Capability.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Capability.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Capability.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Capability.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,51 @@
+/*
+ * 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.managesieve.api.commands;
+
+import java.util.Map;
+
+/**
+ * <code>Capability</code>
+ */
+public interface Capability {
+
+ abstract public Map<Capabilities, String> capability();
+
+ /**
+ * <code>Capabilities</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.4>RFC 5804
CAPABILITY Command</a>
+ */
+ public enum Capabilities {
+ IMPLEMENTATION,
+ SASL,
+ SIEVE,
+ STARTTLS,
+ MAXREDIRECTS,
+ NOTIFY,
+ LANGUAGE,
+ OWNER,
+ VERSION,
+ UNAUTHENTICATE,
+ GETACTIVE
+ }
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CheckScript.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CheckScript.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CheckScript.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CheckScript.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,37 @@
+/*
+ * 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.managesieve.api.commands;
+
+import java.util.List;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.managesieve.api.SyntaxException;
+
+/**
+ * <code>CheckScript</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.12>RFC 5804
CHECKSCRIPT Command</a>
+ */
+public interface CheckScript {
+
+ abstract public List<String> checkScript(String content) throws
AuthenticationRequiredException, SyntaxException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CoreCommands.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CoreCommands.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CoreCommands.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/CoreCommands.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,33 @@
+/*
+ * 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.managesieve.api.commands;
+
+/**
+ * <code>CoreCommands</code>
+ *
+ * <p>Core RFC 5804 Commands common to all transports
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2>RFC 5804
Commands</a>
+ */
+public interface CoreCommands extends Capability, CheckScript, DeleteScript,
GetScript, HaveSpace,
+ ListScripts, PutScript, RenameScript, SetActive, GetActive {
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/DeleteScript.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/DeleteScript.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/DeleteScript.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/DeleteScript.java
Wed Nov 25 16:01:15 2015
@@ -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.managesieve.api.commands;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.sieverepository.api.exception.IsActiveException;
+import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
+
+/**
+ * <code>DeleteScript</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.10>RFC 5804
DELETESCRIPT Command</a>
+ */
+public interface DeleteScript {
+
+ abstract public void deleteScript(String name) throws
AuthenticationRequiredException, ScriptNotFoundException, IsActiveException;
+
+}
Added:
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=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetActive.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetActive.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,37 @@
+/*
+ * 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.managesieve.api.commands;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
+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
+ * 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.
+ */
+public interface GetActive {
+
+ abstract public String getActive() throws AuthenticationRequiredException,
ScriptNotFoundException, StorageException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetScript.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetScript.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetScript.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/GetScript.java
Wed Nov 25 16:01:15 2015
@@ -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.managesieve.api.commands;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
+import org.apache.james.sieverepository.api.exception.StorageException;
+
+/**
+ * <code>GetScript</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.9>RFC 5804
GETSCRIPT Command</a>
+ */
+public interface GetScript {
+
+ abstract public String getScript(String name) throws
AuthenticationRequiredException, ScriptNotFoundException, StorageException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/HaveSpace.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/HaveSpace.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/HaveSpace.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/HaveSpace.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,35 @@
+/*
+ * 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.managesieve.api.commands;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.sieverepository.api.exception.QuotaExceededException;
+
+/**
+ * <code>HaveSpace</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.5>RFC 5804
HAVESPACE Command</a>
+ */
+public interface HaveSpace {
+
+ abstract public void haveSpace(String name, long size) throws
AuthenticationRequiredException, QuotaExceededException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/LineCommands.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/LineCommands.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/LineCommands.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/LineCommands.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,32 @@
+/*
+ * 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.managesieve.api.commands;
+
+/**
+ * <code>LineCommands</code>
+ *
+ * <p>Commands specific to the line oriented protocol defined by RFC 5804
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-1.8>RFC 5804
Transport</a>
+ */
+public interface LineCommands extends Authenticate, Unauthenticate, Logout,
Noop {
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/ListScripts.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/ListScripts.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/ListScripts.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/ListScripts.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,37 @@
+/*
+ * 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.managesieve.api.commands;
+
+import java.util.List;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.sieverepository.api.ScriptSummary;
+
+/**
+ * <code>ListScripts</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.7>RFC 5804
LISTSCRIPTS Command</a>
+ */
+public interface ListScripts {
+
+ abstract public List<ScriptSummary> listScripts() throws
AuthenticationRequiredException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Logout.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Logout.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Logout.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Logout.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,33 @@
+/*
+ * 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.managesieve.api.commands;
+
+
+/**
+ * <code>Logout</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.3>RFC 5804
LOGOUT Command</a>
+ */
+public interface Logout {
+
+ abstract public void logout();
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Noop.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Noop.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Noop.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Noop.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,35 @@
+/*
+ * 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.managesieve.api.commands;
+
+
+/**
+ * <code>Noop</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.13>RFC 5804 NOOP
Command</a>
+ */
+public interface Noop {
+
+ abstract public void noop();
+
+ abstract public String noop(String tag);
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/PutScript.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/PutScript.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/PutScript.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/PutScript.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,38 @@
+/*
+ * 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.managesieve.api.commands;
+
+import java.util.List;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.managesieve.api.SyntaxException;
+import org.apache.james.sieverepository.api.exception.QuotaExceededException;
+
+/**
+ * <code>PutScript</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.6>RFC 5804
PUTSCRIPT Command</a>
+ */
+public interface PutScript {
+
+ abstract public List<String> putScript(String name, String content) throws
AuthenticationRequiredException, SyntaxException, QuotaExceededException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/RenameScript.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/RenameScript.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/RenameScript.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/RenameScript.java
Wed Nov 25 16:01:15 2015
@@ -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.managesieve.api.commands;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.sieverepository.api.exception.DuplicateException;
+import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
+
+/**
+ * <code>RenameScript</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.11>RFC 5804
RENAMESCRIPT Command</a>
+ */
+public interface RenameScript {
+
+ abstract public void renameScript(String oldName, String newName) throws
AuthenticationRequiredException, ScriptNotFoundException, DuplicateException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/SetActive.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/SetActive.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/SetActive.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/SetActive.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,35 @@
+/*
+ * 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.managesieve.api.commands;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
+
+/**
+ * <code>SetActive</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.8>RFC 5804
SETACTIVE Command</a>
+ */
+public interface SetActive {
+
+ abstract public void setActive(String name) throws
AuthenticationRequiredException, ScriptNotFoundException;
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/StartTLS.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/StartTLS.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/StartTLS.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/StartTLS.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,32 @@
+/*
+ * 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.managesieve.api.commands;
+
+/**
+ * <code>StartTLS</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.2>RFC 5804
STARTTLS Command</a>
+ */
+public interface StartTLS {
+
+ abstract public void startTLS();
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Unauthenticate.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Unauthenticate.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Unauthenticate.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/api/commands/Unauthenticate.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,35 @@
+/*
+ * 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.managesieve.api.commands;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+
+
+/**
+ * <code>Unauthenticate</code>
+ *
+ * @see <a href=http://tools.ietf.org/html/rfc5804#section-2.14.1>RFC 5804
UNAUTHENTICATE Command</a>
+ */
+public interface Unauthenticate {
+
+ abstract public void unauthenticate() throws
AuthenticationRequiredException;
+
+}
Added:
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=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/core/CoreProcessor.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,274 @@
+/*
+ * 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.managesieve.core;
+
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.managesieve.api.ManageSieveRuntimeException;
+import org.apache.james.managesieve.api.Session;
+import org.apache.james.managesieve.api.Session.UserListener;
+import org.apache.james.managesieve.api.SieveParser;
+import org.apache.james.managesieve.api.SyntaxException;
+import org.apache.james.managesieve.api.commands.CoreCommands;
+import org.apache.james.sieverepository.api.ScriptSummary;
+import org.apache.james.sieverepository.api.SieveRepository;
+import org.apache.james.sieverepository.api.exception.DuplicateException;
+import org.apache.james.sieverepository.api.exception.IsActiveException;
+import org.apache.james.sieverepository.api.exception.QuotaExceededException;
+import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
+import org.apache.james.sieverepository.api.exception.SieveRepositoryException;
+import org.apache.james.sieverepository.api.exception.StorageException;
+import org.apache.james.sieverepository.api.exception.UserNotFoundException;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <code>CoreProcessor</code>
+ */
+public class CoreProcessor implements CoreCommands {
+
+ public static final String IMPLEMENTATION_DESCRIPTION = "Apache
ManageSieve v1.0";
+ public static final String MANAGE_SIEVE_VERSION = "1.0";
+
+ private SieveRepository _repository = null;
+ private Session _session = null;
+ private SieveParser _parser = null;
+
+ /**
+ * Creates a new instance of CoreProcessor.
+ *
+ */
+ private CoreProcessor() {
+ super();
+ }
+
+ /**
+ * Creates a new instance of CoreProcessor.
+ *
+ */
+ public CoreProcessor(Session session, SieveRepository repository,
SieveParser parser) {
+ this();
+ _session = session;
+ _repository = repository;
+ _parser = parser;
+
+ // Ensure the session user is defined in the repository
+ _session.addUserListener(new UserListener() {
+
+ public void notifyChange(String user) {
+ ensureUser(user);
+ }
+ });
+ }
+
+ /**
+ * @see org.apache.james.managesieve.api.commands.Capability#capability()
+ */
+ public Map<Capabilities, String> capability() {
+ Map<Capabilities, String> capabilities = new HashMap<Capabilities,
String>();
+ capabilities.put(Capabilities.IMPLEMENTATION,
IMPLEMENTATION_DESCRIPTION);
+ capabilities.put(Capabilities.VERSION, MANAGE_SIEVE_VERSION);
+ StringBuilder builder = new StringBuilder();
+ for (String extension : _parser.getExtensions())
+ {
+ builder.append(extension).append(' ');
+ }
+ String extensions = builder.toString().trim();
+ if (!extensions.isEmpty())
+ {
+ capabilities.put(Capabilities.SIEVE, extensions);
+ }
+ if (isAuthenticated())
+ {
+ capabilities.put(Capabilities.OWNER, getUser());
+ }
+ capabilities.put(Capabilities.GETACTIVE, null);
+ return capabilities;
+ }
+
+ /**
+ * @see
org.apache.james.managesieve.api.commands.CheckScript#checkScript(String)
+ */
+ public List<String> checkScript(String content) throws
AuthenticationRequiredException,
+ SyntaxException {
+ authenticationCheck();
+ return _parser.parse(content);
+ }
+
+ /**
+ * @see
org.apache.james.managesieve.api.commands.DeleteScript#deleteScript(String)
+ */
+ public void deleteScript(String name) throws
AuthenticationRequiredException,
+ ScriptNotFoundException, IsActiveException {
+ authenticationCheck();
+ try {
+ _repository.deleteScript(getUser(), name);
+ } catch (StorageException ex) {
+ throw new ManageSieveRuntimeException(ex);
+ } catch (UserNotFoundException ex) {
+ // Should not happen as the UserListener should ensure the session
user is defined in the repository
+ throw new ManageSieveRuntimeException(ex);
+ }
+ }
+
+ /**
+ * @see
org.apache.james.managesieve.api.commands.GetScript#getScript(String)
+ */
+ public String getScript(String name) throws
AuthenticationRequiredException,
+ ScriptNotFoundException, StorageException {
+ authenticationCheck();
+ String script = null;
+ try {
+ script = _repository.getScript(getUser(), name);
+ } catch (UserNotFoundException ex) {
+ // Should not happen as the UserListener should ensure the session
user is defined in the repository
+ throw new ManageSieveRuntimeException(ex);
+ }
+ return script;
+ }
+
+ /**
+ * @see
org.apache.james.managesieve.api.commands.HaveSpace#haveSpace(String, long)
+ */
+ public void haveSpace(String name, long size) throws
AuthenticationRequiredException,
+ QuotaExceededException {
+ authenticationCheck();
+ try {
+ _repository.haveSpace(getUser(), name, size);
+ } catch (SieveRepositoryException ex) {
+ // Should not happen as the UserListener should ensure the session
user is defined in the repository
+ throw new ManageSieveRuntimeException(ex);
+ }
+ }
+
+ /**
+ * @see org.apache.james.managesieve.api.commands.ListScripts#listScripts()
+ */
+ public List<ScriptSummary> listScripts() throws
AuthenticationRequiredException {
+ authenticationCheck();
+ List<ScriptSummary> summaries = null;
+ try {
+ summaries = _repository.listScripts(getUser());
+ } catch (SieveRepositoryException ex) {
+ // Should not happen as the UserListener should ensure the session
user is defined in the repository
+ throw new ManageSieveRuntimeException(ex);
+ }
+ return summaries;
+ }
+
+ /**
+ * @see
org.apache.james.managesieve.api.commands.PutScript#putScript(String, String)
+ */
+ public List<String> putScript(String name, String content)
+ throws AuthenticationRequiredException, SyntaxException,
QuotaExceededException {
+ authenticationCheck();
+ List<String> warnings = _parser.parse(content);
+ try {
+ _repository.putScript(getUser(), name, content);
+ } catch (UserNotFoundException ex) {
+ // Should not happen as the UserListener should ensure the session
user is defined in the repository
+ throw new ManageSieveRuntimeException(ex);
+ } catch (StorageException ex) {
+ throw new ManageSieveRuntimeException(ex);
+ }
+ return warnings;
+ }
+
+ /**
+ * @see
org.apache.james.managesieve.api.commands.RenameScript#renameScript(String,
String)
+ */
+ public void renameScript(String oldName, String newName)
+ throws AuthenticationRequiredException, ScriptNotFoundException,
+ DuplicateException {
+ authenticationCheck();
+ try {
+ _repository.renameScript(getUser(), oldName, newName);
+ } catch (UserNotFoundException ex) {
+ // Should not happen as the UserListener should ensure the session
user is defined in the repository
+ throw new ManageSieveRuntimeException(ex);
+ } catch (StorageException ex) {
+ throw new ManageSieveRuntimeException(ex);
+ }
+ }
+
+ /**
+ * @see
org.apache.james.managesieve.api.commands.SetActive#setActive(String)
+ */
+ public void setActive(String name) throws AuthenticationRequiredException,
+ ScriptNotFoundException {
+ authenticationCheck();
+ try {
+ _repository.setActive(getUser(), name);
+ } catch (UserNotFoundException ex) {
+ // Should not happen as the UserListener should ensure the session
user is defined in the repository
+ throw new ManageSieveRuntimeException(ex);
+ } catch (StorageException ex) {
+ throw new ManageSieveRuntimeException(ex);
+ }
+ }
+
+ protected String getUser()
+ {
+ return _session.getUser();
+ }
+
+ protected void ensureUser(String user) {
+ try {
+ if (!_repository.hasUser(user)) {
+ _repository.addUser(user);
+ }
+ } catch (SieveRepositoryException ex) {
+ throw new ManageSieveRuntimeException(ex);
+ }
+ }
+
+ protected void authenticationCheck() throws AuthenticationRequiredException
+ {
+ if (!isAuthenticated())
+ {
+ throw new AuthenticationRequiredException();
+ }
+ }
+
+ protected boolean isAuthenticated()
+ {
+ return _session.isAuthenticated();
+ }
+
+ /**
+ * @see org.apache.james.managesieve.api.commands.GetActive#getActive()
+ */
+ public String getActive() throws AuthenticationRequiredException,
ScriptNotFoundException, StorageException {
+ authenticationCheck();
+
+ String script = null;
+ try {
+ script = _repository.getActive(getUser());
+ } catch (UserNotFoundException ex) {
+ // Should not happen as the UserListener should ensure the session
+ // user is defined in the repository
+ throw new ManageSieveRuntimeException(ex);
+ }
+ return script;
+ }
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/jsieve/Parser.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/jsieve/Parser.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/jsieve/Parser.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/jsieve/Parser.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,90 @@
+/*
+ * 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.managesieve.jsieve;
+
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.apache.james.managesieve.api.SieveParser;
+import org.apache.james.managesieve.api.SyntaxException;
+import org.apache.jsieve.ConfigurationManager;
+import org.apache.jsieve.SieveFactory;
+import org.apache.jsieve.parser.generated.ParseException;
+
+/**
+ * <code>Parser</code>
+ */
+public class Parser implements SieveParser {
+
+ private static final List<String> EMPTY_WARNINGS = new
ArrayList<String>(0);
+
+ private SieveFactory _sieveFactory = null;
+
+ /**
+ * Creates a new instance of Parser.
+ *
+ */
+ public Parser() {
+ super();
+ }
+
+ /**
+ * Creates a new instance of Parser.
+ *
+ */
+ public Parser(ConfigurationManager manager) {
+ this();
+ setConfigurationManager(manager);
+ }
+
+ /**
+ * setConfigurationManager.
+ *
+ * @param manager The <code>ConfigurationManager</code> to set
+ */
+ @Resource(name = "jsieveconfigurationmanager")
+ public void setConfigurationManager(ConfigurationManager manager) {
+ _sieveFactory = manager.build();
+ }
+
+ /**
+ * @see org.apache.james.managesieve.api.SieveParser#getExtensions()
+ */
+ public List<String> getExtensions() {
+ return _sieveFactory.getExtensions();
+ }
+
+ /**
+ * @see
org.apache.james.managesieve.api.SieveParser#parse(java.lang.String)
+ */
+ public List<String> parse(String content) throws SyntaxException {
+ try {
+ _sieveFactory.parse(new ByteArrayInputStream(content.getBytes()));
+ } catch (ParseException ex) {
+ throw new SyntaxException(ex);
+ }
+ return EMPTY_WARNINGS;
+ }
+
+}
Added:
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java
URL:
http://svn.apache.org/viewvc/james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java?rev=1716451&view=auto
==============================================================================
---
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java
(added)
+++
james/project/trunk/protocols/managesieve/src/main/java/org/apache/james/managesieve/transcode/LineToCore.java
Wed Nov 25 16:01:15 2015
@@ -0,0 +1,212 @@
+/*
+ * 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.managesieve.transcode;
+
+import org.apache.james.managesieve.api.ArgumentException;
+import org.apache.james.managesieve.api.AuthenticationRequiredException;
+import org.apache.james.managesieve.api.SyntaxException;
+import org.apache.james.managesieve.api.commands.Capability.Capabilities;
+import org.apache.james.managesieve.api.commands.CoreCommands;
+import org.apache.james.managesieve.util.ParserUtils;
+import org.apache.james.sieverepository.api.ScriptSummary;
+import org.apache.james.sieverepository.api.exception.DuplicateException;
+import org.apache.james.sieverepository.api.exception.IsActiveException;
+import org.apache.james.sieverepository.api.exception.QuotaExceededException;
+import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
+import org.apache.james.sieverepository.api.exception.StorageException;
+
+import java.util.InputMismatchException;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.Scanner;
+
+/**
+ * <code>LineToCore</code>
+ */
+public class LineToCore{
+
+ private CoreCommands _core = null;
+
+ /**
+ * Creates a new instance of LineToCore.
+ *
+ */
+ private LineToCore() {
+ super();
+ }
+
+ /**
+ * Creates a new instance of LineToCore.
+ *
+ * @param core
+ */
+ public LineToCore(CoreCommands core) {
+ this();
+ _core = core;
+ }
+
+ public Map<Capabilities, String> capability(String args) throws
ArgumentException
+ {
+ if (!args.trim().isEmpty())
+ {
+ throw new ArgumentException("Too many arguments: " + args);
+ }
+ return _core.capability();
+ }
+
+ public void deleteScript(String args) throws
AuthenticationRequiredException, ScriptNotFoundException, IsActiveException,
ArgumentException
+ {
+ String scriptName = ParserUtils.getScriptName(args);
+ if (null == scriptName || scriptName.isEmpty())
+ {
+ throw new ArgumentException("Missing argument: script name");
+ }
+
+ Scanner scanner = new
Scanner(args.substring(scriptName.length()).trim()).useDelimiter("\\A");
+ if (scanner.hasNext())
+ {
+ throw new ArgumentException("Too many arguments: " +
scanner.next());
+ }
+ _core.deleteScript(ParserUtils.unquote(scriptName));
+ }
+
+ public String getScript(String args) throws
AuthenticationRequiredException, ScriptNotFoundException, ArgumentException,
StorageException {
+ String scriptName = ParserUtils.getScriptName(args);
+ if (null == scriptName || scriptName.isEmpty())
+ {
+ throw new ArgumentException("Missing argument: script name");
+ }
+ Scanner scanner = new
Scanner(args.substring(scriptName.length()).trim()).useDelimiter("\\A");
+ if (scanner.hasNext())
+ {
+ throw new ArgumentException("Too many arguments: " +
scanner.next());
+ }
+ return _core.getScript(ParserUtils.unquote(scriptName));
+ }
+
+ public List<String> checkScript(String args) throws ArgumentException,
AuthenticationRequiredException, SyntaxException
+ {
+ if (args.trim().isEmpty())
+ {
+ throw new ArgumentException("Missing argument: script content");
+ }
+ return _core.checkScript(args);
+ }
+
+ public void haveSpace(String args) throws AuthenticationRequiredException,
+ QuotaExceededException, ArgumentException {
+ String scriptName = ParserUtils.getScriptName(args);
+ if (null == scriptName || scriptName.isEmpty()) {
+ throw new ArgumentException("Missing argument: script name");
+ }
+
+ Scanner scanner = new
Scanner(args.substring(scriptName.length()).trim());
+ long size = 0;
+
+ try {
+ size = scanner.nextLong();
+ } catch (InputMismatchException ex) {
+ throw new ArgumentException("Invalid argument: script size");
+ } catch (NoSuchElementException ex) {
+ throw new ArgumentException("Missing argument: script size");
+ }
+
+ scanner.useDelimiter("\\A");
+ if (scanner.hasNext()) {
+ throw new ArgumentException("Too many arguments: " +
scanner.next().trim());
+ }
+ _core.haveSpace(ParserUtils.unquote(scriptName), size);
+ }
+
+ public List<ScriptSummary> listScripts(String args) throws
AuthenticationRequiredException, ArgumentException {
+ if (!args.trim().isEmpty())
+ {
+ throw new ArgumentException("Too many arguments: " + args);
+ }
+ return _core.listScripts();
+ }
+
+ public List<String> putScript(String args)
+ throws AuthenticationRequiredException, SyntaxException,
QuotaExceededException, ArgumentException {
+ String scriptName = ParserUtils.getScriptName(args);
+ if (null == scriptName || scriptName.isEmpty())
+ {
+ throw new ArgumentException("Missing argument: script name");
+ }
+ Scanner scanner = new
Scanner(args.substring(scriptName.length()).trim()).useDelimiter("\\A");
+ if (!scanner.hasNext())
+ {
+ throw new ArgumentException("Missing argument: script content");
+ }
+ String content = scanner.next();
+ return _core.putScript(ParserUtils.unquote(scriptName), content);
+ }
+
+ public void renameScript(String args)
+ throws AuthenticationRequiredException, ScriptNotFoundException,
+ DuplicateException, ArgumentException {
+ String oldName = ParserUtils.getScriptName(args);
+ if (null == oldName || oldName.isEmpty())
+ {
+ throw new ArgumentException("Missing argument: old script name");
+ }
+
+ String newName =
ParserUtils.getScriptName(args.substring(oldName.length()));
+ if (null == newName || newName.isEmpty())
+ {
+ throw new ArgumentException("Missing argument: new script name");
+ }
+
+ Scanner scanner = new Scanner(args.substring(oldName.length() + 1 +
newName.length()).trim()).useDelimiter("\\A");
+ if (scanner.hasNext())
+ {
+ throw new ArgumentException("Too many arguments: " +
scanner.next());
+ }
+ _core.renameScript(oldName, newName);
+ }
+
+ public void setActive(String args) throws AuthenticationRequiredException,
+ ScriptNotFoundException, ArgumentException {
+ String scriptName = ParserUtils.getScriptName(args);
+ if (null == scriptName || scriptName.isEmpty())
+ {
+ throw new ArgumentException("Missing argument: script name");
+ }
+
+ Scanner scanner = new
Scanner(args.substring(scriptName.length()).trim()).useDelimiter("\\A");
+ if (scanner.hasNext())
+ {
+ throw new ArgumentException("Too many arguments: " +
scanner.next());
+ }
+ _core.setActive(ParserUtils.unquote(scriptName));
+ }
+
+ public String getActive(String args) throws
AuthenticationRequiredException, ScriptNotFoundException, ArgumentException,
StorageException {
+ Scanner scanner = new Scanner(args.trim()).useDelimiter("\\A");
+ if (scanner.hasNext())
+ {
+ throw new ArgumentException("Too many arguments: " +
scanner.next());
+ }
+ return _core.getActive();
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]