Refine search
/** * Builds a {@link ClassNotFoundException}. * * @param clsName Class name. * @return The exception. */ protected ClassNotFoundException classNotFoundException(String clsName) { String s = "Failed to resolve class [name=" + clsName + ", bundleId=" + bundle.getBundleId() + ", symbolicName=" + bundle.getSymbolicName() + ", fallbackClsLdr=" + clsLdr + ']'; return new ClassNotFoundException(s); } }
/** * @return the display name of the bundle. */ public String getName() { return bundle.getSymbolicName() + " - " + bundle.getVersion(); }
private String getBundleIdentity(final Bundle bundle) { if ( bundle.getSymbolicName() == null ) { return bundle.getBundleId() + " (" + bundle.getLocation() + ")"; } else { return bundle.getSymbolicName() + ":" + bundle.getVersion() + " (" + bundle.getBundleId() + ")"; } }
public String toString() { String shortName = bundle.getSymbolicName() + "-" + bundle.getVersion(); return "BundleClassLoader[id=" + bundle.getBundleId() + "," + shortName + "]"; } }
public Void run() { map.put("id", new Long(bundle.getBundleId())); map.put("location", bundle.getLocation()); String name = bundle.getSymbolicName(); if (name != null) { map.put("name", name); } SignerProperty signer = new SignerProperty(bundle); if (signer.isBundleSigned()) { map.put("signer", signer); } return null; } });
/** * 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); }
private BundleInfo(Bundle b) { this.symbolicName = b.getSymbolicName(); this.version = b.getVersion(); this.state = b.getState(); this.id = b.getBundleId(); }
public Void run() { props.put("id", new Long(bundle.getBundleId())); props.put("location", bundle.getLocation()); String name = bundle.getSymbolicName(); if (name != null) { props.put("name", name); } SignerProperty signer = new SignerProperty(bundle); if (signer.isBundleSigned()) { props.put("signer", signer); } return null; } });
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; }
private String getInfo(final T service, final ServiceReference<T> ref) { return "Service " + ref.getProperty(Constants.SERVICE_PID) + " from bundle " + ref.getBundle().getBundleId() + (ref.getBundle().getSymbolicName() != null ? ref.getBundle().getSymbolicName() + ":" + ref.getBundle().getVersion() : "") + " class " + service.getClass(); }
public Void run() { props.put("id", new Long(bundle.getBundleId())); props.put("location", bundle.getLocation()); String name = bundle.getSymbolicName(); if (name != null) { props.put("name", name); } SignerProperty signer = new SignerProperty(bundle); if (signer.isBundleSigned()) { props.put("signer", signer); } return null; } });
@Override public boolean apply(Bundle input) { return input.getSymbolicName() != null && input.getVersion() != null && symbolicName.matcher(input.getSymbolicName()).matches() && (version == null || version.matcher(input.getVersion().toString()).matches()); } }
public static String[] bundleIds(Bundle bundle) { return new String[] { String.valueOf(bundle.getBundleId()), bundle.getSymbolicName(), bundle.getVersion().toString() }; } }
public Void run() { map.put("id", new Long(bundle.getBundleId())); map.put("location", bundle.getLocation()); String name = bundle.getSymbolicName(); if (name != null) { map.put("name", name); } SignerProperty signer = new SignerProperty(bundle); if (signer.isBundleSigned()) { map.put("signer", signer); } return null; } });
@Override public String call() throws Exception { BundleContext context = FrameworkUtil.getBundle(getClass()).getBundleContext(); Bundle sysBundle = context.getBundle(0); return sysBundle.getSymbolicName() + "-" + sysBundle.getVersion(); } };
private String getInfo(final T service, final ServiceReference<T> ref) { return "Service " + ref.getProperty(Constants.SERVICE_PID) + " from bundle " + ref.getBundle().getBundleId() + (ref.getBundle().getSymbolicName() != null ? ref.getBundle().getSymbolicName() + ":" + ref.getBundle().getVersion() : "") + " class " + service.getClass(); }
public Void run() { map.put("id", new Long(bundle.getBundleId())); map.put("location", bundle.getLocation()); String name = bundle.getSymbolicName(); if (name != null) { map.put("name", name); } SignerProperty signer = new SignerProperty(bundle); if (signer.isBundleSigned()) { map.put("signer", signer); } return null; } });
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; }
@Override public long getBundleId(String symbolicName, String version) { for (Bundle bundle : bundleContext.getBundles()) { if (symbolicName.equals(bundle.getSymbolicName()) && version.equals(bundle.getVersion().toString())){ return bundle.getBundleId(); } } return -1; }
@Override public void bundleChanged(final BundleEvent event) { if (event.getType() == BundleEvent.RESOLVED) { register(event.getBundle()); } else if (event.getType() == BundleEvent.UNRESOLVED || event.getType() == BundleEvent.UNINSTALLED) { final Bundle unregisteredBundle = event.getBundle(); lock.writeLock().lock(); try { factories.remove(unregisteredBundle.getBundleId()); if (unregisteredBundle.getSymbolicName().equals(CoreBundleSymbolicNAME)) { bundleContext.removeBundleListener(this); factories.clear(); } } finally { lock.writeLock().unlock(); } } }