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.audit.AuditEvent;
27 import org.apache.archiva.common.plexusbridge.MavenIndexerUtils;
28 import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
29 import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
30 import org.apache.archiva.configuration.Configuration;
31 import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
32 import org.apache.archiva.configuration.ProxyConnectorConfiguration;
33 import org.apache.archiva.configuration.RepositoryGroupConfiguration;
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.taskqueue.TaskQueueException;
40 import org.apache.archiva.redback.role.RoleManager;
41 import org.apache.archiva.redback.role.RoleManagerException;
42 import org.apache.archiva.scheduler.repository.model.RepositoryArchivaTaskScheduler;
43 import org.apache.archiva.scheduler.repository.model.RepositoryTask;
44 import org.apache.archiva.security.common.ArchivaRoleConstants;
45 import org.apache.commons.io.FileUtils;
46 import org.apache.commons.lang.StringUtils;
47 import org.apache.maven.index.NexusIndexer;
48 import org.apache.maven.index.context.IndexCreator;
49 import org.apache.maven.index.context.IndexingContext;
50 import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
51 import org.slf4j.Logger;
52 import org.slf4j.LoggerFactory;
53 import org.springframework.stereotype.Service;
55 import javax.annotation.PostConstruct;
56 import javax.annotation.PreDestroy;
57 import javax.inject.Inject;
58 import javax.inject.Named;
60 import java.io.IOException;
61 import java.net.MalformedURLException;
62 import java.util.ArrayList;
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 private RepositorySessionFactory repositorySessionFactory;
91 private RepositoryStatisticsManager repositoryStatisticsManager;
94 private PlexusSisuBridge plexusSisuBridge;
97 private MavenIndexerUtils mavenIndexerUtils;
100 protected RoleManager roleManager;
103 List<? extends IndexCreator> indexCreators;
105 NexusIndexer indexer;
108 public void initialize()
109 throws RepositoryAdminException
113 indexCreators = mavenIndexerUtils.getAllIndexCreators();
114 indexer = plexusSisuBridge.lookup( NexusIndexer.class );
116 catch ( PlexusSisuBridgeException e )
118 throw new RepositoryAdminException( e.getMessage(), e );
120 // initialize index context on start
121 for ( ManagedRepository managedRepository : getManagedRepositories() )
123 createIndexContext( managedRepository );
128 public void shutdown()
129 throws RepositoryAdminException
133 // close index on shutdown
134 for ( ManagedRepository managedRepository : getManagedRepositories() )
136 IndexingContext context = indexer.getIndexingContexts().get( managedRepository.getId() );
137 if ( context != null )
139 indexer.removeIndexingContext( context, false );
143 catch ( IOException e )
145 throw new RepositoryAdminException( e.getMessage(), e );
149 public List<ManagedRepository> getManagedRepositories()
150 throws RepositoryAdminException
152 List<ManagedRepositoryConfiguration> managedRepoConfigs =
153 getArchivaConfiguration().getConfiguration().getManagedRepositories();
155 if ( managedRepoConfigs == null )
157 return Collections.emptyList();
160 List<ManagedRepository> managedRepos = new ArrayList<ManagedRepository>( managedRepoConfigs.size() );
162 for ( ManagedRepositoryConfiguration repoConfig : managedRepoConfigs )
164 ManagedRepository repo =
165 new ManagedRepository( repoConfig.getId(), repoConfig.getName(), repoConfig.getLocation(),
166 repoConfig.getLayout(), repoConfig.isSnapshots(), repoConfig.isReleases(),
167 repoConfig.isBlockRedeployments(), repoConfig.getRefreshCronExpression(),
168 repoConfig.getIndexDir(), repoConfig.isScanned(), repoConfig.getDaysOlder(),
169 repoConfig.getRetentionCount(), repoConfig.isDeleteReleasedSnapshots(),
170 repoConfig.isStageRepoNeeded() );
171 repo.setDescription( repoConfig.getDescription() );
172 repo.setSkipPackedIndexCreation( repoConfig.isSkipPackedIndexCreation() );
173 managedRepos.add( repo );
179 public Map<String, ManagedRepository> getManagedRepositoriesAsMap()
180 throws RepositoryAdminException
182 List<ManagedRepository> managedRepositories = getManagedRepositories();
183 Map<String, ManagedRepository> repositoriesMap =
184 new HashMap<String, ManagedRepository>( managedRepositories.size() );
185 for ( ManagedRepository managedRepository : managedRepositories )
187 repositoriesMap.put( managedRepository.getId(), managedRepository );
189 return repositoriesMap;
192 public ManagedRepository getManagedRepository( String repositoryId )
193 throws RepositoryAdminException
195 List<ManagedRepository> repos = getManagedRepositories();
196 for ( ManagedRepository repo : repos )
198 if ( StringUtils.equals( repo.getId(), repositoryId ) )
206 public Boolean addManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
207 AuditInformation auditInformation )
208 throws RepositoryAdminException
211 getRepositoryCommonValidator().basicValidation( managedRepository, false );
212 getRepositoryCommonValidator().validateManagedRepository( managedRepository );
213 triggerAuditEvent( managedRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
215 addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
216 managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
217 managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
218 managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
219 managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
220 managedRepository.isDeleteReleasedSnapshots(), managedRepository.getDescription(),
221 managedRepository.isSkipPackedIndexCreation(), managedRepository.isScanned(),
222 auditInformation, getArchivaConfiguration().getConfiguration() ) != null;
224 createIndexContext( managedRepository );
229 private ManagedRepositoryConfiguration addManagedRepository( String repoId, String layout, String name,
230 String location, boolean blockRedeployments,
231 boolean releasesIncluded, boolean snapshotsIncluded,
232 boolean stageRepoNeeded, String cronExpression,
233 String indexDir, int daysOlder, int retentionCount,
234 boolean deteleReleasedSnapshots, String description,
235 boolean skipPackedIndexCreation, boolean scanned,
236 AuditInformation auditInformation,
237 Configuration config )
238 throws RepositoryAdminException
241 ManagedRepositoryConfiguration repository = new ManagedRepositoryConfiguration();
243 repository.setId( repoId );
244 repository.setBlockRedeployments( blockRedeployments );
245 repository.setReleases( releasesIncluded );
246 repository.setSnapshots( snapshotsIncluded );
247 repository.setScanned( scanned );
248 repository.setName( name );
249 repository.setLocation( getRepositoryCommonValidator().removeExpressions( location ) );
250 repository.setLayout( layout );
251 repository.setRefreshCronExpression( cronExpression );
252 repository.setIndexDir( indexDir );
253 repository.setDaysOlder( daysOlder );
254 repository.setRetentionCount( retentionCount );
255 repository.setDeleteReleasedSnapshots( deteleReleasedSnapshots );
256 repository.setIndexDir( indexDir );
257 repository.setDescription( description );
258 repository.setSkipPackedIndexCreation( skipPackedIndexCreation );
259 repository.setStageRepoNeeded( stageRepoNeeded );
263 addRepository( repository, config );
264 addRepositoryRoles( repository );
266 if ( stageRepoNeeded )
268 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
269 addRepository( stagingRepository, config );
270 addRepositoryRoles( stagingRepository );
271 triggerAuditEvent( stagingRepository.getId(), null, AuditEvent.ADD_MANAGED_REPO, auditInformation );
274 catch ( RoleManagerException e )
276 throw new RepositoryAdminException( "failed to add repository roles " + e.getMessage(), e );
278 catch ( IOException e )
280 throw new RepositoryAdminException( "failed to add repository " + e.getMessage(), e );
283 saveConfiguration( config );
285 //MRM-1342 Repository statistics report doesn't appear to be working correctly
286 //scan repository when adding of repository is successful
291 scanRepository( repoId, true );
294 // TODO need a better to define scanning or not for staged repo
295 if ( stageRepoNeeded && scanned )
297 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( repository );
298 scanRepository( stagingRepository.getId(), true );
301 catch ( Exception e )
303 log.warn( new StringBuilder( "Unable to scan repository [" ).append( repoId ).append( "]: " ).append(
304 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 NexusIndexer nexusIndexer = plexusSisuBridge.lookup( NexusIndexer.class );
357 IndexingContext context = nexusIndexer.getIndexingContexts().get( repository.getId() );
358 if ( context != null )
360 // delete content only if directory exists
361 nexusIndexer.removeIndexingContext( context,
362 deleteContent && context.getIndexDirectoryFile().exists() );
365 catch ( PlexusSisuBridgeException e )
367 throw new RepositoryAdminException( e.getMessage(), e );
369 catch ( IOException e )
371 throw new RepositoryAdminException( e.getMessage(), e );
375 RepositorySession repositorySession = getRepositorySessionFactory().createSession();
378 MetadataRepository metadataRepository = repositorySession.getRepository();
379 metadataRepository.removeRepository( repository.getId() );
380 log.debug( "call repositoryStatisticsManager.deleteStatistics" );
381 getRepositoryStatisticsManager().deleteStatistics( metadataRepository, repository.getId() );
382 repositorySession.save();
384 catch ( MetadataRepositoryException e )
386 //throw new RepositoryAdminException( e.getMessage(), e );
387 log.warn( "skip error during removing repository from MetadatRepository:" + e.getMessage(), e );
391 repositorySession.close();
394 config.removeManagedRepository( repository );
398 // TODO could be async ? as directory can be huge
399 File dir = new File( repository.getLocation() );
400 if ( !FileUtils.deleteQuietly( dir ) )
402 throw new RepositoryAdminException( "Cannot delete repository " + dir );
406 // olamy: copy list for reading as a unit test in webapp fail with ConcurrentModificationException
407 List<ProxyConnectorConfiguration> proxyConnectors =
408 new ArrayList<ProxyConnectorConfiguration>( config.getProxyConnectors() );
409 for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
411 if ( StringUtils.equals( proxyConnector.getSourceRepoId(), repository.getId() ) )
413 config.removeProxyConnector( proxyConnector );
417 Map<String, List<String>> repoToGroupMap = config.getRepositoryToGroupMap();
418 if ( repoToGroupMap != null )
420 if ( repoToGroupMap.containsKey( repository.getId() ) )
422 List<String> repoGroups = repoToGroupMap.get( repository.getId() );
423 for ( String repoGroup : repoGroups )
425 // copy to prevent UnsupportedOperationException
426 RepositoryGroupConfiguration repositoryGroupConfiguration =
427 config.findRepositoryGroupById( repoGroup );
428 List<String> repos = new ArrayList<String>( repositoryGroupConfiguration.getRepositories() );
429 config.removeRepositoryGroup( repositoryGroupConfiguration );
430 repos.remove( repository.getId() );
431 repositoryGroupConfiguration.setRepositories( repos );
432 config.addRepositoryGroup( repositoryGroupConfiguration );
439 removeRepositoryRoles( repository );
441 catch ( RoleManagerException e )
443 throw new RepositoryAdminException(
444 "fail to remove repository roles for repository " + repository.getId() + " : " + e.getMessage(), e );
447 saveConfiguration( config );
453 public Boolean updateManagedRepository( ManagedRepository managedRepository, boolean needStageRepo,
454 AuditInformation auditInformation, boolean resetStats )
455 throws RepositoryAdminException
458 log.debug( "updateManagedConfiguration repo {} needStage {} resetStats {} ", managedRepository, needStageRepo,
461 // Ensure that the fields are valid.
463 getRepositoryCommonValidator().basicValidation( managedRepository, true );
465 getRepositoryCommonValidator().validateManagedRepository( managedRepository );
467 Configuration configuration = getArchivaConfiguration().getConfiguration();
469 ManagedRepositoryConfiguration toremove = configuration.findManagedRepositoryById( managedRepository.getId() );
471 boolean updateIndexContext = false;
473 if ( toremove != null )
475 configuration.removeManagedRepository( toremove );
477 updateIndexContext = !StringUtils.equals( toremove.getIndexDir(), managedRepository.getIndexDirectory() );
480 ManagedRepositoryConfiguration stagingRepository = getStageRepoConfig( toremove );
482 // TODO remove content from old if path has changed !!!!!
484 if ( stagingRepository != null )
486 configuration.removeManagedRepository( stagingRepository );
489 ManagedRepositoryConfiguration managedRepositoryConfiguration =
490 addManagedRepository( managedRepository.getId(), managedRepository.getLayout(), managedRepository.getName(),
491 managedRepository.getLocation(), managedRepository.isBlockRedeployments(),
492 managedRepository.isReleases(), managedRepository.isSnapshots(), needStageRepo,
493 managedRepository.getCronExpression(), managedRepository.getIndexDirectory(),
494 managedRepository.getDaysOlder(), managedRepository.getRetentionCount(),
495 managedRepository.isDeleteReleasedSnapshots(), managedRepository.getDescription(),
496 managedRepository.isSkipPackedIndexCreation(), managedRepository.isScanned(),
497 auditInformation, getArchivaConfiguration().getConfiguration() );
499 // Save the repository configuration.
500 RepositorySession repositorySession = getRepositorySessionFactory().createSession();
504 triggerAuditEvent( managedRepositoryConfiguration.getId(), null, AuditEvent.MODIFY_MANAGED_REPO,
507 saveConfiguration( this.getArchivaConfiguration().getConfiguration() );
510 log.debug( "call repositoryStatisticsManager.deleteStatistics" );
511 getRepositoryStatisticsManager().deleteStatistics( repositorySession.getRepository(),
512 managedRepositoryConfiguration.getId() );
513 repositorySession.save();
517 catch ( MetadataRepositoryException e )
519 throw new RepositoryAdminException( e.getMessage(), e );
523 repositorySession.close();
526 if ( updateIndexContext )
530 IndexingContext indexingContext = indexer.getIndexingContexts().get( managedRepository.getId() );
531 if ( indexingContext != null )
533 indexer.removeIndexingContext( indexingContext, true );
536 // delete directory too as only content is deleted
537 File indexDirectory = indexingContext.getIndexDirectoryFile();
538 FileUtils.deleteDirectory( indexDirectory );
540 createIndexContext( managedRepository );
542 catch ( IOException e )
544 throw new RepositoryAdminException( e.getMessage(), e );
551 //--------------------------
553 //--------------------------
556 protected void addRepository( ManagedRepositoryConfiguration repository, Configuration configuration )
557 throws RepositoryAdminException, IOException
559 // Normalize the path
560 File file = new File( repository.getLocation() );
561 if ( !file.isAbsolute() )
563 // add appserver.base/repositories
565 getRegistry().getString( "appserver.base" ) + File.separatorChar + "data" + File.separatorChar
566 + "repositories", repository.getLocation() );
568 repository.setLocation( file.getCanonicalPath() );
569 if ( !file.exists() )
573 if ( !file.exists() || !file.isDirectory() )
575 throw new RepositoryAdminException(
576 "Unable to add repository - no write access, can not create the root directory: " + file );
579 configuration.addManagedRepository( repository );
583 public IndexingContext createIndexContext( ManagedRepository repository )
584 throws RepositoryAdminException
587 IndexingContext context = indexer.getIndexingContexts().get( repository.getId() );
589 if ( context != null )
591 log.debug( "skip creating repository indexingContent with id {} as already exists", repository.getId() );
595 // take care first about repository location as can be relative
596 File repositoryDirectory = new File( repository.getLocation() );
598 if ( !repositoryDirectory.isAbsolute() )
600 repositoryDirectory = new File(
601 getRegistry().getString( "appserver.base" ) + File.separatorChar + "data" + File.separatorChar
602 + "repositories", repository.getLocation() );
605 if ( !repositoryDirectory.exists() )
607 repositoryDirectory.mkdirs();
613 String indexDir = repository.getIndexDirectory();
614 //File managedRepository = new File( repository.getLocation() );
616 File indexDirectory = null;
617 if ( StringUtils.isNotBlank( indexDir ) )
619 indexDirectory = new File( repository.getIndexDirectory() );
620 // not absolute so create it in repository directory
621 if ( !indexDirectory.isAbsolute() )
623 indexDirectory = new File( repositoryDirectory, repository.getIndexDirectory() );
624 repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
629 indexDirectory = new File( repositoryDirectory, ".indexer" );
630 if ( !repositoryDirectory.isAbsolute() )
632 indexDirectory = new File( repositoryDirectory, ".indexer" );
633 repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
637 if ( !indexDirectory.exists() )
639 indexDirectory.mkdirs();
642 context = indexer.getIndexingContexts().get( repository.getId() );
644 if ( context == null )
646 context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory,
648 repositoryDirectory.toURI().toURL().toExternalForm(),
649 indexDirectory.toURI().toURL().toString(), indexCreators );
651 context.setSearchable( repository.isScanned() );
655 catch ( MalformedURLException e )
657 throw new RepositoryAdminException( e.getMessage(), e );
659 catch ( IOException e )
661 throw new RepositoryAdminException( e.getMessage(), e );
663 catch ( UnsupportedExistingLuceneIndexException e )
665 throw new RepositoryAdminException( e.getMessage(), e );
669 private ManagedRepositoryConfiguration getStageRepoConfig( ManagedRepositoryConfiguration repository )
671 ManagedRepositoryConfiguration stagingRepository = new ManagedRepositoryConfiguration();
672 stagingRepository.setId( repository.getId() + STAGE_REPO_ID_END );
673 stagingRepository.setLayout( repository.getLayout() );
674 stagingRepository.setName( repository.getName() + STAGE_REPO_ID_END );
675 stagingRepository.setBlockRedeployments( repository.isBlockRedeployments() );
676 stagingRepository.setDaysOlder( repository.getDaysOlder() );
677 stagingRepository.setDeleteReleasedSnapshots( repository.isDeleteReleasedSnapshots() );
679 String path = repository.getLocation();
680 int lastIndex = path.replace( '\\', '/' ).lastIndexOf( '/' );
681 stagingRepository.setLocation( path.substring( 0, lastIndex ) + "/" + stagingRepository.getId() );
683 if ( StringUtils.isNotBlank( repository.getIndexDir() ) )
685 File indexDir = new File( repository.getIndexDir() );
686 // in case of absolute dir do not use the same
687 if ( indexDir.isAbsolute() )
689 stagingRepository.setIndexDir( stagingRepository.getLocation() + "/.index" );
693 stagingRepository.setIndexDir( repository.getIndexDir() );
696 stagingRepository.setRefreshCronExpression( repository.getRefreshCronExpression() );
697 stagingRepository.setReleases( repository.isReleases() );
698 stagingRepository.setRetentionCount( repository.getRetentionCount() );
699 stagingRepository.setScanned( repository.isScanned() );
700 stagingRepository.setSnapshots( repository.isSnapshots() );
701 stagingRepository.setSkipPackedIndexCreation( repository.isSkipPackedIndexCreation() );
702 // do not duplicate description
703 //stagingRepository.getDescription("")
704 return stagingRepository;
707 public Boolean scanRepository( String repositoryId, boolean fullScan )
709 if ( getRepositoryTaskScheduler().isProcessingRepositoryTask( repositoryId ) )
711 log.info( "scanning of repository with id {} already scheduled", repositoryId );
713 RepositoryTask task = new RepositoryTask();
714 task.setRepositoryId( repositoryId );
715 task.setScanAll( fullScan );
718 getRepositoryTaskScheduler().queueTask( task );
720 catch ( TaskQueueException e )
722 log.error( "failed to schedule scanning of repo with id {}", repositoryId, e );
728 protected void addRepositoryRoles( ManagedRepositoryConfiguration newRepository )
729 throws RoleManagerException
731 String repoId = newRepository.getId();
733 // TODO: double check these are configured on start up
734 // TODO: belongs in the business logic
736 if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
738 getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
741 if ( !getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
743 getRoleManager().createTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
747 protected void removeRepositoryRoles( ManagedRepositoryConfiguration existingRepository )
748 throws RoleManagerException
750 String repoId = existingRepository.getId();
752 if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId ) )
754 getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_MANAGER, repoId );
757 if ( getRoleManager().templatedRoleExists( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId ) )
759 getRoleManager().removeTemplatedRole( ArchivaRoleConstants.TEMPLATE_REPOSITORY_OBSERVER, repoId );
762 log.debug( "removed user roles associated with repository {}", repoId );
765 //--------------------------
767 //--------------------------
770 public RoleManager getRoleManager()
775 public void setRoleManager( RoleManager roleManager )
777 this.roleManager = roleManager;
780 public RepositoryStatisticsManager getRepositoryStatisticsManager()
782 return repositoryStatisticsManager;
785 public void setRepositoryStatisticsManager( RepositoryStatisticsManager repositoryStatisticsManager )
787 this.repositoryStatisticsManager = repositoryStatisticsManager;
790 public RepositorySessionFactory getRepositorySessionFactory()
792 return repositorySessionFactory;
795 public void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory )
797 this.repositorySessionFactory = repositorySessionFactory;
801 public RepositoryArchivaTaskScheduler getRepositoryTaskScheduler()
803 return repositoryTaskScheduler;
806 public void setRepositoryTaskScheduler( RepositoryArchivaTaskScheduler repositoryTaskScheduler )
808 this.repositoryTaskScheduler = repositoryTaskScheduler;
811 public PlexusSisuBridge getPlexusSisuBridge()
813 return plexusSisuBridge;
816 public void setPlexusSisuBridge( PlexusSisuBridge plexusSisuBridge )
818 this.plexusSisuBridge = plexusSisuBridge;
821 public MavenIndexerUtils getMavenIndexerUtils()
823 return mavenIndexerUtils;
826 public void setMavenIndexerUtils( MavenIndexerUtils mavenIndexerUtils )
828 this.mavenIndexerUtils = mavenIndexerUtils;