001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer: Benoit Pelletier
022: * --------------------------------------------------------------------------
023: * $Id: Ha.java 8231 2006-04-11 14:23:27Z pelletib $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas.ant.jonasbase;
026:
027: import org.objectweb.jonas.ant.JOnASBaseTask;
028:
029: /**
030: * Defines properties for ha service
031: * @author Benoit Pelletier
032: */
033: public class Ha extends Tasks {
034:
035: /**
036: * Info for the logger
037: */
038: private static final String INFO = "[Ha] ";
039:
040: /**
041: * CMI mcast addr attribut
042: */
043: private static final String MCASTADDR_ATTR = "mcast_addr";
044:
045: /**
046: * CMI mcast port attribut
047: */
048: private static final String MCASTPORT_ATTR = "mcast_port";
049:
050: /**
051: * Default cmi mcast addr
052: */
053: private static final String DEFAULT_MCASTADDR = "224.0.0.36";
054:
055: /**
056: * Default cmi mcast port
057: */
058: private static final String DEFAULT_MCASTPORT = "35468";
059:
060: /**
061: * Default constructor
062: */
063: public Ha() {
064: super ();
065: }
066:
067: /**
068: * Set mcastAddr
069: * @param mcastAddr multicast address
070: */
071: public void setMcastAddr(String mcastAddr) {
072:
073: // Token to replace the multicast addr
074: String token = MCASTADDR_ATTR + "=" + "\"" + DEFAULT_MCASTADDR
075: + "\"";
076: String value = MCASTADDR_ATTR + "=" + "\"" + mcastAddr + "\"";
077: JReplace mcastAddrReplace = new JReplace();
078: mcastAddrReplace.setLogInfo(INFO + "Setting mcastaddr");
079: mcastAddrReplace
080: .setConfigurationFile(JOnASBaseTask.JGROUPS_HA_CONF_FILE);
081: mcastAddrReplace.setToken(token);
082: mcastAddrReplace.setValue(value);
083: addTask(mcastAddrReplace);
084: }
085:
086: /**
087: * Set mcastPort
088: * @param mcastPort multicast port
089: */
090: public void setMcastPort(String mcastPort) {
091:
092: // Token to replace the multicast port
093: String token = MCASTPORT_ATTR + "=" + "\"" + DEFAULT_MCASTPORT
094: + "\"";
095: String value = MCASTPORT_ATTR + "=" + "\"" + mcastPort + "\"";
096: JReplace mcastPortReplace = new JReplace();
097: mcastPortReplace.setLogInfo(INFO + "Setting mcastport");
098: mcastPortReplace
099: .setConfigurationFile(JOnASBaseTask.JGROUPS_HA_CONF_FILE);
100: mcastPortReplace.setToken(token);
101: mcastPortReplace.setValue(value);
102: addTask(mcastPortReplace);
103:
104: }
105:
106: }
|