knowing / Medmon

Medical Monitoring
5 stars 0 forks source link

Set derby-database directory in persistence.xml or programmatically to {user.home} #14

Closed muuki88 closed 13 years ago

muuki88 commented 13 years ago

Look for placeholders for persistence.xml to set the embeddedDerby database directory correctly.

Current setting is

However the location for the folder "medmon" is different for each OS.

  • Ubuntu uses /home/{user}/Desktop
  • Windows 7 -> unkown (!)

If it's not possible to set the directory via the persistence.xml, the EntityManagerFactory must be created programmtically. -> Look into Gemini JPA -> Look into Gemini DBAccess -> EntityManagerFactoryBuilderService

-> Maybe change IEntityManagerService in medic.core plugin.

locked-fg commented 13 years ago

Win 7: {user.home}/AppData/Local/{application name} http://www.blogtechnika.com/what-is-application-data-folder-in-windows-7 http://en.wikipedia.org/wiki/Environment_variable

Win XP: {user.home}/Application Data/{application name}

muuki88 commented 13 years ago

That's what we thought too. This is all a bit strange, as on Ubuntu the application folder is /home/{user}/ and not /home/{user}/Desktop.

Beside that the Windows 7 search wasn't able to find the medmon folder. Like it was created in a very special places. This needs truly some investigation.

locked-fg commented 13 years ago

"The \AppData folder & sub folders are not included in the indexed locations, due to the thousands of files that can reside there."

http://answers.microsoft.com/en-us/windows/forum/windows_7-files/windows-7-search-does-not-find-appdata-files/0f04921d-ce8d-4492-9360-42bf1e4f3bf8

muuki88 commented 13 years ago

Derby has it's own system property which needs to be set. Needs testing if this doesn't fail with other applications running embedded derby.

references: http://www.stuartellis.eu/articles/derby-javadb/#derby-dbs http://stackoverflow.com/questions/4999106/fail-to-create-embedded-derby-java

muuki88 commented 13 years ago

Found the solution. As usual eclipse got some neat stuff: VM-Arguments: -Dderby.system.home=${system_property:user.home}${system_property:file.separator}".derby"

the $(system_property:) placeholder gets replaced by the corresponding system property.

derby.system.home looks for me: /home/muki/.derby

muuki88 commented 13 years ago

Fixed in master

locked-fg commented 13 years ago

This also works if medmon is deployed and not only started in dev environments?

muuki88 commented 13 years ago

Yeah. This is the fancy part. Eclipse has it's own config.ini where application and JVM parameters are stored.