Repository: stratos Updated Branches: refs/heads/docker-grouping-merge caeb7104a -> c6815d123
removing application, group related events from topology Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/c6815d12 Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/c6815d12 Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/c6815d12 Branch: refs/heads/docker-grouping-merge Commit: c6815d123849e1f863e8f3f5513247aeb51080dc Parents: caeb710 Author: Udara Liyanage <[email protected]> Authored: Fri Nov 7 17:02:02 2014 +0530 Committer: Udara Liyanage <[email protected]> Committed: Fri Nov 7 17:02:18 2014 +0530 ---------------------------------------------------------------------- .../topic/ApplicationsEventPublisher.java | 13 +- .../AutoscalerTopologyEventReceiver.java | 25 +- .../topology/TopologyEventPublisher.java | 320 ++++++++----------- .../topology/ApplicationActivatedEvent.java | 34 -- .../event/topology/ApplicationCreatedEvent.java | 54 ---- .../topology/ApplicationInactivatedEvent.java | 34 -- .../topology/ApplicationTerminatedEvent.java | 57 ---- .../topology/ApplicationTerminatingEvent.java | 35 -- .../topology/ApplicationUndeployedEvent.java | 43 --- .../event/topology/GroupActivatedEvent.java | 43 --- .../event/topology/GroupCreatedEvent.java | 43 --- .../event/topology/GroupInactivateEvent.java | 43 --- .../event/topology/GroupTerminatedEvent.java | 43 --- .../event/topology/GroupTerminatingEvent.java | 43 --- .../ApplicationInactivatedMessageProcessor.java | 2 +- .../ApplicationTerminatedMessageProcessor.java | 8 +- .../ApplicationTerminatingMessageProcessor.java | 2 +- .../ApplicationUndeployedMessageProcessor.java | 141 -------- .../ApplicationsMessageProcessorChain.java | 6 - 19 files changed, 148 insertions(+), 841 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java index aa037a7..cc6f27e 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/topic/ApplicationsEventPublisher.java @@ -4,16 +4,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.messaging.broker.publish.EventPublisher; import org.apache.stratos.messaging.broker.publish.EventPublisherPool; -import org.apache.stratos.messaging.domain.applications.*; +import org.apache.stratos.messaging.domain.applications.Application; +import org.apache.stratos.messaging.domain.applications.Applications; import org.apache.stratos.messaging.event.Event; import org.apache.stratos.messaging.event.applications.*; -import org.apache.stratos.messaging.event.topology.ApplicationUndeployedEvent; -import org.apache.stratos.messaging.message.receiver.applications.ApplicationManager; -import org.apache.stratos.messaging.util.Constants; import org.apache.stratos.messaging.util.Util; -import java.util.Set; - /** * This will publish application related events to application status topic. */ @@ -30,11 +26,6 @@ public class ApplicationsEventPublisher { publishEvent(new ApplicationCreatedEvent(application)); } - public static void sendApplicationUndeployedEvent (String appId, Set<ClusterDataHolder> clusterData) { - - publishEvent(new ApplicationUndeployedEvent(appId, clusterData)); - } - public static void sendGroupCreatedEvent(String appId, String groupId) { if (log.isInfoEnabled()) { log.info("Publishing Group created event for [application]: " + appId + http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java index 95d2b60..d11c431 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/event/receiver/topology/AutoscalerTopologyEventReceiver.java @@ -36,29 +36,8 @@ import org.apache.stratos.messaging.domain.topology.ClusterStatus; import org.apache.stratos.messaging.domain.topology.Service; import org.apache.stratos.messaging.domain.topology.Topology; import org.apache.stratos.messaging.event.Event; -import org.apache.stratos.messaging.event.topology.ApplicationClustersCreatedEvent; -import org.apache.stratos.messaging.event.topology.ClusterActivatedEvent; -import org.apache.stratos.messaging.event.topology.ClusterCreatedEvent; -import org.apache.stratos.messaging.event.topology.ClusterInactivateEvent; -import org.apache.stratos.messaging.event.topology.ClusterTerminatedEvent; -import org.apache.stratos.messaging.event.topology.ClusterTerminatingEvent; -import org.apache.stratos.messaging.event.topology.MemberActivatedEvent; -import org.apache.stratos.messaging.event.topology.MemberMaintenanceModeEvent; -import org.apache.stratos.messaging.event.topology.MemberReadyToShutdownEvent; -import org.apache.stratos.messaging.event.topology.MemberTerminatedEvent; -import org.apache.stratos.messaging.listener.topology.ApplicationClustersCreatedEventListener; -import org.apache.stratos.messaging.listener.topology.ClusterActivatedEventListener; -import org.apache.stratos.messaging.listener.topology.ClusterCreatedEventListener; -import org.apache.stratos.messaging.listener.topology.ClusterInActivateEventListener; -import org.apache.stratos.messaging.listener.topology.ClusterResetEventListener; -import org.apache.stratos.messaging.listener.topology.ClusterTerminatedEventListener; -import org.apache.stratos.messaging.listener.topology.ClusterTerminatingEventListener; -import org.apache.stratos.messaging.listener.topology.CompleteTopologyEventListener; -import org.apache.stratos.messaging.listener.topology.MemberActivatedEventListener; -import org.apache.stratos.messaging.listener.topology.MemberMaintenanceListener; -import org.apache.stratos.messaging.listener.topology.MemberReadyToShutdownEventListener; -import org.apache.stratos.messaging.listener.topology.MemberStartedEventListener; -import org.apache.stratos.messaging.listener.topology.MemberTerminatedEventListener; +import org.apache.stratos.messaging.event.topology.*; +import org.apache.stratos.messaging.listener.topology.*; import org.apache.stratos.messaging.message.receiver.topology.TopologyEventReceiver; import org.apache.stratos.messaging.message.receiver.topology.TopologyManager; http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java index 76bdb5d..05ed171 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyEventPublisher.java @@ -1,21 +1,21 @@ - /* - * 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. - */ +/* +* 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.cloud.controller.topology; @@ -28,16 +28,18 @@ import org.apache.stratos.cloud.controller.pojo.PortMapping; import org.apache.stratos.cloud.controller.util.CloudControllerUtil; import org.apache.stratos.messaging.broker.publish.EventPublisher; import org.apache.stratos.messaging.broker.publish.EventPublisherPool; -import org.apache.stratos.messaging.domain.applications.ClusterDataHolder; -import org.apache.stratos.messaging.domain.topology.*; +import org.apache.stratos.messaging.domain.topology.Cluster; +import org.apache.stratos.messaging.domain.topology.Port; +import org.apache.stratos.messaging.domain.topology.ServiceType; +import org.apache.stratos.messaging.domain.topology.Topology; import org.apache.stratos.messaging.event.Event; +import org.apache.stratos.messaging.event.applications.*; import org.apache.stratos.messaging.event.instance.status.InstanceStartedEvent; import org.apache.stratos.messaging.event.topology.*; import org.apache.stratos.messaging.util.Util; import java.util.List; import java.util.Properties; -import java.util.Set; /** * this is to send the relevant events from cloud controller to topology topic @@ -45,49 +47,49 @@ import java.util.Set; public class TopologyEventPublisher { private static final Log log = LogFactory.getLog(TopologyEventPublisher.class); - public static void sendServiceCreateEvent(List<Cartridge> cartridgeList) { - ServiceCreatedEvent serviceCreatedEvent; - for (Cartridge cartridge : cartridgeList) { - serviceCreatedEvent = new ServiceCreatedEvent(cartridge.getType(), - (cartridge.isMultiTenant() ? ServiceType.MultiTenant - : ServiceType.SingleTenant)); - - // Add ports to the event - Port port; - List<PortMapping> portMappings = cartridge.getPortMappings(); - for (PortMapping portMapping : portMappings) { - port = new Port(portMapping.getProtocol(), - Integer.parseInt(portMapping.getPort()), - Integer.parseInt(portMapping.getProxyPort())); - serviceCreatedEvent.addPort(port); - } - - if (log.isInfoEnabled()) { - log.info(String.format( - "Publishing service created event: [service] %s", - cartridge.getType())); - } - publishEvent(serviceCreatedEvent); - } - } - - public static void sendServiceRemovedEvent(List<Cartridge> cartridgeList) { - ServiceRemovedEvent serviceRemovedEvent; - for (Cartridge cartridge : cartridgeList) { - serviceRemovedEvent = new ServiceRemovedEvent(cartridge.getType()); - if (log.isInfoEnabled()) { - log.info(String.format( - "Publishing service removed event: [service] %s", - serviceRemovedEvent.getServiceName())); - } - publishEvent(serviceRemovedEvent); - } - } + public static void sendServiceCreateEvent(List<Cartridge> cartridgeList) { + ServiceCreatedEvent serviceCreatedEvent; + for (Cartridge cartridge : cartridgeList) { + serviceCreatedEvent = new ServiceCreatedEvent(cartridge.getType(), + (cartridge.isMultiTenant() ? ServiceType.MultiTenant + : ServiceType.SingleTenant)); + + // Add ports to the event + Port port; + List<PortMapping> portMappings = cartridge.getPortMappings(); + for (PortMapping portMapping : portMappings) { + port = new Port(portMapping.getProtocol(), + Integer.parseInt(portMapping.getPort()), + Integer.parseInt(portMapping.getProxyPort())); + serviceCreatedEvent.addPort(port); + } + + if (log.isInfoEnabled()) { + log.info(String.format( + "Publishing service created event: [service] %s", + cartridge.getType())); + } + publishEvent(serviceCreatedEvent); + } + } + + public static void sendServiceRemovedEvent(List<Cartridge> cartridgeList) { + ServiceRemovedEvent serviceRemovedEvent; + for (Cartridge cartridge : cartridgeList) { + serviceRemovedEvent = new ServiceRemovedEvent(cartridge.getType()); + if (log.isInfoEnabled()) { + log.info(String.format( + "Publishing service removed event: [service] %s", + serviceRemovedEvent.getServiceName())); + } + publishEvent(serviceRemovedEvent); + } + } public static void sendClusterResetEvent(String appId, String serviceName, String clusterId) { - ClusterResetEvent clusterResetEvent = new ClusterResetEvent(appId,serviceName, clusterId); + ClusterResetEvent clusterResetEvent = new ClusterResetEvent(appId, serviceName, clusterId); - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info("Publishing cluster reset event: " + clusterId); } publishEvent(clusterResetEvent); @@ -96,30 +98,12 @@ public class TopologyEventPublisher { public static void sendClusterCreatedEvent(Cluster cluster) { ClusterCreatedEvent clusterCreatedEvent = new ClusterCreatedEvent(cluster); - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info("Publishing cluster created event: " + cluster.getClusterId()); } publishEvent(clusterCreatedEvent); } - public static void sendApplicationCreatedEvent (ApplicationCreatedEvent applicationCreatedEvent) { - - if(log.isInfoEnabled()) { - log.info("Publishing Application created event: " + applicationCreatedEvent.toString()); - } - - publishEvent(applicationCreatedEvent); - } - - public static void sendApplicationUndeployedEvent (String applicationId, Set<ClusterDataHolder> clusterData) { - - if (log.isInfoEnabled()) { - log.info("Publishing Application undeployed event for Application: " + applicationId); - } - - publishEvent(new ApplicationUndeployedEvent(applicationId, clusterData)); - } - public static void sendApplicationClustersCreated(String appId, List<Cluster> clusters) { if (log.isInfoEnabled()) { @@ -150,70 +134,65 @@ public class TopologyEventPublisher { public static void sendClusterRemovedEvent(ClusterContext ctxt, String deploymentPolicy) { ClusterRemovedEvent clusterRemovedEvent = new ClusterRemovedEvent( - ctxt.getCartridgeType(), ctxt.getClusterId(), deploymentPolicy, ctxt.isLbCluster()); - if (log.isInfoEnabled()) { - log.info(String - .format("Publishing cluster removed event: [service] %s [cluster] %s", - ctxt.getCartridgeType(), ctxt.getClusterId())); - } - publishEvent(clusterRemovedEvent); - - } - - public static void sendInstanceSpawnedEvent(String serviceName, - String clusterId, String networkPartitionId, String partitionId, - String memberId, String lbClusterId, String publicIp, - String privateIp, MemberContext context) { - - long initTime = context.getInitTime(); - InstanceSpawnedEvent instanceSpawnedEvent = new InstanceSpawnedEvent( - serviceName, clusterId, networkPartitionId, partitionId, - memberId, initTime); - instanceSpawnedEvent.setLbClusterId(lbClusterId); - instanceSpawnedEvent.setMemberIp(privateIp); - instanceSpawnedEvent.setMemberPublicIp(publicIp); - instanceSpawnedEvent.setProperties(CloudControllerUtil - .toJavaUtilProperties(context.getProperties())); - if (log.isInfoEnabled()) { - log.info(String - .format("Publishing instance spawned event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member] %s [lb-cluster-id] %s [properties] %s", - serviceName, clusterId, networkPartitionId, - partitionId, memberId, lbClusterId, context.getProperties())); - } - publishEvent(instanceSpawnedEvent); - } + ctxt.getCartridgeType(), ctxt.getClusterId(), deploymentPolicy, ctxt.isLbCluster()); + if (log.isInfoEnabled()) { + log.info(String + .format("Publishing cluster removed event: [service] %s [cluster] %s", + ctxt.getCartridgeType(), ctxt.getClusterId())); + } + publishEvent(clusterRemovedEvent); + + } + + public static void sendInstanceSpawnedEvent(String serviceName, + String clusterId, String networkPartitionId, String partitionId, + String memberId, String lbClusterId, String publicIp, + String privateIp, MemberContext context) { + + long initTime = context.getInitTime(); + InstanceSpawnedEvent instanceSpawnedEvent = new InstanceSpawnedEvent( + serviceName, clusterId, networkPartitionId, partitionId, + memberId, initTime); + instanceSpawnedEvent.setLbClusterId(lbClusterId); + instanceSpawnedEvent.setMemberIp(privateIp); + instanceSpawnedEvent.setMemberPublicIp(publicIp); + instanceSpawnedEvent.setProperties(CloudControllerUtil + .toJavaUtilProperties(context.getProperties())); + log.info(String.format("Publishing instance spawned event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member]%s[lb-cluster-id] %s", serviceName, clusterId, networkPartitionId, partitionId, memberId, lbClusterId)); + publishEvent(instanceSpawnedEvent); + } public static void sendMemberStartedEvent(InstanceStartedEvent instanceStartedEvent) { MemberStartedEvent memberStartedEventTopology = new MemberStartedEvent(instanceStartedEvent.getServiceName(), instanceStartedEvent.getClusterId(), instanceStartedEvent.getNetworkPartitionId(), instanceStartedEvent.getPartitionId(), instanceStartedEvent.getMemberId()); - if (log.isInfoEnabled()) { - log.info(String - .format("Publishing member started event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member] %s", - instanceStartedEvent.getServiceName(), - instanceStartedEvent.getClusterId(), - instanceStartedEvent.getNetworkPartitionId(), - instanceStartedEvent.getPartitionId(), - instanceStartedEvent.getMemberId())); - } - publishEvent(memberStartedEventTopology); - } - - public static void sendMemberActivatedEvent( - MemberActivatedEvent memberActivatedEvent) { - if (log.isInfoEnabled()) { - log.info(String - .format("Publishing member activated event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member] %s", - memberActivatedEvent.getServiceName(), - memberActivatedEvent.getClusterId(), - memberActivatedEvent.getNetworkPartitionId(), - memberActivatedEvent.getPartitionId(), - memberActivatedEvent.getMemberId())); - } - publishEvent(memberActivatedEvent); - } + if (log.isInfoEnabled()) { + log.info(String + .format("Publishing member started event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member] %s", + instanceStartedEvent.getServiceName(), + instanceStartedEvent.getClusterId(), + instanceStartedEvent.getNetworkPartitionId(), + instanceStartedEvent.getPartitionId(), + instanceStartedEvent.getMemberId())); + } + publishEvent(memberStartedEventTopology); + } + + public static void sendMemberActivatedEvent( + MemberActivatedEvent memberActivatedEvent) { + if (log.isInfoEnabled()) { + log.info(String + .format("Publishing member activated event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member] %s", + memberActivatedEvent.getServiceName(), + memberActivatedEvent.getClusterId(), + memberActivatedEvent.getNetworkPartitionId(), + memberActivatedEvent.getPartitionId(), + memberActivatedEvent.getMemberId())); + } + publishEvent(memberActivatedEvent); + } public static void sendMemberReadyToShutdownEvent(MemberReadyToShutdownEvent memberReadyToShutdownEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing member Ready to shut down event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member] %s [groupId] %s", memberReadyToShutdownEvent.getServiceName(), memberReadyToShutdownEvent.getClusterId(), memberReadyToShutdownEvent.getNetworkPartitionId(), memberReadyToShutdownEvent.getPartitionId(), memberReadyToShutdownEvent.getMemberId(), memberReadyToShutdownEvent.getGroupId())); @@ -224,7 +203,7 @@ public class TopologyEventPublisher { } public static void sendMemberMaintenanceModeEvent(MemberMaintenanceModeEvent memberMaintenanceModeEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing Maintenance mode event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member] %s [groupId] %s", memberMaintenanceModeEvent.getServiceName(), memberMaintenanceModeEvent.getClusterId(), memberMaintenanceModeEvent.getNetworkPartitionId(), memberMaintenanceModeEvent.getPartitionId(), memberMaintenanceModeEvent.getMemberId(), memberMaintenanceModeEvent.getGroupId())); @@ -233,17 +212,8 @@ public class TopologyEventPublisher { publishEvent(memberMaintenanceModeEvent); } - public static void sendGroupCreatedEvent (GroupCreatedEvent groupCreatedEvent) { - - if(log.isInfoEnabled()) { - log.info(String.format("Publishing group created event: [appId] %s [group] %s", - groupCreatedEvent.getAppId(), groupCreatedEvent.getGroupId())); - } - publishEvent(groupCreatedEvent); - } - public static void sendGroupActivatedEvent(GroupActivatedEvent groupActivatedEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing group activated event: [appId] %s [group] %s", groupActivatedEvent.getAppId(), groupActivatedEvent.getGroupId())); } @@ -251,17 +221,17 @@ public class TopologyEventPublisher { } public static void sendClusterActivatedEvent(ClusterActivatedEvent clusterActivatedEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing cluster activated event: [service] %s [cluster] %s [appId] %s", - clusterActivatedEvent.getServiceName(), clusterActivatedEvent.getClusterId() , clusterActivatedEvent.getAppId())); + clusterActivatedEvent.getServiceName(), clusterActivatedEvent.getClusterId(), clusterActivatedEvent.getAppId())); } publishEvent(clusterActivatedEvent); } public static void sendClusterInActivateEvent(ClusterInactivateEvent clusterInActiveEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing cluster in-active event: [service] %s [cluster] %s [appId] %s", - clusterInActiveEvent.getServiceName(), clusterInActiveEvent.getClusterId() , clusterInActiveEvent.getAppId())); + clusterInActiveEvent.getServiceName(), clusterInActiveEvent.getClusterId(), clusterInActiveEvent.getAppId())); } publishEvent(clusterInActiveEvent); } @@ -273,7 +243,7 @@ public class TopologyEventPublisher { memberTerminatedEvent.setProperties(properties); memberTerminatedEvent.setGroupId(groupId); - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing member terminated event: [service] %s [cluster] %s [network-partition] %s [partition] %s [member] %s [groupId] %s", serviceName, clusterId, networkPartitionId, partitionId, memberId, groupId)); } @@ -284,14 +254,14 @@ public class TopologyEventPublisher { public static void sendCompleteTopologyEvent(Topology topology) { CompleteTopologyEvent completeTopologyEvent = new CompleteTopologyEvent(topology); - if(log.isDebugEnabled()) { + if (log.isDebugEnabled()) { log.debug(String.format("Publishing complete topology event")); } publishEvent(completeTopologyEvent); } public static void sendApplicationActivatedEvent(ApplicationActivatedEvent applicationActivatedEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing application activated event: [appId] %s", applicationActivatedEvent.getAppId())); } @@ -299,7 +269,7 @@ public class TopologyEventPublisher { } public static void sendApplicationInactivatedEvent(ApplicationInactivatedEvent applicationActivatedEvent1) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing application in activated event: [appId] %s", applicationActivatedEvent1.getAppId())); } @@ -307,7 +277,7 @@ public class TopologyEventPublisher { } public static void sendApplicationTerminatingEvent(ApplicationTerminatingEvent applicationTerminatingEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing application terminating event: [appId] %s", applicationTerminatingEvent.getAppId())); } @@ -315,24 +285,16 @@ public class TopologyEventPublisher { } public static void sendApplicationTerminatedEvent(ApplicationTerminatedEvent applicationTerminatedEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing application terminated event: [appId] %s", applicationTerminatedEvent.getAppId())); } publishEvent(applicationTerminatedEvent); } - public static void sendGroupInActiveEvent(GroupInactivateEvent groupInActivateEvent) { - if(log.isInfoEnabled()) { - log.info(String.format("Publishing group in-active event: [appId] %s", - groupInActivateEvent.getAppId())); - } - publishEvent(groupInActivateEvent); - } - public static void sendGroupTerminatedEvent(GroupTerminatedEvent groupTerminatedTopologyEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing group terminated event: [appId] %s", groupTerminatedTopologyEvent.getAppId())); } @@ -340,16 +302,16 @@ public class TopologyEventPublisher { } public static void sendGroupTerminatingEvent(GroupTerminatingEvent groupTerminatingTopologyEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing group terminating event: [appId] %s", groupTerminatingTopologyEvent.getAppId())); } publishEvent(groupTerminatingTopologyEvent); } - public static void sendClusterTerminatingEvent (ClusterTerminatingEvent clusterTerminatingEvent) { + public static void sendClusterTerminatingEvent(ClusterTerminatingEvent clusterTerminatingEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing Cluster terminating event: [appId] %s [cluster id] %s", clusterTerminatingEvent.getAppId(), clusterTerminatingEvent.getClusterId())); } @@ -357,19 +319,19 @@ public class TopologyEventPublisher { publishEvent(clusterTerminatingEvent); } - public static void sendClusterTerminatedEvent (ClusterTerminatedEvent clusterTerminatedEvent) { + public static void sendClusterTerminatedEvent(ClusterTerminatedEvent clusterTerminatedEvent) { - if(log.isInfoEnabled()) { + if (log.isInfoEnabled()) { log.info(String.format("Publishing Cluster terminated event: [appId] %s [cluster id] %s", clusterTerminatedEvent.getAppId(), clusterTerminatedEvent.getClusterId())); } publishEvent(clusterTerminatedEvent); } - - public static void publishEvent(Event event) { - String topic = Util.getMessageTopicName(event); - EventPublisher eventPublisher = EventPublisherPool.getPublisher(topic); - eventPublisher.publish(event); - } + + public static void publishEvent(Event event) { + String topic = Util.getMessageTopicName(event); + EventPublisher eventPublisher = EventPublisherPool.getPublisher(topic); + eventPublisher.publish(event); + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationActivatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationActivatedEvent.java deleted file mode 100644 index 2d825f7..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationActivatedEvent.java +++ /dev/null @@ -1,34 +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.topology; - -/** - * This event will be sent to Topology upon activation of application - */ -public class ApplicationActivatedEvent extends TopologyEvent { - private final String appId; - - public ApplicationActivatedEvent(String appId) { - this.appId = appId; - } - - public String getAppId() { - return appId; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationCreatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationCreatedEvent.java deleted file mode 100644 index 63b6439..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationCreatedEvent.java +++ /dev/null @@ -1,54 +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.topology; - -import org.apache.stratos.messaging.domain.applications.Application; -import org.apache.stratos.messaging.domain.topology.Cluster; - -import java.util.List; - -public class ApplicationCreatedEvent extends TopologyEvent { - - private final Application application; - - private List<Cluster> clusterList; - - public ApplicationCreatedEvent(Application application, List<Cluster> clusters) { - this.application = application; - this.setClusterList(clusters); - } - - public Application getApplication() { - return application; - } - - public String toString() { - return "ApplicationCreatedEvent [app id= " + application.getUniqueIdentifier() + ", groups= " + application.getGroups() + ", clusters= " + - application.getClusterDataMap().values() + "]"; - } - - public List<Cluster> getClusterList() { - return clusterList; - } - - public void setClusterList(List<Cluster> clusterList) { - this.clusterList = clusterList; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationInactivatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationInactivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationInactivatedEvent.java deleted file mode 100644 index d81dc55..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationInactivatedEvent.java +++ /dev/null @@ -1,34 +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.topology; - -/** - * This event will be sent to Topology upon inactivation of application - */ -public class ApplicationInactivatedEvent extends TopologyEvent { - private final String appId; - - public ApplicationInactivatedEvent(String appId) { - this.appId = appId; - } - - public String getAppId() { - return appId; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatedEvent.java deleted file mode 100644 index 4142685..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatedEvent.java +++ /dev/null @@ -1,57 +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.topology; - -import org.apache.stratos.messaging.domain.applications.ClusterDataHolder; - -import java.util.Set; - -/** - * This event will be sent to Topology upon termination of application - */ -public class ApplicationTerminatedEvent extends TopologyEvent { - private final String appId; - private final Set<ClusterDataHolder> clusterData; - private String tenantDomain; - private int tenantId; - - public ApplicationTerminatedEvent(String appId, Set<ClusterDataHolder> clusterData, - int tenantId, String tenantDomain) { - this.appId = appId; - this.clusterData = clusterData; - this.tenantId = tenantId; - this.tenantDomain = tenantDomain; - } - - public String getAppId() { - return appId; - } - - public Set<ClusterDataHolder> getClusterData() { - return clusterData; - } - - public String getTenantDomain() { - return tenantDomain; - } - - public int getTenantId() { - return tenantId; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatingEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatingEvent.java deleted file mode 100644 index 48fde61..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatingEvent.java +++ /dev/null @@ -1,35 +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.topology; - -/** - * This event will be sent to Topology upon terminating of application - */ -public class ApplicationTerminatingEvent extends TopologyEvent { - - private final String appId; - - public ApplicationTerminatingEvent(String appId) { - this.appId = appId; - } - - public String getAppId() { - return appId; - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationUndeployedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationUndeployedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationUndeployedEvent.java deleted file mode 100644 index bd3667a..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationUndeployedEvent.java +++ /dev/null @@ -1,43 +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.topology; - -import org.apache.stratos.messaging.domain.applications.ClusterDataHolder; - -import java.util.Set; - -public class ApplicationUndeployedEvent extends TopologyEvent { - - private String applicationId; - private Set<ClusterDataHolder> clusterData; - - public ApplicationUndeployedEvent (String applicationId, Set<ClusterDataHolder> clusterData) { - this.applicationId = applicationId; - this.clusterData = clusterData; - } - - public String getApplicationId() { - return applicationId; - } - - public Set<ClusterDataHolder> getClusterData() { - return clusterData; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupActivatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupActivatedEvent.java deleted file mode 100644 index 3328d22..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupActivatedEvent.java +++ /dev/null @@ -1,43 +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.topology; - -import org.apache.stratos.messaging.event.Event; - -/** - * Group Activated Event which will be sent to Topology upon group activation - */ -public class GroupActivatedEvent extends Event { - private String appId; - private String groupId; - - public GroupActivatedEvent(String appId, String groupId) { - this.appId = appId; - this.groupId = groupId; - } - - public String getAppId() { - return appId; - } - - public String getGroupId() { - return groupId; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupCreatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupCreatedEvent.java deleted file mode 100644 index e3794f0..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupCreatedEvent.java +++ /dev/null @@ -1,43 +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.topology; - -import org.apache.stratos.messaging.event.Event; - -/** - * Group Activated Event which will be sent to Topology upon group activation - */ -public class GroupCreatedEvent extends Event { - private String appId; - private String groupId; - - public GroupCreatedEvent(String appId, String groupId) { - this.appId = appId; - this.groupId = groupId; - } - - public String getAppId() { - return appId; - } - - public String getGroupId() { - return groupId; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivateEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivateEvent.java deleted file mode 100644 index 3bcbaa9..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupInactivateEvent.java +++ /dev/null @@ -1,43 +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.topology; - -import org.apache.stratos.messaging.event.Event; - -/** - * Group Activated Event which will be sent to Topology upon group activation - */ -public class GroupInactivateEvent extends Event { - private String appId; - private String groupId; - - public GroupInactivateEvent(String appId, String groupId) { - this.appId = appId; - this.groupId = groupId; - } - - public String getAppId() { - return appId; - } - - public String getGroupId() { - return groupId; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupTerminatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupTerminatedEvent.java deleted file mode 100644 index 667343c..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupTerminatedEvent.java +++ /dev/null @@ -1,43 +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.topology; - -import org.apache.stratos.messaging.event.Event; - -/** - * Group Activated Event which will be sent to Topology upon group activation - */ -public class GroupTerminatedEvent extends Event { - private String appId; - private String groupId; - - public GroupTerminatedEvent(String appId, String groupId) { - this.appId = appId; - this.groupId = groupId; - } - - public String getAppId() { - return appId; - } - - public String getGroupId() { - return groupId; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupTerminatingEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupTerminatingEvent.java deleted file mode 100644 index 31e0cc5..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupTerminatingEvent.java +++ /dev/null @@ -1,43 +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.topology; - -import org.apache.stratos.messaging.event.Event; - -/** - * Group Activated Event which will be sent to Topology upon group activation - */ -public class GroupTerminatingEvent extends Event { - private String appId; - private String groupId; - - public GroupTerminatingEvent(String appId, String groupId) { - this.appId = appId; - this.groupId = groupId; - } - - public String getAppId() { - return appId; - } - - public String getGroupId() { - return groupId; - } - -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java index 21a5906..3fb77ec 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationInactivatedMessageProcessor.java @@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.stratos.messaging.domain.applications.Application; import org.apache.stratos.messaging.domain.applications.ApplicationStatus; import org.apache.stratos.messaging.domain.applications.Applications; -import org.apache.stratos.messaging.event.topology.ApplicationInactivatedEvent; +import org.apache.stratos.messaging.event.applications.ApplicationInactivatedEvent; import org.apache.stratos.messaging.message.processor.MessageProcessor; import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater; import org.apache.stratos.messaging.util.Util; http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java index 9ffe785..f9d2950 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatedMessageProcessor.java @@ -22,7 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.messaging.domain.applications.Applications; import org.apache.stratos.messaging.domain.applications.ClusterDataHolder; -import org.apache.stratos.messaging.event.topology.ApplicationTerminatedEvent; +import org.apache.stratos.messaging.event.applications.ApplicationTerminatedEvent; import org.apache.stratos.messaging.message.processor.MessageProcessor; import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater; import org.apache.stratos.messaging.message.processor.topology.updater.TopologyUpdater; @@ -98,12 +98,6 @@ public class ApplicationTerminatedMessageProcessor extends MessageProcessor { throw new RuntimeException(errorMsg); } - if (event.getTenantDomain() == null) { - String errorMsg = "Application tenant domain of application removed event is invalid"; - log.error(errorMsg); - throw new RuntimeException(errorMsg); - } - // check if an Application with same name exists in applications String appId = event.getAppId(); if (applications.applicationExists(appId)) { http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java index 9b69182..2161214 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationTerminatingMessageProcessor.java @@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.stratos.messaging.domain.applications.Application; import org.apache.stratos.messaging.domain.applications.ApplicationStatus; import org.apache.stratos.messaging.domain.applications.Applications; -import org.apache.stratos.messaging.event.topology.ApplicationTerminatingEvent; +import org.apache.stratos.messaging.event.applications.ApplicationTerminatingEvent; import org.apache.stratos.messaging.message.processor.MessageProcessor; import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater; import org.apache.stratos.messaging.util.Util; http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationUndeployedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationUndeployedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationUndeployedMessageProcessor.java deleted file mode 100644 index 5bf0d9f..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationUndeployedMessageProcessor.java +++ /dev/null @@ -1,141 +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.applications; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.messaging.domain.applications.Application; -import org.apache.stratos.messaging.domain.applications.ApplicationStatus; -import org.apache.stratos.messaging.domain.applications.Applications; -import org.apache.stratos.messaging.domain.applications.ClusterDataHolder; -import org.apache.stratos.messaging.event.topology.ApplicationUndeployedEvent; -import org.apache.stratos.messaging.message.processor.MessageProcessor; -import org.apache.stratos.messaging.message.processor.applications.updater.ApplicationsUpdater; -import org.apache.stratos.messaging.message.processor.topology.updater.TopologyUpdater; -import org.apache.stratos.messaging.util.Util; - -import java.util.Set; - -public class ApplicationUndeployedMessageProcessor extends MessageProcessor { - - private static final Log log = LogFactory.getLog(ApplicationUndeployedMessageProcessor.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 (ApplicationUndeployedEvent.class.getName().equals(type)) { - if (!applications.isInitialized()) { - return false; - } - - ApplicationUndeployedEvent event = (ApplicationUndeployedEvent) - Util.jsonToObject(message, ApplicationUndeployedEvent.class); - if (event == null) { - log.error("Unable to convert the JSON message to ApplicationUndeployedEvent"); - return false; - } - - // get write lock for the application and relevant Clusters - ApplicationsUpdater.acquireWriteLockForApplication(event.getApplicationId()); - Set<ClusterDataHolder> clusterDataHolders = event.getClusterData(); - if (clusterDataHolders != null) { - for (ClusterDataHolder clusterData : clusterDataHolders) { - TopologyUpdater.acquireWriteLockForCluster(clusterData.getServiceType(), - clusterData.getClusterId()); - } - } - - try { - return doProcess(event, applications); - - } finally { - // remove locks - if (clusterDataHolders != null) { - for (ClusterDataHolder clusterData : clusterDataHolders) { - TopologyUpdater.releaseWriteLockForCluster(clusterData.getServiceType(), - clusterData.getClusterId()); - } - } - ApplicationsUpdater.releaseWriteLockForApplication(event.getApplicationId()); - } - - } 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(ApplicationUndeployedEvent event, Applications applications) { - - // update the application status to Terminating - Application application = applications.getApplication(event.getApplicationId()); - // check and update application status to 'Terminating' - if (!application.isStateTransitionValid(ApplicationStatus.Terminating)) { - log.error("Invalid state transfer from " + application.getStatus() + " to " + ApplicationStatus.Terminating); - } - // for now anyway update the status forcefully - application.setStatus(ApplicationStatus.Terminating); - - // update all the Clusters' statuses to 'Terminating' - Set<ClusterDataHolder> clusterData = application.getClusterDataRecursively(); - // update the Cluster statuses to Terminating - for (ClusterDataHolder clusterDataHolder : clusterData) { - log.info("############################### TODO ###############################"); -// Service service = applications.getService(clusterDataHolder.getServiceType()); -// if (service != null) { -// Cluster aCluster = service.getCluster(clusterDataHolder.getClusterId()); -// if (aCluster != null) { -// // validate state transition -// if (!aCluster.isStateTransitionValid(ClusterStatus.Terminating)) { -// log.error("Invalid state transfer from " + aCluster.getStatus() + " to " -// + ClusterStatus.Terminating); -// } -// // for now anyway update the status forcefully -// aCluster.setStatus(ClusterStatus.Terminating); -// -// } else { -// log.warn("Unable to find Cluster with cluster id " + clusterDataHolder.getClusterId() + -// " in Topology"); -// } -// -// } else { -// log.warn("Unable to remove cluster with cluster id: " + clusterDataHolder.getClusterId() + " from Topology, " + -// " associated Service [ " + clusterDataHolder.getServiceType() + " ] npt found"); -// } - } - - notifyEventListeners(event); - return true; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/c6815d12/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java index dc46a0e..a420eea 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/applications/ApplicationsMessageProcessorChain.java @@ -41,7 +41,6 @@ public class ApplicationsMessageProcessorChain extends MessageProcessorChain { private ApplicationInactivatedMessageProcessor applicationInactivatedMessageProcessor; private ApplicationTerminatedMessageProcessor applicationTerminatedMessageProcessor; private ApplicationTerminatingMessageProcessor applicationTerminatingMessageProcessor; - private ApplicationUndeployedMessageProcessor applicationUndeployedMessageProcessor; private CompleteApplicationsMessageProcessor completeApplicationsMessageProcessor; public void initialize() { @@ -80,9 +79,6 @@ public class ApplicationsMessageProcessorChain extends MessageProcessorChain { applicationTerminatedMessageProcessor = new ApplicationTerminatedMessageProcessor(); add(applicationTerminatedMessageProcessor); - applicationUndeployedMessageProcessor = new ApplicationUndeployedMessageProcessor(); - add(applicationUndeployedMessageProcessor); - if (log.isDebugEnabled()) { log.debug("Instance notifier message processor chain initialized"); } @@ -112,8 +108,6 @@ public class ApplicationsMessageProcessorChain extends MessageProcessorChain { applicationTerminatedMessageProcessor.addEventListener(eventListener); } else if (eventListener instanceof CompleteApplicationsEventListener) { completeApplicationsMessageProcessor.addEventListener(eventListener); - } else if (eventListener instanceof ApplicationUndeployedEventListener) { - applicationUndeployedMessageProcessor.addEventListener(eventListener); } else { throw new RuntimeException("Unknown event listener " + eventListener.toString()); }
