mirror of
https://github.com/apache/archiva.git
synced 2025-03-09 02:10:00 +00:00
Dependency cleanup of metadata-store-jcr
This commit is contained in:
parent
3988bfa918
commit
cc10ae9f1e
@ -41,6 +41,26 @@
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>metadata-statistics-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-checksum</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>archiva-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva</groupId>
|
||||
<artifactId>metadata-model</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.maven</groupId>
|
||||
<artifactId>archiva-maven-metadata</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
@ -72,24 +92,44 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>org.apache.felix.scr.annotations</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-jcl</artifactId>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-core-spi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-store-spi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-blob</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>jackrabbit-jcr-commons</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-query-spi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>javax.annotation-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.lucene</groupId>
|
||||
@ -139,6 +179,12 @@
|
||||
<dependency>
|
||||
<groupId>io.dropwizard.metrics</groupId>
|
||||
<artifactId>metrics-core</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
@ -161,11 +207,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.archiva.components.cache</groupId>
|
||||
<artifactId>archiva-components-spring-cache-ehcache</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@ -183,12 +225,6 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<testResources>
|
||||
|
@ -19,12 +19,31 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.archiva.checksum.ChecksumAlgorithm;
|
||||
import org.apache.archiva.metadata.QueryParameter;
|
||||
import org.apache.archiva.metadata.model.*;
|
||||
import org.apache.archiva.metadata.maven.model.MavenArtifactFacet;
|
||||
import org.apache.archiva.metadata.repository.*;
|
||||
import org.apache.archiva.metadata.model.ArtifactMetadata;
|
||||
import org.apache.archiva.metadata.model.CiManagement;
|
||||
import org.apache.archiva.metadata.model.Dependency;
|
||||
import org.apache.archiva.metadata.model.FacetedMetadata;
|
||||
import org.apache.archiva.metadata.model.IssueManagement;
|
||||
import org.apache.archiva.metadata.model.License;
|
||||
import org.apache.archiva.metadata.model.MailingList;
|
||||
import org.apache.archiva.metadata.model.MetadataFacet;
|
||||
import org.apache.archiva.metadata.model.MetadataFacetFactory;
|
||||
import org.apache.archiva.metadata.model.ModelInfo;
|
||||
import org.apache.archiva.metadata.model.Organization;
|
||||
import org.apache.archiva.metadata.model.ProjectMetadata;
|
||||
import org.apache.archiva.metadata.model.ProjectVersionMetadata;
|
||||
import org.apache.archiva.metadata.model.ProjectVersionReference;
|
||||
import org.apache.archiva.metadata.model.Scm;
|
||||
import org.apache.archiva.metadata.repository.AbstractMetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepository;
|
||||
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
|
||||
import org.apache.archiva.metadata.repository.MetadataResolutionException;
|
||||
import org.apache.archiva.metadata.repository.MetadataService;
|
||||
import org.apache.archiva.metadata.repository.MetadataSessionException;
|
||||
import org.apache.archiva.metadata.repository.RepositorySession;
|
||||
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatistics;
|
||||
import org.apache.archiva.metadata.repository.stats.model.RepositoryStatisticsProvider;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -34,14 +53,43 @@
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.jcr.*;
|
||||
import javax.jcr.query.*;
|
||||
import javax.jcr.NamespaceRegistry;
|
||||
import javax.jcr.Node;
|
||||
import javax.jcr.NodeIterator;
|
||||
import javax.jcr.PathNotFoundException;
|
||||
import javax.jcr.Property;
|
||||
import javax.jcr.Repository;
|
||||
import javax.jcr.RepositoryException;
|
||||
import javax.jcr.Session;
|
||||
import javax.jcr.SimpleCredentials;
|
||||
import javax.jcr.Value;
|
||||
import javax.jcr.ValueFactory;
|
||||
import javax.jcr.Workspace;
|
||||
import javax.jcr.query.Query;
|
||||
import javax.jcr.query.QueryManager;
|
||||
import javax.jcr.query.QueryResult;
|
||||
import javax.jcr.query.Row;
|
||||
import javax.jcr.query.RowIterator;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.Spliterator;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
@ -845,7 +893,10 @@ public List<ArtifactMetadata> getArtifactsByProjectVersionFacet(RepositorySessio
|
||||
throws MetadataRepositoryException {
|
||||
final Session jcrSession = getSession(session);
|
||||
final String q = new StringBuilder(QUERY_ARTIFACTS_BY_PROJECT_VERSION_1).append(key).append(QUERY_ARTIFACTS_BY_PROJECT_VERSION_2).toString();
|
||||
return runJcrQuery(jcrSession, repositoryId, q, ImmutableMap.of("value", value));
|
||||
Map<String, String> parameterMap = new HashMap<>();
|
||||
parameterMap.put("value", value);
|
||||
parameterMap = Collections.unmodifiableMap(parameterMap);
|
||||
return runJcrQuery(jcrSession, repositoryId, q, parameterMap);
|
||||
}
|
||||
|
||||
|
||||
@ -854,7 +905,10 @@ public List<ArtifactMetadata> getArtifactsByAttribute(RepositorySession session,
|
||||
throws MetadataRepositoryException {
|
||||
final Session jcrSession = getSession(session);
|
||||
final String q = new StringBuilder(QUERY_ARTIFACTS_BY_METADATA_1).append(key).append(QUERY_ARTIFACTS_BY_METADATA_2).toString();
|
||||
return runJcrQuery(jcrSession, repositoryId, q, ImmutableMap.of("value", value));
|
||||
Map<String, String> parameterMap = new HashMap<>();
|
||||
parameterMap.put("value", value);
|
||||
parameterMap = Collections.unmodifiableMap(parameterMap);
|
||||
return runJcrQuery(jcrSession, repositoryId, q, parameterMap);
|
||||
}
|
||||
|
||||
|
||||
@ -863,7 +917,10 @@ public List<ArtifactMetadata> getArtifactsByProjectVersionAttribute(RepositorySe
|
||||
throws MetadataRepositoryException {
|
||||
final Session jcrSession = getSession(session);
|
||||
final String q = new StringBuilder(QUERY_ARTIFACTS_BY_PROPERTY_1).append(key).append(QUERY_ARTIFACTS_BY_PROPERTY_2).toString();
|
||||
return runJcrQuery(jcrSession, repositoryId, q, ImmutableMap.of("value", value));
|
||||
Map<String, String> parameterMap = new HashMap<>();
|
||||
parameterMap.put("value", value);
|
||||
parameterMap = Collections.unmodifiableMap(parameterMap);
|
||||
return runJcrQuery(jcrSession, repositoryId, q, parameterMap);
|
||||
}
|
||||
|
||||
|
||||
@ -1400,14 +1457,20 @@ public List<ArtifactMetadata> searchArtifacts(RepositorySession session, String
|
||||
"SELECT * FROM [" + PROJECT_VERSION_NODE_TYPE
|
||||
+ "] AS projectVersion LEFT OUTER JOIN [" + ARTIFACT_NODE_TYPE
|
||||
+ "] AS artifact ON ISCHILDNODE(artifact, projectVersion) WHERE " + projectVersionCondition + descendantCondition;
|
||||
result.addAll(runJcrQuery(jcrSession, repositoryId, q1, ImmutableMap.of("value", text), false));
|
||||
Map<String, String> parameterMap = new HashMap<>();
|
||||
parameterMap.put("value", text);
|
||||
parameterMap = Collections.unmodifiableMap(parameterMap);
|
||||
result.addAll(runJcrQuery(jcrSession, repositoryId, q1, parameterMap, false));
|
||||
}
|
||||
String q2 =
|
||||
"SELECT * FROM [" + PROJECT_VERSION_NODE_TYPE
|
||||
+ "] AS projectVersion LEFT OUTER JOIN [" + ARTIFACT_NODE_TYPE
|
||||
+ "] AS artifact ON ISCHILDNODE(artifact, projectVersion) LEFT OUTER JOIN [" + FACET_NODE_TYPE
|
||||
+ "] AS facet ON ISCHILDNODE(facet, projectVersion) WHERE " + facetCondition + descendantCondition;
|
||||
result.addAll(runJcrQuery(jcrSession, repositoryId, q2, ImmutableMap.of("value", text), false));
|
||||
Map<String, String> parameterMap = new HashMap<>();
|
||||
parameterMap.put("value", text);
|
||||
parameterMap = Collections.unmodifiableMap(parameterMap);
|
||||
result.addAll(runJcrQuery(jcrSession, repositoryId, q2, parameterMap, false));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.apache.commons.lang3.time.StopWatch;
|
||||
import org.apache.jackrabbit.oak.api.Type;
|
||||
import org.apache.jackrabbit.oak.jcr.Jcr;
|
||||
@ -71,7 +69,6 @@
|
||||
import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
|
||||
import org.apache.jackrabbit.oak.spi.state.NodeStore;
|
||||
import org.apache.jackrabbit.oak.stats.StatisticsProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -81,6 +78,11 @@
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
@ -88,7 +90,6 @@
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.apache.archiva.metadata.repository.jcr.JcrConstants.*;
|
||||
import static org.apache.archiva.metadata.repository.jcr.OakRepositoryFactory.StoreType.IN_MEMORY_TYPE;
|
||||
import static org.apache.archiva.metadata.repository.jcr.OakRepositoryFactory.StoreType.SEGMENT_FILE_TYPE;
|
||||
@ -241,7 +242,7 @@ public void uncaughtException(Thread t, Throwable e) {
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public Thread newThread(@NotNull Runnable r) {
|
||||
public Thread newThread(Runnable r) {
|
||||
Thread thread = new Thread(r, createName());
|
||||
thread.setDaemon(true);
|
||||
thread.setPriority(Thread.MIN_PRIORITY);
|
||||
@ -305,7 +306,10 @@ private IndexInfoProvider registerIndexInfoProvider() {
|
||||
}
|
||||
|
||||
private Path getIndexCheckDir() {
|
||||
return checkNotNull(indexDir).resolve("indexCheckDir");
|
||||
if (indexDir==null) {
|
||||
throw new NullPointerException( "Null value for indexDir encountered." );
|
||||
}
|
||||
return indexDir.resolve("indexCheckDir");
|
||||
}
|
||||
|
||||
private LuceneIndexImporter registerIndexImporterProvider() {
|
||||
@ -343,7 +347,10 @@ private void registerIndexEditor( IndexTracker tracker) throws IOException {
|
||||
editorProvider.setBlobStore(blobStore);
|
||||
|
||||
if (hybridIndex){
|
||||
editorProvider.setIndexingQueue(checkNotNull(documentQueue));
|
||||
if (documentQueue==null) {
|
||||
throw new NullPointerException( "Null value for documentQueue encountered" );
|
||||
}
|
||||
editorProvider.setIndexingQueue(documentQueue);
|
||||
}
|
||||
|
||||
|
||||
@ -456,14 +463,15 @@ public void initialize( NodeBuilder root )
|
||||
// lucene.setProperty("refresh",true);
|
||||
NodeBuilder rules = lucene.child( "indexRules" ).
|
||||
setProperty( JCR_PRIMARYTYPE, NT_UNSTRUCTURED, NAME );
|
||||
rules.setProperty( ":childOrder", ImmutableSet.of(
|
||||
REPOSITORY_NODE_TYPE,
|
||||
NAMESPACE_MIXIN_TYPE, //
|
||||
PROJECT_MIXIN_TYPE,
|
||||
Set<String> parameterSet = new HashSet<>( Arrays.asList(REPOSITORY_NODE_TYPE,
|
||||
NAMESPACE_MIXIN_TYPE, //
|
||||
PROJECT_MIXIN_TYPE,
|
||||
PROJECT_VERSION_NODE_TYPE, //
|
||||
ARTIFACT_NODE_TYPE, //
|
||||
FACET_NODE_TYPE //
|
||||
), Type.STRINGS );
|
||||
));
|
||||
parameterSet = Collections.unmodifiableSet(parameterSet);
|
||||
rules.setProperty( ":childOrder", parameterSet, Type.STRINGS );
|
||||
IndexDefinitionBuilder idxBuilder = new IndexDefinitionBuilder( lucene );
|
||||
idxBuilder.async( "async", "nrt", "sync" ).includedPaths( "/repositories" ).evaluatePathRestrictions();
|
||||
|
||||
@ -526,7 +534,9 @@ public void initialize( NodeBuilder root )
|
||||
|
||||
idxBuilder.build( );
|
||||
|
||||
IndexUtils.createIndexDefinition( oakIdx, "baseIndexes", true, false, ImmutableList.of( "jcr:uuid", "rep:principalName" ), null );
|
||||
List<String> parameterList = Arrays.asList("jcr:uuid", "rep:principalName");
|
||||
parameterList = Collections.unmodifiableList(parameterList);
|
||||
IndexUtils.createIndexDefinition( oakIdx, "baseIndexes", true, false, parameterList, null );
|
||||
|
||||
log.info( "Index: {} repo-lucene: {}", lucene, lucene.getChildNode( "repo-lucene" ) );
|
||||
log.info( "repo-lucene Properties: {}", lucene.getChildNode( "repo-lucene" ).getProperties( ) );
|
||||
|
32
pom.xml
32
pom.xml
@ -491,11 +491,42 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-core</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-segment-tar</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-store-spi</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-api</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-core-spi</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-blob</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-query-spi</artifactId>
|
||||
<version>${jcr-oak.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.jackrabbit</groupId>
|
||||
<artifactId>oak-lucene</artifactId>
|
||||
@ -524,6 +555,7 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- Maven dependencies -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.indexer</groupId>
|
||||
|
Loading…
x
Reference in New Issue
Block a user