Thursday, March 22, 2007

Flashdoctors Project Creation Wizard

Behind Flashdoctors Project Creation Wizard is a flexible framework for build a project structure.

There are two key components this framework, a XML file that defines the project directory structure and Builder classes that operate to create artifacts within those directories.

XML file is called directory.xml and is located user /resources/config/directory.xml. Below is the structure of the XML.


The root is the top level container that holds 1 or n number of pathelement nodes. Each pathelement nodes contain 0 to n child pathelement nodes. This flexible nesting of elements provides the ability to mirror any directory structure desired.

The root node represents the root directory of operation and the pathelement nodes represent either subdirectories or files. Pathelement nodes with child nodes are considered directories by default. Nature of leaf pathelement nodes are determined by their attributes. Pathelement attributes are listed below.

NameRequiredDefault ValueComments
nameYesN/AThis will become the directory or file name created.
directoryNotrueThis flag instructs the program to treat the node as a directory or file.
overwriteNotrueThis flag instructs the program to overwrite if such element exists already.
builderNoN/AFully qualified name of the class assigned to create the item associated with this pathelement. For a list of available builder classes see below.
param1NoN/AString value to be passed to builder class.
param2NoN/AString value to be passed to builder class.
param3NoN/AString value to be passed to builder class.


Following builder classes are available for use.

Name DescriptionParameters
CopyFromBundleCopies file from a plug-in bundle.

Param1 – Bundle name.

Param2 – Path in bundle.

Param3 – N/A

CreateFromBundleTemplate Copies file from a plug-in bundle while applying string substitution.

Param1 – Bundle name.

Param2 – Path in bundle.

Param3 – N/A

CreateMainPackageStub

Performs the same operation as CreateFromBundleTemplate but creates the file under the main package.

If main package is “com.mysite.project”, the program will create the file under com/mysite/project directory. Subdirectories will be created as needed.

Param1 – Bundle name.

Param2 – Path in bundle.

Param3 – N/A

UnzipFromBundleUnzips an archive in the respective location, creating subdirectories as needed.

Param1 – Bundle name.

Param2 – Path in bundle.

Param3 – N/A

If additional builder classes are needed, they can be created easily as a POJO implementing the com.flashdoctors.eclipse.projectwizards.structurebuilder.IBuilder interface. Dynamic parameters can be passed into the builder classes via ProjectStructureRegistry class.

For additional reference, Class diagram is shown below.