public boolean isExported() { String visibility = underlyingElement.getDirective(Constants.VISIBILITY_DIRECTIVE); return Constants.VISIBILITY_REEXPORT.equals(visibility); } public String getLabel() {
private static Map<String, String> getDirectives(ManifestElement element) { Map<String, String> directives = new HashMap<String, String>(); Enumeration<String> keys = element.getDirectiveKeys(); if (keys == null) return directives; while (keys.hasMoreElements()) { String key = keys.nextElement(); directives.put(key, element.getDirective(key)); } return directives; }
protected void validateDirectiveValue(IHeader header, ManifestElement element, String key, String[] allowedValues) { String value = element.getDirective(key); if (value == null) { return; } for (int i = 0; i < allowedValues.length; i++) { if (allowedValues[i].equals(value)) { return; } } reportIllegalDirectiveValue(header, key, value); }
private static Map<String, String> getDirectives(ManifestElement element) { Map<String, String> directives = new HashMap<String, String>(); Enumeration<String> keys = element.getDirectiveKeys(); if (keys == null) return directives; while (keys.hasMoreElements()) { String key = keys.nextElement(); directives.put(key, element.getDirective(key)); } return directives; }
private static String getInstallationDirective(String requirementId, ManifestElement[] correspondingBundleHeader) { for (ManifestElement manifestElement : correspondingBundleHeader) { String[] packages = manifestElement.getValueComponents(); for (String pckg : packages) { if (requirementId.equals(pckg)) { return manifestElement.getDirective(INSTALLATION_DIRECTIVE); } } } // TODO this case indicates an internal error -> return assertion error status return null; }
private static Map<String, String> getDirectives(ManifestElement element) { Map<String, String> directives = new HashMap<>(); Enumeration<String> keys = element.getDirectiveKeys(); if (keys == null) return directives; while (keys.hasMoreElements()) { String key = keys.nextElement(); directives.put(key, element.getDirective(key)); } return directives; }
protected void validateDirectiveValue(IHeader header, ManifestElement element, String key, String[] allowedValues) { String value = element.getDirective(key); if (value == null) { return; } for (int i = 0; i < allowedValues.length; i++) { if (allowedValues[i].equals(value)) { return; } } reportIllegalDirectiveValue(header, key, value); }
private static Map<String, String> getDirectives(ManifestElement element) { Map<String, String> directives = new HashMap<String, String>(); Enumeration<String> keys = element.getDirectiveKeys(); if (keys == null) return directives; while (keys.hasMoreElements()) { String key = keys.nextElement(); directives.put(key, element.getDirective(key)); } return directives; }
private static String getInstallationDirective(String requirementId, ManifestElement[] correspondingBundleHeader) { for (ManifestElement manifestElement : correspondingBundleHeader) { String[] packages = manifestElement.getValueComponents(); for (String pckg : packages) { if (requirementId.equals(pckg)) { return manifestElement.getDirective(INSTALLATION_DIRECTIVE); } } } // TODO this case indicates an internal error -> return assertion error status return null; }
private static String getInstallationDirective(String requirementId, ManifestElement[] correspondingBundleHeader) { for (ManifestElement manifestElement : correspondingBundleHeader) { String[] packages = manifestElement.getValueComponents(); for (String pckg : packages) { if (requirementId.equals(pckg)) { return manifestElement.getDirective(INSTALLATION_DIRECTIVE); } } } // TODO this case indicates an internal error -> return assertion error status return null; }
private void validateResolutionDirective(IHeader header, ManifestElement requireBundleElement) { String resolution = requireBundleElement .getDirective(Constants.RESOLUTION_DIRECTIVE); if (resolution != null) { validateDirectiveValue(header, requireBundleElement, Constants.RESOLUTION_DIRECTIVE, new String[] { Constants.RESOLUTION_MANDATORY, Constants.RESOLUTION_OPTIONAL }); } }
private static void checkExtensionBundle(String headerKey, ManifestElement[] elements) throws BundleException { if (elements.length == 0 || elements[0].getDirective(Constants.EXTENSION_DIRECTIVE) == null) return; String hostName = elements[0].getValue(); // XXX: The extension bundle check is done against system.bundle and org.eclipse.osgi if (!hostName.equals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) && !hostName.equals(EquinoxContainer.NAME)) { String message = NLS.bind(Msg.MANIFEST_INVALID_HEADER_EXCEPTION, headerKey, elements[0].toString()); throw new BundleException(message + " : " + NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName), BundleException.MANIFEST_ERROR); //$NON-NLS-1$ } }
private static void checkExtensionBundle(String headerKey, ManifestElement[] elements) throws BundleException { if (elements.length == 0 || elements[0].getDirective(Constants.EXTENSION_DIRECTIVE) == null) return; String hostName = elements[0].getValue(); // XXX: The extension bundle check is done against system.bundle and org.eclipse.osgi if (!hostName.equals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) && !hostName.equals(EquinoxContainer.NAME)) { String message = NLS.bind(Msg.MANIFEST_INVALID_HEADER_EXCEPTION, headerKey, elements[0].toString()); throw new BundleException(message + " : " + NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName), BundleException.MANIFEST_ERROR); //$NON-NLS-1$ } }
private void validateX_FriendsDirective(IHeader header, ManifestElement element) { String friends = element.getDirective(ICoreConstants.FRIENDS_DIRECTIVE); String internal = element.getDirective(ICoreConstants.INTERNAL_DIRECTIVE); if (friends != null && internal != null) { String message = NLS.bind(PDECoreMessages.BundleErrorReporter_directive_hasNoEffectWith_, new String[] {ICoreConstants.FRIENDS_DIRECTIVE, ICoreConstants.INTERNAL_DIRECTIVE}); IMarker marker = report(message, getPackageLine(header, element), CompilerFlags.WARNING, PDEMarkerFactory.M_DIRECTIVE_HAS_NO_EFFECT, PDEMarkerFactory.CAT_OTHER); addMarkerAttribute(marker, "packageName", element.getValue()); //$NON-NLS-1$ } }
private static void checkExtensionBundle(String headerKey, ManifestElement[] elements) throws BundleException { if (elements.length == 0 || elements[0].getDirective(Constants.EXTENSION_DIRECTIVE) == null) return; String hostName = elements[0].getValue(); // XXX: The extension bundle check is done against system.bundle and org.eclipse.osgi if (!hostName.equals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) && !hostName.equals(Constants.getInternalSymbolicName())) { String message = NLS.bind(Msg.MANIFEST_INVALID_HEADER_EXCEPTION, headerKey, elements[0].toString()); throw new BundleException(message + " : " + NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName), BundleException.MANIFEST_ERROR); //$NON-NLS-1$ } }
private boolean isFrameworkExtension(BundleDescription bundle) { OsgiManifest mf = manifestReader.loadManifest(new File(bundle.getLocation())); ManifestElement[] elements = mf.getManifestElements(Constants.FRAGMENT_HOST); if (elements.length == 1) { if (Constants.EXTENSION_FRAMEWORK.equals(elements[0].getDirective(Constants.EXTENSION_DIRECTIVE))) { return true; } } return false; } }
private static void checkExtensionBundle(String headerKey, ManifestElement[] elements) throws BundleException { if (elements.length == 0 || elements[0].getDirective(Constants.EXTENSION_DIRECTIVE) == null) return; String hostName = elements[0].getValue(); // XXX: The extension bundle check is done against system.bundle and org.eclipse.osgi if (!hostName.equals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) && !hostName.equals(Constants.getInternalSymbolicName())) { String message = NLS.bind(Msg.MANIFEST_INVALID_HEADER_EXCEPTION, headerKey, elements[0].toString()); throw new BundleException(message + " : " + NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName), BundleException.MANIFEST_ERROR); //$NON-NLS-1$ } } }
private static BundleSpecification createRequiredBundle(ManifestElement spec) { BundleSpecificationImpl result = new BundleSpecificationImpl(); result.setName(spec.getValue()); result.setVersionRange(getVersionRange(spec.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE))); result.setExported(Constants.VISIBILITY_REEXPORT.equals(spec.getDirective(Constants.VISIBILITY_DIRECTIVE)) || "true".equals(spec.getAttribute(Constants.REPROVIDE_ATTRIBUTE))); //$NON-NLS-1$ result.setOptional(Constants.RESOLUTION_OPTIONAL.equals(spec.getDirective(Constants.RESOLUTION_DIRECTIVE)) || "true".equals(spec.getAttribute(Constants.OPTIONAL_ATTRIBUTE))); //$NON-NLS-1$ result.setAttributes(getAttributes(spec, DEFINED_BSN_MATCHING_ATTRS)); return result; }
static BundleSpecification createRequiredBundle(ManifestElement spec) { BundleSpecificationImpl result = new BundleSpecificationImpl(); result.setName(spec.getValue()); result.setVersionRange(getVersionRange(spec.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE))); result.setExported(Constants.VISIBILITY_REEXPORT.equals(spec.getDirective(Constants.VISIBILITY_DIRECTIVE)) || "true".equals(spec.getAttribute(StateImpl.REPROVIDE_ATTRIBUTE))); //$NON-NLS-1$ result.setOptional(Constants.RESOLUTION_OPTIONAL.equals(spec.getDirective(Constants.RESOLUTION_DIRECTIVE)) || "true".equals(spec.getAttribute(StateImpl.OPTIONAL_ATTRIBUTE))); //$NON-NLS-1$ result.setAttributes(getAttributes(spec, DEFINED_BSN_MATCHING_ATTRS)); result.setArbitraryDirectives(getDirectives(spec, DEFINED_REQUIRE_BUNDLE_DIRECTIVES)); return result; }
static BundleSpecification createRequiredBundle(ManifestElement spec) { BundleSpecificationImpl result = new BundleSpecificationImpl(); result.setName(spec.getValue()); result.setVersionRange(getVersionRange(spec.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE))); result.setExported(Constants.VISIBILITY_REEXPORT.equals(spec.getDirective(Constants.VISIBILITY_DIRECTIVE)) || "true".equals(spec.getAttribute(StateImpl.REPROVIDE_ATTRIBUTE))); //$NON-NLS-1$ result.setOptional(Constants.RESOLUTION_OPTIONAL.equals(spec.getDirective(Constants.RESOLUTION_DIRECTIVE)) || "true".equals(spec.getAttribute(StateImpl.OPTIONAL_ATTRIBUTE))); //$NON-NLS-1$ result.setAttributes(getAttributes(spec, DEFINED_BSN_MATCHING_ATTRS)); result.setArbitraryDirectives(getDirectives(spec, DEFINED_REQUIRE_BUNDLE_DIRECTIVES)); return result; }