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.services.ServiceUtils.java

public static StratosAdminResponse deployPartition(Partition partitionBean) throws RestAPIException {

    //log.info("***** " + cartridgeDefinitionBean.toString() + " *****");

    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {

        org.apache.stratos.cloud.controller.stub.deployment.partition.Partition partition = PojoConverter
                .convertToCCPartitionPojo(partitionBean);

        try {/*from  ww  w  . j a v a  2 s  .co m*/
            autoscalerServiceClient.deployPartition(partition);
        } catch (RemoteException e) {
            log.error(e.getMessage(), e);
            throw new RestAPIException(e.getMessage(), e);
        } catch (AutoScalerServiceInvalidPartitionExceptionException e) {
            String message = e.getFaultMessage().getInvalidPartitionException().getMessage();
            log.error(message, e);
            throw new RestAPIException(message, e);
        }

    }

    StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
    stratosAdminResponse.setMessage("Successfully deployed partition definition with id " + partitionBean.id);
    return stratosAdminResponse;
}

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

public static StratosAdminResponse deployAutoscalingPolicy(AutoscalePolicy autoscalePolicyBean)
        throws RestAPIException {

    //log.info("***** " + cartridgeDefinitionBean.toString() + " *****");

    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {

        org.apache.stratos.autoscaler.policy.model.AutoscalePolicy autoscalePolicy = PojoConverter
                .convertToCCAutoscalerPojo(autoscalePolicyBean);

        try {/*from  ww w . j ava2  s  .co m*/
            autoscalerServiceClient.deployAutoscalingPolicy(autoscalePolicy);
        } catch (RemoteException e) {
            log.error(e.getMessage(), e);
            throw new RestAPIException(e.getMessage(), e);
        } catch (AutoScalerServiceInvalidPolicyExceptionException e) {
            String message = e.getFaultMessage().getInvalidPolicyException().getMessage();
            log.error(message, e);
            throw new RestAPIException(message, e);
        }

    }

    StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
    stratosAdminResponse.setMessage(
            "Successfully deployed autoscaling policy definition with id " + autoscalePolicyBean.getId());
    return stratosAdminResponse;
}

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

public static StratosAdminResponse deployDeploymentPolicy(
        org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy deploymentPolicyBean)
        throws RestAPIException {

    //log.info("***** " + cartridgeDefinitionBean.toString() + " *****");

    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {

        org.apache.stratos.autoscaler.deployment.policy.DeploymentPolicy deploymentPolicy = PojoConverter
                .convetToCCDeploymentPolicyPojo(deploymentPolicyBean);

        try {/*from ww  w  . java  2 s .c o m*/
            autoscalerServiceClient.deployDeploymentPolicy(deploymentPolicy);
        } catch (RemoteException e) {
            log.error(e.getMessage(), e);
            throw new RestAPIException(e.getMessage(), e);
        } catch (AutoScalerServiceInvalidPolicyExceptionException e) {
            String message = e.getFaultMessage().getInvalidPolicyException().getMessage();
            log.error(message, e);
            throw new RestAPIException(message, e);
        }

    }

    StratosAdminResponse stratosAdminResponse = new StratosAdminResponse();
    stratosAdminResponse.setMessage(
            "Successfully deployed deployment policy definition with type " + deploymentPolicyBean.id);
    return stratosAdminResponse;
}

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

public static Partition[] getAvailablePartitions() throws RestAPIException {

    org.apache.stratos.cloud.controller.stub.deployment.partition.Partition[] partitions = null;
    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {
        try {/*from  w w  w  .  j  a  v  a  2 s  .c o m*/
            partitions = autoscalerServiceClient.getAvailablePartitions();

        } catch (RemoteException e) {
            String errorMsg = "Error while getting available partitions. Cause : " + e.getMessage();
            log.error(errorMsg, e);
            throw new RestAPIException(errorMsg, e);
        }
    }

    return PojoConverter.populatePartitionPojos(partitions);
}

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

public static Partition[] getPartitionsOfDeploymentPolicy(String deploymentPolicyId) throws RestAPIException {

    org.apache.stratos.cloud.controller.stub.deployment.partition.Partition[] partitions = null;
    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {
        try {//from   www.  ja  va2 s .  c o  m
            partitions = autoscalerServiceClient.getPartitionsOfDeploymentPolicy(deploymentPolicyId);

        } catch (RemoteException e) {
            String errorMsg = "Error while getting available partitions for deployment policy id "
                    + deploymentPolicyId + ". Cause: " + e.getMessage();
            log.error(errorMsg, e);
            throw new RestAPIException(errorMsg, e);
        }
    }

    return PojoConverter.populatePartitionPojos(partitions);
}

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

public static Partition[] getPartitionsOfGroup(String deploymentPolicyId, String groupId)
        throws RestAPIException {

    org.apache.stratos.cloud.controller.stub.deployment.partition.Partition[] partitions = null;
    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {
        try {//from www. j  a va  2 s.  com
            partitions = autoscalerServiceClient.getPartitionsOfGroup(deploymentPolicyId, groupId);

        } catch (RemoteException e) {
            String errorMsg = "Error while getting available partitions for deployment policy id "
                    + deploymentPolicyId + ", group id " + groupId + ". Cause: " + e.getMessage();
            log.error(errorMsg, e);
            throw new RestAPIException(errorMsg, e);
        }
    }

    return PojoConverter.populatePartitionPojos(partitions);
}

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

public static Partition getPartition(String partitionId) throws RestAPIException {

    org.apache.stratos.cloud.controller.stub.deployment.partition.Partition partition = null;
    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {
        try {//w  ww .j a v  a2  s . c  o  m
            partition = autoscalerServiceClient.getPartition(partitionId);

        } catch (RemoteException e) {
            String errorMsg = "Error while getting partition for id " + partitionId + ". Cause: "
                    + e.getMessage();
            log.error(errorMsg, e);
            throw new RestAPIException(errorMsg, e);
        }
    }

    return PojoConverter.populatePartitionPojo(partition);
}

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

public static AutoscalePolicy[] getAutoScalePolicies() throws RestAPIException {

    org.apache.stratos.autoscaler.policy.model.AutoscalePolicy[] autoscalePolicies = null;
    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {
        try {/*from   w  ww  .j a v a2s. c  o  m*/
            autoscalePolicies = autoscalerServiceClient.getAutoScalePolicies();

        } catch (RemoteException e) {
            String errorMsg = "Error while getting available autoscaling policies. Cause : " + e.getMessage();
            log.error(errorMsg, e);
            throw new RestAPIException(errorMsg, e);
        }
    }
    return PojoConverter.populateAutoscalePojos(autoscalePolicies);
}

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

public static AutoscalePolicy getAutoScalePolicy(String autoscalePolicyId) throws RestAPIException {

    org.apache.stratos.autoscaler.policy.model.AutoscalePolicy autoscalePolicy = null;
    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {
        try {//from   ww  w  . j  a va 2  s  .  c  o  m
            autoscalePolicy = autoscalerServiceClient.getAutoScalePolicy(autoscalePolicyId);

        } catch (RemoteException e) {
            String errorMsg = "Error while getting information for autoscaling policy with id "
                    + autoscalePolicyId + ".  Cause: " + e.getMessage();
            log.error(errorMsg, e);
            throw new RestAPIException(errorMsg, e);
        }
    }

    return PojoConverter.populateAutoscalePojo(autoscalePolicy);
}

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

public static org.apache.stratos.rest.endpoint.bean.autoscaler.policy.deployment.DeploymentPolicy[] getDeploymentPolicies()
        throws RestAPIException {

    DeploymentPolicy[] deploymentPolicies = null;
    AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
    if (autoscalerServiceClient != null) {
        try {/*from w w  w .  j a  v  a2  s  . c  o  m*/
            deploymentPolicies = autoscalerServiceClient.getDeploymentPolicies();
        } catch (RemoteException e) {
            String errorMsg = "Error getting available deployment policies. Cause : " + e.getMessage();
            log.error(errorMsg, e);
            throw new RestAPIException(errorMsg, e);
        }
    }

    return PojoConverter.populateDeploymentPolicyPojos(deploymentPolicies);
}