Skip to content

Commit

Permalink
MID-7484: transport moved to separate package transport.impl
Browse files Browse the repository at this point in the history
  • Loading branch information
virgo47 committed Feb 15, 2022
1 parent 27f26ed commit f5bf439
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.springframework.stereotype.Component;

import com.evolveum.midpoint.notifications.api.events.SimpleObjectRef;
import com.evolveum.midpoint.notifications.impl.transport.TransportUtil;
import com.evolveum.midpoint.transport.impl.TransportUtil;
import com.evolveum.midpoint.notifications.impl.formatters.TextFormatter;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.polystring.PolyString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

import com.evolveum.midpoint.notifications.api.NotificationManager;
import com.evolveum.midpoint.notifications.api.events.Event;
import com.evolveum.midpoint.notifications.api.transports.Transport;
import com.evolveum.midpoint.notifications.api.transports.TransportService;
import com.evolveum.midpoint.notifications.impl.transport.TransportUtil;
import com.evolveum.midpoint.transport.impl.TransportUtil;
import com.evolveum.midpoint.repo.api.RepositoryService;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/*
* Copyright (C) 2020-2022 Evolveum and contributors
* Copyright (C) 2010-2022 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.notifications.impl;
package com.evolveum.midpoint.transport.impl;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.annotation.PostConstruct;

import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
Expand All @@ -19,10 +20,10 @@
import com.evolveum.midpoint.notifications.api.transports.Message;
import com.evolveum.midpoint.notifications.api.transports.Transport;
import com.evolveum.midpoint.notifications.api.transports.TransportService;
import com.evolveum.midpoint.notifications.impl.transport.legacy.LegacyCustomTransport;
import com.evolveum.midpoint.notifications.impl.transport.legacy.LegacyFileTransport;
import com.evolveum.midpoint.notifications.impl.transport.legacy.LegacyMailTransport;
import com.evolveum.midpoint.notifications.impl.transport.legacy.LegacySimpleSmsTransport;
import com.evolveum.midpoint.transport.impl.legacy.LegacyCustomTransport;
import com.evolveum.midpoint.transport.impl.legacy.LegacyFileTransport;
import com.evolveum.midpoint.transport.impl.legacy.LegacyMailTransport;
import com.evolveum.midpoint.transport.impl.legacy.LegacySimpleSmsTransport;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.repo.api.SystemConfigurationChangeEvent;
import com.evolveum.midpoint.schema.result.OperationResult;
Expand Down Expand Up @@ -71,7 +72,7 @@ public void refreshTransportConfiguration(SystemConfigurationChangeEvent event)
}

private void refreshConfiguration(SystemConfigurationType systemConfiguration) {
// No need to refresh old legacy transport @Components, they read config every time.
// No need to refresh old legacy transport @Components, they read config every time.

MessageTransportConfigurationType config = systemConfiguration.getMessageTransportConfiguration();
// TODO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.notifications.impl.transport;
package com.evolveum.midpoint.transport.impl;

import java.io.FileWriter;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.notifications.impl.transport.legacy;
package com.evolveum.midpoint.transport.impl.legacy;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
Expand All @@ -22,7 +22,7 @@
import com.evolveum.midpoint.notifications.api.transports.Message;
import com.evolveum.midpoint.notifications.api.transports.Transport;
import com.evolveum.midpoint.notifications.api.transports.TransportSupport;
import com.evolveum.midpoint.notifications.impl.transport.TransportUtil;
import com.evolveum.midpoint.transport.impl.TransportUtil;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.prism.PrismPropertyDefinition;
import com.evolveum.midpoint.prism.PrismPropertyValue;
Expand All @@ -49,7 +49,7 @@ public class LegacyCustomTransport implements Transport<GeneralTransportConfigur

private static final Trace LOGGER = TraceManager.getTrace(LegacyCustomTransport.class);

public static final String NAME = "custom";
private static final String NAME = "custom";

private static final String DOT_CLASS = LegacyCustomTransport.class.getName() + ".";

Expand Down Expand Up @@ -158,8 +158,10 @@ private String formatToFile(Message mailMessage) {
}

// TODO deduplicate
private void evaluateExpression(ExpressionType expressionType, VariablesMap VariablesMap,
String shortDesc, Task task, OperationResult result) throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException, CommunicationException, ConfigurationException, SecurityViolationException {
private void evaluateExpression(
ExpressionType expressionType, VariablesMap VariablesMap, String shortDesc, Task task, OperationResult result)
throws ObjectNotFoundException, SchemaException, ExpressionEvaluationException,
CommunicationException, ConfigurationException, SecurityViolationException {

QName resultName = new QName(SchemaConstants.NS_C, "result");
PrismPropertyDefinition<String> resultDef = prismContext.definitionFactory().createPropertyDefinition(resultName, DOMUtil.XSD_STRING);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.notifications.impl.transport.legacy;
package com.evolveum.midpoint.transport.impl.legacy;

import static com.evolveum.midpoint.notifications.impl.transport.TransportUtil.formatToFileNew;
import static com.evolveum.midpoint.transport.impl.TransportUtil.formatToFileNew;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
Expand All @@ -16,7 +16,7 @@
import com.evolveum.midpoint.notifications.api.transports.Message;
import com.evolveum.midpoint.notifications.api.transports.Transport;
import com.evolveum.midpoint.notifications.api.transports.TransportSupport;
import com.evolveum.midpoint.notifications.impl.transport.TransportUtil;
import com.evolveum.midpoint.transport.impl.TransportUtil;
import com.evolveum.midpoint.prism.polystring.PolyString;
import com.evolveum.midpoint.repo.api.RepositoryService;
import com.evolveum.midpoint.schema.result.OperationResult;
Expand All @@ -33,7 +33,7 @@ public class LegacyFileTransport implements Transport<GeneralTransportConfigurat

private static final Trace LOGGER = TraceManager.getTrace(LegacyFileTransport.class);

public static final String NAME = "file";
private static final String NAME = "file";

private static final String DOT_CLASS = LegacyFileTransport.class.getName() + ".";
private static final String DEFAULT_FILE_NAME = "notifications.txt";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.notifications.impl.transport.legacy;
package com.evolveum.midpoint.transport.impl.legacy;

import static com.evolveum.midpoint.notifications.impl.transport.TransportUtil.formatToFileOld;
import static com.evolveum.midpoint.transport.impl.TransportUtil.formatToFileOld;

import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
Expand Down Expand Up @@ -36,7 +36,7 @@
import com.evolveum.midpoint.notifications.api.transports.Message;
import com.evolveum.midpoint.notifications.api.transports.Transport;
import com.evolveum.midpoint.notifications.api.transports.TransportSupport;
import com.evolveum.midpoint.notifications.impl.transport.TransportUtil;
import com.evolveum.midpoint.transport.impl.TransportUtil;
import com.evolveum.midpoint.notifications.impl.util.MimeTypeUtil;
import com.evolveum.midpoint.prism.crypto.EncryptionException;
import com.evolveum.midpoint.prism.crypto.Protector;
Expand All @@ -59,7 +59,7 @@ public class LegacyMailTransport implements Transport<GeneralTransportConfigurat

private static final Trace LOGGER = TraceManager.getTrace(LegacyMailTransport.class);

public static final String NAME = "mail";
private static final String NAME = "mail";

private static final String DOT_CLASS = LegacyMailTransport.class.getName() + ".";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.notifications.impl.transport.legacy;
package com.evolveum.midpoint.transport.impl.legacy;

import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
Expand Down Expand Up @@ -43,7 +43,7 @@
import com.evolveum.midpoint.notifications.api.transports.Message;
import com.evolveum.midpoint.notifications.api.transports.Transport;
import com.evolveum.midpoint.notifications.api.transports.TransportSupport;
import com.evolveum.midpoint.notifications.impl.transport.TransportUtil;
import com.evolveum.midpoint.transport.impl.TransportUtil;
import com.evolveum.midpoint.notifications.impl.util.HttpUtil;
import com.evolveum.midpoint.prism.MutablePrismPropertyDefinition;
import com.evolveum.midpoint.prism.PrismContext;
Expand Down Expand Up @@ -75,7 +75,7 @@ public class LegacySimpleSmsTransport implements Transport<GeneralTransportConfi

private static final Trace LOGGER = TraceManager.getTrace(LegacySimpleSmsTransport.class);

public static final String NAME = "sms";
private static final String NAME = "sms";

private static final String DOT_CLASS = LegacySimpleSmsTransport.class.getName() + ".";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2017 Evolveum and contributors
~ Copyright (C) 2010-2022 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="false" default-autowire="byName">
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="false">

<context:annotation-config/>
<context:component-scan base-package="com.evolveum.midpoint.notifications.impl"/>
<context:component-scan base-package="com.evolveum.midpoint.transport.impl"/>
<context:spring-configured/>

</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.testng.annotations.Test;
import org.xml.sax.SAXException;

import com.evolveum.midpoint.notifications.impl.transport.TransportUtil;
import com.evolveum.midpoint.transport.impl.TransportUtil;
import com.evolveum.midpoint.prism.util.PrismTestUtil;
import com.evolveum.midpoint.repo.common.expression.ExpressionFactory;
import com.evolveum.midpoint.schema.MidPointPrismContextFactory;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2010-2017 Evolveum and contributors
~ Copyright (C) 2010-2022 Evolveum and contributors
~
~ This work is dual-licensed under the Apache License 2.0
~ and European Union Public License. See LICENSE file for details.
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
default-lazy-init="false">

<context:annotation-config/>
<context:component-scan base-package="com.evolveum.midpoint.notifications.impl"/>
<context:spring-configured/>
<import resource="ctx-notifications.xml"/>

<import resource="ctx-model.xml"/>
<import resource="ctx-model-common.xml"/>
Expand All @@ -30,5 +25,4 @@
<import resource="ctx-task.xml"/>
<import resource="ctx-audit.xml"/>
<import resource="ctx-security.xml"/>
<import resource="ctx-notifications.xml"/>
</beans>

0 comments on commit f5bf439

Please sign in to comment.