⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adminclient.java

📁 Java有关XML编程需要用到axis 的源代码 把里面bin下的包导入相应的Java工程 进行使用
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * Copyright 2001-2004 The Apache Software Foundation. *  * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *  *      http://www.apache.org/licenses/LICENSE-2.0 *  * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.axis.client ;import org.apache.axis.AxisFault;import org.apache.axis.EngineConfiguration;import org.apache.axis.components.logger.LogFactory;import org.apache.axis.deployment.wsdd.WSDDConstants;import org.apache.axis.message.SOAPBodyElement;import org.apache.axis.utils.Messages;import org.apache.axis.utils.Options;import org.apache.axis.utils.StringUtils;import org.apache.commons.logging.Log;import javax.xml.rpc.ServiceException;import java.io.ByteArrayInputStream;import java.io.FileInputStream;import java.io.InputStream;import java.net.URL;import java.util.Vector;/** * An admin client object that can be used both from the command line * and programmatically. * * @author Rob Jellinghaus (robj@unrealities.com) * @author Doug Davis (dug@us.ibm.com) * @author Simeon Simeonov (simeons@macromedia.com) */public class AdminClient{    protected static Log log =        LogFactory.getLog(AdminClient.class.getName());    private static ThreadLocal defaultConfiguration = new ThreadLocal();    /**     * 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.     *     * @param config the EngineConfiguration which should be used     */    public static void setDefaultConfiguration(EngineConfiguration config)    {        defaultConfiguration.set(config);    }    private static 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();    }    /**     * the object that represents our call     */    protected Call call;    /**     * 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 to {@link System.err}.     * This is for 'historical reasons'     */    public AdminClient()    {        try {            initAdminClient();        } catch (ServiceException e) {            System.err.println(Messages.getMessage("couldntCall00") + ": " + e);            call = null;        }    }    /**     * this is a somwhat contrived variant constructor, one that throws an exception     * if things go wrong.     * @param ignored     */    public AdminClient(boolean ignored) throws ServiceException {        initAdminClient();    }    /**     * core initialisation routine     *     * @throws ServiceException     */    private void initAdminClient() throws ServiceException {        // 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();    }    /**     * External access to our <code>Call</code< object.     * This will be null if the non-excepting constructor was used     * and the construction failed.     * @return the <code>Call</code> object this instance uses     */    public Call getCall()    {        return call;    }    /**     * process the options then run a list call     * @param opts     * @return     * @throws Exception     */    public String list(Options opts) throws Exception {        processOpts( opts );        return list();    }    /**     * send a list command     * @return the response from the call     * @throws Exception     */    public String list() throws Exception {        log.debug( Messages.getMessage("doList00") );        String               str   = "<m:list xmlns:m=\"" + WSDDConstants.URI_WSDD + "\"/>" ;        ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());        return process(input);    }    /**     * process the command line ops, then send a quit command     * @param opts     * @return     * @throws Exception     */    public String quit(Options opts) throws Exception {        processOpts( opts );        return quit();    }    /**     * root element of the undeploy request     */    protected static final String ROOT_UNDEPLOY= WSDDConstants.QNAME_UNDEPLOY.getLocalPart();    /**     * make a quit command     * @return     * @throws Exception     */    public String quit() throws Exception {        log.debug(Messages.getMessage("doQuit00"));        String               str   = "<m:quit xmlns:m=\"" + WSDDConstants.URI_WSDD + "\"/>";        ByteArrayInputStream input = new ByteArrayInputStream(str.getBytes());        return process(input);    }    /**     * undeploy a handler     * @param handlerName name of the handler to undeploy     * @return     * @throws Exception     */    public String undeployHandler(String handlerName) throws Exception {        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);    }    /**     * undeploy a service     * @param serviceName name of service     * @return     * @throws Exception     */    public String undeployService(String serviceName) throws Exception {        log.debug(Messages.getMessage("doQuit00"));        String               str   = "<m:"+ROOT_UNDEPLOY +" xmlns:m=\"" + WSDDConstants.URI_WSDD + "\">" +                                     "<service name=\"" + serviceName + "\"/>"+

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -