Commit 29db7c7e authored by Jeroen Hoffman's avatar Jeroen Hoffman

HIPPLUG-1481 Reintegrate branch 'feature/HIPPLUG-1481' into master

parents 36c09b23 26704d11
Running locally
===============
This project uses the Maven Cargo plugin to run Essentials, the CMS and site locally in Tomcat.
From the project root folder, execute:
How to generate a demo project for the Polls feature
----------------------------------------------------
mvn clean verify
mvn -P cargo.run
1) Generate a project from the archetype.
Access the Hippo Essentials at http://localhost:8080/essentials.
After your project is set up, access the CMS at http://localhost:8080/cms and the site at http://localhost:8080/site.
Logs are located in target/tomcat7x/logs
2) To demo a custom poll document with title and poll compound, add to essentials/pom.xml:
Building distribution
=====================
<dependency>
<groupId>org.onehippo.cms7</groupId>
<artifactId>hippo-plugin-poll-essentials-demo-feature</artifactId>
<version>${hippo.plugin.poll.version}</version>
</dependency>
3) Build && run locally.
To build a Tomcat distribution tarball containing only deployable artifacts:
- With Essentials, set up the project with the default settings.
Note that JSP for templating language is not supported for the Polls Demo feature.
mvn clean verify
mvn -P dist
- With Essentials, install Polls feature, then rebuild && run twice (boarding, installing).
See also src/main/assembly/distribution.xml if you need to customize the distribution.
- With Essentials, install Polls Demo feature, then rebuild && run.
Using JRebel
============
4) Demo
Set the environment variable REBEL_HOME to the directory containing jrebel.jar.
Build with:
mvn clean verify -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
================
Automatic export of repository changes to the filesystem is turned on by default. To control this behavior, log into
http://localhost:8080/cms/console and press the "Enable/Disable Auto Export" button at the top right. To set this
as the default for your project edit the file
./bootstrap/configuration/src/main/resources/configuration/modules/autoexport-module.xml
Monitoring with JMX Console
===========================
You may run the following command:
jconsole
Now open the local process org.apache.catalina.startup.Bootstrap start
Visit http://localhost:8080/site/custompoll to see the custom poll directly in the site, or show it in the Channel
Manager preview. The standard poll component is first to be dragged onto a page (e.g. home) to become visible.
\ No newline at end of file
How to create the demo project
==============================
1) Generate project by the Maven archetype with parameters:
groupId: org.onehippo.plugins
artifactId: polldemo
version: reflect Hippo version, e.g. 11.1.0-SNAPSHOT for the archetype 4.1.0-SNAPSHOT
package: org.onehippo.plugins.polldemo
projectName: Hippo Plugin Poll Demo
Move the generated project to the /demo directory.
2) Build and run the project and install the Poll feature with Essentials, in the default set up.
Rebuild and run.
Creating a custom poll document that contains the poll compound
---------------------------------------------------------------
For the next steps, we rely on the auto-export function to export changes into the project.
3) In the CMS document type editor, create a new document type 'customPollDocument' with
- a String field with caption=Title and path=title
- a Poll compound field with caption=Poll and path=poll
Don't forget to commit changes!
4) From Essentials, use the Beanwriter tool to generate a CustomPollDocument Java class.
Implement in the bean the getter for the poll compound:
import org.onehippo.forge.poll.contentbean.compound.Poll;
public Poll getPoll() {
return getBean("polldemo:poll");
}
5) Custom poll component.
- Copy demo-creation/webfiles/custompoll.component.ftl into bootstrap/webfiles/src/main/resources/site/freemarker/polldemo
(this file was created from contents of the standard template at
/hst:hst/hst:configurations/hst:default/hst:templates/poll.component.ftl plus some extra code to show the custom title)
- Copy demo-creation/components to site/src/main/java/org/onehippo/plugins/polldemo
6) From the console, import:
_demo_creation/import/polldata-polldemo.xml into /polldata
_demo_creation/import/content-custom-example-poll.xml into /content/documents/polldemo/polls
_demo_creation/import/custompoll-catalogitem.xml into /hst:hst/hst:configurations/polldemo/hst:catalog/polldemo-catalog
_demo_creation/import/custompoll-page.xml into /hst:hst/hst:configurations/polldemo/hst:pages
_demo_creation/import/custompoll-sitemapitem.xml into /hst:hst/hst:configurations/polldemo/hst:sitemap
_demo_creation/import/custompoll-template.xml into /hst:hst/hst:configurations/polldemo/hst:templates
_demo_creation/import/custompoll-workspace-container.xml into /hst:hst/hst:configurations/polldemo/hst:workspace/hst:containers
7) Rebuild and run.
In the CMS Channel Manager, edit the channel and:
- drop the standard poll component on the home page and pick the example poll document in the component properties.
- drop the custom poll component on the custompoll page and pick the example custom poll document.
Publish the changes!
The auto export should have updated the bootstrap content & configuration.
<?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.plugins</groupId>
<artifactId>polldemo-bootstrap</artifactId>
<version>4.0.0-SNAPSHOT</version>
</parent>
<name>Hippo Plugin Poll Demo Bootstrap Configuration</name>
<description>Hippo Plugin Poll Demo Bootstrap Configuration</description>
<artifactId>polldemo-bootstrap-configuration</artifactId>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Build>${buildNumber}</Implementation-Build>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
definitions:
config:
/hippo:configuration/hippo:modules/autoexport:
/hippo:moduleconfig:
autoexport:enabled:
operation: override
type: boolean
value: true
autoexport:modules:
operation: override
type: string
value: ['bootstrap/content:/content', 'bootstrap/configuration:/']
definitions:
config:
/hippo:configuration/hippo:queries/hippo:templates/new-poll-document:
jcr:primaryType: hippostd:templatequery
hippostd:icon: adddocument_ico
hippostd:modify: [./_name, $name, './hippotranslation:locale', $inherited, './hippotranslation:id',
$uuid, './hippostdpubwf:createdBy', $holder, './hippostdpubwf:creationDate',
$now, './hippostdpubwf:lastModifiedBy', $holder, './hippostdpubwf:lastModificationDate',
$now, './hippostd:holder', $holder]
jcr:language: xpath
jcr:statement: //element(*,hipposysedit:namespacefolder)/element(*,mix:referenceable)/element(*,hipposysedit:templatetype)/hipposysedit:prototypes/element(hipposysedit:prototype,poll:polldocument)
definitions:
config:
/hippo:configuration/hippo:queries/hippo:templates/new-poll-folder:
jcr:primaryType: hippostd:templatequery
jcr:mixinTypes: ['hipposys:implementation']
hippostd:icon: addfolder_ico
hippostd:modify: [./_name, $name, './hippotranslation:id', $uuid, './hippotranslation:locale',
$inherited]
hipposys:classname: org.hippoecm.repository.impl.query.DirectPath
jcr:language: xpath
jcr:statement: /jcr:root/hippo:configuration/hippo:queries/hippo:templates/new-poll-folder/hippostd:templates/node()
/hippostd:templates:
jcr:primaryType: hippostd:templates
/hippostd:folder:
jcr:primaryType: hippostd:folder
jcr:mixinTypes: ['hippotranslation:translated', 'mix:referenceable']
jcr:uuid: 9914c93a-1631-4e06-8985-b3ec013837c5
hippostd:foldertype: [new-poll-document, new-poll-folder]
hippotranslation:id: generated id
hippotranslation:locale: inherited locale
definitions:
config:
/hippo:configuration/hippo:queries/hippo:templates/new-resource-bundle:
jcr:primaryType: hippostd:templatequery
hippostd:icon: adddocument_ico
hippostd:modify: [./_name, $name, './hippotranslation:locale', $inherited, './hippotranslation:id',
$uuid, './hippostdpubwf:createdBy', $holder, './hippostdpubwf:creationDate',
$now, './hippostdpubwf:lastModifiedBy', $holder, './hippostdpubwf:lastModificationDate',
$now, './hippostd:holder', $holder]
jcr:language: xpath
jcr:statement: //element(*,hipposysedit:namespacefolder)/element(*,mix:referenceable)/element(*,hipposysedit:templatetype)/hipposysedit:prototypes/element(hipposysedit:prototype,resourcebundle:resourcebundle)
definitions:
config:
/hippo:configuration/hippo:queries/hippo:templates/new-untranslated-folder:
jcr:primaryType: hippostd:templatequery
jcr:mixinTypes: ['hipposys:implementation']
hippostd:icon: addfolder_ico
hippostd:modify: [./_name, $name]
hipposys:classname: org.hippoecm.repository.impl.query.DirectPath
jcr:language: xpath
jcr:statement: "/jcr:root/hippo:configuration/hippo:queries/hippo:templates/new-untranslated-folder/hippostd:templates/node()\n\
\ "
/hippostd:templates:
jcr:primaryType: hippostd:templates
/hippostd:folder:
jcr:primaryType: hippostd:folder
jcr:mixinTypes: ['mix:versionable']
jcr:uuid: 92eb469f-636c-4e88-a5f4-2839491523fb
hippostd:foldertype: [new-resource-bundle, new-untranslated-folder]
definitions:
config:
/hst:hst/hst:configurations:
/common:
jcr:primaryType: hst:configuration
/hst:sitemap:
jcr:primaryType: hst:sitemap
/hst:abstractpages:
jcr:primaryType: hst:pages
/hst:pages:
jcr:primaryType: hst:pages
/hst:components:
jcr:primaryType: hst:components
/hst:templates:
jcr:primaryType: hst:templates
/hst:sitemenus:
jcr:primaryType: hst:sitemenus
/hst:sitemapitemhandlers:
jcr:primaryType: hst:sitemapitemhandlers
/hst:catalog:
jcr:primaryType: hst:catalog
/polldemo:
jcr:primaryType: hst:configuration
hst:inheritsfrom: [../common]
definitions:
config:
/hst:hst/hst:configurations/hst:default/hst:catalog:
/essentials-catalog:
jcr:primaryType: hst:containeritempackage
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:abstractpages:
jcr:primaryType: hst:pages
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:abstractpages/base:
jcr:primaryType: hst:component
hst:template: base-layout
/menu:
jcr:primaryType: hst:component
hst:componentclassname: org.onehippo.cms7.essentials.components.EssentialsMenuComponent
hst:parameternames: [selectedMenu, level, menu]
hst:parametervalues: ['on', '1', main]
hst:template: base-top-menu
/top:
jcr:primaryType: hst:containercomponentreference
hst:referencecomponent: base/top
/footer:
jcr:primaryType: hst:component
hst:template: base-footer
/container:
jcr:primaryType: hst:containercomponentreference
hst:referencecomponent: base/footer
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:catalog:
jcr:primaryType: hst:catalog
/polldemo-catalog:
jcr:primaryType: hst:containeritempackage
/custompoll:
jcr:primaryType: hst:containeritemcomponent
hst:componentclassname: org.onehippo.plugins.polldemo.components.CustomPollDocumentComponent
hst:label: Custom Poll
hst:parameternames: [poll-pollCompoundName, poll-docsPath, poll-dataPath,
poll-docsClass]
hst:parametervalues: ['polldemo:poll', /, polldata, org.onehippo.plugins.polldemo.beans.CustomPollDocument]
hst:template: custompoll-component
hst:xtype: HST.Item
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:components:
jcr:primaryType: hst:components
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:pages:
jcr:primaryType: hst:pages
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:pages/custompoll:
jcr:primaryType: hst:component
hst:referencecomponent: hst:abstractpages/base
/main:
jcr:primaryType: hst:component
hst:template: homepage-main
/container:
jcr:primaryType: hst:containercomponentreference
hst:referencecomponent: custompoll/main
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:pages/homepage:
jcr:primaryType: hst:component
hst:referencecomponent: hst:abstractpages/base
/main:
jcr:primaryType: hst:component
hst:template: homepage-main
/container:
jcr:primaryType: hst:containercomponentreference
hst:referencecomponent: homepage/main
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:pages/pagenotfound:
jcr:primaryType: hst:component
hst:referencecomponent: hst:abstractpages/base
/main:
jcr:primaryType: hst:component
hst:componentclassname: org.onehippo.cms7.essentials.components.EssentialsPageNotFoundComponent
hst:template: pagenotfound-main
/container:
jcr:primaryType: hst:containercomponentreference
hst:referencecomponent: pagenotfound/main
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:prototypepages:
jcr:primaryType: hst:pages
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:sitemap:
jcr:primaryType: hst:sitemap
/root:
jcr:primaryType: hst:sitemapitem
hst:componentconfigurationid: hst:pages/homepage
hst:refId: root
/_any_:
jcr:primaryType: hst:sitemapitem
hst:componentconfigurationid: hst:pages/pagenotfound
/pagenotfound:
jcr:primaryType: hst:sitemapitem
hst:componentconfigurationid: hst:pages/pagenotfound
hst:refId: pagenotfound
/custompoll:
jcr:primaryType: hst:sitemapitem
hst:componentconfigurationid: hst:pages/custompoll
hst:refId: custompoll
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:sitemenus:
jcr:primaryType: hst:sitemenus
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:templates:
jcr:primaryType: hst:templates
/base-layout:
jcr:primaryType: hst:template
hst:renderpath: webfile:/freemarker/polldemo/base-layout.ftl
/base-top-menu:
jcr:primaryType: hst:template
hst:renderpath: webfile:/freemarker/polldemo/base-top-menu.ftl
/base-footer:
jcr:primaryType: hst:template
hst:renderpath: webfile:/freemarker/polldemo/base-footer.ftl
/homepage-main:
jcr:primaryType: hst:template
hst:renderpath: webfile:/freemarker/polldemo/homepage-main.ftl
/pagenotfound-main:
jcr:primaryType: hst:template
hst:renderpath: webfile:/freemarker/polldemo/pagenotfound-main.ftl
/custompoll-component:
jcr:primaryType: hst:template
hst:renderpath: webfile:/freemarker/polldemo/custompoll.component.ftl
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:workspace:
jcr:primaryType: hst:workspace
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:workspace/hst:channel:
jcr:primaryType: hst:channel
hst:name: Hippo Plugin Poll Demo
hst:type: website
/hst:channelinfo:
jcr:primaryType: hst:channelinfo
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:workspace/hst:containers:
jcr:primaryType: hst:containercomponentfolder
/base:
jcr:primaryType: hst:containercomponentfolder
/top:
jcr:primaryType: hst:containercomponent
hst:label: Top
hst:xtype: HST.Span
/footer:
jcr:primaryType: hst:containercomponent
hst:label: Footer
hst:xtype: HST.vBox
/homepage:
jcr:primaryType: hst:containercomponentfolder
/main:
jcr:primaryType: hst:containercomponent
hst:label: Home Page Main
hst:lastmodified: 2016-08-19T13:01:47.489+02:00
hst:xtype: HST.vBox
/poll:
jcr:primaryType: hst:containeritemcomponent
hst:componentclassname: org.onehippo.forge.poll.component.PollDocumentComponent
hst:iconpath: resources/poll/catalog-poll.png
hst:label: Poll
hst:parameternames: [poll-pollCompoundName, poll-dataPath, poll-docsPath,
poll-docsClass]
hst:parametervalues: ['poll:poll', polldata, /content/documents/polldemo/polls/example-poll,
org.onehippo.forge.poll.contentbean.PollDocument]
hst:template: poll.component.ftl
hst:xtype: HST.Item
/pagenotfound:
jcr:primaryType: hst:containercomponentfolder
/main:
jcr:primaryType: hst:containercomponent
hst:label: Page-Not-Found Main
hst:xtype: HST.vBox
/custompoll:
jcr:primaryType: hst:containercomponentfolder
/main:
jcr:primaryType: hst:containercomponent
hst:lastmodified: 2016-08-19T13:01:47.489+02:00
hst:xtype: HST.vBox
/custompoll:
jcr:primaryType: hst:containeritemcomponent
hst:componentclassname: org.onehippo.plugins.polldemo.components.CustomPollDocumentComponent
hst:label: Custom Poll
hst:parameternames: [poll-pollCompoundName, poll-dataPath, poll-docsPath,
poll-docsClass]
hst:parametervalues: ['polldemo:poll', polldata, /content/documents/polldemo/polls/custom-example-poll,
org.onehippo.plugins.polldemo.beans.CustomPollDocument]
hst:template: custompoll-component
hst:xtype: HST.Item
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:workspace/hst:pages:
jcr:primaryType: hst:pages
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:workspace/hst:sitemap:
jcr:primaryType: hst:sitemap
definitions:
config:
/hst:hst/hst:configurations/polldemo/hst:workspace/hst:sitemenus:
jcr:primaryType: hst:sitemenus
/main:
jcr:primaryType: hst:sitemenu
/home:
jcr:primaryType: hst:sitemenuitem
hst:referencesitemapitem: root
definitions:
config:
/hst:hst/hst:hosts/dev-localhost:
jcr:primaryType: hst:virtualhostgroup
hst:cmslocation: http://localhost:8080/cms
hst:defaultport: 8080
/localhost:
jcr:primaryType: hst:virtualhost
/hst:root:
jcr:primaryType: hst:mount
hst:homepage: root
hst:mountpoint: /hst:hst/hst:sites/polldemo
definitions:
config:
/hst:hst/hst:sites/polldemo:
jcr:primaryType: hst:site
hst:content: /content/documents/polldemo
definitions:
namespace:
polldemo:
uri: http://www.onehippo.org/polldemo/nt/1.0
cnd: namespaces/polldemo.cnd
config:
/hippo:configuration/hippo:modules/webfiles/hippo:moduleconfig:
watchedModules: [bootstrap/webfiles]
/hippo:configuration/hippo:groups/author:
hipposys:members:
operation: add
type: string
value: [author]
/hippo:configuration/hippo:groups/editor:
hipposys:members:
operation: add
type: string
value: [editor]
/hippo:configuration/hippo:groups/webmaster:
hipposys:members:
operation: add
type: string
value: [editor]
/hippo:configuration/hippo:domains/hippofolders/readonly:
hipposys:groups:
operation: add
type: string
value: [sitewriters]
/hippo:configuration/hippo:domains/preview-documents/readonly:
hipposys:groups:
operation: add
type: string
value: [previewusers]
/hippo:configuration/hippo:domains/live-documents/readonly:
hipposys:groups:
operation: add
type: string
value: [liveusers]
<'hippo'='http://www.onehippo.org/jcr/hippo/nt/2.0.4'>
<'hippostd'='http://www.onehippo.org/jcr/hippostd/nt/2.0'>
<'hippostdpubwf'='http://www.onehippo.org/jcr/hippostdpubwf/nt/1.0'>
<'hippotranslation'='http://www.onehippo.org/jcr/hippotranslation/nt/1.0'>
<'polldemo'='http://www.onehippo.org/polldemo/nt/1.0'>
[polldemo:basedocument] > hippo:document, hippostd:publishableSummary, hippostdpubwf:document
orderable
[polldemo:customPollDocument] > hippostd:relaxed, hippotranslation:translated, polldemo:basedocument
orderable
definitions:
config:
/hippo:namespaces/polldemo:
jcr:primaryType: hipposysedit:namespace
jcr:mixinTypes: ['mix:referenceable']