use of com.sun.identity.common.configuration.ConfigurationException in project OpenAM by OpenRock.
the class ServerSiteModelImpl method modifySite.
/**
* Modifies site profile.
*
* @param siteName name of site.
* @param primaryURL Primary URL.
* @param failoverURLs Failover URLs.
* @throws AMConsoleException if site profile cannot be modified.
*/
public void modifySite(String siteName, String primaryURL, Set failoverURLs) throws AMConsoleException {
try {
SSOToken ssoToken = getUserSSOToken();
String[] param = { siteName };
logEvent("ATTEMPT_MODIFY_SITE", param);
SiteConfiguration.setSitePrimaryURL(ssoToken, siteName, primaryURL);
SiteConfiguration.setSiteSecondaryURLs(ssoToken, siteName, failoverURLs);
logEvent("SUCCEED_MODIFY_SITE", param);
} catch (ConfigurationException e) {
String[] params = { siteName, e.getMessage() };
logEvent("CONFIGURATION_EXCEPTION_MODIFY_SITE", params);
throw new AMConsoleException(getErrorString(e));
} catch (SMSException e) {
String[] params = { siteName, e.getMessage() };
logEvent("SMS_EXCEPTION_MODIFY_SITE", params);
throw new AMConsoleException(getErrorString(e));
} catch (SSOException e) {
String[] params = { siteName, e.getMessage() };
logEvent("SSO_EXCEPTION_MODIFY_SITE", params);
throw new AMConsoleException(getErrorString(e));
}
}
use of com.sun.identity.common.configuration.ConfigurationException in project OpenAM by OpenRock.
the class SitesResourceProvider method deleteInstance.
@Override
public Promise<ResourceResponse, ResourceException> deleteInstance(Context context, String id, DeleteRequest request) {
ResourceResponse site;
SSOToken token;
try {
token = getSsoToken(context);
site = getSite(token, id);
} catch (SMSException | SSOException | ConfigurationException e) {
debug.error("Could not read site {}", id, e);
return new InternalServerErrorException("Could not read site").asPromise();
} catch (NotFoundException e) {
return e.asPromise();
}
try {
if (!site.getRevision().equals(request.getRevision())) {
return new PreconditionFailedException("Revision did not match").asPromise();
} else if (!SiteConfiguration.listServers(token, id).isEmpty()) {
return new PreconditionFailedException("Site still has servers attached to it").asPromise();
} else if (!SiteConfiguration.deleteSite(token, id)) {
return new InternalServerErrorException("Could not delete site: " + id).asPromise();
} else {
return newResultPromise(site);
}
} catch (SSOException | SMSException | ConfigurationException e) {
debug.error("Could not delete site {}", id, e);
return new InternalServerErrorException("Could not delete site").asPromise();
}
}
use of com.sun.identity.common.configuration.ConfigurationException in project OpenAM by OpenRock.
the class SitesResourceProvider method updateInstance.
@Override
public Promise<ResourceResponse, ResourceException> updateInstance(Context context, String id, UpdateRequest request) {
JsonValue content = request.getContent();
try {
validWriteOperation(content, id);
} catch (BadRequestException e) {
return e.asPromise();
}
ResourceResponse site;
SSOToken token;
try {
token = getSsoToken(context);
site = getSite(token, id);
} catch (SMSException | SSOException | ConfigurationException e) {
debug.error("Could not read site {}", id, e);
return new InternalServerErrorException("Could not read site").asPromise();
} catch (NotFoundException e) {
return e.asPromise();
}
try {
if (!site.getRevision().equals(request.getRevision())) {
return new PreconditionFailedException("Revision did not match").asPromise();
}
SiteConfiguration.setSitePrimaryURL(token, id, content.get("url").asString());
SiteConfiguration.setSiteSecondaryURLs(token, id, content.get("secondaryURLs").asSet());
return newResultPromise(getSite(token, id));
} catch (SSOException | SMSException | ConfigurationException e) {
debug.error("Could not update site {}", id, e);
return new InternalServerErrorException("Could not update site").asPromise();
} catch (NotFoundException e) {
return new InternalServerErrorException("Could not read site after just updating it", e).asPromise();
}
}
Aggregations