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

@@ -4,7 +4,7 @@
<parent>
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
<artifactId>resources</artifactId>
<version>1.11.0</version>
<version>1.12.0</version>
</parent>
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
<artifactId>resources-management</artifactId>

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* resources-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
@@ -40,6 +40,12 @@ public interface EntaxyResourceProviderMBean {
List<Map<String, Object>> getResourcesInfo(
@Parameter(name = "path", desc = "Path to resources") String path) throws Exception;
@Operation(desc = "Upload resource")
void uploadResource(
@Parameter(name = "path", desc = "Path to the resource") String path,
@Parameter(name = "resourceContent", desc = "Content of the resource") String resourceContentBase64)
throws Exception;
@Operation(desc = "Download resource")
String downloadResource(@Parameter(name = "path", desc = "Path to the resource") String path) throws Exception;
@@ -53,6 +59,7 @@ public interface EntaxyResourceProviderMBean {
@Operation(desc = "Save resource")
void saveResource(@Parameter(name = "path", desc = "Path to the resource") String path,
@Parameter(name = "content", desc = "The resource content") String content) throws Exception;
@Parameter(name = "content", desc = "The resource content") String content,
@Parameter(name = "encoding", desc = "The resource encoding") String encoding) throws Exception;
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* resources-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,14 +25,14 @@
*/
package ru.entaxy.esb.resources.management;
import java.util.List;
import java.util.Map;
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
import ru.entaxy.esb.platform.base.management.core.api.Operation;
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
import java.util.List;
import java.util.Map;
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
public interface EntaxyResourceServiceMBean {
@@ -43,6 +43,11 @@ public interface EntaxyResourceServiceMBean {
@Operation(desc = "Get resource from the location")
String getResource(
@Parameter(name = "location", desc = "Location of the resource") String location) throws Exception;
@Operation(desc = "Get resource from the location with specific encoding")
String getResourceWithEncoding(
@Parameter(name = "location", desc = "Location of the resource") String location,
@Parameter(name = "encoding", desc = "Encoding of the resource") String encoding) throws Exception;
@Operation(desc = "Get resource metadata by the resource location")
Map<String, String> getResourceMetadata(

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* resources-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,13 +30,16 @@ import javax.management.NotCompliantMBeanException;
import org.apache.commons.io.IOUtils;
import ru.entaxy.esb.platform.base.management.core.api.AnnotatedMBean;
import ru.entaxy.esb.resources.EntaxyResource;
import ru.entaxy.esb.resources.EntaxyResourceMetadata;
import ru.entaxy.esb.resources.EntaxyResourceMetadata.MetadataSection;
import ru.entaxy.esb.resources.EntaxyResourceProvider;
import ru.entaxy.esb.resources.management.EntaxyResourceProviderMBean;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -47,6 +50,7 @@ public class EntaxyResourceProviderMBeanImpl extends AnnotatedMBean<EntaxyResour
implements EntaxyResourceProviderMBean{
protected EntaxyResourceProvider resourceProvider;
protected static final String ENCODING_NAME = "encoding";
protected EntaxyResourceProviderMBeanImpl(EntaxyResourceProvider provider) throws NotCompliantMBeanException {
super(EntaxyResourceProviderMBean.class);
@@ -84,6 +88,18 @@ public class EntaxyResourceProviderMBeanImpl extends AnnotatedMBean<EntaxyResour
return resourcesInfo;
}
@Override
public void uploadResource(String path, String resourceContentBase64) throws Exception {
byte[] byteArray = Base64.getDecoder().decode(resourceContentBase64);
try (InputStream inputStream = new ByteArrayInputStream(byteArray)) {
EntaxyResource entaxyResource = resourceProvider.getResource(path);
entaxyResource.save(inputStream);
} catch (RuntimeException e) {
throw e;
}
}
@Override
public String downloadResource(String path) throws Exception {
try (InputStream is = resourceProvider.getResource(path).getInputStream()) {
@@ -143,9 +159,18 @@ public class EntaxyResourceProviderMBeanImpl extends AnnotatedMBean<EntaxyResour
}
@Override
public void saveResource(String path, String content) throws Exception {
public void saveResource(String path, String content, String encoding) throws Exception {
try (InputStream is = IOUtils.toInputStream(content)) {
resourceProvider.getResource(path).save(is);
EntaxyResource resource = resourceProvider.getResource(path);
// if (encoding != null && !encoding.isEmpty()) {
// EntaxyResourceMetadata metadata = resource.getMetadata(true);
// MetadataSection metadataSection = metadata.getSection(EntaxyResourceMetadata.SECTION_RESOURCE.NAME);
// metadataSection.getContent().addProperty(ENCODING_NAME, encoding);
// metadata.update();
// }
resource.save(is);
}
}
}

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* resources-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~~~~~~
* resources-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,24 +25,32 @@
*/
package ru.entaxy.esb.resources.management.impl;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
import ru.entaxy.esb.platform.base.management.core.api.AnnotatedMBean;
import ru.entaxy.esb.resources.EntaxyResource;
import ru.entaxy.esb.resources.EntaxyResourceMetadata;
import ru.entaxy.esb.resources.EntaxyResourceService;
import ru.entaxy.esb.resources.management.EntaxyResourceServiceMBean;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.management.DynamicMBean;
import javax.management.MBeanRegistration;
import javax.management.NotCompliantMBeanException;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import org.osgi.framework.BundleContext;
import org.osgi.service.component.annotations.CollectionType;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ServiceScope;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
import ru.entaxy.esb.platform.base.management.core.api.AnnotatedMBean;
import ru.entaxy.esb.resources.EntaxyResource;
import ru.entaxy.esb.resources.EntaxyResourceMetadata;
import ru.entaxy.esb.resources.EntaxyResourceMetadata.MetadataSection;
import ru.entaxy.esb.resources.EntaxyResourceService;
import ru.entaxy.esb.resources.management.EntaxyResourceServiceMBean;
@Component(service = { EntaxyResourceServiceMBean.class, DynamicMBean.class, MBeanRegistration.class }, property = {
ManagementCore.JMX_OBJECTNAME + "=" + ManagementCore.Q_RUNTIME_S + "," + EntaxyResourceServiceMBean.RESOURCE_SERVICE_KEY + "="
@@ -50,6 +58,8 @@ import java.util.ArrayList;
public class EntaxyResourceServiceMBeanImpl extends AnnotatedMBean<EntaxyResourceServiceMBean>
implements EntaxyResourceServiceMBean {
protected static final String ENCODING_NAME = "encoding";
private static final Logger log = LoggerFactory.getLogger(EntaxyResourceServiceMBeanImpl.class);
protected BundleContext bundleContext;
@@ -65,7 +75,27 @@ public class EntaxyResourceServiceMBeanImpl extends AnnotatedMBean<EntaxyResourc
@Override
public String getResource(String location) throws Exception {
return entaxyResourceService.getResource(location).getAsString();
return getResourceWithEncoding(location, null);
}
@Override
public String getResourceWithEncoding(String location, String encoding) throws Exception {
EntaxyResource resource = entaxyResourceService.getResource(location);
if (encoding == null || encoding.isEmpty()) {
EntaxyResourceMetadata metadata = resource.getMetadata();
if (metadata != null) {
MetadataSection metadataSection = metadata.getSection(EntaxyResourceMetadata.SECTION_RESOURCE.NAME);
if (metadataSection != null) {
encoding = metadataSection.getContent().has(ENCODING_NAME)
? metadataSection.getContent().get(ENCODING_NAME).getAsString()
: StandardCharsets.UTF_8.toString();
}
}
}
return resource.getAsString(encoding);
}
@Override

View File

@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* resources-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