Package org.astrogrid.samp.xmlrpc
Class XmlRpcKit
java.lang.Object
org.astrogrid.samp.xmlrpc.XmlRpcKit
Encapsulates the provision of XML-RPC client and server capabilities.
Two implementations are provided in the JSAMP package;
the pluggable architecture allows others to be provided.
- Since:
- 27 Aug 2008
- Author:
- Mark Taylor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final XmlRpcKitImplementation based on Apache XML-RPC.static final StringProperty which is examined to determine which implementation to use by default.static final XmlRpcKitImplementation which requires no external libraries.static XmlRpcKit[]Array of available known implementations of this class.static final XmlRpcKitInternal implementation variant with verbose logging of RPC calls.static final XmlRpcKitInternal implementation variant with verbose logging of XML I/O. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic XmlRpcKitcreateReflectionKit(String name, String clientFactoryClassName, String serverFactoryClassName) Returns a new XmlRpcKit given classnames for the client and server factory classes.abstract SampXmlRpcClientFactoryReturns an XML-RPC client factory.static XmlRpcKitReturns the default instance of this class.static XmlRpcKitgetInstanceByName(String name) Returns an XmlRpcKit instance given its name.abstract StringgetName()Returns the name of this kit.abstract SampXmlRpcServerFactoryReturns an XML-RPC server factory.abstract booleanIndicates whether this object is ready for use.
-
Field Details
-
APACHE
Implementation based on Apache XML-RPC. -
INTERNAL
Implementation which requires no external libraries. -
XML_LOGGING
Internal implementation variant with verbose logging of XML I/O. -
RPC_LOGGING
Internal implementation variant with verbose logging of RPC calls. -
KNOWN_IMPLS
Array of available known implementations of this class. -
IMPL_PROP
Property which is examined to determine which implementation to use by default. Property values may be one of the elements ofKNOWN_IMPLS, currently:- internal
- xml-log
- rpc-log
- apache
XmlRpcKitand has a no-arg constructor. The property name is "jsamp.xmlrpc.impl".- See Also:
-
-
Constructor Details
-
XmlRpcKit
public XmlRpcKit()
-
-
Method Details
-
getClientFactory
Returns an XML-RPC client factory.- Returns:
- client factory
-
getServerFactory
Returns an XML-RPC server factory.- Returns:
- server factory
-
isAvailable
public abstract boolean isAvailable()Indicates whether this object is ready for use. If it returns false (perhaps because some classes are unavailable at runtime) thengetClientFactory()andgetServerFactory()may throw exceptions rather than behaving as documented.- Returns:
- true if this object works
-
getName
Returns the name of this kit.- Returns:
- implementation name
-
getInstance
Returns the default instance of this class. What implementation this is normally depends on what classes are present at runtime. However, if the system propertyIMPL_PROPis set this will determine the implementation used. It may be one of:apache: implementation based on the Apache XML-RPC libraryinternal: implementation which requires no libraries beyond JSAMP itself- the classname of an implementation of this class which has a no-arg constructor
- Returns:
- default instance of this class
-
getInstanceByName
Returns an XmlRpcKit instance given its name.- Parameters:
name- name of one of the known implementations, or classname of an XmlRpcKit implementatation with a no-arg constructor- Returns:
- named implementation object
- Throws:
IllegalArgumentException- if none by that name can be found
-
createReflectionKit
public static XmlRpcKit createReflectionKit(String name, String clientFactoryClassName, String serverFactoryClassName) Returns a new XmlRpcKit given classnames for the client and server factory classes. If the classes are not available, a kit which returnsisAvailable()()=false will be returned.- Parameters:
name- kit nameclientFactoryClassName- name of class implementing SampXmlRpcClientFactory which has a no-arg constructorserverFactoryClassName- name of class implementing SampXmlRpcServerFactory which has a no-arg constructor- Returns:
- new XmlRpcKit constructed using reflection
-