Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested changes for supporting OSGi Remote Services #6980

Closed
wants to merge 6 commits into from

Commits on Apr 25, 2020

  1. Initial suggested changes for supporting OSGi Remote Services. Added

    methods in java_generator.h/.cpp for generating two new types:
    
    GenerateOSGiService - Generates interface class(s) (in java_package
    directory) that has the same name as the rpc declaration in the
    protofile.  For example:
    
    service HealthCheck {
      // If the requested service is unknown, the call will fail with status
      // NOT_FOUND.
      rpc check(HealthCheckRequest) returns (HealthCheckResponse);
    }
    
    would generate a HealthCheck service interface class:
    
    package io.grpc.health.v1;
    
    public interface HealthCheck {
    
        public HealthCheckResponse check(HealthCheckRequest request);
    
    }
    
    Note that only blocking method calls (not streaming) are included in the
    interface declaration.
    
    GenerateOSGiAbstractImplService generates an abstract impl class that
    implements the (e.g.) HealthCheck interface, with naming convention
    Abstract<service name>Impl:
    
    package io.grpc.health.v1;
    
    import io.grpc.stub.StreamObserver;
    
    public abstract class AbstractHealthCheckImpl extends
    HealthCheckGrpc.HealthCheckImplBase implements HealthCheck {
    
        public abstract HealthCheckResponse check(HealthCheckRequest
    request);
    
        public void check(HealthCheckRequest request,
    StreamObserver<HealthCheckResponse> responseObserver) {
            responseObserver.onNext(check(request));
            responseObserver.onCompleted();
        }
    }
    
    Note that the impl of the grcp check/2 method calls the service
    interface method check/1.
    
    With the service interface method and the abstract service impl class,
    it is easy for a remote service to be created as all that is needed is
    to provide implementation for check/1 method in subclass.  Consumers of
    the remote service use the interface only.
    scottslewis committed Apr 25, 2020
    Configuration menu
    Copy the full SHA
    8e3df44 View commit details
    Browse the repository at this point in the history

Commits on Apr 26, 2020

  1. Configuration menu
    Copy the full SHA
    9a3c03e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    18d7b2a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    37cd480 View commit details
    Browse the repository at this point in the history
  4. Changed message types to use fully qualified java class name

    in service interface and in abstractserviceimpl class.
    scottslewis committed Apr 26, 2020
    Configuration menu
    Copy the full SHA
    0a15c56 View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2020

  1. Fixed handling of message package in generated java interface

    and abstract service interface impl
    scottslewis committed Apr 27, 2020
    Configuration menu
    Copy the full SHA
    684e1a3 View commit details
    Browse the repository at this point in the history