8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * of the Common Development and Distribution License
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * (the License). You may not use this file except in
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * compliance with the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * https://opensso.dev.java.net/public/CDDLv1.0.html or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * If applicable, add the following below the CDDL Header,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * with the fields enclosed by brackets [] replaced by
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * your own identifying information:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * "Portions Copyrighted [year] [name of copyright owner]"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: AMTemplateImpl.java,v 1.3 2008/06/25 05:41:23 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.sm.ServiceSchemaManager;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @deprecated As of Sun Java System Access Manager 7.1.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterclass AMTemplateImpl extends AMObjectImpl implements AMTemplate {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public AMTemplateImpl(SSOToken ssoToken, String DN, String serviceName,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw new AMException(AMSDKBundle.getString("484"), "484");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw new AMException(AMSDKBundle.getString("484"), "484");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets the name of the service to which this template belongs. This method
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * can be used in conjunction with SMS APIs to get the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * AttributeSchema/ServiceSchema for the service.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return service name.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns a set of Attribute Schemas that defines the schema (metadata) of
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * this template.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return Set of <code>com.sun.identity.sm.AttributeSchema</code> for
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * this template
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if there is an internal error in the AM Store
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if the sign on is no longer valid.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public Set getAttributeSchemas() throws AMException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets the priority of this template in the DIT.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return int priority
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.message("AMTemplateImpl.getPriority", e);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets the priority of this template in the DIT
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param priority
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if there is an internal error in the AM Store
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if the sign on is no longer valid
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setPriority(int priority) throws AMException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets the type of the template.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return Returns one of the following possible values:
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <li> <code>AMTemplate.POLICY_TEMPLATE</code>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * <li> <code>AMTemplate.OTHER_TEMPLATE</code>
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return this.type;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Get the policy name. Returns a policyDN if this AMTemplate is a named
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * policy template, otherwise returns null
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return Set DNs of the named policies
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public Set getPolicyNames() throws AMException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets attribute values in this AMObject. Note that this method sets or
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * replaces the attribute value with the new value supplied.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param attributes
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Map where key is the attribute name and value is the attribute
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if there is an internal problem with AM Store.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if the sign-on is no longer valid.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public void setAttributes(Map attributes) throws AMException, SSOException {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster attributes = AMCrypt.encryptPasswords(attributes, serviceSchema);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster debug.error("AMTemplateImpl.setAttributes", smsex);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster throw new AMException(AMSDKBundle.getString("334"), "334");
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets attribute value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param attributeName
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Attribute name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return Set of attribute values.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if an error is encountered when trying to access/retrieve
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * data from the data store
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if the sign-on is no longer valid.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public Set getAttribute(String attributeName) throws AMException,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Set values = super.getAttribute(attributeName);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return AMCrypt.decryptPasswords(values, attributeName, serviceSchema);
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets Map of specified attributes. Map key is the attribute name and value
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * is the attribute value.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param attributeNames
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The Set of attribute names.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return Map of specified attributes.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws AMException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if there is an internal problem with AM Store.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws SSOException
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * if the sign-on is no longer valid.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public Map getAttributes(Set attributeNames) throws AMException,
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Map attributes = super.getAttributes(attributeNames);