You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Riaan Annandale <ri...@mundane.co.za> on 2019/03/25 08:06:26 UTC

Dataformat/ POJO for tab indentation?

Hi everyone

I'm in the process of designing a solution to manage config files which 
look something like this:

config firewall service category
     edit "General"
         set comment "General services."
     next
     edit "Web Access"
         set comment "Web access."
     next
     edit "File Access"
         set comment "File access."
end

Some of you may recognize this as the config for a fortigate firewall. 
It's tab indented, so while it looks a bit yaml-ish it isn't.

With a mix of POJO/ Dataformat clauses I'm hoping to map this from JSON/ 
XML to a templating system in order to generate files similar to the 
snippet above.

I tried googling about camel and tab indentation but only find 
references to bindi which is used for csv/tsv files, this is not quite 
the same use case.

Worst case scenario I guess I'd do it with some kind of hack in 
xslt/xquery to make it "look" like this, but that feels like a hack

Any thoughts, or suggestions welcome

Thanks
Riaan

Re: Dataformat/ POJO for tab indentation?

Posted by Riaan Annandale <ri...@mundane.co.za>.
Hi Ricardo

That looks exactly like the thing I need.

Thanks for the reply!
Riaan

On 2019/03/25 3:00 PM, Ricardo Zanini wrote:
> Hi!
>
> You mentioned templating system, so Velocity [1] comes to mind. Have you
> tried that? I guess that should be simple mapping from JSON/XML to velocity
> (and keeping your formmating).
>
> [1] - http://camel.apache.org/velocity.html
>
> Cheers!
>
> On Mon, 25 Mar 2019 at 05:07 Riaan Annandale <ri...@mundane.co.za> wrote:
>
>> Hi everyone
>>
>> I'm in the process of designing a solution to manage config files which
>> look something like this:
>>
>> config firewall service category
>>       edit "General"
>>           set comment "General services."
>>       next
>>       edit "Web Access"
>>           set comment "Web access."
>>       next
>>       edit "File Access"
>>           set comment "File access."
>> end
>>
>> Some of you may recognize this as the config for a fortigate firewall.
>> It's tab indented, so while it looks a bit yaml-ish it isn't.
>>
>> With a mix of POJO/ Dataformat clauses I'm hoping to map this from JSON/
>> XML to a templating system in order to generate files similar to the
>> snippet above.
>>
>> I tried googling about camel and tab indentation but only find
>> references to bindi which is used for csv/tsv files, this is not quite
>> the same use case.
>>
>> Worst case scenario I guess I'd do it with some kind of hack in
>> xslt/xquery to make it "look" like this, but that feels like a hack
>>
>> Any thoughts, or suggestions welcome
>>
>> Thanks
>> Riaan
>>


Re: Dataformat/ POJO for tab indentation?

Posted by Ricardo Zanini <ri...@gmail.com>.
Hi!

You mentioned templating system, so Velocity [1] comes to mind. Have you
tried that? I guess that should be simple mapping from JSON/XML to velocity
(and keeping your formmating).

[1] - http://camel.apache.org/velocity.html

Cheers!

On Mon, 25 Mar 2019 at 05:07 Riaan Annandale <ri...@mundane.co.za> wrote:

> Hi everyone
>
> I'm in the process of designing a solution to manage config files which
> look something like this:
>
> config firewall service category
>      edit "General"
>          set comment "General services."
>      next
>      edit "Web Access"
>          set comment "Web access."
>      next
>      edit "File Access"
>          set comment "File access."
> end
>
> Some of you may recognize this as the config for a fortigate firewall.
> It's tab indented, so while it looks a bit yaml-ish it isn't.
>
> With a mix of POJO/ Dataformat clauses I'm hoping to map this from JSON/
> XML to a templating system in order to generate files similar to the
> snippet above.
>
> I tried googling about camel and tab indentation but only find
> references to bindi which is used for csv/tsv files, this is not quite
> the same use case.
>
> Worst case scenario I guess I'd do it with some kind of hack in
> xslt/xquery to make it "look" like this, but that feels like a hack
>
> Any thoughts, or suggestions welcome
>
> Thanks
> Riaan
>
-- 
Sent from a mobile device