Search in sources :

Example 1 with PluginUsage

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;
}
Also used : PluginUsage(alien4cloud.plugin.model.PluginUsage) Orchestrator(alien4cloud.model.orchestrators.Orchestrator)

Example 2 with PluginUsage

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;
}
Also used : PluginUsage(alien4cloud.plugin.model.PluginUsage) ManagedPlugin(alien4cloud.plugin.model.ManagedPlugin)

Example 3 with PluginUsage

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;
}
Also used : Repository(alien4cloud.model.repository.Repository) PluginUsage(alien4cloud.plugin.model.PluginUsage)

Example 4 with PluginUsage

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;
}
Also used : LocationModifierReference(alien4cloud.model.orchestrators.locations.LocationModifierReference) PluginUsage(alien4cloud.plugin.model.PluginUsage) Location(alien4cloud.model.orchestrators.locations.Location)

Example 5 with PluginUsage

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;
}
Also used : PluginUsage(alien4cloud.plugin.model.PluginUsage) Location(alien4cloud.model.orchestrators.locations.Location) SecretProviderConfiguration(alien4cloud.model.secret.SecretProviderConfiguration)

Aggregations

PluginUsage (alien4cloud.plugin.model.PluginUsage)5 Location (alien4cloud.model.orchestrators.locations.Location)2 Orchestrator (alien4cloud.model.orchestrators.Orchestrator)1 LocationModifierReference (alien4cloud.model.orchestrators.locations.LocationModifierReference)1 Repository (alien4cloud.model.repository.Repository)1 SecretProviderConfiguration (alien4cloud.model.secret.SecretProviderConfiguration)1 ManagedPlugin (alien4cloud.plugin.model.ManagedPlugin)1