Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 package org.apache.xmlrpc.client;
00020
00021 import java.util.List;
00022
00023 import org.apache.xmlrpc.XmlRpcConfig;
00024 import org.apache.xmlrpc.XmlRpcException;
00025 import org.apache.xmlrpc.XmlRpcRequest;
00026 import org.apache.xmlrpc.common.XmlRpcController;
00027 import org.apache.xmlrpc.common.XmlRpcWorkerFactory;
00028 import org.apache.xmlrpc.serializer.XmlWriterFactory;
00029
00030
00051 public class XmlRpcClient extends XmlRpcController {
00052 private XmlRpcTransportFactory transportFactory = XmlRpcClientDefaults.newTransportFactory(this);
00053 private XmlRpcClientConfig config = XmlRpcClientDefaults.newXmlRpcClientConfig();
00054 private XmlWriterFactory xmlWriterFactory = XmlRpcClientDefaults.newXmlWriterFactory();
00055
00056 protected XmlRpcWorkerFactory getDefaultXmlRpcWorkerFactory() {
00057 return new XmlRpcClientWorkerFactory(this);
00058 }
00059
00070 public void setConfig(XmlRpcClientConfig pConfig) {
00071 config = pConfig;
00072 }
00073
00083 public XmlRpcConfig getConfig() {
00084 return config;
00085 }
00086
00097 public XmlRpcClientConfig getClientConfig() {
00098 return config;
00099 }
00100
00106 public void setTransportFactory(XmlRpcTransportFactory pFactory) {
00107 transportFactory = pFactory;
00108 }
00109
00115 public XmlRpcTransportFactory getTransportFactory() {
00116 return transportFactory;
00117 }
00118
00125 public Object execute(String pMethodName, Object[] pParams) throws XmlRpcException {
00126 return execute(getClientConfig(), pMethodName, pParams);
00127 }
00128
00136 public Object execute(XmlRpcClientConfig pConfig, String pMethodName, Object[] pParams) throws XmlRpcException {
00137 return execute(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams));
00138 }
00139
00146 public Object execute(String pMethodName, List pParams) throws XmlRpcException {
00147 return execute(getClientConfig(), pMethodName, pParams);
00148 }
00149
00157 public Object execute(XmlRpcClientConfig pConfig, String pMethodName, List pParams) throws XmlRpcException {
00158 return execute(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams));
00159 }
00160
00166 public Object execute(XmlRpcRequest pRequest) throws XmlRpcException {
00167 return getWorkerFactory().getWorker().execute(pRequest);
00168 }
00169
00176 public void executeAsync(String pMethodName, Object[] pParams,
00177 AsyncCallback pCallback) throws XmlRpcException {
00178 executeAsync(getClientConfig(), pMethodName, pParams, pCallback);
00179 }
00180
00188 public void executeAsync(XmlRpcClientConfig pConfig,
00189 String pMethodName, Object[] pParams,
00190 AsyncCallback pCallback) throws XmlRpcException {
00191 executeAsync(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams),
00192 pCallback);
00193 }
00194
00201 public void executeAsync(String pMethodName, List pParams,
00202 AsyncCallback pCallback) throws XmlRpcException {
00203 executeAsync(getClientConfig(), pMethodName, pParams, pCallback);
00204 }
00205
00213 public void executeAsync(XmlRpcClientConfig pConfig,
00214 String pMethodName, List pParams,
00215 AsyncCallback pCallback) throws XmlRpcException {
00216 executeAsync(new XmlRpcClientRequestImpl(pConfig, pMethodName, pParams), pCallback);
00217 }
00218
00224 public void executeAsync(XmlRpcRequest pRequest,
00225 AsyncCallback pCallback) throws XmlRpcException {
00226 XmlRpcClientWorker w = (XmlRpcClientWorker) getWorkerFactory().getWorker();
00227 w.execute(pRequest, pCallback);
00228 }
00229
00235 public XmlWriterFactory getXmlWriterFactory() {
00236 return xmlWriterFactory;
00237 }
00238
00244 public void setXmlWriterFactory(XmlWriterFactory pFactory) {
00245 xmlWriterFactory = pFactory;
00246 }
00247 }