WebtopNamingSiteUtils.java revision 35ab1c5bca11317474fe12bdd8d22c17cdaf2697
/**
* Copyright 2014 ForgeRock AS.
*
* 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]".
*/
/**
* Responsible for providing supporting functions for the {@link WebtopNaming} service.
*
* In particular translating concepts that are based on users Sessions into
* those which WebtopNaming operates in.
*/
public class WebtopNamingSiteUtils {
private final WebtopNamingQuery query;
/**
* Guice initialised default constructor.
*
* @param debug Required for debugging.
* @param query Required for performing WebtopNaming operations.
*/
public WebtopNamingSiteUtils(@Named(SessionConstants.SESSION_DEBUG) Debug debug, WebtopNamingQuery query) {
}
/**
* Determines if the Session is associated with a Server that is part of a
* Site. If this is the case then the function will determine the other
* Servers in the cluster.
*
* @param session A non null Session which must be associated with a Server ID.
*
* @return A set of the nodes that make up the cluster or Site. If the server
* is not part of a Site then just the Server ID will be returned in the Set.
*
* @throws IllegalStateException If WebtopNaming was unable to find the IDs
* for Servers in the Site. Unlikely as at this point it has indicated that
* the Server in question is part of a Site.
*/
} else {
// Check for the Servers Site.
// This server has no site.
}
}
try {
} catch (Exception e) {
throw new IllegalStateException(err);
}
}
/**
* Determines the Site (if any) that the Session is based in, and then calculates
* the Servers that make up that Site.
*
* @param session Non null Session to use for query.
*
* @return The URLs for each node in the Site that the Session belongs to. If the
* Session comes from a Server that is not part of a Site, then just the URL for
* that Server will be returned. Never null.
*
* @throws IllegalStateException Thrown if WebtopNaming returned an invalid URL.
*/
try {
} catch (MalformedURLException e) {
throw new IllegalStateException(err, e);
} catch (ServerEntryNotFoundException e) {
continue;
}
}
return urls;
}
}