659636 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 12 Messages: 12 Messages: 12 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

Introducing nWP, the Java counterpart of WordPress

Posted by: Robert Enyedi on October 04, 2008 DIGG
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 Blogger 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 <em>from an end-user's point of view, the application is fully functional</em>. 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've 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.

Threaded replies

·  Introducing nWP, the Java counterpart of WordPress by Robert Enyedi on Sat Oct 04 06:50:46 EDT 2008
  ·  Re: Introducing nWP, the Java counterpart of WordPress by Jevgeni Kabanov on Mon Oct 06 11:56:25 EDT 2008
    ·  Re: Introducing nWP, the Java counterpart of WordPress by Mark Nuttall on Mon Oct 06 13:07:24 EDT 2008
      ·  Broken Links by Florin Gheorghies on Mon Oct 06 15:54:35 EDT 2008
        ·  Re: Broken Links by Robert Enyedi on Tue Oct 07 04:02:01 EDT 2008
    ·  Re: Introducing nWP, the Java counterpart of WordPress by Robert Enyedi on Tue Oct 07 04:22:24 EDT 2008
  ·  Re: Introducing nWP, the Java counterpart of WordPress by J Dev on Tue Oct 07 02:56:01 EDT 2008
    ·  Re: Introducing nWP, the Java counterpart of WordPress by Robert Enyedi on Tue Oct 07 04:40:04 EDT 2008
      ·  I can see the use by Marius Hanganu on Tue Oct 07 12:49:30 EDT 2008
        ·  Re: I can see the use by Robert Enyedi on Wed Oct 08 09:32:52 EDT 2008
  ·  database by David Askey on Tue Oct 07 12:45:52 EDT 2008
    ·  Re: database by Robert Enyedi on Wed Oct 08 09:09:03 EDT 2008
  ·  IT Certification by g m on Mon Jul 13 23:46:13 EDT 2009
  Message #270655 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Introducing nWP, the Java counterpart of WordPress

Posted by: Jevgeni Kabanov on October 06, 2008 in response to Message #270508
The project is pretty much a showcase of (admittably impressive) PHP-to-Java migration technology. The code looks relatively OK (I expected much worse), largely because it's based on the Quercus PHP standard library implementation for Java. However I'm almost 100% sure that you lose a lot of the extensibility of WordPress, which makes it such a powerful platform (you can't override the functions, as they are no longer in the global namespace).

I can't imagine why anyone would want to deploy WordPress on Java instead of PHP and not use Quercus, but as a showcase of Numiton tech it's OK. I just wish they'd actually present it as such.

  Message #270661 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Introducing nWP, the Java counterpart of WordPress

Posted by: Mark Nuttall on October 06, 2008 in response to Message #270655
I can't imagine why anyone would want to deploy WordPress on Java instead of PHP ..

Then re-read the original post.

  Message #270676 Post reply Post reply Post reply Go to top Go to top Go to top

Broken Links

Posted by: Florin Gheorghies on October 06, 2008 in response to Message #270661
www.lambdaprobe.org

Did not work on your dzone post either.

  Message #270694 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Introducing nWP, the Java counterpart of WordPress

Posted by: J Dev on October 07, 2008 in response to Message #270508
What about the module and theme API? Does it provide the same API as wordpress? is it possible to migrate existing modules and themes also?

SS
jsptube.com

  Message #270697 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Broken Links

Posted by: Robert Enyedi on October 07, 2008 in response to Message #270676
Thanks for pointing this out, but I can't find a way to edit the initial post.

  Message #270698 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Introducing nWP, the Java counterpart of WordPress

Posted by: Robert Enyedi on October 07, 2008 in response to Message #270655
The code looks relatively OK (I expected much worse), largely because it's based on the Quercus PHP standard library implementation for Java.


We do have our own runtime implementation which is simpler and more Java like than what Quercus provides. This is due the execution model of the output application which is compiled rather than interpreted.

Only for a select number of runtime functions used by nWP (like the regular expression ones) we are using the Quercus library for convenience reasons. For instance, in the case of regular expression, for regular migration projects we adjust the regular expressions to be Java compliant and use the java.util.regexp library in the migrated code. This did not happen yet for nWP, but it will at some point.

Additionally, there are 2 or 3 places in the code where still some small PHP code blocks are evaluated using Quercus - a functionality inherited from the original PHP code. Again, the usual way of dealing with this is the rewrite of those chunks to pure Java - automated translation cannot address such cases.


However I'm almost 100% sure that you lose a lot of the extensibility of WordPress, which makes it such a powerful platform (you can't override the functions, as they are no longer in the global namespace).


From our point of view, the only relevant extensibility points we did lose are the plugins and themes. But I already mentioned that we want to replace these with OSGi bundles. The physical overriding of functions the PHP way and similar practices aren't really something that we would like to allow in nWP.


I can't imagine why anyone would want to deploy WordPress on Java instead of PHP and not use Quercus, but as a showcase of Numiton tech it's OK. I just wish they'd actually present it as such.


Conceptually, we don't see nWP as a fork of WordPress. We cannot compete directly with WordPress due to a simple reason: cheap Java hosting is still much more troublesome (shared Web container) and more expensive than the cheap PHP hosting options. That's why nWP needs the attention of Java enthusiast who are willing to use it in a dedicated hosting environment and possibly contribute to its development.

  Message #270699 Post reply Post reply Post reply Go to top Go to top Go to top

Re: Introducing nWP, the Java counterpart of WordPress

Posted by: Robert Enyedi on October 07, 2008 in response to Message #270694
What about the module and theme API? Does it provide the same API as wordpress? is it possible to migrate existing modules and themes also?


WordPress features the typical PHP API: the code is the API. There's no enforced access point to the data structures and operations mainly because of the limitations of the PHP language. In this respect, at this point nWP has the same API as WordPress, but we plan to change this.

Once the nWP extensions API gets finalized, we plan to migrate selected WordPress plugins and themes to nWP. But until we get there, we could use everyone's input about which of these to migrate. I already started a topic for this on the development forum: http://www.numiton.com/forum/viewtopic.num?t=33 so please feel free to share your opinions.

  Message #270743 Post reply Post reply Post reply Go to top Go to top Go to top

database

Posted by: David Askey on October 07, 2008 in response to Message #270508
I see from the nWP web site, that you mention MySQL as required. I have not reviewed the code nor do I know PHP that well, but does it have a DAO layer, thus we can 'build' a module for say SQL Server and/or Oracle?

  Message #270744 Post reply Post reply Post reply Go to top Go to top Go to top

I can see the use

Posted by: Marius Hanganu on October 07, 2008 in response to Message #270699
Nice job - I can see the use of it when perhaps someone wants to integrate inside a blogging engine their own Java app.

  Message #270859 Post reply Post reply Post reply Go to top Go to top Go to top

Re: database

Posted by: Robert Enyedi on October 08, 2008 in response to Message #270743
I see from the nWP web site, that you mention MySQL as required. I have not reviewed the code nor do I know PHP that well, but does it have a DAO layer, thus we can 'build' a module for say SQL Server and/or Oracle?


A valid point indeed since nWP is tighly coupled with MySQL. I started out by filing some feature requests in the SourceForge tracker:
- Extract the data layer
- Add support for Oracle databases
- Add support for SQL Server databases
- and, optionally: Use an object-relational mapping framework

I think that in the comments section of these feature requests would be the best to continue these discussions.

  Message #270861 Post reply Post reply Post reply Go to top Go to top Go to top

Re: I can see the use

Posted by: Robert Enyedi on October 08, 2008 in response to Message #270744
Nice job - I can see the use of it when perhaps someone wants to integrate inside a blogging engine their own Java app.

Unfortunately tight integration with a third-party application can only be achieved if the application's license is GPL compatible. nWP is distributed under the GPL license because it is a derivative work of WordPress (also GPL licensed).

  Message #311522 Post reply Post reply Post reply Go to top Go to top Go to top

IT Certification

Posted by: g m on July 13, 2009 in response to Message #270508
Pass4sure Practice Exams are written to the highest standards of technical accuracy, using only certified subject matter experts and published authors for development. Following are some of P4S product list:
70-630
MB6-818
70-642
650-393
70-643
70-638
642-661
640-721
132-S-911.2
70-649
642-611
70-672
MB6-817
1Y0-259
70-236
70-298
70-646
N10-004

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

Static and Dynamic Analysis: Best Practices, New Approaches

Application development teams are increasingly turning to automation in order to improve their processes and produce higher quality software. In this webcast, Peter Varhol will describe how to use static and dynamic analysis to improve the software development process and deliver a quality application. (July 7, Tech Talk)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Auto-Scaling Your Existing Web Application

In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources. (May 19, Tech Talk)

Remote Lazy Loading in Hibernate

Lazy loading means fetching and loading the data, only when it is needed, from a persistent storage like a database. Premkumar Rajendran describes how to implement a lazy loading solution within Hibernate by extending the Hibernate framework. (May 12, Article)

What is the Asynchronous Web, and How is it Revolutionary?

The concept of the Asynchronous Web can revolutionize web applications, but is Java EE positioned to support it? In this two-part article, the authors delve into various aspects of the Asynchronous Web in an effort to scope the problem domain, and then analyze how the Java EE technology stack can support it. (April 28, Article)

EJB 3.1 - A Significant Step Towards Maturity

Paulo Moreira describes the EJB 3.1 specification and how it can make a difference in developing server-side Java applications. (April 21, Article)

Free Book PDF Download: Mastering EJB Third Edition

Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map