Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.aglets
Class AgletContextImpl

    java.lang.Object
      |
      +--com.ibm.aglets.AgletContextImpl

All Implemented Interfaces:
  AgletContext

public final class AgletContextImpl
extends java.lang.Object
implements AgletContext

The `AgletContextImpl` class is the execution context for running aglets. It provides means for maintaining and managing running aglets in an environment where the aglets are protected from each other and the host system is secured against malicious aglets.

Version:
  1.20 $Date: 2001/07/28 06:31:54 $
Author:
  Danny B. Lange, Mitsuru Oshima, ONO Kouichi

Method Summary
`void` | `addContextListener(ContextListener o)` Adds the specified context listener to receive context events from this context.
`void` | `clearCache(java.net.URL codebase)` Clear the cache
`AgletProxy` | `createAglet(java.net.URL url, java.lang.String classname, java.lang.Object init)` Creates an instance of the specified aglet located at the specified URL.
`java.util.Enumeration` | `getAgletProxies()` Gets the aglet proxies in the current execution context.
`java.util.Enumeration` | `getAgletProxies(int type)` Gets the aglet proxies in the current execution context.
`AgletProxy` | `getAgletProxy(AgletID aid)` Gets the proxy for an aglet specified by its identity.
`AgletProxy` | `getAgletProxy(java.net.URL host, AgletID aid)` Deprecated.
`java.applet.AudioClip` | `getAudioClip(java.net.URL url)` Gets an audio clip.
`java.net.URL` | `getHostingURL()` Returns the URL of the daemon serving all current execution contexts.
`java.awt.Image` | `getImage(ImageData d)` Gets an image.
`java.awt.Image` | `getImage(java.net.URL url)` Gets an image.
`ImageData` | `getImageData(java.net.URL url)` Gets an image data.
`java.lang.String` | `getName()` Gets the name of the context
`Persistence` | `getPersistence()`
`java.lang.Object` | `getProperty(java.lang.String key)` Gets the context property indicated by the key.
`java.lang.Object` | `getProperty(java.lang.String key, java.lang.Object def)` Gets the context property indicated by the key and default value.
`ResourceManagerFactory` | `getResourceManagerFactory()`
`ReplySet` | `multicastMessage(Message msg)` Sends a multicast message to the subscribers in the context.
`void` | `postEvent(ContextEvent event, boolean sync)`
`void` | `postEvent0(ContextEvent event)`
`void` | `receiveAglet(Name agent_name, ClassName[] classnames, java.lang.String codebase, byte[] agent, java.lang.String sender)` Receives an aglet.
`void` | `removeContextListener(ContextListener o)` Removes the specified context listener.
`AgletProxy` | `retractAglet(Ticket ticket, AgletID aid)`
`AgletProxy` | `retractAglet(java.net.URL url)` Deprecated.
`AgletProxy` | `retractAglet(java.net.URL url, AgletID aid)` Retracts the Aglet specified by its url: scheme://host-domain-name/[user-name]#aglet-identity.
`void` | `setPersistence(Persistence p)`
`void` | `setProperty(java.lang.String key, java.lang.Object value)` Sets the context property
`void` | `setResourceManagerFactory(ResourceManagerFactory rmf)`
`void` | `showDocument(java.net.URL url)` Shows a new document.
`void` | `shutdown()` Shutdown the context.
`void` | `shutdown(Message msg)` Shutdown the context with the specific message object.
`void` | `start()` Starts
`void` | `start(boolean reactivate)` Starts the context.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### addContextListener

    public void addContextListener(ContextListener o)

  Description copied from interface: `AgletContext`
  Adds the specified context listener to receive context events from this context.
  Specified by:
    `addContextListener` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `listener` - the context listener
  Throws:
    `java.lang.SecurityException` -

### clearCache

    public void clearCache(java.net.URL codebase)

  Clear the cache
  Specified by:
    `clearCache` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `codebase` - the codebase of the cache to clean up. if null, entire cache in this context is cleared.

### createAglet

    public AgletProxy createAglet(java.net.URL url,
                                  java.lang.String classname,
                                  java.lang.Object init)
                           throws java.io.IOException,
                                  AgletException,
                                  java.lang.ClassNotFoundException,
                                  java.lang.InstantiationException

  Creates an instance of the specified aglet located at the specified URL.
  Specified by:
    `createAglet` in interface `AgletContext`
  Parameters:
    `url` - the URL to load the aglet class from.
    `name` - the aglet's class name.
  Returns:
    a newly instantiated and initialized Aglet.
  Throws:
    `java.lang.ClassNotFoundException` - if the class was not found
    `java.lang.InstantiationException` - if failed to instantiate the Aglet.

### getAgletProxies

    public java.util.Enumeration getAgletProxies()

  Gets the aglet proxies in the current execution context.
  Specified by:
    `getAgletProxies` in interface `AgletContext`
  Returns:
    an enumeration of aglet proxies.

### getAgletProxies

    public java.util.Enumeration getAgletProxies(int type)

  Gets the aglet proxies in the current execution context.
  Specified by:
    `getAgletProxies` in interface `AgletContext`
  Returns:
    an enumeration of aglet proxies.

### getAgletProxy

    public AgletProxy getAgletProxy(AgletID aid)

  Gets the proxy for an aglet specified by its identity.
  Specified by:
    `getAgletProxy` in interface `AgletContext`
  Parameters:
    `aid` - the identity of the aglet.
  Returns:
    the aglet proxy.

### getAgletProxy

    public AgletProxy getAgletProxy(java.net.URL host,
                                    AgletID aid)

  Deprecated.

  Gets the proxy for a remote aglet specified by url
  Specified by:
    `getAgletProxy` in interface `AgletContext`
  Parameters:
    `aid` - the identity of the aglet.
  Returns:
    the aglet proxy

### getAudioClip

    public java.applet.AudioClip getAudioClip(java.net.URL url)

  Description copied from interface: `AgletContext`
  Gets an audio clip.
  Specified by:
    `getAudioClip` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `audio` - an absolute URL giving the location of the audio file.
  Returns:
    the Audio clip object give by the URL.

### getHostingURL

    public java.net.URL getHostingURL()

  Returns the URL of the daemon serving all current execution contexts.
  Specified by:
    `getHostingURL` in interface `AgletContext`
  Throws:
    `AgletException` - if the hosting URL cannot be determined.

### getImage

    public java.awt.Image getImage(ImageData d)

  Description copied from interface: `AgletContext`
  Gets an image. This is a tempolary solution.
  Specified by:
    `getImage` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `image` - a serializable image data.
  Returns:
    the image object converted from the image data.

### getImage

    public java.awt.Image getImage(java.net.URL url)

  Description copied from interface: `AgletContext`
  Gets an image.
  Specified by:
    `getImage` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `image` - an absolute URL giving the location of the image file.
  Returns:
    the image object give by the URL.

### getImageData

    public ImageData getImageData(java.net.URL url)

  Description copied from interface: `AgletContext`
  Gets an image data. This is a tempolary solution.
  Specified by:
    `getImageData` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `image` - an absolute URL giving the location of the image file.
  Returns:
    the serializable image data.

### getName

    public java.lang.String getName()

  Gets the name of the context
  Specified by:
    `getName` in interface `AgletContext`
  Returns:
    the name of the context

### getPersistence

    public Persistence getPersistence()
                               throws java.io.IOException

### getProperty

    public java.lang.Object getProperty(java.lang.String key)

  Gets the context property indicated by the key.
  Specified by:
    `getProperty` in interface `AgletContext`
  Parameters:
    `key` - the name of the context property.
  Returns:
    the value of the specified key.

### getProperty

    public java.lang.Object getProperty(java.lang.String key,
                                        java.lang.Object def)

  Gets the context property indicated by the key and default value.
  Specified by:
    `getProperty` in interface `AgletContext`
  Parameters:
    `key` - the name of the context property.
    `def` - the value to use if this property is not set.
  Returns:
    the value of the specified key.

### getResourceManagerFactory

    public ResourceManagerFactory getResourceManagerFactory()

### multicastMessage

    public ReplySet multicastMessage(Message msg)

  Description copied from interface: `AgletContext`
  Sends a multicast message to the subscribers in the context.
  Specified by:
    `multicastMessage` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `message` - to send
  Returns:
    ReplySet containing FutureReplies

### postEvent

    public void postEvent(ContextEvent event,
                          boolean sync)

### postEvent0

    public void postEvent0(ContextEvent event)

### receiveAglet

    public void receiveAglet(Name agent_name,
                             ClassName[] classnames,
                             java.lang.String codebase,
                             byte[] agent,
                             java.lang.String sender)
                      throws AgletException,
                             java.lang.ClassNotFoundException

  Receives an aglet. Will start the aglet and return its proxy.
  Parameters:
    `aglet` - the aglet to be received by the context.
  Throws:
    `AgletException` - if it is not received.

### removeContextListener

    public void removeContextListener(ContextListener o)

  Description copied from interface: `AgletContext`
  Removes the specified context listener.
  Specified by:
    `removeContextListener` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `listener` - the context listener
  Throws:
    `java.lang.SecurityException` -

### retractAglet

    public AgletProxy retractAglet(Ticket ticket,
                                   AgletID aid)
                            throws java.io.IOException,
                                   AgletException

### retractAglet

    public AgletProxy retractAglet(java.net.URL url)
                            throws java.io.IOException,
                                   AgletException

  Deprecated.

  Retracts the Aglet specified by its url: scheme://host-domain-name/[user-name]#aglet-identity.
  Specified by:
    `retractAglet` in interface `AgletContext`
  Parameters:
    `url` - the location and aglet identity of the aglet to be retracted.
  Returns:
    the aglet proxy for the retracted aglet.
  Throws:
    `AgletException` - when the method failed to retract the aglet.

### retractAglet

    public AgletProxy retractAglet(java.net.URL url,
                                   AgletID aid)
                            throws java.io.IOException,
                                   AgletException

  Retracts the Aglet specified by its url: scheme://host-domain-name/[user-name]#aglet-identity.
  Specified by:
    `retractAglet` in interface `AgletContext`
  Parameters:
    `url` - the location and aglet identity of the aglet to be retracted.
    `aid` - the aglet identity of the aglet to be retracted.
  Returns:
    the aglet proxy for the retracted aglet.
  Throws:
    `AgletException` - when the method failed to retract the aglet.

### setPersistence

    public void setPersistence(Persistence p)
                        throws AgletException

### setProperty

    public void setProperty(java.lang.String key,
                            java.lang.Object value)

  Sets the context property
  Specified by:
    `setProperty` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `key` - the name of the context property.
    `value` - the value to be stored.
  Returns:
    the value of the specified key.

### setResourceManagerFactory

    public void setResourceManagerFactory(ResourceManagerFactory rmf)

### showDocument

    public void showDocument(java.net.URL url)

  Shows a new document. This may be ignored by the aglet context. ContextPermission("showDocument", url) is required.
  Specified by:
    `showDocument` in interface `AgletContext`
  Parameters:
    `url` - an url to be shown

### shutdown

    public void shutdown()

  Description copied from interface: `AgletContext`
  Shutdown the context. This is ignored if the context is already stopped.
  Specified by:
    `shutdown` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Throws:
    `java.lang.SecurityException` - if the current execution context is not allowd to shutdown
  See Also:
    `start`

### shutdown

    public void shutdown(Message msg)

  Description copied from interface: `AgletContext`
  Shutdown the context with the specific message object. This message object is delivered to all aglets in the context before all aglets are killed. This is ignored if the context is already stopped.
  Specified by:
    `shutdown` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Throws:
    `java.lang.SecurityException` - if the current execution context is not allowd to shutdown
  See Also:
    `start`

### start

    public void start()

  Starts
  Specified by:
    `start` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Throws:
    `java.lang.SecurityException` -

### start

    public void start(boolean reactivate)

  Description copied from interface: `AgletContext`
  Starts the context. This is ignored if the context is already runnig.
  Specified by:
    `start` in interface `AgletContext`
  Following copied from interface: `com.ibm.aglet.AgletContext`
  Parameters:
    `reactivate` - if false, it does not activate aglets in the deactivation spool
  Throws:
    `java.lang.SecurityException` -

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD