Search in sources :

Example 6 with Orchestrator

use of alien4cloud.model.orchestrators.Orchestrator 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 7 with Orchestrator

use of alien4cloud.model.orchestrators.Orchestrator in project alien4cloud by alien4cloud.

the class OrchestratorService method getArtifactSupport.

/**
 * Get the artifact support information for a given orchestrator.
 *
 * @param orchestratorId The id of the orchestrator for which to get location support information.
 * @return artifact support information.
 */
public ArtifactSupport getArtifactSupport(String orchestratorId) {
    Orchestrator orchestrator = getOrFail(orchestratorId);
    IOrchestratorPluginFactory orchestratorFactory = getPluginFactory(orchestrator);
    return orchestratorFactory.getArtifactSupport();
}
Also used : IOrchestratorPluginFactory(alien4cloud.orchestrators.plugin.IOrchestratorPluginFactory) Orchestrator(alien4cloud.model.orchestrators.Orchestrator)

Example 8 with Orchestrator

use of alien4cloud.model.orchestrators.Orchestrator in project alien4cloud by alien4cloud.

the class OrchestratorStateService method unloadAllOrchestrators.

/**
 * Unload all orchestrators from JVM memory, it's typically to refresh/reload code
 */
public void unloadAllOrchestrators() {
    List<Orchestrator> enabledOrchestratorList = orchestratorService.getAllEnabledOrchestrators();
    if (enabledOrchestratorList != null && !enabledOrchestratorList.isEmpty()) {
        log.info("Unloading orchestrators");
        for (final Orchestrator orchestrator : enabledOrchestratorList) {
            // un-register the orchestrator.
            IOrchestratorPlugin orchestratorInstance = orchestratorPluginService.unregister(orchestrator.getId());
            if (orchestratorInstance != null) {
                IOrchestratorPluginFactory orchestratorFactory = orchestratorService.getPluginFactory(orchestrator);
                orchestratorFactory.destroy(orchestratorInstance);
            }
        }
        log.info("{} Orchestrators Unloaded", enabledOrchestratorList.size());
    }
}
Also used : IOrchestratorPluginFactory(alien4cloud.orchestrators.plugin.IOrchestratorPluginFactory) Orchestrator(alien4cloud.model.orchestrators.Orchestrator) IOrchestratorPlugin(alien4cloud.orchestrators.plugin.IOrchestratorPlugin)

Example 9 with Orchestrator

use of alien4cloud.model.orchestrators.Orchestrator in project alien4cloud by alien4cloud.

the class LocationMatchingConfigurationService method getMatchingConfiguration.

/**
 * Get the matching configuration for a given location.
 *
 * @param location The location for which to get the configuration.
 * @return A map nodetype, matching configuration to be used for matching.
 */
public Map<String, MatchingConfiguration> getMatchingConfiguration(Location location) {
    Orchestrator orchestrator = orchestratorService.getOrFail(location.getOrchestratorId());
    IOrchestratorPlugin orchestratorInstance = (IOrchestratorPlugin) orchestratorPluginService.get(orchestrator.getId());
    if (orchestratorInstance == null) {
        return null;
    }
    ILocationConfiguratorPlugin configuratorPlugin = orchestratorInstance.getConfigurator(location.getInfrastructureType());
    return configuratorPlugin.getMatchingConfigurations();
}
Also used : ILocationConfiguratorPlugin(alien4cloud.orchestrators.plugin.ILocationConfiguratorPlugin) Orchestrator(alien4cloud.model.orchestrators.Orchestrator) IOrchestratorPlugin(alien4cloud.orchestrators.plugin.IOrchestratorPlugin)

Example 10 with Orchestrator

use of alien4cloud.model.orchestrators.Orchestrator in project alien4cloud by alien4cloud.

the class OrchestratorController method search.

@ApiOperation(value = "Search for orchestrators.")
@RequestMapping(method = RequestMethod.GET)
@PreAuthorize("isAuthenticated()")
public RestResponse<GetMultipleDataResult<Orchestrator>> search(@ApiParam(value = "Query text.") @RequestParam(required = false) String query, @ApiParam(value = "If true only connected orchestrators will be retrieved.") @RequestParam(required = false, defaultValue = "false") boolean connectedOnly, @ApiParam(value = "Query from the given index.") @RequestParam(required = false, defaultValue = "0") int from, @ApiParam(value = "Maximum number of results to retrieve.") @RequestParam(required = false, defaultValue = "20") int size) {
    FilterBuilder authorizationFilter = AuthorizationUtil.getResourceAuthorizationFilters();
    OrchestratorState filterStatus = connectedOnly ? OrchestratorState.CONNECTED : null;
    GetMultipleDataResult<Orchestrator> result = orchestratorService.search(query, filterStatus, from, size, authorizationFilter);
    return RestResponseBuilder.<GetMultipleDataResult<Orchestrator>>builder().data(result).build();
}
Also used : OrchestratorState(alien4cloud.model.orchestrators.OrchestratorState) FilterBuilder(org.elasticsearch.index.query.FilterBuilder) GetMultipleDataResult(alien4cloud.dao.model.GetMultipleDataResult) Orchestrator(alien4cloud.model.orchestrators.Orchestrator) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Orchestrator (alien4cloud.model.orchestrators.Orchestrator)28 IOrchestratorPluginFactory (alien4cloud.orchestrators.plugin.IOrchestratorPluginFactory)7 Location (alien4cloud.model.orchestrators.locations.Location)6 IOrchestratorPlugin (alien4cloud.orchestrators.plugin.IOrchestratorPlugin)5 ApiOperation (io.swagger.annotations.ApiOperation)4 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 OrchestratorConfiguration (alien4cloud.model.orchestrators.OrchestratorConfiguration)3 LocationResourceTemplate (alien4cloud.model.orchestrators.locations.LocationResourceTemplate)3 Test (org.junit.Test)3 Audit (alien4cloud.audit.annotation.Audit)2 GetMultipleDataResult (alien4cloud.dao.model.GetMultipleDataResult)2 ILocationMatch (alien4cloud.model.deployment.matching.ILocationMatch)2 LocationMatch (alien4cloud.model.deployment.matching.LocationMatch)2 AbstractLocationResourceTemplate (alien4cloud.model.orchestrators.locations.AbstractLocationResourceTemplate)2 LocationResources (alien4cloud.model.orchestrators.locations.LocationResources)2 PolicyLocationResourceTemplate (alien4cloud.model.orchestrators.locations.PolicyLocationResourceTemplate)2 ILocationConfiguratorPlugin (alien4cloud.orchestrators.plugin.ILocationConfiguratorPlugin)2 LocationMatchingException (alien4cloud.paas.exception.LocationMatchingException)2 LocationPolicyTask (alien4cloud.topology.task.LocationPolicyTask)2