Install&configure the required software for Java admin api

本文介绍如何使用Tivoli访问管理器进行Java应用程序的开发,包括软件安装配置、Java运行时组件配置及Java管理类配置等关键步骤,并提供了一个创建用户和组的应用示例。

To develop Java applications that use the Tivoli Access Manager administration
API, you must install and configure the required software.

I. Tivoli Access Manager software requirements

   You must install and configure secure domain. If you do not have secure domain
    installed, install one before beginning application development. The minimum
    installation consists of a single system with the following Tivoli Access Manager
    components installed:
        1 Tivoli Access Manager runtime environment
        2 Tivoli Access Manager Java runtime component
        3 Tivoli Access Manager policy server
        4 Tivoli Access Manager ADK
    
    If you already have an Tivoli Access Manager secure domain installed and want to
    add a development system to the domain, the minimum Tivoli Access Manager
    installation consists of the following components:
        1 Tivoli Access Manager runtime environment
        2 Tivoli Access Manager Java runtime component
        3 Tivoli Access Manager ADK
        
    Notes.
        1.  The installation of Tivoli Access Manager requires the installation of the Tivoli
                Access Manager runtime component. This runtime component is not required
                for developing or deploying Java applications. In this specific situation, you can
                reclaim the disk space that is used by the Tivoli Access Manager ADK and
                runtime components while saving the Javadoc HTML information and the
                example files from the ADK component.
                To reclaim this disk space, copy the Javadoc information, consisting of the
                entire AM_BASE/nls/javadocs directory tree, and copy the sample Java
                program, in the AM_BASE/example directory tree, to another location on your
                development system and then uninstall the Tivoli Access Manager ADK and
                runtime components.
        2.  If you intend to use the Tivoli Access Manager runtime environment for an
                administration C API application, you also must install the IBM Directory client
                if an LDAP or Lotus
                ? Domino? server is being used as the user registry in the
                secure domain.
                
II. Configuration of the Java runtime component to a particular Java runtime environment
    Configure the Access Manager Runtime for Java component to use the proper JRE
    on the system by using the pdjrtecfg command. The Tivoli Access Manager Java
    runtime component can be configured to several different JREs on the same
    system, if required. See the IBM Tivoli Access Manager for e-business: Installation
    Guide for details.
    
III. Configuration of the Java administration classes
    The com.tivoli.pd.jcfg.SvrSslCfg Java class must be used to configure the
    administration Java APIs. See the IBM Tivoli Access Manager for e-business:
    Authorization Java Classes Developer Reference for details on the SvrSslCfg utility.
    Notes:
        1. Do not use the svrsslcfg command-line interface to create configuration files
        that are to be used with Java applications.
        2. The com.tivoli.mts.SvrSslCfg class provided in previous versions of Tivoli
        Access Manager and IBM SecureWay? Policy Director has been deprecated. Use
        the new com.tivoli.pd.jcfg.SvrSslCfg class instead.

IV. Security requirements
    To run a Java application in the context of a Java security manager, the application
    must have proper Java permissions to use the administration Java APIs. If the
    application is not installed as a Java extension in the JAVA_HOME/lib/ext
    directory, an entry must be added to the JAVA_HOME/lib/security/java.policy file.
    To grant the necessary permission to the Java applications located in the
    /sb/pdsb/export/classes directory, and all its subdirectories, the necessary Java
    permissions to use authorization Java classes and methods, add a statement like
    the following to the java.policy file:
        // Give applications in /sb/pdsb/export/classes and
        // its subdirectories access to the Access Manager
        // Administration APIs
        grant codeBase "file:/sb/pdsb/export/classes/-" {
        permission javax.security.auth.AuthPermission "PDAdmin";
        };        
    Invoke administration Java classes and methods from a privileged block,
    doPrivileged(), to alleviate the need for the application callers to have this Java
    permission as well.
    The PD.jar file is signed, but verification of the signing of JAR files is not
    supported in this version of Tivoli Access Manager.



1.rhel-server-5.3-x86_64 for java developer(An Tivoli Access Manager secure domain installed on other system,eg. tam host)
(all need patchs can be found in )IBM Tivoli Access Manager Base for Linux on x86 v6.1.1
Tivoli Access Manager runtime environment and Tivoli Access Manager ADK is optional installed;

     1.  Install ibm-java2-i386-sdk-5.0-5.0.i386.rpm
     rpm -ivh libXp-1.0.0-8.i386.rpm
         rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm
         rpm -ivh ibm-java2-i386-sdk-5.0-5.0.i386.rpm
        
         add jdk to environment:
         ~]# vi .bashrc
        
             JAVA_HOME=/opt/ibm/java2-i386-50/bin
            PATH=$JAVA_HOME:$PATH:.
            export PATH
            
        ~]# source .bashrc
        
        Notes: If you get the following error, you need disable SElinux and reboot system.
        ~]# java -version
        Failed to find VM - aborting
        
         ]# vi /etc/selinux/config
            # This file controls the state of SELinux on the system.
            # SELINUX= can take one of these three values:
            #       enforcing - SELinux security policy is enforced.
            #       permissive - SELinux prints warnings instead of enforcing.
            #       disabled - SELinux is fully disabled.
            SELINUX=disabled
            # SELINUXTYPE= type of policy in use. Possible values are:
            #       targeted - Only targeted network daemons are protected.
            #       strict - Full SELinux protection.
            SELINUXTYPE=targeted

    2.Tivoli Access Manager Java runtime component
        TAM]# install_amjrte
        
        
    3.Configuration of the Java administration classes
    
    ~]# java com.tivoli.pd.jcfg.SvrSslCfg -action config \
    -admin_id sec_master \
    -admin_pwd object00 \
    -appsvr_id app1 \
    -port 33333 \
    -mode remote \
    -host localhost \
    -policysvr tam:7135:1 \
    -authzsvr tam:7136:2 \
    -cfg_file /opt/PolicyDirector/etc/app1.properties \
    -domain Default \
    -key_file /var/PolicyDirector/keytab/app1.ks \
    -cfg_action create
    
    4.
    
import java.util.*;
import java.net.URL;
import java.io.*;

import com.tivoli.pd.jutil.PDContext;
import com.tivoli.pd.jutil.PDMessage;
import com.tivoli.pd.jutil.PDMessages;
import com.tivoli.pd.jutil.PDRgyUserName;
import com.tivoli.pd.jutil.PDRgyGroupName;
import com.tivoli.pd.jutil.PDException;

import com.tivoli.pd.jadmin.*;

import com.tivoli.pd.nls.*;



public class PDAdminApp1
{
   public static void main(String [] args) throws Exception
   {      
      PDMessages msgs = new PDMessages();

      //application name = {appsvrid}-{host}    
      String prog = "app1-localhost";
      String adminName = "sec_master";
      char[] adminPassword = "object00".toCharArray();
      String configURLStr = "file:///opt/PolicyDirector/etc/app1.properties";

      String rgySuffix = "c=us";
      

      Locale locale = new Locale("ENGLISH", "US");
      URL configURL = null;

         System.out.println("Initializing PDAdmin...\n");
         PDAdmin.initialize(prog, msgs);
         processMsgs(msgs);


         configURL = new URL(configURLStr);

        
         System.out.println("Creating a context...\n");
         PDContext ctxt = new PDContext(locale,
                                        adminName,
                                        adminPassword,
                                        configURL);
      
         String group = "TestGroup1";
         String rgyGroup = "cn=" + group + "," + rgySuffix;
         PDRgyGroupName pdRgyGroupName = new PDRgyGroupName(rgyGroup);

         System.out.println("Creating a group...\n");
         PDGroup.createGroup(ctxt,
                             group,
                             pdRgyGroupName,
                             null, // description
                             null, // container
                             msgs);
         processMsgs(msgs);

        
         String name = "DemoUser";
         String firstName = "Demo";
         String lastName = "User";
         String password = "DemoPassword";
         String description = "Demo Description";
         String rgyName = "cn=" + name + "," + rgySuffix;
         PDRgyUserName pdRgyUserName =
            new PDRgyUserName(rgyName, firstName, lastName);
         boolean ssoUser = false;
         boolean pwdPolicy = true;
         ArrayList groupList = new ArrayList();
         groupList.add(group);

         System.out.println("Creating a user...\n");
         PDUser.createUser(ctxt,
                           name,
                           pdRgyUserName,
                           description,
                           password.toCharArray(),
                           groupList,
                           ssoUser,
                           pwdPolicy,
                           msgs);

         processMsgs(msgs);

         System.out.println("Getting a user...\n");
         PDUser pdUser = new PDUser(ctxt,
                                    name,
                                    msgs);


         processMsgs(msgs);

         System.out.println("User " + name + ".isAccountValid: " +
                            pdUser.isAccountValid() + "\n");

         System.out.println("Setting the user's account to valid using the instance set method ...\n");
         pdUser.setAccountValid(ctxt, true, msgs);
         processMsgs(msgs);

         if (ctxt != null)
         {
             ctxt.close();
         }

         System.out.println("Shutting down PDAdmin...\n");
         PDAdmin.shutdown(msgs);
         processMsgs(msgs);
   }

   static void processMsgs(PDMessages msgs)
   {
      if (msgs.size() > 0)
      {
         System.out.println("Msgs are: " + msgs + "\n");
         msgs.clear();
      }
   }
}

~]# javac PDAdminApp1
~]# java PDAdminApp1
基于遗传算法的微电网调度(风、光、蓄电池、微型燃气轮机)(Matlab代码实现)内容概要:本文档介绍了基于遗传算法的微电网调度模型,涵盖风能、太阳能、蓄电池和微型燃气轮机等多种能源形式,并通过Matlab代码实现系统优化调度。该模型旨在解决微电网中多能源协调运行的问题,优化能源分配,降低运行成本,提高可再生能源利用率,同时考虑系统稳定性与经济性。文中详细阐述了遗传算法在求解微电网多目标优化问题中的应用,包括编码方式、适应度函数设计、约束处理及算法流程,并提供了完整的仿真代码供复现与学习。此外,文档还列举了大量相关电力系统优化案例,如负荷预测、储能配置、潮流计算等,展示了广泛的应用背景和技术支撑。; 适合人群:具备一定电力系统基础知识和Matlab编程能力的研究生、科研人员及从事微电网、智能电网优化研究的工程技术人员。; 使用场景及目标:①学习遗传算法在微电网调度中的具体实现方法;②掌握多能源系统建模与优化调度的技术路线;③为科研项目、毕业设计或实际工程提供可复用的代码框架与算法参考; 阅读建议:建议结合Matlab代码逐段理解算法实现细节,重点关注目标函数构建与约束条件处理,同时可参考文档中提供的其他优化案例进行拓展学习,以提升综合应用能力。
此项目旨在实现一个简易而实用的RFID智能门禁控制系统。采用经典的51系列单片机——STC89C52作为核心控制器,集成MFRC522射频识别模块来读取RFID卡片信息。用户界面通过128x64像素的LCD显示屏展示相关信息,同时配备了键盘用于密码的输入、验证及修改。此设计结合了RFID技术的高效率识别与单片机的强大控制能力,适用于学习、教学或小型安防项目。 资源包含 源代码:完整C语言编写的源程序,涵盖了RFID识别、密码验证逻辑、显示控制以及用户交互等功能模块。 原理图:详细展示了整个系统的电路连接,包括单片机、MFRC522模块、LCD12864屏幕、按键等组件的电气连接方式,便于理解和自制。 技术特点 RFID技术应用:通过MFRC522模块实现非接触式身份认证,提升门禁安全性与便捷性。 人机交互界面:利用LCD12864显示屏直观展示状态信息,并通过物理按键进行操作,增加了系统的易用性。 密码安全机制:支持用户密码的设定和更改,增强系统安全性。 51单片机编程:适合初学者和专业人士学习51单片机应用开发,尤其是嵌入式系统与物联网领域的实践。 使用指南 环境搭建:确保你有合适的IDE(如Keil uVision)安装以编译51单片机的C代码。 原理图分析:详细阅读原理图,了解各部件间的连接,这对于正确搭建硬件平台至关重要。 编译与上传:将提供的源代码编译无误后,通过编程器或ISP接口烧录到STC89C52单片机中。 硬件组装:根据原理图搭建电路,确保所有组件正确连接。 测试与调试:完成后进行功能测试,可能需要对代码或硬件做适当调整以达到最佳工作状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值