[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [geomesa-users] Invalid method name: 'beginFateOperation' when creating a table
|
Hi Luca,
I'd second Emilio's suggestion that getSchema is the best way to check
if a GeoMesa table exists. As a detail, our current implementation
makes that check during createSchema:
https://github.com/locationtech/geomesa/blob/accumulo1.5.x/1.x/geomesa-core/src/main/scala/org/locationtech/geomesa/core/data/AccumuloDataStore.scala#L378-383.
I won't promise that such implementation details will remain the same.
As such, a defensive programmer would add a similar check and call
createSchema if necessary. My preference is to suggest that rather
recovering from an exception.
All that said, your point about the type of exception is excellent. We
conform to the GeoTools DataStore api, and they declare that
IOExceptions can come from getFeatureSource. Initially, we thought that
an IOException was a tad unusually, but we did found precedence in the
GeoTools codebase for an IOException stating a table was not created.
Anyhow, we've pushed a fix for this to the accumulo1.5/1.x branch. In
general, our goal is to make sure that Java developers can use GeoMesa
as naturally as possible. I definitely appreciate the feedback.
Thanks,
Jim
On 03/25/2015 08:44 AM, Emilio Lahr-Vivaz wrote:
Hi Luca,
You raise a good point. We do all of our development in scala, which
doesn't have typed exceptions, so we sometimes lose sight of what
exceptions are appropriate. However, in this particular case, I would
think some type of runtime exception would be appropriate - maybe a
NullPointerException since the value was null or an
IllegalArgumentException since the feature type does not exist. I
would think IOException would be reserved for when something goes
wrong with e.g. our connection to accumulo. Maybe others on the list
can chime in with what they would expect.
For your particular use case, you can call getSchema(featureName),
which will return null if the feature has not been created, as per the
DataStore interface.
Thanks,
Emilio
On 03/25/2015 01:08 AM, Luca Morandini wrote:
On 24/03/15 23:21, Emilio Lahr-Vivaz wrote:
Hi Luca,
It definitely seems like a classpath issue. It appears from the
stack trace that
you have an accumulo 1.6 jar on your classpath somewhere.
Indeed I had a wrong property in my POM, thanks for the quick reply.
Bear with me, for I have another issue:
I wanted to check the existence of a table before creating it;
therefore, I added this line:
SimpleFeatureSource featureSource =
dataStore.getFeatureSource(options
.get(ftName));
To my surprise, an RTE was raised:
Exception in thread "main" java.lang.RuntimeException: Feature 'null'
has not been initialized. Please call 'createSchema' first.
I looked in the GeoMesa source code, and found this in
AccumuloDataStore.scala:
protected def validateMetadata(featureName: String): Unit = {
metadata.read(featureName, ATTRIBUTES_KEY)
.getOrElse(throw new RuntimeException(s"Feature '$featureName'
has not been initialized. Please call 'createSchema' first."))
Well, must it really be an RTE ? Should not a missing featureSource
be a recoverable exception (such as IOException), hence forced to be
declared in the calling methods/functions ?
Regards,
Luca Morandini
Data Architect - AURIN project
Melbourne eResearch Group
Department of Computing and Information Systems
University of Melbourne
Tel. +61 03 903 58 380
Skype: lmorandini
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
http://www.locationtech.org/mailman/listinfo/geomesa-users
_______________________________________________
geomesa-users mailing list
geomesa-users@xxxxxxxxxxxxxxxx
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
http://www.locationtech.org/mailman/listinfo/geomesa-users