diff --git a/archiva-modules/archiva-base/archiva-common/pom.xml b/archiva-modules/archiva-base/archiva-common/pom.xml index 94d979e8e..d2599e860 100644 --- a/archiva-modules/archiva-base/archiva-common/pom.xml +++ b/archiva-modules/archiva-base/archiva-common/pom.xml @@ -46,21 +46,6 @@ org.slf4j slf4j-api - org.eclipse.sisu org.eclipse.sisu.plexus diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml index 25b3d5bd7..32e7cfed1 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/pom.xml @@ -66,22 +66,8 @@ spring-taskqueue - net.sf.beanlib - beanlib - - - cglib - cglib - - - aopalliance - aopalliance - - - log4j - log4j - - + org.modelmapper + modelmapper org.apache.maven.wagon @@ -254,7 +240,7 @@ javax.annotation, javax.inject, - net.sf.beanlib.provider.replicator, + org.modelmapper, org.apache.archiva.admin.model*;version=${project.version}, org.apache.archiva.audit;version=${project.version}, org.apache.archiva.common.plexusbridge;version=${project.version}, diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java index 3286e22bb..194028f29 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/AbstractRepositoryAdmin.java @@ -28,6 +28,7 @@ import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.IndeterminateConfigurationException; import org.apache.archiva.redback.users.User; import org.apache.archiva.redback.components.registry.Registry; +import org.modelmapper.ModelMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -91,6 +92,16 @@ public abstract class AbstractRepositoryAdmin } } + private static class ModelMapperHolder + { + private static ModelMapper MODEL_MAPPER = new ModelMapper(); + } + + protected ModelMapper getModelMapper() + { + return ModelMapperHolder.MODEL_MAPPER; + } + public List getAuditListeners() { return auditListeners; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java index e95862539..93933ad20 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java @@ -18,7 +18,6 @@ package org.apache.archiva.admin.repository.admin; * under the License. */ -import net.sf.beanlib.provider.replicator.BeanReplicator; import org.apache.archiva.admin.model.AuditInformation; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.admin.ArchivaAdministration; @@ -81,7 +80,7 @@ public class DefaultArchivaAdministration for ( org.apache.archiva.configuration.LegacyArtifactPath legacyArtifactPath : getArchivaConfiguration().getConfiguration().getLegacyArtifactPaths() ) { legacyArtifactPaths.add( - new BeanReplicator().replicateBean( legacyArtifactPath, LegacyArtifactPath.class ) ); + getModelMapper().map( legacyArtifactPath, LegacyArtifactPath.class ) ); } return legacyArtifactPaths; } @@ -91,8 +90,8 @@ public class DefaultArchivaAdministration { Configuration configuration = getArchivaConfiguration().getConfiguration(); - configuration.addLegacyArtifactPath( new BeanReplicator().replicateBean( legacyArtifactPath, - org.apache.archiva.configuration.LegacyArtifactPath.class ) ); + configuration.addLegacyArtifactPath( getModelMapper().map( legacyArtifactPath, + org.apache.archiva.configuration.LegacyArtifactPath.class ) ); saveConfiguration( configuration ); triggerAuditEvent( "", "", AuditEvent.ADD_LEGACY_PATH, auditInformation ); @@ -160,7 +159,7 @@ public class DefaultArchivaAdministration { return null; } - return new BeanReplicator().replicateBean( fileType, FileType.class ); + return getModelMapper().map( fileType, FileType.class ); } public void addFileType( FileType fileType, AuditInformation auditInformation ) @@ -174,7 +173,7 @@ public class DefaultArchivaAdministration } configuration.getRepositoryScanning().addFileType( - new BeanReplicator().replicateBean( fileType, org.apache.archiva.configuration.FileType.class ) ); + getModelMapper().map( fileType, org.apache.archiva.configuration.FileType.class ) ); saveConfiguration( configuration ); } @@ -272,7 +271,7 @@ public class DefaultArchivaAdministration List fileTypes = new ArrayList( configFileTypes.size() ); for ( org.apache.archiva.configuration.FileType fileType : configFileTypes ) { - fileTypes.add( new BeanReplicator().replicateBean( fileType, FileType.class ) ); + fileTypes.add( getModelMapper().map( fileType, FileType.class ) ); } return fileTypes; } @@ -300,7 +299,7 @@ public class DefaultArchivaAdministration { return null; } - return new BeanReplicator().replicateBean( organisationInformation, OrganisationInformation.class ); + return getModelMapper().map( organisationInformation, OrganisationInformation.class ); } public void setOrganisationInformation( OrganisationInformation organisationInformation ) @@ -310,8 +309,8 @@ public class DefaultArchivaAdministration if ( organisationInformation != null ) { org.apache.archiva.configuration.OrganisationInformation organisationInformationModel = - new BeanReplicator().replicateBean( organisationInformation, - org.apache.archiva.configuration.OrganisationInformation.class ); + getModelMapper().map( organisationInformation, + org.apache.archiva.configuration.OrganisationInformation.class ); configuration.setOrganisationInfo( organisationInformationModel ); } else @@ -334,7 +333,7 @@ public class DefaultArchivaAdministration { return null; } - return new BeanReplicator().replicateBean( userInterfaceOptions, UiConfiguration.class ); + return getModelMapper().map( userInterfaceOptions, UiConfiguration.class ); } public void updateUiConfiguration( UiConfiguration uiConfiguration ) @@ -345,7 +344,7 @@ public class DefaultArchivaAdministration { UserInterfaceOptions userInterfaceOptions = - new BeanReplicator().replicateBean( uiConfiguration, UserInterfaceOptions.class ); + getModelMapper().map( uiConfiguration, UserInterfaceOptions.class ); configuration.getWebapp().setUi( userInterfaceOptions ); } else @@ -366,7 +365,7 @@ public class DefaultArchivaAdministration { return null; } - return new BeanReplicator().replicateBean( networkConfiguration, NetworkConfiguration.class ); + return getModelMapper().map( networkConfiguration, NetworkConfiguration.class ); } public void setNetworkConfiguration( NetworkConfiguration networkConfiguration ) @@ -379,8 +378,8 @@ public class DefaultArchivaAdministration } else { - configuration.setNetworkConfiguration( new BeanReplicator().replicateBean( networkConfiguration, - org.apache.archiva.configuration.NetworkConfiguration.class ) ); + configuration.setNetworkConfiguration( getModelMapper().map( networkConfiguration, + org.apache.archiva.configuration.NetworkConfiguration.class ) ); } setupWagon( networkConfiguration ); saveConfiguration( configuration ); diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java index abc3caae5..f53ae3fe7 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/group/DefaultRepositoryGroupAdmin.java @@ -27,10 +27,7 @@ import org.apache.archiva.admin.model.managed.ManagedRepositoryAdmin; import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; import org.apache.archiva.audit.AuditEvent; import org.apache.archiva.configuration.Configuration; -import org.apache.archiva.configuration.ConfigurationEvent; -import org.apache.archiva.configuration.ConfigurationListener; import org.apache.archiva.configuration.RepositoryGroupConfiguration; -import org.apache.archiva.redback.components.registry.RegistryListener; import org.apache.archiva.scheduler.MergedRemoteIndexesScheduler; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java index 897bd5c7a..bf0bde93b 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/networkproxy/DefaultNetworkProxyAdmin.java @@ -18,7 +18,6 @@ package org.apache.archiva.admin.repository.networkproxy; * under the License. */ -import net.sf.beanlib.provider.replicator.BeanReplicator; import org.apache.archiva.admin.model.AuditInformation; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.NetworkProxy; @@ -143,13 +142,13 @@ public class DefaultNetworkProxyAdmin { return networkProxyConfiguration == null ? null - : new BeanReplicator().replicateBean( networkProxyConfiguration, NetworkProxy.class ); + : getModelMapper().map( networkProxyConfiguration, NetworkProxy.class ); } protected NetworkProxyConfiguration getNetworkProxyConfiguration( NetworkProxy networkProxy ) { return networkProxy == null ? null - : new BeanReplicator().replicateBean( networkProxy, NetworkProxyConfiguration.class ); + : getModelMapper().map( networkProxy, NetworkProxyConfiguration.class ); } } diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java index b3104fe3e..bd9fdab40 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java @@ -18,7 +18,6 @@ package org.apache.archiva.admin.repository.proxyconnector; * under the License. */ -import net.sf.beanlib.provider.replicator.BeanReplicator; import org.apache.archiva.admin.model.AuditInformation; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ProxyConnector; @@ -211,14 +210,14 @@ public class DefaultProxyConnectorAdmin { return proxyConnector == null ? null - : new BeanReplicator().replicateBean( proxyConnector, ProxyConnectorConfiguration.class ); + : getModelMapper().map( proxyConnector, ProxyConnectorConfiguration.class ); } protected ProxyConnector getProxyConnector( ProxyConnectorConfiguration proxyConnectorConfiguration ) { return proxyConnectorConfiguration == null ? null - : new BeanReplicator().replicateBean( proxyConnectorConfiguration, ProxyConnector.class ); + : getModelMapper().map( proxyConnectorConfiguration, ProxyConnector.class ); } protected void validateProxyConnector( ProxyConnector proxyConnector ) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java index 3ac847b9f..be7004e68 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultArchivaRuntimeConfigurationAdmin.java @@ -18,12 +18,12 @@ package org.apache.archiva.admin.repository.runtime; * under the License. */ -import net.sf.beanlib.provider.replicator.BeanReplicator; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ArchivaRuntimeConfiguration; import org.apache.archiva.admin.model.beans.CacheConfiguration; import org.apache.archiva.admin.model.beans.FileLockConfiguration; import org.apache.archiva.admin.model.runtime.ArchivaRuntimeConfigurationAdmin; +import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.IndeterminateConfigurationException; @@ -41,6 +41,7 @@ import javax.inject.Named; */ @Service( "archivaRuntimeConfigurationAdmin#default" ) public class DefaultArchivaRuntimeConfigurationAdmin + extends AbstractRepositoryAdmin implements ArchivaRuntimeConfigurationAdmin { @@ -151,22 +152,22 @@ public class DefaultArchivaRuntimeConfigurationAdmin } ArchivaRuntimeConfiguration res = - new BeanReplicator().replicateBean( archivaRuntimeConfiguration, ArchivaRuntimeConfiguration.class ); + getModelMapper().map( archivaRuntimeConfiguration, ArchivaRuntimeConfiguration.class ); if ( archivaRuntimeConfiguration.getUrlFailureCacheConfiguration() != null ) { res.setUrlFailureCacheConfiguration( - new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getUrlFailureCacheConfiguration(), - CacheConfiguration.class ) ); + getModelMapper().map( archivaRuntimeConfiguration.getUrlFailureCacheConfiguration(), + CacheConfiguration.class ) ); } if ( archivaRuntimeConfiguration.getFileLockConfiguration() != null ) { res.setFileLockConfiguration( - new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getFileLockConfiguration(), - FileLockConfiguration.class ) ); + getModelMapper().map( archivaRuntimeConfiguration.getFileLockConfiguration(), + FileLockConfiguration.class ) ); } return res; @@ -181,23 +182,23 @@ public class DefaultArchivaRuntimeConfigurationAdmin } org.apache.archiva.configuration.ArchivaRuntimeConfiguration res = - new BeanReplicator().replicateBean( archivaRuntimeConfiguration, - org.apache.archiva.configuration.ArchivaRuntimeConfiguration.class ); + getModelMapper().map( archivaRuntimeConfiguration, + org.apache.archiva.configuration.ArchivaRuntimeConfiguration.class ); if ( archivaRuntimeConfiguration.getUrlFailureCacheConfiguration() != null ) { res.setUrlFailureCacheConfiguration( - new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getUrlFailureCacheConfiguration(), - org.apache.archiva.configuration.CacheConfiguration.class ) ); + getModelMapper().map( archivaRuntimeConfiguration.getUrlFailureCacheConfiguration(), + org.apache.archiva.configuration.CacheConfiguration.class ) ); } if ( archivaRuntimeConfiguration.getFileLockConfiguration() != null ) { res.setFileLockConfiguration( - new BeanReplicator().replicateBean( archivaRuntimeConfiguration.getFileLockConfiguration(), - org.apache.archiva.configuration.FileLockConfiguration.class ) ); + getModelMapper().map( archivaRuntimeConfiguration.getFileLockConfiguration(), + org.apache.archiva.configuration.FileLockConfiguration.class ) ); } return res; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java index 37ffe0aa8..6373a3427 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java @@ -18,13 +18,13 @@ package org.apache.archiva.admin.repository.runtime; * under the License. */ -import net.sf.beanlib.provider.replicator.BeanReplicator; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.CacheConfiguration; import org.apache.archiva.admin.model.beans.LdapConfiguration; import org.apache.archiva.admin.model.beans.LdapGroupMapping; import org.apache.archiva.admin.model.beans.RedbackRuntimeConfiguration; import org.apache.archiva.admin.model.runtime.RedbackRuntimeConfigurationAdmin; +import org.apache.archiva.admin.repository.AbstractRepositoryAdmin; import org.apache.archiva.configuration.ArchivaConfiguration; import org.apache.archiva.configuration.Configuration; import org.apache.archiva.configuration.IndeterminateConfigurationException; @@ -43,7 +43,6 @@ import javax.inject.Inject; import javax.inject.Named; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -55,6 +54,7 @@ import java.util.Set; */ @Service( "redbackRuntimeConfigurationAdmin#default" ) public class DefaultRedbackRuntimeConfigurationAdmin + extends AbstractRepositoryAdmin implements RedbackRuntimeConfigurationAdmin, UserConfiguration { @@ -298,20 +298,18 @@ public class DefaultRedbackRuntimeConfigurationAdmin org.apache.archiva.configuration.RedbackRuntimeConfiguration runtimeConfiguration ) { RedbackRuntimeConfiguration redbackRuntimeConfiguration = - new BeanReplicator().replicateBean( runtimeConfiguration, RedbackRuntimeConfiguration.class ); + getModelMapper().map( runtimeConfiguration, RedbackRuntimeConfiguration.class ); if ( runtimeConfiguration.getLdapConfiguration() != null ) { redbackRuntimeConfiguration.setLdapConfiguration( - new BeanReplicator().replicateBean( runtimeConfiguration.getLdapConfiguration(), - LdapConfiguration.class ) ); + getModelMapper().map( runtimeConfiguration.getLdapConfiguration(), LdapConfiguration.class ) ); } if ( runtimeConfiguration.getUsersCacheConfiguration() != null ) { redbackRuntimeConfiguration.setUsersCacheConfiguration( - new BeanReplicator().replicateBean( runtimeConfiguration.getUsersCacheConfiguration(), - CacheConfiguration.class ) ); + getModelMapper().map( runtimeConfiguration.getUsersCacheConfiguration(), CacheConfiguration.class ) ); } if ( redbackRuntimeConfiguration.getLdapConfiguration() == null ) @@ -378,16 +376,16 @@ public class DefaultRedbackRuntimeConfigurationAdmin RedbackRuntimeConfiguration redbackRuntimeConfiguration ) { org.apache.archiva.configuration.RedbackRuntimeConfiguration res = - new BeanReplicator().replicateBean( redbackRuntimeConfiguration, - org.apache.archiva.configuration.RedbackRuntimeConfiguration.class ); + getModelMapper().map( redbackRuntimeConfiguration, + org.apache.archiva.configuration.RedbackRuntimeConfiguration.class ); if ( redbackRuntimeConfiguration.getLdapConfiguration() == null ) { redbackRuntimeConfiguration.setLdapConfiguration( new LdapConfiguration() ); } res.setLdapConfiguration( - new BeanReplicator().replicateBean( redbackRuntimeConfiguration.getLdapConfiguration(), - org.apache.archiva.configuration.LdapConfiguration.class ) ); + getModelMapper().map( redbackRuntimeConfiguration.getLdapConfiguration(), + org.apache.archiva.configuration.LdapConfiguration.class ) ); if ( redbackRuntimeConfiguration.getUsersCacheConfiguration() == null ) { @@ -396,8 +394,8 @@ public class DefaultRedbackRuntimeConfigurationAdmin res.setUsersCacheConfiguration( - new BeanReplicator().replicateBean( redbackRuntimeConfiguration.getUsersCacheConfiguration(), - org.apache.archiva.configuration.CacheConfiguration.class ) ); + getModelMapper().map( redbackRuntimeConfiguration.getUsersCacheConfiguration(), + org.apache.archiva.configuration.CacheConfiguration.class ) ); List ldapGroupMappings = redbackRuntimeConfiguration.getLdapGroupMappings(); diff --git a/pom.xml b/pom.xml index 529a61aba..44c427097 100644 --- a/pom.xml +++ b/pom.xml @@ -574,6 +574,12 @@ 1.0-2 + + org.modelmapper + modelmapper + 0.6.2 + + net.sf.beanlib beanlib