|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ibm.aglet.AgletStub
com.ibm.aglets.LocalAgletRef
Class LocalAgletRef is the implementation of AgletStub. The purpose of this class is to provide a mechanism to control the aglet.
| Nested Class Summary | |
(package private) static class |
LocalAgletRef.RefKey
|
| Field Summary | |
private static AgentProfile |
_agent_profile
|
private AgletContextImpl |
_context
|
private boolean |
_hasSnapshot
|
private int |
_mode
|
private Name |
_name
|
private java.security.cert.Certificate |
_owner
|
private boolean |
_secure
|
private int |
_state
|
private java.lang.String |
_text
|
private static java.lang.String |
ACTION_ACTIVATE
|
private static java.lang.String |
ACTION_CLONE
|
private static java.lang.String |
ACTION_DEACTIVATE
|
private static java.lang.String |
ACTION_DISPATCH
|
private static java.lang.String |
ACTION_DISPOSE
|
private static java.lang.String |
ACTION_RETRACT
|
(package private) static int |
ACTIVE
|
(package private) Aglet |
aglet
|
(package private) static java.lang.String |
CLASS_AGLET_PERMISSION
|
(package private) static java.lang.String |
CLASS_AGLET_PROTECTION
|
(package private) static java.lang.String |
CLASS_MESSAGE_PERMISSION
|
(package private) static java.lang.String |
CLASS_MESSAGE_PROTECTION
|
(package private) static int |
INACTIVE
|
(package private) AgletInfo |
info
|
(package private) static int |
INVALID
|
(package private) static java.util.Hashtable |
local_ref_table
|
private java.lang.Object |
lock
|
private static LogCategory |
logCategory
|
(package private) MessageManagerImpl |
messageManager
|
(package private) static int |
NOT_INITIALIZED
|
private int |
num_of_trial_to_dispose
|
(package private) Protections |
protections
The protections: permission collection about who can send what kind of messages to the aglet |
(package private) AgletProxyImpl |
proxy
|
(package private) ResourceManager |
resourceManager
|
| Constructor Summary | |
(package private) |
LocalAgletRef(AgletContextImpl cxt)
Creates an aglet reference |
(package private) |
LocalAgletRef(AgletContextImpl cxt,
boolean secure)
|
| Method Summary | |
(package private) java.lang.Object |
_clone()
|
void |
activate()
Activate the aglet |
private static void |
addAgletRef(Name name,
LocalAgletRef ref)
|
private boolean |
canSetProtections(java.security.PermissionCollection newprotections)
Returns that the protections can be set or not |
(package private) void |
checkActive()
|
private void |
checkAgletPermission(java.lang.String actions)
|
private void |
checkAgletPermissionAndProtection(java.lang.String actions)
|
private void |
checkAgletProtection(java.lang.String actions)
|
private void |
checkMessagePermission(MessageImpl msg)
|
private void |
checkMessagePermission(java.lang.String actions)
|
private void |
checkMessagePermissionAndProtection(MessageImpl msg)
|
private void |
checkMessagePermissionAndProtection(java.lang.String actions)
|
private void |
checkMessageProtection(MessageImpl msg)
|
private void |
checkMessageProtection(java.lang.String actions)
|
private void |
checkPermission(java.security.Permission p)
|
private void |
checkProtection(java.security.Permission p)
|
void |
checkValidation()
|
protected java.lang.Object |
clone()
Clones the aglet ref. |
private MessageImpl |
cloneMessageAndCheck(Message msg,
int type)
|
private static Protections |
cloneProtections(Protections protections)
|
(package private) ResourceManager |
createResourceManager(ClassName[] table)
|
protected void |
deactivate(long duration)
Deactivate aglet till the specified date. |
(package private) void |
deactivate(MessageImpl msg,
long duaration)
|
void |
delegateMessage(Message msg)
Delegates a message to the ref. |
(package private) void |
destroyMessageManager()
|
(package private) void |
dispatch(MessageImpl msg,
Ticket ticket)
|
protected void |
dispatch(Ticket ticket)
|
protected void |
dispatch(java.net.URL url)
|
void |
dispatchEvent(AgletEvent ev)
|
protected void |
dispose()
Disposes the aglet. |
(package private) void |
dispose(MessageImpl msg)
|
private void |
disposeAnyway(MessageImpl msg)
|
java.lang.String |
getAddress()
Gets the address. |
Aglet |
getAglet()
Gets the aglet. |
protected AgletContext |
getAgletContext()
|
AgletInfo |
getAgletInfo()
Gets the information of the aglet |
(package private) static LocalAgletRef |
getAgletRef(Name name)
|
java.security.cert.Certificate |
getCertificate()
Gets the Certificate of the aglet's class. |
protected MessageManager |
getMessageManager()
Gets the aglet's message manager object. |
Name |
getName()
|
private java.lang.String |
getPersistenceKey()
|
protected java.security.PermissionCollection |
getProtections()
Gets the protections: permission collection about who can send what kind of messages to the aglet |
Ref |
getRef(VirtualRef vref)
|
java.lang.String |
getRefClassName()
|
(package private) boolean |
getSecurity()
|
(package private) java.lang.String |
getStateAsString()
|
java.lang.String |
getText()
Gets the current content of the Aglet's message line. |
(package private) void |
invalidateReference()
|
boolean |
isActive()
Checks if it's valid or not. |
boolean |
isRemote()
Checks if it's remote or not. |
boolean |
isState(int s)
Check the state |
boolean |
isValid()
Checks if it's valid or not. |
protected void |
kill()
|
void |
referenced()
|
(package private) void |
releaseResource()
|
private static void |
removeAgletRef(Name name,
LocalAgletRef ref)
|
(package private) void |
removeSnapshot()
|
void |
resume()
Resume the aglet |
(package private) void |
resumeMessageManager()
|
(package private) byte[] |
retract()
|
FutureReply |
sendFutureMessage(Message msg)
Sends a future message in asynchronous way. |
(package private) void |
sendFutureMessage(Message msg,
FutureReplyImpl future)
|
java.lang.Object |
sendMessage(Message msg)
Sends a message in synchronous way. |
void |
sendOnewayMessage(Message msg)
Sends an oneway message |
protected void |
setAglet(Aglet a)
|
(package private) void |
setMessageManager(MessageManagerImpl impl)
|
(package private) void |
setName(Name n)
|
protected void |
setProtections(java.security.PermissionCollection newprotections)
Sets the protections: permission collection about who can send what kind of messages to the aglet |
void |
setRef(VirtualRef vref,
java.io.ObjectInputStream s)
|
(package private) void |
setSecurity(boolean secure)
|
protected void |
setText(java.lang.String text)
Sets/Shows a text. |
protected void |
snapshot()
Checkpointing the snapshot of the aglet. |
(package private) void |
startActivatedAglet()
Send events to the activated aglet. |
(package private) void |
startArrivedAglet(AgletContextImpl cxt,
java.lang.String sender)
Activates the arrived aglet. |
(package private) void |
startClonedAglet(AgletContextImpl cxt,
AgletProxyImpl parent)
Activates the cloned aglet. |
(package private) void |
startCreatedAglet(AgletContextImpl cxt,
java.lang.Object init)
Initializes the aglet. |
(package private) void |
startMessageManager()
|
(package private) void |
startResumedAglet()
Send events to the resumed aglet. |
protected void |
subscribeMessage(java.lang.String kind)
|
protected void |
suspend(long duration)
Suspend aglet for the specified amount of time. |
(package private) void |
suspend(MessageImpl msg,
long duaration)
|
(package private) void |
suspendForRetraction(Ticket ticket)
|
(package private) void |
suspendMessageManager()
|
(package private) void |
terminateThreads()
|
(package private) static java.lang.String |
toMessage(java.lang.Exception ex)
|
java.lang.String |
toString()
|
void |
unreferenced()
|
protected void |
unsubscribeAllMessages()
|
protected boolean |
unsubscribeMessage(java.lang.String kind)
|
(package private) void |
validate(AgletContextImpl context,
int state)
|
private void |
writeDeactivatedAglet(java.io.ObjectOutputStream out,
DeactivationInfo dinfo)
|
void |
writeInfo(java.io.ObjectOutputStream s)
|
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
static final int NOT_INITIALIZED
static final int ACTIVE
static final int INACTIVE
static final int INVALID
static final java.lang.String CLASS_AGLET_PERMISSION
static final java.lang.String CLASS_MESSAGE_PERMISSION
static final java.lang.String CLASS_AGLET_PROTECTION
static final java.lang.String CLASS_MESSAGE_PROTECTION
private static final java.lang.String ACTION_CLONE
private static final java.lang.String ACTION_DISPOSE
private static final java.lang.String ACTION_DISPATCH
private static final java.lang.String ACTION_DEACTIVATE
private static final java.lang.String ACTION_ACTIVATE
private static final java.lang.String ACTION_RETRACT
private static LogCategory logCategory
private static AgentProfile _agent_profile
Aglet aglet
AgletInfo info
ResourceManager resourceManager
MessageManagerImpl messageManager
AgletProxyImpl proxy
Protections protections
private Name _name
private int _state
private boolean _hasSnapshot
private AgletContextImpl _context
private java.lang.String _text
private boolean _secure
private java.security.cert.Certificate _owner
private int _mode
private java.lang.Object lock
private int num_of_trial_to_dispose
static java.util.Hashtable local_ref_table
| Constructor Detail |
LocalAgletRef(AgletContextImpl cxt)
LocalAgletRef(AgletContextImpl cxt,
boolean secure)
| Method Detail |
java.lang.Object _clone()
throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
public void activate()
throws java.io.IOException,
InvalidAgletException,
AgletNotFoundException,
ShuttingDownException
AgletRef
activate in interface AgletRefjava.io.IOException
InvalidAgletException
AgletNotFoundException
ShuttingDownException
private static void addAgletRef(Name name,
LocalAgletRef ref)
private boolean canSetProtections(java.security.PermissionCollection newprotections)
void checkActive()
private void checkAgletPermission(java.lang.String actions)
private void checkAgletPermissionAndProtection(java.lang.String actions)
private void checkAgletProtection(java.lang.String actions)
private void checkMessagePermission(MessageImpl msg)
private void checkMessagePermission(java.lang.String actions)
private void checkMessagePermissionAndProtection(MessageImpl msg)
private void checkMessagePermissionAndProtection(java.lang.String actions)
private void checkMessageProtection(MessageImpl msg)
private void checkMessageProtection(java.lang.String actions)
private void checkPermission(java.security.Permission p)
private void checkProtection(java.security.Permission p)
public void checkValidation()
throws InvalidAgletException
checkValidation in interface AgletRefInvalidAgletException
protected java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class AgletStubjava.lang.CloneNotSupportedException - if the cloning fails.
InvalidAgletException - if the aglet is invalid.
private MessageImpl cloneMessageAndCheck(Message msg,
int type)
private static Protections cloneProtections(Protections protections)
ResourceManager createResourceManager(ClassName[] table)
protected void deactivate(long duration)
throws java.io.IOException
deactivate in class AgletStubduration - the duration to sleep in milliseconds.
AgletEception - if can not deactivate the aglet.
java.io.IOException
void deactivate(MessageImpl msg,
long duaration)
throws java.io.IOException,
InvalidAgletException,
RequestRefusedException
java.io.IOException
InvalidAgletException
RequestRefusedException
public void delegateMessage(Message msg)
throws InvalidAgletException
delegateMessage in interface AgletRefmsg - a message to delegate
InvalidAgletException - if the aglet is not valid any longer.void destroyMessageManager()
protected void dispatch(Ticket ticket)
throws java.io.IOException,
RequestRefusedException
dispatch in class AgletStubjava.io.IOException
RequestRefusedException
void dispatch(MessageImpl msg,
Ticket ticket)
throws java.io.IOException,
RequestRefusedException,
InvalidAgletException
java.io.IOException
RequestRefusedException
InvalidAgletException
protected void dispatch(java.net.URL url)
throws java.io.IOException,
RequestRefusedException
dispatch in class AgletStubjava.io.IOException
RequestRefusedExceptionpublic void dispatchEvent(AgletEvent ev)
protected void dispose()
dispose in class AgletStubInvalidAgletException - if the aglet is invalid.
void dispose(MessageImpl msg)
throws InvalidAgletException,
RequestRefusedException
InvalidAgletException
RequestRefusedException
private void disposeAnyway(MessageImpl msg)
throws RequestRefusedException
RequestRefusedException
public java.lang.String getAddress()
throws InvalidAgletException
getAddress in interface AgletRefInvalidAgletException
public Aglet getAglet()
throws InvalidAgletException
getAglet in interface AgletRefjava.lang.SecurityException - if the current execution is not allowed.
InvalidAgletExceptionprotected AgletContext getAgletContext()
getAgletContext in class AgletStubpublic AgletInfo getAgletInfo()
getAgletInfo in interface AgletRefgetAgletInfo in class AgletStubstatic LocalAgletRef getAgletRef(Name name)
public java.security.cert.Certificate getCertificate()
throws InvalidAgletException
InvalidAgletExceptionprotected MessageManager getMessageManager()
AgletStub
getMessageManager in class AgletStubaglet.MessageManagerpublic Name getName()
private java.lang.String getPersistenceKey()
protected java.security.PermissionCollection getProtections()
getProtections in class AgletStubpublic Ref getRef(VirtualRef vref)
getRef in interface Refpublic java.lang.String getRefClassName()
getRefClassName in interface Refboolean getSecurity()
java.lang.String getStateAsString()
public java.lang.String getText()
getText in class AgletStubvoid invalidateReference()
public boolean isActive()
isActive in interface AgletRefpublic boolean isRemote()
isRemote in interface AgletRefpublic boolean isState(int s)
isState in interface AgletRefpublic boolean isValid()
isValid in interface AgletRefprotected void kill()
public void referenced()
referenced in interface Refvoid releaseResource()
private static void removeAgletRef(Name name,
LocalAgletRef ref)
void removeSnapshot()
public void resume()
throws AgletNotFoundException,
InvalidAgletException,
ShuttingDownException
AgletRef
resume in interface AgletRefAgletNotFoundException
InvalidAgletException
ShuttingDownExceptionvoid resumeMessageManager()
byte[] retract()
throws MAFExtendedException
MAFExtendedException
public FutureReply sendFutureMessage(Message msg)
throws InvalidAgletException
AgletRef
sendFutureMessage in interface AgletRefmsg - the message to send
InvalidAgletException
void sendFutureMessage(Message msg,
FutureReplyImpl future)
throws InvalidAgletException
InvalidAgletException
public java.lang.Object sendMessage(Message msg)
throws MessageException,
InvalidAgletException,
NotHandledException
AgletRef
sendMessage in interface AgletRefmsg - the message to send
MessageException
InvalidAgletException
NotHandledException
public void sendOnewayMessage(Message msg)
throws InvalidAgletException
AgletRef
sendOnewayMessage in interface AgletRefmsg - the message to send
InvalidAgletExceptionprotected void setAglet(Aglet a)
setAglet in class AgletStubvoid setMessageManager(MessageManagerImpl impl)
void setName(Name n)
protected void setProtections(java.security.PermissionCollection newprotections)
setProtections in class AgletStubnewprotections - collection of protections about who can send
what kind of messages to the aglet
public void setRef(VirtualRef vref,
java.io.ObjectInputStream s)
throws java.io.IOException,
java.lang.ClassNotFoundException
setRef in interface Refjava.io.IOException
java.lang.ClassNotFoundExceptionvoid setSecurity(boolean secure)
protected void setText(java.lang.String text)
setText in class AgletStubtext -
protected void snapshot()
throws java.io.IOException
snapshot in class AgletStubjava.io.IOException
void startActivatedAglet()
throws InvalidAgletException
AgletException - if the activation fails.
InvalidAgletExceptionAglet#onActivation
void startArrivedAglet(AgletContextImpl cxt,
java.lang.String sender)
throws InvalidAgletException
cxt - the aglet context in which the aglet activatedsender - url of the departure
AgletException - if the activation fails.
InvalidAgletExceptionAglet#onArrival
void startClonedAglet(AgletContextImpl cxt,
AgletProxyImpl parent)
throws InvalidAgletException
cxt - the aglet context in which the aglet activatedparent - proxy to the original aglet
AgletException - if the activation fails.
InvalidAgletExceptionAglet#onClone
void startCreatedAglet(AgletContextImpl cxt,
java.lang.Object init)
throws InvalidAgletException
cxt - the aglet context in which the aglet activatedinit - argumetns to be used in onCreation method.
InvalidAgletException - if the aglet is invalid.Aglet.onCreation(java.lang.Object)void startMessageManager()
void startResumedAglet()
throws InvalidAgletException
AgletException - if the activation fails.
InvalidAgletExceptionAglet#onActivationprotected void subscribeMessage(java.lang.String kind)
subscribeMessage in class AgletStub
protected void suspend(long duration)
throws InvalidAgletException
suspend in class AgletStubduration - the duration to sleep in milliseconds.
InvalidAgletEception - if can not suspend the aglet.
InvalidAgletException
void suspend(MessageImpl msg,
long duaration)
throws InvalidAgletException,
RequestRefusedException
InvalidAgletException
RequestRefusedException
void suspendForRetraction(Ticket ticket)
throws InvalidAgletException
InvalidAgletExceptionvoid suspendMessageManager()
void terminateThreads()
static java.lang.String toMessage(java.lang.Exception ex)
public java.lang.String toString()
public void unreferenced()
unreferenced in interface Refprotected void unsubscribeAllMessages()
unsubscribeAllMessages in class AgletStubprotected boolean unsubscribeMessage(java.lang.String kind)
unsubscribeMessage in class AgletStub
void validate(AgletContextImpl context,
int state)
throws InvalidAgletException
InvalidAgletException
private void writeDeactivatedAglet(java.io.ObjectOutputStream out,
DeactivationInfo dinfo)
throws java.io.IOException
java.io.IOException
public void writeInfo(java.io.ObjectOutputStream s)
throws java.io.IOException
writeInfo in interface Refjava.io.IOException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||