Search in sources :

Example 6 with ServerConfigXML

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();
}
Also used : ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) CCActionTable(com.sun.web.ui.view.table.CCActionTable) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) ServerConfigXML(com.sun.identity.common.configuration.ServerConfigXML)

Example 7 with ServerConfigXML

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;
}
Also used : SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) SMSException(com.sun.identity.sm.SMSException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) IOException(java.io.IOException) UnknownPropertyNameException(com.sun.identity.common.configuration.UnknownPropertyNameException) ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) SSOException(com.iplanet.sso.SSOException) ServerConfigXML(com.sun.identity.common.configuration.ServerConfigXML)

Example 8 with ServerConfigXML

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();
}
Also used : ServerConfigXML(com.sun.identity.common.configuration.ServerConfigXML)

Aggregations

ServerConfigXML (com.sun.identity.common.configuration.ServerConfigXML)8 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)5 ServerSiteModel (com.sun.identity.console.service.model.ServerSiteModel)4 DirUserObject (com.sun.identity.common.configuration.ServerConfigXML.DirUserObject)3 Iterator (java.util.Iterator)3 ConfigurationException (com.sun.identity.common.configuration.ConfigurationException)2 CCActionTable (com.sun.web.ui.view.table.CCActionTable)2 List (java.util.List)2 SSOException (com.iplanet.sso.SSOException)1 SSOToken (com.iplanet.sso.SSOToken)1 ServerGroup (com.sun.identity.common.configuration.ServerConfigXML.ServerGroup)1 UnknownPropertyNameException (com.sun.identity.common.configuration.UnknownPropertyNameException)1 SMSException (com.sun.identity.sm.SMSException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Set (java.util.Set)1