stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raviha...@apache.org
Subject stratos git commit: Fixing STRATOS-1478
Date Tue, 04 Aug 2015 07:55:39 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 77e459500 -> 1c2997172


Fixing STRATOS-1478


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/1c299717
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/1c299717
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/1c299717

Branch: refs/heads/master
Commit: 1c2997172f51e587ba1e7a024d7cf19cab90abc5
Parents: 77e4595
Author: Akila Perera <ravihansa3000@gmail.com>
Authored: Tue Aug 4 12:48:55 2015 +0530
Committer: Akila Perera <ravihansa3000@gmail.com>
Committed: Tue Aug 4 12:48:55 2015 +0530

----------------------------------------------------------------------
 .../publisher/ClusterStatusEventPublisher.java  |  4 -
 .../extensions/DefaultExtensionHandler.java     | 43 ----------
 .../agent/extensions/ExtensionHandler.java      |  7 --
 .../status/ClusterStatusTopicReceiver.java      |  7 --
 .../messaging/topology/TopologyBuilder.java     | 31 -------
 .../application/GroupReadyToShutdownEvent.java  | 52 ------------
 .../ClusterStatusClusterCreatedEvent.java       | 85 --------------------
 .../event/tenant/TenantSubscribedEvent.java     | 53 ------------
 .../event/tenant/TenantUnSubscribedEvent.java   | 53 ------------
 .../GroupMaintenanceModeEventListener.java      | 23 ++++++
 ...lusterStatusClusterCreatedEventListener.java | 24 ------
 .../tenant/TenantSubscribedEventListener.java   | 28 -------
 .../tenant/TenantUnSubscribedEventListener.java | 28 -------
 .../ApplicationsMessageProcessorChain.java      |  6 ++
 .../GroupMaintenanceModeProcessor.java          | 82 +++++++++++++++++++
 ...terStatusClusterCreatedMessageProcessor.java | 58 -------------
 .../ClusterStatusMessageProcessorChain.java     |  8 +-
 17 files changed, 112 insertions(+), 480 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
index 3407f4d..665c5f0 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/publisher/ClusterStatusEventPublisher.java
@@ -49,10 +49,6 @@ public class ClusterStatusEventPublisher {
                         log.info("Publishing Cluster created event for [application]: " +
appId +
                                 " [cluster]: " + clusterId);
                     }
-                    /*ClusterStatusClusterCreatedEvent clusterCreatedEvent =
-                            new ClusterStatusClusterCreatedEvent(appId, serviceName, clusterId);
-
-                    publishEvent(clusterCreatedEvent);*/
                 } else {
                     log.warn("Created is not in the possible state list of [cluster] " +
clusterId);
                 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/DefaultExtensionHandler.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/DefaultExtensionHandler.java
b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/DefaultExtensionHandler.java
index fa0858e..a28060e 100644
--- a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/DefaultExtensionHandler.java
+++ b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/DefaultExtensionHandler.java
@@ -43,8 +43,6 @@ import org.apache.stratos.messaging.event.instance.notifier.ArtifactUpdatedEvent
 import org.apache.stratos.messaging.event.instance.notifier.InstanceCleanupClusterEvent;
 import org.apache.stratos.messaging.event.instance.notifier.InstanceCleanupMemberEvent;
 import org.apache.stratos.messaging.event.tenant.CompleteTenantEvent;
-import org.apache.stratos.messaging.event.tenant.TenantSubscribedEvent;
-import org.apache.stratos.messaging.event.tenant.TenantUnSubscribedEvent;
 import org.apache.stratos.messaging.event.topology.*;
 import org.apache.stratos.messaging.message.receiver.tenant.TenantManager;
 
@@ -522,47 +520,6 @@ public class DefaultExtensionHandler implements ExtensionHandler {
         ExtensionUtils.executeCopyArtifactsExtension(src, des);
     }
 
-    @Override
-    public void onTenantSubscribedEvent(TenantSubscribedEvent tenantSubscribedEvent) {
-        if (log.isInfoEnabled()) {
-            log.info(String.format("Tenant subscribed event received: [tenant] %s [service]
%s [cluster] %s",
-                            tenantSubscribedEvent.getTenantId(), tenantSubscribedEvent.getServiceName(),
-                            tenantSubscribedEvent.getClusterIds())
-            );
-        }
-
-        if (log.isDebugEnabled()) {
-            String msg = gson.toJson(tenantSubscribedEvent);
-            log.debug("Tenant subscribed event msg:" + msg);
-        }
-        Map<String, String> env = new HashMap<String, String>();
-        ExtensionUtils.executeTenantSubscribedExtension(env);
-    }
-
-    @Override
-    public void onTenantUnSubscribedEvent(TenantUnSubscribedEvent tenantUnSubscribedEvent)
{
-        if (log.isInfoEnabled()) {
-            log.info(String.format("Tenant unsubscribed event received: [tenant] %s [service]
%s [cluster] %s",
-                    tenantUnSubscribedEvent.getTenantId(), tenantUnSubscribedEvent.getServiceName(),
-                    tenantUnSubscribedEvent.getClusterIds()));
-        }
-
-        if (log.isDebugEnabled()) {
-            String msg = gson.toJson(tenantUnSubscribedEvent);
-            log.debug("Tenant unsubscribed event msg:" + msg);
-        }
-
-        try {
-            if (CartridgeAgentConfiguration.getInstance().getServiceName().equals(tenantUnSubscribedEvent.getServiceName()))
{
-                GitBasedArtifactRepository.getInstance().removeRepo(tenantUnSubscribedEvent.getTenantId());
-            }
-        } catch (Exception e) {
-            log.error(e);
-        }
-        Map<String, String> env = new HashMap<String, String>();
-        ExtensionUtils.executeTenantUnSubscribedExtension(env);
-    }
-
     //ApplicationSignUpRemovedEvent
     @Override
     public void onApplicationSignUpRemovedEvent(ApplicationSignUpRemovedEvent applicationSignUpRemovedEvent)
{

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/ExtensionHandler.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/ExtensionHandler.java
b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/ExtensionHandler.java
index 9dde074..537bf6e 100644
--- a/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/ExtensionHandler.java
+++ b/components/org.apache.stratos.cartridge.agent/src/main/java/org/apache/stratos/cartridge/agent/extensions/ExtensionHandler.java
@@ -26,8 +26,6 @@ import org.apache.stratos.messaging.event.instance.notifier.ArtifactUpdatedEvent
 import org.apache.stratos.messaging.event.instance.notifier.InstanceCleanupClusterEvent;
 import org.apache.stratos.messaging.event.instance.notifier.InstanceCleanupMemberEvent;
 import org.apache.stratos.messaging.event.tenant.CompleteTenantEvent;
-import org.apache.stratos.messaging.event.tenant.TenantSubscribedEvent;
-import org.apache.stratos.messaging.event.tenant.TenantUnSubscribedEvent;
 import org.apache.stratos.messaging.event.topology.*;
 
 public interface ExtensionHandler {
@@ -70,10 +68,5 @@ public interface ExtensionHandler {
 
     public void onCopyArtifactsExtension(String src, String des);
 
-    public void onTenantSubscribedEvent(TenantSubscribedEvent tenantSubscribedEvent);
-
-    public void onTenantUnSubscribedEvent(TenantUnSubscribedEvent tenantUnSubscribedEvent);
-
     public void onApplicationSignUpRemovedEvent(ApplicationSignUpRemovedEvent applicationSignUpRemovedEvent);
-
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/receiver/cluster/status/ClusterStatusTopicReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/receiver/cluster/status/ClusterStatusTopicReceiver.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/receiver/cluster/status/ClusterStatusTopicReceiver.java
index 40eb7c5..1afe6d8 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/receiver/cluster/status/ClusterStatusTopicReceiver.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/receiver/cluster/status/ClusterStatusTopicReceiver.java
@@ -66,13 +66,6 @@ public class ClusterStatusTopicReceiver {
             }
         });
 
-        statusEventReceiver.addEventListener(new ClusterStatusClusterCreatedEventListener()
{
-            @Override
-            protected void onEvent(Event event) {
-                TopologyBuilder.handleClusterCreated((ClusterStatusClusterCreatedEvent) event);
-            }
-        });
-
         statusEventReceiver.addEventListener(new ClusterStatusClusterActivatedEventListener()
{
             @Override
             protected void onEvent(Event event) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
index acc7bd4..b04204e 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/messaging/topology/TopologyBuilder.java
@@ -147,38 +147,7 @@ public class TopologyBuilder {
         }
     }
 
-    public static void handleClusterCreated(ClusterStatusClusterCreatedEvent event) {
-        TopologyManager.acquireWriteLock();
-        Cluster cluster;
-
-        try {
-            Topology topology = TopologyManager.getTopology();
-            Service service = topology.getService(event.getServiceName());
-            if (service == null) {
-                log.error("Service " + event.getServiceName() +
-                        " not found in Topology, unable to update the cluster status to Created");
-                return;
-            }
 
-            if (service.clusterExists(event.getClusterId())) {
-                log.warn("Cluster " + event.getClusterId() + " is already in the Topology
");
-                return;
-            } else {
-                cluster = new Cluster(event.getServiceName(),
-                        event.getClusterId(), event.getDeploymentPolicyName(),
-                        event.getAutosScalePolicyName(), event.getAppId());
-                //cluster.setStatus(Status.Created);
-                cluster.setHostNames(event.getHostNames());
-                cluster.setTenantRange(event.getTenantRange());
-                service.addCluster(cluster);
-                TopologyManager.updateTopology(topology);
-            }
-        } finally {
-            TopologyManager.releaseWriteLock();
-        }
-
-        TopologyEventPublisher.sendClusterCreatedEvent(cluster);
-    }
 
     public static void handleApplicationClustersCreated(String appId, List<Cluster>
appClusters) {
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/GroupReadyToShutdownEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/GroupReadyToShutdownEvent.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/GroupReadyToShutdownEvent.java
deleted file mode 100644
index a20b729..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/GroupReadyToShutdownEvent.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.messaging.event.application;
-
-import org.apache.stratos.messaging.event.Event;
-
-import java.io.Serializable;
-
-/**
- * This event is fired by autoscaler before actually terminate a group.
- */
-public class GroupReadyToShutdownEvent extends Event implements Serializable {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private String groupId;
-    private String appId;
-    private String instanceId;
-
-    public GroupReadyToShutdownEvent(String appId, String groupId, String instanceId) {
-        this.appId = appId;
-        this.groupId = groupId;
-        this.instanceId = instanceId;
-    }
-
-    public String getGroupId() {
-        return this.groupId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-    public String getInstanceId() {
-        return instanceId;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterCreatedEvent.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterCreatedEvent.java
deleted file mode 100644
index 5004cd8..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/cluster/status/ClusterStatusClusterCreatedEvent.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.messaging.event.cluster.status;
-
-import org.apache.stratos.messaging.event.Event;
-
-import java.util.List;
-
-/**
- * This event is fired by cartridge agent when it has started the server and
- * applications are ready to serve the incoming requests.
- */
-public class ClusterStatusClusterCreatedEvent extends Event {
-    private static final long serialVersionUID = 2625412714611885089L;
-
-    private final String serviceName;
-    private final String clusterId;
-    private String appId;
-    private String autosScalePolicyName;
-    private String deploymentPolicyName;
-    private List<String> hostNames;
-    private String tenantRange;
-
-    public ClusterStatusClusterCreatedEvent(String appId, String serviceName, String clusterId,
-                                            String autosScalePolicyName, String deploymentPolicyName)
{
-        this.serviceName = serviceName;
-        this.clusterId = clusterId;
-        this.appId = appId;
-        this.deploymentPolicyName = deploymentPolicyName;
-        this.autosScalePolicyName = autosScalePolicyName;
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public String getClusterId() {
-        return clusterId;
-    }
-
-    public String getAppId() {
-        return appId;
-    }
-
-    public String getAutosScalePolicyName() {
-        return autosScalePolicyName;
-    }
-
-    public String getDeploymentPolicyName() {
-        return deploymentPolicyName;
-    }
-
-    public List<String> getHostNames() {
-        return hostNames;
-    }
-
-    public void setHostNames(List<String> hostNames) {
-        this.hostNames = hostNames;
-    }
-
-    public String getTenantRange() {
-        return tenantRange;
-    }
-
-    public void setTenantRange(String tenantRange) {
-        this.tenantRange = tenantRange;
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/tenant/TenantSubscribedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/tenant/TenantSubscribedEvent.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/tenant/TenantSubscribedEvent.java
deleted file mode 100644
index 3947738..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/tenant/TenantSubscribedEvent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.messaging.event.tenant;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * This event is fired when a tenant is subscribed to a service.
- */
-public class TenantSubscribedEvent extends TenantEvent implements Serializable {
-    private static final long serialVersionUID = -4023221432696893312L;
-
-    private final int tenantId;
-    private final String serviceName;
-    private final Set<String> clusterIds;
-
-    public TenantSubscribedEvent(int tenantId, String serviceName, Set<String> clusterIds)
{
-        this.tenantId = tenantId;
-        this.serviceName = serviceName;
-        this.clusterIds = clusterIds;
-    }
-
-    public int getTenantId() {
-        return tenantId;
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public Set<String> getClusterIds() {
-        return Collections.unmodifiableSet(clusterIds);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/tenant/TenantUnSubscribedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/tenant/TenantUnSubscribedEvent.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/tenant/TenantUnSubscribedEvent.java
deleted file mode 100644
index 5cfcfdf..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/tenant/TenantUnSubscribedEvent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.messaging.event.tenant;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * This event is fired when a tenant is un-subscribed from a service.
- */
-public class TenantUnSubscribedEvent extends TenantEvent implements Serializable {
-    private static final long serialVersionUID = -4023221432696893312L;
-
-    private final int tenantId;
-    private final String serviceName;
-    private final Set<String> clusterIds;
-
-    public TenantUnSubscribedEvent(int tenantId, String serviceName, Set<String> clusterIds)
{
-        this.tenantId = tenantId;
-        this.serviceName = serviceName;
-        this.clusterIds = clusterIds;
-    }
-
-    public int getTenantId() {
-        return tenantId;
-    }
-
-    public String getServiceName() {
-        return serviceName;
-    }
-
-    public Set<String> getClusterIds() {
-        return Collections.unmodifiableSet(clusterIds);
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/GroupMaintenanceModeEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/GroupMaintenanceModeEventListener.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/GroupMaintenanceModeEventListener.java
new file mode 100644
index 0000000..38a2fde
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/GroupMaintenanceModeEventListener.java
@@ -0,0 +1,23 @@
+package org.apache.stratos.messaging.listener.application;/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+ * KIND, either express or implied.  See the License for the 
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+public abstract class GroupMaintenanceModeEventListener extends EventListener {
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterCreatedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterCreatedEventListener.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterCreatedEventListener.java
deleted file mode 100644
index 15542f6..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/cluster/status/ClusterStatusClusterCreatedEventListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.messaging.listener.cluster.status;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-public abstract class ClusterStatusClusterCreatedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/tenant/TenantSubscribedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/tenant/TenantSubscribedEventListener.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/tenant/TenantSubscribedEventListener.java
deleted file mode 100644
index 73b3afa..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/tenant/TenantSubscribedEventListener.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.messaging.listener.tenant;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * Tenant subscribed event listener.
- */
-public abstract class TenantSubscribedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/tenant/TenantUnSubscribedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/tenant/TenantUnSubscribedEventListener.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/tenant/TenantUnSubscribedEventListener.java
deleted file mode 100644
index 3c923c7..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/tenant/TenantUnSubscribedEventListener.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.messaging.listener.tenant;
-
-import org.apache.stratos.messaging.listener.EventListener;
-
-/**
- * Tenant un-subscribed event listener.
- */
-public abstract class TenantUnSubscribedEventListener extends EventListener {
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/ApplicationsMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/ApplicationsMessageProcessorChain.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/ApplicationsMessageProcessorChain.java
index 6c7c193..b92a236 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/ApplicationsMessageProcessorChain.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/ApplicationsMessageProcessorChain.java
@@ -44,6 +44,7 @@ public class ApplicationsMessageProcessorChain extends MessageProcessorChain
{
     private ApplicationInstanceTerminatedMessageProcessor applicationTerminatedMessageProcessor;
     private ApplicationInstanceTerminatingMessageProcessor applicationTerminatingMessageProcessor;
     private CompleteApplicationsMessageProcessor completeApplicationsMessageProcessor;
+    private GroupMaintenanceModeProcessor groupMaintenanceModeProcessor;
 
     public void initialize() {
         // Add instance notifier event processors
@@ -87,6 +88,9 @@ public class ApplicationsMessageProcessorChain extends MessageProcessorChain
{
         applicationTerminatedMessageProcessor = new ApplicationInstanceTerminatedMessageProcessor();
         add(applicationTerminatedMessageProcessor);
 
+        groupMaintenanceModeProcessor = new GroupMaintenanceModeProcessor();
+        add(groupMaintenanceModeProcessor);
+
         if (log.isDebugEnabled()) {
             log.debug("Instance notifier message processor chain initialized");
         }
@@ -120,6 +124,8 @@ public class ApplicationsMessageProcessorChain extends MessageProcessorChain
{
             applicationTerminatedMessageProcessor.addEventListener(eventListener);
         } else if (eventListener instanceof CompleteApplicationsEventListener) {
             completeApplicationsMessageProcessor.addEventListener(eventListener);
+        } else if (eventListener instanceof GroupMaintenanceModeEventListener){
+            groupMaintenanceModeProcessor.addEventListener(eventListener);
         } else {
             throw new RuntimeException("Unknown event listener " + eventListener.toString());
         }

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/GroupMaintenanceModeProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/GroupMaintenanceModeProcessor.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/GroupMaintenanceModeProcessor.java
new file mode 100644
index 0000000..c689222
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/GroupMaintenanceModeProcessor.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+ * KIND, either express or implied.  See the License for the 
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.messaging.message.processor.application;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.application.Applications;
+import org.apache.stratos.messaging.event.application.GroupMaintenanceModeEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.message.processor.application.updater.ApplicationsUpdater;
+import org.apache.stratos.messaging.util.MessagingUtil;
+
+public class GroupMaintenanceModeProcessor extends MessageProcessor {
+    private static final Log log = LogFactory.getLog(GroupMaintenanceModeProcessor.class);
+    private MessageProcessor nextProcessor;
+
+    @Override
+    public void setNext(MessageProcessor nextProcessor) {
+        this.nextProcessor = nextProcessor;
+    }
+
+    @Override
+    public boolean process(String type, String message, Object object) {
+        Applications applications = (Applications) object;
+
+        if (GroupMaintenanceModeEvent.class.getName().equals(type)) {
+            // Return if applications has not been initialized
+            if (!applications.isInitialized()) {
+                return false;
+            }
+
+            // Parse complete message and build event
+            GroupMaintenanceModeEvent event = (GroupMaintenanceModeEvent) MessagingUtil.jsonToObject(message,
+                    GroupMaintenanceModeEvent.class);
+
+            ApplicationsUpdater.acquireWriteLockForApplication(event.getAppId());
+
+            try {
+                return doProcess(event, applications);
+
+            }
+            finally {
+                ApplicationsUpdater.releaseWriteLockForApplication(event.getAppId());
+            }
+
+        } else {
+            if (nextProcessor != null) {
+                // ask the next processor to take care of the message.
+                return nextProcessor.process(type, message, applications);
+            } else {
+                throw new RuntimeException(String.format(
+                        "Failed to process message using available message processors: [type]
%s [body] %s", type,
+                        message));
+            }
+        }
+    }
+
+    private boolean doProcess(GroupMaintenanceModeEvent event, Applications applications)
{
+        // TODO: validate application, group and state transition. Create a IN_MAINTENANCE
status and set it as the
+        // group context status.
+
+        // Notify event listeners
+        notifyEventListeners(event);
+        return true;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterCreatedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterCreatedMessageProcessor.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterCreatedMessageProcessor.java
deleted file mode 100644
index ceaa90d..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusClusterCreatedMessageProcessor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.messaging.message.processor.cluster.status;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.event.cluster.status.ClusterStatusClusterCreatedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.util.MessagingUtil;
-
-
-public class ClusterStatusClusterCreatedMessageProcessor extends MessageProcessor {
-    private static final Log log = LogFactory.getLog(ClusterStatusClusterCreatedMessageProcessor.class);
-    private MessageProcessor nextProcessor;
-
-    @Override
-    public void setNext(MessageProcessor nextProcessor) {
-        this.nextProcessor = nextProcessor;
-    }
-
-    @Override
-    public boolean process(String type, String message, Object object) {
-        if (ClusterStatusClusterCreatedEvent.class.getName().equals(type)) {
-            // Parse complete message and build event
-            ClusterStatusClusterCreatedEvent event = (ClusterStatusClusterCreatedEvent) MessagingUtil.
-                    jsonToObject(message, ClusterStatusClusterCreatedEvent.class);
-
-            if (log.isDebugEnabled()) {
-                log.debug("Received ClusterStatusClusterCreatedEvent: " + event.toString());
-            }
-            // Notify event listeners
-            notifyEventListeners(event);
-            return true;
-        } else {
-            if (nextProcessor != null) {
-                return nextProcessor.process(type, message, object);
-            } else {
-                throw new RuntimeException(String.format("Failed to process cluster created
message using available message processors: [type] %s [body] %s", type, message));
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/stratos/blob/1c299717/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java
index 720dcee..090a586 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/cluster/status/ClusterStatusMessageProcessorChain.java
@@ -30,7 +30,6 @@ import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
 public class ClusterStatusMessageProcessorChain extends MessageProcessorChain {
     private static final Log log = LogFactory.getLog(ClusterStatusMessageProcessorChain.class);
 
-    private ClusterStatusClusterCreatedMessageProcessor clusterCreatedMessageProcessor;
     private ClusterStatusClusterActivatedMessageProcessor clusterActivatedMessageProcessor;
     private ClusterStatusClusterResetMessageProcessor clusterResetMessageProcessor;
     private ClusterStatusClusterInactivateMessageProcessor clusterInactivateMessageProcessor;
@@ -40,9 +39,6 @@ public class ClusterStatusMessageProcessorChain extends MessageProcessorChain
{
 
     @Override
     protected void initialize() {
-        clusterCreatedMessageProcessor = new ClusterStatusClusterCreatedMessageProcessor();
-        add(clusterCreatedMessageProcessor);
-
         clusterResetMessageProcessor = new ClusterStatusClusterResetMessageProcessor();
         add(clusterResetMessageProcessor);
 
@@ -68,9 +64,7 @@ public class ClusterStatusMessageProcessorChain extends MessageProcessorChain
{
 
     @Override
     public void addEventListener(EventListener eventListener) {
-        if (eventListener instanceof ClusterStatusClusterCreatedEventListener) {
-            clusterCreatedMessageProcessor.addEventListener(eventListener);
-        } else if (eventListener instanceof ClusterStatusClusterResetEventListener) {
+        if (eventListener instanceof ClusterStatusClusterResetEventListener) {
             clusterResetMessageProcessor.addEventListener(eventListener);
         } else if (eventListener instanceof ClusterStatusClusterInactivateEventListener)
{
             clusterInactivateMessageProcessor.addEventListener(eventListener);


Mime
View raw message