/*
* 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: OrganizationConfigManagerImpl.java,v 1.12 2009/07/25 05:11:55 qcheng Exp $
*
* Portions Copyrighted 2011-2015 ForgeRock AS.
*/
/**
* The class <code>OrganizationConfigManagerImpl</code> provides interfaces to
* read the service's configuration data. It provides access to
* <code>OrganizationConfigImpl</code> which represents a single
* "configuration" in the service. It manages configuration data only for GLOBAL
* and ORGANIZATION types.
*/
// Instance variables
// Pointer to schema changes listeners
new HashMap());
// Notification search string
/**
* Constructs an instance of <code>OrganizationConfigManagerImpl</code>
* for the given organization. It requires an user identity that will be
* used to perform read operations. It is assumed that the application
* calling this constructor should authenticate the user.
*/
// Register for notifications
.registerCallbackHandler(this);
} else {
}
}
/**
* Returns organization name as DN
*/
return (orgDN);
}
/**
* Returns a set of service names that are assigned to this realm
*/
try {
// Get service names and iterate through them
} else {
}
.hasNext();) {
if (ServiceManager.isCoexistenceMode()) {
// For backward compatibility, get the version from the
// service. no hardcoding to '1.0', even if it improves
// performance in OpenAM. Otherwise, it breaks for
// services like iplanetAMProviderConfigService with
// '1.1' as version.
} else {
// handle special case for co-existence of OpenSSO and
// AM 7.1. The version for iplanetAMProviderConfigService
// is "1.1" instead of "1.0" for other services.
}
try {
}
} catch (SMSException smse) {
if (smse.getExceptionCode() !=
{
throw (smse);
}
}
}
return (answer);
} catch (SSOException ssoe) {
+ "Unable to get assigned services", ssoe);
.getString("sms-INVALID_SSO_TOKEN"),
"sms-INVALID_SSO_TOKEN"));
}
}
/**
* Returns the names of all suborganizations.
*/
}
/**
* Returns the names of suborganizations that match the given pattern.
*/
boolean recursive) throws SMSException {
try {
if (subEntries == null) {
}
} catch (SSOException ssoe) {
+ "get sub organization names", ssoe);
.getString("sms-INVALID_SSO_TOKEN"),
"sms-INVALID_SSO_TOKEN"));
}
}
/**
* Registers for changes to organization's configuration. The object will be
* called when configuration for this organization is changed.
*
* @param listener
* callback object that will be invoked when organization
* configuration has changed
* @return an ID of the registered listener.
*/
return (id);
}
/**
* Removes the listener from the organization for the given listener ID. The
* ID was issued when the listener was registered.
*
* @param listenerID
* the listener ID issued when the listener was registered
*/
}
}
// Implementations for SMSObjectListener
public void allObjectsChanged() {
// Ignore, do nothing
}
// Check for listeners
if (listenerObjects.isEmpty()) {
+ " No listeners registered: " + dn
+ "\norgNotificationSearchString: "
}
return;
}
// check for service name, version and type
int index = 0;
int orgIndex = 0;
// From realm tree, orgNotificationSearchString will be
// ou=services,o=hpq,ou=services,dc=iplanet,dc=com
}
// Check if the DN matches with organization name
// Initialize parameters
// Get the DN ignoring the organization name
if (index != 0) {
// Needs to check if the DN has more realm names
// More realm names are present, changes not meant for
// this organization
"OrgConfigMgrImpl::entryChanged Notification " +
"not sent since realms names donot match. \nDN: " +
dn + " And orgNotificationSearchString: " +
}
return;
}
// Get the version, service, group and component name
if (size > 0) {
}
if (size > 1) {
}
if (size >= 4) {
//Skip 1 RDNs
rdnIterator.next();
}
// The subconfig names should be "/" separated and left to right
while (rdnIterator.hasNext()) {
}
} else {
compName = "/";
}
}
// Convert changeType from JNDI to com.sun.identity.shared.ldap
switch (type) {
case NamingEvent.OBJECT_ADDED:
break;
case NamingEvent.OBJECT_REMOVED:
break;
default:
}
// Get organization name
+ "entryChanged() serviceName " + serviceName);
+ "entryChanged() version " + version);
+ "entryChanged() orgName " + orgName);
+ "entryChanged() groupName " + groupName);
+ "entryChanged() compName " + compName);
+ "entryChanged() type " + type);
}
// Send notifications to listeners
}
}
synchronized (listenerObjects) {
try {
} catch (Throwable t) {
"Impl:notifyOrgConfigChange Error sending notify to" +
}
}
}
}
void clear() {
// Clears the listeners
listenerObjects.isEmpty())) {
}
}
}
// If in co-exist mode, SMS will not get updates for org
// hence have to update the SMSEntry
}
// Check if the organization still exists
if (smsEntry.isNewEntry()) {
if (debug.messageEnabled()) {
" Organization deleted: " + orgDN);
}
"sms-REALM_NAME_NOT_FOUND", args));
}
// If entry is invalid, remove from cache
}
}
// ---------------------------------------------------------
// Static Protected Methods
// ---------------------------------------------------------
// Convert orgName to DN
// If orgDN is the baseDN, append "ou=services" to it
}
if (debug.messageEnabled()) {
}
// check in cache for organization name
// If in co-exist mode, SMS will not get updates for org
// hence have to update the cEntry
if (ServiceManager.isCoexistenceMode()) {
}
} else {
// Not in cache, construct the object and validate
synchronized (configMgrImpls) {
// Check the cache again, maybe added by another thread
// If in co-exist mode, SMS will not get updates for org
// hence have to update the cEntry
if (ServiceManager.isCoexistenceMode()) {
}
}
}
}
// Validate the entry
if (debug.messageEnabled()) {
orgDN);
}
return (answer);
}
// Check of OCM is valid
} else {
// Check if the user has permissions
if ((principals == null) ||
// Principal name not in cache, need to check perm
}
}
}
return (answer);
}
if (sudoPrincipals == null) {
}
return (answer);
}
static void clearCache() {
synchronized (configMgrImpls) {
}
}
}
new HashMap());
new HashMap());
}