The im4java Library, Version 1.4.0

org.im4java.script
Class AbstractScriptGenerator

java.lang.Object
  extended by org.im4java.script.AbstractScriptGenerator
All Implemented Interfaces:
ScriptGenerator
Direct Known Subclasses:
BashScriptGenerator, CmdScriptGenerator

public abstract class AbstractScriptGenerator
extends java.lang.Object
implements ScriptGenerator

This class is an abstract implementation of a ScriptGenerator.

Since:
1.0.0
Version:
$Revision: 1.7 $
Author:
$Author: bablokb $

Field Summary
protected  char ESC_EOL
          The EOL escape character.
protected  char ESC_SPECIAL
          The escape character for special characters.
protected  int iArgIndex
          The current script-argument-index.
protected  java.lang.String iIndent
          The current indentation-level.
protected  java.lang.StringBuilder iLineBuffer
          The current line-buffer.
protected static int LINE_SIZE
          The maximum linesize.
 
Constructor Summary
AbstractScriptGenerator()
           
 
Method Summary
 void createScript()
          Generate the script.
 Operation getOperation()
          Return the Operation-object.
 java.util.Properties getProperties()
          Return the Properties-object.
protected  java.lang.String getScriptArg(java.lang.String pToken)
          Return the token as a script-argument.
protected  java.lang.String getSearchPath()
          Return the search-path in a plattform-dependent way.
 java.io.PrintWriter getWriter()
          Return the PrintWriter-object.
 void init(java.io.PrintWriter pWriter, Operation pOp, java.util.Properties pProps)
          Intialize the generator.
protected  java.lang.String quote(java.lang.String pString)
          Quote the given string.
protected  void writeCommand()
          Write the ImageCommand to the script-file.
protected  void writeHeader()
          Write the header of the script.
protected  void writeOperation()
          Write the Operation to the script-file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_SIZE

protected static final int LINE_SIZE
The maximum linesize.

See Also:
Constant Field Values

ESC_EOL

protected char ESC_EOL
The EOL escape character.


ESC_SPECIAL

protected char ESC_SPECIAL
The escape character for special characters.


iIndent

protected java.lang.String iIndent
The current indentation-level.


iLineBuffer

protected java.lang.StringBuilder iLineBuffer
The current line-buffer.


iArgIndex

protected int iArgIndex
The current script-argument-index.

Constructor Detail

AbstractScriptGenerator

public AbstractScriptGenerator()
Method Detail

createScript

public void createScript()
Generate the script.

Specified by:
createScript in interface ScriptGenerator

writeHeader

protected void writeHeader()
Write the header of the script. This method must be implemented by subclasses.


getSearchPath

protected java.lang.String getSearchPath()
Return the search-path in a plattform-dependent way.


writeCommand

protected void writeCommand()
Write the ImageCommand to the script-file. This is a default implementation which should do for most cases.


getScriptArg

protected java.lang.String getScriptArg(java.lang.String pToken)
Return the token as a script-argument. Normally, the argument token is only part of the script-argument if it contains a [wxh+x+y]-read-spec.

This method must be implemented by subclasses.


quote

protected java.lang.String quote(java.lang.String pString)
Quote the given string. This method must be implemented by subclasses.


writeOperation

protected void writeOperation()
Write the Operation to the script-file.


init

public void init(java.io.PrintWriter pWriter,
                 Operation pOp,
                 java.util.Properties pProps)
Intialize the generator.

Specified by:
init in interface ScriptGenerator

getWriter

public java.io.PrintWriter getWriter()
Return the PrintWriter-object.


getOperation

public Operation getOperation()
Return the Operation-object.


getProperties

public java.util.Properties getProperties()
Return the Properties-object.


The im4java Library, Version 1.4.0

Released under the LGPL, (c) Bernhard Bablok 2008-2010
Homepage: http://im4java.sourceforge.net/