Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
NEXUS-23434: Refactor Orient/StorageTX-isms from Helm (#126)
Browse files Browse the repository at this point in the history
* NEXUS-23434: Refactor Orient/StorageTX-isms from Helm
  • Loading branch information
Maxim Kalachyov authored Apr 24, 2020
1 parent c3965bd commit 37a6370
Show file tree
Hide file tree
Showing 31 changed files with 69 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ import org.sonatype.nexus.repository.view.matchers.ActionMatcher
import org.sonatype.nexus.repository.view.matchers.LiteralMatcher
import org.sonatype.nexus.repository.view.matchers.logic.LogicMatchers
import org.sonatype.nexus.repository.view.matchers.token.TokenMatcher
import org.sonatype.repository.helm.HelmFacet
import org.sonatype.repository.helm.internal.orient.HelmFacet
import org.sonatype.repository.helm.HelmRestoreFacet
import org.sonatype.repository.helm.internal.orient.HelmComponentMaintenanceFacet
import org.sonatype.repository.helm.internal.security.HelmSecurityFacet

import static org.sonatype.nexus.repository.http.HttpMethods.GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.sonatype.nexus.repository.view.matchers.token.TokenMatcher;
import org.sonatype.nexus.repository.view.matchers.token.TokenMatcher.State;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.orient.hosted.HelmHostedFacet;
import org.sonatype.repository.helm.internal.util.HelmPathUtils;

import static com.google.common.base.Preconditions.checkNotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal;
package org.sonatype.repository.helm.internal.orient;

import java.util.Optional;

Expand All @@ -25,6 +25,7 @@
import org.sonatype.nexus.repository.storage.BucketStore;
import org.sonatype.nexus.repository.storage.Component;
import org.sonatype.nexus.repository.storage.ComponentDirector;
import org.sonatype.repository.helm.internal.HelmFormat;

import static com.google.common.base.Preconditions.checkNotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal;
package org.sonatype.repository.helm.internal.orient;

import java.util.Collections;
import java.util.Set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm;
package org.sonatype.repository.helm.internal.orient;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -25,6 +25,7 @@
import org.sonatype.nexus.repository.storage.StorageTx;
import org.sonatype.nexus.repository.view.Content;
import org.sonatype.nexus.repository.view.Payload;
import org.sonatype.repository.helm.HelmAttributes;
import org.sonatype.repository.helm.internal.AssetKind;

import com.google.common.base.Supplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal;
package org.sonatype.repository.helm.internal.orient;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -35,7 +35,8 @@
import org.sonatype.nexus.repository.view.Payload;
import org.sonatype.nexus.repository.view.payloads.BlobPayload;
import org.sonatype.repository.helm.HelmAttributes;
import org.sonatype.repository.helm.HelmFacet;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.HelmFormat;

import com.google.common.base.Supplier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm;
package org.sonatype.repository.helm.internal.orient;

import java.io.IOException;
import java.util.Collections;
Expand All @@ -34,8 +34,9 @@
import org.sonatype.nexus.repository.view.PartPayload;
import org.sonatype.nexus.rest.ValidationErrorsException;
import org.sonatype.nexus.transaction.UnitOfWork;
import org.sonatype.repository.helm.HelmAttributes;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.hosted.HelmHostedFacet;
import org.sonatype.repository.helm.internal.orient.hosted.HelmHostedFacet;
import org.sonatype.repository.helm.internal.util.HelmAttributeParser;

import org.apache.commons.lang3.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.createindex;
package org.sonatype.repository.helm.internal.orient.createindex;

import org.sonatype.nexus.repository.Facet;
import org.sonatype.nexus.repository.Facet.Exposed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.createindex;
package org.sonatype.repository.helm.internal.orient.createindex;

import java.io.IOException;
import java.util.Collections;
Expand All @@ -36,10 +36,10 @@
import org.sonatype.nexus.repository.transaction.TransactionalStoreBlob;
import org.sonatype.nexus.transaction.UnitOfWork;
import org.sonatype.repository.helm.HelmAttributes;
import org.sonatype.repository.helm.HelmFacet;
import org.sonatype.repository.helm.internal.orient.HelmFacet;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.HelmFormat;
import org.sonatype.repository.helm.internal.hosted.HelmHostedFacet;
import org.sonatype.repository.helm.internal.orient.hosted.HelmHostedFacet;

import com.google.common.eventbus.AllowConcurrentEvents;
import com.google.common.eventbus.Subscribe;
Expand All @@ -66,9 +66,9 @@ public class CreateIndexFacetImpl

private final long interval;

private final static String INDEX_YAML = "index.yaml";
private static final String INDEX_YAML = "index.yaml";

private final static String TGZ_CONTENT_TYPE = "application/x-tgz";
private static final String TGZ_CONTENT_TYPE = "application/x-tgz";

private final AtomicBoolean acceptingEvents = new AtomicBoolean(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.createindex;
package org.sonatype.repository.helm.internal.orient.createindex;

import org.sonatype.nexus.repository.Repository;
import org.sonatype.nexus.repository.storage.TempBlob;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.createindex;
package org.sonatype.repository.helm.internal.orient.createindex;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import javax.annotation.Nullable;
import javax.inject.Inject;
Expand All @@ -32,14 +30,12 @@
import org.sonatype.nexus.repository.storage.TempBlob;
import org.sonatype.nexus.repository.transaction.TransactionalStoreBlob;
import org.sonatype.nexus.transaction.UnitOfWork;
import org.sonatype.repository.helm.HelmAttributes;
import org.sonatype.repository.helm.HelmFacet;
import org.sonatype.repository.helm.internal.orient.HelmFacet;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.metadata.ChartEntry;
import org.sonatype.repository.helm.internal.metadata.ChartIndex;
import org.sonatype.repository.helm.internal.metadata.IndexYamlBuilder;
import org.sonatype.repository.helm.internal.orient.metadata.IndexYamlBuilder;

import org.apache.commons.collections.CollectionUtils;
import org.joda.time.DateTime;

import static com.google.common.base.Preconditions.checkNotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.createindex;
package org.sonatype.repository.helm.internal.orient.createindex;

import static com.google.common.base.Preconditions.checkNotNull;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.hosted;
package org.sonatype.repository.helm.internal.orient.hosted;

import java.io.IOException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.hosted;
package org.sonatype.repository.helm.internal.orient.hosted;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -33,7 +33,7 @@
import org.sonatype.nexus.repository.view.Payload;
import org.sonatype.nexus.transaction.UnitOfWork;
import org.sonatype.repository.helm.HelmAttributes;
import org.sonatype.repository.helm.HelmFacet;
import org.sonatype.repository.helm.internal.orient.HelmFacet;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.util.HelmAttributeParser;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.hosted
package org.sonatype.repository.helm.internal.orient.hosted

import javax.annotation.Nonnull
import javax.inject.Inject
Expand All @@ -35,7 +35,8 @@ import org.sonatype.nexus.repository.view.matchers.token.TokenMatcher
import org.sonatype.repository.helm.internal.AssetKind
import org.sonatype.repository.helm.internal.HelmFormat
import org.sonatype.repository.helm.internal.HelmRecipeSupport
import org.sonatype.repository.helm.internal.createindex.CreateIndexFacetImpl
import org.sonatype.repository.helm.internal.hosted.HostedHandlers
import org.sonatype.repository.helm.internal.orient.createindex.CreateIndexFacetImpl

import static org.sonatype.nexus.repository.http.HttpMethods.DELETE
import static org.sonatype.nexus.repository.http.HttpMethods.PUT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.hosted;
package org.sonatype.repository.helm.internal.orient.hosted;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.metadata;
package org.sonatype.repository.helm.internal.orient.metadata;

import java.io.IOException;
import java.io.InputStream;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.metadata;
package org.sonatype.repository.helm.internal.orient.metadata;

import java.io.InputStream;
import java.io.OutputStream;
Expand All @@ -22,6 +22,7 @@
import org.sonatype.nexus.repository.storage.TempBlob;
import org.sonatype.nexus.thread.io.StreamCopier;
import org.sonatype.repository.helm.internal.HelmFormat;
import org.sonatype.repository.helm.internal.metadata.ChartIndex;
import org.sonatype.repository.helm.internal.util.YamlParser;


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2017-present Sonatype, Inc.
* All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
* which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
*
* Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
@FeatureFlag(name = "nexus.orient.store.content")
package org.sonatype.repository.helm.internal.orient;

import org.sonatype.nexus.common.app.FeatureFlag;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.proxy;
package org.sonatype.repository.helm.internal.orient.proxy;

import java.io.IOException;
import java.util.Collections;
Expand Down Expand Up @@ -39,9 +39,9 @@
import org.sonatype.nexus.repository.view.matchers.token.TokenMatcher;
import org.sonatype.nexus.transaction.UnitOfWork;
import org.sonatype.repository.helm.HelmAttributes;
import org.sonatype.repository.helm.HelmFacet;
import org.sonatype.repository.helm.internal.orient.HelmFacet;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.metadata.IndexYamlAbsoluteUrlRewriter;
import org.sonatype.repository.helm.internal.orient.metadata.IndexYamlAbsoluteUrlRewriter;
import org.sonatype.repository.helm.internal.util.HelmAttributeParser;
import org.sonatype.repository.helm.internal.util.HelmPathUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.proxy
package org.sonatype.repository.helm.internal.orient.proxy

import javax.annotation.Nonnull
import javax.inject.Inject
Expand All @@ -31,7 +31,6 @@ import org.sonatype.nexus.repository.view.ConfigurableViewFacet
import org.sonatype.nexus.repository.view.Route
import org.sonatype.nexus.repository.view.Router
import org.sonatype.nexus.repository.view.ViewFacet
import org.sonatype.nexus.repository.view.handlers.BrowseUnsupportedHandler
import org.sonatype.repository.helm.internal.HelmFormat
import org.sonatype.repository.helm.internal.HelmRecipeSupport

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.restore;
package org.sonatype.repository.helm.internal.orient.restore;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -29,7 +29,7 @@
import org.sonatype.nexus.repository.view.Content;
import org.sonatype.nexus.transaction.UnitOfWork;
import org.sonatype.repository.helm.HelmAttributes;
import org.sonatype.repository.helm.HelmFacet;
import org.sonatype.repository.helm.internal.orient.HelmFacet;
import org.sonatype.repository.helm.HelmRestoreFacet;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.util.HelmAttributeParser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
package org.sonatype.repository.helm.internal.util;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import org.sonatype.nexus.repository.types.HostedType;
import org.sonatype.nexus.repository.types.ProxyType;
import org.sonatype.nexus.repository.view.handlers.HighAvailabilitySupportChecker;
import org.sonatype.repository.helm.internal.hosted.HelmHostedRecipe;
import org.sonatype.repository.helm.internal.proxy.HelmProxyRecipe;
import org.sonatype.repository.helm.internal.orient.hosted.HelmHostedRecipe;
import org.sonatype.repository.helm.internal.orient.proxy.HelmProxyRecipe;

import org.junit.Before;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal;
package org.sonatype.repository.helm.internal.orient;

import org.sonatype.goodies.testsupport.TestSupport;
import org.sonatype.nexus.common.entity.EntityId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
* Eclipse Foundation. All other trademarks are the property of their respective owners.
*/
package org.sonatype.repository.helm.internal.createindex;
package org.sonatype.repository.helm.internal.orient.createindex;

import java.util.Arrays;
import java.util.HashMap;
Expand All @@ -29,9 +29,9 @@
import org.sonatype.nexus.repository.storage.TempBlob;
import org.sonatype.nexus.transaction.TransactionModule;
import org.sonatype.nexus.transaction.UnitOfWork;
import org.sonatype.repository.helm.HelmFacet;
import org.sonatype.repository.helm.internal.orient.HelmFacet;
import org.sonatype.repository.helm.internal.AssetKind;
import org.sonatype.repository.helm.internal.metadata.IndexYamlBuilder;
import org.sonatype.repository.helm.internal.orient.metadata.IndexYamlBuilder;

import com.google.inject.AbstractModule;
import com.google.inject.Guice;
Expand Down
Loading

0 comments on commit 37a6370

Please sign in to comment.