UNOMI-879 Unified CRUD Karaf shell developer commands (includes UNOMI-920 YAML toString() debugging)#755
Open
sergehuber wants to merge 11 commits into
Open
Conversation
- 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.
2 tasks
There was a problem hiding this comment.
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
CrudCommandSPI plus a sharedBaseCrudCommandimplementation for consistent list/table/CSV output across object types. - Introduced the
unomi:crudcommand 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/ProfileServiceAPIs and implementations withdeleteEvent/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.
…to UNOMI-879-unified-crud-shell
Fix condition undeploy, rule list performance, null-safety and pagination in CRUD commands, thread-safe consent date formatting, read-only rulestats behavior, segment ID completion, and BOM httpclient dependency management.
1 task
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked PR (merge order)
UNOMI-920-yaml-tostringUNOMI-879-unified-crud-shellThis PR is stacked: merge into
UNOMI-920-yaml-tostringfirst (after #754 is merged tomaster, 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/viewstyle 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 unifiedunomi:crudstyle (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 samedev.commandspackage alongside the new commands.API support (aligned with
unomi-3-devbehaviour):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/SessionCrudCommanddelete operations.Build:
bom/shell-dev-commandspomupdates as needed for the module.