ResourceTypeConfiguration.java revision 9a9e9f9aa372dc00549820097d30655761b72893
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * The contents of this file are subject to the terms of the Common Development and
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * Distribution License (the License). You may not use this file except in compliance with the
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * specific language governing permission and limitations under the License.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * When distributing Covered Software, include this CDDL Header Notice in each file and include
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * Header, with the fields enclosed by brackets [] replaced by your own identifying
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * information: "Portions copyright [year] [name of copyright owner]".
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * Copyright 2015 ForgeRock AS.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrestpackage org.forgerock.openam.entitlement.configuration;
74dca04245920444925c2544c591c3da5dad607eAndrew Forrestimport com.sun.identity.entitlement.EntitlementException;
74dca04245920444925c2544c591c3da5dad607eAndrew Forrestimport org.forgerock.openam.entitlement.ResourceType;
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * Implementations of this interface are responsible for the persistence of the resource type entitlement configuration.
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * Retrieve a registered resource type by id.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param subject The subject for whom the resource type should be retrieved.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param realm The realm in which the resource type resides.
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * @param uuid The unique identifier for the resource type.
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * @return The registered resource type.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @throws EntitlementException If the retrieval of the resource type failed.
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste public ResourceType getResourceType(Subject subject, String realm, String uuid) throws EntitlementException;
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * Check to see if a resource type with the given UUID already exists in this realm.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param subject The subject for whom the resource type should be retrieved.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param realm The realm in which the resource type resides.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param uuid The unique identifier for the resource type.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @return True if the resource type already exists.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest public boolean containsUUID(Subject subject, String realm, String uuid) throws EntitlementException;
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * Check to see if a resource type with the given name already exists in this realm.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param subject The subject for whom the resource type should be retrieved.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param realm The realm in which the resource type resides.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param name The name of the resource type.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @return True if the resource type already exists.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest public boolean containsName(Subject subject, String realm, String name) throws EntitlementException;
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * Remove a resource type.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param subject The subject for whom the resource type should be removed.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param realm The realm in which the resource type resides.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param uuid The unique identifier for the resource type.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @throws EntitlementException if the resource type cannot be removed.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest public void removeResourceType(Subject subject, String realm, String uuid) throws EntitlementException;
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * Stores the resource type to the data store.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param subject The subject for whom the resource type should be stored.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @param resourceType The resource type to store.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest * @throws EntitlementException if the resource type cannot be stored.
74dca04245920444925c2544c591c3da5dad607eAndrew Forrest public void storeResourceType(Subject subject, ResourceType resourceType) throws EntitlementException;
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * Retrieves a set of resource types based on the passed query filter.
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * @param filter
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * the query filter
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * @param subject
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * the calling subject
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * @param realm
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * the realm to look within
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * @return a set of matching resource types
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * @throws EntitlementException
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest * should an error occur during lookup
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest public Set<ResourceType> getResourceTypes(QueryFilter<SmsAttribute> filter,
ec605f03252c4b0b84efac92c54b22d1b2ba3a6cAndrew Forrest Subject subject, String realm) throws EntitlementException;
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * Retrieve the resource types stored under the specified realm from the data store.
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * @param subject The subject with privilege to access the resource types in this realm.
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * @param realm The realm from which to retrieve the resource types.
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * @return The registered resource types in a map. The outer map holds the resource type UUID as the key. The inner
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * map (value of the outer map) holds the names of the attributes of the resource type as keys and a set of values
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * for that attribute as the value.
9a9e9f9aa372dc00549820097d30655761b72893Jaco Jooste * @throws EntitlementException If the retrieval of the resource type failed.