Package org.jboss.modules.security

# Class ModularProtectionDomain

java.lang.Object
java.security.ProtectionDomain
org.jboss.modules.security.ModularProtectionDomain

public class ModularProtectionDomain extends ProtectionDomain
A protection domain which has a (modular) class loader but whose dynamicity is selectable.

Author:
  David M. Lloyd

## Constructor Summary

Constructors
Constructor
Description
`ModularProtectionDomain(CodeSource codeSource, PermissionCollection permissions, ModuleClassLoader moduleClassLoader)`
Construct a new, static instance.
`ModularProtectionDomain(CodeSource codeSource, PermissionCollection permissions, ModuleClassLoader moduleClassLoader, boolean dynamic)`
Construct a new instance.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`implies(Permission permission)`
Determine if the permission collection of this protection domain implies the given permission.
`String`
`toString()`
Get a string representation of this protection domain.

### Methods inherited from class java.security.ProtectionDomain

`getClassLoader, getCodeSource, getPermissions, getPrincipals, staticPermissionsOnly`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### ModularProtectionDomain

public ModularProtectionDomain(CodeSource codeSource, PermissionCollection permissions, ModuleClassLoader moduleClassLoader, boolean dynamic)
Construct a new instance. The `dynamic` parameter determines whether the policy is consulted for permission checks; if `false`, then only the specified permission collection is consulted.

Parameters:
  `codeSource` - the code source of the protection domain (must not be `null`)
  `permissions` - the permission collection (must not be `null`)
  `moduleClassLoader` - the module class loader (must not be `null`)
  `dynamic` - `true` if the protection domain should be dynamic, `false` otherwise

### ModularProtectionDomain

public ModularProtectionDomain(CodeSource codeSource, PermissionCollection permissions, ModuleClassLoader moduleClassLoader)
Construct a new, static instance. Only the specified permission collection is consulted for permission checks.

Parameters:
  `codeSource` - the code source of the protection domain (must not be `null`)
  `permissions` - the permission collection (must not be `null`)
  `moduleClassLoader` - the module class loader (must not be `null`)

## Method Details

### implies

public boolean implies(Permission permission)
Determine if the permission collection of this protection domain implies the given permission. This is just a shortcut for calling `getPermissions().implies(permission)`.

Overrides:
  `implies` in class `ProtectionDomain`
Parameters:
  `permission` - the permission to check (must not be `null`)
Returns:
  `true` if the permission is implied, `false` otherwise.

### toString

public String toString()
Get a string representation of this protection domain.

Overrides:
  `toString` in class `ProtectionDomain`
Returns:
  the string representation (not `null`)