EMMA Coverage Report (generated Tue Mar 05 16:36:55 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 2013 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 * @author Rizwan Idrees
33 * @author Mohsin Husen
34 */
35public class ElasticsearchRepositoryConfigExtension extends RepositoryConfigurationExtensionSupport {
36 
37        /*
38         * (non-Javadoc)
39         * @see org.springframework.data.repository.config.RepositoryConfigurationExtension#getRepositoryFactoryClassName()
40         */
41        @Override
42        public String getRepositoryFactoryClassName() {
43                return ElasticsearchRepositoryFactoryBean.class.getName();
44        }
45 
46        /*
47         * (non-Javadoc)
48         * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#getModulePrefix()
49         */
50        @Override
51        protected String getModulePrefix() {
52                return "elasticsearch";
53        }
54 
55        /* 
56         * (non-Javadoc)
57         * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource)
58         */
59        @Override
60        public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource config) {
61 
62                AnnotationAttributes attributes = config.getAttributes();
63                builder.addPropertyReference("elasticsearchOperations", attributes.getString("elasticsearchTemplateRef"));
64        }
65 
66        /* 
67         * (non-Javadoc)
68         * @see org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport#postProcess(org.springframework.beans.factory.support.BeanDefinitionBuilder, org.springframework.data.repository.config.XmlRepositoryConfigurationSource)
69         */
70        @Override
71        public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) {
72 
73                Element element = config.getElement();
74                builder.addPropertyReference("elasticsearchOperations", element.getAttribute("elasticsearch-template-ref"));
75        }
76}

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