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.Discovery; 34 35 39 public class DiscoveryCluster extends ClusterTasks { 40 41 44 private static final String INFO = "[DiscoveryCluster] "; 45 46 49 private String [] greetingPortRange = null; 50 51 54 private String [] sourcePortRange = null; 55 56 59 private String mcastPort = null; 60 61 64 private String mcastAddr = null; 65 66 69 private int masterNode = -1; 70 71 72 75 public DiscoveryCluster() { 76 super(); 77 } 78 79 83 public void setMasterNode(int masterNode) { 84 this.masterNode = masterNode; 85 } 86 87 91 public void setMcastPort(String mcastPort) { 92 this.mcastPort = mcastPort; 93 } 94 95 99 public void setMcastAddr(String mcastAddr) { 100 this.mcastAddr = mcastAddr; 101 } 102 103 107 public void setGreetingPortRange(String portRange) { 108 this.greetingPortRange = portRange.split(","); 109 110 } 111 112 116 public void setSourcePortRange(String portRange) { 117 this.sourcePortRange = portRange.split(","); 118 119 } 120 121 124 public void generatesTasks() { 125 126 int portInd = 0; 127 128 for (int i = getDestDirSuffixIndFirst(); i <= getDestDirSuffixIndLast(); i++) { 129 130 String destDir = getDestDir(getDestDirPrefix(), i); 131 log(INFO + "tasks generation for " + destDir); 132 Discovery discovery = new Discovery(); 134 135 if (i == masterNode) { 136 discovery.setSourcePort(sourcePortRange[portInd]); 137 } 138 discovery.setGreetingPort(greetingPortRange[portInd]); 139 discovery.setMcastPort(mcastPort); 140 discovery.setMcastAddr(mcastAddr); 141 142 for (Iterator it = discovery.getTasks().iterator(); it.hasNext();) { 144 BaseTaskItf task = (BaseTaskItf) it.next(); 145 task.setDestDir(new File (destDir)); 146 } 147 148 addTasks(discovery); 149 150 portInd++; 151 152 } 153 } 154 } | Popular Tags |