001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2009 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: ResourceMatch.java,v 1.1 2009/11/24 21:42:35 madan_ranganath Exp $
026 *
027 */
028
029
030package com.sun.identity.shared.whitelist;
031
032/**
033 * The class <code>ResourceMatch</code> defines the results
034 * of a resource match with respect to Policy.
035 *
036 * @supported.all.api
037 */
038public class ResourceMatch extends Object {
039
040    private String resourceMatch;
041
042    /**
043     * The <code>EXACT_MATCH</code> specifies
044     * the resources are exactly the same.
045     */
046    public static final ResourceMatch
047        EXACT_MATCH = new ResourceMatch("exact_match");
048
049    /**
050     * The <code>WILDCARD_MATCH</code> specifies
051     * the resources are wildcard match
052     */
053    public static final ResourceMatch
054        WILDCARD_MATCH = new ResourceMatch("wildcard_match");
055
056    /**
057     * The <code>SUB_RESOURCE_MATCH</code> specifies
058     * the provided resource is a sub resource.
059     */
060    public static final ResourceMatch
061        SUB_RESOURCE_MATCH = new ResourceMatch("sub_resource_match");
062
063    /**
064     * The <code>SUPER_RESOURCE_MATCH</code> specifies
065     * the provided resource is more specific than
066     * this resource
067     */
068    public static final ResourceMatch
069        SUPER_RESOURCE_MATCH = new ResourceMatch("super_resource_match");
070
071    /**
072     * The <code>NO_MATCH</code> specifies
073     * the resources do not match
074     */
075    public static final ResourceMatch
076        NO_MATCH = new ResourceMatch("no_match");
077
078        public static final String RESOURCE_COMPARATOR_DELIMITER = "delimiter";
079
080    public static final String RESOURCE_COMPARATOR_WILDCARD = "wildcard";
081
082    public static final String RESOURCE_COMPARATOR_ONE_LEVEL_WILDCARD
083        = "oneLevelWildcard";
084
085    public static final String RESOURCE_COMPARATOR_CASE_SENSITIVE =
086        "caseSensitive";
087
088    private ResourceMatch() {
089        // do nothing
090    }
091
092    private ResourceMatch(String matchType) {
093        resourceMatch = matchType;
094    }
095
096    /**
097     * Method to get string representation of the resource match.
098     *
099     * @return string representation of the resource match.
100     */
101    public String toString() {
102        return (resourceMatch);
103    }
104
105    /**
106     * Method to check if two resource match objects are equal.
107     *
108     * @param resourceMatch object to which this object will be
109     * compared with
110     *
111     * @return <code>true</code> if the resources match;
112     * <code>false</code> otherwise;
113     */
114    public boolean equals(Object resourceMatch) {
115        if (resourceMatch instanceof ResourceMatch) {
116            ResourceMatch rm = (ResourceMatch) resourceMatch;
117            return (rm.resourceMatch.equals(this.resourceMatch));
118        }
119        return (false);
120    }
121}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.