Package org.apache.xmlrpc.client.util
Class ClientFactory
- java.lang.Object
-
- org.apache.xmlrpc.client.util.ClientFactory
-
public class ClientFactory extends java.lang.Object
The
ClientFactory
is a useful tool for simplifying the use of Apache XML-RPC. The rough idea is as follows: All XML-RPC handlers are implemented as interfaces. The server uses the actual implementation. The client uses theClientFactory
to obtain an implementation, which is based on running XML-RPC calls.
-
-
Field Summary
Fields Modifier and Type Field Description private XmlRpcClient
client
private boolean
objectMethodLocal
private TypeConverterFactory
typeConverterFactory
-
Constructor Summary
Constructors Constructor Description ClientFactory(XmlRpcClient pClient)
Creates a new instance.ClientFactory(XmlRpcClient pClient, TypeConverterFactory pTypeConverterFactory)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XmlRpcClient
getClient()
Returns the factories client.boolean
isObjectMethodLocal()
Returns, whether a method declared by theObject class
is performed by the local object, rather than by the server.java.lang.Object
newInstance(java.lang.Class pClass)
Creates an object, which is implementing the given interface.java.lang.Object
newInstance(java.lang.ClassLoader pClassLoader, java.lang.Class pClass)
Creates an object, which is implementing the given interface.java.lang.Object
newInstance(java.lang.ClassLoader pClassLoader, java.lang.Class pClass, java.lang.String pRemoteName)
Creates an object, which is implementing the given interface.void
setObjectMethodLocal(boolean pObjectMethodLocal)
Sets, whether a method declared by theObject class
is performed by the local object, rather than by the server.
-
-
-
Field Detail
-
client
private final XmlRpcClient client
-
typeConverterFactory
private final TypeConverterFactory typeConverterFactory
-
objectMethodLocal
private boolean objectMethodLocal
-
-
Constructor Detail
-
ClientFactory
public ClientFactory(XmlRpcClient pClient, TypeConverterFactory pTypeConverterFactory)
Creates a new instance.- Parameters:
pClient
- A fully configured XML-RPC client, which is used internally to perform XML-RPC calls.pTypeConverterFactory
- Creates instances ofTypeConverterFactory
, which are used to transform the result object in its target representation.
-
ClientFactory
public ClientFactory(XmlRpcClient pClient)
Creates a new instance. Shortcut fornew ClientFactory(pClient, new TypeConverterFactoryImpl());
- Parameters:
pClient
- A fully configured XML-RPC client, which is used internally to perform XML-RPC calls.- See Also:
TypeConverterFactoryImpl
-
-
Method Detail
-
getClient
public XmlRpcClient getClient()
Returns the factories client.
-
isObjectMethodLocal
public boolean isObjectMethodLocal()
Returns, whether a method declared by theObject class
is performed by the local object, rather than by the server. Defaults to true.
-
setObjectMethodLocal
public void setObjectMethodLocal(boolean pObjectMethodLocal)
Sets, whether a method declared by theObject class
is performed by the local object, rather than by the server. Defaults to true.
-
newInstance
public java.lang.Object newInstance(java.lang.Class pClass)
Creates an object, which is implementing the given interface. The objects methods are internally calling an XML-RPC server by using the factories client; shortcut fornewInstance(Thread.currentThread().getContextClassLoader(), pClass)
-
newInstance
public java.lang.Object newInstance(java.lang.ClassLoader pClassLoader, java.lang.Class pClass)
Creates an object, which is implementing the given interface. The objects methods are internally calling an XML-RPC server by using the factories client; shortcut fornewInstance(pClassLoader, pClass, pClass.getName())
-
newInstance
public java.lang.Object newInstance(java.lang.ClassLoader pClassLoader, java.lang.Class pClass, java.lang.String pRemoteName)
Creates an object, which is implementing the given interface. The objects methods are internally calling an XML-RPC server by using the factories client.- Parameters:
pClassLoader
- The class loader, which is being used for loading classes, if required.pClass
- Interface, which is being implemented.pRemoteName
- Handler name, which is being used when calling the server. This is used for composing the method name. For example, ifpRemoteName
is "Foo" and you want to invoke the method "bar" in the handler, then the full method name would be "Foo.bar".
-
-