mirror of https://github.com/apache/archiva.git
add repository roles from the configuration
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@541057 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4687c698c7
commit
728afe73ad
|
@ -30,6 +30,8 @@ import org.apache.maven.archiva.repository.ArchivaConfigurationAdaptor;
|
|||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
||||
import org.codehaus.plexus.redback.role.RoleManager;
|
||||
import org.codehaus.plexus.redback.role.RoleManagerException;
|
||||
import org.codehaus.plexus.registry.Registry;
|
||||
import org.codehaus.plexus.registry.RegistryListener;
|
||||
|
||||
|
@ -54,6 +56,11 @@ public class ConfigurationSynchronization
|
|||
*/
|
||||
private ArchivaDAO dao;
|
||||
|
||||
/**
|
||||
* @plexus.requirement role-hint="default"
|
||||
*/
|
||||
RoleManager roleManager;
|
||||
|
||||
/**
|
||||
* @plexus.requirement
|
||||
*/
|
||||
|
@ -109,6 +116,26 @@ public class ConfigurationSynchronization
|
|||
// Log error.
|
||||
getLogger().error( "Unable to add configured repositories to the database: " + e.getMessage(), e );
|
||||
}
|
||||
|
||||
// manage roles for repositories
|
||||
try
|
||||
{
|
||||
if ( !roleManager.templatedRoleExists( "archiva-repository-observer", repoConfig.getId() ) )
|
||||
{
|
||||
roleManager.createTemplatedRole( "archiva-repository-observer", repoConfig.getId() );
|
||||
}
|
||||
|
||||
if ( !roleManager.templatedRoleExists( "archiva-repository-manager", repoConfig.getId() ) );
|
||||
{
|
||||
roleManager.createTemplatedRole( "archiva-repository-manager", repoConfig.getId() );
|
||||
}
|
||||
}
|
||||
catch ( RoleManagerException e )
|
||||
{
|
||||
// Log error.
|
||||
getLogger().error( "Unable to create roles for configured repositories: " + e.getMessage(), e );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue