public static boolean canAcceptOutput(Class<?> aClass, ProcessorDefinition def) { if (aClass == null) { return false; } // special for bean/marshal/unmarshal, until their isOutputSupport would return false if (BeanDefinition.class.isAssignableFrom(aClass)) { return false; } if (MarshalDefinition.class.isAssignableFrom(aClass) || UnmarshalDefinition.class.isAssignableFrom(aClass) || TransactedDefinition.class.isAssignableFrom(aClass)) { return false; } // use isOutputSupport on camel model if (ProcessorDefinition.class.isAssignableFrom(aClass)) { if (def != null) { boolean answer = def.isOutputSupported(); return answer; } } // assume no output is supported return false; }
@Test public void testCanImport() throws Exception { assertCanAcceptInput(MarshalDefinition.class, false); assertCanAcceptInput(BeanDefinition.class, false); assertCanAcceptInput(FilterDefinition.class, true); }
public ManagedMarshal(CamelContext context, MarshalProcessor processor, MarshalDefinition definition) { super(context, processor, definition); this.processor = processor; }
@Override public MarshalDefinition getDefinition() { return (MarshalDefinition) super.getDefinition(); }
@SuppressWarnings({"rawtypes"}) private void findOutputComponents(List<ProcessorDefinition<?>> defs, Set<String> components, Set<String> languages, Set<String> dataformats) { if (defs != null) { for (ProcessorDefinition<?> def : defs) { if (def instanceof SendDefinition) { findUriComponent(((SendDefinition) def).getUri(), components); } if (def instanceof MarshalDefinition) { findDataFormat(((MarshalDefinition) def).getDataFormatType(), dataformats); } if (def instanceof UnmarshalDefinition) { findDataFormat(((UnmarshalDefinition) def).getDataFormatType(), dataformats); } if (def instanceof ExpressionNode) { findLanguage(((ExpressionNode) def).getExpression(), languages); } if (def instanceof ResequenceDefinition) { findLanguage(((ResequenceDefinition) def).getExpression(), languages); } if (def instanceof AggregateDefinition) { findLanguage(((AggregateDefinition) def).getExpression(), languages); findLanguage(((AggregateDefinition) def).getCorrelationExpression(), languages); findLanguage(((AggregateDefinition) def).getCompletionPredicate(), languages); findLanguage(((AggregateDefinition) def).getCompletionTimeoutExpression(), languages); findLanguage(((AggregateDefinition) def).getCompletionSizeExpression(), languages); } if (def instanceof CatchDefinition) { findLanguage(((CatchDefinition) def).getHandled(), languages); } if (def instanceof OnExceptionDefinition) { findLanguage(((OnExceptionDefinition) def).getRetryWhile(), languages); findLanguage(((OnExceptionDefinition) def).getHandled(), languages); findLanguage(((OnExceptionDefinition) def).getContinued(), languages); } if (def instanceof SortDefinition) { findLanguage(((SortDefinition) def).getExpression(), languages); } if (def instanceof WireTapDefinition) { findLanguage(((WireTapDefinition<?>) def).getNewExchangeExpression(), languages); } findOutputComponents(def.getOutputs(), components, languages, dataformats); } } }