本文整理汇总了Java中org.apache.xmlrpc.XmlRpcException类的典型用法代码示例。如果您正苦于以下问题:Java XmlRpcException类的具体用法?Java XmlRpcException怎么用?Java XmlRpcException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XmlRpcException类属于org.apache.xmlrpc包,在下文中一共展示了XmlRpcException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tellActive
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
private List<Download> tellActive() throws XmlRpcException {
Object[] params;
if (mSecret != null) {
params = new Object[] {mSecret};
} else {
params = new Object[] {};
}
Object[] status = (Object[]) mClient.execute("aria2.tellActive", params);
List<Download> result = new ArrayList<>(status.length);
for (Object object :
status) {
if (object instanceof Map) {
result.add(new Download((Map<String, Object>) object));
}
}
return result;
}
示例2: addRosterItem
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
@Override
public CompletableFuture<BooleanXmppResponse> addRosterItem(String localuser, String localserver, String user, String server, String nick, String group, String subs){
Map params = new HashMap();
params.put("localuser", localuser);
params.put("localserver", localserver);
params.put("user", user);
params.put("server", server);
params.put("nick", nick);
params.put("group", group);
params.put("subs", subs);
return CompletableFuture.supplyAsync(() -> {
try {
final HashMap response = executeXmlRpc("add_rosteritem", Arrays.asList(params));
final BooleanXmppResponse booleanXmppResponse = responseParser.parseBooleanResponse(response);
return booleanXmppResponse;
} catch (XmlRpcException e) {
throw new CompletionException(e);
}
}, executorService);
}
示例3: revertToSnapshot
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
@Override
public String revertToSnapshot(final Connection conn, final VM vmSnapshot,
final String vmName, final String oldVmUuid, final Boolean snapshotMemory, final String hostUUID)
throws Types.XenAPIException, XmlRpcException {
final String results = callHostPluginAsync(conn, "vmopsSnapshot",
"revert_memory_snapshot", 10 * 60 * 1000, "snapshotUUID",
vmSnapshot.getUuid(conn), "vmName", vmName, "oldVmUuid",
oldVmUuid, "snapshotMemory", snapshotMemory.toString(), "hostUUID", hostUUID);
String errMsg = null;
if (results == null || results.isEmpty()) {
errMsg = "revert_memory_snapshot return null";
} else {
if (results.equals("0")) {
return results;
} else {
errMsg = "revert_memory_snapshot exception";
}
}
s_logger.warn(errMsg);
throw new CloudRuntimeException(errMsg);
}
示例4: cleanupHaltedVms
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
public boolean cleanupHaltedVms(final Connection conn) throws XenAPIException, XmlRpcException {
final Host host = Host.getByUuid(conn, _host.getUuid());
final Map<VM, VM.Record> vms = VM.getAllRecords(conn);
boolean success = true;
if (vms != null && !vms.isEmpty()) {
for (final Map.Entry<VM, VM.Record> entry : vms.entrySet()) {
final VM vm = entry.getKey();
final VM.Record vmRec = entry.getValue();
if (vmRec.isATemplate || vmRec.isControlDomain) {
continue;
}
if (VmPowerState.HALTED.equals(vmRec.powerState) && vmRec.affinity.equals(host) && !isAlienVm(vm, conn)) {
try {
vm.destroy(conn);
} catch (final Exception e) {
s_logger.warn(
"Catch Exception " + e.getClass().getName() + ": unable to destroy VM " + vmRec.nameLabel + " due to ",
e);
success = false;
}
}
}
}
return success;
}
示例5: loadFrame
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
@Nullable
@Override
public XValueChildrenList loadFrame() throws PyDebuggerException {
if (myClient != null) {
try {
Object ret = myClient.execute(GET_FRAME, new Object[]{});
if (ret instanceof String) {
return parseVars((String)ret, null);
}
else {
checkError(ret);
}
}
catch (XmlRpcException e) {
throw new PyDebuggerException("Get frame from console failed", e);
}
}
return new XValueChildrenList();
}
示例6: waitForTask
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
public void waitForTask(final Connection c, final Task task, final long pollInterval, final long timeout)
throws XenAPIException, XmlRpcException, TimeoutException {
final long beginTime = System.currentTimeMillis();
if (s_logger.isTraceEnabled()) {
s_logger.trace("Task " + task.getNameLabel(c) + " (" + task.getUuid(c) + ") sent to " + c.getSessionReference()
+ " is pending completion with a " + timeout
+ "ms timeout");
}
while (task.getStatus(c) == Types.TaskStatusType.PENDING) {
try {
if (s_logger.isTraceEnabled()) {
s_logger.trace("Task " + task.getNameLabel(c) + " (" + task.getUuid(c) + ") is pending, sleeping for "
+ pollInterval + "ms");
}
Thread.sleep(pollInterval);
} catch (final InterruptedException e) {
}
if (System.currentTimeMillis() - beginTime > timeout) {
final String msg = "Async " + timeout / 1000 + " seconds timeout for task " + task.toString();
s_logger.warn(msg);
task.cancel(c);
task.destroy(c);
throw new TimeoutException(msg);
}
}
}
示例7: clusterVMMetaDataSync
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
public HashMap<String, String> clusterVMMetaDataSync(final Connection conn) {
final HashMap<String, String> vmMetaDatum = new HashMap<>();
try {
final Map<VM, VM.Record> vm_map = VM.getAllRecords(conn);
if (vm_map != null) {
for (final VM.Record record : vm_map.values()) {
if (record.isControlDomain || record.isASnapshot || record.isATemplate) {
continue; // Skip DOM0
}
final String platform = StringUtils.mapToString(record.platform);
if (platform.isEmpty()) {
continue; // Skip if platform is null
}
vmMetaDatum.put(record.nameLabel, StringUtils.mapToString(record.platform));
}
}
} catch (XmlRpcException | XenAPIException e) {
final String msg = "Unable to get vms through host " + _host.getUuid() + " due to to " + e.toString();
s_logger.warn(msg, e);
throw new CloudRuntimeException(msg);
}
return vmMetaDatum;
}
示例8: initialize
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
@Override
public StartupCommand[] initialize() throws IllegalArgumentException {
final Connection conn = getConnection();
if (!getHostInfo(conn)) {
s_logger.warn("Unable to get host information for " + _host.getIp());
return null;
}
final StartupRoutingCommand cmd = new StartupRoutingCommand();
fillHostInfo(conn, cmd);
cmd.setHypervisorType(HypervisorType.XenServer);
cmd.setCluster(_cluster);
cmd.setPoolSync(false);
try {
final Pool pool = Pool.getByUuid(conn, _host.getPool());
final Pool.Record poolr = pool.getRecord(conn);
poolr.master.getRecord(conn);
} catch (XmlRpcException | XenAPIException e) {
s_logger.warn("Check for master failed, failing the FULL Cluster sync command");
}
final StartupStorageCommand sscmd = initializeLocalSR(conn);
if (sscmd != null) {
return new StartupCommand[]{cmd, sscmd};
}
return new StartupCommand[]{cmd};
}
示例9: loadVariable
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
@Override
public XValueChildrenList loadVariable(PyDebugValue var) throws PyDebuggerException {
if (myClient != null) {
try {
Object ret = myClient.execute(GET_VARIABLE, new Object[]{GetVariableCommand.composeName(var)});
if (ret instanceof String) {
return parseVars((String)ret, var);
}
else {
checkError(ret);
}
}
catch (XmlRpcException e) {
throw new PyDebuggerException("Get variable from console failed", e);
}
}
return new XValueChildrenList();
}
示例10: tellWaiting
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
private List<Download> tellWaiting(int offset, int num) throws XmlRpcException {
Object[] params;
if (mSecret != null) {
params = new Object[] {mSecret, Integer.valueOf(offset), Integer.valueOf(num)};
} else {
params = new Object[] {Integer.valueOf(offset), Integer.valueOf(num)};
}
Object[] status = (Object[]) mClient.execute("aria2.tellWaiting", params);
List<Download> result = new ArrayList<>(status.length);
for (Object object :
status) {
if (object instanceof Map) {
result.add(new Download((Map<String, Object>) object));
}
}
return result;
}
示例11: revertToSnapshot
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
public String revertToSnapshot(final Connection conn, final VM vmSnapshot, final String vmName,
final String oldVmUuid, final Boolean snapshotMemory, final String hostUUID)
throws XenAPIException, XmlRpcException {
final String results = callHostPluginAsync(conn, "vmopsSnapshot", "revert_memory_snapshot", 10 * 60 * 1000,
"snapshotUUID", vmSnapshot.getUuid(conn), "vmName", vmName,
"oldVmUuid", oldVmUuid, "snapshotMemory", snapshotMemory.toString(), "hostUUID", hostUUID);
String errMsg = null;
if (results == null || results.isEmpty()) {
errMsg = "revert_memory_snapshot return null";
} else {
if (results.equals("0")) {
return results;
} else {
errMsg = "revert_memory_snapshot exception";
}
}
s_logger.warn(errMsg);
throw new CloudRuntimeException(errMsg);
}
示例12: getSRByNameLabel
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
protected SR getSRByNameLabel(final Connection conn, final String name)
throws BadServerResponse, XenAPIException, XmlRpcException {
final Set<SR> srs = SR.getByNameLabel(conn, name);
SR ressr = null;
for (final SR sr : srs) {
final Set<PBD> pbds;
pbds = sr.getPBDs(conn);
for (final PBD pbd : pbds) {
final PBD.Record pbdr = pbd.getRecord(conn);
if (pbdr.host != null) {
ressr = sr;
break;
}
}
}
return ressr;
}
示例13: getPif
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
public PIF getPif(final Connection conn) throws XenAPIException, XmlRpcException {
if (_p == null) {
final Network.Record nr = getNetworkRecord(conn);
for (final PIF pif : nr.PIFs) {
final PIF.Record pr = pif.getRecord(conn);
if (_citrixResourceBase.getHost().getUuid().equals(pr.host.getUuid(conn))) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Found a network called " + nr.nameLabel + " on host=" + _citrixResourceBase.getHost().getIp() + "; Network=" + nr.uuid + "; pif=" + pr
.uuid);
}
_p = pif;
_pr = pr;
break;
}
}
}
return _p;
}
示例14: deleteRosterItem
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
@Override
public CompletableFuture<BooleanXmppResponse> deleteRosterItem(String localuser, String localserver, String user, String server){
Map params = new HashMap();
params.put("localuser", localuser);
params.put("localserver", localserver);
params.put("server", server);
params.put("user", user);
return CompletableFuture.supplyAsync(() -> {
try {
final HashMap response = executeXmlRpc("delete_rosteritem", Arrays.asList(params));
return responseParser.parseBooleanResponse(response);
} catch (XmlRpcException e) {
throw new CompletionException(e);
}
}, executorService);
}
示例15: doInBackground
import org.apache.xmlrpc.XmlRpcException; //导入依赖的package包/类
@Override
protected Boolean doInBackground(Void... params) {
try {
Aria2 aria2 = Aria2Factory.getInstance(mUrl, mSecret);
aria2.getGlobalStat();
return true;
} catch (MalformedURLException | XmlRpcException e) {
e.printStackTrace();
mException = e;
}
return false;
}