Remove @Deprecated classes
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.channel.interceptor;
|
||||
|
||||
import io.micrometer.common.lang.Nullable;
|
||||
import io.micrometer.observation.Observation;
|
||||
import io.micrometer.observation.ObservationRegistry;
|
||||
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.MessageHandler;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* The {@link org.springframework.messaging.support.ExecutorChannelInterceptor}
|
||||
* implementation responsible for an {@link Observation} propagation from one message
|
||||
* flow's thread to another through the {@link MessageChannel}s involved in the flow.
|
||||
* Opens a new {@link Observation.Scope} on another thread and cleans up it in the end.
|
||||
* <p>
|
||||
* NOTE: This interceptor is proven to be wrong since an existing observation usually is closed
|
||||
* on the sender side before the message is consumed on the receiver side.
|
||||
* Therefore, it is better to have a {@code sender} observation on this channel,
|
||||
* and then {@code receiver} observation on a subscriber for this channel.
|
||||
* This way a tracing information is stored into message headers passing this channel.
|
||||
* Such an approach also eliminate a problem with persistent message channels where
|
||||
* an {@link Observation} is not serializable to be stored into database as a part of the message.
|
||||
*
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 6.0
|
||||
*
|
||||
* @deprecated since 6.1.7 for removal in 6.4 in favor of enabling observation on the channel and its consumer.
|
||||
*/
|
||||
@Deprecated(since = "6.1.7", forRemoval = true)
|
||||
public class ObservationPropagationChannelInterceptor extends ThreadStatePropagationChannelInterceptor<Observation> {
|
||||
|
||||
private final ThreadLocal<Observation.Scope> scopes = new ThreadLocal<>();
|
||||
|
||||
private final ObservationRegistry observationRegistry;
|
||||
|
||||
public ObservationPropagationChannelInterceptor(ObservationRegistry observationRegistry) {
|
||||
Assert.notNull(observationRegistry, "'observationRegistry' must noty be null");
|
||||
this.observationRegistry = observationRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected Observation obtainPropagatingContext(Message<?> message, MessageChannel channel) {
|
||||
if (!DirectChannel.class.isAssignableFrom(AopUtils.getTargetClass(channel))) {
|
||||
return this.observationRegistry.getCurrentObservation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populatePropagatedContext(@Nullable Observation state, Message<?> message, MessageChannel channel) {
|
||||
if (state != null) {
|
||||
Observation.Scope scope = state.openScope();
|
||||
this.scopes.set(scope);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterMessageHandled(Message<?> message, MessageChannel channel, MessageHandler handler, Exception ex) {
|
||||
Observation.Scope scope = this.scopes.get();
|
||||
if (scope != null && scope.equals(this.observationRegistry.getCurrentObservationScope())) {
|
||||
scope.close();
|
||||
this.scopes.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.expression;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.context.Lifecycle;
|
||||
import org.springframework.expression.MethodFilter;
|
||||
import org.springframework.integration.core.Pausable;
|
||||
import org.springframework.jmx.export.annotation.ManagedAttribute;
|
||||
import org.springframework.jmx.export.annotation.ManagedOperation;
|
||||
import org.springframework.util.CustomizableThreadCreator;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* SpEL {@link MethodFilter} to restrict method invocations to:
|
||||
* <ul>
|
||||
* <li> {@link Pausable} or {@link Lifecycle} components
|
||||
* <li> {@code get}, {@code set} and {@code shutdown} methods of {@link CustomizableThreadCreator}
|
||||
* <li> methods with {@link ManagedAttribute} and {@link ManagedOperation} annotations
|
||||
* </ul>
|
||||
* This class isn't designed for target applications and typically is used from {@code ExpressionControlBusFactoryBean}.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @since 4.0
|
||||
*
|
||||
* @deprecated in favor of {@link org.springframework.integration.support.management.ControlBusMethodFilter}
|
||||
*/
|
||||
@Deprecated(since = "6.4", forRemoval = true)
|
||||
public class ControlBusMethodFilter implements MethodFilter {
|
||||
|
||||
private static final ReflectionUtils.MethodFilter CONTROL_BUS_METHOD_FILTER =
|
||||
new org.springframework.integration.support.management.ControlBusMethodFilter();
|
||||
|
||||
@Override
|
||||
public List<Method> filter(List<Method> methods) {
|
||||
List<Method> supportedMethods = new ArrayList<>();
|
||||
for (Method method : methods) {
|
||||
if (accept(method)) {
|
||||
supportedMethods.add(method);
|
||||
}
|
||||
}
|
||||
return supportedMethods;
|
||||
}
|
||||
|
||||
private boolean accept(Method method) {
|
||||
return CONTROL_BUS_METHOD_FILTER.matches(method);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.integration.scripting.jsr223;
|
||||
|
||||
import javax.script.Bindings;
|
||||
import javax.script.ScriptEngine;
|
||||
|
||||
/**
|
||||
* A {@link org.springframework.integration.scripting.ScriptExecutor}
|
||||
* that implements special handling required for Python to
|
||||
* emulate behavior similar to other JSR223 scripting languages.
|
||||
* <p>
|
||||
* Script evaluation using the Jython implementation results in a <code>null</code> return
|
||||
* value for normal variable expressions such as <code>x=2</code>. As a work around, it is
|
||||
* necessary to get the value of 'x' explicitly following the script evaluation. This
|
||||
* class performs simple parsing on the last line of the script to obtain the variable
|
||||
* name, if any, and return its value.
|
||||
*
|
||||
* @author David Turanski
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 2.1
|
||||
*
|
||||
* @deprecated in favor of {@link org.springframework.integration.scripting.PolyglotScriptExecutor}
|
||||
* with a {@code python} language argument.
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "6.4")
|
||||
public class PythonScriptExecutor extends AbstractScriptExecutor {
|
||||
|
||||
public PythonScriptExecutor() {
|
||||
super("python");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object postProcess(Object result, ScriptEngine scriptEngine, String script, Bindings bindings) {
|
||||
Object newResult = result;
|
||||
if (newResult == null) {
|
||||
String returnVariableName = PythonVariableParser.parseReturnVariable(script);
|
||||
if (bindings != null) {
|
||||
newResult = bindings.get(returnVariableName);
|
||||
}
|
||||
if (newResult == null) {
|
||||
newResult = scriptEngine.get(returnVariableName);
|
||||
}
|
||||
}
|
||||
return newResult;
|
||||
}
|
||||
|
||||
public static class PythonVariableParser {
|
||||
|
||||
public static String parseReturnVariable(String script) {
|
||||
String[] lines = script.trim().split("\n");
|
||||
String lastLine = lines[lines.length - 1];
|
||||
String[] tokens = lastLine.split("=");
|
||||
return tokens[0].trim();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user