1 package org.apache.archiva.webdav;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.archiva.admin.model.RepositoryAdminException;
23 import org.apache.archiva.admin.model.beans.RemoteRepository;
24 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
25 import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
26 import org.apache.archiva.audit.Auditable;
27 import org.apache.archiva.common.filelock.FileLockManager;
28 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
29 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
30 import org.apache.archiva.common.utils.PathUtil;
31 import org.apache.archiva.common.utils.VersionUtil;
32 import org.apache.archiva.configuration.ArchivaConfiguration;
33 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
34 import org.apache.archiva.indexer.merger.IndexMerger;
35 import org.apache.archiva.indexer.merger.IndexMergerException;
36 import org.apache.archiva.indexer.merger.IndexMergerRequest;
37 import org.apache.archiva.indexer.merger.MergedRemoteIndexesTask;
38 import org.apache.archiva.indexer.merger.MergedRemoteIndexesTaskRequest;
39 import org.apache.archiva.indexer.merger.TemporaryGroupIndex;
40 import org.apache.archiva.indexer.search.RepositorySearch;
41 import org.apache.archiva.indexer.search.RepositorySearchException;
42 import org.apache.archiva.maven2.metadata.MavenMetadataReader;
43 import org.apache.archiva.metadata.model.facets.AuditEvent;
44 import org.apache.archiva.metadata.repository.storage.RelocationException;
45 import org.apache.archiva.metadata.repository.storage.RepositoryStorage;
46 import org.apache.archiva.model.ArchivaRepositoryMetadata;
47 import org.apache.archiva.model.ArtifactReference;
48 import org.apache.archiva.policies.ProxyDownloadException;
49 import org.apache.archiva.proxy.ProxyRegistry;
50 import org.apache.archiva.proxy.model.RepositoryProxyHandler;
51 import org.apache.archiva.redback.authentication.AuthenticationException;
52 import org.apache.archiva.redback.authentication.AuthenticationResult;
53 import org.apache.archiva.redback.authorization.AuthorizationException;
54 import org.apache.archiva.redback.authorization.UnauthorizedException;
55 import org.apache.archiva.redback.integration.filter.authentication.HttpAuthenticator;
56 import org.apache.archiva.redback.policy.AccountLockedException;
57 import org.apache.archiva.redback.policy.MustChangePasswordException;
58 import org.apache.archiva.redback.system.SecuritySession;
59 import org.apache.archiva.redback.users.User;
60 import org.apache.archiva.redback.users.UserManager;
61 import org.apache.archiva.repository.LayoutException;
62 import org.apache.archiva.repository.ManagedRepository;
63 import org.apache.archiva.repository.ManagedRepositoryContent;
64 import org.apache.archiva.repository.ReleaseScheme;
65 import org.apache.archiva.repository.RepositoryContentFactory;
66 import org.apache.archiva.repository.RepositoryRegistry;
67 import org.apache.archiva.repository.content.maven2.RepositoryRequest;
68 import org.apache.archiva.repository.events.AuditListener;
69 import org.apache.archiva.repository.features.IndexCreationFeature;
70 import org.apache.archiva.repository.metadata.MetadataTools;
71 import org.apache.archiva.repository.metadata.RepositoryMetadataException;
72 import org.apache.archiva.repository.metadata.RepositoryMetadataMerge;
73 import org.apache.archiva.repository.metadata.RepositoryMetadataWriter;
74 import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
75 import org.apache.archiva.security.ServletAuthenticator;
76 import org.apache.archiva.webdav.util.MimeTypes;
77 import org.apache.archiva.webdav.util.TemporaryGroupIndexSessionCleaner;
78 import org.apache.archiva.webdav.util.WebdavMethodUtil;
79 import org.apache.archiva.xml.XMLException;
80 import org.apache.commons.io.FilenameUtils;
81 import org.apache.commons.lang.StringUtils;
82 import org.apache.commons.lang.SystemUtils;
83 import org.apache.jackrabbit.webdav.DavException;
84 import org.apache.jackrabbit.webdav.DavResource;
85 import org.apache.jackrabbit.webdav.DavResourceFactory;
86 import org.apache.jackrabbit.webdav.DavResourceLocator;
87 import org.apache.jackrabbit.webdav.DavServletRequest;
88 import org.apache.jackrabbit.webdav.DavServletResponse;
89 import org.apache.jackrabbit.webdav.DavSession;
90 import org.apache.jackrabbit.webdav.lock.LockManager;
91 import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
92 import org.apache.maven.index.context.IndexingContext;
93 import org.codehaus.plexus.digest.ChecksumFile;
94 import org.codehaus.plexus.digest.Digester;
95 import org.codehaus.plexus.digest.DigesterException;
96 import org.slf4j.Logger;
97 import org.slf4j.LoggerFactory;
98 import org.slf4j.MarkerFactory;
99 import org.springframework.context.ApplicationContext;
100 import org.springframework.stereotype.Service;
102 import javax.annotation.PostConstruct;
103 import javax.inject.Inject;
104 import javax.inject.Named;
105 import javax.servlet.http.HttpServletResponse;
106 import javax.servlet.http.HttpSession;
107 import java.io.IOException;
108 import java.nio.file.Files;
109 import java.nio.file.Path;
110 import java.nio.file.Paths;
111 import java.util.ArrayList;
112 import java.util.Date;
113 import java.util.HashMap;
114 import java.util.HashSet;
115 import java.util.List;
116 import java.util.Map;
117 import java.util.Set;
122 @Service( "davResourceFactory#archiva" )
123 public class ArchivaDavResourceFactory
124 implements DavResourceFactory, Auditable
126 private static final String PROXIED_SUFFIX = " (proxied)";
128 private static final String HTTP_PUT_METHOD = "PUT";
130 private Logger log = LoggerFactory.getLogger( ArchivaDavResourceFactory.class );
133 private List<AuditListener> auditListeners = new ArrayList<>();
136 private RepositoryContentFactory repositoryFactory;
138 private RepositoryRequest repositoryRequest;
141 private ProxyRegistry proxyRegistry;
144 private MetadataTools metadataTools;
147 private MimeTypes mimeTypes;
149 private ArchivaConfiguration archivaConfiguration;
152 private ServletAuthenticator servletAuth;
155 @Named( value = "httpAuthenticator#basic" )
156 private HttpAuthenticator httpAuth;
159 private RemoteRepositoryAdmin remoteRepositoryAdmin;
162 private ManagedRepositoryAdmin managedRepositoryAdmin;
165 private RepositoryRegistry repositoryRegistry;
168 private IndexMerger indexMerger;
171 private RepositorySearch repositorySearch;
174 * Lock Manager - use simple implementation from JackRabbit
176 private final LockManager lockManager = new SimpleLockManager();
178 private ChecksumFile checksum;
180 private Digester digestSha1;
182 private Digester digestMd5;
185 @Named( value = "archivaTaskScheduler#repository" )
186 private RepositoryArchivaTaskScheduler scheduler;
189 @Named( value = "fileLockManager#default" )
190 private FileLockManager fileLockManager;
192 private ApplicationContext applicationContext;
195 public ArchivaDavResourceFactory( ApplicationContext applicationContext, PlexusSisuBridge plexusSisuBridge,
196 ArchivaConfiguration archivaConfiguration )
197 throws PlexusSisuBridgeException
199 this.archivaConfiguration = archivaConfiguration;
200 this.applicationContext = applicationContext;
201 this.checksum = plexusSisuBridge.lookup( ChecksumFile.class );
203 this.digestMd5 = plexusSisuBridge.lookup( Digester.class, "md5" );
204 this.digestSha1 = plexusSisuBridge.lookup( Digester.class, "sha1" );
206 // TODO remove this hard dependency on maven !!
207 repositoryRequest = new RepositoryRequest( );
211 public void initialize()
217 public DavResource createResource( final DavResourceLocator locator, final DavServletRequest request,
218 final DavServletResponse response )
221 ArchivaDavResourceLocator archivaLocator = checkLocatorIsInstanceOfRepositoryLocator( locator );
223 RepositoryGroupConfiguration repoGroupConfig =
224 archivaConfiguration.getConfiguration().getRepositoryGroupsAsMap().get( archivaLocator.getRepositoryId() );
226 String activePrincipal = getActivePrincipal( request );
228 List<String> resourcesInAbsolutePath = new ArrayList<>();
230 boolean readMethod = WebdavMethodUtil.isReadMethod( request.getMethod() );
231 DavResource resource;
232 if ( repoGroupConfig != null )
236 throw new DavException( HttpServletResponse.SC_METHOD_NOT_ALLOWED,
237 "Write method not allowed for repository groups." );
240 log.debug( "Repository group '{}' accessed by '{}", repoGroupConfig.getId(), activePrincipal );
242 // handle browse requests for virtual repos
243 if ( getLogicalResource( archivaLocator, null, true ).endsWith( "/" ) )
245 DavResource davResource =
246 getResourceFromGroup( request, repoGroupConfig.getRepositories(), archivaLocator,
249 setHeaders( response, locator, davResource, true );
256 // make a copy to avoid potential concurrent modifications (eg. by configuration)
257 // TODO: ultimately, locking might be more efficient than copying in this fashion since updates are
259 List<String> repositories = new ArrayList<>( repoGroupConfig.getRepositories() );
260 resource = processRepositoryGroup( request, archivaLocator, repositories, activePrincipal,
261 resourcesInAbsolutePath, repoGroupConfig );
269 RemoteRepository remoteRepository =
270 remoteRepositoryAdmin.getRemoteRepository( archivaLocator.getRepositoryId() );
272 if ( remoteRepository != null )
274 String logicalResource = getLogicalResource( archivaLocator, null, false );
275 IndexingContext indexingContext = remoteRepositoryAdmin.createIndexContext( remoteRepository );
276 Path resourceFile = StringUtils.equals( logicalResource, "/" )
277 ? Paths.get( indexingContext.getIndexDirectoryFile().getParent() )
278 : Paths.get( indexingContext.getIndexDirectoryFile().getParent(), logicalResource );
279 resource = new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), //
280 locator.getResourcePath(), //
282 request.getRemoteAddr(), //
284 request.getDavSession(), //
291 setHeaders( response, locator, resource, false );
295 catch ( RepositoryAdminException e )
297 log.debug( "RepositoryException remote repository with d'{}' not found, msg: {}",
298 archivaLocator.getRepositoryId(), e.getMessage() );
302 ManagedRepository repo = repositoryRegistry.getManagedRepository( archivaLocator.getRepositoryId() );
304 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
305 "Invalid repository: " + archivaLocator.getRepositoryId() );
307 ManagedRepositoryContent managedRepositoryContent = repo.getContent( );
308 if (managedRepositoryContent==null) {
309 log.error("Inconsistency detected. Repository content not found for '{}'", archivaLocator.getRepositoryId());
310 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
311 "Invalid repository: " + archivaLocator.getRepositoryId() );
314 log.debug( "Managed repository '{}' accessed by '{}'", managedRepositoryContent.getId(), activePrincipal );
316 resource = processRepository( request, archivaLocator, activePrincipal, managedRepositoryContent,
319 String logicalResource = getLogicalResource( archivaLocator, null, false );
320 resourcesInAbsolutePath.add(
321 Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource ).toAbsolutePath().toString() );
325 String requestedResource = request.getRequestURI();
327 // MRM-872 : merge all available metadata
328 // merge metadata only when requested via the repo group
329 if ( ( repositoryRequest.isMetadata( requestedResource ) || repositoryRequest.isMetadataSupportFile(
330 requestedResource ) ) && repoGroupConfig != null )
332 // this should only be at the project level not version level!
333 if ( isProjectReference( requestedResource ) )
336 ArchivaDavResource res = (ArchivaDavResource) resource;
338 StringUtils.substringBeforeLast( res.getLocalResource().toAbsolutePath().toString().replace( '\\', '/' ),
340 filePath = filePath + "/maven-metadata-" + repoGroupConfig.getId() + ".xml";
342 // for MRM-872 handle checksums of the merged metadata files
343 if ( repositoryRequest.isSupportFile( requestedResource ) )
345 Path metadataChecksum =
346 Paths.get( filePath + "." + StringUtils.substringAfterLast( requestedResource, "." ) );
348 if ( Files.exists(metadataChecksum) )
350 LogicalResource logicalResource =
351 new LogicalResource( getLogicalResource( archivaLocator, null, false ) );
354 new ArchivaDavResource( metadataChecksum.toAbsolutePath().toString(), logicalResource.getPath(), null,
355 request.getRemoteAddr(), activePrincipal, request.getDavSession(),
356 archivaLocator, this, mimeTypes, auditListeners, scheduler,
362 if ( resourcesInAbsolutePath != null && resourcesInAbsolutePath.size() > 1 )
364 // merge the metadata of all repos under group
365 ArchivaRepositoryMetadata mergedMetadata = new ArchivaRepositoryMetadata();
366 for ( String resourceAbsPath : resourcesInAbsolutePath )
370 Path metadataFile = Paths.get( resourceAbsPath );
371 ArchivaRepositoryMetadata repoMetadata = MavenMetadataReader.read( metadataFile );
372 mergedMetadata = RepositoryMetadataMerge.merge( mergedMetadata, repoMetadata );
374 catch ( XMLException e )
376 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
377 "Error occurred while reading metadata file." );
379 catch ( RepositoryMetadataException r )
381 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
382 "Error occurred while merging metadata file." );
388 Path resourceFile = writeMergedMetadataToFile( mergedMetadata, filePath );
390 LogicalResource logicalResource =
391 new LogicalResource( getLogicalResource( archivaLocator, null, false ) );
394 new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), logicalResource.getPath(), null,
395 request.getRemoteAddr(), activePrincipal,
396 request.getDavSession(), archivaLocator, this, mimeTypes,
397 auditListeners, scheduler, fileLockManager );
399 catch ( RepositoryMetadataException r )
401 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
402 "Error occurred while writing metadata file." );
404 catch ( IOException ie )
406 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
407 "Error occurred while generating checksum files." );
409 catch ( DigesterException de )
411 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
412 "Error occurred while generating checksum files."
420 setHeaders( response, locator, resource, false );
422 // compatibility with MRM-440 to ensure browsing the repository works ok
423 if ( resource.isCollection() && !request.getRequestURI().endsWith( "/" ) )
425 throw new BrowserRedirectException( resource.getHref() );
427 resource.addLockManager( lockManager );
431 private DavResource processRepositoryGroup( final DavServletRequest request,
432 ArchivaDavResourceLocator archivaLocator, List<String> repositories,
433 String activePrincipal, List<String> resourcesInAbsolutePath,
434 RepositoryGroupConfiguration repoGroupConfig )
437 DavResource resource = null;
438 List<DavException> storedExceptions = new ArrayList<>();
440 String pathInfo = StringUtils.removeEnd( request.getPathInfo(), "/" );
442 String rootPath = StringUtils.substringBeforeLast( pathInfo, "/" );
444 if ( StringUtils.endsWith( rootPath, repoGroupConfig.getMergedIndexPath() ) )
446 // we are in the case of index file request
447 String requestedFileName = StringUtils.substringAfterLast( pathInfo, "/" );
448 Path temporaryIndexDirectory =
449 buildMergedIndexDirectory( repositories, activePrincipal, request, repoGroupConfig );
451 Path resourceFile = temporaryIndexDirectory.resolve( requestedFileName );
452 resource = new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), requestedFileName, null,
453 request.getRemoteAddr(), activePrincipal, request.getDavSession(),
454 archivaLocator, this, mimeTypes, auditListeners, scheduler,
460 for ( String repositoryId : repositories )
462 ManagedRepositoryContent managedRepositoryContent;
463 ManagedRepository managedRepository = repositoryRegistry.getManagedRepository( repositoryId );
464 if (managedRepository==null) {
465 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not find repository with id "+repositoryId );
467 managedRepositoryContent = managedRepository.getContent();
468 if (managedRepositoryContent==null) {
469 log.error("Inconsistency detected. Repository content not found for '{}'",repositoryId);
470 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not find repository content with id "+repositoryId );
474 DavResource updatedResource =
475 processRepository( request, archivaLocator, activePrincipal, managedRepositoryContent,
477 if ( resource == null )
479 resource = updatedResource;
482 String logicalResource = getLogicalResource( archivaLocator, null, false );
483 if ( logicalResource.endsWith( "/" ) )
485 logicalResource = logicalResource.substring( 1 );
487 resourcesInAbsolutePath.add(
488 Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource ).toAbsolutePath().toString() );
490 catch ( DavException e )
492 storedExceptions.add( e );
496 if ( resource == null )
498 if ( !storedExceptions.isEmpty() )
501 for ( DavException e : storedExceptions )
503 if ( 401 == e.getErrorCode() )
509 throw new DavException( HttpServletResponse.SC_NOT_FOUND );
513 throw new DavException( HttpServletResponse.SC_NOT_FOUND );
519 private String getLogicalResource( ArchivaDavResourceLocator archivaLocator, org.apache.archiva.repository.ManagedRepository managedRepository,
520 boolean useOrigResourcePath )
522 // FIXME remove this hack
523 // but currently managedRepository can be null in case of group
524 String layout = managedRepository == null ? "default" : managedRepository.getLayout();
525 RepositoryStorage repositoryStorage =
526 this.applicationContext.getBean( "repositoryStorage#" + layout, RepositoryStorage.class );
527 String path = repositoryStorage.getFilePath(
528 useOrigResourcePath ? archivaLocator.getOrigResourcePath() : archivaLocator.getResourcePath(),
530 log.debug( "found path {} for resourcePath: '{}' with managedRepo '{}' and layout '{}'", path,
531 archivaLocator.getResourcePath(), managedRepository == null ? "null" : managedRepository.getId(),
536 private String evaluatePathWithVersion( ArchivaDavResourceLocator archivaLocator, //
537 ManagedRepositoryContent managedRepositoryContent, //
541 String layout = managedRepositoryContent.getRepository() == null
543 : managedRepositoryContent.getRepository().getLayout();
544 RepositoryStorage repositoryStorage =
545 this.applicationContext.getBean( "repositoryStorage#" + layout, RepositoryStorage.class );
548 return repositoryStorage.getFilePathWithVersion( archivaLocator.getResourcePath(), //
549 managedRepositoryContent );
551 catch ( RelocationException e )
553 String path = e.getPath();
554 log.debug( "Relocation to {}", path );
556 throw new BrowserRedirectException( addHrefPrefix( contextPath, path ), e.getRelocationType() );
558 catch ( XMLException e )
560 log.error( e.getMessage(), e );
561 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
565 private DavResource processRepository( final DavServletRequest request, ArchivaDavResourceLocator archivaLocator,
566 String activePrincipal, ManagedRepositoryContent managedRepositoryContent,
567 org.apache.archiva.repository.ManagedRepository managedRepository )
570 DavResource resource = null;
571 if ( isAuthorized( request, managedRepositoryContent.getId() ) )
573 boolean readMethod = WebdavMethodUtil.isReadMethod( request.getMethod() );
574 // Maven Centric part ask evaluation if -SNAPSHOT
575 // MRM-1846 test if read method to prevent issue with maven 2.2.1 and uniqueVersion false
577 String path = readMethod
578 ? evaluatePathWithVersion( archivaLocator, managedRepositoryContent, request.getContextPath() )
579 : getLogicalResource( archivaLocator, managedRepository, false );
580 if ( path.startsWith( "/" ) )
582 path = path.substring( 1 );
584 LogicalResource logicalResource = new LogicalResource( path );
585 Path resourceFile = Paths.get( managedRepositoryContent.getRepoRoot(), path );
587 new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), path, managedRepositoryContent.getRepository(),
588 request.getRemoteAddr(), activePrincipal, request.getDavSession(),
589 archivaLocator, this, mimeTypes, auditListeners, scheduler, fileLockManager );
591 if ( WebdavMethodUtil.isReadMethod( request.getMethod() ) )
593 if ( archivaLocator.getHref( false ).endsWith( "/" ) && !Files.isDirectory( resourceFile ) )
595 // force a resource not found
596 throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Resource does not exist" );
600 if ( !resource.isCollection() )
602 boolean previouslyExisted = Files.exists(resourceFile);
604 boolean fromProxy = fetchContentFromProxies( managedRepositoryContent, request, logicalResource );
606 // At this point the incoming request can either be in default or
607 // legacy layout format.
610 // Perform an adjustment of the resource to the managed
611 // repository expected path.
612 String localResourcePath =
613 repositoryRequest.toNativePath( logicalResource.getPath(), managedRepositoryContent );
614 resourceFile = Paths.get( managedRepositoryContent.getRepoRoot(), localResourcePath );
616 new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), logicalResource.getPath(),
617 managedRepositoryContent.getRepository(),
618 request.getRemoteAddr(), activePrincipal,
619 request.getDavSession(), archivaLocator, this, mimeTypes,
620 auditListeners, scheduler, fileLockManager );
622 catch ( LayoutException e )
624 if ( !Files.exists(resourceFile) )
626 throw new DavException( HttpServletResponse.SC_NOT_FOUND, e );
632 String action = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE )
635 log.debug( "Proxied artifact '{}' in repository '{}' (current user '{}')",
636 resourceFile.getFileName(), managedRepositoryContent.getId(), activePrincipal );
638 triggerAuditEvent( request.getRemoteAddr(), archivaLocator.getRepositoryId(),
639 logicalResource.getPath(), action, activePrincipal );
642 if ( !Files.exists(resourceFile) )
644 throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Resource does not exist" );
650 if ( request.getMethod().equals( HTTP_PUT_METHOD ) )
652 String resourcePath = logicalResource.getPath();
654 // check if target repo is enabled for releases
655 // we suppose that release-artifacts can be deployed only to repos enabled for releases
656 if ( managedRepositoryContent.getRepository().getActiveReleaseSchemes().contains( ReleaseScheme.RELEASE ) && !repositoryRequest.isMetadata(
657 resourcePath ) && !repositoryRequest.isSupportFile( resourcePath ) )
659 ArtifactReference artifact = null;
662 artifact = managedRepositoryContent.toArtifactReference( resourcePath );
664 if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
666 // check if artifact already exists and if artifact re-deployment to the repository is allowed
667 if ( managedRepositoryContent.hasContent( artifact )
668 && managedRepositoryContent.getRepository().blocksRedeployments())
670 log.warn( "Overwriting released artifacts in repository '{}' is not allowed.",
671 managedRepositoryContent.getId() );
672 throw new DavException( HttpServletResponse.SC_CONFLICT,
673 "Overwriting released artifacts is not allowed." );
677 catch ( LayoutException e )
679 log.warn( "Artifact path '{}' is invalid.", resourcePath );
684 * Create parent directories that don't exist when writing a file This actually makes this
685 * implementation not compliant to the WebDAV RFC - but we have enough knowledge about how the
686 * collection is being used to do this reasonably and some versions of Maven's WebDAV don't correctly
687 * create the collections themselves.
690 Path rootDirectory = Paths.get( managedRepositoryContent.getRepoRoot() );
691 Path destDir = rootDirectory.resolve( logicalResource.getPath() ).getParent();
693 if ( !Files.exists(destDir) )
697 Files.createDirectories( destDir );
699 catch ( IOException e )
701 log.error("Could not create directory {}: {}", destDir, e.getMessage(), e);
702 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not create directory "+destDir );
704 String relPath = PathUtil.getRelative( rootDirectory.toAbsolutePath().toString(), destDir );
706 log.debug( "Creating destination directory '{}' (current user '{}')", destDir.getFileName(),
709 triggerAuditEvent( request.getRemoteAddr(), managedRepositoryContent.getId(), relPath,
710 AuditEvent.CREATE_DIR, activePrincipal );
718 public DavResource createResource( final DavResourceLocator locator, final DavSession davSession )
721 ArchivaDavResourceLocator archivaLocator = checkLocatorIsInstanceOfRepositoryLocator( locator );
723 ManagedRepositoryContent managedRepositoryContent;
724 ManagedRepository repo = repositoryRegistry.getManagedRepository( archivaLocator.getRepositoryId( ) );
726 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
727 "Invalid repository: " + archivaLocator.getRepositoryId() );
729 managedRepositoryContent = repo.getContent();
730 if (managedRepositoryContent==null) {
731 log.error("Inconsistency detected. Repository content not found for '{}'", archivaLocator.getRepositoryId());
732 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
733 "Invalid repository: " + archivaLocator.getRepositoryId() );
736 DavResource resource = null;
737 String logicalResource = getLogicalResource( archivaLocator, repo, false );
738 if ( logicalResource.startsWith( "/" ) )
740 logicalResource = logicalResource.substring( 1 );
742 Path resourceFile = Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource );
743 resource = new ArchivaDavResource( resourceFile.toAbsolutePath().toString(), logicalResource,
744 repo, davSession, archivaLocator,
745 this, mimeTypes, auditListeners, scheduler, fileLockManager );
747 resource.addLockManager( lockManager );
751 private boolean fetchContentFromProxies( ManagedRepositoryContent managedRepository, DavServletRequest request,
752 LogicalResource resource )
755 String path = resource.getPath();
756 if (!proxyRegistry.hasHandler(managedRepository.getRepository().getType())) {
757 throw new DavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "No proxy handler found for repository type "+managedRepository.getRepository().getType());
759 RepositoryProxyHandler proxyHandler = proxyRegistry.getHandler(managedRepository.getRepository().getType()).get(0);
760 if ( repositoryRequest.isSupportFile( path ) )
762 Path proxiedFile = proxyHandler.fetchFromProxies( managedRepository, path );
764 return ( proxiedFile != null );
767 // Is it a Metadata resource?
768 if ( repositoryRequest.isDefault( path ) && repositoryRequest.isMetadata( path ) )
770 return proxyHandler.fetchMetadataFromProxies( managedRepository, path ).isModified();
773 // Is it an Archetype Catalog?
774 if ( repositoryRequest.isArchetypeCatalog( path ) )
776 // FIXME we must implement a merge of remote archetype catalog from remote servers.
777 Path proxiedFile = proxyHandler.fetchFromProxies( managedRepository, path );
779 return ( proxiedFile != null );
782 // Not any of the above? Then it's gotta be an artifact reference.
785 // Get the artifact reference in a layout neutral way.
786 ArtifactReference artifact = repositoryRequest.toArtifactReference( path );
788 if ( artifact != null )
790 String repositoryLayout = managedRepository.getRepository().getLayout();
792 RepositoryStorage repositoryStorage =
793 this.applicationContext.getBean( "repositoryStorage#" + repositoryLayout, RepositoryStorage.class );
794 repositoryStorage.applyServerSideRelocation( managedRepository, artifact );
796 Path proxiedFile = proxyHandler.fetchFromProxies( managedRepository, artifact );
798 resource.setPath( managedRepository.toPath( artifact ) );
800 log.debug( "Proxied artifact '{}:{}:{}'", artifact.getGroupId(), artifact.getArtifactId(),
801 artifact.getVersion() );
803 return ( proxiedFile != null );
806 catch ( LayoutException e )
810 catch ( ProxyDownloadException e )
812 log.error( e.getMessage(), e );
813 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
814 "Unable to fetch artifact resource." );
821 private void triggerAuditEvent( String remoteIP, String repositoryId, String resource, String action,
824 AuditEvent event = new AuditEvent( repositoryId, principal, resource, action );
825 event.setRemoteIP( remoteIP );
827 for ( AuditListener listener : auditListeners )
829 listener.auditEvent( event );
834 public void addAuditListener( AuditListener listener )
836 this.auditListeners.add( listener );
840 public void clearAuditListeners()
842 this.auditListeners.clear();
846 public void removeAuditListener( AuditListener listener )
848 this.auditListeners.remove( listener );
851 private void setHeaders( DavServletResponse response, DavResourceLocator locator, DavResource resource,
854 // [MRM-503] - Metadata file need Pragma:no-cache response
856 if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) || ( resource instanceof ArchivaDavResource
857 && ( Files.isDirectory( ArchivaDavResource.class.cast( resource ).getLocalResource()) ) ) )
859 response.setHeader( "Pragma", "no-cache" );
860 response.setHeader( "Cache-Control", "no-cache" );
861 response.setDateHeader( "Last-Modified", new Date().getTime() );
863 // if the resource is a directory don't cache it as new groupId deployed will be available
864 // without need of refreshing browser
865 else if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) || (
866 resource instanceof ArchivaVirtualDavResource && ( Files.isDirectory(Paths.get(
867 ArchivaVirtualDavResource.class.cast( resource ).getLogicalResource() )) ) ) )
869 response.setHeader( "Pragma", "no-cache" );
870 response.setHeader( "Cache-Control", "no-cache" );
871 response.setDateHeader( "Last-Modified", new Date().getTime() );
875 if ( resource instanceof ArchivaVirtualDavResource )
877 //MRM-1854 here we have a directory so force "Last-Modified"
878 response.setDateHeader( "Last-Modified", new Date().getTime() );
883 // We need to specify this so connecting wagons can work correctly
884 response.setDateHeader( "Last-Modified", resource.getModificationTime() );
886 // TODO: [MRM-524] determine http caching options for other types of files (artifacts, sha1, md5, snapshots)
889 private ArchivaDavResourceLocator checkLocatorIsInstanceOfRepositoryLocator( DavResourceLocator locator )
892 if ( !( locator instanceof ArchivaDavResourceLocator ) )
894 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
895 "Locator does not implement RepositoryLocator" );
899 if ( locator.getResourcePath().startsWith( ArchivaDavResource.HIDDEN_PATH_PREFIX ) )
901 throw new DavException( HttpServletResponse.SC_NOT_FOUND );
904 ArchivaDavResourceLocator archivaLocator = (ArchivaDavResourceLocator) locator;
906 // MRM-419 - Windows Webdav support. Should not 404 if there is no content.
907 if ( StringUtils.isEmpty( archivaLocator.getRepositoryId() ) )
909 throw new DavException( HttpServletResponse.SC_NO_CONTENT );
911 return archivaLocator;
914 private String addHrefPrefix( String contextPath, String path ) {
915 String prefix = archivaConfiguration.getConfiguration().getWebapp().getUi().getApplicationUrl();
916 if (prefix == null || prefix.isEmpty()) {
917 prefix = contextPath;
919 return prefix + ( StringUtils.startsWith( path, "/" ) ? "" :
920 ( StringUtils.endsWith( prefix, "/" ) ? "" : "/" ) )
924 public void setProxyRegistry(ProxyRegistry proxyRegistry) {
925 this.proxyRegistry = proxyRegistry;
928 public ProxyRegistry getProxyRegistry() {
929 return this.proxyRegistry;
932 private static class LogicalResource
936 public LogicalResource( String path )
941 public String getPath()
946 public void setPath( String path )
952 protected boolean isAuthorized( DavServletRequest request, String repositoryId )
957 AuthenticationResult result = httpAuth.getAuthenticationResult( request, null );
958 SecuritySession securitySession = httpAuth.getSecuritySession( request.getSession( true ) );
960 return servletAuth.isAuthenticated( request, result ) //
961 && servletAuth.isAuthorized( request, securitySession, repositoryId, //
962 WebdavMethodUtil.getMethodPermission( request.getMethod() ) );
964 catch ( AuthenticationException e )
966 // safety check for MRM-911
967 String guest = UserManager.GUEST_USERNAME;
970 if ( servletAuth.isAuthorized( guest,
971 ( (ArchivaDavResourceLocator) request.getRequestLocator() ).getRepositoryId(),
972 WebdavMethodUtil.getMethodPermission( request.getMethod() ) ) )
977 catch ( UnauthorizedException ae )
979 throw new UnauthorizedDavException( repositoryId,
980 "You are not authenticated and authorized to access any repository." );
983 throw new UnauthorizedDavException( repositoryId, "You are not authenticated" );
985 catch ( MustChangePasswordException e )
987 throw new UnauthorizedDavException( repositoryId, "You must change your password." );
989 catch ( AccountLockedException e )
991 throw new UnauthorizedDavException( repositoryId, "User account is locked." );
993 catch ( AuthorizationException e )
995 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
996 "Fatal Authorization Subsystem Error." );
998 catch ( UnauthorizedException e )
1000 throw new UnauthorizedDavException( repositoryId, e.getMessage() );
1004 private DavResource getResourceFromGroup( DavServletRequest request, List<String> repositories,
1005 ArchivaDavResourceLocator locator,
1006 RepositoryGroupConfiguration repositoryGroupConfiguration )
1009 if ( repositoryGroupConfiguration.getRepositories() == null
1010 || repositoryGroupConfiguration.getRepositories().isEmpty() )
1013 Paths.get( System.getProperty( "appserver.base" ), "groups/" + repositoryGroupConfiguration.getId() );
1015 return new ArchivaDavResource( file.toString(), "groups/" + repositoryGroupConfiguration.getId(), null,
1016 request.getDavSession(), locator, this, mimeTypes, auditListeners, scheduler,
1019 List<Path> mergedRepositoryContents = new ArrayList<>();
1020 // multiple repo types so we guess they are all the same type
1021 // so use the first one
1022 // FIXME add a method with group in the repository storage
1023 String firstRepoId = repositoryGroupConfiguration.getRepositories().get( 0 );
1025 String path = getLogicalResource( locator, repositoryRegistry.getManagedRepository( firstRepoId ), false );
1026 if ( path.startsWith( "/" ) )
1028 path = path.substring( 1 );
1030 LogicalResource logicalResource = new LogicalResource( path );
1033 // if the current user logged in has permission to any of the repositories, allow user to
1034 // browse the repo group but displaying only the repositories which the user has permission to access.
1035 // otherwise, prompt for authentication.
1037 String activePrincipal = getActivePrincipal( request );
1039 boolean allow = isAllowedToContinue( request, repositories, activePrincipal );
1042 String pathInfo = StringUtils.removeEnd( request.getPathInfo(), "/" );
1047 if ( StringUtils.endsWith( pathInfo, repositoryGroupConfiguration.getMergedIndexPath() ) )
1049 Path mergedRepoDir =
1050 buildMergedIndexDirectory( repositories, activePrincipal, request, repositoryGroupConfiguration );
1051 mergedRepositoryContents.add( mergedRepoDir );
1055 if ( StringUtils.equalsIgnoreCase( pathInfo, "/" + repositoryGroupConfiguration.getId() ) )
1057 Path tmpDirectory = Paths.get( SystemUtils.getJavaIoTmpDir().toString(),
1058 repositoryGroupConfiguration.getId(),
1059 repositoryGroupConfiguration.getMergedIndexPath() );
1060 if ( !Files.exists(tmpDirectory) )
1062 synchronized ( tmpDirectory.toAbsolutePath().toString() )
1064 if ( !Files.exists(tmpDirectory) )
1068 Files.createDirectories( tmpDirectory );
1070 catch ( IOException e )
1072 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not create direcotory "+tmpDirectory );
1077 mergedRepositoryContents.add( tmpDirectory.getParent() );
1079 for ( String repository : repositories )
1081 ManagedRepositoryContent managedRepository = null;
1082 ManagedRepository repo = repositoryRegistry.getManagedRepository( repository );
1084 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
1085 "Invalid managed repository <" + repository + ">");
1087 managedRepository = repo.getContent();
1088 if (managedRepository==null) {
1089 log.error("Inconsistency detected. Repository content not found for '{}'",repository);
1090 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
1091 "Invalid managed repository <" + repository + ">");
1093 Path resourceFile = Paths.get( managedRepository.getRepoRoot(), logicalResource.getPath() );
1094 if ( Files.exists(resourceFile) )
1096 // in case of group displaying index directory doesn't have sense !!
1097 IndexCreationFeature idf = managedRepository.getRepository().getFeature(IndexCreationFeature.class).get();
1098 String repoIndexDirectory = idf.getIndexPath().toString();
1099 if ( StringUtils.isNotEmpty( repoIndexDirectory ) )
1101 if ( !Paths.get( repoIndexDirectory ).isAbsolute() )
1103 repoIndexDirectory = Paths.get( managedRepository.getRepository().getLocation() ).resolve(
1104 StringUtils.isEmpty( repoIndexDirectory )
1106 : repoIndexDirectory ).toAbsolutePath().toString();
1109 if ( StringUtils.isEmpty( repoIndexDirectory ) )
1111 repoIndexDirectory = Paths.get( managedRepository.getRepository().getLocation() ).resolve(
1112 ".indexer" ).toAbsolutePath().toString();
1115 if ( !StringUtils.equals( FilenameUtils.normalize( repoIndexDirectory ),
1116 FilenameUtils.normalize( resourceFile.toAbsolutePath().toString() ) ) )
1118 // for prompted authentication
1119 if ( httpAuth.getSecuritySession( request.getSession( true ) ) != null )
1123 if ( isAuthorized( request, repository ) )
1125 mergedRepositoryContents.add( resourceFile );
1126 log.debug( "Repository '{}' accessed by '{}'", repository, activePrincipal );
1129 catch ( DavException e )
1131 // TODO: review exception handling
1133 log.debug( "Skipping repository '{}' for user '{}': {}", managedRepository,
1134 activePrincipal, e.getMessage() );
1141 // for the current user logged in
1144 if ( servletAuth.isAuthorized( activePrincipal, repository,
1145 WebdavMethodUtil.getMethodPermission(
1146 request.getMethod() ) ) )
1148 mergedRepositoryContents.add( resourceFile );
1149 log.debug( "Repository '{}' accessed by '{}'", repository, activePrincipal );
1152 catch ( UnauthorizedException e )
1154 // TODO: review exception handling
1156 log.debug( "Skipping repository '{}' for user '{}': {}", managedRepository,
1157 activePrincipal, e.getMessage() );
1168 throw new UnauthorizedDavException( locator.getRepositoryId(), "User not authorized." );
1171 ArchivaVirtualDavResource resource =
1172 new ArchivaVirtualDavResource( mergedRepositoryContents, logicalResource.getPath(), mimeTypes, locator,
1175 // compatibility with MRM-440 to ensure browsing the repository group works ok
1176 if ( resource.isCollection() && !request.getRequestURI().endsWith( "/" ) )
1178 throw new BrowserRedirectException( resource.getHref() );
1184 protected String getActivePrincipal( DavServletRequest request )
1186 User sessionUser = httpAuth.getSessionUser( request.getSession() );
1187 return sessionUser != null ? sessionUser.getUsername() : UserManager.GUEST_USERNAME;
1191 * Check if the current user is authorized to access any of the repos
1194 * @param repositories
1195 * @param activePrincipal
1198 private boolean isAllowedToContinue( DavServletRequest request, List<String> repositories, String activePrincipal )
1200 // when no repositories configured it's impossible to browse nothing !
1201 // at least make possible to see nothing :-)
1202 if ( repositories == null || repositories.isEmpty() )
1207 boolean allow = false;
1209 // if securitySession != null, it means that the user was prompted for authentication
1210 if ( httpAuth.getSecuritySession( request.getSession() ) != null )
1212 for ( String repository : repositories )
1216 if ( isAuthorized( request, repository ) )
1222 catch ( DavException e )
1230 for ( String repository : repositories )
1234 if ( servletAuth.isAuthorized( activePrincipal, repository,
1235 WebdavMethodUtil.getMethodPermission( request.getMethod() ) ) )
1241 catch ( UnauthorizedException e )
1251 private Path writeMergedMetadataToFile( ArchivaRepositoryMetadata mergedMetadata, String outputFilename )
1252 throws RepositoryMetadataException, DigesterException, IOException
1254 Path outputFile = Paths.get( outputFilename );
1255 if ( Files.exists(outputFile) )
1257 org.apache.archiva.common.utils.FileUtils.deleteQuietly( outputFile );
1260 Files.createDirectories(outputFile.getParent());
1261 RepositoryMetadataWriter.write( mergedMetadata, outputFile );
1263 createChecksumFile( outputFilename, digestSha1 );
1264 createChecksumFile( outputFilename, digestMd5 );
1269 private void createChecksumFile( String path, Digester digester )
1270 throws DigesterException, IOException
1272 Path checksumFile = Paths.get( path + digester.getFilenameExtension() );
1273 if ( !Files.exists(checksumFile) )
1275 org.apache.archiva.common.utils.FileUtils.deleteQuietly( checksumFile );
1276 checksum.createChecksum( Paths.get( path ).toFile(), digester );
1278 else if ( !Files.isRegularFile( checksumFile) )
1280 log.error( "Checksum file is not a file." );
1284 private boolean isProjectReference( String requestedResource )
1288 metadataTools.toVersionedReference( requestedResource );
1291 catch ( RepositoryMetadataException re )
1297 protected Path buildMergedIndexDirectory( List<String> repositories, String activePrincipal,
1298 DavServletRequest request,
1299 RepositoryGroupConfiguration repositoryGroupConfiguration )
1305 HttpSession session = request.getSession();
1307 @SuppressWarnings( "unchecked" ) Map<String, TemporaryGroupIndex> temporaryGroupIndexMap =
1308 (Map<String, TemporaryGroupIndex>) session.getAttribute(
1309 TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY );
1310 if ( temporaryGroupIndexMap == null )
1312 temporaryGroupIndexMap = new HashMap<>();
1315 TemporaryGroupIndex tmp = temporaryGroupIndexMap.get( repositoryGroupConfiguration.getId() );
1317 if ( tmp != null && tmp.getDirectory() != null && Files.exists(tmp.getDirectory()))
1319 if ( System.currentTimeMillis() - tmp.getCreationTime() > (
1320 repositoryGroupConfiguration.getMergedIndexTtl() * 60 * 1000 ) )
1322 log.debug( MarkerFactory.getMarker( "group.merged.index" ),
1323 "tmp group index '{}' is too old so delete it", repositoryGroupConfiguration.getId() );
1324 indexMerger.cleanTemporaryGroupIndex( tmp );
1328 log.debug( MarkerFactory.getMarker( "group.merged.index" ),
1329 "merged index for group '{}' found in cache", repositoryGroupConfiguration.getId() );
1330 return tmp.getDirectory();
1334 Set<String> authzRepos = new HashSet<String>();
1336 String permission = WebdavMethodUtil.getMethodPermission( request.getMethod() );
1338 for ( String repository : repositories )
1342 if ( servletAuth.isAuthorized( activePrincipal, repository, permission ) )
1344 authzRepos.add( repository );
1345 authzRepos.addAll( this.repositorySearch.getRemoteIndexingContextIds( repository ) );
1348 catch ( UnauthorizedException e )
1350 // TODO: review exception handling
1352 log.debug( "Skipping repository '{}' for user '{}': {}", repository, activePrincipal,
1357 log.info( "generate temporary merged index for repository group '{}' for repositories '{}'",
1358 repositoryGroupConfiguration.getId(), authzRepos );
1360 Path tempRepoFile = Files.createTempDirectory( "temp" );
1361 tempRepoFile.toFile().deleteOnExit();
1363 IndexMergerRequest indexMergerRequest =
1364 new IndexMergerRequest( authzRepos, true, repositoryGroupConfiguration.getId(),
1365 repositoryGroupConfiguration.getMergedIndexPath(),
1366 repositoryGroupConfiguration.getMergedIndexTtl() ).mergedIndexDirectory(
1367 tempRepoFile ).temporary( true );
1369 MergedRemoteIndexesTaskRequest taskRequest =
1370 new MergedRemoteIndexesTaskRequest( indexMergerRequest, indexMerger );
1372 MergedRemoteIndexesTask job = new MergedRemoteIndexesTask( taskRequest );
1374 IndexingContext indexingContext = job.execute().getIndexingContext();
1376 Path mergedRepoDir = indexingContext.getIndexDirectoryFile().toPath();
1377 TemporaryGroupIndex temporaryGroupIndex =
1378 new TemporaryGroupIndex( mergedRepoDir, indexingContext.getId(), repositoryGroupConfiguration.getId(),
1379 repositoryGroupConfiguration.getMergedIndexTtl() ) //
1380 .setCreationTime( new Date().getTime() );
1381 temporaryGroupIndexMap.put( repositoryGroupConfiguration.getId(), temporaryGroupIndex );
1382 session.setAttribute( TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY,
1383 temporaryGroupIndexMap );
1384 return mergedRepoDir;
1386 catch ( RepositorySearchException e )
1388 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
1390 catch ( IndexMergerException e )
1392 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
1394 catch ( IOException e )
1396 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
1401 public void setServletAuth( ServletAuthenticator servletAuth )
1403 this.servletAuth = servletAuth;
1406 public void setHttpAuth( HttpAuthenticator httpAuth )
1408 this.httpAuth = httpAuth;
1411 public void setScheduler( RepositoryArchivaTaskScheduler scheduler )
1413 this.scheduler = scheduler;
1416 public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
1418 this.archivaConfiguration = archivaConfiguration;
1421 public void setRepositoryFactory( RepositoryContentFactory repositoryFactory )
1423 this.repositoryFactory = repositoryFactory;
1426 public void setRepositoryRequest( RepositoryRequest repositoryRequest )
1428 this.repositoryRequest = repositoryRequest;
1431 public RemoteRepositoryAdmin getRemoteRepositoryAdmin()
1433 return remoteRepositoryAdmin;
1436 public void setRemoteRepositoryAdmin( RemoteRepositoryAdmin remoteRepositoryAdmin )
1438 this.remoteRepositoryAdmin = remoteRepositoryAdmin;
1441 public ManagedRepositoryAdmin getManagedRepositoryAdmin()
1443 return managedRepositoryAdmin;
1446 public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
1448 this.managedRepositoryAdmin = managedRepositoryAdmin;
1451 public RepositoryRegistry getRepositoryRegistry( )
1453 return repositoryRegistry;
1456 public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
1458 this.repositoryRegistry = repositoryRegistry;