Add JMX namespace parser

This commit is contained in:
Mark Pollack
2011-02-13 00:47:46 -02:00
parent 1519b81b1d
commit 704c84b644
7 changed files with 79 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2010 the original author or authors.
* Copyright 2011 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.
@@ -26,7 +26,7 @@ import org.springframework.util.StringUtils;
import org.w3c.dom.Element;
/**
* Parser for <mongo;gt; definitions.
* Parser for <mongo;gt; definitions. If no name
*
* @author Mark Pollack
*/

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2011 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.data.document.mongodb.config;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2011 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.data.document.mongodb.config;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
@@ -22,5 +37,6 @@ public class MongoRepositoryNamespaceHandler extends NamespaceHandlerSupport {
new MongoRepositoryConfigDefinitionParser());
registerBeanDefinitionParser("mongo", new MongoParser());
registerBeanDefinitionParser("jmx", new MongoJmxParser());
}
}

View File

@@ -1,3 +1,18 @@
/*
* Copyright 2011 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.data.document.mongodb.config;
import org.springframework.data.document.mongodb.repository.MongoRepository;

View File

@@ -42,7 +42,7 @@ public class AssertMetrics extends AbstractMonitor {
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Warning")
public int getWarning() {
return getBtree("hits");
return getBtree("warning");
}
@ManagedMetric(metricType = MetricType.COUNTER, displayName = "Msg")

View File

@@ -77,6 +77,22 @@ The host to connect to a MongoDB server. Default is localhost
</xsd:complexType>
</xsd:element>
<xsd:element name="jmx">
<xsd:annotation>
<xsd:documentation><![CDATA[
Defines a JMX Model MBeans for monitoring a MongoDB server'.
]]></xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="mongo-ref" type="mongoRef" use="optional">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the Mongo object that determines what server to monitor. (by default "mongo").]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="mongoTemplateRef">
<xsd:annotation>
<xsd:appinfo>
@@ -87,6 +103,17 @@ The host to connect to a MongoDB server. Default is localhost
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
<xsd:simpleType name="mongoRef">
<xsd:annotation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:assignable-to type="org.springframework.data.document.mongodb.MongoFactoryBean" />
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
<xsd:union memberTypes="xsd:string" />
</xsd:simpleType>
</xsd:schema>

View File

@@ -3,27 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="mongoAdmin" class="org.springframework.data.document.mongodb.MongoAdmin" autowire="constructor"/>
<bean id="serverInfo" class="org.springframework.data.document.mongodb.monitor.ServerInfo" autowire="constructor"/>
<bean id="operationCounters" class="org.springframework.data.document.mongodb.monitor.OperationCounters" autowire="constructor"/>
<bean id="globalLockMetrics" class="org.springframework.data.document.mongodb.monitor.GlobalLockMetrics" autowire="constructor"/>
<bean id="memoryMetrics" class="org.springframework.data.document.mongodb.monitor.MemoryMetrics" autowire="constructor"/>
<bean id="connectionMetrics" class="org.springframework.data.document.mongodb.monitor.ConnectionMetrics" autowire="constructor"/>
<bean id="btreeIndexMetrics" class="org.springframework.data.document.mongodb.monitor.BtreeIndexCounters" autowire="constructor"/>
<bean id="flushingMetrics" class="org.springframework.data.document.mongodb.monitor.BackgroundFlushingMetrics" autowire="constructor"/>
<mongo:jmx/>
<context:mbean-export/>