Refine search
Bundle getBundle(BundleContext bundleContext, String symbolicName) { Bundle result = null; for (Bundle candidate : bundleContext.getBundles()) { if (candidate.getSymbolicName().equals(symbolicName)) { if (result == null || result.getVersion().compareTo(candidate.getVersion()) < 0) { result = candidate; } } } return result; }
/** * @return the display name of the bundle. */ public String getName() { return bundle.getSymbolicName() + " - " + bundle.getVersion(); }
private Logger getLogger(final Bundle bundle) { String name = bundle.getSymbolicName(); Version version = bundle.getVersion(); if (version == null) { version = Version.emptyVersion; } Logger logger = LoggerFactory.getLogger(name + '.' + version); return logger; }
/** * Logs an error message and Throwable for a bundle. * @param bundle in which the error happened * @param message error message * @param t throwable */ public static void logError(final Bundle bundle, final Object message, final Throwable t) { final String pluginString = bundle.getSymbolicName() +"("+ bundle.getVersion()+ ")"; logger.error(message+" in bundle: " + pluginString, t); }
public String toString() { String shortName = bundle.getSymbolicName() + "-" + bundle.getVersion(); return "BundleClassLoader[id=" + bundle.getBundleId() + "," + shortName + "]"; } }
public ExtendedBundleContext(BundleContext paxBundleContext) { this.requirePAXWicketBundle = createMapWithVersion(OSGI_WIRING_BUNDLE_NAMESPACE, paxBundleContext.getBundle().getSymbolicName(), paxBundleContext.getBundle().getVersion()); this.importPAXWicketAPI = createMapWithVersion(OSGI_WIRING_PACKAGE_NAMESPACE, Constants.class.getPackage().getName(), paxBundleContext.getBundle().getVersion()); this.paxBundleContext = paxBundleContext; }
private BundleInfo(Bundle b) { this.symbolicName = b.getSymbolicName(); this.version = b.getVersion(); this.state = b.getState(); this.id = b.getBundleId(); }
public static String[] bundleIds(Bundle bundle) { return new String[] { String.valueOf(bundle.getBundleId()), bundle.getSymbolicName(), bundle.getVersion().toString() }; } }
@Override public Object addingBundle(Bundle bundle, BundleEvent event) { if (symbolicName.equals(bundle.getSymbolicName())) { // we have a bundle! this.bundle = bundle; this.version = bundle.getVersion(); LOG.info("Found bundle \"" + symbolicName + "\", scheduling customization of its WebContainer"); configExecutor.execute(this::processContext); } // we don't actually customize the bundle, so let's not return anything return null; }
@Override public String call() throws Exception { BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext(); Bundle sysBundle = context.getBundle(0); return sysBundle.getSymbolicName() + "-" + sysBundle.getVersion(); } };
@Override public String call() throws Exception { BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext(); Bundle sysBundle = context.getBundle(0); return sysBundle.getSymbolicName() + "-" + sysBundle.getVersion(); } };
private String getSourceLabel(Bundle bundle, boolean detailed) { StringBuilder sb = new StringBuilder("extension"); //$NON-NLS-1$ if(detailed) { sb.append('(').append(bundle.getSymbolicName()).append('_').append(bundle.getVersion()).append(')'); } return sb.toString(); }
protected void performTask(HttpServletRequest request, HttpServletResponse response){ PrintWriter pw = null; try { pw = response.getWriter(); bundleContext = (BundleContext) sc.getAttribute("osgi-bundlecontext"); pw.println("Current wab id: " + bundleContext.getBundle().getBundleId() + "\n" + "wab symbolic name : " + bundleContext.getBundle().getSymbolicName() + "\n" + "wab version :" + bundleContext.getBundle().getVersion() +"\n"); } catch (IOException io){ } }
private void printWarning(Object immutable, String processingType) { StringBuilder sb = new StringBuilder("The property placeholder processor for "); sb.append(placeholderPrefix).append(',').append(" ").append(placeholderSuffix) .append(" in bundle ").append(blueprintBundle.getSymbolicName()).append("/") .append(blueprintBundle.getVersion()).append(" found an immutable ").append(processingType) .append(" at location "); for(String s : processingStack) { sb.append(s); } sb.append(". This may prevent properties, beans, or other items referenced by this component from being properly processed."); LOGGER.info(sb.toString()); }
public String toString() { Bundle b = getBundle(); StringBuffer result = new StringBuffer(super.toString()); if (b == null) return result.toString(); return result.append('[').append(b.getSymbolicName()).append(':').append(b.getVersion()).append("(id=").append(b.getBundleId()).append(")]").toString(); //$NON-NLS-1$//$NON-NLS-2$ }
public String toString() { Bundle b = getBundle(); StringBuffer result = new StringBuffer(super.toString()); if (b == null) return result.toString(); return result.append('[').append(b.getSymbolicName()).append(':').append(b.getVersion()).append("(id=").append(b.getBundleId()).append(")]").toString(); //$NON-NLS-1$//$NON-NLS-2$ }
public String toString() { Bundle b = getBundle(); StringBuffer result = new StringBuffer(super.toString()); if (b == null) return result.toString(); return result.append('[').append(b.getSymbolicName()).append(':').append(b.getVersion()).append("(id=").append(b.getBundleId()).append(")]").toString(); //$NON-NLS-1$//$NON-NLS-2$ }
private String installedBundlesMessage() { StringBuilder sb = new StringBuilder("Installed bundles: {" ); for (Bundle b : osgi.getBundles()) sb.append("[" + b.getBundleId() + "]" + b.getSymbolicName() + ":" + b.getVersion() + ", "); sb.setLength(sb.length() - 2); sb.append("}"); return sb.toString(); } }
@Override public void stop(BundleContext context) throws Exception { Bundle bundle = context.getBundle(); log.debug("Stopping bundle: " + bundle.getSymbolicName() + " (" + bundle.getVersion() + " )"); } }
synchronized void onBundleRemoved(final Bundle bundle) { this.factoryPids.removeIf(factory -> { final Bundle provider = factory.getProviderBundle(); return provider.getSymbolicName().equals(bundle.getSymbolicName()) && provider.getVersion().equals(bundle.getVersion()); }); }