In this blog I explain how I’ve migrated from Struts Tiles to SiteMesh in a AppFuse 1.5 project. I wanted to do that because I was fedup of dealing with Tiles aliases and also because I’ve used SiteMesh in other projects and it’s really easy to use. Metadata filter-mappings.xml In %ROOT%metadatawebfilter-mappings.xml add the folowing <filter-mapping> <filter-name>sitemesh</filter-name> <url-pattern>/*</url-pattern> <!-- These are needed by Tomcat 5 for forwards --> <!--dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher--> </filter-mapping> filters.xml And in the filters.xml file add. <filter> <filter-name>sitemesh</filter-name> <filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class> </filter> struts-actions.xml Change all the actions parameter from Tiles to path to JSP pages. For example, change from <action path="/login" type="org.apache.struts.actions.ForwardAction" parameter=".login"/> to <action path="/login" type="org.apache.struts.actions.ForwardAction" parameter="/WEB-INF/pages/login.jsp"/> struts-plugins.xml In the %ROOT%metadatawebstruts-plugins.xml delete the reference to Tiles plugin <plug-in className="org.apache.struts.tiles.TilesPlugin" > <set-property property="definitions-config" value="/WEB-INF/tiles-config.xml" /> <set-property property="moduleAware" value="true" /> <set-property property="definitions-parser-validate" value="true" /> </plug-in> Action source code The most painful job is to change all your xDoclet tags so that actions forward to a page and not a tile. So you have to change all action classes that are in %ROOT%srcwebmyappwebappaction for example, refering to your tiles-config.xml, change @struts.action-forward name="architectures" path=".architectures" to @struts.action-forward name="architectures" path="/WEB-INF/pages/architectures.jsp" The other problem that you may find is if you have used tiles.Controller. If yes, just change them to struts actions. JSPs First, change your %ROOT%webcommontaglibs.jsp file. Delete <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %> and add <%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator"%> <%@ taglib uri="http://www.opensymphony.com/sitemesh/page" prefix="page"%> Layout to decorator You have to copy and rename the Tiles layout from […]
I’ve just downloaded Skype 2.0 beta with video. It’s fantastic. I’ve got half of my family in Portugal and half in Australia, so I am a big Skype and Skype Out user. The problem was the video. I had to use Yahoo Msg as well as Skype. But now, with the version 2.0, the video works pretty well I have to say. I was quite impressed. You can even have a full screen image of your friend, while speaking normaly. And it’s just a beta version… I can’t wait to have the final version.
Imagine that you have a Customer object that has an Address and a BankAccount. In other words, John lives in Los Angeles and has the bank account number 123456 (V1.0). Imagine then that John decides to move to New York (V1.1) and several months later changes bank accounts (V1.2). Tired of the city stress, he moves to Alaska (V1.3) where he closes his bank account (V1.4) and starts fishing. How do you keep all this information in your system ? How can you get V1.2 of all your object ? You never delete data, you add version numbers when you make updates, add a timestamp, a version to your class definition (imagine that the Customer class has changed and has different attributes) and, of course, lots of data manipulation and processing to be able to visualise your objects at a certain version. A couple of years ago I worked on a project that had these exact needs : we couldn?t delete any data but instead version it (versioning becomes tricky when there are several layers of associations and inheritance between objects). The other important requirement was that the versioned data was not accessed very often. Because of that we decided to use something not really efficient but easy to develop : JRCS. What we did was very simple : we marshalled the Customer objects (and its relationed Address and BankAccount) into an XML stream (using Castor), we used JRCS to […]
For me, a computing language has to be aesthetic ! Like many IT people, I’ve used several computing languages through my life. With my Comodore 64 I’ve started developing in Basic followed by Assembly. Then I had to do a bit of Cobol for a living and jumped into C and Ada. During the client server era I used Visual Basic and then I had a long and painful period of C++ (‘*’ and ‘&’ are definitely not esthetic). In the meantime I was doing a research project in Prolog (that was cool and beautiful). Then, in 1998 Java arrived and I thought “this is great”. Since then, I have to be honest, I have just focused on Java and I love it. Java is great because of the APIs, the Open Source projects, the JCPs… Java is great because a lot of people are working around it. But I have to say, I love Java because I like the aesthetic side of the language. When it comes to aesthetics, nobody is wrong and nobody is right : I like the blue, you like the red, and that’s it. For many months I’ve been reading blogs and articles about Ruby. Yet another language I thought. But more and more people are using it and talking about it. So, I thought, let’s give it a try. I’ve downloaded Ruby, some documentation, and started typing some Hello World examples to have a […]
On top of my J2EE consultancy work, I teach one evening a week at university. The topics I cover go from UML modelling, Design Patterns, Refactoring, Java APIs, Servlets, JSP, XML, EJBs, XML to Web Services . My students have to do a weekly exercise and therefore have to model and write lots of Java classes (and refactor them from time to time). At the end of the year, I always have the same question: « Will I have to do all this work if I become an architect? » In my students heads, an architect is someone who doesn’t write code anymore (even better, someone who never had to write a line in his/her entire life, not even a Hello World). I try to tell them that it’s difficult to link customers, project leaders and developers without having any technical background. One day I was so frustrated, that in my following class I introduced two new slides so we could talk about it. Here is the content (picked up from Enterprise Architect for J2EE Technology book): “The ideal architect should be a person of letters, a mathematician, familiar with historical studies, a diligent student of philisophy, acquainted with music, not ignorant of medecine, learned in the responses of juriconsults, familiar with astronomy and astronomical calculations – Vitruvius, 25 BC” After lots of laughter I showed them the following slide which contains more accurate information based on our job (Software […]
I’m still working for the same massive telecommunication company and trying to understand the tricky architecture of the expensive software they bought and are trying to use, see my previous post Today I’ve discovered how works a new piece of the architecture : the workflow. Their business rules are more or less these ones: managers arrive in the morning and dispatch the work through their team. A worker does the actual work and a supervisor checks that it’s done properly and accepts it or not. I’m simplyfing here but I have to tell you that the entire national team is about 4000 person big and deals with thousands and thousands of request a day. During the meetings, the guys where talking about workflow this and workflow that. So I asked them to show me the workflow engine… which engine?, there is no engine. The workflow is just made of dozens of database views : the supervisors use one view (this view is a view of a view of 2 views, because the business rules are too complicated to describe in one single SQL statement), the worker use several views depending on the work he does, and the same for managers. Oh, I forgot to tell you that one of their problems is performance. Some table have 20 millions entries, and of course, running all these views several times a minutes brings Oracle down. I might go and change the workflow […]