|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Interface to the Place User Driver. This interface collects methods needed by all Place Users. When developing agents, user adapters, or services, the interface from the respective package must be used. The driver will be made accessible to the Place User before it is invoked. The driver interface decouples the Place User from the kernel. The Place User may not gain direct access to internal components. All kernel functionality is only accessible via this driver interface.
| Method Summary | |
void |
addPUType(AMETASType type)
Adds a new type description at runtime. |
AMETASType |
createTypeForString(java.lang.String sString)
Creates a runtime representation of the type description. |
AMETASType |
createTypeForString(java.lang.String sString,
java.lang.String sMode)
Creates a runtime representation of the type description. |
byte |
deleteMessage(AMETASMessageID mid)
Removes a message from the PostOffice. |
byte |
depositMessage(AMETASMessage mesNewMessage)
Deposits a message in the PostOffice. |
byte |
depositMessage(AMETASPlaceUserID idReceiver,
java.lang.Object[] aBody)
Deposits a message in the PostOffice. |
byte |
depositRemoteMessage(AMETASMessage mesNewMessage,
java.lang.String sDestPlaceName)
Deprecated. Use messenger agents for remote message delivery. |
boolean |
fullPrivileges()
Determines whether the Place User received all privileges. |
java.lang.Class |
getClass(java.lang.String sClassName)
Deprecated. This method does not do more than Class.forName(String) can do as well. |
java.lang.String |
getDestinationPlace(AMETASMediationResult descr)
Delivers the place where a mediated agent departed to. |
java.lang.String |
getDestinationPlace(AMETASPlaceUserID puid)
Delivers the place where a mediated agent departed to. |
byte[] |
getFile(java.lang.String sFileName)
Allows the Place User to load an included file. |
java.lang.String |
getHostName()
Returns the fully qualified host name of this place. |
long |
getLeavingTime(AMETASMediationResult descr)
Returns the time since a given Place User left the place. |
long |
getLeavingTime(AMETASPlaceUserID puid)
Returns the time since a given Place User left the place. |
MediatorInfo |
getMediatorInfo()
Returns information about the mediator. |
AMETASMessage[] |
getMessages(boolean bDeleteIfPossible)
Retrieves all messages from the PostOffice which are relevant for this PlaceUser. |
AMETASMessage[] |
getMessages(boolean bDeleteIfPossible,
AMETASMessageMask mesm)
Retrieves all messages relevant for this PlaceUser and matching the given message mask. |
java.util.Vector |
getMessagesAsVector(boolean bDeleteIfPossible)
Retrieves all messages relevant for this PlaceUser as a vector. |
java.util.Vector |
getMessagesAsVector(boolean bDeleteIfPossible,
AMETASMessageMask mesm)
Retrieves all messages relevant for this PlaceUser and matching the given mask as a vector. |
AMETASPermissionList |
getPermissionList(AMETASPrivilegeList prl)
Returns the list of permissions of a given privilege list. |
java.lang.String |
getPlaceName()
Delivers the name of the place where this Place User currently resides. |
AMETASPlaceUserID |
getPlaceUserID()
Returns the Place User ID of this Place User. |
AMETASPrivilegeList |
getPrivileges()
Returns the privileges which were delegated to this Place User. |
AMETASType[] |
getPUTypes()
Returns the types of this Place User. |
AMETASSecurityFeature |
getSecurityFeature()
Retrieves the security features. |
AMETASIdentityID |
getStarterID(AMETASMediationResult mrs)
Returns the starter of the given Place User. |
AMETASType[] |
getTypesOf(AMETASPlaceUserID puid)
Returns the set of types of some running Place User. |
AMETASType[] |
getTypesOf(java.lang.String sRegistered)
Returns the types of the some registered Place User. |
boolean |
idle(long nMillis)
Allows the driver to sleep for some time. |
void |
killPlaceUser(AMETASPlaceUserID puid,
long nValidity)
Attempts to stop a Place User. |
void |
output(java.lang.String sText)
Outputs a string message to the place log. |
boolean |
privilegeGranted(java.lang.String sPrivilegeName)
Determines whether the Place User got the given privilege. |
void |
registerEventListener(int nEventID,
int nOptions,
java.lang.Object[] objArgs)
Registers the Place User for incoming events. |
void |
registerEventListener(int nEventID,
java.lang.Object[] objArgs)
Registers the Place User for incoming events. |
void |
registerEventListener(int nEventID,
short nMinPriority,
int nOptions,
java.lang.Object[] objArgs)
Registers the Place User for incoming events. |
AMETASMessageMask |
registerServiceResponseListener(AMETASPlaceUserID idService)
Convenience method to simplify event registration. |
AMETASMediationResult[] |
request(AMETASMediationRequest req)
Sends a request to the local mediator. |
AMETASMediationResult[] |
request(AMETASMediationRequest req,
AMETASPlaceUserIDMask puidm,
AMETASIdentityID iid)
Sends a request to the local mediator. |
AMETASPlaceUserID |
requestPUStartup(AMETASMediationResult mrs,
AMETASMessage msgInit)
Requests the place to start a Place User. |
AMETASPlaceUserID |
requestPUStartup(java.lang.String sSPUName,
AMETASMessage msgInit)
Requests the place to start a Place User. |
void |
requestService_WaitAndUnregister(AMETASPlaceUserID idService,
java.lang.Object[] aobjParams,
AMETASMessageMask mesmServiceResponse,
long nWaitTime)
Convenience method for service access. |
void |
requestService_WaitAndUnregister(AMETASPlaceUserID idService,
java.util.Vector vctParams,
AMETASMessageMask mesmServiceResponse,
long nWaitTime)
Deprecated. Use the Object[] version of this method. |
boolean |
setSecurityFeature(AMETASSecurityFeature sf)
Defines the security features for this Place User. |
AMETASPlaceUserID |
spawnAgent(java.lang.String sSubAgent,
AMETASMessage msgInit)
Starts a contained Place User. |
boolean |
stillPresent(AMETASMediationResult descr)
Determines whether a given Place User is still running at this place. |
boolean |
stillPresent(AMETASPlaceUserID puid)
Determines whether a given Place User is still running at this place. |
void |
stopDriver()
Deprecated. This method uses the deprecated Thread.stop method. The Place User should terminate by letting all threads halt and leaving the invoke method. |
void |
stopPlace()
Stops the place where this Place User is currently running. |
boolean |
suitableForMediator(AMETASType type)
Deterines whether the local mediator may process the given type. |
void |
trace(java.lang.String sText)
Used to output debug messages. |
boolean |
unknownPrivileges()
Determines whether this Place User requested unknown privileges. |
void |
unregisterEventListener(int nEventID,
java.lang.Object[] objArgs)
Unregisters the Place User for the specified event. |
void |
updateRegistration()
Causes a new type registration for this Place User. |
void |
useRequestedService(AMETASPlaceUserID idService,
java.lang.Object[] aobjParams,
long nWaitTime)
Convenience method for service access. |
void |
useRequestedService(AMETASPlaceUserID idService,
java.util.Vector vctParams,
long nWaitTime)
Deprecated. Use the Object[] version |
void |
wakeup()
Wakes up the driver. |
| Method Detail |
public byte depositMessage(AMETASPlaceUserID idReceiver,
java.lang.Object[] aBody)
idReceiver - ID of the recipient.aBody - Payload of the message.
AMETASErrors.OK,
if the message was deposited correctly, else an error code.public byte depositMessage(AMETASMessage mesNewMessage)
mesNewMessage - Message to be deposited.
AMETASErrors.OK,
if the message was deposited correctly, else an error code.
public byte depositRemoteMessage(AMETASMessage mesNewMessage,
java.lang.String sDestPlaceName)
mesNewMessage - Message to be deposited remotely.sDestPlaceName - Destination place.
AMETASErrors.OK,
if the message was deposited successfully;
AMETASErrors.NOT_FOUND,
if the remote place is unknown;
AMETASErrors.NOT_ENOUGH_ACCOUNT,
if the sender runs out of account;
AMETASErrors.ACCESS_DENIED,
if the remote depositing is not allowed for this sender.public AMETASMessage[] getMessages(boolean bDeleteIfPossible)
bDeleteIfPossible - if true, messages may be deleted after
retrieving.
public AMETASMessage[] getMessages(boolean bDeleteIfPossible,
AMETASMessageMask mesm)
bDeleteIfPossible - if true, messages may be deleted after
retrieving.mesm - Mask to filter uninteresting messages.
public java.util.Vector getMessagesAsVector(boolean bDeleteIfPossible)
bDeleteIfPossible - if true, messages may be deleted after
retrieving.
public java.util.Vector getMessagesAsVector(boolean bDeleteIfPossible,
AMETASMessageMask mesm)
bDeleteIfPossible - if true, messages may be deleted after
retrieving.mesm - Mask to filter uninteresting messages.
public byte deleteMessage(AMETASMessageID mid)
mid - ID of the message to be removed.
AMETASErrors.OK if successful;
AMETASErrors.ACCESS_DENIED
if the Place User must not remove this message.
AMETASErrors.NOT_FOUND if there is no message
with the given ID.public java.lang.String getPlaceName()
public java.lang.String getHostName()
public AMETASPlaceUserID requestPUStartup(java.lang.String sSPUName,
AMETASMessage msgInit)
throws CreationFailedException,
CreationDeniedException
sSPUName - SPU name (including version name)msgInit - Message to be sent to the newly created Place User instance for initialization.
CreationFailedException - if the startup failed (e.g. invalid SPU container).
CreationDeniedException - if the requestor does not have enough privileges.
public AMETASPlaceUserID requestPUStartup(AMETASMediationResult mrs,
AMETASMessage msgInit)
throws CreationFailedException,
CreationDeniedException
mrs - Result of a previous mediation request.msgInit - Message to be sent to the newly created Place User instance for initialization.
CreationFailedException - if the startup failed (e.g. invalid SPU container).
CreationDeniedException - if the requestor does not have enough privileges.
public AMETASPlaceUserID spawnAgent(java.lang.String sSubAgent,
AMETASMessage msgInit)
throws CreationFailedException,
CreationDeniedException
sSubAgent - Agent to be started.msgInit - Optional initialization message.
CreationFailedException - if the startup failed (e.g. invalid SPU container).
CreationDeniedException - if the requestor does not have enough privileges.public void output(java.lang.String sText)
sText - Text to be output.public void trace(java.lang.String sText)
sText - Debug message to be output.public boolean idle(long nMillis)
Thread.suspend.
nMillis - Milliseconds of sleeping.
public void wakeup()
idle.
public void stopDriver()
public void killPlaceUser(AMETASPlaceUserID puid,
long nValidity)
puid - ID of the Place User to be stopped.nValidity - Milliseconds until the stop request will be discarded.
public void stopPlace()
throws AMETASSecurityException
AMETASSecurityException - if the Place User does not have
ADMIN privileges.public AMETASPrivilegeList getPrivileges()
public AMETASPermissionList getPermissionList(AMETASPrivilegeList prl)
prl - Privilege list.
public boolean fullPrivileges()
public boolean unknownPrivileges()
public boolean privilegeGranted(java.lang.String sPrivilegeName)
sPrivilegeName - Name of the privilege.
public boolean setSecurityFeature(AMETASSecurityFeature sf)
sf - Security features.
public AMETASSecurityFeature getSecurityFeature()
public AMETASType[] getTypesOf(AMETASPlaceUserID puid)
puid - PUID of the Place User.
public AMETASType[] getTypesOf(java.lang.String sRegistered)
sRegistered - Registration name of the Place User.
public AMETASType[] getPUTypes()
public void addPUType(AMETASType type)
type - New type.public boolean suitableForMediator(AMETASType type)
type - Type.
public byte[] getFile(java.lang.String sFileName)
throws java.io.FileNotFoundException
sFileName - File name as provided when packing the container.
java.io.FileNotFoundException - if the file was not found.public AMETASMediationResult[] request(AMETASMediationRequest req)
req - Instance or type mediation request. If null, all
currently running Place Users are returned.
public AMETASMediationResult[] request(AMETASMediationRequest req,
AMETASPlaceUserIDMask puidm,
AMETASIdentityID iid)
req - Instance or type mediation request. If null, all
currently running Place Users are returned.puidm - Mask which is used to filter the results.iid - Identity used to filter away all results which belong to
Place Users not started by this ID.
public boolean stillPresent(AMETASMediationResult descr)
descr - Result of a previous mediation.
public boolean stillPresent(AMETASPlaceUserID puid)
puid - Place User ID.
public long getLeavingTime(AMETASMediationResult descr)
throws java.util.NoSuchElementException
descr - Result of a previous mediation.
java.util.NoSuchElementException - if the Place User was terminated or
the agent was absent for a too long time.
public long getLeavingTime(AMETASPlaceUserID puid)
throws java.util.NoSuchElementException
puid - Place User ID.
java.util.NoSuchElementException - if the Place User was terminated or
the agent was absent for a too long time.
public java.lang.String getDestinationPlace(AMETASMediationResult descr)
throws java.util.NoSuchElementException
descr - result of a previous mediation.
java.util.NoSuchElementException - if the Place User was terminated or
the agent was absent for a too long time.
public java.lang.String getDestinationPlace(AMETASPlaceUserID puid)
throws java.util.NoSuchElementException
puid - Place User ID.
java.util.NoSuchElementException - if the Place User was terminated or
the agent was absent for a too long time.public AMETASIdentityID getStarterID(AMETASMediationResult mrs)
mrs - Result of a previous mediation.
public AMETASType createTypeForString(java.lang.String sString,
java.lang.String sMode)
throws TypeException
sString - String representation of the type.sMode - Mediator-dependent mode selection.
TypeException - if the type instance creation failed.
public AMETASType createTypeForString(java.lang.String sString)
throws TypeException
sString - String representation of the type.
TypeException - if the type instance creation failed.public MediatorInfo getMediatorInfo()
public AMETASPlaceUserID getPlaceUserID()
public java.lang.Class getClass(java.lang.String sClassName)
throws java.lang.ClassNotFoundException
newInstance calls. Otherwise, a
ClassNotFoundException is tossed at the caller.
sClassName - Fully qualified name of the class.
java.lang.ClassNotFoundException - if the class was not found.public void updateRegistration()
public AMETASMessageMask registerServiceResponseListener(AMETASPlaceUserID idService)
registerEventListener.
Since version 2.6.0, the message event registration is notify-only, i.e. the Place User must explicitely retrieve the messages after being notified.
idService - ID of a service.
public void requestService_WaitAndUnregister(AMETASPlaceUserID idService,
java.lang.Object[] aobjParams,
AMETASMessageMask mesmServiceResponse,
long nWaitTime)
throws NotRegisteredException,
EventParameterException,
TimeoutException
At first, the
idService and aobjParam parameters are
used to formulate a service REQUEST message. This message is then
submitted.
Then the driver is suspended using idle for the
given wait time.
In the meantime, the reply should arrive via notifyListener.
From there the driver must be waked up using
wakeup. The now reactivated
driver unregisters the Place User using the given mask, and the
method returns. The driver must now retrieve the message if the
message is not contained in the message event. Keep in mind that it
is not recommended to automatically retrieve messages by events.
Try to avoid situations where wakeup calls may be lost; e.g. when using multithreaded Place Users. In this case you should not use this method.
idService - ID of the service to send the message to.aobjParams - Parameters for the service usage. Will become the
body of the request message.mesmServiceResponse - Message mask which was used to
register the Place User as a message listener.nWaitTime - Milliseconds to wait for a reply.
NotRegisteredException - if this Place User has not been
registered as event listener before calling this method.
EventParameterException - if the parameters were invalid.
TimeoutException - if the service did not respond in the given
timeout period.
public void requestService_WaitAndUnregister(AMETASPlaceUserID idService,
java.util.Vector vctParams,
AMETASMessageMask mesmServiceResponse,
long nWaitTime)
throws NotRegisteredException,
EventParameterException,
TimeoutException
requestService_WaitAndUnregister except that it expects the
service parameters as a vector instead of an Object array.
idService - ID of the service to send the message to.vctParams - Parameters for the service usage. Will become the
body of the request message.mesmServiceResponse - Message mask which was used to
register the Place User as a message listener.nWaitTime - Milliseconds to wait for a reply.
NotRegisteredException - if this Place User has not been
registered as event listener before calling this method.
EventParameterException - if the parameters were invalid.
TimeoutException - if the service did not respond in the given
timeout period.
public void useRequestedService(AMETASPlaceUserID idService,
java.lang.Object[] aobjParams,
long nWaitTime)
throws TimeoutException
registerServiceResponseListener
and then a
requestService_WaitAndUnregister.
Since version 2.6.0, the message event registration is notify-only, i.e. the Place User must explicitely retrieve the messages after being notified.
idService - ID of the service to request.aobjParams - Parameters for the service request message.nWaitTime - Timeout for waiting for the service reply.
TimeoutException - if the service did not respond.
public void useRequestedService(AMETASPlaceUserID idService,
java.util.Vector vctParams,
long nWaitTime)
throws TimeoutException
useRequestedService
but takes a vector as parameters.
idService - ID of the service to request.vctParams - Parameters for the service request message.nWaitTime - Timeout for waiting for the service reply.
TimeoutException - if the service did not respond.
public void registerEventListener(int nEventID,
int nOptions,
java.lang.Object[] objArgs)
throws UnauthorizedEventException,
UnknownEventException,
EventParameterException,
DisabledEventException
nEventID - Event ID.objArgs - Event-dependent parameters.
UnauthorizedEventException - if the Place User does not
have the permission for registering to this event.
UnknownEventException - if the event type is unknown.
EventParameterException - if the event parameter is invalid.
DisabledEventException - if the event is disabled.AMETASEvent
public void registerEventListener(int nEventID,
java.lang.Object[] objArgs)
throws UnauthorizedEventException,
UnknownEventException,
EventParameterException,
DisabledEventException
nEventID - Event ID.objArgs - Event-dependent parameters.
UnauthorizedEventException - if the Place User does not
have the permission for registering to this event.
UnknownEventException - if the event type is unknown.
EventParameterException - if the event parameter is invalid.
DisabledEventException - if the event is disabled.AMETASEvent
public void registerEventListener(int nEventID,
short nMinPriority,
int nOptions,
java.lang.Object[] objArgs)
throws UnauthorizedEventException,
UnknownEventException,
EventParameterException,
DisabledEventException
nEventID - Event ID.nMinPriority - Minimum priority for notification.objArgs - Event-dependent parameters.
UnauthorizedEventException - if the Place User does not
have the permission for registering to this event.
UnknownEventException - if the event type is unknown.
EventParameterException - if the event parameter is invalid.
DisabledEventException - if the event is disabled.AMETASEvent
public void unregisterEventListener(int nEventID,
java.lang.Object[] objArgs)
throws NotRegisteredException,
UnknownEventException,
EventParameterException
nEventID - Event ID.objArgs - Event-dependent parameters.
NotRegisteredException - if the Place User was not registered.
UnknownEventException - if the event type is unknown.
EventParameterException - if the parameters are invalid.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||