org.apache.camel.impl
Class DefaultFactoryFinder

java.lang.Object
  extended by org.apache.camel.impl.DefaultFactoryFinder
All Implemented Interfaces:
FactoryFinder
Direct Known Subclasses:
OsgiFactoryFinder

public class DefaultFactoryFinder
extends Object
implements FactoryFinder

Default factory finder.


Field Summary
protected  ConcurrentHashMap<String,Class<?>> classMap
           
 
Constructor Summary
DefaultFactoryFinder(ClassResolver classResolver, String resourcePath)
           
 
Method Summary
 Class<?> findClass(String key)
          Finds the given factory class using the the key to lookup.
 Class<?> findClass(String key, String propertyPrefix)
          Finds the given factory class using the the key to lookup.
 String getResourcePath()
          Gets the resource classpath.
 Object newInstance(String key)
          Creates a new class instance using the key to lookup
<T> List<T>
newInstances(String key, Injector injector, Class<T> type)
          Creates a new class instance using the key to lookup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classMap

protected final ConcurrentHashMap<String,Class<?>> classMap
Constructor Detail

DefaultFactoryFinder

public DefaultFactoryFinder(ClassResolver classResolver,
                            String resourcePath)
Method Detail

getResourcePath

public String getResourcePath()
Description copied from interface: FactoryFinder
Gets the resource classpath.

Specified by:
getResourcePath in interface FactoryFinder
Returns:
the resource classpath.

newInstance

public Object newInstance(String key)
                   throws NoFactoryAvailableException
Description copied from interface: FactoryFinder
Creates a new class instance using the key to lookup

Specified by:
newInstance in interface FactoryFinder
Parameters:
key - is the key to add to the path to find a text file containing the factory name
Returns:
a newly created instance
Throws:
NoFactoryAvailableException - is thrown if no factories exist for the given key

newInstances

public <T> List<T> newInstances(String key,
                                Injector injector,
                                Class<T> type)
                     throws ClassNotFoundException,
                            IOException
Description copied from interface: FactoryFinder
Creates a new class instance using the key to lookup

Specified by:
newInstances in interface FactoryFinder
Parameters:
key - is the key to add to the path to find a text file containing the factory name
injector - injector to use
type - expected type
Returns:
a newly created instance as the expected type
Throws:
ClassNotFoundException - is thrown if not found
IOException - is thrown if loading the class or META-INF file not found

findClass

public Class<?> findClass(String key)
                   throws ClassNotFoundException,
                          IOException
Description copied from interface: FactoryFinder
Finds the given factory class using the the key to lookup.

Specified by:
findClass in interface FactoryFinder
Parameters:
key - is the key to add to the path to find a text file containing the factory name
Returns:
the factory class
Throws:
ClassNotFoundException - is thrown if class not found
IOException - is thrown if loading the class or META-INF file not found

findClass

public Class<?> findClass(String key,
                          String propertyPrefix)
                   throws ClassNotFoundException,
                          IOException
Description copied from interface: FactoryFinder
Finds the given factory class using the the key to lookup.

Specified by:
findClass in interface FactoryFinder
Parameters:
key - is the key to add to the path to find a text file containing the factory name
propertyPrefix - prefix on key
Returns:
the factory class
Throws:
ClassNotFoundException - is thrown if not found
IOException - is thrown if loading the class or META-INF file not found


Apache CAMEL