UNOMI-888: Javadoc and API cleanup for import/export router extension#756
UNOMI-888: Javadoc and API cleanup for import/export router extension#756sergehuber wants to merge 12 commits into
Conversation
Add and expand Javadoc across router-api and router-core: IRouterCamelContext facade, ImportExportConfiguration and services, ProfileToImport, route builders, processors, aggregation strategies, and related exceptions. Also include small behavioral and API fixes discovered during documentation: - IRouterCamelContext: document methods and add getCamelContext() returning Object to avoid a compile-time Camel dependency for API consumers - RouterCamelContext: honor setTracing(boolean) (previously always enabled tracing); add @OverRide and {@inheritdoc} for interface methods - ImportExportConfiguration: fix setColumnSeparator to null-check the parameter, consistent with setLineSeparator - LineSplitFailureHandler: add @OverRide on process(Exchange) Replaces placeholder 'Created by' class comments with module-oriented descriptions.
There was a problem hiding this comment.
Pull request overview
This PR expands Javadoc across the router import/export API and core implementation while making a few small API/behavior adjustments around Camel context access, tracing, and separator handling.
Changes:
- Replaces placeholder comments with detailed Javadoc for router APIs, processors, route builders, aggregation strategies, and beans.
- Adds
IRouterCamelContext#getCamelContext()and updatesRouterCamelContextaccordingly. - Fixes
RouterCamelContext#setTracing(boolean)to honor its argument and updatesImportExportConfiguration#setColumnSeparatornull handling.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/strategy/StringLinesAggregationStrategy.java |
Documents string aggregation behavior for export lines. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/strategy/ArrayListAggregationStrategy.java |
Documents list aggregation behavior for import results. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/RouterAbstractRouteBuilder.java |
Documents shared router route-builder configuration and endpoint creation. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java |
Documents final import-to-storage route setup. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java |
Documents one-shot file import route setup. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportFromSourceRouteBuilder.java |
Documents recurrent import source route setup. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileExportProducerRouteBuilder.java |
Documents export producer route setup. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileExportCollectRouteBuilder.java |
Documents export collection route setup. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/UnomiStorageProcessor.java |
Documents imported profile persistence processing. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitProcessor.java |
Documents CSV line parsing into profiles. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineSplitFailureHandler.java |
Documents import line failure handling and adds @Override. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/LineBuildProcessor.java |
Documents profile-to-CSV-line processing. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportRouteCompletionProcessor.java |
Documents import completion statistics and status updates. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportConfigByFileNameProcessor.java |
Documents one-shot config lookup by filename. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ExportRouteCompletionProcessor.java |
Documents export completion status/history updates. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/RouterCamelContext.java |
Documents router Camel context lifecycle and updates tracing/context API implementation. |
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/bean/CollectProfileBean.java |
Documents segment-based profile collection. |
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ProfileImportService.java |
Documents profile import service responsibilities. |
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ProfileExportService.java |
Documents profile export service responsibilities. |
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ImportExportConfigurationService.java |
Documents import/export configuration service operations. |
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ProfileToImport.java |
Documents import-specific profile fields and merge/delete flags. |
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/IRouterCamelContext.java |
Documents router Camel facade and adds context accessor. |
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/ImportExportConfiguration.java |
Cleans imports, expands configuration docs, and fixes column-separator null handling. |
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/exceptions/BadProfileDataFormatException.java |
Documents bad profile data format exception constructors and usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** | ||
| * Checks if existing profiles should be overwritten during import. | ||
| * When true, all properties of existing profiles will be overwritten with imported data. | ||
| * | ||
| * @return true if existing profiles should be overwritten, false for selective updates | ||
| */ | ||
| public boolean isOverwriteExistingProfiles() { | ||
| return this.overwriteExistingProfiles; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the overwriteExistingProfiles flag. | ||
| * @param overwriteExistingProfiles flag used to specify if we want to overwrite existing profiles | ||
| * Sets whether existing profiles should be completely overwritten during import. | ||
| * | ||
| * @param overwriteExistingProfiles true to overwrite all properties, false for selective updates | ||
| */ |
There was a problem hiding this comment.
Thanks — agreed. Updated isOverwriteExistingProfiles() / setter Javadoc to match ProfileImportServiceImpl: when true and propertiesToOverwrite is non-empty, only listed properties are updated; otherwise the full properties map is replaced.
| * | ||
| * <p>Configuration properties include: | ||
| * <ul> | ||
| * <li>name - unique identifier for the configuration</li> |
There was a problem hiding this comment.
Good catch. Class-level docs now distinguish itemId (persisted identifier used by router services and routes) from name (display label only).
| /** | ||
| * Retrieves the config type of the import configuration | ||
| * @return the config type of the import configuration | ||
| * Retrieves the configuration type (for example import vs export semantics used by the router). | ||
| * | ||
| * @return the config type of this configuration | ||
| */ | ||
| public String getConfigType() { return this.configType; } | ||
|
|
||
| /** | ||
| * Sets the config type of the import configuration | ||
| * @param configType the config type of the import configuration | ||
| * Sets the configuration type. | ||
| * | ||
| * @param configType the config type for this configuration | ||
| */ |
There was a problem hiding this comment.
Fixed. getConfigType() / setConfigType() Javadoc now documents scheduling mode (recurrent / oneshot via RouterConstants.IMPORT_EXPORT_CONFIG_TYPE_*), not import vs export.
| */ | ||
| public void setColumnSeparator(String columnSeparator) { | ||
| if(this.columnSeparator !=null) { | ||
| if (columnSeparator != null) { |
There was a problem hiding this comment.
Addressed. setColumnSeparator() now rejects empty or multi-character values with IllegalArgumentException, consistent with import (charAt(0)) and export usage.
| * </ul> | ||
| * </p> | ||
| * | ||
| * @see org.apache.unomi.router.core.context.RouterCamelContext |
There was a problem hiding this comment.
Removed the @see to RouterCamelContext so router-api Javadoc stays implementation-neutral and does not reference router-core.
| * <p>Implementation considerations: | ||
| * <ul> | ||
| * <li>Must handle profile merging strategies</li> | ||
| * <li>Should implement proper error handling</li> | ||
| * <li>Must maintain data consistency</li> | ||
| * <li>Should handle property type conversions</li> | ||
| * </ul> |
There was a problem hiding this comment.
Updated implementation considerations: property type conversion happens upstream (e.g. LineSplitProcessor); this service merges/deletes/saves prepared profiles only.
| * Exception thrown when profile data cannot be properly parsed or formatted during import/export operations. | ||
| * This exception indicates issues with the structure or content of profile data that prevent it from being | ||
| * properly processed by the Unomi router. |
There was a problem hiding this comment.
Narrowed class Javadoc to import line processing only; export paths do not throw or handle this exception.
| * <li>Sets up import and export routes</li> | ||
| * <li>Handles route configuration updates</li> | ||
| * <li>Manages route lifecycle (start/stop/update)</li> | ||
| * <li>Provides monitoring through event notifications</li> |
There was a problem hiding this comment.
Removed "monitoring through event notifications" from the feature list. The class does not publish router events today (fireEvent is unused).
| private Integer configsRefreshInterval = 1000; | ||
| private ScheduledFuture<?> scheduledFuture; | ||
|
|
||
| /** Event topic fired when a router configuration or route is removed (reserved for integrations). */ |
There was a problem hiding this comment.
Documented EVENT_ID_REMOVE as a reserved topic identifier for future use — not published by the current implementation. We kept constants as placeholders rather than implementing emission in this PR.
| * - Formatting profiles according to export configuration | ||
| * - Generating the export content | ||
| * | ||
| * @param exportConfiguration the configuration specifying export parameters and format |
There was a problem hiding this comment.
Updated extractProfilesBySegment Javadoc to mention that implementations query profiles, build CSV content, append an execution record, and persist the updated export configuration — not a pure read/format helper.
… into UNOMI-888-import-export-javadoc
Align documentation with actual import/export behavior, fix configType and transport-mode wording (kafka/nobroker vs direct), validate column separator length, and make getCamelContext() a default interface method.
Stacked PR (merge order)
UNOMI-879-unified-crud-shellUNOMI-888-import-export-javadocThis PR is stacked: merge into
UNOMI-879-unified-crud-shellfirst (after #755 is merged there, or once that line is rebased).Summary
JIRA: UNOMI-888
Improves public documentation for the profile import/export router (
extensions/router/router-api,extensions/router/router-core) by replacing placeholder comments with substantive Javadoc on the facade, configuration types, services, processors, route builders, aggregation strategies, and related API types.Includes a few small behavioral/API corrections found while documenting.
What changed
Documentation
IRouterCamelContext: Facade-level description and method-level Javadoc for route lifecycle operations.ImportExportConfiguration,ProfileToImport,BadProfileDataFormatException, import/export service interfaces: Expanded and clarified docs (including consistent wording for shared import/export configuration).RouterCamelContext, processors, route builders, aggregation strategies,CollectProfileBean: Class and member documentation aligned with actual responsibilities.Small fixes (non-doc)
IRouterCamelContext: AddObject getCamelContext()so API consumers are not forced to depend on Camel types at compile time (implementations may still return the concrete Camel context).RouterCamelContext:setTracing(boolean)now honors the argument (previously always enabled tracing);@Override+{@inheritDoc}on interface methods.ImportExportConfiguration#setColumnSeparator: Null-check the parameter (consistent withsetLineSeparator).LineSplitFailureHandler:@Overrideonprocess(Exchange).Verification
(Fill in the exact Maven commands you ran, e.g. router modules compile / full
itests.)Scope
extensions/router/(commit51aa61c9f).