Repository: stratos Updated Branches: refs/heads/4.0.0-grouping edd105e20 -> 54e720ce3
rename some events Project: http://git-wip-us.apache.org/repos/asf/stratos/repo Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/54e720ce Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/54e720ce Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/54e720ce Branch: refs/heads/4.0.0-grouping Commit: 54e720ce312a9cd587993e6b9b49e9f4b4b37419 Parents: edd105e Author: Udara Liyanage <[email protected]> Authored: Thu Oct 23 13:53:11 2014 +0530 Committer: Udara Liyanage <[email protected]> Committed: Thu Oct 23 14:22:53 2014 +0530 ---------------------------------------------------------------------- .../AutoscalerTopologyEventReceiver.java | 3 +- .../ApplicationStatusTopicReceiver.java | 5 +- .../status/GroupInActivateEvent.java | 44 -------------- .../status/GroupInInactivateEvent.java | 44 -------------- .../status/GroupInactivateEvent.java | 44 ++++++++++++++ .../status/GroupInActivateEventListener.java | 27 --------- .../status/GroupInTerminatedEventListener.java | 27 --------- .../status/GroupInTerminatingEventListener.java | 27 --------- .../status/GroupInactivateEventListener.java | 27 +++++++++ .../status/GroupTerminatedEventListener.java | 24 ++++++++ .../status/GroupTerminatingEventListener.java | 27 +++++++++ ...onStatusGroupInActivateMessageProcessor.java | 62 -------------------- ...nStatusGroupInActivatedMessageProcessor.java | 61 +++++++++++++++++++ .../ApplicationStatusMessageProcessorChain.java | 12 ++-- 14 files changed, 192 insertions(+), 242 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java index bb91b7e..9e7c769 100644 --- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java +++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/message/receiver/topology/AutoscalerTopologyEventReceiver.java @@ -40,9 +40,8 @@ import org.apache.stratos.messaging.domain.topology.ApplicationStatus; import org.apache.stratos.messaging.domain.topology.ClusterStatus; import org.apache.stratos.messaging.domain.topology.GroupStatus; import org.apache.stratos.messaging.event.Event; -import org.apache.stratos.messaging.event.application.status.GroupInTerminatingEvent; import org.apache.stratos.messaging.event.topology.*; -import org.apache.stratos.messaging.listener.application.status.GroupInTerminatingEventListener; +import org.apache.stratos.messaging.listener.application.status.GroupTerminatingEventListener; 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/54e720ce/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 7c0abfc..3a3be45 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 @@ -37,7 +37,6 @@ public class ApplicationStatusTopicReceiver implements Runnable { addEventListeners(); } - @Override public void run() { //FIXME this activated before autoscaler deployer activated. try { @@ -80,7 +79,7 @@ public class ApplicationStatusTopicReceiver implements Runnable { } }); - statusEventReceiver.addEventListener(new GroupInTerminatedEventListener() { + statusEventReceiver.addEventListener(new GroupTerminatedEventListener() { @Override protected void onEvent(Event event) { TopologyBuilder.handleGroupTerminatedEvent((GroupInTerminatedEvent) event); @@ -88,7 +87,7 @@ public class ApplicationStatusTopicReceiver implements Runnable { } }); - statusEventReceiver.addEventListener(new GroupInTerminatingEventListener() { + statusEventReceiver.addEventListener(new GroupTerminatingEventListener() { @Override protected void onEvent(Event event) { TopologyBuilder.handleGroupTerminatingEvent((GroupInTerminatingEvent) event); http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInActivateEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInActivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInActivateEvent.java deleted file mode 100644 index c7c8d58..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInActivateEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.stratos.messaging.event.application.status; - -/** - * This event is fired by cartridge agent when it has started the server and - * applications are ready to serve the incoming requests. - */ -public class GroupInActivateEvent extends StatusEvent { - private static final long serialVersionUID = 2625412714611885089L; - - private String groupId; - private String appId; - - public GroupInActivateEvent(String appId, String groupId) { - this.appId = appId; - this.groupId = groupId; - } - - public String getGroupId() { - return this.groupId; - } - - public String getAppId() { - return appId; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInInactivateEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInInactivateEvent.java deleted file mode 100644 index 6aeada7..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInInactivateEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.stratos.messaging.event.application.status; - -/** - * This event is fired by cartridge agent when it has started the server and - * applications are ready to serve the incoming requests. - */ -public class GroupInInactivateEvent extends StatusEvent { - private static final long serialVersionUID = 2625412714611885089L; - - private String groupId; - private String appId; - - public GroupInInactivateEvent(String appId, String groupId) { - this.appId = appId; - this.groupId = groupId; - } - - public String getGroupId() { - return this.groupId; - } - - public String getAppId() { - return appId; - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInactivateEvent.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInactivateEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInactivateEvent.java new file mode 100644 index 0000000..e816480 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/status/GroupInactivateEvent.java @@ -0,0 +1,44 @@ +/* + * 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; + +/** + * This event is fired by cartridge agent when it has started the server and + * applications are ready to serve the incoming requests. + */ +public class GroupInactivateEvent extends StatusEvent { + private static final long serialVersionUID = 2625412714611885089L; + + private String groupId; + private String appId; + + public GroupInactivateEvent(String appId, String groupId) { + this.appId = appId; + this.groupId = groupId; + } + + public String getGroupId() { + return this.groupId; + } + + public String getAppId() { + return appId; + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInActivateEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInActivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInActivateEventListener.java deleted file mode 100644 index ecc4f04..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInActivateEventListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.messaging.listener.application.status; - -import org.apache.stratos.messaging.listener.EventListener; - -/** - * Created by reka on 9/22/14. - */ -public abstract class GroupInActivateEventListener extends EventListener { -} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInTerminatedEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInTerminatedEventListener.java deleted file mode 100644 index 8cb331c..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInTerminatedEventListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.messaging.listener.application.status; - -import org.apache.stratos.messaging.listener.EventListener; - -/** - * Created by reka on 9/22/14. - */ -public abstract class GroupInTerminatedEventListener extends EventListener { -} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInTerminatingEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInTerminatingEventListener.java deleted file mode 100644 index 20c8b68..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInTerminatingEventListener.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.stratos.messaging.listener.application.status; - -import org.apache.stratos.messaging.listener.EventListener; - -/** - * Created by reka on 9/22/14. - */ -public abstract class GroupInTerminatingEventListener extends EventListener { -} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInactivateEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInactivateEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInactivateEventListener.java new file mode 100644 index 0000000..bcca3fd --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupInactivateEventListener.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; + +/** + * Created by reka on 9/22/14. + */ +public abstract class GroupInactivateEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupTerminatedEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupTerminatedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupTerminatedEventListener.java new file mode 100644 index 0000000..6572516 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupTerminatedEventListener.java @@ -0,0 +1,24 @@ +/* + * 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; + +public abstract class GroupTerminatedEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupTerminatingEventListener.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupTerminatingEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupTerminatingEventListener.java new file mode 100644 index 0000000..afb65b8 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/status/GroupTerminatingEventListener.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; + +/** + * Created by reka on 9/22/14. + */ +public abstract class GroupTerminatingEventListener extends EventListener { +} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusGroupInActivateMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusGroupInActivateMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusGroupInActivateMessageProcessor.java deleted file mode 100644 index 099b185..0000000 --- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusGroupInActivateMessageProcessor.java +++ /dev/null @@ -1,62 +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.application.status; - - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.stratos.messaging.event.application.status.GroupActivatedEvent; -import org.apache.stratos.messaging.event.application.status.GroupInActivateEvent; -import org.apache.stratos.messaging.message.processor.MessageProcessor; -import org.apache.stratos.messaging.util.Util; - -public class ApplicationStatusGroupInActivateMessageProcessor extends MessageProcessor { - private static final Log log = - LogFactory.getLog(ApplicationStatusGroupInActivateMessageProcessor.class); - private MessageProcessor nextProcessor; - - @Override - public void setNext(MessageProcessor nextProcessor) { - this.nextProcessor = nextProcessor; - } - - @Override - public boolean process(String type, String message, Object object) { - if (GroupInActivateEvent.class.getName().equals(type)) { - // Parse complete message and build event - GroupInActivateEvent event = - (GroupInActivateEvent) Util.jsonToObject(message, GroupInActivateEvent.class); - - if (log.isDebugEnabled()) { - log.debug("Received GroupInActivateEvent: " + 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 in activated message " + - "using available message processors: [type] %s [body] %s", type, message)); - } - } - } -} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusGroupInActivatedMessageProcessor.java ---------------------------------------------------------------------- diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusGroupInActivatedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusGroupInActivatedMessageProcessor.java new file mode 100644 index 0000000..2f7f231 --- /dev/null +++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/status/ApplicationStatusGroupInActivatedMessageProcessor.java @@ -0,0 +1,61 @@ +/* + * 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.GroupInactivateEvent; +import org.apache.stratos.messaging.message.processor.MessageProcessor; +import org.apache.stratos.messaging.util.Util; + +public class ApplicationStatusGroupInActivatedMessageProcessor extends MessageProcessor { + private static final Log log = + LogFactory.getLog(ApplicationStatusGroupInActivatedMessageProcessor.class); + private MessageProcessor nextProcessor; + + @Override + public void setNext(MessageProcessor nextProcessor) { + this.nextProcessor = nextProcessor; + } + + @Override + public boolean process(String type, String message, Object object) { + if (GroupInactivateEvent.class.getName().equals(type)) { + // Parse complete message and build event + GroupInactivateEvent event = + (GroupInactivateEvent) Util.jsonToObject(message, GroupInactivateEvent.class); + + if (log.isDebugEnabled()) { + log.debug("Received GroupInActivateEvent: " + 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 in activated message " + + "using available message processors: [type] %s [body] %s", type, message)); + } + } + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/54e720ce/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 24cb122..e8575cc 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 @@ -34,7 +34,7 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai private ApplicationStatusClusterActivatedMessageProcessor clusterActivatedMessageProcessor; private ApplicationStatusClusterInActivateMessageProcessor clusterInActivateMessageProcessor; private ApplicationStatusGroupActivatedMessageProcessor groupActivatedMessageProcessor; - private ApplicationStatusGroupInActivateMessageProcessor groupInActivateMessageProcessor; + private ApplicationStatusGroupInActivatedMessageProcessor groupInActivateMessageProcessor; private ApplicationStatusAppActivatedMessageProcessor appActivatedMessageProcessor; private ApplicationStatusAppCreatedMessageProcessor applicationStatusAppCreatedMessageProcessor; private ApplicationStatusAppInActivatedMessageProcessor applicationStatusAppInActivatedMessageProcessor; @@ -55,7 +55,7 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai groupActivatedMessageProcessor = new ApplicationStatusGroupActivatedMessageProcessor(); add(groupActivatedMessageProcessor); - groupInActivateMessageProcessor = new ApplicationStatusGroupInActivateMessageProcessor(); + groupInActivateMessageProcessor = new ApplicationStatusGroupInActivatedMessageProcessor(); add(groupInActivateMessageProcessor); appActivatedMessageProcessor = new ApplicationStatusAppActivatedMessageProcessor(); @@ -91,7 +91,7 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai clusterInActivateMessageProcessor.addEventListener(eventListener); } else if (eventListener instanceof GroupActivatedEventListener) { groupActivatedMessageProcessor.addEventListener(eventListener); - } else if (eventListener instanceof GroupInActivateEventListener) { + } else if (eventListener instanceof GroupInactivateEventListener) { groupInActivateMessageProcessor.addEventListener(eventListener); } else if (eventListener instanceof ApplicationActivatedEventListener) { appActivatedMessageProcessor.addEventListener(eventListener); @@ -103,13 +103,13 @@ public class ApplicationStatusMessageProcessorChain extends MessageProcessorChai applicationStatusAppTerminatingMessageProcessor.addEventListener(eventListener); } else if(eventListener instanceof ApplicationTerminatedEventListener){ applicationStatusAppTerminatedMessageProcessor.addEventListener(eventListener); - } else if (eventListener instanceof GroupInTerminatingEventListener){ + } else if (eventListener instanceof GroupTerminatingEventListener){ groupTerminatingMessageProcessor.addEventListener(eventListener); - } else if (eventListener instanceof GroupInTerminatedEventListener){ + } else if (eventListener instanceof GroupTerminatedEventListener){ groupTerminatedMessageProcessor.addEventListener(eventListener); } else { - throw new RuntimeException("Unknown event listener"); + throw new RuntimeException("Unknown event listener " + eventListener.toString()); } } }
