|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ibm.aglets.AgletContextImpl
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.
| Nested Class Summary | |
(package private) class |
AgletContextImpl.EventRunner
|
| Field Summary | |
private java.util.Hashtable |
_agletProxies
|
(package private) java.util.Properties |
_contextProperties
|
private java.net.URL |
_hostingURL
|
private java.lang.String |
_name
|
private Persistence |
_persistence
|
private ResourceManagerFactory |
_rm_factory
|
private boolean |
_secure
|
(package private) SubscriberManager |
_subscriberManager
|
(package private) AgletTimer |
_timer
|
private static ContextPermission |
ADD_LISTENER_PERMISSION
|
private java.util.Hashtable |
clips
|
(package private) AgletID |
context_aid
|
private int |
creating
|
private java.lang.Object |
creationLock
|
(package private) AgletContextImpl.EventRunner |
erunner
|
private java.util.Hashtable |
images
|
(package private) ContextListener |
listeners
|
private static LogCategory |
logCategory
|
private static ContextPermission |
REMOVE_LISTENER_PERMISSION
|
private static ContextPermission |
SHUTDOWN_PERMISSION
|
private boolean |
shutting_down
|
private static ContextPermission |
START_PERMISSION
|
| Constructor Summary | |
(package private) |
AgletContextImpl(java.lang.String name)
Creates an execution context for aglets. |
(package private) |
AgletContextImpl(java.lang.String name,
boolean secure)
|
| Method Summary | |
(package private) void |
addAgletProxy(AgletID aid,
AgletProxyImpl proxy)
|
void |
addContextListener(ContextListener o)
Adds the specified context listener to receive context events from this context. |
(package private) void |
checkPermission(java.security.Permission p)
|
void |
clearCache(java.net.URL codebase)
Clear the cache |
private AgletProxy |
createAglet(java.net.URL url,
java.lang.String classname,
java.security.cert.Certificate owner,
java.lang.Object init)
Creates an instance of the specified aglet located at the specified URL. |
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. |
(package private) ResourceManager |
createResourceManager(java.net.URL codebase,
java.security.cert.Certificate owner,
ClassName[] table)
|
(package private) void |
endCreation()
|
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()
|
(package private) boolean |
getSecurity()
|
(package private) java.lang.Object |
handleMessage(Message msg)
|
(package private) void |
log(java.lang.String kind,
java.lang.String msg)
|
ReplySet |
multicastMessage(Message msg)
Sends a multicast message to the subscribers in the context. |
(package private) boolean |
noResponseAglet(AgletProxy proxy)
|
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. |
(package private) void |
removeAgletProxy(AgletID aid,
AgletProxyImpl proxy)
|
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)
|
(package private) void |
setSecurity(boolean secure)
|
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. |
(package private) void |
startCreation()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static LogCategory logCategory
private boolean _secure
private static ContextPermission START_PERMISSION
private static ContextPermission SHUTDOWN_PERMISSION
private static ContextPermission ADD_LISTENER_PERMISSION
private static ContextPermission REMOVE_LISTENER_PERMISSION
private java.net.URL _hostingURL
private java.lang.String _name
private Persistence _persistence
private java.util.Hashtable _agletProxies
java.util.Properties _contextProperties
SubscriberManager _subscriberManager
private ResourceManagerFactory _rm_factory
AgletTimer _timer
private java.lang.Object creationLock
private int creating
private boolean shutting_down
AgletID context_aid
ContextListener listeners
AgletContextImpl.EventRunner erunner
private java.util.Hashtable images
private java.util.Hashtable clips
| Constructor Detail |
AgletContextImpl(java.lang.String name)
AgletContextImpl(java.lang.String name,
boolean secure)
| Method Detail |
void addAgletProxy(AgletID aid,
AgletProxyImpl proxy)
throws InvalidAgletException
InvalidAgletExceptionpublic void addContextListener(ContextListener o)
AgletContext
addContextListener in interface AgletContexto - the context listenervoid checkPermission(java.security.Permission p)
public void clearCache(java.net.URL codebase)
clearCache in interface AgletContextcodebase - the codebase of the cache to clean up. if null,
entire cache in this context is cleared.
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
createAglet in interface AgletContexturl - the URL to load the aglet class from.classname - 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.
java.lang.ClassNotFoundException - if the class was not found
java.lang.InstantiationException - if failed to instantiate the Aglet.
AgletException - if the aglets can not be created.
java.io.IOExceptionAglet.onCreation(java.lang.Object)
private AgletProxy createAglet(java.net.URL url,
java.lang.String classname,
java.security.cert.Certificate owner,
java.lang.Object init)
throws java.io.IOException,
AgletException,
java.lang.ClassNotFoundException,
java.lang.InstantiationException
url - the URL to load the aglet class from.
java.lang.ClassNotFoundException - if the class was not found
java.lang.InstantiationException - if failed to instantiate the Aglet.
java.io.IOException
AgletException
ResourceManager createResourceManager(java.net.URL codebase,
java.security.cert.Certificate owner,
ClassName[] table)
void endCreation()
public java.util.Enumeration getAgletProxies()
getAgletProxies in interface AgletContextpublic java.util.Enumeration getAgletProxies(int type)
getAgletProxies in interface AgletContexttype - the type of aglets. ACTIVE, INACTIVE or ACTIVE | INACTIVE,
Aglet.ACTIVE,
Aglet.INACTIVEpublic AgletProxy getAgletProxy(AgletID aid)
getAgletProxy in interface AgletContextaid - the identity of the aglet.
public AgletProxy getAgletProxy(java.net.URL host,
AgletID aid)
getAgletProxy in interface AgletContextaid - the identity of the aglet.host - the address specifing a remote context.
getNamepublic java.applet.AudioClip getAudioClip(java.net.URL url)
AgletContext
getAudioClip in interface AgletContexturl - an absolute URL giving the location of the audio file.
public java.net.URL getHostingURL()
getHostingURL in interface AgletContextAgletException - if the hosting URL cannot be determined.public java.awt.Image getImage(ImageData d)
AgletContext
getImage in interface AgletContextd - a serializable image data.
public java.awt.Image getImage(java.net.URL url)
AgletContext
getImage in interface AgletContexturl - an absolute URL giving the location of the image file.
public ImageData getImageData(java.net.URL url)
AgletContext
getImageData in interface AgletContexturl - an absolute URL giving the location of the image file.
public java.lang.String getName()
getName in interface AgletContext
public Persistence getPersistence()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.Object getProperty(java.lang.String key)
getProperty in interface AgletContextkey - the name of the context property.
public java.lang.Object getProperty(java.lang.String key,
java.lang.Object def)
getProperty in interface AgletContextkey - the name of the context property.def - the value to use if this property is not set.
public ResourceManagerFactory getResourceManagerFactory()
boolean getSecurity()
java.lang.Object handleMessage(Message msg)
throws NotHandledException,
MessageException
NotHandledException
MessageException
void log(java.lang.String kind,
java.lang.String msg)
public ReplySet multicastMessage(Message msg)
AgletContext
multicastMessage in interface AgletContextboolean noResponseAglet(AgletProxy proxy)
public void postEvent(ContextEvent event,
boolean sync)
public void postEvent0(ContextEvent event)
public void receiveAglet(Name agent_name,
ClassName[] classnames,
java.lang.String codebase,
byte[] agent,
java.lang.String sender)
throws AgletException,
java.lang.ClassNotFoundException
AgletException - if it is not received.
java.lang.ClassNotFoundException
void removeAgletProxy(AgletID aid,
AgletProxyImpl proxy)
public void removeContextListener(ContextListener o)
AgletContext
removeContextListener in interface AgletContexto - the context listener
public AgletProxy retractAglet(Ticket ticket,
AgletID aid)
throws java.io.IOException,
AgletException
java.io.IOException
AgletException
public AgletProxy retractAglet(java.net.URL url)
throws java.io.IOException,
AgletException
retractAglet in interface AgletContexturl - the location and aglet identity of the aglet to be retracted.
AgletException - when the method failed to retract the aglet.
java.io.IOException
public AgletProxy retractAglet(java.net.URL url,
AgletID aid)
throws java.io.IOException,
AgletException
retractAglet in interface AgletContexturl - the location and aglet identity of the aglet to be retracted.aid - the aglet identity of the aglet to be retracted.
AgletException - when the method failed to retract the aglet.
java.io.IOException
public void setPersistence(Persistence p)
throws AgletException
AgletException
public void setProperty(java.lang.String key,
java.lang.Object value)
setProperty in interface AgletContextkey - the name of the context property.value - the value to be stored.
public void setResourceManagerFactory(ResourceManagerFactory rmf)
void setSecurity(boolean secure)
public void showDocument(java.net.URL url)
showDocument in interface AgletContexturl - an url to be shownpublic void shutdown()
AgletContext
shutdown in interface AgletContextstartpublic void shutdown(Message msg)
AgletContext
shutdown in interface AgletContextstartpublic void start()
start in interface AgletContextpublic void start(boolean reactivate)
AgletContext
start in interface AgletContextreactivate - if false, it does not activate aglets in the deactivation spool
void startCreation()
throws ShuttingDownException
ShuttingDownException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||