WEB开发网
开发学院数据库DB2 雇员工作空间系列: 配置和开发 DB2 Content Manag... 阅读

雇员工作空间系列: 配置和开发 DB2 Content Manager 8.2 的单点登录 portlet

 2008-10-15 16:33:07 来源:WEB开发网   
核心提示: CMBConnection 的方法 connectWithCredential() 接受三个参数:服务器名(server name)、凭证对象(credential object)和连接字符串(connect string),为了在连接 Content Manager 服务器时启用 LTP

CMBConnection 的方法 connectWithCredential() 接受三个参数:服务器名(server name)、凭证对象(credential object)和连接字符串(connect string)。为了在连接 Content Manager 服务器时启用 LTPA 令牌作为凭证,需要添加下列代码,将 Content Manager 服务器连接到 TConnect.java:

 /**
  * Connects to a given server using LTPA token.
  * @param connection an instance of CMBConnection bean
  * @param dstype the datastore type.
  * @param server the server name. A connection string can
  *  also be specified following the name, in parenthesis
  * @param ltpaToken the ltpaToken.
  */
 public static void connect(CMBConnection connection, String dstype,
               String server, String ltpaToken)
  throws Exception {
   // If the server name is followed by a parenthesized string,
  // use that string for the connect string.
  if (server.indexOf("(") > 0) {
   String connectString = server.substring(server.indexOf("(")+1);
   server = server.substring(0, server.indexOf("("));
   if (connectString.endsWith(")")) {
    connectString = connectString.substring(0,
               connectString.length() - 1);
   }
   connection.setConnectString(connectString);
   }
    
  // Set properties on connection bean
  connection.setDsType(dstype);
  // Use the connect method to connect. This will
  // create the correct type of DKDatastore object (see Java API)
  // and call its connect method.
  System.out.println("Connecting to server");
  connection.connectWithCredential(server, ltpaToken, "");
  System.out.println("OK, Connected");
  // Enable display names support. This will cause
   // CMBSchemaManagement, CMBEntity, CMBAttribute, CMBItem to use
   // display names when working with CMv8 (default is to use
   // non-display names).
  connection.setDisplayNamesEnabled(true);
 }

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:雇员 工作 空间

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接