Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjfogell2006-02-10 18:18:54 -0500
committerjfogell2006-02-10 18:18:54 -0500
commit8182b2b8e0b3e9416709c48fc660ec972788073c (patch)
tree96c8aec61735cb52352eaab325bc65557739a508
parent67c9918da843c64d78e5a0e4d92f0e53319ce237 (diff)
downloadrt.equinox.bundles-8182b2b8e0b3e9416709c48fc660ec972788073c.tar.gz
rt.equinox.bundles-8182b2b8e0b3e9416709c48fc660ec972788073c.tar.xz
rt.equinox.bundles-8182b2b8e0b3e9416709c48fc660ec972788073c.zip
fix for 126055 - removed pid reference from OCDv20060213
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java13
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeInformationImpl.java13
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java19
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java13
4 files changed, 22 insertions, 36 deletions
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java
index 3475244e..40085e97 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/DataParser.java
@@ -76,8 +76,8 @@ public class DataParser {
Vector _dp_designateHandlers = new Vector(7);
// ObjectClassDefinitions in DataParser class w/ corresponding reference keys
Hashtable _dp_OCDs = new Hashtable(7);
- // ObjectClassDefinitions in DataParser class as a Vector
- Vector _dp_OCDs_vector = new Vector(7);
+ // pid to ObjectClassDefinitions in DataParser class as a Hashtable
+ Hashtable _dp_pid_to_OCDs_ = new Hashtable(7);
// Localization in DataParser class
String _dp_localization;
@@ -95,7 +95,7 @@ public class DataParser {
/*
* Main method to parse specific MetaData file.
*/
- public Vector doParse() {
+ public Hashtable doParse() {
try {
SAXParser saxParser = _dp_parserFactory.newSAXParser();
@@ -116,7 +116,7 @@ public class DataParser {
ioe.printStackTrace();
return null;
}
- return _dp_OCDs_vector;
+ return _dp_pid_to_OCDs_;
}
/*
@@ -333,13 +333,12 @@ public class DataParser {
ObjectClassDefinitionImpl ocd = (ObjectClassDefinitionImpl) _dp_OCDs.get(designateHandler._ocdref);
if (ocd != null) {
if (designateHandler._factory_val == null) {
- ocd.setPID(designateHandler._pid_val);
ocd.setType(ObjectClassDefinitionImpl.PID);
+ _dp_pid_to_OCDs_.put(designateHandler._pid_val,ocd);
} else {
- ocd.setPID(designateHandler._factory_val);
ocd.setType(ObjectClassDefinitionImpl.FPID);
+ _dp_pid_to_OCDs_.put(designateHandler._factory_val,ocd);
}
- _dp_OCDs_vector.addElement(ocd);
} else {
Logging.log(Logging.ERROR, this, "finished()", //$NON-NLS-1$
NLS.bind(MetaTypeMsg.OCD_ID_NOT_FOUND, designateHandler._ocdref));
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeInformationImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeInformationImpl.java
index f83ae098..aef834ad 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeInformationImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeInformationImpl.java
@@ -47,10 +47,9 @@ public class MetaTypeInformationImpl extends MetaTypeProviderImpl implements Met
}
Vector pids = new Vector(7);
- Enumeration e = _allPidOCDs.elements();
+ Enumeration e = _allPidOCDs.keys();
while (e.hasMoreElements()) {
- ObjectClassDefinitionImpl ocd = (ObjectClassDefinitionImpl) e.nextElement();
- pids.addElement(ocd.getPID());
+ pids.addElement(e.nextElement());
}
String[] retvalue = new String[pids.size()];
@@ -64,18 +63,14 @@ public class MetaTypeInformationImpl extends MetaTypeProviderImpl implements Met
* @see org.osgi.service.metatype.MetaTypeInformation#getFactoryPids()
*/
public String[] getFactoryPids() {
-
if (_allFPidOCDs.size() == 0) {
return new String[0];
}
-
Vector fpids = new Vector(7);
- Enumeration e = _allFPidOCDs.elements();
+ Enumeration e = _allFPidOCDs.keys();
while (e.hasMoreElements()) {
- ObjectClassDefinitionImpl ocd = (ObjectClassDefinitionImpl) e.nextElement();
- fpids.addElement(ocd.getPID());
+ fpids.addElement(e.nextElement());
}
-
String[] retvalue = new String[fpids.size()];
fpids.toArray(retvalue);
return retvalue;
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java
index fd3ebdeb..16141707 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/MetaTypeProviderImpl.java
@@ -88,7 +88,7 @@ public class MetaTypeProviderImpl implements MetaTypeProvider {
boolean _isMetaDataFile;
String fileName = (String) allFileKeys.nextElement();
- Vector allOCDsInFile = null;
+ Hashtable pidToOCD = null;
java.net.URL[] urls = FragmentUtils.findEntries(bundle, fileName);
if (urls != null) {
for (int i = 0; i < urls.length; i++) {
@@ -96,8 +96,8 @@ public class MetaTypeProviderImpl implements MetaTypeProvider {
// Assume all XML files are what we want by default.
_isMetaDataFile = true;
DataParser parser = new DataParser(bundle, urls[i], parserFactory);
- allOCDsInFile = parser.doParse();
- if (allOCDsInFile == null) {
+ pidToOCD = parser.doParse();
+ if (pidToOCD == null) {
_isMetaDataFile = false;
}
} catch (Exception e) {
@@ -105,17 +105,20 @@ public class MetaTypeProviderImpl implements MetaTypeProvider {
_isMetaDataFile = false;
}
- if ((_isMetaDataFile) && (allOCDsInFile != null)) {
+ if ((_isMetaDataFile) && (pidToOCD != null)) {
+
// We got some OCDs now.
- for (int j = 0; j < allOCDsInFile.size(); j++) {
- ObjectClassDefinitionImpl ocd = (ObjectClassDefinitionImpl) allOCDsInFile.elementAt(j);
+ Enumeration pids = pidToOCD.keys();
+ while (pids.hasMoreElements()) {
+ String pid = (String)pids.nextElement();
+ ObjectClassDefinitionImpl ocd = (ObjectClassDefinitionImpl) pidToOCD.get(pid);
if (ocd.getType() == ObjectClassDefinitionImpl.PID) {
isThereMetaHere = true;
- _allPidOCDs.put(ocd.getPID(), ocd);
+ _allPidOCDs.put(pid, ocd);
} else {
isThereMetaHere = true;
- _allFPidOCDs.put(ocd.getPID(), ocd);
+ _allFPidOCDs.put(pid, ocd);
}
} // End of for
}
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java
index 0c66b3a4..a0d6a1c6 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/ObjectClassDefinitionImpl.java
@@ -31,7 +31,7 @@ public class ObjectClassDefinitionImpl extends LocalizationElement implements Ob
String _name;
String _id;
String _description;
- String _pid;
+
int _type;
Vector _required = new Vector(7);
Vector _optional = new Vector(7);
@@ -106,17 +106,6 @@ public class ObjectClassDefinitionImpl extends LocalizationElement implements Ob
}
/*
- * Method to set the ID of ObjectClassDefinition.
- */
- void setPID(String pid) {
- this._pid = pid;
- }
-
- String getPID() {
- return _pid;
- }
-
- /*
* (non-Javadoc)
*
* @see org.osgi.service.metatype.ObjectClassDefinition#getDescription()

Back to the top