release version 1.10.0

This commit is contained in:
2024-10-07 18:42:55 +03:00
parent 2034182607
commit a5088587f7
1501 changed files with 28818 additions and 59966 deletions

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
<artifactId>infrastructure</artifactId>
<version>1.9.0</version>
<version>1.10.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.platform.runtime.core.infrastructure</groupId>
<artifactId>schema</artifactId>
<version>1.9.0</version>
<version>1.10.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* schema-api
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-api
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-api
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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

@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.platform.runtime.core.infrastructure</groupId>
<artifactId>schema</artifactId>
<version>1.9.0</version>
<version>1.10.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -17,8 +17,6 @@
<properties>
<bundle.osgi.export.service>org.apache.camel.spi.ComponentResolver;component=schema</bundle.osgi.export.service>
<bundle.osgi.import.pkg>
ru.entaxy.esb.system.common.osgi,
ru.entaxy.esb.system.common.osgi.impl,
javax.persistence;version="[2,3)",
*
</bundle.osgi.import.pkg>
@ -41,12 +39,13 @@
<artifactId>schema-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.system.commons</groupId>
<artifactId>system-commons</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
<artifactId>base-support</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* schema-component
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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,7 @@ import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.component.exception.SchemaNotFoundException;
import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.component.util.SchemaReaderFromDB;
import ru.entaxy.platform.base.support.xml.CommonXMLUtils;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
@ -184,9 +185,8 @@ public class ValidatingProcessor implements AsyncProcessor {
private String getNamespace(Source source) throws ParserConfigurationException, IOException, SAXException {
StreamSource domSource = (StreamSource) source;
domSource.getInputStream();
DocumentBuilderFactory factory = CommonXMLUtils.newDocumentBuilderFactoryInstance();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(domSource.getInputStream());

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* schema-component
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-component
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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
@ -36,9 +36,10 @@ import org.apache.camel.spi.UriPath;
import org.apache.camel.support.DefaultEndpoint;
import org.osgi.framework.FrameworkUtil;
import org.w3c.dom.ls.LSResourceResolver;
import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.component.util.SchemaReaderFromDB;
import ru.entaxy.esb.system.common.osgi.OSGIUtils;
import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.api.ResourceService;
import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.component.util.SchemaReaderFromDB;
import ru.entaxy.platform.base.support.osgi.OSGIUtils;
@UriEndpoint(
scheme = "validatorWithDBStorage",
@ -57,8 +58,8 @@ public class ValidatorWithDBStorageEndpoint extends DefaultEndpoint {
@Metadata(required = true)
private String version;
/**
* We need a one-to-one relation between endpoint and schema reader in order
* to be able to clear the cached schema in the schema reader. See method
* We need a one-to-one relation between endpoint and schema reader in order to be able to clear
* the cached schema in the schema reader. See method
*/
private final SchemaReaderFromDB schemaReaderFromDB;
private volatile boolean schemaReaderConfigured;
@ -68,9 +69,10 @@ public class ValidatorWithDBStorageEndpoint extends DefaultEndpoint {
public ValidatorWithDBStorageEndpoint(String uri, Component component) {
super(uri, component);
this.uri = uri.replace("validatorWithDBStorage://", "").replace("validatorWithDBStorage:", "").replace("validatorWithDBStorage", "");
schemaReaderFromDB = this.uri.isEmpty() ? new SchemaReaderFromDB() :
new SchemaReaderFromDB(getCamelContext(), this.uri, version);
this.uri = uri.replace("validatorWithDBStorage://", "").replace("validatorWithDBStorage:", "")
.replace("validatorWithDBStorage", "");
schemaReaderFromDB = this.uri.isEmpty() ? new SchemaReaderFromDB()
: new SchemaReaderFromDB(getCamelContext(), this.uri, version);
}
public Producer createProducer() throws Exception {
@ -111,18 +113,18 @@ public class ValidatorWithDBStorageEndpoint extends DefaultEndpoint {
public ResourceService getResourceService() {
if (resourceService == null) {
resourceService = (ResourceService) OSGIUtils.getServiceReference(
resourceService = (ResourceService) OSGIUtils.getService(
FrameworkUtil.getBundle(ValidatorWithDBStorageEndpoint.class).getBundleContext(),
ResourceService.class.getName());
ResourceService.class);
}
return resourceService;
}
private LSResourceResolver getResourceResolver() {
if (resourceResolver == null) {
resourceResolver = (LSResourceResolver) OSGIUtils.getServiceReference(
resourceResolver = (LSResourceResolver) OSGIUtils.getService(
FrameworkUtil.getBundle(ValidatorWithDBStorageEndpoint.class).getBundleContext(),
LSResourceResolver.class.getName());
LSResourceResolver.class);
}
return resourceResolver;
}

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* schema-component
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-component
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-component
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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
@ -190,6 +190,15 @@ public class SchemaReaderFromDB {
public SchemaFactory createSchemaFactory() {
SchemaFactory factory = SchemaFactory.newInstance(schemaLanguage);
//Prohibit the use of all protocols by external entities
try {
factory.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, "");
factory.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
} catch (SAXException e) {
LOG.warn(e.getMessage(), e);
}
if (getResourceResolver() != null) {
factory.setResourceResolver(getResourceResolver());
}

View File

@ -2,7 +2,7 @@
# ~~~~~~licensing~~~~~~
# schema-component
# ==========
# Copyright (C) 2020 - 2023 EmDev LLC
# Copyright (C) 2020 - 2024 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,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>ru.entaxy.esb.platform.runtime.core.infrastructure</groupId>
<artifactId>schema</artifactId>
<version>1.9.0</version>
<version>1.10.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -52,12 +53,12 @@
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>${xerces.version}</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
@ -68,11 +69,11 @@
<artifactId>camel-cxf</artifactId>
</dependency>
<dependency>
<groupId>
ru.entaxy.esb.platform.runtime.core.infrastructure.schema
</groupId>
<artifactId>schema-api</artifactId>
<version>${project.version}</version>
<groupId>
ru.entaxy.esb.platform.runtime.core.infrastructure.schema
</groupId>
<artifactId>schema-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
@ -84,50 +85,71 @@
<artifactId>org.osgi.service.component.annotations</artifactId>
<version>${org.osgi.annotations}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
<artifactId>resources-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
<artifactId>resources-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
<artifactId>resources-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-wsdl</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core.object-producing</groupId>
<artifactId>object-producer-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core.object-producing</groupId>
<artifactId>object-producer-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
<artifactId>core-support-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
<artifactId>core-support-design</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>${swagger.v3.version}</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
<artifactId>resources-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
<artifactId>resources-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base.resources</groupId>
<artifactId>resources-service</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-wsdl</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core.object-producing</groupId>
<artifactId>object-producer-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core.object-producing</groupId>
<artifactId>object-producer-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
<artifactId>core-support-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
<artifactId>core-support-design</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator</artifactId>
<version>${openapi-generator.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>${swagger.v3.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>${icu4j.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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,23 +30,21 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
import java.util.Map.Entry;
import javax.wsdl.WSDLException;
import org.apache.cxf.BusException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.openapitools.codegen.languages.JavaCXFServerCodegen;
import org.openapitools.codegen.utils.CamelizeOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.ibm.icu.text.Transliterator;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.Operation;
@ -76,6 +74,8 @@ public class OpenApiResourceProcessor implements EntaxyResourceProcessor {
protected static final String YAML_EXTENSION = "yaml";
protected static final String JSON_EXTENSION = "json";
public static final String CYRILLIC_TO_LATIN = "Russian-Latin/BGN";
protected static class OpenApiPostprocessor implements EntaxyOpenApiGenerator.GenerationCallback {
private static final String GENERATED_RESOURCES = "generatedResources";
@ -87,9 +87,12 @@ public class OpenApiResourceProcessor implements EntaxyResourceProcessor {
protected String resourcesRootLocation = "";
protected String resourcesLocation = "";
protected Set<String> reservedWords;
public OpenApiPostprocessor(EntaxyResource entaxyResource) {
this.entaxyResource = entaxyResource;
this.setReservedWordsLowerCase(Arrays.asList("object", "list", "file", "localVarPath", "localVarQueryParams", "localVarCollectionQueryParams", "localVarHeaderParams", "localVarCookieParams", "localVarFormParams", "localVarPostBody", "localVarAccepts", "localVarAccept", "localVarContentTypes", "localVarContentType", "localVarAuthNames", "localReturnType", "ApiClient", "ApiException", "ApiResponse", "Configuration", "StringUtil", "abstract", "continue", "for", "new", "switch", "assert", "default", "if", "package", "synchronized", "boolean", "do", "goto", "private", "this", "break", "double", "implements", "protected", "throw", "byte", "else", "import", "public", "throws", "case", "enum", "instanceof", "return", "transient", "catch", "extends", "int", "short", "try", "char", "final", "interface", "static", "void", "class", "finally", "long", "strictfp", "volatile", "const", "float", "native", "super", "while", "null"));
}
public void process() {
@ -113,7 +116,7 @@ public class OpenApiResourceProcessor implements EntaxyResourceProcessor {
if (f != null) {
url = f.getAbsolutePath();
generator.setRootFolder(rootFolder);
}
}
generator.setUrl(url);
generator.setCallback(this);
@ -176,6 +179,12 @@ public class OpenApiResourceProcessor implements EntaxyResourceProcessor {
this.metadata.update();
}
generator.clean();
Path rootFolderPath = Paths.get(System.getProperty("karaf.home"), "temp", rootFolder);
try {
FileUtils.deleteDirectory(rootFolderPath.toAbsolutePath().toFile());
} catch (Exception e) {
log.error(String.format("Error deleting resource: [%s]->[%s]", url, rootFolderPath), e);
}
}
@Override
@ -189,10 +198,10 @@ public class OpenApiResourceProcessor implements EntaxyResourceProcessor {
.toLowerCase());
generationResult.generator.setApiVersionConverted(
api.getInfo().getVersion().replace('.', '_'));
generationResult.generator.setApiPackage(
"entaxy.runtime.service."
+ generationResult.generator.getApiTitleConverted()
+ ".v_" + generationResult.generator.getApiVersionConverted() );
generationResult.generator.setApiPackage(translit("entaxy.runtime.service."
+ generationResult.generator.getApiTitleConverted()
+ ".v_" + generationResult.generator.getApiVersionConverted())
);
processOpenApi(api);
}
break;
@ -200,6 +209,18 @@ public class OpenApiResourceProcessor implements EntaxyResourceProcessor {
}
}
//TODO It makes sense to make a separate common util and put it there
private String translit(String in) {
//substitute ё, ъ, ь first
in = in.replaceAll("ё", "е");
in = in.replaceAll("ъ", "");
in = in.replaceAll("ь", "");
in = in.replaceAll("ы", "");
Transliterator toLatinTrans = Transliterator.getInstance(CYRILLIC_TO_LATIN);
String result = toLatinTrans.transliterate(in);
return result;
}
protected void processOpenApi(OpenAPI api) {
this.metadata = entaxyResource.getMetadata(true);
this.metadataSection = this.metadata.getSection(OpenApiResourceMetadata.SECTION_NAME);
@ -207,25 +228,71 @@ public class OpenApiResourceProcessor implements EntaxyResourceProcessor {
JsonObject info = new JsonObject();
info.addProperty("title", api.getInfo().getTitle());
info.addProperty("version", api.getInfo().getVersion());
// JsonArray operations = new JsonArray();
JsonObject operationData = getOperationData(api);
this.metadataSection.getContent().add(OpenApiResourceMetadata.PROPERTIES.INFO, info);
this.metadataSection.getContent().add(OpenApiResourceMetadata.PROPERTIES.OPERATIONS, operationData);
this.resourcesLocation = (this.resourcesRootLocation
+ "/" + translit(api.getInfo().getTitle().replace(' ', '_'))
+ "/" + api.getInfo().getVersion().replace(' ', '_'))
.replace("//", "/");
this.metadataSection.getContent().addProperty(WSDLResourceMetadata.PROPERTIES.SERVICE_RESOURCES_ROOT, this.resourcesLocation);
}
@NotNull
private JsonObject getOperationData(OpenAPI api) {
JsonObject operationData = new JsonObject();
for (Entry<String, PathItem> entry: api.getPaths().entrySet()) {
JsonObject pathData = new JsonObject();
Map<HttpMethod, Operation> operationMap = entry.getValue().readOperationsMap();
for (Entry<HttpMethod, Operation> oper: operationMap.entrySet()) {
pathData.addProperty(oper.getKey().name(), oper.getValue().getOperationId());
JsonObject operationId = new JsonObject();
String operation = oper.getValue().getOperationId();
if (oper.getValue().getOperationId() == null) {
operation = entry.getKey() + "/" + oper.getKey().name().toLowerCase();
}
operationId.addProperty("original", oper.getValue().getOperationId());
operationId.addProperty("operationIdCamelCase", toCamelCase(operation));
pathData.add(oper.getKey().name(), operationId);
}
operationData.add(entry.getKey(), pathData);
}
this.metadataSection.getContent().add(OpenApiResourceMetadata.PROPERTIES.INFO, info);
this.metadataSection.getContent().add(OpenApiResourceMetadata.PROPERTIES.OPERATIONS, operationData);
this.resourcesLocation = (this.resourcesRootLocation
+ "/" + api.getInfo().getTitle().replace(' ', '_')
+ "/" + api.getInfo().getVersion().replace(' ', '_'))
.replace("//", "/");
this.metadataSection.getContent().addProperty(WSDLResourceMetadata.PROPERTIES.SERVICE_RESOURCES_ROOT, this.resourcesLocation);
return operationData;
}
protected String toCamelCase(String operationId) {
JavaCXFServerCodegen javaCXFServerCodegen = new JavaCXFServerCodegen();
String operationIdToCamelCase = javaCXFServerCodegen.removeNonNameElementToCamelCase(operationId);
if (StringUtils.isEmpty(operationIdToCamelCase)) {
throw new RuntimeException("Empty method/operation name (operationId) not allowed");
} else {
operationId = org.openapitools.codegen.utils.StringUtils.camelize(javaCXFServerCodegen.sanitizeName(operationIdToCamelCase), CamelizeOption.LOWERCASE_FIRST_LETTER);
if (isReservedWord(operationId)) {
String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, CamelizeOption.LOWERCASE_FIRST_LETTER);
log.warn("{} (reserved word) cannot be used as method name. Renamed to {}", operationId, newOperationId);
return newOperationId;
} else {
if (operationId.matches("^\\d.*")) {
log.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId), true);
operationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, CamelizeOption.LOWERCASE_FIRST_LETTER);
}
return operationId;
}
}
}
protected boolean isReservedWord(String word) {
return word != null && this.reservedWords.contains(word.toLowerCase(Locale.ROOT));
}
protected void setReservedWordsLowerCase(List<String> words) {
reservedWords = new HashSet<>();
for (String word : words) {
reservedWords.add(word.toLowerCase(Locale.ROOT));
}
}
protected void generateResources(EntaxyResource resource, EntaxyResourceMetadata meta) {
@ -281,7 +348,7 @@ public class OpenApiResourceProcessor implements EntaxyResourceProcessor {
continue;
EntaxyResource.RESOURCE_SCOPE scope = RESOURCE_SCOPE.DESIGN;
try {
scope = RESOURCE_SCOPE.valueOf(g.getProperties().getOrDefault("acope", "design").toString().toUpperCase());
scope = RESOURCE_SCOPE.valueOf(g.getProperties().getOrDefault("scope", "design").toString().toUpperCase());
} catch (Exception e) {
// use default value
}

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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
@ -88,7 +88,7 @@ public class WSDLResourceProcessor implements EntaxyResourceProcessor {
errorData.addProperty("exception", e.getClass().getName());
errorData.addProperty("message", e.getMessage());
if (e.getCause() != null) {
errorData.addProperty("causeExceptin", e.getCause().getClass().getName());
errorData.addProperty("causeException", e.getCause().getClass().getName());
errorData.addProperty("causeMessage", e.getCause().getMessage());
}
wsdlSection.getContent().add("error", errorData);
@ -137,8 +137,8 @@ public class WSDLResourceProcessor implements EntaxyResourceProcessor {
JsonObject portJson = new JsonObject();
List operations = port.getBinding().getBindingOperations();
JsonArray operationNames = new JsonArray();
for (Object operattionObj: operations) {
BindingOperation operation = (BindingOperation)operattionObj;
for (Object operationObj: operations) {
BindingOperation operation = (BindingOperation)operationObj;
operationNames.add(operation.getName());
}
portJson.addProperty(WSDLResourceMetadata.PROPERTIES.SERVICE_PORT_NAME

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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,62 +0,0 @@
/*-
* ~~~~~~licensing~~~~~~
* schema-impl
* ==========
* Copyright (C) 2020 - 2023 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.platform.runtime.core.infrastructure.schema.resolver.resource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.api.ResourceService;
import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.api.entity.Resource;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamSource;
import java.io.ByteArrayInputStream;
import java.util.Optional;
public class XslUrlResolver implements URIResolver {
private static final Log LOG = LogFactory.getLog(XslUrlResolver.class);
private ResourceService resourceService;
@Override
public Source resolve(String href, String base) throws TransformerException {
try {
Optional<Resource> resource = resourceService.getResourceByName(href);
if (resource.isPresent()) {
return new StreamSource(new ByteArrayInputStream(resource.get().getResourceValue()));
}
} catch (Exception e) {
LOG.error(e);
}
return null;
}
public void setResourceService(ResourceService resourceService) {
this.resourceService = resourceService;
}
}

View File

@ -3,7 +3,7 @@
~~~~~~licensing~~~~~~
schema-impl
==========
Copyright (C) 2020 - 2023 EmDev LLC
Copyright (C) 2020 - 2024 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
@ -39,21 +39,16 @@
<service ref="resourceService" interface="ru.entaxy.esb.platform.runtime.core.infrastructure.schema.api.ResourceService"/>
<bean id="cxfDBResourceResolver"
class="ru.entaxy.esb.platform.runtime.core.infrastructure.schema.resolver.resource.CxfDBResourceResolver">
<property name="resourceService" ref="resourceService"/>
</bean>
<service ref="cxfDBResourceResolver" interface="org.apache.cxf.resource.ResourceResolver"/>
<!-- <bean id="cxfDBResourceResolver"-->
<!-- class="ru.entaxy.esb.platform.runtime.core.infrastructure.schema.resolver.resource.CxfDBResourceResolver">-->
<!-- <property name="resourceService" ref="resourceService"/>-->
<!-- </bean>-->
<!-- <service ref="cxfDBResourceResolver" interface="org.apache.cxf.resource.ResourceResolver"/>-->
<bean id="dbResourceResolver" class="ru.entaxy.esb.platform.runtime.core.infrastructure.schema.resolver.resource.DBResourceResolver">
<property name="resourceService" ref="resourceService"/>
</bean>
<service ref="dbResourceResolver" interface="org.w3c.dom.ls.LSResourceResolver"/>
<bean id="xslUrlResolver" class="ru.entaxy.esb.platform.runtime.core.infrastructure.schema.resolver.resource.XslUrlResolver">
<property name="resourceService" ref="resourceService"/>
</bean>
<service ref="xslUrlResolver" interface="javax.xml.transform.URIResolver"/>
<!-- <bean id="dbResourceResolver" class="ru.entaxy.esb.platform.runtime.core.infrastructure.schema.resolver.resource.DBResourceResolver">-->
<!-- <property name="resourceService" ref="resourceService"/>-->
<!-- </bean>-->
<!-- <service ref="dbResourceResolver" interface="org.w3c.dom.ls.LSResourceResolver"/>-->
<!-- RESOURCE PROVIDER -->

View File

@ -3,7 +3,7 @@
~~~~~~licensing~~~~~~
schema-impl
==========
Copyright (C) 2020 - 2023 EmDev LLC
Copyright (C) 2020 - 2024 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

@ -3,7 +3,7 @@
<parent>
<groupId>ru.entaxy.esb.platform.runtime.core.infrastructure</groupId>
<artifactId>schema</artifactId>
<version>1.9.0</version>
<version>1.10.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
* schema-soap
* ==========
* Copyright (C) 2020 - 2023 EmDev LLC
* Copyright (C) 2020 - 2024 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~~~~~~
# karaf-features
# ==========
# Copyright (C) 2020 - 2023 EmDev LLC
# Copyright (C) 2020 - 2024 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

@ -3,7 +3,7 @@
~~~~~~licensing~~~~~~
schema-soap
==========
Copyright (C) 2020 - 2023 EmDev LLC
Copyright (C) 2020 - 2024 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