UCM (Oracle Content Server)安装及CIS应用(FOR J2EE)

一、下载

       UCM:http://www.oracle.com/technology/software/products/content-management/index.html

        下载:Oracle Content Server 10g

       CIS:http://download.oracle.com/otn/content_management/ContentIntegrationSuite_10gR3_20081218.zip


二、安装(具体步骤见附件——安装.doc)

1.       运行 \UCM\ContentServer\win32\Installer.exe ,开始进行安装。  

2.       配置安装环境,选择简体中文和新服务器,如下图  

3.       继续选择服务安装目录及 JDK 配置,如下  

4.       继续默认选择配置为主服务并安装管理服务器,如下  

5.       选择内容服务器区域为简体中文,并设置时区为系统默认。  

6.       设置端口号及 IP 过滤,此处为可以访问的 IP  

7.       设置一些杂项  

8.       配置服务器和数据库  

服务器选择 Apache ,数据库选择 SqlServer2005

9.       安装所有组件,输入“ 1,2,3,4,5,F ”  

10.   配置管理服务器和内容服务器,均选择安装并自动启动,不使用特定身份,不依赖其他服务。

11.   以上所有配置结束,系统会检查配置项,  

所有配置如下:

审核安装设置。 . .

Content Server 核心文件夹 : e:/oracle/ucm/server

Java 虚拟机 : Sun Java 1.5.0_11 JDK

Content Server 本机 Vault 文件夹 : e:/oracle/ucm/server/vault/

Content Server Weblayout 文件夹 : e:/oracle/ucm/server/weblayout/

通过另一个服务器来代理身份验证功能 : no

安装管理服务器 : yes

Web 浏览器路径 : c:/program files/internet explorer/iexplore.exe

内容服务器系统区域设置 : Chinese-Simplified

内容服务器端口 : 4444

管理服务器端口 : 4440

传入连接地址过滤器 : 127.0.0.1|192.168.*.*

Web 服务器的相对根 : /idc/

公司邮件服务器 : mail

管理员电子邮件地址 : sysadmin@mail

Web 服务器 HTTP 地址 : 127.0.0.1

Content Server 实例名 : idc

Content Server 实例标签 : idc

Content Server 说明 : 内容服务器 idc

Web 服务器 : Apache

内容服务器数据库 : Microsoft SQL Server 2005

JDBC 驱动程序类名称 : net.sourceforge.jtds.jdbc.Driver

JDBC 连接字符串 : jdbc:jtds:sqlserver://192.168.8.18:1433;databaseName=UCM

SQL 数据库用户 : sa

SQL Database Password Encoding: Intradoc

SQL 数据库口令 : ag5WiFbZEIrT3XzaSDf4ULf6/8VClb2dygLGr3pW8Hk=

JDBC 驱动程序 jar 文件路径 :

D:\jboss-4.0.5.GA\server\default\deploy\CRM.war\WEB-INF\lib\jtds-1.2.4.jar

复制 JDBC 驱动程序文件 : true

是否尝试创建数据库表 :

使用 Unicode 文本字段 :

组件 :

ContentFolios,Folders_g,LinkManager8,OracleTextSearch,ThreadedDiscussions

配置管理服务器服务 : auto

将管理服务配置为以特定用户身份运行 : false

将管理服务配置为依赖于另一个服务 : false

配置内容服务器服务 : auto

将服务配置为以特定用户身份运行 : false

将服务配置为依赖于另一个服务 : false

12.   选择继续安装,等待安装结束。  

13.   默认安装 Apache2.2 ,配置项目如下  

打开 E:\Apache2.2\conf\httpd.conf ,在文件最下面加入:

loadModule IdcApacheAuth E:/oracle/ucm/server/shared/os/win32/lib/IdcApache22Auth.dll

IdcUserDB idctest "E:/oracle/ucm/server/data/users/userdb.txt"

Alias /idctest "E:/oracle/ucm/server/weblayout/"

<Location /idctest>

DirectoryIndex portal.htm

IdcSecurity idc

Allow from all

</Location>

 

14.   检查系统服务项


 


三、CIS的使用

1.将cis-client-8.0.0.jar导入到项目中。

2.在src下创建adapterconfig.xml,或在CIS的实例中复制一份,内容如下:


<?xml version="1.0" ?>
<config>
	<adapter default="true" name="myadapter" type="scs">
		<config>
			<property name="port">8888</property>
            <property name="host">127.0.0.1</property>
			<property name="type">socket</property>
		</config>
		<beans template="classpath:/META-INF/resources/adapter/adapter-services-scs.jxml"/>
	</adapter>
</config>


只需要修改host和post,host是安装UCM的机器IP,post是安装时选择的端口(默认是4444)

3.复制\oracle-cis-10g\samples\CodeExamples\src\java下的java文件到项目中。(oracle都给写好了,用的时候复制粘贴就OK了)

4.开始使用。


四、自写UCMUtil


由于毕竟是用例,现成的代码过于分散,所以自己写了一个工具类,只实现checkin和checkout文件,其他的可以自己添加。修改了用例中的声明,全都使用public便于外部调用。



/**
	 * 存储文件
	 * @param path 文件路径
	 * @param title 存储用标题
	 * @return 提取码
	 */
	public static String cheakinFile(String path,String title){
		CheckinFile checkin = new CheckinFile ();
			checkin.initialize ();
        try {
        	checkin.setPrimaryFile(path);
        	checkin.setTitle(title);
            checkin.connect ();
            checkin.execute ();
        } catch (CommandException e) {
            e.printStackTrace ();
        } catch (MalformedURLException e) {
            e.printStackTrace ();
        } catch (RemoteException e) {
            e.printStackTrace ();
        }
		return checkin.getContentId();
	}
	/**
	 * 取文件
	 * @param ContentId 提取码
	 * @return ICISTransferStream文件对象
	 * e.g.
	 * ICISTransferStream in;
	 * 1.获取文件名:in.getFileName();
	 * 2.获取文件2进制流:in.getInputStream();
	 * 3.存储文件:
	 * 		FileOutputStream fos = new FileOutputStream ("d:\\"+in.getFileName());
	 *		UCPMStreamUtil.copyStream (in.getInputStream(), fos, true, true);
	 * @see UCPMStreamUtil
	 */
	public static ICISTransferStream cheakoutFile(String ContentId){
		CheckoutAndSave checkout = new CheckoutAndSave ();
        checkout.initialize ();
        try {
        	checkout.setContentId(ContentId);
            checkout.connect ();
            checkout.execute ();
        } catch (CommandException e) {
            e.printStackTrace ();
        } catch (MalformedURLException e) {
            e.printStackTrace ();
        } catch (RemoteException e) {
            e.printStackTrace ();
        }
        return checkout.getGetfileResult();
	}

 

五、从朋友手里拿的通过http存取文件的方法

package com.stellent.cis.sdk.util;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.Random;

import com.esoon.cisiss.common.PropertiesUtil;

import oracle.stellent.ridc.IdcClient;
import oracle.stellent.ridc.IdcClientException;
import oracle.stellent.ridc.IdcClientManager;
import oracle.stellent.ridc.IdcContext;
import oracle.stellent.ridc.model.DataBinder;
import oracle.stellent.ridc.protocol.ServiceResponse;

public class UCMUtil {
    private static IdcClientManager m_clientManager = null;
    private static IdcClient m_client = null;
    private static IdcContext m_context = null;
    static {
		try{
			UCMUtil.initialize(PropertiesUtil.getConfig().getProperty("UCMURL"),PropertiesUtil.getConfig().getProperty("UCMUserName"),PropertiesUtil.getConfig().getProperty("UCMPassWord"));
		}catch(Exception e){
			e.printStackTrace();
		}
	}
    /**
	 * Initialize connection to UCM
	 * @param url  url of UCM server , eg: http://portal.intertest.gov.mo/edmstest/idcplg
	 * @param user user's ID
	 * @param passwd user's password
	 * @return void
	 */
    private static void initialize(String url,String user,String passwd) throws IdcClientException{
    	m_clientManager=new IdcClientManager ();
    	m_client=m_clientManager.createClient (url);
    	m_context=new IdcContext(user,passwd);
    }

    /**
	 * Save File To UCM
	 * @param path  File's local path
	 * @param title title of file in UCM
	 * @return Content's ID
	 */
    public static String checkinFile(String path,String title) throws IdcClientException,IOException{    	
    	DataBinder dataBinder=m_client.createBinder();       	
    	dataBinder.putLocal("IdcService","CHECKIN_UNIVERSAL");    //Service Name
    	dataBinder.putLocal("dDocType",PropertiesUtil.getConfig().getProperty("dDocType"));                //Content Type
    	dataBinder.putLocal("dDocTitle",title);                   //Content Title 
    	dataBinder.putLocal("dSecurityGroup",PropertiesUtil.getConfig().getProperty("dSecurityGroup"));          //Security Group
    	dataBinder.putLocal("dDocAccount",PropertiesUtil.getConfig().getProperty("dDocAccount"));     //Security Account
//    	dataBinder.putLocal("dCollectionName", "");               //Folder id
    	dataBinder.putLocal("dDocName", new Date().getTime() + rdmString(7) + "Content-Id");    
    	dataBinder.addFile("primaryFile",new File(path));         //Primary File
    	ServiceResponse response = m_client.sendRequest(m_context,dataBinder);
    	//convert the response to a dataBinder
    	DataBinder responseData=response.getResponseAsBinder();
    	return responseData.getLocal("dDocName");
    }
    public static String rdmString(int l) {
		Random r = new Random();
		int i = 0;
		String str = "";
		while (i < l) {
			int n = r.nextInt(122);
			if (n > 64 && n < 90) {
				str += (char) n;
				i++;
			}
		}
		return str;
	}
    /**
	 * Get File From UCM
	 * @param   contentID File's ID in UCM
	 * @return an InputStream 
	 */
    public static InputStream getFile(String contentID) throws IdcClientException,IOException{    
	    DataBinder dataBinder = m_client.createBinder ();
	    dataBinder.putLocal ("IdcService", "GET_FILE");                     //Service Name
	    dataBinder.putLocal ("dDocName", contentID);                        //Content ID
	    dataBinder.putLocal("RevisionSelectionMethod","LatestReleased");	//Which Revision
	    dataBinder.putLocal("Rendition", "primary");                        //Which format? primary/Web
	    ServiceResponse response = m_client.sendRequest (m_context, dataBinder);
	    InputStream inputStream = response.getResponseStream();
	    return inputStream;
}
    
    private static boolean waitForRelease (String contentID) throws IdcClientException {
        //Get the client (from the base class) and create a new binder
        DataBinder dataBinder = m_client.createBinder ();

        //Populate the binder for a DOC_INFO service
        dataBinder.putLocal ("IdcService", "DOC_INFO_BY_NAME");
        dataBinder.putLocal ("dDocName", contentID);

        //Give the content server a minute to "release" the previous checkin
        boolean released = false;
        int count=0;
        while (!released) {
            ServiceResponse infoResponse = m_client.sendRequest (m_context, dataBinder);
            released = "RELEASED".equals (infoResponse.getResponseAsBinder ().getLocal ("dStatus"));
            if (!released) {
                try {
                    Thread.sleep (1000);
                } catch (Exception exp) {
                    //ignored
                }
            }
            if (++count >= 30) {
                System.out.println (String.format("Document %s not released after %s seconds", contentID, count));
                return false;
            }
        }
        return true;
    }
    public static void main(String args[]){
	    String cid;
    	try{    		
    		
    		
    		//Testing of Checkin File to UCM
  		    cid=UCMUtil.checkinFile("c:\\ex2.txt","��Ivan ��� v5 in static");
  		    System.out.println("File in UCM's id:"+cid);
  		    
  		    //Checking if Content is released.
  		    if (waitForRelease(cid))
  		    	System.out.println("Content is Released!!!");
  		    
  		    //Testing of Get File from UCM
        	InputStream is=UCMUtil.getFile(cid);
    		OutputStream out=new FileOutputStream(new File("c:/dest.txt"));
    		byte buf[]=new byte[1024];
    		int len;
    		while((len=is.read(buf))>0)
    			out.write(buf,0,len);
    		out.close();
    		is.close();
    	} catch (IdcClientException e) {
            e.printStackTrace ();
        } catch (IOException e) {
            e.printStackTrace ();
        };
        System.out.println("Finish Testing!");
    }
}
 


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Oracle Database 安全配置。 Table of Contents Overview ...................................................................................................................................................................... 9 Intended Audience .............................................................................................................................................. 9 Consensus Guidance ........................................................................................................................................... 9 Typographical Conventions ......................................................................................................................... 10 Scoring Information ......................................................................................................................................... 10 Profile Definitions ............................................................................................................................................. 11 Acknowledgements .......................................................................................................................................... 13 Recommendations ................................................................................................................................................. 14 1 Oracle Database Installation and Patching Requirements .......................................................... 14 1.1 Ensure the Appropriate Version/Patches for Oracle Software Is Installed (Not Scored) ......................................................................................................................................................... 14 1.2 Ensure All Default Passwords Are Changed (Scored) ..................................................... 16 1.3 Ensure All Sample Data And Users Have Been Removed (Scored) ............................ 18 2 Oracle Parameter Settings ........................................................
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值