类 ServicePermission
- java.lang.Object
-
- java.security.Permission
-
- java.security.BasicPermission
-
- org.osgi.framework.ServicePermission
-
- 所有已实现的接口:
java.io.Serializable,java.security.Guard
public final class ServicePermission extends java.security.BasicPermissionA bundle's authority to register or get a service.- The
registeraction allows a bundle to register a service on the specified names. - The
getaction allows a bundle to detect a service and get it.
ServicePermissionto get the specific service.- 作者:
- $Id: ff7fc46dd623c0a09b49965048dd6faa2b111b39 $
- 另请参阅:
- 序列化表格
-
-
构造器概要
构造器 构造器 说明 ServicePermission(java.lang.String name, java.lang.String actions)Create a new ServicePermission.ServicePermission(ServiceReference<?> reference, java.lang.String actions)Creates a new requestedServicePermissionobject to be used by code that must performcheckPermissionfor thegetaction.
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 booleanequals(java.lang.Object obj)Determines the equality of two ServicePermission objects.java.lang.StringgetActions()Returns the canonical string representation of the actions.inthashCode()Returns the hash code value for this object.booleanimplies(java.security.Permission p)Determines if aServicePermissionobject "implies" the specified permission.java.security.PermissionCollectionnewPermissionCollection()Returns a newPermissionCollectionobject for storingServicePermissionobjects.
-
-
-
构造器详细资料
-
ServicePermission
public ServicePermission(java.lang.String name, java.lang.String actions)Create a new ServicePermission.The name of the service is specified as a fully qualified class name. Wildcards may be used.
name ::= <class name> | <class name ending in ".*"> | *
Examples:org.osgi.service.http.HttpService org.osgi.service.http.* *
For thegetaction, the name can also be a filter expression. The filter gives access to the service properties as well as the following attributes:- signer - A Distinguished Name chain used to sign the bundle publishing the service. Wildcards in a DN are not matched according to the filter string rules, but according to the rules defined for a DN chain.
- location - The location of the bundle publishing the service.
- id - The bundle ID of the bundle publishing the service.
- name - The symbolic name of the bundle publishing the service.
There are two possible actions:
getandregister. Thegetpermission allows the owner of this permission to obtain a service with this name. Theregisterpermission allows the bundle to register a service under that name.- 参数:
name- The service class nameactions-get,register(canonical order)- 抛出:
java.lang.IllegalArgumentException- If the specified name is a filter expression and either the specified action is notgetor the filter has an invalid syntax.
-
ServicePermission
public ServicePermission(ServiceReference<?> reference, java.lang.String actions)
Creates a new requestedServicePermissionobject to be used by code that must performcheckPermissionfor thegetaction.ServicePermissionobjects created with this constructor cannot be added to aServicePermissionpermission collection.- 参数:
reference- The requested service.actions- The actionget.- 抛出:
java.lang.IllegalArgumentException- If the specified action is notgetor reference isnull.- 从以下版本开始:
- 1.5
-
-
方法详细资料
-
implies
public boolean implies(java.security.Permission p)
Determines if aServicePermissionobject "implies" the specified permission.- 覆盖:
implies在类中java.security.BasicPermission- 参数:
p- The target permission to check.- 返回:
trueif the specified permission is implied by this object;falseotherwise.
-
getActions
public java.lang.String getActions()
Returns the canonical string representation of the actions. Always returns present actions in the following order:get,register.- 覆盖:
getActions在类中java.security.BasicPermission- 返回:
- The canonical string representation of the actions.
-
newPermissionCollection
public java.security.PermissionCollection newPermissionCollection()
Returns a newPermissionCollectionobject for storingServicePermissionobjects.- 覆盖:
newPermissionCollection在类中java.security.BasicPermission- 返回:
- A new
PermissionCollectionobject suitable for storingServicePermissionobjects.
-
equals
public boolean equals(java.lang.Object obj)
Determines the equality of two ServicePermission objects. Checks that specified object has the same class name and action as thisServicePermission.- 覆盖:
equals在类中java.security.BasicPermission- 参数:
obj- The object to test for equality.- 返回:
- true if obj is a
ServicePermission, and has the same class name and actions as thisServicePermissionobject;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code value for this object.- 覆盖:
hashCode在类中java.security.BasicPermission- 返回:
- Hash code value for this object.
-
-