XText Classes

                   	package org.eclipse.xtext.generator;

                   	public interface IGenerator {
                   		 * @param input the input for which to generate resources
                   		 * @param fsa file system access to be used to generate files
                   		void doGenerate(Resource input, IFileSystemAccess fsa);

XText Classes

                   	package org.eclipse.xtext.resource.generic;

                   	public abstract class AbstractGenericResourceRuntimeModule 
                   	               extends AbstractGenericModule {
                   	        // Only showing abstract methods to override
                   		protected abstract String getLanguageName();
                   		protected abstract String getFileExtensions();

Additional Methods needed

It appears that there are additional methods retrieved through reflection that are needed on the AbstractGenericResourceRuntimeModule:

                   	public abstract class AbstractGenericResourceRuntimeModule 
                   	               extends AbstractGenericModule {
                   	 	public Class bindIGenerator();
                   		// Return the implementatino if IGenerator
                   		public Class bindResourceSet();
                   		// typically returns ResourceSetImpl.class;
To tie everything together, create a class that has @Inject properties for:

                   	 // Used to get a resource set
                   	// Used to validate the resource after loading
                   	// The generator to use
                   	// Used to specify the output path of the text being generated. 

Loading the Instance

            String filepath; // Filename of the model instance
            final ResourceSet rs = new ResourceSetImpl();
            final URI uri = URI.createFileURI(filepath);
            final Resource resource = rs.getResource(uri, true);
            if (resource != null) {
                EObject eobject = (EObject) resource.getContents().get(0);
                // Cast eobject to the type needed.

                   	public interface IFileSystemAccess {
                   	    public final static String DEFAULT_OUTPUT = "DEFAULT_OUTPUT";
                   	    public void generateFile(String fileName, CharSequence contents);
                   	    public void generateFile(String fileName, String outputConfigurationName, 
                   	            CharSequence contents);
                   	    public void deleteFile(String fileName);