Package org.osgi.framework

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


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

     */
    public ServiceRegistration registerService(ComponentInstance instance, String clazz, Object svcObj, Dictionary dict) {
        synchronized (m_regs) {
            ServiceRegistrationImpl reg = new ServiceRegistrationImpl(this, instance, new String[] { clazz }, new Long(m_serviceId++), svcObj, dict);
            m_regs.add(reg);
            fireServiceChanged(new ServiceEvent(ServiceEvent.REGISTERED, reg.getReference()));
            return reg;
        }
    }
View Full Code Here

     */
    public ServiceRegistration registerService(ComponentInstance instance, String[] clazzes, Object svcObj, Dictionary dict) {
        synchronized (m_regs) {
            ServiceRegistrationImpl reg = new ServiceRegistrationImpl(this, instance, clazzes, new Long(m_serviceId++), svcObj, dict);
            m_regs.add(reg);
            fireServiceChanged(new ServiceEvent(ServiceEvent.REGISTERED, reg.getReference()));
            return reg;
        }
    }
View Full Code Here

    /**
     * Dispatch a service properties modified event.
     * @param reg : the implicated service registration.
     */
    public void servicePropertiesModified(ServiceRegistrationImpl reg) {
        fireServiceChanged(new ServiceEvent(ServiceEvent.MODIFIED, reg.getReference()));
    }
View Full Code Here

     * Unregister a service.
     * @param reg : the service registration to unregister
     */
    public void unregisterService(ServiceRegistrationImpl reg) {
        m_regs.remove(reg);
        fireServiceChanged(new ServiceEvent(ServiceEvent.UNREGISTERING, reg.getReference()));
    }
View Full Code Here

            // 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

      bc.addServiceListener(this);

      // Make sure we get services already registered
      ServiceReference[] srl = bc.getServiceReferences((String) null, null);
      for(int i = 0; srl != null && i < srl.length; i++) {
        serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, srl[i]));
      }

      admin = new KSoapAdminImpl(this);

      Hashtable props = new Hashtable();
View Full Code Here

  private void initalizeListener() {
    ServiceReference references[];
    try {
      references = this.bc.getServiceReferences((String)null, MODEL_FACTORY_FILTER);
      for(int i = 0; references != null && i < references.length; i++) {
        this.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, references[i]));
      }
    } catch(InvalidSyntaxException e) {
      // this will not happen
      log.error("Syntax error", e);
    }
View Full Code Here

                        .returns(null);
            }
        });

        trackerListener.serviceChanged(
                new ServiceEvent(ServiceEvent.REGISTERED, referenceMock));

        // ---------------------------------------------------------------------
        // Modify Service
        // ---------------------------------------------------------------------

        // Modifying the service does not require any changes to the use count
        // of the service.

        managerMock.expects.factoryModified(referenceMock)
                .description("Modify Service");

        trackerListener.serviceChanged(
                new ServiceEvent(ServiceEvent.MODIFIED, referenceMock));

        // ---------------------------------------------------------------------
        // Unregister Service
        // ---------------------------------------------------------------------

        // Unregistering the service must decrement the use count of the
        // service.

        expectations.add(new OrderedExpectations() {
            public void add() {

                managerMock.expects.factoryUnregistering(referenceMock)
                        .description("Unregistering Service");

                contextMock.expects.ungetService(referenceMock)
                        .description("Unregistering Decrement Use Count")
                        .returns(false);
            }
        });

        trackerListener.serviceChanged(
                new ServiceEvent(ServiceEvent.UNREGISTERING, referenceMock));
    }
View Full Code Here

TOP

Related Classes of org.osgi.framework.ServiceEvent

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.