Closed danizen closed 6 years ago
See pull request
Shall we close now that your pull-request has been merged? Please confirm.
Up to you - I couldn't justify work on the government dime to do more than the minimum upstream commit. If you want to parse MongoConnectionDetails parameters in a DRY way, they might be delegated to a MongoConnectionConfig object that taxes an XMLConfiguration to parse and an EnhancedXMLWriter to write. This assures the same conventions for parsing in the Mongo data store and anything else that uses Mongo. However, given that the other is closed ... maybe not worth bothering.
I'm happy either way.
Closing then and if these latest changes prove not to be sufficient, we'll advise then.
Current Behavior
com.norconex.collector.core.data.store.impl.mongo.MongoCrawlDataStore
builds a client object during its construction, based on the details stored incom.norconex.collector.core.data.store.impl.mongo.MongoConnectionDetails
.Desired Behavior
The static method
buildMongoClient
is retained, but delegates to a similar instance method incom.norconex.collector.core.data.store.impl.mongo.MongoConnectionDetails
.The static method
buildMongoCredential
is moved tocom.norconex.collector.core.data.store.impl.mongo.MongoConnectionDetails
and may be static or become an instance method with a smaller signature.Rationale
It makes sense because
MongoConnectionDetails
already contains all information needed to create this client connection aside from the id.It has utility because any user attempting to implement a
MongoJobStatusStore
as discussed in https://github.com/Norconex/jef/issues/9 will have to implement similar logic.Technical Notes
Ideally, the the MongoConnectionDetails would implement IXMLSerializable, and
AbstractMongoCrawlDataStoreFactory
would delegate to it.Maybe a new package
com.norconex.collector.core.config
could be created to holdMongoConnectionDetails
.