use of alien4cloud.plugin.model.PluginUsage in project alien4cloud by alien4cloud.
the class OrchestratorFactoriesRegistry method usage.
@Override
public List<PluginUsage> usage(String pluginId) {
// query the list of orchestrators that uses the given plugin
GetMultipleDataResult<Orchestrator> dataResult = alienDAO.search(Orchestrator.class, null, MapUtil.newHashMap(new String[] { "pluginId" }, new String[][] { new String[] { pluginId } }), Integer.MAX_VALUE);
List<PluginUsage> usages = Lists.newArrayList();
for (Orchestrator orchestrator : dataResult.getData()) {
usages.add(new PluginUsage(orchestrator.getId(), orchestrator.getName(), Orchestrator.class.getSimpleName()));
}
return usages;
}
use of alien4cloud.plugin.model.PluginUsage in project alien4cloud by alien4cloud.
the class PluginManager method disablePlugin.
/**
* Disable a plugin.
*
* @param pluginId The id of the plugin to disable.
* @param remove If true the plugin is not only disabled but also removed from the plugin repository.
* @return Empty list if the plugin was successfully disabled (and removed), or a list of usages that prevent the plugin to be disabled/removed.
*/
public List<PluginUsage> disablePlugin(String pluginId, boolean remove) {
List<PluginUsage> usages = Lists.newArrayList();
ManagedPlugin managedPlugin = pluginContexts.get(pluginId);
if (managedPlugin != null) {
for (PluginLinker linker : linkers) {
usages.addAll(safe(linker.linker.usage(pluginId)));
}
}
if (usages.isEmpty()) {
unloadPlugin(pluginId, true, remove);
}
return usages;
}
use of alien4cloud.plugin.model.PluginUsage in project alien4cloud by alien4cloud.
the class RegistryUtil method getUsages.
public static List<PluginUsage> getUsages(IGenericSearchDAO alienDAO, String pluginId) {
// query the list of repositories that uses the given plugin
GetMultipleDataResult<Repository> dataResult = alienDAO.search(Repository.class, null, MapUtil.newHashMap(new String[] { "pluginId" }, new String[][] { new String[] { pluginId } }), Integer.MAX_VALUE);
List<PluginUsage> usages = Lists.newArrayList();
for (Repository repository : dataResult.getData()) {
usages.add(new PluginUsage(repository.getId(), repository.getName(), Repository.class.getSimpleName()));
}
return usages;
}
use of alien4cloud.plugin.model.PluginUsage in project alien4cloud by alien4cloud.
the class TopologyModifierPluginLinker method usage.
@Override
public List<PluginUsage> usage(String pluginId) {
// Get all modifiers associated with a location
GetMultipleDataResult<Location> locationData = alienDAO.buildQuery(Location.class).prepareSearch().search(0, Integer.MAX_VALUE);
List<PluginUsage> usages = Lists.newArrayList();
for (Location location : locationData.getData()) {
for (LocationModifierReference locationModifierReference : safe(location.getModifiers())) {
if (pluginId.equals(locationModifierReference.getPluginId())) {
usages.add(new PluginUsage(location.getId(), location.getName(), Location.class.getSimpleName()));
}
}
}
return usages;
}
use of alien4cloud.plugin.model.PluginUsage in project alien4cloud by alien4cloud.
the class SecretProviderRegistry method usage.
@Override
public List<PluginUsage> usage(String pluginId) {
GetMultipleDataResult<Location> locationData = alienDAO.buildQuery(Location.class).prepareSearch().search(0, Integer.MAX_VALUE);
List<PluginUsage> usages = Lists.newArrayList();
for (Location location : locationData.getData()) {
SecretProviderConfiguration locationSecretProviderConfiguration = location.getSecretProviderConfiguration();
if (locationSecretProviderConfiguration != null && locationSecretProviderConfiguration.getPluginName().equals(pluginId)) {
usages.add(new PluginUsage(location.getId(), location.getName(), Location.class.getSimpleName()));
}
}
return usages;
}
Aggregations