Search in sources :

Example 1 with DavResourceFactory

use of org.apache.jackrabbit.webdav.DavResourceFactory in project archiva by apache.

the class RepositoryServlet method initServers.

public synchronized void initServers(ServletConfig servletConfig) throws RepositoryAdminException {
    long start = System.currentTimeMillis();
    WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletConfig.getServletContext());
    configuration = wac.getBean("archivaConfiguration#default", ArchivaConfiguration.class);
    configuration.addListener(this);
    managedRepositoryAdmin = wac.getBean(ManagedRepositoryAdmin.class);
    repositoryMap = managedRepositoryAdmin.getManagedRepositoriesAsMap();
    for (ManagedRepository repo : repositoryMap.values()) {
        Path repoDir = Paths.get(repo.getLocation());
        if (!Files.exists(repoDir)) {
            try {
                Files.createDirectories(repoDir);
            } catch (IOException e) {
                log.info("Unable to create missing directory for {}", repo.getLocation());
                continue;
            }
        }
    }
    resourceFactory = wac.getBean("davResourceFactory#archiva", DavResourceFactory.class);
    locatorFactory = new ArchivaDavLocatorFactory();
    ServletAuthenticator servletAuth = wac.getBean(ServletAuthenticator.class);
    HttpAuthenticator httpAuth = wac.getBean("httpAuthenticator#basic", HttpAuthenticator.class);
    sessionProvider = new ArchivaDavSessionProvider(servletAuth, httpAuth);
    long end = System.currentTimeMillis();
    log.debug("initServers done in {} ms", (end - start));
}
Also used : Path(java.nio.file.Path) ManagedRepository(org.apache.archiva.admin.model.beans.ManagedRepository) DavResourceFactory(org.apache.jackrabbit.webdav.DavResourceFactory) ServletAuthenticator(org.apache.archiva.security.ServletAuthenticator) ManagedRepositoryAdmin(org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin) HttpAuthenticator(org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator) IOException(java.io.IOException) ArchivaConfiguration(org.apache.archiva.configuration.ArchivaConfiguration) WebApplicationContext(org.springframework.web.context.WebApplicationContext)

Aggregations

IOException (java.io.IOException)1 Path (java.nio.file.Path)1 ManagedRepository (org.apache.archiva.admin.model.beans.ManagedRepository)1 ManagedRepositoryAdmin (org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin)1 ArchivaConfiguration (org.apache.archiva.configuration.ArchivaConfiguration)1 HttpAuthenticator (org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator)1 ServletAuthenticator (org.apache.archiva.security.ServletAuthenticator)1 DavResourceFactory (org.apache.jackrabbit.webdav.DavResourceFactory)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1