• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java LocalizedMethodFault类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vmware.vim25.LocalizedMethodFault的典型用法代码示例。如果您正苦于以下问题:Java LocalizedMethodFault类的具体用法?Java LocalizedMethodFault怎么用?Java LocalizedMethodFault使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LocalizedMethodFault类属于com.vmware.vim25包,在下文中一共展示了LocalizedMethodFault类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: awaitReady

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
/**
 * Wait up to a minute for the nfcLease to become READY.
 * @throws Exception
 */
public void awaitReady() throws Exception {
    int i = 60;

    while (i-- > 0) {
        HttpNfcLeaseState state = getState();
        if (state.equals(HttpNfcLeaseState.ERROR)) {
            LocalizedMethodFault leaseError = this.get.entityProp(this.nfcLease, PROP_ERROR);
            logger.warn("nfcLease error: {}", leaseError.getLocalizedMessage(), leaseError);
            VimUtils.rethrow(leaseError);
        }

        if (state.equals(HttpNfcLeaseState.READY)) {
            return;
        }

        logger.debug("Waiting for nfcLease {}", VimUtils.convertMoRefToString(this.nfcLease), state);

        Thread.sleep(LEASE_READY_RETRY_MILLIS);
    }

    throw new IllegalStateException("Lease not ready within configured timeout");
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:27,代码来源:LeaseProgressUpdater.java


示例2: rethrow

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
/**
 * This method never returns but throws an Exception wrapping the fault.
 *
 * @param lmf
 * @param <T>
 * @return
 * @throws Exception
 */
public static <T> T rethrow(LocalizedMethodFault lmf) throws Exception {
    Class<?> type = lmf.getFault().getClass();
    String possibleWrapperType = type.getName() + EXCEPTION_SUFFIX;

    Exception ex;
    try {
        ClassLoader cl = type.getClassLoader();
        Class<?> faultClass = cl.loadClass(possibleWrapperType);
        Constructor<?> ctor = faultClass.getConstructor(String.class, type);
        ex = (Exception) ctor.newInstance(lmf.getLocalizedMessage(), lmf.getFault());
    } catch (ReflectiveOperationException e) {
        throw new GenericVimFault(lmf.getLocalizedMessage(), lmf.getFault());
    }

    throw ex;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:25,代码来源:VimUtils.java


示例3: retrhowKnownException

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
@Test
public void retrhowKnownException() {
    DuplicateName dn = new DuplicateName();

    LocalizedMethodFault lmf = new LocalizedMethodFault();
    lmf.setLocalizedMessage("msg");
    lmf.setFault(dn);

    try {
        VimUtils.rethrow(lmf);
        fail();
    } catch (DuplicateNameFaultMsg msg) {
        assertSame(dn, msg.getFaultInfo());
        assertSame(lmf.getLocalizedMessage(), msg.getMessage());
    } catch (Exception e) {
        fail();
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:19,代码来源:VimUtilsTest.java


示例4: retrhowUnknownException

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
@Test
public void retrhowUnknownException() {
    ConnectedIso dn = new ConnectedIso();

    LocalizedMethodFault lmf = new LocalizedMethodFault();
    lmf.setLocalizedMessage("msg");
    lmf.setFault(dn);

    try {
        VimUtils.rethrow(lmf);
        fail();
    } catch (GenericVimFault msg) {
        assertSame(dn, msg.getFaultInfo());
        assertSame(lmf.getLocalizedMessage(), msg.getMessage());
    } catch (Exception e) {
        fail();
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:19,代码来源:VimUtilsTest.java


示例5: getTaskResultAfterDone

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
/**
 * This method returns a boolean value specifying whether the Task is
 * succeeded or failed.
 *
 * @param task
 *            ManagedObjectReference representing the Task.
 * @return boolean value representing the Task result.
 * @throws InvalidCollectorVersionFaultMsg
 *
 * @throws RuntimeFaultFaultMsg
 * @throws InvalidPropertyFaultMsg
 */
public boolean getTaskResultAfterDone(ManagedObjectReference task)
        throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg,
        InvalidCollectorVersionFaultMsg {

    boolean retVal = false;

    // info has a property - state for state of the task
    Object[] result = wait(task,
            new String[] { "info.state", "info.error" },
            new String[] { "state" }, new Object[][] { new Object[] {
                TaskInfoState.SUCCESS, TaskInfoState.ERROR } });

    if (result[0].equals(TaskInfoState.SUCCESS)) {
        retVal = true;
    }
    if (result[1] instanceof LocalizedMethodFault) {
        throw new RuntimeException(
                ((LocalizedMethodFault) result[1]).getLocalizedMessage());
    }
    return retVal;
}
 
开发者ID:vmware,项目名称:vsphere-automation-sdk-java,代码行数:34,代码来源:WaitForValues.java


示例6: getTaskFailureInfo

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public static String getTaskFailureInfo(VmwareContext context, ManagedObjectReference morTask) {
    StringBuffer sb = new StringBuffer();

    try {
        TaskInfo info = (TaskInfo)context.getVimClient().getDynamicProperty(morTask, "info");
        if (info != null) {
            LocalizedMethodFault fault = info.getError();
            if (fault != null) {
                sb.append(fault.getLocalizedMessage()).append(" ");

                if (fault.getFault() != null)
                    sb.append(fault.getFault().getClass().getName());
            }
        }
    } catch (Exception e) {
        s_logger.info("[ignored]"
                + "error retrieving failure info for task : " + e.getLocalizedMessage());
    }

    return sb.toString();
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:22,代码来源:TaskMO.java


示例7: waitForTask

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public static boolean waitForTask(VMwareConnection connection, ManagedObjectReference task) throws Exception {
    try {
        Object[] result = waitForValues(connection, task, new String[] { "info.state", "info.error" }, new String[] { "state" },
                new Object[][] { new Object[] { TaskInfoState.SUCCESS, TaskInfoState.ERROR } });

        if (result[0].equals(TaskInfoState.SUCCESS)) {
            return true;
        }

        if (result[1] instanceof LocalizedMethodFault) {
            throw new Exception(((LocalizedMethodFault)result[1]).getLocalizedMessage());
        }
    } catch (WebServiceException we) {
        s_logger.debug("Cancelling vCenter task because the task failed with the following error: " + we.getLocalizedMessage());

        connection.getVimPortType().cancelTask(task);

        throw new Exception("The vCenter task failed due to the following error: " + we.getLocalizedMessage());
    }

    return false;
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:23,代码来源:VMwareUtil.java


示例8: abort

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public void abort(LocalizedMethodFault e) {
    this.done.set(true);

    try {
        getVimPort().httpNfcLeaseAbort(this.nfcLease, e);
    } catch (RuntimeFaultFaultMsg | TimedoutFaultMsg | InvalidStateFaultMsg ex) {
        logger.warn("Error aborting nfcLease {}", VimUtils.convertMoRefToString(this.nfcLease), e);
    }
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:10,代码来源:LeaseProgressUpdater.java


示例9: convertToFault

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
@Test
public void convertToFault() {
    DuplicateName fault = new DuplicateName();
    String msg = "msg";
    Exception e = new DuplicateNameFaultMsg(msg, fault);

    LocalizedMethodFault lmf = VimUtils.convertExceptionToFault(e);
    assertSame(fault, lmf.getFault());
    assertSame(msg, lmf.getLocalizedMessage());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:11,代码来源:VimUtilsTest.java


示例10: convertToFaultGeneric

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
@Test
public void convertToFaultGeneric() {
    String msg = "test";
    IOException e = new IOException(msg);

    LocalizedMethodFault lmf = VimUtils.convertExceptionToFault(e);
    assertNull(lmf.getFault());
    assertSame(msg, lmf.getLocalizedMessage());
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:10,代码来源:VimUtilsTest.java


示例11: getHttpNfcLeaseErrorState

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public static String getHttpNfcLeaseErrorState(final ConnectionResources connectionResources, final ManagedObjectReference httpNfcLease) throws Exception {
    final ObjectContent objectContent = GetObjectProperties.getObjectProperty(connectionResources, httpNfcLease, "error");
    final List<DynamicProperty> dynamicProperties = objectContent.getPropSet();
    if (firstElementIsOfClass(dynamicProperties, LocalizedMethodFault.class)) {
        return ((LocalizedMethodFault) dynamicProperties.get(0).getVal()).getLocalizedMessage();
    }
    throw new Exception(LEASE_ERROR_STATE_COULD_NOT_BE_OBTAINED);
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:9,代码来源:OvfUtils.java


示例12: getTaskResultAfterDone

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
protected boolean getTaskResultAfterDone(ConnectionResources connectionResources, ManagedObjectReference task)
        throws InvalidPropertyFaultMsg, RuntimeFaultFaultMsg, InvalidCollectorVersionFaultMsg {
    WaitForValues waitForValues = new WaitForValues(connectionResources.getConnection());
    Object[] result = waitForValues.wait(task, new String[]{ManagedObjectType.INFO_STATE.getValue(),
                    ManagedObjectType.INFO_ERROR.getValue()}, new String[]{ManagedObjectType.STATE.getValue()},
            new Object[][]{new Object[]{TaskInfoState.SUCCESS, TaskInfoState.ERROR}});

    if (result[1] instanceof LocalizedMethodFault) {
        throw new RuntimeException(((LocalizedMethodFault) result[1]).getLocalizedMessage());
    }

    return result[0].equals(TaskInfoState.SUCCESS);
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:14,代码来源:ResponseHelper.java


示例13: checkImportSpecResultForErrors

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
private void checkImportSpecResultForErrors(OvfCreateImportSpecResult importSpecResult) throws Exception {
    if (0 < importSpecResult.getError().size()) {
        StringBuilder stringBuilder = new StringBuilder();
        for (LocalizedMethodFault fault : importSpecResult.getError()) {
            stringBuilder.append(fault.getLocalizedMessage()).append(System.lineSeparator());
        }
        throw new Exception(stringBuilder.toString());
    }
}
 
开发者ID:CloudSlang,项目名称:cs-actions,代码行数:10,代码来源:DeployOvfTemplateService.java


示例14: getError

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public LocalizedMethodFault getError()
{
	return (LocalizedMethodFault) getCurrentProperty("error");
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:5,代码来源:HttpNfcLease.java


示例15: httpNfcLeaseAbort

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public void httpNfcLeaseAbort(LocalizedMethodFault fault) throws Timedout, InvalidState, RuntimeFault, RemoteException
{
	getVimService().httpNfcLeaseAbort(getMOR(), fault);
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:5,代码来源:HttpNfcLease.java


示例16: setTaskState

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public void setTaskState(TaskInfoState tis, Object result, LocalizedMethodFault fault) throws InvalidState, RuntimeFault, RemoteException 
{
	getVimService().setTaskState(getMOR(), tis, result, fault);
}
 
开发者ID:Juniper,项目名称:vijava,代码行数:5,代码来源:Task.java


示例17: setTaskState

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public void setTaskState(TaskInfoState state, Object result, LocalizedMethodFault fault) throws Exception {
    _context.getService().setTaskState(_mor, state, result, fault);
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:4,代码来源:TaskMO.java


示例18: getLeaseError

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
public LocalizedMethodFault getLeaseError() throws Exception {
    return (LocalizedMethodFault)_context.getVimClient().getDynamicProperty(_mor, "error");
}
 
开发者ID:apache,项目名称:cloudstack,代码行数:4,代码来源:HttpNfcLeaseMO.java


示例19: getWarning

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
/**
 * Gets the value of the warning property.
 * 
 * <p>
 * This accessor method returns a reference to the live list,
 * not a snapshot. Therefore any modification you make to the
 * returned list will be present inside the JAXB object.
 * This is why there is not a <CODE>set</CODE> method for the warning property.
 * 
 * <p>
 * For example, to add a new item, do as follows:
 * <pre>
 *    getWarning().add(newItem);
 * </pre>
 * 
 * 
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link LocalizedMethodFault }
 * 
 * 
 */
public List<LocalizedMethodFault> getWarning() {
    if (warning == null) {
        warning = new ArrayList<LocalizedMethodFault>();
    }
    return this.warning;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:29,代码来源:PbmPlacementCompatibilityResult.java


示例20: getError

import com.vmware.vim25.LocalizedMethodFault; //导入依赖的package包/类
/**
 * Gets the value of the error property.
 * 
 * <p>
 * This accessor method returns a reference to the live list,
 * not a snapshot. Therefore any modification you make to the
 * returned list will be present inside the JAXB object.
 * This is why there is not a <CODE>set</CODE> method for the error property.
 * 
 * <p>
 * For example, to add a new item, do as follows:
 * <pre>
 *    getError().add(newItem);
 * </pre>
 * 
 * 
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link LocalizedMethodFault }
 * 
 * 
 */
public List<LocalizedMethodFault> getError() {
    if (error == null) {
        error = new ArrayList<LocalizedMethodFault>();
    }
    return this.error;
}
 
开发者ID:vmware,项目名称:photon-model,代码行数:29,代码来源:PbmPlacementCompatibilityResult.java



注:本文中的com.vmware.vim25.LocalizedMethodFault类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Debugger类代码示例发布时间:2022-05-23
下一篇:
Java LabelDirectEditPolicy类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap