Contact us at +1.415.901.7500 or

Using Oracle Beehive for True Process Collaboration

Using Oracle Beehive for True Process Collaboration

Oracle Beehive Server Release 1 (1.4.3) is a true process centric collaboration platform.
At IT Convergence, we developed an internal application that takes advantage of various features and APIs of Oracle Beehive, which includes:

  • * Using the JCR API of Beehive Platform, timecards generated in Excel format from a web application were stored in the Document Repository.
  • * Using the Event Driven Architecture and policies definition provided by the Beehive platform, Business Processes were triggered to email the timecards to supervisors and other internal mailing lists.

Beehive provides document management services which is complaint with Java Content Repository Specification and can be accessed via the JCR API. This blog will provide a brief overview of the JCR API and the configuration needed for invoking business processes based on events.

1. Establish the context.

this.env.put(Context.INITIAL_CONTEXT_FACTORY, “oracle.j2ee.rmi.RMIInitialContextFactory”);
this.env.put(Context.SECURITY_PRINCIPAL, “oc4juser”);
this.env.put(Context.SECURITY_CREDENTIALS, “password”);
//User Account and password of user to be connected to JCR
this.userName = “user” ;
this.userPassword = “password”;

2. Connect to the Repository using the above environment and create a session.

BeehiveRepositoryConfiguration config = new BeehiveRepositoryConfiguration(jcrClient.env);
// Get the repository with the given beehive repository configuration
Repository rep = (Repository) RepositoryFactory.createRepository(config);
// Create the javax.jcr.SimpleCredentials object by giving the username and
// password of the repository
SimpleCredentials cred = new SimpleCredentials(userName, userPassword.toCharArray());

// Login with the Repository object using the SimpleCredentials object.
// A succesful login returns a Session object
Session session = (Session)rep.login(cred);
System.out.println(“Successfully logged in. Session Object ” + session);

*Note: This has a dependency on Beehive_jcr_1.0.jar.

3. Access the path where documents are to be stored.

Node myNode = null;
session.itemExists(docFolderPath + “/” + folderName);
if (!(session.itemExists(docFolderPath + “/” + folderName))) {
Node docFolder = (Node)session.getItem(docFolderPath);
// Save the session;
System.out.println(“Added Folder Node to Workspace Node”);
} else {
System.out.println(“Folder Exist”);

4. Create the file using the folder context and add content to the file.

// Access the file Node by giving the complete path
Node docNode = (Node)session.getItem( docFolderPath + “/” + folderName + “/” + filename);
String contents = readFileAsString(filePath);
ByteArrayInputStream bs = new ByteArrayInputStream(contents.getBytes());
System.out.println(“Doc Name “+ filename);

// Now access jcr:content node directly. No need to add it.
Node jcrcontentNode = docNode.getNode(“jcr:content”);
jcrcontentNode.setProperty(“jcr:data”, bs);;

5. Create the BPEL Process.

6. Register the BPEL Process with Beehive.

prompt> mv bpel_ProcessName_v2008_03_21__56753.jar bpel_ bpel_ProcessName.jar
prompt> beectl add_workflow_schema –file /tmp/bpel_CustomBeehiveWorkflow.jar

Successfully added workflow schema.

7. Define a new Beehive action.

Once the workflow is registered with Beehive, a new action must be created so that Beehive policies know how to call it. The name will later be used when defining the policy, and the action_string is how Beehive knows which workflow to invoke, and therefore must match the BPEL process name used during registration.

prompt> beectl add_policy_action –name CustomBeehiveWorkflow
–type JAVA
–description “Invoke the CustomBeehiveWorkflow workflow process”

Successfully created an ACTION object

8. Define a policy.

A Beehive policy needs to be defined which will determine when the Business Process will be invoked. The policy describes to invoke the business process when documents are added to any folder in a particular workspace. The policy definition also determines what XML data is sent to the workflow process.

The element defines the container in which the policy is configured, in this case the a workspace.

wksp=timeSheet Personal Workspace,enpr=IT Convergence

The element defines the business event inside the above mentioned scope that will trigger the policy to be evaluated.


The element defines the action that will be invoked from the policy. This value corresponds to the action created previously.


The policy also defines the XML data to be sent to the workflow in the element. The JXPATHS define the event payload to be sent to the workflow.

9. Add the policy.

Load the policy into Oracle Beehive with the beectl command-line tool. This tool is located in /beehive/bin:

prompt> beectl add_policy –file /tmp/CustomBeehiveWorkflow.xml

Successfully added policy.

10. Test the integration.

Upload a document to a specified path and check the BPEL Console for new instances of process.

This example demonstrates how easy it is to leverage Beehive’s capabilities and APIs. Most Beehive features are exposed as services, which enables Rapid Application Development and building of composite applications. It also supports an Event Driven Architecture, enabling the triggering of business processes (e.g., approvals or notifications). Since BPEL Process Manager is packaged with Beehive, BPEL processes can be used for true collaboration and task management.

Oracle Beehive is a true service oriented out-of-the-box collaboration infrastructure. It supports central security, audit, and policy management and supports a long list of standards-based clients.

IT Convergence Technology Services will be making a series of posts on Oracle SOA solutions on this blog throughout the year. We invite you to use the comment section to ask questions, make your own observations, or simply share ideas. You can access all SOA related posts by simply clicking on the Oracle SOA Suite tag.