filenet java配置_连接到filenet的外部java应用程序服务器

凑合看,不想翻译了.

Static Variables

There are a few static application parameters that you will use in the sample code.

FILENET_USERNAME

The Login ID for the user that you want to connect to FileNet with. Any content or workflows updated will be attributed to this user.

FILENET_PASSWORD

The password for the user

A simple test to see whether a user has sufficient rights to do certain functions via the API is to log in to Workplace and attempt to do the functionality that you are trying through the API. An example is, if you are trying to get a list of Document Classes through the API, you should be able to do the same in Workplace.

FILENET_URI

The URI that the application should use to connect to FileNet. This URI is used by both the CE and PE, and should point to the CE server. Because I'm using WebSphere with the EJB transport, the URI is in the format of "iiop://[server]:[port]/FileNet/Engine". Adjust the URI according to your platforms EJB syntax.

CE_DOMAIN

The Domain represents a logical grouping of physical resources. A single Domain may contain multiple Object Stores.

CE_OBJECTSTORE

An Object Store represents a location in which CE folders and content are managed on the server. The Object Store name can be found in FEM or by logging into Workplace and looking at the list of Object Stores on the left side.

Each Object Store has its own set of Document Classes that can be defined. There is a default Document Class called 'Document' that serves as the base Document Class.

PE_CONNECTION_POINT

Connection Points have replaced the Routers from FileNet 3.5 and enables connection to a PE Isolated Region. The PE Isolated Region is like the CE Object Store in that it holds PE queues, rosters, and other workflow configurations. Connection Points can be managed through FEM.

Main Code

In this section, I'll break down the main test method in the sample code and explain the API calls being made. The sample code starts off by logging into the CE first.Connection ceConnection =

Factory.Connection.getConnection(FILENET_URI);

The CE API contains Factory.* classes to create CE objects. To establish a Connection object, call the Factory.Connection class to create one by passing in the URI. This Connection object represents a logical connection to a FileNet Domain.Subject ceSubject =

UserContext.createSubject(ceConnection, FILENET_USERNAME,

FILENET_PASSWORD, null);

Next, to use JAAS, you create a Subject object. You pass in the username and password you want to use. The third parameter is for the JAAS stanza. Passing in 'null' means you want to use the default FileNet JAAS stanza, which is called 'FileNetP8'. The server authenticates the user and returns the JAAS subject.UserContext.get().pushSubject(ceSubject);

Before running any further CE API calls, it is necessary to push a Subject object onto the UserContext stack. This sets the user pushed as the active user for subsequent CE API calls.Domain ceDomain =

Factory.Domain.fetchInstance(ceConnection, CE_DOMAIN, null);

Now that you have a valid Subject on the stack, you can retrieve objects from the FileNet server. In this case, you call a fetch* to retrieve a Domain from the FileNet server by passing in the Connection object you created earlier and the Domain name that you want to retrieve. The third parameter represents a PropertyFilter object; it controls what properties should be returned. For the sample, I've left this as null so that all non-object properties are returned by default.ObjectStore ceObjectStore =

Factory.ObjectStore.fetchInstance(ceDomain, CE_OBJECTSTORE,

null);

Because the Domain is a container for CE resources, you now can retrieve your Object Store. You use the same type of call as retrieving the Domain, but instead you pass in the Domain object and the Object Store name. Once again, you pass in a 'null' for the PropertyFilter.

Once you get a valid Object Store object, you are now logged in and ready to use the rest of the CE API.

The next couple lines show how you would retrieve the properties of a Document Class.ClassDefinition classDef =

Factory.ClassDefinition.fetchInstance(ceObjectStore,

"Document", null);A Document Class is represented by the ClassDefinition interface. To retrieve a specific instance of a Document Class, you fetch it by passing in the Object Store object and the Document Class name you want. The "Document" document class is provided by default and serves as the base class for other document classes.PropertyDefinitionList properties =

classDef.get_PropertyDefinitions();

Now that you've fetched the Document Class, you can call a get* to retrieve the properties on the Document Class. It returns a PropertyDefinitionList, which is an iterable collection of PropertyDefinition objects.for (Iterator propertyIter =

properties.iterator(); propertyIter.hasNext();) {

PropertyDefinition property =

(PropertyDefinition) propertyIter.next();

System.out.println("Property: " + property.get_DisplayName());

}

For each PropertyDefinition you can get a lot of metadata, including the display name and symbolic name. Here, you iterate the properties and output the display name to the console.UserContext.get().popSubject();

Lastly, you pop the Subject off because you are done making CE API calls. This makes the next Subject on the stack the active user.VWSession peSession = new VWSession();

peSession.setBootstrapCEURI(FILENET_URI);

The FileNet PE login starts by creating a VWSession object. The VWSession object is the starting point for most of the PE API calls. With the VWSession object, you can query rosters and queues, and process any items found. In this test code, you'll log in to the PE and retrieve a list of all Process Queues that are configured.peSession.logon(FILENET_USERNAME,

FILENET_PASSWORD,

PE_CONNECTION_POINT);

Once you have the VWSession object, you set the CE URI onto the object so that it can perform the login and authentication. Once this method executes successfully, you will be logged into the PE.String[] queueNames =

peSession.fetchQueueNames(VWSession.QUEUE_PROCESS);

From here, you can call fetchQueueNames to retrieve the Queues. The static value you pass in says that you want only the Queues that will be processing Workflow items. There are also other options, such as only system queues or user queues.for (String queue : queueNames) {

System.out.println("Queue: " + queue);

}

The fetchQueueNames method returns an array of Strings for the name of the Queues. You simply print out the names of the Queues for verification.

Although you've covered the basic API calls to login to CE and PE and perform simple queries, this serves as the basis for more complicated API calls. The full API and developers guide are documented within the FileNet ECM Help site, whose link can be found off of Workplace.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值