Search in sources :

Example 21 with ApplicationFile

use of com.yahoo.config.application.api.ApplicationFile in project vespa by vespa-engine.

the class ZooKeeperClient method listFiles.

/**
 * Like {@link ApplicationFile#listFiles(com.yahoo.config.application.api.ApplicationFile.PathFilter)} with a slightly different semantic. Never filter out directories.
 */
private List<ApplicationFile> listFiles(ApplicationFile dir, ApplicationFile.PathFilter filter) {
    List<ApplicationFile> rawList = dir.listFiles();
    List<ApplicationFile> ret = new ArrayList<>();
    if (rawList != null) {
        for (ApplicationFile f : rawList) {
            if (f.isDirectory()) {
                ret.add(f);
            } else {
                if (filter.accept(f.getPath())) {
                    ret.add(f);
                }
            }
        }
    }
    return ret;
}
Also used : ApplicationFile(com.yahoo.config.application.api.ApplicationFile) ArrayList(java.util.ArrayList)

Example 22 with ApplicationFile

use of com.yahoo.config.application.api.ApplicationFile in project vespa by vespa-engine.

the class SessionContentHandler method getContentRequest.

private SessionContentRequestV2 getContentRequest(HttpRequest request) {
    final TenantName tenantName = Utils.getTenantNameFromSessionRequest(request);
    validateRequest(tenantName);
    long sessionId = getSessionIdV2(request);
    String contentPath = SessionContentRequestV2.getContentPath(request);
    ApplicationFile applicationFile = applicationRepository.getApplicationFileFromSession(tenantName, sessionId, contentPath, ContentRequest.getApplicationFileMode(request.getMethod()));
    return new SessionContentRequestV2(request, sessionId, tenantName, contentPath, applicationFile);
}
Also used : TenantName(com.yahoo.config.provision.TenantName) ApplicationFile(com.yahoo.config.application.api.ApplicationFile)

Example 23 with ApplicationFile

use of com.yahoo.config.application.api.ApplicationFile in project vespa by vespa-engine.

the class ZKApplicationFile method listFiles.

@Override
public List<ApplicationFile> listFiles(PathFilter filter) {
    String userPath = getZKPath(path);
    List<ApplicationFile> ret = new ArrayList<>();
    for (String zkChild : zkApp.getChildren(userPath)) {
        Path childPath = path.append(zkChild);
        // Ignore dot-files.
        if (!childPath.getName().startsWith(".") && filter.accept(childPath)) {
            ret.add(new ZKApplicationFile(childPath, zkApp));
        }
    }
    return ret;
}
Also used : Path(com.yahoo.path.Path) ApplicationFile(com.yahoo.config.application.api.ApplicationFile) ArrayList(java.util.ArrayList)

Aggregations

ApplicationFile (com.yahoo.config.application.api.ApplicationFile)23 Test (org.junit.Test)11 Path (com.yahoo.path.Path)5 ArrayList (java.util.ArrayList)3 File (java.io.File)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ApplicationPackage (com.yahoo.config.application.api.ApplicationPackage)1 ApplicationId (com.yahoo.config.provision.ApplicationId)1 TenantName (com.yahoo.config.provision.TenantName)1 IOUtils (com.yahoo.io.IOUtils)1 LogLevel (com.yahoo.log.LogLevel)1 CompressedApplicationInputStreamTest (com.yahoo.vespa.config.server.http.CompressedApplicationInputStreamTest)1 ContentHandler (com.yahoo.vespa.config.server.http.ContentHandler)1 Tenant (com.yahoo.vespa.config.server.tenant.Tenant)1 ConfigUtils (com.yahoo.vespa.config.util.ConfigUtils)1 MockCurator (com.yahoo.vespa.curator.mock.MockCurator)1 Exceptions (com.yahoo.yolean.Exceptions)1 java.io (java.io)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1