Wednesday, February 15, 2006

Blog moved to www.yellowbluebus.com/blog

Starting from February 15th, 2006 this blog is no longer updated. It was moved to www.yellowbluebus.com/blog.

Tuesday, February 14, 2006

Firefox memory tweak

Make sure that Firefox frees memory when minimized.


Technorati Tags: ,

Filenet does exception handling - 2

Week ago I wrote about unusual way of handling exceptions in Filenet Workplace.

Today I found another "gem":


try
{
invokeNamedEvent(eventName, uiModule, request, new WcmEventResponse(response, this, okToRedirect));

// If a non-null return value was returned from the invoke, check for true/false. If the
// result matches "false", set the redirect flag to true indicating to cancel processing
// of the page.
Object result = request.getAttribute(INVOKE_RETURN_VALUE);
if ( result != null result.toString().equals(String.valueOf(false)) )
sendRedirectCalled = true;
}
catch (Exception e)
{
throw e;
}


Why to catch an exception here? And why string comparison is used when Boolean has a constructor with the String parameter?

It seems that Filenet doesn't use any of code review procedures internally. Developers just hack the code all day, make no comments and only two of them really understand the whole Filenet Workplace system. Or it was written long time ago by developer, which left the company, and nobody has time and/or will to do a proper system.

Technorati Tags: , ,

Monday, February 13, 2006

dotcoms and Web 2.0: history repeating

I was thinking about Web 2.0 and found some similarities between them and dotcoms:






dotcomsWeb 2.0
Generated a lot of ideas revolving around web enabling of normall stuffGenerate a lot of ideas revolving around web enabling of normall stuff
Generated some ideas and generated a lot of copies of the same ideasGenerate some ideas and generated a lot of copies of the same ideas
Nobody thought of generating revenue from ideasNobody thinks about revenue
Most of the sites were maid to be sold to venture capitalitsMost of the sites are maid to be sold to survived dotcoms


History repeating, huh?

Technorati Tags: , ,

Sunday, February 12, 2006

There is no need for 3Bubbles

Techcrunch announced the service from 3Bubbles, which allows to place the chat into the blogs. Blogosphere reacted with enthusiasm at first sight, like it happens with everything posted in Techcrunch.

I don't think that online chat within a blog is such a good idea. First of all: blog is more like an article in the newspaper. If you have your thoughts - you will comment that article and may get a response, when the author will have time. With the chat the author should always be present near his blog. How will it be handled?

And what about comment spam? Does somebody wants to be spammed in real time?

And there are more skeptics like me: Mashable*

Technorati tags:, , ,

Wednesday, February 08, 2006

Dozer - object to object mapping tool


Dozer - about
This one looks like very promising solution when I will need to convert normal Java beans to Filenet's property bags.




Technorati Tags: , , , ,

Tuesday, February 07, 2006

This is how exceptions are handled

This is how WcmController.java, the "Controller" part of FileNet Workplace's implementation of MVC pattern, handles exceptions:

First, declare this:

private Exception configureWindowIdException = null;


Then, in ConfigurePage function, do this:

public void configurePage(ServletContext applicationValue, HttpServletRequest request, long windowIdMode)
throws Exception
{
... skipped ...
configureWindowId(request);

// If configureWindowId constructed an exception, throw it.
if ( configureWindowIdException != null )
{
if ( !sp.isSignedIn() )
{
// We attempted to propogate a window Id when not signed in
// probably the result of signing out of an info page.
// Don't throw. Fix the windowId to mainWindow instead.
//
WindowID assignedId = new WindowID(null);
WindowID currentId = new WindowID(null);

assignWindowId(assignedId, currentId, false);
configureWindowState();
postProcessWindowId(assignedId, currentId, currentId,
false, false, false, false, false);
}
else
throw configureWindowIdException;
}
... skipped ...
}
What about good old try-catch?

There is no proper exception handling in Workplace. Should I send this piece to The Daily WTF?

Technorati Tags: ,

Filenet Workplace inheritance

While discovering internals of Filenet Workplace I decided to create a class diagram.

Here is the starting diagram:



Apparently there is something wrong with the inheritance and everything use everything else and share the data. This is not OOP, it's good old VB style of programming done by somebody, who was converted to a java programmer by management decision.

More to go...

Technorati Tags: , , ,

Wednesday, February 01, 2006

Filenet Workplace oddities

Now starting to investigate how Filenet Workplace works and how to integrate and extend it with Java Server Faces (JSF).

Created a new web project project in Rational Software Architect and imported Workplace into it. Right after the start discovered that it fails to run on localhost. "Huh? This is strange". Looked up the source code and found that marvelous piece of code:


/**
* Validates HostName
*
* @param hostName The host nema to validate
* @return true, if valid.
*/
public static boolean validateHostName( String hostName )
{
return !hostName.equalsIgnoreCase("localhost") !validateIP(hostName);
}


What?! It just checks for localhost and validates IP of a host name. Ok, let's look into validateIP function:


/**
* Validates a String as a valid IP address. Checks for four parts, and that
* each part represents a numeric value between 0 and 255.
*
* @param ipAddress
* @return
*/
public static boolean validateIP( String ipAddress )
{
boolean isValid = false;

StringTokenizer st = new StringTokenizer(ipAddress, ".");
if ( st.countTokens() == 4 )
{
isValid = true;
while ( isValid st.hasMoreTokens() )
isValid = validateUnsignedByte(st.nextToken());
}

return isValid;
}


Apparently there is no validation of correct IP address and Workplace should work normally if it would be started using
127.0.0.1


So I commented out first part of the code and Workspace now works on my localhost with no problems.

Technorati Tags: , , ,

Testing, one, two, three...

This is a test post from my FireFox using Performancing v1.1 blog editor.


Technorati Tags: , ,

Technorati Tags: , ,

Wednesday, January 25, 2006

Rational Software Architect: simple guide

Everybody, who worked with Rational tools could think that there is nothing rational in them. And frustration mounts when you'll try to read the supplied documentation. The documentation is structured, but some pages are very shallow and others do not explain topics in undestandable language.

This article is very helpful. It actually shows how to structure design files, so the design will be understandable by anyone in the project.

At the end of page is a little gem: Software Architecture Document for the project, described in the article. Very very helpful!

, , ,

Friday, January 20, 2006

Creating WebSphere 6 application MBeans

This is a little step by step guide on how to create and register custom service with JMX interface on WebSphere:

1. Create class, which implements two interfaces:


com.ibm.websphere.runtime.CustomService
com.ibm.websphere.management.JMXManageable


2. Implement "initialize" method (inherited from CustomService)
This method has a parameter, Properties, which will contain properties defined via WS Administration console. We are interested in one property: externalConfigURLKey. This property contains path to external configuration file (if any is needed).

This is how to get the path:


public void initialize(Properties configProperties) throws Exception {
readConfig(configProperties.getProperty(externalConfigURLKey));
}


3. shutdown() method may be left blank.

4. implement getType() method (inherited from JMXManageable):


public String getType() {
return "MyMBean";
}



Remember the name you returned here!

5. implement getMBeanProperties:


public Properties getMBeanProperties() {
Properties props = new Properties();
props.put("SpecialProperty", "value");
return props;
}



I think this will return a list of properties, not declared in MBean descriptor. Read only, of course, since there is no setMBeanProperties() method.

6. implement getters and setters for properties you want to expose:


public String getUserName() {
return this.userName;
}

public void setUserName(String param) {
this.userName = param;
}



7. Create MBean descriptor file, for example myTest.xml.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE MBean SYSTEM "MBeanDescriptor.dtd">
<MBean type="MyMBean">
<attribute name="UserName" type="java.lang.String" getMethod="getUserName" setMethod="setUserName" />
</MBean>


IMPORTANT: Make sure that type matches the value you remembered on the step 4!

8. Compile and package. Create .jar, having descriptor in the root. Place .jar somewhere accesible for WebSphere.

9. Start WebSphere and open Administration console.

10. Go to Servers - Application Servers - yourserver - Server Infrastructure - Administration - Administration Services

11. Click on "Extension MBean providers"

12. Click on "New"

13. In the "Classpath" entry type the full path and name of your jar (created on step 8)

14. Type something memorable in two other fields and click Apply.

15. Click on "Extension MBeans" (on the left)

16. Click on "New"

17. Enter the name of MBean descriptor file (see step 7.)

for example:
myTest.xml

18. Enter the type name of your MBean. IMPORTANT: must be the same name as it was on steps 4 and 7.

19. Click Apply.

20. Go to Servers - Application Servers - yourserver - Server Infrastructure - Administration - Custom Services

21. Click New

22. Place check on "Enable service at server startup".

23. Enter full class name (with package) of your MBean class (the one we created on step 1) into "Classname" field.

24. Enter something memorable in "Display Name"

25. Enter fill path and file name of the jar file (step 8) into "Classpath".

26. If your service requires configuration file (step 2) enter full path to it into " External Configuration URL"

27. Click on Apply.

28. Click on Save (on top)

29. Click Save.

30. Restart the server.

Here are the commands, used to verify MBean from admin console:

To run console:
wsadmin.bat -conntype SOAP -port 8881

To make sure that MBean started:
$AdminControl queryNames *:*,type=>

Store MBean in Tcl variable:
set mybean [$AdminControl queryNames *:*,type=MBeanName]

See MBean description:
$Help all $mybean

See MBean attributes and values:
$AdminControl getAttributes $mybean

Set specific attribute:
$AdminControl setAttribute $mybean UserName mike




, , , ,

Monday, August 16, 2004

Tool converts .Net code to Java

That one I like! It gives people real freedom and flexibility. Price is right too. I think I'll download 30 day evaluation when time permits.

Now back to thinking about making a right choice between Hibernate and BMP EJBs...

Thursday, August 12, 2004

Optimizing CMP Entity Beans

Good and very thorough article about CMP Beans optimizations.

One question still makes me nervous: If its so hard to do that dance - why bother with CMP?

Moreover most of the "optimizations" are good for any database operations, not only for CMP beans. For example:


Make sure your finder methods use indexes


Huh?

Tuesday, August 10, 2004

Listened to a Webinar at Jboss.org about EJB3. What a nice piece of technology! Basically everything will be defined in attributes: @Session is for session beans, @Entity is for entity beans. It's like having metadata injected into actual classes - nice, very nice idea!

Though I must say that it's picked from .Net, but who cares?

Tomorrow I will look closer to Hibernate and entity EJB inmplementation in JBoss Application Server. I need to have a knowledge which way is best:
  • performance,
  • programmability,
  • availability of developers who are familiar with technologies


Also need to spend some time analysing Cocoon2/Struts 1.1 integration.


Monday, August 09, 2004

ASP.NET Development Center Home: ASP.NET 2.0 Internals

ASP.NET Development Center Home: ASP.NET 2.0 Internals - ASP.Net getting more useful. New quirks announced.

After third example based on non-functioning code I dropped reading "Software Architecture in Practice". I can provide more practice that authors of that book provided. There is no point continue reading that book if I have other software architecture books to read.

Tomorrow would be a big day for work project - management does big software architecture presentation.

We finally selected J2EE as platform choice. This is because all the infrastructure needed for out flexible project is available on Java side. We need to use xslt templates so our html pages would be really flexible - Cocoon2 is for that. We need a flexible way to manage our business logic - Struts is for that. And we need to scale our code up in future with no rewriting - J2EE for that.

I always inclined for MS solutions, but here is the perfect example why have chosen J2EE over .Net. Flexibility of solution and less license costs are the major players here.

Now I need to put more J2EE specific methods into my model. I wonder how Enterprise Architect would be able to switch my classes to Java and database to MySQL.

Thursday, July 29, 2004

Well, one more day reading book, I think I have to go straight to third "real life" architecture sample because second one was about another unreleased project. Now it's about Air Traffic Control project, which was funded by FAA, but never was implemented "because of budgeting issues". In real world that means "project was well over budget even before implementation started". Which, in turn, speaks against architecture, because architecture supposed to help projects to be on budget...

Yesterday I subscribed on Channel9 Forums RSS and somebody wrote there that Visual Studio 2005 designer does not support UML. "Huh?", - I thought and went looking for more information. Read three or four articles and found that MS decided not to extend UML 2.0 with their extension, but to create whole new diagram language. Nice turn for Microsoft, wrong for developers. As far as I can see, MS research recognised that most developers use only class diagrams and never use any of the other UML artifacts and developers seldom use Visio, which Microsoft recognizes as full blown UML editor. That's fine, but what about architects? Should they use only class diagrams, which is by definition static views, to describe systems? There is no answer.

I use Enterprise Architect for my work. It is way better than Visio, much better than Rational XDE and would continue to stay better, than rudimentary Visual Studio 2005 tools. And it supports UML 2.0 and extensions. And there is a add-on for Visual Studio, though I haven't tried it.

Back to work...