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