-
Notifications
You must be signed in to change notification settings - Fork 13
Migrating to 0.4.x
gdrouet edited this page Sep 28, 2013
·
2 revisions
0.4.0 completely reviews the way we configure WUIC. The improvementmainly allow to :
- use any engine and any DAO with a default configuration without having to declare it
- polling the configuration
- specify exactly the engines you want to process
- use a specific terminology related to the WUIC architecture
This guide focuses on the migration of existing features and not on new features (like polling for instance).
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wuic SYSTEM 'http://capgemini.com/wuic/wuic.dtd'>
<wuic ehcache-provider="com.github.wuic.configuration.impl.DefaultEhCacheProvider">
</wuic>
<?xml version="1.0" encoding="UTF-8"?>
<wuic>
</wuic>
- We don't use a DTD anymore but an XSD available here : https://raw.github.com/gdrouet/wuic/wuic-0.4.0-snapshot/modules/core/src/main/resources/wuic.xsd
- ehcache-provider is now a property of the EhCacheEngineBuilder
<resource-factory-builders>
<resource-factory-builder id="imgSourceRootProvider" class="com.github.wuic.resource.impl.classpath.ClasspathWuicResourceFactoryBuilder" regex="true">
<properties>
<property key="c.g.wuic.classpathBasePath">/img</property>
</properties>
</resource-factory-builder>
<resource-factory-builder id="appSourceRootProvider" class="com.github.wuic.servlet.WebappWuicResourceFactoryBuilder" />
</resource-factory-builders>
<nut-dao-builders>
<nut-dao-builder id="imgSourceRootProvider" type="ClasspathNutDaoBuilder">
<properties>
<property key="c.g.wuic.dao.basePath">/img</property>
<property key="c.g.wuic.dao.regex">true</property>
</properties>
</nut-dao-builder>
<nut-dao-builder id="appSourceRootProvider" type="WebappNutDaoBuilder" />
</nut-dao-builders>
- A resource is now called a nut, a factory a DAO so a ResourceFactoryBuilder is now a NutDaoBuilder
- A builder is now built with a type and not a class. The type is the simple class name.
- Property names have changed, they now starts with 'c.g.wuic.dao' and their name are more global (c.g.wuic.dao.basePath for all builders instead the specific c.g.wuic.classpathBasePath).
- Activating regex is now done thanks to a classic builder's property
<groups>
<group id="img" configuration="sprite-image-png" default-builder="imgSourceRootProvider">
<file>.*.png</file>
</group>
</groups>
<heaps>
<heap id="img" dao-builder-id="imgSourceRootProvider">
<nut-path>.*.png</nut-path>
</heap>
</heaps>
- The group is now called a heap
- The nut is not necessary a file so we use now 'nut-path' instead of 'file'
- The heap is linked to a DAO thanks to dao-builder-id
<configurations>
<configuration id="yuicompressor-js" type="JAVASCRIPT">
<cache>true</cache>
<aggregate>true</aggregate>
<charset>UTF-8</charset>
<compress>true</compress>
<yuiLineBreakPos>-1</yuiLineBreakPos>
<yuiDisableOptimizations>false</yuiDisableOptimizations>
<yuiMunge>true</yuiMunge>
<yuiPreserveAllSemiColons>false</yuiPreserveAllSemiColons>
<yuiVerbose>true</yuiVerbose>
</configuration>
<configuration id="sprite-image-png" type="SPRITE">
<cache>true</cache>
<compress>true</compress>
<aggregate>true</aggregate>
<charset>UTF-8</charset>
<sprite-provider>com.github.wuic.engine.impl.embedded.CGJavascriptSpriteProvider</sprite-provider>
</configuration>
</configurations>
<engine-builders>
<engine-builder id="spriteEngine" type="ImageAggregatorEngineBuilder">
<properties>
<property key="c.g.wuic.engine.spriteProviderClassName">javascript</property>
</properties>
</engine-builder>
</engine-builders>
<workflows>
<workflow id-prefix="" heap-id-pattern=".*">
<without>
<engine-builder-id>wuicDefaultMemoryMapCacheEngineBuilder</engine-builder-id>
</without>
<engine-chain>
<engine-builder-id>wuicDefaultEhCacheEngineBuilder</engine-builder-id>
<engine-builder-id>wuicDefaultYuiCompressorJavascriptEngineBuilder</engine-builder-id>
<engine-builder-id>spriteEngine</engine-builder-id>
</engine-chain>
</workflow>
<workflows>
- By default, some engines are injected by default. Here a memory cache injected by default is excluded thanks to the 'without' tag
- Configurations don't exist anymore and have been merged directly with engines builders
- We don't import a heap with its ID (group) anymore but with a workflow referencing it
- The workflow will have the same ID as the heap if 'id-prefix' is empty
- heap-id-pattern is a regex which selects here all the heaps
- By default, YUICompressor & EhCache are not used, we must refer them in the chain of responsibility
- The default builder for image aggregation does not use Javascript sprite, so we declare a custom one