1 19 20 package org.netbeans.modules.tomcat5; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import java.io.InputStream ; 25 import java.io.OutputStream ; 26 import javax.enterprise.deploy.spi.DeploymentManager ; 27 import org.netbeans.modules.j2ee.deployment.plugins.api.AntDeploymentProvider; 28 import org.netbeans.modules.tomcat5.util.TomcatProperties; 29 import org.openide.ErrorManager; 30 import org.openide.filesystems.FileUtil; 31 32 36 public class AntDeploymentProviderImpl implements AntDeploymentProvider { 37 38 private TomcatManager tm; 39 40 public AntDeploymentProviderImpl(DeploymentManager dm) { 41 tm = (TomcatManager)dm; 42 } 43 44 public void writeDeploymentScript(OutputStream os, Object moduleType) throws IOException { 45 InputStream is = AntDeploymentProviderImpl.class.getResourceAsStream("resources/tomcat-ant-deploy.xml"); try { 47 FileUtil.copy(is, os); 48 } finally { 49 is.close(); 50 } 51 } 52 53 public File getDeploymentPropertiesFile() { 54 TomcatProperties tp = tm.getTomcatProperties(); 55 File file = tp.getAntDeploymentPropertiesFile(); 56 if (!file.exists()) { 57 try { 59 tp.storeAntDeploymentProperties(file, true); 60 } catch (IOException ioe) { 61 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ioe); 62 } 63 } 64 return file; 65 } 66 } 67 | Popular Tags |