org.apache.felix.ipojo.util

## Class SecurityHelper

- java.lang.Object
- - org.apache.felix.ipojo.util.SecurityHelper

    public class SecurityHelper
    extends java.lang.Object

Methods checking security permissions.

Author:
  Felix Project Team

### Constructor Summary

Constructors
Constructor and Description
`SecurityHelper()`

### Method Summary

All Methods Static Methods Concrete Methods
`static boolean` `canRegisterService(org.osgi.framework.BundleContext context)` Checks that the given bundle context is in a state where it is possible to register services.
`static boolean` `canUpdateService(org.osgi.framework.ServiceRegistration registration)` Checks that the given service registration can be updated.
`static boolean` `hasPermissionToGetService(java.lang.String itf, org.osgi.framework.BundleContext comp)` Checks if the component bundle context has enough permission to get the given service.
`static boolean` `hasPermissionToGetServices(java.lang.String[] itfs, org.osgi.framework.BundleContext comp)` Checks if the component bundle context has enough permission to get the given services.
`static boolean` `hasPermissionToRegisterService(java.lang.String itf, org.osgi.framework.BundleContext comp)` Checks if the component bundle context has enough permission to register the given service.
`static boolean` `hasPermissionToRegisterServices(java.lang.String[] itfs, org.osgi.framework.BundleContext comp)` Checks if the component bundle context has enough permission to register the given services.
`static org.osgi.framework.BundleContext` `selectContextToGetService(java.lang.String itf, org.osgi.framework.BundleContext comp, org.osgi.framework.BundleContext ipojo)` Gets a bundle context to get the given service.
`static org.osgi.framework.BundleContext` `selectContextToRegisterService(java.lang.String itf, org.osgi.framework.BundleContext comp, org.osgi.framework.BundleContext ipojo)` Gets a bundle context to register the given service.
`static org.osgi.framework.BundleContext` `selectContextToRegisterServices(java.lang.String[] itfs, org.osgi.framework.BundleContext comp, org.osgi.framework.BundleContext ipojo)` Gets a bundle context to register the given services.

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

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

### Constructor Detail

#### SecurityHelper

    public SecurityHelper()

### Method Detail

#### selectContextToRegisterServices

    public static org.osgi.framework.BundleContext selectContextToRegisterServices(java.lang.String[] itfs,
                                                                                   org.osgi.framework.BundleContext comp,
                                                                                   org.osgi.framework.BundleContext ipojo)

Gets a bundle context to register the given services. This method can be used only if iPOJO is able to registers the services (so for ManagedServiceFactory, Factory and Architecture)

Parameters:
  `itfs` - the service interfaces
  `comp` - the component bundle context
  `ipojo` - the ipojo bundle context
Returns:
  `comp` if the bundle has enough permission to register the service, `ipojo` otherwise.

#### selectContextToRegisterService

    public static org.osgi.framework.BundleContext selectContextToRegisterService(java.lang.String itf,
                                                                                  org.osgi.framework.BundleContext comp,
                                                                                  org.osgi.framework.BundleContext ipojo)

Gets a bundle context to register the given service. This method can be used only if iPOJO is able to registers the service (so for ManagedServiceFactory, Factory and Architecture)

Parameters:
  `itf` - the service interface
  `comp` - the component bundle context
  `ipojo` - the ipojo bundle context
Returns:
  `comp` if the bundle has enough permission to register the service, `ipojo` otherwise.

#### selectContextToGetService

    public static org.osgi.framework.BundleContext selectContextToGetService(java.lang.String itf,
                                                                             org.osgi.framework.BundleContext comp,
                                                                             org.osgi.framework.BundleContext ipojo)

Gets a bundle context to get the given service. This method can be used only if iPOJO is able to get the service (so for ManagedServiceFactory, Factory, Architecture and LogService)

Parameters:
  `itf` - the service interface
  `comp` - the component bundle context
  `ipojo` - the ipojo bundle context
Returns:
  `comp` if the bundle has enough permission to get the service, `ipojo` otherwise.

#### hasPermissionToGetService

    public static boolean hasPermissionToGetService(java.lang.String itf,
                                                    org.osgi.framework.BundleContext comp)

Checks if the component bundle context has enough permission to get the given service.

Parameters:
  `itf` - the service interface
  `comp` - the component bundle context
Returns:
  `true` if the bundle has enough permission to get the service, `false` otherwise.

#### hasPermissionToGetServices

    public static boolean hasPermissionToGetServices(java.lang.String[] itfs,
                                                     org.osgi.framework.BundleContext comp)

Checks if the component bundle context has enough permission to get the given services.

Parameters:
  `itfs` - the service interfaces
  `comp` - the component bundle context
Returns:
  `true` if the bundle has enough permission to get the services, `false` otherwise.

#### hasPermissionToRegisterService

    public static boolean hasPermissionToRegisterService(java.lang.String itf,
                                                         org.osgi.framework.BundleContext comp)

Checks if the component bundle context has enough permission to register the given service.

Parameters:
  `itf` - the service interface
  `comp` - the component bundle context
Returns:
  `true` if the bundle has enough permission to register the service, `false` otherwise.

#### hasPermissionToRegisterServices

    public static boolean hasPermissionToRegisterServices(java.lang.String[] itfs,
                                                          org.osgi.framework.BundleContext comp)

Checks if the component bundle context has enough permission to register the given services.

Parameters:
  `itfs` - the service interfaces
  `comp` - the component bundle context
Returns:
  `true` if the bundle has enough permission to register the services, `false` otherwise.

#### canRegisterService

    public static boolean canRegisterService(org.osgi.framework.BundleContext context)

Checks that the given bundle context is in a state where it is possible to register services. This methods ensures that the bundle associated to the given context, is starting or active.

Parameters:
  `context` - the bundle context
Returns:
  true if the context can register a service, false otherwise.

#### canUpdateService

    public static boolean canUpdateService(org.osgi.framework.ServiceRegistration registration)

Checks that the given service registration can be updated. This methods ensures that the bundle associated to the given service, is starting or active.

Parameters:
  `registration` - the service registration
Returns:
  true if the service can be updated, false otherwise.