# oracle/nosql-intellij-plugin architecture

> Architecture diagram of the GitHub repository oracle/nosql-intellij-plugin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-02-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oracle/nosql-intellij-plugin
- Repository: https://github.com/oracle/nosql-intellij-plugin

## Overview

##### Project Type and Purpose
- This is an IntelliJ Plugin (hence an application extension for a popular IDE) that connects to various Oracle NoSQL deployments including Cloud, On-premises, and the Cloud Simulator.
- The primary purpose is to enable users—primarily developers—to interact with Oracle NoSQL databases via a rich user interface, offering capabilities for table management, schema exploration, executing queries, managing connections, and handling both DDL and DML statements.

##### File Structure Analysis
- There are three main modules:
- model-common – Contains common business model classes for handling connections, schema definitions, table definitions, and various utilities. It is the core library providing the generic building blocks used across the product.
- model-cloud – Extends or specializes common models for cloud-specific interactions. It includes connection profiles (e.g., PublicCloudConnectionProfile, OnpremConnectionProfile, CloudConnectionProfile) and schema/table representations tuned for cloud usage.
- plugin – This module houses the IntelliJ-specific integration code. It includes UI components like project wizards, setting dialogs, record viewers, tool window management (database browser, schema explorer) and other user interface forms (.form files) that directly interact with a user’s IDE.
- Additional files (build.gradle, gradle wrap, settings.gradle) show a Gradle-based build system for managing these modules and dependencies.

##### README Insights
- The README explains how the plugin connects with various Oracle NoSQL environments (Cloud, On-premises and CloudSim) and details the feature set using these connection types.
- It provides feature descriptions such as table management, query execution, advanced DDL operations, and management workflows that hint at a layered architecture where the UI layer interacts with lower-level service libraries.
- Detailed example workflows demonstrate how a user navigates from the user interface (UI forms and actions) to underlying data manipulation operations provided by the model libraries.

a. Main Components:
- IntelliJ Plugin UI Layer (plugin module): Include parts like project wizard, settings panels, tool windows (Schema Explorer, Record Viewer, Table Management panels), and the integration with IntelliJ’s IDE framework.
- Business Logic and Abstraction Layer (model-common): Represent core components such as connection interfaces, schema management, table creation, DDL/DML operation endpoints, and supporting utilities.
- Cloud-Specific Adaptation Layer (model-cloud): Illustrate specialized classes for cloud connection profiles, cloud schema builders, and connectivity features.
- Build and Dependency Management (Gradle): Optionally include an element to show how the project is built and managed for dependency resolution.

b. Relationships and Interactions:
- The UI Layer (plugin) sends user actions (e.g., create table, execute query) that invoke services in the common module.
- The common module provides abstract interfaces and classes (e.g., IConnection, SchemaBuilder) that are implemented or extended by the cloud-specific module.
- Model-cloud adapts and enriches these interactions to handle cloud-specific details.
- Both “model-common” and “model-cloud” eventually interact with the external Oracle NoSQL endpoints via network connection classes.

c. Architectural Patterns and Design Principles:
- Layered Architecture: Separation between the UI (plugin module) and the business/service logic (model-common and model-cloud).
- Modular Design: Clear separation and specialization; common models versus cloud-specific implementations.
- Abstraction: Interfaces and abstract classes facilitate multiple connection types (cloud, on-premises, simulation).

d. Relevant Technologies:
- Gradle is used for building the project.
- Java is the primary implementation language.
- The project leverages IntelliJ Platform SDK for the plugin components.
- Oracle NoSQL Java SDK is listed as a dependency for database connectivity.
- Usage of forms (.form files) indicates a Swing-based or IntelliJ form designer for UI components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Build & Dependency"
        Gradle["Gradle Build System"]:::gradle
    end

    subgraph "UI Layer"
        PluginUI["IntelliJ Plugin UI (plugin module)"]:::ui
    end

    subgraph "Business Logic Layer"
        ModelCommon["Business Logic & Common Models (model-common)"]:::common
    end

    subgraph "Cloud Adaptation Layer"
        ModelCloud["Cloud-Specific Models (model-cloud)"]:::cloud
    end

    External["Oracle NoSQL External Services (Cloud, On-Prem, CloudSim)"]:::external

    Gradle --> PluginUI
    Gradle --> ModelCommon
    PluginUI -->|"Triggers:TableManagement,QueryExecution"| ModelCommon
    ModelCommon -->|"Delegates:CloudConnection"| ModelCloud
    ModelCommon -->|"ExecutesDDL/DML"| External
    ModelCloud -->|"ExecutesCloudOps"| External

    click PluginUI "https://github.com/oracle/nosql-intellij-plugin/tree/main/plugin/src/main/java/oracle/nosql/intellij/plugin"
    click PluginUI "https://github.com/oracle/nosql-intellij-plugin/blob/main/plugin/src/main/resources/META-INF/plugin.xml"
    click ModelCommon "https://github.com/oracle/nosql-intellij-plugin/tree/main/model-common/src/main/java/oracle/nosql/model"
    click ModelCloud "https://github.com/oracle/nosql-intellij-plugin/tree/main/model-cloud/src/main/java/oracle/nosql/model/cloud"
    click Gradle "https://github.com/oracle/nosql-intellij-plugin/blob/main/build.gradle"
    click Gradle "https://github.com/oracle/nosql-intellij-plugin/blob/main/settings.gradle"
    click Gradle "https://github.com/oracle/nosql-intellij-plugin/tree/main/gradle"

    classDef ui fill:#ffccff,stroke:#990099,stroke-width:2px;
    classDef common fill:#cce5ff,stroke:#003399,stroke-width:2px;
    classDef cloud fill:#ccffcc,stroke:#009900,stroke-width:2px;
    classDef external fill:#ffcccc,stroke:#990000,stroke-width:2px;
    classDef gradle fill:#fff2cc,stroke:#b38f00,stroke-width:2px;
```
