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.ThreddsManager;
|
|
|
|
import org.gcube.spatial.data.sdi.engine.impl.cache.Cache;
|
|
|
|
import org.gcube.spatial.data.sdi.engine.impl.cache.ThreddsRetriever;
|
|
|
|
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.ThreddsConfiguration;
|
2017-08-03 12:43:53 +02:00
|
|
|
import org.gcube.spatial.data.sdi.model.services.ThreddsDefinition;
|
2017-04-11 18:07:58 +02:00
|
|
|
|
|
|
|
@Singleton
|
|
|
|
public class ThreddsManagerImpl implements ThreddsManager {
|
|
|
|
|
|
|
|
private Cache<ThreddsConfiguration> cache=null;
|
|
|
|
|
2017-08-03 12:43:53 +02:00
|
|
|
private ThreddsRetriever retriever=null;
|
|
|
|
|
2017-04-11 18:07:58 +02:00
|
|
|
public ThreddsManagerImpl() {
|
2017-08-03 12:43:53 +02:00
|
|
|
retriever=new ThreddsRetriever();
|
|
|
|
cache=Cache.getCache(retriever,
|
2017-04-11 18:07:58 +02:00
|
|
|
Long.parseLong(LocalConfiguration.get().getProperty(LocalConfiguration.THREDDS_CACHE_TTL)), "THREDDS - CACHE");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ThreddsConfiguration 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(ThreddsDefinition definition) throws ServiceRegistrationException {
|
|
|
|
return retriever.registerService(definition);
|
|
|
|
}
|
|
|
|
|
2017-04-11 18:07:58 +02:00
|
|
|
}
|