EMMA Coverage Report (generated Sun Sep 18 11:34:27 PHT 2011)
[all classes][org.apache.continuum.scm.manager.spring]

COVERAGE SUMMARY FOR SOURCE FILE [ScmProviderFactoryBean.java]

nameclass, %method, %block, %line, %
ScmProviderFactoryBean.java100% (1/1)80%  (4/5)89%  (17/19)86%  (6/7)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ScmProviderFactoryBean100% (1/1)80%  (4/5)89%  (17/19)86%  (6/7)
getObjectType (): Class 0%   (0/1)0%   (0/2)0%   (0/1)
ScmProviderFactoryBean (): void 100% (1/1)100% (3/3)100% (1/1)
getObject (): Object 100% (1/1)100% (8/8)100% (2/2)
isSingleton (): boolean 100% (1/1)100% (2/2)100% (1/1)
setApplicationContext (ApplicationContext): void 100% (1/1)100% (4/4)100% (2/2)

1package org.apache.continuum.scm.manager.spring;
2 
3/*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements.  See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership.  The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License.  You may obtain a copy of the License at
11 *
12 *   http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied.  See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21 
22import java.util.Map;
23 
24import org.apache.maven.scm.provider.ScmProvider;
25import org.codehaus.plexus.spring.PlexusToSpringUtils;
26import org.springframework.beans.BeansException;
27import org.springframework.beans.factory.FactoryBean;
28import org.springframework.context.ApplicationContext;
29import org.springframework.context.ApplicationContextAware;
30 
31/**
32 * <p>
33 * Factory bean to inject all beans of type {@link ScmProvider}
34 * </p>
35 * <p>
36 * <code>&lt;bean id="scmProviders" class="org.apache.continuum.scm.manager.spring.ScmManagerFactoryBean"/>
37 * </code>
38 * </p>
39 *
40 * @author Carlos Sanchez <carlos@apache.org>
41 * @version $Id: ScmProviderFactoryBean.java 765340 2009-04-15 20:22:00Z evenisse $
42 */
43public class ScmProviderFactoryBean
44    implements FactoryBean, ApplicationContextAware
45{
46    private ApplicationContext applicationContext;
47 
48    /**
49     * FIXME : change how we find scm implementations
50     *
51     * @see org.springframework.beans.factory.FactoryBean#getObject()
52     */
53    public Object getObject()
54        throws Exception
55    {
56        Map<String, ScmProvider> providers;
57        /*
58         olamy : comment the pure spring use because we have a duplicate between cvs java and cvs native
59          
60         Map<String, ScmProvider> beans =
61            BeanFactoryUtils.beansOfTypeIncludingAncestors( applicationContext, ScmProvider.class );
62        
63       
64        for ( ScmProvider provider : beans.values() )
65        {
66            
67            if ( providers.containsKey( provider.getScmType() ) )
68            {
69                throw new BeanInitializationException(
70                                                       "There are to ScmProvider beans in the appllication context for Scm type " +
71                                                           provider.getScmType() +
72                                                           ". Probably two conflicting scm implementations are present in the classpath." );
73            }
74            
75            if (log.isDebugEnabled())
76            {
77                log.debug( "put provider with type " + provider.getScmType() + " and class " + provider.getClass().getName() );
78            }
79            providers.put( provider.getScmType(), provider );
80        }*/
81        providers =
82            PlexusToSpringUtils.lookupMap( PlexusToSpringUtils.buildSpringId( ScmProvider.class ), applicationContext );
83        return providers;
84    }
85 
86    public Class getObjectType()
87    {
88        return Map.class;
89    }
90 
91    public boolean isSingleton()
92    {
93        return true;
94    }
95 
96    public void setApplicationContext( ApplicationContext applicationContext )
97        throws BeansException
98    {
99        this.applicationContext = applicationContext;
100    }
101 
102}

[all classes][org.apache.continuum.scm.manager.spring]
EMMA 2.0.5312 (C) Vladimir Roubtsov