Ejemplo n.º 1
0
  public void requestHandlerRemoved(ServiceReference<RequestHandler> ref) {

    RequestHandler handler = registeredHandlers.remove(ref);
    System.out.println("Un-Registering Request Handler: " + handler.getClass().getName());
    handler
        .getHandles()
        .forEach(
            (k, v) -> {
              handlerMapping.remove(k);
            });
    registeredHandlers.remove(ref);
  }
Ejemplo n.º 2
0
 @ServiceDependency(removed = "requestHandlerRemoved", required = false)
 public void requestHandlerAdded(ServiceReference<RequestHandler> ref, RequestHandler handler) {
   System.out.println("Registering Request Handler: " + handler.getClass().getName());
   registeredHandlers.put(ref, handler);
   handler
       .getHandles()
       .forEach(
           (k, v) -> {
             handlerMapping.put(
                 k.getName(),
                 new HandlerMapping()
                     .setRequestClassName(k.getName())
                     .setRequestHandlerInstance(handler)
                     .setAuthorizationHandlerClassName(v.getName()));
           });
 }