Tag Archives: pebble

Blog Moved to Exist, and WordPress

Since DevZuz was acquired by Exist , I’ve now move my blog to it’s new home. Hopefully everything redirects here now, and I’ll shortly set up Feedburner properly (finally) so that can be used to subscribe in future. I’m really liking WordPress – though Pebble treated me well, you just can’t go past the wealth of plugins that WordPress offers.

You’ll find some other DevZuz bloggers here too – as well a growing number of others from Exist.

It’s been a crazy busy start to the new year, so things have been a little quiet on this blog. I’ve spent most of my time in January in the Philippines, settling in to the new environment and having a blast with my friends and coworkers from Exist.

I’ll post some more separately on what’s been happening and what’s coming up!

Upgrading Pebble from 2.0.0-M2 to 2.0.0-M3

Have just upgraded the blog software to Pebble 2.0.0-M3 which was just released, which was quite painless.

As the post above indicates, the following changes are needed:

  • Add the multiBlog property to the applicationContext-pebble.xml file.
  • Changed configuration of pebbleUserDetailsService and added pebbleSecurityRealm to the applicationContext-acegi-security.xml file.
  • Added a ROLE_BLOG_PUBLISHER role that can publish/unpublish blog entries.
  • Changes to the CSS

I basically took a diff of my acegi config file to the one originally in M2 and reapplied that patch to M3 which worked just fine.

I did similarly for my theme directory since it is customised, but still based on the original one in Pebble for now. This didn’t apply quite so cleanly but it didn’t take long to sort out.

The only other change in configuration that I noticed is that EmailAuthorNotificationListener (which mails the post author) now exists in addition to EmailNotificationListener (which mails the blog owners), and is the recommended but commented out entry in the default plugin properties. This might be a useful change for those who are contributing to a single blog.

Other than that, it has just worked, which is great!

Pebble Rocks

(I’m going to try and stick to the original post which was very favourable, even though I posted it inside Pebble and Acegi redirected me to the login page without holding onto the post in a session. Gone. Sigh. This time I use Performancing 🙂

So after a series on how I set up Pebble, it’s probably a good idea to give it a review. I really like it – from the user interface perspective it is very slick and easy to use. It has a bunch of features but still sufficiently simple. Considering its a milestone it’s quite stable.

The main area it is lacking is documentation. That seems to be the primary work in progress at the moment and I’m hopeful as what is there is quite good. However, I don’t understand why it is only available under the webapp. I couldn’t get it running far enough to view the docs on Windows, and google just points at the old docs which now 404 on Sourceforge. Dropping the help system onto the Pebble website prominently would help a lot.

I’d definitely suggest more examples in the docs, especially in regard to configuring Acegi. Currently, it just points to the Acegi site and its documentation is reference in the rawest form – written such that it is easiest to understand after you already know what it means. The examples in there that I looked at were out of context and without explanation.

I did find I needed to code read quite a bit to get Pebble to where I wanted it to be, which I hope would change with docs. Better logging would also help – there is very little info in the server logs, especially about what it was doing at the time when an error occurs.

Still, it was good to get familiar with the code. The architecture is quite good, though I’m still no fan of Spring. I kept seeing things and thinking it would be much cleaner with Plexus 🙂 The current architecture we are working under is Plexus and WebWork (soon Struts Action 2) which I’m very happy with and I keep wishing everything was using it.

So, wishlist time:

  • I’d like to edit posts with wiki text, not HTML. Something really useful here would be to bring in the Maven Doxia framework (maybe via a plugin) to render the blog content, allowing you to use HTML, XDOC, APT, Confluence Markup, etc and render it all out to HTML.
  • I’d like to have some macros or markup in the editing for handling source code: an appropriate scrolling styled div and syntax highlighting.
  • multi-user seemed to be an after thought and could be improved. I’d like to see finer grained security and more configuration (so that the overall blog is like the individual blog in terms of aggregated categories and tags, configuration of the number of entries to show, and so on).
  • I’d also like to be able to aggregate external feeds for planet like functionality.
  • The admin interface needs to have a fallback or do away with the normal template. Currently, if there is an error rending a blog entry or you’ve mucked up the web editable JSPs, you can’t get back in to fix it. You have to log in to the server, recover the error, and sometimes restart the application server.

I’ll have to get over to the tracker and file some of these. All in all, this was a worthwhile move – congrats to Simon for his work on Pebble.

Technorati Tags:

Setting up LDAP with Pebble 2.0 M2 (and Acegi)

Here’s what you’ll want to do:

First, modify WEB-INF/applicationContext-acegi-security.xml.

First, add the LDAP provider to the list in the provider manager:

<bean id="authenticationManager"
  class="org.acegisecurity.providers.ProviderManager">
<property name="providers">
	<list>
      <ref local="ldapAuthProvider"/>
      <ref local="daoAuthenticationProvider"/>
      <ref local="rememberMeAuthenticationProvider"/>
    </list>
  </property>
</bean>

Next add the LDAP provider configuration:

<!-- LDAP CONFIGURATION -->
<bean id="initialDirContextFactory"
  class="org.acegisecurity.providers.ldap.DefaultInitialDirContextFactory">
  <constructor-arg value="ldap://localhost:389/<b>BASE_DN_HERE</b>"/>
<property name="managerDn">
    <value><b>ADMIN_DN_HERE</b></value>
  </property>
<property name="managerPassword">
    <value><b>ADMIN_PASSWORD_HERE</b></value>
  </property>
</bean>

<bean id="ldapAuthProvider"
  class="org.acegisecurity.providers.ldap.LdapAuthenticationProvider">
  <constructor-arg>
    <bean
      class="org.acegisecurity.providers.ldap.authenticator.BindAuthenticator">
      <constructor-arg>
        <ref local="initialDirContextFactory"/>
      </constructor-arg>
<property name="userDnPatterns">
	<list>
          <value>uid={0},ou=People</value>
        </list>
      </property>
    </bean>
  </constructor-arg>
  <constructor-arg>
    <bean
      class="org.acegisecurity.providers.ldap.populator.DefaultLdapAuthoritiesPopulator">
      <constructor-arg>
        <ref local="initialDirContextFactory"/>
      </constructor-arg>
      <constructor-arg>
        <value>ou=PebbleRoles</value>
      </constructor-arg>
<property name="groupRoleAttribute">
        <value>ou</value>
      </property>
    </bean>
  </constructor-arg>
</bean>

This is almost straight from the Acegi docs. It assumes that your users reside under the organizational unit People in the base DN.

Then, to do the roles you need to create the organizational unit PebbleRoles, and list under that a number of entries of class groupOfNames. They can be named anything friendly, but each should have a list of members under the People unit, eg: uid=brett,ou=People,dc=maven,dc=org. Each also needs to have it's own ou entry set to the Pebble role name, without the ROLE_ prefix, eg. PEBBLE_ADMIN, BLOG_CONTRIBUTOR, BLOG_OWNER.

This is enough to authenticate your user with appropriate roles (assuming the user has a password set in LDAP).

The last thing you'll find is that the posts are all listed "by null". It turns out Pebble doesn't load anything but auth data from LDAP, so you'll still need the same realm.properties as you'll need for the DAO auth. provider setup. The password and roles can be anything (just not blank), but the name, emailAddress and website are all used. Hopefully that'll change in later versions.

Setting up Pebble 2.0 M2 in Multiuser Mode

We’ve decided to give Pebble a bash, which is an interesting experiment. I had a few issues running it on my own machine (unexplained null pointer exceptions), so I stuck to editing it on the live machine.

The one thing I wanted to achieve was to be able to set up a multi-user blog, since that will be it’s purpose on maven.org. However, all the instructions on how to do so seemed to relate to the older versions of Pebble.

In the end, I got back to searching the source code for files named Multi*. No help there. So I looked at the view actions, where I discovered it used a blog manager, which I discovered had a setter for setMultiUser. That’s great, but how to set it? The Spring configuration doesn’t configure BlogManager.

grep to the rescue again (I hadn’t bothered loading this up into IntelliJ yet), and I found out it was set to a value of count > 1, where count is the number of blogs in the data directory. Apparently, you’ve got to have blogs to add blogs 🙂

Anyway, here we are!