Book Image

Learning Karaf Cellar

By : Jean Baptiste Onofre, Jean-Baptiste Onofré
Book Image

Learning Karaf Cellar

By: Jean Baptiste Onofre, Jean-Baptiste Onofré

Overview of this book

Table of Contents (16 chapters)

The client bundle


The client bundle provides a dosgi-greeter:greet shell command. The shell command is part of the client bundle, and you can find the command code on the GitHub source repository. The command calls the following GreeterClient:

package org.apache.karaf.cellar.samples.dosgi.greeter.client;

import org.apache.karaf.cellar.samples.dosgi.greeter.api.Greet;
import org.apache.karaf.cellar.samples.dosgi.greeter.api.GreetResponse;
import org.apache.karaf.cellar.samples.dosgi.greeter.api.Greeter;

/**
 * Client that uses a remote Greeter service.
 */
public class GreeterClient {

  private Greeter greeter;
  private String greetMessage;
  private int count;

  public GreeterClient(Greeter greeter, String greetMessage, int count) {
      this.greeter = greeter;
      this.greetMessage = greetMessage;
      this.count = count;
  }

  public void start() {
      Greet greet  = new Greet(greetMessage);
      for (int i = 0; i < count; i++) {
          GreetResponse greetResponse = greeter...