use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class ServerConfiguration method createDefaults.
public static void createDefaults(SSOToken ssoToken) throws SSOException, SMSException, UnknownPropertyNameException {
boolean bCreated = false;
ServiceConfig sc = getRootServerConfig(ssoToken);
try {
bCreated = (sc.getSubConfig(DEFAULT_SERVER_CONFIG) != null);
} catch (SMSException e) {
// ignore, default is not created.
}
if (!bCreated) {
ResourceBundle res = ResourceBundle.getBundle(SERVER_DEFAULTS);
Set values = new HashSet();
for (Enumeration i = res.getKeys(); i.hasMoreElements(); ) {
String key = (String) i.nextElement();
String val = (String) res.getString(key);
if (val.equals("@" + SetupConstants.CONFIG_VAR_PLATFORM_LOCALE + "@")) {
val = Locale.getDefault().toString();
}
values.add(key + "=" + val);
}
try {
createServerInstance(ssoToken, DEFAULT_SERVER_CONFIG, DEFAULT_SERVER_ID, values, "");
} catch (ConfigurationException ex) {
//ignore, this should not happen because default values
//are all valid.
}
}
}
use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class ServerConfiguration method getServerInstance.
/**
* Returns the configuration of a server instance.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param instanceName Name of the server instance.
* @return the configuration of the server Instance.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
* @throws IOException if IO operation fails.
*/
public static Properties getServerInstance(SSOToken ssoToken, String instanceName) throws SMSException, SSOException, IOException {
Properties prop = null;
ServiceConfig cfg = getServerConfig(ssoToken, instanceName);
if (cfg != null) {
Map map = cfg.getAttributes();
prop = getProperties((Set) map.get(ATTR_SERVER_CONFIG));
}
return prop;
}
use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class ServerConfiguration method getServers.
/**
* Returns a set of server instance name (String).
*
* @param ssoToken Single Sign-On Token which is used to query the service
* management datastore.
* @return a set of server instance name.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static Set<String> getServers(SSOToken ssoToken) throws SMSException, SSOException {
Set<String> servers = new HashSet<>();
ServiceConfig sc = getRootServerConfig(ssoToken);
if (sc != null) {
servers.addAll(sc.getSubConfigNames("*"));
servers.remove(DEFAULT_SERVER_CONFIG);
}
return servers;
}
use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class ServerConfiguration method getServerConfigXML.
/**
* Returns server configuration XML.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param instanceName Name of the server instance.
* @return server configuration XML.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static String getServerConfigXML(SSOToken ssoToken, String instanceName) throws SMSException, SSOException {
String xml = null;
ServiceConfig cfg = getServerConfig(ssoToken, instanceName);
if (cfg != null) {
Map map = cfg.getAttributes();
Set set = (Set) map.get(ATTR_SERVER_CONFIG_XML);
xml = (String) set.iterator().next();
}
return xml;
}
use of com.sun.identity.sm.ServiceConfig in project OpenAM by OpenRock.
the class SiteConfiguration method getSitePrimaryURL.
/**
* Returns the primary URL of a site.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param siteName Name of the site.
* @return the primary URL of a site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static String getSitePrimaryURL(SSOToken ssoToken, String siteName) throws SMSException, SSOException {
ServiceConfig rootNode = getRootSiteConfig(ssoToken);
ServiceConfig sc = rootNode.getSubConfig(siteName);
ServiceConfig accessPoint = sc.getSubConfig(SUBCONFIG_ACCESS_URL);
Map map = accessPoint.getAttributes();
Set set = (Set) map.get(ATTR_PRIMARY_SITE_URL);
return (String) set.iterator().next();
}
Aggregations