Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [emft-dev] Run a JET transformation with a customed JET2Writer


Please use the newsgroups for asking questions.  Specifically the M2T
newsgroup:  news://

Ed Merks/Toronto/IBM@IBMCA
mailto: merks@xxxxxxxxxx
905-413-3265  (t/l 969)

             Guillaume Riby                                                
   >                                                 To 
             Sent by:                  emft-dev@xxxxxxxxxxx                
             emft-dev-bounces@                                          cc 
                                       [emft-dev] Run a JET transformation 
             06/07/2007 10:08          with a customed JET2Writer          
             Please respond to                                             
              EMFT Developer                                               
               Mailing List                                                

I'm currently working on a project where I have defined a FooBar structure
in an Ecore file, here are the different projects :
 - "FooBar" : containing "foobar.ecore" and all generated implementation
 - "FooBar.jetgenerator" : containing all JET templates

I can launch successfully this M2T transformation via the Eclipse
integrated launcher (Run > JET Transformation > ...). But this time I have
to launch it via another project "FooBar.jetlauncher" defining a customed
JET2Writer. The only way I have noticed to invoke JET transformation
specifying a new writer is to use "void generate(JET2Context context,
JET2Writer out)" method of JET2Template interface.

1/ Which is the good way to use this "generate" method ie where do we
precise PLUGIN_ID? and which class implements JET2Template interface? cause
I don't find it in the Javadoc of JET2Template.

2/ Here is source code of the launcher in a Java Project in the same
workspace, it doesn't work now :

Map<String, String> variables = new HashMap<String, String>();
variables.put("", PLUGIN_ID);
IStatus status = JET2Platform.runTransformOnObject(PLUGIN_ID, foobar,
variables, new NullProgressMonitor());
      System.err.println("JET transformation has failed!");

Here PLUGIN_ID has been initialized to "FooBar.jetgenerator", the id of the
JET project, and "foobar" is the FooBar object (object corresponding to
implementation class generated from Ecore). The problem is that even if
"foobar" object is correctly loaded an exception is thrown during
JET2Platform.runTransformOnObject call, here it is :

Exception in thread "main" java.lang.ExceptionInInitializerError
      at java.lang.J9VMInternals.initialize(
      at Main.main( <-------------------------------------
Caused by: java.lang.NullPointerException
      at org.eclipse.jet.JET2Platform.<clinit>(
      at java.lang.J9VMInternals.initializeImpl(Native Method)
      at java.lang.J9VMInternals.initialize(
      ... 2 more

I have used the same technics as described in different other posts of this
mailing list. Is that a problem if the launcher "FooBar.jetlauncher"
project is not in the runtime workspace? Three projects are in the
workspace. Is there a particular configuration for such a project
containing the JET transformation launcher?

Thank you.


emft-dev mailing list

Back to the top