Examples of ServiceEvent


Examples of org.osgi.framework.ServiceEvent

        bc.addServiceListener(this, filter);
        ServiceReference[] sra = bc.getServiceReferences(null, filter);
        if (sra != null) {
            for (int i = 0; i < sra.length; i++) {
                try {
                    serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED,
                            sra[i]));
                } catch (Exception e) {
                }
            }
        }
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

  void getAllServices() {
    try {
      ServiceReference[] srl = Activator.getTargetBC_getServiceReferences();
      for(int i = 0; srl != null && i < srl.length; i++) {
        serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, srl[i]));
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

    bc.addServiceListener(listener, filter);
   
    ServiceReference references[] = bc.getServiceReferences(null, filter);
    for (int i = 0; references != null && i < references.length; i++)
      {
        listener.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED,
                                                 references[i]));
      }
  }
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

    Activator.getTargetBC().addBundleListener(this);

    try {
      ServiceReference [] srl = Activator.getTargetBC_getServiceReferences();
      for(int i = 0; srl != null && i < srl.length; i++) {
        serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, srl[i]));
      }
      Activator.getTargetBC().addServiceListener(this, null);
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

    public void removeServiceListener(final ServiceListener serviceListener) {
        serviceListeners.remove(serviceListener);
    }

    private void notifyServiceListeners(int eventType, ServiceReference serviceReference) {
        final ServiceEvent event = new ServiceEvent(eventType, serviceReference);
        for (ServiceListener serviceListener : serviceListeners) {
            serviceListener.serviceChanged(event);
        }
    }
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

        // Notify callback objects about unregistering service.
        if (m_callbacks != null)
        {
            m_callbacks.serviceChanged(
                new ServiceEvent(ServiceEvent.UNREGISTERING, reg.getReference()), null);
        }

        // Now forcibly unget the service object for all stubborn clients.
        ServiceReference<?> ref = reg.getReference();
        Bundle[] clients = getUsingBundles(ref);
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

    {
        updateHook(reg.getReference());
        if (m_callbacks != null)
        {
            m_callbacks.serviceChanged(
                new ServiceEvent(ServiceEvent.MODIFIED, reg.getReference()), oldProps);
        }
    }
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

            // matched previously.
            else if (((ServiceEvent) event).getType() == ServiceEvent.MODIFIED)
            {
                if (filter.match(oldProps))
                {
                    final ServiceEvent se = new ServiceEvent(
                        ServiceEvent.MODIFIED_ENDMATCH,
                        ((ServiceEvent) event).getServiceReference());
                    if (System.getSecurityManager() != null)
                    {
                        AccessController.doPrivileged(new PrivilegedAction()
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

                }
            }
        }

        // Fire service event.
        fireServiceEvent(new ServiceEvent(ServiceEvent.REGISTERED, reg.getReference()), null);

        return reg;
    }
View Full Code Here

Examples of org.osgi.framework.ServiceEvent

    }


    private void fireServiceEvent( ServiceReference ref, int type )
    {
        ServiceEvent se = new ServiceEvent( type, ref );
        for ( Iterator li = serviceListeners.iterator(); li.hasNext(); )
        {
            ( ( ServiceListener ) li.next() ).serviceChanged( se );
        }
    }
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.