Class PolicyFileProvider
UmbrellaGrantPermissions as shorthand notation for GrantPermissions covering all permissions authorized to given protection domains.- Since:
- 2.0
com.sun.jini.impl - This implementation's no-argument constructor uses a default class name of
"sun.security.provider.PolicyFile"to instantiate base policy objects, if thenet.jini.security.policy.PolicyFileProvider.basePolicyClasssecurity property is not set. - Author:
- Sun Microsystems, Inc.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.security.Policy
Policy.Parameters -
Field Summary
Fields inherited from class java.security.Policy
UNSUPPORTED_EMPTY_COLLECTION -
Constructor Summary
ConstructorsConstructorDescriptionCreates aPolicyFileProviderwhose starting set of permission mappings is the same as those that would result from constructing a new instance of the J2SE default security policy provider with the currentjava.security.policysystem property setting (if any), except thatUmbrellaGrantPermissions are expanded intoGrantPermissions as described in the documentation forUmbrellaGrantPermission.PolicyFileProvider(String policyFile) Creates aPolicyFileProviderwhose starting set of permission mappings is the same as those that would result from constructing a new instance of the J2SE default security policy provider with thejava.security.policysystem property set to the value ofpolicyFile, except thatUmbrellaGrantPermissions are expanded intoGrantPermissions as described in the documentation forUmbrellaGrantPermission. -
Method Summary
Modifier and TypeMethodDescriptiongetPermissions(CodeSource source) Behaves as specified byPolicy.getPermissions(CodeSource).getPermissions(ProtectionDomain domain) Behaves as specified byPolicy.getPermissions(ProtectionDomain).booleanimplies(ProtectionDomain domain, Permission permission) Behaves as specified byPolicy.implies(java.security.ProtectionDomain, java.security.Permission).voidrefresh()Refreshes the policy configuration by callingrefreshon the base policy.Methods inherited from class java.security.Policy
getInstance, getInstance, getInstance, getParameters, getPolicy, getProvider, getType, setPolicy
-
Constructor Details
-
PolicyFileProvider
Creates aPolicyFileProviderwhose starting set of permission mappings is the same as those that would result from constructing a new instance of the J2SE default security policy provider with the currentjava.security.policysystem property setting (if any), except thatUmbrellaGrantPermissions are expanded intoGrantPermissions as described in the documentation forUmbrellaGrantPermission.The constructed
PolicyFileProvidercontains an instance of the J2SE default security policy provider, which is created as follows: if thenet.jini.security.policy.PolicyFileProvider.basePolicyClasssecurity property is set, then its value is interpreted as the class name of the base (underlying) J2SE default policy provider; otherwise, an implementation-specific default class name is used. The base policy is then instantiated using the no-arg public constructor of the named class. If the base policy class is not found or is not instantiable via a public no-arg constructor, or if invocation of its constructor fails, then aPolicyInitializationExceptionis thrown.Note that this constructor requires the appropriate
"getProperty"SecurityPermissionto read thenet.jini.security.policy.PolicyFileProvider.basePolicyClasssecurity property, and may require"accessClassInPackage.*"RuntimePermissions, depending on the package of the base policy class.- Throws:
PolicyInitializationException- if unable to construct the base policySecurityException- if there is a security manager and the calling context does not have adequate permissions to read thenet.jini.security.policy.PolicyFileProvider.basePolicyClasssecurity property, or if the calling context does not have adequate permissions to access the base policy class
-
PolicyFileProvider
Creates aPolicyFileProviderwhose starting set of permission mappings is the same as those that would result from constructing a new instance of the J2SE default security policy provider with thejava.security.policysystem property set to the value ofpolicyFile, except thatUmbrellaGrantPermissions are expanded intoGrantPermissions as described in the documentation forUmbrellaGrantPermission.The constructed
PolicyFileProvidercontains an instance of the J2SE default security policy provider, which is created as described in the documentation forPolicyFileProvider(). Before instantiating the base (underlying) J2SE default policy provider, this constructor sets thejava.security.policysystem property to the value ofpolicyFile; after instantiation of the base policy instance has completed (normally or otherwise), thejava.security.policysystem property is reset to its prior value. Internal synchronization ensures that concurrent calls to this constructor and/or therefresh()method of this class (which may also modifyjava.security.policy) will not interfere with thejava.security.policyvalues set and restored by each. No synchronization is done with any other accesses or modifications tojava.security.policy.Note that this constructor requires
PropertyPermissionto read and write thejava.security.policysystem property,SecurityPermissionto read thenet.jini.security.policy.PolicyFileProvider.basePolicyClasssecurity property, and may require"accessClassInPackage.*"RuntimePermissions, depending on the package of the base policy class.- Parameters:
policyFile- URL string specifying location of the policy file to use- Throws:
PolicyInitializationException- if unable to construct the base policySecurityException- if there is a security manager and the calling context does not have adequate permissions to read and write thejava.security.policysystem property, to read thenet.jini.security.policy.PolicyFileProvider.basePolicyClasssecurity property, or to access the base policy classNullPointerException- ifpolicyFileisnull
-
-
Method Details
-
getPermissions
Behaves as specified byPolicy.getPermissions(CodeSource).- Overrides:
getPermissionsin classPolicy
-
getPermissions
Behaves as specified byPolicy.getPermissions(ProtectionDomain).- Overrides:
getPermissionsin classPolicy
-
implies
Behaves as specified byPolicy.implies(java.security.ProtectionDomain, java.security.Permission). -
refresh
public void refresh()Refreshes the policy configuration by callingrefreshon the base policy. If thisPolicyFileProviderinstance was constructed with an explicit policy file value, then thejava.security.policysystem property is set to that value prior to invokingrefreshon the base policy; once the base policyrefreshcall has completed, thejava.security.policysystem property is reset to its prior value. Internal synchronization ensures that concurrent invocations of this method and/or thePolicyFileProvider(String)constructor (which also modifiesjava.security.policy) will not interfere with thejava.security.policyvalues set and restored by each. No synchronization is done with any other accesses or modifications tojava.security.policy.
-