You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sjmcduf <sm...@hotmail.com> on 2010/01/14 00:25:36 UTC

FTP assume directory do not have dot

I have the following error:

Caused by: java.lang.IllegalArgumentException: Only directory is supported.
Endpoint must be configured with a valid directory: ftp.test
	at
org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68)
	at
org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31)
	at
org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60)
	at
org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83)
	at org.apache.camel.impl.RouteService.doStart(RouteService.java:123)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
	at
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906)
	... 1 more

By looking at the source code I saw the following :
        // we assume its a file if the name has a dot in it (eg foo.txt)
        if (configuration.getDirectory().contains(".")) {
            throw new IllegalArgumentException("Only directory is supported.
Endpoint must be configured with a valid directory: "
                    + configuration.getDirectory());
        }

I remove that code and my code is working!! :-)

I think the above code should not assume that.....
What do you think ? 

(using : camel 2.1.0)

Simon
-- 
View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: A bug of InOut pattern?

Posted by ext2 <xu...@tongtech.com>.
Yes you are right. 
But the real confusing thing is: the two routes I tested have same semantic
means, but the result is different.

While I am try to find which caused the difference, I checked the source
code of camel, and find a lot of camel-processor obey the following rule( I
thinks it's camel's default rule for MEP), but the pipe-line processor
violate it (not same as the other processors): 
The rule is :
1)Processor will remember the input message-exchange
2)while the processor get the final result message-exchange, it will combine
the result message-exchange with the remembered input message-exchange. At
this time, MEP will affect how to combine the two message-exchange
3) the combined result will act as the final result of processor;

But the pipe-line processor doesn't remember the input message-exchange, but
remember the result of first processor in the pipe-line as the
message-exchange to combine; So it cause the two routes has different
result;


Willem Jiang wrote:
> Your processor should check the MEP, and don't set the out message if 
> the Exchange's MEP is InOnly.

>If there is a out message, the pipeline will try to copy the out message 
>to next processor exchange's in message, otherwise it will copy the in 
>message to next processor exchange's in message.

>Willem

ext2 wrote:
> Hi:
> The camel 2.1's pipeline patter's MEP is InOnly default. But the result of
> following route is different, if I using inOnly() processor in route vs
> using default;
> 
> I tried it using a simple sample: send a message to a direct endpoint,
which
> body is number=1, a route receive the message and increase the message's
> body twice by a processor, then send to a mock endpoint;
> 
> The increase number process's code is:
> 
> Class IncreaseProcessor{
> 	void process(MessageExchange me)
> 	{
> 		Integer result= Me.getIn().getBody() + 1;
> 		Me.getOut().setBody(result);
> 	}
> }
> 
> 1): following rout using inOnly() processor , and mock endpoint's return
> ME's in.body=3, out=Null
> 
>
from("direct:inOnlyUsingProcessor").inOnly().process(outProcessor).process(o
> utProcessor).to("mock:result");
> 
> 
> 2) following route using default inOnly, and mock's return ME's in.body=3,
> out.body=2. 
>
from("direct:inOnlyDefault").process(outProcessor).process(outProcessor).to(
> "mock:result");
> 
> So why the result has a out message and it's body=2, it should be same as
> the first route(out=null);
> 
> 
> 
> 
> 
> 




Re: A bug of InOut pattern?

Posted by Willem Jiang <wi...@gmail.com>.
Your processor should check the MEP, and don't set the out message if 
the Exchange's MEP is InOnly.

If there is a out message, the pipeline will try to copy the out message 
to next processor exchange's in message, otherwise it will copy the in 
message to next processor exchange's in message.

Willem

ext2 wrote:
> Hi:
> The camel 2.1's pipeline patter's MEP is InOnly default. But the result of
> following route is different, if I using inOnly() processor in route vs
> using default;
> 
> I tried it using a simple sample: send a message to a direct endpoint, which
> body is number=1, a route receive the message and increase the message's
> body twice by a processor, then send to a mock endpoint;
> 
> The increase number process's code is:
> 
> Class IncreaseProcessor{
> 	void process(MessageExchange me)
> 	{
> 		Integer result= Me.getIn().getBody() + 1;
> 		Me.getOut().setBody(result);
> 	}
> }
> 
> 1): following rout using inOnly() processor , and mock endpoint's return
> ME's in.body=3, out=Null
> 
> from("direct:inOnlyUsingProcessor").inOnly().process(outProcessor).process(o
> utProcessor).to("mock:result");
> 
> 
> 2) following route using default inOnly, and mock's return ME's in.body=3,
> out.body=2. 
> from("direct:inOnlyDefault").process(outProcessor).process(outProcessor).to(
> "mock:result");
> 
> So why the result has a out message and it's body=2, it should be same as
> the first route(out=null);
> 
> 
> 
> 
> 
> 


A bug of InOut pattern?

Posted by ext2 <xu...@tongtech.com>.
Hi:
The camel 2.1's pipeline patter's MEP is InOnly default. But the result of
following route is different, if I using inOnly() processor in route vs
using default;

I tried it using a simple sample: send a message to a direct endpoint, which
body is number=1, a route receive the message and increase the message's
body twice by a processor, then send to a mock endpoint;

The increase number process's code is:

Class IncreaseProcessor{
	void process(MessageExchange me)
	{
		Integer result= Me.getIn().getBody() + 1;
		Me.getOut().setBody(result);
	}
}

1): following rout using inOnly() processor , and mock endpoint's return
ME's in.body=3, out=Null

from("direct:inOnlyUsingProcessor").inOnly().process(outProcessor).process(o
utProcessor).to("mock:result");


2) following route using default inOnly, and mock's return ME's in.body=3,
out.body=2. 
from("direct:inOnlyDefault").process(outProcessor).process(outProcessor).to(
"mock:result");

So why the result has a out message and it's body=2, it should be same as
the first route(out=null);






Re: FTP assume directory do not have dot

Posted by sjmcduf <sm...@hotmail.com>.
http://issues.apache.org/activemq/browse/CAMEL-2362

Thank you again

Simon



Claus Ibsen-2 wrote:
> 
> Yeah good call
> 
> Do you mind creating a ticket in JIRA about this?
> http://issues.apache.org/activemq/browse/CAMEL
> 
> 
> On Thu, Jan 14, 2010 at 12:42 PM, sjmcduf <sm...@hotmail.com> wrote:
>>
>>
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Thu, Jan 14, 2010 at 12:25 AM, sjmcduf <sm...@hotmail.com> wrote:
>>>>
>>>> I have the following error:
>>>>
>>>> Caused by: java.lang.IllegalArgumentException: Only directory is
>>>> supported.
>>>> Endpoint must be configured with a valid directory: ftp.test
>>>>        at
>>>> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68)
>>>>        at
>>>> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31)
>>>>        at
>>>> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60)
>>>>        at
>>>> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83)
>>>>        at
>>>> org.apache.camel.impl.RouteService.doStart(RouteService.java:123)
>>>>        at
>>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
>>>>        at
>>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906)
>>>>        ... 1 more
>>>>
>>>> By looking at the source code I saw the following :
>>>>        // we assume its a file if the name has a dot in it (eg foo.txt)
>>>>        if (configuration.getDirectory().contains(".")) {
>>>>            throw new IllegalArgumentException("Only directory is
>>>> supported.
>>>> Endpoint must be configured with a valid directory: "
>>>>                    + configuration.getDirectory());
>>>>        }
>>>>
>>>> I remove that code and my code is working!! :-)
>>>>
>>>> I think the above code should not assume that.....
>>>> What do you think ?
>>>>
>>>
>>>
>>> Its really a bad habit having a dot in a directory name.
>>> On windows will that not often be considered a file?.
>>>
>>> And since its a remote path we cannot on startup determine if its a
>>> path or file.
>>>
>>> The check was made in the transition from 1.x to 2.x where in 1.x you
>>> could define a starting file or directory.
>>> In 2.x you must specify a directory only.
>>>
>>> We could relax the check but then people may still enter a filename
>>> and think Camel will pickup that file.
>>>
>>> [SIMON]
>>> Windows directory can contains a dot... a good example is in your
>>> eclipse
>>> installation... example:
>>> Directory name=org.eclipse.emf.teneo.jpox_1.0.1.v200902271808
>>>
>>> Also I think that check is useless because you can still enter something
>>> without a dot and it is in fact a file... so the endpoint should verify
>>> that after the connection.
>>>
>>> Simon
>>>
>>>> (using : camel 2.1.0)
>>>>
>>>> Simon
>>>> --
>>>> View this message in context:
>>>> http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html
>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>> Twitter: http://twitter.com/davsclaus
>>>
>>>
>>
>> --
>> View this message in context:
>> http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27159998.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27160157.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: FTP assume directory do not have dot

Posted by Claus Ibsen <cl...@gmail.com>.
Yeah good call

Do you mind creating a ticket in JIRA about this?
http://issues.apache.org/activemq/browse/CAMEL


On Thu, Jan 14, 2010 at 12:42 PM, sjmcduf <sm...@hotmail.com> wrote:
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Thu, Jan 14, 2010 at 12:25 AM, sjmcduf <sm...@hotmail.com> wrote:
>>>
>>> I have the following error:
>>>
>>> Caused by: java.lang.IllegalArgumentException: Only directory is
>>> supported.
>>> Endpoint must be configured with a valid directory: ftp.test
>>>        at
>>> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68)
>>>        at
>>> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31)
>>>        at
>>> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60)
>>>        at
>>> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83)
>>>        at
>>> org.apache.camel.impl.RouteService.doStart(RouteService.java:123)
>>>        at
>>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
>>>        at
>>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906)
>>>        ... 1 more
>>>
>>> By looking at the source code I saw the following :
>>>        // we assume its a file if the name has a dot in it (eg foo.txt)
>>>        if (configuration.getDirectory().contains(".")) {
>>>            throw new IllegalArgumentException("Only directory is
>>> supported.
>>> Endpoint must be configured with a valid directory: "
>>>                    + configuration.getDirectory());
>>>        }
>>>
>>> I remove that code and my code is working!! :-)
>>>
>>> I think the above code should not assume that.....
>>> What do you think ?
>>>
>>
>>
>> Its really a bad habit having a dot in a directory name.
>> On windows will that not often be considered a file?.
>>
>> And since its a remote path we cannot on startup determine if its a
>> path or file.
>>
>> The check was made in the transition from 1.x to 2.x where in 1.x you
>> could define a starting file or directory.
>> In 2.x you must specify a directory only.
>>
>> We could relax the check but then people may still enter a filename
>> and think Camel will pickup that file.
>>
>> [SIMON]
>> Windows directory can contains a dot... a good example is in your eclipse
>> installation... example:
>> Directory name=org.eclipse.emf.teneo.jpox_1.0.1.v200902271808
>>
>> Also I think that check is useless because you can still enter something
>> without a dot and it is in fact a file... so the endpoint should verify
>> that after the connection.
>>
>> Simon
>>
>>> (using : camel 2.1.0)
>>>
>>> Simon
>>> --
>>> View this message in context:
>>> http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27159998.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus

Re: FTP assume directory do not have dot

Posted by sjmcduf <sm...@hotmail.com>.



Claus Ibsen-2 wrote:
> 
> On Thu, Jan 14, 2010 at 12:25 AM, sjmcduf <sm...@hotmail.com> wrote:
>>
>> I have the following error:
>>
>> Caused by: java.lang.IllegalArgumentException: Only directory is
>> supported.
>> Endpoint must be configured with a valid directory: ftp.test
>>        at
>> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68)
>>        at
>> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31)
>>        at
>> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60)
>>        at
>> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83)
>>        at
>> org.apache.camel.impl.RouteService.doStart(RouteService.java:123)
>>        at
>> org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
>>        at
>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906)
>>        ... 1 more
>>
>> By looking at the source code I saw the following :
>>        // we assume its a file if the name has a dot in it (eg foo.txt)
>>        if (configuration.getDirectory().contains(".")) {
>>            throw new IllegalArgumentException("Only directory is
>> supported.
>> Endpoint must be configured with a valid directory: "
>>                    + configuration.getDirectory());
>>        }
>>
>> I remove that code and my code is working!! :-)
>>
>> I think the above code should not assume that.....
>> What do you think ?
>>
> 
> 
> Its really a bad habit having a dot in a directory name.
> On windows will that not often be considered a file?.
> 
> And since its a remote path we cannot on startup determine if its a
> path or file.
> 
> The check was made in the transition from 1.x to 2.x where in 1.x you
> could define a starting file or directory.
> In 2.x you must specify a directory only.
> 
> We could relax the check but then people may still enter a filename
> and think Camel will pickup that file.
> 
> [SIMON]
> Windows directory can contains a dot... a good example is in your eclipse
> installation... example:
> Directory name=org.eclipse.emf.teneo.jpox_1.0.1.v200902271808
> 
> Also I think that check is useless because you can still enter something
> without a dot and it is in fact a file... so the endpoint should verify
> that after the connection.
> 
> Simon
> 
>> (using : camel 2.1.0)
>>
>> Simon
>> --
>> View this message in context:
>> http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Author of Camel in Action: http://www.manning.com/ibsen/
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
> 
> 

-- 
View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27159998.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: FTP assume directory do not have dot

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Jan 14, 2010 at 12:25 AM, sjmcduf <sm...@hotmail.com> wrote:
>
> I have the following error:
>
> Caused by: java.lang.IllegalArgumentException: Only directory is supported.
> Endpoint must be configured with a valid directory: ftp.test
>        at
> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68)
>        at
> org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31)
>        at
> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60)
>        at
> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83)
>        at org.apache.camel.impl.RouteService.doStart(RouteService.java:123)
>        at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55)
>        at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906)
>        ... 1 more
>
> By looking at the source code I saw the following :
>        // we assume its a file if the name has a dot in it (eg foo.txt)
>        if (configuration.getDirectory().contains(".")) {
>            throw new IllegalArgumentException("Only directory is supported.
> Endpoint must be configured with a valid directory: "
>                    + configuration.getDirectory());
>        }
>
> I remove that code and my code is working!! :-)
>
> I think the above code should not assume that.....
> What do you think ?
>

Its really a bad habit having a dot in a directory name.
On windows will that not often be considered a file?.

And since its a remote path we cannot on startup determine if its a
path or file.

The check was made in the transition from 1.x to 2.x where in 1.x you
could define a starting file or directory.
In 2.x you must specify a directory only.

We could relax the check but then people may still enter a filename
and think Camel will pickup that file.


> (using : camel 2.1.0)
>
> Simon
> --
> View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus