application status events, processors and listners
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/e75aaa3e Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/e75aaa3e Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/e75aaa3e Branch: refs/heads/4.0.0-grouping Commit: e75aaa3ec47670902958f5568bb43e3e35f13c18 Parents: 6804f41 Author: Udara Liyanage <[email protected]> Authored: Mon Oct 20 17:47:01 2014 +0530 Committer: Udara Liyanage <[email protected]> Committed: Mon Oct 20 17:47:01 2014 +0530 ---------------------------------------------------------------------- .../grouping/topic/StatusEventPublisher.java | 10 ++ .../ApplicationStatusTopicReceiver.java | 39 +++++- .../controller/topology/TopologyBuilder.java | 121 ++++++++++++++++++- .../topology/TopologyEventPublisher.java | 30 ++++- .../status/ApplicationCreatedEvent.java | 38 ++++++ .../status/ApplicationInactivatedEvent.java | 38 ++++++ .../status/ApplicationTerminatedEvent.java | 38 ++++++ .../status/ApplicationTerminatingEvent.java | 38 ++++++ .../topology/ApplicationInactivatedEvent.java | 34 ++++++ .../topology/ApplicationTerminatedEvent.java | 34 ++++++ .../topology/ApplicationTerminatingEvent.java | 34 ++++++ .../status/ApplicationCreatedEventListener.java | 27 +++++ .../ApplicationInActivatedEventListener.java | 27 +++++ .../ApplicationTerminatedEventListener.java | 27 +++++ .../ApplicationTerminatingEventListener.java | 27 +++++ ...icationStatusAppCreatedMessageProcessor.java | 65 ++++++++++ ...ionStatusAppInActivatedMessageProcessor.java | 65 ++++++++++ ...tionStatusAppTerminatedMessageProcessor.java | 65 ++++++++++ ...ionStatusAppTerminatingMessageProcessor.java | 65 ++++++++++ .../ApplicationStatusMessageProcessorChain.java | 27 ++++- 20 files changed, 835 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java index f8a2322..4867b9c 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/grouping/topic/StatusEventPublisher.java @@ -111,6 +111,16 @@ public class StatusEventPublisher { publishEvent(applicationActivatedEvent); } + public static void sendApplicationInactivatedEvent(String appId){ + if (log.isInfoEnabled()) { + log.info("Publishing Application Inactivated event for [application]: " + appId); + } + + ApplicationInactivatedEvent applicationInActivatedEvent = new ApplicationInactivatedEvent(appId); + + publishEvent(applicationInActivatedEvent); + } + public static void sendGroupInMaintenanceEvent(String appId, String groupId) { if (log.isInfoEnabled()) { http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java index 7cce18f..cfcea8a 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/status/receiver/ApplicationStatusTopicReceiver.java @@ -22,10 +22,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.cloud.controller.topology.TopologyBuilder; import org.apache.stratos.messaging.event.Event; -import org.apache.stratos.messaging.event.application.status.ApplicationActivatedEvent; -import org.apache.stratos.messaging.event.application.status.ClusterActivatedEvent; -import org.apache.stratos.messaging.event.application.status.GroupActivatedEvent; -import org.apache.stratos.messaging.listener.application.status.ApplicationActivatedEventListener; +import org.apache.stratos.messaging.event.application.status.*; +import org.apache.stratos.messaging.listener.application.status.*; import org.apache.stratos.messaging.listener.topology.ClusterActivatedEventListener; import org.apache.stratos.messaging.listener.topology.GroupActivatedEventListener; import org.apache.stratos.messaging.message.receiver.application.status.ApplicationStatusEventReceiver; @@ -93,6 +91,39 @@ public class ApplicationStatusTopicReceiver implements Runnable { } }); + statusEventReceiver.addEventListener(new ApplicationInActivatedEventListener() { + + @Override + protected void onEvent(Event event) { + TopologyBuilder.handleApplicationInActivatedEvent((ApplicationInactivatedEvent) event); + + } + }); + + statusEventReceiver.addEventListener(new ApplicationCreatedEventListener() { + @Override + protected void onEvent(Event event) { + TopologyBuilder.handleApplicationCreatedEvent((ApplicationCreatedEvent) event); + + } + }); + + statusEventReceiver.addEventListener(new ApplicationTerminatingEventListener() { + @Override + protected void onEvent(Event event) { + TopologyBuilder.handleApplicationTerminatingEvent((ApplicationTerminatingEvent) event); + + } + }); + + statusEventReceiver.addEventListener(new ApplicationTerminatedEventListener() { + @Override + protected void onEvent(Event event) { + TopologyBuilder.handleApplicationTerminatedEvent((ApplicationTerminatedEvent) event); + + } + }); + } http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java index b9fb581..b54b203 100644 --- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java +++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/topology/TopologyBuilder.java @@ -30,9 +30,7 @@ import org.apache.stratos.cloud.controller.runtime.FasterLookUpDataHolder; import org.apache.stratos.cloud.controller.util.CloudControllerUtil; import org.apache.stratos.messaging.domain.topology.*; import org.apache.stratos.messaging.domain.topology.util.CompositeApplicationBuilder; -import org.apache.stratos.messaging.event.application.status.ApplicationActivatedEvent; -import org.apache.stratos.messaging.event.application.status.ClusterActivatedEvent; -import org.apache.stratos.messaging.event.application.status.GroupActivatedEvent; +import org.apache.stratos.messaging.event.application.status.*; import org.apache.stratos.messaging.event.instance.status.InstanceActivatedEvent; import org.apache.stratos.messaging.event.instance.status.InstanceMaintenanceModeEvent; import org.apache.stratos.messaging.event.instance.status.InstanceReadyToShutdownEvent; @@ -668,8 +666,8 @@ public class TopologyBuilder { TopologyManager.updateTopology(topology); log.info("Application with id [ " + application.getUniqueIdentifier() + " ] added to Topology successfully"); - - TopologyEventPublisher.sendApplicationCreatedEvent(application ,clusters); + org.apache.stratos.messaging.event.topology.ApplicationCreatedEvent applicationCreatedEvent = new org.apache.stratos.messaging.event.topology.ApplicationCreatedEvent(application, clusters); + TopologyEventPublisher.sendApplicationCreatedEvent(applicationCreatedEvent); } finally { TopologyManager.releaseWriteLock(); @@ -838,7 +836,7 @@ public class TopologyBuilder { applicationActivatedEvent.getAppId()); try { TopologyManager.acquireWriteLock(); - application.setTempStatus(Status.Activated); + application.setStatus(ApplicationStatus.Active); log.info("Application activated adding status started for Topology"); TopologyManager.updateTopology(topology); @@ -848,4 +846,115 @@ public class TopologyBuilder { //publishing data TopologyEventPublisher.sendApplicationActivatedEvent(applicationActivatedEvent1); } + + public static void handleApplicationInActivatedEvent(ApplicationInactivatedEvent event) { + Topology topology = TopologyManager.getTopology(); + Application application = topology.getApplication(event.getAppId()); + //update the status of the Group + if (application == null) { + log.warn(String.format("Application %s does not exist", + event.getAppId())); + return; + } + + org.apache.stratos.messaging.event.topology.ApplicationInactivatedEvent applicationActivatedEvent = + new org.apache.stratos.messaging.event.topology.ApplicationInactivatedEvent( + event.getAppId()); + try { + TopologyManager.acquireWriteLock(); + application.setStatus(ApplicationStatus.Inactive); + log.info("Application inactivated adding status started for Topology"); + + TopologyManager.updateTopology(topology); + } finally { + TopologyManager.releaseWriteLock(); + } + //publishing data + TopologyEventPublisher.sendApplicationInactivatedEvent(applicationActivatedEvent); + } + + public static void handleApplicationCreatedEvent(ApplicationCreatedEvent event) { + Topology topology = TopologyManager.getTopology(); + Application application = topology.getApplication(event.getAppId()); + //update the status of the Group + if (application == null) { + log.warn(String.format("Application %s does not exist", + event.getAppId())); + return; + } + List<Cluster> clusters = new ArrayList<Cluster>(); + Set<ClusterDataHolder> allClusters = application.getClusterDataRecursively(); + + for(ClusterDataHolder clusterDataHolder : allClusters){ + String clusterId = clusterDataHolder.getClusterId(); + String serviceName = clusterDataHolder.getServiceType(); + clusters.add(TopologyManager.getTopology().getService(serviceName).getCluster(clusterId)); + } + org.apache.stratos.messaging.event.topology.ApplicationCreatedEvent applicationActivatedEvent = + new org.apache.stratos.messaging.event.topology.ApplicationCreatedEvent( + application, clusters); + try { + TopologyManager.acquireWriteLock(); + application.setStatus(ApplicationStatus.Created); + log.info("Application created adding status started for Topology"); + + TopologyManager.updateTopology(topology); + } finally { + TopologyManager.releaseWriteLock(); + } + //publishing data + TopologyEventPublisher.sendApplicationCreatedEvent(applicationActivatedEvent); + } + + public static void handleApplicationTerminatingEvent(ApplicationTerminatingEvent event) { + Topology topology = TopologyManager.getTopology(); + Application application = topology.getApplication(event.getAppId()); + //update the status of the Group + if (application == null) { + log.warn(String.format("Application %s does not exist", + event.getAppId())); + return; + } + + org.apache.stratos.messaging.event.topology.ApplicationTerminatingEvent applicationTerminatingEvent = + new org.apache.stratos.messaging.event.topology.ApplicationTerminatingEvent( + event.getAppId()); + try { + TopologyManager.acquireWriteLock(); + application.setStatus(ApplicationStatus.Terminating); + log.info("Application terminating adding status started for Topology"); + + TopologyManager.updateTopology(topology); + } finally { + TopologyManager.releaseWriteLock(); + } + //publishing data + TopologyEventPublisher.sendApplicationTerminatingEvent(applicationTerminatingEvent); + } + + public static void handleApplicationTerminatedEvent(ApplicationTerminatedEvent event) { + Topology topology = TopologyManager.getTopology(); + Application application = topology.getApplication(event.getAppId()); + //update the status of the Group + if (application == null) { + log.warn(String.format("Application %s does not exist", + event.getAppId())); + return; + } + + org.apache.stratos.messaging.event.topology.ApplicationTerminatedEvent applicationTerminatedEvent = + new org.apache.stratos.messaging.event.topology.ApplicationTerminatedEvent( + event.getAppId()); + try { + TopologyManager.acquireWriteLock(); + application.setStatus(ApplicationStatus.Terminated); + log.info("Application terminated adding status started for Topology"); + + TopologyManager.updateTopology(topology); + } finally { + TopologyManager.releaseWriteLock(); + } + //publishing data + TopologyEventPublisher.sendApplicationTerminatedEvent(applicationTerminatedEvent); + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/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 2cb1eeb..b3f60b9 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 @@ -91,13 +91,13 @@ public class TopologyEventPublisher { } - public static void sendApplicationCreatedEvent (Application application, List<Cluster> clusters) { + public static void sendApplicationCreatedEvent (ApplicationCreatedEvent applicationCreatedEvent) { if(log.isInfoEnabled()) { - log.info("Publishing Application created event: " + application.toString()); + log.info("Publishing Application created event: " + applicationCreatedEvent.toString()); } - publishEvent(new ApplicationCreatedEvent(application, clusters)); + publishEvent(applicationCreatedEvent); } public static void sendApplicationRemovedEvent(String applicationId, Set<ClusterDataHolder> clusterData, @@ -270,4 +270,28 @@ public class TopologyEventPublisher { EventPublisher eventPublisher = EventPublisherPool.getPublisher(Constants.TOPOLOGY_TOPIC); eventPublisher.publish(event); } + + public static void sendApplicationInactivatedEvent(ApplicationInactivatedEvent applicationActivatedEvent1) { + if(log.isInfoEnabled()) { + log.info(String.format("Publishing application in activated event: [appId] %s", + applicationActivatedEvent1.getAppId())); + } + publishEvent(applicationActivatedEvent1); + } + + public static void sendApplicationTerminatingEvent(ApplicationTerminatingEvent applicationTerminatingEvent) { + if(log.isInfoEnabled()) { + log.info(String.format("Publishing application terminating event: [appId] %s", + applicationTerminatingEvent.getAppId())); + } + publishEvent(applicationTerminatingEvent); + } + + public static void sendApplicationTerminatedEvent(ApplicationTerminatedEvent applicationTerminatedEvent) { + if(log.isInfoEnabled()) { + log.info(String.format("Publishing application terminated event: [appId] %s", + applicationTerminatedEvent.getAppId())); + } + publishEvent(applicationTerminatedEvent); + } } http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationCreatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationCreatedEvent.java new file mode 100644 index 0000000..f353067 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationCreatedEvent.java @@ -0,0 +1,38 @@ +/* + * 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.status; + +import java.io.Serializable; + +/** + * This event will be fired upon the application activated is detected. + */ +public class ApplicationCreatedEvent extends StatusEvent implements Serializable { + private static final long serialVersionUID = 2625412714611885089L; + + private String appId; + + public ApplicationCreatedEvent(String appId) { + this.appId = appId; + } + + public String getAppId() { + return appId; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationInactivatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationInactivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationInactivatedEvent.java new file mode 100644 index 0000000..ab0587c --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationInactivatedEvent.java @@ -0,0 +1,38 @@ +/* + * 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.status; + +import java.io.Serializable; + +/** + * This event will be fired upon the application activated is detected. + */ +public class ApplicationInactivatedEvent extends StatusEvent implements Serializable { + private static final long serialVersionUID = 2625412714611885089L; + + private String appId; + + public ApplicationInactivatedEvent(String appId) { + this.appId = appId; + } + + public String getAppId() { + return appId; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationTerminatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationTerminatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationTerminatedEvent.java new file mode 100644 index 0000000..16167e9 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationTerminatedEvent.java @@ -0,0 +1,38 @@ +/* + * 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.status; + +import java.io.Serializable; + +/** + * This event will be fired upon the application activated is detected. + */ +public class ApplicationTerminatedEvent extends StatusEvent implements Serializable { + private static final long serialVersionUID = 2625412714611885089L; + + private String appId; + + public ApplicationTerminatedEvent(String appId) { + this.appId = appId; + } + + public String getAppId() { + return appId; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationTerminatingEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationTerminatingEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationTerminatingEvent.java new file mode 100644 index 0000000..bac610a --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/ApplicationTerminatingEvent.java @@ -0,0 +1,38 @@ +/* + * 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.status; + +import java.io.Serializable; + +/** + * This event will be fired upon the application activated is detected. + */ +public class ApplicationTerminatingEvent extends StatusEvent implements Serializable { + private static final long serialVersionUID = 2625412714611885089L; + + private String appId; + + public ApplicationTerminatingEvent(String appId) { + this.appId = appId; + } + + public String getAppId() { + return appId; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/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 new file mode 100644 index 0000000..5d5bbfb --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationInactivatedEvent.java @@ -0,0 +1,34 @@ +/* + * 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 ApplicationInactivatedEvent extends TopologyEvent { + private 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/e75aaa3e/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 new file mode 100644 index 0000000..6c6ca71 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatedEvent.java @@ -0,0 +1,34 @@ +/* + * 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 ApplicationTerminatedEvent extends TopologyEvent { + private String appId; + + public ApplicationTerminatedEvent(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/e75aaa3e/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 new file mode 100644 index 0000000..98ef800 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ApplicationTerminatingEvent.java @@ -0,0 +1,34 @@ +/* + * 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 ApplicationTerminatingEvent extends TopologyEvent { + private 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/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationCreatedEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationCreatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationCreatedEventListener.java new file mode 100644 index 0000000..cbeffa8 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationCreatedEventListener.java @@ -0,0 +1,27 @@ +/* + * 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.application.status; + +import org.apache.stratos.messaging.listener.EventListener; + +/** + * This listener will get triggered upon the application created event. + */ +public abstract class ApplicationCreatedEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationInActivatedEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationInActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationInActivatedEventListener.java new file mode 100644 index 0000000..378738e --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationInActivatedEventListener.java @@ -0,0 +1,27 @@ +/* + * 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.application.status; + +import org.apache.stratos.messaging.listener.EventListener; + +/** + * This listener will get triggered upon the application In activated event. + */ +public abstract class ApplicationInActivatedEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationTerminatedEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationTerminatedEventListener.java new file mode 100644 index 0000000..aacde3b --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationTerminatedEventListener.java @@ -0,0 +1,27 @@ +/* + * 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.application.status; + +import org.apache.stratos.messaging.listener.EventListener; + +/** + * This listener will get triggered upon the application terminated event. + */ +public abstract class ApplicationTerminatedEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationTerminatingEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationTerminatingEventListener.java new file mode 100644 index 0000000..b35984b --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/ApplicationTerminatingEventListener.java @@ -0,0 +1,27 @@ +/* + * 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.application.status; + +import org.apache.stratos.messaging.listener.EventListener; + +/** + * This listener will get triggered upon the application terminating event. + */ +public abstract class ApplicationTerminatingEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppCreatedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppCreatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppCreatedMessageProcessor.java new file mode 100644 index 0000000..33f0a75 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppCreatedMessageProcessor.java @@ -0,0 +1,65 @@ +/* + * 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.status; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.messaging.event.topology.ApplicationCreatedEvent; +import org.apache.stratos.messaging.message.processor.MessageProcessor; +import org.apache.stratos.messaging.util.Util; + +/** + * Created by reka on 9/25/14. + */ +public class ApplicationStatusAppCreatedMessageProcessor extends MessageProcessor { + private static final Log log = + LogFactory.getLog(ApplicationStatusAppCreatedMessageProcessor.class); + + + private MessageProcessor nextProcessor; + @Override + public void setNext(MessageProcessor nextProcessor) { + this.nextProcessor = nextProcessor; + + } + + @Override + public boolean process(String type, String message, Object object) { + if (ApplicationCreatedEvent.class.getName().equals(type)) { + // Parse complete message and build event + ApplicationCreatedEvent event = + (ApplicationCreatedEvent) Util.jsonToObject(message, ApplicationCreatedEvent.class); + + if (log.isDebugEnabled()) { + log.debug("Received ApplicationCreated Event in application status topic: " + 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 group activated message " + + "using available message processors: [type] %s [body] %s", type, message)); + } + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppInActivatedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppInActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppInActivatedMessageProcessor.java new file mode 100644 index 0000000..a4b4e3f --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppInActivatedMessageProcessor.java @@ -0,0 +1,65 @@ +/* + * 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.status; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.messaging.event.application.status.ApplicationInactivatedEvent; +import org.apache.stratos.messaging.message.processor.MessageProcessor; +import org.apache.stratos.messaging.util.Util; + +/** + * Created by reka on 9/25/14. + */ +public class ApplicationStatusAppInActivatedMessageProcessor extends MessageProcessor { + private static final Log log = + LogFactory.getLog(ApplicationStatusAppInActivatedMessageProcessor.class); + + + private MessageProcessor nextProcessor; + @Override + public void setNext(MessageProcessor nextProcessor) { + this.nextProcessor = nextProcessor; + + } + + @Override + public boolean process(String type, String message, Object object) { + if (ApplicationInactivatedEvent.class.getName().equals(type)) { + // Parse complete message and build event + ApplicationInactivatedEvent event = + (ApplicationInactivatedEvent) Util.jsonToObject(message, ApplicationInactivatedEvent.class); + + if (log.isDebugEnabled()) { + log.debug("Received ApplicationInActivatedEvent in application status topic: " + 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 group activated message " + + "using available message processors: [type] %s [body] %s", type, message)); + } + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppTerminatedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppTerminatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppTerminatedMessageProcessor.java new file mode 100644 index 0000000..74f082f --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppTerminatedMessageProcessor.java @@ -0,0 +1,65 @@ +/* + * 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.status; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.messaging.event.application.status.ApplicationTerminatedEvent; +import org.apache.stratos.messaging.message.processor.MessageProcessor; +import org.apache.stratos.messaging.util.Util; + +/** + * Created by reka on 9/25/14. + */ +public class ApplicationStatusAppTerminatedMessageProcessor extends MessageProcessor { + private static final Log log = + LogFactory.getLog(ApplicationStatusAppTerminatedMessageProcessor.class); + + + private MessageProcessor nextProcessor; + @Override + public void setNext(MessageProcessor nextProcessor) { + this.nextProcessor = nextProcessor; + + } + + @Override + public boolean process(String type, String message, Object object) { + if (ApplicationTerminatedEvent.class.getName().equals(type)) { + // Parse complete message and build event + ApplicationTerminatedEvent event = + (ApplicationTerminatedEvent) Util.jsonToObject(message, ApplicationTerminatedEvent.class); + + if (log.isDebugEnabled()) { + log.debug("Received ApplicationTerminatedEvent in application status topic: " + 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 group activated message " + + "using available message processors: [type] %s [body] %s", type, message)); + } + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppTerminatingMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppTerminatingMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppTerminatingMessageProcessor.java new file mode 100644 index 0000000..2acbe58 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusAppTerminatingMessageProcessor.java @@ -0,0 +1,65 @@ +/* + * 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.status; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.stratos.messaging.event.application.status.ApplicationTerminatingEvent; +import org.apache.stratos.messaging.message.processor.MessageProcessor; +import org.apache.stratos.messaging.util.Util; + +/** + * Created by reka on 9/25/14. + */ +public class ApplicationStatusAppTerminatingMessageProcessor extends MessageProcessor { + private static final Log log = + LogFactory.getLog(ApplicationStatusAppTerminatingMessageProcessor.class); + + + private MessageProcessor nextProcessor; + @Override + public void setNext(MessageProcessor nextProcessor) { + this.nextProcessor = nextProcessor; + + } + + @Override + public boolean process(String type, String message, Object object) { + if (ApplicationTerminatingEvent.class.getName().equals(type)) { + // Parse complete message and build event + ApplicationTerminatingEvent event = + (ApplicationTerminatingEvent) Util.jsonToObject(message, ApplicationTerminatingEvent.class); + + if (log.isDebugEnabled()) { + log.debug("Received ApplicationTerminatingEvent in application status topic: " + 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 group activated message " + + "using available message processors: [type] %s [body] %s", type, message)); + } + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/e75aaa3e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java index 809789b..93f9558 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusMessageProcessorChain.java @@ -21,7 +21,7 @@ package org.apache.stratos.messaging.message.processor.application.status; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.stratos.messaging.listener.EventListener; -import org.apache.stratos.messaging.listener.application.status.ApplicationActivatedEventListener; +import org.apache.stratos.messaging.listener.application.status.*; import org.apache.stratos.messaging.listener.topology.ClusterActivatedEventListener; import org.apache.stratos.messaging.listener.topology.GroupActivatedEventListener; import org.apache.stratos.messaging.message.processor.MessageProcessorChain; @@ -36,6 +36,10 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai private ApplicationStatusClusterActivatedMessageProcessor clusterActivatedMessageProcessor; private ApplicationStatusGroupActivatedMessageProcessor groupActivatedMessageProcessor; private ApplicationStatusAppActivatedMessageProcessor appActivatedMessageProcessor; + private ApplicationStatusAppCreatedMessageProcessor applicationStatusAppCreatedMessageProcessor; + private ApplicationStatusAppInActivatedMessageProcessor applicationStatusAppInActivatedMessageProcessor; + private ApplicationStatusAppTerminatedMessageProcessor applicationStatusAppTerminatedMessageProcessor; + private ApplicationStatusAppTerminatingMessageProcessor applicationStatusAppTerminatingMessageProcessor; public void initialize() { // Add instance notifier event processors @@ -46,6 +50,19 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai appActivatedMessageProcessor = new ApplicationStatusAppActivatedMessageProcessor(); add(appActivatedMessageProcessor); + applicationStatusAppCreatedMessageProcessor = new ApplicationStatusAppCreatedMessageProcessor(); + this.add(applicationStatusAppCreatedMessageProcessor); + + applicationStatusAppInActivatedMessageProcessor = new ApplicationStatusAppInActivatedMessageProcessor(); + this.add(applicationStatusAppInActivatedMessageProcessor); + + applicationStatusAppTerminatedMessageProcessor = new ApplicationStatusAppTerminatedMessageProcessor(); + this.add(applicationStatusAppTerminatedMessageProcessor); + + applicationStatusAppTerminatingMessageProcessor = new ApplicationStatusAppTerminatingMessageProcessor(); + this.add(applicationStatusAppTerminatingMessageProcessor); + + if (log.isDebugEnabled()) { log.debug("Instance notifier message processor chain initialized"); } @@ -58,6 +75,14 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai groupActivatedMessageProcessor.addEventListener(eventListener); } else if (eventListener instanceof ApplicationActivatedEventListener) { appActivatedMessageProcessor.addEventListener(eventListener); + } else if(eventListener instanceof ApplicationInActivatedEventListener){ + applicationStatusAppInActivatedMessageProcessor.addEventListener(eventListener); + } else if(eventListener instanceof ApplicationCreatedEventListener){ + applicationStatusAppCreatedMessageProcessor.addEventListener(eventListener); + } else if(eventListener instanceof ApplicationTerminatingEventListener){ + applicationStatusAppTerminatingMessageProcessor.addEventListener(eventListener); + } else if(eventListener instanceof ApplicationTerminatedEventListener){ + applicationStatusAppTerminatedMessageProcessor.addEventListener(eventListener); } else { throw new RuntimeException("Unknown event listener"); }
