Search in sources :

Example 16 with ConfigurationException

use of com.sun.identity.common.configuration.ConfigurationException in project OpenAM by OpenRock.

the class ServerSiteModelImpl method cloneServer.

/**
     * Clones a server.
     *
     * @param origServer Name of the server to be cloned.
     * @param cloneServer Name of clone server.
     * @throws AMConsoleException if server cannot be cloned.
     */
public void cloneServer(String origServer, String cloneServer) throws AMConsoleException {
    String[] param = { origServer, cloneServer };
    logEvent("ATTEMPT_CLONE_SERVER", param);
    try {
        ServerConfiguration.cloneServerInstance(getUserSSOToken(), origServer, cloneServer);
        logEvent("SUCCEED_CLONE_SERVER", param);
    } catch (ConfigurationException e) {
        String[] params = { origServer, cloneServer, e.getMessage() };
        logEvent("CONFIGURATION_EXCEPTION_CLONE_SERVER", params);
        throw new AMConsoleException(getErrorString(e));
    } catch (SMSException e) {
        String[] params = { origServer, cloneServer, e.getMessage() };
        logEvent("SMS_EXCEPTION_CLONE_SERVER", params);
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        String[] params = { origServer, cloneServer, e.getMessage() };
        logEvent("SSO_EXCEPTION_CLONE_SERVER", params);
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 17 with ConfigurationException

use of com.sun.identity.common.configuration.ConfigurationException in project OpenAM by OpenRock.

the class ServerSiteModelImpl method modifyServer.

/**
     * Modifies server profile.
     *
     * @param serverName name of server.
     * @param parentSite Parent site.
     * @param values Property Values.
     * @throws AMConsoleException if server profile cannot be modified.
     * @throws UnknownPropertyNameException if property names are unknown.
     */
public void modifyServer(String serverName, String parentSite, Map values) throws AMConsoleException, UnknownPropertyNameException {
    String[] param = { serverName };
    try {
        SSOToken ssoToken = getUserSSOToken();
        logEvent("ATTEMPT_MODIFY_SERVER", param);
        if (parentSite != null) {
            String currentSite = ServerConfiguration.getServerSite(ssoToken, serverName);
            if ((currentSite == null) || !currentSite.equals(parentSite)) {
                ServerConfiguration.setServerSite(ssoToken, serverName, parentSite);
            }
        }
        ServerConfiguration.setServerInstance(ssoToken, serverName, values);
        logEvent("SUCCEED_MODIFY_SERVER", param);
    } catch (ConfigurationException e) {
        String[] params = { serverName, e.getMessage() };
        logEvent("CONFIGURATION_EXCEPTION_MODIFY_SERVER", params);
        throw new AMConsoleException(getErrorString(e));
    } catch (IOException e) {
        String[] params = { serverName, e.getMessage() };
        logEvent("IO_EXCEPTION_MODIFY_SERVER", params);
        throw new AMConsoleException(getErrorString(e));
    } catch (SMSException e) {
        String[] params = { serverName, e.getMessage() };
        logEvent("SMS_EXCEPTION_MODIFY_SERVER", params);
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        String[] params = { serverName, e.getMessage() };
        logEvent("SSO_EXCEPTION_MODIFY_SERVER", params);
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : SSOToken(com.iplanet.sso.SSOToken) ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) IOException(java.io.IOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 18 with ConfigurationException

use of com.sun.identity.common.configuration.ConfigurationException in project OpenAM by OpenRock.

the class ServerSiteModelImpl method getSiteServers.

/**
     * Returns a set of servers that belong to site.
     *
     * @param name Name of Site.
     * @return a set of servers that belong to site.
     * @throws AMConsoleException if error occurs when getting the servers set.
     */
public Set getSiteServers(String name) throws AMConsoleException {
    String[] param = { name };
    logEvent("ATTEMPT_GET_SITE_MEMBERS", param);
    try {
        Set members = SiteConfiguration.listServers(getUserSSOToken(), name);
        logEvent("SUCCEED_GET_SITE_MEMBERS", param);
        return members;
    } catch (ConfigurationException e) {
        String[] params = { name, e.getMessage() };
        logEvent("SMS_EXCEPTION_GET_SITE_MEMBERS", params);
        throw new AMConsoleException(getErrorString(e));
    } catch (SMSException e) {
        String[] params = { name, e.getMessage() };
        logEvent("SMS_EXCEPTION_GET_SITE_MEMBERS", params);
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        String[] params = { name, e.getMessage() };
        logEvent("SSO_EXCEPTION_GET_SITE_MEMBERS", params);
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 19 with ConfigurationException

use of com.sun.identity.common.configuration.ConfigurationException in project OpenAM by OpenRock.

the class AMSetupFilterTest method filterShouldThrowConfigurationExceptionIfUpgradeInProgressAndConfigStoreIsDownButNoRedirectUriSet.

@Test
public void filterShouldThrowConfigurationExceptionIfUpgradeInProgressAndConfigStoreIsDownButNoRedirectUriSet() throws Exception {
    //Given
    initializeFilter();
    HttpServletRequest request = mockRequest("REQUEST_URI");
    HttpServletResponse response = mock(HttpServletResponse.class);
    FilterChain chain = mock(FilterChain.class);
    systemIsBeingUpgraded();
    configStoreIsDown(null);
    //When
    try {
        setupFilter.doFilter(request, response, chain);
        fail("Expected ServletException with ConfigurationException is cause");
    } catch (ServletException e) {
        //Then
        assertThat(e.getCause()).isInstanceOf(ConfigurationException.class);
        verifyZeroInteractions(response, chain);
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) ServletException(javax.servlet.ServletException) ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) FilterChain(javax.servlet.FilterChain) HttpServletResponse(javax.servlet.http.HttpServletResponse) Test(org.testng.annotations.Test)

Example 20 with ConfigurationException

use of com.sun.identity.common.configuration.ConfigurationException in project OpenAM by OpenRock.

the class UpgradeUtils method createServiceInstance.

/**
     * Creates a service instance.
     *
     * @param serverInstance the server instance value
     * @param serverId the server identifier
     * @throws UpgradeException if there is an error.
     */
public static void createServiceInstance(String serverInstance, String serverId, Set values, String serverConfigXML) {
    //throws UpgradeException {
    String classMethod = "UpgradeUtils:createServiceInstance : ";
    if (debug.messageEnabled()) {
        debug.message(classMethod + "serverInstance :" + serverInstance);
        debug.message(classMethod + "serverId :" + serverId);
    }
    try {
        ServerConfiguration.createServerInstance(ssoToken, serverInstance, serverId, values, serverConfigXML);
    } catch (UnknownPropertyNameException uce) {
    //throw new UpgradeException("Unknwon property ");
    } catch (ConfigurationException ce) {
    //throw new UpgradeException("Unable to create Service instance");
    } catch (SMSException sme) {
    //throw new UpgradeException("Unable to create Service instance");
    } catch (SSOException ssoe) {
    //throw new UpgradeException("invalid ssotoken");
    }
}
Also used : UnknownPropertyNameException(com.sun.identity.common.configuration.UnknownPropertyNameException) ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ByteString(org.forgerock.opendj.ldap.ByteString)

Aggregations

ConfigurationException (com.sun.identity.common.configuration.ConfigurationException)48 SSOException (com.iplanet.sso.SSOException)40 SMSException (com.sun.identity.sm.SMSException)39 SSOToken (com.iplanet.sso.SSOToken)30 CLIException (com.sun.identity.cli.CLIException)19 IOutput (com.sun.identity.cli.IOutput)17 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)14 List (java.util.List)12 IdRepoException (com.sun.identity.idm.IdRepoException)11 IOException (java.io.IOException)11 Map (java.util.Map)10 Set (java.util.Set)9 UnknownPropertyNameException (com.sun.identity.common.configuration.UnknownPropertyNameException)6 HashSet (java.util.HashSet)6 Iterator (java.util.Iterator)6 NotFoundException (org.forgerock.json.resource.NotFoundException)6 AMIdentity (com.sun.identity.idm.AMIdentity)5 MalformedURLException (java.net.MalformedURLException)5 InternalServerErrorException (org.forgerock.json.resource.InternalServerErrorException)5 HashMap (java.util.HashMap)4