Finding Potention JET2 Migration Patterns
DPTK patterns can be converted into JET2 patterns with the DPTK "DPTK to JET2 Conversion"
pattern. This pattern navigates and parses a DPTK pattern project and generates a fully
functional JET2 pattern that generates the same output as the original DPTK pattern.
All DPTK tags in the DPTK templates are replaced by the corresponding JET2 tags.
While the process is almost completely automatic, there are some situations where some DPTK
tags can not be converted and other situations in which the converted JET2 templates don't
run exactly the same as the original DPTK templates.
To help identify these potential trouble spots, a new feature has been added to DPTK
to mark as an error any DPTK tags that might have some issuse during or after the JET2 conversion.
This option can be turned on and off using the Patterns preference page.
Listed below are the error messages that are displayed along with a recommended fix.
- Can not determine whether or not resource is a Java file
The start tag can be changed into one of several different JET2 tags depending on
the type of file it generates. Use the startType attribute to indicate which of the
three kinds of files is produced by this tag.
startType="javaClass" indicates that this file is a java source file. This
attribute isn't required if the resource value ends with a constant ".java". When
migrated this tag will generate a number of tags around a java:class tag
startType="javaFile" indicates that this file is to be generated into a java
package. For example, property files and other files whose access is defined in terms of the runtime
java classpath need to have this value specified.
startType="file" indicates that this is a file to be generated into a folder that
is not a java package. This is the default value for the startType attribute.
- This tag is ignored by DPTK, but will execute under JET2
The select tag collaborates with nested case and default tags to process the appropriate
section of template. DPTK will ignore any other tag directly nested under the select tag and so
those tags will neither contribute to the generated output nor have the opportunity to modify
the pattern state or context. Under JET2, however, those other nested tags will be executed but they
won't be able to write to the generated output.
You can remove those tags from your DPTK templates because they don't do anything anyway.
- Empty tag not closed
In DPTK, tags that are always empty (e.g. >attr< and >milliseconds<) don't have to have the closing slash. In other words,
DPTK treats ">milliseconds<" and ">milliseconds/<" the same way. The JET2 parser, however, is stricter and will require that all
tags be properly closed.
- DOCTYPE and encoding attributes are not supported in JET2
In DPTK it is a common practice to dynamically build the doctype and encodings on generated XML such as
the dump.xml file used for debugging. JET2 parsers do not provide that information via the parsed DOM's.
At any rate, the encoding and doctype information, if really necessary on the genreated XML files, should be
hardcoded as part of the template and not reused from the input model (which may not have the correct information
anyway).
- Can not determine location attribute value
The location attribute must be one of the following, case-sensitive strings: "source", "target", "pattern".
In addition, there are several cases where the converted tag does behave exactly as the original DPTK tag.
- Exists and Nexists tags also test for variable definition
The use of a variable that is not defined results in a false and true evaluation for the
exists and nexists tags, respectively. The corresponding JET2 tag, c:if, will through an exception if the
variable does not exist. The ability to test that a variable is defined should be added in a subsequent JET release.
© Copyright IBM Corporation 2000,
2007. All Rights Reserved.