view gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactFactoryUtilities.java @ 800:db5b04ecb426

ISSUE215: Improved ODV-Export. now all Columns which have identical values but different Parameters will be merged to one row. gnv-artifacts/trunk@882 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 06 Apr 2010 13:07:11 +0000
parents c4156275c1e1
children
line wrap: on
line source
package de.intevation.gnv.utils;

import de.intevation.artifacts.ArtifactFactory;

import org.apache.log4j.Logger;

import org.w3c.dom.Document;
import org.w3c.dom.Node;

/**
 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
 *
 */
public class ArtifactFactoryUtilities {
    /**
     * the logger, used to log exceptions and additonaly information
     */
    private static Logger log = Logger
            .getLogger(ArtifactFactoryUtilities.class);

    /**
     * Constructor
     */
    public ArtifactFactoryUtilities() {
    }

    public ArtifactFactory createArtitfactFactor(Document config,
                                                 Node artifactFactoryNode) {
        String className = artifactFactoryNode.getTextContent();

        ArtifactFactory factory = null;

        try {
            Class clazz = Class.forName(className);
            factory = (ArtifactFactory) clazz.newInstance();
        } catch (ClassNotFoundException cnfe) {
            log.error(cnfe.getLocalizedMessage(), cnfe);
        } catch (InstantiationException ie) {
            log.error(ie.getLocalizedMessage(), ie);
        } catch (ClassCastException cce) {
            log.error(cce.getLocalizedMessage(), cce);
        } catch (IllegalAccessException iae) {
            log.error(iae.getLocalizedMessage(), iae);
        }

        if (factory != null) {
            factory.setup(config, artifactFactoryNode);
            log.info("Registering '" + factory.getName()
                     + "' as artifact factory.");
        }
        return factory;
    }
}

http://dive4elements.wald.intevation.org