net.sf.tm.tomcat
Class TomcatServer

java.lang.Object
  extended bynet.sf.tm.tomcat.TomcatServer

public class TomcatServer
extends Object

Tomcat server object. Stores all connection information and provides a method for executing manager commands.

Version:
$Id: TomcatServer.java,v 1.4 2003/11/17 20:53:06 apataki Exp $
Author:
Andreas Pataki

Constructor Summary
TomcatServer()
          Default constructor.
TomcatServer(String newHost, String newUser, String newPassword)
          Constructor
 
Method Summary
 boolean equals(Object obj)
           
 String executeManager(String command)
          Executes a manager command.
 String generateReloadURL(String context)
          Generates the reload URL for the given context name.
 String getHost()
           
 String getManager()
           
 String getName()
           
 String getPassword()
           
 int getPort()
           
 String getProtocol()
           
 String getUser()
           
 int hashCode()
           
 void setHost(String string)
           
 void setManager(String string)
           
 void setName(String string)
           
 void setPassword(String string)
           
 void setPort(int value)
           
 void setProtocol(String string)
           
 void setUser(String string)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TomcatServer

public TomcatServer()
Default constructor. Sets default values for:
  • protocol: http
  • port: 8080
  • manager: /manager


  • TomcatServer

    public TomcatServer(String newHost,
                        String newUser,
                        String newPassword)
    Constructor

    Parameters:
    newHost - Hostname of the tomcat server (e.g. www.someserver.com)
    newUser - Username for the managing application
    newPassword - Password for the managing application
    Method Detail

    getPassword

    public String getPassword()
    Returns:
    value of the field password

    getPort

    public int getPort()
    Returns:
    value of the field port

    getProtocol

    public String getProtocol()
    Returns:
    value of the field protocol

    getHost

    public String getHost()
    Returns:
    value of the field host

    getUser

    public String getUser()
    Returns:
    value of the field user

    setPassword

    public void setPassword(String string)
    Parameters:
    string - value of the field password

    setPort

    public void setPort(int value)
    Parameters:
    value - new value for the field port

    setProtocol

    public void setProtocol(String string)
    Parameters:
    string - new value for the field protocol

    setHost

    public void setHost(String string)
    Parameters:
    string - new value for the field host

    setUser

    public void setUser(String string)
    Parameters:
    string - new value for the field user

    getManager

    public String getManager()
    Returns:
    value of the field manager

    setManager

    public void setManager(String string)
    Parameters:
    string - new value for the field manager

    getName

    public String getName()
    Returns:
    The name of this tomcat server

    setName

    public void setName(String string)
    Parameters:
    string - new name of the tomcat server

    executeManager

    public String executeManager(String command)
                          throws IOException
    Executes a manager command. Basicly this method builds the URL connection to the Tomcat manager application and returns the resulting String.

    For a list of available commands please consult the tomcat manager documentation.

    Parameters:
    command - The manager command. Example command: /start?path=/test
    Returns:
    The result of the manager application as a String
    Throws:
    IOException - Something went wrong during URL connect

    generateReloadURL

    public String generateReloadURL(String context)
    Generates the reload URL for the given context name.

    Example:

    http://server:8080/manager/reload?path=/examples

    Parameters:
    context - name of the context, must containt the leading /
    Returns:
    reload URL as text

    toString

    public String toString()
    See Also:
    Object.toString()

    equals

    public boolean equals(Object obj)
    See Also:
    Object.equals(java.lang.Object)

    hashCode

    public int hashCode()
    See Also:
    Object.hashCode()


    Copyright © 2003-2004 Andreas Pataki. All Rights Reserved.