Code Polishing (Sonar)
- remove redundant modifiers - overridable methods called from ctors Polishing - PR Comments
This commit is contained in:
committed by
Artem Bilan
parent
ddb4321e1d
commit
255247ca9a
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2015 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.
|
||||
@@ -27,7 +27,7 @@ import org.springframework.integration.endpoint.AbstractMessageSource;
|
||||
* @author Gary Russell
|
||||
* @since 3.0
|
||||
*/
|
||||
class ScriptExecutingMessageSource extends AbstractMessageSource<Object> {
|
||||
public class ScriptExecutingMessageSource extends AbstractMessageSource<Object> {
|
||||
|
||||
private final AbstractScriptExecutingMessageProcessor<?> scriptMessageProcessor;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import org.springframework.util.Assert;
|
||||
* @author Gary Russell
|
||||
* @since 2.1
|
||||
*/
|
||||
abstract class AbstractScriptExecutor implements ScriptExecutor {
|
||||
public abstract class AbstractScriptExecutor implements ScriptExecutor {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract class AbstractScriptExecutor implements ScriptExecutor {
|
||||
|
||||
protected final String language;
|
||||
|
||||
public AbstractScriptExecutor(String language) {
|
||||
protected AbstractScriptExecutor(String language) {
|
||||
Assert.hasText(language, "language must not be empty");
|
||||
this.language = language;
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@ import org.springframework.integration.scripting.ScriptExecutor;
|
||||
* @author Gary Russell
|
||||
* @since 2.1
|
||||
*/
|
||||
class DefaultScriptExecutor extends AbstractScriptExecutor {
|
||||
public class DefaultScriptExecutor extends AbstractScriptExecutor {
|
||||
/**
|
||||
* Create a DefaultScriptExceutor for the specified language name (JSR233
|
||||
* Create a DefaultScriptExecutor for the specified language name (JSR233
|
||||
* alias).
|
||||
*/
|
||||
public DefaultScriptExecutor(String language) {
|
||||
DefaultScriptExecutor(String language) {
|
||||
super(language);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ import org.springframework.integration.scripting.ScriptExecutor;
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
class PythonScriptExecutor extends AbstractScriptExecutor {
|
||||
public class PythonScriptExecutor extends AbstractScriptExecutor {
|
||||
/**
|
||||
* @param language
|
||||
*/
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2015 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -20,7 +20,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @since 2.1
|
||||
*
|
||||
*/
|
||||
class RubyScriptExecutor extends DefaultScriptExecutor {
|
||||
public class RubyScriptExecutor extends DefaultScriptExecutor {
|
||||
|
||||
static {
|
||||
if (ClassUtils.isPresent("org.jruby.embed.jsr223.JRubyEngine", System.class.getClassLoader())) {
|
||||
@@ -28,7 +28,7 @@ import org.springframework.util.ClassUtils;
|
||||
System.setProperty("org.jruby.embed.localcontext.scope", "threadsafe");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public RubyScriptExecutor() {
|
||||
super("ruby");
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 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
|
||||
@@ -29,11 +29,13 @@ import org.springframework.util.Assert;
|
||||
public class ScriptExecutingMessageProcessor extends AbstractScriptExecutingMessageProcessor<Object> {
|
||||
|
||||
private final ScriptExecutor scriptExecutor;
|
||||
|
||||
private volatile ScriptSource scriptSource;
|
||||
|
||||
|
||||
/**
|
||||
* Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor} using the DefaultScriptVariableGenerator
|
||||
* Create a processor for the {@link ScriptSource} using the provided
|
||||
* {@link ScriptExecutor} using the DefaultScriptVariableGenerator
|
||||
*
|
||||
* @param scriptSource The script source.
|
||||
* @param scriptExecutor The script executor.
|
||||
@@ -45,26 +47,30 @@ public class ScriptExecutingMessageProcessor extends AbstractScriptExecutingMess
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor}
|
||||
* Create a processor for the {@link ScriptSource} using the provided
|
||||
* {@link ScriptExecutor}
|
||||
*
|
||||
* @param scriptSource The script source.
|
||||
* @param scriptVariableGenerator The script variable generator.
|
||||
* @param scriptExecutor The script executor.
|
||||
*/
|
||||
public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptVariableGenerator scriptVariableGenerator, ScriptExecutor scriptExecutor) {
|
||||
public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptVariableGenerator scriptVariableGenerator,
|
||||
ScriptExecutor scriptExecutor) {
|
||||
super(scriptVariableGenerator);
|
||||
this.scriptSource = scriptSource;
|
||||
this.scriptExecutor = scriptExecutor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a processor for the {@link ScriptSource} using the provided {@link ScriptExecutor} using the DefaultScriptVariableGenerator
|
||||
* Create a processor for the {@link ScriptSource} using the provided
|
||||
* {@link ScriptExecutor} using the DefaultScriptVariableGenerator
|
||||
*
|
||||
* @param scriptSource The script source.
|
||||
* @param scriptExecutor The script executor.
|
||||
* @param variables The variables.
|
||||
*/
|
||||
public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptExecutor scriptExecutor,Map<String,Object> variables ) {
|
||||
public ScriptExecutingMessageProcessor(ScriptSource scriptSource, ScriptExecutor scriptExecutor,
|
||||
Map<String, Object> variables) {
|
||||
super(new DefaultScriptVariableGenerator(variables));
|
||||
this.scriptSource = scriptSource;
|
||||
this.scriptExecutor = scriptExecutor;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
*
|
||||
* Copyright 2002-2015 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
|
||||
*
|
||||
*
|
||||
* http://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.
|
||||
@@ -19,14 +19,15 @@ import org.springframework.integration.scripting.ScriptExecutor;
|
||||
* @since 2.1
|
||||
*/
|
||||
public abstract class ScriptExecutorFactory {
|
||||
|
||||
|
||||
public static ScriptExecutor getScriptExecutor(String language) {
|
||||
if (language.equalsIgnoreCase("python") || language.equalsIgnoreCase("jython")){
|
||||
return new PythonScriptExecutor();
|
||||
}
|
||||
}
|
||||
else if (language.equalsIgnoreCase("ruby") || language.equalsIgnoreCase("jruby")) {
|
||||
return new RubyScriptExecutor();
|
||||
}
|
||||
return new DefaultScriptExecutor(language);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user