|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openbp.common.template.TemplateBase
org.openbp.cockpit.template.standard.JavaSrcTemplate
org.openbp.cockpit.template.standard.ProcessSrcJavaTemplate
public class ProcessSrcJavaTemplate
Process source code templates. Input: Process items.
| Field Summary | |
|---|---|
protected java.util.Map |
allNodes
List of all nodes that have been encountered yet. |
protected InitialNode |
currentInitialNode
Initial node that corresponds to the method |
protected java.util.Map |
executionPathNodes
List of nodes that have been encountered in the current execution path, i. e. in the current block or its parent blocks. |
protected ProcessItem |
process
Process |
protected JavaTemplateWriter |
w
Source file writer |
| Constructor Summary | |
|---|---|
ProcessSrcJavaTemplate()
Constructor. |
|
| Method Summary | |
|---|---|
protected void |
addDataLinkVariable(DataLink link)
Defines a method-local variable representing a data link. |
protected java.lang.String |
constructDataLinkVariableDeclaration(java.lang.String name,
DataTypeItem dataType)
Constructs the declaration for a data link variable. |
protected boolean |
containsPathNode(Node nodeToSearch,
NodeSocket socket)
|
protected java.lang.String |
determineClassName()
Returns the fully qualified class name to use for the process class. |
protected java.lang.String |
expandParametrizedExpression(java.lang.String expression,
NodeSocket socket)
Expands parameters in an expression, substituting parameter names for their actual values. |
protected java.lang.String |
expandParametrizedExpression(java.lang.String expression,
NodeSocket entrySocket,
NodeSocket exitSocket)
Expands parameters in an expression, substituting parameter names for their actual values. |
protected Node |
findJoiningNode(DecisionNode decisionNode,
NodeSocket yesSocket,
NodeSocket noSocket)
Finds the node that joins the 'then' and the 'else' part of a decison node. |
void |
generate(java.lang.Object[] templateArgs)
This method is called when the template executes. |
protected NodeSocket |
getNamedSocket(Node node,
java.lang.String name)
Gets a socket by its name. |
protected java.lang.String |
getParamValue(NodeSocket socket,
java.lang.String paramName)
Obtains the value for a named parameter. |
protected java.lang.String |
makeVariableName(DescriptionObject o)
Produces a syntactically correct variable name from an arbitrary object. |
protected java.lang.String |
obtainExpression(java.lang.String expression,
java.lang.String desiredLanguage,
PrintNameProvider owner)
Obtains an expression for this source language from the given string. |
protected void |
printActivityNode(ActivityNode node,
NodeSocket entrySocket,
NodeSocket exitSocket)
Prints the activity node code. |
protected void |
printAsssignment(java.lang.String targetName,
java.lang.String sourceName)
Prints a variable asssignment. |
protected void |
printClassCode()
Prints the class comment. |
protected void |
printDecisionNodeCondition(DecisionNode node,
NodeSocket entrySocket)
Prints the decision node condition. |
protected void |
printDecisionNodeElse(DecisionNode node,
NodeSocket noSocket,
Node joinNode)
Prints the decision node else. |
protected void |
printDecisionNodeThen(DecisionNode node,
NodeSocket yesSocket,
Node joinNode)
Prints the decision node then. |
protected void |
printExecution(NodeSocket startSocket,
Node stopNode)
Prints an execution path starting with the supplied start socket. |
protected void |
printFile()
Performs the generation. |
protected void |
printFinalNode(FinalNode node,
NodeSocket entrySocket)
Prints the final node code. |
protected void |
printGlobal(ProcessVariable param)
Prints the declaration of a process variable. |
protected void |
printInitialNode(InitialNode node,
NodeSocket exitSocket)
Prints the initial node code. |
protected void |
printMethod(InitialNode initialNode)
Prints a method for each initial node. |
protected void |
printMethodBody(InitialNode initialNode,
FinalNode finalNode)
Prints the method body. |
protected void |
printMethodFooter(InitialNode initialNode,
FinalNode finalNode)
Prints the method footer. |
protected void |
printMethodHeader(InitialNode initialNode,
FinalNode finalNode)
Prints the method header including the parameter list. |
protected void |
printMethods()
Prints a method for each initial node. |
protected void |
printProcessVariables()
Prints declarations of process variables. |
protected Node |
skipDecisionNodeBranches(DecisionNode decisionNode)
Skips decision node branches. |
| Methods inherited from class org.openbp.cockpit.template.standard.JavaSrcTemplate |
|---|
adverb, createComment, createComment, determineJavaType, errMsg, errMsg, extractUnqualifiedName, printFileHeader, removeDot, singular |
| Methods inherited from class org.openbp.common.template.TemplateBase |
|---|
addResultFileInfo, callTemplate, getOutputDir, getProperties, getProperty, setProperty |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ProcessItem process
protected JavaTemplateWriter w
protected InitialNode currentInitialNode
protected java.util.Map executionPathNodes
Node objects to themselves).
protected java.util.Map allNodes
Node objects to themselves).
| Constructor Detail |
|---|
public ProcessSrcJavaTemplate()
| Method Detail |
|---|
public void generate(java.lang.Object[] templateArgs)
throws java.lang.Exception
generate in class TemplateBasetemplateArgs - Template arguments provided by the caller (null in this case)
java.lang.Exception - On errorprotected java.lang.String determineClassName()
protected void printFile()
throws java.lang.Exception
java.lang.Exception - On error
protected void printClassCode()
throws java.lang.Exception
java.lang.Exception - On error
protected void printProcessVariables()
throws java.lang.Exception
java.lang.Exception - On error
protected void printGlobal(ProcessVariable param)
throws java.lang.Exception
param - Process variable to declare
java.lang.Exception - On errorprotected void addDataLinkVariable(DataLink link)
link - Data link to define
protected java.lang.String constructDataLinkVariableDeclaration(java.lang.String name,
DataTypeItem dataType)
name - Name of the variabledataType - Data type of the variable
protected void printMethods()
throws java.lang.Exception
java.lang.Exception - On error
protected void printMethod(InitialNode initialNode)
throws java.lang.Exception
initialNode - Initial node of the method
java.lang.Exception - On error
protected void printMethodHeader(InitialNode initialNode,
FinalNode finalNode)
throws java.lang.Exception
initialNode - Initial node of the methodfinalNode - Final node of the method or null
java.lang.Exception - On error
protected void printMethodBody(InitialNode initialNode,
FinalNode finalNode)
throws java.lang.Exception
initialNode - Initial node of the methodfinalNode - Final node of the method or null
java.lang.Exception - On error
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected void printMethodFooter(InitialNode initialNode,
FinalNode finalNode)
throws java.lang.Exception
initialNode - Initial node of the methodfinalNode - Final node of the method or null
java.lang.Exception - On error
protected void printExecution(NodeSocket startSocket,
Node stopNode)
throws java.lang.Exception
startSocket - Socket to start with (can be an entry or exit socket)stopNode - Node that ends the execution path or null.
The code of the stop node is not printed.
A return statement always finishes the execution path generation normally.
java.lang.Exception - On error
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected void printInitialNode(InitialNode node,
NodeSocket exitSocket)
throws java.lang.Exception
node - Initial nodeexitSocket - Exit socket
java.lang.Exception - On error
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected void printFinalNode(FinalNode node,
NodeSocket entrySocket)
throws java.lang.Exception
node - Final nodeentrySocket - Entry socket
java.lang.Exception - On error
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected void printAsssignment(java.lang.String targetName,
java.lang.String sourceName)
throws java.lang.Exception
targetName - Target variable namesourceName - Source variable name
java.lang.Exception - On error
protected void printActivityNode(ActivityNode node,
NodeSocket entrySocket,
NodeSocket exitSocket)
throws java.lang.Exception
node - Activity nodeentrySocket - Entry socketexitSocket - Exit socket
java.lang.Exception - On error
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected void printDecisionNodeCondition(DecisionNode node,
NodeSocket entrySocket)
throws java.lang.Exception
node - Decision nodeentrySocket - Entry socket
java.lang.Exception - On error
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected void printDecisionNodeThen(DecisionNode node,
NodeSocket yesSocket,
Node joinNode)
throws java.lang.Exception
node - Decision nodeyesSocket - Socket that refers to the 'then' path of the statementjoinNode - Node that joins the 'then' and the 'else' path
java.lang.Exception - On error
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected void printDecisionNodeElse(DecisionNode node,
NodeSocket noSocket,
Node joinNode)
throws java.lang.Exception
node - Decision nodenoSocket - Socket that refers to the 'else' path of the statementjoinNode - Node that joins the 'then' and the 'else' path
java.lang.Exception - On error
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected Node skipDecisionNodeBranches(DecisionNode decisionNode)
throws CodeGeneratorException
decisionNode - Decision node
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected Node findJoiningNode(DecisionNode decisionNode,
NodeSocket yesSocket,
NodeSocket noSocket)
throws CodeGeneratorException
decisionNode - Decision nodeyesSocket - Yes socketnoSocket - No socket
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected boolean containsPathNode(Node nodeToSearch,
NodeSocket socket)
throws CodeGeneratorException
CodeGeneratorException
protected java.lang.String expandParametrizedExpression(java.lang.String expression,
NodeSocket entrySocket,
NodeSocket exitSocket)
throws CodeGeneratorException
expression - Expression to evaluateentrySocket - Entry socketexitSocket - Exit socket
CodeGeneratorException - On error
protected java.lang.String expandParametrizedExpression(java.lang.String expression,
NodeSocket socket)
throws CodeGeneratorException
expression - Expression to evaluatesocket - socket that hosts the parameters
CodeGeneratorException - On error
protected java.lang.String getParamValue(NodeSocket socket,
java.lang.String paramName)
throws CodeGeneratorException
socket - Socket that hosts the parameterparamName - Parameter name
CodeGeneratorException - If the value could not be resolved
protected NodeSocket getNamedSocket(Node node,
java.lang.String name)
throws CodeGeneratorException
name - Name
CodeGeneratorException - If there is a severe error that prevents the generation of meaningful source code
protected java.lang.String obtainExpression(java.lang.String expression,
java.lang.String desiredLanguage,
PrintNameProvider owner)
throws CodeGeneratorException
expression - ExpresssiondesiredLanguage - The language we are looking for (e. g. "Java")
CodeGeneratorException - If there is no definition for the specified languageprotected java.lang.String makeVariableName(DescriptionObject o)
o - Object to create a name for.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||