You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ud...@apache.org on 2014/10/01 11:35:38 UTC
[1/4] git commit: fix for STRATOS-851
Repository: stratos
Updated Branches:
refs/heads/4.0.0-grouping 5aac10ea4 -> a0e36dbe8
fix for STRATOS-851
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c4740c06
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c4740c06
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c4740c06
Branch: refs/heads/4.0.0-grouping
Commit: c4740c0638865654fbb1e9217e3f781d69b2b897
Parents: c67af55
Author: Udara Liyanage <ud...@wso2.com>
Authored: Tue Sep 30 18:14:11 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Tue Sep 30 18:14:11 2014 +0530
----------------------------------------------------------------------
.../manager/CartridgeSubscriptionManager.java | 5 ++
.../rest/endpoint/services/ServiceUtils.java | 74 ++++++++++++++++++--
2 files changed, 72 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/c4740c06/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java
index cfc1504..0dd09a5 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/manager/CartridgeSubscriptionManager.java
@@ -870,4 +870,9 @@ public class CartridgeSubscriptionManager {
DataInsertionAndRetrievalManager dataInsertionAndRetrievalManager = new DataInsertionAndRetrievalManager();
return dataInsertionAndRetrievalManager.getCartridgeSubscriptions(tenantId, cartridgeType);
}
+
+ public Collection<CartridgeSubscription> getCartridgeSubscriptionsForType (String cartridgeType) {
+
+ return new DataInsertionAndRetrievalManager().getCartridgeSubscriptions(cartridgeType);
+ }
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/c4740c06/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
index 7ccd082..515a21a 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/services/ServiceUtils.java
@@ -345,17 +345,77 @@ public class ServiceUtils {
CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
if (cloudControllerServiceClient != null) {
+
+ CartridgeInfo cartridgeInfo = null;
try {
- cloudControllerServiceClient.unDeployCartridgeDefinition(cartridgeType);
+ cartridgeInfo = cloudControllerServiceClient.getCartridgeInfo(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);
+ log.error("Error in getting Cartridge details for type " + cartridgeType);
+ throw new RestAPIException(e);
+
+ } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
+ log.error("Error in getting Cartridge details for type " + cartridgeType);
+ throw new RestAPIException(e);
+ }
+
+ if (cartridgeInfo == null) {
+ String errorMsg = "Cartridge information not found for type " + cartridgeType;
+ log.error(errorMsg);
+ throw new RestAPIException(errorMsg);
}
+ // check if the service is multi tenant.
+ if (cartridgeInfo.getMultiTenant()) {
+ // check if there are any deployed MT services. If so, should not allow to undeploy
+ try {
+ 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);
+ } else {
+ // can undeploy
+ undeployCartridgeDefinition(cloudControllerServiceClient, cartridgeType);
+ }
+
+ } catch (ADCException e) {
+ log.error("Error in getting MT Service details for type " + cartridgeType);
+ throw new RestAPIException(e);
+ }
+
+ } else {
+ // if not multi tenant, check if there are any existing Subscriptions
+ Collection<CartridgeSubscription> cartridgeSubscriptions =
+ cartridgeSubsciptionManager.getCartridgeSubscriptionsForType(cartridgeType);
+ if (cartridgeSubscriptions != null && !cartridgeSubscriptions.isEmpty()) {
+ // not allowed to undeploy!
+ String errorMsg = "Subscription exists for " + cartridgeType + ", cannot undeploy";
+ log.error(errorMsg);
+ throw new RestAPIException(errorMsg);
+ } else {
+ // can undeploy
+ undeployCartridgeDefinition(cloudControllerServiceClient, cartridgeType);
+ }
+ }
+ }
+ }
+
+ private static void undeployCartridgeDefinition (CloudControllerServiceClient cloudControllerServiceClient,
+ String cartridgeType) throws RestAPIException {
+
+ try {
+ cloudControllerServiceClient.unDeployCartridgeDefinition(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);
}
}
[4/4] git commit: release the http method once executed
Posted by ud...@apache.org.
release the http method once executed
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/a0e36dbe
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/a0e36dbe
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/a0e36dbe
Branch: refs/heads/4.0.0-grouping
Commit: a0e36dbe82893c502ea6f8867309d096ae74a6de
Parents: ec68c2d
Author: Udara Liyanage <ud...@wso2.com>
Authored: Wed Oct 1 15:01:55 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Wed Oct 1 15:01:55 2014 +0530
----------------------------------------------------------------------
.../org/apache/stratos/metadata/client/rest/DefaultRestClient.java | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/a0e36dbe/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java b/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
index cb12b8d..55e0360 100644
--- a/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
+++ b/components/org.apache.stratos.metadata.client/src/main/java/org/apache/stratos/metadata/client/rest/DefaultRestClient.java
@@ -80,6 +80,8 @@ public class DefaultRestClient implements RestClient {
String errorMsg = "Error while executing POST statement";
log.error(errorMsg, e);
throw new RestClientException(errorMsg, e);
+ }finally {
+ post.releaseConnection();
}
}
[2/4] git commit: Merge branch '4.0.0-grouping' of
https://git-wip-us.apache.org/repos/asf/stratos into 4.0.0-grouping
Posted by ud...@apache.org.
Merge branch '4.0.0-grouping' of https://git-wip-us.apache.org/repos/asf/stratos into 4.0.0-grouping
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ce7e93bf
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ce7e93bf
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ce7e93bf
Branch: refs/heads/4.0.0-grouping
Commit: ce7e93bf99250fbda2d9630dc7c65ed838f730ae
Parents: c4740c0 5aac10e
Author: Udara Liyanage <ud...@wso2.com>
Authored: Wed Oct 1 10:12:42 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Wed Oct 1 10:12:42 2014 +0530
----------------------------------------------------------------------
.../AutoscalerTopologyEventReceiver.java | 20 ++++++++++--
.../autoscaler/monitor/group/GroupMonitor.java | 33 +++++++++++---------
.../status/checker/StatusChecker.java | 13 ++++++--
.../stratos/autoscaler/util/AutoscalerUtil.java | 1 +
.../parser/DefaultApplicationParser.java | 14 ++++++---
.../controller/topology/TopologyBuilder.java | 4 +--
.../conf/LoadBalancerConfiguration.java | 2 +-
.../messaging/domain/topology/Cluster.java | 10 +++++-
.../ApplicationStatusEventMessageDelegator.java | 17 ++++------
.../registry/CarbonRegistry.java | 11 +++++--
10 files changed, 84 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
[3/4] git commit: change info log to debug
Posted by ud...@apache.org.
change info log to debug
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/ec68c2d2
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/ec68c2d2
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/ec68c2d2
Branch: refs/heads/4.0.0-grouping
Commit: ec68c2d232c1035c71351aeaa0cb78bc8ac766ed
Parents: ce7e93b
Author: Udara Liyanage <ud...@wso2.com>
Authored: Wed Oct 1 14:59:35 2014 +0530
Committer: Udara Liyanage <ud...@wso2.com>
Committed: Wed Oct 1 14:59:35 2014 +0530
----------------------------------------------------------------------
.../org/apache/stratos/metadataservice/util/ConfUtil.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/ec68c2d2/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java
index bbe2078..1abbf07 100644
--- a/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java
+++ b/components/org.apache.stratos.metadataservice/src/main/java/org/apache/stratos/metadataservice/util/ConfUtil.java
@@ -19,8 +19,6 @@
package org.apache.stratos.metadataservice.util;
-import java.io.File;
-
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.XMLConfiguration;
import org.apache.commons.logging.Log;
@@ -28,6 +26,8 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.metadataservice.Constants;
import org.wso2.carbon.utils.CarbonUtils;
+import java.io.File;
+
/**
* This class contains utility methods for read metadata configuration file.
*/
@@ -40,7 +40,8 @@ public class ConfUtil {
private static ConfUtil instance = null;
private ConfUtil(String configFilePath) {
- log.info("Loading configuration.....");
+ log.debug("Loading configuration.....");
+
try {
File confFile;