reference war file for change logs when usings Liquibase class

Hi! I don’t know if it’s possible, but I would like to use the Liquibase class embedded in an Java Update Application and want to load the changelogs from a war file.
Is it possible to use the FileOpener classes to reference the changelogs in some war file, like using the “–classpath=xy.war” option in command line?
I thought it would be nice to directly use the Liquibase class instead of starting a new system process with “java -jar…”

thx for help

derhoschi

We use liquibase programmatically within our war file so updates can be run automatically.

The Database Updater that wraps liquibase:
http://dev.openmrs.org/browser/openmrs/trunk/src/api/org/openmrs/util/DatabaseUpdater.java

Our changelog files:
http://dev.openmrs.org/browser/openmrs/trunk/metadata/model

Our UpdateFilter that runs if database changes are necessary:
http://dev.openmrs.org/browser/openmrs/trunk/src/web/org/openmrs/web/filter/update/UpdateFilter.java
(this filter is mapped to /* in our web.xml file.  No other initialization happens to other servlets, etc until this one passes)

Hmm, I think that’s not what I mean. We have an external update application which is triggered from the webapp to shutdown the tomcat, deploy new, etc.
Now I’m trying to use liquibase similar to the command line function, but using it programmatically. In this case I need to refer to the changelogs within the new war file to deploy and I don’t want it to be unpacked for that. Perhaps there is some little hint.

There isn’t a nicely packaged FileOpener for war files.  Basically what the command line version does is unpack the war file into a temp directory and add the jar files and WEB-INF/classes directories to the ClassLoaderFileOpener.

You could call the Main.main() method programatically to invoke the command line tool, or you could use similar logic to unpack the .war file.  There may be a nicer way to read classes from a .war file without unpacking it, but I did not hunt enough to find it and/or implement it.

If you find a better way, please let us know.

Nathan