设为首页 收藏本站
查看: 586|回复: 0

[经验分享] UCM (Oracle Content Server)安装及CIS应用(FOR J2EE)

[复制链接]

尚未签到

发表于 2016-8-6 15:38:22 | 显示全部楼层 |阅读模式
  一、下载




         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!");
}
}
   

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-253760-1-1.html 上篇帖子: oracle通过透明网关,创建dblink,访问ms sql server和其他数据库 下篇帖子: 查看Oracle字符集及如何修改字符集
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表