private Boolean check(List<ManifestElement> pub, String packageName) { for (ManifestElement p : pub) { if (packageName.equals(p.getValue())) { return Boolean.TRUE; } } return Boolean.FALSE; }
protected void validateHeaderValue(IHeader header, String[] allowedValues) { ManifestElement[] elements = header.getElements(); if (elements.length > 0) { for (int i = 0; i < allowedValues.length; i++) { if (allowedValues[i].equals(elements[0].getValue())) { return; } } reportIllegalValue(header, elements[0].getValue()); } }
private boolean containsPackage(IHeader header, String name) { if (header != null) { ManifestElement[] elements = header.getElements(); for (int i = 0; i < elements.length; i++) { if (elements[i].getValue().equals(name)) return true; } } return false; }
private boolean containsPackage(IHeader header, String name) { if(header != null) { ManifestElement[] elements = header.getElements(); for (int i = 0; i < elements.length; i++) { if(elements[i].getValue().equals(name)) return true; } } return false; }
private boolean parseDirectoryShape() { ManifestElement[] bundleShapeElements = parseHeader("Eclipse-BundleShape"); return bundleShapeElements != null && bundleShapeElements.length > 0 && "dir".equals(bundleShapeElements[0].getValue()); }
public String getLabel() { String version = underlyingElement.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); String value = underlyingElement.getValue(); if (version == null) return value; if (Character.isDigit(version.charAt(0))) version = '(' + version + ')'; return value + ' ' + version; } }
protected void validateHeaderValue(IHeader header, String[] allowedValues) { ManifestElement[] elements = header.getElements(); if (elements.length > 0) { for (int i = 0; i < allowedValues.length; i++) { if (allowedValues[i].equals(elements[0].getValue())) { return; } } reportIllegalValue(header, elements[0].getValue()); } }
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 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 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 void validateBundleVersionAttribute(IHeader header, ManifestElement element) { String versionRange = element.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_MISSING_VERSION_REQ_BUNDLE); if (severity != CompilerFlags.IGNORE && versionRange == null) { report(NLS.bind(PDECoreMessages.BundleErrorReporter_MissingVersion, element.getValue()), getPackageLine(header, element), severity, PDEMarkerFactory.CAT_OTHER); } if (versionRange != null && !VersionUtil.validateVersionRange(versionRange).isOK()) { report(NLS.bind(UtilMessages.BundleErrorReporter_InvalidFormatInBundleVersion, element.getValue()), getPackageLine(header, element), CompilerFlags.ERROR, PDEMarkerFactory.CAT_FATAL); } }
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 void validateImportPackageVersion(IHeader header, ManifestElement element) { String version = element.getAttribute(Constants.VERSION_ATTRIBUTE); int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_MISSING_VERSION_IMP_PKG); if (severity != CompilerFlags.IGNORE && version == null) { report(NLS.bind(PDECoreMessages.BundleErrorReporter_MissingVersion, element.getValue()), getPackageLine(header, element), severity, PDEMarkerFactory.CAT_OTHER); } validateVersionAttribute(header, element, true); }
private void validateExportPackageVersion(IHeader header, ManifestElement element) { String version = element.getAttribute(Constants.VERSION_ATTRIBUTE); int severity = CompilerFlags.getFlag(fProject, CompilerFlags.P_MISSING_VERSION_EXP_PKG); if (severity != CompilerFlags.IGNORE && version == null) { report(NLS.bind(PDECoreMessages.BundleErrorReporter_MissingVersion, element.getValue()), getPackageLine(header, element), severity, PDEMarkerFactory.CAT_OTHER); } validateVersionAttribute(header, element, false); }
private void validateBundleVersionAttribute(IHeader header, ManifestElement element) { String versionRange = element.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); if (versionRange != null && !VersionUtil.validateVersionRange(versionRange).isOK()) { report(NLS.bind(PDECoreMessages.BundleErrorReporter_InvalidFormatInBundleVersion, element.getValue()), getPackageLine(header, element), CompilerFlags.ERROR, PDEMarkerFactory.CAT_FATAL); } }
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; }
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)); result.setArbitraryDirectives(getDirectives(spec, DEFINED_REQUIRE_BUNDLE_DIRECTIVES)); return result; }