当前位置: 首页>>代码示例>>Java>>正文


Java AclEntry.addPermission方法代码示例

本文整理汇总了Java中java.security.acl.AclEntry.addPermission方法的典型用法代码示例。如果您正苦于以下问题:Java AclEntry.addPermission方法的具体用法?Java AclEntry.addPermission怎么用?Java AclEntry.addPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.acl.AclEntry的用法示例。


在下文中一共展示了AclEntry.addPermission方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SnmpAcl

import java.security.acl.AclEntry; //导入方法依赖的package包/类
/**
 * Constructs the Java Dynamic Management(TM) Access Control List
 * based on IP addresses. The ACL will take the given owner name.
 * The current IP address will be the owner of the ACL.
 *
 * @param Owner The name of the ACL Owner.
 * @param aclFileName The name of the ACL File.
 *
 * @exception UnknownHostException If the local host is unknown.
 * @exception IllegalArgumentException If the ACL file doesn't exist.
 */
public SnmpAcl(String Owner, String aclFileName)
    throws UnknownHostException, IllegalArgumentException {
    trapDestList= new Hashtable<InetAddress, Vector<String>>();
    informDestList= new Hashtable<InetAddress, Vector<String>>();

    // PrincipalImpl() take the current host as entry
    owner = new PrincipalImpl();
    try {
        acl = new AclImpl(owner,Owner);
        AclEntry ownEntry = new AclEntryImpl(owner);
        ownEntry.addPermission(READ);
        ownEntry.addPermission(WRITE);
        acl.addEntry(owner,ownEntry);
    } catch (NotOwnerException ex) {
        if (SNMP_LOGGER.isLoggable(Level.FINEST)) {
            SNMP_LOGGER.logp(Level.FINEST, SnmpAcl.class.getName(),
                "SnmpAcl(String,String)",
                "Should never get NotOwnerException as the owner " +
                "is built in this constructor");
        }
    }
    if (aclFileName == null) setDefaultFileName();
    else setAuthorizedListFile(aclFileName);
    readAuthorizedListFile();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:SnmpAcl.java

示例2: rereadTheFile

import java.security.acl.AclEntry; //导入方法依赖的package包/类
/**
 * Resets this ACL to the values contained in the configuration file.
 *
 * @exception NotOwnerException If the principal attempting the reset is not an owner of this ACL.
 * @exception UnknownHostException If IP addresses for hosts contained in the ACL file couldn't be found.
 */
public void rereadTheFile() throws NotOwnerException, UnknownHostException {
    alwaysAuthorized = false;
    acl.removeAll(owner);
    trapDestList.clear();
    informDestList.clear();
    AclEntry ownEntry = new AclEntryImpl(owner);
    ownEntry.addPermission(READ);
    ownEntry.addPermission(WRITE);
    acl.addEntry(owner,ownEntry);
    readAuthorizedListFile();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:SnmpAcl.java


注:本文中的java.security.acl.AclEntry.addPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。