My task is to design a software agent to monitor the Tamino database for data updates( create/update/delete).Is it possible to use the Tamino Client Java API for this? How? Are there in the Tamino database some triggers for this?
Because the Tamino database can be accessed directly by http, Tamino Interactive Interface or client APIs, this task may be hard, even harder if the monitor must be fast and light.
For example I can perform a “count(./ )” at every couple of minutes to check for addition/deletion of documents, but this doesn’t give me the inoids of documnets in question.And how I know about document updates?
It would be nice if Tamino supported a query by date time last updated - but as far as I know it doesn’t.
The other way that comes to mind is is to write a server extension that does something everytime that something is inserted or updated to a particular doctype.
What would it do?
Write a log entry somewhere. It would write it into Tamino. It could send an email message if the log was empty. You should write the date time into the log item otherwise you might end up with the same problem with the log you had with the data in the first place.
There should be some examples on your Tamino. On my machine they are under /examples/server extensions (My Tamino is a 3.1 so yours may be a bit differentIf you can’t find any just tell me.)
Server extensions are either COM based written in C++,VB or any COM oriented language, OR java.
The document you want to read is called
Mapping to Server Extensions
here is an extract which describes how you can supply a function that is called when a Document is stored.
The Schema Editor provides the following parameters to specify Sever Extension attributes:
Data Storage Specifies the name of the SXS Function that is to be executed when data is stored using Tamino (that is, when using the Tamino _process request). The SXS Function is called after parsing the associated element.
Well, I’m tying to develop a Tamino Agent, a Java class that can notify the rest of the system when process,update,delete… operations are performed on the database.
Such an agent must be started,stoped,restarted when is necessary.Installing a Server Extension it becomes part of the server, I can’t stop it or started again only once with the database(or can I ?!?).So my sad solution is to install/uninstall the extension every time I need too.
To do this I use the System Manager Hub “argbatch” application, I can create a Java class that runs this command in constructors or finalize methods.
So lets say that my Extension class must be use. I need to configure it to write in a socket or a file somewhere when events have occured.Well here I’m stocked! If the Tamino is the one that creates an instance of the extension class how can I pass the parameters(socket,file,etc. ) to the extension without hardcoding?
If I get You correct, you want to 1. relate your functionality to a doctype and execute it on certain events (insert/update/delete) 2. switch your functions ON/OFF on demand. 3. pass parameters to your functions.
As Nigel suggests this can be done with Server Extensions (SXS). Some hints for this: Currently Server Extensions are executed, when related to a Schema Node and certain events. The SXS is used as a mapping function, which means that it controls and is responsible for the mapping (insert/update/delete/search) on this specific node. On the other hand the SXS is executed only when the node is present in the XML instance. So, be sure to find a proper design for Your schema. Switches and parameter passing can be done using the XML Query Callback (see manual). Supply the parameters in a special doctype (use some key for identification) and request its content at SXS runtime. Make the control-flow of your SXS dependent on these parameters.
Some interesting requirements emerge from Your project: 1. Have Server Extension which are NOT mapping functions. This idea will be addressed with Tamino Version to come after 3.1, which is currently under design.
2. Configuration parameters for Server Extensions. This again is an item to be designed with the comming version.