    public void readResourceTypes() throws ConfigurationException {
        try {
            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(true);
            Configuration config;
            config = builder.buildFromFile(resourceTypeConfigFile);
            if (log.isDebugEnabled()) log.debug("Resource types config file: " + resourceTypeConfigFile);
            Configuration resourceTypes[] = config.getChildren("resource-type");
            for (int i = 0; i < resourceTypes.length; i++) {
                try {
                    String packageName = resourceTypes[i].getAttribute("package"); 
                    log.info("Package: " + packageName);
                    URL packageURL = ResourceTypeRegistry.class.getClassLoader().getResource(packageName.replace('.','/'));
                    log.info("Package: " + packageURL.getFile());
                    File jarFile = new File(packageURL.getPath().substring(5, packageURL.getPath().indexOf("!")));
                    log.debug("Jar file: " + jarFile);
                    if (jarFile.isFile()) {
                        java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(jarFile);
                        java.util.Enumeration entries = zipFile.entries();
                        while (entries.hasMoreElements()) {
                            String entryName = ((java.util.zip.ZipEntry) entries.nextElement()).getName();
                            if (entryName.indexOf("resource.xml") >= 0 || entryName.indexOf("resource-") >= 0) {
                                log.info("Resource definition: " + entryName);
                                URL resourceURL = ResourceTypeRegistry.class.getClassLoader().getResource(entryName);
                                log.info("Resource config URL: " + resourceURL);
                                try {
                                    ResourceTypeDefinition rtd = new ResourceTypeDefinition(resourceURL.openStream());
                                    log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                                    log.debug("Classname: " + rtd.getResourceTypeClassname());
                                    hm.put(rtd.getResourceTypeUniversalName(), rtd);
                                } catch (Exception exception) {
                                    log.error("Exception re registring resource with package '" + packageName + "' and resource definition URL '" + resourceURL + "'!");
                                    log.error(exception, exception);
                                }
                            }
                        }
                    } else {
                        log.error("No such file: " + jarFile);
                    }
                } catch (Exception e) {
                    log.info("No package attribute, hence try src attribute...");
                    File resConfigFile = new File(resourceTypes[i].getAttribute("src"));
                    log.info("Source: " + resConfigFile);
                    if (!resConfigFile.isAbsolute()) {
                        resConfigFile = FileUtil.file(resourceTypeConfigFile.getParentFile().getAbsolutePath(), resourceTypes[i].getAttribute("src"));
                    }
                    if (resConfigFile.isDirectory()) {
                        File resDir = resConfigFile;
                        Iterator iter = FileUtils.listFiles(resDir, new WildcardFilter("resource*.xml"), null).iterator();
                        while (iter.hasNext()) {
                            resConfigFile = (File)iter.next();
                            log.debug("found resource config: " + resConfigFile);
                            ResourceTypeDefinition rtd = new ResourceTypeDefinition(resConfigFile);
                            if (log.isDebugEnabled()) {
                                log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                                log.debug("Classname: " + rtd.getResourceTypeClassname());
                            }
                            hm.put(rtd.getResourceTypeUniversalName(), rtd);
                        }
                    } else if (resConfigFile.isFile()) {
                        ResourceTypeDefinition rtd = new ResourceTypeDefinition(resConfigFile);
                        if (log.isDebugEnabled()) {
                            log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                            log.debug("Classname: " + rtd.getResourceTypeClassname());
                        }
                        hm.put(rtd.getResourceTypeUniversalName(), rtd);
                    } else {
                        log.error("No such file or directory: " + resConfigFile);
                    }
                }
            }    
        } catch (Exception e) {
            String errorMsg = "Failure while reading configuration: " + e.getMessage(); 
            log.error(errorMsg, e);
            throw new ConfigurationException(errorMsg, e);
        }
    }

    public void readResourceTypes() throws ConfigurationException {
        try {
            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder(true);
            Configuration config;
            config = builder.buildFromFile(resourceTypeConfigFile);
            if (log.isDebugEnabled()) log.debug("Resource types config file: " + resourceTypeConfigFile);
            Configuration resourceTypes[] = config.getChildren("resource-type");
            for (int i = 0; i < resourceTypes.length; i++) {
                try {
                    String packageName = resourceTypes[i].getAttribute("package"); 
                    log.info("Package: " + packageName);
                    URL packageURL = ResourceTypeRegistry.class.getClassLoader().getResource(packageName.replace('.','/'));
                    log.info("Package: " + packageURL.getFile());
                    File jarFile = new File(packageURL.getPath().substring(5, packageURL.getPath().indexOf("!")));
                    log.debug("Jar file: " + jarFile);
                    if (jarFile.isFile()) {
                        java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(jarFile);
                        java.util.Enumeration entries = zipFile.entries();
                        while (entries.hasMoreElements()) {
                            String entryName = ((java.util.zip.ZipEntry) entries.nextElement()).getName();
                            if (entryName.indexOf("resource.xml") >= 0 || entryName.indexOf("resource-") >= 0) {
                                log.info("Resource definition: " + entryName);
                                URL resourceURL = ResourceTypeRegistry.class.getClassLoader().getResource(entryName);
                                log.info("Resource config URL: " + resourceURL);
                                try {
                                    ResourceTypeDefinition rtd = new ResourceTypeDefinition(resourceURL.openStream());
                                    log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                                    log.debug("Classname: " + rtd.getResourceTypeClassname());
                                    hm.put(rtd.getResourceTypeUniversalName(), rtd);
                                } catch (Exception exception) {
                                    log.error("Exception re registring resource with package '" + packageName + "' and resource definition URL '" + resourceURL + "'!");
                                    log.error(exception, exception);
                                }
                            }
                        }
                    } else {
                        log.error("No such file: " + jarFile);
                    }
                } catch (Exception e) {
                    log.info("No package attribute, hence try src attribute...");
                    File resConfigFile = new File(resourceTypes[i].getAttribute("src"));
                    log.info("Source: " + resConfigFile);
                    if (!resConfigFile.isAbsolute()) {
                        resConfigFile = FileUtil.file(resourceTypeConfigFile.getParentFile().getAbsolutePath(), resourceTypes[i].getAttribute("src"));
                    }
                    if (resConfigFile.isDirectory()) {
                        File resDir = resConfigFile;
                        Iterator iter = FileUtils.listFiles(resDir, new WildcardFilter("resource*.xml"), null).iterator();
                        while (iter.hasNext()) {
                            resConfigFile = (File)iter.next();
                            log.debug("found resource config: " + resConfigFile);
                            ResourceTypeDefinition rtd = new ResourceTypeDefinition(resConfigFile);
                            if (log.isDebugEnabled()) {
                                log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                                log.debug("Classname: " + rtd.getResourceTypeClassname());
                            }
                            hm.put(rtd.getResourceTypeUniversalName(), rtd);
                        }
                    } else if (resConfigFile.isFile()) {
                        ResourceTypeDefinition rtd = new ResourceTypeDefinition(resConfigFile);
                        if (log.isDebugEnabled()) {
                            log.debug("Universal Name: " + rtd.getResourceTypeUniversalName());
                            log.debug("Classname: " + rtd.getResourceTypeClassname());
                        }
                        hm.put(rtd.getResourceTypeUniversalName(), rtd);
                    } else {
                        log.error("No such file or directory: " + resConfigFile);
                    }
                }
            }    
        } catch (Exception e) {
            log.error(e, e);
            String errorMsg = "Failure while reading configuration: " + e.getMessage(); 
            throw new ConfigurationException(errorMsg, e);
        }
    }
