How to run a jet transformation in the plug-ins? [message #25687] |
Tue, 10 July 2007 13:31  |
Eclipse User |
|
|
|
Hi guys,
I'm really new to the JET2 and I met some problems.
I created an EMFT JET transformation project (the id is
"my.jet.transformation") without any change and it worked perfectly via
the run JET Transformation dialog.
Then I created a test plug-in to execute the transformation. The running
result is very weird for it threw a "java.lang.NoClassDefFoundError:
org/eclipse/jet/JET2Platform" exception in JET2 0.7.1 while an error
message of "Variable "org.eclipse.jet.resource.project.name" is not
defined." in JET2 0.8.0 (during debuging).
My test code in the test plugin is quite simple:
...
IProgressMonitor monitor = new NullProgressMonitor();
String TRANS = "my.jet.transformation";
StringBuffer sb = readXML();
IStatus st = JET2Platform.runTransformOnString(TRANS,
sb.toString().trim(), monitor);
....
What shall I do then?
BTW, Is there any sample code or tutorial available for the freshman? I
found JET Tutorial Part 1 and 2 but it seems that they are introduction
for JET1.
|
|
|
Re: How to run a jet transformation in the plug-ins? [message #25945 is a reply to message #25687] |
Wed, 11 July 2007 09:14   |
Eclipse User |
|
|
|
Chaohong:
The default transformation project has the following tag in main.jet:
<ws:file template="templates/dump.jet"
path="{$org.eclipse.jet.resource.project.name}/dump.xml"/>
This dumps the transformations input model to a file dump.xml in the root of
the project containing the input.
But, when you use runTransformOnString, there is not project containing the
input model. You have the following choices
1) remove the above tag
2) Change the {$org.eclipse.jet.resource.project.name} part to something
that is dependent on data in the model itself
3) Pass a value for org.eclipse.jet.resource.project.name into
runTransformOnString...
Map arguments = new HashMap();
arguments.put("org.eclipse.jet.resource.project.name", "Some Known Project
Name");
JET2Platform.runTransformOnString( transformID, yourXMLAsString, "xml",
variables, monitor);
As for articles and learning resourcs, they are still limited. Check out
these two articles:
http://www.devx.com/opensource/Article/34929?trk=DXRSS_LATES T
http://www.ibm.com/developerworks/opensource/library/os-ecl- jet/
Also, a JET FAQ is under construction, with the help of some of the members
of this group:
http://wiki.eclipse.org/M2T-JET-FAQ
And, of course, you can always ask a question on this group. Your question
has now been importalized:
http://wiki.eclipse.org/JET_FAQ_Why_do_I_get_errors_stating_ variable_%27org.eclipse.jet.resource.project.name%27_is_unde fined%3F
http://wiki.eclipse.org/JET_FAQ_What_learning_resources_are_ available_for_JET%3F
Paul
"Chaohong" <hamlinxie@gmail.com> wrote in message
news:8b6315917f2493c537b38942a6c28fc6$1@www.eclipse.org...
> Hi guys,
> I'm really new to the JET2 and I met some problems.
>
> I created an EMFT JET transformation project (the id is
> "my.jet.transformation") without any change and it worked perfectly via
> the run JET Transformation dialog.
>
> Then I created a test plug-in to execute the transformation. The running
> result is very weird for it threw a "java.lang.NoClassDefFoundError:
> org/eclipse/jet/JET2Platform" exception in JET2 0.7.1 while an error
> message of "Variable "org.eclipse.jet.resource.project.name" is not
> defined." in JET2 0.8.0 (during debuging).
>
> My test code in the test plugin is quite simple:
> ..
> IProgressMonitor monitor = new NullProgressMonitor();
> String TRANS = "my.jet.transformation";
> StringBuffer sb = readXML();
> IStatus st = JET2Platform.runTransformOnString(TRANS,
> sb.toString().trim(), monitor);
> ...
>
> What shall I do then?
>
> BTW, Is there any sample code or tutorial available for the freshman? I
> found JET Tutorial Part 1 and 2 but it seems that they are introduction
> for JET1.
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02850 seconds