use of org.glassfish.admin.rest.generator.TextResourcesGenerator in project Payara by payara.
the class GeneratorResource method get.
@GET
@Produces({ "text/plain" })
public String get(@QueryParam("outputDir") String outputDir) {
if (outputDir == null) {
outputDir = DEFAULT_OUTPUT_DIR;
}
String retVal = "Code Generation done at : " + outputDir;
try {
LocatorBridge locatorBridge = habitat.getService(LocatorBridge.class);
Dom dom = Dom.unwrap(locatorBridge.getRemoteLocator().<Domain>getService(Domain.class));
DomDocument document = dom.document;
ConfigModel rootModel = dom.document.getRoot().model;
ResourcesGenerator resourcesGenerator = new TextResourcesGenerator(outputDir, habitat);
resourcesGenerator.generateSingle(rootModel, document);
resourcesGenerator.endGeneration();
} catch (Exception ex) {
RestLogging.restLogger.log(Level.SEVERE, null, ex);
retVal = "Exception encountered during generation process: " + ex.toString() + "\nPlease look at server.log for more information.";
}
return retVal;
}
Aggregations