Search in sources :

Example 21 with ServerSiteModel

use of com.sun.identity.console.service.model.ServerSiteModel in project OpenAM by OpenRock.

the class ServerEditViewBeanBase method beginDisplay.

/**
     * Displays the profile of a site.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    String serverName = (String) getPageSessionAttribute(PG_ATTR_SERVER_NAME);
    ServerSiteModel model = (ServerSiteModel) getModel();
    ptModel.setPageTitleText(model.getEditServerPageTitle(serverName));
    try {
        setConfigProperties(serverName, model);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 22 with ServerSiteModel

use of com.sun.identity.console.service.model.ServerSiteModel in project OpenAM by OpenRock.

the class ServerSiteViewBean method populateSiteTableModel.

private void populateSiteTableModel(Map siteToURL) {
    tblSiteModel.clearAll();
    SerializedField szCache = (SerializedField) getChild(SZ_CACHE_1);
    SerializedField szCacheSite = (SerializedField) getChild(SZ_CACHE_SITE);
    ServerSiteModel model = (ServerSiteModel) getModel();
    tblServerModel.setMaxRows(model.getPageSize());
    HashMap cacheSite = new HashMap();
    ArrayList cache = new ArrayList();
    if ((siteToURL != null) && !siteToURL.isEmpty()) {
        int counter = 0;
        for (Iterator iter = siteToURL.keySet().iterator(); iter.hasNext(); counter++) {
            if (counter > 0) {
                tblSiteModel.appendRow();
            }
            String name = (String) iter.next();
            String[] params = (String[]) siteToURL.get(name);
            String url = params[0];
            String assigned = params[1];
            tblSiteModel.setValue(TBL_DATA_SITE_ACTION_HREF, stringToHex(name));
            tblSiteModel.setValue(TBL_DATA_SITE_NAME, name);
            tblSiteModel.setValue(TBL_DATA_SITE_URL, url);
            tblSiteModel.setValue(TBL_DATA_SITE_SERVERS, assigned);
            tblSiteModel.setSelectionVisible(counter, true);
            cacheSite.put(name, params);
            cache.add(name);
        }
        szCacheSite.setValue(cacheSite);
        szCache.setValue(cache);
    } else {
        szCache.setValue(null);
        szCacheSite.setValue(null);
    }
}
Also used : SerializedField(com.sun.identity.console.components.view.html.SerializedField) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel)

Example 23 with ServerSiteModel

use of com.sun.identity.console.service.model.ServerSiteModel in project OpenAM by OpenRock.

the class ServerAddViewBean method handleButton1Request.

/**
     * Handles create server request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    ServerSiteModel model = (ServerSiteModel) getModel();
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    String name = (String) getDisplayFieldValue(TF_NAME);
    name = name.trim();
    if (name.length() > 0) {
        try {
            FQDNUrl test = new FQDNUrl(name);
            if ((!test.isFullyQualified()) || (test.getPort().length() == 0) || (test.getURI().length() == 0)) {
                setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "serverconfig.create.site.invalid.url");
                forwardTo();
            } else {
                model.createServer(name);
                backTrail();
                ServerSiteViewBean vb = (ServerSiteViewBean) getViewBean(ServerSiteViewBean.class);
                passPgSessionMap(vb);
                vb.forwardTo(getRequestContext());
            }
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            forwardTo();
        } catch (MalformedURLException mue) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", mue.getMessage());
            forwardTo();
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "serverconfig.create.site.missing.attributes");
        forwardTo();
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) FQDNUrl(com.sun.identity.shared.FQDNUrl) AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 24 with ServerSiteModel

use of com.sun.identity.console.service.model.ServerSiteModel in project OpenAM by OpenRock.

the class ServerCloneViewBean method handleButton1Request.

/**
     * Handles clone server request.
     *
     * @param event Request invocation event
     */
public void handleButton1Request(RequestInvocationEvent event) throws ModelControlException {
    ServerSiteModel model = (ServerSiteModel) getModel();
    AMPropertySheet ps = (AMPropertySheet) getChild(PROPERTY_ATTRIBUTE);
    String serverName = (String) getPageSessionAttribute(PG_ATTR_SERVER_NAME);
    String name = (String) getDisplayFieldValue(TF_NAME);
    name = name.trim();
    if (name.length() > 0) {
        try {
            model.cloneServer(serverName, name);
            backTrail();
            ServerSiteViewBean vb = (ServerSiteViewBean) getViewBean(ServerSiteViewBean.class);
            passPgSessionMap(vb);
            vb.forwardTo(getRequestContext());
        } catch (AMConsoleException e) {
            setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
            forwardTo();
        }
    } else {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", "serverconfig.clone.server.missing.atributes");
        forwardTo();
    }
}
Also used : AMPropertySheet(com.sun.identity.console.base.AMPropertySheet) ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 25 with ServerSiteModel

use of com.sun.identity.console.service.model.ServerSiteModel in project OpenAM by OpenRock.

the class ServerEditGeneralViewBean method beginDisplay.

/**
     * Displays the profile of a site.
     */
public void beginDisplay(DisplayEvent event) throws ModelControlException {
    super.beginDisplay(event);
    String serverName = (String) getPageSessionAttribute(PG_ATTR_SERVER_NAME);
    ServerSiteModel model = (ServerSiteModel) getModel();
    try {
        getParentSites(serverName, model);
    } catch (AMConsoleException e) {
        setInlineAlertMessage(CCAlert.TYPE_ERROR, "message.error", e.getMessage());
    }
}
Also used : ServerSiteModel(com.sun.identity.console.service.model.ServerSiteModel) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Aggregations

ServerSiteModel (com.sun.identity.console.service.model.ServerSiteModel)28 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)23 Iterator (java.util.Iterator)11 HashSet (java.util.HashSet)8 HashMap (java.util.HashMap)7 Set (java.util.Set)7 SerializedField (com.sun.identity.console.components.view.html.SerializedField)6 ArrayList (java.util.ArrayList)6 Map (java.util.Map)6 TreeSet (java.util.TreeSet)6 CCActionTable (com.sun.web.ui.view.table.CCActionTable)5 ServerConfigXML (com.sun.identity.common.configuration.ServerConfigXML)4 List (java.util.List)4 UnknownPropertyNameException (com.sun.identity.common.configuration.UnknownPropertyNameException)3 AMPropertySheet (com.sun.identity.console.base.AMPropertySheet)3 ConfigurationException (com.sun.identity.common.configuration.ConfigurationException)1 DirUserObject (com.sun.identity.common.configuration.ServerConfigXML.DirUserObject)1 AMPropertySheetModel (com.sun.identity.console.base.model.AMPropertySheetModel)1 FQDNUrl (com.sun.identity.shared.FQDNUrl)1 CCEditableList (com.sun.web.ui.view.editablelist.CCEditableList)1