mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
M #: Add support for i8 to JAVA binding (#336)
(cherry picked from commit c0dcd8c850211f0c45207601cecb51ff1dc0badc)
This commit is contained in:
parent
1b7d47cb0b
commit
d938c9c341
@ -26,6 +26,13 @@ import java.net.URL;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.apache.xmlrpc.client.XmlRpcClient;
|
||||
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
|
||||
import org.apache.xmlrpc.common.TypeFactoryImpl;
|
||||
import org.apache.xmlrpc.common.XmlRpcStreamConfig;
|
||||
import org.apache.xmlrpc.common.XmlRpcController;
|
||||
import org.apache.xmlrpc.parser.I8Parser;
|
||||
import org.apache.xmlrpc.parser.TypeParser;
|
||||
|
||||
import org.apache.ws.commons.util.NamespaceContextImpl;
|
||||
|
||||
|
||||
/**
|
||||
@ -35,6 +42,28 @@ import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
|
||||
*/
|
||||
public class Client{
|
||||
|
||||
/**
|
||||
* This class extends the TypeFactoryImpl for supporting i8 type.
|
||||
*
|
||||
*/
|
||||
public class ExtendedTypeFactoryImpl extends TypeFactoryImpl {
|
||||
|
||||
private static final String LONG_XML_TAG_NAME = "i8";
|
||||
|
||||
public ExtendedTypeFactoryImpl(XmlRpcController pController) {
|
||||
super(pController);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeParser getParser(XmlRpcStreamConfig pConfig, NamespaceContextImpl pContext, String pURI, String pLocalName) {
|
||||
if (LONG_XML_TAG_NAME.equals(pLocalName)) {
|
||||
return new I8Parser();
|
||||
} else {
|
||||
return super.getParser(pConfig, pContext, pURI, pLocalName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// PUBLIC INTERFACE
|
||||
//--------------------------------------------------------------------------
|
||||
@ -205,6 +234,7 @@ public class Client{
|
||||
}
|
||||
|
||||
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
|
||||
config.setEnabledForExtensions(true);
|
||||
|
||||
try
|
||||
{
|
||||
@ -217,6 +247,7 @@ public class Client{
|
||||
}
|
||||
|
||||
client = new XmlRpcClient();
|
||||
client.setTypeFactory(new ExtendedTypeFactoryImpl(client));
|
||||
client.setConfig(config);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user