Re: Interactive commands in the Karaf shell

2021-09-17 Thread Jean-Baptiste Onofré
No, the getKeyboard() gives you the InputStream, so, you read from there 
directly in the command.


Regards
JB

On 17/09/2021 14:14, Patrique Legault wrote:

Interesting but I'm assuming you need to handle it in a thread or something
like that?

When I called it in the command the execution would just pause.

On Fri., Sep. 17, 2021, 3:26 a.m. Jean-Baptiste Onofré, 
wrote:


Hi Damien,

mask defines if you want the output or not, and the kind of output (*, '
', etc).

readLine() is fine if you just want a single line typed by the users.
getKeyboard() gives your the full keyboard input (multiline, including
breaking characters), it's what I'm using in the vi/edit command.

Regards
JB

On 17/09/2021 09:00, Damien Saulnier wrote:

Hi Patrique,

I have been able to achieve it using session.readLine() :
final String userInput = session.readLine("Do you want to proceed with

the

deletion? (y/n)\n", null);
if (!StringUtils.equalsIgnoreCase(userInput, "y")) return;

I don't know what the "mask" parameter is for, but just setting it to

null

did the job.

I assume that session.getKeyboard() is useful when you want to listen the
keyboard while the command is running, whereas with readLine() it pauses
the execution and waits for the input.


Best,
Damien


Le jeu. 16 sept. 2021 à 22:57, Patrique Legault <

patriquelega...@gmail.com>

a écrit :


I tried to get an example going today of this but failed to properly use
the getKeyboard() function.

With that being said I would like to an example of this.

On Thu., Sep. 16, 2021, 7:26 a.m. Jean-Baptiste Onofré, <

j...@nanthrax.net>

wrote:


Hi Damien,

Yes, sure.

You can get the session by reference (for instance @Reference Session).

Then session gives you access to getKeyboard() which is a input stream
with what the user input.

I can improve the example with the required code if you want.

Regards
JB

On 16/09/2021 11:39, Damien Saulnier wrote:

Hi,

I would like to know if it is possible to develop some interactive

commands

in the Karaf Shell, pausing the execution of the command and reading

some

additional input from the user.
I have not found anything about that neither in the documentation nor

in

the examples on Github.

To give a basic use case, I would like to ask for a confirmation

before

proceeding with the actual removal in the "RemoveCommand" example:






https://github.com/apache/karaf/blob/main/examples/karaf-command-example/karaf-command-example-command/src/main/java/org/apache/karaf/examples/command/command/RemoveCommand.java



Best,
Damien













Re: Interactive commands in the Karaf shell

2021-09-17 Thread Patrique Legault
Interesting but I'm assuming you need to handle it in a thread or something
like that?

When I called it in the command the execution would just pause.

On Fri., Sep. 17, 2021, 3:26 a.m. Jean-Baptiste Onofré, 
wrote:

> Hi Damien,
>
> mask defines if you want the output or not, and the kind of output (*, '
> ', etc).
>
> readLine() is fine if you just want a single line typed by the users.
> getKeyboard() gives your the full keyboard input (multiline, including
> breaking characters), it's what I'm using in the vi/edit command.
>
> Regards
> JB
>
> On 17/09/2021 09:00, Damien Saulnier wrote:
> > Hi Patrique,
> >
> > I have been able to achieve it using session.readLine() :
> > final String userInput = session.readLine("Do you want to proceed with
> the
> > deletion? (y/n)\n", null);
> > if (!StringUtils.equalsIgnoreCase(userInput, "y")) return;
> >
> > I don't know what the "mask" parameter is for, but just setting it to
> null
> > did the job.
> >
> > I assume that session.getKeyboard() is useful when you want to listen the
> > keyboard while the command is running, whereas with readLine() it pauses
> > the execution and waits for the input.
> >
> >
> > Best,
> > Damien
> >
> >
> > Le jeu. 16 sept. 2021 à 22:57, Patrique Legault <
> patriquelega...@gmail.com>
> > a écrit :
> >
> >> I tried to get an example going today of this but failed to properly use
> >> the getKeyboard() function.
> >>
> >> With that being said I would like to an example of this.
> >>
> >> On Thu., Sep. 16, 2021, 7:26 a.m. Jean-Baptiste Onofré, <
> j...@nanthrax.net>
> >> wrote:
> >>
> >>> Hi Damien,
> >>>
> >>> Yes, sure.
> >>>
> >>> You can get the session by reference (for instance @Reference Session).
> >>>
> >>> Then session gives you access to getKeyboard() which is a input stream
> >>> with what the user input.
> >>>
> >>> I can improve the example with the required code if you want.
> >>>
> >>> Regards
> >>> JB
> >>>
> >>> On 16/09/2021 11:39, Damien Saulnier wrote:
>  Hi,
> 
>  I would like to know if it is possible to develop some interactive
> >>> commands
>  in the Karaf Shell, pausing the execution of the command and reading
> >> some
>  additional input from the user.
>  I have not found anything about that neither in the documentation nor
> >> in
>  the examples on Github.
> 
>  To give a basic use case, I would like to ask for a confirmation
> before
>  proceeding with the actual removal in the "RemoveCommand" example:
> 
> >>>
> >>
> https://github.com/apache/karaf/blob/main/examples/karaf-command-example/karaf-command-example-command/src/main/java/org/apache/karaf/examples/command/command/RemoveCommand.java
> 
> 
>  Best,
>  Damien
> 
> >>>
> >>
> >
>


Re: Pax Web 8.0.0 is just one click away

2021-09-17 Thread Jean-Baptiste Onofré

Hi Greg,

thanks for the update !

I'm ready to push the change on Karaf to "promote" main as 4.4.0 and 
have karaf-4.3.x.


Just waiting for Pax Web 8.0.0 to directly update and trigger a build on 
Jenkins ;)


Regards
JB

On 17/09/2021 09:32, Grzegorz Grzybek wrote:

Hello!

I've just prepared Pax Web 8.0.0 release and the staging repository URL 
is https://oss.sonatype.org/content/repositories/orgops4j-1524/ 



How to test it in Karaf? Start fresh (with Karaf 4.3.3 for example), 
uncomment "karaf" user in etc/users.properties and:


|karaf@root()> repo-remove 
mvn:org.ops4j.pax.web/pax-web-features/7.3.19/xml/features karaf@root()> 
feature:install maven karaf@root()> maven:repository-add -id pax-web-8 
https://oss.sonatype.org/content/repositories/orgops4j-1524/ 
 
karaf@root()> repo-add 
mvn:org.ops4j.pax.web/pax-web-features/8.0.0/xml/features karaf@root()> 
feature:install pax-web-http-jetty pax-web-war karaf@root()> 
bundle:install -s 
'webbundle:mvn:io.hawt/hawtio-war/2.13.6/war?Web-ContextPath=/hawtio' |



Now you can navigate to http://localhost:8181/hawtio 
 and see for example:


image.png

Now, I can click "Release" button any time soon and Pax Web 8 will be 
available in Maven Central. I just hope for a little feedback about the 
above steps ;)


kind regards
Grzegorz Grzybek


Pax Web 8.0.0 is just one click away

2021-09-17 Thread Grzegorz Grzybek
Hello!

I've just prepared Pax Web 8.0.0 release and the staging repository URL is
https://oss.sonatype.org/content/repositories/orgops4j-1524/

How to test it in Karaf? Start fresh (with Karaf 4.3.3 for example),
uncomment "karaf" user in etc/users.properties and:

karaf@root()> repo-remove
mvn:org.ops4j.pax.web/pax-web-features/7.3.19/xml/features
karaf@root()> feature:install maven
karaf@root()> maven:repository-add -id pax-web-8
https://oss.sonatype.org/content/repositories/orgops4j-1524/
karaf@root()> repo-add mvn:org.ops4j.pax.web/pax-web-features/8.0.0/xml/features
karaf@root()> feature:install pax-web-http-jetty pax-web-war
karaf@root()> bundle:install -s
'webbundle:mvn:io.hawt/hawtio-war/2.13.6/war?Web-ContextPath=/hawtio'


Now you can navigate to http://localhost:8181/hawtio and see for example:

[image: image.png]

Now, I can click "Release" button any time soon and Pax Web 8 will be
available in Maven Central. I just hope for a little feedback about the
above steps ;)

kind regards
Grzegorz Grzybek


Re: Interactive commands in the Karaf shell

2021-09-17 Thread Jean-Baptiste Onofré

Hi Damien,

mask defines if you want the output or not, and the kind of output (*, ' 
', etc).


readLine() is fine if you just want a single line typed by the users.
getKeyboard() gives your the full keyboard input (multiline, including 
breaking characters), it's what I'm using in the vi/edit command.


Regards
JB

On 17/09/2021 09:00, Damien Saulnier wrote:

Hi Patrique,

I have been able to achieve it using session.readLine() :
final String userInput = session.readLine("Do you want to proceed with the
deletion? (y/n)\n", null);
if (!StringUtils.equalsIgnoreCase(userInput, "y")) return;

I don't know what the "mask" parameter is for, but just setting it to null
did the job.

I assume that session.getKeyboard() is useful when you want to listen the
keyboard while the command is running, whereas with readLine() it pauses
the execution and waits for the input.


Best,
Damien


Le jeu. 16 sept. 2021 à 22:57, Patrique Legault 
a écrit :


I tried to get an example going today of this but failed to properly use
the getKeyboard() function.

With that being said I would like to an example of this.

On Thu., Sep. 16, 2021, 7:26 a.m. Jean-Baptiste Onofré, 
wrote:


Hi Damien,

Yes, sure.

You can get the session by reference (for instance @Reference Session).

Then session gives you access to getKeyboard() which is a input stream
with what the user input.

I can improve the example with the required code if you want.

Regards
JB

On 16/09/2021 11:39, Damien Saulnier wrote:

Hi,

I would like to know if it is possible to develop some interactive

commands

in the Karaf Shell, pausing the execution of the command and reading

some

additional input from the user.
I have not found anything about that neither in the documentation nor

in

the examples on Github.

To give a basic use case, I would like to ask for a confirmation before
proceeding with the actual removal in the "RemoveCommand" example:




https://github.com/apache/karaf/blob/main/examples/karaf-command-example/karaf-command-example-command/src/main/java/org/apache/karaf/examples/command/command/RemoveCommand.java



Best,
Damien









Re: Interactive commands in the Karaf shell

2021-09-17 Thread Damien Saulnier
Hi Patrique,

I have been able to achieve it using session.readLine() :
final String userInput = session.readLine("Do you want to proceed with the
deletion? (y/n)\n", null);
if (!StringUtils.equalsIgnoreCase(userInput, "y")) return;

I don't know what the "mask" parameter is for, but just setting it to null
did the job.

I assume that session.getKeyboard() is useful when you want to listen the
keyboard while the command is running, whereas with readLine() it pauses
the execution and waits for the input.


Best,
Damien


Le jeu. 16 sept. 2021 à 22:57, Patrique Legault 
a écrit :

> I tried to get an example going today of this but failed to properly use
> the getKeyboard() function.
>
> With that being said I would like to an example of this.
>
> On Thu., Sep. 16, 2021, 7:26 a.m. Jean-Baptiste Onofré, 
> wrote:
>
> > Hi Damien,
> >
> > Yes, sure.
> >
> > You can get the session by reference (for instance @Reference Session).
> >
> > Then session gives you access to getKeyboard() which is a input stream
> > with what the user input.
> >
> > I can improve the example with the required code if you want.
> >
> > Regards
> > JB
> >
> > On 16/09/2021 11:39, Damien Saulnier wrote:
> > > Hi,
> > >
> > > I would like to know if it is possible to develop some interactive
> > commands
> > > in the Karaf Shell, pausing the execution of the command and reading
> some
> > > additional input from the user.
> > > I have not found anything about that neither in the documentation nor
> in
> > > the examples on Github.
> > >
> > > To give a basic use case, I would like to ask for a confirmation before
> > > proceeding with the actual removal in the "RemoveCommand" example:
> > >
> >
> https://github.com/apache/karaf/blob/main/examples/karaf-command-example/karaf-command-example-command/src/main/java/org/apache/karaf/examples/command/command/RemoveCommand.java
> > >
> > >
> > > Best,
> > > Damien
> > >
> >
>