com.ibm.pdp.engine
Interface IMicroPattern


public interface IMicroPattern

A IMicroPattern instance models the syntactical representation of a Micro Pattern found in the source code. It is given as an input to the MP Processor dedicated for him
A Micro Pattern has the following structure:

- a MP BEGIN Delimiter sequence depending on the source code technology. It is currently '*{' for the COBOL language
- a MP identifier (not unique) following the XML syntactical rules for DOM Element identifiers
- a list of well-formed attributes as pairs of name="value" expressions following the XML syntactical rules for DOM Node Attributes declaration
- an Header Delimiter sequence depending on the source code technology. It is currently '/' for the COBOL language
- an MP private declaration space that is specific to the MP technology. Its length is determined by the engine and may be reformatted depending on the source code technology
- a local generation area containing previously generated source code if any
- a MP END Delimiter sequence depending on the source code technology. It is currently '*}' for the COBOL language

Example: the following is an example of a MP for the COBOL language (Pacbase Pattern)
*{WF namespace="com.ibm.pdp" enable="false"/ DSL=IZ
*SEL=60 DSP=SD
 01 SD00.
  05 SD00-SUITE.
   15 FILLER PICTURE X(002016).
[...]
*}

A Micro-Pattern may include another Micro-Pattern in its private declaration area. This latter one is called a child.


Field Summary
static java.lang.String ATTRIBUTE_ENABLED
          The Enabled standard attribute name
static java.lang.String ATTRIBUTE_FRAGMENT_ID
          The Fragment ID attribute name
static java.lang.String ATTRIBUTE_NAMESPACE
          The Namespace standard attribute name
static java.lang.String copyright
           
static java.lang.String MICRO_PATTERN_FRAGMENT_TAG_CATEGORY
          SyntacticTag category for Micro-Pattern Fragment Tags
static java.lang.String MICRO_PATTERN_LIST_CONTEXT_KEY
          key used to retrieve the list of declared Micro-Patterns in the same source from the execution context
static java.lang.String MICRO_PATTERN_TAG_CATEGORY
          SyntacticTag category for Micro-Pattern Tags
static int STATUS_OK
          The default processing status
static int UNRECOVERABLE_ERROR
           
static int WARNING_RAISED
           
 
Method Summary
 java.lang.String getAttribute(java.lang.String attributeName)
           
 java.util.Map<java.lang.String,java.lang.String> getAttributes()
           
 java.util.List<IMicroPattern> getChildren()
           
 java.lang.String getClosingSequence()
           
 java.lang.String getConfigurationArea()
           
 java.lang.String getHeader()
           
 java.lang.String getHeaderDelimiterSequence()
           
 java.lang.String getId()
           
 java.lang.String getLocalGenerationArea()
           
 com.ibm.pdp.engine.ITextArtefactLocation getLocation()
           
 java.lang.String getOpeningSequence()
           
 java.lang.String getOriginalHeaderDeclaration()
           
 IMicroPatternProcessingContext getProcessingContext()
           
 java.lang.String getStandardHeaderArea()
           
 boolean isWellFormed()
           
 void setUsageId(java.lang.String usageId)
          This method is intended to be used by Filters in such case as where several Micro-Patterns (with different names) are handled by the same IMicroPatternHandler
Example : imagine the Micro-Pattern ID mask as Xnn where nn may be any character string.
 

Field Detail

ATTRIBUTE_ENABLED

static final java.lang.String ATTRIBUTE_ENABLED
The Enabled standard attribute name

See Also:
Constant Field Values

ATTRIBUTE_FRAGMENT_ID

static final java.lang.String ATTRIBUTE_FRAGMENT_ID
The Fragment ID attribute name

See Also:
Constant Field Values

ATTRIBUTE_NAMESPACE

static final java.lang.String ATTRIBUTE_NAMESPACE
The Namespace standard attribute name

See Also:
Constant Field Values

copyright

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

MICRO_PATTERN_FRAGMENT_TAG_CATEGORY

static final java.lang.String MICRO_PATTERN_FRAGMENT_TAG_CATEGORY
SyntacticTag category for Micro-Pattern Fragment Tags

See Also:
Constant Field Values

MICRO_PATTERN_LIST_CONTEXT_KEY

static final java.lang.String MICRO_PATTERN_LIST_CONTEXT_KEY
key used to retrieve the list of declared Micro-Patterns in the same source from the execution context

See Also:
Constant Field Values

MICRO_PATTERN_TAG_CATEGORY

static final java.lang.String MICRO_PATTERN_TAG_CATEGORY
SyntacticTag category for Micro-Pattern Tags

See Also:
Constant Field Values

STATUS_OK

static final int STATUS_OK
The default processing status

See Also:
Constant Field Values

UNRECOVERABLE_ERROR

static final int UNRECOVERABLE_ERROR
See Also:
Constant Field Values

WARNING_RAISED

static final int WARNING_RAISED
See Also:
Constant Field Values
Method Detail

getAttribute

java.lang.String getAttribute(java.lang.String attributeName)
Parameters:
attributeName - : the name of an existing attribute
Returns:
the attribute's value as a String
Returns null in case this attribute is not defined in the MP Header
In the above example, getAttribute("namespace") returns com.ibm.pdp

getAttributes

java.util.Map<java.lang.String,java.lang.String> getAttributes()
Returns:
a Map of attribute values. The key is the attribute's name

getChildren

java.util.List<IMicroPattern> getChildren()
Returns:
a list of first level child Micro-Patterns imbricated in this one

getClosingSequence

java.lang.String getClosingSequence()
Returns:
the closing character sequence for this MicroPattern
Example: (please, refer to the Class level Javadoc)
*}

getConfigurationArea

java.lang.String getConfigurationArea()
Returns:
the specific MP configuration area, from the Header Delimiter sequence (exclusive) to the first character of the local generation area (eclusive)
The engine may reformat the area to remove language-specific artifacts
Example: (please, refer to the Class level Javadoc) DSL=IZ SEL=60 DSP=SD

getHeader

java.lang.String getHeader()
Returns:
this Micro-Pattern header, including declaration begin sequence, standard header and configuration area This header is re-exported in a canonical form, so that it may be different from the original one

getHeaderDelimiterSequence

java.lang.String getHeaderDelimiterSequence()
Returns:
the Header delimiter tag as defined by the Pattern it is associated to Example: (please, refer to the Class level Javadoc)
/

getId

java.lang.String getId()
Returns:
this Micro Pattern declared ID. ID may not be unique depending on registered contributions
the optional namespace attribute further describes the Micro Pattern
Example: *{WF namespace="com.ibm.pdp" enable="false"/ DSL=IZ
In this example, getId() returns WF

getLocalGenerationArea

java.lang.String getLocalGenerationArea()
Returns:
the area of the source code comprised exclusively between the end of the configuration area and the MP END Delimiter sequence
Example: (please, refer to the Class level Javadoc)
 01 SD00.
  05 SD00-SUITE.
   15 FILLER PICTURE X(002016).
[...]

getLocation

com.ibm.pdp.engine.ITextArtefactLocation getLocation()
Returns:
this Micro Pattern localization in the original source code

getOpeningSequence

java.lang.String getOpeningSequence()
Returns:
the opening character sequence for this MicroPattern
Example: (please, refer to the Class level Javadoc)
*{

getOriginalHeaderDeclaration

java.lang.String getOriginalHeaderDeclaration()
Returns:
the MP Header declaration, from the MP BEGIN Delimiter sequence (exclusive) to the Header Delimiter sequence (exclusive)
Example: *{WF namespace="com.ibm.pdp" / 00012345 Z

getProcessingContext

IMicroPatternProcessingContext getProcessingContext()
Returns:
the associated Processing context

getStandardHeaderArea

java.lang.String getStandardHeaderArea()
Returns:
the standard header area as re-exported from current attributes values
WARNING: may be different from the original standard header area

isWellFormed

boolean isWellFormed()
Returns:
whether or not this MicroPattern declaration is well formed according to the canonical format

setUsageId

void setUsageId(java.lang.String usageId)
This method is intended to be used by Filters in such case as where several Micro-Patterns (with different names) are handled by the same IMicroPatternHandler
Example : imagine the Micro-Pattern ID mask as Xnn where nn may be any character string. To have one single Handler handle all this mask occurrences, let define a filter that parses the mask and changes the UsageId (defaults to the ID) and replace nn by a specific attribute

Parameters:
usageId -