You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2013/10/23 21:43:21 UTC

[04/47] Spring Modularization

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/web/CloudStackContextLoaderListener.java
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/web/CloudStackContextLoaderListener.java b/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/web/CloudStackContextLoaderListener.java
new file mode 100644
index 0000000..e704437
--- /dev/null
+++ b/framework/spring/module/src/main/java/org/apache/cloudstack/spring/module/web/CloudStackContextLoaderListener.java
@@ -0,0 +1,75 @@
+/*
+ * 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.cloudstack.spring.module.web;
+
+import java.io.IOException;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+
+import org.apache.cloudstack.spring.module.factory.CloudStackSpringContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.web.context.ConfigurableWebApplicationContext;
+import org.springframework.web.context.ContextLoaderListener;
+
+public class CloudStackContextLoaderListener extends ContextLoaderListener {
+
+    public static final String WEB_PARENT_MODULE = "parentModule";
+    public static final String WEB_PARENT_MODULE_DEFAULT = "web";
+    
+    private static final Logger log = LoggerFactory.getLogger(CloudStackContextLoaderListener.class);
+    
+    CloudStackSpringContext cloudStackContext;
+    String configuredParentName;
+    
+    @Override
+    protected ApplicationContext loadParentContext(ServletContext servletContext) {
+        return cloudStackContext.getApplicationContextForWeb(configuredParentName);
+    }
+
+    @Override
+    public void contextInitialized(ServletContextEvent event) {
+        try {
+            cloudStackContext = new CloudStackSpringContext();
+        } catch (IOException e) {
+            log.error("Failed to start CloudStack", e);
+            throw new RuntimeException("Failed to initialize CloudStack Spring modules", e);
+        }
+        
+        configuredParentName = event.getServletContext().getInitParameter(WEB_PARENT_MODULE);
+        if ( configuredParentName == null ) {
+            configuredParentName = WEB_PARENT_MODULE_DEFAULT;
+        }
+        
+        super.contextInitialized(event);
+    }
+
+    @Override
+    protected void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext applicationContext) {
+        super.customizeContext(servletContext, applicationContext);
+        
+        String[] newLocations = cloudStackContext.getConfigLocationsForWeb(configuredParentName, 
+                applicationContext.getConfigLocations());
+        
+        applicationContext.setConfigLocations(newLocations);
+    }
+   
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/main/resources/org/apache/cloudstack/spring/module/model/impl/defaults-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/main/resources/org/apache/cloudstack/spring/module/model/impl/defaults-context.xml b/framework/spring/module/src/main/resources/org/apache/cloudstack/spring/module/model/impl/defaults-context.xml
new file mode 100644
index 0000000..b19833a
--- /dev/null
+++ b/framework/spring/module/src/main/resources/org/apache/cloudstack/spring/module/model/impl/defaults-context.xml
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <bean id="DefaultConfigResources" class="java.util.ArrayList" />
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/InitTest.java
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/InitTest.java b/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/InitTest.java
new file mode 100644
index 0000000..db3549b
--- /dev/null
+++ b/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/InitTest.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.cloudstack.spring.module.factory;
+
+import javax.annotation.PostConstruct;
+
+public class InitTest {
+
+    public static boolean initted = false;
+    
+    @PostConstruct
+    public void init() {
+        setInitted(true);
+    }
+
+    public boolean isInitted() {
+        return initted;
+    }
+
+    public void setInitted(boolean initted) {
+        InitTest.initted = initted;
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/ModuleBasedContextFactoryTest.java
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/ModuleBasedContextFactoryTest.java b/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/ModuleBasedContextFactoryTest.java
new file mode 100644
index 0000000..2947615
--- /dev/null
+++ b/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/factory/ModuleBasedContextFactoryTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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.cloudstack.spring.module.factory;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.apache.cloudstack.spring.module.locator.impl.ClasspathModuleDefinitionLocator;
+import org.apache.cloudstack.spring.module.model.ModuleDefinition;
+import org.apache.cloudstack.spring.module.model.ModuleDefinitionSet;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.context.ApplicationContext;
+
+public class ModuleBasedContextFactoryTest {
+
+    Collection<ModuleDefinition> defs;
+    
+    @Before
+    public void setUp() throws IOException {
+        InstantiationCounter.count = 0;
+
+        ClasspathModuleDefinitionLocator locator = new ClasspathModuleDefinitionLocator();
+        defs = locator.locateModules("testhierarchy");
+    }
+
+    @Test
+    public void testLoad() throws IOException {
+        
+        ModuleBasedContextFactory factory = new ModuleBasedContextFactory();
+        
+        ModuleDefinitionSet set = factory.loadModules(defs, "base");
+        
+        assertNotNull(set.getApplicationContext("base"));
+    }
+    
+    @Test
+    public void testOverride() throws IOException {
+        
+        InitTest.initted = false;
+        
+        ModuleBasedContextFactory factory = new ModuleBasedContextFactory();
+        
+        ModuleDefinitionSet set = factory.loadModules(defs, "base");
+        
+        assertTrue(!InitTest.initted);
+        assertEquals("a string", set.getApplicationContext("child1").getBean("override", String.class));
+    }
+    
+    @Test
+    public void testBeans() throws IOException {
+        ModuleBasedContextFactory factory = new ModuleBasedContextFactory();
+        ModuleDefinitionSet set = factory.loadModules(defs, "base");
+        
+        testBeansInContext(set, "base", 1, new String[] { "base" }, new String[] { "child1", "child2", "child1-1" });
+        testBeansInContext(set, "child1", 2, new String[] { "base", "child1" }, new String[] { "child2", "child1-1" });
+        testBeansInContext(set, "child2", 4, new String[] { "base", "child2" }, new String[] { "child1", "child1-1" });
+        testBeansInContext(set, "child1-1", 3, new String[] { "base", "child1", "child1-1" }, new String[] { "child2" });
+    }
+    
+    protected void testBeansInContext(ModuleDefinitionSet set, String name, int order, String[] parents, String[] notTheres) {
+        ApplicationContext context = set.getApplicationContext(name);
+        
+        String nameBean = context.getBean("name", String.class);
+        assertEquals(name, nameBean);
+        
+        for ( String parent : parents ) {
+            String parentBean = context.getBean(parent, String.class);
+            assertEquals(parent, parentBean);
+        }
+        
+        for ( String notThere : notTheres ) {
+            try {
+                context.getBean(notThere, String.class);
+                fail();
+            } catch ( NoSuchBeanDefinitionException e ) {
+            }
+        }
+        
+        int count = context.getBean("count", InstantiationCounter.class).getCount();
+        
+        assertEquals(order, count);
+    }
+    
+    public static class InstantiationCounter {
+        public static Integer count = 0;
+        
+        int myCount;
+        
+        public InstantiationCounter() {
+            synchronized (count) {
+                myCount = count + 1;
+                count = myCount;
+            }
+        }
+        
+        public int getCount() {
+            return myCount;
+        }
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/locator/impl/ClasspathModuleDefinitionSetLocatorTest.java
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/locator/impl/ClasspathModuleDefinitionSetLocatorTest.java b/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/locator/impl/ClasspathModuleDefinitionSetLocatorTest.java
new file mode 100644
index 0000000..5114187
--- /dev/null
+++ b/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/locator/impl/ClasspathModuleDefinitionSetLocatorTest.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.cloudstack.spring.module.locator.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.apache.cloudstack.spring.module.model.ModuleDefinition;
+import org.junit.Test;
+
+public class ClasspathModuleDefinitionSetLocatorTest {
+    
+    @Test
+    public void testDiscover() throws IOException {
+        ClasspathModuleDefinitionLocator factory = new ClasspathModuleDefinitionLocator();
+        
+        Collection<ModuleDefinition> modules = factory.locateModules("testhierarchy");
+        
+        assertEquals(5, modules.size());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionTest.java
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionTest.java b/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionTest.java
new file mode 100644
index 0000000..31a82ba
--- /dev/null
+++ b/framework/spring/module/src/test/java/org/apache/cloudstack/spring/module/model/impl/DefaultModuleDefinitionTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.cloudstack.spring.module.model.impl;
+
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.cloudstack.spring.module.util.ModuleLocationUtils;
+import org.junit.Test;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.core.io.support.ResourcePatternResolver;
+
+public class DefaultModuleDefinitionTest {
+
+    ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
+    
+    protected DefaultModuleDefinition createDef(String name) {
+        Resource resource = 
+                resolver.getResource(ModuleLocationUtils.getModuleLocation("testfiles", name));
+        
+        return new DefaultModuleDefinition("testfiles", resource, resolver);
+    }
+    
+    @Test
+    public void testBlankName() {
+        DefaultModuleDefinition def = createDef("blankname");
+        
+        try {
+            def.init();
+            fail();
+        } catch ( IOException e ) {
+            assertTrue(e.getMessage().contains("Missing name property"));
+        }
+        
+    }
+    
+    @Test
+    public void testMissingName() {
+        DefaultModuleDefinition def = createDef("missingname");
+        
+        try {
+            def.init();
+            fail();
+        } catch ( IOException e ) {
+            assertTrue(e.getMessage().contains("Missing name property"));
+        }
+        
+    }
+    
+    @Test
+    public void testBadName() {
+        DefaultModuleDefinition def = createDef("badname");
+        
+        try {
+            def.init();
+            fail();
+        } catch ( IOException e ) {
+            assertTrue(e.getMessage().contains("is expected to exist at"));
+        }
+    }
+
+    @Test
+    public void testGood() throws IOException {
+        DefaultModuleDefinition def = createDef("good");
+        def.init();
+        assertTrue(def.isValid());
+    }
+    
+    @Test
+    public void testWrongName() {
+        DefaultModuleDefinition def = createDef("wrongname");
+        
+        try {
+            def.init();
+            fail();
+        } catch ( IOException e ) {
+            assertTrue(e.getMessage().contains("do not appear to be the same resource"));
+        }
+    }
+    
+    @Test
+    public void testAllFiles() throws IOException {
+        DefaultModuleDefinition def = createDef("all");
+        
+        def.init();
+        
+        assertEquals(2, def.getContextLocations().size());
+        has(def.getContextLocations(), "empty-context.xml", "empty2-context.xml");
+        
+        assertEquals(2, def.getConfigLocations().size());
+        has(def.getConfigLocations(), "test2-defaults.properties", "defaults.properties");
+        
+        assertEquals(2, def.getInheritableContextLocations().size());
+        has(def.getInheritableContextLocations(), "empty-context-inheritable.xml", "empty2-context-inheritable.xml");
+    }
+    
+    protected void has(List<Resource> resources, String... files) throws IOException {
+        int count = 0;
+        
+        for ( Resource r : resources ) {
+            for ( String file : files ) {
+                if ( r.getURL().toExternalForm().contains(file) ) {
+                    count++;
+                    break;
+                }
+            }
+        }
+        
+        assertEquals(resources + " does not contain " + Arrays.toString(files), files.length, count);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/all/defaults.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/all/defaults.properties b/framework/spring/module/src/test/resources/testfiles/all/defaults.properties
new file mode 100644
index 0000000..c08d10b
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/all/defaults.properties
@@ -0,0 +1,18 @@
+# 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.
+
+blah=1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/all/empty-context-inheritable.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/all/empty-context-inheritable.xml b/framework/spring/module/src/test/resources/testfiles/all/empty-context-inheritable.xml
new file mode 100644
index 0000000..7c6b8fd
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/all/empty-context-inheritable.xml
@@ -0,0 +1,26 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/all/empty-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/all/empty-context.xml b/framework/spring/module/src/test/resources/testfiles/all/empty-context.xml
new file mode 100644
index 0000000..7c6b8fd
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/all/empty-context.xml
@@ -0,0 +1,26 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/all/empty2-context-inheritable.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/all/empty2-context-inheritable.xml b/framework/spring/module/src/test/resources/testfiles/all/empty2-context-inheritable.xml
new file mode 100644
index 0000000..7c6b8fd
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/all/empty2-context-inheritable.xml
@@ -0,0 +1,26 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/all/empty2-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/all/empty2-context.xml b/framework/spring/module/src/test/resources/testfiles/all/empty2-context.xml
new file mode 100644
index 0000000..7c6b8fd
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/all/empty2-context.xml
@@ -0,0 +1,26 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/all/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/all/module.properties b/framework/spring/module/src/test/resources/testfiles/all/module.properties
new file mode 100644
index 0000000..3faaf94
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/all/module.properties
@@ -0,0 +1,17 @@
+# 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.
+name=all

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/all/test2-defaults.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/all/test2-defaults.properties b/framework/spring/module/src/test/resources/testfiles/all/test2-defaults.properties
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/all/test2-defaults.properties
@@ -0,0 +1,17 @@
+# 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.
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/badname/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/badname/module.properties b/framework/spring/module/src/test/resources/testfiles/badname/module.properties
new file mode 100644
index 0000000..354accf
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/badname/module.properties
@@ -0,0 +1,17 @@
+# 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.
+name=what

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/blankname/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/blankname/module.properties b/framework/spring/module/src/test/resources/testfiles/blankname/module.properties
new file mode 100644
index 0000000..b11279b
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/blankname/module.properties
@@ -0,0 +1,18 @@
+# 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.
+# A bunch of whitespace is after name
+name=           

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/good/empty-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/good/empty-context.xml b/framework/spring/module/src/test/resources/testfiles/good/empty-context.xml
new file mode 100644
index 0000000..7c6b8fd
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/good/empty-context.xml
@@ -0,0 +1,26 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/good/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/good/module.properties b/framework/spring/module/src/test/resources/testfiles/good/module.properties
new file mode 100644
index 0000000..47e60ec
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/good/module.properties
@@ -0,0 +1,17 @@
+# 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.
+name=good

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/missingname/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/missingname/module.properties b/framework/spring/module/src/test/resources/testfiles/missingname/module.properties
new file mode 100644
index 0000000..00ae6c0
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/missingname/module.properties
@@ -0,0 +1,17 @@
+# 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.
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testfiles/wrongname/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testfiles/wrongname/module.properties b/framework/spring/module/src/test/resources/testfiles/wrongname/module.properties
new file mode 100644
index 0000000..47e60ec
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testfiles/wrongname/module.properties
@@ -0,0 +1,17 @@
+# 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.
+name=good

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/base/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/base/module.properties b/framework/spring/module/src/test/resources/testhierarchy/base/module.properties
new file mode 100644
index 0000000..955a32c
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/base/module.properties
@@ -0,0 +1,17 @@
+# 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.
+name=base

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/base/test-context-inheritable.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/base/test-context-inheritable.xml b/framework/spring/module/src/test/resources/testhierarchy/base/test-context-inheritable.xml
new file mode 100644
index 0000000..188301e
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/base/test-context-inheritable.xml
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <bean id="count" class="org.apache.cloudstack.spring.module.factory.ModuleBasedContextFactoryTest.InstantiationCounter" />
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/base/test-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/base/test-context.xml b/framework/spring/module/src/test/resources/testhierarchy/base/test-context.xml
new file mode 100644
index 0000000..a72d8c6
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/base/test-context.xml
@@ -0,0 +1,34 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <bean id="name" class="java.lang.String" >
+        <constructor-arg value="base" />
+    </bean>
+    
+    <bean id="base" class="java.lang.String" >
+        <constructor-arg value="base" />
+    </bean>
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/child1-1/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/child1-1/module.properties b/framework/spring/module/src/test/resources/testhierarchy/child1-1/module.properties
new file mode 100644
index 0000000..4abe53f
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/child1-1/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=child1-1
+parent=child1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/child1-1/test-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/child1-1/test-context.xml b/framework/spring/module/src/test/resources/testhierarchy/child1-1/test-context.xml
new file mode 100644
index 0000000..7a2a9ad
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/child1-1/test-context.xml
@@ -0,0 +1,34 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <bean id="name" class="java.lang.String" >
+        <constructor-arg value="child1-1" />
+    </bean>
+    
+    <bean id="child1-1" class="java.lang.String" >
+        <constructor-arg value="child1-1" />
+    </bean>
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/child1/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/child1/module.properties b/framework/spring/module/src/test/resources/testhierarchy/child1/module.properties
new file mode 100644
index 0000000..9f4df48
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/child1/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=child1
+parent=base

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/child1/test-context-override.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/child1/test-context-override.xml b/framework/spring/module/src/test/resources/testhierarchy/child1/test-context-override.xml
new file mode 100644
index 0000000..ceffeb5
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/child1/test-context-override.xml
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+    
+    <bean id="override" class="java.lang.String" >
+        <constructor-arg value="a string" />
+    </bean>
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/child1/test-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/child1/test-context.xml b/framework/spring/module/src/test/resources/testhierarchy/child1/test-context.xml
new file mode 100644
index 0000000..f906183
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/child1/test-context.xml
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <context:annotation-config/>
+
+    <bean id="name" class="java.lang.String" >
+        <constructor-arg value="child1" />
+    </bean>
+    
+    <bean id="child1" class="java.lang.String" >
+        <constructor-arg value="child1" />
+    </bean>
+    
+    <bean id="override" class="org.apache.cloudstack.spring.module.factory.InitTest" />
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/child2/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/child2/module.properties b/framework/spring/module/src/test/resources/testhierarchy/child2/module.properties
new file mode 100644
index 0000000..f03edfc
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/child2/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=child2
+parent=base

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/child2/test-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/child2/test-context.xml b/framework/spring/module/src/test/resources/testhierarchy/child2/test-context.xml
new file mode 100644
index 0000000..24bac54
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/child2/test-context.xml
@@ -0,0 +1,33 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <bean id="name" class="java.lang.String" >
+        <constructor-arg value="child2" />
+    </bean>
+    
+    <bean id="child2" class="java.lang.String" >
+        <constructor-arg value="child2" />
+    </bean>
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/orphan1/module.properties
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/orphan1/module.properties b/framework/spring/module/src/test/resources/testhierarchy/orphan1/module.properties
new file mode 100644
index 0000000..d4a0e6c
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/orphan1/module.properties
@@ -0,0 +1,18 @@
+# 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.
+name=orphan1
+parent=missing1

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/framework/spring/module/src/test/resources/testhierarchy/orphan1/test-context.xml
----------------------------------------------------------------------
diff --git a/framework/spring/module/src/test/resources/testhierarchy/orphan1/test-context.xml b/framework/spring/module/src/test/resources/testhierarchy/orphan1/test-context.xml
new file mode 100644
index 0000000..658beea
--- /dev/null
+++ b/framework/spring/module/src/test/resources/testhierarchy/orphan1/test-context.xml
@@ -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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <bean id="name" class="java.lang.String" >
+        <constructor-arg value="orphan1" />
+    </bean>
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/acl/static-role-based/resources/META-INF/cloudstack/acl-static-role-based/module.properties
----------------------------------------------------------------------
diff --git a/plugins/acl/static-role-based/resources/META-INF/cloudstack/acl-static-role-based/module.properties b/plugins/acl/static-role-based/resources/META-INF/cloudstack/acl-static-role-based/module.properties
new file mode 100644
index 0000000..28c79d3
--- /dev/null
+++ b/plugins/acl/static-role-based/resources/META-INF/cloudstack/acl-static-role-based/module.properties
@@ -0,0 +1,2 @@
+name=acl-static-role-based
+parent=api
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/acl/static-role-based/resources/META-INF/cloudstack/acl-static-role-based/spring-acl-static-role-based-context.xml
----------------------------------------------------------------------
diff --git a/plugins/acl/static-role-based/resources/META-INF/cloudstack/acl-static-role-based/spring-acl-static-role-based-context.xml b/plugins/acl/static-role-based/resources/META-INF/cloudstack/acl-static-role-based/spring-acl-static-role-based-context.xml
new file mode 100644
index 0000000..f13acc1
--- /dev/null
+++ b/plugins/acl/static-role-based/resources/META-INF/cloudstack/acl-static-role-based/spring-acl-static-role-based-context.xml
@@ -0,0 +1,34 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >                     
+
+    <bean id="StaticRoleBasedAPIAccessChecker" class="org.apache.cloudstack.acl.StaticRoleBasedAPIAccessChecker" >
+        <property name="services" value="#{apiCommandsRegistry.registered}" />
+    </bean>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/affinity-group-processors/explicit-dedication/resources/META-INF/cloudstack/explicit-dedication/module.properties
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/explicit-dedication/resources/META-INF/cloudstack/explicit-dedication/module.properties b/plugins/affinity-group-processors/explicit-dedication/resources/META-INF/cloudstack/explicit-dedication/module.properties
new file mode 100644
index 0000000..bd19e52
--- /dev/null
+++ b/plugins/affinity-group-processors/explicit-dedication/resources/META-INF/cloudstack/explicit-dedication/module.properties
@@ -0,0 +1,2 @@
+name=explicit-dedication
+parent=planner
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/affinity-group-processors/explicit-dedication/resources/META-INF/cloudstack/explicit-dedication/spring-explicit-dedication-context.xml
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/explicit-dedication/resources/META-INF/cloudstack/explicit-dedication/spring-explicit-dedication-context.xml b/plugins/affinity-group-processors/explicit-dedication/resources/META-INF/cloudstack/explicit-dedication/spring-explicit-dedication-context.xml
new file mode 100644
index 0000000..5864f94
--- /dev/null
+++ b/plugins/affinity-group-processors/explicit-dedication/resources/META-INF/cloudstack/explicit-dedication/spring-explicit-dedication-context.xml
@@ -0,0 +1,36 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+    <bean id="ExplicitDedicationProcessor"
+        class="org.apache.cloudstack.affinity.ExplicitDedicationProcessor">
+        <property name="name" value="ExplicitDedicationProcessor" />
+        <property name="type" value="ExplicitDedication" />
+    </bean>
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/affinity-group-processors/host-anti-affinity/resources/META-INF/cloudstack/host-anti-affinity/module.properties
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/host-anti-affinity/resources/META-INF/cloudstack/host-anti-affinity/module.properties b/plugins/affinity-group-processors/host-anti-affinity/resources/META-INF/cloudstack/host-anti-affinity/module.properties
new file mode 100644
index 0000000..80f912d
--- /dev/null
+++ b/plugins/affinity-group-processors/host-anti-affinity/resources/META-INF/cloudstack/host-anti-affinity/module.properties
@@ -0,0 +1,2 @@
+name=host-anti-affinity
+parent=planner
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/affinity-group-processors/host-anti-affinity/resources/META-INF/cloudstack/host-anti-affinity/spring-host-anti-affinity-context.xml
----------------------------------------------------------------------
diff --git a/plugins/affinity-group-processors/host-anti-affinity/resources/META-INF/cloudstack/host-anti-affinity/spring-host-anti-affinity-context.xml b/plugins/affinity-group-processors/host-anti-affinity/resources/META-INF/cloudstack/host-anti-affinity/spring-host-anti-affinity-context.xml
new file mode 100644
index 0000000..bc09cc3
--- /dev/null
+++ b/plugins/affinity-group-processors/host-anti-affinity/resources/META-INF/cloudstack/host-anti-affinity/spring-host-anti-affinity-context.xml
@@ -0,0 +1,37 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+    <bean id="HostAntiAffinityProcessor"
+        class="org.apache.cloudstack.affinity.HostAntiAffinityProcessor">
+        <property name="name" value="HostAntiAffinityProcessor" />
+        <property name="type" value="host anti-affinity" />
+    </bean>
+
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
index 860240f..5be109e 100755
--- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
+++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java
@@ -16,14 +16,24 @@
 // under the License.
 package org.apache.cloudstack.discovery;
 
-import com.cloud.serializer.Param;
-import com.cloud.user.User;
-import com.cloud.utils.ReflectUtil;
-import com.cloud.utils.StringUtils;
-import com.cloud.utils.component.PluggableService;
-import com.google.gson.annotations.SerializedName;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.ejb.Local;
+import javax.inject.Inject;
+
 import org.apache.cloudstack.acl.APIChecker;
-import org.apache.cloudstack.api.*;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.BaseResponse;
+import org.apache.cloudstack.api.Parameter;
 import org.apache.cloudstack.api.command.user.discovery.ListApisCmd;
 import org.apache.cloudstack.api.response.ApiDiscoveryResponse;
 import org.apache.cloudstack.api.response.ApiParameterResponse;
@@ -32,27 +42,29 @@ import org.apache.cloudstack.api.response.ListResponse;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-import javax.inject.Inject;
-import java.lang.reflect.Field;
-import java.util.*;
+import com.cloud.serializer.Param;
+import com.cloud.user.User;
+import com.cloud.utils.ReflectUtil;
+import com.cloud.utils.StringUtils;
+import com.cloud.utils.component.ComponentLifecycleBase;
+import com.cloud.utils.component.PluggableService;
+import com.google.gson.annotations.SerializedName;
 
 @Component
 @Local(value = ApiDiscoveryService.class)
-public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
+public class ApiDiscoveryServiceImpl extends ComponentLifecycleBase implements ApiDiscoveryService {
     private static final Logger s_logger = Logger.getLogger(ApiDiscoveryServiceImpl.class);
 
-    @Inject protected List<APIChecker> _apiAccessCheckers = null;
-    @Inject protected List<PluggableService> _services = null;
+    List<APIChecker> _apiAccessCheckers = null;
+    List<PluggableService> _services = null;
     private static Map<String, ApiDiscoveryResponse> s_apiNameDiscoveryResponseMap = null;
 
     protected ApiDiscoveryServiceImpl() {
         super();
     }
 
-    @PostConstruct
-    void init() {
+    @Override
+    public boolean start() {
         if (s_apiNameDiscoveryResponseMap == null) {
             long startTime = System.nanoTime();
             s_apiNameDiscoveryResponseMap = new HashMap<String, ApiDiscoveryResponse>();
@@ -66,6 +78,8 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
             long endTime = System.nanoTime();
             s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms");
         }
+        
+        return true;
     }
 
     protected Map<String, List<String>> cacheResponseMap(Set<Class<?>> cmdClasses) {
@@ -249,4 +263,21 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService {
         cmdList.add(ListApisCmd.class);
         return cmdList;
     }
+
+    public List<APIChecker> getApiAccessCheckers() {
+        return _apiAccessCheckers;
+    }
+
+    public void setApiAccessCheckers(List<APIChecker> _apiAccessCheckers) {
+        this._apiAccessCheckers = _apiAccessCheckers;
+    }
+
+    public List<PluggableService> getServices() {
+        return _services;
+    }
+
+    @Inject
+    public void setServices(List<PluggableService> _services) {
+        this._services = _services;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java
----------------------------------------------------------------------
diff --git a/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java b/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java
index afff746..a34484b 100644
--- a/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java
+++ b/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java
@@ -65,7 +65,7 @@ public class ApiDiscoveryTest {
 
         Set<Class<?>> cmdClasses = new HashSet<Class<?>>();
         cmdClasses.add(ListApisCmd.class);
-        _discoveryService.init();
+        _discoveryService.start();
         _discoveryService.cacheResponseMap(cmdClasses);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/api/rate-limit/resources/META-INF/cloudstack/rate-limit/module.properties
----------------------------------------------------------------------
diff --git a/plugins/api/rate-limit/resources/META-INF/cloudstack/rate-limit/module.properties b/plugins/api/rate-limit/resources/META-INF/cloudstack/rate-limit/module.properties
new file mode 100644
index 0000000..4b8fbdb
--- /dev/null
+++ b/plugins/api/rate-limit/resources/META-INF/cloudstack/rate-limit/module.properties
@@ -0,0 +1,2 @@
+name=rate-limit
+parent=api
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/api/rate-limit/resources/META-INF/cloudstack/rate-limit/spring-rate-limit-context.xml
----------------------------------------------------------------------
diff --git a/plugins/api/rate-limit/resources/META-INF/cloudstack/rate-limit/spring-rate-limit-context.xml b/plugins/api/rate-limit/resources/META-INF/cloudstack/rate-limit/spring-rate-limit-context.xml
new file mode 100644
index 0000000..17153cf
--- /dev/null
+++ b/plugins/api/rate-limit/resources/META-INF/cloudstack/rate-limit/spring-rate-limit-context.xml
@@ -0,0 +1,32 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+      <bean id="apiRateLimitServiceImpl" class="org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl"/>
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/dedicated-resources/resources/META-INF/cloudstack/core/spring-dedicated-resources-core-context.xml
----------------------------------------------------------------------
diff --git a/plugins/dedicated-resources/resources/META-INF/cloudstack/core/spring-dedicated-resources-core-context.xml b/plugins/dedicated-resources/resources/META-INF/cloudstack/core/spring-dedicated-resources-core-context.xml
new file mode 100644
index 0000000..e2879f7
--- /dev/null
+++ b/plugins/dedicated-resources/resources/META-INF/cloudstack/core/spring-dedicated-resources-core-context.xml
@@ -0,0 +1,33 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+    <bean id="DedicatedResourceManagerImpl"
+        class="org.apache.cloudstack.dedicated.DedicatedResourceManagerImpl" />
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/deployment-planners/implicit-dedication/resources/META-INF/cloudstack/implicit-dedication/module.properties
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/resources/META-INF/cloudstack/implicit-dedication/module.properties b/plugins/deployment-planners/implicit-dedication/resources/META-INF/cloudstack/implicit-dedication/module.properties
new file mode 100644
index 0000000..a7dc458
--- /dev/null
+++ b/plugins/deployment-planners/implicit-dedication/resources/META-INF/cloudstack/implicit-dedication/module.properties
@@ -0,0 +1,2 @@
+name=implicit-dedication
+parent=planner
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/deployment-planners/implicit-dedication/resources/META-INF/cloudstack/implicit-dedication/spring-implicit-dedication-context.xml
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/implicit-dedication/resources/META-INF/cloudstack/implicit-dedication/spring-implicit-dedication-context.xml b/plugins/deployment-planners/implicit-dedication/resources/META-INF/cloudstack/implicit-dedication/spring-implicit-dedication-context.xml
new file mode 100644
index 0000000..d14b450
--- /dev/null
+++ b/plugins/deployment-planners/implicit-dedication/resources/META-INF/cloudstack/implicit-dedication/spring-implicit-dedication-context.xml
@@ -0,0 +1,25 @@
+<!-- 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. -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
+    xmlns:aop="http://www.springframework.org/schema/aop"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+    <bean id="ImplicitDedicationPlanner" class="com.cloud.deploy.ImplicitDedicationPlanner">
+        <property name="name" value="ImplicitDedicationPlanner" />
+    </bean>
+
+
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/deployment-planners/user-concentrated-pod/resources/META-INF/cloudstack/user-concentrated-pod/module.properties
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/user-concentrated-pod/resources/META-INF/cloudstack/user-concentrated-pod/module.properties b/plugins/deployment-planners/user-concentrated-pod/resources/META-INF/cloudstack/user-concentrated-pod/module.properties
new file mode 100644
index 0000000..f685b9c
--- /dev/null
+++ b/plugins/deployment-planners/user-concentrated-pod/resources/META-INF/cloudstack/user-concentrated-pod/module.properties
@@ -0,0 +1,2 @@
+name=user-concentrated-pod
+parent=planner
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/deployment-planners/user-concentrated-pod/resources/META-INF/cloudstack/user-concentrated-pod/spring-user-concentrated-pod-context.xml
----------------------------------------------------------------------
diff --git a/plugins/deployment-planners/user-concentrated-pod/resources/META-INF/cloudstack/user-concentrated-pod/spring-user-concentrated-pod-context.xml b/plugins/deployment-planners/user-concentrated-pod/resources/META-INF/cloudstack/user-concentrated-pod/spring-user-concentrated-pod-context.xml
new file mode 100644
index 0000000..e26cb2b
--- /dev/null
+++ b/plugins/deployment-planners/user-concentrated-pod/resources/META-INF/cloudstack/user-concentrated-pod/spring-user-concentrated-pod-context.xml
@@ -0,0 +1,35 @@
+<!--
+  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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:aop="http://www.springframework.org/schema/aop"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                      http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
+                      http://www.springframework.org/schema/context
+                      http://www.springframework.org/schema/context/spring-context-3.0.xsd"
+                      >
+
+  <bean id="UserConcentratedPodPlanner" class="com.cloud.deploy.UserConcentratedPodPlanner">
+    <property name="name" value="UserConcentratedPodPlanner"/>
+  </bean>
+
+    
+</beans>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/67186429/plugins/host-allocators/random/resources/META-INF/cloudstack/host-allocator-random/module.properties
----------------------------------------------------------------------
diff --git a/plugins/host-allocators/random/resources/META-INF/cloudstack/host-allocator-random/module.properties b/plugins/host-allocators/random/resources/META-INF/cloudstack/host-allocator-random/module.properties
new file mode 100644
index 0000000..95231f5
--- /dev/null
+++ b/plugins/host-allocators/random/resources/META-INF/cloudstack/host-allocator-random/module.properties
@@ -0,0 +1,2 @@
+name=host-allocator-random
+parent=allocator
\ No newline at end of file