Javaref

This post has already been published on code::gallery blog which now has been merged into this blog.

I think Javaref (via Ajaxian) displays one of the best uses of AJAX. It has injected usability and ease in refering to the Java documentation.

So welcome to the Web 2.0 JavaDoc. The default way of looking up is searching. This is made easier with features like autocomplete.

Java API documentation are displayed in a style that is radically different from the classic javadoc style that ships with the JDK. The documentation includes class source code (where available), ability to leave user notes and ability to transparently navigate between APIs by following code references.

However, the drawback is that it does not have Sun’s JDK documentation, as mentioned in the FAQ.

I hope even gotAPI follows this.

Technorati tags: , ,

Copyright Abhijit Nadgouda.

Advertisements

A Push To Open Java

It is quite ironic that the language and platform that has sourced so many open source applications and open standards in the development world, is not open source itself.

Peter Yared, a former Sun executive, tries to get an answer on Sun’s open source strategy. While Sun’s Solaris and StarOffice have their open source counter parts (OpenSolaris and OpenOffice), why is Java being held back? He has posted an open letter on his weblog to Sun President, Jonathan Schwartz.

Peter, looks at it from multiple perspectives. One is to understand why Sun does not want to collaborate with LAMP to compete with Microsoft .Net which offers multiple languages on a single virtual machine. Sun can open up Java Virtual Machine (JVM) to invite the Ps (PHP, Python, Perl – ‘P’ in LAMP, as Peters calls them), which are all open source; and offer an integrated productive platform.

The “P” languages in LAMP — PHP, Python, and Perl — are all open source, and each provide their own virtual machine. It would be ideal if the Java JVM was open source so that open source projects like PHP could join up with the Java Virtual Machine. In turn, Java would be much more competitive with .Net, which supports numerous languages out of the box. Initiatives like adding dynamic language support in the JVM will not go far if Java can not meet existing languages on a common ground of open source.

Using open source as a common ground for various technologies to meet and integrate is a very interesting point. Open source, as it is, provides great transparency and control over software development. Interaction between various technologies on this ground can add the value of choice and higher productivity to the developer.

The second point that Peter tries to tingle is the significance of Java Community Process (JCP) in the world of Java. “The JCP holds the responsibility for the development of Java technology. As an open, inclusive organization of active members and non-member public input, it primarily guides the development and approval of Java technical specifications. Anyone can join the JCP and have a part in its process, and you don’t even have to join to contribute as a public participant.”

And most of the Java innovation nowadays comes from open source projects like Spring and Hibernate, not the JCP, which then has to recreate all of these open source projects. Some of the biggest supports of Java, including IBM and BEA and others in the JCP executive committee, have long asked for Java to be open sourced.

Meanwhile, Apache has incubated the Harmony project which wants to be an independent, compatible implementation of J2SE 5. Its specific aim is to modularise development so that runtime components can be shared. More of them have come up and some more will dividing the Java community itself.

Sun has to make its open source strategy clear, to justify its selective behaviour for making certain projects open source and not making something as powerful as Java. While a normal Java develper can care zilch about it being open source, the vision of creating an open source platform with multiple technologies really wants something like the JVM to be opened up.

In addition to covering this, eWEEK also provides opinion of James Gosling, the creator of Java.

Technorati tags: , , ,

Copyright Abhijit Nadgouda.

Portlets

With Internet penetrating all the walks of life, a web page today has to display diverse information. Sometimes this information is not related to each other, but is relevant to the user. Even thought the result is an integrated web page, several components contribute in creating parts of the web page.

The Concept

For the developer, this brings in more complexity. As more and more diverse applications have to be integrated to display the integrated output to the user, the complexity involved in developing them increases. It is important to keep the applications independent of each other to make sure that they are not affected by each other. This isolated application, which works as a web component and creates part of the resultant document is the portlet.

Java Portlets

The Java community has taken lead to establish the context of a portlet in the Java domain. It has released a Java Specification Request (JSR) – JSR 168 – which provides a standardised Application Programming Interface (API) for portlet development. Portlets were being used by multiple portals even before JSR 168, but every vendor has a personalised portlet development framework. JSR 168 aimed at enabling interoperability between portlets and multiple portals by introducing the standard portlet API.

By definition, a portal provides a common and integrated interface for information from varied sources. Naturally, portlets perfectly apply and JSR 168 addresses portlets in the portal domain.

The portlets runs in a runtime environment provided by the Portlet Container. It also controls lifecycle of a portlet – creation, usage and destruction. The Portlet Container uses the Portlet API to communicate with the portlets. The portlets should comply to the Portlet API so that the Portlet Container can invoke them.

The browser or other clients can use a request/response paradigm to communicate to a portlet. It then processes the requests and create dynamic content in any markup language (XHTML, WML, VoiceXML, …). Along with the appropriate Cascading Style Sheets (CSS) for multiple media, the same portlet can be displayed on multiple devices like a computer, PDA, mobile phone or other devices.

The portal application processes the user’s request and identifies the portlets to be loaded to display the current page. It then calls the portlet container using the Portlet Invoker API. Inversely, the portlet container can get information about the portal itself by using the Portlet Provider Service Provider Interface

Invocation of Portlets

Portlets and Servlets

Portlet is actually a special type of servlet that runs inside a portlet container and use the JSP to render content. The Portlet API is an extension of the Servlet API, so portlets can do everything that servlets can, but in a customised manner. Instead of doGet and doPost, it processes doView and doEdit requests which are sent by the portal application.

Modes

Portlets are different from servlets in some aspects, one of them being support for different modes. Depending on the modes, the portlet performs different functionalities. Some of the modes are Help, Edit, View, Config, Preview and custom modes are also supported. Any portlet must support atleast the View mode where the portlet renders the content. Edit mode is a typical property of portals which allow personalised settings of a portlet.

Window States

Porlets also support windows states, similar to the windows in other window managers – Normal, Minimized and Maximized. The Normal state is used when the portlet is part of an page that contains other portlets, Maximized indicates that the page will contain only this specific portlet and the Minimized indicates display of minimal or no output.

The Portlet API is powerful and provides access to the user information, caching, portal context. Using this the portlets can have customized behaviour depending on the user or the portal vendor.

Web Services for Remote Portlets

Web Services for Remote Portlets (WSRP) enables integration of different portlets running on different remote machines and different run time environments. This enables portals to access content from remote portlets and also enables publishing portlets as web services. WSRP allows reuse of even the user interface saving lot of time and avoiding duplication of portlets. JSR 168 entities have been aligned with WSRP entities to allow the interaction between two standards.

Technorati tags: , , , , , , , , , , ,

Copyright Abhijit Nadgouda.