dmShell

Posted: 7th August 2010 by davy in Development, Documentum

I wrote this in native Ansi C.  Mostly because its a server application designed to run on a ‘Nix platform.  dmshell was designed to allow Documentum API to be accessed from a Korn, C or Bash shell script.  I was developing  a monitoring solution for Documentum using Big Brother ( When it was Open Source – its now a commercial product ) and it uses shell scripts heavily for its customisation.   Documentum APIs are quite well supported – but I wanted something that could allow a developer who was building shell scripts to easily add Documentum API Commands.

This is the user manual

It works using a single compiled executable ( tested on AIX and Solaris ).  The executable then can be linked to known API commands.  The application sets up a Documentum session and keeps track of it – so its fully stateful.  You can call API commands like they are staeless shell commands.

The following shows a sample code block of a shell script – you simply embed the Documentum API as a shell string.  You can use the shell script substitutions to build up a full API command.  Note that the $SESSION variable works in a similar way to compiled Documentum API applications.

col_id=`dmAPIGet "query,$SESSION,$DQL"`

The following shows a full script extract with Documentum API commands being embedded into shell script strings.

Script Extract 
# define SQL for counting
DQL="SELECT * FROM dmi_queue_item"
# do duery
col_id=`dmAPIGet "query,$SESSION,$DQL"`
echo Col ID:"$col_id"END

# if query successful
if [ ! -z "$col_id" ];  then

	# loop through collection and print count
  	res=`dmAPIExec "next,$SESSION,$col_id"`

	while [ "$res" != "0" ]; do

		qname=`dmAPIGet "get,$SESSION,$col_id,name"`
		qitem=`dmAPIGet "get,$SESSION,$col_id,item_name"`
		qmess=`dmAPIGet "get,$SESSION,$col_id,message"`
		echo $qname $qitem $qmess
  		res=`dmAPIExec "next,$SESSION,$col_id"`

	done
	res=`dmAPIExec "close,$SESSION,$col_id"`
	echo "You have $count items in your inbox.\n"
else
	echo Failed......
	dmAPIGet "getmessage,$SESSION"
fi

en.pdf24.org    Send article as PDF   

You must be logged in to post a comment.