Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JSR 216 (Maintenance Release)

javax.microedition.xlet.ixc
Class IxcRegistry

java.lang.Object
  extended byjavax.microedition.xlet.ixc.IxcRegistry
All Implemented Interfaces:
Registry, Remote

public abstract class IxcRegistry
extends Object
implements Registry

IxcRegistry is the bootstrap mechanism for obtaining references to remote objects residing in other Xlets executing on the same machine, but in separate classloaders. The IxcRegistry class provides access to a database of objects exported for the purpose of inter-xlet communication (IXC). A single database is shared for all IXC clients on a given machine. Objects stored in the database are identified by a String name of arbitrary format. Each IxcRegistry instance is associated with a single XletContext, in order to identify the IXC client using it.

Instances of IXCRegistry are never accessible via java.rmi.Naming or java.rmi.registry.LocateRegistry if RMI functionality is implemented.

See Also:
Registry, getRegistry(javax.microedition.xlet.XletContext)

Field Summary
 
Fields inherited from interface java.rmi.registry.Registry
REGISTRY_PORT
 
Constructor Summary
protected IxcRegistry()
          Creates the IxcRegistry.
 
Method Summary
abstract  void bind(String name, Remote obj)
          Binds the specified name to a remote object.
static IxcRegistry getRegistry(XletContext context)
          Provides the inter-Xlet communication registry for use by the calling Xlet.
abstract  String[] list()
          Returns an array of the names bound in the registry.
abstract  Remote lookup(String name)
          Returns a reference, a stub, for the remote object associated with the specified name.
abstract  void rebind(String name, Remote obj)
          Rebinds the specified name to a new remote object.
abstract  void unbind(String name)
          Destroys the binding for the specified name that is associated with a remote object.
abstract  void unbindAll()
          Removes the bindings for all remote objects currently exported by the calling Xlet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IxcRegistry

protected IxcRegistry()
Creates the IxcRegistry. (This class cannot be instantiated directly.)

See Also:
getRegistry(javax.microedition.xlet.XletContext)
Method Detail

getRegistry

public static IxcRegistry getRegistry(XletContext context)
Provides the inter-Xlet communication registry for use by the calling Xlet.

Parameters:
context - The context of the Xlet requesting the registry.
Returns:
The inter-Xlet communication registry.
Throws:
NullPointerException - If context or context.getClassLoader() is null.

lookup

public abstract Remote lookup(String name)
                       throws StubException,
                              NotBoundException
Returns a reference, a stub, for the remote object associated with the specified name.

First, if there is a security manager, its checkPermission method is called with the permission IxcPermission(name, "lookup").

Specified by:
lookup in interface Registry
Parameters:
name - the name of the remote object
Returns:
a reference for a remote object
Throws:
NotBoundException - If name is not currently bound
StubException - If a stub could not be generated.
SecurityException - If the caller does not have the permission IxcPermission(name, "lookup")
See Also:
IxcPermission

bind

public abstract void bind(String name,
                          Remote obj)
                   throws StubException,
                          AlreadyBoundException
Binds the specified name to a remote object.

First, if there is a security manager, its checkPermission method is called with the permission IxcPermission(name, "bind").

A pre-check is performed on the Remote object to verify that it conforms to the rules for well-formed Remote interfaces; if it does not, a StubException is thrown.

Specified by:
bind in interface Registry
Parameters:
name - the name of the remote object
obj - a reference for the remote object (usually a stub)
Throws:
AlreadyBoundException - if name is already bound
StubException - If a stub could not be generated.
SecurityException - If the caller does not have the permission IxcPermission(name, "bind")
See Also:
IxcPermission

unbind

public abstract void unbind(String name)
                     throws NotBoundException,
                            AccessException
Destroys the binding for the specified name that is associated with a remote object.

First, if there is a security manager, its checkPermission method is called with the permission IxcPermission(name, "bind"). However, names bound to objects exported by the calling xlet are exempted from this permission check. In other words, xlets are always allowed to unbind objects they have currently exported.

Specified by:
unbind in interface Registry
Parameters:
name - the name of the remote object
Throws:
SecurityException - If name is not bound to an object exported by the calling xlet and the caller does not have the permission IxcPermission(name, "bind").
NotBoundException - If name is not currently bound.
AccessException - If name is bound to an object exported in a different registry.
See Also:
IxcPermission

unbindAll

public abstract void unbindAll()
Removes the bindings for all remote objects currently exported by the calling Xlet.


rebind

public abstract void rebind(String name,
                            Remote obj)
                     throws StubException,
                            AccessException
Rebinds the specified name to a new remote object. Any existing binding for the name is replaced.

First, if there is a security manager, its checkPermission method is called with the permission IxcPermission(name, "bind").

A pre-check is performed on the Remote object to verify that it conforms to the rules for well-formed Remote interfaces; if it does not, a StubException is thrown.

Specified by:
rebind in interface Registry
Parameters:
name - the name of the remote object
obj - new remote object to associate with the name
Throws:
StubException - If a stub could not be generated.
AccessException - If name is bound to an object exported in a different registry.
SecurityException - If the caller does not have the permission IxcPermission(name, "bind"). In such an event, the remote object remains bound as before.
See Also:
IxcPermission

list

public abstract String[] list()
Returns an array of the names bound in the registry. The array contains a snapshot of the names present in the registry at the time of the call for which the caller has the permission IxcPermission(name, "lookup").

Specified by:
list in interface Registry
Returns:
an array of names bound in the registry
See Also:
IxcPermission

JSR 216 (Maintenance Release)

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 216 specification.