Package org.osgi.service.event

Examples of org.osgi.service.event.EventAdmin.postEvent()


        EasyMock.verify(ea);
    }

    public void testServiceUnsatisfiedAdminEvent() throws Exception {
        EventAdmin ea = EasyMock.createMock(EventAdmin.class);
        ea.postEvent((Event) EasyMock.anyObject());
        EasyMock.expectLastCall().andAnswer(new IAnswer<Object>() {
            public Object answer() throws Throwable {
                Event e = (Event) EasyMock.getCurrentArguments()[0];
                assertEquals("org/osgi/service/distribution/DistributionProvider/service/unsatisfied", e.getTopic());               
                return null;
View Full Code Here


            RemoteServiceAdminEvent rsaEvent =
                new RemoteServiceAdminEvent(RemoteServiceAdminEvent.EXPORT_REGISTRATION, source, registration
                    .getExportReference(), registration.getException());
            EventAdmin eventAdmin = getEventAdmin();
            if (eventAdmin != null) {
                eventAdmin.postEvent(wrap(rsaEvent));
            }
            for (Object listener : listeners.getServices()) {
                RemoteServiceAdminListener rsaListener = (RemoteServiceAdminListener)listener;
                rsaListener.remoteAdminEvent(rsaEvent);
            }
View Full Code Here

        RemoteServiceAdminEvent rsaEvent =
            new RemoteServiceAdminEvent(RemoteServiceAdminEvent.IMPORT_REGISTRATION, source, registration
                .getImportReference(), registration.getException());
        EventAdmin eventAdmin = getEventAdmin();
        if (eventAdmin != null) {
            eventAdmin.postEvent(wrap(rsaEvent));
        }
        for (Object listener : listeners.getServices()) {
            RemoteServiceAdminListener rsaListener = (RemoteServiceAdminListener)listener;
            rsaListener.remoteAdminEvent(rsaEvent);
        }
View Full Code Here

        if (admin != null) {
            Event event = getEvent(exchange);
            if (endpoint.isSend()) {
                admin.sendEvent(event);
            } else {
                admin.postEvent(event);
            }
        } else {
            throw new CamelExchangeException("EventAdmin service not present", exchange);
        }
    }
View Full Code Here

            topic = EventConstants.TOPIC_FEATURES_UNINSTALLED;
            break;
        default:
            throw new IllegalStateException("Unknown features event type: " + event.getType());
        }
        eventAdmin.postEvent(new Event(topic, props));
    }

    public void repositoryEvent(RepositoryEvent event) {
        EventAdmin eventAdmin = tracker.getService();
        if (eventAdmin == null) {
View Full Code Here

            topic = EventConstants.TOPIC_REPOSITORY_REMOVED;
            break;
        default:
            throw new IllegalStateException("Unknown repository event type: " + event.getType());
        }
        eventAdmin.postEvent(new Event(topic, props));
    }
}
View Full Code Here

            EventAdmin admin = tracker.getService();
            if (admin != null) {
                Map<String, Object> props = new HashMap<String, Object>();
                props.put("command", command.toString());
                Event event = new Event("org/apache/karaf/shell/console/EXECUTING", props);
                admin.postEvent(event);
            }
        }
    }

    public void afterExecute(CommandSession session, CharSequence command, Exception exception) {
View Full Code Here

      return;
    }
    // post via event admin
    AccessController.doPrivileged(new PrivilegedAction<Object>() {
      public Object run() {
        eventAdmin.postEvent(new Event(topic, eventProperties));
        return null;
      }
    });
  }
View Full Code Here

    EventAdmin eventAdmin = Activator.getEventAdmin();
    if (eventAdmin == null) {
      logger.error("No event admin found");
      return false;
    }
    eventAdmin.postEvent(event);
    return true;
  }

  @SuppressWarnings("unchecked")
  private Event constructEvent(String topic, Object data) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.