コード例 #1
0
 @Override
 protected CamelContext createCamelContext() throws Exception {
   CamelContext context = super.createCamelContext();
   // simulate JMS with the SEDA component
   context.addComponent("jms", context.getComponent("seda"));
   return context;
 }
コード例 #2
0
  @Override
  protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    PropertiesComponent pc = context.getComponent("properties", PropertiesComponent.class);
    pc.setLocation("ref:myProp");

    return context;
  }
コード例 #3
0
  @Override
  protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();

    QuartzComponent quartz = context.getComponent("quartz", QuartzComponent.class);
    quartz.setEnableJmx(isEnableJmx());

    return context;
  }
コード例 #4
0
ファイル: BeanInfo.java プロジェクト: tivv/camel
  public BeanInfo(
      CamelContext camelContext,
      Class<?> type,
      Method explicitMethod,
      ParameterMappingStrategy strategy) {
    this.camelContext = camelContext;
    this.type = type;
    this.strategy = strategy;
    this.component = camelContext.getComponent("bean", BeanComponent.class);

    final BeanInfoCacheKey key = new BeanInfoCacheKey(type, explicitMethod);

    // lookup if we have a bean info cache
    BeanInfo beanInfo = component.getBeanInfoFromCache(key);
    if (beanInfo != null) {
      // copy the values from the cache we need
      defaultMethod = beanInfo.defaultMethod;
      operations = beanInfo.operations;
      operationsWithBody = beanInfo.operationsWithBody;
      operationsWithNoBody = beanInfo.operationsWithNoBody;
      operationsWithCustomAnnotation = beanInfo.operationsWithCustomAnnotation;
      operationsWithHandlerAnnotation = beanInfo.operationsWithHandlerAnnotation;
      methodMap = beanInfo.methodMap;
      publicConstructors = beanInfo.publicConstructors;
      return;
    }

    if (explicitMethod != null) {
      // must be a valid method
      if (!isValidMethod(type, explicitMethod)) {
        throw new IllegalArgumentException(
            "The method "
                + explicitMethod
                + " is not valid (for example the method must be public)");
      }
      introspect(getType(), explicitMethod);
    } else {
      introspect(getType());
    }

    // if there are only 1 method with 1 operation then select it as a default/fallback method
    MethodInfo method = null;
    if (operations.size() == 1) {
      List<MethodInfo> methods = operations.values().iterator().next();
      if (methods.size() == 1) {
        method = methods.get(0);
      }
    }
    defaultMethod = method;

    // mark the operations lists as unmodifiable, as they should not change during runtime
    // to keep this code thread safe
    operations = Collections.unmodifiableMap(operations);
    operationsWithBody = Collections.unmodifiableList(operationsWithBody);
    operationsWithNoBody = Collections.unmodifiableList(operationsWithNoBody);
    operationsWithCustomAnnotation = Collections.unmodifiableList(operationsWithCustomAnnotation);
    operationsWithHandlerAnnotation = Collections.unmodifiableList(operationsWithHandlerAnnotation);
    methodMap = Collections.unmodifiableMap(methodMap);

    // add new bean info to cache
    component.addBeanInfoToCache(key, this);
  }