You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by im...@apache.org on 2015/01/09 21:00:07 UTC
[1/2] stratos git commit: Implementing application signup messaging
events, listeners, processors, receiver and manager
Repository: stratos
Updated Branches:
refs/heads/master c65438a30 -> 5fcfdac1b
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageQueue.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageQueue.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageQueue.java
new file mode 100644
index 0000000..04ac36d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageQueue.java
@@ -0,0 +1,30 @@
+/*
+ * 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.receiver.application.signup;
+
+import org.apache.stratos.messaging.domain.Message;
+
+import java.util.concurrent.LinkedBlockingQueue;
+
+/**
+ * Application signup event message queue.
+ */
+class ApplicationSignUpEventMessageQueue extends LinkedBlockingQueue<Message> {
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventReceiver.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventReceiver.java
new file mode 100644
index 0000000..c8d098d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventReceiver.java
@@ -0,0 +1,91 @@
+/*
+ * 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.receiver.application.signup;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.broker.subscribe.TopicSubscriber;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.util.Util;
+
+import java.util.concurrent.ExecutorService;
+
+/**
+ * Application signup event receiver.
+ */
+public class ApplicationSignUpEventReceiver {
+
+ private static final Log log = LogFactory.getLog(ApplicationSignUpEventReceiver.class);
+
+ private ApplicationSignUpEventMessageDelegator messageDelegator;
+ private ApplicationSignUpEventMessageListener messageListener;
+ private TopicSubscriber topicSubscriber;
+ private ExecutorService executorService;
+
+ public ApplicationSignUpEventReceiver() {
+ ApplicationSignUpEventMessageQueue messageQueue = new ApplicationSignUpEventMessageQueue();
+ this.messageDelegator = new ApplicationSignUpEventMessageDelegator(messageQueue);
+ this.messageListener = new ApplicationSignUpEventMessageListener(messageQueue);
+ }
+
+ public void addEventListener(EventListener eventListener) {
+ messageDelegator.addEventListener(eventListener);
+ }
+
+
+ public void execute() {
+ try {
+ // Start topic subscriber thread
+ topicSubscriber = new TopicSubscriber(Util.Topics.APPLICATION_SIGNUPS_TOPIC.getTopicName(), messageListener);
+ // subscriber.setMessageListener(messageListener);
+ executorService.execute(topicSubscriber);
+
+
+ if (log.isDebugEnabled()) {
+ log.debug("Application signup event message receiver thread started");
+ }
+
+ // Start topology event message delegator thread
+ executorService.execute(messageDelegator);
+ if (log.isDebugEnabled()) {
+ log.debug("Application signup event message delegator thread started");
+ }
+
+
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Application signup receiver failed", e);
+ }
+ }
+ }
+
+ public void terminate() {
+ topicSubscriber.terminate();
+ messageDelegator.terminate();
+ }
+
+ public ExecutorService getExecutorService() {
+ return executorService;
+ }
+
+ public void setExecutorService(ExecutorService executorService) {
+ this.executorService = executorService;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpManager.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpManager.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpManager.java
new file mode 100644
index 0000000..aab4d9b
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpManager.java
@@ -0,0 +1,134 @@
+/*
+ * 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.receiver.application.signup;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+/**
+ * Application signup manager.
+ */
+public class ApplicationSignUpManager {
+
+ private static final Log log = LogFactory.getLog(ApplicationSignUpManager.class);
+
+ // Map<ApplicationId,Map<TenantId,ApplicationSignUp>>
+ private Map<String, Map<Integer, ApplicationSignUp>> applicationIdToApplicationSignUpsMap;
+
+ private static volatile ApplicationSignUpManager instance;
+ private static volatile ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
+ private static volatile ReentrantReadWriteLock.ReadLock readLock = lock.readLock();
+ private static volatile ReentrantReadWriteLock.WriteLock writeLock = lock.writeLock();
+
+ private boolean initialized;
+
+ private ApplicationSignUpManager() {
+ applicationIdToApplicationSignUpsMap = new HashMap<String, Map<Integer, ApplicationSignUp>>();
+ }
+
+ public static void acquireReadLock() {
+ if(log.isDebugEnabled()) {
+ log.debug("Read lock acquired");
+ }
+ readLock.lock();
+ }
+
+ public static void releaseReadLock() {
+ if(log.isDebugEnabled()) {
+ log.debug("Read lock released");
+ }
+ readLock.unlock();
+ }
+
+ public static void acquireWriteLock() {
+ if(log.isDebugEnabled()) {
+ log.debug("Write lock acquired");
+ }
+ writeLock.lock();
+ }
+
+ public static void releaseWriteLock() {
+ if(log.isDebugEnabled()) {
+ log.debug("Write lock released");
+ }
+ writeLock.unlock();
+ }
+
+ public static ApplicationSignUpManager getInstance() {
+ if (instance == null) {
+ synchronized (ApplicationSignUpManager.class){
+ if (instance == null) {
+ instance = new ApplicationSignUpManager();
+ if(log.isDebugEnabled()) {
+ log.debug("Application signup manager instance created");
+ }
+ }
+ }
+ }
+ return instance;
+ }
+
+ public void addApplicationSignUp(ApplicationSignUp applicationSignUp) {
+ String applicationId = applicationSignUp.getApplicationId();
+ Map<Integer, ApplicationSignUp> applicationSignUpMap = applicationIdToApplicationSignUpsMap.get(applicationId);
+ if(applicationSignUpMap == null) {
+ applicationSignUpMap = new HashMap<Integer, ApplicationSignUp>();
+ applicationIdToApplicationSignUpsMap.put(applicationId, applicationSignUpMap);
+ }
+
+ int tenantId = applicationSignUp.getTenantId();
+ if(applicationSignUpMap.get(tenantId) == null) {
+ applicationSignUpMap.put(tenantId, applicationSignUp);
+ }
+ }
+
+ public Collection<ApplicationSignUp> getApplicationSignUps(String applicationId) {
+ Map<Integer, ApplicationSignUp> applicationSignUpMap = applicationIdToApplicationSignUpsMap.get(applicationId);
+ if(applicationSignUpMap != null) {
+ return applicationSignUpMap.values();
+ }
+ return null;
+ }
+
+ public ApplicationSignUp getApplicationSignUp(String applicationId, int tenantId) {
+ Map<Integer, ApplicationSignUp> applicationSignUpMap = applicationIdToApplicationSignUpsMap.get(applicationId);
+ if(applicationSignUpMap != null) {
+ if(applicationSignUpMap.containsKey(tenantId)) {
+ return applicationSignUpMap.get(tenantId);
+ }
+ }
+ return null;
+ }
+
+ public void removeApplicationSignUp(String applicationId, int tenantId) {
+ Map<Integer, ApplicationSignUp> applicationSignUpMap = applicationIdToApplicationSignUpsMap.get(applicationId);
+ if(applicationSignUpMap != null) {
+ if(applicationSignUpMap.containsKey(tenantId)) {
+ applicationSignUpMap.remove(tenantId);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
index eee8152..d173900 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/util/Util.java
@@ -64,6 +64,7 @@ public class Util {
INSTANCE_STATUS_TOPIC("instance/status/#"),
INSTANCE_NOTIFIER_TOPIC("instance/notifier/#"),
APPLICATIONS_TOPIC("applications/#"),
+ APPLICATION_SIGNUPS_TOPIC("application-signups/#"),
CLUSTER_STATUS_TOPIC("cluster/status/#"),
TENANT_TOPIC("tenant/#"),
DOMAIN_MAPPING_TOPIC("domain/mappings/#");
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index fbe747f..96c7f49 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -49,7 +49,7 @@ import org.apache.stratos.common.beans.topology.GroupInstanceBean;
import org.apache.stratos.common.client.AutoscalerServiceClient;
import org.apache.stratos.common.client.CloudControllerServiceClient;
import org.apache.stratos.common.client.StratosManagerServiceClient;
-import org.apache.stratos.manager.service.stub.domain.ApplicationSignUp;
+import org.apache.stratos.manager.service.stub.domain.application.signup.ApplicationSignUp;
import org.apache.stratos.manager.utils.ApplicationManagementUtil;
import org.apache.stratos.manager.utils.CartridgeConstants;
import org.apache.stratos.messaging.domain.application.Application;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
index 997616d..0b806f1 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
@@ -48,8 +48,8 @@ import org.apache.stratos.common.beans.subscription.domain.SubscriptionDomainBea
import org.apache.stratos.common.beans.topology.*;
import org.apache.stratos.common.util.CommonUtil;
import org.apache.stratos.common.beans.DependencyDefinitions;
-import org.apache.stratos.manager.service.stub.domain.ApplicationSignUp;
-import org.apache.stratos.manager.service.stub.domain.ArtifactRepository;
+import org.apache.stratos.manager.service.stub.domain.application.signup.ApplicationSignUp;
+import org.apache.stratos.manager.service.stub.domain.application.signup.ArtifactRepository;
import org.apache.stratos.messaging.domain.application.Application;
import org.apache.stratos.messaging.domain.application.Group;
import org.apache.stratos.messaging.domain.instance.ApplicationInstance;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/service-stubs/org.apache.stratos.manager.service.stub/pom.xml
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.manager.service.stub/pom.xml b/service-stubs/org.apache.stratos.manager.service.stub/pom.xml
index 35af795..85b3941 100644
--- a/service-stubs/org.apache.stratos.manager.service.stub/pom.xml
+++ b/service-stubs/org.apache.stratos.manager.service.stub/pom.xml
@@ -51,7 +51,7 @@
<pathelement location="${settings.localRepository}/org/apache/axis2/wso2/axis2/${axis2.wso2.version}/axis2-${axis2.wso2.version}.jar" />
</path>
<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
- <arg line="-uri src/main/resources/StratosManagerService.wsdl -u -uw -o target/generated-code -p org.apache.stratos.manager.service.stub -ns2p http://impl.services.manager.stratos.apache.org=org.apache.stratos.manager.service.stub.impl,http://domain.manager.stratos.apache.org/xsd=org.apache.stratos.manager.service.stub.domain,http://exception.manager.stratos.apache.org/xsd=org.apache.stratos.manager.service.stub.exceptions" />
+ <arg line="-uri src/main/resources/StratosManagerService.wsdl -u -uw -o target/generated-code -p org.apache.stratos.manager.service.stub -ns2p http://impl.services.manager.stratos.apache.org=org.apache.stratos.manager.service.stub.impl,http://domain.manager.stratos.apache.org/xsd=org.apache.stratos.manager.service.stub.domain,http://exception.manager.stratos.apache.org/xsd=org.apache.stratos.manager.service.stub.exceptions,http://signup.application.domain.messaging.stratos.apache.org/xsd=org.apache.stratos.manager.service.stub.domain.application.signup,http://mapping.domain.domain.messaging.stratos.apache.org/xsd=org.apache.stratos.manager.service.stub.domain.domain.mapping" />
<classpath refid="wsdl2java.classpath" />
<classpath refid="maven.dependency.classpath" />
<classpath refid="maven.compile.classpath" />
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl b/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
index 92f23d8..9a88246 100644
--- a/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
+++ b/service-stubs/org.apache.stratos.manager.service.stub/src/main/resources/StratosManagerService.wsdl
@@ -1,18 +1,6 @@
-<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://impl.services.manager.stratos.apache.org" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax23="http://domain.manager.stratos.apache.org/xsd" xmlns:ax24="http://mapping.domain.domain.messaging.stratos.apache.org/xsd" xmlns:ax21="http://exception.manager.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.manager.stratos.apache.org">
+<?xml version="1.0" encoding="UTF-8"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://impl.services.manager.stratos.apache.org" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax23="http://signup.application.domain.messaging.stratos.apache.org/xsd" xmlns:ax24="http://mapping.domain.domain.messaging.stratos.apache.org/xsd" xmlns:ax21="http://exception.manager.stratos.apache.org/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://impl.services.manager.stratos.apache.org">
<wsdl:types>
- <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://mapping.domain.domain.messaging.stratos.apache.org/xsd">
- <xs:complexType name="DomainMapping">
- <xs:sequence>
- <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="contextPath" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="domainName" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
- <xs:element minOccurs="0" name="tenantId" type="xs:int"/>
- </xs:sequence>
- </xs:complexType>
- </xs:schema>
- <xs:schema xmlns:ax25="http://mapping.domain.domain.messaging.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://domain.manager.stratos.apache.org/xsd">
+ <xs:schema xmlns:ax25="http://mapping.domain.domain.messaging.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://signup.application.domain.messaging.stratos.apache.org/xsd">
<xs:import namespace="http://mapping.domain.domain.messaging.stratos.apache.org/xsd"/>
<xs:complexType name="ApplicationSignUp">
<xs:sequence>
@@ -33,9 +21,21 @@
</xs:sequence>
</xs:complexType>
</xs:schema>
- <xs:schema xmlns:ax27="http://mapping.domain.domain.messaging.stratos.apache.org/xsd" xmlns:ax26="http://domain.manager.stratos.apache.org/xsd" xmlns:ax22="http://exception.manager.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.manager.stratos.apache.org">
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://mapping.domain.domain.messaging.stratos.apache.org/xsd">
+ <xs:complexType name="DomainMapping">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="applicationId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="clusterId" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="contextPath" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="domainName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
+ <xs:element minOccurs="0" name="tenantId" type="xs:int"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ <xs:schema xmlns:ax27="http://mapping.domain.domain.messaging.stratos.apache.org/xsd" xmlns:ax26="http://signup.application.domain.messaging.stratos.apache.org/xsd" xmlns:ax22="http://exception.manager.stratos.apache.org/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.services.manager.stratos.apache.org">
<xs:import namespace="http://exception.manager.stratos.apache.org/xsd"/>
- <xs:import namespace="http://domain.manager.stratos.apache.org/xsd"/>
+ <xs:import namespace="http://signup.application.domain.messaging.stratos.apache.org/xsd"/>
<xs:import namespace="http://mapping.domain.domain.messaging.stratos.apache.org/xsd"/>
<xs:element name="StratosManagerServiceApplicationSignUpException">
<xs:complexType>
[2/2] stratos git commit: Implementing application signup messaging
events, listeners, processors, receiver and manager
Posted by im...@apache.org.
Implementing application signup messaging events, listeners, processors, receiver and manager
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/5fcfdac1
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/5fcfdac1
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/5fcfdac1
Branch: refs/heads/master
Commit: 5fcfdac1b8981b54c07f999cf4aefd2793f88b2a
Parents: c65438a
Author: Imesh Gunaratne <im...@apache.org>
Authored: Sat Jan 10 01:29:49 2015 +0530
Committer: Imesh Gunaratne <im...@apache.org>
Committed: Sat Jan 10 01:29:49 2015 +0530
----------------------------------------------------------------------
.../services/impl/AutoScalerServiceImpl.java | 4 +-
.../client/StratosManagerServiceClient.java | 2 +-
.../components/ApplicationSignUpHandler.java | 4 +-
.../ArtifactDistributionCoordinator.java | 4 +-
.../components/DomainMappingHandler.java | 2 +-
.../manager/domain/ApplicationSignUp.java | 69 ----------
.../manager/domain/ArtifactRepository.java | 82 ------------
...ratosManagerInstanceStatusEventReceiver.java | 2 +-
.../manager/services/StratosManagerService.java | 4 +-
.../impl/StratosManagerServiceImpl.java | 4 +-
.../application/signup/ApplicationSignUp.java | 69 ++++++++++
.../application/signup/ArtifactRepository.java | 82 ++++++++++++
.../application/ApplicationCreatedEvent.java | 1 +
.../signup/ApplicationSignUpAddedEvent.java | 47 +++++++
.../signup/ApplicationSignUpRemovedEvent.java | 39 ++++++
.../signup/CompleteApplicationSignUpsEvent.java | 40 ++++++
.../ApplicationSignUpAddedEventListener.java | 28 ++++
.../ApplicationSignUpRemovedEventListener.java | 28 ++++
...CompleteApplicationSignUpsEventListener.java | 28 ++++
.../ApplicationSignUpAddedMessageProcessor.java | 43 ++++++
.../ApplicationSignUpMessageProcessorChain.java | 66 +++++++++
...pplicationSignUpRemovedMessageProcessor.java | 38 ++++++
...pleteApplicationSignUpsMessageProcessor.java | 38 ++++++
.../DomainMappingAddedMessageProcessor.java | 119 ++++++++++++++++
.../DomainMappingMessageProcessorChain.java | 8 +-
.../DomainMappingRemovedMessageProcessor.java | 132 ++++++++++++++++++
.../DomainNameAddedMessageProcessor.java | 119 ----------------
.../DomainNameRemovedMessageProcessor.java | 131 ------------------
.../ApplicationSignUpEventMessageDelegator.java | 93 +++++++++++++
.../ApplicationSignUpEventMessageListener.java | 54 ++++++++
.../ApplicationSignUpEventMessageQueue.java | 30 +++++
.../signup/ApplicationSignUpEventReceiver.java | 91 +++++++++++++
.../signup/ApplicationSignUpManager.java | 134 +++++++++++++++++++
.../org/apache/stratos/messaging/util/Util.java | 1 +
.../rest/endpoint/api/StratosApiV41Utils.java | 2 +-
.../util/converter/ObjectConverter.java | 4 +-
.../pom.xml | 2 +-
.../main/resources/StratosManagerService.wsdl | 32 ++---
38 files changed, 1236 insertions(+), 440 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoScalerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoScalerServiceImpl.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoScalerServiceImpl.java
index 8029425..733e38f 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoScalerServiceImpl.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/services/impl/AutoScalerServiceImpl.java
@@ -51,8 +51,8 @@ import org.apache.stratos.autoscaler.util.AutoscalerUtil;
import org.apache.stratos.common.Properties;
import org.apache.stratos.common.Property;
import org.apache.stratos.common.client.StratosManagerServiceClient;
-import org.apache.stratos.manager.service.stub.domain.ApplicationSignUp;
-import org.apache.stratos.manager.service.stub.domain.ArtifactRepository;
+import org.apache.stratos.manager.service.stub.domain.application.signup.ApplicationSignUp;
+import org.apache.stratos.manager.service.stub.domain.application.signup.ArtifactRepository;
import org.apache.stratos.messaging.domain.application.Application;
import org.apache.stratos.messaging.domain.application.ClusterDataHolder;
import org.apache.stratos.messaging.domain.application.Group;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java
index f36d6a9..d8c4a9a 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/client/StratosManagerServiceClient.java
@@ -28,7 +28,7 @@ import org.apache.stratos.common.constants.StratosConstants;
import org.apache.stratos.manager.service.stub.StratosManagerServiceApplicationSignUpExceptionException;
import org.apache.stratos.manager.service.stub.StratosManagerServiceArtifactDistributionCoordinatorExceptionException;
import org.apache.stratos.manager.service.stub.StratosManagerServiceStub;
-import org.apache.stratos.manager.service.stub.domain.ApplicationSignUp;
+import org.apache.stratos.manager.service.stub.domain.application.signup.ApplicationSignUp;
import java.rmi.RemoteException;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java
index a16420a..4f3b63f 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ApplicationSignUpHandler.java
@@ -23,8 +23,8 @@ import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.stratos.common.util.CommonUtil;
-import org.apache.stratos.manager.domain.ApplicationSignUp;
-import org.apache.stratos.manager.domain.ArtifactRepository;
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
+import org.apache.stratos.messaging.domain.application.signup.ArtifactRepository;
import org.apache.stratos.manager.exception.ApplicationSignUpException;
import org.apache.stratos.manager.registry.RegistryManager;
import org.apache.stratos.messaging.domain.application.Application;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java
index 1851cad..c96627b 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/ArtifactDistributionCoordinator.java
@@ -22,8 +22,8 @@ package org.apache.stratos.manager.components;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.manager.domain.ApplicationSignUp;
-import org.apache.stratos.manager.domain.ArtifactRepository;
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
+import org.apache.stratos.messaging.domain.application.signup.ArtifactRepository;
import org.apache.stratos.manager.exception.ArtifactDistributionCoordinatorException;
import org.apache.stratos.manager.messaging.publisher.InstanceNotificationPublisher;
import org.apache.stratos.messaging.domain.application.Application;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/DomainMappingHandler.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/DomainMappingHandler.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/DomainMappingHandler.java
index 83fd4b0..3aaf014 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/DomainMappingHandler.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/components/DomainMappingHandler.java
@@ -21,7 +21,7 @@ package org.apache.stratos.manager.components;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.manager.domain.ApplicationSignUp;
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
import org.apache.stratos.manager.exception.DomainMappingException;
import org.apache.stratos.manager.messaging.publisher.DomainMappingEventPublisher;
import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/ApplicationSignUp.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/ApplicationSignUp.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/ApplicationSignUp.java
deleted file mode 100644
index dbb836e..0000000
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/ApplicationSignUp.java
+++ /dev/null
@@ -1,69 +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.manager.domain;
-
-import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
-
-import java.io.Serializable;
-
-/**
- * Application signup.
- */
-public class ApplicationSignUp implements Serializable {
-
- private static final long serialVersionUID = -3055522170914869018L;
-
- private int tenantId;
- private String applicationId;
- private ArtifactRepository[] artifactRepositories;
- private DomainMapping[] domainMappings;
-
- public int getTenantId() {
- return tenantId;
- }
-
- public void setTenantId(int tenantId) {
- this.tenantId = tenantId;
- }
-
- public String getApplicationId() {
- return applicationId;
- }
-
- public void setApplicationId(String applicationId) {
- this.applicationId = applicationId;
- }
-
- public ArtifactRepository[] getArtifactRepositories() {
- return artifactRepositories;
- }
-
- public void setArtifactRepositories(ArtifactRepository[] artifactRepositories) {
- this.artifactRepositories = artifactRepositories;
- }
-
- public DomainMapping[] getDomainMappings() {
- return domainMappings;
- }
-
- public void setDomainMappings(DomainMapping[] domainMappings) {
- this.domainMappings = domainMappings;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/ArtifactRepository.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/ArtifactRepository.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/ArtifactRepository.java
deleted file mode 100644
index c9af4a0..0000000
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/domain/ArtifactRepository.java
+++ /dev/null
@@ -1,82 +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.manager.domain;
-
-import java.io.Serializable;
-
-public class ArtifactRepository implements Serializable {
-
- private static final long serialVersionUID = -5473975963401915533L;
-
- private String cartridgeType;
- private String alias;
- private boolean privateRepo;
- private String repoUrl;
- private String repoUsername;
- private String repoPassword;
-
- public String getCartridgeType() {
- return cartridgeType;
- }
-
- public void setCartridgeType(String cartridgeType) {
- this.cartridgeType = cartridgeType;
- }
-
- public String getAlias() {
- return alias;
- }
-
- public void setAlias(String alias) {
- this.alias = alias;
- }
-
- public boolean isPrivateRepo() {
- return privateRepo;
- }
-
- public void setPrivateRepo(boolean privateRepo) {
- this.privateRepo = privateRepo;
- }
-
- public String getRepoUrl() {
- return repoUrl;
- }
-
- public void setRepoUrl(String repoUrl) {
- this.repoUrl = repoUrl;
- }
-
- public String getRepoUsername() {
- return repoUsername;
- }
-
- public void setRepoUsername(String repoUsername) {
- this.repoUsername = repoUsername;
- }
-
- public String getRepoPassword() {
- return repoPassword;
- }
-
- public void setRepoPassword(String repoPassword) {
- this.repoPassword = repoPassword;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/messaging/receiver/StratosManagerInstanceStatusEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/messaging/receiver/StratosManagerInstanceStatusEventReceiver.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/messaging/receiver/StratosManagerInstanceStatusEventReceiver.java
index 365661d..4f30258 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/messaging/receiver/StratosManagerInstanceStatusEventReceiver.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/messaging/receiver/StratosManagerInstanceStatusEventReceiver.java
@@ -25,7 +25,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.autoscaler.stub.pojo.*;
import org.apache.stratos.manager.components.ApplicationSignUpHandler;
import org.apache.stratos.manager.components.ArtifactDistributionCoordinator;
-import org.apache.stratos.manager.domain.ApplicationSignUp;
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
import org.apache.stratos.messaging.event.Event;
import org.apache.stratos.messaging.event.instance.status.InstanceStartedEvent;
import org.apache.stratos.messaging.listener.instance.status.InstanceStartedEventListener;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/StratosManagerService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/StratosManagerService.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/StratosManagerService.java
index d9e92ea..dd55324 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/StratosManagerService.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/StratosManagerService.java
@@ -19,14 +19,12 @@
package org.apache.stratos.manager.services;
-import org.apache.stratos.manager.domain.ApplicationSignUp;
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
import org.apache.stratos.manager.exception.ApplicationSignUpException;
import org.apache.stratos.manager.exception.ArtifactDistributionCoordinatorException;
import org.apache.stratos.manager.exception.DomainMappingException;
import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
-import java.util.List;
-
/**
* Stratos manager service interface.
*/
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/impl/StratosManagerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/impl/StratosManagerServiceImpl.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/impl/StratosManagerServiceImpl.java
index f037d6e..36d127d 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/impl/StratosManagerServiceImpl.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/services/impl/StratosManagerServiceImpl.java
@@ -24,15 +24,13 @@ import org.apache.commons.logging.LogFactory;
import org.apache.stratos.manager.components.ApplicationSignUpHandler;
import org.apache.stratos.manager.components.ArtifactDistributionCoordinator;
import org.apache.stratos.manager.components.DomainMappingHandler;
-import org.apache.stratos.manager.domain.ApplicationSignUp;
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
import org.apache.stratos.manager.exception.ApplicationSignUpException;
import org.apache.stratos.manager.exception.ArtifactDistributionCoordinatorException;
import org.apache.stratos.manager.exception.DomainMappingException;
import org.apache.stratos.manager.services.StratosManagerService;
import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
-import java.util.List;
-
/**
* Stratos manager service implementation.
*/
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java
new file mode 100644
index 0000000..5b195b1
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ApplicationSignUp.java
@@ -0,0 +1,69 @@
+/*
+ * 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.domain.application.signup;
+
+import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
+
+import java.io.Serializable;
+
+/**
+ * Application signup.
+ */
+public class ApplicationSignUp implements Serializable {
+
+ private static final long serialVersionUID = -3055522170914869018L;
+
+ private int tenantId;
+ private String applicationId;
+ private ArtifactRepository[] artifactRepositories;
+ private DomainMapping[] domainMappings;
+
+ public int getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(int tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getApplicationId() {
+ return applicationId;
+ }
+
+ public void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ public ArtifactRepository[] getArtifactRepositories() {
+ return artifactRepositories;
+ }
+
+ public void setArtifactRepositories(ArtifactRepository[] artifactRepositories) {
+ this.artifactRepositories = artifactRepositories;
+ }
+
+ public DomainMapping[] getDomainMappings() {
+ return domainMappings;
+ }
+
+ public void setDomainMappings(DomainMapping[] domainMappings) {
+ this.domainMappings = domainMappings;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ArtifactRepository.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ArtifactRepository.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ArtifactRepository.java
new file mode 100644
index 0000000..8c739e6
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/application/signup/ArtifactRepository.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.messaging.domain.application.signup;
+
+import java.io.Serializable;
+
+public class ArtifactRepository implements Serializable {
+
+ private static final long serialVersionUID = -5473975963401915533L;
+
+ private String cartridgeType;
+ private String alias;
+ private boolean privateRepo;
+ private String repoUrl;
+ private String repoUsername;
+ private String repoPassword;
+
+ public String getCartridgeType() {
+ return cartridgeType;
+ }
+
+ public void setCartridgeType(String cartridgeType) {
+ this.cartridgeType = cartridgeType;
+ }
+
+ public String getAlias() {
+ return alias;
+ }
+
+ public void setAlias(String alias) {
+ this.alias = alias;
+ }
+
+ public boolean isPrivateRepo() {
+ return privateRepo;
+ }
+
+ public void setPrivateRepo(boolean privateRepo) {
+ this.privateRepo = privateRepo;
+ }
+
+ public String getRepoUrl() {
+ return repoUrl;
+ }
+
+ public void setRepoUrl(String repoUrl) {
+ this.repoUrl = repoUrl;
+ }
+
+ public String getRepoUsername() {
+ return repoUsername;
+ }
+
+ public void setRepoUsername(String repoUsername) {
+ this.repoUsername = repoUsername;
+ }
+
+ public String getRepoPassword() {
+ return repoPassword;
+ }
+
+ public void setRepoPassword(String repoPassword) {
+ this.repoPassword = repoPassword;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/ApplicationCreatedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/ApplicationCreatedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/ApplicationCreatedEvent.java
index 8ea410f..d634619 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/ApplicationCreatedEvent.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/ApplicationCreatedEvent.java
@@ -27,6 +27,7 @@ import java.io.Serializable;
* This event will be fired upon the application created is detected.
*/
public class ApplicationCreatedEvent extends Event implements Serializable {
+
private static final long serialVersionUID = 2625412714611885089L;
private Application application;
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/ApplicationSignUpAddedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/ApplicationSignUpAddedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/ApplicationSignUpAddedEvent.java
new file mode 100644
index 0000000..77d92f6
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/ApplicationSignUpAddedEvent.java
@@ -0,0 +1,47 @@
+/*
+ * 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.signup;
+
+import org.apache.stratos.messaging.domain.application.signup.ArtifactRepository;
+import org.apache.stratos.messaging.event.Event;
+import java.io.Serializable;
+
+/**
+ * Application signup added event.
+ */
+public class ApplicationSignUpAddedEvent extends Event implements Serializable {
+
+ private final String applicationId;
+ private final int tenantId;
+ private ArtifactRepository[] artifactRepositories;
+
+ public ApplicationSignUpAddedEvent(String applicationId, int tenantId) {
+ this.applicationId = applicationId;
+ this.tenantId = tenantId;
+ }
+
+ public ArtifactRepository[] getArtifactRepositories() {
+ return artifactRepositories;
+ }
+
+ public void setArtifactRepositories(ArtifactRepository[] artifactRepositories) {
+ this.artifactRepositories = artifactRepositories;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/ApplicationSignUpRemovedEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/ApplicationSignUpRemovedEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/ApplicationSignUpRemovedEvent.java
new file mode 100644
index 0000000..38dbb9b
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/ApplicationSignUpRemovedEvent.java
@@ -0,0 +1,39 @@
+/*
+ * 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.signup;
+
+import org.apache.stratos.messaging.event.Event;
+import java.io.Serializable;
+
+/**
+ * Application signup removed event.
+ */
+public class ApplicationSignUpRemovedEvent extends Event implements Serializable {
+
+ private static final long serialVersionUID = -8023701025057783621L;
+
+ private final String applicationId;
+ private final int tenantId;
+
+ public ApplicationSignUpRemovedEvent(String applicationId, int tenantId) {
+ this.applicationId = applicationId;
+ this.tenantId = tenantId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/CompleteApplicationSignUpsEvent.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/CompleteApplicationSignUpsEvent.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/CompleteApplicationSignUpsEvent.java
new file mode 100644
index 0000000..2c1511d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/event/application/signup/CompleteApplicationSignUpsEvent.java
@@ -0,0 +1,40 @@
+/*
+ * 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.signup;
+
+import org.apache.stratos.messaging.domain.application.signup.ApplicationSignUp;
+import org.apache.stratos.messaging.event.Event;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Complete application signup event.
+ */
+public class CompleteApplicationSignUpsEvent extends Event implements Serializable {
+
+ private static final long serialVersionUID = 417310788611446084L;
+
+ private final List<ApplicationSignUp> applicationSignUps;
+
+ public CompleteApplicationSignUpsEvent(List<ApplicationSignUp> applicationSignUps) {
+ this.applicationSignUps = applicationSignUps;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/ApplicationSignUpAddedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/ApplicationSignUpAddedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/ApplicationSignUpAddedEventListener.java
new file mode 100644
index 0000000..56578af
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/ApplicationSignUpAddedEventListener.java
@@ -0,0 +1,28 @@
+/*
+ * 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.signup;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+/**
+ * Application signup added event listener.
+ */
+public abstract class ApplicationSignUpAddedEventListener extends EventListener {
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/ApplicationSignUpRemovedEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/ApplicationSignUpRemovedEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/ApplicationSignUpRemovedEventListener.java
new file mode 100644
index 0000000..f9c325a
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/ApplicationSignUpRemovedEventListener.java
@@ -0,0 +1,28 @@
+/*
+ * 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.signup;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+/**
+ * Application signup removed event listener.
+ */
+public abstract class ApplicationSignUpRemovedEventListener extends EventListener {
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/CompleteApplicationSignUpsEventListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/CompleteApplicationSignUpsEventListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/CompleteApplicationSignUpsEventListener.java
new file mode 100644
index 0000000..12b4ddb
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/listener/application/signup/CompleteApplicationSignUpsEventListener.java
@@ -0,0 +1,28 @@
+/*
+ * 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.signup;
+
+import org.apache.stratos.messaging.listener.EventListener;
+
+/**
+ * Complete application signups event listener.
+ */
+public abstract class CompleteApplicationSignUpsEventListener extends EventListener {
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpAddedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpAddedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpAddedMessageProcessor.java
new file mode 100644
index 0000000..143c9b3
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpAddedMessageProcessor.java
@@ -0,0 +1,43 @@
+/*
+ * 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.signup;
+
+import org.apache.stratos.messaging.event.application.signup.ApplicationSignUpAddedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+
+/**
+ * Application signup added message processor.
+ */
+public class ApplicationSignUpAddedMessageProcessor extends MessageProcessor {
+
+ @Override
+ public void setNext(MessageProcessor nextProcessor) {
+
+ }
+
+ @Override
+ public boolean process(String type, String message, Object object) {
+
+ if(type.equals(ApplicationSignUpAddedEvent.class.getName())) {
+
+ }
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpMessageProcessorChain.java
new file mode 100644
index 0000000..99c1b6d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpMessageProcessorChain.java
@@ -0,0 +1,66 @@
+/*
+ * 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.signup;
+
+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.signup.CompleteApplicationSignUpsEventListener;
+import org.apache.stratos.messaging.listener.domain.mapping.DomainMappingAddedEventListener;
+import org.apache.stratos.messaging.listener.domain.mapping.DomainMappingRemovedEventListener;
+import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
+
+/**
+ * Application signup message processor chain.
+ */
+public class ApplicationSignUpMessageProcessorChain extends MessageProcessorChain {
+
+ private static final Log log = LogFactory.getLog(ApplicationSignUpMessageProcessorChain.class);
+
+ private CompleteApplicationSignUpsMessageProcessor completeApplicationSignUpsMessageProcessor;
+ private ApplicationSignUpAddedMessageProcessor domainNameAddedMessageProcessor;
+ private ApplicationSignUpRemovedMessageProcessor domainNameRemovedMessageProcessor;
+
+ @Override
+ protected void initialize() {
+ completeApplicationSignUpsMessageProcessor = new CompleteApplicationSignUpsMessageProcessor();
+ add(completeApplicationSignUpsMessageProcessor);
+
+ domainNameAddedMessageProcessor = new ApplicationSignUpAddedMessageProcessor();
+ add(domainNameAddedMessageProcessor);
+
+ domainNameRemovedMessageProcessor = new ApplicationSignUpRemovedMessageProcessor();
+ add(domainNameRemovedMessageProcessor);
+ }
+
+ @Override
+ public void addEventListener(EventListener eventListener) {
+ if (eventListener instanceof CompleteApplicationSignUpsEventListener) {
+ completeApplicationSignUpsMessageProcessor.addEventListener(eventListener);
+ } else if (eventListener instanceof DomainMappingAddedEventListener) {
+ domainNameAddedMessageProcessor.addEventListener(eventListener);
+ } else if (eventListener instanceof DomainMappingRemovedEventListener) {
+ domainNameRemovedMessageProcessor.addEventListener(eventListener);
+ }
+ else {
+ throw new RuntimeException("Unknown event listener");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpRemovedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpRemovedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpRemovedMessageProcessor.java
new file mode 100644
index 0000000..0d0658b
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/ApplicationSignUpRemovedMessageProcessor.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.message.processor.application.signup;
+
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+
+/**
+ * Application signup removed message processor.
+ */
+public class ApplicationSignUpRemovedMessageProcessor 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/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/CompleteApplicationSignUpsMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/CompleteApplicationSignUpsMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/CompleteApplicationSignUpsMessageProcessor.java
new file mode 100644
index 0000000..ce62399
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/application/signup/CompleteApplicationSignUpsMessageProcessor.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.message.processor.application.signup;
+
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+
+/**
+ * Complete application signups message processor.
+ */
+public class CompleteApplicationSignUpsMessageProcessor 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/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingAddedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingAddedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingAddedMessageProcessor.java
new file mode 100644
index 0000000..4ae0a95
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingAddedMessageProcessor.java
@@ -0,0 +1,119 @@
+/*
+ * 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.domain.mapping;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.application.Application;
+import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
+import org.apache.stratos.messaging.domain.tenant.Tenant;
+import org.apache.stratos.messaging.event.domain.mapping.DomainMappingAddedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
+import org.apache.stratos.messaging.message.receiver.domain.mapping.DomainMappingManager;
+import org.apache.stratos.messaging.message.receiver.tenant.TenantManager;
+import org.apache.stratos.messaging.util.Util;
+
+/**
+ * Url mapping added message processor.
+ */
+public class DomainMappingAddedMessageProcessor extends MessageProcessor {
+
+ private static final Log log = LogFactory.getLog(DomainMappingAddedMessageProcessor.class);
+
+ private MessageProcessor nextProcessor;
+
+ @Override
+ public void setNext(MessageProcessor nextProcessor) {
+ this.nextProcessor = nextProcessor;
+ }
+
+ @Override
+ public boolean process(String type, String message, Object object) {
+ if (DomainMappingAddedEvent.class.getName().equals(type)) {
+
+ // Return if domain mapping manager has not initialized
+ if (!DomainMappingManager.getInstance().isInitialized()) {
+ return false;
+ }
+
+ // Parse complete message and build event
+ DomainMappingAddedEvent event = (DomainMappingAddedEvent) Util.jsonToObject(message, DomainMappingAddedEvent.class);
+
+ int tenantId = event.getTenantId();
+ String applicationId = event.getApplicationId();
+
+ try {
+ TenantManager.acquireReadLock();
+ Tenant tenant = TenantManager.getInstance().getTenant(tenantId);
+ if (tenant == null) {
+ if (log.isWarnEnabled()) {
+ log.warn(String.format("Tenant not found: [tenant-id] %d", tenantId));
+ }
+ return false;
+ }
+
+ ApplicationManager.acquireReadLockForApplication(applicationId);
+ Application application = ApplicationManager.getApplications().getApplication(applicationId);
+ if (application == null) {
+ if (log.isWarnEnabled()) {
+ log.warn(String.format("Application not found: [application-id] %d", applicationId));
+ }
+ return false;
+ }
+
+ try {
+ DomainMappingManager.acquireWriteLock();
+ DomainMapping domainMapping = new DomainMapping(event.getTenantId(), event.getApplicationId(),
+ event.getServiceName(), event.getClusterId(), event.getDomainName(), event.getContextPath());
+ DomainMappingManager.getInstance().addDomainMapping(domainMapping);
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Domain mapping added: [application-id] %s [cluster-id] %s " +
+ "[domain-name]", event.getApplicationId(), event.getClusterId(), event.getDomainName()));
+ }
+
+ // Notify event listeners
+ notifyEventListeners(event);
+ return true;
+ } catch (Exception e) {
+ String error = String.format("Could not add domain mapping: [application-id] %s [cluster-id] %s " +
+ "[domain-name]", event.getApplicationId(), event.getClusterId(), event.getDomainName());
+ log.error(error, e);
+ return false;
+ } finally {
+ DomainMappingManager.releaseWriteLock();
+ }
+ }
+ finally {
+ ApplicationManager.releaseReadLockForApplication(applicationId);
+ TenantManager.releaseReadLock();
+ }
+ }
+ else {
+ if (nextProcessor != null) {
+ return nextProcessor.process(type, message, object);
+ } else {
+ throw new RuntimeException(String.format("Failed to process domain mapping using available " +
+ "message processors: [type] %s [body] %s", type, message));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingMessageProcessorChain.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingMessageProcessorChain.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingMessageProcessorChain.java
index 75a14bd..784f5e2 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingMessageProcessorChain.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingMessageProcessorChain.java
@@ -33,15 +33,15 @@ public class DomainMappingMessageProcessorChain extends MessageProcessorChain {
private static final Log log = LogFactory.getLog(DomainMappingMessageProcessorChain.class);
- private DomainNameAddedMessageProcessor domainNameAddedMessageProcessor;
- private DomainNameRemovedMessageProcessor domainNameRemovedMessageProcessor;
+ private DomainMappingAddedMessageProcessor domainNameAddedMessageProcessor;
+ private DomainMappingRemovedMessageProcessor domainNameRemovedMessageProcessor;
@Override
protected void initialize() {
- domainNameAddedMessageProcessor = new DomainNameAddedMessageProcessor();
+ domainNameAddedMessageProcessor = new DomainMappingAddedMessageProcessor();
add(domainNameAddedMessageProcessor);
- domainNameRemovedMessageProcessor = new DomainNameRemovedMessageProcessor();
+ domainNameRemovedMessageProcessor = new DomainMappingRemovedMessageProcessor();
add(domainNameRemovedMessageProcessor);
}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingRemovedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingRemovedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingRemovedMessageProcessor.java
new file mode 100644
index 0000000..1a382d5
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainMappingRemovedMessageProcessor.java
@@ -0,0 +1,132 @@
+/*
+ * 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.domain.mapping;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.application.Application;
+import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
+import org.apache.stratos.messaging.domain.tenant.Tenant;
+import org.apache.stratos.messaging.event.domain.mapping.DomainMappingRemovedEvent;
+import org.apache.stratos.messaging.message.processor.MessageProcessor;
+import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
+import org.apache.stratos.messaging.message.receiver.domain.mapping.DomainMappingManager;
+import org.apache.stratos.messaging.message.receiver.tenant.TenantManager;
+import org.apache.stratos.messaging.util.Util;
+
+/**
+ * Subscription domain removed message processor for removing domains from tenant subscriptions.
+ */
+public class DomainMappingRemovedMessageProcessor extends MessageProcessor {
+
+ private static final Log log = LogFactory.getLog(DomainMappingRemovedMessageProcessor.class);
+
+ private MessageProcessor nextProcessor;
+
+ @Override
+ public void setNext(MessageProcessor nextProcessor) {
+ this.nextProcessor = nextProcessor;
+ }
+
+ @Override
+ public boolean process(String type, String message, Object object) {
+
+ if (DomainMappingRemovedEvent.class.getName().equals(type)) {
+
+ // Return if domain mapping manager has not initialized
+ if (!DomainMappingManager.getInstance().isInitialized()) {
+ return false;
+ }
+
+ // Parse complete message and build event
+ DomainMappingRemovedEvent event = (DomainMappingRemovedEvent) Util.jsonToObject(message, DomainMappingRemovedEvent.class);
+
+ int tenantId = event.getTenantId();
+ String applicationId = event.getApplicationId();
+
+ try {
+ TenantManager.acquireWriteLock();
+ Tenant tenant = TenantManager.getInstance().getTenant(tenantId);
+ if(tenant == null) {
+ if(log.isWarnEnabled()) {
+ log.warn(String.format("Tenant not found: [tenant-id] %d", event.getTenantId()));
+ }
+ return false;
+ }
+
+ ApplicationManager.acquireReadLockForApplication(applicationId);
+ Application application = ApplicationManager.getApplications().getApplication(applicationId);
+ if (application == null) {
+ if (log.isWarnEnabled()) {
+ log.warn(String.format("Application not found: [application-id] %d", applicationId));
+ }
+ return false;
+ }
+
+ try {
+ DomainMappingManager.acquireReadLock();
+ DomainMapping domainMapping = DomainMappingManager.getInstance().getDomainMapping(
+ event.getClusterId(), event.getDomainName());
+ if(domainMapping == null) {
+ if (log.isWarnEnabled()) {
+ log.warn(String.format("Domain mapping not found: [application-id] %s [cluster-id] %s " +
+ "[domain-name]", event.getApplicationId(), event.getClusterId(),
+ event.getDomainName()));
+ }
+ return false;
+ }
+ } finally {
+ DomainMappingManager.releaseReadLock();
+ }
+
+ try {
+ DomainMappingManager.acquireWriteLock();
+ DomainMappingManager.getInstance().removeDomainMapping(event.getClusterId(), event.getDomainName());
+
+ if (log.isInfoEnabled()) {
+ log.info(String.format("Domain mapping removed: [application-id] %s [cluster-id] %s [domain-name]",
+ event.getApplicationId(), event.getClusterId(), event.getDomainName()));
+ }
+
+ // Notify event listeners
+ notifyEventListeners(event);
+ return true;
+ } catch (Exception e) {
+ String error = String.format("Could not remove domain mapping: [application-id] %s [cluster-id] %s " +
+ "[domain-name]", event.getApplicationId(), event.getClusterId(), event.getDomainName());
+ log.error(error, e);
+ return false;
+ } finally {
+ DomainMappingManager.releaseWriteLock();
+ }
+ }
+ finally {
+ TenantManager.releaseWriteLock();
+ }
+ }
+ else {
+ if (nextProcessor != null) {
+ return nextProcessor.process(type, message, object);
+ } else {
+ throw new RuntimeException(String.format("Failed to process tenant message using available message processors: [type] %s [body] %s", type, message));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java
deleted file mode 100644
index c905cb0..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameAddedMessageProcessor.java
+++ /dev/null
@@ -1,119 +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.domain.mapping;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.application.Application;
-import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
-import org.apache.stratos.messaging.domain.tenant.Tenant;
-import org.apache.stratos.messaging.event.domain.mapping.DomainMappingAddedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
-import org.apache.stratos.messaging.message.receiver.domain.mapping.DomainMappingManager;
-import org.apache.stratos.messaging.message.receiver.tenant.TenantManager;
-import org.apache.stratos.messaging.util.Util;
-
-/**
- * Url mapping added message processor.
- */
-public class DomainNameAddedMessageProcessor extends MessageProcessor {
-
- private static final Log log = LogFactory.getLog(DomainNameAddedMessageProcessor.class);
-
- private MessageProcessor nextProcessor;
-
- @Override
- public void setNext(MessageProcessor nextProcessor) {
- this.nextProcessor = nextProcessor;
- }
-
- @Override
- public boolean process(String type, String message, Object object) {
- if (DomainMappingAddedEvent.class.getName().equals(type)) {
-
- // Return if domain mapping manager has not initialized
- if (!DomainMappingManager.getInstance().isInitialized()) {
- return false;
- }
-
- // Parse complete message and build event
- DomainMappingAddedEvent event = (DomainMappingAddedEvent) Util.jsonToObject(message, DomainMappingAddedEvent.class);
-
- int tenantId = event.getTenantId();
- String applicationId = event.getApplicationId();
-
- try {
- TenantManager.acquireReadLock();
- Tenant tenant = TenantManager.getInstance().getTenant(tenantId);
- if (tenant == null) {
- if (log.isWarnEnabled()) {
- log.warn(String.format("Tenant not found: [tenant-id] %d", tenantId));
- }
- return false;
- }
-
- ApplicationManager.acquireReadLockForApplication(applicationId);
- Application application = ApplicationManager.getApplications().getApplication(applicationId);
- if (application == null) {
- if (log.isWarnEnabled()) {
- log.warn(String.format("Application not found: [application-id] %d", applicationId));
- }
- return false;
- }
-
- try {
- DomainMappingManager.acquireWriteLock();
- DomainMapping domainMapping = new DomainMapping(event.getTenantId(), event.getApplicationId(),
- event.getServiceName(), event.getClusterId(), event.getDomainName(), event.getContextPath());
- DomainMappingManager.getInstance().addDomainMapping(domainMapping);
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Domain mapping added: [application-id] %s [cluster-id] %s " +
- "[domain-name]", event.getApplicationId(), event.getClusterId(), event.getDomainName()));
- }
-
- // Notify event listeners
- notifyEventListeners(event);
- return true;
- } catch (Exception e) {
- String error = String.format("Could not add domain mapping: [application-id] %s [cluster-id] %s " +
- "[domain-name]", event.getApplicationId(), event.getClusterId(), event.getDomainName());
- log.error(error, e);
- return false;
- } finally {
- DomainMappingManager.releaseWriteLock();
- }
- }
- finally {
- ApplicationManager.releaseReadLockForApplication(applicationId);
- TenantManager.releaseReadLock();
- }
- }
- else {
- if (nextProcessor != null) {
- return nextProcessor.process(type, message, object);
- } else {
- throw new RuntimeException(String.format("Failed to process domain mapping using available " +
- "message processors: [type] %s [body] %s", type, message));
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java
deleted file mode 100644
index 497104a..0000000
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/processor/domain/mapping/DomainNameRemovedMessageProcessor.java
+++ /dev/null
@@ -1,131 +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.domain.mapping;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stratos.messaging.domain.application.Application;
-import org.apache.stratos.messaging.domain.domain.mapping.DomainMapping;
-import org.apache.stratos.messaging.domain.tenant.Tenant;
-import org.apache.stratos.messaging.event.domain.mapping.DomainMappingRemovedEvent;
-import org.apache.stratos.messaging.message.processor.MessageProcessor;
-import org.apache.stratos.messaging.message.receiver.application.ApplicationManager;
-import org.apache.stratos.messaging.message.receiver.domain.mapping.DomainMappingManager;
-import org.apache.stratos.messaging.message.receiver.tenant.TenantManager;
-import org.apache.stratos.messaging.util.Util;
-
-/**
- * Subscription domain removed message processor for removing domains from tenant subscriptions.
- */
-public class DomainNameRemovedMessageProcessor extends MessageProcessor {
-
- private static final Log log = LogFactory.getLog(DomainNameRemovedMessageProcessor.class);
-
- private MessageProcessor nextProcessor;
-
- @Override
- public void setNext(MessageProcessor nextProcessor) {
- this.nextProcessor = nextProcessor;
- }
-
- @Override
- public boolean process(String type, String message, Object object) {
- if (DomainMappingRemovedEvent.class.getName().equals(type)) {
-
- // Return if domain mapping manager has not initialized
- if (!DomainMappingManager.getInstance().isInitialized()) {
- return false;
- }
-
- // Parse complete message and build event
- DomainMappingRemovedEvent event = (DomainMappingRemovedEvent) Util.jsonToObject(message, DomainMappingRemovedEvent.class);
-
- int tenantId = event.getTenantId();
- String applicationId = event.getApplicationId();
-
- try {
- TenantManager.acquireWriteLock();
- Tenant tenant = TenantManager.getInstance().getTenant(tenantId);
- if(tenant == null) {
- if(log.isWarnEnabled()) {
- log.warn(String.format("Tenant not found: [tenant-id] %d", event.getTenantId()));
- }
- return false;
- }
-
- ApplicationManager.acquireReadLockForApplication(applicationId);
- Application application = ApplicationManager.getApplications().getApplication(applicationId);
- if (application == null) {
- if (log.isWarnEnabled()) {
- log.warn(String.format("Application not found: [application-id] %d", applicationId));
- }
- return false;
- }
-
- try {
- DomainMappingManager.acquireReadLock();
- DomainMapping domainMapping = DomainMappingManager.getInstance().getDomainMapping(
- event.getClusterId(), event.getDomainName());
- if(domainMapping == null) {
- if (log.isWarnEnabled()) {
- log.warn(String.format("Domain mapping not found: [application-id] %s [cluster-id] %s " +
- "[domain-name]", event.getApplicationId(), event.getClusterId(),
- event.getDomainName()));
- }
- return false;
- }
- } finally {
- DomainMappingManager.releaseReadLock();
- }
-
- try {
- DomainMappingManager.acquireWriteLock();
- DomainMappingManager.getInstance().removeDomainMapping(event.getClusterId(), event.getDomainName());
-
- if (log.isInfoEnabled()) {
- log.info(String.format("Domain mapping removed: [application-id] %s [cluster-id] %s [domain-name]",
- event.getApplicationId(), event.getClusterId(), event.getDomainName()));
- }
-
- // Notify event listeners
- notifyEventListeners(event);
- return true;
- } catch (Exception e) {
- String error = String.format("Could not remove domain mapping: [application-id] %s [cluster-id] %s " +
- "[domain-name]", event.getApplicationId(), event.getClusterId(), event.getDomainName());
- log.error(error, e);
- return false;
- } finally {
- DomainMappingManager.releaseWriteLock();
- }
- }
- finally {
- TenantManager.releaseWriteLock();
- }
- }
- else {
- if (nextProcessor != null) {
- return nextProcessor.process(type, message, object);
- } else {
- throw new RuntimeException(String.format("Failed to process tenant message using available message processors: [type] %s [body] %s", type, message));
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageDelegator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageDelegator.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageDelegator.java
new file mode 100644
index 0000000..adf805d
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageDelegator.java
@@ -0,0 +1,93 @@
+/*
+ * 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.receiver.application.signup;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.domain.Message;
+import org.apache.stratos.messaging.listener.EventListener;
+import org.apache.stratos.messaging.message.processor.MessageProcessorChain;
+import org.apache.stratos.messaging.message.processor.application.signup.ApplicationSignUpMessageProcessorChain;
+
+/**
+ * Application signup event message delegator.
+ */
+class ApplicationSignUpEventMessageDelegator implements Runnable {
+
+ private static final Log log = LogFactory.getLog(ApplicationSignUpEventMessageDelegator.class);
+
+ private MessageProcessorChain processorChain;
+ private ApplicationSignUpEventMessageQueue messageQueue;
+ private boolean terminated;
+
+ public ApplicationSignUpEventMessageDelegator(ApplicationSignUpEventMessageQueue messageQueue) {
+ this.messageQueue = messageQueue;
+ this.processorChain = new ApplicationSignUpMessageProcessorChain();
+ }
+
+ public void addEventListener(EventListener eventListener) {
+ processorChain.addEventListener(eventListener);
+ }
+
+ @Override
+ public void run() {
+ try {
+ if (log.isInfoEnabled()) {
+ log.info("Application signup event message delegator started");
+ }
+
+ while (!terminated) {
+ try {
+ Message message = messageQueue.take();
+ String type = message.getEventClassName();
+
+ // Retrieve the actual message
+ String json = message.getText();
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Application signup event message received from queue: [event-class-name] %s " +
+ "[message-queue] %s", type, messageQueue.getClass()));
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Delegating application signup event message: %s", type));
+ }
+ processorChain.process(type, json, ApplicationSignUpManager.getInstance());
+ } catch (InterruptedException e) {
+ log.info("Application signup event message delegator is shutting down...");
+ return;
+ } catch (Exception e) {
+ log.error("Failed to retrieve application signup event message", e);
+ }
+ }
+ } catch (Exception e) {
+ if (log.isErrorEnabled()) {
+ log.error("Application signup event message delegator failed", e);
+ }
+ }
+ }
+
+ /**
+ * Terminate application signup event message delegator thread.
+ */
+ public void terminate() {
+ terminated = true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/stratos/blob/5fcfdac1/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageListener.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageListener.java b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageListener.java
new file mode 100644
index 0000000..89ae2be
--- /dev/null
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/message/receiver/application/signup/ApplicationSignUpEventMessageListener.java
@@ -0,0 +1,54 @@
+/*
+ * 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.receiver.application.signup;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.messaging.broker.subscribe.MessageListener;
+import org.apache.stratos.messaging.domain.Message;
+
+/**
+ * Application signup event message listener.
+ */
+class ApplicationSignUpEventMessageListener implements MessageListener {
+
+ private static final Log log = LogFactory.getLog(ApplicationSignUpEventMessageListener.class);
+
+ private final ApplicationSignUpEventMessageQueue messageQueue;
+
+ public ApplicationSignUpEventMessageListener(ApplicationSignUpEventMessageQueue messageQueue) {
+ this.messageQueue = messageQueue;
+ }
+
+ @Override
+ public void messageReceived(Message message) {
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Application signup message received: %s", message.getText()));
+ }
+ // Add received message to the queue
+ messageQueue.add(message);
+
+ } catch (Exception e) {
+ String error = "An error occurred while receiving application signup event message";
+ log.error(error, e);
+ }
+ }
+}