ServerInfoResource.java revision c1399137c7f5280a373374ec053be39dbe7cfbf1
/*
* DO NOT REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2013-2014 ForgeRock AS. All rights reserved.
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions copyright [year] [name of copyright owner]"
*/
/**
* Represents Server Information that can be queried via a REST interface.
*
* This resources acts as a read only resource for the moment.
*/
public class ServerInfoResource extends RealmAwareResource {
}
/**
* Retrieves the cookie domains set on the server.
*
* @param handler Result handler which handles error or success
*/
int rev;
try {
if (debug.messageEnabled()) {
" Added resource to response: " + COOKIE_DOMAINS);
}
} catch (Exception e) {
}
}
/**
* Retrieves all server info set on the server.
*
* @param context Current Server Context.
* @param realm realm in whose security context we use.
* @param handler Result handler which handles error or success.
* @param realm The realm
*/
private void getAllServerInfo(ServerContext context, ResultHandler<Resource> handler, String realm) {
//added for the XUI to be able to understand its locale to request the appropriate translations to cache
locale.setLocale(httpContext); //we have nothing else to go on at this point other than their request
try {
if (debug.messageEnabled()) {
" Added resource to response: " + ALL_SERVER_INFO);
}
} catch (Exception e) {
}
}
/**
* Generate and return one of two values, "enabled" or "disabled" based on the value of the specified string.
* If the specified string is utterly weird, use the value specified in defaultValue to help make up our minds
* (true being enabled and false being disabled).
* @param value The string value to interpret.
* @param defaultValue A boolean value to fall back to, in case value cannot be interpreted.
* @return the string "enabled" or the string "disabled"
*/
} else if (value.equals("f") || value.equals("false") || value.equals("off") || value.equals(DISABLED)) {
}
}
return result;
}
/**
* Read out the data whose schema is defined in the file socialAuthN.xml. The enabled implementations value gives
* us the social authentication implementations we care about. We use the values there to index into the display
* names, auth chains and icons.
*
* @param realm The realm/organization name
*/
try {
ServiceConfigManager mgr = new ServiceConfigManager(SocialAuthenticationImplementation.SERVICE_NAME, token);
if (enabledImplementationSet != null) {
if (implementation.isValid()) {
}
}
}
} catch (SSOException sso) {
} catch (SMSException sms) {
} catch (Exception e) {
if (debug.errorEnabled()) {
}
}
return implementations;
}
/**
* Given the specified name, use the serviceConfig object to retrieve the entire set of [name]=value pairs
* specified.
*
* @param serviceConfig The service config
* @param name The implementation name we're looking for, e.g. google
* @param attributeName The attribute we're interested in
* @return The value (as in [name]=value) corresponding to the specified name, or null if not found.
*/
private String getEntryForImplementation(ServiceConfig serviceConfig, String name, String attributeName) {
return nameValueParser.getValueForName(name, ServiceConfigUtils.getSetAttribute(serviceConfig, attributeName));
}
/**
* {@inheritDoc}
*/
public void actionCollection(ServerContext context, ActionRequest request, ResultHandler<JsonValue> handler) {
}
/**
* {@inheritDoc}
*/
}
/**
* {@inheritDoc}
*/
public void createInstance(ServerContext context, CreateRequest request, ResultHandler<Resource> handler) {
}
/**
* {@inheritDoc}
*/
}
/**
* {@inheritDoc}
*/
public void patchInstance(ServerContext context, String s, PatchRequest request, ResultHandler<Resource> handler) {
}
/**
* {@inheritDoc}
*/
public void queryCollection(ServerContext context, QueryRequest request, QueryResultHandler handler) {
}
/**
* {@inheritDoc}
*/
} else { // for now this is the only case coming in, so fail if otherwise
if (debug.errorEnabled()) {
": Cannot receive information on requested resource: " + resourceId, e);
}
handler.handleError(e);
}
}
/**
* {@inheritDoc}
*/
}
}