org.browsecode.helpers.controlcomputer
Class TomcatManagerConnection

java.lang.Object
  extended by org.browsecode.helpers.controlcomputer.TomcatManagerConnection

public class TomcatManagerConnection
extends java.lang.Object


Nested Class Summary
 class TomcatManagerConnection.ConnectionFailed
           
 class TomcatManagerConnection.ConnectionFailedCreatedUser
           
 class TomcatManagerConnection.CouldNotFindTomcatDirectory
           
 class TomcatManagerConnection.WebappStatus
           
 
Constructor Summary
TomcatManagerConnection(java.lang.String tomcatPath)
          Start up the TomcatManagerConnection when you don't know the userID and password, but do know the path to Tomcat.
TomcatManagerConnection(java.lang.String userID, java.lang.String password)
          Start up the TomcatManagerConnection when you know the userID and password to log in as.
 
Method Summary
 void checkTomcatLogin()
          To forestall future problems, after you call new TomcatManagerConnection(Username,Password), you may want to call this to verify that the username/password were correct.
 boolean deleteWebapp(java.lang.String title)
           
 java.lang.String getLastCallResult()
           
 java.lang.String getLastCallURL()
           
 java.lang.String getManagerCallResult(java.lang.String command)
          Note that if you put any sensitive information into the 'command' string, you will want to catch the exception this calls and make sure the user never sees it.
 java.lang.String getManagerCallResult(java.lang.String command, java.lang.String webappTitle)
           
 java.lang.String getManagerCallResult(java.lang.String command, java.lang.String webappTitle, java.lang.String extraParameters)
           
 java.lang.String getPassword()
           
 TomcatManagerConnection.WebappStatus getStatus(java.lang.String title)
          Get the statis of a webapp.
 java.lang.String getUserID()
           
 java.lang.String installWebappGetError(java.lang.String title, java.io.File warFileOrFolderDirectory)
           
 boolean reloadWebapp(java.lang.String title)
           
 java.lang.String reloadWebappGetError(java.lang.String title)
           
 void setTomcatURL(java.net.URL url)
          The URL passed in should be a URL to tomcat or a tomcat webapp.
 boolean startWebapp(java.lang.String title)
           
 boolean stopWebapp(java.lang.String title)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TomcatManagerConnection

public TomcatManagerConnection(java.lang.String userID,
                               java.lang.String password)
Start up the TomcatManagerConnection when you know the userID and password to log in as.

Parameters:
userID -
password -

TomcatManagerConnection

public TomcatManagerConnection(java.lang.String tomcatPath)
                        throws TomcatManagerConnection.ConnectionFailed
Start up the TomcatManagerConnection when you don't know the userID and password, but do know the path to Tomcat.

Parameters:
tomcatPath -
Throws:
TomcatManagerConnection.ConnectionFailed
Method Detail

setTomcatURL

public void setTomcatURL(java.net.URL url)
The URL passed in should be a URL to tomcat or a tomcat webapp. It does not need to be a URL to the manager -- that part of the string is ignored. This just sets the hostname and port, and https.


checkTomcatLogin

public void checkTomcatLogin()
                      throws TomcatManagerConnection.ConnectionFailed
To forestall future problems, after you call new TomcatManagerConnection(Username,Password), you may want to call this to verify that the username/password were correct.

Throws:
TomcatManagerConnection.ConnectionFailed

getManagerCallResult

public java.lang.String getManagerCallResult(java.lang.String command)
Note that if you put any sensitive information into the 'command' string, you will want to catch the exception this calls and make sure the user never sees it. However, I can't imagine any situations where this command has sensitive information in it -- it should just be the type of instruction to apache tomcat and the webapp name.

Parameters:
command -
Returns:

getManagerCallResult

public java.lang.String getManagerCallResult(java.lang.String command,
                                             java.lang.String webappTitle)

getManagerCallResult

public java.lang.String getManagerCallResult(java.lang.String command,
                                             java.lang.String webappTitle,
                                             java.lang.String extraParameters)

getLastCallResult

public java.lang.String getLastCallResult()

getLastCallURL

public java.lang.String getLastCallURL()

stopWebapp

public boolean stopWebapp(java.lang.String title)

startWebapp

public boolean startWebapp(java.lang.String title)

deleteWebapp

public boolean deleteWebapp(java.lang.String title)

reloadWebapp

public boolean reloadWebapp(java.lang.String title)

reloadWebappGetError

public java.lang.String reloadWebappGetError(java.lang.String title)

installWebappGetError

public java.lang.String installWebappGetError(java.lang.String title,
                                              java.io.File warFileOrFolderDirectory)

getStatus

public TomcatManagerConnection.WebappStatus getStatus(java.lang.String title)
Get the statis of a webapp. Returns null if the webapp does not exist or if there was an error getting it.

Parameters:
title -
Returns:

getUserID

public java.lang.String getUserID()

getPassword

public java.lang.String getPassword()