Spec-Zone .ru
спецификации, руководства, описания, API
JavaTM 2 Platform
Standard Edition

java.security
Class ProtectionDomain

java.lang.Object
  |
  +--java.security.ProtectionDomain

public class ProtectionDomain
extends Object

This ProtectionDomain class encapulates the characteristics of a domain, which encloses a set of classes whose instances are granted the same set of permissions.

In addition to a set of permissions, a domain is comprised of a CodeSource, which is a set of PublicKeys together with a codebase (in the form of a URL). Thus, classes signed by the same keys and from the same URL are placed in the same domain. Classes that have the same permissions but are from different code sources belong to different domains.

A class belongs to one and only one ProtectionDomain.


Constructor Summary
ProtectionDomain(CodeSource codesource, PermissionCollection permissions)
          Creates a new ProtectionDomain with the given CodeSource and Permissions.
 
Method Summary
 CodeSource getCodeSource()
          Returns the CodeSource of this domain.
 PermissionCollection getPermissions()
          Returns the permissions of this domain.
 boolean implies(Permission permission)
          Check and see if this ProtectionDomain implies the permissions expressed in the Permission object.
 String toString()
          Convert a ProtectionDomain to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProtectionDomain

public ProtectionDomain(CodeSource codesource,
                        PermissionCollection permissions)
Creates a new ProtectionDomain with the given CodeSource and Permissions. If the permissions object is not null, then setReadOnly() will be called on the passed in Permissions object.
Parameters:
codesource - the codesource associated with this domain
permissions - the permissions granted to this domain
Method Detail

getCodeSource

public final CodeSource getCodeSource()
Returns the CodeSource of this domain.
Returns:
the CodeSource of this domain.

getPermissions

public final PermissionCollection getPermissions()
Returns the permissions of this domain.
Returns:
the permissions of this domain.

implies

public boolean implies(Permission permission)
Check and see if this ProtectionDomain implies the permissions expressed in the Permission object.
Parameters:
permission - the Permission object to check.
Returns:
true if "permission" is a proper subset of a permission in this ProtectionDomain, false if not.

toString

public String toString()
Convert a ProtectionDomain to a String.
Overrides:
toString in class Object
Tags copied from class: Object
Returns:
a string representation of the object.

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.