Examples of ServiceTracker


Examples of org.osgi.util.tracker.ServiceTracker

  }

  public void open() {
    super.open();

    psTracker = new ServiceTracker(bc,
                                   PreferencesService.class.getName(),
                                   null) {
        public Object addingService(ServiceReference sr) {
          Object obj = super.addingService(sr);
          reinit();
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

            Filter filter = Activator.bc.createFilter("(&(" +
                    org.osgi.service.device.Constants.DEVICE_CATEGORY + "=" +
                    JiniDriver.DEVICE_CATEGORY + ")(" + JiniDriver.EXPORT +
                    "=*))");
            ServiceTrackerCustomizer serviceTrackerCustomizer = new JiniExporter();
            serviceTracker = new ServiceTracker(Activator.bc, filter,
                    serviceTrackerCustomizer);
        } catch (Exception ex) {
            serviceTracker = null;
            Debug.printDebugInfo(10,
                "Could not setup up the OSGi to Jini Bridge", ex);
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker


  public void start() {

    slTracker =
      new ServiceTracker(Activator.getTargetBC(),
                         StartLevel.class.getName(), null);
    slTracker.open();

    pkgTracker =
      new ServiceTracker(Activator.getTargetBC(),
                         PackageAdmin.class.getName(), null);
    pkgTracker.open();


    lfManager = new LFManager();
    lfManager.init();

    consoleSwing = new ConsoleSwing(Activator.getTargetBC());
    consoleSwing.start();

    toolBar       = makeToolBar();
    statusBar     = new StatusBar("");

    String rName = Activator.remoteHost;
    String spid  = Activator.getBC().getProperty("org.osgi.provisioning.spid");

    if(spid == null) {
      spid = "";
    }


    try {
      ToolTipManager.sharedInstance().setInitialDelay(50);
    } catch (Exception e) {
      Activator.log.warn("Failed to change tooltip manager", e);
    }

    frame       = new JFrame(Strings.fmt("frame_title", rName, spid));

    frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
          stopFramework();
        }
      });

    // If running on Mac OS, create eawt Application to catch Mac OS
    // quit and about events
    if(bMacOS) {
      try {
        OSXAdapter.setQuitHandler(this,
                                  getClass().getDeclaredMethod("stopFramework",
                                                               (Class[])null));
        OSXAdapter.setAboutHandler(this,
                                   getClass().getDeclaredMethod("showVersion",
                                                                (Class[])null));
      } catch (Exception e) {
        Activator.log.warn("Error while loading the OSXAdapter", e);
        bMacOS = false;
      }
    }

    contentPane = frame.getContentPane();
    contentPane.setLayout(new BorderLayout());

    SizeSaver ss = new SizeSaver("top", new Dimension(900, 600), -1);

    ss.attach(frame);
    sizesavers.add(ss);

    bundlePanel = new JCardPane();
    // bundlePanel.setPreferredSize(new Dimension(400, 300));

    toolBar       = makeToolBar();


    detailPanel   = new JTabbedPane();
    // detailPanel.setPreferredSize(new Dimension(400, 300));

    detailPanel.setTabPlacement(JTabbedPane.BOTTOM);

    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();
            }
          }
        }
      });

    //    displayHTML = new BundleInfoDisplayerHTML(this);


    contentPane.add(toolBar,      BorderLayout.NORTH);
    contentPane.add(statusBar,    BorderLayout.SOUTH);


    splitPaneHoriz = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                                    bundlePanel,
                                    detailPanel);

    ss = new SizeSaver("splitPaneHoriz",
                       null, // new Dimension(700, 400),
                       350);
    ss.attach(splitPaneHoriz);
    sizesavers.add(ss);
    // splitPaneHoriz.setDividerLocation(bundlePanel.getPreferredSize().width);

    splitPaneHoriz.setOneTouchExpandable(false);


    JFloatable consoleWrapper =
      new JFloatable(consoleSwing.getJComponent(), "Console");

    splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,
                               splitPaneHoriz,
                               consoleWrapper);

    ss = new SizeSaver("splitPaneVertical",
                       null, // new Dimension(800, 600),
                       300);
    ss.attach(splitPane);
    sizesavers.add(ss);

    // splitPane.setDividerLocation(300);
    splitPane.setOneTouchExpandable(false);


    contentPane.add(splitPane,  BorderLayout.CENTER);


    DropTarget dt =
      new DropTarget(contentPane,
                     DnDConstants.ACTION_COPY_OR_MOVE, // actions
                     this,
                     true);



    alive = true;

    // Catch up the set of bundles; no need to call bundleChanged for
    // each bundle since that method ignores the actual event!
    // Bundle[]  bl = Activator.getTargetBCbundles();
    // for(int i = 0; i  < bl.length; i++) {
    //   bundleChanged(new BundleEvent(BundleEvent.INSTALLED, bl[i]));
    // }
    bundleChanged((BundleEvent) null);

    pm = new PackageManager(pkgTracker);

    frame.setJMenuBar(menuBar = makeMenuBar());


    setRemote(Activator.remoteTracker.getService() != null);

    setIcon(frame, "/kf-");

    // frame.pack() not used since SizeSaver(frame) does a setSize()
    // frame.pack();
    frame.setVisible(true);
    frame.toFront();

//    String dispFilter1 =
//      "(&" +
//      "(" + Constants.OBJECTCLASS + "=" +
//      SwingBundleDisplayer.class.getName() +
//      ")" +
//      "(" + SwingBundleDisplayer.PROP_ISDETAIL + "=false" + ")" +
//      ")";

    String dispFilter =
      "(" + Constants.OBJECTCLASS + "=" +
      SwingBundleDisplayer.class.getName() +
      ")";

    try {
      dispTracker =
        new ServiceTracker(Activator.getBC(),
                           Activator.getBC().createFilter(dispFilter),
                           null)
        {
          public Object addingService(final ServiceReference sr) {
            final SwingBundleDisplayer disp =
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

     */
    public void start(BundleContext bc) {
        LogCommands.bc = bc;

        // Create service tracker for log config service
        LogCommands.logConfigTracker = new ServiceTracker(bc, LogConfig.class
                .getName(), null);
        LogCommands.logConfigTracker.open();

        // Register log commands
        CommandGroup logCommandGroup = new LogCommandGroup(bc);
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

  private final Hashtable topicsToHandlers = new Hashtable();
  private final Hashtable wildcardsToHandlers = new Hashtable();

  public EventHandlerTracker(BundleContext bc) {
    this.bc = bc;
    tracker = new ServiceTracker(bc, EventHandler.class.getName(), this);
  }
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

      b1 = Util.installBundle(bc, "bundleEnd101_test-1.0.0.jar");
      b2 = Util.installBundle(bc, "bundleEnd102_test-1.0.0.jar");
      b1.start();
      b2.start();
     
      tracker1 = new ServiceTracker(bc, Control101.class.getName(), null);
      tracker2 = new ServiceTracker(bc, Control102.class.getName(), null);
      tracker1.open();
      tracker2.open();
     
      tracker = new ServiceTracker(bc, Control.class.getName(), null);
      tracker.open();
     
    } catch (BundleException e) {
     
      e.printStackTrace();
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

  ServiceTracker pkgTracker;

  public JPackageView(GraphDisplayer.JMainBundles jmb, BundleContext bc, Bundle b, BundleSelectionModel bundleSelModel) {
    super(jmb, bc, b, bundleSelModel);

    pkgTracker = new ServiceTracker(bc, PackageAdmin.class.getName(), null);
    pkgTracker.open();

    setMaxDepth(8);
    currentNode = makeRootNode();
    setLabel(Strings.get("str_packages"));
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

    this.bc     = Util.getBundleContext(bundle);

    if(bc == null) {
      log.debug("No BC for " + Util.getBundleName(bundle));
    } else {
      psTracker = new ServiceTracker(bc,
                                     PreferencesService.class.getName(),
                                     null) {
          public Object addingService(ServiceReference sr) {
            Object obj = super.addingService(sr);
            ps = (PreferencesService)obj;
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

        this.tserv = tserv;

        log.info("Connection request from " +socket.getInetAddress() );

        // Set up service tracker for the console service.
        consoleTracker = new ServiceTracker(bc, consoleServiceName, this);
        consoleTracker.open();

        try {
            is = socket.getInputStream();
            os = socket.getOutputStream();
View Full Code Here

Examples of org.osgi.util.tracker.ServiceTracker

    throws BundleException
  {
    Activator.bc  = bc;
    Activator.log = new LogRef(bc);

    httpTracker = new ServiceTracker(bc, HttpService.class.getName(), null) {
        public Object addingService(final ServiceReference sr)
        {
          return register(sr);
        }
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.