Example usage for java.rmi RemoteException getMessage

List of usage examples for java.rmi RemoteException getMessage

Introduction

In this page you can find the example usage for java.rmi RemoteException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message, including the message from the cause, if any, of this exception.

Usage

From source file:org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.java

/**
 * Get Kubernetes Master//from w  w w  . java2s  .co m
 *
 * @param kubernetesClusterId Kubernetes ClusterId
 * @return KubernetesMasterBean
 * @throws RestAPIException
 */
public static KubernetesMasterBean getKubernetesMaster(String kubernetesClusterId) throws RestAPIException {
    CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
    if (cloudControllerServiceClient != null) {
        try {
            org.apache.stratos.cloud.controller.stub.domain.kubernetes.KubernetesMaster kubernetesMaster = cloudControllerServiceClient
                    .getKubernetesMaster(kubernetesClusterId);
            return ObjectConverter.convertStubKubernetesMasterToKubernetesMaster(kubernetesMaster);

        } catch (RemoteException e) {
            log.error(e.getMessage(), e);
            throw new RestAPIException(e.getMessage(), e);
        } catch (CloudControllerServiceNonExistingKubernetesClusterExceptionException e) {
            String message = e.getFaultMessage().getNonExistingKubernetesClusterException().getMessage();
            log.error(message);
            throw new RestAPIException(message, e);
        }
    }
    return null;
}

From source file:org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.java

/**
 * Update KubernetesHost/*from  ww  w.  j  a v a2  s. c  om*/
 *
 * @param kubernetesHostBean KubernetesHostBean
 * @return update status
 * @throws RestAPIException
 */
public static boolean updateKubernetesHost(KubernetesHostBean kubernetesHostBean) throws RestAPIException {
    CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
    if (cloudControllerServiceClient != null) {
        org.apache.stratos.cloud.controller.stub.domain.kubernetes.KubernetesHost kubernetesHost = ObjectConverter
                .convertKubernetesHostToStubKubernetesHost(kubernetesHostBean);
        try {
            return cloudControllerServiceClient.updateKubernetesHost(kubernetesHost);
        } catch (RemoteException e) {
            log.error(e.getMessage(), e);
            throw new RestAPIException(e.getMessage(), e);
        } catch (CloudControllerServiceInvalidKubernetesHostExceptionException e) {
            String message = e.getFaultMessage().getInvalidKubernetesHostException().getMessage();
            log.error(message, e);
            throw new RestAPIException(message, e);
        } catch (CloudControllerServiceNonExistingKubernetesHostExceptionException e) {
            String message = e.getFaultMessage().getNonExistingKubernetesHostException().getMessage();
            log.error(message, e);
            throw new RestAPIException(message, e);
        }
    }
    return false;
}

From source file:org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.java

/**
 * Add a Network Partition/*from   w  w  w . j  a va  2  s  .c o  m*/
 *
 * @param networkPartitionBean NetworkPartitionBean
 */
public static void addNetworkPartition(NetworkPartitionBean networkPartitionBean)
        throws RestAPIException, CloudControllerServiceNetworkPartitionAlreadyExistsExceptionException,
        CloudControllerServiceInvalidNetworkPartitionExceptionException {
    try {
        CloudControllerServiceClient serviceClient = CloudControllerServiceClient.getInstance();
        serviceClient.addNetworkPartition(
                ObjectConverter.convertNetworkPartitionToCCStubNetworkPartition(networkPartitionBean));
    } catch (RemoteException e) {
        String message = e.getMessage();
        log.error(message);
        throw new RestAPIException(message, e);
    }
}

From source file:org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.java

/**
 * Get Network Partitions/*from  ww  w  .  j  ava  2  s .  co  m*/
 *
 * @return Array of NetworkPartitionBeans
 */
public static NetworkPartitionBean[] getNetworkPartitions() throws RestAPIException {
    try {
        CloudControllerServiceClient serviceClient = CloudControllerServiceClient.getInstance();
        org.apache.stratos.cloud.controller.stub.domain.NetworkPartition[] networkPartitions = serviceClient
                .getNetworkPartitions();
        return ObjectConverter.convertCCStubNetworkPartitionsToNetworkPartitions(networkPartitions);
    } catch (RemoteException e) {
        String message = e.getMessage();
        log.error(message);
        throw new RestAPIException(message, e);
    }
}

From source file:org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.java

/**
 * Get Network Partition/*from   ww  w.j  a v a 2  s . c o  m*/
 *
 * @param networkPartitionId networkPartitionId
 * @return NetworkPartitionBean
 */
public static NetworkPartitionBean getNetworkPartition(String networkPartitionId) throws RestAPIException {
    try {
        CloudControllerServiceClient serviceClient = CloudControllerServiceClient.getInstance();
        org.apache.stratos.cloud.controller.stub.domain.NetworkPartition networkPartition = serviceClient
                .getNetworkPartition(networkPartitionId);
        return ObjectConverter.convertCCStubNetworkPartitionToNetworkPartition(networkPartition);
    } catch (RemoteException e) {
        String message = e.getMessage();
        log.error(message);
        throw new RestAPIException(message, e);
    }
}

From source file:org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.java

/**
 * Update Network Partition/* w ww .j  a  v  a 2 s . c om*/
 *
 * @param networkPartition NetworkPartitionBean
 */
public static void updateNetworkPartition(NetworkPartitionBean networkPartition)
        throws RestAPIException, CloudControllerServiceNetworkPartitionNotExistsExceptionException {
    try {
        CloudControllerServiceClient serviceClient = CloudControllerServiceClient.getInstance();
        serviceClient.updateNetworkPartition(
                ObjectConverter.convertNetworkPartitionToCCStubNetworkPartition(networkPartition));
    } catch (RemoteException e) {
        String message = e.getMessage();
        log.error(message);
        throw new RestAPIException(message, e);
    }
}

From source file:org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.java

/**
 * Add deployment policy/*from  w  ww . j ava 2 s  .c om*/
 *
 * @param deployementPolicyDefinitionBean DeploymentPolicyBean
 */
public static void addDeploymentPolicy(DeploymentPolicyBean deployementPolicyDefinitionBean)
        throws RestAPIException, AutoscalerServiceDeploymentPolicyAlreadyExistsExceptionException,
        AutoscalerServiceInvalidDeploymentPolicyExceptionException {
    try {
        if (log.isDebugEnabled()) {
            log.debug(String.format("Adding deployment policy: [deployment-policy-id] %s ",
                    deployementPolicyDefinitionBean.getId()));
        }

        org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy deploymentPolicy =

                ObjectConverter
                        .convertDeploymentPolicyBeanToASDeploymentPolicy(deployementPolicyDefinitionBean);
        AutoscalerServiceClient.getInstance().addDeploymentPolicy(deploymentPolicy);

        if (log.isDebugEnabled()) {
            log.debug(String.format("Successfully added deploymentPolicy: [deployment-policy-id] %s ",
                    deployementPolicyDefinitionBean.getId()));
        }
    } catch (RemoteException e) {
        String msg = e.getMessage();
        log.error(msg, e);
        throw new RestAPIException(msg, e);
    } catch (AutoscalerServiceRemoteExceptionException e) {
        String msg = e.getMessage();
        log.error(msg, e);
        throw new RestAPIException(msg, e);
    }
}

From source file:org.apache.stratos.rest.endpoint.api.StratosApiV41Utils.java

/**
 * Get Iaas Providers/*from   ww w  . j av a 2s. c o m*/
 *
 * @return Array of Strings
 */
public static IaasProviderInfoBean getIaasProviders() throws RestAPIException {
    try {
        CloudControllerServiceClient serviceClient = CloudControllerServiceClient.getInstance();
        String[] iaasProviders = serviceClient.getIaasProviders();
        return ObjectConverter.convertStringArrayToIaasProviderInfoBean(iaasProviders);
    } catch (RemoteException e) {
        String message = e.getMessage();
        log.error(message);
        throw new RestAPIException(message, e);
    }
}

From source file:org.apache.stratos.rest.endpoint.services.ServiceUtils.java

static StratosAdminResponse deployCartridge(CartridgeDefinitionBean cartridgeDefinitionBean,
        ConfigurationContext ctxt, String userName, String tenantDomain) throws RestAPIException {

    log.info("Starting to deploy a Cartridge [type] " + cartridgeDefinitionBean.type);

    CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();

    if (cloudControllerServiceClient != null) {

        CartridgeConfig cartridgeConfig = PojoConverter.populateCartridgeConfigPojo(cartridgeDefinitionBean);

        if (cartridgeConfig == null) {
            throw new RestAPIException(
                    "Populated CartridgeConfig instance is null, cartridge deployment aborted");
        }/*from   ww w.jav a 2  s .  com*/

        // call CC
        try {
            cloudControllerServiceClient.deployCartridgeDefinition(cartridgeConfig);
        } catch (RemoteException e) {
            log.error(e.getMessage(), e);
            throw new RestAPIException(e.getMessage(), e);
        } catch (CloudControllerServiceInvalidCartridgeDefinitionExceptionException e) {
            String message = e.getFaultMessage().getInvalidCartridgeDefinitionException().getMessage();
            log.error(message, e);
            throw new RestAPIException(message, e);
        } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) {
            String message = e.getFaultMessage().getInvalidIaasProviderException().getMessage();
            log.error(message, e);
            throw new RestAPIException(message, e);
        }

        log.info("Successfully deployed Cartridge [type] " + cartridgeDefinitionBean.type);

    }

    StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
    stratosAdminResponse
            .setMessage("Successfully deployed cartridge definition with type " + cartridgeDefinitionBean.type);
    return stratosAdminResponse;
}

From source file:org.apache.stratos.rest.endpoint.services.ServiceUtils.java

static StratosAdminResponse undeployCartridge(String cartridgeType) throws RestAPIException {

    CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
    if (cloudControllerServiceClient != null) {
        try {//from w ww  .ja  va2 s  . co m
            cloudControllerServiceClient.unDeployCartridgeDefinition(cartridgeType);
        } catch (RemoteException e) {
            log.error(e.getMessage(), e);
            throw new RestAPIException(e.getMessage(), e);
        } catch (CloudControllerServiceInvalidCartridgeTypeExceptionException e) {
            String msg = e.getFaultMessage().getInvalidCartridgeTypeException().getMessage();
            log.error(msg, e);
            throw new RestAPIException(msg, e);
        }

    }

    StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
    stratosAdminResponse.setMessage("Successfully undeployed cartridge definition with type " + cartridgeType);
    return stratosAdminResponse;
}