release version 1.12.0

This commit is contained in:
2026-02-18 23:32:39 +03:00
parent 24ce86f470
commit 5d0e27b3e2
2858 changed files with 18366 additions and 113588 deletions

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.platform.runtime</groupId>
<artifactId>core</artifactId>
<version>1.11.0</version>
<version>1.12.0</version>
</parent>
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
<artifactId>artifact-management</artifactId>
@@ -80,9 +80,8 @@
<version>${karaf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.cave.repository</groupId>
<groupId>ru.entaxy.cave.repository</groupId>
<artifactId>org.apache.karaf.cave.repository.api</artifactId>
<version>${cave.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
@@ -109,14 +108,12 @@
<version>${karaf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.cellar</groupId>
<groupId>ru.entaxy.cellar</groupId>
<artifactId>org.apache.karaf.cellar.bundle</artifactId>
<version>${cellar.version}-ENTAXY</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.cellar</groupId>
<groupId>ru.entaxy.cellar</groupId>
<artifactId>org.apache.karaf.cellar.core</artifactId>
<version>${cellar.version}</version>
</dependency>
<!-- dependency>
<groupId>org.apache.felix</groupId>

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -28,8 +28,6 @@ package ru.entaxy.platform.core.artifact;
import java.io.File;
import java.util.Map;
import ru.entaxy.platform.base.support.osgi.bundle.CapabilityDescriptor;
public interface Artifact {
public static final String ARTIFACT_CATEGORY_UNKNOWN = "unknown";
@@ -58,14 +56,6 @@ public interface Artifact {
public Map<String, Object> getProperties();
// capabilities support
@Deprecated(forRemoval = true, since = "1.8.2")
public CapabilityDescriptor provideCapability(String namespace);
@Deprecated(forRemoval = true, since = "1.8.2")
public CapabilityDescriptor requireCapability(String namespace);
public default boolean isManifested() {
return Manifested.class.isAssignableFrom(this.getClass());
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* test-producers
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* test-producers
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -37,9 +37,7 @@ import org.apache.camel.tooling.model.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.entaxy.platform.base.support.osgi.bundle.CapabilityDescriptor;
import ru.entaxy.platform.core.artifact.annotation.ArtifactSupport;
import ru.entaxy.platform.core.artifact.impl.CapabilityDescriptorImpl;
public class DefaultArtifact implements Artifact {
@@ -57,9 +55,6 @@ public class DefaultArtifact implements Artifact {
protected List<Class<?>> supportedContentClasses = new ArrayList<>();
protected Map<String, CapabilityDescriptorImpl> requiredCapabilities = new HashMap<>();
protected Map<String, CapabilityDescriptorImpl> providedCapabilities = new HashMap<>();
public DefaultArtifact() {
this.coordinates = new ArtifactCoordinates();
this.artifactSupport = this.getClass().getAnnotation(ArtifactSupport.class);
@@ -149,39 +144,4 @@ public class DefaultArtifact implements Artifact {
public Map<String, Object> getProperties() {
return properties;
}
@Override
public CapabilityDescriptor provideCapability(String namespace) {
if (!this.providedCapabilities.containsKey(namespace))
this.providedCapabilities.put(namespace, new CapabilityDescriptorImpl(namespace));
return this.providedCapabilities.get(namespace);
}
@Override
public CapabilityDescriptor requireCapability(String namespace) {
if (!this.requiredCapabilities.containsKey(namespace))
this.requiredCapabilities.put(namespace, new CapabilityDescriptorImpl(namespace));
return this.requiredCapabilities.get(namespace);
}
protected String getRequiredCapabilitiesValue() {
return getCapabilitiesValue(requiredCapabilities);
}
protected String getProvidedCapabilitiesValue() {
return getCapabilitiesValue(providedCapabilities);
}
protected String getCapabilitiesValue(Map<String, CapabilityDescriptorImpl> data) {
String result = "";
for (Map.Entry<String, CapabilityDescriptorImpl> entry : data.entrySet()) {
if (!result.isEmpty())
result += ",";
result += entry.getKey();
String attributes = entry.getValue().getAttributesAsString();
if (!attributes.isEmpty())
result += ";" + attributes;
}
return result;
}
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -26,9 +26,11 @@
package ru.entaxy.platform.core.artifact;
public interface DeployedArtifact {
public Artifact getArtifact();
public String getLocation();
Artifact getArtifact();
String getLocation();
Exception getException();
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* test-producers
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* test-producers
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -1,139 +0,0 @@
/*-
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
* rights to the Software and any copies are the property of the Copyright Holder. Unless
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
* Software for commercial purposes to provide services to third parties.
*
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
* Under no circumstances does the Copyright Holder guarantee or promise that the
* Software provided by him will be suitable or not suitable for the specific purposes
* of the User, that the Software will meet all commercial and personal subjective
* expectations of the User, that the Software will work properly, without technical
* errors, quickly and uninterruptedly.
*
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
* to the User for any direct or indirect losses of the User, his expenses or actual
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
* or damage to data, property, etc.
* ~~~~~~/licensing~~~~~~
*/
package ru.entaxy.platform.core.artifact.impl;
import java.util.HashMap;
import java.util.Map;
import org.osgi.resource.Resource;
import ru.entaxy.platform.base.support.osgi.bundle.CapabilityDescriptor;
@Deprecated(forRemoval = true, since = "1.8.2")
public class CapabilityDescriptorImpl implements CapabilityDescriptor {
protected String namespace;
protected Map<String, String> directives = new HashMap<>();
protected Map<String, AttributeDescriptor> attributes = new HashMap<>();
private static class AttributeDescriptor {
String type;
String value;
Object typedValue;
public AttributeDescriptor(String value) {
this(value, "String");
}
public AttributeDescriptor(String value, String type) {
this.type = type;
this.value = value;
// TODO convert types if needed
this.typedValue = value;
}
}
public CapabilityDescriptorImpl() {
// TODO Auto-generated constructor stub
}
public CapabilityDescriptorImpl(String namespace) {
this();
namespace(namespace);
}
public String getAttributesAsString() {
String result = "";
for (Map.Entry<String, AttributeDescriptor> entry: this.attributes.entrySet()) {
if (!result.isEmpty())
result += ";";
result += entry.getKey();
if (!"String".equals(entry.getValue().type))
result += ":" + entry.getValue().type;
result += "=" + entry.getValue().value;
}
return result;
}
@Override
public String getNamespace() {
return this.namespace;
}
@Override
public Map<String, String> getDirectives() {
return this.directives;
}
@Override
public Map<String, Object> getAttributes() {
Map<String, Object> result = new HashMap<>();
for (Map.Entry<String, AttributeDescriptor> entry: this.attributes.entrySet())
result.put(entry.getKey(), entry.getValue().typedValue);
return result;
}
@Override
public Resource getResource() {
// not implemented
return null;
}
@Override
public CapabilityDescriptor namespace(String namespace) {
this.namespace = namespace;
return this;
}
@Override
public CapabilityDescriptor attributes(Map<String, Object> attributes) {
// TODO Auto-generated method stub
return null;
}
@Override
public CapabilityDescriptor attribute(String name, Object value) {
// TODO Auto-generated method stub
return null;
}
@Override
public CapabilityDescriptor attribute(String name, Object value, String type) {
// TODO Auto-generated method stub
return null;
}
@Override
public Map<String, Object> getRawAttributes() {
// TODO Auto-generated method stub
return null;
}
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -95,9 +95,12 @@ public class DefaultCellarInstaller extends AbstractInstaller<ClusterInstaller,
@Override
public ClusterInstaller groups(String... groups) {
if (groups != null && groups.length > 0)
if (groups != null && groups.length > 0) {
if (this.groups == null)
this.groups = new HashSet<>();
this.groups.clear();
this.groups.addAll(Arrays.asList((String[]) groups));
else
} else
initGroups();
return this;
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -38,12 +38,6 @@ public class DefaultLocalInstaller extends AbstractInstaller<LocalInstaller, Loc
super();
/*
this.typedInstallerClasses.put(Artifact.ARTIFACT_CATEGORY_BLUEPRINT, BlueprintInstallerImpl.class);
this.typedInstallerClasses.put(Artifact.ARTIFACT_CATEGORY_BUNDLE, BundleInstallerImpl.class);
this.typedInstallerClasses.put(Artifact.ARTIFACT_CATEGORY_JAR, JarInstallerImpl.class);
*/
this.typedHelperClasses.put(BlueprintInstaller.class, LocalCommonBundleInstallerHelper.class);
this.typedHelperClasses.put(BundleInstaller.class, LocalCommonBundleInstallerHelper.class);
this.typedHelperClasses.put(JarInstaller.class, LocalCommonBundleInstallerHelper.class);

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* cellar-deployer
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -38,6 +38,8 @@ public interface ArtifactRepository {
public static final String REPO_NAME_UPDATES = "entaxy-updates";
public void destroy();
public String getName();
public boolean isHealthy();

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -25,8 +25,6 @@
*/
package ru.entaxy.platform.core.artifact.repository;
public interface RepositoryDescriptor {
String getName();
@@ -49,11 +47,13 @@ public interface RepositoryDescriptor {
boolean isEnabled();
boolean isUploadEnabled();
String getUsername();
String getPassword();
String getRemoteHostSuffix();
// String getRemoteHostSuffix();
boolean isSystem();

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -27,7 +27,6 @@ package ru.entaxy.platform.core.artifact.repository.impl;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -36,6 +35,7 @@ import java.util.Calendar;
import java.util.List;
import org.apache.camel.tooling.model.Strings;
import org.apache.commons.lang3.StringUtils;
import org.apache.karaf.cave.repository.Repository;
import org.apache.karaf.cave.repository.RepositoryService;
import org.slf4j.Logger;
@@ -43,15 +43,13 @@ import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import ru.entaxy.platform.base.support.CommonUtils;
import ru.entaxy.platform.base.support.xml.CommonXMLUtils;
import ru.entaxy.platform.core.artifact.Artifact;
import ru.entaxy.platform.core.artifact.ArtifactCoordinates;
import ru.entaxy.platform.core.artifact.DeployedArtifact;
import ru.entaxy.platform.core.artifact.repository.ArtifactRepository;
import ru.entaxy.platform.core.artifact.repository.RepositoryDescriptor;
import ru.entaxy.platform.core.artifact.repository.impl.remote.RemoteRepository;
import ru.entaxy.platform.core.artifact.repository.impl.remote.RemoteRepositoryDescriptor;
import ru.entaxy.platform.core.artifact.repository.impl.remote.RemoteRepositoryFactory;
public class ArtifactRepositoryImpl implements ArtifactRepository {
@@ -63,8 +61,6 @@ public class ArtifactRepositoryImpl implements ArtifactRepository {
protected RepositoryDescriptor repositoryDescriptor;
protected RemoteRepository remoteRepository = null;
public ArtifactRepositoryImpl() {
// TODO Auto-generated constructor stub
}
@@ -83,6 +79,16 @@ public class ArtifactRepositoryImpl implements ArtifactRepository {
}
}
@Override
public void destroy() {
if (repositoryService != null)
try {
repositoryService.remove(repositoryDescriptor.getName());
} catch (Exception e) {
log.error(String.format("Failed repository remove: [%s]", repositoryDescriptor.getName()), e);
}
}
protected Repository createRepo() {
Repository repo = null;
try {
@@ -106,10 +112,13 @@ public class ArtifactRepositoryImpl implements ArtifactRepository {
null,
null,
null,
8);
8,
repositoryDescriptor.isReadOnly(),
CommonUtils.isValid(repositoryDescriptor.getUsername()) ? repositoryDescriptor.getUsername() : null,
CommonUtils.isValid(repositoryDescriptor.getUsername()) ? repositoryDescriptor.getPassword() : null,
repositoryDescriptor.isUploadEnabled());
this.isHealthy = true;
} catch (Exception e) {
// TODO Auto-generated catch block
log.error("createRepo", e);
this.isHealthy = false;
}
@@ -135,6 +144,35 @@ public class ArtifactRepositoryImpl implements ArtifactRepository {
repositoryService.changeProxy(repositoryDescriptor.getName(), repositoryDescriptor.getRemotes(),
repositoryDescriptor.isMirror());
}
boolean changed = false;
if (repo.isReadOnly() != repositoryDescriptor.isReadOnly()) {
repo.setReadOnly(repositoryDescriptor.isReadOnly());
changed = true;
}
if (repo.isUploadEnabled() != repositoryDescriptor.isUploadEnabled()) {
repo.setUploadEnabled(repositoryDescriptor.isUploadEnabled());
changed = true;
}
if (CommonUtils.isValid(repositoryDescriptor.getUsername())) {
if (StringUtils.compare(repo.getUploadUsername(), repositoryDescriptor.getUsername()) != 0) {
repo.setUploadUsername(repositoryDescriptor.getUsername());
changed = true;
}
if (StringUtils.compare(repo.getUploadPassword(), repositoryDescriptor.getPassword()) != 0) {
repo.setUploadPassword(repositoryDescriptor.getPassword());
changed = true;
}
}
if (StringUtils.compare(repo.getProxyOrigin(), repositoryDescriptor.getRemotes()) != 0) {
repo.loadProxy(repositoryDescriptor.getRemotes());
changed = true;
}
if (changed)
repositoryService.update();
this.isHealthy = true;
} catch (Exception e) {
log.error("checkUpdateRepo", e);
@@ -154,11 +192,7 @@ public class ArtifactRepositoryImpl implements ArtifactRepository {
protected DeployedArtifact deployArtifact(Artifact artifact) throws Exception {
String location = "mvn:";
if (!repositoryDescriptor.isProxy() || repositoryDescriptor.isMirror())
deployToCave(artifact);
if (repositoryDescriptor.isProxy())
deployToRemoteMaven(artifact);
deployToCave(artifact);
return new DeployedArtifactImpl(artifact, location + artifact.getCoordinates().toString());
}
@@ -185,24 +219,6 @@ public class ArtifactRepositoryImpl implements ArtifactRepository {
}
}
protected void deployToRemoteMaven(Artifact artifact) throws Exception {
try {
initRemoteRepository();
this.remoteRepository.deploy(artifact);
} catch (Exception e) {
log.error("deployToRemoteMaven", e);
throw e;
}
}
protected void initRemoteRepository() throws NoSuchMethodException, SecurityException, InstantiationException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException, MalformedURLException {
if (this.remoteRepository == null) {
this.remoteRepository =
RemoteRepositoryFactory.create(new RemoteRepositoryDescriptor(repositoryDescriptor));
}
}
@Override
public String getName() {
return repositoryDescriptor.getName();

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -30,30 +30,43 @@ import ru.entaxy.platform.core.artifact.DeployedArtifact;
public class DeployedArtifactImpl implements DeployedArtifact {
protected Artifact artifact;
protected String location = null;
public DeployedArtifactImpl(Artifact artifact) {
this.artifact = artifact;
}
protected Artifact artifact;
public DeployedArtifactImpl(Artifact artifact, String location) {
this.artifact = artifact;
this.location = location;
}
@Override
public Artifact getArtifact() {
// TODO Auto-generated method stub
return this.artifact;
}
protected String location = null;
@Override
public String getLocation() {
// TODO Auto-generated method stub
return this.location;
}
protected Exception exception;
public DeployedArtifactImpl(Artifact artifact) {
this.artifact = artifact;
}
public DeployedArtifactImpl(Artifact artifact, String location) {
this.artifact = artifact;
this.location = location;
}
public void setException(Exception exception) {
this.exception = exception;
}
public DeployedArtifactImpl exception(Exception exceptionValue) {
this.setException(exceptionValue);
return this;
};
@Override
public Artifact getArtifact() {
return this.artifact;
}
@Override
public String getLocation() {
return this.location;
}
@Override
public Exception getException() {
return exception;
}
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -26,6 +26,7 @@
package ru.entaxy.platform.core.artifact.repository.impl;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -42,6 +43,8 @@ public class RepositoryConfigurableHelper extends RepositoryDescriptorImpl {
RepositoryDescriptorCollector collector;
protected List<String> remotesList = null;
public void init() {
if (collector != null)
collector.addRepositoryDescriptor(this);
@@ -57,4 +60,21 @@ public class RepositoryConfigurableHelper extends RepositoryDescriptorImpl {
this.collector = collector;
}
public List<String> getRemotesList() {
return remotesList;
}
public void setRemotesList(List<String> remotesList) {
this.remotesList = remotesList;
// remotesList has priority over remotes
if (this.remotesList != null)
super.setRemotes(this.remotesList.stream().collect(Collectors.joining(",")));
}
@Override
public void setRemotes(String remotes) {
// remotesList has priority over remotes
if (this.remotesList == null || this.remotesList.isEmpty())
super.setRemotes(remotes);
}
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -37,6 +37,7 @@ public class RepositoryDescriptorImpl implements RepositoryDescriptor {
String remotes;
boolean isReadOnly = false;
boolean copyOnChange;
boolean uploadEnabled;
String username = "";
String password = "";
@@ -44,7 +45,7 @@ public class RepositoryDescriptorImpl implements RepositoryDescriptor {
boolean isEnabled = true;
String remoteHostSuffix = "";
// String remoteHostSuffix = "";
boolean isSystem = true;
@@ -158,15 +159,16 @@ public class RepositoryDescriptorImpl implements RepositoryDescriptor {
this.password = password;
}
@Override
public String getRemoteHostSuffix() {
return remoteHostSuffix;
}
public void setRemoteHostSuffix(String remoteHostSuffix) {
this.remoteHostSuffix = remoteHostSuffix;
}
/*
@Override
public String getRemoteHostSuffix() {
return remoteHostSuffix;
}
public void setRemoteHostSuffix(String remoteHostSuffix) {
this.remoteHostSuffix = remoteHostSuffix;
}
*/
@Override
public boolean isSystem() {
return isSystem;
@@ -185,4 +187,15 @@ public class RepositoryDescriptorImpl implements RepositoryDescriptor {
this.isLookupEnabled = isLookupEnabled;
}
@Override
public boolean isUploadEnabled() {
return uploadEnabled;
}
public void setUploadEnabled(boolean uploadEnabled) {
this.uploadEnabled = uploadEnabled;
}
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -1,32 +0,0 @@
/*-
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
* rights to the Software and any copies are the property of the Copyright Holder. Unless
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
* Software for commercial purposes to provide services to third parties.
*
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
* Under no circumstances does the Copyright Holder guarantee or promise that the
* Software provided by him will be suitable or not suitable for the specific purposes
* of the User, that the Software will meet all commercial and personal subjective
* expectations of the User, that the Software will work properly, without technical
* errors, quickly and uninterruptedly.
*
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
* to the User for any direct or indirect losses of the User, his expenses or actual
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
* or damage to data, property, etc.
* ~~~~~~/licensing~~~~~~
*/
package ru.entaxy.platform.core.artifact.repository.impl.remote;
public abstract class AbstractRemoteRepository implements RemoteRepository {
public abstract void init(RemoteRepositoryDescriptor repositoryDescriptor);
}

View File

@@ -1,165 +0,0 @@
/*-
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
* rights to the Software and any copies are the property of the Copyright Holder. Unless
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
* Software for commercial purposes to provide services to third parties.
*
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
* Under no circumstances does the Copyright Holder guarantee or promise that the
* Software provided by him will be suitable or not suitable for the specific purposes
* of the User, that the Software will meet all commercial and personal subjective
* expectations of the User, that the Software will work properly, without technical
* errors, quickly and uninterruptedly.
*
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
* to the User for any direct or indirect losses of the User, his expenses or actual
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
* or damage to data, property, etc.
* ~~~~~~/licensing~~~~~~
*/
package ru.entaxy.platform.core.artifact.repository.impl.remote;
import javax.net.ssl.SSLContext;
import org.apache.http.HttpRequest;
import org.apache.http.auth.AuthenticationException;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.config.Registry;
import org.apache.http.config.RegistryBuilder;
import org.apache.http.conn.socket.ConnectionSocketFactory;
import org.apache.http.conn.socket.PlainConnectionSocketFactory;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.impl.conn.BasicHttpClientConnectionManager;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.ssl.TrustStrategy;
import ru.entaxy.platform.base.support.CommonUtils;
import ru.entaxy.platform.core.artifact.Artifact;
public class NexusRepository extends AbstractRemoteRepository {
private static final String DEFAULT_REPOSITORY_NAME = "entaxy";
private static final String NEXUS_ADDRESS = "/service/rest/v1";
String username;
String password;
String host;
String repositoryName;
String hostSuffix;
String apiAddress;
boolean isSystem;
@Override
public void init(RemoteRepositoryDescriptor repositoryDescriptor) {
this.host = repositoryDescriptor.getHost();
String repositoryPath = repositoryDescriptor.getRepositoryPath();
if (CommonUtils.isValid(repositoryPath))
repositoryPath = repositoryPath.trim();
if (!CommonUtils.isValid(repositoryPath))
// TODO throw exception
return;
if (repositoryPath.endsWith("/"))
repositoryPath = repositoryPath.substring(0, repositoryPath.length() - 1);
String[] splitted = repositoryPath.split("/");
this.repositoryName = splitted[splitted.length - 1];
if (!CommonUtils.isValid(repositoryName))
this.repositoryName = DEFAULT_REPOSITORY_NAME;
this.hostSuffix = repositoryDescriptor.getHostSuffix();
this.apiAddress = this.host + this.hostSuffix + NEXUS_ADDRESS;
this.username = repositoryDescriptor.getUsername();
this.password = repositoryDescriptor.getPassword();
this.isSystem = repositoryDescriptor.isSystem();
}
@Override
public void deploy(Artifact artifact) throws Exception {
// TODO: manage via config
TrustStrategy acceptingTrustStrategy = (cert, authType) -> true;
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext,
NoopHostnameVerifier.INSTANCE);
Registry<ConnectionSocketFactory> socketFactoryRegistry =
RegistryBuilder.<ConnectionSocketFactory>create()
.register("https", sslsf)
.register("http", new PlainConnectionSocketFactory())
.build();
try (BasicHttpClientConnectionManager connectionManager =
new BasicHttpClientConnectionManager(socketFactoryRegistry)) {
HttpPost httpPost = new HttpPost(this.apiAddress + "/components?repository=" + this.repositoryName);
addAuth(httpPost);
httpPost.setEntity(createMultipartEntityBuilder(artifact).build());
try (CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslsf)
.setConnectionManager(connectionManager).build();
CloseableHttpResponse response = httpClient.execute(httpPost)) {
checkAnswer(response);
}
}
}
private void checkAnswer(CloseableHttpResponse response) throws HttpResponseException {
if (response.getStatusLine().getStatusCode() != 204 && response.getStatusLine().getStatusCode() != 200) {
throw new HttpResponseException(response.getStatusLine().getStatusCode(),
response.getStatusLine().getReasonPhrase());
}
}
private void addAuth(HttpRequest httpRequest) throws AuthenticationException {
if (CommonUtils.isValid(username)) {
UsernamePasswordCredentials creds = new UsernamePasswordCredentials(username, password);
httpRequest.addHeader(new BasicScheme().authenticate(creds, httpRequest, null));
}
}
/*
private List getListArtifactInfo(CloseableHttpResponse response) throws IOException {
if (response.getEntity() != null && response.getEntity().getContent() != null) {
Map content = new Gson().fromJson(IOUtils.toString(response.getEntity().getContent()), Map.class);
return (List) content.get("items");
}
return null;
}
*/
private MultipartEntityBuilder createMultipartEntityBuilder(Artifact artifact) {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addBinaryBody("maven2.asset1", artifact.asByteArray());
builder.addTextBody("maven2.groupId", artifact.getCoordinates().getGroupId());
builder.addTextBody("maven2.artifactId", artifact.getCoordinates().getArtifactId());
builder.addTextBody("maven2.version", artifact.getCoordinates().getVersion());
builder.addTextBody("maven2.asset1.extension", artifact.getCoordinates().getType());
builder.addTextBody("maven2.asset1.classifier", artifact.getCoordinates().getClassifier());
return builder;
}
}

View File

@@ -1,32 +0,0 @@
/*-
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
* rights to the Software and any copies are the property of the Copyright Holder. Unless
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
* Software for commercial purposes to provide services to third parties.
*
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
* Under no circumstances does the Copyright Holder guarantee or promise that the
* Software provided by him will be suitable or not suitable for the specific purposes
* of the User, that the Software will meet all commercial and personal subjective
* expectations of the User, that the Software will work properly, without technical
* errors, quickly and uninterruptedly.
*
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
* to the User for any direct or indirect losses of the User, his expenses or actual
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
* or damage to data, property, etc.
* ~~~~~~/licensing~~~~~~
*/
package ru.entaxy.platform.core.artifact.repository.impl.remote;
import ru.entaxy.platform.core.artifact.Artifact;
public interface RemoteRepository {
public void deploy(Artifact artifact) throws Exception;
}

View File

@@ -1,106 +0,0 @@
/*-
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
* rights to the Software and any copies are the property of the Copyright Holder. Unless
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
* Software for commercial purposes to provide services to third parties.
*
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
* Under no circumstances does the Copyright Holder guarantee or promise that the
* Software provided by him will be suitable or not suitable for the specific purposes
* of the User, that the Software will meet all commercial and personal subjective
* expectations of the User, that the Software will work properly, without technical
* errors, quickly and uninterruptedly.
*
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
* to the User for any direct or indirect losses of the User, his expenses or actual
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
* or damage to data, property, etc.
* ~~~~~~/licensing~~~~~~
*/
package ru.entaxy.platform.core.artifact.repository.impl.remote;
import java.net.MalformedURLException;
import java.net.URL;
import ru.entaxy.platform.core.artifact.repository.RepositoryDescriptor;
public class RemoteRepositoryDescriptor {
String type = "nexus";
String host;
String hostSuffix;
String username;
String password;
String repositoryPath;
boolean isSystem;
public RemoteRepositoryDescriptor(RepositoryDescriptor repositoryDescriptor) throws MalformedURLException {
String repositoryUrl = repositoryDescriptor.getRemotes().trim();
URL url = new URL(repositoryUrl);
this.host = url.getProtocol() + "://" + url.getHost();
if (url.getPort() > 0)
this.host += ":" + url.getPort();
this.hostSuffix = repositoryDescriptor.getRemoteHostSuffix();
this.repositoryPath = url.getPath();
this.username = repositoryDescriptor.getUsername();
this.password = repositoryDescriptor.getPassword();
this.isSystem = repositoryDescriptor.isSystem();
}
public String getType() {
return type;
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getRepositoryPath() {
return repositoryPath;
}
public void setRepositoryPath(String repositoryName) {
this.repositoryPath = repositoryName;
}
public String getHostSuffix() {
return hostSuffix;
}
public void setHostSuffix(String hostSuffix) {
this.hostSuffix = hostSuffix;
}
public boolean isSystem() {
return isSystem;
}
}

View File

@@ -1,55 +0,0 @@
/*-
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
* rights to the Software and any copies are the property of the Copyright Holder. Unless
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
* Software for commercial purposes to provide services to third parties.
*
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
* Under no circumstances does the Copyright Holder guarantee or promise that the
* Software provided by him will be suitable or not suitable for the specific purposes
* of the User, that the Software will meet all commercial and personal subjective
* expectations of the User, that the Software will work properly, without technical
* errors, quickly and uninterruptedly.
*
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
* to the User for any direct or indirect losses of the User, his expenses or actual
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
* or damage to data, property, etc.
* ~~~~~~/licensing~~~~~~
*/
package ru.entaxy.platform.core.artifact.repository.impl.remote;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
public class RemoteRepositoryFactory {
private static Map<String, Class<? extends AbstractRemoteRepository>> repositoryClasses;
static {
repositoryClasses = new HashMap<>();
repositoryClasses.put("nexus", NexusRepository.class);
}
public static RemoteRepository create(RemoteRepositoryDescriptor descriptor)
throws NoSuchMethodException, SecurityException, InstantiationException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Class<? extends AbstractRemoteRepository> clazz = repositoryClasses.get(descriptor.getType());
Constructor<? extends AbstractRemoteRepository> constructor = clazz.getConstructor();
AbstractRemoteRepository remoteRepository = constructor.newInstance();
remoteRepository.init(descriptor);
return remoteRepository;
};
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* artifact-management
* ==========
* Copyright (C) 2020 - 2025 EmDev LLC
* Copyright (C) 2020 - 2026 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -86,6 +86,9 @@ public class ArtifactServiceImpl implements ArtifactService, RepositoryDescripto
if (repositories != null && helper != null) {
if (helper.isLookupEnabled())
RepositoryRegistrator.INSTANCE.removeRepository(repositories.get(helper.getName()));
ArtifactRepository repo = repositories.get(helper.getName());
if (repo != null)
repo.destroy();
repositories.remove(helper.getName());
}
}
@@ -112,6 +115,7 @@ public class ArtifactServiceImpl implements ArtifactService, RepositoryDescripto
protected DeployedArtifact deploy(Artifact artifact, String repositoryName) {
String error = "Repository [" + repositoryName + "] not found";
Exception exception = null;
if (repositories.containsKey(repositoryName)) {
ArtifactRepository repo = repositories.get(repositoryName);
error = String.format("Cannot deploy artifact [%s] to repository [" + repositoryName + "]",
@@ -123,9 +127,9 @@ public class ArtifactServiceImpl implements ArtifactService, RepositoryDescripto
return repo.deploy(artifact);
} catch (Exception e) {
error += ": ".concat(e.getMessage());
exception = e;
}
}
else
} else
error += ": repository is readonly";
else
error += ": repository is disabled";
@@ -133,7 +137,7 @@ public class ArtifactServiceImpl implements ArtifactService, RepositoryDescripto
error += ": repository is not healthy";
}
log.error(error);
return new DeployedArtifactImpl(artifact);
return new DeployedArtifactImpl(artifact).exception(exception);
}
@Override

View File

@@ -2,7 +2,7 @@
# ~~~~~~licensing~~~~~~
# artifact-management
# ==========
# Copyright (C) 2020 - 2025 EmDev LLC
# Copyright (C) 2020 - 2026 EmDev LLC
# ==========
# You may not use this file except in accordance with the License Terms of the Copyright
# Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -38,11 +38,31 @@ local.snapshots = false
shared.location=${karaf.home}/shared-repo
# set 'true' if proxy
shared.proxy=false
# set value if proxy
#
# FORMAT
# data := value[,value]*
# value := [<search_specifiaction>:]<remote_repository_url>
# search_specifiaction := <provider_name>[{<provider_params>}]
#
# Only Nexus is supported as a remote search provider now
# search_specifiaction_nexus := nexus[{<nexus_assets_search_api_url_including_creds>[$<remote_repo_name>]}]
#
# EXAMPLE:
#
# shared.remotes=nexus:http://entaxy:entaxyPass@localhost:8981/repository/entaxy-shared/
#
# is equivalent to
#
# shared.remotes=nexus{http://entaxy:entaxyPass@localhost:8981/service/rest/v1/search/assets$entaxy-shared}:http://entaxy:entaxyPass@localhost:8981/repository/entaxy-shared/
#
#
shared.remotes=
# hardcoded to 'true', left for information
# shared.mirror=true
# mirror mode for proxy repo
shared.mirror=true
# set true if repo should be searched for snapshots
shared.snapshots = false

View File

@@ -3,7 +3,7 @@
~~~~~~licensing~~~~~~
uniform-service-exchange-endpoint
==========
Copyright (C) 2020 - 2025 EmDev LLC
Copyright (C) 2020 - 2026 EmDev LLC
==========
You may not use this file except in accordance with the License Terms of the Copyright
Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -48,7 +48,8 @@
<cm:property name="shared.mirror" value="true"/>
<cm:property name="shared.snapshots" value="false"/>
<cm:property name="shared.remotes" value=""/>
<cm:property name="shared.remotes.hostSuffix" value=""/>
<!-- >cm:property name="shared.remotes.hostSuffix" value=""/ -->
<cm:property name="shared.uploadEnabled" value="true"/>
<cm:property name="shared.username" value=""/>
<cm:property name="shared.password" value=""/>
@@ -57,7 +58,7 @@
<cm:property name="updates.proxy" value="true"/>
<cm:property name="updates.mirror" value="true"/>
<cm:property name="updates.enabled" value="true"/>
<cm:property name="updates.remotes.hostSuffix" value=""/>
<!-- cm:property name="updates.remotes.hostSuffix" value=""/ -->
<cm:property name="updates.snapshots" value="false"/>
<cm:property name="updates.remotes" value="https://nexus.entaxy.ru/nexus/repository/entaxy-public/"/>
@@ -123,10 +124,11 @@
<property name="location" value="${shared.location}"></property>
<property name="proxy" value="${shared.proxy}"></property>
<!-- property name="mirror" value="${shared.mirror}"></property -->
<property name="mirror" value="true"></property>
<property name="mirror" value="${shared.mirror}"></property>
<property name="snapshots" value="${shared.snapshots}"></property>
<property name="remotes" value="${shared.remotes}"></property>
<property name="remoteHostSuffix" value="${shared.remotes.hostSuffix}"></property>
<!-- property name="remoteHostSuffix" value="${shared.remotes.hostSuffix}"></property -->
<property name="uploadEnabled" value="${shared.uploadEnabled}"></property>
<property name="username" value="${shared.username}"></property>
<property name="password" value="${shared.password}"></property>
<property name="collector" ref="artifactServiceImpl"></property>
@@ -142,7 +144,7 @@
<property name="mirror" value="true"></property>
<property name="snapshots" value="${updates.snapshots}"></property>
<property name="remotes" value="${updates.remotes}"></property>
<property name="remoteHostSuffix" value="${updates.remotes.hostSuffix}"></property>
<!-- property name="remoteHostSuffix" value="${updates.remotes.hostSuffix}"></property -->
<property name="collector" ref="artifactServiceImpl"></property>
</bean>