Wednesday, January 27, 2010

Apple iPad, Oracle-Sun, and the State of the Union

It's a big day for announcements and media. First, Apple launched the iPad; which looks like it nearly lives up to the hype. Next, Oracle finalized its acquisition of Sun. Finally, President Obama will give his State of the Union address tonight. I wonder which event will be remembered as the most important years from now ?

Sunday, January 24, 2010

Multiple RMI Services on a Single Port

I recently learned of a solution to a problem I've struggled with using java remote method invocation (RMI) to implement client-server applications. I've used RMI for several years, and I think it's a great technology. RMI makes it easy to implement fast and secure remote procedure call between java clients and servers. RMI has two disadvantages compared to REST over HTTP or CORBA as a network computing platform. First, RMI is tied to java, so non-java clients cannot directly access network services via RMI. A second disadvantage of RMI is that RMI exports each of a server's remote objects on a separate TCP network port, so it's difficult to setup firewall rules for an RMI server that dynamically exports distributed objects as different clients request different services.

It turns out that there's an easy workaround to configure RMI to export all of a server's remote objects through a single firewall-friendly network port. I've known for some time that RMI allows server code to specify the port on which to export a remote object. For example, the HelloService below can pass a network port number to its UnicastRemoteObject super class constructor. However, I did not realize that multiple remote objects can specify the same network port to the RMI engine as long as a single RMISocketFactory manages every object on that port (which is the default behavior).

A contrived example below shows a simple scenario where an application dynamically exports multiple remote objects. At boot time, the server initializes a DirectoryService object, and registers the object with an RMI name service. The DirectoryService dynamically creates a HelloService object for each client call to login(). Because DirectoryService and HelloService both specify port 12345 in their constructor, clients access every service object via the same network port.


public class DirectoryService extends UnicastRemoteObject implements Directory {
    public DirectoryService() {
        super( 12345 );
    }

   public login( String name ) throws RemoteObject {
        return new HelloService( name );
   }
}

…

public class HelloService extends UnicastRemoteObject implements Hello {
    private  final String name;

    public HelloService ( String name ) {
        super( 12345 );
        this.name = name;
    }

    public String sayHell() {
        return “Hello, “ + name + “!”;
   }
}


Sunday, January 17, 2010

Jython ScriptEngine with WebStart

An embedded script engine is a great way to empower an application's users with the ability to customize and extend tools, and java's JSR223 ScriptEngine framework makes it easy to implement.

I recently embedded a Jython ScriptEngine in a littleware based application that runs in a WebStart environment. Problems always arise when integrating two sophisticated software frameworks like jython and webstart, but the jython ScriptEngine ran with WebStart after addressing two small problems.

First, the application links against the "standalone" jython.jar library which bundles the complete jython script engine. Second, the application includes the following jython-specific code to add jython.jar to the python library search path.

...
final PySystemState engineSys = new PySystemState();
engineSys.path.append( Py.newString( "__pyclasspath__/Lib" ) );
Py.setSystemState(engineSys);
final ScriptEngine jython = new ScriptEngineManager().getEngineByName("jython");
if (null == jython) {
   throw new IllegalStateException("Failed to load jython ScriptEngine");
}
...

Thursday, January 07, 2010

Windows 7 Cross Domain Drive Map Garbage

I tried to map a network drive cross-domain over VPN on my Windows 7 laptop last night, but my laptop failed to authenticate with the file server. Last month I bought a new Dell Studio 15 laptop with Windows 7 64bit, and I've been very happy with it, so I assumed that the map failed due to some random bad setting. I googled around and sent some e-mail to IT support, and eventually found out that I would have to upgrade to Windows 7 Professional to alter the Windows security policy preventing the drive map. The technical details are here in the "catdogboy" posts.

This map drive issue is my first Windows 7 problem that really annoys me. It's upsetting when something works with XP and Vista, but requires extra money and an upgrade with 7.

Library 2020

Let's assume the following technology trends realize their potential over the next ten years.

  • Cloud discovery services like Worldcat, EBSCO, and Serial Solutions successfully federate search across most journals and databases that universities subscribe to.
  • Subscription services from Google and others offer access to most out of print books.
  • Computer tablets like the iSlate with e-reader software become ubiquitous on university campus, and students obtain all their text books electronically.

What would a University Library look like in this world ? The traditional acquisition, cataloging, archiving, and circulation library and librarian roles become anachronisms. The library completes its already begun transition from a student's content provider of books and journals to become a manager of contracts with third party content and service providers that students access directly. Eventually campus IT or some similar organization assumes responsibility for managing the library provider contracts, and the library space itself completes its transition to student union and learning commons.

An academic library may keep vitality as a publisher and archiver of university authored content from research papers to financial statements. It will be fun to see what happens.