KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > ant > cluster > ServicesCluster


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 2005 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * 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: ServicesCluster.java,v 1.1 2005/06/07 08:21:27 pelletib Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas.ant.cluster;
28
29 import java.io.File JavaDoc;
30 import org.objectweb.jonas.ant.jonasbase.Services;
31
32 /**
33  * Define ServicesCluster task
34  * @author Benoit Pelletier
35  */

36 public class ServicesCluster extends ClusterTasks {
37
38     /**
39      * Info for the logger
40      */

41     private static final String JavaDoc INFO = "[ServicesCluster] ";
42     /**
43      * Partial list of the JOnAS's services to be used whether the chosen
44      * architecture is separated web/ejb
45      */

46     private String JavaDoc partialList = null;
47
48     /**
49      * Partial list of the JOnAS's services to be used whether the chosen
50      * architecture is both web/ejb
51      */

52     private String JavaDoc fullList = null;
53
54     /**
55      * Default constructor
56      */

57     public ServicesCluster() {
58         super();
59     }
60
61     /**
62      * Set the partial list of the JOnAS's services
63      * @param partialList partial list of JOnAS services
64      */

65     public void setPartialList(String JavaDoc partialList) {
66         this.partialList = partialList;
67
68     }
69
70     /**
71      * Set the full list of the JOnAS's services
72      * @param fullList full list of JOnAS services
73      */

74     public void setFullList(String JavaDoc fullList) {
75         this.fullList = fullList;
76
77     }
78
79     /**
80      * Generates the Services tasks for each JOnAS's instances
81      */

82     public void generatesTasks() {
83
84         for (int i = getDestDirSuffixIndFirst(); i <= getDestDirSuffixIndLast(); i++) {
85
86             String JavaDoc destDir = getDestDir(getDestDirPrefix(), i);
87
88             log(INFO + "tasks generation for " + destDir);
89
90             // creation of the Services task
91
Services services = new Services();
92
93             if (this.getArch().compareTo(ARCH_BOTH_WEB_EJB) == 0) {
94                 services.setNames(fullList);
95             } else {
96                 services.setNames(partialList);
97             }
98             services.setDestDir(new File JavaDoc(destDir));
99
100             addTask(services);
101         }
102     }
103 }
Popular Tags