2017-04-11 18:07:58 +02:00
|
|
|
package org.gcube.spatial.data.sdi.engine.impl;
|
|
|
|
|
|
|
|
import javax.inject.Singleton;
|
|
|
|
|
|
|
|
import org.gcube.spatial.data.sdi.LocalConfiguration;
|
|
|
|
import org.gcube.spatial.data.sdi.engine.GeoNetworkManager;
|
|
|
|
import org.gcube.spatial.data.sdi.engine.impl.cache.Cache;
|
|
|
|
import org.gcube.spatial.data.sdi.engine.impl.cache.GeoNetworkRetriever;
|
|
|
|
import org.gcube.spatial.data.sdi.engine.impl.faults.ConfigurationNotFoundException;
|
2017-08-03 12:43:53 +02:00
|
|
|
import org.gcube.spatial.data.sdi.engine.impl.faults.ServiceRegistrationException;
|
|
|
|
import org.gcube.spatial.data.sdi.model.health.ServiceHealthReport;
|
2017-04-11 18:07:58 +02:00
|
|
|
import org.gcube.spatial.data.sdi.model.service.GeoNetworkConfiguration;
|
2017-08-03 12:43:53 +02:00
|
|
|
import org.gcube.spatial.data.sdi.model.services.GeoNetworkServiceDefinition;
|
2017-04-11 18:07:58 +02:00
|
|
|
|
|
|
|
@Singleton
|
|
|
|
public class GeoNetworkManagerImpl implements GeoNetworkManager {
|
|
|
|
|
|
|
|
private Cache<GeoNetworkConfiguration> cache=null;
|
2017-08-03 12:43:53 +02:00
|
|
|
private GeoNetworkRetriever retriever=null;
|
2017-04-11 18:07:58 +02:00
|
|
|
|
|
|
|
public GeoNetworkManagerImpl() {
|
2017-08-03 12:43:53 +02:00
|
|
|
retriever=new GeoNetworkRetriever();
|
|
|
|
cache=Cache.getCache(retriever,
|
2017-04-11 18:07:58 +02:00
|
|
|
Long.parseLong(LocalConfiguration.get().getProperty(LocalConfiguration.GEONETWORK_CACHE_TTL)),"GeoNetwork - cache");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public GeoNetworkConfiguration getConfiguration() throws ConfigurationNotFoundException {
|
|
|
|
return cache.get();
|
|
|
|
}
|
|
|
|
|
2017-08-03 12:43:53 +02:00
|
|
|
@Override
|
|
|
|
public ServiceHealthReport getHealthReport() {
|
|
|
|
return retriever.getHealthReport();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String registerService(GeoNetworkServiceDefinition definition) throws ServiceRegistrationException {
|
|
|
|
return retriever.registerService(definition);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-04-11 18:07:58 +02:00
|
|
|
}
|