Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2009-04-13 17:34:36 +0000
committerJohn Arthorne2009-04-13 17:34:36 +0000
commitef85873b64f6e846bfd232320014d1dc51c7d813 (patch)
treee34027cb46374104758135365c3412b6d0bb40e7 /bundles/org.eclipse.equinox.p2.metadata.repository
parent146570fa26f6878b5d83bd1b630a42eaa49de0a1 (diff)
downloadrt.equinox.p2-ef85873b64f6e846bfd232320014d1dc51c7d813.tar.gz
rt.equinox.p2-ef85873b64f6e846bfd232320014d1dc51c7d813.tar.xz
rt.equinox.p2-ef85873b64f6e846bfd232320014d1dc51c7d813.zip
Bug 271402 [repository] Metadataparser should use statics for required and optional attributes
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.metadata.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java6
2 files changed, 9 insertions, 8 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
index f5bb50878..a8ec4d7ee 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/MetadataParser.java
@@ -104,8 +104,6 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
protected class InstallableUnitHandler extends AbstractHandler {
- private final String[] required = new String[] {ID_ATTRIBUTE, VERSION_ATTRIBUTE};
- private final String[] optional = new String[] {SINGLETON_ATTRIBUTE};
InstallableUnitDescription currentUnit = null;
@@ -133,7 +131,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
public InstallableUnitHandler(AbstractHandler parentHandler, Attributes attributes, List units) {
super(parentHandler, INSTALLABLE_UNIT_ELEMENT);
- String[] values = parseAttributes(attributes, required, optional);
+ String[] values = parseAttributes(attributes, REQUIRED_IU_ATTRIBUTES, OPTIONAL_IU_ATTRIBUTES);
this.units = units;
//skip entire IU if the id is missing
if (values[0] == null)
@@ -484,11 +482,10 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
protected class ProvidedCapabilityHandler extends AbstractHandler {
- private final String[] required = new String[] {NAMESPACE_ATTRIBUTE, NAME_ATTRIBUTE, VERSION_ATTRIBUTE};
public ProvidedCapabilityHandler(AbstractHandler parentHandler, Attributes attributes, List capabilities) {
super(parentHandler, PROVIDED_CAPABILITY_ELEMENT);
- String[] values = parseRequiredAttributes(attributes, required);
+ String[] values = parseRequiredAttributes(attributes, REQUIRED_PROVIDED_CAPABILITY_ATTRIBUTES);
Version version = checkVersion(PROVIDED_CAPABILITY_ELEMENT, VERSION_ATTRIBUTE, values[2]);
capabilities.add(MetadataFactory.createProvidedCapability(values[0], values[1], version));
}
@@ -565,8 +562,6 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
}
protected class RequiredCapabilityHandler extends AbstractHandler {
- private final String[] required = new String[] {NAMESPACE_ATTRIBUTE, NAME_ATTRIBUTE, VERSION_RANGE_ATTRIBUTE};
- private final String[] optional = new String[] {CAPABILITY_OPTIONAL_ATTRIBUTE, CAPABILITY_MULTIPLE_ATTRIBUTE, CAPABILITY_GREED_ATTRIBUTE};
private IRequiredCapability currentCapability = null;
@@ -575,7 +570,7 @@ public abstract class MetadataParser extends XMLParser implements XMLConstants {
public RequiredCapabilityHandler(AbstractHandler parentHandler, Attributes attributes, List capabilities) {
super(parentHandler, REQUIRED_CAPABILITY_ELEMENT);
- String[] values = parseAttributes(attributes, required, optional);
+ String[] values = parseAttributes(attributes, REQIURED_CAPABILITY_ATTRIBUTES, OPTIONAL_CAPABILITY_ATTRIBUTES);
VersionRange range = checkVersionRange(REQUIRED_CAPABILITY_ELEMENT, VERSION_RANGE_ATTRIBUTE, values[2]);
boolean isOptional = checkBoolean(REQUIRED_CAPABILITY_ELEMENT, CAPABILITY_OPTIONAL_ATTRIBUTE, values[3], false).booleanValue();
boolean isMultiple = checkBoolean(REQUIRED_CAPABILITY_ELEMENT, CAPABILITY_MULTIPLE_ATTRIBUTE, values[4], false).booleanValue();
diff --git a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java
index 54dbd61ba..0d48f0206 100644
--- a/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java
+++ b/bundles/org.eclipse.equinox.p2.metadata.repository/src/org/eclipse/equinox/internal/p2/metadata/repository/io/XMLConstants.java
@@ -42,6 +42,7 @@ public interface XMLConstants extends org.eclipse.equinox.internal.p2.persistenc
public static final String REQUIRED_CAPABILITY_ELEMENT = "required"; //$NON-NLS-1$
public static final String PROVIDED_CAPABILITIES_ELEMENT = "provides"; //$NON-NLS-1$
public static final String PROVIDED_CAPABILITY_ELEMENT = "provided"; //$NON-NLS-1$
+ public static final String[] REQUIRED_PROVIDED_CAPABILITY_ATTRIBUTES = new String[] {NAMESPACE_ATTRIBUTE, NAME_ATTRIBUTE, VERSION_ATTRIBUTE};
public static final String TOUCHPOINT_TYPE_ELEMENT = "touchpoint"; //$NON-NLS-1$
public static final String TOUCHPOINT_DATA_ELEMENT = "touchpointData"; //$NON-NLS-1$
public static final String IU_FILTER_ELEMENT = "filter"; //$NON-NLS-1$
@@ -58,6 +59,8 @@ public interface XMLConstants extends org.eclipse.equinox.internal.p2.persistenc
// Constants for attributes of an installable unit element
public static final String SINGLETON_ATTRIBUTE = "singleton"; //$NON-NLS-1$
public static final String FRAGMENT_ATTRIBUTE = "fragment"; //$NON-NLS-1$
+ public static final String[] REQUIRED_IU_ATTRIBUTES = new String[] {ID_ATTRIBUTE, VERSION_ATTRIBUTE};
+ public static final String[] OPTIONAL_IU_ATTRIBUTES = new String[] {SINGLETON_ATTRIBUTE};
// Constants for sub-elements of a required capability element
public static final String CAPABILITY_FILTER_ELEMENT = "filter"; //$NON-NLS-1$
@@ -68,6 +71,8 @@ public interface XMLConstants extends org.eclipse.equinox.internal.p2.persistenc
public static final String CAPABILITY_OPTIONAL_ATTRIBUTE = "optional"; //$NON-NLS-1$
public static final String CAPABILITY_MULTIPLE_ATTRIBUTE = "multiple"; //$NON-NLS-1$
public static final String CAPABILITY_GREED_ATTRIBUTE = "greedy"; //$NON-NLS-1$
+ public static final String[] REQIURED_CAPABILITY_ATTRIBUTES = new String[] {NAMESPACE_ATTRIBUTE, NAME_ATTRIBUTE, VERSION_RANGE_ATTRIBUTE};
+ public static final String[] OPTIONAL_CAPABILITY_ATTRIBUTES = new String[] {CAPABILITY_OPTIONAL_ATTRIBUTE, CAPABILITY_MULTIPLE_ATTRIBUTE, CAPABILITY_GREED_ATTRIBUTE};
// Constants for attributes of an artifact key element
public static final String ARTIFACT_KEY_CLASSIFIER_ATTRIBUTE = "classifier"; //$NON-NLS-1$
@@ -82,4 +87,5 @@ public interface XMLConstants extends org.eclipse.equinox.internal.p2.persistenc
// Constants for attributes of an update descriptor
public static final String UPDATE_DESCRIPTOR_SEVERITY = "severity"; //$NON-NLS-1$
+
}

Back to the top