- Timestamp:
- 2009-02-11 12:59:13 (3 years ago)
- Location:
- branches/BRANCH_CONFIG
- Files:
-
- 8 added
- 13 deleted
- 8 edited
- 11 copied
- 11 moved
-
core/kauri-runtime-tests/src/test/java/org/kauriproject/runtime/test/ConfListeningTest.java (modified) (1 diff)
-
core/kauri-runtime-tests/src/test/java/org/kauriproject/runtime/test/ConfTest.java (modified) (3 diffs)
-
core/kauri-runtime-tests/src/test/java/org/kauriproject/runtime/test/testmodules/confmod (added)
-
core/kauri-runtime-tests/src/test/java/org/kauriproject/runtime/test/testmodules/confmod/ConfDependentBean.java (added)
-
core/kauri-runtime-tests/src/test/modulesrc/org/kauriproject/runtime/test/testmodules/confmod/KAURI-INF/spring/services.xml (modified) (1 diff)
-
core/kauri-runtime/src/main/java/org/kauriproject/runtime/module/build/KauriRuntimeNamespaceHandler.java (modified) (11 diffs)
-
core/kauri-runtime/src/main/resources/org/kauriproject/runtime/component/kauriruntime-springext.xsd (modified) (1 diff)
-
modules/kauri-blueprintcss/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/modules/kauri-blueprintcss/conf/runtime)
-
modules/kauri-blueprintcss/conf/kauri/modules.xml (deleted)
-
modules/kauri-blueprintcss/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/modules/kauri-blueprintcss/conf/runtime/wiring.xml)
-
modules/kauri-jquery/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/modules/kauri-jquery/conf/runtime)
-
modules/kauri-jquery/conf/kauri/modules.xml (deleted)
-
modules/kauri-jquery/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/modules/kauri-jquery/conf/runtime/wiring.xml)
-
modules/kauri-upload/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/modules/kauri-upload/conf/runtime)
-
modules/kauri-upload/conf/kauri/modules.xml (deleted)
-
modules/kauri-upload/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/modules/kauri-upload/conf/runtime/wiring.xml)
-
samples/kauri-dbresources-sample/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/samples/kauri-dbresources-sample/conf/runtime)
-
samples/kauri-dbresources-sample/conf/kauri/modules.xml (deleted)
-
samples/kauri-dbresources-sample/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/samples/kauri-dbresources-sample/conf/runtime/wiring.xml)
-
samples/kauri-dbresources-sample/src/main/kauri/pages/index.html.xml (modified) (1 diff)
-
samples/kauri-forms-sample/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/samples/kauri-forms-sample/conf/runtime)
-
samples/kauri-forms-sample/conf/kauri/modules.xml (deleted)
-
samples/kauri-forms-sample/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/samples/kauri-forms-sample/conf/runtime/wiring.xml)
-
samples/kauri-i18n-sample/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/samples/kauri-i18n-sample/conf/runtime)
-
samples/kauri-i18n-sample/conf/kauri/modules.xml (deleted)
-
samples/kauri-i18n-sample/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/samples/kauri-i18n-sample/conf/runtime/wiring.xml)
-
samples/kauri-representationbuilder-sample/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/samples/kauri-representationbuilder-sample/conf/runtime)
-
samples/kauri-representationbuilder-sample/conf/kauri/modules.xml (deleted)
-
samples/kauri-representationbuilder-sample/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/samples/kauri-representationbuilder-sample/conf/runtime/wiring.xml)
-
samples/kauri-routing-sample/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/samples/kauri-routing-sample/conf/runtime)
-
samples/kauri-routing-sample/conf/kauri/modules.xml (deleted)
-
samples/kauri-routing-sample/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/samples/kauri-routing-sample/conf/runtime/wiring.xml)
-
samples/kauri-runtime-sample/conf (added)
-
samples/kauri-runtime-sample/conf/kauri (added)
-
samples/kauri-runtime-sample/conf/kauri/wiring.xml (added)
-
samples/kauri-runtime-sample/kauri.xml (deleted)
-
samples/kauri-samples-common/conf (added)
-
samples/kauri-samples-common/conf/kauri (added)
-
samples/kauri-samples-common/conf/kauri/wiring.xml (added)
-
samples/kauri-samples-common/kauri.xml (deleted)
-
samples/kauri-template-sample/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/samples/kauri-template-sample/conf/runtime)
-
samples/kauri-template-sample/conf/kauri/modules.xml (deleted)
-
samples/kauri-template-sample/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/samples/kauri-template-sample/conf/runtime/wiring.xml)
-
tools/kauri-archetype/kauri-archetype-basic/src/main/resources/archetype-resources/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/tools/kauri-archetype/kauri-archetype-basic/src/main/resources/archetype-resources/conf/runtime)
-
tools/kauri-archetype/kauri-archetype-basic/src/main/resources/archetype-resources/conf/kauri/modules.xml (deleted)
-
tools/kauri-archetype/kauri-archetype-basic/src/main/resources/archetype-resources/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/tools/kauri-archetype/kauri-archetype-basic/src/main/resources/archetype-resources/conf/runtime/wiring.xml)
-
tools/kauri-archetype/kauri-archetype-prototyping/src/main/resources/archetype-resources/conf/kauri (moved) (moved from branches/BRANCH_CONFIG/tools/kauri-archetype/kauri-archetype-prototyping/src/main/resources/archetype-resources/conf/runtime)
-
tools/kauri-archetype/kauri-archetype-prototyping/src/main/resources/archetype-resources/conf/kauri/modules.xml (deleted)
-
tools/kauri-archetype/kauri-archetype-prototyping/src/main/resources/archetype-resources/conf/kauri/wiring.xml (copied) (copied from branches/BRANCH_CONFIG/tools/kauri-archetype/kauri-archetype-prototyping/src/main/resources/archetype-resources/conf/runtime/wiring.xml)
-
tools/kauri-package-plugin/src/main/java/org/kauriproject/tools/plugin/packaging/BasePackageMojo.java (modified) (3 diffs)
-
tools/kauri-package-plugin/src/main/java/org/kauriproject/tools/plugin/packaging/BaseWebappMojo.java (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/BRANCH_CONFIG/core/kauri-runtime-tests/src/test/java/org/kauriproject/runtime/test/ConfListeningTest.java
r1050 r1056 42 42 43 43 // Create a config for the configuration manager 44 File runtimeConfDir = new File(test1ConfDir, "runtime");45 writeConf( runtimeConfDir, "configuration.xml", "<conf><reloading enabled='true' delay='1000'/></conf>");44 File kauriConfDir = new File(test1ConfDir, "kauri"); 45 writeConf(kauriConfDir, "configuration.xml", "<conf><reloading enabled='true' delay='1000'/></conf>"); 46 46 47 47 // Create a conf for our test module -
branches/BRANCH_CONFIG/core/kauri-runtime-tests/src/test/java/org/kauriproject/runtime/test/ConfTest.java
r1044 r1056 6 6 import org.kauriproject.runtime.configuration.ConfManager; 7 7 import org.kauriproject.runtime.configuration.ConfManagerImpl; 8 import org.kauriproject.runtime.test.testmodules.confmod.ConfDependentBean; 8 9 import org.kauriproject.conf.Conf; 10 import org.springframework.context.ApplicationContext; 9 11 10 12 import java.io.File; … … 41 43 42 44 public void testConf() { 43 Map beans = runtime.getModuleById("confmod").getApplicationContext().getBeansOfType(ConfRegistry.class); 45 ApplicationContext appContext = runtime.getModuleById("confmod").getApplicationContext(); 46 47 Map beans = appContext.getBeansOfType(ConfRegistry.class); 44 48 ConfRegistry confRegistry = (ConfRegistry)beans.get("conf"); 45 49 … … 54 58 assertEquals(599, conf.getChild("delay").getValueAsInteger()); 55 59 56 String confTestBean1 = (String) runtime.getModuleById("confmod").getApplicationContext().getBean("confTestBean1");60 String confTestBean1 = (String)appContext.getBean("confTestBean1"); 57 61 assertEquals("foobar@hotmail.com", confTestBean1); 62 63 ConfDependentBean confTestBean2 = (ConfDependentBean)appContext.getBean("confTestBean2"); 64 assertNotNull(confTestBean2.getConf()); 65 assertEquals("foobar@hotmail.com", confTestBean2.getConf().getChild("email").getValue()); 66 67 String confTestBean3 = (String)appContext.getBean("confTestBean3"); 68 assertEquals("foobar@hotmail.com", confTestBean3); 58 69 } 59 70 -
branches/BRANCH_CONFIG/core/kauri-runtime-tests/src/test/modulesrc/org/kauriproject/runtime/test/testmodules/confmod/KAURI-INF/spring/services.xml
r1044 r1056 23 23 </bean> 24 24 25 <bean id="confTestBean2" class="org.kauriproject.runtime.test.testmodules.confmod.ConfDependentBean"> 26 <constructor-arg> 27 <kauri:conf path="test2"/> 28 </constructor-arg> 29 </bean> 30 31 <bean id="confTestBean3" class="java.lang.String"> 32 <!-- The following is equivalent to the ${path:expr} syntax --> 33 <constructor-arg><kauri:conf path="test2" select="email"/></constructor-arg> 34 </bean> 25 35 </beans> -
branches/BRANCH_CONFIG/core/kauri-runtime/src/main/java/org/kauriproject/runtime/module/build/KauriRuntimeNamespaceHandler.java
r1054 r1056 22 22 import org.springframework.beans.factory.config.ConstructorArgumentValues; 23 23 import org.springframework.beans.factory.support.RootBeanDefinition; 24 import org.springframework.beans.factory.support.GenericBeanDefinition; 24 25 import org.w3c.dom.Element; 25 26 import org.w3c.dom.Node; … … 30 31 import org.kauriproject.runtime.rapi.KauriModule; 31 32 import org.kauriproject.runtime.rapi.ConfRegistry; 33 import org.kauriproject.conf.Conf; 34 import org.apache.commons.jxpath.JXPathContext; 32 35 33 36 import java.util.Map; … … 47 50 if (processor != null) { 48 51 try { 49 processor.process(element, parserContext, springBuildContext);52 return processor.process(element, parserContext, springBuildContext); 50 53 } catch (Throwable e) { 51 54 throw new KauriRTException("Error handling " + elementName + " directive.", e); … … 61 64 62 65 private static interface ElementProcessor { 63 voidprocess(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) throws Exception;66 BeanDefinition process(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) throws Exception; 64 67 } 65 68 66 69 private static final ElementProcessor MODULE_PROCESSOR = new ElementProcessor() { 67 public voidprocess(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) {70 public BeanDefinition process(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) { 68 71 String contextBeanId = element.getAttribute("restletContext"); 69 72 if (contextBeanId.length() > 0) { … … 124 127 parserContext.getRegistry().registerBeanDefinition(confBeanId, def); 125 128 } 129 130 return null; 126 131 } 127 132 }; 128 133 129 134 private static final ElementProcessor IMPORT_RESTSERVICE_PROCESSOR = new ElementProcessor() { 130 public voidprocess(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) {135 public BeanDefinition process(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) { 131 136 String name = element.getAttribute("name"); 132 137 … … 136 141 137 142 springBuildContext.importRestservice(name, type); 143 144 return null; 138 145 } 139 146 }; 140 147 141 148 private static final ElementProcessor EXPORT_RESTSERVICE_PROCESSOR = new ElementProcessor() { 142 public voidprocess(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) {149 public BeanDefinition process(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) { 143 150 String beanName = element.getAttribute("ref"); 144 151 … … 152 159 153 160 springBuildContext.exportRestservice(name, beanName, type); 161 162 return null; 154 163 } 155 164 }; 156 165 157 166 private static final ElementProcessor IMPORT_SERVICE_PROCESSOR = new ElementProcessor() { 158 public voidprocess(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) throws ClassNotFoundException {167 public BeanDefinition process(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) throws ClassNotFoundException { 159 168 String service = element.getAttribute("service"); 160 169 Class serviceClass = parserContext.getReaderContext().getBeanClassLoader().loadClass(service); … … 184 193 } 185 194 } catch (Throwable t) { 186 throw new KauriRTException("Error assigning Java service dependency " + dependencyName + " of module " + springBuildContext.getModule().getDefinition().getId(), t); 195 throw new KauriRTException("Error assigning Java service dependency " + dependencyName + " of module " 196 + springBuildContext.getModule().getDefinition().getId(), t); 187 197 } 188 198 … … 196 206 def.setLazyInit(false); 197 207 parserContext.getRegistry().registerBeanDefinition(id, def); 208 209 return null; 198 210 } 199 211 }; 200 212 201 213 private static final ElementProcessor EXPORT_SERVICE_PROCESSOR = new ElementProcessor() { 202 public void process(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) throws ClassNotFoundException { 214 public BeanDefinition process(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) 215 throws ClassNotFoundException { 203 216 String service = element.getAttribute("service"); 204 217 Class serviceClass = parserContext.getReaderContext().getBeanClassLoader().loadClass(service); … … 210 223 211 224 springBuildContext.exportJavaService(name, serviceClass, beanName); 225 226 return null; 227 } 228 }; 229 230 private static final ElementProcessor CONF_PROCESSOR = new ElementProcessor() { 231 public BeanDefinition process(Element element, ParserContext parserContext, SpringBuildContext springBuildContext) 232 throws Exception { 233 String path = element.getAttribute("path"); 234 String expr = element.getAttribute("select"); 235 236 String moduleId = springBuildContext.getModule().getDefinition().getId(); 237 Conf conf = springBuildContext.getRuntime().getConfManager().getConfRegistry(moduleId).getConfiguration(path); 238 239 if (expr.length() > 0) { 240 JXPathContext context = JXPathContext.newContext(conf); 241 String value; 242 243 try { 244 value = String.valueOf(context.getValue(expr)); 245 } catch (Exception e) { 246 throw new KauriRTException("Element " + element.getTagName() + " of Spring bean config in module " + 247 moduleId + ": error retrieving configuration value using expression \"" + expr + "\"" 248 + " from configuration path \"" + path + "\".", e); 249 } 250 251 GenericBeanDefinition def = new GenericBeanDefinition(); 252 def.setBeanClass(ObjectFactoryBean.class); 253 254 ConstructorArgumentValues args = new ConstructorArgumentValues(); 255 args.addIndexedArgumentValue(0, String.class); 256 args.addIndexedArgumentValue(1, value); 257 258 def.setConstructorArgumentValues(args); 259 def.setLazyInit(false); 260 261 return def; 262 } else { 263 GenericBeanDefinition def = new GenericBeanDefinition(); 264 def.setBeanClass(ObjectFactoryBean.class); 265 266 ConstructorArgumentValues args = new ConstructorArgumentValues(); 267 args.addIndexedArgumentValue(0, Conf.class); 268 args.addIndexedArgumentValue(1, conf); 269 270 def.setConstructorArgumentValues(args); 271 def.setLazyInit(false); 272 273 return def; 274 } 212 275 } 213 276 }; … … 222 285 ELEMENT_PROCESSORS.put("import-restservice", IMPORT_RESTSERVICE_PROCESSOR); 223 286 ELEMENT_PROCESSORS.put("module", MODULE_PROCESSOR); 287 ELEMENT_PROCESSORS.put("conf", CONF_PROCESSOR); 224 288 } 225 289 } -
branches/BRANCH_CONFIG/core/kauri-runtime/src/main/resources/org/kauriproject/runtime/component/kauriruntime-springext.xsd
r1033 r1056 36 36 </xs:complexType> 37 37 </xs:element> 38 <xs:element name="conf"> 39 <xs:complexType> 40 <xs:attribute name="path" type="xs:string" use="required"/> 41 <xs:attribute name="select" type="xs:string" use="optional"/> 42 </xs:complexType> 43 </xs:element> 38 44 </xs:schema> -
branches/BRANCH_CONFIG/samples/kauri-dbresources-sample/src/main/kauri/pages/index.html.xml
r988 r1056 65 65 JpaRestlet 66 66 </b> 67 on a path of choice in your kauri.xml file.67 on a path of choice in your wiring.xml file. 68 68 Note that it got exported from the import mentioned above. 69 <br/>(See kauri.xml)69 <br/>(See wiring.xml) 70 70 <pre><![CDATA[ 71 71 <artifact id="your.module" groupId="your.groupId" artifactId="your-artifactId"> -
branches/BRANCH_CONFIG/tools/kauri-package-plugin/src/main/java/org/kauriproject/tools/plugin/packaging/BasePackageMojo.java
r1054 r1056 26 26 27 27 /** 28 * Creates a packaged Kauri application from a kauri.xml file.28 * Creates a packaged Kauri application from a wiring.xml file. 29 29 * 30 30 * While this is a plugin, it doesn't really work on the current project, 31 * but rather gets all its information from the kauri.xml file.31 * but rather gets all its information from the wiring.xml file. 32 32 * 33 33 * @requiresDependencyResolution runtime 34 * @description Creates a packaged Kauri application from a kauri.xml file.34 * @description Creates a packaged Kauri application from a wiring.xml file. 35 35 */ 36 36 public abstract class BasePackageMojo extends AbstractPackageMojo { … … 68 68 // 69 69 // Create an artifact repository to include in the webapp, containing: 70 // 1. the modules listed in the kauri.xml70 // 1. the modules listed in the wiring.xml 71 71 // 2. for each module, the dependencies listed in its classloader.xml 72 72 // … … 83 83 84 84 // 85 // Include the kauri.xml file85 // Include the configuration data 86 86 // 87 87 getLog().info("Including the configuration."); -
branches/BRANCH_CONFIG/tools/kauri-package-plugin/src/main/java/org/kauriproject/tools/plugin/packaging/BaseWebappMojo.java
r1054 r1056 30 30 31 31 /** 32 * Creates a Servlet webapp from a kauri.xml file.32 * Creates a Servlet webapp from a wiring.xml file. 33 33 * 34 34 * While this is a plugin, it doesn't really work on the current project, 35 * but rather gets all its information from the kauri.xml file.35 * but rather gets all its information from the wiring.xml file. 36 36 * 37 37 * @requiresDependencyResolution runtime 38 * @description Creates a Servlet webapp from a kauri.xml file.38 * @description Creates a Servlet webapp from a wiring.xml file. 39 39 */ 40 40 public abstract class BaseWebappMojo extends AbstractPackageMojo { … … 68 68 // 69 69 // Create an artifact repository to include in the webapp, containing: 70 // 1. the modules listed in the kauri.xml70 // 1. the modules listed in the wiring.xml 71 71 // 2. for each module, the dependencies listed in its classloader.xml 72 72 // … … 83 83 84 84 // 85 // Include the kauri.xml file85 // Include the configuration data 86 86 // 87 87 getLog().info("Including the configuration.");
Note: See TracChangeset
for help on using the changeset viewer.