Chapter 5. Launching a compiled kermeta program (Compiler V1)

For each operation having like parameters a sequence of String, a Java "main" method is generated at compilation time in a Java package denoted "runner". A Java package "runner" is generated for all Kermeta or Ecore packages. Thus this main is usable as a classical Java Main method.

An example of Java Main Class for the operation: event::manager::EventManager::execute( filePath : String )

package event.manager.runner;

import org.kermeta.compil.runtime.ExecutionContext;

/**
 * A Stub of a Java Application Runner for a Kermeta runnable operation
 *
 * @generated
 */
public class EventManager__execute__Runner {

	/**
	 * @generated
	 * Main to run the execution
	 */
	public static void main(String[] args) {
		
		//Initialize the reflection
		ExecutionContext.getInstance().lazyInitialize();

		event.manager.EventManager anExec = (event.manager.EventManager) org.kermeta.compil.runtime.helper.language.ClassUtil
				.newObject(event.manager.ManagerPackage.eINSTANCE
						.getEventManager());
						
		// args[0] is the parameter filePath
		// call the operation "execute" on an EventManager
		anExec.execute(args[0]);

	}

}
	

If the Runner operation has not been generated at compilation time (parameters having types different of String), you should write the previous source code by the hand and adapt it following the operation.