// Add a reference to this grammar
//
Grammars grammars;
if (application.getGrammars() != null) {
LOG.info("The wadl application already contains a grammars element,"
+ " we're adding elements of the provided grammars file.");
grammars = application.getGrammars();
} else {
grammars = new Grammars();
application.setGrammars(grammars);
}
// Create a reference back to the root WADL
//
for (String path : applicationDescription.getExternalMetadataKeys()) {
ApplicationDescription.ExternalGrammar eg =
applicationDescription.getExternalGrammar(path);
if (!eg.isIncludedInGrammar()) {
continue;
}
URI schemaURI =
extendedPath.clone().path(path).build();
String schemaURIS = schemaURI.toString();
String requestURIs = requestURI.toString();
String schemaPath = rootURI != null
? requestURI.relativize(schemaURI).toString()
: schemaURI.toString();
Include include = new Include();
include.setHref(schemaPath);
Doc doc = new Doc();
doc.setLang("en");
doc.setTitle("Generated");
include.getDoc().add(doc);
// Finally add to list
grammars.getInclude().add(include);
}
}