mirror of https://github.com/apache/archiva.git
Switching to generics for cache implementation
This commit is contained in:
parent
7536a89125
commit
3756ba57f6
|
@ -324,6 +324,8 @@
|
|||
</bean>
|
||||
|
||||
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="java.util.Date"/>
|
||||
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache" lazy-init="true"
|
||||
destroy-method="dispose">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="java.util.Date"/>
|
||||
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
|
||||
<property name="diskPersistent" value="true"/>
|
||||
<property name="diskStorePath" value="${appserver.base}/tmp/urlcache"/>
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
<context:property-placeholder system-properties-mode="OVERRIDE"/>
|
||||
|
||||
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="java.util.Date"/>
|
||||
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
|
|
|
@ -109,7 +109,7 @@ public class DefaultManagedRepositoryAdmin
|
|||
|
||||
@Inject
|
||||
@Named(value = "cache#namespaces")
|
||||
private Cache<String, Collection<String>> namespacesCache;
|
||||
private Cache<String, List<String>> namespacesCache;
|
||||
|
||||
@Inject
|
||||
private IndexManagerFactory indexManagerFactory;
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.apache.archiva.configuration.util.ConfigMapper;
|
|||
import org.apache.archiva.redback.configuration.UserConfiguration;
|
||||
import org.apache.archiva.redback.configuration.UserConfigurationException;
|
||||
import org.apache.archiva.redback.configuration.UserConfigurationKeys;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -100,13 +101,13 @@ public class DefaultRedbackRuntimeConfigurationAdmin
|
|||
LDAP_MAPPER.addBooleanMapping( LDAP_BIND_AUTHENTICATOR_ENABLED, LdapConfiguration::isBindAuthenticatorEnabled );
|
||||
}
|
||||
|
||||
private Cache usersCache;
|
||||
private Cache<String, User> usersCache;
|
||||
|
||||
@Inject
|
||||
public DefaultRedbackRuntimeConfigurationAdmin( ArchivaConfiguration archivaConfiguration,//
|
||||
@Named( value = "userConfiguration#redback" ) //
|
||||
UserConfiguration userConfiguration,
|
||||
@Named( value = "cache#users" ) Cache usersCache )
|
||||
@Named( value = "cache#users" ) Cache<String, User> usersCache )
|
||||
{
|
||||
this.archivaConfiguration = archivaConfiguration;
|
||||
this.userConfiguration = userConfiguration;
|
||||
|
|
|
@ -68,6 +68,8 @@
|
|||
|
||||
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache" lazy-init="true"
|
||||
destroy-method="dispose">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="java.util.Date"/>
|
||||
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="diskStorePath" value="${appserver.base}/tmp/urlcache"/>
|
||||
|
|
|
@ -67,7 +67,7 @@ import static org.apache.archiva.security.common.ArchivaRoleConstants.*;
|
|||
* </li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Martin Stockhammer <martin_s@apache.org>
|
||||
* @author Martin Schreier <martin_s@apache.org>
|
||||
* @since 3.0
|
||||
*/
|
||||
@Schema( name = "MavenManagedRepositoryService", description = "Managing and configuration of managed maven repositories" )
|
||||
|
@ -425,7 +425,7 @@ public interface MavenManagedRepositoryService
|
|||
permissions = { OPERATION_MANAGE_CONFIGURATION, OPERATION_DELETE_NAMESPACE },
|
||||
resource = "{id}"
|
||||
)
|
||||
@Operation( summary = "Removes a group and all subfolders from the repository",
|
||||
@Operation( summary = "Removes a maven group and all containing artifacts and sub groups from the repository",
|
||||
security = {
|
||||
@SecurityRequirement(
|
||||
name = OPERATION_MANAGE_CONFIGURATION
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.archiva.redback.policy.CookieSettings;
|
|||
import org.apache.archiva.redback.policy.PasswordRule;
|
||||
import org.apache.archiva.redback.rbac.RBACManager;
|
||||
import org.apache.archiva.redback.role.RoleManager;
|
||||
import org.apache.archiva.redback.users.User;
|
||||
import org.apache.archiva.redback.users.UserManager;
|
||||
import org.apache.archiva.rest.api.model.ActionStatus;
|
||||
import org.apache.archiva.rest.api.model.RBACManagerImplementationInformation;
|
||||
|
@ -88,7 +89,7 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
|
||||
@Inject
|
||||
@Named(value = "cache#users")
|
||||
private Cache usersCache;
|
||||
private Cache<String, User> usersCache;
|
||||
|
||||
@Inject
|
||||
private LdapUserMapper ldapUserMapper;
|
||||
|
|
|
@ -159,7 +159,7 @@ public class DefaultRepositoriesService
|
|||
*/
|
||||
@Inject
|
||||
@Named(value = "cache#namespaces")
|
||||
private Cache<String, Collection<String>> namespacesCache;
|
||||
private Cache<String, List<String>> namespacesCache;
|
||||
|
||||
private List<ChecksumAlgorithm> algorithms = Arrays.asList(ChecksumAlgorithm.SHA256, ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5 );
|
||||
|
||||
|
|
|
@ -128,11 +128,13 @@
|
|||
|
||||
<bean name="browse#versionMetadata" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String" />
|
||||
<constructor-arg index="1" value="org.apache.archiva.metadata.model.ProjectVersionMetadata"/>
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
<property name="memoryEvictionPolicy" value="LRU"/>
|
||||
<property name="name" value="userPermissions"/>
|
||||
<property name="name" value="versionMetadata"/>
|
||||
<property name="timeToIdleSeconds" value="300"/>
|
||||
<property name="timeToLiveSeconds" value="600"/>
|
||||
</bean>
|
||||
|
|
|
@ -68,7 +68,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
* Native REST tests do not use the JAX-RS client and can be used with a remote
|
||||
* REST API service. The tests
|
||||
*
|
||||
* @author Martin Stockhammer <martin_s@apache.org>
|
||||
* @author Martin Schreier <martin_s@apache.org>
|
||||
*/
|
||||
@Tag( "rest-native" )
|
||||
@Tag( "rest-v2" )
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.apache.archiva.rest.v2.svc;
|
||||
package org.apache.archiva.rest.v2.svc.maven;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
|
@ -22,6 +22,7 @@ import io.restassured.path.json.JsonPath;
|
|||
import io.restassured.response.Response;
|
||||
import org.apache.archiva.rest.api.v2.model.MavenManagedRepository;
|
||||
import org.apache.archiva.rest.api.v2.svc.RestConfiguration;
|
||||
import org.apache.archiva.rest.v2.svc.AbstractNativeRestServices;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
|
@ -39,7 +40,7 @@ import static io.restassured.http.ContentType.JSON;
|
|||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
/**
|
||||
* @author Martin Stockhammer <martin_s@apache.org>
|
||||
* @author Martin Schreier <martin_s@apache.org>
|
||||
*/
|
||||
@TestInstance( TestInstance.Lifecycle.PER_CLASS )
|
||||
@Tag( "rest-native" )
|
|
@ -119,6 +119,8 @@
|
|||
<!-- for change configuration of the users cache -->
|
||||
<bean name="cache#users" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String" />
|
||||
<constructor-arg index="1" value="org.apache.archiva.redback.users.User" />
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -132,6 +134,8 @@
|
|||
|
||||
<bean name="cache#url-failures-cache" class="org.apache.archiva.components.cache.ehcache.EhcacheCache" lazy-init="true"
|
||||
destroy-method="dispose">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="java.util.Date"/>
|
||||
<property name="diskExpiryThreadIntervalSeconds" value="600"/>
|
||||
<property name="diskPersistent" value="true"/>
|
||||
<property name="diskStorePath" value="${appserver.base}/tmp/urlcache"/>
|
||||
|
@ -147,6 +151,8 @@
|
|||
|
||||
<bean name="cache#keys" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String" />
|
||||
<constructor-arg index="1" value="org.apache.archiva.redback.keys.AuthenticationKey"/>
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -158,6 +164,8 @@
|
|||
|
||||
<bean name="cache#operations" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="org.apache.archiva.redback.rbac.Operation" />
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -169,6 +177,8 @@
|
|||
|
||||
<bean name="cache#permissions" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="org.apache.archiva.redback.rbac.Permission" />
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -180,6 +190,8 @@
|
|||
|
||||
<bean name="cache#resources" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="org.apache.archiva.redback.rbac.Resource" />
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -191,6 +203,8 @@
|
|||
|
||||
<bean name="cache#roles" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="org.apache.archiva.redback.rbac.Role" />
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -202,6 +216,8 @@
|
|||
|
||||
<bean name="cache#effectiveRoleSet" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="java.util.HashSet" />
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -217,6 +233,8 @@
|
|||
|
||||
<bean name="cache#userAssignments" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="org.apache.archiva.redback.rbac.UserAssignment" />
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -228,6 +246,8 @@
|
|||
|
||||
<bean name="cache#userPermissions" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="java.util.HashMap" />
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -239,6 +259,8 @@
|
|||
|
||||
<bean name="cache#ldapRoles" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String"/>
|
||||
<constructor-arg index="1" value="org.apache.archiva.redback.rbac.Role"/>
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
@ -250,6 +272,8 @@
|
|||
|
||||
<bean name="cache#namespaces" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String" />
|
||||
<constructor-arg index="1" value="java.util.ArrayList"/>
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.archiva.metadata.model;
|
|||
*/
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
@ -28,8 +29,10 @@ import java.util.Properties;
|
|||
|
||||
@XmlRootElement( name = "projectVersionMetadata" )
|
||||
public class ProjectVersionMetadata
|
||||
extends FacetedMetadata
|
||||
extends FacetedMetadata implements Serializable
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 5506968284780639002L;
|
||||
/**
|
||||
* id is the version
|
||||
*/
|
||||
|
|
|
@ -93,7 +93,7 @@ public class DefaultMetadataResolver
|
|||
*/
|
||||
@Inject
|
||||
@Named( value = "cache#namespaces" )
|
||||
private Cache<String, Collection<String>> namespacesCache;
|
||||
private Cache<String, List<String>> namespacesCache;
|
||||
|
||||
@Override
|
||||
public ProjectVersionMetadata resolveProjectVersion( RepositorySession session, String repoId, String namespace,
|
||||
|
@ -193,7 +193,7 @@ public class DefaultMetadataResolver
|
|||
try
|
||||
{
|
||||
|
||||
Collection<String> namespaces = namespacesCache.get( repoId );
|
||||
List<String> namespaces = namespacesCache.get( repoId );
|
||||
if ( namespaces != null )
|
||||
{
|
||||
return namespaces;
|
||||
|
@ -246,7 +246,7 @@ public class DefaultMetadataResolver
|
|||
{
|
||||
MetadataRepository metadataRepository = session.getRepository();
|
||||
String cacheKey = repoId + "-" + namespace;
|
||||
Collection<String> namespaces = namespacesCache.get( cacheKey );
|
||||
List<String> namespaces = namespacesCache.get( cacheKey );
|
||||
if ( namespaces == null )
|
||||
{
|
||||
namespaces = metadataRepository.getChildNamespaces( session, repoId, namespace );
|
||||
|
@ -299,7 +299,7 @@ public class DefaultMetadataResolver
|
|||
Collection<String> exclusions = new ArrayList<>( projects );
|
||||
|
||||
String cacheKey = repoId + "-" + namespace;
|
||||
Collection<String> namespaces = namespacesCache.get( cacheKey );
|
||||
List<String> namespaces = namespacesCache.get( cacheKey );
|
||||
if ( namespaces == null )
|
||||
{
|
||||
namespaces = metadataRepository.getChildNamespaces( session, repoId, namespace );
|
||||
|
|
|
@ -41,11 +41,13 @@
|
|||
|
||||
<bean name="cache#namespaces" class="org.apache.archiva.components.cache.ehcache.EhcacheCache"
|
||||
init-method="initialize">
|
||||
<constructor-arg index="0" value="java.lang.String" />
|
||||
<constructor-arg index="1" value="java.util.ArrayList"/>
|
||||
<property name="diskPersistent" value="false"/>
|
||||
<property name="eternal" value="false"/>
|
||||
<property name="maxElementsInMemory" value="1000"/>
|
||||
<property name="memoryEvictionPolicy" value="LRU"/>
|
||||
<property name="name" value="usersCache"/>
|
||||
<property name="name" value="namespaces"/>
|
||||
<property name="timeToIdleSeconds" value="600"/>
|
||||
<property name="timeToLiveSeconds" value="600"/>
|
||||
</bean>
|
||||
|
|
Loading…
Reference in New Issue