uka.karmi.rmi
Class Transport

java.lang.Object
  extended byuka.karmi.rmi.Transport

public final class Transport
extends java.lang.Object

Main class of the transport layer. The transport class loads a properties file (filename in the "uka.karmi.config" property) on startup. This file is used to determine the technology objects, the DGC objects and the RegistryImpl object. It also contains information to individually configure the technology objects.

Whenever a stub is unmarshaled, the SingleRemoteClientRef uses the transport to determines which technology can contact its referenced server. This is done with the connect() method.

Author:
Christian Nester, Bernhard Haumacher

Field Summary
static ConfigBundle config
           
private static EnlargingArray exportPoints
           
private static CopyEnvironment freeEnvList
           
private static java.lang.Object freeEnvLock
           
static java.lang.String KARMI_REGISTRY_CLASS
          class name for a registry object
private static java.util.ArrayList technologies
           
 
Constructor Summary
Transport()
           
 
Method Summary
static ObjectId addProxy(ObjectId id, RemoteServerRef proxyRef)
           
protected static void addTechnology(Technology t)
           
static UTID buildUTID(java.lang.String protocol, java.lang.String location)
          Finds the technology that corresponds to the protocol string given as parameter and calls buildUTID on this technology.
static UTID connect(ObjectId id)
          Lookup a suitable technology in the given ObjectId structure and return its UTID.
static Registry createRegistry(int nr)
          Creates a registry object in a certain export point.
static void dump()
           
static void exportObject(RemoteServerRef ref, int nr, int objectId)
           
static CopyEnvironment getCopyEnvironment()
          Returns a CopyEnvironment object from a list.
private static ExportPoint getExportPoint(int nr)
          Creates and initializes an export point with a given number.
static ObjectId getProxy(ObjectId id, int domainId)
          Checks whether the object identified by id can be accessed from a technology with the given domain identifier.
protected static Technology getTechnology(int n)
           
static int getTechnologyCnt()
           
static UTID getUTID(int nr)
          Returns the UTIDs of the specified export point.
(package private) static java.lang.Object newSystemInstance(java.lang.String name)
           
static void pinObject(RemoteServerRef ref)
          Pins the object referenced by the given remote server reference.
static void probe()
           
static void putCopyEnvironment(CopyEnvironment env)
          Puts a CopyEnvironment back into a list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KARMI_REGISTRY_CLASS

public static final java.lang.String KARMI_REGISTRY_CLASS
class name for a registry object


technologies

private static java.util.ArrayList technologies

exportPoints

private static EnlargingArray exportPoints

config

public static ConfigBundle config

freeEnvLock

private static java.lang.Object freeEnvLock

freeEnvList

private static CopyEnvironment freeEnvList
Constructor Detail

Transport

public Transport()
Method Detail

getTechnology

protected static final Technology getTechnology(int n)

addTechnology

protected static final void addTechnology(Technology t)

getTechnologyCnt

public static final int getTechnologyCnt()

newSystemInstance

static java.lang.Object newSystemInstance(java.lang.String name)

probe

public static void probe()
                  throws java.lang.Exception
Throws:
java.lang.Exception
See Also:
Probe

dump

public static void dump()

getProxy

public static ObjectId getProxy(ObjectId id,
                                int domainId)
                         throws RemoteException
Checks whether the object identified by id can be accessed from a technology with the given domain identifier. If the check succeeds, the object identifier of the proxy is returned that can be used for communication. This object identifier may also be the identifier for the original object passed as argument.

Throws:
RemoteException

addProxy

public static ObjectId addProxy(ObjectId id,
                                RemoteServerRef proxyRef)
                         throws RemoteException
Throws:
RemoteException

connect

public static UTID connect(ObjectId id)
                    throws RemoteException

Lookup a suitable technology in the given ObjectId structure and return its UTID. If the referenced object is local, the server implementation can be found in the local export point referenced from the returned UTID object in its UTID.ep member.

The returned UTID can be used to perform calls to this object. The transient fields UTID.technology, UTID.ep and UTID.objectId are initialized.

Parameters:
id - object identifier, a suitable technology is requested for.
Returns:
utid object for communication; null if object is local.
Throws:
RemoteException
See Also:
ObjectId

getExportPoint

private static ExportPoint getExportPoint(int nr)
                                   throws RemoteException
Creates and initializes an export point with a given number. Export points are created lazily, because each export point comsumes additionally resources in each technology that supports it (e.g. a thread that serves requests directed to that export point). If an export point is configured but never used, like the export point for the registry on most machines, no resources should be consumed.

Throws:
RemoteException

exportObject

public static void exportObject(RemoteServerRef ref,
                                int nr,
                                int objectId)
                         throws RemoteException
Parameters:
ref - server side reference of the object to export.
objectId - ID for this object. Must be 0 or 1..WELLKNOWN.
nr - ID of the export point the object should be exported to.
Throws:
RemoteException
See Also:
RemoteServerRef, ExportPoint

pinObject

public static void pinObject(RemoteServerRef ref)
                      throws RemoteException
Pins the object referenced by the given remote server reference. Pinning an object prevents it from being garbage collected until it is explicitly unexported.

Throws:
RemoteException

getUTID

public static UTID getUTID(int nr)
                    throws RemoteException
Returns the UTIDs of the specified export point. Every export point has a UTID structure. Every supported technology has its UTID in this list. You are not allowed to make changes to the returned list.

Parameters:
nr - ID of the export point.
Returns:
head of the UTID list
Throws:
RemoteException

createRegistry

public static Registry createRegistry(int nr)
                               throws RemoteException
Creates a registry object in a certain export point.

Returns:
the registry object
Throws:
RemoteException

buildUTID

public static UTID buildUTID(java.lang.String protocol,
                             java.lang.String location)
                      throws RemoteException
Finds the technology that corresponds to the protocol string given as parameter and calls buildUTID on this technology. The methods returns the created UTID object. The object may also be local (technology field is set to null).

Parameters:
protocol - protocol string
location - loction of the remote host
Returns:
a UTID object for communication or null if address space is local.
Throws:
RemoteException

getCopyEnvironment

public static CopyEnvironment getCopyEnvironment()
Returns a CopyEnvironment object from a list.


putCopyEnvironment

public static void putCopyEnvironment(CopyEnvironment env)
Puts a CopyEnvironment back into a list.