Change all methods which has void return type to boolean return type in CC service
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ed558da4 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ed558da4 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ed558da4 Branch: refs/heads/master Commit: ed558da45d0ebf8cc07804fdc13f23ed64f23603 Parents: 8e5397e Author: Lahiru Sandaruwan <[email protected]> Authored: Mon May 11 15:07:55 2015 +0530 Committer: Lahiru Sandaruwan <[email protected]> Committed: Mon May 11 15:07:55 2015 +0530 ---------------------------------------------------------------------- .../services/CloudControllerService.java | 35 +- .../impl/CloudControllerServiceImpl.java | 54 +- .../main/resources/CloudControllerService.wsdl | 1366 +++++++++++------- 3 files changed, 895 insertions(+), 560 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/ed558da4/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java index b38fdb7..b8f166f 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/CloudControllerService.java @@ -39,7 +39,7 @@ public interface CloudControllerService { * @throws InvalidIaasProviderException if the iaas providers configured are not valid. * @throws IllegalArgumentException if the provided argument is not valid. */ - void addCartridge(Cartridge cartridgeConfig) + public boolean addCartridge(Cartridge cartridgeConfig) throws InvalidCartridgeDefinitionException, InvalidIaasProviderException, CartridgeAlreadyExistsException; /** @@ -50,7 +50,7 @@ public interface CloudControllerService { * @throws InvalidIaasProviderException * @throws org.apache.stratos.cloud.controller.exception.CartridgeDefinitionNotExistsException */ - public void updateCartridge(Cartridge cartridgeConfig) throws InvalidCartridgeDefinitionException, + public boolean updateCartridge(Cartridge cartridgeConfig) throws InvalidCartridgeDefinitionException, InvalidIaasProviderException, CartridgeDefinitionNotExistsException; @@ -60,7 +60,7 @@ public interface CloudControllerService { * @param cartridgeType type of the cartridge to be undeployed. * @throws InvalidCartridgeTypeException if the cartridge type specified is not a deployed cartridge. */ - public void removeCartridge(String cartridgeType) throws InvalidCartridgeTypeException; + public boolean removeCartridge(String cartridgeType) throws InvalidCartridgeTypeException; /** * Add a cartridge group @@ -68,7 +68,7 @@ public interface CloudControllerService { * @param servicegroup * @throws InvalidServiceGroupException */ - public void addServiceGroup(ServiceGroup servicegroup) throws InvalidServiceGroupException; + public boolean addServiceGroup(ServiceGroup servicegroup) throws InvalidServiceGroupException; /** * Remove a cartridge group @@ -76,7 +76,7 @@ public interface CloudControllerService { * @param name * @throws InvalidServiceGroupException */ - public void removeServiceGroup(String name) throws InvalidServiceGroupException; + public boolean removeServiceGroup(String name) throws InvalidServiceGroupException; /** * Get cartridge group @@ -171,10 +171,10 @@ public interface CloudControllerService { * @param memberId member ID of the instance to be terminated. * @return whether an instance terminated successfully or not. */ - void terminateInstance(String memberId) throws InvalidMemberException, InvalidCartridgeTypeException, + public boolean terminateInstance(String memberId) throws InvalidMemberException, InvalidCartridgeTypeException, CloudControllerException; - void terminateInstanceForcefully(String memberId) throws InvalidCartridgeTypeException; + public boolean terminateInstanceForcefully(String memberId) throws InvalidCartridgeTypeException; /** * Calling this method will result in termination of all instances belong @@ -183,7 +183,7 @@ public interface CloudControllerService { * @param clusterId cluster ID of the instance to be terminated. * @return whether an instance terminated successfully or not. */ - void terminateInstances(String clusterId) throws InvalidClusterException; + public boolean terminateInstances(String clusterId) throws InvalidClusterException; /** * Update the topology with current cluster status. @@ -193,7 +193,7 @@ public interface CloudControllerService { * @param instanceId id of the cluster instance. * @param status total number of replicas to be set to the controller. */ - void updateClusterStatus(String serviceName, String clusterId, String instanceId, ClusterStatus status); + public boolean updateClusterStatus(String serviceName, String clusterId, String instanceId, ClusterStatus status); /** * Unregister the service cluster identified by the given cluster id. @@ -201,7 +201,7 @@ public interface CloudControllerService { * @param clusterId service cluster id. * @throws UnregisteredClusterException if the service cluster requested is not a registered one. */ - void unregisterService(String clusterId) throws UnregisteredClusterException; + public boolean unregisterService(String clusterId) throws UnregisteredClusterException; /** * This method will return the information regarding the given cartridge, if present. @@ -239,7 +239,7 @@ public interface CloudControllerService { * @param appClustersContexts cluster information holder object * @throws ApplicationClusterRegistrationException if the cluster information are null/empty */ - public void createApplicationClusters(String appId, ApplicationClusterContext[] appClustersContexts) throws + public boolean createApplicationClusters(String appId, ApplicationClusterContext[] appClustersContexts) throws ApplicationClusterRegistrationException; /** @@ -251,7 +251,7 @@ public interface CloudControllerService { * @param instanceId instance id * @throws ClusterInstanceCreationException if an y error occurs in cluster instance creation */ - public void createClusterInstance(String serviceType, String clusterId, String alias, + public boolean createClusterInstance(String serviceType, String clusterId, String alias, String instanceId, String partitionId, String networkPartitionId) throws ClusterInstanceCreationException; @@ -291,7 +291,8 @@ public interface CloudControllerService { * @param kubernetesCluster * @throws org.apache.stratos.cloud.controller.exception.InvalidKubernetesClusterException */ - public boolean addKubernetesCluster(KubernetesCluster kubernetesCluster) throws InvalidKubernetesClusterException, KubernetesClusterAlreadyExistsException; + public boolean addKubernetesCluster(KubernetesCluster kubernetesCluster) throws InvalidKubernetesClusterException, + KubernetesClusterAlreadyExistsException; /** * Add a Kubernetes host to a Kubernetes cluster. @@ -320,7 +321,7 @@ public interface CloudControllerService { * @param groupId * @throws NonExistingKubernetesClusterException */ - public void removeKubernetesCluster(String groupId) throws NonExistingKubernetesClusterException; + public boolean removeKubernetesCluster(String groupId) throws NonExistingKubernetesClusterException; /** * Update a Kubernetes host. @@ -345,7 +346,7 @@ public interface CloudControllerService { * @param networkPartition * @throws NetworkPartitionAlreadyExistsException */ - public void addNetworkPartition(NetworkPartition networkPartition) throws NetworkPartitionAlreadyExistsException; + public boolean addNetworkPartition(NetworkPartition networkPartition) throws NetworkPartitionAlreadyExistsException; /** * Remove network partition @@ -353,7 +354,7 @@ public interface CloudControllerService { * @param networkPartitionId * @throws NetworkPartitionNotExistsException */ - public void removeNetworkPartition(String networkPartitionId) throws NetworkPartitionNotExistsException; + public boolean removeNetworkPartition(String networkPartitionId) throws NetworkPartitionNotExistsException; /** * Update network partition @@ -361,7 +362,7 @@ public interface CloudControllerService { * @param networkPartition * @throws NetworkPartitionNotExistsException */ - public void updateNetworkPartition(NetworkPartition networkPartition) throws NetworkPartitionNotExistsException; + public boolean updateNetworkPartition(NetworkPartition networkPartition) throws NetworkPartitionNotExistsException; /** * Get network partitions http://git-wip-us.apache.org/repos/asf/stratos/blob/ed558da4/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java index e90bd09..a524704 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/services/impl/CloudControllerServiceImpl.java @@ -68,7 +68,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } - public void addCartridge(Cartridge cartridgeConfig) throws InvalidCartridgeDefinitionException, + public boolean addCartridge(Cartridge cartridgeConfig) throws InvalidCartridgeDefinitionException, InvalidIaasProviderException, CartridgeAlreadyExistsException { handleNullObject(cartridgeConfig, "Cartridge definition is null"); @@ -108,10 +108,11 @@ public class CloudControllerServiceImpl implements CloudControllerService { if (log.isInfoEnabled()) { log.info("Successfully added cartridge: [cartridge-type] " + cartridgeType); } + return true; } @Override - public void updateCartridge(Cartridge cartridgeConfig) throws InvalidCartridgeDefinitionException, + public boolean updateCartridge(Cartridge cartridgeConfig) throws InvalidCartridgeDefinitionException, InvalidIaasProviderException, CartridgeDefinitionNotExistsException { @@ -153,6 +154,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { if (log.isInfoEnabled()) { log.info("Successfully updated cartridge: [cartridge-type] " + cartridgeType); } + return true; } private void copyIaasProviders(Cartridge destCartridge, @@ -182,7 +184,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } - public void removeCartridge(String cartridgeType) throws InvalidCartridgeTypeException { + public boolean removeCartridge(String cartridgeType) throws InvalidCartridgeTypeException { //Removing the cartridge from CC Cartridge cartridge = removeCartridgeFromCC(cartridgeType); //removing the cartridge from Topology @@ -191,6 +193,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { if (log.isInfoEnabled()) { log.info("Successfully removed cartridge: [cartridge-type] " + cartridgeType); } + return true; } private Cartridge removeCartridgeFromCC(String cartridgeType) throws InvalidCartridgeTypeException { @@ -224,7 +227,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { TopologyBuilder.handleServiceRemoved(cartridgeList); } - public void addServiceGroup(ServiceGroup servicegroup) throws InvalidServiceGroupException { + public boolean addServiceGroup(ServiceGroup servicegroup) throws InvalidServiceGroupException { if (servicegroup == null) { String msg = "Invalid ServiceGroup Definition: Definition is null."; @@ -272,9 +275,10 @@ public class CloudControllerServiceImpl implements CloudControllerService { CloudControllerContext.getInstance().addServiceGroup(servicegroup); CloudControllerContext.getInstance().persist(); + return true; } - public void removeServiceGroup(String name) throws InvalidServiceGroupException { + public boolean removeServiceGroup(String name) throws InvalidServiceGroupException { if (log.isDebugEnabled()) { log.debug("CloudControllerServiceImpl:removeServiceGroup: " + name); } @@ -289,7 +293,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { if (log.isInfoEnabled()) { log.info("Successfully removed the cartridge group: [group-name] " + serviceGroup); } - return; + return true; } } @@ -584,7 +588,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { return clusterId + memberId.toString(); } - public void terminateInstanceForcefully(String memberId) { + public boolean terminateInstanceForcefully(String memberId) { log.info(String.format("Starting to forcefully terminate the member " + memberId)); boolean memberTerminated = true; @@ -605,10 +609,11 @@ public class CloudControllerServiceImpl implements CloudControllerService { MemberContext memberContext = CloudControllerContext.getInstance().getMemberContextOfMemberId(memberId); CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext); } + return true; } @Override - public void terminateInstance(String memberId) throws InvalidMemberException, + public boolean terminateInstance(String memberId) throws InvalidMemberException, InvalidCartridgeTypeException, CloudControllerException { try { @@ -652,7 +657,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext); - return; + return false; } } } @@ -670,6 +675,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } finally { TopologyManager.releaseWriteLock(); } + return true; } /** @@ -697,7 +703,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } @Override - public void terminateInstances(String clusterId) throws InvalidClusterException { + public boolean terminateInstances(String clusterId) throws InvalidClusterException { log.info("Starting to terminate all instances of cluster : " + clusterId); @@ -708,12 +714,13 @@ public class CloudControllerServiceImpl implements CloudControllerService { if (memberContexts == null) { String msg = "Instance termination failed. No members found for cluster id: " + clusterId; log.warn(msg); - return; + return false; } for (MemberContext memberContext : memberContexts) { executorService.execute(new InstanceTerminator(memberContext)); } + return true; } @Override @@ -789,7 +796,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } @Override - public void unregisterService(String clusterId) throws UnregisteredClusterException { + public boolean unregisterService(String clusterId) throws UnregisteredClusterException { final String clusterId_ = clusterId; ClusterContext ctxt = CloudControllerContext.getInstance().getClusterContext(clusterId_); @@ -917,7 +924,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { }; new Thread(terminateInTimeout).start(); new Thread(unregister).start(); - // } + return true; } /** @@ -1043,8 +1050,9 @@ public class CloudControllerServiceImpl implements CloudControllerService { } @Override - public void updateClusterStatus(String serviceName, String clusterId, String instanceId, ClusterStatus status) { + public boolean updateClusterStatus(String serviceName, String clusterId, String instanceId, ClusterStatus status) { //TODO + return true; } private void handleNullObject(Object obj, String errorMsg) { @@ -1055,7 +1063,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } @Override - public void createApplicationClusters(String appId, ApplicationClusterContext[] appClustersContexts) throws + public boolean createApplicationClusters(String appId, ApplicationClusterContext[] appClustersContexts) throws ApplicationClusterRegistrationException { if (appClustersContexts == null || appClustersContexts.length == 0) { String errorMsg = "No application cluster information found, unable to create clusters"; @@ -1137,9 +1145,10 @@ public class CloudControllerServiceImpl implements CloudControllerService { CloudControllerContext.getInstance().releaseWriteLock(lock); } } + return true; } - public void createClusterInstance(String serviceType, String clusterId, + public boolean createClusterInstance(String serviceType, String clusterId, String alias, String instanceId, String partitionId, String networkPartitionId) throws ClusterInstanceCreationException { Lock lock = null; @@ -1154,6 +1163,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { CloudControllerContext.getInstance().releaseWriteLock(lock); } } + return true; } @Override @@ -1276,7 +1286,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } @Override - public void removeKubernetesCluster(String kubernetesClusterId) throws NonExistingKubernetesClusterException { + public boolean removeKubernetesCluster(String kubernetesClusterId) throws NonExistingKubernetesClusterException { if (StringUtils.isEmpty(kubernetesClusterId)) { throw new NonExistingKubernetesClusterException("Kubernetes cluster id can not be empty"); } @@ -1302,6 +1312,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { CloudControllerContext.getInstance().releaseWriteLock(lock); } } + return true; } @Override @@ -1432,7 +1443,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { } @Override - public void addNetworkPartition(NetworkPartition networkPartition) throws NetworkPartitionAlreadyExistsException { + public boolean addNetworkPartition(NetworkPartition networkPartition) throws NetworkPartitionAlreadyExistsException { try { handleNullObject(networkPartition, "Network Partition is null"); @@ -1480,10 +1491,11 @@ public class CloudControllerServiceImpl implements CloudControllerService { log.error(message); throw new CloudControllerException(message, e); } + return true; } @Override - public void removeNetworkPartition(String networkPartitionId) throws NetworkPartitionNotExistsException { + public boolean removeNetworkPartition(String networkPartitionId) throws NetworkPartitionNotExistsException { try { if (log.isInfoEnabled()) { @@ -1509,10 +1521,11 @@ public class CloudControllerServiceImpl implements CloudControllerService { log.error(message); throw new CloudControllerException(message, e); } + return true; } @Override - public void updateNetworkPartition(NetworkPartition networkPartition) throws NetworkPartitionNotExistsException { + public boolean updateNetworkPartition(NetworkPartition networkPartition) throws NetworkPartitionNotExistsException { try { handleNullObject(networkPartition, "Network Partition is null"); handleNullObject(networkPartition.getId(), "Network Partition ID is null"); @@ -1560,6 +1573,7 @@ public class CloudControllerServiceImpl implements CloudControllerService { log.error(message); throw new CloudControllerException(message, e); } + return true; } @Override
