2007-11-10 | Categories: Blog, Geek | Tags: ibm, java, portlet
I’ve been facing new projects and challenges in my professional career since the last month. My first challenge was on a project using IBM Websphere Portlet Factory (WPF) which is a tool for rapidly building portlets on top of a service-oriented architecture. Yeah, it sounds great, doesn’t it? Like other IBM products it’s based on Eclipse so I felt comfortable using it.
WPF uses models (saved as XML files) which contain builders (component that generates source code) and it also allows you use Java classes to do some tasks. It’s pretty flexible but the documentation is not enough when you need to do something that WPF doesn’t do by default. In that case, if you take a wrong decision it could carry a lot of trouble in your project. I’ll write an article about this soon.
In conclusion, WPF is an excellent tool and has a good future.
Xdoclet – Portlet Module & Spring Portlet MVC
2006-03-08 | Categories: Articles, Technology | Tags: foss, java, portlet, spring
Nadie puede negar que la programación orientada a atributos es muy util. Pues bien, estuve jugando con Spring Framework 2.0M3, en especial el modulo para Porlets.
Según la regla que sigo: “Mientras menos hago más avanzo”, decidí usar el modulo Xdoclet para generar el archivo portlet.xml.
Definí un controlador con los respectivos tags:
package com.stconsulting.sample.web.portlet.controller;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.springframework.web.portlet.ModelAndView;
import org.springframework.web.portlet.mvc.AbstractController;
/**
* @portlet.portlet name="SamplePortlet"
* portlet-class="org.springframework.web.portlet.DispatcherPortlet"
* display-name="Sample Portlet" expiration-cache="0"
*
* @portlet.portlet-init-param name="contextConfigLocation"
* value="/WEB-INF/context/sample/applicationPortlet.xml"
*
* @portlet.supports mime-type="text/html"
* modes="view,edit,help"
*
* @portlet.portlet-info title="Sample Portlet" keywords="Sample"
* short-title="Sample"
*
* @author Abner Nazario Ballardo Urco
*/
public class SamplePortlet extends AbstractController {
public ModelAndView handleRenderRequestInternal(RenderRequest request,
RenderResponse response) throws Exception {
return new ModelAndView("sample", "model", "hello");
}
}
Pero XDoclet no generaba correctamente el archivo (estaba en blanco), en fin,… luego de varias pruebas encontre que el archivo portlet_xml.xdt tenía esta definición
<XDtClass:forAllClasses type="javax.portlet.GenericPortlet">
<XDtClass:forAllClassTags tagName="portlet.portlet" superclasses="true">
<portlet>
...............
Como vemos se indica que solo procese las clases que extiendan de javax.portlet.GenericPortlet, para poder usar libremente XDoclet Porlet Module con Spring solo necesitamos modificar el archivo .xdt que se encuentra en:
JAR: xdoclet-portlet-module.jar
Ruta: /xdoclet/modules/portlet/resources/portlet_xml.xdt
<XDtClass:forAllClasses>
<XDtClass:ifHasClassTag tagName="portlet.portlet">
<XDtClass:forAllClassTags tagName="portlet.portlet" superclasses="true">
<portlet>
...............
</XDtClass:forAllClassTags>
</XDtClass:ifHasClassTag>
</XDtClass:forAllClasses>







