PolicySpi.java revision 2362
2362N/A * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) 0N/A * for the <code>Policy</code> class. 0N/A * All the abstract methods in this class must be implemented by each 0N/A * service provider who wishes to supply a Policy implementation. 0N/A * <p> Subclass implementations of this abstract class must provide 0N/A * a public constructor that takes a <code>Policy.Parameters</code> 0N/A * object as an input parameter. This constructor also must throw 0N/A * an IllegalArgumentException if it does not understand the 0N/A * <code>Policy.Parameters</code> input. 0N/A * Check whether the policy has granted a Permission to a ProtectionDomain. 0N/A * @param domain the ProtectionDomain to check. 0N/A * @param permission check whether this permission is granted to the 0N/A * @return boolean true if the permission is granted to the domain. 0N/A * depends on the implementation. For example, calling <code>refresh</code> 0N/A * on a file-based policy will cause the file to be re-read. 0N/A * <p> The default implementation of this method does nothing. 0N/A * This method should be overridden if a refresh operation is supported 0N/A * by the policy implementation. 0N/A * Return a PermissionCollection object containing the set of 0N/A * permissions granted to the specified CodeSource. 0N/A * <p> The default implementation of this method returns 0N/A * Policy.UNSUPPORTED_EMPTY_COLLECTION object. This method can be 0N/A * overridden if the policy implementation can return a set of 0N/A * permissions granted to a CodeSource. 0N/A * @param codesource the CodeSource to which the returned 0N/A * PermissionCollection has been granted. 0N/A * @return a set of permissions granted to the specified CodeSource. 0N/A * If this operation is supported, the returned 0N/A * set of permissions must be a new mutable instance 0N/A * and it must support heterogeneous Permission types. 0N/A * If this operation is not supported, 0N/A * Policy.UNSUPPORTED_EMPTY_COLLECTION is returned. 0N/A * Return a PermissionCollection object containing the set of 0N/A * permissions granted to the specified ProtectionDomain. 0N/A * <p> The default implementation of this method returns 0N/A * Policy.UNSUPPORTED_EMPTY_COLLECTION object. This method can be 0N/A * overridden if the policy implementation can return a set of 0N/A * permissions granted to a ProtectionDomain. 0N/A * @param domain the ProtectionDomain to which the returned 0N/A * PermissionCollection has been granted. 0N/A * @return a set of permissions granted to the specified ProtectionDomain. 0N/A * If this operation is supported, the returned 0N/A * set of permissions must be a new mutable instance 0N/A * and it must support heterogeneous Permission types. 0N/A * If this operation is not supported, 0N/A * Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.