Repository: stratos Updated Branches: refs/heads/4.0.0-grouping 2ca08d461 -> bfb5d00ec
adding group events and cluster events Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/bfb5d00e Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/bfb5d00e Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/bfb5d00e Branch: refs/heads/4.0.0-grouping Commit: bfb5d00ec7af054d020b9b750bf8ce574d8446fc Parents: 2ca08d4 Author: Reka <[email protected]> Authored: Wed Sep 17 16:40:45 2014 +0530 Committer: Reka <[email protected]> Committed: Wed Sep 17 16:40:45 2014 +0530 ---------------------------------------------------------------------- .../event/topology/ClusterActivatedEvent.java | 58 ++++++++++++++++++++ .../event/topology/GroupActivatedEvent.java | 34 ++++++++++++ .../topology/ClusterActivatedEventListener.java | 27 +++++++++ .../topology/GroupActivatedEventListener.java | 27 +++++++++ .../topology/ClusterActivatedProcessor.java | 36 ++++++++++++ .../topology/GroupActivatedProcessor.java | 36 ++++++++++++ .../topology/TopologyMessageProcessorChain.java | 13 ++++- 7 files changed, 230 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/bfb5d00e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterActivatedEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterActivatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterActivatedEvent.java new file mode 100644 index 0000000..f041358 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/ClusterActivatedEvent.java @@ -0,0 +1,58 @@ +/* + * 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.topology.ClusterStatus; + +/** + * Cluster activated event will be sent by Autoscaler + */ +public class ClusterActivatedEvent { + + private final String serviceName; + private final String clusterId; + private ClusterStatus status; + + public ClusterActivatedEvent(String serviceName, String clusterId) { + this.serviceName = serviceName; + this.clusterId = clusterId; + } + + public String getServiceName() { + return serviceName; + } + + @Override + public String toString() { + return "ClusterActivatedEvent [serviceName=" + serviceName + ", clusterStatus=" + + status.toString() + "]"; + } + + public String getClusterId() { + return clusterId; + } + + public ClusterStatus getStatus() { + return status; + } + + public void setStatus(ClusterStatus status) { + this.status = status; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfb5d00e/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 new file mode 100644 index 0000000..2081e3d --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/topology/GroupActivatedEvent.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; + +import org.apache.stratos.messaging.event.Event; + +/** + * Group Activated Event which will be sent by Autoscaler + */ +public class GroupActivatedEvent extends Event { + private String appId; + private String groupId; + + public GroupActivatedEvent(String appId, String groupId) { + this.appId = appId; + this.groupId = groupId; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfb5d00e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterActivatedEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterActivatedEventListener.java new file mode 100644 index 0000000..9514541 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/ClusterActivatedEventListener.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.topology; + +import org.apache.stratos.messaging.listener.EventListener; + +/** + * Created by reka on 9/17/14. + */ +public abstract class ClusterActivatedEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfb5d00e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupActivatedEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupActivatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupActivatedEventListener.java new file mode 100644 index 0000000..d19d013 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/topology/GroupActivatedEventListener.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.topology; + +import org.apache.stratos.messaging.listener.EventListener; + +/** + * This will get triggered by the groups activation processor after processing the event + */ +public abstract class GroupActivatedEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfb5d00e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterActivatedProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterActivatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterActivatedProcessor.java new file mode 100644 index 0000000..9c8ebf5 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/ClusterActivatedProcessor.java @@ -0,0 +1,36 @@ +/* + * 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.topology; + +import org.apache.stratos.messaging.message.processor.MessageProcessor; + +/** + * This processor will act upon the cluster activated event + */ +public class ClusterActivatedProcessor extends MessageProcessor { + @Override + public void setNext(MessageProcessor nextProcessor) { + + } + + @Override + public boolean process(String type, String message, Object object) { + return false; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfb5d00e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupActivatedProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupActivatedProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupActivatedProcessor.java new file mode 100644 index 0000000..c2455c4 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/GroupActivatedProcessor.java @@ -0,0 +1,36 @@ +/* + * 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.topology; + +import org.apache.stratos.messaging.message.processor.MessageProcessor; + +/** + * This processor will act upon the Group activation events + */ +public class GroupActivatedProcessor extends MessageProcessor { + @Override + public void setNext(MessageProcessor nextProcessor) { + + } + + @Override + public boolean process(String type, String message, Object object) { + return false; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/bfb5d00e/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java index ca6afb4..b048cfd 100644 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/topology/TopologyMessageProcessorChain.java @@ -36,6 +36,7 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain { private ServiceCreatedMessageProcessor serviceCreatedMessageProcessor; private ServiceRemovedMessageProcessor serviceRemovedMessageProcessor; private ClusterCreatedMessageProcessor clusterCreatedMessageProcessor; + private ClusterActivatedProcessor clusterActivatedProcessor; private ClusterMaintenanceModeMessageProcessor clusterMaintenanceModeMessageProcessor; private ClusterRemovedMessageProcessor clusterRemovedMessageProcessor; private InstanceSpawnedMessageProcessor instanceSpawnedMessageProcessor; @@ -45,6 +46,7 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain { private MemberMaintenanceModeProcessor memberMaintenanceModeProcessor; private MemberSuspendedMessageProcessor memberSuspendedMessageProcessor; private MemberTerminatedMessageProcessor memberTerminatedMessageProcessor; + private GroupActivatedProcessor groupActivatedProcessor; private CompositeApplicationCreatedMessageProcessor compositeApplicationCreatedMessageProcessor; private CompositeApplicationRemovedMessageProcessor compositeApplicationRemovedMessageProcessor; private ApplicationCreatedMessageProcessor applicationCreatedMessageProcessor; @@ -64,6 +66,9 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain { clusterCreatedMessageProcessor = new ClusterCreatedMessageProcessor(); add(clusterCreatedMessageProcessor); + clusterActivatedProcessor = new ClusterActivatedProcessor(); + add(clusterActivatedProcessor); + clusterMaintenanceModeMessageProcessor = new ClusterMaintenanceModeMessageProcessor(); add(clusterMaintenanceModeMessageProcessor); @@ -91,6 +96,9 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain { memberTerminatedMessageProcessor = new MemberTerminatedMessageProcessor(); add(memberTerminatedMessageProcessor); + groupActivatedProcessor = new GroupActivatedProcessor(); + add(groupActivatedProcessor); + applicationCreatedMessageProcessor = new ApplicationCreatedMessageProcessor(); add(applicationCreatedMessageProcessor); @@ -118,7 +126,8 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain { completeTopologyMessageProcessor.addEventListener(eventListener); } else if (eventListener instanceof ClusterCreatedEventListener) { clusterCreatedMessageProcessor.addEventListener(eventListener); - log.info("Messaging: added ClusterCreatedEventListener"); + } else if (eventListener instanceof ClusterActivatedEventListener) { + clusterActivatedProcessor.addEventListener(eventListener); } else if (eventListener instanceof ClusterMaintenanceModeEventListener) { clusterMaintenanceModeMessageProcessor.addEventListener(eventListener); } else if (eventListener instanceof ClusterRemovedEventListener) { @@ -141,6 +150,8 @@ public class TopologyMessageProcessorChain extends MessageProcessorChain { serviceRemovedMessageProcessor.addEventListener(eventListener); } else if (eventListener instanceof MemberMaintenanceListener) { memberMaintenanceModeProcessor.addEventListener(eventListener); + } else if (eventListener instanceof GroupActivatedEventListener) { + groupActivatedProcessor.addEventListener(eventListener); } else if (eventListener instanceof ApplicationCreatedEventListener) { applicationCreatedMessageProcessor.addEventListener(eventListener); } else if (eventListener instanceof ApplicationRemovedEventListener) {
