Class Policy
Policy object was responsible for determining whether code
 executing in the Java runtime environment had permission to perform a
 security-sensitive operation. This feature no longer exists.- Since:
- 1.2
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfaceDeprecated, for removal: This API element is subject to removal in a future version.This class was only useful in conjunction with the Security Manager, which is no longer supported.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final PermissionCollectionDeprecated, for removal: This API element is subject to removal in a future version.A read-only empty PermissionCollection instance.
- 
Constructor SummaryConstructorsConstructorDescriptionPolicy()Deprecated, for removal: This API element is subject to removal in a future version.Constructor for subclasses to call.
- 
Method SummaryModifier and TypeMethodDescriptionstatic PolicygetInstance(String type, Policy.Parameters params) Deprecated, for removal: This API element is subject to removal in a future version.Returns a Policy object of the specified type.static PolicygetInstance(String type, Policy.Parameters params, String provider) Deprecated, for removal: This API element is subject to removal in a future version.Returns aPolicyobject of the specified type.static PolicygetInstance(String type, Policy.Parameters params, Provider provider) Deprecated, for removal: This API element is subject to removal in a future version.Returns aPolicyobject of the specified type.Deprecated, for removal: This API element is subject to removal in a future version.ReturnPolicyparameters.getPermissions(CodeSource codesource) Deprecated, for removal: This API element is subject to removal in a future version.Return a PermissionCollection object containing the set of permissions granted to the specified CodeSource.getPermissions(ProtectionDomain domain) Deprecated, for removal: This API element is subject to removal in a future version.Return a PermissionCollection object containing the set of permissions granted to the specified ProtectionDomain.static PolicyDeprecated, for removal: This API element is subject to removal in a future version.Returns aPolicyobject that grants no permissions.Deprecated, for removal: This API element is subject to removal in a future version.Return theProviderof this policy.getType()Deprecated, for removal: This API element is subject to removal in a future version.Return the type of thisPolicy.booleanimplies(ProtectionDomain domain, Permission permission) Deprecated, for removal: This API element is subject to removal in a future version.Evaluates the permissions granted to the ProtectionDomain and tests whether the permission is granted.voidrefresh()Deprecated, for removal: This API element is subject to removal in a future version.Refreshes/reloads the policy configuration.static voidDeprecated, for removal: This API element is subject to removal in a future version.ThrowsUnsupportedOperationException.
- 
Field Details- 
UNSUPPORTED_EMPTY_COLLECTIONDeprecated, for removal: This API element is subject to removal in a future version.A read-only empty PermissionCollection instance.- Since:
- 1.6
 
 
- 
- 
Constructor Details- 
Policypublic Policy()Deprecated, for removal: This API element is subject to removal in a future version.Constructor for subclasses to call.
 
- 
- 
Method Details- 
getPolicyDeprecated, for removal: This API element is subject to removal in a future version.Returns aPolicyobject that grants no permissions. Specifically:-  The getParametersmethod returnsnull.
-  The getPermissions(CodeSource)andgetPermissions(ProtectionDomain)methods return a read-only emptyPermissionCollection.
-  The impliesmethod always returnsfalse.
 - API Note:
- This method originally returned the installed Policyobject, or if noPolicyobject had been installed, a defaultPolicyimplementation. Installing a system-widePolicyobject is no longer supported. This method always returns a defaultPolicyobject that grants no permissions. APolicyobject was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for this method.
- Returns:
- a Policyobject that grants no permissions
- See Also:
 
-  The 
- 
setPolicyDeprecated, for removal: This API element is subject to removal in a future version.ThrowsUnsupportedOperationException. Setting a system-widePolicyobject is not supported.- API Note:
- This method originally installed the system-wide
    Policyobject. Installing a system-widePolicyobject is no longer supported. APolicyobject was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for this method.
- Parameters:
- p- ignored
- Throws:
- UnsupportedOperationException- always
- See Also:
 
- 
getInstancepublic static Policy getInstance(String type, Policy.Parameters params) throws NoSuchAlgorithmException Deprecated, for removal: This API element is subject to removal in a future version.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 Policyobject encapsulating thePolicySpiimplementation 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.preferredSecurityproperty to determine the preferred provider order for the specified algorithm. This may be different than the order of providers returned bySecurity.getProviders().
- Parameters:
- type- the specified Policy type
- params- parameters for the- Policy, which may be- null.
- Returns:
- the new Policyobject
- Throws:
- IllegalArgumentException- if the specified parameters are not understood by the- PolicySpiimplementation from the selected- Provider
- NoSuchAlgorithmException- if no- Providersupports a- PolicySpiimplementation for the specified type
- NullPointerException- if- typeis- null
- Since:
- 1.6
- See Also:
 
- 
getInstancepublic static Policy getInstance(String type, Policy.Parameters params, String provider) throws NoSuchProviderException, NoSuchAlgorithmException Deprecated, for removal: This API element is subject to removal in a future version.Returns aPolicyobject of the specified type.A new Policyobject encapsulating thePolicySpiimplementation 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- the specified Policy type
- params- parameters for the- Policy, which may be- null.
- provider- the provider.
- Returns:
- the new Policyobject
- Throws:
- IllegalArgumentException- if the specified provider is- nullor empty, or if the specified parameters are not understood by the- PolicySpiimplementation from the specified provider
- NoSuchAlgorithmException- if the specified provider does not support a- PolicySpiimplementation for the specified type
- NoSuchProviderException- if the specified provider is not registered in the security provider list
- NullPointerException- if- typeis- null
- Since:
- 1.6
- See Also:
 
- 
getInstancepublic static Policy getInstance(String type, Policy.Parameters params, Provider provider) throws NoSuchAlgorithmException Deprecated, for removal: This API element is subject to removal in a future version.Returns aPolicyobject of the specified type.A new Policyobject encapsulating thePolicySpiimplementation from the specified provider is returned. Note that the specified provider does not have to be registered in the provider list.- Parameters:
- type- the specified Policy type
- params- parameters for the- Policy, which may be- null.
- provider- the- Provider.
- Returns:
- the new Policyobject
- Throws:
- IllegalArgumentException- if the specified- Provideris- null, or if the specified parameters are not understood by the- PolicySpiimplementation from the specified- Provider
- NoSuchAlgorithmException- if the specified- Providerdoes not support a- PolicySpiimplementation for the specified type
- NullPointerException- if- typeis- null
- Since:
- 1.6
- See Also:
 
- 
getProviderDeprecated, for removal: This API element is subject to removal in a future version.Return theProviderof this policy.This Policyinstance will only have a provider if it was obtained via a call toPolicy.getInstance. Otherwise this method returnsnull.- Returns:
- the Providerof this policy, ornull.
- Since:
- 1.6
 
- 
getTypeDeprecated, for removal: This API element is subject to removal in a future version.Return the type of thisPolicy.This Policyinstance will only have a type if it was obtained via a call toPolicy.getInstance. Otherwise this method returnsnull.- Returns:
- the type of this Policy, ornull.
- Since:
- 1.6
 
- 
getParametersDeprecated, for removal: This API element is subject to removal in a future version.ReturnPolicyparameters.This Policyinstance will only have parameters if it was obtained via a call toPolicy.getInstance. Otherwise this method returnsnull.- Returns:
- Policyparameters, or- null.
- Since:
- 1.6
 
- 
getPermissionsDeprecated, for removal: This API element is subject to removal in a future version.Return a PermissionCollection object containing the set of permissions granted to the specified CodeSource.The default implementation of this method ignores the CodeSource and returns Policy.UNSUPPORTED_EMPTY_COLLECTION. - Parameters:
- codesource- ignored
- 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.
 
- 
getPermissionsDeprecated, for removal: This API element is subject to removal in a future version.Return a PermissionCollection object containing the set of permissions granted to the specified ProtectionDomain.The default implementation of this method ignores the ProtectionDomain and returns Policy.UNSUPPORTED_EMPTY_COLLECTION. - Parameters:
- domain- ignored
- 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.
- Since:
- 1.4
 
- 
impliesDeprecated, for removal: This API element is subject to removal in a future version.Evaluates the permissions granted to the ProtectionDomain and tests whether the permission is granted.The default implementation of this method ignores the ProtectionDomain and Permission parameters and always returns false. - Parameters:
- domain- ignored
- permission- ignored
- Returns:
- falsealways
- Since:
- 1.4
- See Also:
 
- 
refreshpublic void refresh()Deprecated, for removal: This API element is subject to removal in a future version.Refreshes/reloads the policy configuration.The default implementation of this method does nothing. 
 
- 
Policyobject is no longer supported. The setPolicy method has been changed to always throwUnsupportedOperationException. The getPolicy method has been changed to always return aPolicyobject that grants no permissions. There is no replacement for the Security Manager or this class.