ARTEMIS-1446 Use Contructor on TransformerConfiguration

This commit is contained in:
Clebert Suconic 2017-10-10 13:47:01 -04:00
parent 3b24a3b74c
commit ea89833204
5 changed files with 11 additions and 18 deletions

View File

@ -24,25 +24,18 @@ public final class TransformerConfiguration implements Serializable {
private static final long serialVersionUID = -1057244274380572226L;
private String className = null;
private final String className;
private Map<String, String> properties = new HashMap<>();
public TransformerConfiguration() {
public TransformerConfiguration(String className) {
this.className = className;
}
public String getClassName() {
return className;
}
/**
* @param className the class name to set
*/
public TransformerConfiguration setClassName(final String className) {
this.className = className;
return this;
}
public Map<String, String> getProperties() {
return properties;
}

View File

@ -1641,11 +1641,11 @@ public final class FileConfigurationParser extends XMLConfigurationUtil {
properties.put(key, value);
}
}
return new TransformerConfiguration().setClassName(className).setProperties(properties);
return new TransformerConfiguration(className).setProperties(properties);
}
private TransformerConfiguration getTransformerConfiguration(final String transformerClassName) {
return new TransformerConfiguration().setClassName(transformerClassName).setProperties(Collections.EMPTY_MAP);
return new TransformerConfiguration(transformerClassName).setProperties(Collections.EMPTY_MAP);
}
private void parseBridgeConfiguration(final Element brNode, final Configuration mainConfig) throws Exception {

View File

@ -2294,7 +2294,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO();
try {
TransformerConfiguration transformerConfiguration = transformerClassName == null ? null : new TransformerConfiguration().setClassName(transformerClassName).setProperties(transformerProperties);
TransformerConfiguration transformerConfiguration = transformerClassName == null ? null : new TransformerConfiguration(transformerClassName).setProperties(transformerProperties);
DivertConfiguration config = new DivertConfiguration().setName(name).setRoutingName(routingName).setAddress(address).setForwardingAddress(forwardingAddress).setExclusive(exclusive).setFilterString(filterString).setTransformerConfiguration(transformerConfiguration).setRoutingType(DivertConfigurationRoutingType.valueOf(routingType));
server.deployDivert(config);
} finally {
@ -2439,7 +2439,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO();
try {
TransformerConfiguration transformerConfiguration = transformerClassName == null ? null : new TransformerConfiguration().setClassName(transformerClassName).setProperties(transformerProperties);
TransformerConfiguration transformerConfiguration = transformerClassName == null ? null : new TransformerConfiguration(transformerClassName).setProperties(transformerProperties);
BridgeConfiguration config = new BridgeConfiguration().setName(name).setQueueName(queueName).setForwardingAddress(forwardingAddress).setFilterString(filterString).setTransformerConfiguration(transformerConfiguration).setClientFailureCheckPeriod(clientFailureCheckPeriod).setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setInitialConnectAttempts(initialConnectAttempts).setReconnectAttempts(reconnectAttempts).setUseDuplicateDetection(useDuplicateDetection).setConfirmationWindowSize(confirmationWindowSize).setProducerWindowSize(producerWindowSize).setHA(ha).setUser(user).setPassword(password);
if (useDiscoveryGroup) {
@ -2477,7 +2477,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
clearIO();
try {
TransformerConfiguration transformerConfiguration = transformerClassName == null ? null : new TransformerConfiguration().setClassName(transformerClassName);
TransformerConfiguration transformerConfiguration = transformerClassName == null ? null : new TransformerConfiguration(transformerClassName);
BridgeConfiguration config = new BridgeConfiguration().setName(name).setQueueName(queueName).setForwardingAddress(forwardingAddress).setFilterString(filterString).setTransformerConfiguration(transformerConfiguration).setClientFailureCheckPeriod(clientFailureCheckPeriod).setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setInitialConnectAttempts(initialConnectAttempts).setReconnectAttempts(reconnectAttempts).setUseDuplicateDetection(useDuplicateDetection).setConfirmationWindowSize(confirmationWindowSize).setHA(ha).setUser(user).setPassword(password);
if (useDiscoveryGroup) {

View File

@ -973,7 +973,7 @@ public class BridgeTest extends ActiveMQTestBase {
ArrayList<String> staticConnectors = new ArrayList<>();
staticConnectors.add(server1tc.getName());
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setTransformerConfiguration(new TransformerConfiguration().setClassName(SimpleTransformer.class.getName())).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors);
BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setTransformerConfiguration(new TransformerConfiguration(SimpleTransformer.class.getName())).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors);
List<BridgeConfiguration> bridgeConfigs = new ArrayList<>();
bridgeConfigs.add(bridgeConfiguration);
@ -1059,7 +1059,7 @@ public class BridgeTest extends ActiveMQTestBase {
final String propValue = "true";
TransformerConfiguration transformerConfiguration = new TransformerConfiguration().setClassName(AddHeadersTransformer.class.getName());
TransformerConfiguration transformerConfiguration = new TransformerConfiguration(AddHeadersTransformer.class.getName());
transformerConfiguration.getProperties().put(propKey, propValue);
Map<String, Object> server0Params = new HashMap<>();

View File

@ -81,7 +81,7 @@ public class DivertControlTest extends ManagementTestBase {
CoreQueueConfiguration forwardQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
divertConfig = new DivertConfiguration().setName(RandomUtil.randomString()).setRoutingName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()).setForwardingAddress(forwardQueueConfig.getAddress()).setExclusive(RandomUtil.randomBoolean()).
setTransformerConfiguration(new TransformerConfiguration().setClassName(AddHeadersTransformer.class.getName()));
setTransformerConfiguration(new TransformerConfiguration(AddHeadersTransformer.class.getName()));
TransportConfiguration connectorConfig = new TransportConfiguration(INVM_CONNECTOR_FACTORY);