@Override
    public void init (AbstractQueue<QueueElement> queue, Properties props) 
            throws MalformedURLException, ParserConfigurationException, 
                   TransformerConfigurationException {
        this.queue = queue;
        this.props = props;
        
        String strInputURL = System.getProperty("ncmInputURL");
        if (strInputURL == null) {
            logger.severe("System property ncmInputURL not set.");
            System.exit(1);
        } else {
            url = new URL(strInputURL);
        }

        // Check filter.
        String strFilter = props.getProperty("filter");
        if (strFilter != null) {
            filterFile = new File(strFilter);
            if (!filterFile.exists()) {
                throw new RuntimeException(filterFile.getPath() + ": does not exist.");
            } else if (!filterFile.isFile()) {
                throw new RuntimeException(filterFile.getPath() + ": is not a file.");
            }
            if (!filterFile.canRead()) {
                throw new RuntimeException(filterFile.getPath() + ": is not readable.");
            }
        } else {
            logger.config("No filter stylesheet configured.");
        }

        // Check stylesheet.
        String strTransform = props.getProperty("transform");
        if (strTransform != null) {
            transformFile = new File(strTransform);
            if (!transformFile.exists()) {
                throw new RuntimeException(transformFile.getPath() + ": does not exist.");
            } else if (!transformFile.isFile()) {
                throw new RuntimeException(transformFile.getPath() + ": is not a file.");
            }
            if (!transformFile.canRead()) {
                throw new RuntimeException(transformFile.getPath() + ": is not readable.");
            }
        } else {
            logger.config("No transform stylesheet configured.");
        }

        bDebug = props.getProperty("debug", "false").equalsIgnoreCase("true");

        // Prepare a document builder.
        docBuilderFactory = DocumentBuilderFactory.newInstance();
        docBuilderFactory.setNamespaceAware(true);
        docBuilder = docBuilderFactory.newDocumentBuilder();

        transformerFactory = TransformerFactory.newInstance();

        // Prepare a transfomer.
        transformer = transformerFactory.newTransformer();
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        transformer.setOutputProperty(OutputKeys.STANDALONE, "no");
        transformer.setOutputProperty("{http://xml.apache.org/xsl}indent-amount", "4");

        logger.fine("Using class " + docBuilderFactory.getClass().getCanonicalName() + " as DocumentBuilderFactory.");
        logger.fine("Using class " + transformerFactory.getClass().getCanonicalName() + " as TransformerFactory.");
    }