Coverage Report - org.mule.model.resolvers.LegacyEntryPointResolverSet
 
Classes in this File Line Coverage Branch Coverage Complexity
LegacyEntryPointResolverSet
0%
0/18
0%
0/2
0
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.model.resolvers;
 8  
 
 9  
 import org.mule.api.MuleRuntimeException;
 10  
 import org.mule.api.model.EntryPointResolver;
 11  
 import org.mule.config.i18n.CoreMessages;
 12  
 import org.mule.util.ClassUtils;
 13  
 
 14  
 import org.apache.commons.logging.Log;
 15  
 import org.apache.commons.logging.LogFactory;
 16  
 
 17  
 /**
 18  
  * An {@link org.mule.api.model.EntryPointResolverSet} that mimics the behaviour of the Mule 1.x
 19  
  * DynamicEntryPointResolver.
 20  
  * <b>NOTE:</b> Since 3.0 this legacy entry point resolver will always invoked after message
 21  
  * transformation  and not before.
 22  
  */
 23  
 public class LegacyEntryPointResolverSet extends DefaultEntryPointResolverSet
 24  
 {
 25  
     private static final String ANNOTATED_ENTRYPOINT_RESOLVER_CLASS = "org.mule.impl.model.resolvers.AnnotatedEntryPointResolver";
 26  0
     private static final Log logger = LogFactory.getLog(LegacyEntryPointResolverSet.class);
 27  
 
 28  
     public LegacyEntryPointResolverSet()
 29  0
     {
 30  0
         addAnnotatedEntryPointResolver();
 31  0
         addEntryPointResolver(new MethodHeaderPropertyEntryPointResolver());
 32  0
         addEntryPointResolver(new CallableEntryPointResolver());
 33  
 
 34  0
         ReflectionEntryPointResolver reflectionResolver = new ReflectionEntryPointResolver();
 35  
         //In Mule 1.x you could call setXX methods as service methods by default
 36  0
         reflectionResolver.removeIgnoredMethod("set*");
 37  0
         addEntryPointResolver(reflectionResolver);
 38  0
     }
 39  
 
 40  
     protected void addAnnotatedEntryPointResolver()
 41  
     {
 42  
         //Annotations support is not part of Mule core, but we want default handling for annotations we have
 43  
         //work-arounds like this to avoid importing annotation classes
 44  
         //See MULE-4962 for details
 45  
         try
 46  
         {
 47  0
             Class<? extends EntryPointResolver> annotatedEntrypointResolver =
 48  
                     ClassUtils.loadClass(ANNOTATED_ENTRYPOINT_RESOLVER_CLASS, getClass(), EntryPointResolver.class);
 49  0
             addEntryPointResolver(ClassUtils.instanciateClass(annotatedEntrypointResolver, ClassUtils.NO_ARGS));
 50  
         }
 51  0
         catch (ClassNotFoundException e)
 52  
         {
 53  0
             if(logger.isDebugEnabled())
 54  
             {
 55  0
                 logger.warn("Mule annotations module is not on your classpath, annotations cannot be used on components");
 56  
             }
 57  
         }
 58  0
         catch (Exception e)
 59  
         {
 60  0
             throw new MuleRuntimeException(CoreMessages.cannotLoadFromClasspath(ANNOTATED_ENTRYPOINT_RESOLVER_CLASS));
 61  0
         }
 62  0
     }
 63  
 }