- Extension ID
- What's new?
- Description
- In what situation should you install this extension?
- Features
- Function Point, Quality and Sizing support
- AIP Core compatibility
- Prerequisites
- What source code is needed by our analyzer?
- Dependencies with other extensions
- Download and installation instructions
- What results can you expect?
- Current known limitations
Extension ID
com.castsoftware.grpcjava
What's new?
Please see gRPC-java - 1.0 - Release Notes for more information.
Description
This extension provides support for gRPC when used inside Java source code.
In what situation should you install this extension?
If your JEE application source code uses the gRPC framework you should install this extension (see gRPC for more information about this framework).
Features
Object structure and links
- Creates gRPC service method objects which represent entry-points to the server.
- Creates calls to gRPC service method objects which represent exit-points from the client.
- The dependent Web Services Linker is responsible for detecting and creating links between matching calls to gRPC Method objects and the gRPC Method objects.
Support
Server side
When a class inherits from FooServiceGrpc.FooServiceImplBase, for any overiden method FooMethod
the analyzer creates a gRPC Method object named FooService.FooMethod
. For instance when analyzing the following source code, the extension creates a Greeter.sayHello gRPC Method and a callLink to the Java Method sayHello
.
public class GreeterService extends GreeterGrpc.GreeterImplBase { @Override public void sayHello(GreeterOuterClass.HelloRequest request, StreamObserver<GreeterOuterClass.HelloReply> responseObserver) { String message = "Hello " + request.getName(); log.info("Returning " +message); } }
Client side
The gRPC frameworks provide stubs for the client side. A gRPC call can be carried out from that stub. When analyzing the following source code, this extension will generate a call to gRPC Method object name Greeter.sayHello
.
import io.grpc.examples.GreeterGrpc; public class DemoAPpTest { private static final GreeterGrpc.GreeterStub stub = GreeterGrpc.newStub(channel); protected void init(VaadinRequest vaadinRequest) { try { stub.sayHello(GreeterOuterClass.HelloRequest.newBuilder().setName("name").build()); } catch (StatusRuntimeException e) { }
Web Services Linker is then responsible for linking that call to gRPC Method to any matching gRPC service method.
Function Point, Quality and Sizing support
- Function Points (transactions): a green tick indicates that OMG Function Point counting and Transaction Risk Index are supported
- Quality and Sizing: no Quality Rules are implemented for gRPC-java
Function Points | Quality and Sizing |
---|---|
AIP Core release | Supported |
---|---|
8.3.x |
Prerequisites
An installation of any compatible release of AIP Core (see table above) |
What source code is needed by our analyzer?
In order to develop an application which uses gRPC one needs to go through the following steps:
- write at least one *.proto file. This file is used to define the name of the services and their methods which will be available for remote procedure calls.
- use protoc to generate source code (in a chosen language) containing the client and server. This code is generated based on the *.proto files.
- define the services and methods available through gRPC by extending the generated server.
- calls to these methods are carried out using stubs defined in the generated source code.
Our analyzers rely on the naming convention which is used by gRPC for generating the source code based on the *.proto files. Our analyzers do not need the *.proto file nor the generated source code.
Dependencies with other extensions
Some CAST extensions require the presence of other CAST extensions in order to function correctly. The extension requires that the following other CAST extensions are also installed:
- JEE Analyzer
- Web Services Linker
- com.castsoftware.internal.platform (Internal Extension)
Note that:
- any dependent extensions are automatically downloaded and installed for you. You do not need to do anything.
- the JEE Analyzer is not a dependency, but this extension will be automatically installed when JEE/Java source code is delivered for analysis.
Download and installation instructions
The extension will not be automatically downloaded and installed in CAST Console. If you need to use it, should manually install the extension using the Application - Extensions interface:
What results can you expect?
Objects
The following objects are displayed in CAST Enlighten:
Icon | Description |
---|---|
Java gRPC Service Method | |
call to gRPC Service Method |
Current known limitations
- Only the files which contain an import containing at least one "grpc" string are currently analyzed with this extension.
- Cloud endpoints with gRPC is not supported
- gRPC Cloud Pub/Sub is not supported
Multi-line method call are not supported for the creation of calls to gRPC service method. No call to gRPC service can be created from the following code:
stub .foo()