Package org.apache.axis.client
Class AdminClient
- java.lang.Object
-
- org.apache.axis.client.AdminClient
-
public class AdminClient extends java.lang.ObjectAn admin client object that can be used both from the command line and programmatically.- Author:
- Rob Jellinghaus (robj@unrealities.com), Doug Davis (dug@us.ibm.com), Simeon Simeonov (simeons@macromedia.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected Callcallthe object that represents our callprotected static org.apache.commons.logging.Loglogprotected static java.lang.StringROOT_UNDEPLOYroot element of the undeploy request
-
Constructor Summary
Constructors Constructor Description AdminClient()Construct an admin client w/o a logger.AdminClient(boolean ignored)this is a somwhat contrived variant constructor, one that throws an exception if things go wrong.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CallgetCall()External access to ourCalljava.lang.Stringlist()send a list commandjava.lang.Stringlist(Options opts)process the options then run a list callstatic voidmain(java.lang.String[] args)Creates in instance ofAdminClientand invokesprocess(args).java.lang.Stringprocess(java.io.InputStream input)java.lang.Stringprocess(java.lang.String xmlFile)process an XML file containing a pre-prepared admin messagejava.lang.Stringprocess(java.lang.String[] args)Processes a set of administration commands.java.lang.Stringprocess(java.net.URL xmlURL)java.lang.Stringprocess(Options opts, java.io.InputStream input)submit the input stream's contents to the endpoint, return the results as a string.java.lang.Stringprocess(Options opts, java.lang.String xmlFile)voidprocessOpts(Options opts)go from the (parsed) command line to setting properties on our call object.java.lang.Stringquit()make a quit commandjava.lang.Stringquit(Options opts)process the command line ops, then send a quit commandstatic voidsetDefaultConfiguration(EngineConfiguration config)If the user calls this with an EngineConfiguration object, all AdminClients on this thread will use that EngineConfiguration rather than the default one.voidsetLogin(java.lang.String user, java.lang.String password)set the username and password requires that call!=nullvoidsetTargetEndpointAddress(java.net.URL address)set the URL to deploy to requires that call!=nullvoidsetTransport(java.lang.String transportName)set the transport to deploy with.java.lang.StringundeployHandler(java.lang.String handlerName)undeploy a handlerjava.lang.StringundeployService(java.lang.String serviceName)undeploy a service
-
-
-
Field Detail
-
log
protected static org.apache.commons.logging.Log log
-
call
protected Call call
the object that represents our call
-
ROOT_UNDEPLOY
protected static final java.lang.String ROOT_UNDEPLOY
root element of the undeploy request
-
-
Constructor Detail
-
AdminClient
public AdminClient()
Construct an admin client w/o a logger. If the client cannot create a call object, then it does not throw an exception. Instead it prints a message toSystem.err. This is for 'historical reasons'
-
AdminClient
public AdminClient(boolean ignored) throws ServiceExceptionthis is a somwhat contrived variant constructor, one that throws an exception if things go wrong.- Parameters:
ignored-- Throws:
ServiceException
-
-
Method Detail
-
setDefaultConfiguration
public static void setDefaultConfiguration(EngineConfiguration config)
If the user calls this with an EngineConfiguration object, all AdminClients on this thread will use that EngineConfiguration rather than the default one. This is primarily to enable the deployment of custom transports and handlers.- Parameters:
config- the EngineConfiguration which should be used
-
getCall
public Call getCall()
External access to ourCall- Returns:
- the
Callobject this instance uses
-
list
public java.lang.String list(Options opts) throws java.lang.Exception
process the options then run a list call- Parameters:
opts-- Returns:
- Throws:
java.lang.Exception
-
list
public java.lang.String list() throws java.lang.Exceptionsend a list command- Returns:
- the response from the call
- Throws:
java.lang.Exception
-
quit
public java.lang.String quit(Options opts) throws java.lang.Exception
process the command line ops, then send a quit command- Parameters:
opts-- Returns:
- Throws:
java.lang.Exception
-
quit
public java.lang.String quit() throws java.lang.Exceptionmake a quit command- Returns:
- Throws:
java.lang.Exception
-
undeployHandler
public java.lang.String undeployHandler(java.lang.String handlerName) throws java.lang.Exceptionundeploy a handler- Parameters:
handlerName- name of the handler to undeploy- Returns:
- Throws:
java.lang.Exception
-
undeployService
public java.lang.String undeployService(java.lang.String serviceName) throws java.lang.Exceptionundeploy a service- Parameters:
serviceName- name of service- Returns:
- Throws:
java.lang.Exception
-
process
public java.lang.String process(java.lang.String[] args) throws java.lang.ExceptionProcesses a set of administration commands.
The following commands are available:
-lurlsets the AxisServlet URL-hhostNamesets the AxisServlet host-pportNumbersets the AxisServlet port-sservletPathsets the path to the AxisServlet-ffileNamespecifies that a simple file protocol should be used-uusernamesets the username-wpasswordsets the password-dsets the debug flag (for instance, -ddd would set it to 3)-tnamesets the transport chain touselistwill list the currently deployed servicesquitwill quit (???)passwd valuechanges the admin passwordxmlConfigFiledeploys or undeploys Axis components and web services
If
-lor-h -p -sare not set, the AdminClient will invokehttp://localhost:8080/axis/servlet/AxisServlet.- Parameters:
args- Commands to process- Returns:
- XML result or null in case of failure. In the case of multiple commands, the XML results will be concatenated, separated by \n
- Throws:
java.lang.Exception- Could be an IO exception, an AxisFault or something else
-
processOpts
public void processOpts(Options opts) throws java.lang.Exception
go from the (parsed) command line to setting properties on our call object.- Parameters:
opts-- Throws:
java.lang.Exception- if call==null
-
setLogin
public void setLogin(java.lang.String user, java.lang.String password)set the username and password requires that call!=null- Parameters:
user- usernamepassword- password
-
setTargetEndpointAddress
public void setTargetEndpointAddress(java.net.URL address)
set the URL to deploy to requires that call!=null- Parameters:
address-
-
setTransport
public void setTransport(java.lang.String transportName)
set the transport to deploy with. requires that call!=null- Parameters:
transportName- a null or empty value does not trigger a setting
-
process
public java.lang.String process(java.io.InputStream input) throws java.lang.Exception- Throws:
java.lang.Exception
-
process
public java.lang.String process(java.net.URL xmlURL) throws java.lang.Exception- Throws:
java.lang.Exception
-
process
public java.lang.String process(java.lang.String xmlFile) throws java.lang.Exceptionprocess an XML file containing a pre-prepared admin message- Parameters:
xmlFile- file to load- Returns:
- Throws:
java.lang.Exception
-
process
public java.lang.String process(Options opts, java.lang.String xmlFile) throws java.lang.Exception
- Throws:
java.lang.Exception
-
process
public java.lang.String process(Options opts, java.io.InputStream input) throws java.lang.Exception
submit the input stream's contents to the endpoint, return the results as a string. The input stream is always closed after the call, whether the request worked or not- Parameters:
opts- options -can be nullinput- -input stream for request- Returns:
- Throws:
java.lang.Exception- if the call was nullAxisFault- if the invocation returned an empty response
-
main
public static void main(java.lang.String[] args)
Creates in instance ofAdminClientand invokesprocess(args).Diagnostic output goes to
log.info.- Parameters:
args- Commands to process
-
-