2009-09-25

Using Gradle to deploy to Glassfish

As mentioned before, I've used Gradle for my build in my latest project. I started to get tired of logging on to the admin console to deploy the WAR file so it was time to look at Glassfish & Gradle in combination.

Glassfish 2.1 includes some ANT tasks which is a wrapper to the asadmin command line tools. Using ANT tasks from Gradle is really simple - even those who aren't part of the main ANT distribution.

I started out with checking if the machine has an environment variable pointing to the glassfish install directory:

gfHome = System.getenv('GLASSFISH_HOME')
logger.info("Glassfish home: " + gfHome)
if (gfHome == null || gfHome.length() <= 0)
{
msg = "No GLASSFISH_HOME in environment variable. Please set GLASSFISH_HOME to glassfish installation directory"
logger.error(msg)
throw new RuntimeException(msg)
}
This will throw an error and the build script will fail if the environment variable GLASSFISH_HOME isn't set. If this succeeds I need to define the task by using ANT's taskdef from Gradle.

ant.taskdef(name: 'gfDeploy',
classname: 'org.apache.tools.ant.taskdefs.optional.sun.appserv.DeployTask') {
classpath {
fileset(dir: gfHome + File.separator + 'lib') {
include(name: '*.jar')
}
}
}
I use the lib directory of the Glassfish install directory and add all jar files to the classpath.

In order to use the deploy task, I need a password file which contains the password for the admin user. I've added a file called dev.passfile in the project directory and it contains a singel line:

AS_ADMIN_PASSWORD=adminadmin
Then the only thing which is missing is calling the task:

ant.gfdeploy(file: war.archivePath.path, name: project.name, contextroot: project.name,
upload: 'true', precompilejsp: 'false', asinstalldir: gfHome) {
server(host: 'mydevserver', port: '40048', user: 'admin', passwordfile: 'dev.passfile')
}
As you see I can reference the war file with the war.archivePath.path. This is a handy shortcut to reference the generated WAR file. Also used the project.name as the context root which avoids the version number in the URL.

Since I need to define an undeploy tasks also I can use the power of Groovy and separate out the commen part as a method. For instance I need to check for GLASSFISH_HOME environment variable for each task I define so I put this in a separate method:

def getGlassfishHomeDir()
{
gfHome = System.getenv('GLASSFISH_HOME')
logger.info("Glassfish home: " + gfHome)
if (gfHome == null || gfHome.length() <= 0)
{
msg = "No GLASSFISH_HOME in environment variable. Please set GLASSFISH_HOME to glassfish installation directory"
logger.error(msg)
throw new RuntimeException(msg)
}
return gfHome
}
This can then be called from every gradle tasks.

Smooth :-)

2009-07-10

GWT and AES decryption

I’ve been working on a simple GWT application which had to decrypt some content in the browser. The requirement was that this should happen in the browser – as close to the end user as possible.

The first solution I considered was to use Java code which then would be generated into JavaScript with the GWT compiler. I couldn’t use the built in support in Java since these classes isn’t supported by the GWT compiler, but I thought I might find an implementation which could be used. After some research I found this comment and the specifically the first point:

virtually all crypto libraries out there,… to asymmetric 
(RSA, DSA, 'public/private keypairs') rely heavily on register
looping; the idea that the maximum value an integer field will
hold + 1 'loops around' silently to the minimum value.

javascript numbers do not behave that way (they upgrade
themselves silently to doubles) - and GWT's 'ints', for
reasons of speed, aren't objectified stuff that
software-matically does integer math, they are just translated
to javascript numbers. Hence this looping never occurs, and all

those libraries get confused, and they don't work. You're FAR
FAR better off finding a proper chunk of code designed for
javascript specifically, and wrapping that using JSNI.

This certainly made me look the other way which was to embed JavaScript implementation of the AES algorithm. We had some requirements to the algorithm implementation:


  • Support for 256 bit key lengths

  • Support for salt

  • Cipher Block Chaining

  • Support for initialization vector

  • Handle PKCS-7 padding

After some trial with several implementations we finally got the pidCrypt library working with the content encrypted by our WPF .NET client. It is hosted on SourceForge and the team has been really responsive to questions regarding challenges that I experienced.

In order to get this to work with GWT I had to do the following:

Add the JavaScript to the project

I added the following JavaScript files pidcrypt.js, pidcrypt_util.js, aes_core.js, aes_cbc.js and md5.js to the project (src/main/webapp).

Make those JavaScripts available to the GWT applicaiton

I had to declare the scripts in my GWT application configuration:

<script src="pidcrypt.js" />
<script src="pidcrypt_util.js"/>
<script src="md5.js" />
<script src="aes_core.js" />
<script src="aes_cbc.js" />
Wrap those JavaScript calls with native methods

In order to call those JavaScripts from my "regular Java code" (the Java code which gets compiled to JavaScript), I had to wrap the JavaScript calls with native methods:

public static native String Decrypt(String encryptedText, String key)
/*-{
var aes = new $wnd.pidCrypt.AES.CBC();
var iv = '4857487548754874587549889898';

aes.initByValues(encryptedText, key, iv, {nBits:256, A0_PAD:false});

return aes.decrypt();
}-*/;

With this in place, I was able to decrypt some of the content which our .NET client had encrypted.

2009-07-03

Building GWT application with Gradle

I wanted to check out Gradle in a small GWT application that we build for a very specific purpose. The Gradle version I've used is 0.61. Gradle has a plugin concept, but I haven't seen any GWT plugin for Gradle. The setup ended up being rather easy.

I defined a task which used ANT's Java task:

task gwtCompile << {
created = (new File(gwtBuildDir)).mkdirs()
ant.java(classname:'com.google.gwt.dev.Compiler', failOnError: 'true', fork: 'true') {
jvmarg(value: '-Xmx184M')
arg(line: '-war ' + gwtBuildDir)
arg(line: '-logLevel INFO')
arg(line: '-style PRETTY')
arg(value: 'me.trond.app.MyApp')
classpath {
pathElement(location: srcRootName + '/' + srcDirNames[0])
pathElement(path: configurations.compile.asPath)
pathElement(path: configurations.gwtCompile.asPath)
}
}
}


If you look at the classpath elements I've included a special configuration called gwtCompile. I had to define my own configuration:

configurations {
gwtCompile
}


This also had to be reflected in the dependencies:

dependencies {
...
gwtCompile (
[group: 'com.google.gwt', name: 'gwt-user', version: '1.6.4'],
[group: 'com.google.gwt', name: 'gwt-dev', version: '1.6.4', classifier: 'windows']
)
}


Since I use the war plugin for gradle I had to make sure that gwtCompile task got called before packaging up the war file:

war.dependsOn gwtCompile


Also ensured that the result of the gwtCompile got included in the war file:

war {
//Adds the JavaScript and resources compiled by the GWT compiler
fileSet(dir: file(gwtBuildDir) )
}

2009-01-29

Glassfish: starting node agents in clustered setup fails with ExceptionInInitializerError

We're starting to use glassfish as our application server. The major reason going from Tomcat was that we needed more fully-fledged appserver with JMS functionality. We have had some issues regarding configuring glassfish - especially for cluster support.

I started with a fresh glassfish 2.1 install and headed for a clustered setup. I've seen a few blog post regarding this which made it look simple enough. So I started out with the following commands:


lib/ant/bin/ant -f setup-cluster.xml -Ddomain.name=myDomain -Dadmin.user=admin
-Dadmin.password=password -Dmaster.password=password
bin/asadmin start-domain myDomain
bin/asadmin create-node-agent --host localhost --port 4848 --user admin
--passwordfile /home/glassfish/passfile agentOnFirst
bin/asadmin create-cluster --host localhost --port 4848 --user admin
--passwordfile /home/glassfish/passfile myCluster
bin/asadmin create-instance --host localhost --port 4848 --user admin
--passwordfile /home/glassfish/passfile --nodeagent agentOnFirst --cluster
myCluster instance1


The passfile contained

AS_ADMIN_PASSWORD=password
AS_ADMIN_MASTERPASSWORD=password


Which is what I issued to the setup-cluster.xml ANT build script. When I tried to run the node-agent I got an ExceptionInInitializerError. I tried many different combination - like supplying password when requested instead of providing this as parameters, but it still seems to fail.

I was not able to get the node-agent to start until I tried without changing the admin/master password. If I rather just used the standard passwords, the nodeagent started just fine. Here the commands:


lib/ant/bin/ant -f setup-cluster.xml -Ddomain.name=myDomain
bin/asadmin start-domain myDomain
bin/asadmin create-node-agent --host localhost --port 4848 --savemasterpassword agentOnFirst
bin/asadmin create-cluster --host localhost --port 4848 myCluster
bin/asadmin create-instance --host localhost --port 4848 --nodeagent agentOnFirst --cluster myCluster instance1
bin/asadmin start-node-agent agentOnFirst


I've reported this as a bug as I still consider the original commands or variants of them to be correct.

2008-12-11

Wanted to utilize explorers "New" submenu in an application for both XP and Vista - read this then

Microsoft changed the way to create new files from XP to Vista and the support for this in .NET on Vista vs. XP is rather poor. It took some research to figure how to find the correct files.

In Windows Explorer a user can right-click, choose new and then the user gets presented with a list of different files to create. We have an application which needs to have this functionality available to the user. Windows stores information on how to create these files in the registry. Under a ShellNew key there are some options set up. You can read more about this in this book.

Basically there are four different ways to create a new file:
  1. NullFile
    This means that you can create a new file without worrying about the content in the file. A good example is a .txt file. You just create a new file with the correct extension and you are good to go.
  2. Data
    This means you create a new file, but you have to flush some special content into the file which is stored in the registry. A good example is using .rtf where there are som special data in the beginning of the file.
  3. Command
    Have not tried this one since there isn't a requirement to support this kind of file. Windows have "Briefcase" as a command. Do you need it - you're on your own ;)
  4. FileName
    In this scenario you get a filename from the registry which acts as a template. You then have to make a copy of the template to a new file with the filename you want. Here's were all the fun begins.
On WinXP you could use following method in .NET to find the folder where the templates are located:


string templateFolder = Environment.GetFolderPath(Environment.SpecialFolder.Templates)


In WinXP you get the following directory as a result: "C:\Documents and Settings\Templates". Here are all the templates stored. All you had to do was to copy the templates into the desired location and you were good to go.

In Vista you get the following directory: "C:\users\AppData\Roaming\Microsoft\Windows\Templates". The directory exists, but there's no content in it. Bummer! After some research I found this blogpost which lead to success. Looking into "C:\Windows\ShellNew" gives me template files for all Office documents and OpenOffice documents. Finally a directory where I actually find templates!!!

2008-01-29

unixGeek.equals(financialGeek) == true

According to amazon.co.uk:

We recommend: Standard & Poor's Dictionary of Financial Terms (Standard & Poor's)

by Virginia B. Morris
http://www.amazon.co.uk/dp/1933569042/ref=pe_ar_x3

RRP: £9.99
Price: £9.49
You Save: £0.50 (5%)

Recommended because you purchased or rated:
* The Art of Unix Programming (Addison-Wesley Professional Computing Series)

2007-04-10

Nutch experience

I've experimented a bit with Nutch and the project is both ambitious and potentially important for the open source/Java space. I'm using Nutch to index the file server at work where most of our documents are stored. This index gets used by our intranet which is a Confluence site. The Nutch generated index is used to show related documents on our intranet site. If the viewed page in confluence is a page describing a software architecture document, the confluence plugin will show all related documents from the Nutch index. I'm also planning to create a simple search dialog to do explicit search towards the index.

I think the project has great potential, but still needs some work. My biggest complaint towards Nutch is around configuration. This is both how you configure Nutch, but also the way the code is structured.

Nutch has a concept of default values and site/setup specific values. So if you need to override something for each setup (which you always have to), you must edit the nutch-site.xml. There's the default values which is called nutch-default.xml. I think that Nutch should have "good defaults" and move the whole nutch-default.xml file into the jar file. This way - the user don't have to know about it, but still is able to alter and view it by extracting it from the jar file.

The other part that I'm not to happy about is the number of configuration files. There's the Hadoop configuration, regex-urlfilter.txt, craw-urlfilter.txt and a lot of others. This should be cleaned up so that these configurations could be consolidated so that the user don't have to know about all of these files. Personally I would like to have ONE file to configure and I don't see any reason why this shouldn't be possible. One way to reduce the problem with these configuration settings, is to provide a GUI client which generates the appropriate configuration files.

The other part is the way the code is for the configuration part. First of, I would really like to have in interface for configuration because the current implementation has to many assumption about where to find the configuration files for Hadoop. It's expected to be available in the classpath/classloader. This might be an issue if you have complex classloader hierarchies. Personally I think that the project should consider Common Configuration, but at least start using interfaces so anyone can provide an alternative implementation.

2007-01-25

My new goodie of the month: AbstractTransactionalDataSourceSpringContextTests

I've bought the SpringOne DVD and got it this autumn, but haven't had the time to listen to it before I started on a new project. Finally using the Spring Framework, a really good IDE and an application server that doesn't take forever to start up.

This little project I'm working on doesn't have to much logic on the business tier so what I really wanted was to test the SQL statements. I've tried the mock object approach and as everybody else says: It's not the way to go when testing this kind of code.

When listening to Rod's talk about testing, I had to agree with the statement about using in memory database. When you are testing SQL towards a database, I really want to use the same database as the production environment because of the difference between SQL dialects.

So this really cool, long named class: AbstractTransactionalDataSourceSpringContextTests does a fantastic job solving my testing needs. By utilizing the transaction mechanism in the database, you can issue update and insert statements, getting error messages from the database if something went wrong, and if everything went fine - everything just gets rolled back so my tests are repeatable. Brilliant - just brilliant.

I think that Spring-boys from time-to-time should borrow the slogan from Jetbrains: "Develop with pleasure".....

2005-10-13

Scratching a BEA Workshop itch

BEA Workshop have somewhat strange project layout, making it difficult to use a really good IDE. It's also difficult to use ANT or Maven in a 'standard' way since the generated ANT scripts from Workshop just generates one target doing all the magic. But since BEA Portal does have tight integration with Workshop, it's not an option to drop using Workshop.

Workshop offers a menu item to generate an EAR file for the portal project. This is a good thing, but when we're working in a development environment we typical would like to have different settings than in test and/or production. One example is that we really want to have much more strict security settings in test/production than in the development environment. There's also a several performance related options that should be very different in test/production compared to development.

Since the generated ANT scripts hides away everything regarding building and packaging of the portal ear, it has been a bit difficult to change these settings when moving from development to test/production. For this reason I made a Jython script which reads a configuration change from a XML file and then inserts these changes into web.xml, weblogic.xml and application-config.xml. This script supports the possibility to change an existing setting, but also to append a new setting that doesn't already exist in the XML configuration file.

In order to do this, I tried a couple of options. First the DOM support in Python/Jython, but problems with minidom in Jython and the crappy DOM api made me drop this. Then I tried to look into XMLBeans but since I didn't have the XML Schema for web.xml and weblogic.xml I couldn't generate JavaBeans representing these Schemas. XMLBeans has a token mechanism, but this was way to ackward to use for my needs. So I ended with using dom4j and I'm pretty happy with the choice. Compared to jdom, dom4j seems more pleasant to work with.

If you are struggeling with the same itch, leave a notice and I will ask my customer if I can give the code to you....

2005-09-12

Python suprised me - in a bad way

I talked with someone looking at Ruby to use for a prototype and didn't want Java's verbose syntax and complex APIs. I suggested Python as a good alternative since it got better support for GTK than Ruby and RedHat and others uses the language alot, but it seemed like they had rejected Python as an alternative for such a relative large prototype. I just had to ask why. So he fired up the console on his Mac and typed:

python

class foo:
def __init__(self, x=[]):
self.y = x

a = foo()
a.y.append("123456")
a.y

b = foo()
b.y

a.y.append("98765")
a.y
b.y

Try it !!!! It wasn't quite what I've expected.

Go figure.....

2005-08-26

Trac looks promising

I've installed Trac at my current customer and I must say I really like the concept of combining a wiki, issue tracker and integration with version control system. Installing Trac on windows isn't the easiest thing in the world, but after many seperate downloads and configuration, all the Trac-Subversion integration magic worked like a dream. There were a few Windows spesific issues - like the diff functionality.


There are quite a few rough edges still, such as the need for running the trac-admin python script in order to configure the wiki/project setup. There's definitely a need for an administrator web console. And the web pages don't look that good using Internet Explorer. Not so important for me, but could be annoying if we're going to let non technical people use the issue tracker.


I haven't gotten to really use the issue tracker. It's not like Enterprise Jira, but then again we didn't have a need for a full configurable workflow based issue tracker, only something simple.


We have currently been using SnipSnap as the wiki and I don't look forward to converting all those SnipSnap pages to the moin-moin based syntax that Trac uses.

2005-06-14

JUnit plugin for BEA Workshop

Since the company I'm working for have a strong focus on BEA's software stack, and the developers complain about the lacking JUnit support in Workshop, my employer had a student writing a workshop plugin which allows the usage of JUnit from Workshop in a better way than using External Tool mechanism.

You will find the JUnit plugin. It's far from perfect, but still much better than the alternatives. It parses the XML that the XMLReporter produces. This could have been solved more elegant with having a process receive the results from JUnit. If somebody would like to contribute I think Bjørn Ove would be happy to include your contribution.

2005-06-03

BEA Portal 9.0 - what's coming

I participated in a BEA breakfast seminar where the product manager for BEA Portal told us about new features in the coming 9.0 release. Before I forget anything, I'll better write them down :-)

Federated Portals
It's seems like the hype world within the portal enterprise market nowadays is federated portals. What is it? Well - shortly it's means that you can 'swallow' somebody else's portlets and present them as part of your own portal. This isn't a Java only thing since there's a web service standard called WSRP (Web Services for Remote Portlets). This got introduced in WebLogic Portal 8.1 Service Pack 3 so it's not a new concept. It's interesting because it allows reuse on presentation level - and also across organisations. So a few of the things BEA is addressing is grouping of remote portlets and the possibility to manage metrics and Service Level Agreement based on these metrics.

Content Management
The Content Management API, which BEA have offered for Content Management shops to integrate with, have been expanded. Their aren't allow to call it JSR-170 compatible since this specification isn't approved, but I guess these improvements are just to comply with JSR-170. These improvements are Content type inheritance, Softlinks, full text search and nested content types.
The Bulk Loader is removed and they have opened the life cycle API so one can write code responding to changes for instance in moving content from 'Ready for approval' to 'Published'. This is all good, but no reason to get really excited....
There's a wizard to easily getting started with retrieving content from a content repository. Hopefully the documentation will get better.

Commerce Server
BEA haven't done anything with commerce server for quite some time now. This release will be a major rewrite of the commerce functionality, and it's about time. The commerce server functionality haven't been available as Workshop controls so the tool support haven't been so good. There will be implemented a new service layer, but the tools won't be part of the first release. The product catalog will now use the content repository instead of using it's own database - which is good thing.

Management/administration
One of the most exciting news is actually a result of a new feature in WebLogic Server. If you have read anything about Diablo you will know that they will allow the possibility to upgrade applications without taking the application down and without killing the sessions of the logged on users. This is a wicked cool feature if you can't tolerate taking the applications down. A result of this is that you can actually upgrade the Portal framework (which is a J2EE application) without taking the server down. Pretty cool.... There's also functionality for extending the Portal administration tool - if needed.

Conclusion
I didn't get a 'wow-feeling' on the features coming in upcoming 9.0 release. BEA focus on federated portals, but I not so sure many of the companies I know of will actually use this functionality. I see similarities between this federated portals and the SOA hype. So an OK upgrade, but nothing revolutionary unless you are longing for hyping in the portal market ;-)

2005-05-25

Nokia involved in the GNOME Project

Seems like Nokia have been sponsoring the Fluendo's work on improving Multimedia experience on free desktop. Fluendo have been working a lot with Python and the late Symbian-based phones from Nokia (Series 60) have support for Python. I also read that TV on mobile probably will be next big thing according to Nokia.... I think I see a connection here :-)

Update:
Seems like the news was this Internet Tablet. Cool, but seems to be a bit unpractical for a left handed guy like me.... Maybe we will see a Linux based Nokia phone, but it's not likely in the near future. Think I have to buy this one.

2005-05-01

Integration products - loosing your OO-design?

I've been working on automating a manual process by using BEA WebLogic Integration. My initial feelings about how these products works is that the design has a tendency to be functional oriented instead of object oriented. I think that these products are important and very valuable for companies where the J2EE connectors - like CICS, SAP etc. - maps to the companies legacy systems. Using such components are also crucial in a object oriented design. But these products also focus on the business logic part - often represented as business processes using a visual representation - like this one below:



It might be my naive usage of WebLogic Integration, but I do see a tendency to focus on handling the complexity by using "function points" instead of objects. The reason? Well - one of the strong points with these business process products are that they communicate what's going on within the business process. This involves classical constructs like for and while loops, if and case statements and of course more high level constructs to create parallel processing. The result of these processes is that you run a function - made by yourself or other components - alter the data - and then the next function works on the same data. The connections points between the functions are the data, but as you probably see the object oriented principle of keeping data together with the logic doesn't apply in these processes.

I haven't used any other integration products, but have gotten Microsoft BizTalk presented and I saw similarity with BEA WebLogic Integration.

Whether or not this is a good or bad thing - I'm not sure, but my guess is that on a large project this approach might be a bit difficult. I also suspect that these business processes get very complex and the reuse perspective might be more difficult. It surely will be interesting to get more experience with such a solution. My current assignment isn't big enough to pinpoint possible problem areas.

Any thoughts on this issue?

2005-04-16

BitKeeper - why is it so great?

The announcement about BitMover no longer offers kernel developers to use BitKeeper as their version control tool. Some of the reason have been that Tridgell (The guy behind the excellent product Samba) have tried to reverse engineer the binary protocol used by BitKeeper. So Linus wasn't too happy about this. While others think that Linus should cool it.

Linus doesn't seem to even consider using Subversion. The Subversion team have commented on this issue - explaining why Subversion isn't kernel developers right choice. So the question is - is it the Linux kernel development model that makes BitKeeper so great, or would other projects also benefit from using BitKeeper? Personally I've only used CVS, Subversion (currently using), SourceSafe and ClearCase. My company have bought Accurev, but I haven't been in a project using it.

My experience with ClearCase it that it seems to require a person working full time on ClearCase in order to get it to give the benefits that companies have paid big bucks for. My former employer used ClearCase, but as a developer I never saw the big benefit. We actually struggled stabilizing the ClearCase server. I've also tried ClearCase UCM, but never really liked all the steps involved. Might just be the way Rational have implemented UCM. Could have been interesting to try a different product focusing on the UCM concept.

So are there any Java developers out there that have used BitKeeper? Would non-Linux-kernel developers also benefit from using this product? If so - why?

2005-04-14

While waiting for new version of Jython

I had the need for automatically creating tables from comma separated files, and thought of using Jython as the tool. Since the released version of Jython is based on Python 2.1, there are many features in newer versions of Python which are lacking in Jython. The Python module I was going to look at was the csv module, which is handy when working with comma separated files.

A little bit of background. I'm using a 'free' version of DBVisualizer, which is part of BEA WebLogic Platform. I needed to create a local database on a few of the tables from an ERP system and the free version of DBVisualizer only supports exporting a table definition as a comma separated file or HTML. DDL export would have been nice.

Since I got sick yesterday I decided - in boredom - to create a script reading these csv files (why are they called csv when they should have been called csf) and then create the tables in MySQL. I found the csv module, but since this module isn't part of Jython I had to use Python. The script might not be the prettiest thing, but it does the job and the tables are created within a second.

I'm really hoping that Jython gets it momentum up and running. According to the roadmap the first release will be in August and there's an indication that some of the new modules included (such as the csv module) might not be released until November....

Now I probably try looking at DBUnit to populate the database with some data.... I probably could have used Python also here, but there's nothing like trying out a new tool when struggling with a cold.

2005-03-09

GNOME 2.10 Released

This new release includes LOTS of bug fixes, some improvement on the multimedia as a result of the GStreamer architecture. This isn't the most interesting release, but includes quite a few features I have missed. One of them being the simple, but cool, Sticky Note applet in the panel. I use xpad, but no need for this now. The System Tools now handle wireless network connections.

I'm really looking forward to the next Ubuntu release named HoaryHedgehog which is coming out fourth of April.

2005-02-20

BEA Portal afterthoughts

I'm just about to complete a project using BEA portal and I found that this is a good time to reflect over the experience so far. This post isn't a technical consideration of the BEA Portal product. I've haven't worked with any other portal products and I also only worked on this project a few months. But this might be valuable for those getting started with BEA Portal - avoiding some of the struggles that I've experienced.

Linking within Portal
The way the portal and portlets handles links on isn't straight forward. The reason is that portlet is supposed to be self contained - without assuming to much of the environment that surrounds it. For web developers being used to link from one part to a completely different part, this comes up regular as a pain doing portal/portlet development. dev2dev have written an article regarding URL handling in the portal. It's worth a read, but isn't as practical as I would like have it. I miss a 'best practice' guide when it comes to URLs in the portal.

The front page typically have quite a few links into other parts of the portal. News entries and other campaigns will typically link into certain parts of the portal. These elements isn't suppose to be reusable for other contexts, so if they assumes things about the portal, it's OK. The render tags are the ones to be used when you need this kind of linking. We used the render:pageurl tag for this kind of linking. Read the render tags documentation.

We had the need for a redirection service - which used a few parameters and then redirected to the correct place in the portal. This redirection got written as a JSP (yeah - it should have been a servlet...), but when you need to redirect to a resource in the portal, you must remember that when you are accessing the JSP directly (using the direct URL to the JSP), you must change to 'portal-linking'. You should look at the PostbackURL class and there also is a postbackURL tag.

Another issue with linking is the difference between development environment portal configuration, which is stored in a .portal file, and the production environment portal configuration which involves defining a portal and a desktop. The URLs for these environments aren't identical - so be aware if you are doing any linking hack.

Configuration & Datasync tool
Configuration of the portal, done in the Portal Admin tool, is annoyingly dependent on the Portal Admin tool GUI. According to this thread, it isn't a public API for scripting up the portal configuration. This is very annoying because every time you have to create a new desktop because of changes in the .portal file in development environment, you also have to go through the tedious steps of reenter the entitlement configuration. Hopefully will the core server focus on WebLogic Scripting Tool make portal configuration available through WLST.

When I first deployed the portal on the test server, I wasn't able to use the custom Unified User Profile that I had written. In the development environment, the UUP showed up without any problem, and on the test server all the user interface logic dependent on this custom UUP worked, but the portal admin wouldn't display the UUP as available. So you have to use the Datasync tool to bootstrap configuration for this to be available in the portal admin tool. This is just plain weird. I haven't used this tool for anything else which also means that I don't see the big benefit of having it. Anyway - unnecessary complex...

Taglibraries
There are quite a few tag libraries available on a portal project within BEA Workshop. The ones with good tool support is, netui tags. I must say that you really feel the difference between the workshop framework (which is the Beehive project) and the rest of the portal tags. Example on this is that netui tags would store the result of a tag in an resultId attribute if available. This result would be put in pageContext for retrieval later in the JSP. The portal tags often doesn't include similar functionality and when they do - the attribute certainly isn't called resultId. This makes the tag libraries very inconsistent.

Some of the netui tags shouldn't be used in a portal setting - for instance in the linking area. I think workshop should see that this is a portal project and then 'promote' typical portal aware tags and possibly hide away tags that isn't supposed to be used in a portal setting.

There is also a mix of portal utility tags (notNull, isNull etc), struts tags and netui tags. I think that BEA should go the Java Standard Tag Library (JSTL) way instead of this collection of tags . Where some of them do the same thing.

To sum up, BEA needs to clean up the tag library usage and give the developers some help in choosing the correct tags....

Caching
When you are working with portlets, Workshop present the portlets properties. Among these properties are caching settings. We utilized this cache properties because there are many pages which are shared among all users. Typically open pages presenting product information, prices etc. Then this article got posted on dev2dev and we realized that the caching we had done weren't doing us any good because portlet caching is on user session level. So we were actually only using more resources - without getting any major benefits. I miss the operand's to say to a portlet that this information should be cached on a application level - no matter what user that sees this portlet.

Custom authentication provider
The customer had a need for a custom authentication provider. When you develop a custom authentication provider there are a collection of interfaces and some of them have to be implemented others are considered optional. The initial authentication provider only implemented the minimum set of interfaces that had to be implemented. This didn't work when using the UserLoginControl. After some investigation I found that the portal actually uses one of the optional interfaces called UserReader, because it uses the method boolean userExists(String username). So I implemented both the UserReader and GroupReader interface in my authentication provider. I still don't get the custom authentication provider's groups up in the portal admin tool user interface when trying to create entitlements, but this haven't been critical since I've used Global Roles defined in the realm of the server instead.

Custom Unified User Profile
Developing a custom Unified User Profile (UUP) is actually just to create a stateless session bean. Doing the development wasn't a problem, but configuring the UUP with P13n had too many manual steps for my taste. You had to extract the deployment descriptors for the existing p13n_ejb.jar file, add reference to the custom UUP and then update the p13n_ejb.jar file. I recommend using JRockIt when working with these jar files because JRockIt jar binary support the notion of updating a file within an existing jar. Sun's jar utility doesn't. BEA should provide tools support for doing this. Either command line or through Workshop.

I also had a few points about layout and usage of CSS, but I leave it for now...

2005-01-27

Dell Laptitude D800 and Ubuntu Linux 4.10

Here's my experience on my first Ubuntu/Debian install. I have reached a state where I'm pretty satisfied, but I still have some issues that I would like to get fixed and I'll update this as I get into improvements.

The computer

  • Dell Laptitude D800.
  • Pentium Mobile 2.0 GHz
  • 15.4" WUXGA (1920x1200)
  • nVidia GeForce 5650, 128 Mb RAM
  • 2 Gb RAM
  • Intel Pro Wireless 2200
  • 60 Gb HD, 7200 RPM
  • DVD ROM, CD RW

Partitioning of the disk

I've used several approaches when it comes to partitioning of the disk, but this time I took the time to read a bit about it before I started. Used PartitionMagic from work to resize the huge partition which only included Windows XP. I ended up with the following:

/ 12Gb
/boot 23Mb
/home 10Gb
/usr/local 10Gb
/mnt/xp 22Gb
swap 2Gb

Installing Ubuntu

Installing Ubuntu 4.10 (Warty) went without any major problems. It didn't get the wireless card to work out of the box, but I wasn't too worried since Intel have launch a sourceforge project. I was a bit disappointed that it didn't managed to enable my 1920x1200 resolution on the screen.

Screen resolution and nVidia drivers

I was able to get WUXGA resolution (1920x1200) by using the these settings. I was a bit concerned about the resolution begin to big, but it works great on the GNOME desktop. I then followed this wiki-page to install the binary drivers for my nVidia card. This resulted in destroying my XF86Config-4 file so I had to create the WUXGA resolution once again. The only struggle is that gDesklet handled the binary drivers bad when it comes to font handling. They all the sudden got extremely small. I haven't figured this out yet.

Special multimedia keys

The laptop only includes volume up, volume down and mute buttons. I struggled a bit to get this working, but eventually i started gstreamer-properties application and got it use ALSA as the sound architecture. Then I just used the keyboard shortcuts application in GNOME to map the special keys to volume up/down and mute. I also had to work around a bug concerning IRQ conflicts. I solved this by adding acpi_irq_isa=7 to the kernel parameters. To avoid having to rewrite this every time you install a new kernel, you have to alter the line: kopt=root=/dev/hda8 ro. Just add the parameter at the end and then a updated kernel will use these parameters as well.

Memory problems

Since I'm using the full BEA WebLogic stack I have a need for lots of memory and I was really looking forward for this laptop with 2Gb!!! The problem was that Ubuntu only reported that I had 900Mb!!! Trying to cat /proc/meminfo gave me the same result. I tried to search for this and saw somebody else struggling. I also found a Debian message where somebody mentioned that 386 compiled kernels might be a problem. Used apt-get to install 686 compiled kernel, rebooted and voila - my gDesklet reported 1.98 Gb memory.

NTFS support

I used Ubuntu wiki again and I had mounted NTFS drive within no time. Just worked. I haven't enabled write access to it.

Multimedia support

I've gotten MP3 enabled which it's included in the base installation because of license issues. There's a pretty good description on the wiki, but I didn't get support for xvid,dvdcss and Microsoft w32codecs. Seemed like they were compiled with other libraries. Not an issue yet, but I have to fix this.

Wireless card

At home I only have wireless access and I have struggled ALOT with a 3Com card for many years now so I was really looking forward to this wireless card with Intel having launched their sourceforge project. There was some trouble compiling these drivers, but the reason was some of my lacking header files for the kernel. Got that fixed and then the driver compiled. I only had to untar the firmware into /usr/lib/hotplug/firmware directory. More details on the forum. This got the card working, but I wasn't able to get the card working with an encryption key based on ASCII signs instead of hexa decimal signs. So I had to reconfigure the access point to use hexa decimal signs and the first password instead of number three. I still have some problems getting IP address, but it does work (from time to time :-)

Java

There are several pages on the Ubuntu wiki about Java. I tried one of them and it failed so I didn't use the 'apt way' of doing things. I regret this now, but I might fix it. This wiki page is a good starting point. I should have made a choice based on these options. Currently I have everything under /usr/local/java. Installed IntelliJ, BEA software and quite a few libraries. I do miss the JPackage project for Debian - although JPackage is far from perfect. Guess I also should install Eclipse - maybe - we'll see :-)

Minor stuff
  • I've installed Skype and it's working. Chose a static compiled version with the qt libraries since Ubuntu doesn't include them. Looks butt ugly, but works.
  • Configured gDesklet with quite a few cool desklets. They are pretty :-)
  • Installed a few Nautilus scripts. Must have!!!
  • Installed several development tools which were missing - such as Glade, MySQL and a lot more.
  • Installed Microsoft fonts which were available by easy apt-get command.
Some headache

I have quite a few issues still to be solved.

  • Suspend to disk doesn't work, but I'm looking forward to the next Ubuntu release which seems to focus a bit on laptop
  • Suspend to RAM makes X freeze. I think this is a problem with the binary drivers, but don't take my word for it
  • I haven't been able to get Citrix Client software to integrate with GNOME based Terminal Server Client software
  • I haven't tried VPN yet
  • Must do some hdparm optimalisation
  • I should have Wine/Crossover office up and running
Conclusion

My first Debian based installation has been a positive experience. There are a few issues and I get a feeling that Java have more friends in the RPM based distributions. I really like the wiki that Ubuntu have set up (Think they use Plone) and the howto's are on the average very good. The search strategy is first the wiki - then the web forum. Found answers on most issues.

I still have laptop challenges, but have hopes for next Ubuntu release in April. I also miss a few of RedHat/Fedora GUI tools, such as service/daemon configuration tool and a few others, but this might be better when GNOME System Tools grows up.