Ruby versus Java

This is totally cool. I’m in the middle of a geek crowd discussing
Java vs Ruby, but there’s none of that “my language is better than
yours” vibe that often comes out in Linux distribution discussions. I
think what’s cool about it is that most people here use both, so we’re
just figuring out where one is better than the other for something,
and how we can improve things…

On Technorati: , ,

Random Japanese sentence: 彼は2匹猫を飼っている。一匹は黒でもう一匹は白だ。 He keeps two cats: one is black, and the other white.

Sample code for allowing drag-and-drop of Notes/Domino documents (including email) to a table in a plugin

Because I had to piece this together from examples on the Internet, and probably other people do too:

Transfer[] transferArray = new Transfer[]{
    XMLTransfer.getInstance(),
};
tableViewer.addDropSupport(DND.DROP_DEFAULT | DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK,
    transferArray, new DropTargetAdapter() {
        public void drop(DropTargetEvent event) {
            TableItem item = (TableItem) event.item;
            // You can access the object with item.getData()
            try {
                NotesThread.sinitThread();
                Session session = NotesFactory.createSessionWithFullAccess();
                if (event.data instanceof URIDescriptor[]){ 
                    URIDescriptor[] droppedURL = (URIDescriptor[]) event.data;
                    for (int i = 0; i < droppedURL.length; i++) { 
                        URI uri = ((URIDescriptor) droppedURL[i]).uri;
                        Document d = (Document) session.resolve(uri.toString());
                        // Do things with the document
                    }					
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                NotesThread.stermThread();
            }
        }});

Use session.resolve instead of db.getDocumentByURL to retrieve a document from a plugin, as both session.getAgentContext() and session.getCurrentDatabase() will return null.

Learning more about Websphere and web service development

So I finally figured out what was wrong with the way I was trying to generate my web services for Websphere 6.1. I’d been using “Generate Java bean skeleton” from the WSDL file, which worked fine for the 6.0 target, but which didn’t work for 6.1. The correct way to do it is to right-click on the service and choose “Generate – Top-down Service”.

I also spent some time figuring out how to correctly use the XSD the IT architect sent me in order to use it for the data types in the WSDL. This is how:

<xsd:import schemaLocation="....xsd" namespace="...">
</xsd:import>

One of the pieces that was missing for me was dealing with namespaces, but once I got my head around XML again, I added some namespaces and got the referred types working.

So I’ve retwiddled our web services and gotten them to work with the new data structures. My test cases pass again. Progress!

2011-03-21 Mon 20:03