当前位置: 首页>>代码示例>>Java>>正文


Java Messages.getAll方法代码示例

本文整理汇总了Java中org.oscm.app.iaas.i18n.Messages.getAll方法的典型用法代码示例。如果您正苦于以下问题:Java Messages.getAll方法的具体用法?Java Messages.getAll怎么用?Java Messages.getAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.oscm.app.iaas.i18n.Messages的用法示例。


在下文中一共展示了Messages.getAll方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateInstanceName

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
public void validateInstanceName(PropertyHandler paramHandler)
        throws APPlatformException {
    String regex = paramHandler.getInstanceNamePattern();
    String instanceName = paramHandler.getInstanceName();
    if (isNullOrEmpty(instanceName)) {
        throw new APPlatformException(Messages.getAll("error_invalid_name",
                new Object[] { instanceName }));
    }
    Pattern p = Pattern.compile(regex);
    Matcher m = p.matcher(instanceName);
    if (!m.matches()) {
        logger.error("Validation error on instance name: [" + instanceName
                + "/" + regex + "]");
        throw new APPlatformException(Messages.getAll("error_invalid_name",
                new Object[] { instanceName }));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:18,代码来源:ProvisioningValidator.java

示例2: validateClusterDefinition

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
private void validateClusterDefinition() throws ConfigurationException {
    if (isClusterDefined()) {
        return;
    }
    if (notNullNorEmpty(getClusterSize())
            || notNullNorEmpty(getMasterTemplateId())
            || notNullNorEmpty(getSlaveTemplateId())) {
        throw new ConfigurationException(Messages.getAll(
                "error_provider_clusterdef_incomplete", getClusterSize(),
                getMasterTemplateId(), getSlaveTemplateId()));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:13,代码来源:PropertyHandler.java

示例3: getControllerInstanceStatus

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Provide information about the state of operation according to current
 * task state.
 * 
 * @param controllerId
 *            id of the controller
 * @param instanceId
 *            id of the instance
 * @param paramHandler
 *            entity which holds all properties of the instance.
 * @return InstanceStatus
 * @throws Exception
 */
public InstanceStatus getControllerInstanceStatus(String controllerId,
        String instanceId, PropertyHandler paramHandler) throws Exception {
    if (paramHandler.isInstanceSuspended()) {
        return getInstanceStatusForSuspendedInstance();
    }
    FlowState oldState = paramHandler.getState();
    // Check and/or dispatch next provisioning operation
    performProvisioningProcessing(controllerId, instanceId, paramHandler);

    FlowState state = paramHandler.getState();
    if (state == FlowState.FAILED) {
        throw new APPlatformException(Messages.getAll("error_operation"));
    }
    Operation operation = paramHandler.getOperation();
    InstanceStatus result = new InstanceStatus();
    result.setIsReady((state == FlowState.FINISHED && (operation != null && !operation
            .isDeletion())) || state == FlowState.DESTROYED);
    result.setRunWithTimer(state != FlowState.MANUAL);

    if (state == FlowState.VSERVERS_STOPPING) {
        result.setAccessInfo(Messages.get(paramHandler.getCustomerLocale(),
                "accessInfo_NOT_AVAILABLE"));
    }
    if (result.isReady()) {
        if (state != FlowState.DESTROYED
                && oldState != FlowState.VSERVERS_STOPPING) {
            // add access info as far as applicable
            result.setAccessInfo(getConnectionData(instanceId, paramHandler));
        }
        // notify about modification
        sendMailAboutModification(instanceId, paramHandler);
    }
    return result;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:48,代码来源:ProcessManagerBean.java

示例4: getSuspendException

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Creates a SuspendException related to this exception.
 * 
 * @return the SuspendException
 */
public SuspendException getSuspendException() {
    if (ResourceType.UNKNOWN.equals(getResouceType())) {
        return new SuspendException(Messages.getAll(
                "error_resource_missing_unknown_type", new Object[] {
                        getResouceType(), getResouceId(), getMessage() }));
    } else {
        return new SuspendException(Messages.getAll(
                "error_resource_missing", new Object[] { getResouceType(),
                        getResouceId() }));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:17,代码来源:MissingResourceException.java

示例5: validateExistingInstance

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
public void validateExistingInstance(APPlatformService platformService,
        String controllerID, PropertyHandler paramHandler)
        throws APPlatformException {
    String instanceName = paramHandler.getInstanceName();
    if (platformService.exists(controllerID, instanceName)) {
        logger.error("Other instance with same name already registered: ["
                + instanceName + "]");
        throw new APPlatformException(Messages.getAll(
                "error_instance_exists", new Object[] { instanceName }));
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:12,代码来源:ProvisioningValidator.java

示例6: getProvisioningStatusText

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Returns a small status text for the current provisioning step.
 * 
 * @param paramHandler
 *            property handler containing the current status
 * @return short status text describing the current status
 */
private List<LocalizedText> getProvisioningStatusText(
        PropertyHandler paramHandler) {
    List<LocalizedText> messages = Messages.getAll("status_"
            + paramHandler.getState());
    for (LocalizedText message : messages) {
        if (message.getText() == null
                || (message.getText().startsWith("!") && message.getText()
                        .endsWith("!"))) {
            message.setText(Messages.get(message.getLocale(),
                    "status_INSTANCE_OVERALL"));
        }
    }
    return messages;
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:22,代码来源:IaasController.java

示例7: process

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
@Override
public void process(String controllerId, String instanceId,
        PropertyHandler paramHandler) throws Exception {
    if (paramHandler.isVirtualSystemProvisioning()) {
        try {
            validateParameters(paramHandler);
            dispatch(controllerId, instanceId, paramHandler);
        } catch (MissingResourceException e) {
            ResourceType resourceType = e.getResouceType();
            if (ResourceType.VSYSTEM.equals(resourceType)
                    && Operation.VSYSTEM_DELETION.equals(paramHandler
                            .getOperation())
                    && paramHandler.getVsysId() != null
                    && paramHandler.getVsysId().equals(e.getResouceId())) {
                logger.warn(
                        "Ignoring missing resource since virtual system {} is to be deleted anyway",
                        paramHandler.getVsysId());
                // adapt internal knowledge about the instance an try to
                // finalize the deletion process
                paramHandler.setState(FlowState.VSYSTEM_DELETING);
                paramHandler.setVsysId("");
                dispatch(controllerId, instanceId, paramHandler);
            } else if (ResourceType.VSYSTEM.equals(resourceType)
                    && Operation.VSYSTEM_OPERATION.equals(paramHandler
                            .getOperation())) {
                throw new InstanceNotAliveException(Messages.getAll(
                        "error_suspend_instance_error", e.getMessage()));
            } else {
                throw e.getSuspendException();
            }
        }
    } else {
        throw new RuntimeException("Wrong processoer");
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:36,代码来源:VSystemProcessorBean.java

示例8: executeLPlatformAction

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
XMLConfiguration executeLPlatformAction(String action)
        throws IaasException, SuspendException {
    if (isEmpty(lplatformId)) {
        throw new SuspendException(Messages.getAll("error_missing_sysid"));
    }
    HashMap<String, String> request = this.getRequestParameters();
    request.put(LParameter.ACTION, action);
    XMLConfiguration result = vdcClient.execute(request);
    return result;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:11,代码来源:LPlatformClient.java

示例9: createVServer

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Creates a VSERVER for the given VSYS with the given name.
 * 
 * @param paramHandler
 *            the parameter handler
 * @return the VServer ID
 * @throws Exception
 */
@Override
public String createVServer(PropertyHandler paramHandler) throws Exception {
    LPlatformClient vsysClient = getLPlatformClient(paramHandler);
    // Create virtual machine

    String vserverId = "";
    List<LServerConfiguration> lServers = vsysClient.getConfiguration()
            .getVServers();
    Iterator<LServerConfiguration> lServerIter = lServers.iterator();

    while (lServerIter.hasNext()) {
        LServerConfiguration tempLServer = lServerIter.next();
        String serverName = tempLServer.getServerName();
        if (serverName.equals(paramHandler.getInstanceName())) {
            throw new InstanceExistsException(Messages.getAll(
                    "error_instance_exists", new Object[] { serverName }));
        }
    }

    vserverId = vsysClient.createLServer(paramHandler.getInstanceName(),
            paramHandler.getVserverType(), paramHandler.getDiskImageId(),
            resolveValidNetworkId(paramHandler), paramHandler.getVMPool(),
            paramHandler.getStoragePool(), paramHandler.getCountCPU());

    paramHandler.setVserverId(vserverId);
    paramHandler.getIaasContext().clear();
    return vserverId;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:37,代码来源:RORVServerCommunication.java

示例10: getNonErrorVServerStatus

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Retrieves the current VServer status and throws a SuspendException if the
 * VServer is in an error state.
 * 
 * @param paramHandler
 *            The parameter handler
 * @return the string representation of the current status
 * @throws Exception
 */
@Override
public String getNonErrorVServerStatus(PropertyHandler paramHandler)
        throws Exception {
    final String status = this.getVServerStatus(paramHandler);
    boolean isErrorState = false;
    String errorCode = "";
    if (status != null) {
        switch (status) {
        case VServerStatus.ERROR:
            isErrorState = true;
            errorCode = "error_state_vserver";
            break;
        case VServerStatus.START_ERROR:
            isErrorState = true;
            errorCode = "error_failed_to_start_vserver";
            break;
        case VServerStatus.STOP_ERROR:
            isErrorState = true;
            errorCode = "error_failed_to_stop_vserver";
            break;
        case VServerStatus.UNEXPECTED_STOP:
            isErrorState = true;
            errorCode = "error_unexpected_stop_vserver";
            break;
        }
    }

    if (isErrorState) {
        throw new SuspendException(Messages.getAll(errorCode,
                new Object[] { paramHandler.getVserverId() }));
    }

    return status;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:44,代码来源:RORVServerCommunication.java

示例11: validateParameters

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
void validateParameters(PropertyHandler paramHandler) throws Exception {
    FlowState currentState = paramHandler.getState();
    FlowState[] VALIDABLE_STATES = { FlowState.VSERVER_CREATION_REQUESTED,
            FlowState.VSERVER_MODIFICATION_REQUESTED,
            FlowState.VSERVER_DELETION_REQUESTED };
    for (FlowState cflState : VALIDABLE_STATES) {
        if (cflState.equals(currentState)) {
            // validation of parameters for creation, modification, deletion
            logger.debug("VServerProcessor is validating parameters in state "
                    + currentState.name());
            if (VSystemStatus.ERROR.equals(paramHandler.getIaasContext()
                    .getVSystemStatus())) {
                throw new SuspendException(Messages.getAll(
                        "error_vsys_notrunning",
                        new Object[] { paramHandler.getVsysId() }));
            }
            if (!vserverComm.isNetworkIdValid(paramHandler)) {
                throw new SuspendException(Messages.getAll(
                        "error_invalid_networkid",
                        new Object[] { paramHandler.getNetworkId() }));
            }
            // validation of input parameters against the back end API
            if (!cflState.equals(FlowState.VSERVER_DELETION_REQUESTED)) {
                if (!vserverComm.isVSysIdValid(paramHandler)) {
                    throw new SuspendException(Messages.getAll(
                            "error_invalid_sysid",
                            new Object[] { paramHandler.getVsysId() }));
                }
                if (isDiskImageIdValid(null, paramHandler) == null) {
                    throw new SuspendException(Messages.getAll(
                            "error_invalid_diskimageid",
                            new Object[] { paramHandler.getDiskImageId() }));
                }
                if (!vserverComm.isServerTypeValid(paramHandler)) {
                    throw new SuspendException(Messages.getAll(
                            "error_invalid_servertype",
                            new Object[] { paramHandler.getVserverType() }));
                }
            }
            break;
        }
    }
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:44,代码来源:VServerProcessorBean.java

示例12: resolveValidNetworkId

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Checks if the configured network ID or name can be resolved to a
 * deterministic network ID.
 * 
 * @param paramHandler
 *            the parameter handler
 * @return the Id of the resolved network
 * @throws Exception
 */

public String resolveValidNetworkId(PropertyHandler paramHandler)
        throws Exception {

    String id = paramHandler.getNetworkId();
    if (id != null && id.trim().length() == 0) {
        id = null;
    }

    try {
        LPlatformClient lPlatformClient = getLPlatformClient(paramHandler);
        VSystemConfiguration config = paramHandler.getIaasContext()
                .getVSystemConfiguration();
        if (config == null) { // nothing cached
            config = lPlatformClient.getConfiguration();
            paramHandler.getIaasContext().add(config);
        }

        List<Network> networks = config.getNetworks();
        if (id == null) {
            if (networks != null && networks.size() == 1) {
                // the only existing network is always deterministic
                return networks.iterator().next().getId();
            }
            throw new SuspendException(Messages.getAll(
                    "error_invalid_networkid", new Object[] { id }));
        }
        String nameToId = null;
        boolean nameDeterministic = true;
        if (networks != null) {
            for (Network net : networks) {
                if (id.equals(net.getId())) {
                    return id;
                }
                if (id.equals(net.getName())) {
                    if (nameToId == null) {
                        nameToId = net.getId();
                    } else {
                        nameDeterministic = false;
                    }
                }
            }
        }
        if (nameToId != null) {
            if (nameDeterministic) {
                return nameToId;
            } else {
                throw new SuspendException(Messages.getAll(
                        "error_invalid_networkid", new Object[] { id }));
            }
        }
    } catch (Exception e) {
        logger.error("Error while validating configured networkId", e);
        SuspendException exception = getSuspendException(e,
                "error_invalid_networkid");
        throw exception;
    }
    return null;
}
 
开发者ID:servicecatalog,项目名称:development,代码行数:69,代码来源:RORVServerCommunication.java

示例13: getSuspendException

import org.oscm.app.iaas.i18n.Messages; //导入方法依赖的package包/类
/**
 * Creates a SuspendException related to this exception.
 * 
 * @return the SuspendException
 */
public SuspendException getSuspendException() {
    return new SuspendException(Messages.getAll(
            "error_communication_failed", new Object[] { getHostName() }));
}
 
开发者ID:servicecatalog,项目名称:oscm-app,代码行数:10,代码来源:CommunicationException.java


注:本文中的org.oscm.app.iaas.i18n.Messages.getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。