Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging notice about database location #128

Open
judithek opened this issue May 7, 2015 · 0 comments
Open

Add logging notice about database location #128

judithek opened this issue May 7, 2015 · 0 comments

Comments

@judithek
Copy link
Member

judithek commented May 7, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant