You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
geoportal-service/src/main/java/org/gcube/application/geoportal/service/engine/ImplementationProvider.java

61 lines
1.4 KiB
Java

package org.gcube.application.geoportal.service.engine;
import org.gcube.application.geoportal.managers.AbstractRecordManager;
import org.gcube.application.geoportal.managers.EMFProvider;
import org.gcube.application.geoportal.service.engine.cache.MongoClientProvider;
import org.gcube.application.geoportal.service.engine.cache.MongoConnectionProvider;
import lombok.Getter;
import lombok.Setter;
import lombok.Synchronized;
public class ImplementationProvider {
private static ImplementationProvider instance=null;
@Synchronized
public static ImplementationProvider get() {
if(instance==null) {
instance=new ImplementationProvider();
}
return instance;
}
@Getter
@Setter
private MongoConnectionProvider mongoConnectionProvider=new MongoConnectionProvider();
@Getter
@Setter
private MongoClientProvider mongoClientProvider=new MongoClientProvider();
@Getter
@Setter
private StorageClientProvider storageProvider=new StorageClientProvider();
@Getter
@Setter
private EMFProvider emfProvider=new ScopedEMFProvider();
@Getter
@Setter
private StorageHubProvider sHubProvider=new StorageHubProvider();
public void shutdown() {
// Stop JPA
AbstractRecordManager.shutdown();
mongoConnectionProvider.shustdown();
mongoClientProvider.shustdown();
}
public void startup() {
AbstractRecordManager.setDefaultProvider(emfProvider);
mongoConnectionProvider.init();
mongoClientProvider.init();
}
}