Class ServerConfiguration
- java.lang.Object
-
- com.sun.identity.common.configuration.ConfigurationBase
-
- com.sun.identity.common.configuration.ServerConfiguration
-
public class ServerConfiguration extends ConfigurationBase
This manages server configuration information.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_SERVER_CONFIGDefault server configuration.static StringDEFAULT_SERVER_IDstatic StringSERVER_DEFAULTS-
Fields inherited from class com.sun.identity.common.configuration.ConfigurationBase
ATTR_PRIMARY_SITE_ID, ATTR_PRIMARY_SITE_URL, ATTR_SEC_ID, ATTR_SERVER_ID, CONFIG_SERVERS, CONFIG_SITES, OLD_ATTR_SERVER_LIST, OLD_ATTR_SITE_LIST, SUBCONFIG_ACCESS_URL, SUBCONFIG_SEC_URLS, SUBSCHEMA_SERVER, SUBSCHEMA_SITE
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddToSite(SSOToken ssoToken, String instanceName, String siteId)Adds server to a site.static booleanbelongToSite(SSOToken ssoToken, String instanceName, String siteId)Returnstrueif a server belongs to a site.static voidcloneServerInstance(SSOToken token, String serverName, String cloneName)Clones an existing server using the new cloned server name.static voidcloneServerInstance(SSOToken ssoToken, String serverName, String cloneName, String cloneId)Clones a server instance.static voidcreateDefaults(SSOToken ssoToken)static booleancreateServerInstance(SSOToken ssoToken, String instanceName, String instanceId, Set values, String serverConfigXML)Creates a server instance.static voidcreateServerInstance(SSOToken ssoToken, String instanceName, Map values, String serverConfigXML)Creates a server instance.static voidcreateServerInstance(SSOToken ssoToken, String instanceName, Set values, String serverConfigXML)Creates a server instance.static booleandeleteServerInstance(SSOToken ssoToken, String instanceName)Deletes a server instance.static StringexportServerInstance(SSOToken ssoToken, String serverName)Exports a server instance.static MapgetDefaultProperties()static PropertiesgetDefaults(SSOToken ssoToken)Returns the default server properties.static MapgetLBCookieValues(SSOToken ssoToken)Returns a map of server name to its load balancer cookie value.static Map<String,String>getNewServerDefaults(SSOToken ssoToken)static PropertiesgetProperties(String str)Returns properties object.static PropertiesgetProperties(Set set)Returns properties object.static SetgetPropertiesSet(String str)Returns set of string with this format, key=value.static StringgetServerConfigXML(SSOToken ssoToken, String instanceName)Returns server configuration XML.static StringgetServerID(SSOToken ssoToken, String instanceName)Returns server Identifier.static SetgetServerInfo(SSOToken ssoToken)Returns a set of server information where each entry in a set is a string of this formatserver-instance-name|serverId|siteId1|siteId2|...static PropertiesgetServerInstance(SSOToken ssoToken, String instanceName)Returns the configuration of a server instance.static Set<String>getServers(SSOToken ssoToken)Returns a set of server instance name (String).static StringgetServerSite(SSOToken ssoToken, String instanceName)Returns a site name of which server belongs to.static StringgetWarFileVersion()static booleanhasServerOrSiteId(SSOToken ssoToken, String serverId)Returnstrueif server or site id exists.static voidimportServerInstance(SSOToken ssoToken, String serverName, String xmlFile)Imports a server instance.static booleanisServerInstanceExist(SSOToken ssoToken, String instanceName)Returnstrueif server instance exists.static voidremoveFromSite(SSOToken ssoToken, String instanceName, String siteId)Removes server from a site.static voidremoveServerConfiguration(SSOToken ssoToken, String instanceName, Collection propertyNames)Removes server configuration.static voidsetServerConfigXML(SSOToken ssoToken, String instanceName, String xml)Sets server configuration XML.static voidsetServerInstance(SSOToken ssoToken, String instanceName, Map newValues)Sets configuration to a server instance.static voidsetServerSite(SSOToken ssoToken, String instanceName, String siteName)Sets site name of which server belongs to.static voidupgradeServerInstance(SSOToken ssoToken, String instanceName, String instanceId, Map<String,String> upgradedValues)Upgrades a server instance.-
Methods inherited from class com.sun.identity.common.configuration.ConfigurationBase
getNextId, getNextId, getRootServerConfig, getRootServerConfigWithRetry, getRootSiteConfig, getServerConfig, getServerConfigurationId, getSiteConfigurationId, getSiteConfigurationIds, updateOrganizationAlias
-
-
-
-
Field Detail
-
SERVER_DEFAULTS
public static final String SERVER_DEFAULTS
- See Also:
- Constant Field Values
-
DEFAULT_SERVER_ID
public static final String DEFAULT_SERVER_ID
- See Also:
- Constant Field Values
-
DEFAULT_SERVER_CONFIG
public static final String DEFAULT_SERVER_CONFIG
Default server configuration.- See Also:
- Constant Field Values
-
-
Method Detail
-
getServerInfo
public static Set getServerInfo(SSOToken ssoToken) throws SMSException, SSOException
Returns a set of server information where each entry in a set is a string of this formatserver-instance-name|serverId|siteId1|siteId2|...|siteIdn.- Parameters:
ssoToken- Single Sign-On Token which is used to query the service management datastore.- Returns:
- a set of server information.
- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
getLBCookieValues
public static Map getLBCookieValues(SSOToken ssoToken) throws SMSException, SSOException, IOException
Returns a map of server name to its load balancer cookie value.- Parameters:
ssoToken- Single Sign-On Token which is used to query the service management datastore.- Returns:
- a map of server id to its load balancer cookie value.
- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.IOException
-
getServers
public static Set<String> getServers(SSOToken ssoToken) throws SMSException, SSOException
Returns a set of server instance name (String).- Parameters:
ssoToken- Single Sign-On Token which is used to query the service management datastore.- Returns:
- a set of server instance name.
- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
createServerInstance
public static void createServerInstance(SSOToken ssoToken, String instanceName, Map values, String serverConfigXML) throws SMSException, SSOException, IOException, ConfigurationException, UnknownPropertyNameException
Creates a server instance.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.values- Map of string to set of (String) values.serverConfigXML- Server configuration XML.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.IOException- if IO operation fails.UnknownPropertyNameException- if property names are unknown.ConfigurationException- if property names or values are not valid.
-
createServerInstance
public static void createServerInstance(SSOToken ssoToken, String instanceName, Set values, String serverConfigXML) throws SMSException, SSOException, ConfigurationException, UnknownPropertyNameException
Creates a server instance.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.values- Set of string with this formatkey=value.serverConfigXML- Server configuration XML.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.UnknownPropertyNameException- if property names are unknown.ConfigurationException- if property names or values are not valid.
-
createDefaults
public static void createDefaults(SSOToken ssoToken) throws SSOException, SMSException, UnknownPropertyNameException
-
getWarFileVersion
public static String getWarFileVersion()
-
getNewServerDefaults
public static Map<String,String> getNewServerDefaults(SSOToken ssoToken) throws SMSException, SSOException
- Throws:
SMSExceptionSSOException
-
getDefaultProperties
public static Map getDefaultProperties()
-
getServerID
public static String getServerID(SSOToken ssoToken, String instanceName) throws SMSException, SSOException
Returns server Identifier.- Returns:
- server Identifier. Returns null if server Id is not stored in centralized datastore.
- Throws:
SMSExceptionSSOException
-
getServerConfigXML
public static String getServerConfigXML(SSOToken ssoToken, String instanceName) throws SMSException, SSOException
Returns server configuration XML.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.- Returns:
- server configuration XML.
- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
setServerConfigXML
public static void setServerConfigXML(SSOToken ssoToken, String instanceName, String xml) throws SMSException, SSOException, ConfigurationException
Sets server configuration XML.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.xml- Server configuration XML.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.ConfigurationException
-
getServerInstance
public static Properties getServerInstance(SSOToken ssoToken, String instanceName) throws SMSException, SSOException, IOException
Returns the configuration of a server instance.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.- Returns:
- the configuration of the server Instance.
- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.IOException- if IO operation fails.
-
isServerInstanceExist
public static boolean isServerInstanceExist(SSOToken ssoToken, String instanceName) throws SMSException, SSOException
Returnstrueif server instance exists.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.- Returns:
trueif server instance exists.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
hasServerOrSiteId
public static boolean hasServerOrSiteId(SSOToken ssoToken, String serverId) throws SMSException, SSOException
Returnstrueif server or site id exists.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.serverId- Id of the server instance.- Returns:
trueif server id exists.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
setServerInstance
public static void setServerInstance(SSOToken ssoToken, String instanceName, Map newValues) throws SMSException, SSOException, IOException, ConfigurationException, UnknownPropertyNameException
Sets configuration to a server instance.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.newValues- Map of string to Set of string.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.UnknownPropertyNameException- if property names are unknown.ConfigurationException- if property names or values are not valid.IOException
-
removeServerConfiguration
public static void removeServerConfiguration(SSOToken ssoToken, String instanceName, Collection propertyNames) throws SMSException, SSOException, IOException
Removes server configuration. This will result in inheriting from default server configuration.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.propertyNames- Collection of property names to be removed.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.IOException
-
deleteServerInstance
public static boolean deleteServerInstance(SSOToken ssoToken, String instanceName) throws SMSException, SSOException
Deletes a server instance.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
createServerInstance
public static boolean createServerInstance(SSOToken ssoToken, String instanceName, String instanceId, Set values, String serverConfigXML) throws SMSException, SSOException, ConfigurationException, UnknownPropertyNameException
Creates a server instance.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.instanceId- Identifier of the server instance.values- Set of string with this formatkey=value.serverConfigXML- Service configuration XML.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.UnknownPropertyNameException- if property names are unknown.ConfigurationException- if the property name and values are not valid.
-
upgradeServerInstance
public static void upgradeServerInstance(SSOToken ssoToken, String instanceName, String instanceId, Map<String,String> upgradedValues) throws SMSException, SSOException, ConfigurationException, IOException
Upgrades a server instance.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.instanceId- Identifier of the server instance.upgradedValues- Map of new values for the default server config- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.UnknownPropertyNameException- if property names are unknown.ConfigurationException- if the property name and values are not valid.IOException
-
getDefaults
public static Properties getDefaults(SSOToken ssoToken)
Returns the default server properties.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.- Returns:
- the default server properties.
-
getProperties
public static Properties getProperties(String str) throws IOException
Returns properties object.- Parameters:
str- String of this format key1=value1\nkey2=value2\n...keyN=valueN- Returns:
- properties object.
- Throws:
IOException- ifstrcontains incorrect format.
-
getProperties
public static Properties getProperties(Set set) throws IOException
Returns properties object.- Parameters:
set- Set of string of this format key=value.- Returns:
- properties object.
- Throws:
IOException- ifstrcontains incorrect format.
-
getPropertiesSet
public static Set getPropertiesSet(String str) throws IOException
Returns set of string with this format, key=value.- Parameters:
str- String of this format key1=value1\nkey2=value2\n...keyN=valueN- Returns:
- set of formated string.
- Throws:
IOException- ifstrcontains incorrect format.
-
addToSite
public static void addToSite(SSOToken ssoToken, String instanceName, String siteId) throws SMSException, SSOException, ConfigurationException
Adds server to a site.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.siteId- Identifier of the site.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.ConfigurationException- if server instance is not found.
-
getServerSite
public static String getServerSite(SSOToken ssoToken, String instanceName) throws SMSException, SSOException
Returns a site name of which server belongs to.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.- Returns:
- a site name.
- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
setServerSite
public static void setServerSite(SSOToken ssoToken, String instanceName, String siteName) throws SMSException, SSOException
Sets site name of which server belongs to.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.siteName- Site name.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
removeFromSite
public static void removeFromSite(SSOToken ssoToken, String instanceName, String siteId) throws SMSException, SSOException
Removes server from a site.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.siteId- Identifier of the site.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
belongToSite
public static boolean belongToSite(SSOToken ssoToken, String instanceName, String siteId) throws SMSException, SSOException
Returnstrueif a server belongs to a site.- Parameters:
ssoToken- Single Sign-On Token which is used to access to the service management datastore.instanceName- Name of the server instance.siteId- Identifier of the site.- Throws:
SMSException- if errors access in the service management datastore.SSOException- if thessoTokenis not valid.
-
cloneServerInstance
public static void cloneServerInstance(SSOToken ssoToken, String serverName, String cloneName, String cloneId) throws SMSException, SSOException, ConfigurationException
Clones a server instance.- Parameters:
serverName- Server name to clone.cloneName- server name.cloneId- new server id- Throws:
SMSExceptionSSOExceptionConfigurationException
-
cloneServerInstance
public static void cloneServerInstance(SSOToken token, String serverName, String cloneName) throws SSOException, SMSException, ConfigurationException
Clones an existing server using the new cloned server name.- Parameters:
token- SSO tokenserverName- name of existing servercloneName- name of new cloned server- Throws:
SSOException- should there be some issue with the passed tokenSMSException- should some SMS error occurConfigurationException- should some issue occur within configuration handling
-
exportServerInstance
public static String exportServerInstance(SSOToken ssoToken, String serverName) throws SMSException, SSOException
Exports a server instance.- Parameters:
serverName- Server name to clone.- Returns:
- a XML representation of server instance.
- Throws:
SMSExceptionSSOException
-
importServerInstance
public static void importServerInstance(SSOToken ssoToken, String serverName, String xmlFile) throws SMSException, SSOException, IOException, SAXException, ParserConfigurationException, ConfigurationException
Imports a server instance.- Parameters:
serverName- Server name to clone.xmlFile- File that contains XML representation of server instance.- Throws:
SMSExceptionSSOExceptionIOExceptionSAXExceptionParserConfigurationExceptionConfigurationException
-
-