1 19 28 29 package org.netbeans.test.j2ee.lib; 30 31 import java.io.File ; 32 import java.util.ArrayList ; 33 import java.util.List ; 34 import org.netbeans.api.project.Project; 35 import org.netbeans.modules.j2ee.ejbjarproject.EjbJarProject; 36 37 38 42 public final class WebSvc extends AbstractJ2eeFile { 43 44 static final String SEI = "SEI"; 45 static final String BEAN_IMPL = "Bean"; 46 static final String IMPL = "Impl"; 47 static final String CONFIG = "-config.xml"; 48 static final String WS_XML = "webservices.xml"; 49 private String wsIntf; 50 private String wsImpl; 51 private String wsConfig; 52 53 54 public WebSvc(String fqName, Project p) { 55 super(fqName, p); 56 wsIntf = name + SEI; 57 wsImpl = name + ((isEjbMod) ? BEAN_IMPL : IMPL); 58 wsConfig = name + CONFIG; 59 } 60 61 public WebSvc(String fqName, Project p, String srcRoot) { 62 super(fqName, p, srcRoot); 63 wsIntf = name + SEI; 64 wsImpl = name + ((isEjbMod) ? BEAN_IMPL : IMPL); 65 wsConfig = name + CONFIG; 66 } 67 68 private boolean implClassExists() { 69 String res = pkgName.replace('.', File.separatorChar) + wsImpl + ".java"; 70 return srcFileExist(res); 73 } 74 75 private boolean seiClassExists() { 76 String res = pkgName.replace('.', File.separatorChar) + wsIntf + ".java"; 77 return srcFileExist(res); 79 } 80 81 private boolean configXmlExists() { 82 String res = pkgName.replace('.', File.separatorChar) + wsConfig; 83 return srcFileExist(res); 85 } 86 87 private boolean websvcXmlExists() { 88 return confFileExist(WS_XML); 90 } 91 92 public String [] checkExistingFiles() { 93 List l = new ArrayList (); 94 if (!implClassExists()) { 95 l.add(MESSAGE.replaceAll("\\$0", "WS impl class")); 96 } 97 if (!seiClassExists()) { 98 l.add(MESSAGE.replaceAll("\\$0", "WS sei class")); 99 } 100 if (!configXmlExists()) { 101 l.add(MESSAGE.replaceAll("\\$0", "WS config file")); 102 } 103 if (!websvcXmlExists()) { 104 l.add(MESSAGE.replaceAll("\\$0", "Webservices.xml file")); 105 } 106 return (String []) l.toArray(new String [l.size()]); 107 } 108 } 109 | Popular Tags |