Since I'm not able to attend the actual ApacheCon conference days I decided to join some of the pre-conference meetups.
On monday evening I joined Jasha and some other fellow Hippos to the Maven meetup, were I was hoping to hear some new and interesting stuff. Maven has been one of my default development tools for over more then 3 years.This was the first time I actually met other users and developers from the Maven community. I think there were around 40 people at the meetup and some interesting topics came along.
Carlos Sanchez talked about the effort they're putting in the "Eclipse IAM" project over at the Eclipse foundation. I just recently started using the m2eclipse plugin in my Eclipse IDE, which seems to suite my needs, but the Eclipse IAM plugin looked really interesting. Towards the end of the Maven meetup Jasha and I left for a chat with Grzegorz Kossakowski. It was good seeing you again Grzegorz!
Tuesday evening was an evening packed with interesting meetups, but unfortunately they were all at the same time. In the end I went to the Lucene Meetup, where I stayed until 21.30. It was good to see so many people (60+) at the meetup and after an introduction round it was nice to found out that other open source content management vendors were also present at the meetup.
I was especially interested in the talks about Solr. Most of the attendees were Solr users as far as I could see. After some presentations the attendees started asking questions and talking about the number of documents in their Lucene/Solr indexes and I was a bit blown away by the amount of documents some of them had in their lucene index. It ranged from 300.000 to tens of millions, which is really a lot. For me, from a content management perspective, I really wondered what kind of content it was and I would love to see that amount of content in our CMS.
Well that was my ApacheCon for this year. I'm curious too see where the ApacheCon Europe will be held next year. Hope to see you all next year...
24 March 2009
22 March 2009
This week: ApacheCon Europe 2009
For those of you that are attending the conference, I can say that the program looks really promising and has a lot to offer.
If you're attending the ApacheCon on Thursday, be sure to check out Niels's talk on "Documentation: get it right!"
Using Daemon modules with Hippo CMS 7
Recently I was working on a new Hippo CMS 7 based project, where I was in need of a repository component that could run in the background and perform some scheduled tasks.
While talking to some colleagues about what I had to do, they pointed me to a build-in solution for adding repository components, which are initiated at startup.
It was actually very simple to implement this feature, so I'll try to describe how you can achieve the same solution in some very small steps.
The first thing you will need to do is create a Java class that implements the DaemonModule interface. As an example I've created the BackgroundModule as shown below.
You might wonder how the repository knows about these daemon modules? Well the trick is that the repository goes through all 'MANIFEST.MF' files, which it can find on the classpath. If the MANIFEST.MF file contains an entry for the property 'Hippo-Modules', it will be added to the list of available modules. Once finished finding all modules it will start to initialize each of them and pass on an authorized JCR session, so you will be able to work with all information inside the repository.
I'm always using Maven 2 while working with CMS 7. Maven 2 has some usefull utilities and it can help you you out with adding the correct manifest entry. In my pom.xml I added some configuration for the maven-jar-plugin that adds my module to the manifest.
If you need to add more then one module, you can do so by adding a space in between modules.
For the project I was doing, I also made use of Quartz triggers, so my module would execute once in a while instead of just after initialization of the repository.
The concept of these modules is quite powerful, so I hope this can help you to get started with writing your own Daemon modules.
Update
The above article describes the situation back in 2009. With the recent release of Hippo CMS 7.8 there is a slightly different way of creating these modules. For more information see the repository managed components page in the hippo documentation.
While talking to some colleagues about what I had to do, they pointed me to a build-in solution for adding repository components, which are initiated at startup.
It was actually very simple to implement this feature, so I'll try to describe how you can achieve the same solution in some very small steps.
The first thing you will need to do is create a Java class that implements the DaemonModule interface. As an example I've created the BackgroundModule as shown below.
package com.example.repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import org.hippoecm.repository.ext.DaemonModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BackgroundModule implements DaemonModule{
static final Logger log = LoggerFactory.getLogger(BackgroundModule.class);
static Session session = null;
public void initialize(Session session) throws RepositoryException {
this.session = session;
log.info("BackgroundModule started");
}
public void shutdown() {
session.logout();
}
}
You might wonder how the repository knows about these daemon modules? Well the trick is that the repository goes through all 'MANIFEST.MF' files, which it can find on the classpath. If the MANIFEST.MF file contains an entry for the property 'Hippo-Modules', it will be added to the list of available modules. Once finished finding all modules it will start to initialize each of them and pass on an authorized JCR session, so you will be able to work with all information inside the repository.
I'm always using Maven 2 while working with CMS 7. Maven 2 has some usefull utilities and it can help you you out with adding the correct manifest entry. In my pom.xml I added some configuration for the maven-jar-plugin that adds my module to the manifest.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Hippo-Modules>com.example.repository.BackgroundModule</Hippo-Modules>
</manifestEntries>
</archive>
</configuration>
</plugin>
If you need to add more then one module, you can do so by adding a space in between modules.
For the project I was doing, I also made use of Quartz triggers, so my module would execute once in a while instead of just after initialization of the repository.
The concept of these modules is quite powerful, so I hope this can help you to get started with writing your own Daemon modules.
Update
The above article describes the situation back in 2009. With the recent release of Hippo CMS 7.8 there is a slightly different way of creating these modules. For more information see the repository managed components page in the hippo documentation.
21 March 2009
Welcome to my new Blog
Well all my content has been migrated to Blogger and the default skin is gone. Goal for tomorrow is writing a new blog post on Daemon modules for Hippo Repository.
16 February 2009
Using Apache Commons FileUpload
I'm currently working on a project that required me to upload some files from a JSP driven web application. A quick Google search brought me to Apache Commons FileUpload. It's a very useful library, that if used correctly makes you're life a lot easier.
Once adding the dependency to my Maven 2 pom.xml and looking at the user guide, I expected it to work straight away, but unfortunately it didn't and I was not really sure why. My piece of code seemed to halt when trying to execute the following method:
My friend Google was unable to provide me with the correct answer (that's why I'm writing it down now), but after a while I figured out what the problem was. The problem was: me not reading the documentation. On that same user guide page it states:
So in the end it was just another dependency. Not sure why it did not throw an error though, but after adding it to my pom.xml it worked like a charm.
Once adding the dependency to my Maven 2 pom.xml and looking at the user guide, I expected it to work straight away, but unfortunately it didn't and I was not really sure why. My piece of code seemed to halt when trying to execute the following method:
List items = upload.parseRequest(request);
My friend Google was unable to provide me with the correct answer (that's why I'm writing it down now), but after a while I figured out what the problem was. The problem was: me not reading the documentation. On that same user guide page it states:
FileUpload depends on Commons IO, so make sure you have the version mentioned on the dependencies page in your classpath before continuing.
So in the end it was just another dependency. Not sure why it did not throw an error though, but after adding it to my pom.xml it worked like a charm.
Subscribe to:
Posts (Atom)