Methods Summary |
---|
public Call | getCall()External access to our Call
return call;
|
private static java.lang.String | getUsageInfo()
String lSep = System.getProperty("line.separator");
StringBuffer msg = new StringBuffer();
// 26 is the # of lines in resources.properties
msg.append(Messages.getMessage("acUsage00")).append(lSep);
msg.append(Messages.getMessage("acUsage01")).append(lSep);
msg.append(Messages.getMessage("acUsage02")).append(lSep);
msg.append(Messages.getMessage("acUsage03")).append(lSep);
msg.append(Messages.getMessage("acUsage04")).append(lSep);
msg.append(Messages.getMessage("acUsage05")).append(lSep);
msg.append(Messages.getMessage("acUsage06")).append(lSep);
msg.append(Messages.getMessage("acUsage07")).append(lSep);
msg.append(Messages.getMessage("acUsage08")).append(lSep);
msg.append(Messages.getMessage("acUsage09")).append(lSep);
msg.append(Messages.getMessage("acUsage10")).append(lSep);
msg.append(Messages.getMessage("acUsage11")).append(lSep);
msg.append(Messages.getMessage("acUsage12")).append(lSep);
msg.append(Messages.getMessage("acUsage13")).append(lSep);
msg.append(Messages.getMessage("acUsage14")).append(lSep);
msg.append(Messages.getMessage("acUsage15")).append(lSep);
msg.append(Messages.getMessage("acUsage16")).append(lSep);
msg.append(Messages.getMessage("acUsage17")).append(lSep);
msg.append(Messages.getMessage("acUsage18")).append(lSep);
msg.append(Messages.getMessage("acUsage19")).append(lSep);
msg.append(Messages.getMessage("acUsage20")).append(lSep);
msg.append(Messages.getMessage("acUsage21")).append(lSep);
msg.append(Messages.getMessage("acUsage22")).append(lSep);
msg.append(Messages.getMessage("acUsage23")).append(lSep);
msg.append(Messages.getMessage("acUsage24")).append(lSep);
msg.append(Messages.getMessage("acUsage25")).append(lSep);
msg.append(Messages.getMessage("acUsage26")).append(lSep);
return msg.toString();
|
private void | initAdminClient()core initialisation routine
// Initialize our Service - allow the user to override the
// default configuration with a thread-local version (see
// setDefaultConfiguration() above)
EngineConfiguration config =
(EngineConfiguration) defaultConfiguration.get();
Service service;
if (config != null) {
service = new Service(config);
} else {
service = new Service();
}
call = (Call) service.createCall();
|
public java.lang.String | list(org.apache.axis.utils.Options opts)process the options then run a list call
processOpts( opts );
return list();
|
public java.lang.String | list()send a list command
log.debug( Messages.getMessage("doList00") );
String str = "<m:list xmlns:m=\"" + WSDDConstants.URI_WSDD + "\"/>" ;
ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());
return process(input);
|
public static void | main(java.lang.String[] args)Creates in instance of AdminClient and
invokes process(args) .
Diagnostic output goes to log.info .
try {
AdminClient admin = new AdminClient();
String result = admin.process(args);
if (result != null) {
System.out.println( StringUtils.unescapeNumericChar(result) );
} else {
System.exit(1);
}
} catch (AxisFault ae) {
System.err.println(Messages.getMessage("exception00") + " " + ae.dumpToString());
System.exit(1);
} catch (Exception e) {
System.err.println(Messages.getMessage("exception00") + " " + e.getMessage());
System.exit(1);
}
|
public java.lang.String | process(java.lang.String[] args)Processes a set of administration commands.
The following commands are available:
-lurl sets the AxisServlet URL
-hhostName sets the AxisServlet host
-pportNumber sets the AxisServlet port
-sservletPath sets the path to the
AxisServlet
-ffileName specifies that a simple file
protocol should be used
-uusername sets the username
-wpassword sets the password
-d sets the debug flag (for instance, -ddd would
set it to 3)
-tname sets the transport chain touse
list will list the currently deployed services
quit will quit (???)
passwd value changes the admin password
xmlConfigFile deploys or undeploys
Axis components and web services
If -l or -h -p -s are not set, the
AdminClient will invoke
http://localhost:8080/axis/servlet/AxisServlet .
StringBuffer sb = new StringBuffer();
Options opts = new Options( args );
opts.setDefaultURL("http://localhost:8080/axis/services/AdminService");
if (opts.isFlagSet('d") > 0) {
// Set logger properties... !!!
}
args = opts.getRemainingArgs();
if ( args == null || opts.isFlagSet('?") > 0) {
System.out.println(Messages.getMessage("usage00","AdminClient [Options] [list | <deployment-descriptor-files>]"));
System.out.println("");
System.out.println(getUsageInfo());
return null;
}
for ( int i = 0 ; i < args.length ; i++ ) {
InputStream input = null;
if ( args[i].equals("list") )
sb.append( list(opts) );
else if (args[i].equals("quit"))
sb.append( quit(opts) );
else if (args[i].equals("passwd")) {
System.out.println(Messages.getMessage("changePwd00"));
if (args[i + 1] == null) {
System.err.println(Messages.getMessage("needPwd00"));
return null;
}
String str = "<m:passwd xmlns:m=\"http://xml.apache.org/axis/wsdd/\">";
str += args[i + 1];
str += "</m:passwd>";
input = new ByteArrayInputStream(str.getBytes());
i++;
sb.append( process(opts, input) );
}
else {
if(args[i].indexOf(java.io.File.pathSeparatorChar)==-1){
System.out.println( Messages.getMessage("processFile00", args[i]) );
sb.append( process(opts, args[i] ) );
} else {
java.util.StringTokenizer tokenizer = null ;
tokenizer = new java.util.StringTokenizer(args[i],
java.io.File.pathSeparator);
while(tokenizer.hasMoreTokens()) {
String file = tokenizer.nextToken();
System.out.println( Messages.getMessage("processFile00", file) );
sb.append( process(opts, file) );
if(tokenizer.hasMoreTokens())
sb.append("\n");
}
}
}
}
return sb.toString();
|
public java.lang.String | process(java.io.InputStream input)
return process(null, input );
|
public java.lang.String | process(java.net.URL xmlURL)
return process(null, xmlURL.openStream() );
|
public java.lang.String | process(java.lang.String xmlFile)process an XML file containing a pre-prepared admin message
FileInputStream in = new FileInputStream(xmlFile);
String result = process(null, in );
return result ;
|
public java.lang.String | process(org.apache.axis.utils.Options opts, java.lang.String xmlFile)
processOpts( opts );
return process( xmlFile );
|
public java.lang.String | process(org.apache.axis.utils.Options opts, java.io.InputStream input)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
try {
if (call == null) {
//validate that the call is not null
throw new Exception(Messages.getMessage("nullCall00"));
}
if ( opts != null ) {
//process options if supplied
processOpts( opts );
}
call.setUseSOAPAction( true);
call.setSOAPActionURI( "urn:AdminService");
Vector result = null ;
Object[] params = new Object[] { new SOAPBodyElement(input) };
result = (Vector) call.invoke( params );
if (result == null || result.isEmpty()) {
throw new AxisFault(Messages.getMessage("nullResponse00"));
}
SOAPBodyElement body = (SOAPBodyElement) result.elementAt(0);
return body.toString();
} finally {
input.close();
}
|
public void | processOpts(org.apache.axis.utils.Options opts)go from the (parsed) command line to setting properties on our call object.
if (call == null) {
throw new Exception(Messages.getMessage("nullCall00"));
}
URL address = new URL(opts.getURL());
setTargetEndpointAddress(address);
setLogin(opts.getUser(), opts.getPassword());
String tName = opts.isValueSet( 't" );
setTransport(tName);
|
public java.lang.String | quit()make a quit command
log.debug(Messages.getMessage("doQuit00"));
String str = "<m:quit xmlns:m=\"" + WSDDConstants.URI_WSDD + "\"/>";
ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());
return process(input);
|
public java.lang.String | quit(org.apache.axis.utils.Options opts)process the command line ops, then send a quit command
processOpts( opts );
return quit();
|
public static void | setDefaultConfiguration(org.apache.axis.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.
defaultConfiguration.set(config);
|
public void | setLogin(java.lang.String user, java.lang.String password)set the username and password
requires that call!=null
call.setUsername( user );
call.setPassword( password );
|
public void | setTargetEndpointAddress(java.net.URL address)set the URL to deploy to
requires that call!=null
call.setTargetEndpointAddress( address );
|
public void | setTransport(java.lang.String transportName)set the transport to deploy with.
requires that call!=null
if(transportName != null && !transportName.equals("")) {
call.setProperty( Call.TRANSPORT_NAME, transportName );
}
|
public java.lang.String | undeployHandler(java.lang.String handlerName)undeploy a handler
log.debug(Messages.getMessage("doQuit00"));
String str = "<m:"+ROOT_UNDEPLOY +" xmlns:m=\"" + WSDDConstants.URI_WSDD + "\">" +
"<handler name=\"" + handlerName + "\"/>"+
"</m:"+ROOT_UNDEPLOY +">" ;
ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());
return process(input);
|
public java.lang.String | undeployService(java.lang.String serviceName)undeploy a service
log.debug(Messages.getMessage("doQuit00"));
String str = "<m:"+ROOT_UNDEPLOY +" xmlns:m=\"" + WSDDConstants.URI_WSDD + "\">" +
"<service name=\"" + serviceName + "\"/>"+
"</m:"+ROOT_UNDEPLOY +">" ;
ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());
return process(input);
|