@Override
public boolean install()
{
RestActivatorType activatorType = null;
Configuration projectConfiguration = getProjectConfiguration();
String activatorChoice = projectConfiguration.getString(RestFacet.ACTIVATOR_CHOICE);
if (activatorChoice == null || activatorChoice.equals(""))
{
activatorType = prompt.promptEnum("How do you want to activate REST resources in your application ?",
RestActivatorType.class,
RestActivatorType.WEB_XML);
}
else
{
activatorType = RestActivatorType.valueOf(activatorChoice);
}
String rootpath = prompt.prompt("What root path do you want to use for your resources?", "/rest");
projectConfiguration.setProperty(RestFacet.ROOTPATH, rootpath);
if (activatorType == null || activatorType == RestActivatorType.WEB_XML
&& !project.hasFacet(RestWebXmlFacetImpl.class))
{
request.fire(new InstallFacets(RestWebXmlFacetImpl.class));
}
else if (activatorType == RestActivatorType.APP_CLASS && !project.hasFacet(RestApplicationFacet.class))
{
String pkg = prompt.promptCommon("In what package do you want to store the Application class?",
PromptType.JAVA_PACKAGE, project.getFacet(MetadataFacet.class).getTopLevelPackage() + ".rest");
String restApplication = prompt.prompt("How do you want to name the Application class?", "RestApplication");
projectConfiguration.setProperty(RestApplicationFacet.REST_APPLICATIONCLASS_PACKAGE, pkg);
projectConfiguration.setProperty(RestApplicationFacet.REST_APPLICATIONCLASS_NAME, restApplication);
request.fire(new InstallFacets(RestApplicationFacet.class));
}
return super.install();
}