diff --git a/smp-docker/images/tomcat-mysql-smp-sml/Dockerfile b/smp-docker/images/tomcat-mysql-smp-sml/Dockerfile index c3f774207761f0ce18bcd6889e07a66a1369e3fe..2937ad03582b7da9381d0b3332633ed431988c79 100755 --- a/smp-docker/images/tomcat-mysql-smp-sml/Dockerfile +++ b/smp-docker/images/tomcat-mysql-smp-sml/Dockerfile @@ -20,10 +20,10 @@ ENV SMP_HOME=/opt/smp \ SMP_DB_USER_PASSWORD=smp \ MYSQL_ROOT_PASSWORD=root \ # sml environment variables - SML_VERSION=4.0.1 \ + SML_VERSION=4.2.RC1 \ SML_DISTRIBUTION_URL=https://ec.europa.eu/digital-building-blocks/artifact/repository/public/eu/europa/ec/bdmsl/bdmsl-webapp/ \ - SML_SHA512=b40d6ff717216635839e420f467b9dbf5cab87582babc103dea3ed7cbb0fd264f0755fc95607bb3d5ddbcd976a13f0d2170cbf824b3dfebb2ca046579a5d5278 \ - SML_SETUP_SHA512=dee04b6c60696c052f4807cc24df72a09dd7443e1c87df82967b08a02381c3042af338f726bc60f40e9428de301af8c317839d286ac58e37b5c7c6ae36c42468 \ + SML_SHA512=2330e6caf557fd6a6e8725eb339c26cb2d06f0ca768fd1766989f5dec7557e41375ef61b65cad5d87fa478f3c468272880ebe8521bb66e8e7dee9bb16d0a3d51 \ + SML_SETUP_SHA512=f9b7a9607f34f2d547acac13e7044df04fdf616b163f4cae8788f7b1eccd837c3db947458b4f55273d263f6af2e794c18d5216484cc8132e3cfd2dc176d9e1bf \ SML_DB_SCHEMA=sml \ SML_DB_USER=sml \ SML_DB_USER_PASSWORD=sml \ diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverter.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverter.java index bbce5f4f957c5d074bace39e690d3af07095c014..b4b8dde29a5513a4e38116f12783f954335c1821 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverter.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/conversion/ServiceGroupConverter.java @@ -18,7 +18,6 @@ import eu.europa.ec.edelivery.smp.exceptions.ErrorCode; import eu.europa.ec.edelivery.smp.exceptions.SMPRuntimeException; import eu.europa.ec.edelivery.smp.logging.SMPLogger; import eu.europa.ec.edelivery.smp.logging.SMPLoggerFactory; -import eu.europa.ec.smp.api.Identifiers; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.exception.ExceptionUtils; import org.oasis_open.docs.bdxr.ns.smp._2016._05.ExtensionType; @@ -53,22 +52,22 @@ public class ServiceGroupConverter { /** * Class has only static members. */ - private ServiceGroupConverter() { + private ServiceGroupConverter() { } private static final String PARSER_DISALLOW_DTD_PARSING_FEATURE = "http://apache.org/xml/features/disallow-doctype-decl"; private static final SMPLogger LOG = SMPLoggerFactory.getLogger(ServiceGroupConverter.class); - private static final ThreadLocal<Unmarshaller> jaxbUnmarshaller = ThreadLocal.withInitial( () -> { + private static final ThreadLocal<Unmarshaller> jaxbUnmarshaller = ThreadLocal.withInitial(() -> { try { JAXBContext jaxbContext = JAXBContext.newInstance(ServiceGroup.class); return jaxbContext.createUnmarshaller(); - }catch(JAXBException ex) { + } catch (JAXBException ex) { LOG.error("Error occurred while initializing JAXBContext for ServiceMetadata. Cause message:", ex); } return null; - } ); + }); private static Unmarshaller getUnmarshaller() { @@ -77,6 +76,7 @@ public class ServiceGroupConverter { /** * Method umarshal ServiceGroup from xml string + * * @param serviceGroupXml * @return */ @@ -85,12 +85,13 @@ public class ServiceGroupConverter { Document serviceGroupDoc = parse(serviceGroupXml); return getUnmarshaller().unmarshal(serviceGroupDoc, ServiceGroup.class).getValue(); } catch (ParserConfigurationException | IOException | SAXException | JAXBException ex) { - throw new SMPRuntimeException(ErrorCode.XML_PARSE_EXCEPTION,ex,ServiceGroup.class.getName(), ExceptionUtils.getRootCauseMessage(ex)); + throw new SMPRuntimeException(ErrorCode.XML_PARSE_EXCEPTION, ex, ServiceGroup.class.getName(), ExceptionUtils.getRootCauseMessage(ex)); } } /** * Method umarshal ServiceGroup from xml bytearraz + * * @param serviceGroupXml * @return */ @@ -99,7 +100,7 @@ public class ServiceGroupConverter { try { System.out.println("UNMARSHAL SERVICE GROUP " + new String(serviceGroupXml)); Document serviceGroupDoc = parse(serviceGroupXml); - ServiceGroup serviceGroup = getUnmarshaller().unmarshal(serviceGroupDoc, ServiceGroup.class).getValue(); + ServiceGroup serviceGroup = getUnmarshaller().unmarshal(serviceGroupDoc, ServiceGroup.class).getValue(); /* if (serviceGroup!=null && serviceGroup.getParticipantIdentifier()!=null && StringUtils.isBlank(serviceGroup.getParticipantIdentifier().getScheme()) @@ -113,7 +114,7 @@ public class ServiceGroupConverter { }*/ return serviceGroup; } catch (ParserConfigurationException | IOException | SAXException | JAXBException ex) { - throw new SMPRuntimeException(ErrorCode.XML_PARSE_EXCEPTION,ex,ServiceGroup.class.getName(), ExceptionUtils.getRootCauseMessage(ex)); + throw new SMPRuntimeException(ErrorCode.XML_PARSE_EXCEPTION, ex, ServiceGroup.class.getName(), ExceptionUtils.getRootCauseMessage(ex)); } } @@ -125,28 +126,28 @@ public class ServiceGroupConverter { * @param dsg - database service group entity * @return Oasis ServiceGroup entity or null if parameter is null */ - public static ServiceGroup toServiceGroup(DBServiceGroup dsg, boolean concatenateEBCoreID){ + public static ServiceGroup toServiceGroup(DBServiceGroup dsg, boolean concatenateEBCoreID) { - if (dsg==null){ + if (dsg == null) { return null; } ServiceGroup serviceGroup = new ServiceGroup(); - String schema = dsg.getParticipantScheme(); - String value = dsg.getParticipantIdentifier(); - if (concatenateEBCoreID && StringUtils.startsWithIgnoreCase(schema, EBCORE_IDENTIFIER_PREFIX) ){ + String schema = dsg.getParticipantScheme(); + String value = dsg.getParticipantIdentifier(); + if (concatenateEBCoreID && StringUtils.startsWithIgnoreCase(schema, EBCORE_IDENTIFIER_PREFIX)) { value = schema + ":" + value; schema = null; } ParticipantIdentifierType identifier = new ParticipantIdentifierType(value, schema); serviceGroup.setParticipantIdentifier(identifier); - if (dsg.getExtension()!=null){ + if (dsg.getExtension() != null) { try { List<ExtensionType> extensions = ExtensionConverter.unmarshalExtensions(dsg.getExtension()); serviceGroup.getExtensions().addAll(extensions); } catch (JAXBException e) { - throw new SMPRuntimeException(INVALID_EXTENSION_FOR_SG, e, dsg.getParticipantIdentifier(), - dsg.getParticipantScheme(),ExceptionUtils.getRootCauseMessage(e)); + throw new SMPRuntimeException(INVALID_EXTENSION_FOR_SG, e, dsg.getParticipantIdentifier(), + dsg.getParticipantScheme(), ExceptionUtils.getRootCauseMessage(e)); } } serviceGroup.setServiceMetadataReferenceCollection(new ServiceMetadataReferenceCollectionType(new ArrayList())); @@ -163,6 +164,7 @@ public class ServiceGroupConverter { InputStream inputStream = new ByteArrayInputStream(serviceGroupXml); return getDocumentBuilder().parse(inputStream); } + private static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); @@ -173,7 +175,7 @@ public class ServiceGroupConverter { public static byte[] extractExtensionsPayload(ServiceGroup sg) { try { return ExtensionConverter.marshalExtensions(sg.getExtensions()); - } catch (JAXBException | XMLStreamException | IOException e) { + } catch (JAXBException | XMLStreamException | IOException e) { throw new SMPRuntimeException(INVALID_EXTENSION_FOR_SG, e, sg.getParticipantIdentifier().getValue(), sg.getParticipantIdentifier().getScheme(), ExceptionUtils.getRootCauseMessage(e));