You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ba...@apache.org on 2007/09/21 11:32:05 UTC
svn commit: r578033 [1/5] - in
/james/jsieve/trunk/src/main/java/org/apache/jsieve: ./ commands/
commands/extensions/ commands/optional/ comparators/ exception/ mail/
mail/optional/ parser/ parser/address/ samples/james/ tests/
tests/optional/ util/check/
Author: bago
Date: Fri Sep 21 02:32:00 2007
New Revision: 578033
URL: http://svn.apache.org/viewvc?rev=578033&view=rev
Log:
Main sources reformatted (JSIEVE-17)
Modified:
james/jsieve/trunk/src/main/java/org/apache/jsieve/Argument.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/Arguments.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/BaseSieveContext.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/Block.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/Command.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandManager.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandStateManager.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/Commands.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/ConditionManager.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/Executable.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/ExecutableCommand.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/Logger.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/NumberArgument.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/ScriptCoordinate.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveConfigurationException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveContext.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveFactory.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/SieveParserVisitorImpl.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/StringListArgument.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/TagArgument.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/Test.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/TestList.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/TestManager.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractActionCommand.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractBodyCommand.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractCommand.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractConditionalCommand.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractControlCommand.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/AbstractPrologCommand.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Discard.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Else.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Elsif.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/If.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Keep.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Redirect.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Require.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/Stop.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/extensions/Log.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/extensions/LogLevelTags.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/optional/FileInto.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/optional/Reject.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/AsciiCasemap.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/AsciiNumeric.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/Comparator.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/ComparatorNames.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/ComparatorUtils.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/Contains.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/Equals.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/MatchTypeTags.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/Matches.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/comparators/Octet.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/CommandException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/FeatureException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/InternetAddressException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/LookupException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/OperationException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/SieveException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/SievePatternException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/StopException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/SyntaxException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/exception/TestException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/Action.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/ActionFileInto.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/ActionKeep.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/ActionRedirect.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/ActionReject.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/MailAdapter.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/MailUtils.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/SieveMailException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/mail/optional/EnvelopeAccessors.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/parser/SieveNode.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/parser/address/SieveAddressBuilder.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/samples/james/ActionDispatcher.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/samples/james/Actions.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/samples/james/DestinationException.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/samples/james/JSieve.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/samples/james/SieveMailAdapter.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/AbstractCompatatorTest.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/AbstractTest.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/Address.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/AddressPartTags.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/AllOf.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/AnyOf.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/ComparatorTags.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/ComparatorUtils.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/ExecutableTest.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/Exists.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/False.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/Header.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/Not.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/Size.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/True.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/optional/Body.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/tests/optional/Envelope.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/util/check/ScriptCheckMailAdapter.java
james/jsieve/trunk/src/main/java/org/apache/jsieve/util/check/ScriptChecker.java
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/Argument.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/Argument.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/Argument.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/Argument.java Fri Sep 21 02:32:00 2007
@@ -17,19 +17,17 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
-
/**
* A simple Interface for Arguments.
*
* Creation Date: 24-Nov-03
*/
-public interface Argument
-{
+public interface Argument {
/**
* Method getValue answers the value of the receiver's Argument.
+ *
* @return Object
*/
public Object getValue();
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/Arguments.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/Arguments.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/Arguments.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/Arguments.java Fri Sep 21 02:32:00 2007
@@ -17,140 +17,138 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
import java.util.ArrayList;
import java.util.List;
/**
- * <p>A parsed representation of the RFC3028 BNF...</p>
+ * <p>
+ * A parsed representation of the RFC3028 BNF...
+ * </p>
*
* <code>arguments = *argument [test / test-list]</code>
*
- * <p>Note that a test is represented as a test-list with a single element.</p>
+ * <p>
+ * Note that a test is represented as a test-list with a single element.
+ * </p>
*
*/
-public class Arguments
-{
+public class Arguments {
/**
* A List of the parsed Arguments
- */
+ */
private List fieldArgumentList;
-
+
/**
* The parsed tests
- */
+ */
private TestList fieldTestList;
/**
* Constructor for Arguments.
*/
- private Arguments()
- {
+ private Arguments() {
super();
}
-
+
/**
* Constructor for Arguments.
+ *
* @param arguments
* @param testList
*/
- public Arguments(List arguments, TestList testList)
- {
+ public Arguments(List arguments, TestList testList) {
this();
setArgumentList(arguments);
setTestList(testList);
- }
+ }
/**
* Returns the arguments.
+ *
* @return List
*/
- public List getArgumentList()
- {
+ public List getArgumentList() {
return fieldArgumentList;
}
/**
* Returns the testList, lazily initialised if required.
+ *
* @return TestList
*/
- public TestList getTestList()
- {
+ public TestList getTestList() {
TestList testList = null;
- if (null == (testList = getTestListBasic()))
- {
+ if (null == (testList = getTestListBasic())) {
updateTestList();
return getTestList();
}
return testList;
}
-
+
/**
- * Returns true if there is a TestList and it has Tests.
- * Saves triggering lazy initialisation.
+ * Returns true if there is a TestList and it has Tests. Saves triggering
+ * lazy initialisation.
+ *
* @return boolean
*/
- public boolean hasTests()
- {
+ public boolean hasTests() {
TestList testList = getTestListBasic();
return null != testList && testList.getTests().size() == 0;
- }
-
+ }
+
/**
* Returns the testList.
+ *
* @return TestList
*/
- private TestList getTestListBasic()
- {
+ private TestList getTestListBasic() {
return fieldTestList;
}
-
+
/**
* Computes the testList.
+ *
* @return TestList
*/
- protected TestList computeTestList()
- {
+ protected TestList computeTestList() {
return new TestList(new ArrayList());
- }
+ }
/**
* Sets the arguments.
- * @param arguments The arguments to set
+ *
+ * @param arguments
+ * The arguments to set
*/
- protected void setArgumentList(List arguments)
- {
+ protected void setArgumentList(List arguments) {
fieldArgumentList = arguments;
}
/**
* Sets the testList.
- * @param testList The testList to set
+ *
+ * @param testList
+ * The testList to set
*/
- protected void setTestList(TestList testList)
- {
+ protected void setTestList(TestList testList) {
fieldTestList = testList;
}
-
+
/**
* Updates the TestList
*/
- protected void updateTestList()
- {
+ protected void updateTestList() {
setTestList(computeTestList());
- }
+ }
/**
* @see java.lang.Object#toString()
*/
- public String toString()
- {
- return "Arguments: "
- + getArgumentList().toString()
- + " Tests: "
- + (hasTests() ? getTestList().toString(): "null");
+ public String toString() {
+ return "Arguments: " + getArgumentList().toString() + " Tests: "
+ + (hasTests() ? getTestList().toString() : "null");
}
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/BaseSieveContext.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/BaseSieveContext.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/BaseSieveContext.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/BaseSieveContext.java Fri Sep 21 02:32:00 2007
@@ -20,24 +20,27 @@
package org.apache.jsieve;
/**
- * Bean based implementation of context.
- *
+ * Bean based implementation of context.
+ *
*/
public class BaseSieveContext extends SieveContext {
private ScriptCoordinate coordinate;
-
+
/**
* Gets the script position of the current operation.
+ *
* @return <code>ScriptCoordinate</code>, not null
*/
public ScriptCoordinate getCoordinate() {
return coordinate;
}
-
+
/**
* Sets the script position of the current operation.
- * @param coordinate <code>ScriptCoordinate</code>, not null
+ *
+ * @param coordinate
+ * <code>ScriptCoordinate</code>, not null
*/
public void setCoordinate(ScriptCoordinate coordinate) {
this.coordinate = coordinate;
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/Block.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/Block.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/Block.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/Block.java Fri Sep 21 02:32:00 2007
@@ -17,72 +17,70 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.mail.MailAdapter;
/**
- * <p>A parsed representation of the RFC3028 BNF...</p>
+ * <p>
+ * A parsed representation of the RFC3028 BNF...
+ * </p>
*
* <code>block = "{" commands "}"</code>
*
*/
-public class Block implements Executable
-{
+public class Block implements Executable {
/**
* The chilren of the Block
- */
+ */
private Commands fieldChildren;
/**
* Constructor for Block.
*/
- private Block()
- {
+ private Block() {
super();
}
-
+
/**
* Constructor for Block.
+ *
* @param commands
*/
- public Block(Commands commands)
- {
+ public Block(Commands commands) {
this();
setChildren(commands);
- }
+ }
/**
* Returns the commands.
+ *
* @return Commands
*/
- public Commands getChildren()
- {
+ public Commands getChildren() {
return fieldChildren;
}
/**
* Sets the commands.
- * @param commands The commands to set
+ *
+ * @param commands
+ * The commands to set
*/
- protected void setChildren(Commands commands)
- {
+ protected void setChildren(Commands commands) {
fieldChildren = commands;
}
/**
* @see org.apache.jsieve.Executable#execute(MailAdapter)
*/
- public Object execute(MailAdapter mail) throws SieveException
- {
- return getChildren().execute(mail);
+ public Object execute(MailAdapter mail) throws SieveException {
+ return getChildren().execute(mail);
}
public String toString() {
return "BLOCK: " + getChildren();
}
-
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/Command.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/Command.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/Command.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/Command.java Fri Sep 21 02:32:00 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
import org.apache.commons.logging.Log;
@@ -25,17 +24,17 @@
import org.apache.jsieve.mail.MailAdapter;
/**
- * <p>A parsed representation of the RFC3028 BNF...</p>
+ * <p>
+ * A parsed representation of the RFC3028 BNF...
+ * </p>
*
* <code>command = identifier arguments ( ";" / block )</code>
*/
-public class Command implements Executable
-{
+public class Command implements Executable {
/**
* @see org.apache.jsieve.Executable#execute(MailAdapter)
*/
- public Object execute(MailAdapter mail) throws SieveException
- {
+ public Object execute(MailAdapter mail) throws SieveException {
Log log = Logger.getLog();
if (log.isDebugEnabled()) {
log.debug(toString());
@@ -46,119 +45,117 @@
// so need to use the coordinate recorded from the parse
context.setCoordinate(coordinate);
return CommandManager.getInstance().newInstance(getName()).execute(
- mail,
- getArguments(),
- getBlock(), context);
+ mail, getArguments(), getBlock(), context);
}
-
// The name of this Command
private String fieldName;
-
+
// The Arguments for this Command
private Arguments fieldArguments;
-
- // The Block for this Command
- private Block fieldBlock;
-
+
+ // The Block for this Command
+ private Block fieldBlock;
+
private SieveContext context;
-
+
/**
- * Script coordinate for this command.
- * Commands are executed after the document has been parse.
- * So this must be recorded on construction
- * and stored for later use.
+ * Script coordinate for this command. Commands are executed after the
+ * document has been parse. So this must be recorded on construction and
+ * stored for later use.
*/
private ScriptCoordinate coordinate;
-
+
/**
* Constructor for Test.
*/
- private Command()
- {
+ private Command() {
super();
}
-
+
/**
* Constructor for Command.
+ *
* @param name
* @param arguments
* @param block
*/
- public Command(String name, Arguments arguments, Block block, SieveContext context)
- {
+ public Command(String name, Arguments arguments, Block block,
+ SieveContext context) {
this();
this.context = context;
this.coordinate = context.getCoordinate();
setName(name);
setArguments(arguments);
- setBlock(block);
- }
+ setBlock(block);
+ }
/**
* Returns the name.
+ *
* @return String
*/
- public String getName()
- {
+ public String getName() {
return fieldName;
}
/**
* Sets the name.
- * @param name The name to set
+ *
+ * @param name
+ * The name to set
*/
- protected void setName(String name)
- {
+ protected void setName(String name) {
fieldName = name;
}
/**
* @see java.lang.Object#toString()
*/
- public String toString()
- {
+ public String toString() {
return "Command name: "
- + getName()
- + " "
- + ((getArguments() == null) ? "null" : getArguments().toString())
- + " Block: "
- + ((getBlock() == null) ? "null" : getBlock().toString());
+ + getName()
+ + " "
+ + ((getArguments() == null) ? "null" : getArguments()
+ .toString()) + " Block: "
+ + ((getBlock() == null) ? "null" : getBlock().toString());
}
/**
* Returns the arguments.
+ *
* @return Arguments
*/
- public Arguments getArguments()
- {
+ public Arguments getArguments() {
return fieldArguments;
}
/**
* Returns the block.
+ *
* @return Block
*/
- public Block getBlock()
- {
+ public Block getBlock() {
return fieldBlock;
}
/**
* Sets the arguments.
- * @param arguments The arguments to set
+ *
+ * @param arguments
+ * The arguments to set
*/
- protected void setArguments(Arguments arguments)
- {
+ protected void setArguments(Arguments arguments) {
fieldArguments = arguments;
}
/**
* Sets the block.
- * @param block The block to set
+ *
+ * @param block
+ * The block to set
*/
- protected void setBlock(Block block)
- {
+ protected void setBlock(Block block) {
fieldBlock = block;
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandManager.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandManager.java Fri Sep 21 02:32:00 2007
@@ -17,200 +17,184 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
+
import java.util.Map;
import org.apache.jsieve.exception.LookupException;
/**
- * Singleton class <code>CommandManager</code> maps Command names to configured
- * Command implementation classes.
+ * Singleton class <code>CommandManager</code> maps Command names to
+ * configured Command implementation classes.
*/
-public class CommandManager
-{
+public class CommandManager {
/**
* The sole instance of the receiver.
- */
+ */
static private CommandManager fieldInstance;
/**
* Constructor for CommandManager.
*/
- private CommandManager()
- {
+ private CommandManager() {
super();
}
/**
- * Returns the sole instance of the receiver, lazily initialised if required.
+ * Returns the sole instance of the receiver, lazily initialised if
+ * required.
+ *
* @return CommandManager
*/
- public static synchronized CommandManager getInstance()
- {
+ public static synchronized CommandManager getInstance() {
CommandManager instance = null;
- if (null == (instance = getInstanceBasic()))
- {
+ if (null == (instance = getInstanceBasic())) {
updateInstance();
return getInstance();
- }
+ }
return instance;
}
-
+
/**
* Returns the sole instance of the receiver.
+ *
* @return CommandManager
*/
- private static CommandManager getInstanceBasic()
- {
+ private static CommandManager getInstanceBasic() {
return fieldInstance;
}
-
+
/**
* Computes a new instance of the receiver.
+ *
* @return CommandManager
*/
- protected static CommandManager computeInstance()
- {
+ protected static CommandManager computeInstance() {
return new CommandManager();
- }
+ }
/**
* Sets the sole instance of the receiver.
- * @param instance The current instance to set
+ *
+ * @param instance
+ * The current instance to set
*/
- protected static void setInstance(CommandManager instance)
- {
+ protected static void setInstance(CommandManager instance) {
fieldInstance = instance;
}
-
+
/**
* Resets the sole instance.
*/
- public static void resetInstance()
- {
+ public static void resetInstance() {
setInstance(null);
- }
-
+ }
+
/**
* Updates the sole instance.
*/
- protected static void updateInstance()
- {
+ protected static void updateInstance() {
setInstance(computeInstance());
}
-
+
/**
- * <p>Method lookup answers the class to which a Command name is mapped.</p>
+ * <p>
+ * Method lookup answers the class to which a Command name is mapped.
+ * </p>
*
- * @param name - The name of the Command
+ * @param name -
+ * The name of the Command
* @return Class - The class of the Command
* @throws LookupException
*/
- public Class lookup(String name)
- throws LookupException
- {
+ public Class lookup(String name) throws LookupException {
Class cmdClass = null;
- try
- {
- cmdClass =
- getClass().getClassLoader().loadClass(getClassName(name));
- }
- catch (ClassNotFoundException e)
- {
- throw new LookupException(
- "Command named '" + name + "' not found.");
+ try {
+ cmdClass = getClass().getClassLoader()
+ .loadClass(getClassName(name));
+ } catch (ClassNotFoundException e) {
+ throw new LookupException("Command named '" + name + "' not found.");
}
if (!ExecutableCommand.class.isAssignableFrom(cmdClass))
- throw new LookupException(
- "Class "
- + cmdClass.getName()
- + " must implement "
- + ExecutableCommand.class.getName());
+ throw new LookupException("Class " + cmdClass.getName()
+ + " must implement " + ExecutableCommand.class.getName());
return cmdClass;
}
-
+
/**
- * <p>Method newInstance answers an instance of the class to which a Command name
- * is mapped.</p>
+ * <p>
+ * Method newInstance answers an instance of the class to which a Command
+ * name is mapped.
+ * </p>
*
- * @param name - The name of the Command
+ * @param name -
+ * The name of the Command
* @return Class - The class of the Command
* @throws LookupException
- */
- public ExecutableCommand newInstance(String name) throws LookupException
- {
- try
- {
+ */
+ public ExecutableCommand newInstance(String name) throws LookupException {
+ try {
return (ExecutableCommand) lookup(name).newInstance();
- }
- catch (InstantiationException e)
- {
+ } catch (InstantiationException e) {
throw new LookupException(e.getMessage());
- }
- catch (IllegalAccessException e)
- {
+ } catch (IllegalAccessException e) {
throw new LookupException(e.getMessage());
}
- }
+ }
/**
- * Method isSupported answers a boolean indicating if a Command name is
+ * Method isSupported answers a boolean indicating if a Command name is
* configured.
- * @param name - The Command name
+ *
+ * @param name -
+ * The Command name
* @return boolean - True if the Command name is configured.
*/
- public boolean isSupported(String name)
- {
+ public boolean isSupported(String name) {
boolean isSupported = false;
- try
- {
+ try {
lookup(name);
isSupported = true;
- }
- catch (LookupException e)
- {
+ } catch (LookupException e) {
}
return isSupported;
}
-
+
/**
- * <p>Method getClassName answers the name of the class to which a Command name is
- * mapped.</p>
+ * <p>
+ * Method getClassName answers the name of the class to which a Command name
+ * is mapped.
+ * </p>
*
- * @param name - The name of the Command
+ * @param name -
+ * The name of the Command
* @return String - The name of the class
* @throws LookupException
*/
- protected String getClassName(String name) throws LookupException
- {
+ protected String getClassName(String name) throws LookupException {
String className;
- try
- {
+ try {
className = (String) getClassNameMap().get(name.toLowerCase());
- }
- catch (SieveConfigurationException e)
- {
+ } catch (SieveConfigurationException e) {
throw new LookupException(
- "Lookup failed due to a Configuration Exception: "
- + e.getMessage());
+ "Lookup failed due to a Configuration Exception: "
+ + e.getMessage());
}
if (null == className)
- throw new LookupException(
- "Command named '" + name + "' not mapped.");
+ throw new LookupException("Command named '" + name
+ + "' not mapped.");
return className;
}
-
+
/**
- * Method getClassNameMap answers a Map of Command names and their class names.
+ * Method getClassNameMap answers a Map of Command names and their class
+ * names.
+ *
* @return Map
* @throws SieveConfigurationException
*/
- protected Map getClassNameMap() throws SieveConfigurationException
- {
+ protected Map getClassNameMap() throws SieveConfigurationException {
return ConfigurationManager.getInstance().getCommandMap();
- }
-
-
+ }
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandStateManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandStateManager.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandStateManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/CommandStateManager.java Fri Sep 21 02:32:00 2007
@@ -17,199 +17,194 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
/**
- * Thread singleton class CommandStateManager records the state of a Sieve evaluation.
+ * Thread singleton class CommandStateManager records the state of a Sieve
+ * evaluation.
*/
-public class CommandStateManager
-{
-
+public class CommandStateManager {
+
/**
* The evaluated script is processing Prolog Commands
- */
+ */
private boolean fieldInProlog = true;
-
+
/**
* The evaluated script has rejected the mail
- */
+ */
private boolean fieldRejected = false;
-
+
/**
* The evaluated script must keep the mail
- */
- private boolean fieldImplicitKeep = true;
-
+ */
+ private boolean fieldImplicitKeep = true;
+
/**
- * The evaluation has processed Action Commands
- */
+ * The evaluation has processed Action Commands
+ */
private boolean fieldHasActions = false;
-
+
/**
* The instance of the reciever for the current thread
- */
+ */
static private final ThreadLocal fieldInstance = new ThreadLocal();
-
+
/**
* Constructor for CommandStateManager.
*/
- private CommandStateManager()
- {
+ private CommandStateManager() {
super();
initialize();
}
-
+
/**
* Initialize the receiver.
*/
- protected void initialize()
- {
+ protected void initialize() {
setInProlog(true);
setRejected(false);
setHasActions(false);
- setImplicitKeep(true);
- }
-
+ setImplicitKeep(true);
+ }
+
/**
* Answers a new instance of the receiver.
+ *
* @return ConditionManager
*/
- static protected CommandStateManager computeInstance()
- {
+ static protected CommandStateManager computeInstance() {
return new CommandStateManager();
- }
-
+ }
/**
- * <p>Returns an instance of the receiver for the current thread, lazily
- * intialised if required.</p>
+ * <p>
+ * Returns an instance of the receiver for the current thread, lazily
+ * intialised if required.
+ * </p>
*
- * <p>Note that this must be synchronized to prevent another thread
- * detecting the null state while this thread is initialising.</p>
+ * <p>
+ * Note that this must be synchronized to prevent another thread detecting
+ * the null state while this thread is initialising.
+ * </p>
*
* @return ConditionManager
*/
- static synchronized public CommandStateManager getInstance()
- {
+ static synchronized public CommandStateManager getInstance() {
CommandStateManager instance = null;
- if (null == (instance = getInstanceBasic()))
- {
+ if (null == (instance = getInstanceBasic())) {
updateInstance();
return getInstance();
}
return instance;
}
-
/**
* Returns the current CommandStateManager for the current thread.
+ *
* @return CommandStateManager
*/
- static private CommandStateManager getInstanceBasic()
- {
- return (CommandStateManager)fieldInstance.get();
- }
-
+ static private CommandStateManager getInstanceBasic() {
+ return (CommandStateManager) fieldInstance.get();
+ }
/**
* Sets the CommandStateManager for the current thread.
- * @param conditionManager The CommandStateManager to set
+ *
+ * @param conditionManager
+ * The CommandStateManager to set
*/
- static protected void setInstance(CommandStateManager conditionManager)
- {
+ static protected void setInstance(CommandStateManager conditionManager) {
fieldInstance.set(conditionManager);
}
-
+
/**
* resets the current CommandStateManager.
*/
- static public void resetInstance()
- {
+ static public void resetInstance() {
setInstance(null);
- }
-
+ }
/**
* Updates the current CommandStateManager.
*/
- static protected void updateInstance()
- {
+ static protected void updateInstance() {
setInstance(computeInstance());
- }
-
-
-
+ }
/**
* Returns the hasActions.
+ *
* @return boolean
*/
- public boolean isHasActions()
- {
+ public boolean isHasActions() {
return fieldHasActions;
}
/**
* Returns the inProlog.
+ *
* @return boolean
*/
- public boolean isInProlog()
- {
+ public boolean isInProlog() {
return fieldInProlog;
}
/**
* Returns the isRejected.
+ *
* @return boolean
*/
- public boolean isRejected()
- {
+ public boolean isRejected() {
return fieldRejected;
}
/**
* Sets the hasActions.
- * @param hasActions The hasActions to set
+ *
+ * @param hasActions
+ * The hasActions to set
*/
- public void setHasActions(boolean hasActions)
- {
+ public void setHasActions(boolean hasActions) {
fieldHasActions = hasActions;
}
/**
* Sets the inProlog.
- * @param inProlog The inProlog to set
+ *
+ * @param inProlog
+ * The inProlog to set
*/
- public void setInProlog(boolean inProlog)
- {
+ public void setInProlog(boolean inProlog) {
fieldInProlog = inProlog;
}
/**
* Sets the isRejected.
- * @param isRejected The isRejected to set
+ *
+ * @param isRejected
+ * The isRejected to set
*/
- public void setRejected(boolean isRejected)
- {
+ public void setRejected(boolean isRejected) {
fieldRejected = isRejected;
}
/**
* Returns the implicitKeep.
+ *
* @return boolean
*/
- public boolean isImplicitKeep()
- {
+ public boolean isImplicitKeep() {
return fieldImplicitKeep;
}
/**
* Sets the implicitKeep.
- * @param implicitKeep The implicitKeep to set
+ *
+ * @param implicitKeep
+ * The implicitKeep to set
*/
- public void setImplicitKeep(boolean implicitKeep)
- {
+ public void setImplicitKeep(boolean implicitKeep) {
fieldImplicitKeep = implicitKeep;
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/Commands.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/Commands.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/Commands.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/Commands.java Fri Sep 21 02:32:00 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
import java.util.Iterator;
@@ -27,69 +26,67 @@
import org.apache.jsieve.mail.*;
/**
- * <p>A parsed representation of the RFC3028 BNF...</p>
+ * <p>
+ * A parsed representation of the RFC3028 BNF...
+ * </p>
*
* <code>commands = *command</code>
*
*/
-public class Commands implements Executable
-{
+public class Commands implements Executable {
/**
* A List of children of the receiver
- */
+ */
private List fieldChildren;
/**
* Constructor for Commands.
*/
- private Commands()
- {
+ private Commands() {
super();
}
-
+
/**
* Constructor for Commands.
+ *
* @param commands
*/
- public Commands(List commands)
- {
+ public Commands(List commands) {
this();
setChildren(commands);
- }
+ }
/**
* Returns the commands.
+ *
* @return List
*/
- public List getChildren()
- {
+ public List getChildren() {
return fieldChildren;
}
/**
* Sets the commands.
- * @param commands The commands to set
+ *
+ * @param commands
+ * The commands to set
*/
- protected void setChildren(List commands)
- {
+ protected void setChildren(List commands) {
fieldChildren = commands;
}
/**
* @see org.apache.jsieve.Executable#execute(MailAdapter)
*/
- public Object execute(MailAdapter mail) throws SieveException
- {
+ public Object execute(MailAdapter mail) throws SieveException {
Iterator commandsIter = getChildren().iterator();
while (commandsIter.hasNext())
- ((Executable)commandsIter.next()).execute(mail);
- return null;
+ ((Executable) commandsIter.next()).execute(mail);
+ return null;
}
public String toString() {
return "COMMANDS: " + fieldChildren;
}
-
-
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/ComparatorManager.java Fri Sep 21 02:32:00 2007
@@ -17,202 +17,186 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
+
import java.util.Map;
import org.apache.jsieve.comparators.Comparator;
import org.apache.jsieve.exception.LookupException;
/**
- * Singleton class <code>ComparatorManager</code> maps Comparator names to configured
- * Comparator implementation classes.
+ * Singleton class <code>ComparatorManager</code> maps Comparator names to
+ * configured Comparator implementation classes.
*/
-public class ComparatorManager
-{
+public class ComparatorManager {
/**
* The sole instance of the receiver.
- */
+ */
static private ComparatorManager fieldInstance;
/**
* Constructor for ComparatorManager.
*/
- private ComparatorManager()
- {
+ private ComparatorManager() {
super();
}
/**
- * Returns the sole instance of the receiver, lazily initialised if required.
+ * Returns the sole instance of the receiver, lazily initialised if
+ * required.
+ *
* @return ComparatorManager
*/
- public static synchronized ComparatorManager getInstance()
- {
+ public static synchronized ComparatorManager getInstance() {
ComparatorManager current = null;
- if (null == (current = getInstanceBasic()))
- {
+ if (null == (current = getInstanceBasic())) {
updateInstance();
return getInstance();
- }
+ }
return current;
}
-
+
/**
* Returns the sole instance of the receiver.
+ *
* @return ComparatorManager
*/
- private static ComparatorManager getInstanceBasic()
- {
+ private static ComparatorManager getInstanceBasic() {
return fieldInstance;
}
-
+
/**
* Computes a new instance of the receiver.
+ *
* @return ComparatorManager
*/
- protected static ComparatorManager computeInstance()
- {
+ protected static ComparatorManager computeInstance() {
return new ComparatorManager();
- }
+ }
/**
* Sets the sole instance.
- * @param instance The current instance to set
+ *
+ * @param instance
+ * The current instance to set
*/
- protected static void setInstance(ComparatorManager instance)
- {
+ protected static void setInstance(ComparatorManager instance) {
fieldInstance = instance;
}
-
+
/**
* Resets the sole instance.
*/
- public static void resetInstance()
- {
+ public static void resetInstance() {
setInstance(null);
- }
-
+ }
+
/**
* Updates the sole instance.
*/
- protected static void updateInstance()
- {
+ protected static void updateInstance() {
setInstance(computeInstance());
}
-
+
/**
- * <p>Method lookup answers the class to which a Comparator name is mapped.</p>
+ * <p>
+ * Method lookup answers the class to which a Comparator name is mapped.
+ * </p>
*
- * @param name - The name of the Comparator
+ * @param name -
+ * The name of the Comparator
* @return Class - The class of the Comparator
* @throws LookupException
*/
- public Class lookup(String name) throws LookupException
- {
+ public Class lookup(String name) throws LookupException {
Class comparatorClass = null;
- try
- {
- comparatorClass =
- getClass().getClassLoader().loadClass(getClassName(name));
- }
- catch (ClassNotFoundException e)
- {
- throw new LookupException(
- "Comparator named '" + name + "' not found.");
+ try {
+ comparatorClass = getClass().getClassLoader().loadClass(
+ getClassName(name));
+ } catch (ClassNotFoundException e) {
+ throw new LookupException("Comparator named '" + name
+ + "' not found.");
}
if (!Comparator.class.isAssignableFrom(comparatorClass))
- throw new LookupException(
- "Class "
- + comparatorClass.getName()
- + " must implement "
- + Comparator.class.getName());
+ throw new LookupException("Class " + comparatorClass.getName()
+ + " must implement " + Comparator.class.getName());
return comparatorClass;
}
-
+
/**
- * <p>Method newInstance answers an instance of the class to which a Comparator
- * name is mapped.</p>
+ * <p>
+ * Method newInstance answers an instance of the class to which a Comparator
+ * name is mapped.
+ * </p>
*
- * @param name - The name of the Comparator
+ * @param name -
+ * The name of the Comparator
* @return Class - The class of the Comparator
* @throws LookupException
*/
- public Comparator newInstance(String name) throws LookupException
- {
- try
- {
+ public Comparator newInstance(String name) throws LookupException {
+ try {
return (Comparator) lookup(name).newInstance();
- }
- catch (InstantiationException e)
- {
+ } catch (InstantiationException e) {
throw new LookupException(e.getMessage());
- }
- catch (IllegalAccessException e)
- {
+ } catch (IllegalAccessException e) {
throw new LookupException(e.getMessage());
}
- }
-
+ }
/**
- * Method isSupported answers a boolean indicating if a Comparator name is
+ * Method isSupported answers a boolean indicating if a Comparator name is
* configured.
- * @param name - The Comparator name
+ *
+ * @param name -
+ * The Comparator name
* @return boolean - True if the Comparator name is configured.
*/
- public boolean isSupported(String name)
- {
+ public boolean isSupported(String name) {
boolean isSupported = true;
- try
- {
+ try {
lookup(name);
- }
- catch (LookupException e)
- {
+ } catch (LookupException e) {
isSupported = false;
}
return isSupported;
}
-
+
/**
- * <p>Method getClassName answers the name of the class to which a Comparator
- * name is mapped.</p>
+ * <p>
+ * Method getClassName answers the name of the class to which a Comparator
+ * name is mapped.
+ * </p>
*
- * @param name - The name of the Comparator
+ * @param name -
+ * The name of the Comparator
* @return String - The name of the class
* @throws LookupException
*/
- protected String getClassName(String name) throws LookupException
- {
+ protected String getClassName(String name) throws LookupException {
String className;
- try
- {
+ try {
className = (String) getClassNameMap().get(name.toLowerCase());
- }
- catch (SieveConfigurationException e)
- {
+ } catch (SieveConfigurationException e) {
throw new LookupException(
- "Lookup failed due to a Configuration Exception: "
- + e.getMessage());
+ "Lookup failed due to a Configuration Exception: "
+ + e.getMessage());
}
if (null == className)
- throw new LookupException(
- "Command named '" + name + "' not mapped.");
+ throw new LookupException("Command named '" + name
+ + "' not mapped.");
return className;
}
-
+
/**
- * Method getClassNameMap answers a Map of Comparator names and their class
+ * Method getClassNameMap answers a Map of Comparator names and their class
* names.
+ *
* @return Map
* @throws SieveConfigurationException
*/
- protected Map getClassNameMap() throws SieveConfigurationException
- {
- return ConfigurationManager.getInstance().getComparatorMap();
- }
-
-
+ protected Map getClassNameMap() throws SieveConfigurationException {
+ return ConfigurationManager.getInstance().getComparatorMap();
+ }
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/ConditionManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/ConditionManager.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/ConditionManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/ConditionManager.java Fri Sep 21 02:32:00 2007
@@ -17,231 +17,226 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
/**
* Thread singleton class ConditionManager manages Conditional Commands during a
* Sieve evaluation.
*/
-public class ConditionManager
-{
+public class ConditionManager {
/**
* The Condition Manager instance for the current thread
- */
+ */
static private final ThreadLocal fieldInstance = new ThreadLocal();
-
+
/**
* Is an Else Condition allowed
- */
+ */
private boolean fieldElseAllowed;
-
+
/**
* The result of the last Test
- */
- private boolean fieldTestResult;
+ */
+ private boolean fieldTestResult;
/**
* Constructor for ConditionManager.
*/
- private ConditionManager()
- {
+ private ConditionManager() {
super();
initialize();
}
-
+
/**
* Initialize the receiver.
*/
- protected void initialize()
- {
+ protected void initialize() {
setElseAllowed(false);
- setTestResult(true);
- }
-
+ setTestResult(true);
+ }
+
/**
- * Method setIfTestResult enables a following Else Command and records the test
- * result.
+ * Method setIfTestResult enables a following Else Command and records the
+ * test result.
+ *
* @param result
*/
- public void setIfTestResult(boolean result)
- {
+ public void setIfTestResult(boolean result) {
setElseAllowed(true);
- setTestResult(result);
- }
+ setTestResult(result);
+ }
/**
- * Method setElsifTestResult enables a following Else Command and records the
- * test result.
+ * Method setElsifTestResult enables a following Else Command and records
+ * the test result.
+ *
* @param result
- */
- public void setElsifTestResult(boolean result)
- {
+ */
+ public void setElsifTestResult(boolean result) {
setElseAllowed(true);
- setTestResult(result);
- }
+ setTestResult(result);
+ }
/**
- * Method setElseTestResult disables a following Else Command and records the
- * test result.
+ * Method setElseTestResult disables a following Else Command and records
+ * the test result.
+ *
* @param result
- */
- public void setElseTestResult(boolean result)
- {
+ */
+ public void setElseTestResult(boolean result) {
setElseAllowed(false);
- setTestResult(result);
- }
-
+ setTestResult(result);
+ }
+
/**
- * Method isIfAllowed answers a boolean indicating if an If Command is allowed.
+ * Method isIfAllowed answers a boolean indicating if an If Command is
+ * allowed.
+ *
* @return boolean
*/
- public boolean isIfAllowed()
- {
+ public boolean isIfAllowed() {
return true;
- }
-
+ }
+
/**
* Method isElsifAllowed answers a boolean indicating if an Elsif Command is
* allowed.
+ *
* @return boolean
*/
- public boolean isElsifAllowed()
- {
- return isElseAllowed();
- }
-
+ public boolean isElsifAllowed() {
+ return isElseAllowed();
+ }
+
/**
* Method isElseAllowed answers a boolean indicating if an Else Command is
* allowed.
+ *
* @return boolean
*/
- public boolean isElseAllowed()
- {
- return fieldElseAllowed;
+ public boolean isElseAllowed() {
+ return fieldElseAllowed;
}
/**
* Method isIfRunnable answers a boolean indicating if an If Command is
* runnable based upon the current evaluation state.
+ *
* @return boolean
- */
- public boolean isIfRunnable()
- {
+ */
+ public boolean isIfRunnable() {
return true;
}
/**
- * Method isElsifRunnable answers a boolean indicating if an Elsif Command is
- * runnable based upon the current evaluation state.
+ * Method isElsifRunnable answers a boolean indicating if an Elsif Command
+ * is runnable based upon the current evaluation state.
+ *
* @return boolean
- */
- public boolean isElsifRunnable()
- {
+ */
+ public boolean isElsifRunnable() {
return isElseRunnable();
}
/**
* Method isElseRunnable answers a boolean indicating if an Else Command is
* runnable based upon the current evaluation state.
+ *
* @return boolean
- */
- public boolean isElseRunnable()
- {
- return !isTestResult();
- }
-
+ */
+ public boolean isElseRunnable() {
+ return !isTestResult();
+ }
/**
* Answers a new instance of the manager.
+ *
* @return ConditionManager
*/
- static protected ConditionManager computeInstance()
- {
+ static protected ConditionManager computeInstance() {
return new ConditionManager();
- }
-
+ }
/**
- * <p>Returns the conditionManager, lazily intialised if required.</p>
+ * <p>
+ * Returns the conditionManager, lazily intialised if required.
+ * </p>
*
- * <p>Note that this must be synchronized to prevent another thread
- * detecting the null state while this thread is initialising.</p>
+ * <p>
+ * Note that this must be synchronized to prevent another thread detecting
+ * the null state while this thread is initialising.
+ * </p>
*
* @return ConditionManager
*/
- static synchronized public ConditionManager getInstance()
- {
+ static synchronized public ConditionManager getInstance() {
ConditionManager instance = null;
- if (null == (instance = getInstanceBasic()))
- {
+ if (null == (instance = getInstanceBasic())) {
updateInstance();
return getInstance();
}
return instance;
}
-
/**
* Returns the current conditionManager.
+ *
* @return ConditionManager
*/
- static private ConditionManager getInstanceBasic()
- {
- return (ConditionManager)fieldInstance.get();
- }
-
+ static private ConditionManager getInstanceBasic() {
+ return (ConditionManager) fieldInstance.get();
+ }
/**
* Sets the current conditionManager.
- * @param conditionManager The conditionManager to set
+ *
+ * @param conditionManager
+ * The conditionManager to set
*/
- public static void setInstance(ConditionManager conditionManager)
- {
+ public static void setInstance(ConditionManager conditionManager) {
fieldInstance.set(conditionManager);
}
-
+
/**
* resets the current conditionManager.
*/
- static public void resetInstance()
- {
+ static public void resetInstance() {
setInstance(null);
- }
-
+ }
/**
* Updates the current conditionManager.
*/
- static protected void updateInstance()
- {
+ static protected void updateInstance() {
setInstance(computeInstance());
- }
+ }
/**
* Returns the testResult.
+ *
* @return boolean
*/
- protected boolean isTestResult()
- {
+ protected boolean isTestResult() {
return fieldTestResult;
}
/**
* Sets the elseAllowed.
- * @param elseAllowed The elseAllowed to set
+ *
+ * @param elseAllowed
+ * The elseAllowed to set
*/
- protected void setElseAllowed(boolean elseAllowed)
- {
+ protected void setElseAllowed(boolean elseAllowed) {
fieldElseAllowed = elseAllowed;
}
/**
* Sets the testResult.
- * @param testResult The testResult to set
+ *
+ * @param testResult
+ * The testResult to set
*/
- protected void setTestResult(boolean testResult)
- {
+ protected void setTestResult(boolean testResult) {
fieldTestResult = testResult;
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/ConfigurationManager.java Fri Sep 21 02:32:00 2007
@@ -18,6 +18,7 @@
****************************************************************/
package org.apache.jsieve;
+
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
@@ -25,11 +26,11 @@
import org.apache.commons.digester.Digester;
import org.apache.commons.logging.Log;
import org.xml.sax.SAXException;
+
/**
* <p>
- * Singleton class <code>ConfigurationManager</code> parses the XML
- * statements in the Sieve configuration file and translates them to Java
- * objects.
+ * Singleton class <code>ConfigurationManager</code> parses the XML statements
+ * in the Sieve configuration file and translates them to Java objects.
* </p>
*
* <p>
@@ -37,52 +38,53 @@
* located by searching the classpath of the current ClassLoader.
* </p>
*/
-public class ConfigurationManager
-{
+public class ConfigurationManager {
/**
* The sole instance of the receiver.
*/
static private ConfigurationManager fieldInstance;
+
/**
* The Digester used to process the Sieve configuration XML.
*/
private Digester fieldDigester;
+
/**
* A Map of the Command names and their associated class names.
*/
private Map fieldCommandMap;
+
/**
* A Map of the Test names and their associated class names.
*/
private Map fieldTestMap;
+
/**
* A Map of the Comparator names and their associated class names.
*/
private Map fieldComparatorMap;
+
/**
* Constructor for ConfigurationManager.
*
* @throws SieveConfigurationException
*/
- private ConfigurationManager() throws SieveConfigurationException
- {
+ private ConfigurationManager() throws SieveConfigurationException {
super();
Log log = Logger.getLog();
- try
- {
+ try {
parse();
- } catch (SAXException e)
- {
+ } catch (SAXException e) {
if (log.isErrorEnabled())
log.error("Exception processing Configuration: ", e);
throw new SieveConfigurationException(e);
- } catch (IOException e)
- {
+ } catch (IOException e) {
if (log.isErrorEnabled())
log.error("Exception processing Configuration: ", e);
throw new SieveConfigurationException(e);
}
}
+
/**
* Returns the sole instance of the receiver, lazily initialised if
* required.
@@ -90,202 +92,199 @@
* @return ConfigurationManager
*/
static public synchronized ConfigurationManager getInstance()
- throws SieveConfigurationException
- {
+ throws SieveConfigurationException {
ConfigurationManager instance = null;
- if (null == (instance = getInstanceBasic()))
- {
+ if (null == (instance = getInstanceBasic())) {
updateInstance();
return getInstance();
}
return instance;
}
+
/**
* Returns the sole instance of the receiver.
*
* @return ConfigurationManager
*/
- static private ConfigurationManager getInstanceBasic()
- {
+ static private ConfigurationManager getInstanceBasic() {
return fieldInstance;
}
+
/**
* Returns a new instance of the receiver.
*
* @return ConfigurationManager
*/
static protected ConfigurationManager computeInstance()
- throws SieveConfigurationException
- {
+ throws SieveConfigurationException {
return new ConfigurationManager();
}
+
/**
* Sets the instance.
*
- * @param instance The instance to set
+ * @param instance
+ * The instance to set
*/
- static protected void setInstance(ConfigurationManager instance)
- {
+ static protected void setInstance(ConfigurationManager instance) {
fieldInstance = instance;
}
+
/**
* Updates the instance.
*/
- static protected void updateInstance() throws SieveConfigurationException
- {
+ static protected void updateInstance() throws SieveConfigurationException {
setInstance(computeInstance());
}
+
/**
* Method getConfigName answers the name of the Sieve configuration file.
*
* @return String
*/
- static protected String getConfigName()
- {
+ static protected String getConfigName() {
return "sieveConfig.xml";
}
+
/**
* <p>
* Method getConfigStream answers an InputStream over the Sieve
* configuration file. It is located by searching the classpath of the
* current ClassLoader.
- * </p><p>
- * The context classloader is searched first. If a suitably named
- * resource is found then this is returned. Otherwise, the classloader
- * used to load this class is searched for the resource.
* </p>
+ * <p>
+ * The context classloader is searched first. If a suitably named resource
+ * is found then this is returned. Otherwise, the classloader used to load
+ * this class is searched for the resource.
+ * </p>
+ *
* @return InputStream
* @throws IOException
*/
- static protected InputStream getConfigStream() throws IOException
- {
+ static protected InputStream getConfigStream() throws IOException {
InputStream stream = null;
final String configName = getConfigName();
// Context classloader is usually right in a JEE evironment
- final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
- if (contextClassLoader != null)
- {
+ final ClassLoader contextClassLoader = Thread.currentThread()
+ .getContextClassLoader();
+ if (contextClassLoader != null) {
stream = contextClassLoader.getResourceAsStream(configName);
}
-
+
// Sometimes context classloader will not be set conventionally
// So, try class classloader
- if (null == stream)
- {
+ if (null == stream) {
stream = ConfigurationManager.class.getClassLoader()
- .getResourceAsStream(configName);
+ .getResourceAsStream(configName);
}
if (null == stream)
- throw new IOException("Resource \"" + configName
- + "\" not found");
+ throw new IOException("Resource \"" + configName + "\" not found");
return stream;
}
+
/**
* Method getCommandMap answers a Map of Command names and their associated
* class names, lazily initialized if required.
*
* @return Map
*/
- public synchronized Map getCommandMap()
- {
+ public synchronized Map getCommandMap() {
Map commandMap = null;
- if (null == (commandMap = getCommandMapBasic()))
- {
+ if (null == (commandMap = getCommandMapBasic())) {
updateCommandMap();
return getCommandMap();
}
return commandMap;
}
+
/**
* Method getTestMap answers a Map of Test names and their associated class
* names, lazily initialized if required.
*
* @return Map
*/
- public synchronized Map getTestMap()
- {
+ public synchronized Map getTestMap() {
Map testMap = null;
- if (null == (testMap = getTestMapBasic()))
- {
+ if (null == (testMap = getTestMapBasic())) {
updateTestMap();
return getTestMap();
}
return testMap;
}
+
/**
* Method getComparatorMap answers a Map of Comparator names and their
* associated class names, lazily initialized if required.
*
* @return Map
*/
- public synchronized Map getComparatorMap()
- {
+ public synchronized Map getComparatorMap() {
Map comparatorMap = null;
- if (null == (comparatorMap = getComparatorMapBasic()))
- {
+ if (null == (comparatorMap = getComparatorMapBasic())) {
updateComparatorMap();
return getComparatorMap();
}
return comparatorMap;
}
+
/**
* Method getCommandMapBasic answers a Map of Command names and their
* associated class names.
*
* @return Map
*/
- private Map getCommandMapBasic()
- {
+ private Map getCommandMapBasic() {
return fieldCommandMap;
}
+
/**
* Method getTestMapBasic answers a Map of Test names and their associated
* class names.
*
* @return Map
*/
- private Map getTestMapBasic()
- {
+ private Map getTestMapBasic() {
return fieldTestMap;
}
+
/**
* Method getComparatorMapBasic answers a Map of Comparator names and their
* a ssociated class names.
*
* @return Map
*/
- private Map getComparatorMapBasic()
- {
+ private Map getComparatorMapBasic() {
return fieldComparatorMap;
}
+
/**
* Method computeCommandMap answers a new CommandMap.
*
* @return Map
*/
- protected Map computeCommandMap()
- {
+ protected Map computeCommandMap() {
return new HashMap();
}
+
/**
* Method computeTestMap answers a new TestMap.
*
* @return Map
*/
- protected Map computeTestMap()
- {
+ protected Map computeTestMap() {
return new HashMap();
}
+
/**
* Method computeComparatorMap answers a new ComparatorMap.
*
* @return Map
*/
- protected Map computeComparatorMap()
- {
+ protected Map computeComparatorMap() {
return new HashMap();
}
+
/**
* Method putCommandMapEntry adds an association between a Command name and
* an implementation class to the Command Map.
@@ -293,10 +292,10 @@
* @param name
* @param className
*/
- public void putCommandMapEntry(String name, String className)
- {
+ public void putCommandMapEntry(String name, String className) {
getCommandMap().put(name, className);
}
+
/**
* Method putTestMapEntry adds an association between a Test name and an
* implementation class to the Test Map.
@@ -304,10 +303,10 @@
* @param name
* @param className
*/
- public void putTestMapEntry(String name, String className)
- {
+ public void putTestMapEntry(String name, String className) {
getTestMap().put(name, className);
}
+
/**
* Method putComparatorMapEntry adds an association between a Comparator
* name and an implementation class to the Comparator Map.
@@ -315,79 +314,79 @@
* @param name
* @param className
*/
- public void putComparatorMapEntry(String name, String className)
- {
+ public void putComparatorMapEntry(String name, String className) {
getComparatorMap().put(name, className);
}
+
/**
* Returns the digester, lazily initialised if required.
*
* @return Digester
*/
- protected synchronized Digester getDigester()
- {
+ protected synchronized Digester getDigester() {
Digester digester = null;
- if (null == (digester = getDigesterBasic()))
- {
+ if (null == (digester = getDigesterBasic())) {
updateDigester();
return getDigester();
}
return digester;
}
+
/**
* Returns the digester.
*
* @return Digester
*/
- private Digester getDigesterBasic()
- {
+ private Digester getDigesterBasic() {
return fieldDigester;
}
+
/**
* Method computeDigester answers a new digester intialised with the rules
* to parse the Sieve configuration file.
*
* @return Digester
*/
- protected Digester computeDigester()
- {
+ protected Digester computeDigester() {
Digester digester = new Digester();
digester.push(this);
digester.setValidating(false);
// CommandMap rules
digester.addCallMethod("sieve/commandMap/entry", "putCommandMapEntry",
- 2, new Class[]{String.class, String.class});
+ 2, new Class[] { String.class, String.class });
digester.addCallParam("sieve/commandMap/entry/name", 0);
digester.addCallParam("sieve/commandMap/entry/class", 1);
// TestMap rules
digester.addCallMethod("sieve/testMap/entry", "putTestMapEntry", 2,
- new Class[]{String.class, String.class});
+ new Class[] { String.class, String.class });
digester.addCallParam("sieve/testMap/entry/name", 0);
digester.addCallParam("sieve/testMap/entry/class", 1);
// ComparatorMap rules
digester.addCallMethod("sieve/comparatorMap/entry",
- "putComparatorMapEntry", 2, new Class[]{String.class,
- String.class});
+ "putComparatorMapEntry", 2, new Class[] { String.class,
+ String.class });
digester.addCallParam("sieve/comparatorMap/entry/name", 0);
digester.addCallParam("sieve/comparatorMap/entry/class", 1);
return digester;
}
+
/**
* Sets the digester.
*
- * @param digester The digester to set
+ * @param digester
+ * The digester to set
*/
- protected void setDigester(Digester digester)
- {
+ protected void setDigester(Digester digester) {
fieldDigester = digester;
}
+
/**
* Updates the digester.
*/
- protected void updateDigester()
- {
+ protected void updateDigester() {
setDigester(computeDigester());
}
+
/**
* Method parse uses the Digester to parse the XML statements in the Sieve
* configuration file into Java objects.
@@ -396,56 +395,58 @@
* @throws SAXException
* @throws IOException
*/
- protected Object parse() throws SAXException, IOException
- {
+ protected Object parse() throws SAXException, IOException {
return getDigester().parse(getConfigStream());
}
+
/**
* Sets the commandMap.
*
- * @param commandMap The commandMap to set
+ * @param commandMap
+ * The commandMap to set
*/
- protected void setCommandMap(Map commandMap)
- {
+ protected void setCommandMap(Map commandMap) {
fieldCommandMap = commandMap;
}
+
/**
* Sets the testMap.
*
- * @param testMap The testMap to set
+ * @param testMap
+ * The testMap to set
*/
- protected void setTestMap(Map testMap)
- {
+ protected void setTestMap(Map testMap) {
fieldTestMap = testMap;
}
+
/**
* Sets the comparatorMap.
*
- * @param comparatorMap The comparatorMap to set
+ * @param comparatorMap
+ * The comparatorMap to set
*/
- protected void setComparatorMap(Map comparatorMap)
- {
+ protected void setComparatorMap(Map comparatorMap) {
fieldComparatorMap = comparatorMap;
}
+
/**
* Updates the commandMap.
*/
- protected void updateCommandMap()
- {
+ protected void updateCommandMap() {
setCommandMap(computeCommandMap());
}
+
/**
* Updates the testMap.
*/
- protected void updateTestMap()
- {
+ protected void updateTestMap() {
setTestMap(computeTestMap());
}
+
/**
* Updates the comparatorMap.
*/
- protected void updateComparatorMap()
- {
+ protected void updateComparatorMap() {
setComparatorMap(computeComparatorMap());
}
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/Executable.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/Executable.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/Executable.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/Executable.java Fri Sep 21 02:32:00 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
import org.apache.jsieve.exception.SieveException;
@@ -26,8 +25,7 @@
/**
* Interface for an Executable operation.
*/
-public interface Executable
-{
+public interface Executable {
public Object execute(MailAdapter mail) throws SieveException;
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/ExecutableCommand.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/ExecutableCommand.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/ExecutableCommand.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/ExecutableCommand.java Fri Sep 21 02:32:00 2007
@@ -17,28 +17,31 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
import org.apache.jsieve.exception.SieveException;
import org.apache.jsieve.mail.MailAdapter;
/**
- * Interface ExecutableCommand defines the method signatures for Sieve Commands.
+ * Interface ExecutableCommand defines the method signatures for Sieve Commands.
*/
-public interface ExecutableCommand
-{
+public interface ExecutableCommand {
/**
* Method execute executes a Sieve Command.
- * @param mail - The mail against which the Command is executed.
- * @param arguments - The Command arguments
- * @param block - An optional Block to be evaluated
- * @param context <code>SieveContext</code> containing contextual information,
- * not null
+ *
+ * @param mail -
+ * The mail against which the Command is executed.
+ * @param arguments -
+ * The Command arguments
+ * @param block -
+ * An optional Block to be evaluated
+ * @param context
+ * <code>SieveContext</code> containing contextual
+ * information, not null
* @return Object - The result of evaluating the Command
* @throws SieveException
*/
- public Object execute(MailAdapter mail, Arguments arguments, Block block,
+ public Object execute(MailAdapter mail, Arguments arguments, Block block,
SieveContext context) throws SieveException;
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/Logger.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/Logger.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/Logger.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/Logger.java Fri Sep 21 02:32:00 2007
@@ -17,7 +17,6 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
import org.apache.commons.logging.Log;
@@ -26,83 +25,83 @@
/**
* Singleton class Logger manages the configuartion of the Log used by Sieve.
*/
-public class Logger
-{
+public class Logger {
/*
* The sole instance of the Log.
- */
+ */
static private Log fieldLog;
/**
* Constructor for Logger.
*/
- private Logger()
- {
+ private Logger() {
super();
}
/**
* Returns the logger.
+ *
* @return Log
*/
- public static Log getLog()
- {
+ public static Log getLog() {
Log log = null;
- if (null == (log = getLogBasic()))
- {
+ if (null == (log = getLogBasic())) {
updateLog();
- return getLog();
- }
+ return getLog();
+ }
return log;
}
-
+
/**
* Returns the log.
+ *
* @return Log
*/
- private static Log getLogBasic()
- {
+ private static Log getLogBasic() {
return fieldLog;
}
-
+
/**
* Computes the log.
+ *
* @return Log
*/
- protected static Log computeLog()
- {
+ protected static Log computeLog() {
return LogFactory.getLog(getLogName());
- }
+ }
/**
* Sets the logger.
- * @param logger The logger to set
+ *
+ * @param logger
+ * The logger to set
*/
- protected static void setLog(Log logger)
- {
+ protected static void setLog(Log logger) {
fieldLog = logger;
}
-
+
/**
* Updates the log.
*/
- protected static void updateLog()
- {
+ protected static void updateLog() {
setLog(computeLog());
}
-
+
/**
- * <p>Answers the log name.</p>
+ * <p>
+ * Answers the log name.
+ * </p>
*
- * <p>Note that this cannot be fetched from the ConfigurationManager as the
- * ConfigurationManager itself uses the Logger. This would result in a loop! No
- * points for deducing why I am sure of this!</p>
+ * <p>
+ * Note that this cannot be fetched from the ConfigurationManager as the
+ * ConfigurationManager itself uses the Logger. This would result in a loop!
+ * No points for deducing why I am sure of this!
+ * </p>
*
* @return String The name of the log
*/
- protected static String getLogName()
- {
+ protected static String getLogName() {
return "Sieve";
- }
+ }
}
Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/NumberArgument.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/NumberArgument.java?rev=578033&r1=578032&r2=578033&view=diff
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/NumberArgument.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/NumberArgument.java Fri Sep 21 02:32:00 2007
@@ -17,107 +17,102 @@
* under the License. *
****************************************************************/
-
package org.apache.jsieve;
import org.apache.jsieve.parser.generated.Token;
/**
- * <p>A parsed representation of the RFC3028 BNF...</p>
+ * <p>
+ * A parsed representation of the RFC3028 BNF...
+ * </p>
*
* <code>1*DIGIT [QUANTIFIER]</code>
*
- * <p>Note that the stored value is the absolute value after applying the quantifier.
+ * <p>
+ * Note that the stored value is the absolute value after applying the
+ * quantifier.
* </p>
*
*/
-public class NumberArgument implements Argument
-{
-
+public class NumberArgument implements Argument {
+
/**
- * The absolute value of the number after applying the quentifier.
- */
+ * The absolute value of the number after applying the quentifier.
+ */
private Integer fieldValue;
/**
* Constructor for NumberArgument.
*/
- private NumberArgument()
- {
+ private NumberArgument() {
super();
}
-
+
/**
* Constructor for NumberArgument.
+ *
* @param token
*/
- public NumberArgument(Token token)
- {
+ public NumberArgument(Token token) {
this();
setValue(token);
}
/**
* Sets the value of the reciver to an Integer.
- * @param number The value to set
+ *
+ * @param number
+ * The value to set
*/
- protected void setValue(Integer number)
- {
+ protected void setValue(Integer number) {
fieldValue = number;
}
/**
* @see org.apache.jsieve.Argument#getValue()
*/
- public Object getValue()
- {
+ public Object getValue() {
return fieldValue;
}
-
+
/**
* Method getInteger answers the value of the receiver as an Integer.
+ *
* @return Integer
*/
- public Integer getInteger()
- {
+ public Integer getInteger() {
return fieldValue;
- }
+ }
/**
* Sets the value of the receiver from a Token.
- * @param aToken The Token from which to extract the value to set
+ *
+ * @param aToken
+ * The Token from which to extract the value to set
*/
- protected void setValue(Token aToken)
- {
+ protected void setValue(Token aToken) {
int endIndex = aToken.image.length();
int magnitude = 1;
- if (aToken.image.endsWith("K"))
- {
+ if (aToken.image.endsWith("K")) {
magnitude = 1024;
endIndex--;
- }
- else if (aToken.image.endsWith("M"))
- {
+ } else if (aToken.image.endsWith("M")) {
magnitude = 1048576;
endIndex--;
- }
- else if (aToken.image.endsWith("G"))
- {
+ } else if (aToken.image.endsWith("G")) {
magnitude = 1073741824;
endIndex--;
}
- setValue(
- new Integer(
- Integer.parseInt(aToken.image.substring(0, endIndex))
- * magnitude));
+ setValue(new Integer(Integer.parseInt(aToken.image.substring(0,
+ endIndex))
+ * magnitude));
}
/**
* @see java.lang.Object#toString()
*/
- public String toString()
- {
+ public String toString() {
return (getValue() == null) ? "null" : getValue().toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org