Examples of ServiceReference


Examples of org.osgi.framework.ServiceReference

    public StringBuffer  bundleInfo(Bundle[] targets) {
      StringBuffer sb = new StringBuffer();

      startFont(sb);
      ServiceReference sr = Activator
        .getTargetBC_getServiceReference(PackageAdmin.class.getName());
      PackageAdmin pkgAdmin
        = (PackageAdmin) Activator.getTargetBC_getService(sr);
      if(pkgAdmin == null) {
        sb.append("No PackageAdmin service found");
View Full Code Here

Examples of org.osgi.framework.ServiceReference

    log("starting");
   
    String filter = "(objectclass=" + DateService.class.getName() + ")";
    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.ServiceReference

  public static void log(int level, String msg) {
    log(level, msg, null);
  }

  public static void log(int level, String msg, Exception e) {
    ServiceReference srLog = bc.getServiceReference(logServiceName);
    if (srLog != null) {
      LogService sLog = (LogService)bc.getService(srLog);
      if (sLog != null) {
        if(e != null) {
          sLog.log(level, msg, e);
View Full Code Here

Examples of org.osgi.framework.ServiceReference

    detailPanel.setBorder(null);

    detailPanel.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
          for(Iterator it = detailMap.keySet().iterator(); it.hasNext();) {
            ServiceReference sr = (ServiceReference)it.next();
            Object obj = detailMap.get(sr);

            if(obj instanceof DefaultSwingBundleDisplayer) {

              ((DefaultSwingBundleDisplayer)obj).setTabSelected();
View Full Code Here

Examples of org.osgi.framework.ServiceReference

    viewPopupMenu = new JPopupMenu();
    menuMap.clear();

    for(Iterator it = displayMap.keySet().iterator(); it.hasNext(); ) {
      final ServiceReference     sr   = (ServiceReference)it.next();
      final String key = (String)sr.getProperty(SwingBundleDisplayer.PROP_NAME);

      JMenuItem item = new JMenuItem(key);
      item.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent ev) {
            bundlePanelShowTab(sr);
View Full Code Here

Examples of org.osgi.framework.ServiceReference

    menu.add(new JSeparator());

    int count = 0;
    menuMap.clear();
    for(Iterator it = displayMap.keySet().iterator(); it.hasNext(); ) {
      final ServiceReference     sr   = (ServiceReference)it.next();
      final String   name = (String)sr.getProperty(SwingBundleDisplayer.PROP_NAME);
      final int c2 = count++;

      menu.add(new JRadioButtonMenuItem(name) {
          {
            setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1 + c2,
View Full Code Here

Examples of org.osgi.framework.ServiceReference

      }.start();
    }
  }

  void refreshBundle(final Bundle[] b) {
    final ServiceReference sr
      = Activator.getTargetBC_getServiceReference(PackageAdmin.class.getName());

    if(sr != null) {
      final PackageAdmin packageAdmin = (PackageAdmin)
        Activator.getTargetBC_getService(sr);
View Full Code Here

Examples of org.osgi.framework.ServiceReference

      }
    }
  }

  void resolveBundles(final Bundle[] b) {
    final ServiceReference sr = Activator.getTargetBC()
      .getServiceReference(PackageAdmin.class.getName());

    if(sr != null) {
      final PackageAdmin packageAdmin = (PackageAdmin)
        Activator.getTargetBC().getService(sr);
View Full Code Here

Examples of org.osgi.framework.ServiceReference

  public void start(BundleContext bc) throws Exception {
    System.out.println(bc.getBundle().getHeaders()
                       .get(Constants.BUNDLE_NAME) +
                       " starting...");
    Activator.bc = bc;
    ServiceReference reference =
      bc.getServiceReference(DateService.class.getName());

    DateService service = (DateService)bc.getService(reference);
    System.out.println("Using DateService: formatting date: " +
                       service.getFormattedDate(new Date()));
View Full Code Here

Examples of org.osgi.framework.ServiceReference

    /**
     * Creates a new BundleHttpContext object.
     */
    public BundleHttpContext() {
        ServiceReference ref = Activator.bc.getServiceReference(
                "org.osgi.service.packageadmin.PackageAdmin");
        packageAdmin = (PackageAdmin) Activator.bc.getService(ref);
    }
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.