diff options
author | Martin Stockhammer <martin.stockhammer@ars.de> | 2017-09-11 09:23:39 +0200 |
---|---|---|
committer | Martin Stockhammer <martin.stockhammer@ars.de> | 2017-09-11 09:23:39 +0200 |
commit | a7db09420a48587b884a4f871300ac104a6746e7 (patch) | |
tree | 0666dc9ffb56ca26558f459060b9d2eed3a5a263 /archiva-modules/plugins/metadata-store-jcr/src | |
parent | a6706c8414c4807794ee94ab7cf19530b7b41460 (diff) | |
download | archiva-a7db09420a48587b884a4f871300ac104a6746e7.tar.gz archiva-a7db09420a48587b884a4f871300ac104a6746e7.zip |
Migrating some plugins to java.nio
Diffstat (limited to 'archiva-modules/plugins/metadata-store-jcr/src')
3 files changed, 18 insertions, 25 deletions
diff --git a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/RepositoryFactory.java b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/RepositoryFactory.java index b1b821dc8..b2c6c0c43 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/RepositoryFactory.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/RepositoryFactory.java @@ -26,11 +26,7 @@ import org.apache.jackrabbit.oak.Oak; import org.apache.jackrabbit.oak.api.Type; import org.apache.jackrabbit.oak.jcr.Jcr; import org.apache.jackrabbit.oak.plugins.index.IndexUtils; -import org.apache.jackrabbit.oak.plugins.index.lucene.ExtractedTextCache; -import org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier; -import org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker; -import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider; -import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider; +import org.apache.jackrabbit.oak.plugins.index.lucene.*; import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue; import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LocalIndexObserver; import org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndexFactory; @@ -52,7 +48,6 @@ import org.slf4j.LoggerFactory; import javax.annotation.Nonnull; import javax.jcr.Repository; -import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -207,9 +202,9 @@ public class RepositoryFactory StatisticsProvider statsProvider = StatisticsProvider.NOOP; int queueSize = Integer.getInteger( "queueSize", 10000 ); - File indexDir = Files.createTempDirectory( "archiva_index" ).toFile(); + Path indexDir = Files.createTempDirectory( "archiva_index" ); log.info( "Queue Index {}", indexDir.toString() ); - IndexCopier indexCopier = new IndexCopier( executorService, indexDir, true ); + IndexCopier indexCopier = new IndexCopier( executorService, indexDir.toFile(), true ); NRTIndexFactory nrtIndexFactory = new NRTIndexFactory( indexCopier, statsProvider ); MountInfoProvider mountInfoProvider = Mounts.defaultMountInfoProvider(); IndexTracker tracker = diff --git a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java index e87d53f98..0c6dedb44 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepositoryTest.java @@ -21,7 +21,6 @@ package org.apache.archiva.metadata.repository.jcr; import org.apache.archiva.metadata.model.MetadataFacetFactory; import org.apache.archiva.metadata.repository.AbstractMetadataRepositoryTest; -import org.apache.commons.io.FileUtils; import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException; import org.junit.After; import org.junit.Before; @@ -32,8 +31,10 @@ import javax.inject.Inject; import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.Session; -import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Map; public class JcrMetadataRepositoryTest @@ -49,13 +50,13 @@ public class JcrMetadataRepositoryTest @BeforeClass public static void setupSpec() throws IOException, InvalidFileStoreVersionException { - File directory = new File( "target/test-repositories" ); - if ( directory.exists() ) + Path directory = Paths.get( "target/test-repositories" ); + if (Files.exists(directory) ) { - FileUtils.deleteDirectory( directory ); + org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory ); } RepositoryFactory factory = new RepositoryFactory(); - factory.setRepositoryPath( directory.getPath() ); + factory.setRepositoryPath( directory.toString()); jcrRepository = factory.createRepository(); } diff --git a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java index 4ae7aacd8..aa6658ad8 100644 --- a/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java +++ b/archiva-modules/plugins/metadata-store-jcr/src/test/java/org/apache/archiva/metadata/repository/stats/JcrRepositoryStatisticsGatheringTest.java @@ -27,7 +27,6 @@ import org.apache.archiva.metadata.repository.jcr.JcrMetadataRepository; import org.apache.archiva.metadata.repository.jcr.RepositoryFactory; import org.apache.archiva.metadata.repository.stats.model.DefaultRepositoryStatistics; import org.apache.archiva.test.utils.ArchivaSpringJUnit4ClassRunner; -import org.apache.commons.io.FileUtils; import org.apache.jackrabbit.commons.JcrUtils; import org.apache.jackrabbit.oak.segment.file.InvalidFileStoreVersionException; import org.junit.After; @@ -41,15 +40,13 @@ import org.springframework.context.ApplicationContext; import org.springframework.test.context.ContextConfiguration; import javax.inject.Inject; -import javax.jcr.ImportUUIDBehavior; -import javax.jcr.Node; -import javax.jcr.Repository; -import javax.jcr.RepositoryException; -import javax.jcr.Session; +import javax.jcr.*; import javax.jcr.nodetype.NodeTypeManager; import javax.jcr.nodetype.NodeTypeTemplate; -import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Calendar; import java.util.Date; import java.util.Map; @@ -84,13 +81,13 @@ public class JcrRepositoryStatisticsGatheringTest public static void setupSpec() throws IOException, InvalidFileStoreVersionException { - File directory = new File( "target/test-repositories" ); - if ( directory.exists() ) + Path directory = Paths.get( "target/test-repositories" ); + if ( Files.exists(directory) ) { - FileUtils.deleteDirectory( directory ); + org.apache.archiva.common.utils.FileUtils.deleteDirectory( directory ); } RepositoryFactory factory = new RepositoryFactory(); - factory.setRepositoryPath( directory.getPath() ); + factory.setRepositoryPath( directory.toString() ); factory.setStoreType( RepositoryFactory.StoreType.IN_MEMORY_TYPE ); jcrRepository = factory.createRepository(); } |