Record Class PolicyManager.ModuleEntitlements
- Record Components:
componentName- the plugin name or else one of the special component names like "(server)".
- Enclosing class:
PolicyManager
FileAccessTree for the special case of filesystem entitlements.
We use layers when computing PolicyManager.ModuleEntitlements; first, we check whether the module we are building it for is in the
server layer (PolicyManager.SERVER_LAYER_MODULES) (*).
If it is, we use the server policy, using the same caller class module name as the scope, and read the entitlements for that scope.
Otherwise, we use the PluginResolver to identify the correct plugin layer and find the policy for it (if any).
If the plugin is modular, we again use the same caller class module name as the scope, and read the entitlements for that scope.
If it's not, we use the single ALL-UNNAMED scope – in this case there is one scope and all entitlements apply
to all the plugin code.
(*) implementation detail: this is currently done in an indirect way: we know the module is not in the system layer
(otherwise the check would have been already trivially allowed), so we just check that the module is named, and it belongs to the
boot ModuleLayer. We might want to change this in the future to make it more consistent/easier to maintain.
-
Constructor Summary
ConstructorsConstructorDescriptionModuleEntitlements(String componentName, String moduleName, Map<Class<? extends Entitlement>, List<Entitlement>> entitlementsByType, FileAccessTree fileAccess) Creates an instance of aModuleEntitlementsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecomponentNamerecord component.Map<Class<? extends Entitlement>, List<Entitlement>> Returns the value of theentitlementsByTyperecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefileAccessrecord component.<E extends Entitlement>
Stream<E> getEntitlements(Class<E> entitlementClass) booleanhasEntitlement(Class<? extends Entitlement> entitlementClass) final inthashCode()Returns a hash code value for this object.Returns the value of themoduleNamerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ModuleEntitlements
public ModuleEntitlements(String componentName, String moduleName, Map<Class<? extends Entitlement>, List<Entitlement>> entitlementsByType, FileAccessTree fileAccess) Creates an instance of aModuleEntitlementsrecord class.- Parameters:
componentName- the value for thecomponentNamerecord componentmoduleName- the value for themoduleNamerecord componententitlementsByType- the value for theentitlementsByTyperecord componentfileAccess- the value for thefileAccessrecord component
-
-
Method Details
-
hasEntitlement
-
getEntitlements
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
componentName
Returns the value of thecomponentNamerecord component.- Returns:
- the value of the
componentNamerecord component
-
moduleName
Returns the value of themoduleNamerecord component.- Returns:
- the value of the
moduleNamerecord component
-
entitlementsByType
Returns the value of theentitlementsByTyperecord component.- Returns:
- the value of the
entitlementsByTyperecord component
-
fileAccess
Returns the value of thefileAccessrecord component.- Returns:
- the value of the
fileAccessrecord component
-