use of com.yahoo.config.application.api.ApplicationFile in project vespa by vespa-engine.
the class ZooKeeperClient method writeUserIncludeDirs.
private void writeUserIncludeDirs(ApplicationPackage applicationPackage, List<String> userIncludeDirs) throws IOException {
// User defined include directories
for (String userInclude : userIncludeDirs) {
ApplicationFile dir = applicationPackage.getFile(Path.fromString(userInclude));
final List<ApplicationFile> files = dir.listFiles();
if (files == null || files.isEmpty()) {
configCurator.createNode(getZooKeeperAppPath(ConfigCurator.USERAPP_ZK_SUBPATH + "/" + userInclude).getAbsolute());
}
writeDir(dir, getZooKeeperAppPath(ConfigCurator.USERAPP_ZK_SUBPATH + "/" + userInclude), xmlFilter, true);
}
}
use of com.yahoo.config.application.api.ApplicationFile in project vespa by vespa-engine.
the class ContentHandler method delete.
public HttpResponse delete(ContentRequest request) {
ApplicationFile file = request.getExistingFile();
deleteFile(file);
return createResponse(request);
}
use of com.yahoo.config.application.api.ApplicationFile in project vespa by vespa-engine.
the class ApplicationHandler method handleGET.
@Override
public HttpResponse handleGET(HttpRequest request) {
ApplicationId applicationId = getApplicationIdFromRequest(request);
Tenant tenant = verifyTenantAndApplication(applicationId);
if (isServiceConvergeRequest(request)) {
return applicationRepository.serviceConvergenceCheck(tenant, applicationId, getHostNameFromRequest(request), request.getUri());
}
if (isClusterControllerStatusRequest(request)) {
String hostName = getHostNameFromRequest(request);
String pathSuffix = getPathSuffix(request);
return applicationRepository.clusterControllerStatusPage(tenant, applicationId, hostName, pathSuffix);
}
if (isContentRequest(request)) {
long sessionId = applicationRepository.getSessionIdForApplication(tenant, applicationId);
String contentPath = ApplicationContentRequest.getContentPath(request);
ApplicationFile applicationFile = applicationRepository.getApplicationFileFromSession(tenant.getName(), sessionId, contentPath, ContentRequest.getApplicationFileMode(request.getMethod()));
ApplicationContentRequest contentRequest = new ApplicationContentRequest(request, sessionId, applicationId, zone, contentPath, applicationFile);
return new ContentHandler().get(contentRequest);
}
if (isServiceConvergeListRequest(request)) {
return applicationRepository.serviceListToCheckForConfigConvergence(tenant, applicationId, request.getUri());
}
if (isFiledistributionStatusRequest(request)) {
Duration timeout = HttpHandler.getRequestTimeout(request, Duration.ofSeconds(5));
return applicationRepository.filedistributionStatus(tenant, applicationId, timeout);
}
return new GetApplicationResponse(Response.Status.OK, applicationRepository.getApplicationGeneration(tenant, applicationId));
}
use of com.yahoo.config.application.api.ApplicationFile in project vespa by vespa-engine.
the class LocalSessionTest method require_that_application_file_can_be_fetched.
@Test
public void require_that_application_file_can_be_fetched() throws Exception {
LocalSession session = createSession(TenantName.defaultName(), 3);
ApplicationFile f1 = session.getApplicationFile(Path.fromString("services.xml"), LocalSession.Mode.READ);
ApplicationFile f2 = session.getApplicationFile(Path.fromString("services2.xml"), LocalSession.Mode.READ);
assertTrue(f1.exists());
assertFalse(f2.exists());
}
use of com.yahoo.config.application.api.ApplicationFile in project vespa by vespa-engine.
the class ZKApplicationFileTest method getApplicationFile.
@Override
public ApplicationFile getApplicationFile(Path path) throws IOException {
ConfigCurator configCurator = ConfigCurator.create(new MockCurator());
File tmp = Files.createTempDir();
writeAppTo(tmp);
feed(configCurator, tmp);
return new ZKApplicationFile(path, new ZKLiveApp(configCurator, Path.fromString("/0")));
}
Aggregations