Skip to content

UNOMI-879 Unified CRUD Karaf shell developer commands (includes UNOMI-920 YAML toString() debugging)#755

Open
sergehuber wants to merge 11 commits into
UNOMI-920-yaml-tostringfrom
UNOMI-879-unified-crud-shell
Open

UNOMI-879 Unified CRUD Karaf shell developer commands (includes UNOMI-920 YAML toString() debugging)#755
sergehuber wants to merge 11 commits into
UNOMI-920-yaml-tostringfrom
UNOMI-879-unified-crud-shell

Conversation

@sergehuber
Copy link
Copy Markdown
Contributor

@sergehuber sergehuber commented May 6, 2026

Stacked PR (merge order)

Role Branch
Base (merge into) UNOMI-920-yaml-tostring
Head (this PR) UNOMI-879-unified-crud-shell

This PR is stacked: merge into UNOMI-920-yaml-tostring first (after #754 is merged to master, or equivalent).

This branch is stacked: it builds on the UNOMI-920 commit, then adds the UNOMI-879 shell work.
For more information (each PR targets the branch below until the bottom merges): https://github.github.com/gh-stack/introduction/overview/


JIRA


UNOMI-879 — Unified CRUD shell (shell-dev-commands)

The previous Karaf shell commands grew inconsistent across object types (list / view style varied), duplicated a lot of logic, used different arguments and behaviours for similar operations, and scattered help and docs, which raised maintenance cost and made the shell harder for new operators and contributors. The unified unomi:crud style (operations × types, shared table/CSV output, JSON create/update, and coherent completion/help) matches UNOMI-879: one predictable pattern, shared plumbing for listing and errors, and less duplicated command code so fixes and features apply everywhere at once.

Replaces the older fragmented list/view-style commands with a consistent CRUD-oriented layout under org.apache.unomi.shell.dev: shared routing (UnomiCrudCommand), CrudCommand / BaseCrudCommand, table/CSV listing support, completers, and type-specific command classes (rules, segments, profiles, events, sessions, definitions, etc.). Deployment / tail / watch helpers are moved into the same dev.commands package alongside the new commands.

API support (aligned with unomi-3-dev behaviour):

  • EventService#deleteEvent(String) / EventServiceImpl — remove event by id via persistence.
  • ProfileService#deleteSession(String) / ProfileServiceImpl — remove session by id via persistence.

Shell wiring depends on these for EventCrudCommand / SessionCrudCommand delete operations.

Build: bom / shell-dev-commands pom updates as needed for the module.

- Replace legacy per-type list/view commands with unified unomi:crud routing,
  shared bases (BaseCrudCommand, CrudCommand), completers, and type-specific
  CRUD implementations under org.apache.unomi.shell.dev.
- Relocate deployment/tail/watch helpers into dev.commands package.
- EventService/ProfileService: add deleteEvent/deleteSession; implementations
  delegate to PersistenceService.remove (aligned with unomi-3-dev).
- BOM: dependency adjustments needed by shell-dev-commands build.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes and unifies the Karaf “developer” shell commands by introducing a single unomi:crud command that routes CRUD/list/help operations to type-specific handlers, while also adding backend API support to delete persisted Events and Sessions (needed by the new delete operations).

Changes:

  • Added a CrudCommand SPI plus a shared BaseCrudCommand implementation for consistent list/table/CSV output across object types.
  • Introduced the unomi:crud command with operation/type/id completers and a set of new type-specific CRUD handlers (rules, segments, profiles, events, sessions, goals, etc.), while removing legacy fragmented commands.
  • Extended EventService / ProfileService APIs and implementations with deleteEvent / deleteSession, and updated Maven/OSGi metadata for the shell module.

Reviewed changes

Copilot reviewed 62 out of 62 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/services/CrudCommand.java New SPI for CRUD handlers used by unomi:crud.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/services/BaseCrudCommand.java Shared list/query/table/CSV scaffolding for CRUD handlers.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/completers/TypeCompleter.java Completes available CRUD object types from OSGi services.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/completers/OperationCompleter.java Completes supported operations for unomi:crud.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/completers/IdCompleter.java Completes IDs for read/update/delete contexts.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/completers/BaseCompleter.java Base completer for item-id completions (existing pattern reused).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/UndeployDefinition.java Moved/rewired undeploy command into dev.commands.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/topics/TopicCrudCommand.java CRUD handler for topics.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/TailCommandUtils.java Shared helpers for tail/watch output formatting.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/TailCommandSupport.java Repackaged tail support into dev.commands and aligned console output.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/sessions/SessionCrudCommand.java CRUD handler for sessions (uses new delete API).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/segments/SegmentCrudCommand.java CRUD handler for segments.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/scoring/ScoringCrudCommand.java CRUD handler for scoring definitions.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/scopes/ScopeCrudCommand.java CRUD handler for scopes.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/RuleWatch.java Repackaged rule watch command into dev.commands.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/RuleTail.java Repackaged rule tail command into dev.commands.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/rules/RuleStatisticsCrudCommand.java CRUD handler for rule statistics.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/rules/RuleCrudCommand.java CRUD handler for rules (includes statistics columns).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/RuleResetStats.java Updated reset-stats command to use shared console base.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/RemoveCommandSupport.java New shared “remove with confirmation” base command.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/properties/PropertyTypeCrudCommand.java CRUD handler for property types.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/profiles/ProfileCrudCommand.java CRUD handler for profiles (plus ID completion).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/profiles/ProfileAliasCrudCommand.java CRUD handler for profile aliases.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/personas/PersonaCrudCommand.java CRUD handler for personas.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/ListCommandSupport.java Repackaged list support and fixed output to session console.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/goals/GoalCrudCommand.java CRUD handler for goals.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/EventTail.java Repackaged event tail command and reused shared formatting.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/events/EventCrudCommand.java CRUD handler for events (uses new delete API).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/DeploymentCommandSupport.java Refactored deployment support into dev.commands with shared console base.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/DeployDefinition.java New deploy-definition command under dev.commands.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/consents/ConsentCrudCommand.java CRUD handler for consents (profile-embedded).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/conditions/ConditionTypeCrudCommand.java CRUD handler for condition types.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/CommandUtils.java Shared command utilities (date formatting).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/campaigns/CampaignEventCrudCommand.java CRUD handler for campaign events.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/campaigns/CampaignCrudCommand.java CRUD handler for campaigns.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/BaseSimpleCommand.java Base class for commands needing consistent session console output.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/BaseListCommand.java New generic list base (shared query/table pattern).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/BaseCommand.java New generic command base utilities (table + confirm).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/actions/ActionTypeCrudCommand.java CRUD handler for action types.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/actions/UnomiCrudCommand.java New unified unomi:crud router command.
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/UndeployDefinition.java Removed legacy command (replaced by dev.commands).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/SessionList.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/SegmentView.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/SegmentRemove.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/SegmentList.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/RuleList.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ProfileView.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ProfileList.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/EventView.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/EventSearch.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/EventList.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/DeployDefinition.java Removed legacy command (replaced by dev.commands).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ConditionView.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ConditionList.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ActionView.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/commands/ActionList.java Removed legacy command (replaced by CRUD).
tools/shell-dev-commands/pom.xml Adds commons-csv and adjusts OSGi bundle/plugin metadata.
services/src/main/java/org/apache/unomi/services/impl/profiles/ProfileServiceImpl.java Implements new ProfileService#deleteSession().
services/src/main/java/org/apache/unomi/services/impl/events/EventServiceImpl.java Implements new EventService#deleteEvent().
bom/pom.xml Adds an additional managed dependency entry for httpclient-osgi with type bundle.
api/src/main/java/org/apache/unomi/api/services/ProfileService.java Adds ProfileService#deleteSession API.
api/src/main/java/org/apache/unomi/api/services/EventService.java Adds EventService#deleteEvent API.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bom/pom.xml Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants