Friday, May 30, 2014

Add Multiple Documents in a single transaction (Batch)


If you have requirement to upload multiple  documents as part of the single  transaction you can use com.filenet.api.core.UpdatingBatch API. 

This API  first create a batch object that allows adding  multiple documents as part of the batch. Once the batch is completed you can call updateBatch() to complete the transaction. If there is any error it will rollback the transaction. In this case no documents will be added.

The API returns BatchItemHandle that has the document ID's and any exception. You can iterate the objects and get the document ID that was added.

One of the user case where it can be used when you want to all documents in a directory. Instead of client making a single call to add documents in a loop you can expose API that takes dir_path as input. This will enable easy error handling at the client side.

If you have storage that has retention policy e.g. snaplock it will still not add the documents  if error occurs in middle of transaction. Snaplock use staging area that allows deletion before commit is made.


API Usage


createUpdatingBatchInstance(Domain domain,RefreshMode refresh)

// create update batch
UpdatingBatch ub = UpdatingBatch.createUpdatingBatchInstance(this.getDomain(), RefreshMode.REFRESH);
// add documents in a loop
// returns non object property for BatchItemHandle

ub.add(doc,null)

// execute the batch
ub.updateBatch();

// get the list of document IDs and check for exception 

public static List<DocumentMetadata> getDocumentList( UpdatingBatch ub )
{
List<DocumentMetadata> documentList = new ArrayList<DocumentMetadata>();
Iterator<BatchItemHandle> it = ub.getBatchItemHandles( null ).iterator();
// iterate over the batch object
while( it.hasNext() )
{
BatchItemHandle batchItem = it.next();
if( batchItem.hasException() )
{
// Displays the exception,
EngineRuntimeException thrown = batchItem.getException();
}
else
{
// get the document object 
Document doc = ( Document )batchItem.getObject();
// document metadata bean
DocumentMetadata docMetadata= new DocumentMetadata();
// add id to  bean
docMetadata.setDocumentId( doc.get_Id().toString() );
ContentElementList docContentList = doc.get_ContentElements();
Iterator iter = docContentList.iterator();
// mostly single content document
while (iter.hasNext() )
{
ContentTransfer ct = (ContentTransfer) iter.next();
// file name of the document set in bean
docMetadata.setFilePath( ct.get_RetrievalName());
}
// adding the bean (has the ID and the file name )  to the list
documentList.add( docMetadata );
}
}
return documentList;
}


Friday, May 9, 2014

FileNet Deployment Manager

P8 Assets Migration across environments

There are two ways data can be migrated across environments in Content Engine

1. Using Enterprise Manager (Export/Import)

2. Using Deployment Manager

Most of the time we use Enterprise Manager export/import option to move the P8 assets across environments. This works fine if the migration involves small data set with few environments. However if you have multiple environments and you need to sync-up the data, deployment manager is better option. This guide will help you get started. 

Using Deployment Manager

Deployment Manager is installed as part of Content Engine client installation.

Environments

As detailed in the guide first step is to add all environment details. This should include the source and destination environment.


Connections

Add the Content Engine Connection details for each environment and test the connection.





















Object Stores

Once you add the environment details next step is to map all object stores that will be used for export/import. Save the configuration.  The location of the configuration file (xml) is relative to the deployment manager working folder.


Export Assets (Source Environment)

You should perform the following on source environment. Right click and export manifest and then click on New Export Manifest. Give the name of the export and save.


Double click on export manifest and then click '+' symbol (Add Assets to the export manifest) to add the assets that you need to export.  If you are moving documents that are 'unfiled', deployment manager provides option to select unfiled documents. Once you click unfiled document wait for sometime. It may take a while to load all the documents. Once you have all required assets add them to the export manifest and save.




Note: There is no way to filter the  unfiled document using date range. You might face problem with memory issue if you have large set of documents.

You can filter the export using  export options (edit include options). This is same options as we have in Enterprise Manager export.




Once all the assets are retrieved then right click on the export manifest and click on export. This will create export file data set. You can create multiple export files for same object store or from different object store.

Note:  This export manifest is not compatible with FileNet Enterprise Manager export manifest.


Destination

In this step we first convert the assets from the source to destination environment. The conversion involves copy of data over with the new configuration. This converted assets is then imported in new environment.

Object Stores Mapping

If your source and destination has many object stores you can do the selective mapping. Deployment manager does not have option to ignore object store mapping. If you don't want object store from the source  to map  destination object store you can either map it to itself or leave the destination object store empty.


Security Mapping

Deployment Manager will map source and destination security based on the CE connection. If your source and destination has the same LDAP users and groups the mapping will be done by the tool. You don't need the mapping file as required by Enterprise Manager mapping.

Deployment Manager will display the mapping and will list down the security users/group that did not match. It also provides a UI to select a different user/group for the mapping. Once you have fixed the mapping you can save this mapping file. This mapping file will be used for assets conversion and import.

Note: If you find large number of mismatch security assets it is better to update the file manually instead of updating from the UI.  Best way is to map one of the security user/group from the screen UI and  save it . Open the  configuration XML file and map the rest of the security manually. Usually in these type of user/group mismatch best option is to map all mismatch with same user (p8admin).

Deployment Manager also has a feature  to import the document with system properties. This include the 'timestamp' of the document when it was created and also the original owner of the document. This is not possible when done via Enterprise Manager. To achieve this you should also enable the  security on destination object store ( Object store security -> add user to update system property).

Perform the import of documents in destination environment in this sequence

1. Convert Assets

Assets is  converted with the new configuration. It actually copies the data in new directory with this configuration

2. Analyze

This step validates the new configuration file before actual import.

3. Import

This is the final step for the import. This will import the data from the converted assets to target object store.

Thursday, December 12, 2013

WAS 8. 0 : API_UNEXPECTED_JNDI_ERROR: The JNDI cannot be accessed

Caused By:

javax.naming.NamingException: Error getting WsnNameService properties [Root exception is org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible  vmcid: IBM  minor code: E07  completed: No]

The steps to resolve the issue are :

http://mresetar.blogspot.in/2012/06/was-8-has-ssl-turned-on-for-rmi-by.html

In Application Server Admin Console,

1)      Go to Global Security

2)      Under Authentication panel -> Expand RMI/IIOP security

3)      Click on  CSIv2 inbound communications -> CSIv2 Transport Layer  ->

  • set Transport :  SSL-supported


4)      Similarly, for  CSIv2 outbound communications -> CSIv2 Transport Layer  ->

  • set Transport :  SSL-supported


5)      Restart the Server.

Friday, September 20, 2013

Large Content Upload and Download performance

Improving content uploads and downloads

http://pic.dhe.ibm.com/infocenter/p8docs/v5r1m0/topic/com.ibm.p8.performance.doc/p8ppt135.htm

Optimizing performance for large content uploads and downloads

http://pic.dhe.ibm.com/infocenter/p8docs/v5r1m0/topic/com.ibm.p8.performance.doc/p8ppt148.htm

Tuning recommendations

http://pic.dhe.ibm.com/infocenter/p8docs/v5r1m0/topic/com.ibm.p8.xt.user.doc/ae_help/ae_admin/aeadm_tuning_recommend.htm

Tune ORB in WebSphere to boost FileNet P8 performance

http://www.ibm.com/developerworks/data/library/techarticle/dm-1004tuneorbperformance/

After implementing the optimization as suggested  above we were still getting the following upload error for file of size 1.3 GB .

Caused by: java.io.IOException: File too large
        at java.io.FileOutputStream.writeBytes(Native Method)
        at java.io.FileOutputStream.write(FileOutputStream.java:263)
        at com.filenet.engine.content.TimeToLiveOutputStream.write(TimeToLiveOutputStream.java:401)
        at com.filenet.engine.content.PutContentHandler$PutContentState.write(PutContentHandler.java:1291)

After research we found that 'wasadmin' user that is configured as admin user for content engine in websphere (AIX) does not have ulimit setting as 'unlimited'. We changed the setting to unlimited in AIX and it fixed the problem.