Package org.osgi.service.event

Examples of org.osgi.service.event.EventHandler


        Dictionary<String, Object> properties = new Hashtable<String, Object>();
        properties.put(EventConstants.EVENT_TOPIC, "a/*");

        final CountDownLatch latch = new CountDownLatch(1);
        final AtomicInteger count = new AtomicInteger();
        ServiceRegistration sr = bundleContext.registerService(EventHandler.class.getName(), new EventHandler()
        {
            public void handleEvent(Event event)
            {
                try
                {
View Full Code Here


            .setInterface(EventHandler.class.getName(), new Properties() {
                {
                    put(EventConstants.EVENT_TOPIC, "*");
                }
            })
            .setImplementation(new EventHandler() {
                @Override
                public void handleEvent(Event event) {
                    System.out.print("[EVENT] " + event.getTopic());
                    for (String key : event.getPropertyNames()) {
                        System.out.print(" " + key + "=" + event.getProperty(key));
View Full Code Here

        final CountDownLatch topicLatch = new CountDownLatch(topicList.length);
        final CountDownLatch startLatch = new CountDownLatch(1);

        Component comp = m_dependencyManager.createComponent()
            .setInterface(EventHandler.class.getName(), topics)
            .setImplementation(new EventHandler() {
                @Override
                public void handleEvent(Event event) {
                    if (debug) {
                        System.err.println("Received event: " + event.getTopic());
                    }
View Full Code Here

    /**
     * Send the event.
     */
    public void sendEvent(final Event event)
    {
        final EventHandler handlerService = this.obtain();
        if (handlerService == null)
        {
            return;
        }

        try
        {
            handlerService.handleEvent(event);
        }
        catch (final Throwable e)
        {
            // The spec says that we must catch exceptions and log them:
            LogWrapper.getLogger().log(
View Full Code Here

        final IEventBroker eventBroker) throws CoreException {
    CCWPlugin.getTracer().trace(TraceOptions.LOG_INFO,
        "CCW Model Processor called.");

    eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE,
        new EventHandler() {
          @Override
          public void handleEvent(Event event) {
            CCWPlugin.getTracer().trace(TraceOptions.LOG_INFO,
            "App startup complete, launching user plugins");
            try {
View Full Code Here

        return handler;
      }
    }

    // we don't have the handler, so lets get it outside the sync region
    EventHandler tempHandler = (EventHandler) context.getService(reference);

    synchronized (this) {
      // do we still need the handler we just got?
      if (handler == null) {
        handler = tempHandler;
View Full Code Here

    if ((perm != null) && (!bundle.hasPermission(perm))) {
      return;
    }

    // get handler service
    EventHandler handlerService = getHandler();
    if (handlerService == null) {
      return;
    }

    try {
      handlerService.handleEvent(event);
    } catch (Throwable t) {
      // log/handle any Throwable thrown by the listener
      log.log(LogService.LOG_ERROR, "Exception while dispatching event "+event+" to handler "+handlerService, t);
    }
  }
View Full Code Here

    String[] topics = new String[] {topic};
    Dictionary<String, Object> d = new Hashtable<String, Object>();
    d.put(EventConstants.EVENT_TOPIC, topics);
    if (filter != null)
      d.put(EventConstants.EVENT_FILTER, filter);
    EventHandler wrappedHandler = new UIEventHandler(eventHandler, headless ? null : uiSync);
    ServiceRegistration registration = bundleContext.registerService(EventHandler.class.getName(), wrappedHandler, d);
    registrations.put(eventHandler, registration);
    return true;
  }
View Full Code Here

      themeManager.setCurrentThemeId((String)context.get(E4Application.THEME_ID));
    }
  }
 
  void setupEventListener(IEventBroker eventBroker) {
    eventBroker.subscribe(UIEvents.UIElement.TOPIC_TOBERENDERED, new EventHandler() {
     
      public void handleEvent(Event event) {
        MUIElement changedObj = (MUIElement) event.getProperty(UIEvents.EventTags.ELEMENT);
       
        if (changedObj.isToBeRendered()) {
View Full Code Here

        throw new IllegalStateException("There's no application with ID '" + applicationId + "' known.");
      } else if (col.size() > 1) {
        System.err.println("There are more than 1 application with ID '" + applicationId + "' known.");
        throw new IllegalStateException("There are more than 1 application with ID '" + applicationId + "' known.");
      } else {
        EventHandler handler = new EventHandler() {
          public void handleEvent(final Event event) {
            launched.set(false);
          }
        };
View Full Code Here

TOP

Related Classes of org.osgi.service.event.EventHandler

Copyright © 2018 www.massapicom. 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.