|
MIDP3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.security.Permission
javax.microedition.event.EventPermission
public final class EventPermission
EventPermission
allows access to system events.
An EventPermission
objects contains a name (also referred
to as a "target name") and actions.
The target name is the name of the event ("BATTERY_LEVEL", "com.MyCompany.MyEvent", etc). The naming convention follows the hierarchical property naming convention and are explained in the package description. An asterisk MAY appear at the end of the event name, following a ".", or by itself, to signify a wildcard match. For example: "com.MyCompany.*" or "*" is valid, but "*MyCompany" or "a*b" is not valid.
The actions to be granted are passed to the constructor in a String
containing a list of one or more comma-separated keywords. The possible
keywords are "post", "read" and "register". Their meaning is defined as
follows:
post |
Permission to post an event. Allows the
EventManager.post method to post an event. |
read |
Permission to read an event. Allows the
EventManager.getCurrent
method return the current event. |
register |
Permission to register applications to launch
in response to events. Allows the
EventManager.registerApplication()
method to register for the named event. |
Care should be taken before granting application permission to access certain events. For example, granting permission to post events could allow a badly behaving application to interfere with the operation of the device.
Constructor Summary | |
---|---|
EventPermission(java.lang.String event,
java.lang.String actions)
Creates a new EventPermission object with the specified
name and actions. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object object)
Checks if another object is "equal" to this one. |
java.lang.String |
getActions()
Gets the canonical string representing the actions. |
int |
hashCode()
Gets the hash code value for this object. |
boolean |
implies(java.security.Permission p)
Checks if the specified permission is "implied" by this object. |
Methods inherited from class java.security.Permission |
---|
getName, newPermissionCollection, toString |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EventPermission(java.lang.String event, java.lang.String actions)
EventPermission
object with the specified
name and actions.
event
- The name of the event for which to grant permission.actions
- Valid actions are "post", "read" and "register".
java.lang.NullPointerException
- if event
or actions
is
null
.
java.lang.IllegalArgumentException
- if actions
is
empty or includes any string other than those allowed.EventManager
Method Detail |
---|
public boolean implies(java.security.Permission p)
true
if:
implies
in class java.security.Permission
p
- the permission to check against.
true
if the passed permission is equal to or
implied by this permission, false
otherwise.public java.lang.String getActions()
EventPermission
object allows both
post and read actions, a call to getActions
will return
the string "post,read".
getActions
in class java.security.Permission
public int hashCode()
hashCode
in class java.security.Permission
public boolean equals(java.lang.Object object)
equals
in class java.security.Permission
object
- an object to compare
true
if the objects are of the same type
and the event and action are equal.
|
MIDP3.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |