I’m working for the camel-events-support, and its release notes states that the version 1.x supports for Hippo CMS 12.x. But when working with its demo project, I found the problem.
It is something related with site module which uses listener of org.hippoecm.hst.site.container.HstContextLoaderListener in web.xml to configure/initialize/destroy HST Container, and which does not exist in Hippo CMS 10.x. Thus, if I use the listener, I got the following error:
[INFO] [talledLocalContainer] org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/org/hippoecm/hst/cmsrest/SpringComponentManager-cmsrest.xml]
[INFO] [talledLocalContainer] Offending resource: file [/Users/tonny/Documents/hippo-workspace/demo/target/tomcat8x/webapps/site/WEB-INF/classes/META-INF/hst-assembly/overrides/hst-cms-rest.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [org/hippoecm/hst/cmsrest/SpringComponentManager-cmsrest.xml]; nested exception is java.io.FileNotFoundException: class path resource [org/hippoecm/hst/cmsrest/SpringComponentManager-cmsrest.xml] cannot be opened because it does not exist
. However, if I remove the listener, the HST Container Services will not be initialized at all.
Unfortunately, the demo sub-project was not upgraded to be compliant with v12 yet. The parent root pom (demo/pom.xml) still inherits from 10.1.0. Sorry for that.
For now, you can create a demo project locally using hippo archetype for your testing and use the forge component somehow.
There are 3 steps:
Instantiate Camel Context
You need to initialize spring web application context and camel Context. See the examples:
Your camel route doesn’t have to invoke a REST service, perhaps you can use JCR API or Workflow API or even Content EXIM API to create/update document. But at the moment, the demo includes REST APIs just for simplicity to be invoked from a camel route.
Feel free to let us know how it goes. Also feel free to create a JIRA tickets to improve its demo or documentation in https://issues.onehippo.com/projects/HIPFORGE. Pull requests are more than welcome, too.
The 3 steps you mentioned is actually what I have done to create a camel route in Hippo CMS, and it really works fine. The following question is how to get the documents’ info, viz. get some subclasses of BaseDocument. The demo sample provides a way to use rest api in site, which, unfortunately, will cause some errors for version 12.x.
For your suggestion to use JCR API or Workflow API etc., I may get wrong knowledge but I’m afraid all this API should be in site module which is just the same module in where all BaseDocument's subclasses exist. Thus, how can camel route in cms module call some API exist in site module?
I see. You want to take advantage of HST Content Beans.
In that case, I think you can do the following:
The original demo used HST Plain JAX-RS Services (the “rest api in site”) [1]. So, you can enable a plain JAX-RS service mount and copy/configure the REST services. So,
Indeed, if you don’t use the HST Content Beans like the old demo, you cannot take advantage of the bean mapping provided by HST-2 unfortunately.
But there are pros and cons. Some pointers:
Using HST Content Beans in site webapp, your camel route residing in cms webapp should always make local restapi calls.
Even if it is more tedious by not using HST content beans, you can still achieve the integration by using, for example, Content EXIM library [2], to read/update content.
Thanks a lot for your reply. Actually, I think the demo’s solution is just based on the architecture of Hippo CMS (High Level Component Overview), which shows the Authoring (viz. CMS) can access Delivery (viz. site) via REST API. I’ll let you know if it works according to your guide.
And for Content EXIM library, currently we only run a standalone application, so the local rest api call is just fine for my case.
The problem of the demo for Hippo CMS 12.x is just something with how to add restful support in site module. It seems it has got some changes of the aspect, because there’s no folder named bootstrap in 12.x (repo). Eo add restful support there’s an official guide as you mentioned. Actually, there’s a hosts.yaml file located in repository-data/application/src/main/resources/hcm-config/hst which may be have the same function as hosts.xml because I just modified this file and it works.
I’m afraid this is the only point should be changed for the demo to upgrade to Hippo CMS 12.x.
By the nature of ‘forge’, we depend on internal/external voluntary efforts for The Community. So, it would take some time to fix it. I volunteer to fix it with the knowledge found here soon.
I’ve fixed the demo in develop branch. It’s now on 12.4.0. After building the module first (snapshot version for now), the demo project can be built and running like the documentation described.
I’ve tested with solr only, but I guess it should work with elasticsearch and ActiveMQ as well because it’s really dependent on very generic integration APIs only with those.
Please feel free to test if anybody is interested in.
I’ll probably cut a new release, v1.2.0, next week.