org.apache.james.mpt
Class ProtocolSessionBuilder

java.lang.Object
  extended by org.apache.james.mpt.ProtocolSessionBuilder

public class ProtocolSessionBuilder
extends java.lang.Object

A builder which generates scripts from textual input.

Version:
$Revision: 776401 $
Author:
Darrell DeBoer

Field Summary
static java.lang.String CLIENT_TAG
           
static java.lang.String CLOSE_UNORDERED_BLOCK_TAG
           
static java.lang.String COMMENT_TAG
           
static java.lang.String OPEN_UNORDERED_BLOCK_TAG
           
static java.lang.String SERVER_CONTINUATION_TAG
           
static java.lang.String SERVER_TAG
           
static java.lang.String SESSION_TAG
           
 
Constructor Summary
ProtocolSessionBuilder()
           
 
Method Summary
 void addProtocolLines(java.lang.String scriptName, java.io.InputStream is, ProtocolInteractor session)
          Reads ProtocolElements from the supplied InputStream and adds them to the ProtocolSession.
 void addProtocolLines(java.lang.String scriptName, java.io.Reader reader, ProtocolInteractor session)
          Reads ProtocolElements from the supplied Reader and adds them to the ProtocolSession.
 void addTestFile(java.lang.String fileName, ProtocolInteractor session)
          Adds all protocol elements from a test file to the ProtocolSession supplied.
 ProtocolInteractor buildProtocolSession(java.lang.String fileName)
          Builds a ProtocolSession by reading lines from the test file with the supplied name.
 ProtocolInteractor buildProtocolSession(java.lang.String scriptName, java.io.Reader reader)
          Builds a ProtocolSession by reading lines from the reader.
 void setVariable(java.lang.String name, java.lang.String value)
          Sets a substitution varaible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_CONTINUATION_TAG

public static final java.lang.String SERVER_CONTINUATION_TAG
See Also:
Constant Field Values

CLIENT_TAG

public static final java.lang.String CLIENT_TAG
See Also:
Constant Field Values

SERVER_TAG

public static final java.lang.String SERVER_TAG
See Also:
Constant Field Values

OPEN_UNORDERED_BLOCK_TAG

public static final java.lang.String OPEN_UNORDERED_BLOCK_TAG
See Also:
Constant Field Values

CLOSE_UNORDERED_BLOCK_TAG

public static final java.lang.String CLOSE_UNORDERED_BLOCK_TAG
See Also:
Constant Field Values

COMMENT_TAG

public static final java.lang.String COMMENT_TAG
See Also:
Constant Field Values

SESSION_TAG

public static final java.lang.String SESSION_TAG
See Also:
Constant Field Values
Constructor Detail

ProtocolSessionBuilder

public ProtocolSessionBuilder()
Method Detail

setVariable

public void setVariable(java.lang.String name,
                        java.lang.String value)
Sets a substitution varaible. The value of a variable will be substituted whereever ${NAME} is found in the input where NAME is the name of the variable.

Parameters:
name - not null
value - not null

buildProtocolSession

public ProtocolInteractor buildProtocolSession(java.lang.String fileName)
                                        throws java.lang.Exception
Builds a ProtocolSession by reading lines from the test file with the supplied name.

Parameters:
fileName - The name of the protocol session file.
Returns:
The ProtocolSession
Throws:
java.lang.Exception

buildProtocolSession

public ProtocolInteractor buildProtocolSession(java.lang.String scriptName,
                                               java.io.Reader reader)
                                        throws java.lang.Exception
Builds a ProtocolSession by reading lines from the reader.

Parameters:
scriptName - not null
reader - not null
Returns:
The ProtocolSession
Throws:
java.lang.Exception

addTestFile

public void addTestFile(java.lang.String fileName,
                        ProtocolInteractor session)
                 throws java.lang.Exception
Adds all protocol elements from a test file to the ProtocolSession supplied.

Parameters:
fileName - The name of the protocol session file.
session - The ProtocolSession to add the elements to.
Throws:
java.lang.Exception

addProtocolLines

public void addProtocolLines(java.lang.String scriptName,
                             java.io.InputStream is,
                             ProtocolInteractor session)
                      throws java.lang.Exception
Reads ProtocolElements from the supplied InputStream and adds them to the ProtocolSession.

Parameters:
scriptName - The name of the source file, for error messages.
is - The input stream containing the protocol definition.
session - The ProtocolSession to add elements to.
Throws:
java.lang.Exception

addProtocolLines

public void addProtocolLines(java.lang.String scriptName,
                             java.io.Reader reader,
                             ProtocolInteractor session)
                      throws java.lang.Exception
Reads ProtocolElements from the supplied Reader and adds them to the ProtocolSession.

Parameters:
scriptName - The name of the source file, for error messages.
reader - the reader containing the protocol definition.
session - The ProtocolSession to add elements to.
Throws:
java.lang.Exception


Copyright © 2008-2009 The Apache Software Foundation. All Rights Reserved.