* Loads all property files of the form 'oid*.map' from the given path.
* @param path relative to classpath e.g. 'codec/asn1'
*/
public static void loadOIDMap(String path)
{
ASN1ObjectIdentifier oid;
InputStream in;
Properties props;
Map.Entry entry;
Iterator i;
String key;
int n;
if (path == null)
{
throw new NullPointerException("path");
}
n = 0;
in = ClassLoader.getSystemResourceAsStream(path + "/oid0.map");
// trying different loaders and paths
if (in == null)
{
in = Repository.class.getResourceAsStream(path + "/oid0.map");
if (in == null)
{
in = Repository.class.getResourceAsStream(
"/" + path + "/oid0.map");
if (in == null)
{
log.error("Warning: could not get resource at " + path);
}
}
}
while (in != null)
{
try
{
props = new Properties();
props.load(in);
for (i = props.entrySet().iterator(); i.hasNext();)
{
entry = (Map.Entry)i.next();
key = (String)entry.getKey();
String classname = (String)entry.getValue();
String typereference = null;
int indexOfSemicolon = key.indexOf(';');
if (indexOfSemicolon != -1)
{
typereference = key.substring(
indexOfSemicolon + 1);
key = key.substring(
0,
indexOfSemicolon);
}
oid = new ASN1ObjectIdentifier(key.trim());
// oid to class mapping
map.put(oid, classname);
log.debug("map '" + key + "' -> '" + classname + "'");
if (typereference != null)
{
// module + typereference to class mapping
key = key.substring(0, key.lastIndexOf('.'));
oid = new ASN1ObjectIdentifier(key.trim());
Hashtable module = null;
if (modules.containsKey(oid))
{