Crafter Configuration
You are viewing this demo application because this Crafter website application is running under a default configuration. It is possible to configure Crafter to load your website rather than the default or demo website. website site configuration from a number of sources, namely
- A location on disk inside the war file
- A location on disk outside the war file
- A Alfresco WCM Store
It is possible to provide other data sources by creating new implementations of the Crafer WCM Adapter. By altering the configuration of Crafter to include different implementations of DAO (Data Acces Objects) and caching parameters it is possible to create different modes in which the application can run, each suitable for different needs.
- Default Mode
- Developer Mode
- Production Mode
- Alfresco WCM Preview Server Mode
Default Mode
Default mode loads the website you are looking at now. This is essentially a default website configuration that lives inside the war file. This is not generally a configuration which is usable for production environments. It implies that in order to udpdate content one must redeploy the War file. In most cases we want a CMS to deploy content to the application. However, such a default configuration is useful for creating a default website that will be shown when the system has not yet been configured.
Developer Mode
Developer Mode uses a file system based store for its site configuration which lives out side of the WAR file. This configuration is very similar to Production except all caching has been disabled to facilitate quick editing and feedback without the need to refresh the webapp or clear any caches.
Production Mode
Production Mode uses a file system based store for its site configuration which lives out side of the WAR file. This configuration has aggressive caching presets which are appropriate for a production runtime.
Alfresco WCM Preview Server Mode
The Alfresco WCM Preview server configuration allows Crafter to read its configurations from Alfresco WCM sandboxes. All caching is disabled creating an environment in which changes to managed content within a repository are immediately viewable with a simple refresh of the page. Alfresco WCM Preview Server mode is designed to provide an in-context preview of edits made in the content authoring and website construction process. Preview server is not nearly as fast as the disk based implementations of the content DAO due to the fact that every descriptor file and every content asset must be queried and served from the repository via a remote RESTful call and no caches are enabled to ensure that every single change is surfaced to the user immediately upon saving them to the CMS.
Setting up Crafter
To change modes or override any Crafter configuration. In a shared class loader area create the following:
- ./seam-demo/extension
- Add the a file called application-custom-context.xml with the following content
- Add an empty file at ./seam-demo/custom-system-cfg.properties
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <!-- load common properties --> <bean id="crafterConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="ignoreUnresolvablePlaceholders"> <value>true</value> </property> <property name="locations"> <list> <value>classpath:core/system-cfg.properties</value> <value>classpath:core/crafter-cfg.properties</value> <value>classpath:seam-demo/custom-system-cfg.properties</value> </list> </property> </bean> <!-- uncomment to enable alfresco preview server mode --> <!--<import resource="classpath:core/mode-alfwcm-preview-server.xml" /> --> <!-- To override the Alfresco endpoint configuration like user name, password, server address port and so forth place the key value pair properties that you wish to override from core/system-cfg.properties in your custom-system-cfg.properties file --> <!-- uncomment to enable development server mode --> <!--<import resource="classpath:core/mode-development-server.xml" /> --> <!-- To override the file path Crafter should use to pick up your website configuration place the key value pair crafter.base.site.path=PATH-HERE ie: crafter.base.site.path=../../websites/crafter/ROOT in your custom-system-cfg.properties file --> <!-- uncomment to enable production server mode --> <!--<import resource="classpath:core/mode-production-server.xml" /> --> <!-- To override the file path Crafter should use to pick up your website configuration place the key value pair crafter.base.site.path=PATH-HERE ie: crafter.base.site.path=../../websites/crafter/ROOT in your custom-system-cfg.properties file --> </beans>
Special Configuration of Alfresco to support Crafter
Preview Server Icon
The Alfresco WCM client provides users with a preview icon which launches the a window to a server that can provide the author with an in-context preview of their changes. This icon must be configured to point the user to the appropriate sandbox, server name and port. To configure this configure the preview Icon:
- In ./alfresco/tomcat/shared/classes/alfresco/extension/preview-context.xml place the following contents in verbatim.
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <bean id="PreviewURIService" class="org.alfresco.web.bean.wcm.preview.StoreSpecificPreviewURIService"> <constructor-arg index="0"> <list> <bean class="org.alfresco.util.Pair"> <constructor-arg index="0" value=".*" /> <constructor-arg index="1"> <bean class="org.alfresco.web.bean.wcm.preview.URITemplatePreviewURIService"> <constructor-arg index="0" value="http://{storeId}.www--sandbox.127-0-0-1.ip.alfrescodemo.net:8080/" /> </bean> </constructor-arg> </bean> </list> </constructor-arg> </bean> </beans>
Crafter Preview Server Webscripts
Crafter needs a few APIs to be installed in to Alfresco in order to support the preview server. To install them:
1. Download the APIs from here and import it in to the webscripts area of the Alfresco Data Dictionary