# Analyzer Architecture _analyzer-lsp_ is a rules engine that uses language providers to enable static code analysis of different languages. ![image](https://hackmd.io/_uploads/ryqCuTY1A.png) The two important pieces above are: 1. Rules Engine: The engine is the core component responsible for parsing rules, invoking providers to run them, and generating output. 2. Providers: The providers are responsible for accepting queries in the rules as input, converting them into LSP queries for the language servers and sending the results back to the engine. While most providers use LSP based language servers for analysis, it's not a requirement. The engine communicates with a provider over gRPC and mainly invokes three routines: 1. Init(): This is the very first step in the engine where it will initialize a provider. The provider will initialize the underlying language server using the input source code. It can also do additional things needed for the analysis. 2. Evaluate(): This is where engine parses a rule and calls Evaluate() procedure of the provider to evaluate the rule. The provider will query the already initialized language server and return search matches in the engine's format. 3. Stop(): The engine will shutdown the providers gracefully at the end. ## Java Provider The Java provider is responsible for analysis of Java applications. It uses [Eclipse jdt.ls](https://github.com/eclipse-jdtls/eclipse.jdt.ls) as the base language server providing Java search capabilities. It also uses a custom extension to the language server [Konveyor Java Bundle](https://github.com/konveyor/java-analyzer-bundle/pulls). The java bundle is added to the language server at startup, and requests to the server go through the extension point (handler) in the bundle. #### Init() ![If then Flowchart(1)](https://hackmd.io/_uploads/HJimiCFkC.jpg) #### Evaluate() When _java_ provider's _Evaluate()_ procedure is called, it will make a query to invoke the custom handler in the Java bundle. https://github.com/konveyor/analyzer-lsp/blob/bd8295e211f9e05f585bc926ca7a9dbff664124e/provider/internal/java/service_client.go#L115-L118