KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ant > taskdefs > server > ConfigManagerTask


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.ant.taskdefs.server;
23
24 import org.apache.tools.ant.BuildException;
25 import org.apache.tools.ant.Task;
26 import org.jboss.test.util.server.Server;
27 import org.jboss.test.util.server.ServerManager;
28
29 /**
30  * A ConfigManagerTask. Delegates to the Server manager.
31  *
32  * @author <a HREF="ryan.campbell@jboss.com">Ryan Campbell</a>
33  * @version $Revision: 56504 $
34  */

35 public class ConfigManagerTask extends Task
36 {
37    /** The key for the project reference **/
38    protected static final String JavaDoc MANAGER_REF = "serverManager";
39
40    ServerManager manager = null;
41
42    /**
43     * Create a new ConfigManagerTask.
44     *
45     *
46     */

47    public ConfigManagerTask()
48    {
49        manager = new ServerManager();
50    }
51    
52    /**
53     * Create a server manager using the specified configuration.
54     */

55    public void execute() throws BuildException
56    {
57       if (getProject().getReference(MANAGER_REF) == null)
58       {
59          getProject().addReference(MANAGER_REF, manager);
60       }
61    }
62
63    /**
64     * Add a server.
65     *
66     * @param server the server
67     */

68    public void addServer(Server server)
69    {
70       manager.addServer(server);
71    }
72
73    /**
74     * JAVA_HOME to start jboss with.
75     * @param javaHome
76     */

77    public void setJavaHome(String JavaDoc javaHome)
78    {
79       manager.setJavaHome(javaHome);
80    }
81
82    /**
83     * JBoss dist to start.
84     * @param jbossHome
85     */

86    public void setJbossHome(String JavaDoc jbossHome)
87    {
88       manager.setJbossHome(jbossHome);
89    }
90
91    /**
92     * JVM command to use default is "java"
93     * @param jvm
94     */

95    public void setJvm(String JavaDoc jvm)
96    {
97       manager.setJvm(jvm);
98    }
99    
100    /**
101     * The UDP group to pass to org.jboss.Main using
102     * the -u option.
103     *
104     * @param udpGroup the udp group
105     */

106    public void setUdpGroup(String JavaDoc udpGroup)
107    {
108       manager.setUdpGroup(udpGroup);
109    }
110 }
Popular Tags