Ejemplo n.º 1
0
 public long installBundle(String location) {
   try {
     Bundle b = Activator.bc.installBundle(location);
     return b.getBundleId();
   } catch (BundleException e) {
     throw new IllegalArgumentException("Failed to install location=" + location);
   }
 }
 public void setBundle(Bundle b) {
   try {
     MetaTypeInformation mtp = Activator.getMTP(b);
     jcmInfo.setProvider(mtp, b);
   } catch (Exception e) {
     e.printStackTrace();
     Activator.log.error("Failed to get MetaTypeInformation from bundle " + b.getBundleId(), e);
   }
 }
Ejemplo n.º 3
0
  public Map getBundleManifest(long bundleId) {
    Bundle b = Activator.bc.getBundle(bundleId);

    Dictionary d = b.getHeaders();

    Map result = new HashMap();

    int i = 0;
    for (Enumeration e = d.keys(); e.hasMoreElements(); ) {
      String key = (String) e.nextElement();
      String val = (String) d.get(key);

      result.put(key, val);

      i += 2;
    }

    result.remove("Application-Icon");
    return result;
  }
Ejemplo n.º 4
0
  public long[] getFrameworkEvents() {
    synchronized (frameworkEvents) {
      try {

        long[] r = new long[frameworkEvents.size() * 2];
        if (bDebug) {
          System.out.println("server: getFrameworkEvents size=" + r.length / 2);
        }
        int i = 0;

        for (Iterator it = frameworkEvents.iterator(); it.hasNext(); ) {
          FrameworkEvent ev = (FrameworkEvent) it.next();
          Bundle b = ev.getBundle();
          long bid = -1;
          if (b == null) {
            if (bDebug) {
              System.out.println("fw event: " + ev + " - no bundle");
            }
          } else {
            bid = b.getBundleId();
          }
          r[i * 2] = bid;
          r[i * 2 + 1] = ev.getType();
          i++;
        }

        frameworkEvents.clear();
        if (bDebug) {
          System.out.println("server: getFrameworkEvents -> " + r);
        }
        return r;
      } catch (Exception e) {
        if (bDebug) {
          e.printStackTrace();
        }
      }
    }
    return null;
  }
Ejemplo n.º 5
0
 public long[] getRegisteredServices(long bid) {
   Bundle b = Activator.bc.getBundle(bid);
   return Util.referencesToLong(b.getRegisteredServices());
 }
Ejemplo n.º 6
0
 public long[] getServicesInUse(long bid) {
   Bundle b = Activator.bc.getBundle(bid);
   return Util.referencesToLong(b.getServicesInUse());
 }
Ejemplo n.º 7
0
  public int getBundleState(long bid) {
    Bundle b = Activator.bc.getBundle(bid);

    return b.getState();
  }
Ejemplo n.º 8
0
  public String getBundleLocation(long bid) {
    Bundle b = Activator.bc.getBundle(bid);

    return b.getLocation();
  }