EMC -- DFS篇(Documentum Foundation Services)

DFS 包含的技术有

1. Enterprise Content Services.

 --- 一组面向对象的服务。

2.  Data model and API

3. Client productivity layer

4. Tools for generating services and runtime support

5. SDK

6. EMC Documentum Solution Catalog Repository


DFS消费者

1. 使用生产力层 , 用java 和 .net 直接调用  wsdl

2. 通过WSDL产生客户端代理, 不需要使用生产力层

转化方式:

 java : Axis 或者JAX-WS

 .NET: WCF(EMC自己提供的工具)


本地和远端消费

DFS提供的所有服务,包含客制的服务, 都可以使用DFS java 生产里层本地调用, 之后才作为远端客户运行。

这样的话对于调式非常有用。


DFS工具

1. 把Java代码生成WSDL. 使用Composer interface。

2. 把WSDL生成代码来调用。 使用 ant 脚本(EMC提供, 包含在WDK中)

DFS服务可以实施为POJOs(Plain Old Java Objects), BOF, SBOs


Java Productivity Layer

SDK的路径不能有空格


调用Query Service 的例子(基于Eclipse)

1.  确保http://IP:9080/services/core/QueryService?WSDL

是可以连接和正常访问的, 具体需要看IP, Port 是否正常, QueryService 是否正确安装(默认在Content Server安装时,会安装在jboss里)

2.  新建java 工程,把 SDK下 , lib/java 目录下所有的jar档 include 到build path中(注意, 千万不要把xml等非jar 的文件include)

3. 写测试代码 TQueryServiceTest.java

package com.study.client;

import java.util.List;

import com.emc.documentum.fs.datamodel.core.CacheStrategyType;
import com.emc.documentum.fs.datamodel.core.DataObject;
import com.emc.documentum.fs.datamodel.core.DataPackage;
import com.emc.documentum.fs.datamodel.core.OperationOptions;
import com.emc.documentum.fs.datamodel.core.context.RepositoryIdentity;
import com.emc.documentum.fs.datamodel.core.properties.PropertySet;
import com.emc.documentum.fs.datamodel.core.query.PassthroughQuery;
import com.emc.documentum.fs.datamodel.core.query.QueryExecution;
import com.emc.documentum.fs.datamodel.core.query.QueryResult;
import com.emc.documentum.fs.rt.ServiceException;
import com.emc.documentum.fs.rt.context.ContextFactory;
import com.emc.documentum.fs.rt.context.IServiceContext;
import com.emc.documentum.fs.rt.context.ServiceFactory;
import com.emc.documentum.fs.services.core.client.IQueryService;

public class TQueryServiceTest {

	private String repository = "test";

	private String userName = "username";

	private String password = "passowrd";

	private String host = "http://ip:port/services";

	private static String moduleName = "core";

	private IServiceContext serviceContext;

	public TQueryServiceTest() {
	}

	public void setContext() {
		ContextFactory contextFactory = ContextFactory.getInstance();
		serviceContext = contextFactory.newContext();
		RepositoryIdentity repoId = new RepositoryIdentity();
		repoId.setRepositoryName(repository);
		repoId.setUserName(userName);
		repoId.setPassword(password);
		serviceContext.addIdentity(repoId);
	}

	public void callQueryService() {
		try {
			ServiceFactory serviceFactory = ServiceFactory.getInstance();
			IQueryService querySvc = serviceFactory.getRemoteService(IQueryService.class, serviceContext, moduleName,
					host);
			PassthroughQuery query = new PassthroughQuery();
			query.setQueryString("select r_object_id,object_name from dm_cabinet");
			query.addRepository(repository);
			QueryExecution queryEx = new QueryExecution();
			queryEx.setCacheStrategyType(CacheStrategyType.DEFAULT_CACHE_STRATEGY);

			OperationOptions operationOptions = null;
			QueryResult queryResult = querySvc.execute(query, queryEx, operationOptions);
			System.out.println("QueryId == " + query.getQueryString());
			System.out.println("CacheStragegyType == " + queryEx.getCacheStrategyType());
			DataPackage resultDp = queryResult.getDataPackage();
			List<DataObject> dataObjects = resultDp.getDataObjects();
			int numberOfObjects = dataObjects.size();
			System.out.println("Total objects returned is: " + numberOfObjects);
			for (DataObject dObj : dataObjects) {
				PropertySet docProperties = dObj.getProperties();
				String objectId = dObj.getIdentity().getValueAsString();
				String docName = docProperties.get("object_name").getValueAsString();
				System.out.println("Cabinet " + objectId + " name is " + docName);
			}
		} catch (ServiceException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		TQueryServiceTest t = new TQueryServiceTest();
		t.setContext();
		t.callQueryService();
	}

}

ServiceFactory:

1. 两个参数时, 服务的地址会从

serviceFactory.getRemoteService(IObjectService.class,
                    serviceContext);

方法:

createPath: 创建目录

create: 创建doc



DFS SDK

包含 DFS  productivity layer and build tools


对于本地DFS客户端(local DFS Client), 消费者和服务在同一个进程中,在同一个Java虚拟机中。

本地DFS客户端通过传统的RPC方式与Content Server交互。

本地消费方式提供的附加功能: 因为和远端服务提供的功能是一样的, 对与系统开发比较有用。 可以用来做测试。不同的地方有

1. 服务上下文注册

2. 内容传送不同


你可能感兴趣的:(EMC -- DFS篇(Documentum Foundation Services))