Search in sources :

Example 1 with EndpointPermission

use of org.osgi.service.remoteserviceadmin.EndpointPermission in project ecf by eclipse.

the class RemoteServiceAdmin method publishEvent.

private void publishEvent(final RemoteServiceAdminEvent event, EndpointDescription endpointDescription) {
    // send event synchronously to RemoteServiceAdminListeners
    EndpointPermission perm = new EndpointPermission(endpointDescription, Activator.getDefault().getFrameworkUUID(), EndpointPermission.READ);
    // notify synchronously all appropriate listeners (those with READ
    // permission)
    final RemoteServiceAdminListener[] listeners = getListeners(perm);
    if (listeners != null)
        for (int i = 0; i < listeners.length; i++) {
            final RemoteServiceAdminListener listener = listeners[i];
            SafeRunner.run(new ISafeRunnable() {

                public void handleException(Throwable exception) {
                    logError(// $NON-NLS-1$
                    "publishEvent", // $NON-NLS-1$
                    "Exeption in RemoteServiceAdminListener.remoteAdminEvent for listener=" + listener, exception);
                }

                public void run() throws Exception {
                    listener.remoteAdminEvent(event);
                }
            });
        }
    // Now also post the event asynchronously to EventAdmin
    postEvent(event, endpointDescription);
}
Also used : RemoteServiceAdminListener(org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener) ISafeRunnable(org.eclipse.core.runtime.ISafeRunnable) EndpointPermission(org.osgi.service.remoteserviceadmin.EndpointPermission)

Example 2 with EndpointPermission

use of org.osgi.service.remoteserviceadmin.EndpointPermission in project ecf by eclipse.

the class RemoteServiceAdmin method checkEndpointPermission.

private void checkEndpointPermission(org.osgi.service.remoteserviceadmin.EndpointDescription endpointDescription, String permissionType) throws SecurityException {
    SecurityManager sm = System.getSecurityManager();
    if (sm == null)
        return;
    sm.checkPermission(new EndpointPermission(endpointDescription, Activator.getDefault().getFrameworkUUID(), permissionType));
}
Also used : EndpointPermission(org.osgi.service.remoteserviceadmin.EndpointPermission)

Aggregations

EndpointPermission (org.osgi.service.remoteserviceadmin.EndpointPermission)2 ISafeRunnable (org.eclipse.core.runtime.ISafeRunnable)1 RemoteServiceAdminListener (org.osgi.service.remoteserviceadmin.RemoteServiceAdminListener)1