1 26 27 package org.objectweb.jonas.ant.cluster; 28 29 import java.io.File ; 30 import java.util.Iterator ; 31 32 import org.objectweb.jonas.ant.jonasbase.BaseTaskItf; 33 import org.objectweb.jonas.ant.jonasbase.WebContainer; 34 35 39 public class WebContainerCluster extends ClusterTasks { 40 41 44 private static final String INFO = "[WebContainerCluster] "; 45 46 49 private String name = null; 50 51 54 private String [] httpPortRange = null; 55 56 59 private String [] ajpPortRange = null; 60 61 64 private boolean stickySession = false; 65 66 69 private String [] modJkLbFactorRange = null; 70 71 74 private String [] directorPortRange = null; 75 76 79 private String [] directorLbFactorRange = null; 80 81 84 private String clusterMcastAddr = null; 85 86 89 private String clusterMcastPort = null; 90 91 94 private String [] clusterListenPortRange = null; 95 96 99 private String modjkDir = null; 100 101 104 private String directorDir = null; 105 106 109 public WebContainerCluster() { 110 super(); 111 } 112 113 117 public void setDirectorDir(String directorDir) { 118 this.directorDir = directorDir; 119 } 120 121 125 public void setModjkDir(String modjkDir) { 126 this.modjkDir = modjkDir; 127 } 128 129 133 public void setClusterMcastAddr(String clusterMcastAddr) { 134 this.clusterMcastAddr = clusterMcastAddr; 135 } 136 137 141 public void setClusterMcastPort(String clusterMcastPort) { 142 this.clusterMcastPort = clusterMcastPort; 143 } 144 145 149 public void setClusterListenPortRange(String clusterListenPortRange) { 150 this.clusterListenPortRange = clusterListenPortRange.split(","); 151 152 } 153 154 158 public void setHttpPortRange(String httpPortRange) { 159 this.httpPortRange = httpPortRange.split(","); 160 161 } 162 163 167 public void setAjpPortRange(String ajpPortRange) { 168 this.ajpPortRange = ajpPortRange.split(","); 169 170 } 171 172 176 public void setModJkLbFactorRange(String modJkLbFactorRange) { 177 this.modJkLbFactorRange = modJkLbFactorRange.split(","); 178 179 } 180 181 185 public void setDirectorPortRange(String directorPortRange) { 186 this.directorPortRange = directorPortRange.split(","); 187 188 } 189 190 194 public void setDirectorLbFactorRange(String directorLbFactorRange) { 195 this.directorLbFactorRange = directorLbFactorRange.split(","); 196 197 } 198 199 203 public void setName(String containerName) { 204 205 this.name = containerName; 206 } 207 208 212 public void setStickySession(boolean stickySession) { 213 214 this.stickySession = stickySession; 215 } 216 217 220 public void generatesTasks() { 221 222 int portInd = 0; 223 224 ModJk modJk = new ModJk(); 225 Director director = new Director(); 226 227 modJk.createFiles(modjkDir); 229 modJk.setStickySession(stickySession); 230 231 director.createFile(directorDir); 233 234 for (int i = getDestDirSuffixIndFirst(); i <= getDestDirSuffixIndLast(); i++) { 235 236 String destDir = getDestDir(getDestDirPrefix(), i); 237 238 log(INFO + "tasks generation for " + destDir); 239 240 WebContainer webContainer = new WebContainer(); 242 243 webContainer.setName(name); 244 webContainer.setPort(httpPortRange[portInd]); 245 webContainer.setAjpPort(ajpPortRange[portInd]); 246 webContainer.setDirectorPort(directorPortRange[portInd]); 247 webContainer.setClusterListenPort(clusterListenPortRange[portInd]); 248 webContainer.setClusterMcastAddr(clusterMcastAddr); 249 webContainer.setClusterMcastPort(clusterMcastPort); 250 251 modJk.addWorker(ajpPortRange[portInd], modJkLbFactorRange[portInd]); 253 254 director.addAppServer(directorPortRange[portInd], directorLbFactorRange[portInd]); 256 257 for (Iterator it = webContainer.getTasks().iterator(); it.hasNext();) { 259 BaseTaskItf task = (BaseTaskItf) it.next(); 260 task.setDestDir(new File (destDir)); 261 } 262 263 addTasks(webContainer); 264 265 portInd++; 266 267 } 268 269 modJk.flushFiles(); 270 addTasks(modJk); 271 272 director.flushFile(); 273 addTasks(director); 274 } 275 } | Popular Tags |