Refine search
if (b.getState() <= Bundle.RESOLVED || b.getHeaders().get(Constants.FRAGMENT_HOST) != null) continue;
/** * @throws Exception */ @Test public void testAllBundlesActiveAndFeaturesInstalled() throws Exception { // Asssert all bundles except fragments are ACTIVE. for (Bundle b : bundleCtx.getBundles()) { System.out.println(String.format("Checking state of bundle [symbolicName=%s, state=%s]", b.getSymbolicName(), b.getState())); if (b.getHeaders().get(Constants.FRAGMENT_HOST) == null) assertTrue(b.getState() == Bundle.ACTIVE); } // Check that according to the FeaturesService, all Ignite features except ignite-log4j are installed. Feature[] features = featuresSvc.getFeatures(IGNITE_FEATURES_NAME_REGEX); assertNotNull(features); assertEquals(EXPECTED_FEATURES, features.length); for (Feature f : features) { if (IGNORED_FEATURES.contains(f.getName())) continue; boolean installed = featuresSvc.isInstalled(f); System.out.println(String.format("Checking if feature is installed [featureName=%s, installed=%s]", f.getName(), installed)); assertTrue(installed); assertEquals(PROJECT_VERSION.replaceAll("-", "."), f.getVersion().replaceAll("-", ".")); } }
private static boolean isFragment(Bundle bundle) { return bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null; } }
protected String getBundleVersion(String pSymbolicName) { BundleContext context = JolokiaServlet.getCurrentBundleContext(); if (context != null) { for (Bundle bundle: context.getBundles()) { if (pSymbolicName.equalsIgnoreCase(bundle.getSymbolicName())) { Dictionary headers = bundle.getHeaders(); return (String) headers.get("Bundle-Version"); } } } return null; }
/** * This service is being activated so setup it: * <ul> * <li>Create and open the {@link MetadataDependencyRegistryTracker}.</li> * </ul> */ protected void activate(final ComponentContext componentContext) { this.registryTracker = new MetadataDependencyRegistryTracker(componentContext.getBundleContext(), this); this.registryTracker.open(); for (final Bundle b : componentContext.getBundleContext().getBundles()) { if (!MY_BUNDLE_SYMBOLIC_NAME.equals(b.getSymbolicName())) { continue; } final Object v = b.getHeaders().get("Bundle-Version"); if (v != null) { final String version = v.toString(); bundleVersionInfo = extractVersionInfoFromString(version); } break; } }
startLevel = (StartLevel) context.getService(startLevelServiceReference); for (final Bundle bundle : context.getBundles()) { final String value = bundle.getHeaders().get("Service-Component"); if (value != null) { List<String> componentDescriptions = Arrays.asList(value.split("\\s*,\\s*"));
private static boolean isFragment(Bundle bundle) { return bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null; } }
private String getDefaultPrefix(Bundle bundle) { Dictionary<String, String> headers = bundle.getHeaders(); String defaultPrefix = headers.get(Constants.TRIAXRS_PATH_PREFIX); if (defaultPrefix == null) { defaultPrefix = ""; } return defaultPrefix; }
private boolean shouldAutoExportOnmsServices(Bundle bundle) { if (bundle == null) return false; String headerValue = bundle.getHeaders().get("OnmsAutoExportServices"); if (headerValue == null) { return false; } return Boolean.valueOf(headerValue); } }
private boolean isVaadinBundle(Bundle bundle) { String importedPackages = (String) bundle.getHeaders().get( Constants.IMPORT_PACKAGE); if (importedPackages == null) { return false; } if (importedPackages.contains("com.vaadin")) { return true; } return false; } }
public static String getNiceBundleName(Bundle b) { String name = (String) b.getHeaders().get(Constants.BUNDLE_NAME); if (name == null) { name = b.getSymbolicName(); } return name; }
public static String getBundleSymbolicName(Bundle bundle) { if (osgiVersion >= OSGI_1_3) { return bundle.getSymbolicName(); } else { return (String) bundle.getHeaders().get(Constants.BUNDLE_SYMBOLICNAME); } }
/** * Indicates if the given bundle is a fragment or not. * * @param bundle OSGi bundle * @return true if the given bundle is a fragment, false otherwise * @see Constants#FRAGMENT_HOST */ public static boolean isFragment(Bundle bundle) { Assert.notNull(bundle, "bundle is required"); return bundle.getHeaders().get(Constants.FRAGMENT_HOST) != null; }
/** * Constructs a new BundleReference. * * @param bundle */ public BundleReference(Bundle bundle) { this.bundle = bundle; this.symbolicName = bundle.getSymbolicName(); this.version = (String)bundle.getHeaders().get(Constants.BUNDLE_VERSION); }
public void execute(String s, PrintStream out, PrintStream err) { out.println(m_context.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION)); } }
public Hashtable getHeaders() { Hashtable ht=new Hashtable(); Enumeration keys=bundle.getHeaders().keys(); while(keys.hasMoreElements()) { Object key=keys.nextElement(); ht.put(key, bundle.getHeaders().get(key)); } return ht; } /* (non-Javadoc)
public static String getBundleName(Bundle bundle) { if (bundle != null) { String name = bundle.getHeaders().get(Constants.BUNDLE_NAME); return (name == null) ? "Bundle " + Long.toString(bundle.getBundleId()) : name + " (" + Long.toString(bundle.getBundleId()) + ")"; } return "[STALE BUNDLE]"; }
public static boolean isSingleton(Bundle b) { StringBuffer singleton1 = new StringBuffer(Constants.SINGLETON_DIRECTIVE); singleton1.append(":=true"); StringBuffer singleton2 = new StringBuffer(Constants.SINGLETON_DIRECTIVE); singleton2.append(":=\"true\""); return ((String) b.getHeaders().get(Constants.BUNDLE_SYMBOLICNAME)).contains(singleton1.toString()) || ((String) b.getHeaders().get(Constants.BUNDLE_SYMBOLICNAME)).contains(singleton2.toString()); }
public static String getBundleName(Bundle bundle) { if (bundle != null) { String name = bundle.getHeaders().get(Constants.BUNDLE_NAME); return (name == null) ? "Bundle " + Long.toString(bundle.getBundleId()) : name + " (" + Long.toString(bundle.getBundleId()) + ")"; } return "[STALE BUNDLE]"; }
private static Set<Bundle> getUnresolvedVaadinThemeFragments(BundleContext context) { return Arrays.stream(context.getBundles()) .filter(bundle -> { String fragmentHost = bundle.getHeaders().get("Fragment-Host"); return fragmentHost != null && fragmentHost.contains("com.vaadin.themes") && bundle.getState() == Bundle.INSTALLED; }) .collect(Collectors.toSet()); } }