Skip to main content

Manipulation Oracle Bpm directory with FDI api

The BPM Directory is an information repository. It stores configuration information about a BPM Environment. This repository is a fundamental component of the BPM Environment; a BPM Environment cannot exist without a BPM Directory. All the users information and organizational unit information maintains on BPM directory. Oracle BPM also provides API named FDI to CRUD operations on these information. For more additional information see here. In this current post, i will provide sample java code which will help to quick start with FDI.
Fdi Api is not public api to use, for these reason only a few reference found on the web. Oracle BPM Standard Components Reference provides most of the information to working with FDI. For example purpose, i will use Bpm Standalone Enterprise server directory.xml. To run standalone client we have to need following libraries on class path:
  • fuegopapi-client.jar
  • b1oracle.jar
  • b1base.jar
  • b1util.jar
  • b1resource.jar

Here is my maven pom.xml file
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ru.fors.nsi.bpm.proxy</groupId>
<artifactId>bpmproxy</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>bpmproxy</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fuego</groupId>
<artifactId>fuegopapi-client</artifactId>
<version>6.5.0</version>
<!--<scope>provided</scope>-->  
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>albpm.jdbc.oracle</groupId>
<artifactId>b1oracle</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>albpm.jdbc.base</groupId>
<artifactId>b1base</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>albpm.util</groupId>
<artifactId>b1util</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.1</version>
</dependency>
<!--<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<skip>true</skip>
</configuration>
</plugin>          
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>      
</build>
</project>

Here is my directory.xml, which must be on classpath.
<?xml version="1.0" encoding="UTF-8"?>
<?fuego version="6.5.1" build="94375"?>
<DirectoryConfiguration>
<id>default</id>
<description>Default Directory Configuration</description>
<admin>admin</admin>
<adminPass><encrypted>uPgrjqI482A=</adminPass>
<presets>
<preset name="engine">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
<preset name="xobjects">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
<preset name="portal-anonymous">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
<preset name="datawarehouse">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
<preset name="papiws-anonymous">
<property name="participant" value="admin"/>
<property name="participant_password" value="<encrypted>uPgrjqI482A="/>
</preset>
</presets>
<set>
<configuration name="fuego" type="SQL" subtype="DDORACLE">
<property name="jdbc.pool.idle_timeout" value="5"/>
<property name="jdbc.pool.entry.max" value="10"/>
<property name="oracle.dateEqualsTimestamp" value="false"/>
<property name="jdbc.host" value="xyz"/>
<property name="user" value="OBPMDirLocal"/>
<property name="jdbc.port" value="1521"/>
<property name="jdbc.pool.min" value="0"/>
<property name="jdbc.pool.maxopencursors" value="100"/>
<property name="oracle.sid" value="ftsdb"/>
<property name="password" value="<encrypted>ko8PrHu2UJLLicio"/>
<property name="jdbc.xa" value="false"/>
<property name="jdbc.pool.max" value="10"/>
</configuration>
</set>
</DirectoryConfiguration>



Next, it's time for java coding
package ru.fors.bpm.client;

import fuego.directory.*;
import fuego.directory.exception.ProtocolNotSupportedException;


import java.util.Properties;

public class FdiClient {
public FdiClient(){}
private static DirectorySession directorySession;
static{
Properties configuration = new Properties();
/*Configuration for Standalone*/
configuration.setProperty( "fuego.custom.replication.config.directoryId", "default");
configuration.setProperty("fuego.custom.replication.config.directoryFile", "directory.xml");
configuration.setProperty("fuego.custom.replication.config.preset", "engine");
try {
DirectoryConfigurationManager.getRuntime("default").setPropertiesFileName(configuration.getProperty("fuego.custom.replication.config.directoryFile").trim());
DirectoryPassport directoryPassport = DirectoryPassport.createWithIDAndPreset(configuration.getProperty("fuego.custom.replication.config.directoryId").trim(), configuration.getProperty("fuego.custom.replication.config.preset").trim());

directoryPassport.fillPassport();

directorySession = Directory.startAdminSession(directoryPassport);

}catch (ProtocolNotSupportedException e) {
e.printStackTrace();
}catch (AuthenticationException e) {
e.printStackTrace();
}catch(DirectoryException e){
e.printStackTrace();
}
}
private void disconnect () throws DirectoryException{
if(directorySession.isConnected()){
directorySession.disconnect();
}
}
private void createParticipant (final String participantName, final String participantDisplayName, final String password) throws Exception{
if(!directorySession.isConnected()){
throw new Exception ("session already closed..");
}
// fetch Role
DirOrganizationalRole nsiRoles = DirOrganizationalRole.fetch(directorySession, "Controller");

fuego.directory.DirHumanParticipant.RoleAssignment role = new DirHumanParticipant.RoleAssignment(nsiRoles.getId(), 255, nsiRoles.getIn());

DirHumanParticipant participant = DirHumanParticipant.create(directorySession,
participantName,
participantDisplayName,
participantName,
participantDisplayName,
"fts@mydomain.com", "", "",
password, DirOrganizationalUnit.fetchRoot(directorySession) , new DirHumanParticipant.RoleAssignment[]{ role } );

System.out.println("Participant create:"+ participant.getStatus());
}
private void changedPassword(final String oldPassWord, final String newPassword) throws Exception{
if(!directorySession.isConnected()){
throw new Exception ("session already closed..");
}
DirHumanParticipant part = DirHumanParticipant.fetch(directorySession, "test23");
part.changePassword(oldPassWord, newPassword);
System.out.println("Status:"+part.getStatus());

}
private DirHumanParticipant getParticipant(final String name) {
if(!directorySession.isConnected()){
throw new Exception ("session already closed..");
}
return DirHumanParticipant.fetch(directorySession, name);
}
public static void main(String[] args) throws Exception{
System.out.println("FDI - connect to Oracle BPM directory Service...");
FdiClient client = new FdiClient();
//client.createParticipant("test23", "test23","123456");
//client.changedPassword("123456","654321");
DirHumanParticipant part =  client.getParticipant("part2");
System.out.println("Status:"+ part.getPermissions());
client.disconnect();
}
}

On the above code permission 255 is a binary mask, from the api reference
Fuego.Fdi.DirHumanParticipant.getPermissionValue would be as follows:
"X" Execute 1
"R" Route 2
"S" Suspend 4
"A" Abort 8
"D" Delegate 16
"G" Grab (re-assign) 32
"E" Escalate 64
"P" Peer assign 128
For example, if you have XEP, then the integer value would be 1 + 64 + 128 = 193, and then all values are XRSADGEP = 255
Additional links:
1) Creating Oracle BPM PAPI Clients
2) Oracle forum thread

Comments

Popular posts from this blog

8 things every developer should know about the Apache Ignite caching

Any technology, no matter how advanced it is, will not be able to solve your problems if you implement it improperly. Caching, precisely when it comes to the use of a distributed caching, can only accelerate your application with the proper use and configurations of it. From this point of view, Apache Ignite is no different, and there are a few steps to consider before using it in the production environment. In this article, we describe various technics that can help you to plan and adequately use of Apache Ignite as cutting-edge caching technology. Do proper capacity planning before using Ignite cluster. Do paperwork for understanding the size of the cache, number of CPUs or how many JVMs will be required. Let’s assume that you are using Hibernate as an ORM in 10 application servers and wish to use Ignite as an L2 cache. Calculate the total memory usages and the number of Ignite nodes you have to need for maintaining your SLA. An incorrect number of the Ignite nodes can become a b...

Benchmarking high performance java collection framework

I am an ultimate fan of java high performance framework or library. Java native collection framework always works with primitive wrapper class such as Integer, Float e.t.c. Boxing and unboxing of wrapper class to primitive data type always decrease the java execution performance. Most of us, always looking for such a library or framework to works with primitive data type in collections for increasing performance of Java application. Most of the time i uses javolution framework to get better performance, however, this holiday i have read about a few new java collections frameworks and decided to do some homework benchmarking to find out, how much they could better than Java native collection framework. I have examine two new java collection framework, one of them are fastutil and another one are HPPC. For benchmarking i have used java JMH with mode Throughput. For benchmarking i took similar collection for java ArrayList, HashSet and HasMap from two above described frameworks. Col...

Apache Ignite Baseline Topology by Examples

Ignite Baseline Topology or BLT represents a set of server nodes in the cluster that persists data on disk. Where, N1-2 and N5 server nodes are the member of the Ignite clusters with native persistence which enable data to persist on disk. N3-4 and N6 server nodes are the member of the Ignite cluster but not a part of the baseline topology. The nodes from the baseline topology are a regular server node, that store's data in memory and on the disk, and also participates in computing tasks. Ignite clusters can have different nodes that are not a part of the baseline topology such as: Server nodes that are not used Ignite native persistence to persist data on disk. Usually, they store data in memory or persists data to a 3rd party database or NoSQL. In the above equitation, node N3 or N4 might be one of them. Client nodes that are not stored shared data. To better understand the baseline topology concept, let’s start at the beginning and try to understand its goal and what ...