|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.aglet.Aglet
The Aglet class is the abstract base class for aglets. Use this class to create your own personalized aglets.
Field Summary | |
static int |
ACTIVE
State of Aglet. |
static int |
INACTIVE
|
static short |
MAJOR_VERSION
|
static short |
MINOR_VERSION
|
Constructor Summary | |
protected |
Aglet()
Constructs an uninitialized aglet. |
Method Summary | |
void |
addCloneListener(CloneListener listener)
Adds the specified clone listener to receive clone events from this aglet. |
void |
addMobilityListener(MobilityListener listener)
Adds the specified mobility listener to receive mobility events from this aglet. |
void |
addPersistencyListener(PersistencyListener listener)
Adds the specified persistency listener to receive persistency events from this aglet. |
java.lang.Object |
clone()
Clones the aglet and the proxy that holds the aglet. |
void |
deactivate(long duration)
Deactivates the aglet. |
void |
dispatch(Ticket ticket)
Dispatches the aglet to the location (host) specified by the ticket as argument. |
void |
dispatch(java.net.URL destination)
Dispatches the aglet to the location (host) specified by the argument. |
void |
dispatchEvent(AgletEvent ev)
Dispatches an event to this aglet |
void |
dispose()
Destroys and removes the aglet from its current aglet context. |
void |
exitMonitor()
Exits the current monitor. |
AgletContext |
getAgletContext()
Gets the context in which the aglet is currently executing. |
AgletID |
getAgletID()
Gets the id of this aglet. |
AgletInfo |
getAgletInfo()
Gets the info object of this aglet |
java.applet.AudioClip |
getAudioData(java.net.URL url)
Gets an audio data |
java.net.URL |
getCodeBase()
Gets the code base URL of this aglet |
java.awt.Image |
getImage(java.net.URL url)
Gets an image |
java.awt.Image |
getImage(java.net.URL url,
java.lang.String name)
Gets an image |
MessageManager |
getMessageManager()
Gets the message manager. |
java.security.PermissionCollection |
getProtections()
Gets the protections: permission collection about who can send what kind of messages to the aglet |
AgletProxy |
getProxy()
Gets the proxy of aglet. |
java.lang.String |
getText()
Gets the message line of this Aglet. |
boolean |
handleMessage(Message message)
Handles the message form outside. |
void |
notifyAllMessages()
Notifies all of waiting threads. |
void |
notifyMessage()
Notifies a single waiting thread. |
void |
onCreation(java.lang.Object init)
Initializes the new aglet. |
void |
onDisposing()
Is called when an attempt is made to dispose of the aglet. |
protected void |
processCloneEvent(CloneEvent ev)
Processes clone events occurring on this aglet by dispatching them to any registered CloneListener objects. |
protected void |
processMobilityEvent(MobilityEvent ev)
Processes mobility events occurring on this aglet by dispatching them to any registered MobilityListener objects. |
protected void |
processPersistencyEvent(PersistencyEvent ev)
Processes persistency events occurring on this aglet by dispatching them to any registered PersistencyListener objects. |
void |
removeCloneListener(CloneListener l)
Removes the specified clone listener so it no longer receives clone events. |
void |
removeMobilityListener(MobilityListener l)
Removes the specified mobility listener so it no longer receives mobility events. |
void |
removePersistencyListener(PersistencyListener l)
Removes the specified persistency listener so it no longer receives persistency events. |
void |
run()
Is the entry point for the aglet's own thread of execution. |
void |
setProtections(java.security.PermissionCollection protections)
Sets the protections: permission collection about who can send what kind of messages to the aglet |
void |
setStub(AgletStub stub)
Sets the proxy for the aglet. |
void |
setText(java.lang.String text)
Sets the text of this Aglet. |
void |
snapshot()
[Preliminary] Save a snapshot of this aglet into a 2nd storage. |
void |
subscribeMessage(java.lang.String name)
Subscribes to a named message. |
void |
suspend(long duration)
This is an experimental feature. |
void |
unsubscribeAllMessages()
Unsubscribes from all message kinds. |
boolean |
unsubscribeMessage(java.lang.String name)
Unsubscribes from a named message. |
void |
waitMessage()
Waits until it is notified. |
void |
waitMessage(long timeout)
Waits until it is notified or the timeout expires |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final short MAJOR_VERSION
public static final short MINOR_VERSION
public static final int ACTIVE
AgletContext.getAgletProxies()
public static final int INACTIVE
Constructor Detail |
protected Aglet()
onCreation(java.lang.Object)
Method Detail |
public final void addCloneListener(CloneListener listener)
listener
- the mobility listenerpublic final void addMobilityListener(MobilityListener listener)
listener
- the mobility listenerpublic final void addPersistencyListener(PersistencyListener listener)
listener
- the persistency listenerpublic final java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- when the cloning fails.CloneListener.onCloning(com.ibm.aglet.event.CloneEvent)
,
CloneListener.onClone(com.ibm.aglet.event.CloneEvent)
public final void deactivate(long duration) throws java.io.IOException
millisecounds
- duration of the aglet deactivating.
If this is 0, it will be activeted at the next startup time.java.io.NotSerializableException
- if the entire aglet is not
serializable.java.io.IOException
- if I/O failedjava.lang.IllegalArgumentException
- if the argument is negative.public final void dispatch(Ticket ticket) throws java.io.IOException, RequestRefusedException
ticket
- ticket to dispatch destination.ServerNotFoundException
- if the server could not be found.java.net.UnknownHostException
- if the host given in the URL does not
exist.RequestRefusedException
- if the remote server refused the
dispatch request.ServerNotFoundException
- if the the destination is
unavailablejava.io.NotSerializableException
- if the entire aglet is not
serializableMobilityListener.onDispatching(com.ibm.aglet.event.MobilityEvent)
,
MobilityListener.onArrival(com.ibm.aglet.event.MobilityEvent)
public final void dispatch(java.net.URL destination) throws java.io.IOException, RequestRefusedException
destination
- dispatch destination.ServerNotFoundException
- if the server could not be found.java.net.UnknownHostException
- if the host given in the URL does not
exist.RequestRefusedException
- if the remote server refused the
dispatch request.ServerNotFoundException
- if the the destination is
unavailablejava.io.NotSerializableException
- if the entire aglet is not
serializableMobilityListener.onDispatching(com.ibm.aglet.event.MobilityEvent)
,
MobilityListener.onArrival(com.ibm.aglet.event.MobilityEvent)
public final void dispatchEvent(AgletEvent ev)
ev
- the aglet eventpublic final void dispose()
onDisposing()
public void exitMonitor()
IllegalMonitorStateException
- if the current thread is not the
owner of the monitor.exitMonitor()
,
waitMessage
,
notifyMessage
,
notifyAllMessages
public final AgletContext getAgletContext()
public final AgletID getAgletID()
aglet.AgletID
public final AgletInfo getAgletInfo()
aglet.AgletID
public final java.applet.AudioClip getAudioData(java.net.URL url) throws java.io.IOException
public final java.net.URL getCodeBase()
aglet.AgletID
public final java.awt.Image getImage(java.net.URL url) throws java.io.IOException
public final java.awt.Image getImage(java.net.URL url, java.lang.String name) throws java.io.IOException
public final MessageManager getMessageManager()
public java.security.PermissionCollection getProtections()
public final AgletProxy getProxy()
public final java.lang.String getText()
public boolean handleMessage(Message message)
msg
- the message sent to the agletFutureReply.getReply()
,
Message.sendReply()
,
AgletProxy.sendMessage(com.ibm.aglet.Message)
public void notifyAllMessages()
IllegalMonitorStateException
- If the current thread
is not the owner of the monitor.notifyAllMessages()
,
waitMessage
,
notifyMessage
public void notifyMessage()
IllegalMonitorStateException
- If the current thread
is not the owner of the monitor.notifyMessage()
,
waitMessage
,
notifyAllMessages
public void onCreation(java.lang.Object init)
init
- the argument with which the aglet is initialized.AgletContext.createAglet(java.net.URL, java.lang.String, java.lang.Object)
public void onDisposing()
java.lang.SecurityException
- if the request for disposal is rejected.dispose()
,
AgletProxy.dispose()
protected void processCloneEvent(CloneEvent ev)
ev
- the clone eventprotected void processMobilityEvent(MobilityEvent ev)
ev
- the mobility eventprotected void processPersistencyEvent(PersistencyEvent ev)
ev
- the persistency eventpublic final void removeCloneListener(CloneListener l)
l
- the clone listenerpublic final void removeMobilityListener(MobilityListener l)
l
- the mobility listenerpublic final void removePersistencyListener(PersistencyListener l)
l
- the persistency listenerpublic void run()
onCreation(java.lang.Object)
,
CloneListener.onClone(com.ibm.aglet.event.CloneEvent)
,
MobilityListener.onArrival(com.ibm.aglet.event.MobilityEvent)
,
PersistencyListener.onActivation(com.ibm.aglet.event.PersistencyEvent)
public void setProtections(java.security.PermissionCollection protections)
protections
- collection of protections about who can send
what kind of messages to the agletpublic final void setStub(AgletStub stub)
proxy
- the proxy to setpublic final void setText(java.lang.String text)
message
- the message.public final void snapshot() throws java.io.IOException
java.io.NotSerializableException
- if the entire aglet is not
serializablejava.io.IOException
- if I/O failedpublic final void subscribeMessage(java.lang.String name)
name
- the message kind.public final void suspend(long duration) throws AgletException, java.lang.IllegalArgumentException
This is almost like deactivate(long duration), but there are some differences.
duration
- duration of the aglet deactivating in milliseconds.
If this is 0, it will be activeted at the next startup time.AgletException
- if the aglet cannot be suspended.java.lang.IllegalArgumentException
- if the minutes parameter is
negative.public final void unsubscribeAllMessages()
public final boolean unsubscribeMessage(java.lang.String name)
name
- the message kind.public void waitMessage()
IllegalMonitorStateException
- If the current thread
is not the owner of the monitor.MessageManager.waitMessage()
,
notifyMessage
,
notifyAllMessages
public void waitMessage(long timeout)
timeout
- the maximum value to wait in millisecondsIllegalMonitorStateException
- If the current thread
is not the owner of the monitor.MessageManager.waitMessage()
,
notifyMessage
,
notifyAllMessages
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |