001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: AMTemplate.java,v 1.4 2008/06/25 05:41:23 qcheng Exp $
026 *
027 */
028
029package com.iplanet.am.sdk;
030
031import java.util.Set;
032
033import com.iplanet.sso.SSOException;
034
035/**
036 * Represents a service template associated with a AMObject. Sun Java System
037 * Access Manager distinguishes between virtual and entry attibutes. Per iDS
038 * terminology, virtual attribute is an attribute that is not physically stored
039 * in an LDAP entry but still returned with the LDAP entry as a result of a LDAP
040 * search operation. Virtual attributes are analagous to the "inherited"
041 * attributes. Entry attributes are non-inherited attributes. For each AMObject,
042 * virtual attributes can be grouped in a Template on a per-service basis.
043 * Hence, there may be one service Template per service for any given AMObject.
044 * A given object may have more than one Template, in total, one each for each
045 * of the services for that object. Such templates determine the service
046 * attributes inherited by all the other objects within the scope of this
047 * object.
048 * <p>
049 * When any object inherits more than one template for the same service (by
050 * virtue of being in the scope of two or more objects with service templates),
051 * conflicts between such templates are resolved by the use of template
052 * priorities. In this priority scheme, zero is the highest possible priority
053 * with the lower priorities extending towards finity. Templates with higher
054 * priorities will be favored over and to the exclusion of templates with lower
055 * priorities. Templates which do not have an explicitly assigned priority are
056 * considered to have the lowest priority possible, or no priority. In the case
057 * where two or more templates are being considered for inheritance of an
058 * attribute value, and they have the same (or no) priority, the result is
059 * undefined, but does not exclude the possibility that a value will be
060 * returned, however arbitrarily chosen.
061 * <p>
062 * The two types of templates supported in Identity Management are: Organization
063 * templates and Dynamic templates. Organizatin templates manage service
064 * attributes of services that are registered to an organization, while dynamic
065 * templates manage service attributes for both organizations and roles.
066 * <p>
067 * Note: Policy templates are no longer supported by AM SDK. Use
068 * <code>com.sun.identity.policy</code> package to manage policy attributes.
069 * 
070 * <PRE>
071 * 
072 * Code sample on how to obtain service templates from AMOrganization object:
073 * 
074 * AMTemplate orgTemplate; if (org.orgTemplateExists("iPlanetAMAuthService") {
075 * orgTemplate = org.getTemplate("iPlanetAMAuthService",
076 * AMTemplate.ORGANIZATION_TEMPLATE); Map attributes =
077 * orgTemplate.getAttributes(); - more code here - }
078 * 
079 * 
080 * AMTemplate dynTemplate = org.getTemplate("iPlanetAMSessionService",
081 * AMTemplates.DYNAMIC_TEMPLATE); if (dynTemplate.isExists()) { Map attributes =
082 * dynTemplate.getAttributes(); - more code here - }
083 * 
084 * </PRE>
085 *
086 * @deprecated  As of Sun Java System Access Manager 7.1.
087 * @supported.all.api
088 */
089public interface AMTemplate extends AMObject {
090
091    // template type
092    /** Represents a Policy template type */
093    public static final int POLICY_TEMPLATE = 300;
094
095    /** Represents the Dynamic template type */
096    public static final int DYNAMIC_TEMPLATE = 301;
097
098    /** Represents an Organization template type */
099    public static final int ORGANIZATION_TEMPLATE = 302;
100
101    /**
102     * Represents both dynamic and policy template for a service
103     */
104    public static final int ALL_TEMPLATES = 303;
105
106    /**
107     * Represents the priority of a template whose priority is not explicitly
108     * set.
109     */
110    public static final int UNDEFINED_PRIORITY = -1;
111
112    /**
113     * Gets the name of the service to which this template belongs. This method
114     * can be used in conjunction with SMS APIs to get the
115     * <code>AttributeSchema/ServiceSchema</code> for the service.
116     * 
117     * @return service name.
118     */
119    public String getServiceName();
120
121    /**
122     * Returns a set of Attribute Schemas that defines the schema (metadata) of
123     * this template.
124     * 
125     * @return Set of <code>com.sun.identity.sm.AttributeSchema</code> for
126     *         this template.
127     * @throws AMException
128     *             if an error is encountered when trying to access/retrieve
129     *             data from the data store.
130     * @throws SSOException
131     *             if the single sign on token is no longer valid.
132     */
133    public Set getAttributeSchemas() throws AMException, SSOException;
134
135    /**
136     * Returns the priority of this template in the DIT.
137     * 
138     * @return priority.
139     * @throws SSOException
140     *             if the single sign on token is no longer valid.
141     */
142    public int getPriority() throws SSOException;
143
144    /**
145     * Sets the priority of this template in the DIT
146     * 
147     * @param priority
148     *            priority
149     * @throws AMException
150     *             if an error is encountered when trying to access/retrieve
151     *             data from the data store.
152     * @throws SSOException
153     *             if the single sign on token is no longer valid.
154     */
155    public void setPriority(int priority) throws AMException, SSOException;
156
157    /**
158     * Gets the type of the template.
159     * 
160     * @return Returns one of the following possible values:
161     *         <ul>
162     *         <li> DYNAMIC_TEMPLATE
163     *         <li> ORGANIZATION_TEMPLATE
164     */
165    public int getType();
166
167    /**
168     * Returns a set of policy distinguished names if this
169     * <code>AMTemplate</code> is a named policy template, otherwise returns
170     * null.
171     * 
172     * @return set of policy distinguished names.
173     * @throws AMException
174     *             if an error is encountered when trying to access/retrieve
175     *             data from the data store.
176     * @throws SSOException
177     *             if the single sign on token is no longer valid.
178     */
179    public Set getPolicyNames() throws AMException, SSOException;
180}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.