SiteConfiguration.java revision 56ed5bbb263838f338eb8afc978091c01a4f2a2b
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2007 Sun Microsystems Inc. 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
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: SiteConfiguration.java,v 1.12 2010/01/15 18:10:55 veiming Exp $
*
*/
/*
* Portions Copyrighted 2010 ForgeRock AS
*/
/**
* This manages site configuration information.
*/
public class SiteConfiguration extends ConfigurationBase {
static {
for (Character c : specialCharacters) {
specialChars += c;
}
}
// prevent instantiation of this class.
private SiteConfiguration() {
}
/**
* Returns a set of site information where each entry in a set is
* a string of this format <code>site-instance-name|siteId</code>.
*
* @param ssoToken Single Sign-On Token which is used to query the service
* management datastore.
* @return a set of site information.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
throws SMSException, SSOException {
} else {
}
}
}
return siteInfo;
}
private static Set getSiteInfo(
) throws SMSException, SSOException {
}
}
}
return info;
}
/**
* Returns a set of site instance name (String).
*
* @param ssoToken Single Sign-On Token which is used to query the service
* management datastore.
* @return a set of site instance name.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
throws SMSException, SSOException {
if (idx != -1) {
}
}
}
} else {
}
}
return sites;
}
/**
* Deletes a site.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param siteName Name of the site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static boolean deleteSite(
boolean deleted = false;
if (s.startsWith(site)) {
i.remove();
deleted = true;
}
}
if (deleted) {
}
} else {
}
deleted = true;
}
}
}
return deleted;
}
/**
* Creates a site.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param siteName Name of the site.
* @param siteURL primary URL of the site.
* @param secondaryURLs secondary URLs of the site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
* @throws ConfigurationException if site url is invalid.
*/
public static boolean createSite(
boolean created = false;
}
if (specialCharacters.contains(c)) {
}
}
//need to do this because we are getting Collections.EMPTY.SET;
}
} else {
}
}
if (created) {
}
return created;
}
/**
* Creates a site.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param siteName Name of the site.
* @param siteURL Primary URL of the site.
* @param siteId Identifier of the site.
* @param secondaryURLs Secondary URLs of the site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
private static boolean createSite(
boolean created = false;
try {
if ((!test.isFullyQualified()) ||
}
} catch (MalformedURLException ex) {
}
}
throw new ConfigurationException("duplicated.site.url",
param);
}
try {
if ((!test.isFullyQualified()) ||
throw new ConfigurationException(
"invalid.site.secondary.url", param);
}
} catch (MalformedURLException ex) {
throw new ConfigurationException(
"invalid.site.secondary.url", param);
}
}
}
}
created = true;
}
return created;
}
/**
* 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.
*/
throws SMSException, SSOException {
{
}
}
/**
* 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.
*/
throws SMSException, SSOException {
}
/**
* Returns the primary and secondary URLs 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 and secondary URLs of a site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
throws SMSException, SSOException {
}
}
return urls;
}
/**
* Returns the secondary URLs 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 secondary URLs of a site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
throws SMSException, SSOException {
}
return secondaryURLs;
}
/**
* Sets 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.
* @param siteURL 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 void setSitePrimaryURL(
}
}
}
/**
* Sets the ID 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.
* @param siteID The new id of the site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static void setSiteID(
// check we are not already set to this value
}
// check no other site is using it!
}
}
}
/**
* Sets the secondary URLs 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.
* @param secondaryURLs secondary URLs 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 void setSiteSecondaryURLs(
try {
if ((!test.isFullyQualified()) ||
throw new ConfigurationException(
"invalid.site.secondary.url", param);
}
} catch (MalformedURLException ex) {
throw new ConfigurationException(
"invalid.site.secondary.url", param);
}
}
}
}
}
}
}
}
/**
* Adds the secondary URLs 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.
* @param secondaryURLs Secondary URLs to be added to site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static void addSiteSecondaryURLs(
}
}
}
}
}
/**
* Removes the secondary URLs from a site.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param siteName Name of the site.
* @param secondaryURLs Secondary URLs to be removed from site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static void removeSiteSecondaryURLs(
) throws SMSException, SSOException {
}
}
}
}
/**
* Adds a set of server instances to a site.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param siteName Name of the site.
* @param serverInstanceNames Set of server instance names.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
* @throws ConfigurationException if one or more server instances are not
* found.
*/
public static void addServersToSite(
}
}
}
/**
* Removes a set of server instances from a site.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param siteName Name of the site.
* @param serverInstanceNames Set of server instance names.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static void removeServersFromSite(
}
}
}
) {
if (idx != -1) {
if (idx != -1) {
}
}
}
}
}
} else {
}
}
}
return siteId;
}
/**
* Returns the server instance names that belong to 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 server instance names that belong to a site.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static Set listServers(
}
}
}
return members;
}
/**
* Returns <code>true</code> if site exists.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param siteName Name of the site.
* @return <code>true</code> if site exists.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
public static boolean isSiteExist(
) throws SMSException, SSOException {
}
throws SMSException, SSOException {
}
return urls;
}
/**
* Returns site name where the given URL is either its primary or
* secondary URL.
*
* @param ssoToken Single Sign-On Token which is used to access to the
* service management datastore.
* @param url Lookup URL.
* @return site name.
* @throws SMSException if errors access in the service management
* datastore.
* @throws SSOException if the <code>ssoToken</code> is not valid.
*/
throws SMSException, SSOException {
}
}
return siteName;
}
}