Have a default no-arg ctr, and then remove that 2nd ctr where you
create the component manually in your endpoint class.

On Thu, Sep 24, 2015 at 2:02 PM, burner
<bjoernpaulsen1...@googlemail.com> wrote:
> Still the same Error:
>
> Ambiguous method invocations possible: [public
> org.apache.camel.EndpointConfiguration
> org.apache.camel.impl.DefaultComponent.createConfiguration(java.lang.String)
> throws java.lang.Exception, public org.apache.camel.Endpoint
> org.apache.camel.impl.DefaultComponent.createEndpoint(java.lang.String)
> throws java.lang.Exception].
>
> *CsvToXmlComponent.java:*
>
> public final class CsvToXmlComponent extends DefaultComponent {
>         private static final Logger LOG =
> LoggerFactory.getLogger(CsvToXmlComponent.class);
>
>         @Override
>         protected CsvToXmlEndpoint createEndpoint(String uri, String 
> remaining,
>                         Map<String, Object> parameters) throws Exception {
>
>                 System.err.println(parameters.toString());
>                 CsvToXmlEndpoint endpoint = new CsvToXmlEndpoint(uri, this);
>
>                 if (parameters.get("delimiterChar") != null) {
>                         System.err.println("delChar:
> "+parameters.get("delimiterChar").toString());
>                         
> endpoint.setDelimiterChar(parameters.get("delimiterChar").toString());
>                 }
>                 if (parameters.get("quoteChar") != null) {
>                         
> endpoint.setQuoteChar(parameters.get("quoteChar").toString());
>                 }
>                 if (parameters.get("escapeChar") != null) {
>                         
> endpoint.setEscapeChar(parameters.get("escapeChar").toString());
>                 }
>                 return endpoint;
>         }
> }
>
> *CsvToXmlEndpoint.java*
>
> public class CsvToXmlEndpoint extends ProcessorEndpoint {
>         private static final Logger LOG =
> LoggerFactory.getLogger(CsvToXmlEndpoint.class);
>         private String delimiterChar = ";";
>         private String quoteChar = "\"";
>         private String escapeChar = "\0";
>
>         public CsvToXmlEndpoint(String endpointUriString, Component 
> component) {
>                 super(endpointUriString, component);
>
>                 try {
>                         this.setPropertiesToProcessor();
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }
>         }
>
>         public CsvToXmlEndpoint(String endpointUriString) throws 
> URISyntaxException
> {
>
>                 super(endpointUriString, new CsvToXmlComponent(), new
> CsvToXmlProcessor());
>
>                 System.err.println(this.delimiterChar);
>
>                 try {
>                         this.setPropertiesToProcessor();
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }
>         }
>
>         protected CsvToXmlProcessor createProcessor() throws Exception {
>                 return new CsvToXmlProcessor();
>         }
>
>         private void setPropertiesToProcessor() throws Exception {
>                 CsvToXmlProcessor csvToXmlProcessor;
>                 csvToXmlProcessor = (CsvToXmlProcessor) this.getProcessor();
>                 csvToXmlProcessor.delimiterChar = 
> this.delimiterChar.charAt(0);
>                 csvToXmlProcessor.quoteChar = this.quoteChar.charAt(0);
>                 csvToXmlProcessor.escapeChar = this.escapeChar.charAt(0);
>         }
>
>         public String getDelimiterChar() {
>                 return delimiterChar;
>         }
>
>         public void setDelimiterChar(String delimiterChar) {
>                 this.delimiterChar = delimiterChar;
>
>                 try {
>                         this.setPropertiesToProcessor();
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }
>         }
>
>         public String getEscapeChar() {
>                 return escapeChar;
>         }
>
>         public void setEscapeChar(String escapeChar) {
>                 this.escapeChar = escapeChar;
>
>                 try {
>                         this.setPropertiesToProcessor();
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }
>         }
>
>         public String getQuoteChar() {
>                 return quoteChar;
>         }
>
>         public void setQuoteChar(String quoteChar) {
>                 this.quoteChar = quoteChar;
>
>                 try {
>                         this.setPropertiesToProcessor();
>                 } catch (Exception e) {
>                         e.printStackTrace();
>                 }
>         }
>
> }
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Own-Component-with-optional-Parameters-tp5771889p5771909.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: https://www.manning.com/books/ibsen2

Reply via email to