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 36 40 public final class Ejb extends AbstractJ2eeFile { 41 42 static final String IMPL = "Bean"; 43 static final String INTF = "Business"; 44 static final String HOME = "Home"; 45 static final String LOCAL = "Local"; 46 static final String REMOTE = "Remote"; 47 private boolean isLocal; 48 private boolean isRemote; 49 private String beanImpl; 51 52 53 public Ejb(String fqName, Project p, boolean local, boolean remote) { 54 super(fqName, p); 55 isLocal = local; 56 isRemote = remote; 57 beanImpl = name + IMPL; 58 } 59 60 public Ejb(String fqName, Project p, boolean local, 61 boolean remote, String srcRoot) { 62 super(fqName, p, srcRoot); 63 isLocal = local; 64 isRemote = remote; 65 beanImpl = name + IMPL; 66 } 67 68 public String [] checkExistingFiles() { 69 List l = new ArrayList (); 70 if (!implClassExists()) { 71 l.add(MESSAGE.replaceAll("\\$0", "Bean impl class")); 72 } 73 if (isLocal) { 74 if (!localIntfExists()) { 75 l.add(MESSAGE.replaceAll("\\$0", "Local interface class")); 76 } 77 if (!localBusIntfExists()) { 78 l.add(MESSAGE.replaceAll("\\$0", "Local business interface class")); 79 } 80 if (!localHomeIntfExists()) { 81 l.add(MESSAGE.replaceAll("\\$0", "Local home interface class")); 82 } 83 } 84 if (isRemote) { 85 if (!remoteIntfExists()) { 86 l.add(MESSAGE.replaceAll("\\$0", "Remote interface class")); 87 } 88 if (!remoteBusIntfExists()) { 89 l.add(MESSAGE.replaceAll("\\$0", "Remote business interface class")); 90 } 91 if (!remoteHomeIntfExists()) { 92 l.add(MESSAGE.replaceAll("\\$0", "Remote home interface class")); 93 } 94 } 95 return (String []) l.toArray(new String [l.size()]); 96 } 97 98 private boolean implClassExists() { 99 String res = pkgName.replace('.', File.separatorChar) + beanImpl + ".java"; 100 return srcFileExist(res); 103 } 104 105 private boolean localIntfExists() { 106 String res = pkgName.replace('.', File.separatorChar) + name + LOCAL + ".java"; 107 return srcFileExist(res); 109 } 110 111 private boolean localBusIntfExists() { 112 String res = pkgName.replace('.', File.separatorChar) + name + LOCAL + INTF + ".java"; 113 return srcFileExist(res); 115 } 116 117 private boolean localHomeIntfExists() { 118 String res = pkgName.replace('.', File.separatorChar) + name + LOCAL + HOME + ".java"; 119 return srcFileExist(res); 121 } 122 123 private boolean remoteIntfExists() { 124 String res = pkgName.replace('.', File.separatorChar) + name + REMOTE + ".java"; 125 return srcFileExist(res); 127 } 128 129 private boolean remoteBusIntfExists() { 130 String res = pkgName.replace('.', File.separatorChar) + name + REMOTE + INTF + ".java"; 131 return srcFileExist(res); 133 } 134 135 private boolean remoteHomeIntfExists() { 136 String res = pkgName.replace('.', File.separatorChar) + name + REMOTE + HOME + ".java"; 137 return srcFileExist(res); 139 } 140 } 141 | Popular Tags |