|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of thisfile are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.tomcat5.ide; import java.io.*; import javax.enterprise.deploy.spi.DeploymentConfiguration; import javax.enterprise.deploy.spi.exceptions.ConfigurationException; import javax.enterprise.deploy.model.DeployableObject; import javax.enterprise.deploy.shared.ModuleType; import org.netbeans.modules.j2ee.deployment.plugins.api.DeploymentPlanSplitter; import org.netbeans.modules.tomcat5.WebappConfiguration; /** Implementation of read/write for configuration that delegates to save/restore * methods of DeploymentConfiguration. * * @author Pavel Buzek */ public class TomcatPlanSplitter implements DeploymentPlanSplitter { private static final String DEPLOYMENT_PLAN_FNAME = "META-INF/context.xml"; //NOI18N /** Creates a new instance of TomcatPlanSplitter */ public TomcatPlanSplitter () { } public void readDeploymentPlanFiles (DeploymentConfiguration config, DeployableObject module, File[] files) throws ConfigurationException { if (!(config instanceof WebappConfiguration)) { //at least log org.openide.ErrorManager.getDefault ().log ("Tomcat is asked to read DeploymentConfiguration of another plugin"); } try { InputStream is = new BufferedInputStream (new FileInputStream (files[0]), 4086); config.restore (is); } catch (FileNotFoundException e) { throw new ConfigurationException (e.getLocalizedMessage ()); } } public void writeDeploymentPlanFiles (DeploymentConfiguration config, DeployableObject module, File[] files) throws ConfigurationException { if (!(config instanceof WebappConfiguration)) { //at least log org.openide.ErrorManager.getDefault ().log ("Tomcat is asked to write DeploymentConfiguration of another plugin"); } try { OutputStream os = new BufferedOutputStream (new FileOutputStream (files[0]), 4086); config.save (os); } catch (FileNotFoundException e) { throw new ConfigurationException (e.getLocalizedMessage ()); } } public String[] getDeploymentPlanFileNames (javax.enterprise.deploy.shared.ModuleType type) { if (type.equals (ModuleType.WAR)) { return new String [] {DEPLOYMENT_PLAN_FNAME}; } else { return null; } } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.