39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package org.gcube.data.spd.manager;
|
|
|
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
|
import org.gcube.common.scope.api.ScopeProvider;
|
|
import org.gcube.data.spd.plugin.PluginManager;
|
|
import org.gcube.data.spd.utils.ExecutorsContainer;
|
|
import org.gcube.smartgears.ApplicationManager;
|
|
import org.gcube.smartgears.ContextProvider;
|
|
import org.gcube.smartgears.context.application.ApplicationContext;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
public class AppInitializer implements ApplicationManager {
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(AppInitializer.class);
|
|
|
|
private PluginManager pluginManager;
|
|
|
|
private ApplicationContext ctx = ContextProvider.get();
|
|
|
|
@Override
|
|
public void onInit() {
|
|
log.info("security token is "+SecurityTokenProvider.instance.get());
|
|
pluginManager = new PluginManager(ctx);
|
|
}
|
|
|
|
@Override
|
|
public void onShutdown() {
|
|
pluginManager.shutdown();
|
|
pluginManager = null;
|
|
ExecutorsContainer.stopAll();
|
|
log.info("App Initializer shut down on "+ScopeProvider.instance.get());
|
|
}
|
|
|
|
public PluginManager getPluginManager() {
|
|
return pluginManager;
|
|
}
|
|
}
|