mirror of https://github.com/apache/archiva.git
use a better naming convention as it concerned redback part
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1423659 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d15b737723
commit
9736ffc636
|
@ -30,7 +30,7 @@ import java.util.Map;
|
|||
* @since 1.4-M4
|
||||
*/
|
||||
@XmlRootElement(name = "redbackRuntimeConfiguration")
|
||||
public class ArchivaRuntimeConfiguration
|
||||
public class RedbackRuntimeConfiguration
|
||||
implements Serializable
|
||||
{
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class ArchivaRuntimeConfiguration
|
|||
*/
|
||||
private List<PropertyEntry> configurationPropertiesEntries;
|
||||
|
||||
public ArchivaRuntimeConfiguration()
|
||||
public RedbackRuntimeConfiguration()
|
||||
{
|
||||
// no op
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ public class ArchivaRuntimeConfiguration
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "ArchivaRuntimeConfiguration{" +
|
||||
return "RedbackRuntimeConfiguration{" +
|
||||
"userManagerImpls=" + userManagerImpls +
|
||||
", ldapConfiguration=" + ldapConfiguration +
|
||||
", migratedFromRedbackConfiguration=" + migratedFromRedbackConfiguration +
|
|
@ -19,7 +19,7 @@ package org.apache.archiva.admin.model.runtime;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
|
@ -27,10 +27,10 @@ import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
|||
*/
|
||||
public interface ArchivaRuntimeConfigurationAdmin
|
||||
{
|
||||
ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
|
||||
RedbackRuntimeConfiguration getArchivaRuntimeConfiguration()
|
||||
throws RepositoryAdminException;
|
||||
|
||||
void updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
||||
void updateArchivaRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
|
||||
throws RepositoryAdminException;
|
||||
|
||||
}
|
||||
|
|
|
@ -21,12 +21,11 @@ package org.apache.archiva.admin.repository.runtime;
|
|||
import net.sf.beanlib.provider.replicator.BeanReplicator;
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.beans.LdapConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
|
||||
import org.apache.archiva.configuration.ArchivaConfiguration;
|
||||
import org.apache.archiva.configuration.Configuration;
|
||||
import org.apache.archiva.configuration.IndeterminateConfigurationException;
|
||||
import org.apache.archiva.configuration.RedbackRuntimeConfiguration;
|
||||
import org.apache.archiva.redback.components.registry.RegistryException;
|
||||
import org.apache.archiva.redback.configuration.UserConfiguration;
|
||||
import org.apache.archiva.redback.configuration.UserConfigurationException;
|
||||
|
@ -65,24 +64,24 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
{
|
||||
try
|
||||
{
|
||||
ArchivaRuntimeConfiguration archivaRuntimeConfiguration = getArchivaRuntimeConfiguration();
|
||||
RedbackRuntimeConfiguration redbackRuntimeConfiguration = getArchivaRuntimeConfiguration();
|
||||
// migrate or not data from redback
|
||||
if ( !archivaRuntimeConfiguration.isMigratedFromRedbackConfiguration() )
|
||||
if ( !redbackRuntimeConfiguration.isMigratedFromRedbackConfiguration() )
|
||||
{
|
||||
// so migrate if available
|
||||
String userManagerImpl = userConfiguration.getString( UserConfigurationKeys.USER_MANAGER_IMPL );
|
||||
if ( StringUtils.isNotEmpty( userManagerImpl ) )
|
||||
{
|
||||
archivaRuntimeConfiguration.getUserManagerImpls().add( userManagerImpl );
|
||||
redbackRuntimeConfiguration.getUserManagerImpls().add( userManagerImpl );
|
||||
}
|
||||
|
||||
// now ldap
|
||||
|
||||
LdapConfiguration ldapConfiguration = archivaRuntimeConfiguration.getLdapConfiguration();
|
||||
LdapConfiguration ldapConfiguration = redbackRuntimeConfiguration.getLdapConfiguration();
|
||||
if ( ldapConfiguration == null )
|
||||
{
|
||||
ldapConfiguration = new LdapConfiguration();
|
||||
archivaRuntimeConfiguration.setLdapConfiguration( ldapConfiguration );
|
||||
redbackRuntimeConfiguration.setLdapConfiguration( ldapConfiguration );
|
||||
}
|
||||
|
||||
ldapConfiguration.setHostName(
|
||||
|
@ -100,19 +99,19 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
ldapConfiguration.setAuthenticationMethod(
|
||||
userConfiguration.getString( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD, null ) );
|
||||
|
||||
archivaRuntimeConfiguration.setMigratedFromRedbackConfiguration( true );
|
||||
redbackRuntimeConfiguration.setMigratedFromRedbackConfiguration( true );
|
||||
|
||||
updateArchivaRuntimeConfiguration( archivaRuntimeConfiguration );
|
||||
updateArchivaRuntimeConfiguration( redbackRuntimeConfiguration );
|
||||
|
||||
}
|
||||
|
||||
// we must ensure userManagerImpls list is not empty if so put at least jdo one !
|
||||
if ( archivaRuntimeConfiguration.getUserManagerImpls().isEmpty() )
|
||||
if ( redbackRuntimeConfiguration.getUserManagerImpls().isEmpty() )
|
||||
{
|
||||
log.info(
|
||||
"archivaRuntimeConfiguration with empty userManagerImpls so force at least jdo implementation !" );
|
||||
archivaRuntimeConfiguration.getUserManagerImpls().add( "jdo" );
|
||||
updateArchivaRuntimeConfiguration( archivaRuntimeConfiguration );
|
||||
"redbackRuntimeConfiguration with empty userManagerImpls so force at least jdo implementation !" );
|
||||
redbackRuntimeConfiguration.getUserManagerImpls().add( "jdo" );
|
||||
updateArchivaRuntimeConfiguration( redbackRuntimeConfiguration );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -122,15 +121,16 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
}
|
||||
|
||||
public ArchivaRuntimeConfiguration getArchivaRuntimeConfiguration()
|
||||
public RedbackRuntimeConfiguration getArchivaRuntimeConfiguration()
|
||||
{
|
||||
return build( archivaConfiguration.getConfiguration().getRedbackRuntimeConfiguration() );
|
||||
}
|
||||
|
||||
public void updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
||||
public void updateArchivaRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
|
||||
throws RepositoryAdminException
|
||||
{
|
||||
RedbackRuntimeConfiguration runtimeConfiguration = build( archivaRuntimeConfiguration );
|
||||
org.apache.archiva.configuration.RedbackRuntimeConfiguration
|
||||
runtimeConfiguration = build( redbackRuntimeConfiguration );
|
||||
Configuration configuration = archivaConfiguration.getConfiguration();
|
||||
configuration.setRedbackRuntimeConfiguration( runtimeConfiguration );
|
||||
try
|
||||
|
@ -147,31 +147,31 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
}
|
||||
|
||||
private ArchivaRuntimeConfiguration build( RedbackRuntimeConfiguration runtimeConfiguration )
|
||||
private RedbackRuntimeConfiguration build( org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration )
|
||||
{
|
||||
ArchivaRuntimeConfiguration archivaRuntimeConfiguration =
|
||||
new BeanReplicator().replicateBean( runtimeConfiguration, ArchivaRuntimeConfiguration.class );
|
||||
RedbackRuntimeConfiguration redbackRuntimeConfiguration =
|
||||
new BeanReplicator().replicateBean( runtimeConfiguration, RedbackRuntimeConfiguration.class );
|
||||
|
||||
if ( runtimeConfiguration.getLdapConfiguration() != null )
|
||||
{
|
||||
archivaRuntimeConfiguration.setLdapConfiguration(
|
||||
redbackRuntimeConfiguration.setLdapConfiguration(
|
||||
new BeanReplicator().replicateBean( runtimeConfiguration.getLdapConfiguration(),
|
||||
LdapConfiguration.class ) );
|
||||
}
|
||||
|
||||
if ( archivaRuntimeConfiguration.getLdapConfiguration() == null )
|
||||
if ( redbackRuntimeConfiguration.getLdapConfiguration() == null )
|
||||
{
|
||||
// prevent NPE
|
||||
archivaRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
|
||||
redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() );
|
||||
}
|
||||
|
||||
return archivaRuntimeConfiguration;
|
||||
return redbackRuntimeConfiguration;
|
||||
}
|
||||
|
||||
private RedbackRuntimeConfiguration build( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
||||
private org.apache.archiva.configuration.RedbackRuntimeConfiguration build( RedbackRuntimeConfiguration archivaRuntimeConfiguration )
|
||||
{
|
||||
RedbackRuntimeConfiguration redbackRuntimeConfiguration =
|
||||
new BeanReplicator().replicateBean( archivaRuntimeConfiguration, RedbackRuntimeConfiguration.class );
|
||||
org.apache.archiva.configuration.RedbackRuntimeConfiguration redbackRuntimeConfiguration =
|
||||
new BeanReplicator().replicateBean( archivaRuntimeConfiguration, org.apache.archiva.configuration.RedbackRuntimeConfiguration.class );
|
||||
|
||||
redbackRuntimeConfiguration.setLdapConfiguration(
|
||||
new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getLdapConfiguration(),
|
||||
|
@ -191,7 +191,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
return getArchivaRuntimeConfiguration().getUserManagerImpls().get( 0 );
|
||||
}
|
||||
|
||||
ArchivaRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
RedbackRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
|
||||
if ( conf.getConfigurationProperties().containsKey( key ) )
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
log.error( "fail to save ArchivaRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
|
@ -237,7 +237,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
return getArchivaRuntimeConfiguration().getLdapConfiguration().getAuthenticationMethod();
|
||||
}
|
||||
|
||||
ArchivaRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
RedbackRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
|
||||
if ( conf.getConfigurationProperties().containsKey( key ) )
|
||||
{
|
||||
|
@ -258,7 +258,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
log.error( "fail to save ArchivaRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
|
||||
public int getInt( String key )
|
||||
{
|
||||
ArchivaRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
RedbackRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
|
||||
if ( conf.getConfigurationProperties().containsKey( key ) )
|
||||
{
|
||||
|
@ -283,7 +283,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
log.error( "fail to save ArchivaRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
return getArchivaRuntimeConfiguration().getLdapConfiguration().getPort();
|
||||
}
|
||||
|
||||
ArchivaRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
RedbackRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
|
||||
if ( conf.getConfigurationProperties().containsKey( key ) )
|
||||
{
|
||||
|
@ -313,7 +313,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
log.error( "fail to save ArchivaRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
|
||||
public boolean getBoolean( String key )
|
||||
{
|
||||
ArchivaRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
RedbackRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
|
||||
if ( conf.getConfigurationProperties().containsKey( key ) )
|
||||
{
|
||||
|
@ -338,7 +338,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
log.error( "fail to save ArchivaRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
return getArchivaRuntimeConfiguration().getLdapConfiguration().isSsl();
|
||||
}
|
||||
|
||||
ArchivaRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
RedbackRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
|
||||
if ( conf.getConfigurationProperties().containsKey( key ) )
|
||||
{
|
||||
|
@ -368,7 +368,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
log.error( "fail to save ArchivaRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
|
@ -379,7 +379,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
{
|
||||
List<String> value = userConfiguration.getList( key );
|
||||
|
||||
ArchivaRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
RedbackRuntimeConfiguration conf = getArchivaRuntimeConfiguration();
|
||||
// TODO concat values
|
||||
conf.getConfigurationProperties().put( key, "" );
|
||||
try
|
||||
|
@ -388,7 +388,7 @@ public class DefaultArchivaRuntimeConfigurationAdmin
|
|||
}
|
||||
catch ( RepositoryAdminException e )
|
||||
{
|
||||
log.error( "fail to save ArchivaRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
log.error( "fail to save RedbackRuntimeConfiguration: {}", e.getMessage(), e );
|
||||
throw new RuntimeException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.archiva.rest.api.services;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.LdapConfiguration;
|
||||
import org.apache.archiva.redback.authorization.RedbackAuthorization;
|
||||
import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
|
||||
|
@ -44,15 +44,15 @@ public interface ArchivaRuntimeConfigurationService
|
|||
@GET
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
|
||||
ArchivaRuntimeConfiguration getArchivaRuntimeConfigurationAdmin()
|
||||
RedbackRuntimeConfiguration getArchivaRuntimeConfigurationAdmin()
|
||||
throws ArchivaRestServiceException;
|
||||
|
||||
@Path("archivaRuntimeConfiguration")
|
||||
@Path("redbackRuntimeConfiguration")
|
||||
@PUT
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@RedbackAuthorization(permissions = ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION)
|
||||
Boolean updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
||||
Boolean updateArchivaRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
|
||||
throws ArchivaRestServiceException;
|
||||
|
||||
@Path("userManagerImplementationInformation")
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.apache.archiva.rest.services;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.LdapConfiguration;
|
||||
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
|
||||
import org.apache.archiva.redback.authentication.AuthenticationException;
|
||||
|
@ -71,7 +71,7 @@ public class DefaultArchivaRuntimeConfigurationService
|
|||
@Named(value = "ldapConnectionFactory#configurable")
|
||||
private LdapConnectionFactory ldapConnectionFactory;
|
||||
|
||||
public ArchivaRuntimeConfiguration getArchivaRuntimeConfigurationAdmin()
|
||||
public RedbackRuntimeConfiguration getArchivaRuntimeConfigurationAdmin()
|
||||
throws ArchivaRestServiceException
|
||||
{
|
||||
try
|
||||
|
@ -84,25 +84,25 @@ public class DefaultArchivaRuntimeConfigurationService
|
|||
}
|
||||
}
|
||||
|
||||
public Boolean updateArchivaRuntimeConfiguration( ArchivaRuntimeConfiguration archivaRuntimeConfiguration )
|
||||
public Boolean updateArchivaRuntimeConfiguration( RedbackRuntimeConfiguration redbackRuntimeConfiguration )
|
||||
throws ArchivaRestServiceException
|
||||
{
|
||||
try
|
||||
{
|
||||
// has user manager impl changed ?
|
||||
boolean userManagerChanged = archivaRuntimeConfiguration.getUserManagerImpls().size()
|
||||
boolean userManagerChanged = redbackRuntimeConfiguration.getUserManagerImpls().size()
|
||||
!= archivaRuntimeConfigurationAdmin.getArchivaRuntimeConfiguration().getUserManagerImpls().size();
|
||||
|
||||
userManagerChanged =
|
||||
userManagerChanged || ( archivaRuntimeConfiguration.getUserManagerImpls().toString().hashCode()
|
||||
userManagerChanged || ( redbackRuntimeConfiguration.getUserManagerImpls().toString().hashCode()
|
||||
!= archivaRuntimeConfigurationAdmin.getArchivaRuntimeConfiguration().getUserManagerImpls().toString().hashCode() );
|
||||
|
||||
archivaRuntimeConfigurationAdmin.updateArchivaRuntimeConfiguration( archivaRuntimeConfiguration );
|
||||
archivaRuntimeConfigurationAdmin.updateArchivaRuntimeConfiguration( redbackRuntimeConfiguration );
|
||||
|
||||
if ( userManagerChanged )
|
||||
{
|
||||
log.info( "user managerImpls changed to {} so reload it",
|
||||
archivaRuntimeConfiguration.getUserManagerImpls() );
|
||||
redbackRuntimeConfiguration.getUserManagerImpls() );
|
||||
userManager.initialize();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.archiva.rest.services;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration;
|
||||
import org.apache.archiva.rest.api.model.UserManagerImplementationInformation;
|
||||
import org.apache.archiva.rest.api.services.ArchivaRuntimeConfigurationService;
|
||||
import org.fest.assertions.api.Assertions;
|
||||
|
@ -37,25 +37,25 @@ public class ArchivaRuntimeConfigurationServiceTest
|
|||
public void nonnullConfiguration()
|
||||
throws Exception
|
||||
{
|
||||
ArchivaRuntimeConfiguration archivaRuntimeConfiguration =
|
||||
RedbackRuntimeConfiguration redbackRuntimeConfiguration =
|
||||
getArchivaRuntimeConfigurationService().getArchivaRuntimeConfigurationAdmin();
|
||||
assertEquals( "jdo", archivaRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
|
||||
assertEquals( "jdo", redbackRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void update()
|
||||
throws Exception
|
||||
{
|
||||
ArchivaRuntimeConfiguration archivaRuntimeConfiguration =
|
||||
RedbackRuntimeConfiguration redbackRuntimeConfiguration =
|
||||
getArchivaRuntimeConfigurationService().getArchivaRuntimeConfigurationAdmin();
|
||||
assertEquals( "jdo", archivaRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
|
||||
assertEquals( "jdo", redbackRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
|
||||
|
||||
archivaRuntimeConfiguration.setUserManagerImpls( Arrays.asList( "foo" ) );
|
||||
redbackRuntimeConfiguration.setUserManagerImpls( Arrays.asList( "foo" ) );
|
||||
|
||||
getArchivaRuntimeConfigurationService().updateArchivaRuntimeConfiguration( archivaRuntimeConfiguration );
|
||||
getArchivaRuntimeConfigurationService().updateArchivaRuntimeConfiguration( redbackRuntimeConfiguration );
|
||||
|
||||
archivaRuntimeConfiguration = getArchivaRuntimeConfigurationService().getArchivaRuntimeConfigurationAdmin();
|
||||
assertEquals( "foo", archivaRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
|
||||
redbackRuntimeConfiguration = getArchivaRuntimeConfigurationService().getArchivaRuntimeConfigurationAdmin();
|
||||
assertEquals( "foo", redbackRuntimeConfiguration.getUserManagerImpls().get( 0 ) );
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,10 @@ package org.apache.archiva.web.runtime.ldap;
|
|||
*/
|
||||
|
||||
import org.apache.archiva.admin.model.RepositoryAdminException;
|
||||
import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration;
|
||||
import org.apache.archiva.admin.model.beans.LdapConfiguration;
|
||||
import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin;
|
||||
import org.apache.archiva.redback.common.ldap.connection.ConfigurableLdapConnectionFactory;
|
||||
import org.apache.archiva.redback.common.ldap.connection.LdapConnectionConfiguration;
|
||||
import org.apache.archiva.redback.configuration.UserConfigurationKeys;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
|
|
@ -1151,10 +1151,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
}
|
||||
|
||||
|
||||
ArchivaRuntimeConfiguration=function(userManagerImpls,ldapConfiguration,migratedFromRedbackConfiguration,configurationPropertiesEntries){
|
||||
RedbackRuntimeConfiguration=function(userManagerImpls,ldapConfiguration,migratedFromRedbackConfiguration,configurationPropertiesEntries){
|
||||
var self=this;
|
||||
this.modified=ko.observable(false);
|
||||
this.modified.subscribe(function(newValue){$.log("ArchivaRuntimeConfiguration modified")});
|
||||
this.modified.subscribe(function(newValue){$.log("RedbackRuntimeConfiguration modified")});
|
||||
|
||||
this.userManagerImpls=ko.observableArray(userManagerImpls);
|
||||
this.userManagerImpls.subscribe(function(newValue){self.modified(true)});
|
||||
|
@ -1171,22 +1171,22 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
});
|
||||
}
|
||||
|
||||
mapArchivaRuntimeConfiguration=function(data){
|
||||
var archivaRuntimeConfiguration =
|
||||
new ArchivaRuntimeConfiguration(data.userManagerImpls,mapLdapConfiguration(data.ldapConfiguration),data.migratedFromRedbackConfiguration);
|
||||
mapRedbackRuntimeConfiguration=function(data){
|
||||
var redbackRuntimeConfiguration =
|
||||
new RedbackRuntimeConfiguration(data.userManagerImpls,mapLdapConfiguration(data.ldapConfiguration),data.migratedFromRedbackConfiguration);
|
||||
|
||||
|
||||
var configurationPropertiesEntries = data.configurationPropertiesEntries == null ? []: $.each(data.configurationPropertiesEntries,function(item){
|
||||
return new Entry(item.key, item.value,function(newValue){
|
||||
archivaRuntimeConfiguration.modified(true);
|
||||
redbackRuntimeConfiguration.modified(true);
|
||||
});
|
||||
});
|
||||
if (!$.isArray(configurationPropertiesEntries)){
|
||||
configurationPropertiesEntries=[];
|
||||
}
|
||||
archivaRuntimeConfiguration.configurationPropertiesEntries(configurationPropertiesEntries);
|
||||
archivaRuntimeConfiguration.modified(false);
|
||||
return archivaRuntimeConfiguration;
|
||||
redbackRuntimeConfiguration.configurationPropertiesEntries(configurationPropertiesEntries);
|
||||
redbackRuntimeConfiguration.modified(false);
|
||||
return redbackRuntimeConfiguration;
|
||||
|
||||
}
|
||||
|
||||
|
@ -1246,9 +1246,9 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
return null;
|
||||
}
|
||||
|
||||
ArchivaRuntimeConfigurationViewModel=function(archivaRuntimeConfiguration,userManagerImplementationInformations){
|
||||
RedbackRuntimeConfigurationViewModel=function(redbackRuntimeConfiguration,userManagerImplementationInformations){
|
||||
var self=this;
|
||||
this.archivaRuntimeConfiguration=ko.observable(archivaRuntimeConfiguration);
|
||||
this.redbackRuntimeConfiguration=ko.observable(redbackRuntimeConfiguration);
|
||||
this.userManagerImplementationInformations=ko.observable(userManagerImplementationInformations);
|
||||
|
||||
this.usedUserManagerImpls=ko.observableArray([]);
|
||||
|
@ -1300,7 +1300,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
{
|
||||
type: "POST",
|
||||
contentType: 'application/json',
|
||||
data:ko.toJSON(self.archivaRuntimeConfiguration().ldapConfiguration),
|
||||
data:ko.toJSON(self.redbackRuntimeConfiguration().ldapConfiguration),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var message=$.i18n.prop('redback.runtime.ldap.verified');
|
||||
|
@ -1318,8 +1318,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
);
|
||||
}
|
||||
|
||||
for(var i= 0;i<archivaRuntimeConfiguration.userManagerImpls().length;i++){
|
||||
var id=archivaRuntimeConfiguration.userManagerImpls()[i];
|
||||
for(var i= 0;i<redbackRuntimeConfiguration.userManagerImpls().length;i++){
|
||||
var id=redbackRuntimeConfiguration.userManagerImpls()[i];
|
||||
$.log("id:"+id);
|
||||
var userManagerImplementationInformation=findUserManagerImplementationInformation(id);
|
||||
|
||||
|
@ -1348,7 +1348,7 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
|
||||
userManagerImplMoved=function(arg){
|
||||
$.log("userManagerImplMoved");
|
||||
self.archivaRuntimeConfiguration().modified(true);
|
||||
self.redbackRuntimeConfiguration().modified(true);
|
||||
}
|
||||
|
||||
saveArchivaRuntimeConfiguration=function(){
|
||||
|
@ -1358,20 +1358,20 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
clearUserMessages();
|
||||
var userMessages=$("#user-messages");
|
||||
userMessages.html(mediumSpinnerImg());
|
||||
self.archivaRuntimeConfiguration().userManagerImpls=ko.observableArray([]);
|
||||
self.redbackRuntimeConfiguration().userManagerImpls=ko.observableArray([]);
|
||||
$.log("length:"+self.usedUserManagerImpls().length);
|
||||
for(var i=0;i<self.usedUserManagerImpls().length;i++){
|
||||
var beanId=self.usedUserManagerImpls()[i].beanId;
|
||||
$.log("beanId:"+beanId);
|
||||
self.archivaRuntimeConfiguration().userManagerImpls.push(beanId);
|
||||
self.redbackRuntimeConfiguration().userManagerImpls.push(beanId);
|
||||
}
|
||||
$.log("length:"+self.archivaRuntimeConfiguration().userManagerImpls().length);
|
||||
$.log("json:"+ko.toJSON(self.archivaRuntimeConfiguration));
|
||||
$.log("length:"+self.redbackRuntimeConfiguration().userManagerImpls().length);
|
||||
$.log("json:"+ko.toJSON(self.redbackRuntimeConfiguration));
|
||||
$.ajax("restServices/archivaServices/archivaRuntimeConfigurationService/archivaRuntimeConfiguration",
|
||||
{
|
||||
type: "PUT",
|
||||
contentType: 'application/json',
|
||||
data:ko.toJSON(self.archivaRuntimeConfiguration),
|
||||
data:ko.toJSON(self.redbackRuntimeConfiguration),
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var message=$.i18n.prop('archiva-runtime-configuration.updated');
|
||||
|
@ -1384,8 +1384,8 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
complete:function(data){
|
||||
removeMediumSpinnerImg(userMessages);
|
||||
saveButton.button('reset');
|
||||
self.archivaRuntimeConfiguration().modified(false);
|
||||
self.archivaRuntimeConfiguration().ldapConfiguration().modified(false);
|
||||
self.redbackRuntimeConfiguration().modified(false);
|
||||
self.redbackRuntimeConfiguration().ldapConfiguration().modified(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -1427,11 +1427,11 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
|
|||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var archivaRuntimeConfiguration = mapArchivaRuntimeConfiguration(data);
|
||||
var archivaRuntimeConfigurationViewModel =
|
||||
new ArchivaRuntimeConfigurationViewModel(archivaRuntimeConfiguration,userManagerImplementationInformations);
|
||||
var redbackRuntimeConfiguration = mapRedbackRuntimeConfiguration(data);
|
||||
var redbackRuntimeConfigurationViewModel =
|
||||
new RedbackRuntimeConfigurationViewModel(redbackRuntimeConfiguration,userManagerImplementationInformations);
|
||||
mainContent.html( $( "#runtime-configuration-main" ).tmpl() );
|
||||
ko.applyBindings(archivaRuntimeConfigurationViewModel,$("#runtime-configuration-content" ).get(0));
|
||||
ko.applyBindings(redbackRuntimeConfigurationViewModel,$("#runtime-configuration-content" ).get(0));
|
||||
activatePopoverDoc();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -932,7 +932,7 @@
|
|||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="ldap-host" name="ldap-host" class="input-xlarge"
|
||||
data-bind="value: archivaRuntimeConfiguration().ldapConfiguration().hostName"/>
|
||||
data-bind="value: redbackRuntimeConfiguration().ldapConfiguration().hostName"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
@ -941,7 +941,7 @@
|
|||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="ldap-port" name="ldap-port" class="input-large"
|
||||
data-bind="value: archivaRuntimeConfiguration().ldapConfiguration().port"/>
|
||||
data-bind="value: redbackRuntimeConfiguration().ldapConfiguration().port"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
@ -950,7 +950,7 @@
|
|||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="ldap-baseDn" name="ldap-baseDn" class="input-xxlarge"
|
||||
data-bind="value: archivaRuntimeConfiguration().ldapConfiguration().baseDn"/>
|
||||
data-bind="value: redbackRuntimeConfiguration().ldapConfiguration().baseDn"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
@ -959,7 +959,7 @@
|
|||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="ldap-bindDn" name="ldap-bindDn" class="input-xxlarge"
|
||||
data-bind="value: archivaRuntimeConfiguration().ldapConfiguration().bindDn"/>
|
||||
data-bind="value: redbackRuntimeConfiguration().ldapConfiguration().bindDn"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
@ -968,7 +968,7 @@
|
|||
</label>
|
||||
<div class="controls">
|
||||
<input type="checkbox" id="ldap-ssl" name="ldap-ssl"
|
||||
data-bind="checked: archivaRuntimeConfiguration().ldapConfiguration().ssl"/>
|
||||
data-bind="checked: redbackRuntimeConfiguration().ldapConfiguration().ssl"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
@ -977,7 +977,7 @@
|
|||
</label>
|
||||
<div class="controls">
|
||||
<input type="password" id="ldap-password" name="ldap-password" class="input-xlarge"
|
||||
data-bind="value: archivaRuntimeConfiguration().ldapConfiguration().password"/>
|
||||
data-bind="value: redbackRuntimeConfiguration().ldapConfiguration().password"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
@ -986,7 +986,7 @@
|
|||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="ldap-context-factory" name="ldap-context-factory" class="input-xlarge"
|
||||
data-bind="value: archivaRuntimeConfiguration().ldapConfiguration().contextFactory"/>
|
||||
data-bind="value: redbackRuntimeConfiguration().ldapConfiguration().contextFactory"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
@ -995,15 +995,15 @@
|
|||
</label>
|
||||
<div class="controls">
|
||||
<input type="text" id="ldap-authenticationMethod" name="ldap-authenticationMethod" class="input-xlarge"
|
||||
data-bind="value: archivaRuntimeConfiguration().ldapConfiguration().authenticationMethod"/>
|
||||
data-bind="value: redbackRuntimeConfiguration().ldapConfiguration().authenticationMethod"/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- TODO extraPropertiesEntries -->
|
||||
|
||||
</form>
|
||||
|
||||
<button data-bind="click: checkChangedLdapConfiguration,css:{ 'btn-warning': archivaRuntimeConfiguration().ldapConfiguration().modified() },
|
||||
enabled: archivaRuntimeConfiguration().ldapConfiguration().modified()"
|
||||
<button data-bind="click: checkChangedLdapConfiguration,css:{ 'btn-warning': redbackRuntimeConfiguration().ldapConfiguration().modified() },
|
||||
enabled: redbackRuntimeConfiguration().ldapConfiguration().modified()"
|
||||
id="ldap-configuration-check-modification"class="btn">${$.i18n.prop('redback.runtime.ldap.checkModification')}</button>
|
||||
|
||||
<button data-bind="click: checkLdapServerConfiguration"
|
||||
|
@ -1023,7 +1023,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{each(i, property) archivaRuntimeConfiguration().configurationPropertiesEntries}}
|
||||
{{each(i, property) redbackRuntimeConfiguration().configurationPropertiesEntries}}
|
||||
<tr>
|
||||
<td>
|
||||
{{var key = property.key}}
|
||||
|
@ -1044,7 +1044,7 @@
|
|||
</div>
|
||||
|
||||
<div>
|
||||
<button data-bind="click: saveArchivaRuntimeConfiguration,css:{ 'btn-warning': archivaRuntimeConfiguration().modified() | archivaRuntimeConfiguration().ldapConfiguration().modified() }"
|
||||
<button data-bind="click: saveArchivaRuntimeConfiguration,css:{ 'btn-warning': redbackRuntimeConfiguration().modified() | redbackRuntimeConfiguration().ldapConfiguration().modified() }"
|
||||
id="archiva-runtime-configuration-save"class="btn">${$.i18n.prop('save')}</button>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue