EMMA Coverage Report (generated Mon Jan 28 16:15:17 GMT 2013)
[all classes][org.springframework.data.elasticsearch.repository.config]

COVERAGE SUMMARY FOR SOURCE FILE [ElasticsearchRepositoryConfigExtension.java]

nameclass, %method, %block, %line, %
ElasticsearchRepositoryConfigExtension.java100% (1/1)100% (5/5)100% (30/30)100% (9/9)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ElasticsearchRepositoryConfigExtension100% (1/1)100% (5/5)100% (30/30)100% (9/9)
ElasticsearchRepositoryConfigExtension (): void 100% (1/1)100% (3/3)100% (1/1)
getModulePrefix (): String 100% (1/1)100% (2/2)100% (1/1)
getRepositoryFactoryClassName (): String 100% (1/1)100% (3/3)100% (1/1)
postProcess (BeanDefinitionBuilder, AnnotationRepositoryConfigurationSource):... 100% (1/1)100% (11/11)100% (3/3)
postProcess (BeanDefinitionBuilder, XmlRepositoryConfigurationSource): void 100% (1/1)100% (11/11)100% (3/3)

1/*
2 * Copyright 2012 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.springframework.data.elasticsearch.repository.config;
17 
18import org.springframework.beans.factory.support.BeanDefinitionBuilder;
19import org.springframework.core.annotation.AnnotationAttributes;
20import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean;
21import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource;
22import org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport;
23import org.springframework.data.repository.config.XmlRepositoryConfigurationSource;
24import org.w3c.dom.Element;
25 
26 
27 
28/**
29 * {@link org.springframework.data.repository.config.RepositoryConfigurationExtension} implementation to configure Elasticsearch repository configuration support,
30 * evaluating the {@link EnableElasticsearchRepositories} annotation or the equivalent XML element.
31 * 
32 */
33public class ElasticsearchRepositoryConfigExtension extends RepositoryConfigurationExtensionSupport {
34 
35        /*
36         * (non-Javadoc)
37         * @see org.springframework.data.repository.config.RepositoryConfigurationExtension#getRepositoryFactoryClassName()
38         */
39        @Override
40        public String getRepositoryFactoryClassName() {
41                return ElasticsearchRepositoryFactoryBean.class.getName();
42        }
43 
44        /*
45         * (non-Javadoc)
46         * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getModulePrefix()
47         */
48        @Override
49        protected String getModulePrefix() {
50                return "elasticsearch";
51        }
52 
53        /* 
54         * (non-Javadoc)
55         * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource)
56         */
57        @Override
58        public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {
59 
60                AnnotationAttributes attributes = config.getAttributes();
61                builder.addPropertyReference("elasticsearchOperations", attributes.getString("elasticsearchTemplateRef"));
62        }
63 
64        /* 
65         * (non-Javadoc)
66         * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.XmlRepositoryConfigurationSource)
67         */
68        @Override
69        public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) {
70 
71                Element element = config.getElement();
72                builder.addPropertyReference("elasticsearchOperations", element.getAttribute("elasticsearch-template-ref"));
73        }
74}

[all classes][org.springframework.data.elasticsearch.repository.config]
EMMA 2.0.5312 (C) Vladimir Roubtsov