8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
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 *
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 * opensso/legal/CDDLv1.0.txt
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * See the License for the specific language governing
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Code, include this CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header Notice in each file and include the License file
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * at opensso/legal/CDDLv1.0.txt.
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 *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * $Id: ProtectedResource.java,v 1.2 2008/06/25 05:43:44 qcheng Exp $
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
0c9594d96d580b0cba488fa7d01802fbb49d8a3eCraig McDonnell * Portions Copyrighted 2011-2014 ForgeRock AS.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpackage com.sun.identity.policy;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport java.util.Set;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Class that encapsulates a resource and policies protecting the resource
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * for a given user
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @supported.all.api
0c9594d96d580b0cba488fa7d01802fbb49d8a3eCraig McDonnell * @deprecated since 12.0.0
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
0c9594d96d580b0cba488fa7d01802fbb49d8a3eCraig McDonnell@Deprecated
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic class ProtectedResource {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private String resourceName;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster private Set policies;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Constructs a <code>ProtectedResource</code> based on
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the given resource name and protecting policies
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param resourceName the resource that is protected
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param policies set of policies that protect
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the resource. The set contains Policy objects.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster ProtectedResource(String resourceName, Set policies) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.resourceName = resourceName;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.policies = policies;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets the protected resource name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param resourceName protected resource name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster void setResourceName(String resourceName) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.resourceName = resourceName;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets the protected resource name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return protected resource name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public String getResourceName() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return resourceName;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Sets policies that protect the resource name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param policies set of policies that protect the resource.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The set contains Policy objects.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster void setPolicies(Set policies) {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster this.policies = policies;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Gets policies that protect the resource name
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return set of policies that protect the resource.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The set contains Policy objects.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster public Set getPolicies() {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster return policies;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster }
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}