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));
}
}
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));
}
}
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));
}
}
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);
}
}
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");
}
}
Aggregations