]> source.dussan.org Git - archiva.git/commitdiff
Switching to generics for cache implementation
authorMartin Schreier <martin_s@apache.org>
Mon, 3 Jan 2022 19:26:49 +0000 (20:26 +0100)
committerMartin Schreier <martin_s@apache.org>
Mon, 3 Jan 2022 19:26:49 +0000 (20:26 +0100)
17 files changed:
archiva-modules/archiva-base/archiva-configuration/src/test/resources/spring-context.xml
archiva-modules/archiva-base/archiva-policies/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-base/archiva-policies/src/test/resources/spring-context.xml
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java
archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/runtime/DefaultRedbackRuntimeConfigurationAdmin.java
archiva-modules/archiva-maven/archiva-maven-proxy/src/test/resources/spring-context.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-api/src/main/java/org/apache/archiva/rest/api/v2/svc/maven/MavenManagedRepositoryService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRedbackRuntimeConfigurationService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultRepositoriesService.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/resources/META-INF/spring-context.xml
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/v2/svc/AbstractNativeRestServices.java
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/v2/svc/NativeMavenManagedRepositoryServiceTest.java [deleted file]
archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/v2/svc/maven/NativeMavenManagedRepositoryServiceTest.java [new file with mode: 0644]
archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/ProjectVersionMetadata.java
archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java
archiva-modules/metadata/metadata-repository-api/src/main/resources/META-INF/spring-context.xml

index 46b2f71d8d49a463b66a5ed68876235a1b1ce890..4eb7b5be64fdd6617397da91182749b75aaa61e1 100755 (executable)
   </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"/>
index e42a9b8e7f7662c5114651b373fc2db995482c12..2a9dc119e319d18465fcf46e7f9d2bc81c85f2d1 100644 (file)
@@ -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"/>
index 91426974cd7e2d3dd3d71f867a1e767e50e0a5f2..dfe404519a7ee0134e7feac5a6c4fe942f6d672c 100755 (executable)
@@ -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"/>
index 1ed25d946ec5ba9a0c2e7a1d30f6a88565aafed5..d15990189db858aacf141c950ea192bc0e16eb35 100644 (file)
@@ -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;
index f9fccfbc13ebbb03654659f2dcd972264050d32a..18697b3022c7e82cd03d918191ce34b2f662cb9a 100755 (executable)
@@ -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"/>
index f8e3f314cd22c931e9e79bc46d51c2ee3a2932b9..c8cd8522caeea5282a04a26b72318372c0e19098 100644 (file)
@@ -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
index 81b58aa946c97009bd2916a3a35a0510f1709228..ea3f179484493781c10409d1637fde5dd806e85b 100644 (file)
@@ -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;
index 02e4f9ecb2658b8ae64b3df51903584236c61823..f7871e75a64357822a7c06f9d13b6bb07e1ea276 100644 (file)
@@ -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 );
 
index 6f5f1fc1fbf06471d5ef05bd48b6d953036ad6fe..044998678cb5b1192f54c6f742e0d5934941d24a 100644 (file)
 
   <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>
index 4949e55a7b18de5cf70b8ef3fe0313caee3174dd..b5b185684bd3ebe0fac01e5f952e2f3c5d0821b0 100644 (file)
@@ -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" )
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/v2/svc/NativeMavenManagedRepositoryServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/v2/svc/NativeMavenManagedRepositoryServiceTest.java
deleted file mode 100644 (file)
index d078b45..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.apache.archiva.rest.v2.svc;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-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.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.DisplayName;
-import org.junit.jupiter.api.MethodOrderer;
-import org.junit.jupiter.api.Order;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.TestInstance;
-import org.junit.jupiter.api.TestMethodOrder;
-
-import java.util.List;
-
-import static io.restassured.RestAssured.given;
-import static io.restassured.http.ContentType.JSON;
-import static org.junit.jupiter.api.Assertions.*;
-
-/**
- * @author Martin Stockhammer <martin_s@apache.org>
- */
-@TestInstance( TestInstance.Lifecycle.PER_CLASS )
-@Tag( "rest-native" )
-@TestMethodOrder( MethodOrderer.OrderAnnotation.class )
-@DisplayName( "Native REST tests for V2 ManagedRepositoryService" )
-public class NativeMavenManagedRepositoryServiceTest extends AbstractNativeRestServices
-{
-    @Override
-    protected String getServicePath( )
-    {
-        return "/repositories/maven/managed";
-    }
-
-    @BeforeAll
-    void setup( ) throws Exception
-    {
-        super.setupNative( );
-    }
-
-    @AfterAll
-    void destroy( ) throws Exception
-    {
-        super.shutdownNative( );
-    }
-
-    @Test
-    @Order( 1 )
-    void testGetRepositories( )
-    {
-        String token = getAdminToken( );
-        Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON )
-            .when( )
-            .get( "" )
-            .then( ).statusCode( 200 ).extract( ).response( );
-        JsonPath json = response.getBody( ).jsonPath( );
-        assertEquals( 2, json.getInt( "pagination.total_count" ) );
-        assertEquals( 0, json.getInt( "pagination.offset" ) );
-        assertEquals( Integer.valueOf( RestConfiguration.DEFAULT_PAGE_LIMIT ), json.getInt( "pagination.limit" ) );
-        List<MavenManagedRepository> repositories = json.getList( "data", MavenManagedRepository.class );
-        assertEquals( "internal", repositories.get( 0 ).getId( ) );
-        assertEquals( "snapshots", repositories.get( 1 ).getId( ) );
-    }
-
-
-
-}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/v2/svc/maven/NativeMavenManagedRepositoryServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/v2/svc/maven/NativeMavenManagedRepositoryServiceTest.java
new file mode 100644 (file)
index 0000000..9a8f932
--- /dev/null
@@ -0,0 +1,89 @@
+package org.apache.archiva.rest.v2.svc.maven;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+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;
+import org.junit.jupiter.api.MethodOrderer;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInstance;
+import org.junit.jupiter.api.TestMethodOrder;
+
+import java.util.List;
+
+import static io.restassured.RestAssured.given;
+import static io.restassured.http.ContentType.JSON;
+import static org.junit.jupiter.api.Assertions.*;
+
+/**
+ * @author Martin Schreier <martin_s@apache.org>
+ */
+@TestInstance( TestInstance.Lifecycle.PER_CLASS )
+@Tag( "rest-native" )
+@TestMethodOrder( MethodOrderer.OrderAnnotation.class )
+@DisplayName( "Native REST tests for V2 ManagedRepositoryService" )
+public class NativeMavenManagedRepositoryServiceTest extends AbstractNativeRestServices
+{
+    @Override
+    protected String getServicePath( )
+    {
+        return "/repositories/maven/managed";
+    }
+
+    @BeforeAll
+    void setup( ) throws Exception
+    {
+        super.setupNative( );
+    }
+
+    @AfterAll
+    void destroy( ) throws Exception
+    {
+        super.shutdownNative( );
+    }
+
+    @Test
+    @Order( 1 )
+    void testGetRepositories( )
+    {
+        String token = getAdminToken( );
+        Response response = given( ).spec( getRequestSpec( token ) ).contentType( JSON )
+            .when( )
+            .get( "" )
+            .then( ).statusCode( 200 ).extract( ).response( );
+        JsonPath json = response.getBody( ).jsonPath( );
+        assertEquals( 2, json.getInt( "pagination.total_count" ) );
+        assertEquals( 0, json.getInt( "pagination.offset" ) );
+        assertEquals( Integer.valueOf( RestConfiguration.DEFAULT_PAGE_LIMIT ), json.getInt( "pagination.limit" ) );
+        List<MavenManagedRepository> repositories = json.getList( "data", MavenManagedRepository.class );
+        assertEquals( "internal", repositories.get( 0 ).getId( ) );
+        assertEquals( "snapshots", repositories.get( 1 ).getId( ) );
+    }
+
+
+
+}
index 0a64d5880928504f4424436f0416922da37107ae..5751f60eafa2be7409ba3fd5c348c312c885b2cb 100644 (file)
   <!-- 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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
 
   <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"/>
index c6b749d6c686c9df334bf4fdc3a7a651c4897fe5..13ebf38492fc505c57b34456b2d6024d66c74279 100644 (file)
@@ -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
      */
index e94ff0969581bb6cb7f127d1f92dbdcdf9b0d08e..b8903dfea9b33c781085057d7b736caa6bf1902b 100644 (file)
@@ -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 );
index 06b3213a52cdb50fe3ce9fa1bc52610c0287ffa2..6f4964fa49cd24b04a0f1cc399a37dd2c23e09a2 100644 (file)
 
   <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>