dkpro / dkpro-uby

Framework for creating and accessing UBY resources – sense-linked lexical resources in standard UBY-LMF format
https://dkpro.github.io/dkpro-uby
Other
22 stars 3 forks source link

Add logging notice about database location #128

Open judithek opened 9 years ago

judithek commented 9 years ago

It would be nice if Uby displayed a very prominent notice when it is working from a Maven packaged database versus when it is working from the user's local database.

Recently, I followed the (outdated) tutorial code and created my Uby as below. I wanted to use my local mysql.

ExternalResourceDescription myUbyResource = ExternalResourceFactory .createExternalResourceDescription( UbyResource.class, UbyResource.PARAM_URL, "localhost/uby_open_0_6_0", UbyResource.PARAM_DRIVER, "com.mysql.jdbc.Driver", UbyResource.PARAM_LANGUAGE, "en", UbyResource.PARAM_DIALECT, "mysql", UbyResource.PARAM_USERNAME, "root", UbyResource.PARAM_PASSWORD, "pass" );

There weren't instructions anywhere to include this line: UbyResource.PARAM_MODEL_LOCATION, ResourceObjectProviderBase.NOT_REQUIRED, and if I hadn't been fixing an unrelated exception, I might not have ever discovered I was not using my local database.

I believe that instructions are in the JavaDoc of PARAM_MODEL_LOCATION.

Actually, it would be good if it was not required to set UbyResource.PARAM_MODEL_LOCATION to ResourceObjectProviderBase.NOT_REQUIRED at all. We should probably assume that if PARAM_URL is set, that PARAM_MODEL_LOCATION should not be used. I agree. We could also assume that if PARAM_USERNAME and PARAM_PASSWORD are set, it should not be necessary to set UbyResource.PARAM_MODEL_LOCATION to ResourceObjectProviderBase.NOT_REQUIRED. Btw. the information that the embedded DB is used is also logged:

UbyResource.this.getLogger().info("Using embedded database");

Also, the process of extracting the database to a temporary location is logged and where to:

UbyResource.this.getLogger().info("Extracting embedded database to [" + tmpDbFile + "]"); I still think we should find a way of doing with the ResourceObjectProviderBase.NOT_REQUIRED. We're pretty much all thinking that this is not intuitive.

If nobody has a better suggestion, then mine would be to try settings PARAM_MODEL_LOCATION to NOT_REQUIRED implicitly when PARAM_URL is set.