use of com.webcohesion.enunciate.api.services.ServiceGroup in project enunciate by stoicflame.
the class DocsModule method call.
@Override
public void call(EnunciateContext context) {
try {
File docsDir = getDocsDir();
String subDir = getDocsSubdir();
if (subDir != null) {
docsDir = new File(docsDir, subDir);
}
if (!isUpToDateWithSources(docsDir)) {
Set<String> facetIncludes = new TreeSet<String>(this.enunciate.getConfiguration().getFacetIncludes());
facetIncludes.addAll(getFacetIncludes());
Set<String> facetExcludes = new TreeSet<String>(this.enunciate.getConfiguration().getFacetExcludes());
facetExcludes.addAll(getFacetExcludes());
FacetFilter facetFilter = new FacetFilter(facetIncludes, facetExcludes);
ApiRegistrationContext registrationContext = new DocsRegistrationContext(this.apiRegistry, facetFilter);
List<ResourceApi> resourceApis = this.apiRegistry.getResourceApis(registrationContext);
Set<Syntax> syntaxes = this.apiRegistry.getSyntaxes(registrationContext);
List<ServiceApi> serviceApis = this.apiRegistry.getServiceApis(registrationContext);
Set<Artifact> documentationArtifacts = findDocumentationArtifacts();
if (syntaxes.isEmpty() && serviceApis.isEmpty() && resourceApis.isEmpty() && documentationArtifacts.isEmpty()) {
warn("No documentation generated: there are no data types, services, or resources to document.");
return;
}
// make sure the docs dir exists.
docsDir.mkdirs();
Map<String, Object> model = new HashMap<String, Object>();
String intro = this.enunciate.getConfiguration().readDescription(context, false, registrationContext.getTagHandler());
if (intro != null) {
model.put("apiDoc", intro);
}
String copyright = this.enunciate.getConfiguration().getCopyright();
if (copyright != null) {
model.put("copyright", copyright);
}
String title = this.enunciate.getConfiguration().getTitle();
model.put("title", title == null ? "Web Service API" : title);
// extract out the documentation base
String cssPath = buildBase(docsDir);
if (cssPath != null) {
model.put("cssFile", cssPath);
}
model.put("file", new FileDirective(docsDir, this.enunciate.getLogger()));
model.put("apiRelativePath", getRelativePathToRootDir());
model.put("includeApplicationPath", isIncludeApplicationPath());
model.put("includeDataTypesHomeIndex", isIncludeDataTypesHomeIndex());
model.put("favicon", getFavicon());
// iterate through schemas and make sure the schema is copied to the docs dir
for (Syntax syntax : syntaxes) {
for (Namespace namespace : syntax.getNamespaces()) {
if (namespace.getSchemaFile() != null) {
namespace.getSchemaFile().writeTo(docsDir);
}
}
}
model.put("data", syntaxes);
for (ResourceApi resourceApi : resourceApis) {
if (resourceApi.getWadlFile() != null) {
resourceApi.getWadlFile().writeTo(docsDir);
}
}
model.put("resourceApis", resourceApis);
InterfaceDescriptionFile swaggerUI = this.apiRegistry.getSwaggerUI();
if (swaggerUI != null) {
swaggerUI.writeTo(docsDir);
model.put("swaggerUI", swaggerUI);
}
// iterate through wsdls and make sure the wsdl is copied to the docs dir
for (ServiceApi serviceApi : serviceApis) {
for (ServiceGroup serviceGroup : serviceApi.getServiceGroups()) {
if (serviceGroup.getWsdlFile() != null) {
serviceGroup.getWsdlFile().writeTo(docsDir);
}
}
}
model.put("serviceApis", serviceApis);
model.put("downloads", copyDocumentationArtifacts(documentationArtifacts, docsDir));
model.put("indexPageName", getIndexPageName());
model.put("disableMountpoint", isDisableRestMountpoint());
model.put("additionalCssFiles", getAdditionalCss());
model.put("disableResourceLinks", isDisableResourceLinks());
processTemplate(getDocsTemplateURL(), model);
} else {
info("Skipping documentation source generation as everything appears up-to-date...");
}
this.enunciate.addArtifact(new FileArtifact(getName(), "docs", docsDir));
} catch (IOException e) {
throw new EnunciateException(e);
} catch (TemplateException e) {
throw new EnunciateException(e);
}
}
use of com.webcohesion.enunciate.api.services.ServiceGroup in project enunciate by stoicflame.
the class JaxwsServiceApi method getServiceGroups.
@Override
public List<ServiceGroup> getServiceGroups() {
Map<String, WsdlInfo> wsdls = this.context.getWsdls();
ArrayList<ServiceGroup> serviceGroups = new ArrayList<ServiceGroup>();
for (WsdlInfo wsdlInfo : wsdls.values()) {
serviceGroups.add(new ServiceGroupImpl(wsdlInfo, registrationContext));
}
return serviceGroups;
}
Aggregations