AMCommonNameGenerator.java revision 8af80418ba1ec431c8027fa9668e5678658d3611
/**
* 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: AMCommonNameGenerator.java,v 1.4 2008/11/08 08:20:41 veiming Exp $
*
*/
/* - NEED NOT LOG - */
/**
* <code>AMCommonNameGenerator</code> is a singleton class that generates
* common name for an user.
*/
public class AMCommonNameGenerator
implements AMAdminConstants, ServiceListener
{
private static SSOToken adminSSOToken =
private static AMCommonNameGenerator instance
= new AMCommonNameGenerator();
private static ServiceSchemaManager serviceSchemaManager;
private static ServiceConfigManager serviceConfigManager;
/**
* Creates a Console Listener Manager.
*/
private AMCommonNameGenerator() {
initialize();
}
private void initialize() {
try {
} catch (SMSException smse) {
} catch (SSOException ssoe) {
}
}
/**
* Gets an instance of Common Name generator.
*
* @return an instance of Common Name generator.
*/
public static AMCommonNameGenerator getInstance() {
return instance;
}
/**
* Generates common name for an user. This name is generated by reading
* the common name format attribute from Globalization service. This
* format contains tokenized User Profile's attributes. E.g.
* <code>{givenname} {initials} {sn}</code>. This method replaces these
* tokens with attributes values from <code>userInfoMap</code>.
*
* @param univId Universal Id of user.
* @param model of the view bean.
* @return common name for user.
*/
{
}
commonName = format;
) {
value += " ";
}
}
// remove unused token
if (idx != -1) {
} else {
if (idx != -1) {
}
}
}
}
return commonName;
}
try {
/*
* Need to get the attribute name to the proper case.
* SDK makes them all lowercased
*/
}
}
}
} catch (SSOException e) {
} catch (SMSException e) {
} catch (IdRepoException e) {
}
}
{
if (serviceName != null) {
}
}
return mapping;
}
}
}
return map;
}
while (start != -1) {
if (end != 1) {
} else {
break;
}
}
return tokens;
}
if (idx != -1) {
}
}
}
}
/**
* Adds format by retrieving the globalization service
* attributes to get the list of formats and add them
* accordingly.
*
* @param realm Realm Name
* @return map of locale to formats
*/
try {
} else {
}
} catch (SSOException e) {
} catch (SMSException e) {
} catch (IdRepoException e) {
}
}
if (serviceSchemaManager != null) {
try {
} catch (SMSException e) {
}
} else {
"AMCommonNameGenerator.addFormats: " +
"formats are not added because Console cannot get " +
"an instance of service schema manager.");
}
}
synchronized (mapRealmToFormat) {
}
return mapFormats;
}
/**
* Returns a map of locale string to common name format.
*
* @param formats set of formatting information.
* @return a map of locale string to common name format.
*/
} else {
format + " in Globalization Service");
}
}
return map;
}
/**
* Returns a map of common name formats.
*/
}
return map;
}
/**
* This method will be invoked when a service's schema has been changed.
*
* @param serviceName name of the service
* @param version version of the service
*/
synchronized (mapRealmToFormat) {
}
}
/**
* This method will be invoked when a service's global configuration
* data has been changed. The parameter <code>groupName</code> denotes the
* name of the configuration grouping (e.g. default) and
* <code>serviceComponent</code> denotes the service's sub-component that
* changed (e.g. <code>/NamedPolicy</code>, <code>/Templates</code>).
*
* @param serviceName name of the service
* @param version version of the service
* @param groupName name of the configuration grouping
* @param serviceComponent name of the service components that
* changed
* @param type change type, i.e., ADDED, REMOVED or MODIFIED
*/
public void globalConfigChanged(
int type)
{
//NO-OP
}
/**
* This method will be invoked when a service's organization
* configuration data has been changed. The parameters
* <code>orgName</code>, <code>groupName</code> and
* <code>serviceComponent</code> denotes the organization name,
* configuration grouping name and service's sub-component that are
* changed respectively.
*
* @param serviceName name of the service
* @param version version of the service
* @param orgName organization name as DN
* @param groupName name of the configuration grouping
* @param serviceComponent the name of the service components that
* changed
* @param type change type, i.e., ADDED, REMOVED or MODIFIED
*/
public void organizationConfigChanged(
int type)
{
synchronized (mapRealmToFormat) {
}
}
}