windows下ITIM admin API开发环境配置,部署至tomcat
?
??? itim
4.项目的目录结构图如下:
5.部署至apache-tomcat-6.0.18服务器中
A.配置apache-tomcat-6.0.18运行jre
在apache-tomcat-6.0.18/bin/setclasspath.bat中添加JRE_HOME:
set JRE_HOME="D:\IBM\eclipseDevelopmentPackage\ibm_sdk50\jre"
B.拷贝$APP_SRV_TOP/runtime/com.ibm.ws.admin.client_6.1.0.jar到apache-tomcat-6.0.18/lib中
附录代码
PersonMgr.java
package com.likegene.demo;
import java.rmi.RemoteException;
import java.util.Collection;
import java.util.Hashtable;
import java.util.ResourceBundle;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import com.ibm.itim.apps.ApplicationException;
import com.ibm.itim.apps.InitialPlatformContext;
import com.ibm.itim.apps.PlatformContext;
import com.ibm.itim.apps.Request;
import com.ibm.itim.apps.identity.PersonMO;
import com.ibm.itim.apps.identity.PersonManager;
import
com.ibm.itim.apps.jaas.callback.PlatformCallbackHandler;
import com.ibm.itim.apps.provisioning.PasswordManager;
public class PersonMgr {
??? static
ResourceBundle rb = ResourceBundle.getBundle("context");
??? public
Subject getSubject(PlatformContext platform) {
???
??? String
itimManager = rb.getString("itimManager");
???
??? String
itimManagerPwd = rb.getString("itimManagerPwd");
???
??? Subject
subject = null;
???
??? try {
???
???
???
PlatformCallbackHandler handler = new
PlatformCallbackHandler(
???
???
???
???
??? itimManager,
itimManagerPwd);
???
???
???
handler.setPlatformContext(platform);
???
???
??? LoginContext
lc = new LoginContext("ITIM", handler);
???
???
???
lc.login();
???
???
??? subject =
lc.getSubject();
???
??? }
???
??? catch
(LoginException e) {
???
???
???
e.printStackTrace();
???
??? }
???
??? return
subject;
??? }
??? public
PlatformContext getPlatform() {
???
??? String
platformContextFactory = rb.getString("contextFactory");
???
??? String
ejbUser = rb.getString("ejbUser");
???
??? String
appServerURL = rb.getString("appServerURL");
???
??? String
ejbPwd = rb.getString("ejbPwd");
???
???
Hashtable<String, String> env = new
Hashtable<String, String>();
???
???
env.put(InitialPlatformContext.CONTEXT_FACTORY,
platformContextFactory);
???
???
env.put(PlatformContext.PLATFORM_URL, appServerURL);
???
???
env.put(PlatformContext.PLATFORM_PRINCIPAL, ejbUser);
???
???
env.put(PlatformContext.PLATFORM_CREDENTIALS, ejbPwd);
???
?