use of com.sun.identity.common.configuration.ServerConfigXML in project OpenAM by OpenRock.
the class ServerConfigXMLViewBean method handleTblServerConfigXMLUserButtonDeleteRequest.
/**
* Handles remove server group entry request.
*
* @param event Request invocation event
*/
public void handleTblServerConfigXMLUserButtonDeleteRequest(RequestInvocationEvent event) throws ModelControlException {
String serverName = (String) getPageSessionAttribute(ServerEditViewBeanBase.PG_ATTR_SERVER_NAME);
ServerSiteModel model = (ServerSiteModel) getModel();
try {
ServerConfigXML xmlObj = model.getServerConfigObject(serverName);
ServerConfigXML.ServerGroup defaultServerGroup = xmlObj.getDefaultServerGroup();
CCActionTable table = (CCActionTable) getChild(TBL_USERS);
table.restoreStateData();
Integer[] selected = tblUserModel.getSelectedRows();
if (selected.length >= defaultServerGroup.hosts.size()) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", model.getLocalizedString("exception.cannot,delete.all.servers"));
} else {
for (int i = selected.length - 1; i >= 0; --i) {
defaultServerGroup.hosts.remove(selected[i].intValue());
}
model.setServerConfigXML(serverName, xmlObj.toXML());
setInlineAlertMessage(CCAlert.TYPE_INFO, "message.information", "serverconfig.updated");
}
} catch (AMConsoleException e) {
setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
}
forwardTo();
}
use of com.sun.identity.common.configuration.ServerConfigXML in project OpenAM by OpenRock.
the class ServerSiteModelImpl method getServerConfigObject.
/**
* Returns the server configuration XML object.
*
* @param serverName Name of server.
* @return the server configuration XML object.
* @throws AMConsoleException if server configuration XML object cannot be
* return.
*/
public ServerConfigXML getServerConfigObject(String serverName) throws AMConsoleException {
String[] param = { serverName };
logEvent("ATTEMPT_GET_SERVER_CONFIG_XML", param);
ServerConfigXML xmlObject = null;
try {
String xml = ServerConfiguration.getServerConfigXML(getUserSSOToken(), serverName);
xmlObject = new ServerConfigXML(xml);
logEvent("SUCCEED_GET_SERVER_CONFIG_XML", param);
} catch (SMSException e) {
String[] params = { serverName, e.getMessage() };
logEvent("SMS_EXCEPTION_GET_SERVER_CONFIG_XML", params);
throw new AMConsoleException(getErrorString(e));
} catch (SSOException e) {
String[] params = { serverName, e.getMessage() };
logEvent("SSO_EXCEPTION_GET_SERVER_CONFIG_XML", params);
throw new AMConsoleException(getErrorString(e));
} catch (Exception e) {
String[] params = { serverName, e.getMessage() };
logEvent("GENERIC_EXCEPTION_GET_SERVER_CONFIG_XML", params);
throw new AMConsoleException(getErrorString(e));
}
return xmlObject;
}
use of com.sun.identity.common.configuration.ServerConfigXML in project OpenAM by OpenRock.
the class AMSetupServlet method getSMSServerGroup.
/**
* Gets <code>ServerGroup</code> for SMS for specified server
* @param sname servername of groupo to find.
* @return <code>ServerGroup</code> instance
*/
private static ServerGroup getSMSServerGroup(String sname) throws Exception {
String xml = ServerConfiguration.getServerConfigXML(adminToken, sname);
ServerConfigXML scc = new ServerConfigXML(xml);
return scc.getSMSServerGroup();
}
Aggregations