01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 2005 Bull S.A.
04: * Contact: jonas-team@objectweb.org
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19: * USA
20: *
21: * Initial developer: Benoit Pelletier
22: * --------------------------------------------------------------------------
23: * $Id: DbCluster.java 6896 2005-06-07 08:21:28Z pelletib $
24: * --------------------------------------------------------------------------
25: */package org.objectweb.jonas.ant.cluster;
26:
27: import java.io.File;
28: import org.objectweb.jonas.ant.jonasbase.Db;
29:
30: /**
31: * Define DbCluster task
32: * @author Benoit Pelletier
33: */
34: public class DbCluster extends ClusterTasks {
35:
36: /**
37: * Info for the logger
38: */
39: private static final String INFO = "[DbCluster] ";
40:
41: /**
42: * ports range
43: */
44: private String[] portRange = null;
45:
46: /**
47: * Default constructor
48: */
49: public DbCluster() {
50: super ();
51: }
52:
53: /**
54: * Set ports range
55: * @param portRange ports range
56: */
57: public void setPortRange(String portRange) {
58: this .portRange = portRange.split(",");
59:
60: }
61:
62: /**
63: * Generates the db tasks for each JOnAS's instances
64: */
65: public void generatesTasks() {
66:
67: int portInd = 0;
68:
69: for (int i = getDestDirSuffixIndFirst(); i <= getDestDirSuffixIndLast(); i++) {
70:
71: String destDir = getDestDir(getDestDirPrefix(), i);
72: log(INFO + "tasks generation for " + destDir);
73: // creation of the Db task
74: Db db = new Db();
75:
76: db.setPort(portRange[portInd]);
77: db.setDestDir(new File(destDir));
78:
79: addTask(db);
80:
81: portInd++;
82:
83: }
84: }
85: }
|