A Tangled Web

http://blogs.sun.com/mwhite/date/20070504 Friday May 04, 2007

Application Server Platform Independence in the JBI Runtime

Recently, we completed the work to remove GlassFish dependencies that were scattered around in the core JBI runtime code. This was achieved by creating a new generic abstraction for providing application server platform-specific information to the runtime. Now all of the GlassFish-specific code has been isolated to a single package in the JBI runtime. The interfaces providing the abstraction can easily be implemented for other platforms in separate packages.

The big news is that this allowed us to proceed with the creation of a version of the JBI runtime that will run standalone in a standard Java runtime environment. You can read all about how to download, install, and run the standalone version here!

The Technical Details

Now all of the  GlassFish-specific code is isolated to the com.sun.jbi.framework.sun package in the runtime. A new package, com.sun.jbi.platform, has been created. This package contains generic interfaces for implementing application server platform-specific functionality. The interfaces are:

  • com.sun.jbi.platform.PlatformContext - derived from the old com.sun.jbi.management.util.AppServerInfo class and the old com.sun.jbi.framework.PlatformContext interface, both of which have been deleted
  • com.sun.jbi.platform.PlatformEventListener - created from the old  com.sun.jbi.management.system.AdminEventListener interface, which has been deleted.

Here is a list of methods defined in the PlatformContext interface:

  • getAdminServerName() - returns the instance name of the administration server, which can be the local instance if the platform does not provide a separate administration server
  • getClusterNames() - returns a set of the names of all clusters in the domain
  • getClusteredServerNames() - returns a set of the names of all clustered servers in the domain
  • getInstallRoot() - returns the full path to the platform's installation root directory
  • getInstanceName() - returns the name of the local instance
  • getInstanceRoot() - returns the full path to the local instance's root directory
  • getJmxRmiPort() - returns a string representation of the JMX RMI connector port for the domain administration server
  • getMBeanServer() - returns an instance of javax.management.MBeanServer to be used for all MBean registrations
  • getMBeanServerConnection() - returns an instance of javax.management.MBeanServerConnection for a specified instance name
  • getNamingContext() - returns the instance of javax.naming.InitialContext that can be used to look up platform-specific information
  • getProvider() - returns an enumeration value representing the platform
  • getServersInCluster() - returns a set of the names of all servers in a specified cluster
  • getStandaloneServerNames() - returns a set of the names of all standalone servers in the domain
  • getTargetName() - returns the target name for an instance: if the instance is part of a cluster, returns the cluster name; otherwise returns the instance name
  • getTransactionManager() - returns an instance of javax.transaction.TransactionManager, or null if none is available
  • addListener() - adds an instance of PlatformEventListener to listen for platform events
  • removeListener() - removes an instance of PlatformEventListener that was previously added
  • isAdminServer() - returns true if this is the administration server instance
  • isCluster() - returns  true if the specified target is a cluster
  • isClusteredServer() - returns true if the specified target is a clustered server
  • isInstanceClustered() - returns true if the specified instance is part of a cluster
  • isInstanceUp() - returns true if the specified instance is up and running
  • isStandaloneServer() - returns true if the specified target is a standalone server
  • isValidTarget() - returns true if the specified target is a valid server or cluster name
  • supportsMultipleServers() - returns true if multiple servers are supported in a single domain

Code from numerous places in the core runtime was consolidated into a GlassFish-specific implementation of the new PlatformContext interface. This implementation now resides in the com.sun.jbi.framework.sun.SunASPlatformContext class.

You can browse the source for the PlatformContext and PlatformEventListener interfaces here. You can browse the source for the GlassFish-specific implementation here.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed