release version 1.11.0
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime</groupId>
|
||||
<artifactId>base</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<version>1.11.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>resources</artifactId>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>resources</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<version>1.11.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
|
||||
<artifactId>resources-api</artifactId>
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -26,6 +26,7 @@
|
||||
package ru.entaxy.esb.resources;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface EntaxyResourceService {
|
||||
|
||||
@ -35,6 +36,7 @@ public interface EntaxyResourceService {
|
||||
|
||||
EntaxyResource getResource(String location);
|
||||
List<EntaxyResource> getResources(String location);
|
||||
Map<String, EntaxyResourceProvider> getProviders();
|
||||
|
||||
boolean isProtocolAvailable(String protocol);
|
||||
|
||||
|
@ -0,0 +1,96 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-api
|
||||
* ==========
|
||||
* 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.esb.resources;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
public class EntaxyResourceURLFactory {
|
||||
|
||||
private EntaxyResourceURLFactory() {
|
||||
|
||||
}
|
||||
|
||||
public static final String DEFAULT_GLOBAL_PROTOCOL = "entaxy-resource";
|
||||
|
||||
public static URI getLocalUri(String resourceUrl) throws URISyntaxException {
|
||||
return getLocalUri(resourceUrl, DEFAULT_GLOBAL_PROTOCOL);
|
||||
}
|
||||
|
||||
public static URI getLocalUri(String resourceUrl, String globalProtocol) throws URISyntaxException {
|
||||
String prefix = globalProtocol.concat("://");
|
||||
String result = resourceUrl;
|
||||
if (resourceUrl.startsWith(prefix))
|
||||
result = resourceUrl.substring(prefix.length());
|
||||
int index = result.indexOf(":");
|
||||
if (index > 0)
|
||||
return new URI(result);
|
||||
index = result.indexOf("/");
|
||||
if (index <= 0)
|
||||
return new URI(result);
|
||||
return new URI(result.substring(0, index).concat(":").concat(result.substring(index + 1)));
|
||||
|
||||
}
|
||||
|
||||
public static URL getGlobalUrl(EntaxyResource resource) throws MalformedURLException {
|
||||
return getGlobalUrl(resource, DEFAULT_GLOBAL_PROTOCOL);
|
||||
}
|
||||
|
||||
public static URL getGlobalUrl(String resourceUrl) throws MalformedURLException {
|
||||
return getGlobalUrl(resourceUrl, DEFAULT_GLOBAL_PROTOCOL);
|
||||
}
|
||||
|
||||
public static URL getGlobalUrl(EntaxyResource resource, String globalProtocol) throws MalformedURLException {
|
||||
return getGlobalUrl(resource.getURL(), globalProtocol);
|
||||
}
|
||||
|
||||
public static URL getGlobalUrl(String resourceUrl, String globalProtocol) throws MalformedURLException {
|
||||
if (resourceUrl.startsWith(globalProtocol + "://"))
|
||||
return new URL(resourceUrl);
|
||||
|
||||
String localProtocol = "";
|
||||
String resourcePath = resourceUrl;
|
||||
|
||||
int index = resourceUrl.indexOf(':');
|
||||
if (index > 0) {
|
||||
localProtocol = resourceUrl.substring(0, index);
|
||||
resourcePath = resourceUrl.substring(index + 1);
|
||||
}
|
||||
|
||||
while (resourcePath.startsWith("/"))
|
||||
resourcePath = resourcePath.substring(1);
|
||||
|
||||
String resultPath = localProtocol.length() > 0 ? localProtocol.concat("/").concat(resourcePath) : resourcePath;
|
||||
|
||||
while (resultPath.startsWith("/"))
|
||||
resultPath = resultPath.substring(1);
|
||||
|
||||
return new URL(globalProtocol.concat("://").concat(resultPath));
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>resources</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<version>1.11.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
|
||||
<artifactId>resources-management</artifactId>
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -51,4 +51,8 @@ public interface EntaxyResourceProviderMBean {
|
||||
void removeResource(
|
||||
@Parameter(name = "path", desc = "Path or location of the resource") String path) throws Exception;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -30,6 +30,7 @@ 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)
|
||||
@ -47,4 +48,7 @@ public interface EntaxyResourceServiceMBean {
|
||||
Map<String, String> getResourceMetadata(
|
||||
@Parameter(name = "location", desc = "Location of the resource") String location) throws Exception;
|
||||
|
||||
@Operation(desc = "Get a list of providers")
|
||||
List<String> listProviders() throws Exception;
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -107,11 +107,25 @@ public class EntaxyResourceProviderMBeanImpl extends AnnotatedMBean<EntaxyResour
|
||||
}
|
||||
|
||||
EntaxyResource sourceResource = ServiceHelper.INSTANCE.entaxyResourceService.getResource(from);
|
||||
pasteResource(sourceResource, to);
|
||||
}
|
||||
|
||||
private void pasteResource(EntaxyResource sourceResource, String to) throws Exception {
|
||||
if (sourceResource.exists()) {
|
||||
try (InputStream is = sourceResource.getInputStream()) {
|
||||
EntaxyResource targetResource = resourceProvider.getResource(to);
|
||||
targetResource.save(is);
|
||||
if (sourceResource.isFolder()) {
|
||||
List<EntaxyResource> resources = ServiceHelper.INSTANCE.entaxyResourceService
|
||||
.getResources(sourceResource.getURL());
|
||||
for(EntaxyResource resource : resources) {
|
||||
pasteResource(resource, to + '/' + resource.getName());
|
||||
}
|
||||
} else {
|
||||
try (InputStream is = sourceResource.getInputStream()) {
|
||||
EntaxyResource targetResource = resourceProvider.getResource(to);
|
||||
targetResource.save(is);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new IllegalArgumentException("Resource located at [" + sourceResource.getURL() + "] is not found");
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,4 +141,11 @@ public class EntaxyResourceProviderMBeanImpl extends AnnotatedMBean<EntaxyResour
|
||||
resourceProvider.getResource(path).delete();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveResource(String path, String content) throws Exception {
|
||||
try (InputStream is = IOUtils.toInputStream(content)) {
|
||||
resourceProvider.getResource(path).save(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -41,6 +41,8 @@ import javax.management.MBeanRegistration;
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Component(service = { EntaxyResourceServiceMBean.class, DynamicMBean.class, MBeanRegistration.class }, property = {
|
||||
ManagementCore.JMX_OBJECTNAME + "=" + ManagementCore.Q_RUNTIME_S + "," + EntaxyResourceServiceMBean.RESOURCE_SERVICE_KEY + "="
|
||||
@ -80,4 +82,9 @@ public class EntaxyResourceServiceMBeanImpl extends AnnotatedMBean<EntaxyResourc
|
||||
throw new Exception("Metadata is not present");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> listProviders() {
|
||||
return new ArrayList<>(entaxyResourceService.getProviders().keySet());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,50 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-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.esb.resources.management.impl;
|
||||
|
||||
import org.osgi.service.component.annotations.*;
|
||||
import ru.entaxy.esb.resources.EntaxyResourceService;
|
||||
|
||||
@Component(service = ServiceHelper.class, immediate = true)
|
||||
public class ServiceHelper {
|
||||
|
||||
public static ServiceHelper INSTANCE;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public EntaxyResourceService entaxyResourceService;
|
||||
|
||||
@Activate
|
||||
public void activate() {
|
||||
INSTANCE = this;
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {
|
||||
INSTANCE = null;
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>resources</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<version>1.11.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
|
||||
<artifactId>resources-service</artifactId>
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -33,6 +33,7 @@ import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
@ -112,7 +113,9 @@ public class EntaxyResourceServiceImpl implements EntaxyResourceService {
|
||||
return null;
|
||||
String location = resourceLocation;
|
||||
try {
|
||||
location = EntaxyResourceURLFactory.getLocalUri(resourceLocation).toString();
|
||||
location = EntaxyResourceURLFactory
|
||||
.getLocalUri(resourceLocation.replaceAll(" ", "%20")).toString()
|
||||
.replaceAll("%20", " ");
|
||||
} catch (URISyntaxException e) {
|
||||
log.warn(String.format("Failed getting local URI for [%s]", resourceLocation), e);
|
||||
}
|
||||
@ -137,7 +140,9 @@ public class EntaxyResourceServiceImpl implements EntaxyResourceService {
|
||||
|
||||
String location = resourceLocation;
|
||||
try {
|
||||
location = EntaxyResourceURLFactory.getLocalUri(resourceLocation).toString();
|
||||
location = EntaxyResourceURLFactory
|
||||
.getLocalUri(resourceLocation.replaceAll(" ", "%20")).toString()
|
||||
.replaceAll("%20", " ");
|
||||
} catch (URISyntaxException e) {
|
||||
log.warn(String.format("Failed getting local URI for [%s]", resourceLocation), e);
|
||||
}
|
||||
@ -166,6 +171,11 @@ public class EntaxyResourceServiceImpl implements EntaxyResourceService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, EntaxyResourceProvider> getProviders() {
|
||||
return controller.getProviders();
|
||||
}
|
||||
|
||||
protected void updateResourceTimestamp(EntaxyResource resource, String timestamp) {
|
||||
if (resource == null)
|
||||
return;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -74,6 +74,10 @@ public class ProvidersController {
|
||||
return this.providers.getOrDefault(protocol, null);
|
||||
}
|
||||
|
||||
public Map<String, EntaxyResourceProvider> getProviders() {
|
||||
return this.providers;
|
||||
}
|
||||
|
||||
public void registerProtocolCallback(String protocol, EntaxyResourceProtocolAvailableCallback callback) {
|
||||
if (!callbacks.containsKey(protocol))
|
||||
callbacks.put(protocol, new ArrayList<>());
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -239,6 +239,8 @@ public class FileResourceProvider extends AbstractResourceProvider {
|
||||
|
||||
@Override
|
||||
protected void deleteMatadata() {
|
||||
if (!metadataInited)
|
||||
initMetadata();
|
||||
deleteFile(metadataFile);
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* schema-impl
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
@ -79,18 +79,23 @@ public class ResourceProvider {
|
||||
int splitIndex = path.indexOf("/");
|
||||
String protocol = splitIndex > 0
|
||||
? path.substring(0, splitIndex)
|
||||
: "";
|
||||
: path;
|
||||
|
||||
if (splitIndex > 0)
|
||||
path = path.substring(splitIndex + 1);
|
||||
else
|
||||
path = "";
|
||||
|
||||
if (!CommonUtils.isValid(protocol) || !CommonUtils.isValid(resourceName))
|
||||
if (!CommonUtils.isValid(protocol) || !CommonUtils.isValid(resourceName)) {
|
||||
log.warn("Incorrect resource URL: [{}]", entry.toString());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!resources.containsKey(protocol))
|
||||
resources.put(protocol, new ArrayList<>());
|
||||
|
||||
resources.get(protocol).add(new ResourceDescriptor(entry, path + "/" + resourceName));
|
||||
resources.get(protocol)
|
||||
.add(new ResourceDescriptor(entry, (CommonUtils.isValid(path) ? path + "/" : "") + resourceName));
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* resources-service
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* 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
|
||||
|
Reference in New Issue
Block a user