October 24, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Connecting to IBM FileNet 4.0 Outside of a Java Application Server

  • December 29, 2008
  • By Anthony Lee
  • Send Email »
  • More Articles »

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.

Running the Sample Code

Now that you've explored what is in the sample code, it is time to try running it in your environment. I used Eclipse and JUnit to run the sample code, but any Java IDE or command line will work as well. Before executing the sample, some VM arguments need to be set so that the configuration files are located properly.

I've set mine in the 'Run Configurations...' window in Eclipse.

Figure 4: Configuring JUnit VM Arguments in Eclipse

Listing 3: VM Arguments

-Djava.naming.factory.initial="com.ibm.websphere.naming.
    WsnInitialContextFactory"
-Djava.security.auth.login.config=file:"{JAAS file location}"
-Dcom.ibm.CORBA.ConfigURL=file:"{sas.client.props location}"
-Dcom.ibm.SSL.ConfigURL=file:"{ssl.client.props location}"

Tags: API



Page 4 of 5



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel