Category Archives: Uncategorized

Re: What is the state of the enterprise Java world, anyway?

Ted & Don are arguing the point of JavaContainersNG (Spring, Pico, HiveMind etc).

I'm a little surprised – the main point of them all is a very Microsoftish concept – reduce the amount code you have to write.

At TechEd this year (in the few product sessions I went to) it was all about “.NET 2.0 will reduce the number of lines of code you write by 1000%” (or whatever). That's what Spring etc do – no more worrying about wiring code, and just concentrate on your business logic.

Yes, they have other features, too, and yes, they can let you run your code outside EJBs, and yes it is cool that you can test you logic easier, and yes the AOP stuff can be very useful, but the main point is you don't need to write all that stupid wiring code that pollutes most programs.

Don's right to be puzzled why Spring is easier than EJB – you still need stupid XML configuration files, and it doesn't magically make EJBs as easy as .NET development. BUT – and I suspect this is what you miss unless you've actually suffered through EJBs – Spring is easier than using POEJBs (Plain-Old EJBs) because is hides 90% of the things you don't need to worry about.

Don's right about ORM mappers, too, and I don't think any Java person would disagree. There are 3 current JCPs for ORM, not counting the SDO (Service Data Object) one, and that also exclude Hibernate, Apache OBJ and iBatis, which all have pretty reasonable mind/marketshare. That's just so stupid – but the competition makes it interesting.

Evil JDK 1.5 Open-GL configuration

J2SE 5.0 includes a new OpenGL-based pipeline for Java 2D. This pipeline provides hardware acceleration for simple rendering operations (text, images, lines, and filled primitives) as well as those that involve complex transforms, paints, composites, and clips. This pipeline is available on all platforms (Solaris, Linux, and Microsoft Windows) and is currently disabled by default.

Cool!

To silently enable the OpenGL-based pipeline, specify the 
following system property on the command line:

    -Dsun.java2d.opengl=true

To receive verbose console output about whether the OpenGL-based pipeline is   
initialized successfully for a particular screen, specify "True" (note the 
uppercase T) :

    -Dsun.java2d.opengl=True

Hu!?! On what planet is that a good idea? Is there precedent for this? As someone said at work today – perhaps in JDK 1.5 “tRue” will be another option, and to turn them both on: “TRue” (!?!)

Automated summaries using Classifier4J

The DevX article on Classifier4J includes a good example of using Classifier4J for doing automatic text summary. I have to admit the example given makes it seem pretty impressive. I'm not sure everyone will get as good results as that (the summarising code is the ugliest in Classifier4J by far – I just wanted to see if it would work), but none the less summarising http://www.devx.com/xml/Article/16704/1954?pf=true
to:

The invention of database driver methodologies such as JDBC
and ODBC led to applications being loosely coupled with their back end databases,
allowing best-of-breed databases to be chosen—and swapped
out when necessary—without any ill-effect on the user interface.
Similarly, the decoupling of data and presentation in HTML—by using XML for the data and
XSLT for the presentation of data—has led to much innovation and flexibility,
not least of which is the ability to deliver a document as data in XML and deliver
custom styling for that document with different XSLTs.
A runtime engine would be present on the desktop, and servers would
be able to deliver the GUI to the browser with an XML document.

is pretty useful. It does demonstrate that the software might currently have a preference for using sentances too early in the article, though.

DRM in Office 2003 AND Internet Explorer

Tim Bray notes that Office 2003 has built-in DRM support. About a year ago I was pretty shocked to discover that Internet Explorer offers that same thing: Rights Managed Add-on for Internet Explorer. This appears to use the same facilities that Tim notes Office 2003 supports:

Using Windows Rights Management Services technology, authors can set restricted permission to limit what a reader can do with the content they receive. These restrictions are customizable, that is, an author can specify that one person may view the document but not print it, another may do both, and that a third person may view and print the document, but only for five days.

Content can be created with restricted permission by using an application that supports Windows Right Management Services, such as Microsoft Office Professional Edition 2003. When an author creates a protected document, Office will also embed a rights-managed HTML version of the content within the file.

(Lack of) Java Security

Ted Neward wrote an entry today on Java Security. This post started out as a comment on that, but it got too long.

Are there any java open source projects that actually use any Java Security (ignoring spec implementations where it is required)?

Some frameworks have some support for using it, but apart from that I think even the best projects fail to use it.

I'm not blaming the authors for that – I know there are times when I've thought that I should be using Java security, but it's a whole area I know I don't understand as well as I should, and while I think I'm very secuity conscious as programmers go, I suspect there may be others in the same position.

I'd love to see some sample code for using the principle-of-least-privilege in Java. Java programmers often shout about how much more secure it is than C, but at least in C you do see code that deliberatly reduces the permissions it requires.

Spring Portlet Support

Since there were no promising responses to my previous request for portlet frameworks I decided to do something about it myself.

I've submitted a patch to Spring 1.1 to enhance the spring portlet support so it will allow the use of the Spring Tag Libraries. It isn't (yet) as extensible as the web framework, but it is a good starting point (I think).

There isn't much in the way of documentation for it yet, but I did port the MVC tutorial code to the portlet framework.

Some notes:

  • The portlet version of the application leverages the concept of view and edit portlet modes. The view mode allows the user to view the current prices, while the edit mode allows the user to increase the prices.
  • The code in the bus package is identical to the Web version.
  • This JSP pages are almost identical to the Web versions, with the following exceptions:
    • The Portlet tag library is included as a jsp page directive in the JSP pages.
      If the various Portals properly exposed the taglib themselves this would not be required.
    • The link from the view.jsp page to priceincrease is a portlet:renderURL tag
    • The form in priceincrease.jsp has to submit to the a URL defined by a portlet:actionURL tag
  • The code in the controller package is specific to the Portlet version.

The ultimate version of this would allow the reuse of JSP views in both the Portlet and Web frameworks.

I'm hopeful that it will incorporated into Spring and people will find it useful.

Portlet Frameworks

What frameworks are people using to build java Portlets – in particular the user interface part?

I know the EXO people use JavaServerFaces, and I think both EXO and Liferay come with Stuts bridges. I'd love to hear peoples impressions of how well that work.

I believe Struts 1.2 adds (some?) support for Portlets, but I'm not sure how far it extends.

I've been using the Portlet support in the Spring sandbox with some success, but getting the taglibs to work is taking some work (ie, it isn't supported), and it looks to me that Webwork2 is in a fairly similar state.

So here's a hint for framework authors: if your framework allows developers to use the same JSP taglibs in pages for both web and portlet applications you are going to pick up some quick marketshare.