Top Description Inners Fields Constructors Methods
java.security

public abstract Class Policy

extends Object
Class Inheritance
Known Direct Subclasses
java.security.Policy.PolicyDelegate, sun.security.provider.PolicyFile
Annotations
@Deprecated
since:17
forRemoval:true
Imports
java.util.Enumeration, .WeakHashMap, .Objects, sun.security.jca.GetInstance, sun.security.util.Debug, .SecurityConstants

Deprecated

for removal since 17.

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

A Policy object is responsible for determining whether code executing in the Java runtime environment has permission to perform a security-sensitive operation.

There is only one Policy object installed in the runtime at any given time. A Policy object can be installed by calling the setPolicy method. The installed Policy object can be obtained by calling the getPolicy method.

If no Policy object has been installed in the runtime, a call to getPolicy installs an instance of the default Policy implementation (a default subclass implementation of this abstract class). The default Policy implementation can be changed by setting the value of the policy.provider security property to the fully qualified name of the desired Policy subclass implementation. The system class loader is used to load this class.

Application code can directly subclass Policy to provide a custom implementation. In addition, an instance of a Policy object can be constructed by invoking one of the getInstance factory methods with a standard type. The default policy type is "JavaPolicy".

Once a Policy instance has been installed (either by default, or by calling setPolicy), the Java runtime invokes its implies method when it needs to determine whether executing code (encapsulated in a ProtectionDomain) can perform SecurityManager-protected operations. How a Policy object retrieves its policy data is up to the Policy implementation itself. The policy data may be stored, for example, in a flat ASCII file, in a serialized binary file of the Policy class, or in a database.

The refresh method causes the policy object to refresh/reload its data. This operation is implementation-dependent. For example, if the policy object stores its data in configuration files, calling refresh will cause it to re-read the configuration policy files. If a refresh operation is not supported, this method does nothing. Note that refreshed policy may not have an effect on classes in a particular ProtectionDomain. This is dependent on the policy provider's implementation of the implies method and its PermissionCollection caching strategy.

Authors
Roland Schemers, Gary Ellison
Since
1.2
See Also
java.security.Provider, java.security.ProtectionDomain, java.security.Permission, security properties

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Policy.Parameters

Deprecated for removal since 17. This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release.
This represents a marker interface for Policy parameters.
private static class
Policy.PolicyDelegate

References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.
This subclass is returned by the getInstance calls.
private static class
private static class
Policy.UnsupportedEmptyCollection

This class represents a read-only empty PermissionCollection object that is returned from the getPermissions(CodeSource) and getPermissions(ProtectionDomain) methods in the Policy class when those operations are not supported by the Policy implementation.

Field Summary

Modifier and TypeField and Description
private static final Debug
private static final String
private WeakHashMap<ProtectionDomain.Key, PermissionCollection>
private static volatile Policy.PolicyInfo
public static final PermissionCollection
UNSUPPORTED_EMPTY_COLLECTION

A read-only empty PermissionCollection instance.

Constructor Summary

AccessConstructor and Description
public
Policy()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
private void
addStaticPerms(PermissionCollection perms, PermissionCollection statics)

add static permissions to provided permission collection

private static void
public static Policy

Returns:

the new Policy object
getInstance
(String
the specified Policy type. See the Policy section in the Java Security Standard Algorithm Names Specification for a list of standard Policy types.
type
,
Policy.Parameters
parameters for the Policy, which may be null.
params
)
References Deprecated Policy.Parameters and Policy are deprecated or reference (maybe indirectly) at least one deprecated element.

Returns a Policy object of the specified type.

public static Policy

Returns:

the new Policy object
getInstance
(String
the specified Policy type. See the Policy section in the Java Security Standard Algorithm Names Specification for a list of standard Policy types.
type
,
Policy.Parameters
parameters for the Policy, which may be null.
params
,
String
the provider.
provider
)
References Deprecated Policy.Parameters and Policy are deprecated or reference (maybe indirectly) at least one deprecated element.

Returns a Policy object of the specified type.

public static Policy

Returns:

the new Policy object
getInstance
(String
the specified Policy type. See the Policy section in the Java Security Standard Algorithm Names Specification for a list of standard Policy types.
type
,
Policy.Parameters
parameters for the Policy, which may be null.
params
,
Provider
the Provider.
provider
)
References Deprecated Policy.Parameters and Policy are deprecated or reference (maybe indirectly) at least one deprecated element.

Returns a Policy object of the specified type.

public Policy.Parameters

Returns:

Policy parameters, or null.
getParameters
()
References Deprecated Policy.Parameters is deprecated or references (maybe indirectly) at least one deprecated element.

Return Policy parameters.

public PermissionCollection

Returns:

a set of permissions granted to the specified CodeSource. If this operation is supported, the returned set of permissions must be a new mutable instance and it must support heterogeneous Permission types. If this operation is not supported, Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.
getPermissions
(CodeSource
the CodeSource to which the returned PermissionCollection has been granted.
codesource
)

Return a PermissionCollection object containing the set of permissions granted to the specified CodeSource.

public PermissionCollection

Returns:

a set of permissions granted to the specified ProtectionDomain. If this operation is supported, the returned set of permissions must be a new mutable instance and it must support heterogeneous Permission types. If this operation is not supported, Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.
getPermissions
(ProtectionDomain
the ProtectionDomain to which the returned PermissionCollection has been granted.
domain
)

Return a PermissionCollection object containing the set of permissions granted to the specified ProtectionDomain.

public static Policy

Returns:

the installed Policy.
getPolicy
()
References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.

Returns the installed Policy object.

pack-priv static Policy

Returns:

the installed Policy.
getPolicyNoCheck
()
References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.

Returns the installed Policy object, skipping the security check.

public Provider

Returns:

the Provider of this policy, or null.
getProvider
()

Return the Provider of this policy.

public String

Returns:

the type of this Policy, or null.
getType
()

Return the type of this Policy.

private static Policy
handleException(NoSuchAlgorithmException nsae)
References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.

public boolean

Returns:

true if "permission" is a proper subset of a permission granted to this ProtectionDomain.
implies
(ProtectionDomain
the ProtectionDomain to test
domain
,
Permission
the Permission object to be tested for implication.
permission
)

Evaluates the global policy for the permissions granted to the ProtectionDomain and tests whether the permission is granted.

private static void
initPolicy(final Policy p)
References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.

Initialize superclass state such that a legacy provider can handle queries for itself.

pack-priv static boolean
isSet()

package private for AccessControlContext and ProtectionDomain

private static Policy
loadPolicyProvider()
References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.

Loads and instantiates a Policy implementation specified by the policy.provider security property.

public void
refresh()

Refreshes/reloads the policy configuration.

public static void
setPolicy(Policy
the new system Policy object.
p
)
References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.

Sets the system-wide Policy object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

debugback to summary
private static final Debug debug
DEFAULT_POLICYback to summary
private static final String DEFAULT_POLICY
pdMappingback to summary
private WeakHashMap<ProtectionDomain.Key, PermissionCollection> pdMapping
policyInfoback to summary
private static volatile Policy.PolicyInfo policyInfo
UNSUPPORTED_EMPTY_COLLECTIONback to summary
public static final PermissionCollection UNSUPPORTED_EMPTY_COLLECTION

A read-only empty PermissionCollection instance.

Since
1.6

Constructor Detail

Policyback to summary
public Policy()

Constructor for subclasses to call.

Method Detail

addStaticPermsback to summary
private void addStaticPerms(PermissionCollection perms, PermissionCollection statics)

add static permissions to provided permission collection

checkPermissionback to summary
private static void checkPermission(String type)
getInstanceback to summary
public static Policy getInstance(String type, Policy.Parameters params) throws NoSuchAlgorithmException

References Deprecated

Policy.Parameters and Policy are deprecated or reference (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns a Policy object of the specified type.

This method traverses the list of registered security providers, starting with the most preferred provider. A new Policy object encapsulating the PolicySpi implementation from the first provider that supports the specified type is returned.

Note that the list of registered providers may be retrieved via the Security.getProviders() method.

Implementation Note

The JDK Reference Implementation additionally uses the jdk.security.provider.preferred Security property to determine the preferred provider order for the specified algorithm. This may be different than the order of providers returned by Security.getProviders().

Parameters
type:String

the specified Policy type. See the Policy section in the Java Security Standard Algorithm Names Specification for a list of standard Policy types.

params:Policy.Parameters

parameters for the Policy, which may be null.

Returns:Policy

the new Policy object

Annotations
@SuppressWarnings:removal
Exceptions
NoSuchAlgorithmException:
if no Provider supports a PolicySpi implementation for the specified type
IllegalArgumentException:
if the specified parameters are not understood by the PolicySpi implementation from the selected Provider
NullPointerException:
if type is null
SecurityException:
if the caller does not have permission to get a Policy instance for the specified type.
Since
1.6
See Also
Provider
getInstanceback to summary
public static Policy getInstance(String type, Policy.Parameters params, String provider) throws NoSuchProviderException, NoSuchAlgorithmException

References Deprecated

Policy.Parameters and Policy are deprecated or reference (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns a Policy object of the specified type.

A new Policy object encapsulating the PolicySpi implementation from the specified provider is returned. The specified provider must be registered in the provider list.

Note that the list of registered providers may be retrieved via the Security.getProviders() method.

Parameters
type:String

the specified Policy type. See the Policy section in the Java Security Standard Algorithm Names Specification for a list of standard Policy types.

params:Policy.Parameters

parameters for the Policy, which may be null.

provider:String

the provider.

Returns:Policy

the new Policy object

Annotations
@SuppressWarnings:removal
Exceptions
NoSuchProviderException:
if the specified provider is not registered in the security provider list
NoSuchAlgorithmException:
if the specified provider does not support a PolicySpi implementation for the specified type
IllegalArgumentException:
if the specified provider is null or empty, or if the specified parameters are not understood by the PolicySpi implementation from the specified provider
NullPointerException:
if type is null
SecurityException:
if the caller does not have permission to get a Policy instance for the specified type
Since
1.6
See Also
Provider
getInstanceback to summary
public static Policy getInstance(String type, Policy.Parameters params, Provider provider) throws NoSuchAlgorithmException

References Deprecated

Policy.Parameters and Policy are deprecated or reference (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns a Policy object of the specified type.

A new Policy object encapsulating the PolicySpi implementation from the specified provider is returned. Note that the specified provider does not have to be registered in the provider list.

Parameters
type:String

the specified Policy type. See the Policy section in the Java Security Standard Algorithm Names Specification for a list of standard Policy types.

params:Policy.Parameters

parameters for the Policy, which may be null.

provider:Provider

the Provider.

Returns:Policy

the new Policy object

Annotations
@SuppressWarnings:removal
Exceptions
NoSuchAlgorithmException:
if the specified Provider does not support a PolicySpi implementation for the specified type
IllegalArgumentException:
if the specified Provider is null, or if the specified parameters are not understood by the PolicySpi implementation from the specified Provider
NullPointerException:
if type is null
SecurityException:
if the caller does not have permission to get a Policy instance for the specified type
Since
1.6
See Also
Provider
getParametersback to summary
public Policy.Parameters getParameters()

References Deprecated

Policy.Parameters is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Return Policy parameters.

This Policy instance will only have parameters if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.

Returns:Policy.Parameters

Policy parameters, or null.

Since
1.6
getPermissionsback to summary
public PermissionCollection getPermissions(CodeSource codesource)

Return a PermissionCollection object containing the set of permissions granted to the specified CodeSource.

Applications are discouraged from calling this method since this operation may not be supported by all policy implementations. Applications should solely rely on the implies method to perform policy checks. If an application absolutely must call a getPermissions method, it should call getPermissions(ProtectionDomain).

The default implementation of this method returns Policy.UNSUPPORTED_EMPTY_COLLECTION. This method can be overridden if the policy implementation can return a set of permissions granted to a CodeSource.

Parameters
codesource:CodeSource

the CodeSource to which the returned PermissionCollection has been granted.

Returns:PermissionCollection

a set of permissions granted to the specified CodeSource. If this operation is supported, the returned set of permissions must be a new mutable instance and it must support heterogeneous Permission types. If this operation is not supported, Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.

getPermissionsback to summary
public PermissionCollection getPermissions(ProtectionDomain domain)

Return a PermissionCollection object containing the set of permissions granted to the specified ProtectionDomain.

Applications are discouraged from calling this method since this operation may not be supported by all policy implementations. Applications should rely on the implies method to perform policy checks.

The default implementation of this method first retrieves the permissions returned via getPermissions(CodeSource) (the CodeSource is taken from the specified ProtectionDomain), as well as the permissions located inside the specified ProtectionDomain. All of these permissions are then combined and returned in a new PermissionCollection object. If getPermissions(CodeSource) returns Policy.UNSUPPORTED_EMPTY_COLLECTION, then this method returns the permissions contained inside the specified ProtectionDomain in a new PermissionCollection object.

This method can be overridden if the policy implementation supports returning a set of permissions granted to a ProtectionDomain.

Parameters
domain:ProtectionDomain

the ProtectionDomain to which the returned PermissionCollection has been granted.

Returns:PermissionCollection

a set of permissions granted to the specified ProtectionDomain. If this operation is supported, the returned set of permissions must be a new mutable instance and it must support heterogeneous Permission types. If this operation is not supported, Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.

Since
1.4
getPolicyback to summary
public static Policy getPolicy()

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns the installed Policy object. This value should not be cached, as it may be changed by a call to setPolicy. This method first calls SecurityManager.checkPermission with a SecurityPermission("getPolicy") permission to ensure it's ok to get the Policy object.

Returns:Policy

the installed Policy.

Exceptions
SecurityException:
if a security manager exists and its checkPermission method doesn't allow getting the Policy object.
See Also
SecurityManager#checkPermission(Permission), setPolicy(java.security.Policy)
getPolicyNoCheckback to summary
pack-priv static Policy getPolicyNoCheck()

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns the installed Policy object, skipping the security check. Used by ProtectionDomain and getPolicy.

Returns:Policy

the installed Policy.

getProviderback to summary
public Provider getProvider()

Return the Provider of this policy.

This Policy instance will only have a provider if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.

Returns:Provider

the Provider of this policy, or null.

Since
1.6
getTypeback to summary
public String getType()

Return the type of this Policy.

This Policy instance will only have a type if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.

Returns:String

the type of this Policy, or null.

Since
1.6
handleExceptionback to summary
private static Policy handleException(NoSuchAlgorithmException nsae) throws NoSuchAlgorithmException

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

impliesback to summary
public boolean implies(ProtectionDomain domain, Permission permission)

Evaluates the global policy for the permissions granted to the ProtectionDomain and tests whether the permission is granted.

Parameters
domain:ProtectionDomain

the ProtectionDomain to test

permission:Permission

the Permission object to be tested for implication.

Returns:boolean

true if "permission" is a proper subset of a permission granted to this ProtectionDomain.

Since
1.4
See Also
java.security.ProtectionDomain
initPolicyback to summary
private static void initPolicy(final Policy p)

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Initialize superclass state such that a legacy provider can handle queries for itself.

Since
1.4
isSetback to summary
pack-priv static boolean isSet()

package private for AccessControlContext and ProtectionDomain

loadPolicyProviderback to summary
private static Policy loadPolicyProvider()

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Loads and instantiates a Policy implementation specified by the policy.provider security property. Note that this method should only be called by getPolicyNoCheck and from within a synchronized block with an intrinsic lock on the Policy.class.

refreshback to summary
public void refresh()

Refreshes/reloads the policy configuration. The behavior of this method depends on the implementation. For example, calling refresh on a file-based policy will cause the file to be re-read.

The default implementation of this method does nothing. This method should be overridden if a refresh operation is supported by the policy implementation.

setPolicyback to summary
public static void setPolicy(Policy p)

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Sets the system-wide Policy object. This method first calls SecurityManager.checkPermission with a SecurityPermission("setPolicy") permission to ensure it's ok to set the Policy.

Parameters
p:Policy

the new system Policy object.

Exceptions
SecurityException:
if a security manager exists and its checkPermission method doesn't allow setting the Policy.
See Also
SecurityManager#checkPermission(Permission), getPolicy()
java.security back to summary

public Interface Policy.Parameters

Known Direct Implementers
java.security.URIParameter
Annotations
@Deprecated
since:17
forRemoval:true

Deprecated

for removal since 17.

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

This represents a marker interface for Policy parameters.
Since
1.6
java.security back to summary

private Class Policy.PolicyDelegate

extends Policy
Class Inheritance

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

This subclass is returned by the getInstance calls. All Policy calls are delegated to the underlying PolicySpi.

Field Summary

Modifier and TypeField and Description
private Provider
p

private Policy.Parameters
params

References Deprecated Policy.Parameters is deprecated or references (maybe indirectly) at least one deprecated element.
private PolicySpi
spi

References Deprecated PolicySpi is deprecated or references (maybe indirectly) at least one deprecated element.
private String
Inherited from java.security.Policy:
UNSUPPORTED_EMPTY_COLLECTION

Constructor Summary

AccessConstructor and Description
private
PolicyDelegate(PolicySpi spi, Provider p, String type, Policy.Parameters params)
References Deprecated PolicySpi and Policy.Parameters are deprecated or reference (maybe indirectly) at least one deprecated element.

Method Summary

Modifier and TypeMethod and Description
public Policy.Parameters
getParameters()

Overrides java.security.Policy.getParameters.

References Deprecated Policy.Parameters is deprecated or references (maybe indirectly) at least one deprecated element.

Return Policy parameters.

public PermissionCollection
getPermissions(CodeSource
the CodeSource to which the returned PermissionCollection has been granted.
codesource
)

Overrides java.security.Policy.getPermissions.

Return a PermissionCollection object containing the set of permissions granted to the specified CodeSource.

public PermissionCollection
getPermissions(ProtectionDomain
the ProtectionDomain to which the returned PermissionCollection has been granted.
domain
)

Overrides java.security.Policy.getPermissions.

Return a PermissionCollection object containing the set of permissions granted to the specified ProtectionDomain.

public Provider
getProvider()

Overrides java.security.Policy.getProvider.

Return the Provider of this policy.

public String
getType()

Overrides java.security.Policy.getType.

Return the type of this Policy.

public boolean
implies(ProtectionDomain
the ProtectionDomain to test
domain
,
Permission
the Permission object to be tested for implication.
perm
)

Overrides java.security.Policy.implies.

Evaluates the global policy for the permissions granted to the ProtectionDomain and tests whether the permission is granted.

public void
refresh()

Overrides java.security.Policy.refresh.

Refreshes/reloads the policy configuration.

Inherited from java.security.Policy:
getInstancegetInstancegetInstancegetPolicygetPolicyNoCheckisSetsetPolicy

Field Detail

pback to summary
private Provider p
paramsback to summary
private Policy.Parameters params

References Deprecated

Policy.Parameters is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

spiback to summary
private PolicySpi spi

References Deprecated

PolicySpi is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Annotations
@SuppressWarnings:removal
typeback to summary
private String type

Constructor Detail

PolicyDelegateback to summary
private PolicyDelegate(PolicySpi spi, Provider p, String type, Policy.Parameters params)

References Deprecated

PolicySpi and Policy.Parameters are deprecated or reference (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method Detail

getParametersback to summary
public Policy.Parameters getParameters()

Overrides java.security.Policy.getParameters.

Doc from java.security.Policy.getParameters.

References Deprecated

Policy.Parameters is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Return Policy parameters.

This Policy instance will only have parameters if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.

Returns:Policy.Parameters

Policy parameters, or null.

Annotations
@Override
getPermissionsback to summary
public PermissionCollection getPermissions(CodeSource codesource)

Overrides java.security.Policy.getPermissions.

Doc from java.security.Policy.getPermissions.

Return a PermissionCollection object containing the set of permissions granted to the specified CodeSource.

Applications are discouraged from calling this method since this operation may not be supported by all policy implementations. Applications should solely rely on the implies method to perform policy checks. If an application absolutely must call a getPermissions method, it should call getPermissions(ProtectionDomain).

The default implementation of this method returns Policy.UNSUPPORTED_EMPTY_COLLECTION. This method can be overridden if the policy implementation can return a set of permissions granted to a CodeSource.

Parameters
codesource:CodeSource

the CodeSource to which the returned PermissionCollection has been granted.

Returns:PermissionCollection

a set of permissions granted to the specified CodeSource. If this operation is supported, the returned set of permissions must be a new mutable instance and it must support heterogeneous Permission types. If this operation is not supported, Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.

Annotations
@Override
getPermissionsback to summary
public PermissionCollection getPermissions(ProtectionDomain domain)

Overrides java.security.Policy.getPermissions.

Doc from java.security.Policy.getPermissions.

Return a PermissionCollection object containing the set of permissions granted to the specified ProtectionDomain.

Applications are discouraged from calling this method since this operation may not be supported by all policy implementations. Applications should rely on the implies method to perform policy checks.

The default implementation of this method first retrieves the permissions returned via getPermissions(CodeSource) (the CodeSource is taken from the specified ProtectionDomain), as well as the permissions located inside the specified ProtectionDomain. All of these permissions are then combined and returned in a new PermissionCollection object. If getPermissions(CodeSource) returns Policy.UNSUPPORTED_EMPTY_COLLECTION, then this method returns the permissions contained inside the specified ProtectionDomain in a new PermissionCollection object.

This method can be overridden if the policy implementation supports returning a set of permissions granted to a ProtectionDomain.

Parameters
domain:ProtectionDomain

the ProtectionDomain to which the returned PermissionCollection has been granted.

Returns:PermissionCollection

a set of permissions granted to the specified ProtectionDomain. If this operation is supported, the returned set of permissions must be a new mutable instance and it must support heterogeneous Permission types. If this operation is not supported, Policy.UNSUPPORTED_EMPTY_COLLECTION is returned.

Annotations
@Override
getProviderback to summary
public Provider getProvider()

Overrides java.security.Policy.getProvider.

Doc from java.security.Policy.getProvider.

Return the Provider of this policy.

This Policy instance will only have a provider if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.

Returns:Provider

the Provider of this policy, or null.

Annotations
@Override
getTypeback to summary
public String getType()

Overrides java.security.Policy.getType.

Doc from java.security.Policy.getType.

Return the type of this Policy.

This Policy instance will only have a type if it was obtained via a call to Policy.getInstance. Otherwise this method returns null.

Returns:String

the type of this Policy, or null.

Annotations
@Override
impliesback to summary
public boolean implies(ProtectionDomain domain, Permission perm)

Overrides java.security.Policy.implies.

Doc from java.security.Policy.implies.

Evaluates the global policy for the permissions granted to the ProtectionDomain and tests whether the permission is granted.

Parameters
domain:ProtectionDomain

the ProtectionDomain to test

perm:Permission

the Permission object to be tested for implication.

Returns:boolean

true if "permission" is a proper subset of a permission granted to this ProtectionDomain.

Annotations
@Override
refreshback to summary
public void refresh()

Overrides java.security.Policy.refresh.

Doc from java.security.Policy.refresh.

Refreshes/reloads the policy configuration. The behavior of this method depends on the implementation. For example, calling refresh on a file-based policy will cause the file to be re-read.

The default implementation of this method does nothing. This method should be overridden if a refresh operation is supported by the policy implementation.

Annotations
@Override
java.security back to summary

private Class Policy.PolicyInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final boolean
pack-priv final Policy
policy

References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.

Constructor Summary

AccessConstructor and Description
pack-priv
PolicyInfo(Policy policy, boolean initialized)
References Deprecated Policy is deprecated or references (maybe indirectly) at least one deprecated element.

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

initializedback to summary
pack-priv final boolean initialized
policyback to summary
pack-priv final Policy policy

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Constructor Detail

PolicyInfoback to summary
pack-priv PolicyInfo(Policy policy, boolean initialized)

References Deprecated

Policy is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

java.security back to summary

private Class Policy.UnsupportedEmptyCollection

extends PermissionCollection
Class Inheritance

This class represents a read-only empty PermissionCollection object that is returned from the getPermissions(CodeSource) and getPermissions(ProtectionDomain) methods in the Policy class when those operations are not supported by the Policy implementation.

Field Summary

Modifier and TypeField and Description
private Permissions
private static final long

Constructor Summary

AccessConstructor and Description
public
UnsupportedEmptyCollection()

Create a read-only empty PermissionCollection object.

Method Summary

Modifier and TypeMethod and Description
public void
add(Permission
the Permission object to add.
permission
)

Implements abstract java.security.PermissionCollection.add.

Adds a permission object to the current collection of permission objects.

public Enumeration<Permission>

Returns:

an enumeration of all the Permissions.
elements
()

Implements abstract java.security.PermissionCollection.elements.

Returns an enumeration of all the Permission objects in the collection.

public boolean

Returns:

true if "permission" is implied by the permissions in the collection, false if not.
implies
(Permission
the Permission object to compare.
permission
)

Implements abstract java.security.PermissionCollection.implies.

Checks to see if the specified permission is implied by the collection of Permission objects held in this PermissionCollection.

Inherited from java.security.PermissionCollection:
elementsAsStreamisReadOnlysetReadOnlytoString

Field Detail

permsback to summary
private Permissions perms
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.PermissionCollection.serialVersionUID.

Annotations
@Serial

Constructor Detail

UnsupportedEmptyCollectionback to summary
public UnsupportedEmptyCollection()

Create a read-only empty PermissionCollection object.

Method Detail

addback to summary
public void add(Permission permission)

Implements abstract java.security.PermissionCollection.add.

Adds a permission object to the current collection of permission objects.

Parameters
permission:Permission

the Permission object to add.

Annotations
@Override
Exceptions
SecurityException:
if this PermissionCollection object has been marked readonly
elementsback to summary
public Enumeration<Permission> elements()

Implements abstract java.security.PermissionCollection.elements.

Returns an enumeration of all the Permission objects in the collection.

Returns:Enumeration<Permission>

an enumeration of all the Permissions.

Annotations
@Override
impliesback to summary
public boolean implies(Permission permission)

Implements abstract java.security.PermissionCollection.implies.

Checks to see if the specified permission is implied by the collection of Permission objects held in this PermissionCollection.

Parameters
permission:Permission

the Permission object to compare.

Returns:boolean

true if "permission" is implied by the permissions in the collection, false if not.

Annotations
@Override