INT-1240, removed 'default' from 'operation-name' and 'object-name', since 'operation-name' and 'object-name' is now required on adapters/gateway, there is no reason calling them 'default'

This commit is contained in:
Oleg Zhurakousky
2010-07-19 12:23:54 +00:00
parent 7cbf845a83
commit c2f526586a
7 changed files with 30 additions and 30 deletions

View File

@@ -63,9 +63,9 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa
private volatile MBeanServer server;
private volatile ObjectName defaultObjectName;
private volatile ObjectName objectName;
private volatile String defaultOperationName;
private volatile String operationName;
/**
@@ -80,10 +80,10 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa
* Specify a default ObjectName to use when no such header is
* available on the Message being handled.
*/
public void setDefaultObjectName(String defaultObjectName) {
public void setObjectName(String objectName) {
try {
if (defaultObjectName != null) {
this.defaultObjectName = ObjectNameManager.getInstance(defaultObjectName);
if (objectName != null) {
this.objectName = ObjectNameManager.getInstance(objectName);
}
}
catch (MalformedObjectNameException e) {
@@ -92,11 +92,11 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa
}
/**
* Specify a default operation name to be invoked when no such
* Specify an operation name to be invoked when no such
* header is available on the Message being handled.
*/
public void setDefaultOperationName(String defaultOperationName) {
this.defaultOperationName = defaultOperationName;
public void setOperationName(String operationName) {
this.operationName = operationName;
}
@Override
@@ -155,7 +155,7 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa
* First checks if defaultObjectName is set, otherwise falls back on {@link JmxHeaders#OBJECT_NAME} header.
*/
private ObjectName resolveObjectName(Message<?> message) {
ObjectName objectName = this.defaultObjectName;
ObjectName objectName = this.objectName;
if (objectName == null){
Object objectNameHeader = message.getHeaders().get(JmxHeaders.OBJECT_NAME);
if (objectNameHeader instanceof ObjectName) {
@@ -178,7 +178,7 @@ public class OperationInvokingMessageHandler extends AbstractReplyProducingMessa
* First checks if defaultOperationName is set, otherwise falls back on {@link JmxHeaders#OPERATION_NAME} header.
*/
private String resolveOperationName(Message<?> message) {
String operationName = this.defaultOperationName;
String operationName = this.operationName;
if (operationName == null){
operationName = message.getHeaders().get(JmxHeaders.OPERATION_NAME, String.class);
}

View File

@@ -35,8 +35,8 @@ public class OperationInvokingChannelAdapterParser extends AbstractOutboundChann
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(
"org.springframework.integration.jmx.OperationInvokingMessageHandler");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "mbean-server", "server");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "default-object-name");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "default-operation-name");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "object-name");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "operation-name");
return builder.getBeanDefinition();
}

View File

@@ -38,8 +38,8 @@ public class OperationInvokingOutboundGatewayParser extends AbstractConsumerEndp
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(
"org.springframework.integration.jmx.OperationInvokingMessageHandler");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "mbean-server", "server");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "default-object-name");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "default-operation-name");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "object-name");
IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "operation-name");
IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "reply-channel", "outputChannel");
return builder;
}

View File

@@ -163,8 +163,8 @@
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="mbeanServerIdentifyerType">
<xsd:attribute name="default-object-name" type="xsd:string" use="required"/>
<xsd:attribute name="default-operation-name" type="xsd:string" use="required"/>
<xsd:attribute name="object-name" type="xsd:string" use="required"/>
<xsd:attribute name="operation-name" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

View File

@@ -69,9 +69,9 @@ public class OperationInvokingMessageHandlerTests {
QueueChannel outputChannel = new QueueChannel();
OperationInvokingMessageHandler handler = new OperationInvokingMessageHandler();
handler.setServer(this.server);
handler.setDefaultObjectName(this.objectName);
handler.setObjectName(this.objectName);
handler.setOutputChannel(outputChannel);
handler.setDefaultOperationName("x");
handler.setOperationName("x");
handler.afterPropertiesSet();
Map<String, Object> params = new HashMap<String, Object>();
params.put("p1", "foo");
@@ -88,9 +88,9 @@ public class OperationInvokingMessageHandlerTests {
QueueChannel outputChannel = new QueueChannel();
OperationInvokingMessageHandler handler = new OperationInvokingMessageHandler();
handler.setServer(this.server);
handler.setDefaultObjectName(this.objectName);
handler.setObjectName(this.objectName);
handler.setOutputChannel(outputChannel);
handler.setDefaultOperationName("y");
handler.setOperationName("y");
handler.afterPropertiesSet();
Message<?> message = MessageBuilder.withPayload("foo").build();
handler.handleMessage(message);
@@ -101,9 +101,9 @@ public class OperationInvokingMessageHandlerTests {
QueueChannel outputChannel = new QueueChannel();
OperationInvokingMessageHandler handler = new OperationInvokingMessageHandler();
handler.setServer(this.server);
handler.setDefaultObjectName(this.objectName);
handler.setObjectName(this.objectName);
handler.setOutputChannel(outputChannel);
handler.setDefaultOperationName("x");
handler.setOperationName("x");
handler.afterPropertiesSet();
Map<String, Object> params = new HashMap<String, Object>();
params.put("p1", "foo");
@@ -119,9 +119,9 @@ public class OperationInvokingMessageHandlerTests {
QueueChannel outputChannel = new QueueChannel();
OperationInvokingMessageHandler handler = new OperationInvokingMessageHandler();
handler.setServer(this.server);
handler.setDefaultObjectName(this.objectName);
handler.setObjectName(this.objectName);
handler.setOutputChannel(outputChannel);
handler.setDefaultOperationName("x");
handler.setOperationName("x");
handler.afterPropertiesSet();
List<Object> params = Arrays.asList(new Object[] { "foo", new Integer(123) });
Message<?> message = MessageBuilder.withPayload(params).build();

View File

@@ -17,8 +17,8 @@
<context:mbean-server/>
<jmx:operation-invoking-channel-adapter id="input"
default-object-name="org.springframework.integration.jmx.config:type=TestBean,name=testBeanAdapter"
default-operation-name="test"/>
object-name="org.springframework.integration.jmx.config:type=TestBean,name=testBeanAdapter"
operation-name="test"/>
<bean id="testBeanAdapter" class="org.springframework.integration.jmx.config.TestBean"/>

View File

@@ -30,12 +30,12 @@
<jmx:operation-invoking-outbound-gateway request-channel="withReplyChannel"
reply-channel="withReplyChannelOutput"
default-object-name="org.springframework.integration.jmx.config:type=TestBean,name=testBeanGateway"
default-operation-name="testWithReturn"/>
object-name="org.springframework.integration.jmx.config:type=TestBean,name=testBeanGateway"
operation-name="testWithReturn"/>
<jmx:operation-invoking-outbound-gateway request-channel="withNoReplyChannel"
default-object-name="org.springframework.integration.jmx.config:type=TestBean,name=testBeanGateway"
default-operation-name="testWithReturn"/>
object-name="org.springframework.integration.jmx.config:type=TestBean,name=testBeanGateway"
operation-name="testWithReturn"/>
<bean id="testBeanGateway" class="org.springframework.integration.jmx.config.TestBean"/>
</beans>