INT-793, INT-1015 Adding initial support for JMX namespace and first version of operation-invoking-channel-adapter parser.

This commit is contained in:
Mark Fisher
2010-03-09 22:55:13 +00:00
parent d1ac769ea2
commit 0885ee15d8
7 changed files with 131 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
/*
* Copyright 2002-2010 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.
*/
package org.springframework.integration.jmx.config;
import org.springframework.integration.config.xml.AbstractIntegrationNamespaceHandler;
/**
* Namespace handler for Spring Integration's <em>jmx</em> namespace.
*
* @author Mark Fisher
* @since 2.0
*/
public class JmxNamespaceHandler extends AbstractIntegrationNamespaceHandler {
public void init() {
this.registerBeanDefinitionParser("operation-invoking-channel-adapter", new OperationInvokingChannelAdapterParser());
}
}

View File

@@ -0,0 +1,43 @@
/*
* Copyright 2002-2010 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.
*/
package org.springframework.integration.jmx.config;
import org.w3c.dom.Element;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.AbstractOutboundChannelAdapterParser;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
/**
* @author Mark Fisher
* @since 2.0
*/
public class OperationInvokingChannelAdapterParser extends AbstractOutboundChannelAdapterParser {
@Override
protected AbstractBeanDefinition parseConsumer(Element element, ParserContext parserContext) {
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");
return builder.getBeanDefinition();
}
}

View File

@@ -0,0 +1 @@
http\://www.springframework.org/schema/integration/jmx=org.springframework.integration.jmx.config.JmxNamespaceHandler

View File

@@ -0,0 +1,2 @@
http\://www.springframework.org/schema/integration/jmx/spring-integration-jmx-2.0.xsd=org/springframework/integration/jmx/config/spring-integration-jmx-2.0.xsd
http\://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd=org/springframework/integration/jmx/config/spring-integration-jmx-2.0.xsd

View File

@@ -0,0 +1,4 @@
# Tooling related information for the integration jmx namespace
http\://www.springframework.org/schema/integration/jmx@name=integration jmx Namespace
http\://www.springframework.org/schema/integration/jmx@prefix=int-jmx
#http\://www.springframework.org/schema/integration/jmx@icon=org/springframework/integration/jmx/config/spring-integration-jmx.gif

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.springframework.org/schema/integration/jmx"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:tool="http://www.springframework.org/schema/tool"
xmlns:integration="http://www.springframework.org/schema/integration"
targetNamespace="http://www.springframework.org/schema/integration/jmx"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:import namespace="http://www.springframework.org/schema/beans"/>
<xsd:import namespace="http://www.springframework.org/schema/tool"/>
<xsd:import namespace="http://www.springframework.org/schema/integration"
schemaLocation="http://www.springframework.org/schema/integration/spring-integration-2.0.xsd"/>
<xsd:annotation>
<xsd:documentation><![CDATA[
Defines the configuration elements for Spring Integration's JMX adapters.
]]></xsd:documentation>
</xsd:annotation>
<xsd:element name="attribute-polling-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Defines an inbound Channel Adapter that polls for JMX attribute values.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="operation-invoking-channel-adapter">
<xsd:annotation>
<xsd:documentation>
Defines an outbound Channel Adapter for invoking JMX operations.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="id" type="xsd:string" use="optional"/>
<xsd:attribute name="channel" type="xsd:string" use="optional"/>
<xsd:attribute name="mbean-server" type="xsd:string" default="mbeanServer"/>
<xsd:attribute name="default-operation-name" type="xsd:string" use="optional"/>
<xsd:attribute name="default-object-name" type="xsd:string" use="optional"/>
</xsd:complexType>
</xsd:element>
</xsd:schema>