Package org.apache.cocoon.maven.deployer.monolithic

Examples of org.apache.cocoon.maven.deployer.monolithic.XPatchDeployer


            WebApplicationRewriter.shieldWebapp(new File(getWebappDirectory(), "WEB-INF"), getLog(), this.useShieldingRepository);
        }
    }

    public static void xpatch(final Map libraries, File[] xpatchFiles, final File basedir, Log log) throws DeploymentException {
        XPatchDeployer xwebPatcher = new XPatchDeployer("WEB-INF");
        xwebPatcher.setBasedir(basedir);
        xwebPatcher.setLogger(log);
        // iterate over all blocks that need to be installed into a J2EE web
        // application
        for (Iterator it = libraries.entrySet().iterator(); it.hasNext();) {
            final Map.Entry entry = (Map.Entry) it.next();
            final Object id = entry.getKey();
            File lib = (File) entry.getValue();
            try {
                log.debug("Scanning " + id);
                RuleBasedZipExtractor zipExtractor = new RuleBasedZipExtractor(basedir, log);
                // add the matching/execution rules
                zipExtractor.addRule("META-INF/cocoon/xpatch/*.xweb", xwebPatcher);
                // extract all configurations files
                zipExtractor.extract(lib);
            } catch (IOException e) {
                throw new DeploymentException("Can't deploy '" + lib.getAbsolutePath() + "'.", e);
            }
        }

        for (int i = 0; i < xpatchFiles.length; i++ ) {
            File patch = xpatchFiles[i];
            try {
                xwebPatcher.addPatch(patch);
                log.info("Adding xpatch: " + patch);
            } catch (IOException e) {
                throw new DeploymentException("Can't use patches '" + patch + "'.", e);
            }
        }

        InputStream sourceWebXmlFile = null;
        File webXml = new File(basedir, "WEB-INF/web.xml");
        try {
            sourceWebXmlFile = new FileInputStream(webXml);
            xwebPatcher.applyPatches(sourceWebXmlFile, "WEB-INF/web.xml");
        } catch (FileNotFoundException e) {
            throw new DeploymentException("Can't apply patches on " + webXml + ".", e);
        } finally {
            IOUtils.closeQuietly(sourceWebXmlFile);
        }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.maven.deployer.monolithic.XPatchDeployer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.