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.managed.ManagedRepositoryAdmin;
23 import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
24 import org.apache.archiva.audit.Auditable;
25 import org.apache.archiva.checksum.ChecksumAlgorithm;
26 import org.apache.archiva.checksum.ChecksumUtil;
27 import org.apache.archiva.checksum.StreamingChecksum;
28 import org.apache.archiva.common.filelock.DefaultFileLockManager;
29 import org.apache.archiva.common.filelock.FileLockManager;
30 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
31 import org.apache.archiva.common.utils.PathUtil;
32 import org.apache.archiva.common.utils.VersionUtil;
33 import org.apache.archiva.configuration.ArchivaConfiguration;
34 import org.apache.archiva.indexer.ArchivaIndexingContext;
35 import org.apache.archiva.indexer.merger.IndexMerger;
36 import org.apache.archiva.indexer.merger.IndexMergerException;
37 import org.apache.archiva.indexer.merger.IndexMergerRequest;
38 import org.apache.archiva.indexer.merger.base.MergedRemoteIndexesTask;
39 import org.apache.archiva.indexer.merger.base.MergedRemoteIndexesTaskRequest;
40 import org.apache.archiva.indexer.merger.TemporaryGroupIndex;
41 import org.apache.archiva.indexer.search.RepositorySearch;
42 import org.apache.archiva.indexer.search.RepositorySearchException;
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.RepositoryGroup;
66 import org.apache.archiva.repository.RepositoryRegistry;
67 import org.apache.archiva.repository.RepositoryRequestInfo;
68 import org.apache.archiva.repository.storage.fs.FilesystemStorage;
69 import org.apache.archiva.repository.storage.StorageAsset;
70 import org.apache.archiva.metadata.audit.AuditListener;
71 import org.apache.archiva.repository.features.IndexCreationFeature;
72 import org.apache.archiva.repository.metadata.base.MetadataTools;
73 import org.apache.archiva.repository.metadata.RepositoryMetadataException;
74 import org.apache.archiva.repository.metadata.base.RepositoryMetadataMerge;
75 import org.apache.archiva.repository.metadata.base.RepositoryMetadataWriter;
76 import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
77 import org.apache.archiva.security.ServletAuthenticator;
78 import org.apache.archiva.webdav.util.MimeTypes;
79 import org.apache.archiva.webdav.util.TemporaryGroupIndexSessionCleaner;
80 import org.apache.archiva.webdav.util.WebdavMethodUtil;
81 import org.apache.archiva.xml.XMLException;
82 import org.apache.commons.io.FilenameUtils;
83 import org.apache.commons.lang3.StringUtils;
84 import org.apache.commons.lang3.SystemUtils;
85 import org.apache.jackrabbit.webdav.DavException;
86 import org.apache.jackrabbit.webdav.DavResource;
87 import org.apache.jackrabbit.webdav.DavResourceFactory;
88 import org.apache.jackrabbit.webdav.DavResourceLocator;
89 import org.apache.jackrabbit.webdav.DavServletRequest;
90 import org.apache.jackrabbit.webdav.DavServletResponse;
91 import org.apache.jackrabbit.webdav.DavSession;
92 import org.apache.jackrabbit.webdav.lock.LockManager;
93 import org.apache.jackrabbit.webdav.lock.SimpleLockManager;
94 import org.slf4j.Logger;
95 import org.slf4j.LoggerFactory;
96 import org.slf4j.MarkerFactory;
97 import org.springframework.context.ApplicationContext;
98 import org.springframework.stereotype.Service;
100 import javax.annotation.PostConstruct;
101 import javax.inject.Inject;
102 import javax.inject.Named;
103 import javax.servlet.http.HttpServletResponse;
104 import javax.servlet.http.HttpSession;
105 import java.io.IOException;
106 import java.io.OutputStream;
107 import java.io.OutputStreamWriter;
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.Objects;
118 import java.util.Set;
119 import java.util.stream.Collectors;
124 @Service( "davResourceFactory#archiva" )
125 public class ArchivaDavResourceFactory
126 implements DavResourceFactory, Auditable
128 private static final String PROXIED_SUFFIX = " (proxied)";
130 private static final String HTTP_PUT_METHOD = "PUT";
132 private Logger log = LoggerFactory.getLogger( ArchivaDavResourceFactory.class );
135 private List<AuditListener> auditListeners = new ArrayList<>();
138 private ProxyRegistry proxyRegistry;
141 private MetadataTools metadataTools;
144 private MimeTypes mimeTypes;
146 private ArchivaConfiguration archivaConfiguration;
149 private ServletAuthenticator servletAuth;
152 @Named( value = "httpAuthenticator#basic" )
153 private HttpAuthenticator httpAuth;
156 private RemoteRepositoryAdmin remoteRepositoryAdmin;
159 private ManagedRepositoryAdmin managedRepositoryAdmin;
162 private RepositoryRegistry repositoryRegistry;
165 private IndexMerger indexMerger;
168 private RepositorySearch repositorySearch;
171 * Lock Manager - use simple implementation from JackRabbit
173 private final LockManager lockManager = new SimpleLockManager();
176 @Named( value = "archivaTaskScheduler#repository" )
177 private RepositoryArchivaTaskScheduler scheduler;
180 @Named( value = "fileLockManager#default" )
181 private FileLockManager fileLockManager;
183 private ApplicationContext applicationContext;
187 public ArchivaDavResourceFactory( ApplicationContext applicationContext, ArchivaConfiguration archivaConfiguration )
188 throws PlexusSisuBridgeException
190 this.archivaConfiguration = archivaConfiguration;
191 this.applicationContext = applicationContext;
196 public void initialize() throws IOException
203 public DavResource createResource( final DavResourceLocator locator, final DavServletRequest request,
204 final DavServletResponse response )
207 final ArchivaDavResourceLocator archivaLocator = checkLocatorIsInstanceOfRepositoryLocator( locator );
209 final String sRepoId = archivaLocator.getRepositoryId();
211 RepositoryGroup repoGroup = repositoryRegistry.getRepositoryGroup(sRepoId);
213 final boolean isGroupRepo = repoGroup != null;
215 String activePrincipal = getActivePrincipal( request );
217 List<String> resourcesInAbsolutePath = new ArrayList<>();
219 boolean readMethod = WebdavMethodUtil.isReadMethod( request.getMethod() );
220 RepositoryRequestInfo repositoryRequestInfo = null;
221 DavResource resource;
226 throw new DavException( HttpServletResponse.SC_METHOD_NOT_ALLOWED,
227 "Write method not allowed for repository groups." );
230 log.debug( "Repository group '{}' accessed by '{}", repoGroup.getId(), activePrincipal );
232 // handle browse requests for virtual repos
233 if ( getLogicalResource( archivaLocator, null, true ).endsWith( "/" ) )
235 DavResource davResource =
236 getResourceFromGroup( request, archivaLocator,
239 setHeaders( response, locator, davResource, true );
246 // make a copy to avoid potential concurrent modifications (eg. by configuration)
247 // TODO: ultimately, locking might be more efficient than copying in this fashion since updates are
249 resource = processRepositoryGroup( request, archivaLocator, activePrincipal,
250 resourcesInAbsolutePath, repoGroup );
251 for (ManagedRepository repo : repoGroup.getRepositories() ) {
253 repositoryRequestInfo = repo.getRequestInfo();
262 // We do not provide folders for remote repositories
265 ManagedRepository repo = repositoryRegistry.getManagedRepository( sRepoId );
267 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
268 "Invalid repository: " + archivaLocator.getRepositoryId() );
270 ManagedRepositoryContent managedRepositoryContent = repo.getContent( );
271 if (managedRepositoryContent==null) {
272 log.error("Inconsistency detected. Repository content not found for '{}'", archivaLocator.getRepositoryId());
273 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
274 "Invalid repository: " + archivaLocator.getRepositoryId() );
277 log.debug( "Managed repository '{}' accessed by '{}'", managedRepositoryContent.getId(), activePrincipal );
279 resource = processRepository( request, archivaLocator, activePrincipal, managedRepositoryContent,
281 repositoryRequestInfo = repo.getRequestInfo();
282 String logicalResource = getLogicalResource( archivaLocator, null, false );
283 resourcesInAbsolutePath.add(
284 Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource ).toAbsolutePath().toString() );
288 String requestedResource = request.getRequestURI();
290 // MRM-872 : merge all available metadata
291 // merge metadata only when requested via the repo group
292 if ( ( repositoryRequestInfo.isMetadata( requestedResource ) || repositoryRequestInfo.isMetadataSupportFile(
293 requestedResource ) ) && isGroupRepo )
295 // this should only be at the project level not version level!
296 if ( isProjectReference( requestedResource ) )
299 ArchivaDavResource res = (ArchivaDavResource) resource;
301 if (res.getAsset().hasParent())
303 newPath = res.getAsset( ).getParent( ).getPath( ) + "/maven-metadata-" + sRepoId + ".xml";
305 newPath = StringUtils.substringBeforeLast( res.getAsset().getPath(), "/" ) + "/maven-metadata-" + sRepoId + ".xml";;
307 // for MRM-872 handle checksums of the merged metadata files
308 if ( repositoryRequestInfo.isSupportFile( requestedResource ) )
310 String metadataChecksumPath = newPath + "." + StringUtils.substringAfterLast( requestedResource, "." );
311 StorageAsset metadataChecksum = repoGroup.getAsset( metadataChecksumPath );
312 if ( repoGroup.getAsset( metadataChecksumPath ).exists() )
314 LogicalResource logicalResource =
315 new LogicalResource( getLogicalResource( archivaLocator, null, false ) );
320 new ArchivaDavResource( metadataChecksum, logicalResource.getPath(), repoGroup,
321 request.getRemoteAddr(), activePrincipal, request.getDavSession(),
322 archivaLocator, this, mimeTypes, auditListeners, scheduler);
324 catch ( LayoutException e )
326 log.error("Incompatible layout: {}", e.getMessage(), e);
327 throw new DavException( 500, e );
333 if ( resourcesInAbsolutePath != null && resourcesInAbsolutePath.size() > 1 )
335 // merge the metadata of all repos under group
336 ArchivaRepositoryMetadata mergedMetadata = new ArchivaRepositoryMetadata();
337 for ( String resourceAbsPath : resourcesInAbsolutePath )
341 Path metadataFile = Paths.get( resourceAbsPath );
342 FilesystemStorage storage = new FilesystemStorage( metadataFile.getParent( ), new DefaultFileLockManager( ) );
343 ArchivaRepositoryMetadata repoMetadata = repositoryRegistry.getMetadataReader( repoGroup.getType( ) ).read( storage.getAsset( metadataFile.getFileName().toString() ) );
344 mergedMetadata = RepositoryMetadataMerge.merge( mergedMetadata, repoMetadata );
346 catch ( RepositoryMetadataException r )
348 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
349 "Error occurred while merging metadata file." );
351 catch ( IOException e )
353 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
354 "Error occurred while merging metadata file." );
360 StorageAsset resourceFile = writeMergedMetadataToFile( repoGroup, mergedMetadata, newPath );
362 LogicalResource logicalResource =
363 new LogicalResource( getLogicalResource( archivaLocator, null, false ) );
366 new ArchivaDavResource( resourceFile, logicalResource.getPath(), repoGroup,
367 request.getRemoteAddr(), activePrincipal,
368 request.getDavSession(), archivaLocator, this, mimeTypes,
369 auditListeners, scheduler);
371 catch ( RepositoryMetadataException r )
373 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
374 "Error occurred while writing metadata file." );
376 catch ( IOException ie )
378 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
379 "Error occurred while generating checksum files." );
381 catch ( LayoutException e )
383 log.error("Incompatible layout: {}", e.getMessage(), e);
384 throw new DavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Incompatible layout for repository "+repoGroup.getId());
391 setHeaders( response, locator, resource, false );
393 // compatibility with MRM-440 to ensure browsing the repository works ok
394 if ( resource.isCollection() && !request.getRequestURI().endsWith( "/" ) )
396 throw new BrowserRedirectException( resource.getHref() );
398 resource.addLockManager( lockManager );
402 private DavResource processRepositoryGroup( final DavServletRequest request,
403 ArchivaDavResourceLocator archivaLocator,
404 String activePrincipal, List<String> resourcesInAbsolutePath,
405 RepositoryGroup repoGroup )
408 DavResource resource = null;
409 List<DavException> storedExceptions = new ArrayList<>();
411 String pathInfo = StringUtils.removeEnd( request.getPathInfo(), "/" );
413 String rootPath = StringUtils.substringBeforeLast( pathInfo, "/" );
415 String mergedIndexPath = "/";
416 if (repoGroup.supportsFeature( IndexCreationFeature.class )) {
417 mergedIndexPath = repoGroup.getFeature( IndexCreationFeature.class ).get().getIndexPath().getPath();
420 if ( StringUtils.endsWith( rootPath, mergedIndexPath ) )
422 // we are in the case of index file request
423 String requestedFileName = StringUtils.substringAfterLast( pathInfo, "/" );
424 StorageAsset temporaryIndexDirectory =
425 buildMergedIndexDirectory( activePrincipal, request, repoGroup );
426 StorageAsset asset = temporaryIndexDirectory.resolve(requestedFileName);
429 resource = new ArchivaDavResource( asset, requestedFileName, repoGroup,
430 request.getRemoteAddr(), activePrincipal, request.getDavSession(),
431 archivaLocator, this, mimeTypes, auditListeners, scheduler );
432 } catch (LayoutException e) {
433 log.error("Bad layout: {}", e.getMessage(), e);
434 throw new DavException(500, e);
440 for ( ManagedRepository repository : repoGroup.getRepositories() )
442 String repositoryId = repository.getId();
443 ManagedRepositoryContent managedRepositoryContent;
444 ManagedRepository managedRepository = repositoryRegistry.getManagedRepository( repositoryId );
445 if (managedRepository==null) {
446 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not find repository with id "+repositoryId );
448 managedRepositoryContent = managedRepository.getContent();
449 if (managedRepositoryContent==null) {
450 log.error("Inconsistency detected. Repository content not found for '{}'",repositoryId);
451 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not find repository content with id "+repositoryId );
455 DavResource updatedResource =
456 processRepository( request, archivaLocator, activePrincipal, managedRepositoryContent,
458 if ( resource == null )
460 resource = updatedResource;
463 String logicalResource = getLogicalResource( archivaLocator, null, false );
464 if ( logicalResource.endsWith( "/" ) )
466 logicalResource = logicalResource.substring( 1 );
468 resourcesInAbsolutePath.add(
469 Paths.get( managedRepositoryContent.getRepoRoot(), logicalResource ).toAbsolutePath().toString() );
471 catch ( DavException e )
473 storedExceptions.add( e );
477 if ( resource == null )
479 if ( !storedExceptions.isEmpty() )
482 for ( DavException e : storedExceptions )
484 if ( 401 == e.getErrorCode() )
490 throw new DavException( HttpServletResponse.SC_NOT_FOUND );
494 throw new DavException( HttpServletResponse.SC_NOT_FOUND );
500 private String getLogicalResource( ArchivaDavResourceLocator archivaLocator, org.apache.archiva.repository.ManagedRepository managedRepository,
501 boolean useOrigResourcePath )
503 // FIXME remove this hack
504 // but currently managedRepository can be null in case of group
505 String layout = managedRepository == null ? "default" : managedRepository.getLayout();
506 RepositoryStorage repositoryStorage =
507 this.applicationContext.getBean( "repositoryStorage#" + layout, RepositoryStorage.class );
508 String path = repositoryStorage.getFilePath(
509 useOrigResourcePath ? archivaLocator.getOrigResourcePath() : archivaLocator.getResourcePath(),
511 log.debug( "found path {} for resourcePath: '{}' with managedRepo '{}' and layout '{}'", path,
512 archivaLocator.getResourcePath(), managedRepository == null ? "null" : managedRepository.getId(),
517 private String evaluatePathWithVersion( ArchivaDavResourceLocator archivaLocator, //
518 ManagedRepositoryContent managedRepositoryContent, //
522 String layout = managedRepositoryContent.getRepository() == null
524 : managedRepositoryContent.getRepository().getLayout();
525 RepositoryStorage repositoryStorage =
526 this.applicationContext.getBean( "repositoryStorage#" + layout, RepositoryStorage.class );
529 return repositoryStorage.getFilePathWithVersion( archivaLocator.getResourcePath(), //
530 managedRepositoryContent );
532 catch ( RelocationException e )
534 String path = e.getPath();
535 log.debug( "Relocation to {}", path );
537 throw new BrowserRedirectException( addHrefPrefix( contextPath, path ), e.getRelocationType() );
539 catch (XMLException | IOException e )
541 log.error( e.getMessage(), e );
542 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
546 private DavResource processRepository( final DavServletRequest request, ArchivaDavResourceLocator archivaLocator,
547 String activePrincipal, ManagedRepositoryContent managedRepositoryContent,
548 org.apache.archiva.repository.ManagedRepository managedRepository )
551 DavResource resource = null;
552 if ( isAuthorized( request, managedRepositoryContent.getId() ) )
554 boolean readMethod = WebdavMethodUtil.isReadMethod( request.getMethod() );
555 // Maven Centric part ask evaluation if -SNAPSHOT
556 // MRM-1846 test if read method to prevent issue with maven 2.2.1 and uniqueVersion false
558 String path = readMethod
559 ? evaluatePathWithVersion( archivaLocator, managedRepositoryContent, request.getContextPath() )
560 : getLogicalResource( archivaLocator, managedRepository, false );
561 if ( path.startsWith( "/" ) )
563 path = path.substring( 1 );
565 LogicalResource logicalResource = new LogicalResource( path );
566 StorageAsset repoAsset = managedRepository.getAsset( path );
567 // Path resourceFile = Paths.get( managedRepositoryContent.getRepoRoot(), path );
571 new ArchivaDavResource( repoAsset, path, managedRepository,
572 request.getRemoteAddr(), activePrincipal, request.getDavSession(),
573 archivaLocator, this, mimeTypes, auditListeners, scheduler );
575 catch ( LayoutException e )
577 log.error("Incompatible layout: {}", e.getMessage(), e);
578 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
581 if ( WebdavMethodUtil.isReadMethod( request.getMethod() ) )
583 if ( archivaLocator.getHref( false ).endsWith( "/" ) && !repoAsset.isContainer() )
585 // force a resource not found
586 throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Resource does not exist" );
590 if ( !resource.isCollection() )
592 boolean previouslyExisted = repoAsset.exists();
594 boolean fromProxy = fetchContentFromProxies( managedRepository, request, logicalResource );
596 StorageAsset resourceAsset=null;
597 // At this point the incoming request can either be in default or
598 // legacy layout format.
601 // Perform an adjustment of the resource to the managed
602 // repository expected path.
603 // String localResourcePath = managedRepository.getRequestInfo().toNativePath( logicalResource.getPath() );
604 resourceAsset = managedRepository.getAsset( logicalResource.getPath() );
606 new ArchivaDavResource( resourceAsset, logicalResource.getPath(),
608 request.getRemoteAddr(), activePrincipal,
609 request.getDavSession(), archivaLocator, this, mimeTypes,
610 auditListeners, scheduler );
612 catch ( LayoutException e )
614 if ( resourceAsset==null || !resourceAsset.exists() )
616 throw new DavException( HttpServletResponse.SC_NOT_FOUND, e );
622 String action = ( previouslyExisted ? AuditEvent.MODIFY_FILE : AuditEvent.CREATE_FILE )
625 log.debug( "Proxied artifact '{}' in repository '{}' (current user '{}')",
626 resourceAsset.getName(), managedRepositoryContent.getId(), activePrincipal );
628 triggerAuditEvent( request.getRemoteAddr(), archivaLocator.getRepositoryId(),
629 logicalResource.getPath(), action, activePrincipal );
632 if ( !resourceAsset.exists() )
634 throw new DavException( HttpServletResponse.SC_NOT_FOUND, "Resource does not exist" );
640 if ( request.getMethod().equals( HTTP_PUT_METHOD ) )
642 String resourcePath = logicalResource.getPath();
643 RepositoryRequestInfo repositoryRequestInfo = managedRepository.getRequestInfo();
644 // check if target repo is enabled for releases
645 // we suppose that release-artifacts can be deployed only to repos enabled for releases
646 if ( managedRepositoryContent.getRepository().getActiveReleaseSchemes().contains( ReleaseScheme.RELEASE ) && !repositoryRequestInfo.isMetadata(
647 resourcePath ) && !repositoryRequestInfo.isSupportFile( resourcePath ) )
649 ArtifactReference artifact = null;
652 artifact = managedRepositoryContent.toArtifactReference( resourcePath );
654 if ( !VersionUtil.isSnapshot( artifact.getVersion() ) )
656 // check if artifact already exists and if artifact re-deployment to the repository is allowed
657 if ( managedRepositoryContent.hasContent( artifact )
658 && managedRepositoryContent.getRepository().blocksRedeployments())
660 log.warn( "Overwriting released artifacts in repository '{}' is not allowed.",
661 managedRepositoryContent.getId() );
662 throw new DavException( HttpServletResponse.SC_CONFLICT,
663 "Overwriting released artifacts is not allowed." );
667 catch ( LayoutException e )
669 log.warn( "Artifact path '{}' is invalid.", resourcePath );
671 catch ( org.apache.archiva.repository.ContentAccessException e )
673 e.printStackTrace( );
678 * Create parent directories that don't exist when writing a file This actually makes this
679 * implementation not compliant to the WebDAV RFC - but we have enough knowledge about how the
680 * collection is being used to do this reasonably and some versions of Maven's WebDAV don't correctly
681 * create the collections themselves.
684 Path rootDirectory = Paths.get( managedRepositoryContent.getRepoRoot() );
685 Path destDir = rootDirectory.resolve( logicalResource.getPath() ).getParent();
687 if ( !Files.exists(destDir) )
691 Files.createDirectories( destDir );
693 catch ( IOException e )
695 log.error("Could not create directory {}: {}", destDir, e.getMessage(), e);
696 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not create directory "+destDir );
698 String relPath = PathUtil.getRelative( rootDirectory.toAbsolutePath().toString(), destDir );
700 log.debug( "Creating destination directory '{}' (current user '{}')", destDir.getFileName(),
703 triggerAuditEvent( request.getRemoteAddr(), managedRepositoryContent.getId(), relPath,
704 AuditEvent.CREATE_DIR, activePrincipal );
712 public DavResource createResource( final DavResourceLocator locator, final DavSession davSession )
715 ArchivaDavResourceLocator archivaLocator = checkLocatorIsInstanceOfRepositoryLocator( locator );
717 ManagedRepositoryContent managedRepositoryContent;
718 ManagedRepository repo = repositoryRegistry.getManagedRepository( archivaLocator.getRepositoryId( ) );
720 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
721 "Invalid repository: " + archivaLocator.getRepositoryId() );
723 managedRepositoryContent = repo.getContent();
724 if (managedRepositoryContent==null) {
725 log.error("Inconsistency detected. Repository content not found for '{}'", archivaLocator.getRepositoryId());
726 throw new DavException( HttpServletResponse.SC_NOT_FOUND,
727 "Invalid repository: " + archivaLocator.getRepositoryId() );
730 DavResource resource = null;
731 String logicalResource = getLogicalResource( archivaLocator, repo, false );
732 if ( logicalResource.startsWith( "/" ) )
734 logicalResource = logicalResource.substring( 1 );
736 StorageAsset resourceAsset = repo.getAsset( logicalResource );
739 resource = new ArchivaDavResource( resourceAsset, logicalResource,
740 repo, davSession, archivaLocator,
741 this, mimeTypes, auditListeners, scheduler);
743 catch ( LayoutException e )
745 log.error( "Incompatible layout: {}", e.getMessage( ), e );
746 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
749 resource.addLockManager( lockManager );
753 private boolean fetchContentFromProxies( ManagedRepository managedRepository, DavServletRequest request,
754 LogicalResource resource )
757 String path = resource.getPath();
758 if (!proxyRegistry.hasHandler(managedRepository.getType())) {
759 throw new DavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "No proxy handler found for repository type "+managedRepository.getType());
761 RepositoryRequestInfo repositoryRequestInfo = managedRepository.getRequestInfo();
762 RepositoryProxyHandler proxyHandler = proxyRegistry.getHandler(managedRepository.getType()).get(0);
763 if ( repositoryRequestInfo.isSupportFile( path ) )
765 StorageAsset proxiedFile = proxyHandler.fetchFromProxies( managedRepository, path );
767 return ( proxiedFile != null );
770 // Is it a Metadata resource?
771 if ( "default".equals(repositoryRequestInfo.getLayout( path )) && repositoryRequestInfo.isMetadata( path ) )
773 return proxyHandler.fetchMetadataFromProxies( managedRepository, path ).isModified();
776 // Is it an Archetype Catalog?
777 if ( repositoryRequestInfo.isArchetypeCatalog( path ) )
779 // FIXME we must implement a merge of remote archetype catalog from remote servers.
780 StorageAsset proxiedFile = proxyHandler.fetchFromProxies( managedRepository, path );
782 return ( proxiedFile != null );
785 // Not any of the above? Then it's gotta be an artifact reference.
788 // Get the artifact reference in a layout neutral way.
789 ArtifactReference artifact = repositoryRequestInfo.toArtifactReference( path );
791 if ( artifact != null )
793 String repositoryLayout = managedRepository.getLayout();
795 RepositoryStorage repositoryStorage =
796 this.applicationContext.getBean( "repositoryStorage#" + repositoryLayout, RepositoryStorage.class );
797 repositoryStorage.applyServerSideRelocation( managedRepository, artifact );
799 StorageAsset proxiedFile = proxyHandler.fetchFromProxies( managedRepository, artifact );
801 resource.setPath( managedRepository.getContent().toPath( artifact ) );
803 log.debug( "Proxied artifact '{}:{}:{}'", artifact.getGroupId(), artifact.getArtifactId(),
804 artifact.getVersion() );
806 return ( proxiedFile != null );
809 catch ( LayoutException e )
813 catch ( ProxyDownloadException e )
815 log.error( e.getMessage(), e );
816 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
817 "Unable to fetch artifact resource." );
824 private void triggerAuditEvent( String remoteIP, String repositoryId, String resource, String action,
827 AuditEvent event = new AuditEvent( repositoryId, principal, resource, action );
828 event.setRemoteIP( remoteIP );
830 for ( AuditListener listener : auditListeners )
832 listener.auditEvent( event );
837 public void addAuditListener( AuditListener listener )
839 this.auditListeners.add( listener );
843 public void clearAuditListeners()
845 this.auditListeners.clear();
849 public void removeAuditListener( AuditListener listener )
851 this.auditListeners.remove( listener );
854 private void setHeaders( DavServletResponse response, DavResourceLocator locator, DavResource resource,
857 // [MRM-503] - Metadata file need Pragma:no-cache response
859 if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) || ( resource instanceof ArchivaDavResource
860 && ( ArchivaDavResource.class.cast( resource ).getAsset().isContainer() ) ) )
862 response.setHeader( "Pragma", "no-cache" );
863 response.setHeader( "Cache-Control", "no-cache" );
864 response.setDateHeader( "Last-Modified", new Date().getTime() );
866 // if the resource is a directory don't cache it as new groupId deployed will be available
867 // without need of refreshing browser
868 else if ( locator.getResourcePath().endsWith( "/maven-metadata.xml" ) || (
869 resource instanceof ArchivaVirtualDavResource && ( Files.isDirectory(Paths.get(
870 ArchivaVirtualDavResource.class.cast( resource ).getLogicalResource() )) ) ) )
872 response.setHeader( "Pragma", "no-cache" );
873 response.setHeader( "Cache-Control", "no-cache" );
874 response.setDateHeader( "Last-Modified", new Date().getTime() );
878 if ( resource instanceof ArchivaVirtualDavResource )
880 //MRM-1854 here we have a directory so force "Last-Modified"
881 response.setDateHeader( "Last-Modified", new Date().getTime() );
886 // We need to specify this so connecting wagons can work correctly
887 response.setDateHeader( "Last-Modified", resource.getModificationTime() );
889 // TODO: [MRM-524] determine http caching options for other types of files (artifacts, sha1, md5, snapshots)
892 private ArchivaDavResourceLocator checkLocatorIsInstanceOfRepositoryLocator( DavResourceLocator locator )
895 if ( !( locator instanceof ArchivaDavResourceLocator ) )
897 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
898 "Locator does not implement RepositoryLocator" );
902 if ( locator.getResourcePath().startsWith( ArchivaDavResource.HIDDEN_PATH_PREFIX ) )
904 throw new DavException( HttpServletResponse.SC_NOT_FOUND );
907 ArchivaDavResourceLocator archivaLocator = (ArchivaDavResourceLocator) locator;
909 // MRM-419 - Windows Webdav support. Should not 404 if there is no content.
910 if ( StringUtils.isEmpty( archivaLocator.getRepositoryId() ) )
912 throw new DavException( HttpServletResponse.SC_NO_CONTENT );
914 return archivaLocator;
917 private String addHrefPrefix( String contextPath, String path ) {
918 String prefix = archivaConfiguration.getConfiguration().getWebapp().getUi().getApplicationUrl();
919 if (prefix == null || prefix.isEmpty()) {
920 prefix = contextPath;
922 return prefix + ( StringUtils.startsWith( path, "/" ) ? "" :
923 ( StringUtils.endsWith( prefix, "/" ) ? "" : "/" ) )
927 public void setProxyRegistry(ProxyRegistry proxyRegistry) {
928 this.proxyRegistry = proxyRegistry;
931 public ProxyRegistry getProxyRegistry() {
932 return this.proxyRegistry;
935 private static class LogicalResource
939 public LogicalResource( String path )
944 public String getPath()
949 public void setPath( String path )
955 protected boolean isAuthorized( DavServletRequest request, String repositoryId )
960 AuthenticationResult result = httpAuth.getAuthenticationResult( request, null );
961 SecuritySession securitySession = httpAuth.getSecuritySession( request.getSession( true ) );
963 return servletAuth.isAuthenticated( request, result ) //
964 && servletAuth.isAuthorized( request, securitySession, repositoryId, //
965 WebdavMethodUtil.getMethodPermission( request.getMethod() ) );
967 catch ( AuthenticationException e )
969 // safety check for MRM-911
970 String guest = UserManager.GUEST_USERNAME;
973 if ( servletAuth.isAuthorized( guest,
974 ( (ArchivaDavResourceLocator) request.getRequestLocator() ).getRepositoryId(),
975 WebdavMethodUtil.getMethodPermission( request.getMethod() ) ) )
980 catch ( UnauthorizedException ae )
982 throw new UnauthorizedDavException( repositoryId,
983 "You are not authenticated and authorized to access any repository." );
986 throw new UnauthorizedDavException( repositoryId, "You are not authenticated" );
988 catch ( MustChangePasswordException e )
990 throw new UnauthorizedDavException( repositoryId, "You must change your password." );
992 catch ( AccountLockedException e )
994 throw new UnauthorizedDavException( repositoryId, "User account is locked." );
996 catch ( AuthorizationException e )
998 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
999 "Fatal Authorization Subsystem Error." );
1001 catch ( UnauthorizedException e )
1003 throw new UnauthorizedDavException( repositoryId, e.getMessage() );
1007 private DavResource getResourceFromGroup( DavServletRequest request,
1008 ArchivaDavResourceLocator locator,
1009 RepositoryGroup repositoryGroup )
1012 final String id = repositoryGroup.getId();
1013 final List<ManagedRepository> repositories = repositoryGroup.getRepositories();
1014 if ( repositories == null
1015 || repositories.isEmpty() )
1018 return new ArchivaDavResource( repositoryGroup.getAsset("/"), "groups/" + id, null,
1019 request.getDavSession(), locator, this, mimeTypes, auditListeners, scheduler);
1020 } catch (LayoutException e) {
1021 log.error("Bad repository layout: {}", e.getMessage(), e);
1022 throw new DavException(500, e);
1025 List<StorageAsset> mergedRepositoryContents = new ArrayList<>();
1027 ManagedRepository firstRepo = repositories.get( 0 );
1029 String path = getLogicalResource( locator, firstRepo, false );
1030 if ( path.startsWith( "/" ) )
1032 path = path.substring( 1 );
1034 LogicalResource logicalResource = new LogicalResource( path );
1037 // if the current user logged in has permission to any of the repositories, allow user to
1038 // browse the repo group but displaying only the repositories which the user has permission to access.
1039 // otherwise, prompt for authentication.
1041 String activePrincipal = getActivePrincipal( request );
1043 boolean allow = isAllowedToContinue( request, repositories, activePrincipal );
1046 String pathInfo = StringUtils.removeEnd( request.getPathInfo(), "/" );
1047 String mergedIndexPath = "/";
1048 if (repositoryGroup.supportsFeature( IndexCreationFeature.class )) {
1049 IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get();
1050 mergedIndexPath = indexCreationFeature.getIndexPath().getPath();
1056 if ( StringUtils.endsWith( pathInfo, mergedIndexPath ) )
1058 StorageAsset mergedRepoDirPath =
1059 buildMergedIndexDirectory( activePrincipal, request, repositoryGroup );
1060 mergedRepositoryContents.add( mergedRepoDirPath );
1064 if ( StringUtils.equalsIgnoreCase( pathInfo, "/" + id ) )
1066 Path tmpDirectory = Paths.get( SystemUtils.getJavaIoTmpDir().toString(),
1069 if ( !Files.exists(tmpDirectory) )
1071 synchronized ( tmpDirectory.toAbsolutePath().toString() )
1073 if ( !Files.exists(tmpDirectory) )
1077 Files.createDirectories( tmpDirectory );
1079 catch ( IOException e )
1081 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not create direcotory "+tmpDirectory );
1087 FilesystemStorage storage = new FilesystemStorage(tmpDirectory.getParent(), new DefaultFileLockManager());
1088 mergedRepositoryContents.add( storage.getAsset("") );
1089 } catch (IOException e) {
1090 throw new DavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not create storage for " + tmpDirectory);
1093 for ( ManagedRepository repo : repositories )
1095 ManagedRepositoryContent managedRepository = null;
1097 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
1098 "Invalid managed repository <" + repo.getId() + ">");
1100 managedRepository = repo.getContent();
1101 if (managedRepository==null) {
1102 log.error("Inconsistency detected. Repository content not found for '{}'",repo.getId());
1103 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
1104 "Invalid managed repository <" + repo.getId() + ">");
1106 // Path resourceFile = Paths.get( managedRepository.getRepoRoot(), logicalResource.getPath() );
1107 StorageAsset resourceFile = repo.getAsset(logicalResource.getPath());
1108 if ( resourceFile.exists() && managedRepository.getRepository().supportsFeature( IndexCreationFeature.class ))
1110 // in case of group displaying index directory doesn't have sense !!
1111 IndexCreationFeature idf = managedRepository.getRepository().getFeature(IndexCreationFeature.class).get();
1112 StorageAsset repoIndexDirectory = idf.getLocalIndexPath();
1113 if ( !StringUtils.equals( FilenameUtils.normalize( repoIndexDirectory.getPath() ),
1114 FilenameUtils.normalize( logicalResource.getPath() ) ) )
1116 // for prompted authentication
1117 if ( httpAuth.getSecuritySession( request.getSession( true ) ) != null )
1121 if ( isAuthorized( request, repo.getId() ) )
1123 mergedRepositoryContents.add( resourceFile );
1124 log.debug( "Repository '{}' accessed by '{}'", repo.getId(), activePrincipal );
1127 catch ( DavException e )
1129 // TODO: review exception handling
1131 log.debug( "Skipping repository '{}' for user '{}': {}", managedRepository,
1132 activePrincipal, e.getMessage() );
1139 // for the current user logged in
1142 if ( servletAuth.isAuthorized( activePrincipal, repo.getId(),
1143 WebdavMethodUtil.getMethodPermission(
1144 request.getMethod() ) ) )
1146 mergedRepositoryContents.add( resourceFile );
1147 log.debug( "Repository '{}' accessed by '{}'", repo.getId(), activePrincipal );
1150 catch ( UnauthorizedException e )
1152 // TODO: review exception handling
1154 log.debug( "Skipping repository '{}' for user '{}': {}", managedRepository,
1155 activePrincipal, e.getMessage() );
1166 throw new UnauthorizedDavException( locator.getRepositoryId(), "User not authorized." );
1169 ArchivaVirtualDavResource resource =
1170 new ArchivaVirtualDavResource( mergedRepositoryContents, logicalResource.getPath(), mimeTypes, locator,
1173 // compatibility with MRM-440 to ensure browsing the repository group works ok
1174 if ( resource.isCollection() && !request.getRequestURI().endsWith( "/" ) )
1176 throw new BrowserRedirectException( resource.getHref() );
1182 protected String getActivePrincipal( DavServletRequest request )
1184 User sessionUser = httpAuth.getSessionUser( request.getSession() );
1185 return sessionUser != null ? sessionUser.getUsername() : UserManager.GUEST_USERNAME;
1189 * Check if the current user is authorized to access any of the repos
1192 * @param repositories
1193 * @param activePrincipal
1196 private boolean isAllowedToContinue( DavServletRequest request, List<ManagedRepository> repositories, String activePrincipal )
1198 // when no repositories configured it's impossible to browse nothing !
1199 // at least make possible to see nothing :-)
1200 if ( repositories == null || repositories.isEmpty() )
1205 boolean allow = false;
1207 // if securitySession != null, it means that the user was prompted for authentication
1208 if ( httpAuth.getSecuritySession( request.getSession() ) != null )
1210 for ( ManagedRepository repository : repositories )
1214 if ( isAuthorized( request, repository.getId() ) )
1220 catch ( DavException e )
1228 for ( ManagedRepository repository : repositories )
1232 if ( servletAuth.isAuthorized( activePrincipal, repository.getId(),
1233 WebdavMethodUtil.getMethodPermission( request.getMethod() ) ) )
1239 catch ( UnauthorizedException e )
1249 private StorageAsset writeMergedMetadataToFile( RepositoryGroup repoGroup, ArchivaRepositoryMetadata mergedMetadata, String outputFilename )
1250 throws RepositoryMetadataException, IOException
1252 StorageAsset asset = repoGroup.addAsset( outputFilename, false );
1253 OutputStream stream = asset.getWriteStream( true );
1254 OutputStreamWriter sw = new OutputStreamWriter( stream, "UTF-8" );
1255 RepositoryMetadataWriter.write( mergedMetadata, sw );
1257 createChecksumFiles( repoGroup, outputFilename );
1262 private void createChecksumFiles(RepositoryGroup repo, String path) {
1263 List<ChecksumAlgorithm> algorithms = ChecksumUtil.getAlgorithms( archivaConfiguration.getConfiguration( ).getArchivaRuntimeConfiguration( ).getChecksumTypes( ) );
1264 List<OutputStream> outStreams = algorithms.stream( ).map( algo -> {
1265 String ext = algo.getDefaultExtension( );
1268 return repo.getAsset( path + "." + ext ).getWriteStream( true );
1270 catch ( IOException e )
1272 e.printStackTrace( );
1275 } ).filter( Objects::nonNull ).collect( Collectors.toList( ) );
1278 StreamingChecksum.updateChecksums( repo.getAsset(path).getReadStream(), algorithms, outStreams );
1280 catch ( IOException e )
1282 e.printStackTrace( );
1288 private boolean isProjectReference( String requestedResource )
1292 metadataTools.toVersionedReference( requestedResource );
1295 catch ( RepositoryMetadataException re )
1301 protected StorageAsset buildMergedIndexDirectory( String activePrincipal,
1302 DavServletRequest request,
1303 RepositoryGroup repositoryGroup )
1309 final List<ManagedRepository> repositories = repositoryGroup.getRepositories();
1310 HttpSession session = request.getSession();
1312 @SuppressWarnings( "unchecked" ) Map<String, TemporaryGroupIndex> temporaryGroupIndexMap =
1313 (Map<String, TemporaryGroupIndex>) session.getAttribute(
1314 TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY );
1315 if ( temporaryGroupIndexMap == null )
1317 temporaryGroupIndexMap = new HashMap<>();
1320 final String id = repositoryGroup.getId();
1321 TemporaryGroupIndex tmp = temporaryGroupIndexMap.get(id);
1323 if ( tmp != null && tmp.getDirectory() != null && tmp.getDirectory().exists())
1325 if ( System.currentTimeMillis() - tmp.getCreationTime() > (
1326 repositoryGroup.getMergedIndexTTL() * 60 * 1000 ) )
1328 log.debug( MarkerFactory.getMarker( "group.merged.index" ),
1329 "tmp group index '{}' is too old so delete it", id);
1330 indexMerger.cleanTemporaryGroupIndex( tmp );
1334 log.debug( MarkerFactory.getMarker( "group.merged.index" ),
1335 "merged index for group '{}' found in cache", id);
1336 return tmp.getDirectory();
1340 Set<String> authzRepos = new HashSet<String>();
1342 String permission = WebdavMethodUtil.getMethodPermission( request.getMethod() );
1344 for ( ManagedRepository repository : repositories )
1348 if ( servletAuth.isAuthorized( activePrincipal, repository.getId(), permission ) )
1350 authzRepos.add( repository.getId() );
1351 authzRepos.addAll( this.repositorySearch.getRemoteIndexingContextIds( repository.getId() ) );
1354 catch ( UnauthorizedException e )
1356 // TODO: review exception handling
1358 log.debug( "Skipping repository '{}' for user '{}': {}", repository, activePrincipal,
1364 log.info( "generate temporary merged index for repository group '{}' for repositories '{}'",
1367 IndexCreationFeature indexCreationFeature = repositoryGroup.getFeature( IndexCreationFeature.class ).get();
1368 Path indexPath = indexCreationFeature.getLocalIndexPath().getFilePath();
1369 if (indexPath!=null)
1371 Path tempRepoFile = Files.createTempDirectory( "temp" );
1372 tempRepoFile.toFile( ).deleteOnExit( );
1373 FilesystemStorage storage = new FilesystemStorage(tempRepoFile, new DefaultFileLockManager());
1374 StorageAsset tmpAsset = storage.getAsset("");
1376 IndexMergerRequest indexMergerRequest =
1377 new IndexMergerRequest( authzRepos, true, id,
1378 indexPath.toString( ),
1379 repositoryGroup.getMergedIndexTTL( ) ).mergedIndexDirectory(
1380 tmpAsset ).temporary( true );
1382 MergedRemoteIndexesTaskRequest taskRequest =
1383 new MergedRemoteIndexesTaskRequest( indexMergerRequest, indexMerger );
1385 MergedRemoteIndexesTask job = new MergedRemoteIndexesTask( taskRequest );
1387 ArchivaIndexingContext indexingContext = job.execute( ).getIndexingContext( );
1389 StorageAsset mergedRepoDir = indexingContext.getPath( );
1390 TemporaryGroupIndex temporaryGroupIndex =
1391 new TemporaryGroupIndex( mergedRepoDir, indexingContext.getId( ), id,
1392 repositoryGroup.getMergedIndexTTL( ) ) //
1393 .setCreationTime( new Date( ).getTime( ) );
1394 temporaryGroupIndexMap.put( id, temporaryGroupIndex );
1395 session.setAttribute( TemporaryGroupIndexSessionCleaner.TEMPORARY_INDEX_SESSION_KEY,
1396 temporaryGroupIndexMap );
1397 return mergedRepoDir;
1399 log.error("Local index path for repository group {} does not exist.", repositoryGroup.getId());
1400 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR );
1403 catch ( RepositorySearchException e )
1405 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
1407 catch ( IndexMergerException e )
1409 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
1411 catch ( IOException e )
1413 throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
1418 public void setServletAuth( ServletAuthenticator servletAuth )
1420 this.servletAuth = servletAuth;
1423 public void setHttpAuth( HttpAuthenticator httpAuth )
1425 this.httpAuth = httpAuth;
1428 public void setScheduler( RepositoryArchivaTaskScheduler scheduler )
1430 this.scheduler = scheduler;
1433 public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
1435 this.archivaConfiguration = archivaConfiguration;
1438 public RemoteRepositoryAdmin getRemoteRepositoryAdmin()
1440 return remoteRepositoryAdmin;
1443 public void setRemoteRepositoryAdmin( RemoteRepositoryAdmin remoteRepositoryAdmin )
1445 this.remoteRepositoryAdmin = remoteRepositoryAdmin;
1448 public ManagedRepositoryAdmin getManagedRepositoryAdmin()
1450 return managedRepositoryAdmin;
1453 public void setManagedRepositoryAdmin( ManagedRepositoryAdmin managedRepositoryAdmin )
1455 this.managedRepositoryAdmin = managedRepositoryAdmin;
1458 public RepositoryRegistry getRepositoryRegistry( )
1460 return repositoryRegistry;
1463 public void setRepositoryRegistry( RepositoryRegistry repositoryRegistry )
1465 this.repositoryRegistry = repositoryRegistry;