分享
 
 
 

java.security.Permission翻译

王朝java/jsp·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

[/url] [url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview

Package

Class

Use

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Std. Ed. v1.4.2

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

java.security

Class Permissionjava.lang.Object

java.security.Permission

All Implemented Interfaces: Guard, Serializable Direct Known Subclasses: AllPermission, BasicPermission, FilePermission, PrivateCredentialPermission, ServicePermission, SocketPermission, UnresolvedPermission public abstract class Permission extends Object implements Guard, SerializableAbstract class for representing access to a system resource. All permissions have a name (whose interpretation depends on the subclass), as well as abstract functions for defining the semantics of the particular Permission subclass. 表示访问系统资源的抽象类。所有许可都有一个名称(解释依赖于子类)和用于定义特定的Permission子类语义的抽象函数。

Most Permission objects also include an "actions" list that tells the actions that are permitted for the object. For example, for a java.io.FilePermission object, the permission name is the pathname of a file (or directory), and the actions list (such as "read, write") specifies which actions are granted for the specified file (or for files in the specified directory). The actions list is optional for Permission objects, such as java.lang.RuntimePermission, that don't need such a list; you either have the named permission (such as "system.exit") or you don't. 大多数Permission对象还包括一个对象许可动作的列表。例如,java.io.FilePermission对象, 许可名是文件或目录的路径名,动作列表(如“读,写”)指定授权给指定文件(或指定目录的文件)的动作。 动作列表是Permission对象的可选项,比如java.lang.RuntimePermission不需要那样的列表, 你可以有命名的许可(如“system.exit”),也可以没有。

An important method that must be implemented by each subclass is the implies method to compare Permissions. Basically, "permission p1 implies permission p2" means that if one is granted permission p1, one is naturally granted permission p2. Thus, this is not an equality test, but rather more of a subset test. 每一个子类必须实现一个重要方法implies来比较Permissions。 基本上,“许可p1包含许可p2”意味着如果有一个被授予了许可p1,则自然也被授予许可p2。 因此,这并不是一个相等性测试,而是子集测试。

Permission objects are similar to String objects in that they are immutable once they have been created. Subclasses should not provide methods that can change the state of a permission once it has been created. Permission一旦被创建,将不能改变,这一点和String对象类似。子类不应该提供 一旦许可被创建后改变其状态的方法。

See Also: Permissions, PermissionCollection, Serialized FormConstructor Summary

Permission(String name)

Constructs a permission with the specified name. 构建指定名称的许可。

Method Summary

void

checkGuard(Object object)

Implements the guard interface for a permission. 实现许可的guard接口。

abstract boolean

equals(Object obj)

Checks two Permission objects for equality.检查两个Permission对象是否相等。

abstract String

getActions()

Returns the actions as a String.将动作以字符串形式返回。

String

getName()

Returns the name of this Permission.返回该Permission的名称。

abstract int

hashCode()

Returns the hash code value for this Permission object. 返回该Permission对象的hash码值。

abstract boolean

implies(Permission permission)

Checks if the specified permission's actions are "implied by" this object's actions.检查指定许可的动作是否包含于当前对象的动作。

PermissionCollection

newPermissionCollection()

Returns an empty PermissionCollection for a given Permission object, or null if one is not defined. 返回给定的Permission对象的空PermissionCollection,如果未定义,返回null。

String

toString()

Returns a string describing this Permission.返回描述该Permission的字符串。

Methods inherited from class java.lang.Object

clone, finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail

Permissionpublic Permission(String name)

Constructs a permission with the specified name. 构建指定名称的许可。

Parameters: name - name of the Permission object being created. 要创建的Permission对象名称。Method Detail

checkGuardpublic void checkGuard(Object object)

throws SecurityException

Implements the guard interface for a permission. The SecurityManager.checkPermission method is called, passing this permission object as the permission to check. Returns silently if access is granted. Otherwise, throws a SecurityException. 实现许可的guard接口。方法调用SecurityManager.checkPermission方法, 并以当前许可对象作为要检查的许可。如果访问被许可,正常返回,否则抛出SecurityException。

Specified by: checkGuard in interface GuardParameters: object - the object being guarded (currently ignored). 要保护的对象(目前忽略)。 Throws: SecurityException - if a security manager exists and its checkPermission method doesn't allow access. 如果安全管理器存在,它的checkPermission方法不允许访问时抛出。 See Also: Guard, GuardedObject, SecurityManager.checkPermission(java.security.Permission)impliespublic abstract boolean implies(Permission permission)

Checks if the specified permission's actions are "implied by" this object's actions. 检查指定许可的动作是否包含于当前对象的动作。 This must be implemented by subclasses of Permission, as they are the only ones that can impose semantics on a Permission object. Permission的子类必须实现该方法,因为它是唯一的可以将语义强加于Permission对象之上的方法。

The implies method is used by the AccessController to determine whether or not a requested permission is implied by another permission that is known to be valid in the current execution context. implies方法由AccessController使用以确认被请求的许可是否被另一个许可包含, 该许可已知在当前执行的上下文中有效。

Parameters: permission - the permission to check against. 要检查的许可。 Returns: true if the specified permission is implied by this object, false if not. 如果指定的许可包含于当前对象,返回true,否则为false。equalspublic abstract boolean equals(Object obj)

Checks two Permission objects for equality. 检查两个Permission对象是否相等。 Do not use the equals method for making access control decisions; use the implies method. 在访问控制决策时不要使用equals方法,而应使用implies方法。

Overrides: equals in class ObjectParameters: obj - the object we are testing for equality with this object. 和当前对象测试相等性的对象。 Returns: true if both Permission objects are equivalent. 如果Permission对象相等,返回true。 See Also: Object.hashCode(), HashtablehashCodepublic abstract int hashCode()

Returns the hash code value for this Permission object. 返回该Permission对象的hash码值。 The required hashCode behavior for Permission Objects is the following: Permission对象的hashCode行为要求如下:

Whenever it is invoked on the same Permission object more than once during an execution of a Java application, the hashCode method must consistently return the same integer. This integer need not remain consistent from one execution of an application to another execution of the same application. 对同一个Permission对象而言,无论它在一个Java应用的一次执行过程中调用hashCode方法多少次, 它总是返回相同的整数。对于同一应用的不同执行过程中,返回值不必保持一致。

If two Permission objects are equal according to the equals method, then calling the hashCode method on each of the two Permission objects must produce the same integer result. 如果两个Permission根据equals方法相等,那么每一个Permission对象调用hashCode方法都应生成相同的整数结果。

Overrides: hashCode in class ObjectReturns: a hash code value for this object. 当前对象的hash码值。 See Also: Object.equals(java.lang.Object), HashtablegetNamepublic final String getName()

Returns the name of this Permission. For example, in the case of a java.io.FilePermission, the name will be a pathname. 返回该Permission的名称。比如java.io.FilePermission的名称为路径名。

Returns: the name of this Permission. 该Permission的名称。getActionspublic abstract String getActions()

Returns the actions as a String. This is abstract so subclasses can defer creating a String representation until one is needed. Subclasses should always return actions in what they consider to be their canonical form. For example, two FilePermission objects created via the following: 将动作以字符串形式返回。这是一个抽象方法,子类可以延迟到需要字符串形式时才创建。 子类应返回动作的规范形式。比如,以下创建了两个FilePermission对象: perm1 = new FilePermission(p1,"read,write");

perm2 = new FilePermission(p2,"write,read");

both return "read,write" when the getActions method is invoked. 当调用getActions方法时,均返回“read,write”。

Returns: the actions of this Permission. Permission的动作。newPermissionCollectionpublic PermissionCollection newPermissionCollection()

Returns an empty PermissionCollection for a given Permission object, or null if one is not defined. Subclasses of class Permission should override this if they need to store their permissions in a particular PermissionCollection object in order to provide the correct semantics when the PermissionCollection.implies method is called. If null is returned, then the caller of this method is free to store permissions of this type in any PermissionCollection they choose (one that uses a Hashtable, one that uses a Vector, etc). 返回给定的Permission对象的空PermissionCollection,如果未定义,返回null。 如果Permission类的子类需要在特定的PermissionCollection对象中保存许可以在 PermissionCollection.implies调用时提供正确的语义,应当重载该方法。 如果返回null,那么方法的调用者将会将这种类型的许可随意保存在选择的任意 PermissionCollection中(有可能使用Hashtable,也有可能使用Vector)。

Returns: a new PermissionCollection object for this type of Permission, or null if one is not defined. 当前类型的Permission对象的空PermissionCollection,如果未定义,返回null。toStringpublic String toString()

Returns a string describing this Permission. The convention is to specify the class name, the permission name, and the actions in the following format: '("ClassName" "name" "actions")'. 返回描述该Permission的字符串。按惯例,遵循以下格式:("类名" "名称" "动作")。

Overrides: toString in class ObjectReturns: information about this Permission. 关于Permission的信息。[/url][url=file:///F:/资料/文字资料/j2sdk-1_4_2-doc/docs/api/overview-summary.html]Overview

Package

Class

Use

Tree

Deprecated

Index

Help

JavaTM 2 Platform

Std. Ed. v1.4.2

PREV CLASS NEXT CLASS

FRAMES NO FRAMES All Classes

SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature

For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. Copyright 2003 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有