Package org.apache.felix.framework.security.permissionadmin

## Class PermissionAdminImpl

- java.lang.Object
- - org.apache.felix.framework.security.permissionadmin.PermissionAdminImpl

All Implemented Interfaces:
  `org.osgi.service.permissionadmin.PermissionAdmin`

    public final class PermissionAdminImpl
    extends java.lang.Object
    implements org.osgi.service.permissionadmin.PermissionAdmin

This class is a relatively straight forward implementation of the PermissionAdmin service. The only somewhat involved thing is that it respects the presents of a conditionalpermissionadmin service as per spec.

### Constructor Summary

Constructors
`PermissionAdminImpl​(Permissions permissions, PropertiesCache cache)`

### Method Summary

All Methods Instance Methods Concrete Methods
`org.osgi.service.permissionadmin.PermissionInfo[]` `getDefaultPermissions()`
`java.lang.String[]` `getLocations()`
`org.osgi.service.permissionadmin.PermissionInfo[]` `getPermissions​(java.lang.String location)`

`java.lang.Boolean`

`hasPermission​(java.lang.String location, org.osgi.framework.Bundle bundle, java.security.Permission permission, ConditionalPermissionAdminImpl cpai, java.security.ProtectionDomain pd, org.apache.felix.framework.cache.Content content)`

This will do the actual permission check as described in the core spec 10.2 It will respect a present condpermadmin service as described in 9.10.

`void` `setDefaultPermissions​(org.osgi.service.permissionadmin.PermissionInfo[] permissions)`
`void` `setPermissions​(java.lang.String location, org.osgi.service.permissionadmin.PermissionInfo[] permissions)`

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

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

### Constructor Detail

#### PermissionAdminImpl

    public PermissionAdminImpl​(Permissions permissions,
                               PropertiesCache cache)
                        throws java.io.IOException

Throws:
  `java.io.IOException`

### Method Detail

#### getDefaultPermissions

    public org.osgi.service.permissionadmin.PermissionInfo[] getDefaultPermissions()

Specified by:
  `getDefaultPermissions` in interface `org.osgi.service.permissionadmin.PermissionAdmin`

#### getLocations

    public java.lang.String[] getLocations()

Specified by:
  `getLocations` in interface `org.osgi.service.permissionadmin.PermissionAdmin`

#### getPermissions

    public org.osgi.service.permissionadmin.PermissionInfo[] getPermissions​(java.lang.String location)

Specified by:
  `getPermissions` in interface `org.osgi.service.permissionadmin.PermissionAdmin`

#### hasPermission

    public java.lang.Boolean hasPermission​(java.lang.String location,
                                           org.osgi.framework.Bundle bundle,
                                           java.security.Permission permission,
                                           ConditionalPermissionAdminImpl cpai,
                                           java.security.ProtectionDomain pd,
                                           org.apache.felix.framework.cache.Content content)

This will do the actual permission check as described in the core spec 10.2 It will respect a present condpermadmin service as described in 9.10.

Parameters:
  `location` - the location of the bundle.
  `bundle` - the bundle in question.
  `permission` - the permission to check.
  `cpai` - A condpermadmin if one is present else null.
  `pd` - the protectiondomain
Returns:
  Boolean.TRUE if the location is bound and the permission is granted or if there is no cpa and the default permissions imply the permission Boolean.FALSE otherwise unless the location is not bound and their is a cpa in which case null is returned.

#### setDefaultPermissions

    public void setDefaultPermissions​(org.osgi.service.permissionadmin.PermissionInfo[] permissions)

Specified by:
  `setDefaultPermissions` in interface `org.osgi.service.permissionadmin.PermissionAdmin`

#### setPermissions

    public void setPermissions​(java.lang.String location,
                               org.osgi.service.permissionadmin.PermissionInfo[] permissions)

Specified by:
  `setPermissions` in interface `org.osgi.service.permissionadmin.PermissionAdmin`