I know about Guard Gem which can keep listening to changes to a file and trigger a script based on the change (though i have never used it). .
But right now that is not exactly what i need . .I need a similar tool to keep listening to the changes in a particular table in the database . .I need to trigger a script if there is any change . .
Additional Details
I'm using a tool called Jasper Server which is basically a reporting engine. . It runs as a webapp on top of tomcat . .
It is very convenient while designing a new report to add most of the features through the User Interface . .However as I make changes the changes are stored locally in the table named jasperserver(I presently use PostgreSQL, probably it is very similar with other db's).
So whenever i need to take a copy of my report , i have to do
$JASPER_HOME/buildomatic/js-export.sh --uris Path/In/JasperServer --output-dir Path/In/FileSystem
This takes the picture of the jasperserver table and creates the Report folder. .Which can be deployed on other machines . .
However i find that this is a manual step i feel that there has to be some way to automate this process . .So i was wondering if there is any tool to guard the database rather than a plain file. .
Any Suggestions . .Please reply . .
The export script does not take an image of the database table but creates a descriptor of the report configuration in JasperReports Server. If you look at the --output-dir you will find XML file describing the report configuration, data files holding all contents, descriptions of input controls, datasource etc. These configurations are exported into a database independent XML format and involve ~20 tables in the JasperReports Server database. So monitoring a particular table would not address your requirement, e.g.
JIResource
table - all new repository elements (such as folders, temp files, other resources) would trigger the monitor. JIResource
holds the URI you'd need for your export.JIReportUnit
table you'd see all new report units, however, you'd need to then do some query to retrieve the information about the URI that you'd need for the export. In general it is bad practice to use an application's database directly, better would be to utilize the API's the application comes with.
So from my understanding there are two options:
solution based on a workflow - i.e. when a new report is uploaded, manually kick off the export (the latest release supports export via frontend which might simplify your use case).
solution based on a customization of the server products where you e.g. extend the save report workflow to kick of additional actions during save.