- /*
- * protected void sleep(long ms) { try { Thread.sleep(ms); } catch
- * (InterruptedException e) { // silent } }
- *
- * public ServiceTracker newTracker(Class<?> clss) { ServiceTracker st = new
- * ServiceTracker(bundleContext, clss.getName(), null); st.open(); return
- * st; }
- *
- * @SuppressWarnings(value = { "unchecked" }) public <T> T
- * getSingleService(Class<T> clss, String filter) {
- * Assert.isTrue(OsgiFilterUtils.isValidFilter(filter), "valid filter");
- * ServiceReference[] sfs; try { sfs =
- * bundleContext.getServiceReferences(clss.getName(), filter); } catch
- * (InvalidSyntaxException e) { throw new
- * SlcException("Cannot retrieve service reference for " + filter, e); }
- *
- * if (sfs == null || sfs.length == 0) return null; else if (sfs.length > 1)
- * throw new SlcException("More than one execution flow found for " +
- * filter); return (T) bundleContext.getService(sfs[0]); }
- *
- * public <T> T getSingleServiceStrict(Class<T> clss, String filter) { T
- * service = getSingleService(clss, filter); if (service == null) throw new
- * SlcException("No execution flow found for " + filter); else return
- * service; }
- *
- * public Bundle findRelatedBundle(OsgiBundle osgiBundle) { Bundle bundle =
- * null; if (osgiBundle.getInternalBundleId() != null) { bundle =
- * bundleContext.getBundle(osgiBundle.getInternalBundleId()); Assert.isTrue(
- * osgiBundle.getName().equals(bundle.getSymbolicName()),
- * "symbolic name consistent");
- * Assert.isTrue(osgiBundle.getVersion().equals(
- * bundle.getHeaders().get(Constants.BUNDLE_VERSION)),
- * "version consistent"); } else { for (Bundle b :
- * bundleContext.getBundles()) { if
- * (b.getSymbolicName().equals(osgiBundle.getName())) { if
- * (b.getHeaders().get(Constants.BUNDLE_VERSION).equals(
- * osgiBundle.getVersion())) { bundle = b;
- * osgiBundle.setInternalBundleId(b.getBundleId()); } } } } return bundle; }
- *
- * public OsgiBundle findFromPattern(String pattern) { OsgiBundle osgiBundle
- * = null; for (Bundle b : bundleContext.getBundles()) { if
- * (b.getSymbolicName().contains(pattern)) { osgiBundle = new OsgiBundle(b);
- * break; } } return osgiBundle; }
- *
- * public OsgiBundle getBundle(Long bundleId) { Bundle bundle =
- * bundleContext.getBundle(bundleId); return new OsgiBundle(bundle); }
- *
- * public void setBundleContext(BundleContext bundleContext) {
- * this.bundleContext = bundleContext; }
- *
- * public void afterPropertiesSet() throws Exception {
- * bundleContext.addFrameworkListener(this); }
- *
- * public void setDefaultTimeout(Long defaultTimeout) { this.defaultTimeout
- * = defaultTimeout; }
- *
- * BundleContext getBundleContext() { return bundleContext; }
- */
-
- protected void debug(Object obj) {
- if (debug)
- System.out.println("#OSGiMANAGER DEBUG# " + obj);
- }
-