01: /**
02: * JOnAS: Java(TM) Open Application Server
03: * Copyright (C) 2004-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: * --------------------------------------------------------------------------
22: * $Id: Services.java 6285 2005-02-10 10:27:02Z benoitf $
23: * --------------------------------------------------------------------------
24: */package org.objectweb.jonas.ant.jonasbase;
25:
26: import java.io.File;
27:
28: import org.apache.tools.ant.BuildException;
29:
30: import org.objectweb.jonas.ant.JOnASBaseTask;
31:
32: /**
33: * Allow to configure the list of services in jonas.properties file
34: * @author Florent Benoit
35: */
36: public class Services extends JTask implements BaseTaskItf {
37:
38: /**
39: * Info for the logger
40: */
41: private static final String INFO = "[JOnAS] ";
42:
43: /**
44: * Services property
45: */
46: private static final String SERVICES_PROPERTY = "jonas.services";
47:
48: /**
49: * List of services names
50: */
51: private String serviceNames = null;
52:
53: /**
54: * Default constructor
55: */
56: public Services() {
57: super ();
58: }
59:
60: /**
61: * Set the names of the services
62: * @param serviceNames list of services
63: */
64: public void setNames(String serviceNames) {
65: this .serviceNames = serviceNames;
66: }
67:
68: /**
69: * Check the properties
70: */
71: private void checkProperties() {
72: if (serviceNames == null) {
73: throw new BuildException(INFO
74: + "Property 'dataSource ' is missing.");
75: }
76: }
77:
78: /**
79: * Execute this task
80: */
81: public void execute() {
82: checkProperties();
83:
84: // Path to JONAS_BASE
85: String jBaseConf = getDestDir().getPath() + File.separator
86: + "conf";
87: changeValueForKey(INFO, jBaseConf,
88: JOnASBaseTask.JONAS_CONF_FILE, SERVICES_PROPERTY,
89: serviceNames, false);
90:
91: }
92:
93: }
|