本文整理汇总了Java中org.apache.camel.NoFactoryAvailableException类的典型用法代码示例。如果您正苦于以下问题:Java NoFactoryAvailableException类的具体用法?Java NoFactoryAvailableException怎么用?Java NoFactoryAvailableException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NoFactoryAvailableException类属于org.apache.camel包,在下文中一共展示了NoFactoryAvailableException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doFindFactoryProperties
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
private Properties doFindFactoryProperties(String key) throws IOException {
String uri = path + key;
InputStream in = classResolver.loadResourceAsStream(uri);
if (in == null) {
throw new NoFactoryAvailableException(uri);
}
// lets load the file
BufferedInputStream reader = null;
try {
reader = IOHelper.buffered(in);
Properties properties = new Properties();
properties.load(reader);
return properties;
} finally {
IOHelper.close(reader, key, null);
IOHelper.close(in, key, null);
}
}
示例2: createChildProcessor
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
@Override
public Processor createChildProcessor(RouteContext routeContext, ProcessorDefinition<?> definition, boolean mandatory) throws Exception {
String name = definition.getClass().getSimpleName();
FactoryFinder finder = routeContext.getCamelContext().getFactoryFinder(RESOURCE_PATH);
try {
if (finder != null) {
Object object = finder.newInstance(name);
if (object != null && object instanceof ProcessorFactory) {
ProcessorFactory pc = (ProcessorFactory) object;
return pc.createChildProcessor(routeContext, definition, mandatory);
}
}
} catch (NoFactoryAvailableException e) {
// ignore there is no custom factory
}
return null;
}
示例3: createProcessor
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
@Override
public Processor createProcessor(RouteContext routeContext, ProcessorDefinition<?> definition) throws Exception {
String name = definition.getClass().getSimpleName();
FactoryFinder finder = routeContext.getCamelContext().getFactoryFinder(RESOURCE_PATH);
try {
if (finder != null) {
Object object = finder.newInstance(name);
if (object != null && object instanceof ProcessorFactory) {
ProcessorFactory pc = (ProcessorFactory) object;
return pc.createProcessor(routeContext, definition);
}
}
} catch (NoFactoryAvailableException e) {
// ignore there is no custom factory
}
return null;
}
示例4: loadTypeConverters
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
/**
* Checks if the registry is loaded and if not lazily load it
*/
protected void loadTypeConverters() throws Exception {
for (TypeConverterLoader typeConverterLoader : getTypeConverterLoaders()) {
typeConverterLoader.load(this);
}
// lets try load any other fallback converters
try {
loadFallbackTypeConverters();
} catch (NoFactoryAvailableException e) {
// ignore its fine to have none
}
}
示例5: newInstance
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
public Object newInstance(String key) throws NoFactoryAvailableException {
try {
return newInstance(key, null);
} catch (Exception e) {
throw new NoFactoryAvailableException(key, e);
}
}
示例6: createInjector
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
/**
* Lazily create a default implementation
*/
protected Injector createInjector() {
FactoryFinder finder = getDefaultFactoryFinder();
try {
return (Injector) finder.newInstance("Injector");
} catch (NoFactoryAvailableException e) {
// lets use the default injector
return new DefaultInjector(this);
}
}
示例7: getFactoryFinder
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
public FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException {
synchronized (factories) {
FactoryFinder answer = factories.get(path);
if (answer == null) {
answer = factoryFinderResolver.resolveFactoryFinder(getClassResolver(), path);
factories.put(path, answer);
}
return answer;
}
}
示例8: findClass
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
@Override
public Class<?> findClass(String key, String propertyPrefix, Class<?> checkClass) throws ClassNotFoundException, IOException {
if (propertyPrefix == null) {
propertyPrefix = "";
}
Class<?> clazz = classMap.get(propertyPrefix + key);
if (clazz == null) {
BundleEntry entry = getResource(key, checkClass);
if (entry != null) {
URL url = entry.url;
InputStream in = url.openStream();
// lets load the file
BufferedInputStream reader = null;
try {
reader = IOHelper.buffered(in);
Properties properties = new Properties();
properties.load(reader);
String className = properties.getProperty(propertyPrefix + "class");
if (className == null) {
throw new IOException("Expected property is missing: " + propertyPrefix + "class");
}
clazz = entry.bundle.loadClass(className);
classMap.put(propertyPrefix + key, clazz);
} finally {
IOHelper.close(reader, key, null);
IOHelper.close(in, key, null);
}
} else {
throw new NoFactoryAvailableException(propertyPrefix + key);
}
}
return clazz;
}
示例9: createProducer
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
@Override
public Producer createProducer() throws Exception {
RestApiProcessorFactory factory = null;
RestConfiguration config = getCamelContext().getRestConfiguration(componentName, true);
// lookup in registry
Set<RestApiProcessorFactory> factories = getCamelContext().getRegistry().findByType(RestApiProcessorFactory.class);
if (factories != null && factories.size() == 1) {
factory = factories.iterator().next();
}
// lookup on classpath using factory finder to automatic find it (just add camel-swagger-java to classpath etc)
if (factory == null) {
String name = apiComponentName != null ? apiComponentName : config.getApiComponent();
if (name == null) {
name = DEFAULT_API_COMPONENT_NAME;
}
try {
FactoryFinder finder = getCamelContext().getFactoryFinder(RESOURCE_PATH);
Object instance = finder.newInstance(name);
if (instance instanceof RestApiProcessorFactory) {
factory = (RestApiProcessorFactory) instance;
}
} catch (NoFactoryAvailableException e) {
// ignore
}
}
if (factory != null) {
// if no explicit port/host configured, then use port from rest configuration
String host = "";
int port = 80;
if (config.getHost() != null) {
host = config.getHost();
}
int num = config.getPort();
if (num > 0) {
port = num;
}
// if no explicit hostname set then resolve the hostname
if (ObjectHelper.isEmpty(host)) {
if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.allLocalIp) {
host = "0.0.0.0";
} else if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.localHostName) {
host = HostUtils.getLocalHostName();
} else if (config.getRestHostNameResolver() == RestConfiguration.RestHostNameResolver.localIp) {
host = HostUtils.getLocalIp();
}
// no host was configured so calculate a host to use
// there should be no schema in the host (but only port)
String targetHost = host + (port != 80 ? ":" + port : "");
getParameters().put("host", targetHost);
}
// the base path should start with a leading slash
String path = getPath();
if (path != null && !path.startsWith("/")) {
path = "/" + path;
}
// whether listing of the context id's is enabled or not
boolean contextIdListing = config.isApiContextListing();
Processor processor = factory.createApiProcessor(getCamelContext(), path, getContextIdPattern(), contextIdListing, config, getParameters());
return new RestApiProducer(this, processor);
} else {
throw new IllegalStateException("Cannot find RestApiProcessorFactory in Registry or classpath (such as the camel-swagger-java component)");
}
}
示例10: SqsProducer
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
public SqsProducer(SqsEndpoint endpoint) throws NoFactoryAvailableException {
super(endpoint);
}
示例11: S3Consumer
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
public S3Consumer(S3Endpoint endpoint, Processor processor) throws NoFactoryAvailableException {
super(endpoint, processor);
}
示例12: getFactoryFinder
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
@Override
public FactoryFinder getFactoryFinder(String path) throws NoFactoryAvailableException {
return context.getFactoryFinder(path);
}
示例13: newInstance
import org.apache.camel.NoFactoryAvailableException; //导入依赖的package包/类
/**
* Creates a new class instance using the key to lookup
*
* @param key is the key to add to the path to find a text file containing the factory name
* @return a newly created instance
* @throws org.apache.camel.NoFactoryAvailableException is thrown if no factories exist for the given key
*/
Object newInstance(String key) throws NoFactoryAvailableException;