NamingTableConfigurationFactory.java revision 01f7f939eba03e95a87e8e4a6883d2591336a5ec
/*
* 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 legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at 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 copyright [year] [name of copyright owner]".
*
* Copyright 2015-2016 ForgeRock AS.
*/
/**
* Responsible for creating the configuration which is used by WebtopNaming.
*
* The objective is to ensure that the configuration is used in an immutable fashion
* by WebtopNaming, which has a high tendency of leak untyped collections through its
* API.
*
* This class is intentionally gingerly moving code from WebtopNaming to this
* configuration factory in the attempt to minimise the impact of these changes
* on what is some of the oldest code in the product.
*
* Future direction: Refactor and convert these initialisation methods so that the
* configuration can be entirely initialsed as final.
*/
public class NamingTableConfigurationFactory {
/**
* The delimiter used to separate server IDs in the service attribute.
*/
/**
* Constructs the internal configuration required by WebtopNaming.
*
* Thread Safety: This method does not require synchronisation as the result is an immutable
* data structure.
*
* @param namingTable Non null naming table which contains the current server and site configuration.
* @return Non null NamingTableConfiguration.
* @throws MalformedURLException TODO
* @throws ServerEntryNotFoundException TODO
*/
public NamingTableConfiguration getConfiguration(Hashtable namingTable) throws MalformedURLException, ServerEntryNotFoundException {
while (st.hasMoreTokens()) {
}
}
if (debug.messageEnabled()) {
}
return config;
}
/*
* This method is to update the servers and their IDs in a seprate
* hash. It will get updated each time when the naming table gets
* updated. Note: this table will have all the entries in the
* naming table but in a reverse order except the platform server
* list. We can just keep only server ID mappings but we need to
* exclude each other entry which is there in.
*/
continue;
}
// If the key is server list skip it, since it would
// have the same value
continue;
}
/**
* serverIDTbl stores mappings of Server URL to Server ID.
* e.g. http://openam.example.com:8080/openam -> 01
* If another Server ID or Site ID also uses the same URL,
* this is a conflict. The following protects the server
* configuration from being corrupted by this conflict and
* make sure the mapping is to a non-siteID
*/
if (debug.warningEnabled()) {
debug.warning("NamingTable.updateServerIdMappings: multiple mapping for URL: {} IDs: {} and {}", value, serverIdTbl.get(value), key);
}
// If the Server ID is not a known Site ID,
// then we are ok to add it to the table.
}
} else {
}
}
}
if (debug.messageEnabled()) {
}
}
return;
}
while (tok.hasMoreTokens()) {
if (idx != -1) {
}
}
if (debug.messageEnabled()) {
}
}
}
}
}
return;
}
while (tok.hasMoreTokens()) {
if (idx != -1) {
}
}
if (debug.messageEnabled()) {
}
}
//the first one is always the primary site ID, which we don't need now
while (tokenizer.hasMoreTokens()) {
}
}
}
}
}
}
return null;
}
return Collections.EMPTY_MAP;
}
while (tok.hasMoreTokens()) {
if (idx != -1) {
}
}
return map;
}
/**
* Configuration based on the naming table provided. This configuration is intended to
* be non-modifiable to ensure that it is used correctly by WebtopNaming.
*/
public class NamingTableConfiguration {
//This is created for ignore case comparison
private Map siteNameToIdTable;
//This is created for storing server id and lbcookievalue mapping
//key:serverid | value:lbcookievalue
/**
* @return An unmodifiable copy of the naming table for read only access.
*/
return namingTable;
}
}
return serverIdTable;
}
}
return serverIDs;
}
}
return siteIDs;
}
}
return siteIdTable;
}
}
return platformServers;
}
}
return siteNameToIdTable;
}
}
return lbCookieValuesTable;
}
}
return lcPlatformServers;
}
}
return secondarySiteIDs;
}
}
return platformServerIDs;
}
}
}
}
}
}