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: PolicyEvent.java,v 1.2 2008/06/25 05:43:44 qcheng Exp $ 026 * 027 */ 028 029 030package com.sun.identity.policy; 031 032import java.util.Set; 033 034/** 035 * Class to represent policy change events, used by policy framework to 036 * notify interested listeners 037 * @see com.sun.identity.policy.interfaces.PolicyListener 038 * 039 * @supported.all.api 040 */ 041public class PolicyEvent { 042 043 /** 044 * constant to indicate change type policy added 045 */ 046 public static final int POLICY_ADDED = 047 com.sun.identity.sm.ServiceListener.ADDED; 048 049 /** 050 * constant to indicate change type policy modified 051 */ 052 public static final int POLICY_MODIFIED = 053 com.sun.identity.sm.ServiceListener.MODIFIED; 054 055 /** 056 * constant to indicate change type policy removed 057 */ 058 public static final int POLICY_REMOVED = 059 com.sun.identity.sm.ServiceListener.REMOVED; 060 061 private Set resourceNames; 062 private int changeType; 063 064 /** 065 * No argument constructor 066 */ 067 PolicyEvent() { 068 } 069 070 /** 071 * Sets the resource names affected by the policy change 072 * @param resourceNames names of the resources affected by 073 * the policy change 074 */ 075 void setResourceNames(Set resourceNames) { 076 this.resourceNames = resourceNames; 077 } 078 079 /** 080 * Gets the resource names affected by the policy change. 081 * This indicates that policy decisions for the affected resource names 082 * would likely be different from those computed before the change. 083 * @return names of the resources affected by the policy change. 084 */ 085 public Set getResourceNames() { 086 return resourceNames; 087 } 088 089 /** 090 * Sets the change type 091 * @param changeType <code>int</code> representing change type 092 */ 093 void setChangeType(int changeType) { 094 this.changeType = changeType; 095 } 096 097 /** 098 * Gets the change type 099 * The change type gives the type of policy change that triggered this 100 * event indicating whether a policy was added, modified or removed. 101 * This change type does not indicate whether resource(s) were added, 102 * modified or removed. 103 * @return change type 104 */ 105 public int getChangeType() { 106 return changeType; 107 } 108} 109