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.common.plexusbridge.MavenIndexerUtils;
27 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
28 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
29 import org.apache.archiva.configuration.Configuration;
30 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
31 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
32 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
33 import org.apache.archiva.metadata.model.facets.AuditEvent;
34 import org.apache.archiva.metadata.repository.MetadataRepository;
35 import org.apache.archiva.metadata.repository.MetadataRepositoryException;
36 import org.apache.archiva.metadata.repository.RepositorySession;
37 import org.apache.archiva.metadata.repository.RepositorySessionFactory;
38 import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
39 import org.apache.archiva.redback.components.cache.Cache;
40 import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
41 import org.apache.archiva.redback.role.RoleManager;
42 import org.apache.archiva.redback.role.RoleManagerException;
43 import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
44 import org.apache.archiva.scheduler.repository.model.RepositoryTask;
45 import org.apache.archiva.security.common.ArchivaRoleConstants;
46 import org.apache.commons.io.FileUtils;
47 import org.apache.commons.lang.StringUtils;
48 import org.apache.maven.index.NexusIndexer;
49 import org.apache.maven.index.context.IndexCreator;
50 import org.apache.maven.index.context.IndexingContext;
51 import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
52 import org.slf4j.Logger;
53 import org.slf4j.LoggerFactory;
54 import org.springframework.stereotype.Service;
56 import javax.annotation.PostConstruct;
57 import javax.annotation.PreDestroy;
58 import javax.inject.Inject;
59 import javax.inject.Named;
61 import java.io.IOException;
62 import java.net.MalformedURLException;
63 import java.util.ArrayList;
64 import java.util.Collection;
65 import java.util.Collections;
66 import java.util.HashMap;
67 import java.util.List;
71 * FIXME review the staging mechanism to have a per user session one
73 * @author Olivier Lamy
75 @Service("managedRepositoryAdmin#default")
76 public class DefaultManagedRepositoryAdmin
77 extends AbstractRepositoryAdmin
78 implements ManagedRepositoryAdmin
81 private Logger log = LoggerFactory.getLogger( getClass() );
83 public static final String STAGE_REPO_ID_END = "-stage";
86 @Named(value = "archivaTaskScheduler#repository")
87 private RepositoryArchivaTaskScheduler repositoryTaskScheduler;
90 * FIXME: this could be multiple implementations and needs to be configured.
93 private RepositorySessionFactory repositorySessionFactory;
96 private RepositoryStatisticsManager repositoryStatisticsManager;
99 private MavenIndexerUtils mavenIndexerUtils;
102 protected RoleManager roleManager;
105 @Named(value = "cache#namespaces")
106 private Cache<String, Collection<String>> namespacesCache;
110 private List<? extends IndexCreator> indexCreators;
113 private NexusIndexer indexer;
116 public void initialize()
117 throws RepositoryAdminException, RoleManagerException
121 // indexCreators = mavenIndexerUtils.getAllIndexCreators();
122 // indexer = plexusSisuBridge.lookup( NexusIndexer.class );
124 // catch ( PlexusSisuBridgeException e )
126 // throw new RepositoryAdminException( e.getMessage(), e );
128 // initialize index context on start and check roles here
129 for ( ManagedRepository managedRepository : getManagedRepositories() )
131 createIndexContext( managedRepository );
132 addRepositoryRoles( managedRepository.getId() );
138 public void shutdown()
139 throws RepositoryAdminException
143 // close index on shutdown
144 for ( ManagedRepository managedRepository : getManagedRepositories() )
146 IndexingContext context = indexer.getIndexingContexts().get( managedRepository.getId() );
147 if ( context != null )
149 indexer.removeIndexingContext( context, false );
153 catch ( IOException e )
155 throw new RepositoryAdminException( e.getMessage(), e );
160 public List<ManagedRepository> getManagedRepositories()
161 throws RepositoryAdminException
163 List<ManagedRepositoryConfiguration> managedRepoConfigs =
164 getArchivaConfiguration().getConfiguration().getManagedRepositories();
166 if ( managedRepoConfigs == null )
168 return Collections.emptyList();
171 List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() );
173 for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
175 ManagedRepository repo =
176 new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
177 repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
178 repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
179 repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
180 repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(),
181 repoConfig.isStageRepoNeeded() );
182 repo.setDescription( repoConfig.getDescription() );
183 repo.setSkipPackedIndexCreation( repoConfig.isSkipPackedIndexCreation() );
184 managedRepos.add( repo );
191 public Map<String, ManagedRepository> getManagedRepositoriesAsMap()
192 throws RepositoryAdminException
194 List<ManagedRepository> managedRepositories = getManagedRepositories();
195 Map<String, ManagedRepository> repositoriesMap = new HashMap<>( managedRepositories.size() );
196 for ( ManagedRepository managedRepository : managedRepositories )
198 repositoriesMap.put( managedRepository.getId(), managedRepository );
200 return repositoriesMap;
204 public ManagedRepository getManagedRepository( String repositoryId )
205 throws RepositoryAdminException
207 List<ManagedRepository> repos = getManagedRepositories();
208 for ( ManagedRepository repo : repos )
210 if ( StringUtils.equals( repo.getId(), repositoryId ) )
219 public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
220 AuditInformation auditInformation )
221 throws RepositoryAdminException
224 getRepositoryCommonValidator().basicValidation( managedRepository, false );
225 getRepositoryCommonValidator().validateManagedRepository( managedRepository );
226 triggerAuditEvent( managedRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
228 addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
229 managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
230 managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
231 managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
232 managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
233 managedRepository.isDeleteReleasedSnapshots(), managedRepository.getDescription(),
234 managedRepository.isSkipPackedIndexCreation(), managedRepository.isScanned(),
235 auditInformation, getArchivaConfiguration().getConfiguration() ) != null;
237 createIndexContext( managedRepository );
242 private ManagedRepositoryConfiguration addManagedRepository( String repoId, String layout, String name,
243 String location, boolean blockRedeployments,
244 boolean releasesIncluded, boolean snapshotsIncluded,
245 boolean stageRepoNeeded, String cronExpression,
246 String indexDir, int daysOlder, int retentionCount,
247 boolean deteleReleasedSnapshots, String description,
248 boolean skipPackedIndexCreation, boolean scanned,
249 AuditInformation auditInformation,
250 Configuration config )
251 throws RepositoryAdminException
254 ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
256 repository.setId( repoId );
257 repository.setBlockRedeployments( blockRedeployments );
258 repository.setReleases( releasesIncluded );
259 repository.setSnapshots( snapshotsIncluded );
260 repository.setScanned( scanned );
261 repository.setName( name );
262 repository.setLocation( getRepositoryCommonValidator().removeExpressions( location ) );
263 repository.setLayout( layout );
264 repository.setRefreshCronExpression( cronExpression );
265 repository.setIndexDir( indexDir );
266 repository.setDaysOlder( daysOlder );
267 repository.setRetentionCount( retentionCount );
268 repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots );
269 repository.setIndexDir( indexDir );
270 repository.setDescription( description );
271 repository.setSkipPackedIndexCreation( skipPackedIndexCreation );
272 repository.setStageRepoNeeded( stageRepoNeeded );
276 addRepository( repository, config );
277 addRepositoryRoles( repository.getId() );
279 if ( stageRepoNeeded )
281 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
282 addRepository( stagingRepository, config );
283 addRepositoryRoles( stagingRepository.getId() );
284 triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
287 catch ( RoleManagerException e )
289 throw new RepositoryAdminException( "failed to add repository roles " + e.getMessage(), e );
291 catch ( IOException e )
293 throw new RepositoryAdminException( "failed to add repository " + e.getMessage(), e );
296 saveConfiguration( config );
298 //MRM-1342 Repository statistics report doesn't appear to be working correctly
299 //scan repository when adding of repository is successful
304 scanRepository( repoId, true );
307 // TODO need a better to define scanning or not for staged repo
308 if ( stageRepoNeeded && scanned )
310 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
311 scanRepository( stagingRepository.getId(), true );
314 catch ( Exception e )
316 log.warn( new StringBuilder( "Unable to scan repository [" ).append( repoId ).append( "]: " ).append(
317 e.getMessage() ).toString(), e );
324 public Boolean deleteManagedRepository( String repositoryId, AuditInformation auditInformation,
325 boolean deleteContent )
326 throws RepositoryAdminException
328 Configuration config = getArchivaConfiguration().getConfiguration();
330 ManagedRepositoryConfiguration repository = config.findManagedRepositoryById( repositoryId );
332 if ( repository == null )
334 throw new RepositoryAdminException( "A repository with that id does not exist" );
337 triggerAuditEvent( repositoryId, null, AuditEvent.DELETE_MANAGED_REPO, auditInformation );
339 deleteManagedRepository( repository, deleteContent, config, false );
341 // stage repo exists ?
342 ManagedRepositoryConfiguration stagingRepository =
343 getArchivaConfiguration().getConfiguration().findManagedRepositoryById( repositoryId + STAGE_REPO_ID_END );
344 if ( stagingRepository != null )
346 // do not trigger event when deleting the staged one
347 deleteManagedRepository( stagingRepository, deleteContent, config, true );
352 saveConfiguration( config );
354 catch ( Exception e )
356 throw new RepositoryAdminException( "Error saving configuration for delete action" + e.getMessage(), e );
362 private Boolean deleteManagedRepository( ManagedRepositoryConfiguration repository, boolean deleteContent,
363 Configuration config, boolean stagedOne )
364 throws RepositoryAdminException
369 IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
370 if ( context != null )
372 // delete content only if directory exists
373 indexer.removeIndexingContext( context,
374 deleteContent && context.getIndexDirectoryFile().exists() );
377 catch ( IOException e )
379 throw new RepositoryAdminException( e.getMessage(), e );
383 RepositorySession repositorySession = getRepositorySessionFactory().createSession();
386 MetadataRepository metadataRepository = repositorySession.getRepository();
387 metadataRepository.removeRepository( repository.getId() );
389 namespacesCache.remove( repository.getId() );
390 log.debug( "call repositoryStatisticsManager.deleteStatistics" );
391 getRepositoryStatisticsManager().deleteStatistics( metadataRepository, repository.getId() );
392 repositorySession.save();
394 catch ( MetadataRepositoryException e )
396 //throw new RepositoryAdminException( e.getMessage(), e );
397 log.warn( "skip error during removing repository from MetadataRepository:{}", e.getMessage(), e );
401 repositorySession.close();
404 config.removeManagedRepository( repository );
408 // TODO could be async ? as directory can be huge
409 File dir = new File( repository.getLocation() );
410 if ( !FileUtils.deleteQuietly( dir ) )
412 throw new RepositoryAdminException( "Cannot delete repository " + dir );
416 // olamy: copy list for reading as a unit test in webapp fail with ConcurrentModificationException
417 List<ProxyConnectorConfiguration> proxyConnectors = new ArrayList<>( config.getProxyConnectors() );
418 for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
420 if ( StringUtils.equals( proxyConnector.getSourceRepoId(), repository.getId() ) )
422 config.removeProxyConnector( proxyConnector );
426 Map<String, List<String>> repoToGroupMap = config.getRepositoryToGroupMap();
427 if ( repoToGroupMap != null )
429 if ( repoToGroupMap.containsKey( repository.getId() ) )
431 List<String> repoGroups = repoToGroupMap.get( repository.getId() );
432 for ( String repoGroup : repoGroups )
434 // copy to prevent UnsupportedOperationException
435 RepositoryGroupConfiguration repositoryGroupConfiguration =
436 config.findRepositoryGroupById( repoGroup );
437 List<String> repos = new ArrayList<>( repositoryGroupConfiguration.getRepositories() );
438 config.removeRepositoryGroup( repositoryGroupConfiguration );
439 repos.remove( repository.getId() );
440 repositoryGroupConfiguration.setRepositories( repos );
441 config.addRepositoryGroup( repositoryGroupConfiguration );
448 removeRepositoryRoles( repository );
450 catch ( RoleManagerException e )
452 throw new RepositoryAdminException(
453 "fail to remove repository roles for repository " + repository.getId() + " : " + e.getMessage(), e );
456 saveConfiguration( config );
463 public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
464 AuditInformation auditInformation, boolean resetStats )
465 throws RepositoryAdminException
468 log.debug( "updateManagedConfiguration repo {} needStage {} resetStats {} ", managedRepository, needStageRepo,
471 // Ensure that the fields are valid.
473 getRepositoryCommonValidator().basicValidation( managedRepository, true );
475 getRepositoryCommonValidator().validateManagedRepository( managedRepository );
477 Configuration configuration = getArchivaConfiguration().getConfiguration();
479 ManagedRepositoryConfiguration toremove = configuration.findManagedRepositoryById( managedRepository.getId() );
481 boolean updateIndexContext = false;
483 if ( toremove != null )
485 configuration.removeManagedRepository( toremove );
487 updateIndexContext = !StringUtils.equals( toremove.getIndexDir(), managedRepository.getIndexDirectory() );
490 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( toremove );
492 // TODO remove content from old if path has changed !!!!!
494 if ( stagingRepository != null )
496 configuration.removeManagedRepository( stagingRepository );
499 ManagedRepositoryConfiguration managedRepositoryConfiguration =
500 addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
501 managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
502 managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
503 managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
504 managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
505 managedRepository.isDeleteReleasedSnapshots(), managedRepository.getDescription(),
506 managedRepository.isSkipPackedIndexCreation(), managedRepository.isScanned(),
507 auditInformation, getArchivaConfiguration().getConfiguration() );
509 // Save the repository configuration.
510 RepositorySession repositorySession = getRepositorySessionFactory().createSession();
514 triggerAuditEvent( managedRepositoryConfiguration.getId(), null, AuditEvent.MODIFY_MANAGED_REPO,
517 saveConfiguration( this.getArchivaConfiguration().getConfiguration() );
520 log.debug( "call repositoryStatisticsManager.deleteStatistics" );
521 getRepositoryStatisticsManager().deleteStatistics( repositorySession.getRepository(),
522 managedRepositoryConfiguration.getId() );
523 repositorySession.save();
527 catch ( MetadataRepositoryException e )
529 throw new RepositoryAdminException( e.getMessage(), e );
533 repositorySession.close();
536 if ( updateIndexContext )
540 IndexingContext indexingContext = indexer.getIndexingContexts().get( managedRepository.getId() );
541 if ( indexingContext != null )
543 indexer.removeIndexingContext( indexingContext, true );
546 // delete directory too as only content is deleted
547 File indexDirectory = indexingContext.getIndexDirectoryFile();
548 FileUtils.deleteDirectory( indexDirectory );
550 createIndexContext( managedRepository );
552 catch ( IOException e )
554 throw new RepositoryAdminException( e.getMessage(), e );
561 //--------------------------
563 //--------------------------
566 protected void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration )
567 throws RepositoryAdminException, IOException
569 // Normalize the path
570 File file = new File( repository.getLocation() );
571 if ( !file.isAbsolute() )
573 // add appserver.base/repositories
574 file = new File( getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories",
575 repository.getLocation() );
577 repository.setLocation( file.getCanonicalPath() );
578 if ( !file.exists() )
582 if ( !file.exists() || !file.isDirectory() )
584 throw new RepositoryAdminException(
585 "Unable to add repository - no write access, can not create the root directory: " + file );
588 configuration.addManagedRepository( repository );
593 public IndexingContext createIndexContext( ManagedRepository repository )
594 throws RepositoryAdminException
597 IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
599 if ( context != null )
601 log.debug( "skip creating repository indexingContent with id {} as already exists", repository.getId() );
605 // take care first about repository location as can be relative
606 File repositoryDirectory = new File( repository.getLocation() );
608 if ( !repositoryDirectory.isAbsolute() )
610 repositoryDirectory =
611 new File( getRegistry().getString( "appserver.base" ) + File.separatorChar + "repositories",
612 repository.getLocation() );
615 if ( !repositoryDirectory.exists() )
617 repositoryDirectory.mkdirs();
623 String indexDir = repository.getIndexDirectory();
624 //File managedRepository = new File( repository.getLocation() );
626 File indexDirectory = null;
627 if ( StringUtils.isNotBlank( indexDir ) )
629 indexDirectory = new File( repository.getIndexDirectory() );
630 // not absolute so create it in repository directory
631 if ( !indexDirectory.isAbsolute() )
633 indexDirectory = new File( repositoryDirectory, repository.getIndexDirectory() );
635 repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
639 indexDirectory = new File( repositoryDirectory, ".indexer" );
640 if ( !repositoryDirectory.isAbsolute() )
642 indexDirectory = new File( repositoryDirectory, ".indexer" );
644 repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
647 if ( !indexDirectory.exists() )
649 indexDirectory.mkdirs();
652 context = indexer.getIndexingContexts().get( repository.getId() );
654 if ( context == null )
656 context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory,
658 repositoryDirectory.toURI().toURL().toExternalForm(),
659 indexDirectory.toURI().toURL().toString(), indexCreators );
661 context.setSearchable( repository.isScanned() );
665 catch ( MalformedURLException e )
667 throw new RepositoryAdminException( e.getMessage(), e );
669 catch ( IOException e )
671 throw new RepositoryAdminException( e.getMessage(), e );
673 catch ( UnsupportedExistingLuceneIndexException e )
675 throw new RepositoryAdminException( e.getMessage(), e );
679 private ManagedRepositoryConfiguration getStageRepoConfig( ManagedRepositoryConfiguration repository )
681 ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration();
682 stagingRepository.setId( repository.getId() + STAGE_REPO_ID_END );
683 stagingRepository.setLayout( repository.getLayout() );
684 stagingRepository.setName( repository.getName() + STAGE_REPO_ID_END );
685 stagingRepository.setBlockRedeployments( repository.isBlockRedeployments() );
686 stagingRepository.setDaysOlder( repository.getDaysOlder() );
687 stagingRepository.setDeleteReleasedSnapshots( repository.isDeleteReleasedSnapshots() );
689 String path = repository.getLocation();
690 int lastIndex = path.replace( '\\', '/' ).lastIndexOf( '/' );
691 stagingRepository.setLocation( path.substring( 0, lastIndex ) + "/" + stagingRepository.getId() );
693 if ( StringUtils.isNotBlank( repository.getIndexDir() ) )
695 File indexDir = new File( repository.getIndexDir() );
696 // in case of absolute dir do not use the same
697 if ( indexDir.isAbsolute() )
699 stagingRepository.setIndexDir( stagingRepository.getLocation() + "/.index" );
703 stagingRepository.setIndexDir( repository.getIndexDir() );
706 stagingRepository.setRefreshCronExpression( repository.getRefreshCronExpression() );
707 stagingRepository.setReleases( repository.isReleases() );
708 stagingRepository.setRetentionCount( repository.getRetentionCount() );
709 stagingRepository.setScanned( repository.isScanned() );
710 stagingRepository.setSnapshots( repository.isSnapshots() );
711 stagingRepository.setSkipPackedIndexCreation( repository.isSkipPackedIndexCreation() );
712 // do not duplicate description
713 //stagingRepository.getDescription("")
714 return stagingRepository;
717 public Boolean scanRepository( String repositoryId, boolean fullScan )
719 if ( getRepositoryTaskScheduler().isProcessingRepositoryTask( repositoryId ) )
721 log.info( "scanning of repository with id {} already scheduled", repositoryId );
723 RepositoryTask task = new RepositoryTask();
724 task.setRepositoryId( repositoryId );
725 task.setScanAll( fullScan );
728 getRepositoryTaskScheduler().queueTask( task );
730 catch ( TaskQueueException e )
732 log.error( "failed to schedule scanning of repo with id {}", repositoryId, e );
739 private void addRepositoryRoles( String repoId )
740 throws RoleManagerException
742 // TODO: double check these are configured on start up
743 // TODO: belongs in the business logic
745 if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
747 getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
750 if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
752 getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
756 protected void removeRepositoryRoles( ManagedRepositoryConfiguration existingRepository )
757 throws RoleManagerException
759 String repoId = existingRepository.getId();
761 if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
763 getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
766 if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
768 getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
771 log.debug( "removed user roles associated with repository {}", repoId );
774 //--------------------------
776 //--------------------------
779 public RoleManager getRoleManager()
784 public void setRoleManager( RoleManager roleManager )
786 this.roleManager = roleManager;
789 public RepositoryStatisticsManager getRepositoryStatisticsManager()
791 return repositoryStatisticsManager;
794 public void setRepositoryStatisticsManager( RepositoryStatisticsManager repositoryStatisticsManager )
796 this.repositoryStatisticsManager = repositoryStatisticsManager;
799 public RepositorySessionFactory getRepositorySessionFactory()
801 return repositorySessionFactory;
804 public void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory )
806 this.repositorySessionFactory = repositorySessionFactory;
810 public RepositoryArchivaTaskScheduler getRepositoryTaskScheduler()
812 return repositoryTaskScheduler;
815 public void setRepositoryTaskScheduler( RepositoryArchivaTaskScheduler repositoryTaskScheduler )
817 this.repositoryTaskScheduler = repositoryTaskScheduler;
820 public MavenIndexerUtils getMavenIndexerUtils()
822 return mavenIndexerUtils;
825 public void setMavenIndexerUtils( MavenIndexerUtils mavenIndexerUtils )
827 this.mavenIndexerUtils = mavenIndexerUtils;
830 public NexusIndexer getIndexer()
835 public void setIndexer( NexusIndexer indexer )
837 this.indexer = indexer;
840 public List<? extends IndexCreator> getIndexCreators()
842 return indexCreators;
845 public void setIndexCreators( List<? extends IndexCreator> indexCreators )
847 this.indexCreators = indexCreators;