Update the method comment
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/e5d003d5 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/e5d003d5 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/e5d003d5 Branch: refs/heads/tenant-isolation Commit: e5d003d55e502dfec6bd44749415c790f311890e Parents: a82310c Author: Gayan Gunarathne <[email protected]> Authored: Mon Jul 6 13:35:11 2015 +0530 Committer: Gayan Gunarathne <[email protected]> Committed: Mon Jul 6 13:35:11 2015 +0530 ---------------------------------------------------------------------- .../rest/endpoint/api/StratosApiV41Utils.java | 114 +++++++++---------- 1 file changed, 57 insertions(+), 57 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/e5d003d5/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java index 6aae2fe..16f70cd 100644 --- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java +++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java @@ -107,63 +107,63 @@ public class StratosApiV41Utils { private static final Log log = LogFactory.getLog(StratosApiV41Utils.class); - /** - * Add new cartridge util method - * - * @param cartridgeBean Cartridge definition - * @throws RestAPIException - */ - public static void addCartridge(CartridgeBean cartridgeBean) throws RestAPIException { - - try { - if (log.isDebugEnabled()) { - log.debug(String.format("Adding cartridge: [cartridge-type] %s ", cartridgeBean.getType())); - } - - List<IaasProviderBean> iaasProviders = cartridgeBean.getIaasProvider(); - if ((iaasProviders == null) || iaasProviders.size() == 0) { - throw new RestAPIException(String.format("IaaS providers not found in cartridge: %s", - cartridgeBean.getType())); - } - - for(PortMappingBean portMapping : cartridgeBean.getPortMapping()) { - if(StringUtils.isBlank(portMapping.getName())) { - portMapping.setName(portMapping.getProtocol() + "-" + portMapping.getPort()); - if(log.isInfoEnabled()) { - log.info(String.format("Port mapping name not found, default value generated: " + - "[cartridge-type] %s [port-mapping-name] %s", - cartridgeBean.getType(), portMapping.getName())); - } - } - } - - Cartridge cartridgeConfig = createCartridgeConfig(cartridgeBean); - CloudControllerServiceClient cloudControllerServiceClient = CloudControllerServiceClient.getInstance(); - cloudControllerServiceClient.addCartridge(cartridgeConfig); - - if (log.isDebugEnabled()) { - log.debug(String.format( - "Successfully added cartridge: [cartridge-type] %s ", - cartridgeBean.getType())); - } - } catch (CloudControllerServiceCartridgeAlreadyExistsExceptionException e) { - String msg = "Could not add cartridge"; - log.error(msg, e); - throw new RestAPIException(msg); - } catch (CloudControllerServiceInvalidCartridgeDefinitionExceptionException e) { - String msg = "Could not add cartridge"; - log.error(msg, e); - throw new RestAPIException(msg); - } catch (RemoteException e) { - String msg = "Could not add cartridge"; - log.error(msg, e); - throw new RestAPIException(msg); - } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) { - String msg = "Could not add cartridge"; - log.error(msg, e); - throw new RestAPIException(msg); - } - } + /** + * Add new cartridge util method + * + * @param cartridgeBean Cartridge definition + * @throws RestAPIException + */ + public static void addCartridge(CartridgeBean cartridgeBean) throws RestAPIException { + + try { + if (log.isDebugEnabled()) { + log.debug(String.format("Adding cartridge: [cartridge-type] %s ", cartridgeBean.getType())); + } + + List<IaasProviderBean> iaasProviders = cartridgeBean.getIaasProvider(); + if ((iaasProviders == null) || iaasProviders.size() == 0) { + throw new RestAPIException(String.format("IaaS providers not found in cartridge: %s", + cartridgeBean.getType())); + } + + for (PortMappingBean portMapping : cartridgeBean.getPortMapping()) { + if (StringUtils.isBlank(portMapping.getName())) { + portMapping.setName(portMapping.getProtocol() + "-" + portMapping.getPort()); + if (log.isInfoEnabled()) { + log.info(String.format("Port mapping name not found, default value generated: " + + "[cartridge-type] %s [port-mapping-name] %s", + cartridgeBean.getType(), portMapping.getName())); + } + } + } + + Cartridge cartridgeConfig = createCartridgeConfig(cartridgeBean); + CloudControllerServiceClient cloudControllerServiceClient = CloudControllerServiceClient.getInstance(); + cloudControllerServiceClient.addCartridge(cartridgeConfig); + + if (log.isDebugEnabled()) { + log.debug(String.format( + "Successfully added cartridge: [cartridge-type] %s ", + cartridgeBean.getType())); + } + } catch (CloudControllerServiceCartridgeAlreadyExistsExceptionException e) { + String msg = "Could not add cartridge"; + log.error(msg, e); + throw new RestAPIException(msg); + } catch (CloudControllerServiceInvalidCartridgeDefinitionExceptionException e) { + String msg = "Could not add cartridge"; + log.error(msg, e); + throw new RestAPIException(msg); + } catch (RemoteException e) { + String msg = "Could not add cartridge"; + log.error(msg, e); + throw new RestAPIException(msg); + } catch (CloudControllerServiceInvalidIaasProviderExceptionException e) { + String msg = "Could not add cartridge"; + log.error(msg, e); + throw new RestAPIException(msg); + } + } /** * Update Cartridge
