NamingService.java revision 56ed5bbb263838f338eb8afc978091c01a4f2a2b
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2005 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: NamingService.java,v 1.13 2009/04/07 22:30:07 beomsuk Exp $
*
*/
/*
* Portions Copyrighted 2010-2011 ForgeRock AS
*/
public static final int SERVICE_REV_NUMBER_70 = 20;
public static int serviceRevNumber;
/*
* Initialize SSO, schema managers statically, and add listener for schema
* change events for platform service so that the naming table gets updated
* if a new platform server is added or gets deleted
*/
static {
initialize();
}
public static void initialize() {
"com.iplanet.am.server.protocol", "");
"com.iplanet.am.server.host", "");
try {
.doPrivileged(new AdminDNAction());
.doPrivileged(new AdminPasswordAction());
sso);
sso);
if (serviceRevNumber < SERVICE_REV_NUMBER_70) {
"iPlanetAMSessionService", sso);
}
// Add Listener to the platform and naming service
// for schema changes
// Add Listener to the platform and naming service
// for config changes
}
}
public NamingService() {
}
/**
* This function returns the naming table that consists of service urls,
* instance needs to be updated in the platform server list to reflect that
* server in the naming table
*/
throws SMSException {
return updateNamingTable(forClient);
}
try {
if (namingTable != null) {
return namingTable;
}
}
return namingTable;
}
/**
* This method updates the naming table especially whenever a new server
*/
private static void updateNamingTable() throws SMSException {
namingTable = updateNamingTable(false);
}
/**
* This method updates the naming table especially whenever a new server
*/
throws SMSException {
try {
if (!forClient) {
}
} else {
}
if (forClient) {
} else {
}
// To reduce risk convert from a Map to a Hastable since the rest
// of the naming code expects it in this format. Note there is
// tradeoff based on whether or not short circuiting is being used.
}
}
return nametable;
}
/**
* This will convert updated naming attributes map into naming hashtable
*/
}
return retHash;
}
/**
* This function stores the server list by parsing platform server list that
* are stored in <code>iPlanetAMPlatformService</code>. This would expect
* the servers from the platform service are in the following format
* protocol://server.domain:port|serverId e.g.
* http://solpuppy.red.iplanet.com:58081|02 The serverId can be anything and
* does not need to be a number If the platform server is not in the correct
* format, that entry will be ignored. Note: This server id should be unique
* if it's participating in load balancing mode.
*/
if (index != -1) {
.length());
if (index != -1) {
}
} else {
+ serverEntry);
}
}
}
if (index != -1) {
.length());
if (index != -1) {
continue;
}
} else {
+ serverEntry);
}
}
}
}
}
}
}
{
}
return rset;
}
// get the version from nreq and check old
// get the sesisonId from nreq
try {
} else {
if (namingDebug.messageEnabled()) {
}
}
url.getProtocol(),
uri);
} else {
}
if (replacedTable == null) {
+ "---is Invalid");
} else {
}
}
} catch (Exception e) {
}
// if request version is less than 3.0, need to replace
// %uri with the actual value
if (reqVersion < 3.0) {
}
}
}
return null;
}
if (preferredNamingURL == null) {
return null;
}
return null;
}
if (primary_id != null) {
preferredURL = url;
}
}
}
return preferredURL;
}
return replaceTable(namingTable,
}
return null;
}
// Do validation from platform server list
.equals(server_port))) {
return null;
}
}
// replace all percent here
}
return tempNamingTable;
}
return null;
}
return newTab;
}
// The following functions are the implementations of service listener
/**
* This function updates the naming table whenever it gets a schema changed
* event.
*/
// Do not update if the servieName is not "iPlanetAMPlatformService"
if ((serviceName == null)
return;
}
try {
} catch (SMSException ex) {
}
}
// We don't need to do anything for the following methods, we kept it
// for the implementation sake. But, these methods will never be
// invoked since the Platform service currently does not support
// global/organization 'Configuration'.
if ((serviceName == null)
return;
}
try {
}
}
}
{
// Do nothing
}
return;
}
"com.sun.identity.server.fqdnMap[{0}]");
try {
}
} catch (MalformedURLException ex) {
}
}
}
if (serviceRevNumber < SERVICE_REV_NUMBER_70) {
} else {
}
if (namingDebug.messageEnabled()) {
}
}
return sites;
}
throws Exception {
try {
} catch(SMSException smsException) {
continue;
}
}
if (namingDebug.messageEnabled()) {
}
return siteNamesAndIDs;
}
throws Exception {
}
if (namingDebug.messageEnabled()) {
}
}
return servers;
}
{
}
}
}
throws Exception {
while (serverlist.hasNext()) {
continue;
}
boolean found = false;
found = true;
}
}
if (found == false) {
}
}
}
}
return clustertbl;
}
throws Exception {
if (namingDebug.messageEnabled()) {
}
}
}
}
}