use of org.glassfish.admin.rest.results.OptionsResult in project Payara by payara.
the class MonitoredAttributeBagResource method get.
/**
* Gets the monitored-attributes.
*
* @return a list of the monitored-attributes after the transaction.
*/
@GET
@Produces({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public ActionReportResult get() {
RestActionReporter ar = new RestActionReporter();
ar.setActionExitCode(ActionReport.ExitCode.SUCCESS);
ar.setActionDescription("monitored-attribute");
List monitoredAttributes = getMonitoredAttributes();
Properties extraProperties = new Properties();
extraProperties.put("monitoredAttributes", monitoredAttributes);
ar.setExtraProperties(extraProperties);
return new ActionReportResult(tagName, ar, new OptionsResult(Util.getResourceName(uriInfo)));
}
use of org.glassfish.admin.rest.results.OptionsResult in project Payara by payara.
the class SystemPropertiesCliResource method get.
@GET
public ActionReportResult get() {
domain = locatorBridge.getRemoteLocator().getService(Domain.class);
ParameterMap data = new ParameterMap();
processCommandParams(data);
addQueryString(uriInfo.getQueryParameters(), data);
adjustParameters(data);
Map<String, Map<String, String>> properties = new TreeMap<String, Map<String, String>>();
RestActionReporter actionReport = new RestActionReporter();
getSystemProperties(properties, getEntity(), false);
actionReport.getExtraProperties().put("systemProperties", new ArrayList(properties.values()));
if (properties.isEmpty()) {
// i18n
actionReport.getTopMessagePart().setMessage("Nothing to list.");
}
ActionReportResult results = new ActionReportResult(commandName, actionReport, new OptionsResult());
return results;
}
use of org.glassfish.admin.rest.results.OptionsResult in project Payara by payara.
the class SystemPropertiesCliResource method saveProperties.
protected Response saveProperties(String parent, HashMap<String, String> data) {
String propertiesString = convertPropertyMapToString(data);
data = new HashMap<String, String>();
data.put("DEFAULT", propertiesString);
data.put("target", (parent == null) ? getParent(uriInfo) : parent);
RestActionReporter actionReport = ResourceUtil.runCommand("create-system-properties", data, getSubject());
ActionReport.ExitCode exitCode = actionReport.getActionExitCode();
ActionReportResult results = new ActionReportResult(commandName, actionReport, new OptionsResult());
int status = HttpURLConnection.HTTP_OK;
/*200 - ok*/
if (exitCode == ActionReport.ExitCode.FAILURE) {
status = HttpURLConnection.HTTP_INTERNAL_ERROR;
}
return Response.status(status).entity(results).build();
}
use of org.glassfish.admin.rest.results.OptionsResult in project Payara by payara.
the class CollectionLeafResource method buildActionReportResult.
protected ActionReportResult buildActionReportResult() {
RestActionReporter ar = new RestActionReporter();
final String typeKey = upperCaseFirstLetter((decode(getName())));
ar.setActionDescription(typeKey);
ar.getExtraProperties().put("leafList", getEntity());
OptionsResult optionsResult = new OptionsResult(Util.getResourceName(uriInfo));
Map<String, MethodMetaData> mmd = getMethodMetaData();
optionsResult.putMethodMetaData("GET", mmd.get("GET"));
optionsResult.putMethodMetaData("POST", mmd.get("POST"));
ResourceUtil.addMethodMetaData(ar, mmd);
return new ActionReportResult(ar, optionsResult);
}
use of org.glassfish.admin.rest.results.OptionsResult in project Payara by payara.
the class LeafResource method buildActionReportResult.
protected ActionReportResult buildActionReportResult() {
RestActionReporter ar = new RestActionReporter();
final String typeKey = (decode(getName()));
ar.setActionDescription(typeKey);
ar.getExtraProperties().put("entityLeaf", getEntity());
OptionsResult optionsResult = new OptionsResult(Util.getResourceName(uriInfo));
Map<String, MethodMetaData> mmd = getMethodMetaData();
optionsResult.putMethodMetaData("GET", mmd.get("GET"));
optionsResult.putMethodMetaData("POST", mmd.get("POST"));
ResourceUtil.addMethodMetaData(ar, mmd);
ActionReportResult r = new ActionReportResult(ar, optionsResult);
r.setLeafContent(entity);
return r;
}
Aggregations