Re: How can Shiro be used with camel to limit access to a route?

2013-05-06 Thread jethwani.bi...@gmail.com
Thank you for the reply.
Is there a way to make the type converter work for camel header?
Currently, I have a camel processor to reset the base64 shiro token to
ByteSource, on the side where authentication has to be done



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-Shiro-be-used-with-camel-to-limit-access-to-a-route-tp5521623p5732055.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exception handling for camel-ftp

2013-05-06 Thread sarfaraj
Thanks clause. Have follow up question.

Currently I see two below exceptions in FTP

org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
connect to XXX file system location OR
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: XXX file system location


But I am not sure about which predicate to use in onWhen which will make
sure that to retry when FTP exception occurred. I tried few things also
googled but no luck.

/Sarfaraj



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-handling-for-camel-ftp-tp5732051p5732056.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exception handling for camel-ftp

2013-05-06 Thread Claus Ibsen
Hi

If you have a copy of Camel in Action, then see page 150.

If you want to do in XML then you can possible do

onWhensimple${exception.message} contains 'connect to'/simpleonWhen

But you can also use a java bean

public static boolean
isConnectError(GenericFileOperationFailedException cause) {
   ...
}

bean id=myBean class=com.foo.MyErrorBean/

onWhenmethod ref=myBean method=isConnectError//onWhen



On Mon, May 6, 2013 at 8:00 AM, sarfaraj sarfarajsay...@gmail.com wrote:
 Thanks clause. Have follow up question.

 Currently I see two below exceptions in FTP

 org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
 connect to XXX file system location OR
 org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
 store file: XXX file system location


 But I am not sure about which predicate to use in onWhen which will make
 sure that to retry when FTP exception occurred. I tried few things also
 googled but no luck.

 /Sarfaraj



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Exception-handling-for-camel-ftp-tp5732051p5732056.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: How can Shiro be used with camel to limit access to a route?

2013-05-06 Thread Claus Ibsen
You can use your own messageConverter with the camel-jms component and
do all the to/from JMS yourselves. This is of course too much work.
But that gives you full power.

You can use interceptors to match when sending to jms, where you can
then transform the header to a valid JMS type.
And then have a type converter on the other side to go from
base64/String - ByteSource
http://camel.apache.org/intercept



On Mon, May 6, 2013 at 7:49 AM, jethwani.bi...@gmail.com
jethwani.bi...@gmail.com wrote:
 Thank you for the reply.
 Is there a way to make the type converter work for camel header?
 Currently, I have a camel processor to reset the base64 shiro token to
 ByteSource, on the side where authentication has to be done



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/How-can-Shiro-be-used-with-camel-to-limit-access-to-a-route-tp5521623p5732055.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


What the main Difference between Stoppping the Route and Suspending the Route

2013-05-06 Thread Dayakar




--
View this message in context: 
http://camel.465427.n5.nabble.com/What-the-main-Difference-between-Stoppping-the-Route-and-Suspending-the-Route-tp5732059.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: What the main Difference between Stoppping the Route and Suspending the Route

2013-05-06 Thread Claus Ibsen
Hi

See this page
http://camel.apache.org/lifecycle

On Mon, May 6, 2013 at 8:54 AM, Dayakar daya.kond...@gmail.com wrote:




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/What-the-main-Difference-between-Stoppping-the-Route-and-Suspending-the-Route-tp5732059.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Sftp bug in Camel 2.11.0

2013-05-06 Thread Bengt Rodehav
JIRA created:

https://issues.apache.org/jira/browse/CAMEL-6335

/Bengt


2013/5/6 Bengt Rodehav be...@rodehav.com

 Hello Hadrian,

 I'm not really interested in the blame issue. I'm really glad that there
 are so many competent people developing Camel which I think is a great
 product. It might be interesting, though, to see how long the bug has been
 there and what versions are affected.

 I've also been thinking why it hasn't been picked up by any tests. I
 realize that it must be very difficult to design tests for integration
 components like sftp. Ideally you would have a number of ftp/ftps/sftp
 servers to perform integration tests against. But I guess that is hard to
 maintain. I don't think unit tests (with mocking) will catch bugs like the
 above. How are ftp/ftps/sftp integrations tested?

 I have noticed that some sftp servers silently ignore attempts to change
 directory to a non-existing directory - you won't get there but you won't
 get an error code either. But some will give you an error code (like the
 one we are integrating to right now).

 I will create a JIRA. As for patching I guess the most important part is
 to determine if it is necessary to change back to the home directory in a
 stepwise fashion or not. If not, then I think we can just remove that code.
 If it is necessary, then we must instead fix it.

 /Bengt



 2013/5/3 Hadrian Zbarcea hzbar...@gmail.com

 Bengt, many thanks for reporting this.

 Either svn or git tells you pretty quickly how that code got there (git
 blame). Do you mind raising a jira for this embarrassing bug? If you want
 to contribute a patch it'd be highly appreciated. That aside, I'll look
 into it in the afternoon. I'll need to check if that piece of code was
 meant to address another usecase or was an oversight and insufficient
 testing.

 Cheers,
 Hadrian



 On 05/03/2013 10:35 AM, Bengt Rodehav wrote:

 Unfortunately I seem to have found another bug in Camel 2.11.0 regarding
 sftp. I noticed it when I removed the stepwise=false argument from my
 routes thus enabling the default stepwise way of changing directory.

 The problematic section begins at line 404 in SftpOperations.java:

 *404:*if (getCurrentDirectory().**startsWith(path)) {
 *405:*// use relative path
 *406:*String p = getCurrentDirectory().**
 substring(path.length());
 *407:*if (p.length() == 0) {
 *408:*return;
 *409:*}
 *410:*// the first character must be '/' and hence removed
 *411:*path =
 UP_DIR_PATTERN.matcher(p).**replaceAll(/..).substring(1)**;
 *412:*}



 The problem does not arise when stepping down into the directory to poll
 but when going back to the directory where we started. Assume that the
 home
 directory in the sftp server is / and I want to poll the directory in
 relative to the root. My endpoint would look something like this:

sftp://user@server/in?**password=secret

 What happens is that the i in in is removed and Camel attempts to
 change to directory n. Looking at the code above, the following
 happens:

 - The current directory is /in since we have previously succeeded in
 moving there and polling for files. We are now attempting to go back to
 where we started, therefore path is /.
 - On line 406, the variable p will be set to in, thus removing the
 leading /.
 - On line 411 an incorrect assumption is made: It is assumed that the
 first
 character must be / but the leading / was removed on line 406. The
 result is therefore that path is set to n instead of in.

 I haven't investigated when this error was introduced. I did however
 compare with the corresponding logic in FtpOperations.java. In that file
 the section quoted above does not exist at all. It seems to me that the
 purpose with this code is to, stepwise, change directory up to .. - one
 directory at a time instead of going straight to /. It seems very
 unnecessary to me but I assume there is a reason for it. Otherwise, the
 easiest change would be to just remove the code above and use the same
 logic as in FtpOperations.java.

 Currently my only workaround is to use stepwise=false.

 /Bengt





Re: Exception handling for camel-ftp

2013-05-06 Thread sarfaraj
Yes I want to do in XML only.

Adding below two lines will cover these two exception. But I am not sure
about other (all) FTP related exception.

Basically I need a list, what all exception will occur in case of FTP used.
So i can add that exception in onWhen

org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
connect to XXX file system location OR 
org.apache.camel.component.file.GenericFileOperationFailedException: Cannot
store file: XXX file system location

 
onWhensimple${exception.message} contains 'connect to'/simpleonWhen
onWhensimple${exception.message} contains 'store file'/simpleonWhen







--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-handling-for-camel-ftp-tp5732051p5732063.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exception handling for camel-ftp

2013-05-06 Thread sarfaraj
Currently i am aware of these two only. I dont know others if any



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-handling-for-camel-ftp-tp5732051p5732065.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: What the main Difference between Stoppping the Route and Suspending the Route

2013-05-06 Thread mdo
Dayakar wrote
 Can you please explain the exact when we need to use stopRoute(id) and
 suspendRoute(id) with an examples

Have a look at this thread:
http://camel.465427.n5.nabble.com/2-11-File2-Quartz-threads-leaking-td5731922.html

Obviously there are some pitfalls and I think in essence you should only
stop a route when you do not want to re-start it without removing the route
from the context. Note that endpoints may have a different behaviour on
suspend or stop, e.g. SFTP keeps the connection open when suspended. Suspend
is your friend if you want to pause the processing of new messages
temporarily.

Regards, mdo.





--
View this message in context: 
http://camel.465427.n5.nabble.com/What-the-main-Difference-between-Stoppping-the-Route-and-Suspending-the-Route-tp5732059p5732071.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: ftpConsumer still remain in threadpools (seen in javaVisual JVMBeansorg.apache.camelthreadPools)

2013-05-06 Thread dtjep
Hi,
Problem resolved by creating my own FtpConsumer.
Best regards,
Dtjep



--
View this message in context: 
http://camel.465427.n5.nabble.com/ftpConsumer-still-remain-in-threadpools-seen-in-javaVisual-JVM-Beans-org-apache-camel-threadPools-tp5730976p5732076.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: REST Proxy Service

2013-05-06 Thread vizaac
Hi All,

Please reply, I really need some help here



--
View this message in context: 
http://camel.465427.n5.nabble.com/REST-Proxy-Service-tp5731827p5732077.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Question about Camel end() and endChoice() expressions

2013-05-06 Thread nikagra
Hello

I have question about end() and endChoice() expressions. Here is how my
route looks like:
Some XML--split--continue processing

XML structure is like:
personnameV. Lenin/nameaddressSoviet Russia, Moscow,
Kremlin/address/person

Here is part of my route:
.split(xpath(/person/*))
.convertBodyTo(String.class)
.choice()
.when(xpath(/address))
.setBody(xpath(/person/adderss/text()))
.to(direct:processAddress)
.when(xpath(/name))
.setBody(xpath(/person/name/text()))
.to(direct:process)
.end() // (*)
.end()

During XML processing I want to process parts of XML (i.e. write them to
file) and then process initial XML as a whole. I've found that depending of
what I put to line marked with asterisk message will contain either one of
splitted parts (name or address if endChoice() is put in this line) or whole
message (in case of end()).
I failed to find some exhaustive documentation on when I should use end() or
endChoice() expressions

Could you please explain such behavior?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Question-about-Camel-end-and-endChoice-expressions-tp5732079.html
Sent from the Camel - Users mailing list archive at Nabble.com.


add bean to registry in custom endpoint?

2013-05-06 Thread javamonkey79
Can you add a custom bean to the registry in a custom endpoint?

I'd like to be able to add some default beans to the registry in my custom
endpoint, is this possible?

I can see that I can get the camel context from the endpoint, and I can get
the registry from the camel context - but the registry appears to be
immutable.

Thanks!



--
View this message in context: 
http://camel.465427.n5.nabble.com/add-bean-to-registry-in-custom-endpoint-tp5732085.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: What the main Difference between Stoppping the Route and Suspending the Route

2013-05-06 Thread Dayakar
Hi,
Thanks for your Reply

I Have gone through the link which you suggested.

But i have some doubts regarding Stop and suspending the route.

I Have a Route with following Code
from(jms:queue:JobQueue)
.routeId(getName())
.process(new JobProcessor())
.to(jms:queue:destQueue); 
If i stop the Above route by using camelContext.stopRoute(id) 
== Does this stop the route and when we say startRoute(id) it start the new
Route?

If i suspend the Above route by using camelContext.suspendRoute(Id)
=Does this suspend route for sometime and when we invoke resumeRoute(id) it
start the existing Route?

Can you please explain the exact when we need to use stopRoute(id) and
suspendRoute(id) with an examples

Thanks in advance 



--
View this message in context: 
http://camel.465427.n5.nabble.com/What-the-main-Difference-between-Stoppping-the-Route-and-Suspending-the-Route-tp5732059p5732067.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: What the main Difference between Stoppping the Route and Suspending the Route

2013-05-06 Thread Dayakar




--
View this message in context: 
http://camel.465427.n5.nabble.com/What-the-main-Difference-between-Stoppping-the-Route-and-Suspending-the-Route-tp5732059p5732068.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How can Shiro be used with camel to limit access to a route?

2013-05-06 Thread jethwani.bi...@gmail.com
Does it makes sense to have alwaysReauthenticate set from shiro.ini [main]
block?
I believe seeing the ShiroSecurityPolicy.java code that it won't pick that
setting from ini file for now.



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-can-Shiro-be-used-with-camel-to-limit-access-to-a-route-tp5521623p5732069.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exception handling for camel-ftp

2013-05-06 Thread sarfaraj
I can see one more exception now

org.apache.camel.component.file.GenericFileOperationFailedException: File
operation failed:  Connection closed without indication

How can I confirm that all exception covered using onWhen

Its very difficult for me to find all . Can someone tell me what is the best
way to cover all FTP exception? I don't want to miss any, also don't want to
retry in case of local file error i.e. file:src/target.

/Sarfaraj



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-handling-for-camel-ftp-tp5732051p5732070.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: cxf:rsClient 2way SSL

2013-05-06 Thread jasonor
Thanks Sergey, much appreciated!



--
View this message in context: 
http://camel.465427.n5.nabble.com/cxf-rsClient-2way-SSL-tp5731991p5732072.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Sql Component insert with batch=true, Camel 2.11

2013-05-06 Thread kalber
Hi, 
i'm working on an Oracle-DB 10.2.0.1.0 and using ojdbc6.jar.

Using the Sql component it works inserting  record with the this.
configuration :

@Override
public void configure() throws Exception {
from(direct:infor.insert.ipnl_passages)
.to(sql:insert into cust_ipnl_passages (ID, 
)
  values (sys_guid(),
...))?dataSource=#infor.DataSourcebatch=true);
}


Exceeding a certain number of records  no insert is done, the table is
empty.

Is there a way to load a huge amount of records ?

thanks
kh






--
View this message in context: 
http://camel.465427.n5.nabble.com/Sql-Component-insert-with-batch-true-Camel-2-11-tp5732073.html
Sent from the Camel - Users mailing list archive at Nabble.com.


DefaultClassResolver and schemes

2013-05-06 Thread richardgroote
Hello,

In our project we'd like to resolve uri within the camel configuration.
For instance camel:to uri=xslt:myScheme://myProject/test.xslt /.
It's not possible to resolve the resources through file, classpath, etc.

We created an extension on the org.apache.camel.impl.DefaultClassResolver
and override the method loadResourceAsStream with our own resolving. This
was working fine camel 2.10.1 but it's not working anymore within 2.11.
Within the org.apache.camel.builder.xml.XsltUriResolver the '//' within my
url is replaced with '/'. I fixed it in our extension but now i have the
following questions:

- Is the above solution the correct solution or are there are ways to
resolve uri's.
- Is it correct that slashes are removed

Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/DefaultClassResolver-and-schemes-tp5732075.html
Sent from the Camel - Users mailing list archive at Nabble.com.


How to replace hard coded URIs?

2013-05-06 Thread Al Ferguson
Hi,

I defined the following route that works very well.

However, I have to read the URIs of the 3 services from ZooKeeper nodes.

How to replace the 3 hard coded URIs in the initial route by value nodes
read from Zookeeper?

Thanks



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-replace-hard-coded-URIs-tp5732083.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Exception handling for camel-ftp

2013-05-06 Thread Claus Ibsen
Its the FTP server that returns the errors. So you should go look for
the FTP error codes. There is some standard codes. So google and find
them.

And as said you can use getCode on the exception to get the code, and
use that in your check instead of the error message text.

On Mon, May 6, 2013 at 9:54 AM, sarfaraj sarfarajsay...@gmail.com wrote:
 I can see one more exception now

 org.apache.camel.component.file.GenericFileOperationFailedException: File
 operation failed:  Connection closed without indication

 How can I confirm that all exception covered using onWhen

 Its very difficult for me to find all . Can someone tell me what is the best
 way to cover all FTP exception? I don't want to miss any, also don't want to
 retry in case of local file error i.e. file:src/target.

 /Sarfaraj



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Exception-handling-for-camel-ftp-tp5732051p5732070.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Question about Camel end() and endChoice() expressions

2013-05-06 Thread Claus Ibsen
Hi

A good idea is to use the search box on the Camel front page
Then you can type in eg: endChoice and read the links



On Mon, May 6, 2013 at 2:28 PM, nikagra nika...@gmail.com wrote:
 Hello

 I have question about end() and endChoice() expressions. Here is how my
 route looks like:
 Some XML--split--continue processing

 XML structure is like:
 personnameV. Lenin/nameaddressSoviet Russia, Moscow,
 Kremlin/address/person

 Here is part of my route:
 .split(xpath(/person/*))
 .convertBodyTo(String.class)
 .choice()
 .when(xpath(/address))
 .setBody(xpath(/person/adderss/text()))
 .to(direct:processAddress)
 .when(xpath(/name))
 .setBody(xpath(/person/name/text()))
 .to(direct:process)
 .end() // (*)
 .end()

 During XML processing I want to process parts of XML (i.e. write them to
 file) and then process initial XML as a whole. I've found that depending of
 what I put to line marked with asterisk message will contain either one of
 splitted parts (name or address if endChoice() is put in this line) or whole
 message (in case of end()).
 I failed to find some exhaustive documentation on when I should use end() or
 endChoice() expressions

 Could you please explain such behavior?



 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/Question-about-Camel-end-and-endChoice-expressions-tp5732079.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cib...@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


Re: Exception running a simple websocket with Camel component on Jetty

2013-05-06 Thread soumya_sd
I posted a solution (not perfect but works) on the Stackoverflow thread in
case someone is interested or faces the same issue in the future. 



--
View this message in context: 
http://camel.465427.n5.nabble.com/Exception-running-a-simple-websocket-with-Camel-component-on-Jetty-tp5732046p5732105.html
Sent from the Camel - Users mailing list archive at Nabble.com.