This repository has been archived on 2021-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
2021-08-04 16:22:29 +02:00
|
|
|
package org.gcube.application.geoportal.service.engine.providers;
|
2020-11-19 17:38:56 +01:00
|
|
|
|
|
|
|
import org.gcube.application.geoportal.service.ServiceConstants;
|
|
|
|
import org.gcube.application.geoportal.service.model.internal.db.MongoConnection;
|
2021-07-30 18:21:29 +02:00
|
|
|
import org.gcube.application.geoportal.service.model.internal.faults.ConfigurationException;
|
2020-11-19 17:38:56 +01:00
|
|
|
import org.gcube.application.geoportal.service.utils.ISUtils;
|
|
|
|
|
2021-07-30 18:21:29 +02:00
|
|
|
import java.time.Duration;
|
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
|
|
2020-11-19 17:38:56 +01:00
|
|
|
public class MongoConnectionProvider extends AbstractScopedMap<MongoConnection>{
|
|
|
|
|
|
|
|
public MongoConnectionProvider() {
|
|
|
|
super("MongoDBInfo Cache");
|
|
|
|
setTTL(Duration.of(2,ChronoUnit.MINUTES));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected MongoConnection retrieveObject() throws ConfigurationException {
|
|
|
|
return ISUtils.queryForMongoDB(ServiceConstants.MONGO_SE_PLATFORM, ServiceConstants.MONGO_SE_GNA_FLAG);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void dispose(MongoConnection toDispose) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void init() {
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
|
|
}
|