com.mysql.fabric.xmlrpc.base.Array Java Examples
The following examples show how to use
com.mysql.fabric.xmlrpc.base.Array.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InternalXmlRpcMethodCaller.java From r-course with MIT License | 5 votes |
/** * Unwrap the underlying object from the Value wrapper. */ private Object unwrapValue(Value v) { if (v.getType() == Value.TYPE_array) { return methodResponseArrayToList((Array) v.getValue()); } else if (v.getType() == Value.TYPE_struct) { Map<String, Object> s = new HashMap<String, Object>(); for (Member m : ((Struct) v.getValue()).getMember()) { s.put(m.getName(), unwrapValue(m.getValue())); } return s; } return v.getValue(); }
Example #2
Source File: InternalXmlRpcMethodCaller.java From r-course with MIT License | 5 votes |
private List<Object> methodResponseArrayToList(Array array) { List<Object> result = new ArrayList<Object>(); for (Value v : array.getData().getValue()) { result.add(unwrapValue(v)); } return result; }
Example #3
Source File: InternalXmlRpcMethodCaller.java From r-course with MIT License | 5 votes |
public List<Object> call(String methodName, Object args[]) throws FabricCommunicationException { MethodCall methodCall = new MethodCall(); Params p = new Params(); if (args == null) { args = new Object[] {}; } for (int i = 0; i < args.length; ++i) { if (args[i] == null) { throw new NullPointerException("nil args unsupported"); } else if (String.class.isAssignableFrom(args[i].getClass())) { p.addParam(new Param(new Value((String) args[i]))); } else if (Double.class.isAssignableFrom(args[i].getClass())) { p.addParam(new Param(new Value((Double) args[i]))); } else if (Integer.class.isAssignableFrom(args[i].getClass())) { p.addParam(new Param(new Value((Integer) args[i]))); } else { throw new IllegalArgumentException("Unknown argument type: " + args[i].getClass()); } } methodCall.setMethodName(methodName); methodCall.setParams(p); try { MethodResponse resp = this.xmlRpcClient.execute(methodCall); return methodResponseArrayToList((Array) resp.getParams().getParam().get(0).getValue().getValue()); } catch (Exception ex) { throw new FabricCommunicationException("Error during call to `" + methodName + "' (args=" + Arrays.toString(args) + ")", ex); //irrecoverable } }
Example #4
Source File: InternalXmlRpcMethodCaller.java From Komondor with GNU General Public License v3.0 | 5 votes |
/** * Unwrap the underlying object from the Value wrapper. */ private Object unwrapValue(Value v) { if (v.getType() == Value.TYPE_array) { return methodResponseArrayToList((Array) v.getValue()); } else if (v.getType() == Value.TYPE_struct) { Map<String, Object> s = new HashMap<String, Object>(); for (Member m : ((Struct) v.getValue()).getMember()) { s.put(m.getName(), unwrapValue(m.getValue())); } return s; } return v.getValue(); }
Example #5
Source File: InternalXmlRpcMethodCaller.java From Komondor with GNU General Public License v3.0 | 5 votes |
private List<Object> methodResponseArrayToList(Array array) { List<Object> result = new ArrayList<Object>(); for (Value v : array.getData().getValue()) { result.add(unwrapValue(v)); } return result; }
Example #6
Source File: InternalXmlRpcMethodCaller.java From Komondor with GNU General Public License v3.0 | 5 votes |
public List<Object> call(String methodName, Object args[]) throws FabricCommunicationException { MethodCall methodCall = new MethodCall(); Params p = new Params(); if (args == null) { args = new Object[] {}; } for (int i = 0; i < args.length; ++i) { if (args[i] == null) { throw new NullPointerException("nil args unsupported"); } else if (String.class.isAssignableFrom(args[i].getClass())) { p.addParam(new Param(new Value((String) args[i]))); } else if (Double.class.isAssignableFrom(args[i].getClass())) { p.addParam(new Param(new Value((Double) args[i]))); } else if (Integer.class.isAssignableFrom(args[i].getClass())) { p.addParam(new Param(new Value((Integer) args[i]))); } else { throw new IllegalArgumentException("Unknown argument type: " + args[i].getClass()); } } methodCall.setMethodName(methodName); methodCall.setParams(p); try { MethodResponse resp = this.xmlRpcClient.execute(methodCall); return methodResponseArrayToList((Array) resp.getParams().getParam().get(0).getValue().getValue()); } catch (Exception ex) { throw new FabricCommunicationException("Error during call to `" + methodName + "' (args=" + Arrays.toString(args) + ")", ex); //irrecoverable } }