1 2 24 package org.enhydra.tool.archive; 25 26 import org.enhydra.tool.common.FileUtil; 28 import org.enhydra.tool.common.PathHandle; 29 import org.enhydra.tool.common.ResUtil; 30 31 import java.io.File ; 33 import java.io.FileFilter ; 34 import java.util.ResourceBundle ; 35 import java.util.Arrays ; 36 import java.util.ArrayList ; 37 38 public class EarPlan extends JarPlan { 40 41 private String appName = new String (); 43 private String appDesc = "Application description"; private String [] eModules = new String [0]; 45 private WebApplication[] webApps = new WebApplication[0]; 46 private boolean alt = false; 47 private boolean copyClient = true; 48 49 public EarPlan() {} 50 51 public boolean isAlt() { 52 return alt; 53 } 54 55 public void setAlt(boolean a) { 56 alt = a; 57 } 58 59 public boolean isCopyClient() { 60 return copyClient; 61 } 62 63 public void setCopyClient(boolean c) { 64 copyClient = c; 65 } 66 67 public String getAppName() { 68 return appName; 69 } 70 71 public void setAppName(String n) { 72 appName = n; 73 } 74 75 public String getDescription() { 76 return appDesc; 77 } 78 79 public void setDescription(String d) { 80 appDesc = d.replace('\n', ' '); 81 } 82 83 public String [] getEnterpriseModules() { 84 return eModules; 85 } 86 87 public void setEnterpriseModules(String [] in) { 88 eModules = in; 89 } 90 91 public WebApplication[] getWebApplications() { 92 return webApps; 93 } 94 95 public void setWebApplications(WebApplication[] apps) { 96 webApps = apps; 97 } 98 99 public void addWebApplication(String war) { 100 ArrayList list = null; 101 102 list = new ArrayList (Arrays.asList(webApps)); 103 list.add(new WebApplication(war)); 104 list.trimToSize(); 105 webApps = new WebApplication[list.size()]; 106 webApps = (WebApplication[]) list.toArray(webApps); 107 list.clear(); 108 } 109 110 public void addEnterpriseModule(String mod) { 111 ArrayList list = null; 112 113 list = new ArrayList (Arrays.asList(eModules)); 114 list.add(mod); 115 list.trimToSize(); 116 eModules = new String [list.size()]; 117 eModules = (String []) list.toArray(eModules); 118 list.clear(); 119 } 120 121 public Module[] getAllModules() { 122 ArrayList list = new ArrayList (); 123 String [] ePaths = getEnterpriseModules(); 124 Module[] mods = new Module[ePaths.length]; 125 126 for (int i = 0; i < mods.length; i++) { 127 mods[i] = new Module(ePaths[i]); 128 } 129 list.addAll(Arrays.asList(mods)); 130 list.addAll(Arrays.asList(getWebApplications())); 131 list.trimToSize(); 132 mods = new Module[list.size()]; 133 mods = (Module[]) list.toArray(mods); 134 list.clear(); 135 return mods; 136 } 137 138 public boolean equals(Object comp) { 139 EarPlan plan = null; 140 boolean equal = false; 141 142 if (comp instanceof EarPlan) { 143 plan = (EarPlan) comp; 144 equal = super.equals(comp); 145 } 146 if (equal) { 147 if (plan.getAppName() == null && getAppName() == null) {} 148 else if (plan.getAppName().equals(getAppName())) {} 149 else { 150 equal = false; 151 } 152 } 153 if (equal) { 154 if (plan.getDescription() == null && getDescription() == null) {} 155 else if (plan.getDescription().equals(getDescription())) {} 156 else { 157 equal = false; 158 } 159 } 160 if (equal) { 161 if (!(plan.isAlt() == isAlt())) { 162 equal = false; 163 } 164 } 165 if (equal) { 166 if (!(plan.isCopyClient() == isCopyClient())) { 167 equal = false; 168 } 169 } 170 if (equal) { 171 if (!Arrays.equals(plan.getWebApplications(), 172 getWebApplications())) { 173 equal = false; 174 } 175 } 176 if (equal) { 177 if (!Arrays.equals(plan.getEnterpriseModules(), 178 getEnterpriseModules())) { 179 equal = false; 180 } 181 } 182 return equal; 183 } 184 185 } 186 | Popular Tags |