@Override protected Endpoint convertBeanToEndpoint(String uri, Object bean) { // We will use the type convert to build the endpoint first Endpoint endpoint = getTypeConverter().convertTo(Endpoint.class, bean); if (endpoint != null) { endpoint.setCamelContext(this); return endpoint; } return new ProcessorEndpoint(uri, this, new BeanProcessor(bean, this)); }
if (r.next()) { BeanProcessor bp = new BeanProcessor(); emp = bp.toBean(r, Employee.class); }
public void process(Exchange exchange) throws Exception { beanProcessor.process(exchange); }
public <T> List<T> queryBeanList(String sql, final Class<T> clazz,final Map<String, String> columnToPropertyOverrides) throws SQLException { ResultSetHandler<List<T>> rsh = new ResultSetHandler<List<T>>(){ @Override public List<T> handle(ResultSet rs) throws SQLException { BeanProcessor bp = new BeanProcessor(columnToPropertyOverrides); return bp.toBeanList(rs, clazz); } }; return query(sql, rsh); }
public RmiProducer(RmiEndpoint endpoint) throws RemoteException, NotBoundException { super(endpoint); BeanHolder holder = new RmiRegistryBean(endpoint.getCamelContext(), endpoint.getName(), endpoint.getRegistry()); beanProcessor = new BeanProcessor(holder); String method = endpoint.getMethod(); if (method != null) { beanProcessor.setMethod(method); } }
serviceProxy = ProxyHelper.createProxy(endpoint, bind, producer, getServiceInterface()); } catch (Exception e) { throw new FailedToCreateProducerException(endpoint, e);
from( "direct:start" ).process( new Processor() { @Override public void process( Exchange e) throws Exception { final BeanInvocation bi = e.getIn().getBody( BeanInvocation.class ); e.getIn().setBody( bi.getArgs() ); } } ).to( "cxf:bean:cxfEndpoint" )
@ConditionalOnMissingBean(BeanComponent.class) public BeanComponent configureBeanComponent() throws Exception { BeanComponent component = new BeanComponent(); component.setCamelContext(camelContext); Map<String, Object> parameters = new HashMap<>(); IntrospectionSupport.getProperties(configuration, parameters, null,
@Override protected void doStart() throws Exception { super.doStart(); if (context == null && properties != null) { context = new InitialContext(getProperties()); } } }
throw new IllegalStateException("The endpoint is not active: " + getEndpoint().getEndpointUri()); BeanInvocation invocation = new BeanInvocation(method, args); Exchange exchange = getEndpoint().createExchange(); exchange.getIn().setBody(invocation);
public void afterPropertiesSet() throws Exception { // lets bind the URI to a pojo notNull(uri, "uri"); // Always resolve the camel context by using the camelContextID if (ObjectHelper.isNotEmpty(camelContextId)) { camelContext = CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId); } notNull(camelContext, "camelContext"); if (serviceRef != null && getService() == null && applicationContext != null) { setService(applicationContext.getBean(serviceRef)); } Endpoint endpoint = CamelContextHelper.getMandatoryEndpoint(camelContext, uri); notNull(getService(), "service"); Object proxy = getProxyForService(); try { // need to start endpoint before we create consumer ServiceHelper.startService(endpoint); consumer = endpoint.createConsumer(new BeanProcessor(proxy, camelContext)); // add and start consumer camelContext.addService(consumer, true, true); } catch (Exception e) { throw new FailedToCreateConsumerException(endpoint, e); } }
serviceProxy = ProxyHelper.createProxy(endpoint, bind, producer, clazz); } catch (Exception e) { throw new FailedToCreateProducerException(endpoint, e);
} else { if (BeanInvocation.class.isAssignableFrom(msg.getClass())) { msg = ((BeanInvocation)msg).getArgs()[0];
@Override public T create(CreationalContext<T> creationalContext) { try { CamelContext context = isNotEmpty(exporter.getCamelContextId()) ? getReferenceByName(manager, exporter.getCamelContextId(), CamelContext.class).get() : getReference(manager, CamelContext.class, this.context); Bean<?> bean = manager.resolve(manager.getBeans(exporter.getServiceRef())); if (bean == null) { throw new UnsatisfiedResolutionException("No bean with name [" + exporter.getServiceRef() + "] is deployed!"); } @SuppressWarnings("unchecked") T service = (T) manager.getReference(bean, type, manager.createCreationalContext(bean)); Endpoint endpoint = getMandatoryEndpoint(context, exporter.getUri()); try { // need to start endpoint before we create consumer startService(endpoint); Consumer consumer = endpoint.createConsumer(new BeanProcessor(service, context)); // add and start consumer context.addService(consumer, true, true); } catch (Exception cause) { throw new FailedToCreateConsumerException(endpoint, cause); } return service; } catch (Exception cause) { throw new CreationException("Error while creating instance for " + this, cause); } }
return createProxy(endpoint, bind, producer, (Class<T>) proxy.getServiceInterface()); } catch (Exception cause) { throw new FailedToCreateProducerException(endpoint, cause);