use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class TenantRequestHandler method setLiveApp.
private void setLiveApp(ApplicationSet applicationSet) {
ApplicationId id = applicationSet.getId();
final Collection<String> hostsForApp = applicationSet.getAllHosts();
hostRegistry.update(id, hostsForApp);
applicationSet.updateHostMetrics();
tenantMetricUpdater.setApplications(applicationMapper.numApplications());
applicationMapper.register(id, applicationSet);
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class TenantRequestHandler method removeApplicationsExcept.
@Override
public void removeApplicationsExcept(Set<ApplicationId> applications) {
for (ApplicationId activeApplication : applicationMapper.listApplicationIds()) {
if (!applications.contains(activeApplication)) {
log.log(LogLevel.INFO, "Will remove deleted application " + activeApplication.toShortString());
removeApplication(activeApplication);
}
}
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class SuperModelConfigProvider method getConfig.
public <CONFIGTYPE extends ConfigInstance> CONFIGTYPE getConfig(Class<CONFIGTYPE> configClass, ApplicationId applicationId, String configId) {
TenantName tenant = applicationId.tenant();
if (!superModel.getAllModels().containsKey(tenant)) {
throw new IllegalArgumentException("Tenant " + tenant + " not found");
}
Map<ApplicationId, ApplicationInfo> applications = superModel.getAllModels().get(tenant);
if (!applications.containsKey(applicationId)) {
throw new IllegalArgumentException("Application id " + applicationId + " not found");
}
ApplicationInfo application = applications.get(applicationId);
ConfigKey<CONFIGTYPE> key = new ConfigKey<>(configClass, configId);
ConfigPayload payload = application.getModel().getConfig(key, null);
return payload.toInstance(configClass, configId);
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ApplicationHandler method handleDELETE.
@Override
public HttpResponse handleDELETE(HttpRequest request) {
ApplicationId applicationId = getApplicationIdFromRequest(request);
boolean removed = applicationRepository.remove(applicationId);
if (!removed)
return HttpErrorResponse.notFoundError("Unable to delete " + applicationId + ": Not found");
return new DeleteApplicationResponse(Response.Status.OK, applicationId);
}
use of com.yahoo.config.provision.ApplicationId in project vespa by vespa-engine.
the class ApplicationHandler method handlePOST.
@Override
public HttpResponse handlePOST(HttpRequest request) {
ApplicationId applicationId = getApplicationIdFromRequest(request);
Tenant tenant = verifyTenantAndApplication(applicationId);
if (request.getUri().getPath().endsWith("restart"))
return restart(request, applicationId);
if (request.getUri().getPath().endsWith("log"))
return grabLog(request, applicationId, tenant);
throw new NotFoundException("Illegal POST request '" + request.getUri() + "': Must end by /restart or /log");
}
Aggregations