From 8ef9e32cfda4b1ce138ac167caa26521bd7a3508 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Fri, 19 Oct 2012 15:24:01 -0700 Subject: [PATCH] Architecture refactoring - Stateless management server - Spring Framework initiatives --- client/WEB-INF/web.xml | 9 ++- pom.xml | 81 +++++++++++++++++++ utils/conf/db.properties | 1 + .../src/com/cloud/utils/events/EventBus.java | 4 +- .../com/cloud/utils/events/EventBusBase.java | 5 +- .../com/cloud/utils/events/Subscriber.java | 4 +- 6 files changed, 99 insertions(+), 5 deletions(-) diff --git a/client/WEB-INF/web.xml b/client/WEB-INF/web.xml index 50f2455e848..c6fd30fa3ac 100644 --- a/client/WEB-INF/web.xml +++ b/client/WEB-INF/web.xml @@ -20,7 +20,14 @@ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> - + + org.springframework.web.context.ContextLoaderListener + + + contextConfigLocation + classpath:applicationContext.xml + + cloudStartupServlet com.cloud.servlet.CloudStartupServlet diff --git a/pom.xml b/pom.xml index 3c14d4ea560..5f63ce64692 100644 --- a/pom.xml +++ b/pom.xml @@ -79,6 +79,7 @@ 2.4 1.2 1.0-20081010.060147 + 3.0.5.RELEASE true @@ -169,6 +170,86 @@ ${cs.junit.version} test + + + org.springframework + spring-core + ${org.springframework.version} + + + + org.springframework + spring-expression + ${org.springframework.version} + + + + org.springframework + spring-beans + ${org.springframework.version} + + + + org.springframework + spring-aop + ${org.springframework.version} + + + + org.springframework + spring-context + ${org.springframework.version} + + + + org.springframework + spring-context-support + ${org.springframework.version} + + + + org.springframework + spring-tx + ${org.springframework.version} + + + + org.springframework + spring-jdbc + ${org.springframework.version} + + + + org.springframework + spring-orm + ${org.springframework.version} + + + + org.springframework + spring-oxm + ${org.springframework.version} + + + + org.springframework + spring-web + ${org.springframework.version} + + + + org.springframework + spring-webmvc + ${org.springframework.version} + + + + org.springframework + spring-test + ${org.springframework.version} + test + + diff --git a/utils/conf/db.properties b/utils/conf/db.properties index 6bdb6d61667..8d981191b0e 100644 --- a/utils/conf/db.properties +++ b/utils/conf/db.properties @@ -24,6 +24,7 @@ cluster.servlet.port=9090 # CloudStack database settings db.cloud.username=cloud db.cloud.password=cloud +db.root.password= db.cloud.host=localhost db.cloud.port=3306 db.cloud.name=cloud diff --git a/utils/src/com/cloud/utils/events/EventBus.java b/utils/src/com/cloud/utils/events/EventBus.java index 4195acdb469..c1b6f707449 100644 --- a/utils/src/com/cloud/utils/events/EventBus.java +++ b/utils/src/com/cloud/utils/events/EventBus.java @@ -17,9 +17,11 @@ package com.cloud.utils.events; +import java.io.Serializable; + public interface EventBus { void subscribe(String subject, Subscriber subscriber); void unsubscribe(String subject, Subscriber subscriber); - void publish(String subject, PublishScope scope, Object sender, String args); + void publish(String subject, PublishScope scope, Object sender, Serializable args); } diff --git a/utils/src/com/cloud/utils/events/EventBusBase.java b/utils/src/com/cloud/utils/events/EventBusBase.java index 0c135dbc9c0..cd10f1d7506 100644 --- a/utils/src/com/cloud/utils/events/EventBusBase.java +++ b/utils/src/com/cloud/utils/events/EventBusBase.java @@ -17,6 +17,7 @@ package com.cloud.utils.events; +import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -72,7 +73,7 @@ public class EventBusBase implements EventBus { @Override public void publish(String subject, PublishScope scope, Object sender, - String args) { + Serializable args) { if(_gate.enter(true)) { @@ -283,7 +284,7 @@ public class EventBusBase implements EventBus { _children.put(key, childNode); } - public void notifySubscribers(String subject, Object sender, String args) { + public void notifySubscribers(String subject, Object sender, Serializable args) { for(Subscriber subscriber : _subscribers) { subscriber.onPublishEvent(subject, sender, args); } diff --git a/utils/src/com/cloud/utils/events/Subscriber.java b/utils/src/com/cloud/utils/events/Subscriber.java index 7af283b5a39..c3baa6f1169 100644 --- a/utils/src/com/cloud/utils/events/Subscriber.java +++ b/utils/src/com/cloud/utils/events/Subscriber.java @@ -17,6 +17,8 @@ package com.cloud.utils.events; +import java.io.Serializable; + public interface Subscriber { - void onPublishEvent(String subject, Object sender, String args); + void onPublishEvent(String subject, Object sender, Serializable args); }