Commit fceb1073 authored by Frank van Lankvelt's avatar Frank van Lankvelt

CMS7-6455: merge auto-export in cms build

- separate constants class for frontend; do not rely on repository jar being on the same classpath
- use new sax dereferenced export view method on hippo session
parent 434209d8
This diff is collapsed.
......@@ -23,12 +23,6 @@ api/workspaces
automatic-export/.idea
automatic-export/.project
automatic-export/.settings
automatic-export/demo/cms/target
automatic-export/demo/content/target
automatic-export/demo/foocontent/target
automatic-export/demo/site/target
automatic-export/demo/storage
automatic-export/demo/target
automatic-export/frontend/.classpath
automatic-export/frontend/.project
automatic-export/frontend/.settings
......
Running locally
===============
This project uses the Maven Cargo plugin to run the CMS and site locally in Tomcat.
From the project root folder, execute:
$ mvn clean install
$ mvn -P cargo.run
Access the CMS at http://localhost:8080/cms, and the site at http://localhost:8080/site
Logs are located in target/tomcat6x/logs
Building distribution
=====================
To build a Tomcat distribution tarball containing only deployable artifacts:
$ mvn clean install
$ mvn -P dist
See also src/main/assembly/distribution.xml if you need to customize the distribution
Using JRebel
============
Set the environment variable REBEL_HOME to the directory containing jrebel.jar.
Build with:
$ mvn clean install -Djrebel
Start with:
$ mvn -P cargo.run -Djrebel
Best Practice for development
============
Use the option -Drepo.path=/some/path/to/repository during start up. This will avoid
your repository to be cleared when you do a mvn clean.
For example start your project with:
$ mvn -P cargo.run -Drepo.path=/home/usr/tmp/repo
or with jrebel:
$ mvn -P cargo.run -Drepo.path=/home/usr/tmp/repo -Djrebel
Hot deploy
==========
To hot deploy, redeploy or undeploy the CMS or site:
$ cd cms (or site)
$ mvn cargo:redeploy (or cargo:undeploy, or cargo:deploy)
Automatic Export
==========
To have your repository changes automatically exported to filesystem during local development, add to the
startup cmd:
$ mvn -P cargo.run -Dhippoecm.export.dir=content/src/main/resources
The automatic export can then be switch off/on through the /cms/console. By default it is switched on.
Monitoring with JMX Console
===========================
You may run the following command:
$ jconsole
Now open the local process org.apache.catalina.startyp.Bootstrap start
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.onehippo.cms7</groupId>
<artifactId>autoexportdemo</artifactId>
<version>1.01.00-SNAPSHOT</version>
</parent>
<name>Automatic Export Demo CMS</name>
<description>Automatic Export Demo CMS</description>
<artifactId>autoexportdemo-cms</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-package-cms-dependencies</artifactId>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-package-cms-resources</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-repository-dependencies</artifactId>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-repository-export</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-addon-automatic-export-frontend</artifactId>
<version>2.02.04-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-addon-automatic-export-repository</artifactId>
<version>2.02.04-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.onehippo.cms7.hst.toolkit-resources.addon.toolkit-cnd</groupId>
<artifactId>hst-addon-cnd</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7.hst.toolkit-resources.addon</groupId>
<artifactId>hst-addon-repository</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-addon-hst-configuration-editor-frontend</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-addon-hst-configuration-editor-repository</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-addon-channel-manager-frontend</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-addon-channel-manager-repository</artifactId>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>autoexportdemo-content</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>autoexportdemo-foocontent</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Gallery picker dependency -->
<dependency>
<groupId>org.onehippo.addon.frontend.gallerypicker</groupId>
<artifactId>gallerypicker</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<finalName>cms</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-package-cms-resources</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<configuration>
<type>runtime</type>
</configuration>
<container>
<type>remote</type>
</container>
</configuration>
</plugin>
<plugin>
<groupId>com.googlecode.mavenfilesync</groupId>
<artifactId>maven-filesync-plugin</artifactId>
<configuration>
<mappings>
<mapping>
<sourceFolder>src/main/resources</sourceFolder>
<destinationFolder>@../target/tomcat${cargo.tomcat.major.version}x/webapps/cms/WEB-INF/classes</destinationFolder>
</mapping>
<mapping>
<sourceFolder>src/main/webapp</sourceFolder>
<destinationFolder>@../target/tomcat${cargo.tomcat.major.version}x/webapps/cms</destinationFolder>
</mapping>
</mappings>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5"
id="cms">
<!-- General configuration -->
<display-name>Automatic Export Demo CMS</display-name>
<description>Automatic Export Demo CMS</description>
<context-param>
<description>The address of the repository</description>
<param-name>repository-address</param-name>
<param-value>rmi://localhost:1099/hipporepository</param-value>
</context-param>
<context-param>
<description>The (relative) location where to store files</description>
<param-name>repository-directory</param-name>
<param-value>storage</param-value>
</context-param>
<context-param>
<description>The location of the repository configuration file. Unless the location
starts with file://, the location is retrieved from within the application package as
resource.</description>
<param-name>repository-config</param-name>
<param-value>repository.xml</param-value>
</context-param>
<!--No concurrent logins-->
<filter>
<filter-name>ConcurrentLogin</filter-name>
<filter-class>org.hippoecm.frontend.plugins.login.ConcurrentLoginFilter</filter-class>
</filter>
<!--Remap resources as anti-cache-->
<filter>
<filter-name>ResourceAntiCache</filter-name>
<filter-class>org.hippoecm.frontend.ResourceRewriteFilter</filter-class>
<!-- init-param>
<param-name>prefix</param-name>
<param-value>nocache</param-value>
</init-param -->
</filter>
<!--Default application-->
<filter>
<filter-name>CMS</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>org.hippoecm.frontend.Main</param-value>
</init-param>
<init-param>
<param-name>filterMappingUrlPattern</param-name>
<param-value>/*</param-value>
</init-param>
<init-param>
<param-name>wicket.configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>repository-address</param-name>
<param-value>vm://</param-value>
</init-param>
<init-param>
<param-name>upload-limit</param-name>
<param-value>4096k</param-value>
</init-param>
</filter>
<!--Builtin console-->
<filter>
<filter-name>Console</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class>
<init-param>
<param-name>applicationClassName</param-name>
<param-value>org.hippoecm.frontend.Main</param-value>
</init-param>
<init-param>
<param-name>config</param-name>
<param-value>console</param-value>
</init-param>
<init-param>
<param-name>wicket.configuration</param-name>
<param-value>deployment</param-value>
</init-param>
<init-param>
<param-name>repository-address</param-name>
<param-value>vm://</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ConcurrentLogin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ResourceAntiCache</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>CMS</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Console</filter-name>
<url-pattern>/console/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.hippoecm.frontend.plugins.login.ConcurrentLoginListener</listener-class>
</listener>
<servlet>
<servlet-name>StatusServlet</servlet-name>
<servlet-class>org.hippoecm.repository.StatusServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>LoggingServlet</servlet-name>
<servlet-class>org.hippoecm.repository.LoggingServlet</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<!-- Repository -->
<servlet>
<servlet-name>Repository</servlet-name>
<servlet-class>org.hippoecm.repository.RepositoryServlet</servlet-class>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet>
<servlet-name>PingServlet</servlet-name>
<servlet-class>org.hippoecm.repository.PingServlet</servlet-class>
<init-param>
<param-name>repository-address</param-name>
<param-value>vm://</param-value>
</init-param>
<load-on-startup>5</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>StatusServlet</servlet-name>
<url-pattern>/status/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>LoggingServlet</servlet-name>
<url-pattern>/logging/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Repository</servlet-name>
<url-pattern>/repository/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>PingServlet</servlet-name>
<url-pattern>/ping/</url-pattern>
</servlet-mapping>
<!-- Timeout in minutes -->
<session-config>
<session-timeout>60</session-timeout>
</session-config>
</web-app>
/* Defaults */
* { margin: 0; padding: 0; }
div.clearer { clear: both; }
/* ======================================== */
body, table tr td, table tr th {
font-family: arial,sans-serif,helvetica;
font-size: 12px;
line-height: 14px;
vertical-align: top;
background: white;
padding-top: 5px;
}
ol, ul{ list-style-position: inside }
h1 {
font-size: 1.4em;
line-height: 2.7em;
font-weight: bold;
font-family: arial, sans-serif;
}
h2 {
font-size: 1.2em;
line-height: 1.2em;
margin: 0.65em 0;
font-weight: bold;
font-family: arial, sans-serif;
}
h3 {
font-size: 1.3em;
line-height: 1.2em;
margin: 0.65em 0;
font-weight: bold;
font-family: arial, sans-serif;
}
h4, h5, h6 {
font-size: 1.2em;
line-height: 1.2em;
margin: 0.65em 0;
font-family: arial, sans-serif;
}
p {
font-size: 1.2em;
line-height: 1.2em;
font-family: arial, sans-serif;
}
<?xml version='1.0' encoding='utf-8'?>
<Context>
<!-- Disable session persistence across Tomcat restarts -->
<Manager pathname="" />
<Parameter name="repository-address" value="rmi://127.0.0.1:1099/hipporepository" override="false"/>
<!--
<Parameter name="repository-directory" value="/data/storage" override="false"/>
-->
<!--
<Parameter name="hst-config-properties" value="file:${catalina.base}/conf/hst.properties" override="false"/>
-->
</Context>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- ====================================================================== -->
<!-- A P P E N D E R S -->
<!-- ====================================================================== -->
<!-- hippo-cms.log -->
<appender name="cms" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${catalina.base}/logs/hippo-cms.log"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} %-5p [%C.%M():%L] %m%n"/>
</layout>
</appender>
<!-- hippo-site.log -->
<appender name="site" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${catalina.base}/logs/hippo-site.log"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} %-5p [%C.%M():%L] %m%n"/>
</layout>
</appender>
<!-- hippo-audit.log -->
<appender name="audit" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${catalina.base}/logs/hippo-audit.log"/>
<param name="Append" value="true"/>
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} %-5p [%C.%M():%L] %m%n"/>
</layout>
</appender>
<!-- console -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} %-5p [%C.%M():%L] %m%n"/>
</layout>
</appender>
<!-- ====================================================================== -->
<!-- L O G G E R S -->
<!-- ====================================================================== -->
<!-- CMS logging -->
<logger name="org.apache.jackrabbit.core">
<level value="warn"/>
</logger>
<logger name="org.apache.jackrabbit.extractor">
<level value="warn"/>
</logger>
<logger name="org.apache.jackrabbit">
<level value="warn"/>
</logger>
<logger name="org.hippoecm.repository">
<level value="warn"/>
</logger>
<logger name="org.hippoecm.frontend">
<level value="warn"/>
</logger>
<logger name="org.apache.wicket">
<level value="warn"/>
</logger>
<!-- audit logging -->
<logger additivity="false" name="org.hippoecm.repository.api.Workflow">
<level value="info"/>
<appender-ref ref="audit"/>
</logger>
<!-- Site logging -->
<logger additivity="false" name="org.hippoecm.hst">
<level value="warn"/>
<appender-ref ref="site"/>
<appender-ref ref="console"/>
</logger>
<logger additivity="false" name="freemarker">
<level value="warn"/>
<appender-ref ref="site"/>
<appender-ref ref="console"/>
</logger>
<logger additivity="false" name="org.apache.cxf">
<level value="warn"/>
<appender-ref ref="site"/>
<appender-ref ref="console"/>
</logger>
<logger additivity="false" name="javax.ws.rs.core">
<level value="warn"/>
<appender-ref ref="site"/>
<appender-ref ref="console"/>
</logger>
<logger additivity="false" name="org.apache.commons.pool">
<level value="warn"/>
<appender-ref ref="site"/>
<appender-ref ref="console"/>
</logger>
<logger additivity="false" name="org.apache.commons.beanutils">
<level value="warn"/>
<appender-ref ref="site"/>
<appender-ref ref="console"/>
</logger>
<!-- too many caching warnings -->
<logger name="org.apache.jackrabbit.core.state">
<level value="error"/>
</logger>
<logger name="org.apache.jackrabbit.core.ItemManager">
<level value="error"/>
</logger>
<logger name="org.apache.jackrabbit.core.persistence.bundle.util.LRUNodeIdCache">
<level value="error"/>
</logger>
<!-- ignore wicket localizer warnings -->
<logger name="org.apache.wicket.Localizer">
<level value="error"/>
</logger>
<!-- ignore DataNucleus errors -->
<logger name="DataNucleus.Plugin">
<level value="fatal"/>
</logger>
<logger name="DataNucleus.ClassLoading">
<level value="fatal"/>
</logger>
<logger name="DataNucleus.Enhancer">
<level value="fatal"/>
</logger>
<!-- more info wanted -->
<logger name="org.apache.jackrabbit.core.persistence.bundle">
<level value="warn"/>
</logger>
<logger name="org.hippoecm.repository.jackrabbit.persistence">
<level value="info"/>
</logger>
<logger name="org.hippoecm.repository.updater">
<level value="info"/>
</logger>
<logger name="org.onehippo.cms7.autoexport">
<level value="debug"/>
</logger>
<root>
<level value="warn"/>
<appender-ref ref="cms"/>
<appender-ref ref="console"/>
</root>
</log4j:configuration>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- ====================================================================== -->
<!-- A P P E N D E R S -->
<!-- ====================================================================== -->
<!-- hippo-cms.log -->
<appender name="cms" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="${catalina.base}/logs/hippo-cms.log"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} %-5p [%C.%M():%L] %m%n"/>
</layout>