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

Guillaume,

Please use the newsgroups for asking questions.  Specifically the M2T
newsgroup:  news://news.eclipse.org/eclipse.modeling.m2t


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




                                                                           
             Guillaume Riby                                                
             <guillaume.riby@f                                             
             r.ibm.com>                                                 To 
             Sent by:                  emft-dev@xxxxxxxxxxx                
             emft-dev-bounces@                                          cc 
             eclipse.org                                                   
                                                                   Subject 
                                       [emft-dev] Run a JET transformation 
             06/07/2007 10:08          with a customed JET2Writer          
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
              EMFT Developer                                               
               Mailing List                                                
             <emft-dev@eclipse                                             
                   .org>                                                   
                                                                           
                                                                           





Hi,
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
files
 - "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("org.eclipse.jet.resource.project.name", PLUGIN_ID);
IStatus status = JET2Platform.runTransformOnObject(PLUGIN_ID, foobar,
variables, new NullProgressMonitor());
if(!status.isOK())
      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(J9VMInternals.java:205)
      at Main.main(Main.java:37) <-------------------------------------
runTransformOnObject()
Caused by: java.lang.NullPointerException
      at org.eclipse.jet.JET2Platform.<clinit>(JET2Platform.java:79)
      at java.lang.J9VMInternals.initializeImpl(Native Method)
      at java.lang.J9VMInternals.initialize(J9VMInternals.java:187)
      ... 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.

Guillaume

_______________________________________________
emft-dev mailing list
emft-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/emft-dev




Back to the top