1 package org.apache.archiva.admin.repository.managed;
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
21 import org.apache.archiva.admin.model.AuditInformation;
22 import org.apache.archiva.admin.model.RepositoryAdminException;
23 import org.apache.archiva.admin.model.beans.ManagedRepository;
24 import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin;
25 import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
26 import org.apache.archiva.configuration.Configuration;
27 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
28 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
29 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
30 import org.apache.archiva.metadata.model.facets.AuditEvent;
31 import org.apache.archiva.metadata.repository.MetadataRepository;
32 import org.apache.archiva.metadata.repository.MetadataRepositoryException;
33 import org.apache.archiva.metadata.repository.RepositorySession;
34 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
35 import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsManager;
36 import org.apache.archiva.redback.components.cache.Cache;
37 import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
38 import org.apache.archiva.redback.role.RoleManager;
39 import org.apache.archiva.redback.role.RoleManagerException;
40 import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
41 import org.apache.archiva.scheduler.repository.model.RepositoryTask;
42 import org.apache.archiva.security.common.ArchivaRoleConstants;
43 import org.apache.commons.io.FileUtils;
44 import org.apache.commons.lang.StringUtils;
45 import org.apache.maven.index.NexusIndexer;
46 import org.apache.maven.index.context.IndexCreator;
47 import org.apache.maven.index.context.IndexingContext;
48 import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
49 import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException;
50 import org.slf4j.Logger;
51 import org.slf4j.LoggerFactory;
52 import org.springframework.stereotype.Service;
54 import javax.annotation.PostConstruct;
55 import javax.annotation.PreDestroy;
56 import javax.inject.Inject;
57 import javax.inject.Named;
59 import java.io.IOException;
60 import java.net.MalformedURLException;
61 import java.util.ArrayList;
62 import java.util.Collection;
63 import java.util.Collections;
64 import java.util.HashMap;
65 import java.util.List;
69 * FIXME review the staging mechanism to have a per user session one
71 * @author Olivier Lamy
73 @Service("managedRepositoryAdmin#default")
74 public class DefaultManagedRepositoryAdmin
75 extends AbstractRepositoryAdmin
76 implements ManagedRepositoryAdmin
79 private Logger log = LoggerFactory.getLogger( getClass() );
81 public static final String STAGE_REPO_ID_END = "-stage";
84 @Named(value = "archivaTaskScheduler#repository")
85 private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
88 * FIXME: this could be multiple implementations and needs to be configured.
91 private RepositorySessionFactory repositorySessionFactory;
94 private RepositoryStatisticsManager repositoryStatisticsManager;
97 protected RoleManager roleManager;
100 @Named(value = "cache#namespaces")
101 private Cache<String, Collection<String>> namespacesCache;
105 private List<? extends IndexCreator> indexCreators;
108 private NexusIndexer indexer;
111 public void initialize()
112 throws RepositoryAdminException, RoleManagerException
114 // initialize index context on start and check roles here
115 for ( ManagedRepository managedRepository : getManagedRepositories() )
117 createIndexContext( managedRepository );
118 addRepositoryRoles( managedRepository.getId() );
124 public void shutdown()
125 throws RepositoryAdminException
129 // close index on shutdown
130 for ( ManagedRepository managedRepository : getManagedRepositories() )
132 IndexingContext context = indexer.getIndexingContexts().get( managedRepository.getId() );
133 if ( context != null )
135 indexer.removeIndexingContext( context, false );
139 catch ( IOException e )
141 throw new RepositoryAdminException( e.getMessage(), e );
146 public List<ManagedRepository> getManagedRepositories()
147 throws RepositoryAdminException
149 List<ManagedRepositoryConfiguration> managedRepoConfigs =
150 getArchivaConfiguration().getConfiguration().getManagedRepositories();
152 if ( managedRepoConfigs == null )
154 return Collections.emptyList();
157 List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() );
159 for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
161 ManagedRepository repo =
162 new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
163 repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
164 repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
165 repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
166 repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(),
167 repoConfig.isStageRepoNeeded() );
168 repo.setDescription( repoConfig.getDescription() );
169 repo.setSkipPackedIndexCreation( repoConfig.isSkipPackedIndexCreation() );
170 managedRepos.add( repo );
177 public Map<String, ManagedRepository> getManagedRepositoriesAsMap()
178 throws RepositoryAdminException
180 List<ManagedRepository> managedRepositories = getManagedRepositories();
181 Map<String, ManagedRepository> repositoriesMap = new HashMap<>( managedRepositories.size() );
182 for ( ManagedRepository managedRepository : managedRepositories )
184 repositoriesMap.put( managedRepository.getId(), managedRepository );
186 return repositoriesMap;
190 public ManagedRepository getManagedRepository( String repositoryId )
191 throws RepositoryAdminException
193 List<ManagedRepository> repos = getManagedRepositories();
194 for ( ManagedRepository repo : repos )
196 if ( StringUtils.equals( repo.getId(), repositoryId ) )
205 public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
206 AuditInformation auditInformation )
207 throws RepositoryAdminException
210 getRepositoryCommonValidator().basicValidation( managedRepository, false );
211 getRepositoryCommonValidator().validateManagedRepository( managedRepository );
212 triggerAuditEvent( managedRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
214 addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
215 managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
216 managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
217 managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
218 managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
219 managedRepository.isDeleteReleasedSnapshots(), managedRepository.getDescription(),
220 managedRepository.isSkipPackedIndexCreation(), managedRepository.isScanned(),
221 auditInformation, getArchivaConfiguration().getConfiguration() ) != null;
223 createIndexContext( managedRepository );
228 private ManagedRepositoryConfiguration addManagedRepository( String repoId, String layout, String name,
229 String location, boolean blockRedeployments,
230 boolean releasesIncluded, boolean snapshotsIncluded,
231 boolean stageRepoNeeded, String cronExpression,
232 String indexDir, int daysOlder, int retentionCount,
233 boolean deteleReleasedSnapshots, String description,
234 boolean skipPackedIndexCreation, boolean scanned,
235 AuditInformation auditInformation,
236 Configuration config )
237 throws RepositoryAdminException
240 ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
242 repository.setId( repoId );
243 repository.setBlockRedeployments( blockRedeployments );
244 repository.setReleases( releasesIncluded );
245 repository.setSnapshots( snapshotsIncluded );
246 repository.setScanned( scanned );
247 repository.setName( name );
248 repository.setLocation( getRepositoryCommonValidator().removeExpressions( location ) );
249 repository.setLayout( layout );
250 repository.setRefreshCronExpression( cronExpression );
251 repository.setIndexDir( indexDir );
252 repository.setDaysOlder( daysOlder );
253 repository.setRetentionCount( retentionCount );
254 repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots );
255 repository.setIndexDir( indexDir );
256 repository.setDescription( description );
257 repository.setSkipPackedIndexCreation( skipPackedIndexCreation );
258 repository.setStageRepoNeeded( stageRepoNeeded );
262 addRepository( repository, config );
263 addRepositoryRoles( repository.getId() );
265 if ( stageRepoNeeded )
267 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
268 addRepository( stagingRepository, config );
269 addRepositoryRoles( stagingRepository.getId() );
270 triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
273 catch ( RoleManagerException e )
275 throw new RepositoryAdminException( "failed to add repository roles " + e.getMessage(), e );
277 catch ( IOException e )
279 throw new RepositoryAdminException( "failed to add repository " + e.getMessage(), e );
282 saveConfiguration( config );
284 //MRM-1342 Repository statistics report doesn't appear to be working correctly
285 //scan repository when adding of repository is successful
290 scanRepository( repoId, true );
293 // TODO need a better to define scanning or not for staged repo
294 if ( stageRepoNeeded && scanned )
296 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
297 scanRepository( stagingRepository.getId(), true );
300 catch ( Exception e )
302 log.warn( new StringBuilder( "Unable to scan repository [" ).append( repoId ).append( "]: " ).append(
303 e.getMessage() ).toString(), e );
310 public Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation,
311 boolean deleteContent )
312 throws RepositoryAdminException
314 Configuration config = getArchivaConfiguration().getConfiguration();
316 ManagedRepositoryConfiguration repository = config.findManagedRepositoryById( repositoryId );
318 if ( repository == null )
320 throw new RepositoryAdminException( "A repository with that id does not exist" );
323 triggerAuditEvent( repositoryId, null, AuditEvent.DELETE_MANAGED_REPO, auditInformation );
325 deleteManagedRepository( repository, deleteContent, config, false );
327 // stage repo exists ?
328 ManagedRepositoryConfiguration stagingRepository =
329 getArchivaConfiguration().getConfiguration().findManagedRepositoryById( repositoryId + STAGE_REPO_ID_END );
330 if ( stagingRepository != null )
332 // do not trigger event when deleting the staged one
333 deleteManagedRepository( stagingRepository, deleteContent, config, true );
338 saveConfiguration( config );
340 catch ( Exception e )
342 throw new RepositoryAdminException( "Error saving configuration for delete action" + e.getMessage(), e );
348 private Boolean deleteManagedRepository( ManagedRepositoryConfiguration repository, boolean deleteContent,
349 Configuration config, boolean stagedOne )
350 throws RepositoryAdminException
355 IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
356 if ( context != null )
358 // delete content only if directory exists
359 indexer.removeIndexingContext( context,
360 deleteContent && context.getIndexDirectoryFile().exists() );
363 catch ( IOException e )
365 throw new RepositoryAdminException( e.getMessage(), e );
369 RepositorySession repositorySession = getRepositorySessionFactory().createSession();
372 MetadataRepository metadataRepository = repositorySession.getRepository();
373 metadataRepository.removeRepository( repository.getId() );
375 namespacesCache.remove( repository.getId() );
376 log.debug( "call repositoryStatisticsManager.deleteStatistics" );
377 getRepositoryStatisticsManager().deleteStatistics( metadataRepository, repository.getId() );
378 repositorySession.save();
380 catch ( MetadataRepositoryException e )
382 //throw new RepositoryAdminException( e.getMessage(), e );
383 log.warn( "skip error during removing repository from MetadataRepository:{}", e.getMessage(), e );
387 repositorySession.close();
390 config.removeManagedRepository( repository );
394 // TODO could be async ? as directory can be huge
395 File dir = new File( repository.getLocation() );
396 if ( !FileUtils.deleteQuietly( dir ) )
398 throw new RepositoryAdminException( "Cannot delete repository " + dir );
402 // olamy: copy list for reading as a unit test in webapp fail with ConcurrentModificationException
403 List<ProxyConnectorConfiguration> proxyConnectors = new ArrayList<>( config.getProxyConnectors() );
404 for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
406 if ( StringUtils.equals( proxyConnector.getSourceRepoId(), repository.getId() ) )
408 config.removeProxyConnector( proxyConnector );
412 Map<String, List<String>> repoToGroupMap = config.getRepositoryToGroupMap();
413 if ( repoToGroupMap != null )
415 if ( repoToGroupMap.containsKey( repository.getId() ) )
417 List<String> repoGroups = repoToGroupMap.get( repository.getId() );
418 for ( String repoGroup : repoGroups )
420 // copy to prevent UnsupportedOperationException
421 RepositoryGroupConfiguration repositoryGroupConfiguration =
422 config.findRepositoryGroupById( repoGroup );
423 List<String> repos = new ArrayList<>( repositoryGroupConfiguration.getRepositories() );
424 config.removeRepositoryGroup( repositoryGroupConfiguration );
425 repos.remove( repository.getId() );
426 repositoryGroupConfiguration.setRepositories( repos );
427 config.addRepositoryGroup( repositoryGroupConfiguration );
434 removeRepositoryRoles( repository );
436 catch ( RoleManagerException e )
438 throw new RepositoryAdminException(
439 "fail to remove repository roles for repository " + repository.getId() + " : " + e.getMessage(), e );
442 saveConfiguration( config );
449 public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
450 AuditInformation auditInformation, boolean resetStats )
451 throws RepositoryAdminException
454 log.debug( "updateManagedConfiguration repo {} needStage {} resetStats {} ", managedRepository, needStageRepo,
457 // Ensure that the fields are valid.
459 getRepositoryCommonValidator().basicValidation( managedRepository, true );
461 getRepositoryCommonValidator().validateManagedRepository( managedRepository );
463 Configuration configuration = getArchivaConfiguration().getConfiguration();
465 ManagedRepositoryConfiguration toremove = configuration.findManagedRepositoryById( managedRepository.getId() );
467 boolean updateIndexContext = false;
469 if ( toremove != null )
471 configuration.removeManagedRepository( toremove );
473 updateIndexContext = !StringUtils.equals( toremove.getIndexDir(), managedRepository.getIndexDirectory() );
476 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( toremove );
478 // TODO remove content from old if path has changed !!!!!
480 if ( stagingRepository != null )
482 configuration.removeManagedRepository( stagingRepository );
485 ManagedRepositoryConfiguration managedRepositoryConfiguration =
486 addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
487 managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
488 managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
489 managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
490 managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
491 managedRepository.isDeleteReleasedSnapshots(), managedRepository.getDescription(),
492 managedRepository.isSkipPackedIndexCreation(), managedRepository.isScanned(),
493 auditInformation, getArchivaConfiguration().getConfiguration() );
495 // Save the repository configuration.
496 RepositorySession repositorySession = getRepositorySessionFactory().createSession();
500 triggerAuditEvent( managedRepositoryConfiguration.getId(), null, AuditEvent.MODIFY_MANAGED_REPO,
503 saveConfiguration( this.getArchivaConfiguration().getConfiguration() );
506 log.debug( "call repositoryStatisticsManager.deleteStatistics" );
507 getRepositoryStatisticsManager().deleteStatistics( repositorySession.getRepository(),
508 managedRepositoryConfiguration.getId() );
509 repositorySession.save();
513 catch ( MetadataRepositoryException e )
515 throw new RepositoryAdminException( e.getMessage(), e );
519 repositorySession.close();
522 if ( updateIndexContext )
526 IndexingContext indexingContext = indexer.getIndexingContexts().get( managedRepository.getId() );
527 if ( indexingContext != null )
529 indexer.removeIndexingContext( indexingContext, true );
532 // delete directory too as only content is deleted
533 File indexDirectory = indexingContext.getIndexDirectoryFile();
534 FileUtils.deleteDirectory( indexDirectory );
536 createIndexContext( managedRepository );
538 catch ( IOException e )
540 throw new RepositoryAdminException( e.getMessage(), e );
547 //--------------------------
549 //--------------------------
552 protected void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration )
553 throws RepositoryAdminException, IOException
555 // Normalize the path
556 File file = new File( repository.getLocation() );
557 if ( !file.isAbsolute() )
559 // add appserver.base/repositories
560 file = new File( getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories",
561 repository.getLocation() );
563 repository.setLocation( file.getCanonicalPath() );
564 if ( !file.exists() )
568 if ( !file.exists() || !file.isDirectory() )
570 throw new RepositoryAdminException(
571 "Unable to add repository - no write access, can not create the root directory: " + file );
574 configuration.addManagedRepository( repository );
579 public IndexingContext createIndexContext( ManagedRepository repository )
580 throws RepositoryAdminException
583 IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
585 if ( context != null )
587 log.debug( "skip creating repository indexingContent with id {} as already exists", repository.getId() );
591 // take care first about repository location as can be relative
592 File repositoryDirectory = new File( repository.getLocation() );
594 if ( !repositoryDirectory.isAbsolute() )
596 repositoryDirectory =
597 new File( getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories",
598 repository.getLocation() );
601 if ( !repositoryDirectory.exists() )
603 repositoryDirectory.mkdirs();
609 String indexDir = repository.getIndexDirectory();
610 //File managedRepository = new File( repository.getLocation() );
612 File indexDirectory = null;
613 if ( StringUtils.isNotBlank( indexDir ) )
615 indexDirectory = new File( repository.getIndexDirectory() );
616 // not absolute so create it in repository directory
617 if ( !indexDirectory.isAbsolute() )
619 indexDirectory = new File( repositoryDirectory, repository.getIndexDirectory() );
621 repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
625 indexDirectory = new File( repositoryDirectory, ".indexer" );
626 if ( !repositoryDirectory.isAbsolute() )
628 indexDirectory = new File( repositoryDirectory, ".indexer" );
630 repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
633 if ( !indexDirectory.exists() )
635 indexDirectory.mkdirs();
638 context = indexer.getIndexingContexts().get( repository.getId() );
640 if ( context == null )
644 context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory,
646 repositoryDirectory.toURI().toURL().toExternalForm(),
647 indexDirectory.toURI().toURL().toString(), indexCreators );
649 context.setSearchable( repository.isScanned() );
651 catch ( IndexFormatTooOldException e )
653 // existing index with an old lucene format so we need to delete it!!!
654 // delete it first then recreate it.
655 log.warn( "the index of repository {} is too old we have to delete and recreate it", //
656 repository.getId() );
657 FileUtils.deleteDirectory( indexDirectory );
658 context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory,
660 repositoryDirectory.toURI().toURL().toExternalForm(),
661 indexDirectory.toURI().toURL().toString(), indexCreators );
663 context.setSearchable( repository.isScanned() );
668 catch ( IOException| UnsupportedExistingLuceneIndexException e )
670 throw new RepositoryAdminException( e.getMessage(), e );
674 private ManagedRepositoryConfiguration getStageRepoConfig( ManagedRepositoryConfiguration repository )
676 ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration();
677 stagingRepository.setId( repository.getId() + STAGE_REPO_ID_END );
678 stagingRepository.setLayout( repository.getLayout() );
679 stagingRepository.setName( repository.getName() + STAGE_REPO_ID_END );
680 stagingRepository.setBlockRedeployments( repository.isBlockRedeployments() );
681 stagingRepository.setDaysOlder( repository.getDaysOlder() );
682 stagingRepository.setDeleteReleasedSnapshots( repository.isDeleteReleasedSnapshots() );
684 String path = repository.getLocation();
685 int lastIndex = path.replace( '\\', '/' ).lastIndexOf( '/' );
686 stagingRepository.setLocation( path.substring( 0, lastIndex ) + "/" + stagingRepository.getId() );
688 if ( StringUtils.isNotBlank( repository.getIndexDir() ) )
690 File indexDir = new File( repository.getIndexDir() );
691 // in case of absolute dir do not use the same
692 if ( indexDir.isAbsolute() )
694 stagingRepository.setIndexDir( stagingRepository.getLocation() + "/.index" );
698 stagingRepository.setIndexDir( repository.getIndexDir() );
701 stagingRepository.setRefreshCronExpression( repository.getRefreshCronExpression() );
702 stagingRepository.setReleases( repository.isReleases() );
703 stagingRepository.setRetentionCount( repository.getRetentionCount() );
704 stagingRepository.setScanned( repository.isScanned() );
705 stagingRepository.setSnapshots( repository.isSnapshots() );
706 stagingRepository.setSkipPackedIndexCreation( repository.isSkipPackedIndexCreation() );
707 // do not duplicate description
708 //stagingRepository.getDescription("")
709 return stagingRepository;
712 public Boolean scanRepository( String repositoryId, boolean fullScan )
714 if ( getRepositoryTaskScheduler().isProcessingRepositoryTask( repositoryId ) )
716 log.info( "scanning of repository with id {} already scheduled", repositoryId );
718 RepositoryTask task = new RepositoryTask();
719 task.setRepositoryId( repositoryId );
720 task.setScanAll( fullScan );
723 getRepositoryTaskScheduler().queueTask( task );
725 catch ( TaskQueueException e )
727 log.error( "failed to schedule scanning of repo with id {}", repositoryId, e );
734 private void addRepositoryRoles( String repoId )
735 throws RoleManagerException
737 // TODO: double check these are configured on start up
738 // TODO: belongs in the business logic
740 if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
742 getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
745 if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
747 getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
751 protected void removeRepositoryRoles( ManagedRepositoryConfiguration existingRepository )
752 throws RoleManagerException
754 String repoId = existingRepository.getId();
756 if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
758 getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
761 if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
763 getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
766 log.debug( "removed user roles associated with repository {}", repoId );
769 //--------------------------
771 //--------------------------
774 public RoleManager getRoleManager()
779 public void setRoleManager( RoleManager roleManager )
781 this.roleManager = roleManager;
784 public RepositoryStatisticsManager getRepositoryStatisticsManager()
786 return repositoryStatisticsManager;
789 public void setRepositoryStatisticsManager( RepositoryStatisticsManager repositoryStatisticsManager )
791 this.repositoryStatisticsManager = repositoryStatisticsManager;
794 public RepositorySessionFactory getRepositorySessionFactory()
796 return repositorySessionFactory;
799 public void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory )
801 this.repositorySessionFactory = repositorySessionFactory;
805 public RepositoryArchivaTaskScheduler getRepositoryTaskScheduler()
807 return repositoryTaskScheduler;
810 public void setRepositoryTaskScheduler( RepositoryArchivaTaskScheduler repositoryTaskScheduler )
812 this.repositoryTaskScheduler = repositoryTaskScheduler;
815 public NexusIndexer getIndexer()
820 public void setIndexer( NexusIndexer indexer )
822 this.indexer = indexer;
825 public List<? extends IndexCreator> getIndexCreators()
827 return indexCreators;
830 public void setIndexCreators( List<? extends IndexCreator> indexCreators )
832 this.indexCreators = indexCreators;