Skip to content

Commit

Permalink
upstream: b=main,r=9d0aede896ba98a01623f35a0138e867d9f44773,t=2024-06…
Browse files Browse the repository at this point in the history
…-14-1243-35893
  • Loading branch information
sonatype-zion committed Jun 14, 2024
1 parent 4115396 commit 467d109
Show file tree
Hide file tree
Showing 173 changed files with 3,948 additions and 569 deletions.
5 changes: 4 additions & 1 deletion .mvn/maven-build-cache-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
<input>
<global>
<glob>
{*.lock}
{*.lock,*.js,*.jsx,*.scss,*.java,*.groovy,*.properties}
</glob>
<includes>
<include>src/</include>
</includes>
</global>
</input>

Expand Down
5 changes: 0 additions & 5 deletions assemblies/nexus-startup-feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@
<artifactId>jetty-util-ajax</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-proxy</artifactId>
Expand Down
6 changes: 0 additions & 6 deletions buildsupport/jetty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,6 @@
<version>${eclipse-jetty.version}</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${eclipse-jetty.version}</version>
</dependency>

<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-proxy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2008-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.
*/
package org.sonatype.nexus.node.datastore;

import java.time.OffsetDateTime;
import java.util.Map;

import org.sonatype.nexus.common.entity.ContinuationAware;

/**
* Heartbeat of a node pinging the database indicating its presence.
*
* @since 3.37
*/
public interface NodeHeartbeat
extends ContinuationAware
{
/**
* The time of the last heartbeat
*/
OffsetDateTime heartbeatTime();

/**
* Host name derived for the local system
*/
String hostname();

/**
* The database record ID
*/
Integer id();

Map<String, Object> nodeInfo();

Map<String, Object> systemInfo();

/**
* The Heartbeat ID of the node, this is a non-persistent value that is distinct from the NodeAccess ID. Only useful to
* determine whether the heartbeat was created while an instance is running.
*/
String heartbeatId();

void setHeartbeatTime(final OffsetDateTime heartbeatTime);

void setHostname(final String hostname);

void setId(final Integer id);

void setHeartbeatId(final String heartbeatId);

void setNodeInfo(final Map<String, Object> nodeInfo);

void setSystemInfo(final Map<String, Object> systemInfo);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package org.sonatype.nexus.node.datastore;

import java.util.Collection;
import java.util.Map;
import java.util.stream.Stream;

Expand Down Expand Up @@ -47,8 +48,18 @@ public interface NodeHeartbeatManager
*/
boolean isCurrentNodeClustered();

/**
* Triggers a write of the latest heartbeat information
*/
void writeHeartbeat();

/**
* Collects and transforms system info from heartbeat table
*/
Map<String, Map<String, Object>> getSystemInformationForNodes();

/**
* Collects nodeInfo from the heartbeat table
*/
Collection<NodeHeartbeat> getActiveNodeHeartbeatData();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.sonatype.nexus.blobstore.file.FileBlobStore;
import org.sonatype.nexus.blobstore.quota.BlobStoreQuotaService;
import org.sonatype.nexus.common.app.ApplicationDirectories;
import org.sonatype.nexus.common.upgrade.AvailabilityVersion;
import org.sonatype.nexus.formfields.FormField;
import org.sonatype.nexus.formfields.StringTextFormField;
import org.sonatype.nexus.rest.ValidationErrorsException;
Expand All @@ -48,6 +49,7 @@
*
* @since 3.6
*/
@AvailabilityVersion(from = "1.0")
@Named(FileBlobStore.TYPE)
public class FileBlobStoreDescriptor
extends BlobStoreDescriptorSupport
Expand Down
1 change: 0 additions & 1 deletion components/nexus-blobstore/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<groupId>org.sonatype.nexus</groupId>
<artifactId>nexus-blobstore-api</artifactId>
</dependency>

<dependency>
<groupId>org.sonatype.nexus</groupId>
<artifactId>nexus-thread</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

/**
* Describes a blob store.
* Note: Do not inject Map<String, BlobStoreDescriptors> and instead opt to use BlobStoreDescriptorProvider
*
* @since 3.6
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2008-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.
*/
package org.sonatype.nexus.blobstore;

import java.util.Map;
import java.util.Map.Entry;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import org.sonatype.nexus.common.db.DatabaseCheck;

@Named
@Singleton
public class BlobStoreDescriptorProvider
{
private final Map<String, BlobStoreDescriptor> blobStoreDescriptors;

private final DatabaseCheck databaseCheck;

@Inject
public BlobStoreDescriptorProvider(
final DatabaseCheck databaseCheck,
final Map<String, BlobStoreDescriptor> blobStoreDescriptors)
{
this.databaseCheck = databaseCheck;
this.blobStoreDescriptors = blobStoreDescriptors;
}

public Map<String, BlobStoreDescriptor> get() {
return blobStoreDescriptors.entrySet().stream()
.filter(item -> databaseCheck.isAllowedByVersion(item.getValue().getClass()))
.collect(Collectors.toMap(Entry::getKey, Entry::getValue));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.sonatype.nexus.blobstore.group.BlobStoreGroupService;
import org.sonatype.nexus.blobstore.group.FillPolicy;
import org.sonatype.nexus.blobstore.quota.BlobStoreQuotaService;
import org.sonatype.nexus.common.upgrade.AvailabilityVersion;
import org.sonatype.nexus.formfields.ComboboxFormField;
import org.sonatype.nexus.formfields.FormField;
import org.sonatype.nexus.formfields.ItemselectFormField;
Expand All @@ -57,6 +58,7 @@
*
* @since 3.14
*/
@AvailabilityVersion(from = "1.0")
@Named(BlobStoreGroup.TYPE)
public class BlobStoreGroupDescriptor
extends BlobStoreDescriptorSupport
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ private void readEnvironmentVariables(final Properties properties) {
properties.setProperty(FIREWALL_QUARANTINE_FIX_ENABLED,
Boolean.toString(parseBoolean(System.getenv("FIREWALL_QUARANTINE_FIX_ENABLED"))));
}

if (properties.getProperty(ZERO_DOWNTIME_BASELINE_FAIL) == null) {
properties.setProperty(ZERO_DOWNTIME_BASELINE_FAIL,
Optional.ofNullable(System.getenv("NEXUS_ZDU_BASELINE_FAIL")).orElse("false"));
}
}

private void selectDatastoreFeature(final Properties properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

/**
* Describes a capability (its type).
* Note: Do not inject List<BlobStoreDescriptors> and instead opt to use DefaultCapabilityDescriptorProvider
*/
public interface CapabilityDescriptor
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Sonatype Nexus (TM) Open Source Version
* Copyright (c) 2008-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.
*/
package org.sonatype.nexus.capability;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import org.sonatype.nexus.common.db.DatabaseCheck;

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

@Named
@Singleton
public class DefaultCapabilityDescriptorProvider
{
private final Map<String, CapabilityDescriptor> descriptors;

private final DatabaseCheck databaseCheck;

@Inject
public DefaultCapabilityDescriptorProvider(final Map<String, CapabilityDescriptor> descriptors,
final DatabaseCheck databaseCheck) {
this.descriptors = checkNotNull(descriptors);
this.databaseCheck = checkNotNull(databaseCheck);
}

public List<CapabilityDescriptor> get() {
return descriptors.values().stream()
.filter(capabilityDescriptor -> databaseCheck.isAllowedByVersion(capabilityDescriptor.getClass()))
.collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
import javax.inject.Named;
import javax.inject.Singleton;

import org.sonatype.nexus.common.upgrade.AvailabilityVersion;
import org.sonatype.nexus.scheduling.TaskDescriptorSupport;

/**
* Task descriptor for {@link CleanupTask}.
*
* @since 3.14
*/
@AvailabilityVersion(from = "1.0")
@Named
@Singleton
public class CleanupTaskDescriptor
Expand Down
Loading

0 comments on commit 467d109

Please sign in to comment.