oracle.clex.process
Class CreateTagReplacementPage

java.lang.Object
  |
  +--oracle.cle.process.Process
        |
        +--oracle.cle.process.GenericProcess
              |
              +--oracle.cle.process.ParentProcess
                    |
                    +--oracle.clex.process.CreatePage
                          |
                          +--oracle.clex.process.CreateGenericTextPage
                                |
                                +--oracle.clex.process.CreateTagReplacementPage
All Implemented Interfaces:
Child, java.lang.Cloneable, PageConstants, Parent, ProcessConstants, java.io.Serializable, State
Direct Known Subclasses:
CreateHTMLPage

public abstract class CreateTagReplacementPage
extends CreateGenericTextPage

This class constructs a bytestream by parsing through the contents of a file. During parsing all tags of the following general form <CLE_INC>tagName</CLE_INC> are replaced by the actual dynamic data using the following lookup strategy:
1) The tagName is used to determine if there is a ProcessInfo in the InfoTable with a matching tag. If so that value is substituted.
2) If a value provided is specified in the constructor then the word 'get' will be prepended to the 'tagName' and reflection will be used to call the method. The result of the method call will be substituted in place of the tags.

After each line is parsed and all tagName the function postProcessLine(String) is executed to perform and class specific processing on individual lines. This function is curretly being used in CreateHTMLPage to support automatic inclusion of a PageID tag after a form tag in html files.

About CLE_INC Tag: The only restrictions that currently exist for the CLE_INC tags are:
1) The entire tag must be on a line. You can not currently split the tag across lines.

See Also:
Serialized Form

Field Summary
protected  java.lang.String className
           
protected  java.lang.String filename
           
protected  HTMLString htmlDynamicLine
           
protected  java.lang.String htmlInputBufferLine
          HTML line read from input buffer
protected  java.lang.String htmlInputBufferNextLine
          // Next HTML Line
protected  boolean lookupPage
           
protected static java.lang.String matchString
           
protected  java.lang.String pageLocationKey
           
protected  java.net.URL url
           
protected  java.lang.Class valueProvider
           
protected  GenericProcess valueProviderInstance
           
protected  java.lang.String valueStr
          Actual getXXX - valueStr contains XXX
protected  java.lang.String wrbStr
          Sub string between beginning from WRB_INC to ">"
protected  java.lang.String wrbSubStr
          Sub string of HTML line beginning from WRB_INC
 
Fields inherited from class oracle.cle.process.GenericProcess
parent
 
Fields inherited from class oracle.cle.process.Process
condition, DEBUG, endState, FAILURE, name, processes, service, stateMachine, SUCCESS, TRANSITION_CONDITION_FAILURE, TRANSITION_CONDITION_SUCCESS
 
Fields inherited from interface oracle.cle.process.ProcessConstants
ALLINFO, BINARYSIZE, CONNECTION_PROVIDER_DTD_NAME, CONNECTION_PROVIDER_VALIDATION_PROPERTY, CONTENTTYPE, CURRENTPAGEID, CURRENTSERVICE, ERRORMESSAGE, GENERICBINARYRESULT, GENERICTEXTRESULT, GETINFO_CHECK_ALL, GETINFO_CHECK_CONTROLLERONLY, GETINFO_CHECK_SERVICEONLY, HTML, HTMLRESULT, JSPRESULT, LOGOFF, NOMESSAGE, PAGEID, PDF, PDFRESULT, PRE_GROUP_DTD_NAME, PRE_GROUP_VALIDATION_PROPERTY, PROCESS_FEEDBACK, RESTART, RESULTTYPE, RULES_DTD_NAME, SERVICE_DESCRIPTOR, SERVICE_DTD_NAME, SERVICE_VALIDATION_PROPERTY, SERVICEINITIALSTATE, SERVICENAME, SESSIONID, SKIP, STACKTRACE, USER, USERROLE, WML, XML, XMLRESULT
 
Constructor Summary
CreateTagReplacementPage()
          Default constructor
CreateTagReplacementPage(java.lang.String aFileURLString)
          Constructor with aFileURLString parameter.
CreateTagReplacementPage(java.lang.String aPageLocationKey, boolean lookup)
          Constructor with aPageLocationKey parameter.
CreateTagReplacementPage(java.lang.String aFilename, java.lang.String aClassName)
           
CreateTagReplacementPage(java.lang.String aPageLocationOrKey, java.lang.String aClassName, boolean lookup)
          Constructor with aPageLocationKey and aClassName parameters.
 
Method Summary
protected  java.io.InputStream getInputStream(java.lang.String aFilename)
          Returns the InputStream for the specified file.
 HTMLString handleTag(java.lang.String tag)
          Resolves the value of the tag either from the infoTable or the valueProvider Object
protected  void init(java.lang.String aFilename, java.lang.String aClassName)
          Common code for all constructors.
static void main(java.lang.String[] args)
          Main method for testing this class.
protected abstract  java.lang.String postProcessLine(java.lang.String aString)
           
protected  void postStart()
          Processes the result for the valueProvider(Child) Object.
protected  void preStart()
          Invokes super.preStart() before processing the parameters in the valueProvider(Child) Object.
 void printPage(java.io.PrintWriter out)
          This method takes a PrintWriter as an argument.
protected  void registerInfo()
          Register all ProcessParameters(CURRENTSERVICE,GroupName) and potential ProcessResults(CURRENTPAGEID).
 void setService(Service aService)
          Overload this setter to set the valueProvider's service
 
Methods inherited from class oracle.clex.process.CreateGenericTextPage
setContentType
 
Methods inherited from class oracle.clex.process.CreatePage
buildTransitionTable, getPageId, lookupPageLocation, registerProcesses, setCreatePageResult, start
 
Methods inherited from class oracle.cle.process.ParentProcess
addTransition, clone, doSkip, getChildren, getEndStates, getInitialState, getSkipable, isReady, processParameters, processResults, registerProcess, setInitialState, setSkipable, skip
 
Methods inherited from class oracle.cle.process.GenericProcess
getBooleanInfo, getFloatInfo, getInfo, getInfo, getInfo, getInfoValue, getInfoValue, getInfoValueFromController, getInfoValueFromService, getIntegerInfo, getParameterNamed, getParameters, getParent, getParents, getResultNamed, getResults, getSessionId, getStringInfo, processParameters, processResults, registerBooleanParameter, registerBooleanResult, registerIntegerParameter, registerIntegerResult, registerParameter, registerProcessInfo, registerResult, registerStringArrayParameter, registerStringArrayResult, registerStringParameter, registerStringParameter, registerStringResult, registerStringResult, retrieveStringParameter, runTest, setParent, setResult, setResult, setResult
 
Methods inherited from class oracle.cle.process.Process
addCondition, addProcess, cloneProcess, debug, generateFailureCondition, generateSuccessCondition, getClassname, getCondition, getConditions, getIconName, getImageName, getName, getProcesses, getProcessNamed, getStateMachine, hashCode, isEndState, removeCondition, removeCondition, reportException, returnCondition, setCondition, setCondition, setEndState, setName, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.cle.process.Parent
getInfo, getName, getParents
 
Methods inherited from interface oracle.cle.process.Child
getParameters, getParent, getParents, getResults, setParent
 

Field Detail

filename

protected java.lang.String filename

className

protected java.lang.String className

valueProvider

protected java.lang.Class valueProvider

valueProviderInstance

protected GenericProcess valueProviderInstance

htmlDynamicLine

protected HTMLString htmlDynamicLine

url

protected java.net.URL url

lookupPage

protected boolean lookupPage

pageLocationKey

protected java.lang.String pageLocationKey

htmlInputBufferLine

protected java.lang.String htmlInputBufferLine
HTML line read from input buffer

htmlInputBufferNextLine

protected java.lang.String htmlInputBufferNextLine
// Next HTML Line

wrbSubStr

protected java.lang.String wrbSubStr
Sub string of HTML line beginning from WRB_INC

wrbStr

protected java.lang.String wrbStr
Sub string between beginning from WRB_INC to ">"

valueStr

protected java.lang.String valueStr
Actual getXXX - valueStr contains XXX

matchString

protected static final java.lang.String matchString
Constructor Detail

CreateTagReplacementPage

public CreateTagReplacementPage()
Default constructor

CreateTagReplacementPage

public CreateTagReplacementPage(java.lang.String aFileURLString)
Constructor with aFileURLString parameter. Assumption is made that the HTML file will not contain any WRB tag. In case, a WRB tag is found and if no class parameter was passed, the printHTMLPage method sets state condition to failure.
Parameters:
aFileURLString - URL string containing the HTML file name

CreateTagReplacementPage

public CreateTagReplacementPage(java.lang.String aFilename,
                                java.lang.String aClassName)

CreateTagReplacementPage

public CreateTagReplacementPage(java.lang.String aPageLocationOrKey,
                                java.lang.String aClassName,
                                boolean lookup)
Constructor with aPageLocationKey and aClassName parameters. From the aClassName actual class is created and assigned to valueProvider class object. The aPageLocationOrKey is the key used to lookup the HTML Page location if lookup is true. Otherwise, the file is looked up as a resource (if no protocol specified) or via a URL (if a protocol is specified).
Parameters:
aPageLocationKey - properties key to use for lookup of the HTML page
aClassName - Name of the child class
lookup - lookup HTML location if this is true

CreateTagReplacementPage

public CreateTagReplacementPage(java.lang.String aPageLocationKey,
                                boolean lookup)
Constructor with aPageLocationKey parameter. The aPageLocationKey is the key used to lookup the HTML Page location only if the lookup parameter is set to true.
Parameters:
aPageLocationKey - properties key to use for lookup of the HTML page
lookup - lookup HTML location if this is true
Method Detail

init

protected void init(java.lang.String aFilename,
                    java.lang.String aClassName)
             throws java.lang.Exception
Common code for all constructors. Takes a filename String and a child class name. An object of the child class is instantiated and used to provide values to the related HTML page through the CLE_INC mechanism.
Throws:
java.lang.Exception -  

setService

public void setService(Service aService)
Overload this setter to set the valueProvider's service
Overrides:
setService in class Process

handleTag

public HTMLString handleTag(java.lang.String tag)
Resolves the value of the tag either from the infoTable or the valueProvider Object

printPage

public void printPage(java.io.PrintWriter out)
This method takes a PrintWriter as an argument. Currently the PrintWriter is a ByteArrayOutputStream in memory.

The File to be parsed for CLE_INC tags is specified in the constructor. You can specify the location of the file in one of two ways:

1) Pass the a filensme or URL to the constructor (ie. if URL: file://c:/tmp/file.html, if in WEB-INF/classes [root of classpath]: file.html)
2) Pass in the key of the file name. The key will then be used to lookup the exact file name from a properties file.

During parsing all tags of the following general form tagName are replaced by the actual dynamic data using the following lookup strategy:

1) The tagName is used to determine if there is a ProcessInfo in the InfoTable with a matching tag. If so that value is substituted.
2) If a value provided is specified in the constructor then the word 'get' will be prepended to the 'tagName' and reflection will be used to call the method. The result of the method call will be substituted in place of the tags.

Overrides:
printPage in class CreatePage

registerInfo

protected void registerInfo()
Register all ProcessParameters(CURRENTSERVICE,GroupName) and potential ProcessResults(CURRENTPAGEID).
Overrides:
registerInfo in class CreateGenericTextPage

preStart

protected void preStart()
Invokes super.preStart() before processing the parameters in the valueProvider(Child) Object.
Overrides:
preStart in class CreateGenericTextPage

postStart

protected void postStart()
Processes the result for the valueProvider(Child) Object.
Overrides:
postStart in class CreatePage

postProcessLine

protected abstract java.lang.String postProcessLine(java.lang.String aString)

getInputStream

protected final java.io.InputStream getInputStream(java.lang.String aFilename)
                                            throws java.lang.Exception
Returns the InputStream for the specified file. The file can be looked up as a resource with file name specified at root of classpath (no protocol) or via a URL if a protocol is given. Invokes CLEUtil.getInputStream(String, Class)
Returns:
java.io.InputStream

main

public static void main(java.lang.String[] args)
Main method for testing this class.


Copyright © 2003 ORACLE Corp. All Rights Reserved.