You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2008/11/13 20:08:05 UTC

[jira] Commented: (CAMEL-896) org.apache.camel.spi.Registry should have mandatory lookup methods

    [ https://issues.apache.org/activemq/browse/CAMEL-896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47359#action_47359 ] 

Claus Ibsen commented on CAMEL-896:
-----------------------------------

CamelContextHelper has the mandatory methods and they are provided in the DefaultComponent so no need to expose it on the SPI also

> org.apache.camel.spi.Registry should have mandatory lookup methods
> ------------------------------------------------------------------
>
>                 Key: CAMEL-896
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-896
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 1.5.0
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 2.0.0
>
>
> The Registry only has lookup methods that return null if the bean was not found. Then we need to manually throw exception if the bean was expected.
> We need to expose mandatoryLookup methods that will do null check
> For instance:
> {code}
>             FTPClientConfig ftpClientConfig = this.getCamelContext().getRegistry().lookup(ref, FTPClientConfig.class);
>             if (ftpClientConfig == null) {
>                 throw new IllegalArgumentException("Damm can not find it");
>             }
> {code}
> Should just be:
> {code}
>             FTPClientConfig ftpClientConfig = this.getCamelContext().getRegistry().mandatoryLookup(ref, FTPClientConfig.class);
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.