Package org.osgi.framework

Examples of org.osgi.framework.BundleContext.addServiceListener()


          return ctx.getBundle(0).getBundleContext();
        }
      });
      if (systemBundle == null) systemBundle = ctx;
      systemBundle.addBundleListener(cacheClearoutListener);
      systemBundle.addServiceListener(cacheClearoutListener);
    }
  }

  private static final class ServiceKey
  {
View Full Code Here


        BundleContext systemBundleContext = framework.getSystemBundleContext();

        try
        {
            systemBundleContext.addServiceListener(new ServiceListener()
            {
                public void serviceChanged(ServiceEvent serviceEvent)
                {
                    ServiceReference reference = serviceEvent.getServiceReference();
View Full Code Here

                        holders.add(holder);
                    }
                }
            }, "(&(objectClass=" + URLStreamHandlerService.class.getName() + ")(" + URLConstants.URL_HANDLER_PROTOCOL + "=*))");

            systemBundleContext.addServiceListener(new ServiceListener()
            {
                public void serviceChanged(ServiceEvent serviceEvent)
                {
                    ServiceReference reference = serviceEvent.getServiceReference();

View Full Code Here

  @Override
  // 注册
  public void register() {
    BundleContext bundleContext = getBundleContext();
    bundleContext.addServiceListener(serviceListener);
    super.register();
  }

  // 取消注册
  @Override
View Full Code Here

    serviceChanged(event);
  }

  public void init() {
    BundleContext bundleContext = this.getBundleContext();
    bundleContext.addServiceListener(serviceListener);
    bundleContext.addBundleListener(bundleListener);
    init(0);
  }

  public void destory() {
View Full Code Here

            ServiceListener listener = new ServiceListener() {
                public void serviceChanged(ServiceEvent event) {
                    commands.clear();
                }
            };
            context.addServiceListener(listener,
                    String.format("(&(%s=*)(%s=*))",
                            CommandProcessor.COMMAND_SCOPE,
                            CommandProcessor.COMMAND_FUNCTION));
        }
    }
View Full Code Here

          return ctx.getBundle(0).getBundleContext();
        }
      });
      if (systemBundle == null) systemBundle = ctx;
      systemBundle.addBundleListener(cacheClearoutListener);
      systemBundle.addServiceListener(cacheClearoutListener);
    }
  }

  private static final class ServiceKey
  {
View Full Code Here

    // events related to
    // LogReaderService
    String filter = "(objectclass=" + LogReaderService.class.getName()
        + ")";
    try {
      context.addServiceListener(servlistener, filter);
    } catch (InvalidSyntaxException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

            // Register the JNDI service listener
            jndiServiceListener = new JNDIServiceListener(syscontext);
            try {
                String filter = "(" + Constants.OBJECTCLASS + "=" + ObjectFactory.class.getName() + ")";
                syscontext.addServiceListener(jndiServiceListener, filter);
            } catch (InvalidSyntaxException e) {
                // ignore
            }

            // Register the socket-binding services
View Full Code Here

            ServiceListener listener = new ServiceListener() {
                public void serviceChanged(ServiceEvent event) {
                    commands.clear();
                }
            };
            context.addServiceListener(listener,
                    String.format("(&(%s=*)(%s=*))",
                            CommandProcessor.COMMAND_SCOPE,
                            CommandProcessor.COMMAND_FUNCTION));
        }
    }
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.