/*
* 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: COSManager.java,v 1.5 2009/01/28 05:34:51 ww203982 Exp $
*
* Portions Copyright 2015 ForgeRock AS.
*/
/**
* This class has the responsibility of adding, removing and replacing COS
* definitions. It also provides search capabilities for COS definitions.
* @supported.api
*/
public class COSManager {
/**
* This constructor sets the parent Directory entry which identifies the
* location of COS definitions which will be managed. It also gets an
* instance of a SchemaManager which will be used to update schema entries
* for COS assignments.
*
* @param token Authenticated principal's single sign on token.
* @param guid The unique identifier specifying where COS definitions will
* be managed.
* @throws UMSException if the token authentication fails, or if
* the guid for the parent entry is not valid.
*/
try {
} catch (SSOException se) {
se);
}
try {
.getPrincipal());
} catch (SSOException se) {
throw new UMSException("Bad Authentication Token "
+ se.getMessage());
}
}
/**
* This constructor sets the parent Directory entry which identifies the
* location of COS definitions which will be managed. It also gets an
* instance of a SchemaManager which will be used to update schema entries
* for COS assignments.
*
* @param principal
* Authenticated principal
* @param guid
* The unique identifier specifying where COS definitions will be
* managed.
*
* @throws UMSException
* The exception thrown if there is a problem determining the
* parent entry, or getting the SchemaManager instance.
*/
}
/**
* This method returns an instance of a COS Manager.
*
* @param token Authenticated principal's single sign on token.
* @param guid COS definitions will be managed under the level identified by
* this guid.
* @throws UMSException
* The exception thrown from the COSManager constructor.
* @supported.api
*/
throws UMSException {
}
/**
* This method returns an instance of a COS Manager.
*
* @param principal Authenticated principal.
* @param guid COS definitions will be managed under the level identified by
* this guid.
* @throws UMSException
* The exception thrown from the data layer.
*/
throws UMSException {
}
/**
* This method adds a COS definition to the persistent store. The definition
* is added under the specified "guid" parameter.
*
* @param cosDef
* The COS definition to be added.
*
* @throws UMSException
* The exception thrown from the data layer.
* @supported.api
*/
if (!(cosDef instanceof DirectCOSDefinition)) {
throw new UMSException(msg);
}
if (st.hasMoreTokens()) {
}
if (cosAttribute == null) {
throw new UMSException(msg);
}
if (st.hasMoreTokens())
}
throw new UMSException(msg);
}
}
}
/**
* Removes the COS definition.
*
* @param name
* The name of the definition to be removed.
*
* @throws UMSException
* The exception thrown from the data layer.
* @supported.api
*/
}
/**
* Updates the contents of a COS definition with the new contents. The COS
* definition must already exist in the persistent layer, before its
* contents can be replaced.
*
* @param cosDef
* The COS definition containing new contents, which will replace
* the same definition in the persistent layer.
*
* @throws UMSException
* The exception thrown from the data layer.
* @supported.api
*/
throw new UMSException(msg);
}
}
/**
* Returns COS definition given the name.
*
* @param name Name of the COS definition.
* @return A COS definition with the specified name.
* @throws UMSException if exception occurred at the data layer.
* @throws COSNotFoundException if the COS object is not found.
* @supported.api
*/
while (sr.hasMoreElements()) {
break;
} else {
}
}
throw new COSNotFoundException(msg);
}
return cosDef;
}
/**
* Retrieves all COS definitions for the current organization. This
* COSManager instance applies to an organization.
*
* @return A collection of COS definition objects.
*
* @throws UMSException
* The exception thrown from the data layer.
* @supported.api
*/
while (sr.hasMoreElements()) {
}
return cosDefinitions;
}
/**
* Assigns a COS (as defined by a COS definition) to the persistent object.
* The COS target persistent object could be a user, group, organization,
* organizationalunit, etc. The COS target object must be persistent before
* this method can be used.
*
* @param pObject
* The COS target persistent object.
* @param cosDef
* A COS definition.
* @param cosTemplate
* A COS template. This only applies for COS and Indirect COS
* definitions. For pointer COS definitions, this parameter can
* be null.
*
* @throws UMSException
* If a data layer exception occurs.
* @supported.api
*/
throw new UMSException(msg);
}
// Do validation....
//
throw new UMSException(msg);
}
if (!(cosDef instanceof DirectCOSDefinition)) {
throw new UMSException(msg);
}
if (cosDef instanceof DirectCOSDefinition) {
}
}
/**
* Removes COS assignment from the persistent object. The COS target
* persistent object could be a user, group, organization,
* organizationalunit, etc. The COS target object must be persistent before
* this method can be used.
*
* @param pObject
* The COS target persistent object.
* @param cosDef
* A COS definition.
* @param cosTemplate
* A COS template.
*
* @throws UMSException
* The exception thrown if any of the following occur: o the
* target persistent object or COS definition parameter is null.
* o the target object is not persistent. o the COS definition
* is not one of the valid COS definitions. o an exception is
* propagated from any of the "remove" methods.
* @supported.api
*/
{
throw new UMSException(msg);
}
// Do validation....
//
throw new UMSException(msg);
}
if (!(cosDef instanceof DirectCOSDefinition)) {
throw new UMSException(msg);
}
if (cosDef instanceof DirectCOSDefinition) {
}
}
/**
* Removes a Direct COS assignment from a target persistent object. The COS
* target persistent object could be a user, group, organization,
* organizationalunit, etc. The COS target object must be persistent before
* this method can be used.
*
* @param pObject
* The COS target persistent object.
* @param cosDef
* A COS definition.
* @param sMgr
* A SchemaManager object, which is used to determine object
* classes for attributes.
*
* @throws UMSException
* The exception thrown if any of the following occur: o an
* exception occurs determining the object class for the COS
* specifier. o an exception occurs determining the object class
* for the COS attributes. o there is an exception thrown rom
* the data layer.
*/
try {
// Include the attribute (whose name is the cosSpecifier)
// in the attribute set for removal (only if it exists).
//
.getName()));
// Get cosSpecifier object class - should only be one.
// Include the cosSpecifier object class in the attribute
// set for removal (only if itt exists).
//
}
// Get the cos attributes from the definition (ex. mailquota).
// For each of the attributes, get the objectclass. Include the
// object classes in the attribute set for removal (if they exist).
//
// Only get the attribute - not the qualifier
//
}
}
}
} catch (UMSException e) {
// Ignore anything that is not a COS generated attribute's object class
throw e;
}
}
}
/**
* Assigns a direct (Classic) COS definition to a persistent object.
*
* @param pObject
* The target persistent object.
* @param cosDef
* The direct (Classic) COS definition.
* @param cosTemplate
* A COS template belonging to the definition.
* @param sMgr
* A SchemaManager instance.
*
* @throws UMSException
* if an exception occurs
*/
// Do validation....
//
throw new UMSException(msg);
}
// Make sure target entry is in same tree as COS Def parent.
//
throw new UMSException(msg);
}
// If cosSpecifier is "nsRole", then we don't need to go
// any further (we don't need to update target entries).
//
return;
// Get cosSpecifier object class - should only be one.
// Update the target entry with cosSpecifier object class.
// Only add it if it doesn't already exist.
//
}
// Get the cos attributes from the definition (ex. mailquota).
// For each of the attributes, get the objectclass. These
// will be used to attach to the target entry. This is only
// done if the cos attribute qualifier is not "operational"
// (you don't need to add cos attribute object classes for
// "operational" cos attribute qualifier.
//
{
cosTempObjClasses[j])) {
cosTempObjClasses[j]));
}
}
}
}
}
// Add the attribute name (cosSpecifier value) and attribute
// value (cosTemplate name) only if it doesn't exist.
//
.getName()));
}
}
while (attributes.hasMoreElements()) {
}
return modifications;
}
/**
* Utility method to check if an object class exists in a persistent object.
*
* @param objectClass
* The object class.
* @param pObject
* The persistent object.
*/
return true;
}
}
return false;
}
//
// Definition Search Attributes
//
}