You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2014/12/19 13:42:04 UTC
[1/8] stratos git commit: Update error handling in rest API and meta
data service
Repository: stratos
Updated Branches:
refs/heads/master 144776694 -> bb3a32fbd
Update error handling in rest API and meta data service
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/16e505c9
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/16e505c9
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/16e505c9
Branch: refs/heads/master
Commit: 16e505c9ccfb5dc656088287222ca70971150f2a
Parents: 8e2b743
Author: gayan <ga...@puppet.gayan.org>
Authored: Fri Dec 19 15:43:04 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 19 18:11:48 2014 +0530
----------------------------------------------------------------------
.../registry/CarbonRegistry.java | 2 +-
.../metadataservice/services/MetaDataAdmin.java | 29 ++++++++++++--------
.../rest/endpoint/api/StratosApiV41Utils.java | 20 +++++++++-----
3 files changed, 32 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/16e505c9/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java
index 5c3495d..bab037b 100644
--- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java
+++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/registry/CarbonRegistry.java
@@ -113,7 +113,7 @@ public class CarbonRegistry implements DataStore {
* @throws RegistryException
*/
public boolean deleteApplication(String applicationId) throws RegistryException {
- if(StringUtils.isEmpty(applicationId)){
+ if(StringUtils.isBlank(applicationId)){
throw new IllegalArgumentException("Application ID can not be null");
}
Registry tempRegistry = DataHolder.getRegistryService().getRegistry();
http://git-wip-us.apache.org/repos/asf/stratos/blob/16e505c9/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
index fc688f9..6f527e5 100644
--- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
+++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
@@ -63,7 +63,7 @@ public class MetaDataAdmin {
@Produces("application/json")
@Consumes("application/json")
@AuthorizationAction("/permission/protected/manage/monitor/tenants")
- public Response getClusterProperties(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId){
+ public Response getClusterProperties(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId) throws RestAPIException{
List<NewProperty> properties;
NewProperty[] propertiesArr = null;
@@ -74,8 +74,10 @@ public class MetaDataAdmin {
propertiesArr = new NewProperty[properties.size()];
propertiesArr = properties.toArray(propertiesArr);
}
- } catch (Exception e) {
- log.error("Error occurred while getting properties ", e);
+ } catch (RegistryException e) {
+ String msg = "Error occurred while getting properties ";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
}
Response.ResponseBuilder rb;
@@ -92,8 +94,7 @@ public class MetaDataAdmin {
@Produces("application/json")
@Consumes("application/json")
@AuthorizationAction("/permission/protected/manage/monitor/tenants")
-
- public Response getClusterProperty(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId, @PathParam("property_name") String propertyName){
+ public Response getClusterProperty(@PathParam("application_id") String applicationId, @PathParam("cluster_id") String clusterId, @PathParam("property_name") String propertyName) throws RestAPIException{
List<NewProperty> properties;
@@ -111,8 +112,10 @@ public class MetaDataAdmin {
break;
}
}
- } catch (Exception e) {
- log.error("Error occurred while getting property ", e);
+ } catch (RegistryException e) {
+ String msg = "Error occurred while adding property";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
}
Response.ResponseBuilder rb;
@@ -137,7 +140,9 @@ public class MetaDataAdmin {
try {
registry.addPropertyToCluster(applicationId, clusterId, property);
} catch (RegistryException e) {
- log.error("Error occurred while adding property", e);
+ String msg = "Error occurred while adding property";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
}
return Response.created(url).build();
@@ -154,8 +159,10 @@ public class MetaDataAdmin {
try {
registry.addPropertiesToCluster(applicationId, clusterId, properties);
- } catch (Exception e) {
- log.error("Error occurred while adding properties ", e);
+ } catch (RegistryException e) {
+ String msg = "Error occurred while adding properties ";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
}
return Response.created(url).build();
@@ -177,7 +184,7 @@ public class MetaDataAdmin {
} catch (RegistryException e) {
String msg= "Resource attached with appId could not be deleted";
log.error(msg, e);
- throw new RestAPIException(" ", e);
+ throw new RestAPIException(msg, e);
}
return Response.ok().build();
http://git-wip-us.apache.org/repos/asf/stratos/blob/16e505c9/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 5820cb3..3dacdac 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
@@ -144,7 +144,7 @@ public class StratosApiV41Utils {
try {
Service service = serviceDeploymentManager.getService(cartridgeType);
if (service != null) {
- // not allowed to undeploy!
+ // not allowed to undeploy!
String errorMsg =
String.format("Multi tenant Service already exists for %s ,hence cannot undeploy",
cartridgeType);
@@ -287,14 +287,20 @@ public class StratosApiV41Utils {
log.debug("There are no available cartridges");
}
}
- } catch (Exception e) {
- String msg = "Error while getting available cartridges. Cause: " + e.getMessage();
- log.error(msg, e);
- throw new RestAPIException(msg, e);
+ } catch (AxisFault axisFault) {
+ String errorMsg = String.format(
+ "Error while getting CloudControllerServiceClient instance to connect to the Cloud Controller. " +
+ "Cause: %s ", axisFault.getMessage());
+ log.error(errorMsg, axisFault);
+ throw new RestAPIException(errorMsg, axisFault);
+ } catch (RemoteException e) {
+ String errorMsg =
+ String.format("Error while getting cartridge information for provider %s Cause: %s ", provider,
+ e.getMessage());
+ log.error(errorMsg, e);
+ throw new RestAPIException(errorMsg, e);
}
- //Collections.sort(cartridges);
-
if (log.isDebugEnabled()) {
log.debug("Returning available cartridges " + cartridges.size());
}
[7/8] stratos git commit: Update the messaging model util with apache
commons isNumber util method
Posted by im...@apache.org.
Update the messaging model util with apache commons isNumber util method
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/9ddd01cc
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/9ddd01cc
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/9ddd01cc
Branch: refs/heads/master
Commit: 9ddd01ccdeaeb2bf76dc81b2331a5591d561f70f
Parents: 16e505c
Author: gayan <ga...@puppet.gayan.org>
Authored: Fri Dec 19 15:54:58 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 19 18:11:49 2014 +0530
----------------------------------------------------------------------
.../org/apache/stratos/messaging/util/Util.java | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/9ddd01cc/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
index d5df69d..bae0a35 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
@@ -23,6 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.messaging.event.Event;
import org.apache.stratos.messaging.message.JsonMessage;
+import org.apache.commons.lang3.math.NumberUtils;
import java.io.File;
import java.io.FileInputStream;
@@ -122,11 +123,11 @@ public class Util {
String[] array = tenantRange.split(TENANT_RANGE_DELIMITER);
if (array.length == 2) {
// Integer-Integer
- if (isNumber(array[0]) && (isNumber(array[1]))) {
+ if (NumberUtils.isNumber(array[0]) && (NumberUtils.isNumber(array[1]))) {
valid = true;
}
// Integer-*
- else if (isNumber(array[0]) && "*".equals(array[1])) {
+ else if (NumberUtils.isNumber(array[0]) && "*".equals(array[1])) {
valid = true;
}
}
@@ -137,21 +138,6 @@ public class Util {
throw new RuntimeException(String.format("Tenant range %s is not valid", tenantRange));
}
- /**
- * Check given string is a number
- *
- * @param inputStr String to be checked
- * @return Boolean of given string is a number
- */
- public static boolean isNumber(String inputStr) {
- try {
- Integer.parseInt(inputStr);
- return true;
- } catch (NumberFormatException ignore) {
- // Not a valid number
- }
- return false;
- }
/**
* Transform json into an object of given type.
[3/8] stratos git commit: Update the class with String format for
string generation and method doc comments
Posted by im...@apache.org.
Update the class with String format for string generation and method doc comments
Conflicts:
components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/030dd5ac
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/030dd5ac
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/030dd5ac
Branch: refs/heads/master
Commit: 030dd5ac3f2b82599e7fc49c2ad907ffae7aed0b
Parents: 1447766
Author: gayan <ga...@puppet.gayan.org>
Authored: Fri Dec 19 13:51:29 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 19 18:11:48 2014 +0530
----------------------------------------------------------------------
.../rest/endpoint/api/StratosApiV41Utils.java | 55 ++++++++++++--------
1 file changed, 32 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/030dd5ac/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 2f21d0f..6030b4f 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
@@ -95,27 +95,27 @@ public class StratosApiV41Utils {
private static ServiceDeploymentManager serviceDeploymentManager = new ServiceDeploymentManager();
// Util methods for cartridges
- public static void addCartridge(CartridgeDefinitionBean cartridgeDefinitionBean, ConfigurationContext ctxt,
- String userName, String tenantDomain) throws RestAPIException {
+ public static void createCartridgeDefinition(CartridgeDefinitionBean cartridgeDefinitionBean, ConfigurationContext ctxt,
+ String userName, String tenantDomain) throws RestAPIException {
- log.info("Starting to add cartridge: [cartridge-type] " + cartridgeDefinitionBean.getType());
+ log.info(String.format("Starting to deploy a cartridge: [type] %s " , cartridgeDefinitionBean.getType()));
CartridgeConfig cartridgeConfig = ObjectConverter.convertCartridgeDefinitionBeanToStubCartridgeConfig(cartridgeDefinitionBean);
if (cartridgeConfig == null) {
throw new RestAPIException("Could not read cartridge definition, cartridge deployment failed");
}
if (StringUtils.isEmpty(cartridgeConfig.getCategory())) {
- throw new RestAPIException("Category is not specified, cartridge deployment failed");
+ throw new RestAPIException(String.format("Category is not specified %s , hence cartridge deployment failed",cartridgeConfig.getDisplayName()));
}
try {
CartridgeDeploymentManager.getDeploymentManager(cartridgeDefinitionBean.getDeployerType()).deploy(cartridgeConfig);
} catch (ADCException e) {
throw new RestAPIException(e);
}
- log.info("Successfully added cartridge: [cartridge-type] " + cartridgeDefinitionBean.getType());
+ log.info(String.format("Successfully deployed cartridge: [type] %s " , cartridgeDefinitionBean.getType()));
}
- public static void removeCartridge(String cartridgeType) throws RestAPIException {
+ public static void deleteCartridgeDefinition(String cartridgeType) throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
@@ -124,16 +124,16 @@ public class StratosApiV41Utils {
try {
cartridgeInfo = cloudControllerServiceClient.getCartridgeInfo(cartridgeType);
} catch (RemoteException e) {
- log.error("Could not find cartridge: [type] " + cartridgeType);
+ log.error(String.format("Could not find cartridge: [type] %s ", cartridgeType));
throw new RestAPIException(e);
} catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
- log.error("Could not find cartridge: [type] " + cartridgeType);
+ log.error(String.format("Could not find cartridge: [type] %s " , cartridgeType));
throw new RestAPIException(e);
}
if (cartridgeInfo == null) {
- String errorMsg = "Could not find cartridge: [type] " + cartridgeType;
+ String errorMsg = String.format("Could not find cartridge: [type] %s ", cartridgeType);
log.error(errorMsg);
throw new RestAPIException(errorMsg);
}
@@ -145,16 +145,18 @@ public class StratosApiV41Utils {
Service service = serviceDeploymentManager.getService(cartridgeType);
if (service != null) {
// not allowed to undeploy!
- String errorMsg = "Multi tenant Service already exists for " + cartridgeType + ", cannot undeploy";
- log.error(errorMsg);
- throw new RestAPIException(errorMsg);
+ String errorMsg =
+ String.format("Multi tenant Service already exists for %s ,hence cannot undeploy",
+ cartridgeType);
+ log.error(errorMsg);
+ throw new RestAPIException(errorMsg);
} else {
// can undeploy
undeployCartridgeDefinition(cloudControllerServiceClient, cartridgeType);
}
} catch (ADCException e) {
- log.error("Error in getting MT Service details for type " + cartridgeType);
+ log.error(String.format("Error in getting MT Service details for type %S " , cartridgeType));
throw new RestAPIException(e);
}
@@ -164,7 +166,7 @@ public class StratosApiV41Utils {
cartridgeSubsciptionManager.getCartridgeSubscriptionsForType(cartridgeType);
if (cartridgeSubscriptions != null && !cartridgeSubscriptions.isEmpty()) {
// not allowed to undeploy!
- String errorMsg = "Subscription exists for " + cartridgeType + ", cannot undeploy";
+ String errorMsg =String.format("Subscription exists for %s, cannot undeploy",cartridgeType);
log.error(errorMsg);
throw new RestAPIException(errorMsg);
} else {
@@ -179,7 +181,7 @@ public class StratosApiV41Utils {
String cartridgeType) throws RestAPIException {
try {
- cloudControllerServiceClient.removeCartridge(cartridgeType);
+ cloudControllerServiceClient.unDeployCartridgeDefinition(cartridgeType);
} catch (RemoteException e) {
log.error(e.getMessage(), e);
@@ -236,6 +238,13 @@ public class StratosApiV41Utils {
return lbCartridges;
}
+ /**
+ * Get the available cartridges by provider
+ * @param provider provide name
+ * @param configurationContext configuration context
+ * @return List of the cartridge definitions
+ * @throws RestAPIException
+ */
private static List<CartridgeDefinitionBean> getAvailableCartridgesByProvider(String provider, ConfigurationContext configurationContext) throws RestAPIException {
List<CartridgeDefinitionBean> cartridges = new ArrayList<CartridgeDefinitionBean>();
@@ -526,7 +535,7 @@ public class StratosApiV41Utils {
// Util methods for Autoscaling policies
- public static void addAutoscalingPolicy(AutoscalePolicy autoscalePolicyBean) throws RestAPIException {
+ public static void createAutoscalingPolicy(AutoscalePolicy autoscalePolicyBean) throws RestAPIException {
log.info(String.format("Deploying autoscaling policy: [id] %s", autoscalePolicyBean.getId()));
@@ -854,7 +863,7 @@ public class StratosApiV41Utils {
// Util methods for service groups
- public static void addServiceGroup(ServiceGroupDefinition serviceGroupDefinition) throws RestAPIException {
+ public static void createServiceGroupDefinition(ServiceGroupDefinition serviceGroupDefinition) throws RestAPIException {
try {
serviceGropingManager.deployServiceGroupDefinition(serviceGroupDefinition);
@@ -894,7 +903,7 @@ public class StratosApiV41Utils {
}
}
- public static void removeServiceGroup(String serviceGroupDefinitionName) throws RestAPIException {
+ public static void deleteServiceGroupDefinition(String serviceGroupDefinitionName) throws RestAPIException {
try {
serviceGropingManager.undeployServiceGroupDefinition(serviceGroupDefinitionName);
@@ -1024,7 +1033,7 @@ public class StratosApiV41Utils {
}
}
- public static void removeApplication(String applicationId) throws RestAPIException {
+ public static void deleteApplication(String applicationId) throws RestAPIException {
try {
AutoscalerServiceClient.getServiceClient().deleteApplication(applicationId);
@@ -1244,7 +1253,7 @@ public class StratosApiV41Utils {
// Util methods for Kubernetes clusters
- public static boolean addKubernetesGroup(KubernetesGroup kubernetesGroupBean) throws RestAPIException {
+ public static boolean deployKubernetesGroup(KubernetesGroup kubernetesGroupBean) throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
@@ -1265,7 +1274,7 @@ public class StratosApiV41Utils {
return false;
}
- public static boolean addKubernetesHost(String kubernetesGroupId, KubernetesHost kubernetesHostBean)
+ public static boolean deployKubernetesHost(String kubernetesGroupId, KubernetesHost kubernetesHostBean)
throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
@@ -1354,7 +1363,7 @@ public class StratosApiV41Utils {
return null;
}
- public static boolean removeKubernetesGroup(String kubernetesGroupId) throws RestAPIException {
+ public static boolean undeployKubernetesGroup(String kubernetesGroupId) throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
@@ -1373,7 +1382,7 @@ public class StratosApiV41Utils {
return false;
}
- public static boolean removeKubernetesHost(String kubernetesHostId) throws RestAPIException {
+ public static boolean undeployKubernetesHost(String kubernetesHostId) throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
[2/8] stratos git commit: Update the class with String format for
string generation and method doc comments
Posted by im...@apache.org.
Update the class with String format for string generation and method doc comments
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/8e2b7438
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/8e2b7438
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/8e2b7438
Branch: refs/heads/master
Commit: 8e2b743841be7da33f9f50f85e84c3b7d681e6c3
Parents: 030dd5a
Author: gayan <ga...@puppet.gayan.org>
Authored: Fri Dec 19 13:56:04 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 19 18:11:48 2014 +0530
----------------------------------------------------------------------
.../org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/8e2b7438/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 6030b4f..5820cb3 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
@@ -156,7 +156,7 @@ public class StratosApiV41Utils {
}
} catch (ADCException e) {
- log.error(String.format("Error in getting MT Service details for type %S " , cartridgeType));
+ log.error(String.format("Error in getting MT Service details for type %s " , cartridgeType));
throw new RestAPIException(e);
}
[4/8] stratos git commit: Merge the changes
Posted by im...@apache.org.
Merge the changes
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/bb3a32fb
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/bb3a32fb
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/bb3a32fb
Branch: refs/heads/master
Commit: bb3a32fbd8eb334a9f9deaecc791e145258391e3
Parents: fbce8c7
Author: gayan <ga...@puppet.gayan.org>
Authored: Fri Dec 19 18:07:14 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 19 18:11:49 2014 +0530
----------------------------------------------------------------------
.../rest/endpoint/api/StratosApiV41Utils.java | 24 ++++++++++----------
1 file changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/bb3a32fb/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 3dacdac..e0e9a60 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
@@ -95,7 +95,7 @@ public class StratosApiV41Utils {
private static ServiceDeploymentManager serviceDeploymentManager = new ServiceDeploymentManager();
// Util methods for cartridges
- public static void createCartridgeDefinition(CartridgeDefinitionBean cartridgeDefinitionBean, ConfigurationContext ctxt,
+ public static void addCartridge(CartridgeDefinitionBean cartridgeDefinitionBean, ConfigurationContext ctxt,
String userName, String tenantDomain) throws RestAPIException {
log.info(String.format("Starting to deploy a cartridge: [type] %s " , cartridgeDefinitionBean.getType()));
@@ -112,10 +112,10 @@ public class StratosApiV41Utils {
} catch (ADCException e) {
throw new RestAPIException(e);
}
- log.info(String.format("Successfully deployed cartridge: [type] %s " , cartridgeDefinitionBean.getType()));
+ log.info(String.format("Successfully deployed cartridge: [cartridge-type] %s " , cartridgeDefinitionBean.getType()));
}
- public static void deleteCartridgeDefinition(String cartridgeType) throws RestAPIException {
+ public static void removeCartridge(String cartridgeType) throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
@@ -181,7 +181,7 @@ public class StratosApiV41Utils {
String cartridgeType) throws RestAPIException {
try {
- cloudControllerServiceClient.unDeployCartridgeDefinition(cartridgeType);
+ cloudControllerServiceClient.removeCartridge(cartridgeType);
} catch (RemoteException e) {
log.error(e.getMessage(), e);
@@ -541,7 +541,7 @@ public class StratosApiV41Utils {
// Util methods for Autoscaling policies
- public static void createAutoscalingPolicy(AutoscalePolicy autoscalePolicyBean) throws RestAPIException {
+ public static void addAutoscalingPolicy(AutoscalePolicy autoscalePolicyBean) throws RestAPIException {
log.info(String.format("Deploying autoscaling policy: [id] %s", autoscalePolicyBean.getId()));
@@ -869,7 +869,7 @@ public class StratosApiV41Utils {
// Util methods for service groups
- public static void createServiceGroupDefinition(ServiceGroupDefinition serviceGroupDefinition) throws RestAPIException {
+ public static void addServiceGroup(ServiceGroupDefinition serviceGroupDefinition) throws RestAPIException {
try {
serviceGropingManager.deployServiceGroupDefinition(serviceGroupDefinition);
@@ -909,7 +909,7 @@ public class StratosApiV41Utils {
}
}
- public static void deleteServiceGroupDefinition(String serviceGroupDefinitionName) throws RestAPIException {
+ public static void removeServiceGroup(String serviceGroupDefinitionName) throws RestAPIException {
try {
serviceGropingManager.undeployServiceGroupDefinition(serviceGroupDefinitionName);
@@ -1039,7 +1039,7 @@ public class StratosApiV41Utils {
}
}
- public static void deleteApplication(String applicationId) throws RestAPIException {
+ public static void removeApplication(String applicationId) throws RestAPIException {
try {
AutoscalerServiceClient.getServiceClient().deleteApplication(applicationId);
@@ -1259,7 +1259,7 @@ public class StratosApiV41Utils {
// Util methods for Kubernetes clusters
- public static boolean deployKubernetesGroup(KubernetesGroup kubernetesGroupBean) throws RestAPIException {
+ public static boolean addKubernetesGroup(KubernetesGroup kubernetesGroupBean) throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
@@ -1280,7 +1280,7 @@ public class StratosApiV41Utils {
return false;
}
- public static boolean deployKubernetesHost(String kubernetesGroupId, KubernetesHost kubernetesHostBean)
+ public static boolean addKubernetesHost(String kubernetesGroupId, KubernetesHost kubernetesHostBean)
throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
@@ -1369,7 +1369,7 @@ public class StratosApiV41Utils {
return null;
}
- public static boolean undeployKubernetesGroup(String kubernetesGroupId) throws RestAPIException {
+ public static boolean removeKubernetesGroup(String kubernetesGroupId) throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
@@ -1388,7 +1388,7 @@ public class StratosApiV41Utils {
return false;
}
- public static boolean undeployKubernetesHost(String kubernetesHostId) throws RestAPIException {
+ public static boolean removeKubernetesHost(String kubernetesHostId) throws RestAPIException {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
[6/8] stratos git commit: Update the messaging model util with apache
commons isNumber util method
Posted by im...@apache.org.
Update the messaging model util with apache commons isNumber util method
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/98e5efe7
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/98e5efe7
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/98e5efe7
Branch: refs/heads/master
Commit: 98e5efe7f0a05ff71f2546fda9b5a83a702fbf9a
Parents: 9ddd01c
Author: gayan <ga...@puppet.gayan.org>
Authored: Fri Dec 19 15:56:59 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 19 18:11:49 2014 +0530
----------------------------------------------------------------------
.../src/main/java/org/apache/stratos/messaging/util/Util.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/98e5efe7/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
index bae0a35..94e8807 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
@@ -23,7 +23,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.messaging.event.Event;
import org.apache.stratos.messaging.message.JsonMessage;
-import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.commons.lang.math.NumberUtils;
import java.io.File;
import java.io.FileInputStream;
[8/8] stratos git commit: Update the messaging model util with apache
commons isNumber util method
Posted by im...@apache.org.
Update the messaging model util with apache commons isNumber util method
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/fbce8c7a
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/fbce8c7a
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/fbce8c7a
Branch: refs/heads/master
Commit: fbce8c7a410ab18f0e655ee9f68c300dcaa82653
Parents: 7d36b01
Author: gayan <ga...@puppet.gayan.org>
Authored: Fri Dec 19 16:04:47 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 19 18:11:49 2014 +0530
----------------------------------------------------------------------
.../org/apache/stratos/metadataservice/services/MetaDataAdmin.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/fbce8c7a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
index 8282516..8e0448a 100644
--- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
+++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
@@ -112,7 +112,7 @@ public class MetaDataAdmin {
}
}
} catch (RegistryException e) {
- String msg = "Error occurred while adding property";
+ String msg = "Error occurred while getting property";
log.error(msg, e);
throw new RestAPIException(msg, e);
}
[5/8] stratos git commit: Update the messaging model util with apache
commons isNumber util method
Posted by im...@apache.org.
Update the messaging model util with apache commons isNumber util method
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7d36b01a
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7d36b01a
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7d36b01a
Branch: refs/heads/master
Commit: 7d36b01ac8e48b4a84cb870bff4ef445504510a9
Parents: 98e5efe
Author: gayan <ga...@puppet.gayan.org>
Authored: Fri Dec 19 16:03:20 2014 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Fri Dec 19 18:11:49 2014 +0530
----------------------------------------------------------------------
.../metadataservice/services/MetaDataAdmin.java | 109 ++++++++++---------
1 file changed, 55 insertions(+), 54 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/7d36b01a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
index 6f527e5..8282516 100644
--- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
+++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/services/MetaDataAdmin.java
@@ -29,7 +29,6 @@ import org.apache.stratos.metadataservice.registry.DataStore;
import org.apache.stratos.metadataservice.util.ConfUtil;
import org.wso2.carbon.registry.api.RegistryException;
-import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
@@ -67,18 +66,18 @@ public class MetaDataAdmin {
List<NewProperty> properties;
NewProperty[] propertiesArr = null;
- try {
- properties = registry
- .getPropertiesOfCluster(applicationId, clusterId);
- if (properties != null) {
- propertiesArr = new NewProperty[properties.size()];
- propertiesArr = properties.toArray(propertiesArr);
- }
- } catch (RegistryException e) {
- String msg = "Error occurred while getting properties ";
- log.error(msg, e);
- throw new RestAPIException(msg, e);
- }
+ try {
+ properties = registry
+ .getPropertiesOfCluster(applicationId, clusterId);
+ if (properties != null) {
+ propertiesArr = new NewProperty[properties.size()];
+ propertiesArr = properties.toArray(propertiesArr);
+ }
+ } catch (RegistryException e) {
+ String msg = "Error occurred while getting properties ";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
Response.ResponseBuilder rb;
if (propertiesArr == null) {
@@ -100,23 +99,23 @@ public class MetaDataAdmin {
NewProperty property = null;
- try {
- properties = registry
- .getPropertiesOfCluster(applicationId, clusterId);
- if (properties == null) {
- return Response.status(Response.Status.NOT_FOUND).build();
- }
- for (NewProperty p : properties) {
- if (propertyName.equals(p.getKey())) {
- property = p;
- break;
- }
- }
- } catch (RegistryException e) {
- String msg = "Error occurred while adding property";
- log.error(msg, e);
- throw new RestAPIException(msg, e);
- }
+ try {
+ properties = registry
+ .getPropertiesOfCluster(applicationId, clusterId);
+ if (properties == null) {
+ return Response.status(Response.Status.NOT_FOUND).build();
+ }
+ for (NewProperty p : properties) {
+ if (propertyName.equals(p.getKey())) {
+ property = p;
+ break;
+ }
+ }
+ } catch (RegistryException e) {
+ String msg = "Error occurred while adding property";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
Response.ResponseBuilder rb;
if (property == null) {
@@ -137,13 +136,13 @@ public class MetaDataAdmin {
URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + clusterId + "/" + property.getKey()).build();
- try {
- registry.addPropertyToCluster(applicationId, clusterId, property);
- } catch (RegistryException e) {
- String msg = "Error occurred while adding property";
- log.error(msg, e);
- throw new RestAPIException(msg, e);
- }
+ try {
+ registry.addPropertyToCluster(applicationId, clusterId, property);
+ } catch (RegistryException e) {
+ String msg = "Error occurred while adding property";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
return Response.created(url).build();
}
@@ -157,13 +156,13 @@ public class MetaDataAdmin {
throws RestAPIException {
URI url = uriInfo.getAbsolutePathBuilder().path(applicationId + "/" + clusterId).build();
- try {
- registry.addPropertiesToCluster(applicationId, clusterId, properties);
- } catch (RegistryException e) {
- String msg = "Error occurred while adding properties ";
- log.error(msg, e);
- throw new RestAPIException(msg, e);
- }
+ try {
+ registry.addPropertiesToCluster(applicationId, clusterId, properties);
+ } catch (RegistryException e) {
+ String msg = "Error occurred while adding properties ";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
return Response.created(url).build();
}
@@ -176,16 +175,18 @@ public class MetaDataAdmin {
public Response deleteApplicationProperties(@PathParam("application_id") String applicationId)
throws RestAPIException {
- try {
- boolean deleted = registry.deleteApplication(applicationId);
- if(!deleted){
- log.warn(String.format("Either no metadata is associated with given appId %s Or resources could not be deleted", applicationId));
- }
- } catch (RegistryException e) {
- String msg= "Resource attached with appId could not be deleted";
- log.error(msg, e);
- throw new RestAPIException(msg, e);
- }
+ try {
+ boolean deleted = registry.deleteApplication(applicationId);
+ if (!deleted) {
+ log.warn(String.format(
+ "Either no metadata is associated with given appId %s Or resources could not be deleted",
+ applicationId));
+ }
+ } catch (RegistryException e) {
+ String msg = "Resource attached with appId could not be deleted";
+ log.error(msg, e);
+ throw new RestAPIException(msg, e);
+ }
return Response.ok().build();
}