⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jbacls.java

📁 OPIAM stands for Open Identity and Access Management. This Suite will provide modules for user & rig
💻 JAVA
字号:
/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.config.javabeans;

import opiam.admin.faare.service.services.acl.AclPluginInterface;

import org.apache.log4j.Logger;

import java.io.Serializable;

import java.util.HashMap;
import java.util.Map;


/**
 *
 * This object conveys ACLs defined in acl_conf.xml.
 *
 */
public class JBAcls implements Serializable
{
    /** Instance of logger. */
    private static Logger _logger = Logger.getLogger(JBAcls.class);

    /** ACLs table. */
    private Map aclsMap = new HashMap();

    /** ACLs Plugin class name. */
    private String classname;

    /** ACLs Plugin class. */
    private AclPluginInterface plugin;

    /**
     * Adds one ACL.
     *
     * @param jbAcl ACL to add
     */
    public void addAcl(JBAcl jbAcl)
    {
        String key = null;

        aclsMap.put(jbAcl.getTargetname().trim().toLowerCase(), jbAcl);
    }

    /**
     * Returns the ACLs table.
     * @return Map containing the ACLs.
     */
    public Map getAclsMap()
    {
        return aclsMap;
    }

    /**
     * Returns the ACLs plugin class name.
     * @return ACLs plugin class name.
     */
    public String getClassname()
    {
        return classname;
    }

    /**
     * Sets the ACLs plugin class name.
     * @param aclassname The ACLs plugin class name to set.
     */
    public void setClassname(String aclassname)
    {
        this.classname = aclassname;

        // instancie un objet the ce plugin
        try
        {
            Class cl = Class.forName(classname);
            plugin = (AclPluginInterface) cl.newInstance();
        }
        catch (Exception ex)
        {
            _logger.error("pb dans setClassname");
            throw new RuntimeException("pb dans setClassname");
        }
    }

    /**
     * Displays the ACLs.
     *
     * @return String formatted ACLs.
     */
    public String toString()
    {
        StringBuffer buf = new StringBuffer();
        java.util.Iterator it = null;

        buf.append("classname = ");
        buf.append(classname);
        buf.append(System.getProperty("line.separator"));

        if (aclsMap != null)
        {
            buf.append("Map components of aclsMap = ");
            buf.append(System.getProperty("line.separator"));
            it = aclsMap.keySet().iterator();

            Object key;

            while (it.hasNext())
            {
                buf.append("...");
                key = it.next();
                buf.append(key);
                buf.append(" = ");
                buf.append(aclsMap.get(key));
                buf.append(System.getProperty("line.separator"));
            }
        }

        return buf.toString();
    }

    // end of toString method

    /**
     * Returns the ACL plugin class.
     * @return class implemnting AclPluginInterface
     */
    public AclPluginInterface getPlugin()
    {
        return plugin;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -