aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2018-03-30 15:15:26 +0200
committerMartin Stockhammer <martin_s@apache.org>2018-03-30 15:15:26 +0200
commitc002211a10ee5c323b2b99b69f147ce9888e2f3b (patch)
tree0062ad7bb58a92c27945cb28edc16f931bc2759b /archiva-modules
parent385985032ca3037cb531b231557f5ec4f3102c0d (diff)
downloadarchiva-c002211a10ee5c323b2b99b69f147ce9888e2f3b.tar.gz
archiva-c002211a10ee5c323b2b99b69f147ce9888e2f3b.zip
Removing IndexerCleaners
Diffstat (limited to 'archiva-modules')
-rw-r--r--archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java1
-rw-r--r--archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java16
-rw-r--r--archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java97
-rw-r--r--archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/utils/MavenIndexerCleaner.java53
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java3
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java112
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml3
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml3
9 files changed, 12 insertions, 279 deletions
diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
index efd5e7e8f..d8c482d1b 100644
--- a/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
+++ b/archiva-modules/archiva-base/archiva-consumers/archiva-lucene-consumers/src/main/java/org/apache/archiva/consumers/lucene/NexusIndexerConsumer.java
@@ -36,7 +36,6 @@ import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.RepositoryType;
import org.apache.archiva.scheduler.ArchivaTaskScheduler;
import org.apache.archiva.scheduler.indexing.ArtifactIndexingTask;
-import org.apache.maven.index.NexusIndexer;
import org.apache.maven.index.context.IndexCreator;
import org.apache.maven.index.context.IndexingContext;
import org.slf4j.Logger;
diff --git a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
index 2bb82d50d..30e17f92b 100644
--- a/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
+++ b/archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/proxy/AbstractProxyTestCase.java
@@ -26,19 +26,21 @@ import org.apache.archiva.configuration.ArchivaConfiguration;
import org.apache.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
-import org.apache.archiva.policies.*;
+import org.apache.archiva.policies.CachedFailuresPolicy;
+import org.apache.archiva.policies.ChecksumPolicy;
+import org.apache.archiva.policies.PropagateErrorsDownloadPolicy;
+import org.apache.archiva.policies.PropagateErrorsOnUpdateDownloadPolicy;
+import org.apache.archiva.policies.ReleasesPolicy;
+import org.apache.archiva.policies.SnapshotsPolicy;
import org.apache.archiva.proxy.model.RepositoryProxyConnectors;
import org.apache.archiva.repository.ManagedRepositoryContent;
import org.apache.archiva.repository.RepositoryContentProvider;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.maven2.MavenManagedRepository;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.apache.maven.index.NexusIndexer;
-import org.apache.maven.index.context.IndexingContext;
import org.apache.maven.wagon.Wagon;
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
-import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
@@ -58,7 +60,11 @@ import java.nio.file.Paths;
import java.nio.file.attribute.FileTime;
import java.text.ParseException;
import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Locale;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
index 6b063e36e..8759a0278 100644
--- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
+++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/remote/DefaultRemoteRepositoryAdmin.java
@@ -24,36 +24,23 @@ import org.apache.archiva.admin.model.remote.RemoteRepositoryAdmin;
import org.apache.archiva.admin.repository.AbstractRepositoryAdmin;
import org.apache.archiva.common.utils.PathUtil;
import org.apache.archiva.configuration.Configuration;
-import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.configuration.RepositoryCheckPath;
import org.apache.archiva.indexer.UnsupportedBaseContextException;
import org.apache.archiva.metadata.model.facets.AuditEvent;
-import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.PasswordCredentials;
+import org.apache.archiva.repository.RemoteRepository;
import org.apache.archiva.repository.RepositoryCredentials;
import org.apache.archiva.repository.RepositoryException;
import org.apache.archiva.repository.RepositoryRegistry;
-import org.apache.archiva.repository.features.IndexCreationEvent;
import org.apache.archiva.repository.features.IndexCreationFeature;
import org.apache.archiva.repository.features.RemoteIndexFeature;
import org.apache.commons.lang.StringUtils;
-import org.apache.maven.index.NexusIndexer;
-import org.apache.maven.index.context.IndexCreator;
import org.apache.maven.index.context.IndexingContext;
-import org.apache.maven.index.context.UnsupportedExistingLuceneIndexException;
-import org.apache.maven.index_shaded.lucene.index.IndexFormatTooOldException;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
import javax.inject.Inject;
-import java.io.IOException;
-import java.net.URI;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -72,11 +59,6 @@ public class DefaultRemoteRepositoryAdmin
@Inject
RepositoryRegistry repositoryRegistry;
- @Inject
- private List<? extends IndexCreator> indexCreators;
-
- @Inject
- private NexusIndexer indexer;
@PostConstruct
private void initialize()
@@ -88,30 +70,6 @@ public class DefaultRemoteRepositoryAdmin
}
}
- @PreDestroy
- private void shutdown()
- throws RepositoryAdminException
- {
- try
- {
- List<org.apache.archiva.admin.model.beans.RemoteRepository> remoteRepositories = getRemoteRepositories();
- // close index on shutdown
- for ( org.apache.archiva.admin.model.beans.RemoteRepository remoteRepository : remoteRepositories )
- {
- IndexingContext context = indexer.getIndexingContexts().get( remoteRepository.getId() );
- if ( context != null )
- {
- indexer.removeIndexingContext( context, false );
- }
- }
- }
- catch ( IOException e )
- {
- throw new RepositoryAdminException( e.getMessage(), e );
- }
- }
-
-
/*
* Conversion between the repository from the registry and the serialized DTO for the admin API
*/
@@ -311,59 +269,6 @@ public class DefaultRemoteRepositoryAdmin
{
RemoteRepository repo = repositoryRegistry.getRemoteRepository(remoteRepository.getId());
return repo.getIndexingContext().getBaseContext(IndexingContext.class);
- /*String appServerBase = getRegistry().getString( "appserver.base" );
-
- String contextKey = "remote-" + remoteRepository.getId();
- IndexingContext indexingContext = indexer.getIndexingContexts().get( contextKey );
- if ( indexingContext != null )
- {
- return indexingContext;
- }
- // create remote repository path
- Path repoDir = Paths.get( appServerBase, "data/remotes/" + remoteRepository.getId() );
- if ( !Files.exists(repoDir) )
- {
- Files.createDirectories(repoDir);
- }
-
- Path indexDirectory = null;
-
- // is there configured indexDirectory ?
- String indexDirectoryPath = remoteRepository.getIndexDirectory();
-
- if ( StringUtils.isNotBlank( indexDirectoryPath ) )
- {
- repoDir.resolve( indexDirectoryPath );
- }
- // if not configured use a default value
- if ( indexDirectory == null )
- {
- indexDirectory = repoDir.resolve(".index" );
- }
- if ( !Files.exists(indexDirectory) )
- {
- Files.createDirectories(indexDirectory);
- }
-
- try
- {
-
- return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir.toFile(), indexDirectory.toFile(),
- remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ),
- indexCreators );
- }
- catch ( IndexFormatTooOldException e )
- {
- // existing index with an old lucene format so we need to delete it!!!
- // delete it first then recreate it.
- log.warn( "the index of repository {} is too old we have to delete and recreate it", //
- remoteRepository.getId() );
- org.apache.archiva.common.utils.FileUtils.deleteDirectory( indexDirectory );
- return indexer.addIndexingContext( contextKey, remoteRepository.getId(), repoDir.toFile(), indexDirectory.toFile(),
- remoteRepository.getUrl(), calculateIndexRemoteUrl( remoteRepository ),
- indexCreators );
-
- }*/
} catch (UnsupportedBaseContextException e) {
throw new RepositoryAdminException( e.getMessage(), e);
}
diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/utils/MavenIndexerCleaner.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/utils/MavenIndexerCleaner.java
deleted file mode 100644
index c633adb0c..000000000
--- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/utils/MavenIndexerCleaner.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.archiva.rest.services.utils;
-/*
- * 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 org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
-import org.apache.maven.index.NexusIndexer;
-import org.apache.maven.index.context.IndexingContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-
-/**
- * @author Olivier Lamy
- */
-@Service
-public class MavenIndexerCleaner
-{
- Logger log = LoggerFactory.getLogger( getClass() );
-
- @Inject
- private NexusIndexer nexusIndexer;
-
- @PreDestroy
- public void shutdown()
- throws Exception
- {
-
- log.info( "cleanup IndexingContext" );
- for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() )
- {
- nexusIndexer.removeIndexingContext( context, true );
- }
- }
-}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
index 1a65a35ba..96828aba7 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletTestCase.java
@@ -31,7 +31,6 @@ import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
import org.apache.archiva.webdav.httpunit.MkColMethodWebRequest;
-import org.apache.archiva.webdav.util.MavenIndexerCleaner;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
@@ -150,8 +149,6 @@ public abstract class AbstractRepositoryServletTestCase
CacheManager.getInstance().clearAll();
- applicationContext.getBean( MavenIndexerCleaner.class ).cleanupIndex();
-
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
index f6d6f2670..41683c07c 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletSecurityTest.java
@@ -38,7 +38,6 @@ import org.apache.archiva.repository.audit.TestAuditListener;
import org.apache.archiva.security.ServletAuthenticator;
import org.apache.archiva.security.common.ArchivaRoleConstants;
import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner;
-import org.apache.archiva.webdav.util.MavenIndexerCleaner;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.jackrabbit.webdav.DavSessionProvider;
@@ -212,8 +211,6 @@ public class RepositoryServletSecurityTest
FileUtils.deleteDirectory( repoRootInternal );
}*/
- applicationContext.getBean( MavenIndexerCleaner.class ).cleanupIndex();
-
super.tearDown();
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java
deleted file mode 100644
index cd59302e7..000000000
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/util/MavenIndexerCleaner.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.apache.archiva.webdav.util;
-/*
- * 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 org.apache.maven.index.NexusIndexer;
-import org.apache.maven.index.context.IndexingContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.inject.Inject;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-/**
- * @author Olivier Lamy
- */
-@Service
-public class MavenIndexerCleaner
- implements ServletContextListener
-{
- Logger log = LoggerFactory.getLogger( getClass() );
-
-
-
- @Inject
- private ApplicationContext applicationContext;
-
- @Inject
- NexusIndexer nexusIndexer;
-
- @PostConstruct
- public void startup()
- {
- cleanupIndex();
- }
-
- @PreDestroy
- public void shutdown()
- {
- cleanupIndex();
- }
-
-
- @Override
- public void contextInitialized( ServletContextEvent servletContextEvent )
- {
- try
- {
- cleanupIndex();
-
- }
- catch ( Exception e )
- {
- log.error( e.getMessage(), e );
- throw new RuntimeException( e.getMessage(), e );
- }
- }
-
- @Override
- public void contextDestroyed( ServletContextEvent servletContextEvent )
- {
- try
- {
- cleanupIndex();
-
- }
- catch ( Exception e )
- {
- log.error( e.getMessage(), e );
- throw new RuntimeException( e.getMessage(), e );
- }
- }
-
- public void cleanupIndex()
- {
- log.info( "cleanup IndexingContext" );
- try
- {
- for ( IndexingContext context : nexusIndexer.getIndexingContexts().values() )
- {
- nexusIndexer.removeIndexingContext( context, true );
- }
- }
- catch ( Exception e )
- {
- log.warn( "fail to cleanupIndex: {}", e.getMessage(), e );
- }
-
- }
-
-
-}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml
index 158e4724a..4e83153aa 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/repository-servlet-security-test/web.xml
@@ -27,9 +27,6 @@
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
- <listener>
- <listener-class>org.apache.archiva.webdav.util.MavenIndexerCleaner</listener-class>
- </listener>
<context-param>
<param-name>contextConfigLocation</param-name>
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
index d03192e4b..1e7d54687 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/resources/WEB-INF/web.xml
@@ -27,9 +27,6 @@
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
- <listener>
- <listener-class>org.apache.archiva.webdav.util.MavenIndexerCleaner</listener-class>
- </listener>
<context-param>
<param-name>contextConfigLocation</param-name>