use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class UpdateCenterHandlers method updateCenterProcess.
@Handler(id = "updateCenterProcess", input = { @HandlerInput(name = "action", type = String.class, required = true), @HandlerInput(name = "selectedRows", type = java.util.List.class, required = true) })
public static void updateCenterProcess(HandlerContext handlerCtx) {
Image image = getUpdateCenterImage();
boolean install = false;
String action = (String) handlerCtx.getInputValue("action");
if (action.equals("install")) {
install = true;
}
List obj = (List) handlerCtx.getInputValue("selectedRows");
if (obj == null) {
// no row selected
return;
}
List<Map> selectedRows = (List) obj;
// do not use Fmri list to pass to installPackages, use String array to avoid UPDATECENTER2-2187
String[] fmris = new String[selectedRows.size()];
int i = 0;
try {
for (Map oneRow : selectedRows) {
fmris[i++] = ((Fmri) oneRow.get("fmri")).toString();
}
if (install) {
image.installPackages(fmris);
// updateCountInSession(image); No need to update the update count since the count will not change. Only installing new component is allowed.
} else {
image.uninstallPackages(fmris);
}
GuiUtil.setSessionValue("restartRequired", Boolean.TRUE);
} catch (Exception ex) {
GuiUtil.handleException(handlerCtx, ex);
ex.printStackTrace();
}
}
use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class UpdateCenterHandlers method getAuthList.
@Handler(id = "getAuthList", output = { @HandlerOutput(name = "result", type = java.util.List.class) })
public static void getAuthList(HandlerContext handlerCtx) {
List result = new ArrayList();
try {
Image image = getUpdateCenterImage();
if (image == null) {
handlerCtx.setOutputValue("result", result);
return;
}
String[] auths = image.getAuthorityNames();
for (int i = 0; i < auths.length; i++) {
Map oneRow = new HashMap();
oneRow.put("authName", auths[i]);
result.add(oneRow);
}
} catch (Exception ex1) {
ex1.printStackTrace();
}
handlerCtx.setOutputValue("result", result);
}
use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class UpdateCenterHandlers method getLicenseText.
// getLicenseText(selectedRows="#{selectedRows}" license=>$page{license});
@Handler(id = "getLicenseText", input = { @HandlerInput(name = "selectedRows", type = java.util.List.class, required = true) }, output = { @HandlerOutput(name = "license", type = String.class), @HandlerOutput(name = "hasLicense", type = Boolean.class) })
public static void getLicenseText(HandlerContext handlerCtx) {
List obj = (List) handlerCtx.getInputValue("selectedRows");
Image image = getUpdateCenterImage();
List<Map> selectedRows = (List) obj;
try {
StringBuffer allLicense = new StringBuffer();
for (Map oneRow : selectedRows) {
Fmri fmri = (Fmri) oneRow.get("fmri");
allLicense.append(getLicense(image, fmri));
}
handlerCtx.setOutputValue("license", "" + allLicense);
handlerCtx.setOutputValue("hasLicense", (allLicense.length() > 0));
} catch (Exception ex) {
GuiUtil.handleException(handlerCtx, ex);
// ex.printStackTrace();
}
}
use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class UpdateCenterHandlers method getInstalledPath.
@Handler(id = "getInstalledPath", output = { @HandlerOutput(name = "result", type = String.class) })
public static void getInstalledPath(HandlerContext handlerCtx) {
Image image = getUpdateCenterImage();
handlerCtx.setOutputValue("result", (image == null) ? GuiUtil.getMessage(BUNDLE, "updateCenter.NoImageDirectory") : image.getRootDirectory());
}
use of com.sun.jsftemplating.annotation.Handler in project Payara by payara.
the class UpdateCenterHandlers method getAuthority.
@Handler(id = "getAuthority", output = { @HandlerOutput(name = "result", type = String.class) })
public static void getAuthority(HandlerContext handlerCtx) {
Image image = getUpdateCenterImage();
handlerCtx.setOutputValue("result", (image == null) ? "" : image.getPreferredAuthorityName());
}
Aggregations