JanosVM v1.0 API

edu.utah.janosvm.sys
Class PortAuthority

java.lang.Object
  |
  +--edu.utah.janosvm.sys.PortAuthority

public final class PortAuthority
extends java.lang.Object

Manages the imports and exports of a team.

Author:
Tim Stack, Utah Janos Team

Field Summary
private  java.util.Vector anonymousExports
          The list of anonymous exports for a team.
private  java.util.Hashtable exports
          The table of named exports for a team.
 
Constructor Summary
PortAuthority()
           
 
Method Summary
 void cancelImport(Importable im)
          Break the reference of the given Importable.
 ExportManager exportAnonymousObject(Exportable ex)
          Export an object without a public identifier.
 ExportManager exportObject(java.lang.Object id, Exportable ex)
          Export an object with the given identifier.
 ExportManager findExport(java.lang.Object id)
          Find an export with the given identifier.
 void importObject(Importable to, TeamHandle from, java.lang.Object id)
          Import a publicly available object from another team.
(package private) static boolean isValid(Importable im)
           
(package private) static boolean register(Importable im)
          Register the Importable internally so that we're revoked when the team dies.
 ExportManager reserveExportID(java.lang.Object id)
          Attempt to reserve an exported identifier for future use.
(package private)  void revokeAllExports()
          Revoke all of a teams exports.
(package private) static void revokeAllImports()
          Revoke all of a team's imports.
 void revokeAnonymousObject(Exportable ex)
          Revoke an anonymously exported object.
private  void revokeAnonymousObject(Exportable ex, ExportManager em)
           
 void revokeObject(java.lang.Object id)
          Revoke access to the export with given identifier.
 java.lang.String toString()
           
(package private) static void unregister(Importable im)
          Unregister the Importable internally.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait, wait0
 

Field Detail

exports

private java.util.Hashtable exports
The table of named exports for a team.

anonymousExports

private java.util.Vector anonymousExports
The list of anonymous exports for a team.
Constructor Detail

PortAuthority

public PortAuthority()
Method Detail

revokeAllExports

void revokeAllExports()
Revoke all of a teams exports.

register

static boolean register(Importable im)
Register the Importable internally so that we're revoked when the team dies.

unregister

static void unregister(Importable im)
Unregister the Importable internally.

isValid

static boolean isValid(Importable im)
Parameters:
im - The Importable to test.
Returns:
True if the given Importable is valid.

revokeAllImports

static void revokeAllImports()
Revoke all of a team's imports.

reserveExportID

public ExportManager reserveExportID(java.lang.Object id)
                              throws DuplicateExportException
Attempt to reserve an exported identifier for future use. This is useful if you want to delay the construction of the Exportable object until you're sure that the identifier is available.
Parameters:
id - The identifier to reserve.
Returns:
An empty ExportManager that should eventually be filled in with the export.
Throws:
DuplicateExportException - if the `id' is already used.

exportObject

public ExportManager exportObject(java.lang.Object id,
                                  Exportable ex)
                           throws DuplicateExportException
Export an object with the given identifier.
Parameters:
id - The identifier to export the object under.
ex - The object to export.
Returns:
The ExportManager for this mapping of `id' to `ex'.
Throws:
DuplicateExportException - if the `id' is already used.

revokeObject

public void revokeObject(java.lang.Object id)
                  throws NoSuchExportException
Revoke access to the export with given identifier.

XXX rename to revokeExport()

Parameters:
id - The identifier of the export to revoke.
Throws:
NoSuchExportException - if there isn't an export with the given identifier in the table.

exportAnonymousObject

public ExportManager exportAnonymousObject(Exportable ex)
Export an object without a public identifier.
Parameters:
ex - The object to export.
Returns:
The ExportManager for the newly exported object.

revokeAnonymousObject

private void revokeAnonymousObject(Exportable ex,
                                   ExportManager em)

revokeAnonymousObject

public void revokeAnonymousObject(Exportable ex)
                           throws NoSuchExportException
Revoke an anonymously exported object.
Parameters:
ex - The object to revoke access to.
Throws:
NoSuchExportException - if the given object isn't in the export table.

findExport

public ExportManager findExport(java.lang.Object id)
Find an export with the given identifier.
Parameters:
id - The identifier associated with the ExportManager to look for.
Returns:
The ExportManager associated with the given id or NULL if its not in the table.

importObject

public void importObject(Importable to,
                         TeamHandle from,
                         java.lang.Object id)
                  throws DeadTeamException,
                         TeamEjectionException,
                         NoSuchExportException
Import a publicly available object from another team.

XXX what context can this be invoked in? "to" team? "from" team? If its only a certain team, perhaps it should be exposed on the specific team only?

Parameters:
to - The Importable that should be set to reference the export.
from - Reference to the team to import the object from.
id - The identifier of the object to import from the given team.
Throws:
DeadTeamException - if the team couldn't be reached.
TeamEjectionException - if the thread was thrown out of the team during processing.
NoSuchExportException - if the object doesn't exist in the other team.

cancelImport

public void cancelImport(Importable im)
Break the reference of the given Importable.
Parameters:
im - The Importable that should have its reference cleared.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

JanosVM v1.0 API

This documentation is Copyright (C) 2000-2003 The University of Utah. All Rights Reserved. See the documentation license for distribution terms and restrictions.
Documentation, software, and mailing lists for the JanosVM can be found at the Janos Project web page: http://www.cs.utah.edu/flux/janos/
Generated on Feb 13, 2003