public void parse() { String adviceVersion = advice.get(ADVICE_VERSION); if (adviceVersion != null) checkAdviceVersion(adviceVersion); next(); parseProperties(PROPERTIES_PREFIX, adviceProperties); else if (current.startsWith(UPDATE_DESCRIPTOR_PREFIX)) this.adviceUpdateDescriptor = parseUpdateDescriptor(UPDATE_DESCRIPTOR_PREFIX, hostId); else if (current.startsWith(PROVIDES_PREFIX)) parseProvides(PROVIDES_PREFIX, adviceProvides); else if (current.startsWith(REQUIRES_PREFIX)) parseRequires(REQUIRES_PREFIX, adviceRequires); else if (current.startsWith(META_REQUIREMENTS_PREFIX)) parseRequires(META_REQUIREMENTS_PREFIX, adviceMetaRequires); else if (current.startsWith(INSTRUCTIONS_PREFIX)) parseInstructions(INSTRUCTIONS_PREFIX, adviceInstructions); else if (current.startsWith(UNITS_PREFIX)) parseUnits(UNITS_PREFIX, adviceOtherIUs); else if (current.equals(ADVICE_VERSION)) { next(); } else { next();
private void parseProperty(String prefix, Map<String, String> properties) { String propertyName = null; String propertyValue = null; while (current != null && current.startsWith(prefix)) { String token = current.substring(prefix.length()); if (token.equals(NAME)) { propertyName = currentValue(); } else if (token.equals(VALUE)) { propertyValue = currentValue(); } else { // we ignore elements we do not understand } next(); } properties.put(propertyName, propertyValue); }
private void parseLicenses(String prefix, List<ILicense> licenses) { while (current != null && current.startsWith(prefix)) { int dotIndex = current.indexOf('.', prefix.length()); if (dotIndex != -1) throw new IllegalStateException("bad token: " + current + " = " + currentValue()); //$NON-NLS-1$ //$NON-NLS-2$ parseLicense(current, licenses); } }
private void parseUnits(String prefix, List<InstallableUnitDescription> ius) { while (current != null && current.startsWith(prefix)) { int dotIndex = current.indexOf('.', prefix.length()); if (dotIndex == -1) throw new IllegalStateException("bad token: " + current + " = " + currentValue()); //$NON-NLS-1$ //$NON-NLS-2$ parseUnit(current.substring(0, dotIndex + 1), ius); } }
private void parseArtifacts(String prefix, List<IArtifactKey> artifacts) { while (current != null && current.startsWith(prefix)) { int dotIndex = current.indexOf('.', prefix.length()); if (dotIndex == -1) throw new IllegalStateException("bad token: " + current + " = " + currentValue()); //$NON-NLS-1$ //$NON-NLS-2$ parseArtifact(current.substring(0, dotIndex + 1), artifacts); } }
return; AdviceFileParser parser = new AdviceFileParser(id, version, advice); try { parser.parse(); } catch (Exception e) { String message = "An error occured while parsing advice file: basePath=" + basePath + ", adviceFilePath=" + adviceFilePath + "."; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return; touchpointInstructions = parser.getTouchpointInstructions(); providedCapabilities = parser.getProvidedCapabilities(); requiredCapabilities = parser.getRequiredCapabilities(); metaRequiredCapabilities = parser.getMetaRequiredCapabilities(); iuProperties = parser.getProperties(); additionalIUs = parser.getAdditionalInstallableUnitDescriptions(); updateDescriptor = parser.getUpdateDescriptor(); containsAdvice = true;
String token = current.substring(prefix.length()); if (token.equals(ID)) { unitId = currentValue(); next(); } else if (token.equals(VERSION)) { unitVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); next(); } else if (token.equals(SINGLETON)) { unitSingleton = Boolean.parseBoolean(currentValue()); next(); } else if (token.equals(FILTER)) { unitFilter = currentValue(); next(); } else if (token.equals(COPYRIGHT)) { unitCopyright = currentValue(); next(); } else if (token.equals(COPYRIGHT_LOCATION)) { unitCopyrightLocation = currentValue(); next(); } else if (token.equals(TOUCHPOINT_ID)) { unitTouchpointId = currentValue(); next(); } else if (token.equals(TOUCHPOINT_VERSION)) { unitTouchpointVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); next(); } else if (token.equals(UPDATE_ID)) { unitUpdateId = currentValue(); next(); } else if (token.equals(UPDATE_RANGE)) {
private void parseProvided(String prefix, List<IProvidedCapability> provides) { String namespace = null; String name = null; Version capabilityVersion = null; while (current != null && current.startsWith(prefix)) { String token = current.substring(prefix.length()); if (token.equals(NAME)) { name = currentValue(); } else if (token.equals(NAMESPACE)) { namespace = currentValue(); } else if (token.equals(VERSION)) { capabilityVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); } else { // we ignore elements we do not understand } next(); } IProvidedCapability capability = MetadataFactory.createProvidedCapability(namespace, name, capabilityVersion); provides.add(capability); }
String token = current.substring(prefix.length()); if (token.equals(GREEDY)) { greedy = Boolean.parseBoolean(currentValue()); } else if (token.equals(OPTIONAL)) { optional = Boolean.parseBoolean(currentValue()); } else if (token.equals(MULTIPLE)) { multiple = Boolean.parseBoolean(currentValue()); } else if (token.equals(FILTER)) { filter = currentValue(); } else if (token.equals(NAME)) { name = currentValue(); } else if (token.equals(NAMESPACE)) { namespace = currentValue(); } else if (token.equals(RANGE)) { range = new VersionRange(substituteVersionAndQualifier(currentValue())); } else if (token.equals(MIN)) { min = Integer.valueOf(currentValue()).intValue(); } else if (token.equals(MAX)) { max = Integer.valueOf(currentValue()).intValue(); } else if (token.equals(MATCH_EXP)) { matchExp = currentValue(); } else { next(); capability = createRequirement(namespace, name, range, filter, min, max, greedy); } else { capability = createRequirement(namespace, name, range, filter, optional, multiple, greedy);
parser.parse(); } catch (Exception e) { final IProvidedCapability[] provided = parser.getProvidedCapabilities(); final IRequirement[] required = parser.getRequiredCapabilities();
@Override protected IRequirement createRequirement(String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple, boolean greedy) { if (optionalAction == OptionalResolutionAction.OPTIONAL) { return super.createRequirement(namespace, name, range, filter, optional, multiple, greedy); } return BundleDependenciesAction.this.createRequirement(namespace, name, range, filter, optional, multiple, greedy); } };
return; AdviceFileParser parser = new AdviceFileParser(id, version, advice); try { parser.parse(); } catch (Exception e) { String message = "An error occured while parsing advice file: basePath=" + basePath + ", adviceFilePath=" + adviceFilePath + "."; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return; touchpointInstructions = parser.getTouchpointInstructions(); providedCapabilities = parser.getProvidedCapabilities(); requiredCapabilities = parser.getRequiredCapabilities(); metaRequiredCapabilities = parser.getMetaRequiredCapabilities(); iuProperties = parser.getProperties(); additionalIUs = parser.getAdditionalInstallableUnitDescriptions(); updateDescriptor = parser.getUpdateDescriptor(); containsAdvice = true;
String token = current.substring(prefix.length()); if (token.equals(ID)) { unitId = currentValue(); next(); } else if (token.equals(VERSION)) { unitVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); next(); } else if (token.equals(SINGLETON)) { unitSingleton = Boolean.valueOf(currentValue()).booleanValue(); next(); } else if (token.equals(FILTER)) { unitFilter = currentValue(); next(); } else if (token.equals(COPYRIGHT)) { unitCopyright = currentValue(); next(); } else if (token.equals(COPYRIGHT_LOCATION)) { unitCopyrightLocation = currentValue(); next(); } else if (token.equals(TOUCHPOINT_ID)) { unitTouchpointId = currentValue(); next(); } else if (token.equals(TOUCHPOINT_VERSION)) { unitTouchpointVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); next(); } else if (token.equals(UPDATE_ID)) { unitUpdateId = currentValue(); next(); } else if (token.equals(UPDATE_RANGE)) {
private void parseArtifact(String prefix, List<IArtifactKey> artifacts) { String artifactClassifier = null; String artifactId = null; Version artifactVersion = null; while (current != null && current.startsWith(prefix)) { String token = current.substring(prefix.length()); if (token.equals(CLASSIFIER)) { artifactClassifier = currentValue(); } else if (token.equals(ID)) { artifactId = currentValue(); } else if (token.equals(VERSION)) { artifactVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); } else { // we ignore elements we do not understand } next(); } IArtifactKey artifactKey = new ArtifactKey(artifactClassifier, artifactId, artifactVersion); artifacts.add(artifactKey); }
String token = current.substring(prefix.length()); if (token.equals(GREEDY)) { greedy = Boolean.parseBoolean(currentValue()); } else if (token.equals(OPTIONAL)) { optional = Boolean.parseBoolean(currentValue()); } else if (token.equals(MULTIPLE)) { multiple = Boolean.parseBoolean(currentValue()); } else if (token.equals(FILTER)) { filter = currentValue(); } else if (token.equals(NAME)) { name = currentValue(); } else if (token.equals(NAMESPACE)) { namespace = currentValue(); } else if (token.equals(RANGE)) { range = VersionRange.create(substituteVersionAndQualifier(currentValue())); } else if (token.equals(MIN)) { min = Integer.valueOf(currentValue()).intValue(); } else if (token.equals(MAX)) { max = Integer.valueOf(currentValue()).intValue(); } else if (token.equals(MATCH_EXP)) { matchExp = currentValue(); } else { next(); capability = createRequirement(namespace, name, range, filter, min, max, greedy); } else { capability = createRequirement(namespace, name, range, filter, optional, multiple, greedy);
private void parseUnits(String prefix, List<InstallableUnitDescription> ius) { while (current != null && current.startsWith(prefix)) { int dotIndex = current.indexOf('.', prefix.length()); if (dotIndex == -1) throw new IllegalStateException("bad token: " + current + " = " + currentValue()); //$NON-NLS-1$ //$NON-NLS-2$ parseUnit(current.substring(0, dotIndex + 1), ius); } }
private void parseArtifacts(String prefix, List<IArtifactKey> artifacts) { while (current != null && current.startsWith(prefix)) { int dotIndex = current.indexOf('.', prefix.length()); if (dotIndex == -1) throw new IllegalStateException("bad token: " + current + " = " + currentValue()); //$NON-NLS-1$ //$NON-NLS-2$ parseArtifact(current.substring(0, dotIndex + 1), artifacts); } }
private void parseLicenses(String prefix, List<ILicense> licenses) { while (current != null && current.startsWith(prefix)) { int dotIndex = current.indexOf('.', prefix.length()); if (dotIndex != -1) throw new IllegalStateException("bad token: " + current + " = " + currentValue()); //$NON-NLS-1$ //$NON-NLS-2$ parseLicense(current, licenses); } }
return; AdviceFileParser parser = new AdviceFileParser(id, version, advice); try { parser.parse(); } catch (Exception e) { String message = "An error occured while parsing advice file: basePath=" + basePath + ", adviceFilePath=" + adviceFilePath + "."; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return; touchpointInstructions = parser.getTouchpointInstructions(); providedCapabilities = parser.getProvidedCapabilities(); requiredCapabilities = parser.getRequiredCapabilities(); metaRequiredCapabilities = parser.getMetaRequiredCapabilities(); iuProperties = parser.getProperties(); additionalIUs = parser.getAdditionalInstallableUnitDescriptions(); updateDescriptor = parser.getUpdateDescriptor(); containsAdvice = true;
String token = current.substring(prefix.length()); if (token.equals(ID)) { unitId = currentValue(); next(); } else if (token.equals(VERSION)) { unitVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); next(); } else if (token.equals(SINGLETON)) { unitSingleton = Boolean.valueOf(currentValue()).booleanValue(); next(); } else if (token.equals(FILTER)) { unitFilter = currentValue(); next(); } else if (token.equals(COPYRIGHT)) { unitCopyright = currentValue(); next(); } else if (token.equals(COPYRIGHT_LOCATION)) { unitCopyrightLocation = currentValue(); next(); } else if (token.equals(TOUCHPOINT_ID)) { unitTouchpointId = currentValue(); next(); } else if (token.equals(TOUCHPOINT_VERSION)) { unitTouchpointVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); next(); } else if (token.equals(UPDATE_ID)) { unitUpdateId = currentValue(); next(); } else if (token.equals(UPDATE_RANGE)) {