1 19 28 29 package org.netbeans.test.j2ee.lib; 30 31 import java.io.File ; 32 import org.netbeans.api.project.Project; 33 import org.netbeans.modules.j2ee.ejbjarproject.EjbJarProject; 34 import org.openide.filesystems.FileObject; 35 import org.openide.filesystems.FileUtil; 36 37 41 abstract class AbstractJ2eeFile { 42 43 protected static final String MESSAGE = "$0 does not exist."; 44 protected String pkgName; 45 protected FileObject prjRoot; 46 protected String name; 47 protected boolean isEjbMod; 48 protected String srcRoot; 49 50 51 public AbstractJ2eeFile(String fqName, Project p) { 52 this(fqName, p, "src/java"); 53 } 54 55 public AbstractJ2eeFile(String fqName, Project p, String srcRoot) { 56 int i = fqName.lastIndexOf('.') + 1; 57 name = fqName.substring(i); 58 pkgName = fqName.substring(0, i); 59 prjRoot = p.getProjectDirectory(); 60 isEjbMod = p instanceof EjbJarProject; 61 this.srcRoot = srcRoot; 62 } 63 64 protected boolean confFileExist(String name) { 65 boolean retVal = false; 66 String confDir = (isEjbMod) ? "src/conf" : "web/WEB-INF"; 67 File f = new File (FileUtil.toFile(prjRoot), confDir); 68 try { 69 File ff = new File (f, name); 70 retVal = ff.exists(); 73 } catch (Exception e) { 74 } 75 return retVal; 76 } 77 78 protected boolean srcFileExist(String name) { 79 boolean retVal = false; 80 File f = new File (FileUtil.toFile(prjRoot), srcRoot); 81 try { 82 File ff = new File (f, name); 83 retVal = ff.exists(); 86 } catch (Exception e) { 87 } 88 return retVal; 89 } 90 91 97 public abstract String [] checkExistingFiles(); 98 } 99 | Popular Tags |