-
Notifications
You must be signed in to change notification settings - Fork 570
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upstream: b=main,r=9d0aede896ba98a01623f35a0138e867d9f44773,t=2024-06…
…-14-1243-35893
- Loading branch information
1 parent
4115396
commit 467d109
Showing
173 changed files
with
3,948 additions
and
569 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
components/nexus-base/src/main/java/org/sonatype/nexus/node/datastore/NodeHeartbeat.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...xus-blobstore/src/main/java/org/sonatype/nexus/blobstore/BlobStoreDescriptorProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...lity/src/main/java/org/sonatype/nexus/capability/DefaultCapabilityDescriptorProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.