|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The AgletContext interface is used by an aglet to get information about its environment and to send messages to the environment and other aglets currently active in that environment. It provides means for maintaining and managing running aglets in an environment where the host system is secured against malicious aglets.
Method Summary | |
void |
addContextListener(ContextListener listener)
Adds the specified context listener to receive context events from this context. |
void |
clearCache(java.net.URL codebase)
Clears class cache in memory. |
AgletProxy |
createAglet(java.net.URL codeBase,
java.lang.String code,
java.lang.Object init)
Creates an instance of the specified aglet class. |
java.util.Enumeration |
getAgletProxies()
Gets an enumeration of all aglets in the current context including deactivated aglets. |
java.util.Enumeration |
getAgletProxies(int type)
Gets an array of aglet proxies in the current context. |
AgletProxy |
getAgletProxy(AgletID id)
Gets a proxy for an aglet in the current context. |
AgletProxy |
getAgletProxy(java.net.URL contextAddress,
AgletID id)
Deprecated. |
java.applet.AudioClip |
getAudioClip(java.net.URL audio)
Gets an audio clip. |
java.net.URL |
getHostingURL()
Returns the URL of the daemon serving this context. |
java.awt.Image |
getImage(ImageData image)
Gets an image. |
java.awt.Image |
getImage(java.net.URL image)
Gets an image. |
ImageData |
getImageData(java.net.URL image)
Gets an image data. |
java.lang.String |
getName()
Gets the name of the context. |
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. |
ReplySet |
multicastMessage(Message msg)
Sends a multicast message to the subscribers in the context. |
void |
removeContextListener(ContextListener listener)
Removes the specified context listener. |
AgletProxy |
retractAglet(java.net.URL url)
Deprecated. |
AgletProxy |
retractAglet(java.net.URL url,
AgletID aid)
Retracts the aglet specified by its url and id |
void |
setProperty(java.lang.String key,
java.lang.Object value)
Sets the context property indicated by the key and value. |
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 the context. |
void |
start(boolean reactivate)
Starts the context. |
Method Detail |
public void addContextListener(ContextListener listener)
listener
- the context listenerjava.lang.SecurityException
- public void clearCache(java.net.URL codebase)
codebase
- the codebase of the cache to clean up. if null,
entire cache in this context is cleared.public AgletProxy createAglet(java.net.URL codeBase, java.lang.String code, java.lang.Object init) throws java.io.IOException, AgletException, java.lang.ClassNotFoundException, java.lang.InstantiationException
codeBase
- codeBase specifies the base URL of the aglet class file,
in other words, the (possibly remote) directory that contains the
aglet's code. If this argument is null, then the directories
specified in the local host's aglet search path are searched.
The aglet search path works in a similar way to Java's class path.
It is typically an environment variable that specifies a list of
directories to be searched for aglet code files.code
- code gives the name of the file that contains the
aglet's compiled class code. This file is relative to the base URL
of the aglet, and cannot be absolute.init
- init is an object passed on to the aglet's onCreation
method.AgletException
- if the aglets can not be created.UnknownHostException
- if the given host could not be found.ServerNotFoundException
- if the server could not be found.java.lang.InstantiationException
- if the instantiation failed.java.lang.ClassNotFoundException
- if the class not found.Aglet.onCreation(java.lang.Object)
public java.util.Enumeration getAgletProxies()
public java.util.Enumeration getAgletProxies(int type)
type
- the type of aglets. ACTIVE, INACTIVE or ACTIVE | INACTIVE,Aglet.ACTIVE
,
Aglet.INACTIVE
public AgletProxy getAgletProxy(AgletID id)
id
- the identity of the aglet.public AgletProxy getAgletProxy(java.net.URL contextAddress, AgletID id)
contextAddress
- the address specifing a remote context.id
- the identity of the aglet.getName
public java.applet.AudioClip getAudioClip(java.net.URL audio)
audio
- an absolute URL giving the location of the audio file.public java.net.URL getHostingURL()
public java.awt.Image getImage(ImageData image)
image
- a serializable image data.public java.awt.Image getImage(java.net.URL image)
image
- an absolute URL giving the location of the image file.public ImageData getImageData(java.net.URL image)
image
- an absolute URL giving the location of the image file.public java.lang.String getName()
public java.lang.Object getProperty(java.lang.String key)
key
- the name of the context property.public java.lang.Object getProperty(java.lang.String key, java.lang.Object def)
key
- the name of the context property.def
- the value to use if this property is not set.public ReplySet multicastMessage(Message msg)
message
- to sendpublic void removeContextListener(ContextListener listener)
listener
- the context listenerjava.lang.SecurityException
- public AgletProxy retractAglet(java.net.URL url) throws java.io.IOException, AgletException
url
- the location and aglet identity of the aglet to be retracted.AgletException
- when the method failed to retract the aglet.UnknownHostException
- if the specified HOST is not found.ServerNotFoundException
- if the aglet server specified
in the URL is not available.MalformedURLException
- if the given url is not URI for
an aglet.RequestRefusedException
- if the retraction refused.AgletNotFoundException
- if the aglet could not be found.public AgletProxy retractAglet(java.net.URL url, AgletID aid) throws java.io.IOException, AgletException
url
- the location of the aglet to be retracted.id
- the aglet identity of the aglet to be retracted.AgletException
- when the method failed to retract the aglet.UnknownHostException
- if the specified HOST is not found.ServerNotFoundException
- if the aglet server specified
in the URL is not available.MalformedURLException
- if the given url is not URI for
an aglet.RequestRefusedException
- if the retraction refused.AgletNotFoundException
- if the aglet could not be found.public void setProperty(java.lang.String key, java.lang.Object value)
key
- the name of the context property.value
- the value to be stored.public void showDocument(java.net.URL url)
url
- an url to be shownpublic void shutdown()
java.lang.SecurityException
- if the current execution context is not
allowd to shutdownstart
public void shutdown(Message msg)
java.lang.SecurityException
- if the current execution context is not
allowd to shutdownstart
public void start()
java.lang.SecurityException
- public void start(boolean reactivate)
reactivate
- if false, it does not activate aglets in the deactivation spooljava.lang.SecurityException
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |