Re: camel-jsch in sink mode for one time copy from a remote host using SCP

2013-05-10 Thread kzmeyao
Sorry for reviving an old thread, but is there an update on this?

I would like to use this as well.

Thanks!



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jsch-in-sink-mode-for-one-time-copy-from-a-remote-host-using-SCP-tp5680887p5732308.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-jsch in sink mode for one time copy from a remote host using SCP

2012-09-06 Thread vishal1981
Hi Hadrian ,
I am facing the same issue. Can you tell me where you checked in you fix.
Thanks in advance,
Vishal



--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jsch-in-sink-mode-for-one-time-copy-from-a-remote-host-using-SCP-tp5680887p5718734.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-jsch in sink mode for one time copy from a remote host using SCP

2012-05-08 Thread mohammadwrk
Thanks for the update :-)

--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jsch-in-sink-mode-for-one-time-copy-from-a-remote-host-using-SCP-tp5680887p5691711.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-jsch in sink mode for one time copy from a remote host using SCP

2012-05-07 Thread mohammadwrk

hadrian wrote
 
 ...Give me one day to put some code together...
 

Hi Hadrian,

Did you get a chance to put together some code for this feature?

Thanks,
Mohammad

--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jsch-in-sink-mode-for-one-time-copy-from-a-remote-host-using-SCP-tp5680887p5691293.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: camel-jsch in sink mode for one time copy from a remote host using SCP

2012-05-07 Thread Hadrian Zbarcea
Yes, I got the sink mode working in operations, still a few things to 
iron out. I will finish the private key first though.


Thanks for the patience,
Hadrian

On 05/07/2012 11:02 AM, mohammadwrk wrote:


hadrian wrote


...Give me one day to put some code together...



Hi Hadrian,

Did you get a chance to put together some code for this feature?

Thanks,
Mohammad

--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jsch-in-sink-mode-for-one-time-copy-from-a-remote-host-using-SCP-tp5680887p5691293.html
Sent from the Camel - Users mailing list archive at Nabble.com.


--
Hadrian Zbarcea
Principal Software Architect
Talend, Inc
http://coders.talend.com/
http://camelbot.blogspot.com/


Re: camel-jsch in sink mode for one time copy from a remote host using SCP

2012-05-02 Thread Hadrian Zbarcea
The main issue is that with scp you cannot list the content of a remote 
file system. It is possible to implement a consumer that can be used in 
conjunction with a ConsumerTemplate. The protocol is a bit tricky to 
implement, but too hard. Give me one day to put some code together.


Hadrian


On 05/02/2012 11:43 AM, mohammadwrk wrote:

Hi,

According to  http://camel.apache.org/jsch.html camel-jsch : Currently
camel-jsch only supports a Producer (i.e. copy files to another host)... It
is possible however to use camel-jsch in sink mode for one time copy from a
remote host using a ConsumerTemplate.

Here is the code I'm using to test this functionality:

camelContext = new DefaultCamelContext();
msgConsumer = camelContext.createConsumerTemplate();
camelContext.addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
ScpConsumer scpConsumer = new ScpConsumer(msgConsumer,

scp://remotehost/test_scp/test.txt?username=myuserpassword=mypasswordknownHostsFile=/myhome/.ssh/known_hosts);
from(timer://foo?period=5000).bean(scpConsumer, receive);

}
});
camelContext.start();



public static class ScpConsumer {

private final ConsumerTemplate consumer;
private final String uri;

public ScpConsumer(ConsumerTemplate consumer, String uri) {
this.consumer = consumer;
this.uri = uri;
}

public void receive() {
Object body = consumer.receiveBodyNoWait(uri);
System.out.println(body);
}
}

This code results in NPE (see below for stack trace). Here is the source
code for  org.apache.camel.component.jsch.ScpEndpoint.buildConsumer

 @Override
 protected RemoteFileConsumerScpFile  buildConsumer(Processor processor)
{
 return null; // new ScpConsumer(this, processor,
createRemoteFileOperations());
 }

Which explains the NPE! Wondering if anybody knows how I can fix this issue?

08:14:01,664 ERROR DefaultErrorHandler:161 - Failed delivery for (MessageId:
ID-msg-35692-1335971640877-0-1 on ExchangeId:
ID-msg-35692-1335971640877-0-2). Exhausted after delivery attempt: 1 caught:
org.apache.camel.FailedToCreateConsumerException: Failed to create Consumer
for endpoint:
Endpoint[scp://remotehost/test_scp/test.txt?knownHostsFile=/myhome/.ssh/known_hostspassword=**username=myuser].
Reason: java.lang.NullPointerException
org.apache.camel.FailedToCreateConsumerException: Failed to create Consumer
for endpoint:
Endpoint[scp://remotehost/test_scp/test.txt?knownHostsFile=/myhome/.ssh/known_hostspassword=**username=myuser].
Reason: java.lang.NullPointerException
at 
org.apache.camel.impl.ConsumerCache.getConsumer(ConsumerCache.java:81)
at
org.apache.camel.impl.ConsumerCache.receiveNoWait(ConsumerCache.java:116)
at
org.apache.camel.impl.DefaultConsumerTemplate.receiveNoWait(DefaultConsumerTemplate.java:92)
at
org.apache.camel.impl.DefaultConsumerTemplate.receiveBodyNoWait(DefaultConsumerTemplate.java:131)
at
ca.sk.gov.cjimspoc.service.camel.CamelService$ScpConsumer.receive(CamelService.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at 
org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:340)
at
org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:237)
at
org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:166)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)
at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91)
at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:333)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:223)
at

Re: camel-jsch in sink mode for one time copy from a remote host using SCP

2012-05-02 Thread mohammadwrk
Thanks for the quick reply. 
 Give me one day to put some code together. 
Looking forward into it.

--
View this message in context: 
http://camel.465427.n5.nabble.com/camel-jsch-in-sink-mode-for-one-time-copy-from-a-remote-host-using-SCP-tp5680887p5680932.html
Sent from the Camel - Users mailing list archive at Nabble.com.