List of usage examples for java.rmi RemoteException getMessage
public String getMessage()
From source file:org.apache.stratos.autoscaler.client.CloudControllerClient.java
public synchronized void terminateInstances(String clusterId) throws TerminationException { try {// www . j a v a 2s. c o m if (log.isInfoEnabled()) { log.info(String.format("Terminating all instances of cluster via cloud controller: [cluster] %s", clusterId)); } long startTime = System.currentTimeMillis(); stub.terminateInstances(clusterId); if (log.isDebugEnabled()) { long endTime = System.currentTimeMillis(); log.debug( String.format("Service call terminateInstances() returned in %dms", (endTime - startTime))); } } catch (RemoteException e) { String msg = e.getMessage(); log.error(msg, e); throw new TerminationException(msg, e); } catch (CloudControllerServiceInvalidClusterExceptionException e) { String message = e.getFaultMessage().getInvalidClusterException().getMessage(); log.error(message, e); throw new TerminationException(message, e); } }
From source file:org.apache.stratos.autoscaler.client.CloudControllerClient.java
public synchronized void createApplicationClusters(String appId, Set<ApplicationClusterContext> appClusterContexts) { List<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext> contextDTOs = new ArrayList<org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext>(); for (ApplicationClusterContext applicationClusterContext : appClusterContexts) { org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext dto = new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext(); dto.setClusterId(applicationClusterContext.getClusterId()); dto.setAutoscalePolicyName(applicationClusterContext.getAutoscalePolicyName()); dto.setDeploymentPolicyName(applicationClusterContext.getDeploymentPolicyName()); dto.setCartridgeType(applicationClusterContext.getCartridgeType()); dto.setHostName(applicationClusterContext.getHostName()); dto.setTenantRange(applicationClusterContext.getTenantRange()); dto.setTextPayload(applicationClusterContext.getTextPayload()); dto.setLbCluster(applicationClusterContext.isLbCluster()); dto.setProperties(AutoscalerUtil.toStubProperties(applicationClusterContext.getProperties())); dto.setDependencyCluterIds(applicationClusterContext.getDependencyCluterId()); contextDTOs.add(dto);/*from w ww.ja v a 2 s. c om*/ } org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[] applicationClusterContextDTOs = new org.apache.stratos.cloud.controller.stub.domain.ApplicationClusterContext[contextDTOs .size()]; contextDTOs.toArray(applicationClusterContextDTOs); try { stub.createApplicationClusters(appId, applicationClusterContextDTOs); } catch (RemoteException e) { String msg = e.getMessage(); log.error(msg, e); //throw new TerminationException(msg, e); } catch (CloudControllerServiceApplicationClusterRegistrationExceptionException e) { String msg = e.getMessage(); log.error(msg, e); } }
From source file:org.apache.stratos.autoscaler.client.CloudControllerClient.java
public void createClusterInstance(String serviceType, String clusterId, String alias, String instanceId, String partitionId, String networkPartitionId) { try {/* www .ja v a 2s . c o m*/ stub.createClusterInstance(serviceType, clusterId, alias, instanceId, partitionId, networkPartitionId); } catch (RemoteException e) { String msg = e.getMessage(); log.error(msg, e); throw new RuntimeException(msg, e); } catch (CloudControllerServiceClusterInstanceCreationExceptionException e) { String msg = e.getMessage(); log.error(msg, e); throw new RuntimeException(msg, e); } }
From source file:org.apache.stratos.autoscaler.client.CloudControllerClient.java
public synchronized void terminateInstance(String memberId) throws TerminationException { try {/* ww w . jav a 2 s. co m*/ if (log.isInfoEnabled()) { log.info(String.format("Terminating instance via cloud controller: [member] %s", memberId)); } long startTime = System.currentTimeMillis(); stub.terminateInstance(memberId); if (log.isDebugEnabled()) { long endTime = System.currentTimeMillis(); log.debug( String.format("Service call terminateInstance() returned in %dms", (endTime - startTime))); } } catch (RemoteException e) { String msg = e.getMessage(); log.error(msg, e); throw new TerminationException(msg, e); } catch (CloudControllerServiceInvalidMemberExceptionException e) { String msg = e.getFaultMessage().getInvalidMemberException().getMessage(); log.error(msg, e); throw new TerminationException(msg, e); } catch (CloudControllerServiceInvalidCartridgeTypeExceptionException e) { String msg = e.getFaultMessage().getInvalidCartridgeTypeException().getMessage(); log.error(msg, e); throw new TerminationException(msg, e); } catch (CloudControllerServiceCloudControllerExceptionException e) { String msg = e.getMessage(); log.error(msg, e); throw new TerminationException(msg, e); } }
From source file:org.apache.stratos.autoscaler.client.CloudControllerClient.java
public CartridgeInfo getCartrdgeInformation(String cartridgeType) throws CartridgeInformationException { try {// w ww .j a va 2s .c om return stub.getCartridgeInfo(cartridgeType); } catch (RemoteException e) { String msg = e.getMessage(); log.error(msg, e); throw new CartridgeInformationException(msg, e); } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) { String msg = e.getMessage(); log.error(msg, e); throw new CartridgeInformationException(msg, e); } }
From source file:org.apache.stratos.autoscaler.monitor.cluster.ClusterMonitor.java
private static void createClusterInstance(String serviceType, String clusterId, String alias, String instanceId, String partitionId, String networkPartitionId) { try {/*ww w .j a va2 s . c o m*/ CloudControllerServiceClient.getInstance().createClusterInstance(serviceType, clusterId, alias, instanceId, partitionId, networkPartitionId); } catch (RemoteException e) { String msg = " Exception occurred in creating cluster instance with cluster-id [" + clusterId + "] instance-id [" + instanceId + "] service-type [" + serviceType + "]" + "] alias [" + alias + "] partition-id [" + partitionId + "]" + "] network-parition-id [" + networkPartitionId + "]" + " .Reason [" + e.getMessage() + "]"; log.error(msg); throw new RuntimeException(msg, e); } }
From source file:org.apache.stratos.cloud.controller.hive.HiveQueryExecutor.java
public QueryResult[] execute(String query) { try {/*from w ww . ja v a2 s.c om*/ return hiveService.executeHiveScript(query); } catch (RemoteException e) { handleException("Query : '" + query + "' - " + e.getMessage(), e); } catch (HiveExecutionServiceHiveExecutionException e) { handleException("Query : '" + query + "' - " + e.getMessage(), e); } return new QueryResult[0]; }
From source file:org.apache.stratos.rest.endpoint.api.StratosApiV40Utils.java
static ResponseMessageBean deployCartridge(CartridgeBean cartridgeDefinitionBean, ConfigurationContext ctxt, String userName, String tenantDomain) throws RestAPIException { log.info("Starting to deploy a Cartridge [type] " + cartridgeDefinitionBean.getType()); CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient(); if (cloudControllerServiceClient != null) { Cartridge cartridgeConfig = ObjectConverter .convertCartridgeBeanToStubCartridgeConfig(cartridgeDefinitionBean); if (cartridgeConfig == null) { throw new RestAPIException( "Populated CartridgeConfig instance is null, cartridge deployment aborted"); }/*from w w w. ja v a 2 s . c o m*/ // call CC try { cloudControllerServiceClient.addCartridge(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 (CloudControllerServiceCartridgeAlreadyExistsExceptionException e) { String message = e.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); } } ResponseMessageBean stratosApiResponse = new ResponseMessageBean(); String message = "Successfully added cartridge definition: [cartridge-type] " + cartridgeDefinitionBean.getType(); stratosApiResponse.setMessage(message); if (log.isInfoEnabled()) { log.info(message); } return stratosApiResponse; }
From source file:org.apache.stratos.rest.endpoint.api.StratosApiV40Utils.java
static ResponseMessageBean undeployCartridge(String cartridgeType) throws RestAPIException { CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient(); if (cloudControllerServiceClient != null) { try {/*w w w.jav a 2 s. c om*/ cloudControllerServiceClient.removeCartridge(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); } } ResponseMessageBean stratosApiResponse = new ResponseMessageBean(); stratosApiResponse.setMessage("Successfully undeployed cartridge definition with type " + cartridgeType); return stratosApiResponse; }
From source file:org.apache.stratos.rest.endpoint.api.StratosApiV40Utils.java
public static ResponseMessageBean deployAutoscalingPolicy(AutoscalePolicyBean autoscalePolicyBean) throws RestAPIException { //log.info("***** " + cartridgeDefinitionBean.toString() + " *****"); AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient(); if (autoscalerServiceClient != null) { org.apache.stratos.autoscaler.stub.autoscale.policy.AutoscalePolicy autoscalePolicy = ObjectConverter .convertToCCAutoscalerPojo(autoscalePolicyBean); try {//from ww w .j av a 2 s . c o m autoscalerServiceClient.addAutoscalingPolicy(autoscalePolicy); } catch (RemoteException e) { log.error(e.getMessage(), e); throw new RestAPIException(e.getMessage(), e); } catch (AutoscalerServiceAutoScalingPolicyAlreadyExistExceptionException e) { log.error(e.getMessage(), e); throw new RestAPIException(e.getMessage(), e); } } ResponseMessageBean stratosApiResponse = new ResponseMessageBean(); stratosApiResponse.setMessage( "Successfully deployed autoscaling policy definition with id " + autoscalePolicyBean.getId()); return stratosApiResponse; }