Clarifying the use of SessionFactory

As mentioned previously I have started using a SessionFactory approach when working with session to Domino using Corba/DIIOP. I forgot forever to mention that you should really combine the use of the SessionFactory with a servlet filter to recycle() the session once the thread has completed. The filter could be as simple as this:

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

import dk.horisontnet.domino.SessionFactory;

public class CloseSessionFilter implements Filter {

   public void init(FilterConfig config) throws ServletException {
   }

   public void destroy() {
   }

   public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
                                            throws IOException, ServletException {
      // do work from other filters
      chain.doFilter(req, res);

      // close session
      SessionFactory.closeSession();
   }
}

The above filter uses a new method in the SessionFactory class called closeSession():

public static void closeSession() {
   try {
      // declarations
      Session session = null;

      // look for a session in the thread local
      session = (Session)pSession.get();
      if (null != session) {
         session.recycle();
         pSession.set(null);
      }
   } catch (Exception e) {
      // do nothing but log it
      logger.warn("Exception thrown while closing session to Domino", e);
   }
}

Deploy the filter via web.xml as described previously.

Update on 13/Feb/06: Remember to nullify the ThreadLocal (code in bold above) after recycling the Domino session to avoid having a recycled session being reused once the thread is reused from Tomcats thread pool. Failure to do so will result in the dreaded “Object no longer exists on server”-NotesException.

Where do people shop i Washington DC?

After Lotusphere I have been spending some days driving around Florida more specifically going to Tampa, St. Petersburg, Naples, Everglades, Key West, Kennedy Space Center and Daytona Beach. Now I’m in DC where I’m going to spend a couple of days before leaving for Copenhagen on Friday afternoon.

One question though – where do people shop in DC? I’m really looking for some shops with sunglasses and clothes in general but have been unable to find any. I guess it is because I’m staying in a business part of the city (I’m staying near the Washington Monument).

If anyone has any pointers I would really be grateful. I guess I need to take the subway or similar to get out of the central part of town but some general directions would be nice… 🙂

As an aside – I have spent the day (re-)seeing the sights (was in DC a couple of years ago) and it really seems that every other shop in DC is either a coffee shop (it seems like Starbucks really has a stronghold here) or a deli selling sandwiches. Quite amazing actually…

Lotusphere 2006: And then suddenly it’s all over…

It feels like waking up on New Years Day. I’m tired. Really tired. I blog this after the General Closing Session sitting alone in the lobby of the Dolphin with my laptop trying to get my head around the past couple of days, watching Lotusphere 2006 being packed into crates. It seems to intensify the feeling of emptyness.

It has been amazing. As a first time visitor, and Lotusphere being the first kind of these conferences I have attended, it has been overwhelming. So much new stuff, having met so many new people. Putting faces to blogs, talking to strangers at lunch sharing ideas and getting really energized by the commitment of IBM which really has come across. The distance from a developer from Denmark to Lotus has never been shorter.

Personally it has been nice meeting people I have only “met” via e-mail – none mentioned, none forgotten. Many very nice comments and interesting conversations. I even experienced a person coming up to me and thanking me for LotusScript.doc. Whow!

Thanks to you all and remember:

Yellow is the new black… 😉

See you next year.

Lotusphere 2006: Not really enjoying the GURUpalooza!

For those who didn’t attend, the concept of the session is to have the presenters from the Best Practices track on stage and have them take questions from the audience. A good idea though I didn’t find it to be as fruitful as it could have been.

Only having an hour set aside for the session I found it unnecessary to spend time on questions that really should be asked during the “Ask the developers” session later in the afternoon. Another thing is that, although it underlines that Lotusphere is indeed a multi-lingual and global event, some of us (myself included), who doesn’t have English as their mother tounge, take a little longer to express what we mean. Because of this a lot of time was spent trying to simply express the question and make sure that all were on the same page.

From my perspective, as primarily as listener to the session, it would have been better to have the questions submitted beforehand. Then the GURU’s would have had the time to sort through the questions, find out who should answer it and make sure that time wasn’t spent on questions that really couldn’t be answered in that forum. I realize that it kinds of defies the point of the session but in the interest of getting the most questions answered I think it would help. Another option could be to have a daily GURUpalooza.

Just some thoughts…

The word of Sametime 7.5 and the AIM/Yahoo deals is spreading

To quote the article:

The deals with AOL and Yahoo are similar to deals Microsoft struck last year with the two IM service providers. The difference is Lotus does not plan to charge for the integration. Microsoft is charging customers to integrate its IM platform with those consumer networks.”

The highlighting was added by me.

Link to the complete article in Computerworld Australia: Lotus preps new IM gateway software by John Fontana.

My The VIEW article is of to the presses

Went to see if my editor at The VIEW (Ann Baker) was here at Lotusphere which she was so that was very nice to finally meet her in person. We have been exchanging e-mail for the last 6-7 months now so a face-to-face meeting was definately overdue. She was quite surprised to see how young I looked which is always nice to hear although I don’t consider myself young looking anymore… 🙂

Ann told me that the next issue was in the presses which means it will be out to the subscribers soon. Very exciting.

I really hope they picked up the changes I added at the last read-through.

Lotusphere 2006: Talking to the developers’bout the missing NotesDocmentCollection constructor and extensions to LotusScript

In the lab I was kindly directed to James Cooper who is the guy in charge of the Lotus Domino backend objects at IBM and hence the guy to talk to about these things.

At present my solution to the missing default constructor is to always have a view I know to be empty view in my databases. I do this with a selection formula like “1=2” to make sure it is empty. Then to create a new documnet collection you do a GetAllDocumentsByKey-call on the view which of cause will return an empty collection. While the approach works and is a valid workaround it is messy and means that other developers must know why that stupid view is there in the first place.

From my perspective adding the possibility to use the New keyword would be the way to go.

James told me that they never really thought about it, which I find hard to believe, but I accept that. His basic problem would be how to create a compelling business case for it within IBM since a working aworkround exists. The performance penalty to the current workaround is probably also negiable which makes it even more difficult. Anyways he took it down as a feature request so we’ll see how it goes with that.

Now that I was there I also asked the LotusScript team about whether to expect expansions to the core LotusScript language with some built-in classes for collections (ArrayList, LinkedList, Set and a Map) and for proper regular expression support (no more “Like”). I am under the impression that both should be fairly easy to expose via a LSX since the functionality is probably already there somewhere under the covers. I know that it raises some questions in regard to the Set since you need some standard way to tell whether when I, the developer, consider two elements equal. This should be relatively easy when using the built-in classes or primitive datatypes but will be more difficult when using custom classes.

Maybe it’s time to introduce a common base class for custom LotusScript classes. Well I guess that is a whole new can of worms…

Lotusphere 2006: Talking with “DXL Dick” ’bout web services and DXL

This morning (Tuesday 24 January) I attended session “AD204: Power Programming: Examining and Manipulating IBM Lotus Domino Application Designs” to hear a little about how the presenters were using DXL in their applications. The session was quite nice and in the demos they used DXL a lot to get at the design elements and manipulate them on-the-fly. In the Q&A session afterwards I had the opportunity to ask them why it isn’t possible to get at the source code for web services using DXL. They didn’t know that you were unable to do this but they redirected me to Dick Annicchiorico who’s the guy in charge of all things DXL.

As an aside it turns out that Dick is known internally in IBM as “DXL Dick”.

Dick should be available over in the “Meet the developers lab” so I went there. Unfortunately he could confirm that it was indeed not possible to get at the source code due to some problems with the DXLImporter part so the functionality was dropped from the product. What is really unfortunate for me, and LotusScript.doc, is that he told me that it might not even make it into Hannover which is really a shame.

Seems like the C API approach will have to be the way to go… Bummer.

Lotusphere 2006: What’s up with the Lotusphere pen?

The Lotusphere pen I got when registrering doesn’t work which is a first since give-away pens usually are better than expensive pens. I have been borrowing other Lotusphere pens during the sessions but they also stink which is extremely fustrating when taking notes. What’s up with that?

Sametime 7.5 announcement

I was going to blog about Sametime 7.5 but I just saw a post on Ed Brills blog with some screenshots and where he lists some highlights of Sametime 7.5 so I wont spend the time.

However I think he forgot to mention one of the best features shown in the demo – a built in screencapture application that allows you to embed screencaptures directly into the chat. I can’t recall the number of times I have gone through taking a screenshot and saving it as a file before sending it off via Sametime. Totally cool.

Screenshots are available in Ed Brills blog.