Manually migrate to the JET project format

You can manually migrate the Design Pattern Toolkit (DPTK) project structure and metadata to the JET format.
To manually migrate to the JET format:
  1. Migrate the information in the DPTK file .pattern to two new files: META-INF/MANIFEST.MF and plugin.xml.
  2. Create a Java source directory (jet2java) and a .classpath file to support the Java builder.
  3. Create a build.propertiesfile to enable the proper exporting of JET templates into JAR files (the equivalent of DPTK PATZIP files).
The following example shows a typical DPTK .pattern file and how it is migrated:
Note: The lines in bold must be migrated to JET equivalents.

The values after the colon for the lines starting with SetName, SetID and Version must be written to the new file META-INF/MANIFEST.MF:

SetName:bean generator
SetID:bean.generator
Controller:bean.generator/control.pat
Version:1.0
*Appdef: name="sample.appdef" description="bean generator"
Filter: type="appdef" resource="file" enablesFor="1" 
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: value of SetName
Bundle-SymbolicName: value of SetID
Bundle-Version: value of Version
Bundle-Localization: plugin
Bundle-Vendor: 
Require-Bundle: org.eclipse.jet
Bundle-ClassPath: .,bin/

The value after the colon of the Controller line must be written to the new file plugin.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
    <extension
          id=""
          name=""
          point="org.eclipse.jet.transform">
        <transform 
          startTemplate="value of Controller" 
          templateLoaderClass="org.eclipse.jet.compiled._jet_transformation">
            <description></description>
            <tagLibraries>
                <importLibrary 
                    id="com.ibm.xtools.jet.dptk.dptk"
                    usePrefix="" 
                    autoImport="true"/>
            </tagLibraries>
        </transform>
    </extension>
</plugin>

A new folder jet2java must be created in the root of the project. In addition, a new file .classpath must be added to the root of the project. Note that the .classpath file refers to this folder (highlighted in bold).

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="jet2java/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

To add the JET natures and builders to the project, the file .project must be modified to include the bold lines in the following code:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>existing project name</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jet.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.pde.ManifestBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>com.ibm.dptk.patternBuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.pde.PluginNature</nature> 
        <nature>org.eclipse.jdt.core.javanature</nature> 
        <nature>org.eclipse.jet.jet2Nature</nature>
        <nature>com.ibm.dptk.patternNature</nature>
    </natures>
</projectDescription>

To enable the JET compiler to recognize PAT files as JET templates, the file .settings/org.eclipse.jet.prefs must be created with the following content:

eclipse.preferences.version=1
org.eclipse.jet.projectPrefs=true
org.eclipse.jet.templateExt=pat,jet

To permit proper exporting of the pattern to a JAR (the functional equivalent of a DPTK PATZIP file), create the file build.properties in the project root with the following content:

source.. = jet2java/
output.. = bin/
bin.includes = .,\
    plugin.xml,\
    META-INF/,\
    **/*.pat,\
    **/*.jet
src.includes = .project,\
    build.properties,\
    .classpath
Note: The DPTK pattern Add JET Nature to Pattern makes all the above changes as well as running a validation to ensure that all DPTK tags can be correctly migrated.

Feedback