Robert has several years of professional experience and a PhD in the field of automated software migrations. He is the co-founder and CEO of Numition Ltd., a start-up company specialized in developing software migrators. Robert is a DZone MVB and is not an employee of DZone and has posted 10 posts at DZone. You can read more from them at their website. View Full User Profile

Introducing nWP, the Java Counterpart of WordPress

10.05.2008
| 6923 views |
  • submit to reddit

At Numiton we've been exploring several options for hosting our blog on dedicated servers.

We wanted to stick with a Java Web container for several reasons including:

  • our love for Java based technologies and the fact that our forum was already Java based
  • avoiding the complexities of setting up another Web container
  • use of a single monitoring console (LambdaProbe in our case)

We started by evaluating Apache Roller but it seemed too heavyweight for our needs. It was also difficult to configure. Then we found Pebble which was much closer to what we needed. So we settled for it for a few months.

But we knew about WordPress, a heavily used blogging engine, much more extensible and polished and with considerably better administrative features. We didn't want to code in PHP to fix bugs or implement new extensions, though. In case you're interested, I've already blogged about why open-source PHP projects are more popular in spite of what happens under the hood.

With all these in mind, we decided to use our own technology and migrate WordPress 2.5.1 to Java. The result is the nWordPress project (or, in short, nWP), a pure Java blogging engine.

How did we actually perform the migration? We used our automated software migration tool. There are several challenges in implementing such a tool. The first one is to produce a functionally equivalent application in the migration target language (Java in this case). Once this is dealt with, the quality of the generated code comes into focus: transforming PHP code into good quality Java code and making use of the consacrated Java technologies. Both are difficult tasks and this is why you don't see automated software migrators too often, regardless of the source and target languages.

In doing the migration of nWP, we applied the usual nTile PtoJ optimization algorithms, including type inference, transformation of dynamic constructs, object extraction and variable scope optimization. Additionally, we used the Spring output flavor option to generate a Spring MVC based Web application.

From a functional point of view, nWP in its present state is quite satisfactory. However, the code quality of the original WordPress project wasn't that great to start with. It got improved by the migration process (we now have declared types, fewer dangerous dynamic constructs, variable scopes are narrowed etc.), but more can still be done.

This is what we have in mind:

  • improve the code quality and enforce sanity checks using static analysis tools (like PMD, FindBugs)
  • in particular, find a better alternative to the current inherited framework for defining and applying filters (dynamic function invocations) - OSGi services or Equinox extension points come to mind
  • make better use of the Spring MVC features, especially by improving the page models
  • modularize the engine - separate the user and administrator sections, maybe split the administrative section into smaller chunks with the option of adding new functionality by third-party plug-ins
  • provide proper plug-in based extensibility for themes, plugins, languages etc. probably using an OSGi implementation like Equinox
  • start migrating relevant existing WordPress extensions

So there's still quite some engineering work ahead to maximize the code quality. The good news though is that from an end-user's point of view, the application is fully functional. Moreover, the above enhancements are far more easy to perform using Java IDEs and tools - some of these are even out of the reach of PHP. The end-result will be a state-of-the-art component-based application.

I already used nWP on our blog and it's really more intuitive from an administrative point of view than Pebble is. Also, it is very easy to install and start your own blog with it (even simpler than the famous WordPress 5-minute install). But don't take my word for it, give it a try yourself. It's open-source and hosted at SourceForge.

0
Average: 5 (1 vote)
Published at DZone with permission of Robert Enyedi, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Konstantin Chikarev replied on Sun, 2008/10/05 - 2:24pm

You made a great job, looks awesome. I've been waiting for such project for 3 years.

Naiden Gochev replied on Mon, 2008/10/06 - 3:29am

very nice :) worklooks good but wordpress is better than jroller not because it's easy to use it is better because there is a lot of plugins/addons/themes for it..

for example are the wordpress themes work for nWordPress ? or is there a way for you or for us to use something from PtoJ   to convert themes for example

Robert Enyedi replied on Mon, 2008/10/06 - 6:26am in response to: Konstantin Chikarev

Thanks!

May I ask what exactly is of interest for you at nWP? Is it just using it or would you also be interested in developing it? :-)

Robert Enyedi replied on Mon, 2008/10/06 - 7:06am in response to: Naiden Gochev

[quote=j0ke]

very nice :) worklooks good but wordpress is better than jroller not because it's easy to use it is better because there is a lot of plugins/addons/themes for it..

[/quote]

While WordPress does indeed feature lots of extensions, from my experience its basic functionality (especially in the administrative section) is already richer and easier to use than that of Apache Roller. But the true power of WordPress are the extensions, granted.

[quote=j0ke]

for example are the wordpress themes work for nWordPress ?

[/quote]

No, WordPress extensions in general cannot be directly used for nWordPress due to the language barrier. This could probably be overcome by using something like Quercus from Caucho, but I think that development should focus on something different.

This is why I listed as a nWP TODO item the implementation of a proper plug-in based extensibility for themes, plugins, languages etc. probably using an OSGi implementation like Equinox.

[quote=j0ke]

or is there a way for you or for us to use something from PtoJ   to convert themes for example

[/quote]

Currently there is no public access to PtoJ, but that's going to change in the near future. As a first step, we plan to provide free on-demand translations for PHP snippets of limited size. Next will be the rolling-out of a commercial online migration service.

Only at that point we will be able to provide a publicly available free migration of extensions for nWP (and other open-source migration projects). But don't despair, until then we will do this ourselves based on the input of the community. So, if you need specific extensions, let's discuss them at the dedicated nWP forum topic.

Naiden Gochev replied on Tue, 2008/10/07 - 2:14am

Hmm thanks for the answers I have a plan to start blogging engine too + video/screenshots tutorials how it is created but I dont have enought time  so nWordPress is very good idea for users. I dont have time to help in developing nWordPress sorry but I changed my work recently and I dont know what time I will have in the feature. If I have time I will send message in the forum.

And again nice work :) I like wordpress :) and if I can host it on my tomcat it is awesome :)

Eric MacAdie replied on Thu, 2008/10/09 - 12:47am

I tried it out, and it looks pretty good. Right now I use Roller, and I will stick with it for the time being. I don't know a whole lot about Spring, so I would have to learn about that before contributing.

Robert Enyedi replied on Thu, 2008/10/09 - 1:24am in response to: Eric MacAdie

[quote=emacadie]I don't know a whole lot about Spring, so I would have to learn about that before contributing.[/quote]

Fair enough. I'm thinking about providing a Spring crash-course (our own or adapt it from another source) in the nWP development section of the site for the Spring features used. This way newcomers could fully understand the code in a shorter time, without needing to browse the Spring documentation (quite large) for understanding basic concepts.

Konstantin Chikarev replied on Thu, 2008/10/09 - 5:20am in response to: Robert Enyedi

Robert,

I am intrested in developing plugins for blogging software in the nearest future.

Gauthier Willia... replied on Thu, 2011/07/07 - 2:32am

This will be good for those who like to make blogs but still like wordpress because it is easy and it has so many plugins that can be use. Wordpress is growing and many bloggers likes using wordpress for their projects, blogs, or work because there are so many things to choose especially their themes and plugins. <a href="http://twitter.com/SeniorHealthCC">Senior Healthcare Consultants</a>

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.