sergehuber commented on code in PR #756:
URL: https://github.com/apache/unomi/pull/756#discussion_r3254129302
##########
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportOneShotRouteBuilder.java:
##########
@@ -30,18 +30,59 @@
import java.util.Map;
/**
- * Created by amidani on 22/05/2017.
+ * A Camel route builder that handles one-time profile imports from files.
+ * This route builder creates routes that process CSV files dropped into a
+ * monitored directory for one-time import operations.
+ *
+ * <p>Features:
+ * <ul>
+ * <li>File-based import processing</li>
+ * <li>Configuration lookup from filename</li>
+ * <li>CSV file processing with error handling</li>
+ * <li>Support for both Kafka and direct endpoints</li>
+ * <li>Automatic file movement after processing</li>
+ * <li>Error reporting and failed file handling</li>
+ * </ul>
+ * </p>
+ *
+ * @since 1.0
*/
public class ProfileImportOneShotRouteBuilder extends
RouterAbstractRouteBuilder {
private static final Logger LOGGER =
LoggerFactory.getLogger(ProfileImportOneShotRouteBuilder.class.getName());
+
+ /** Processor for extracting import configuration from filenames */
private ImportConfigByFileNameProcessor importConfigByFileNameProcessor;
+
+ /** Directory to monitor for import files */
private String uploadDir;
+ /**
+ * Constructs a new route builder with Kafka configuration.
+ *
+ * @param kafkaProps map containing Kafka configuration properties
+ * @param configType the type of configuration (kafka/direct)
Review Comment:
Same fix — transport mode documented as `kafka` / `nobroker`, not `direct`.
##########
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/route/ProfileImportToUnomiRouteBuilder.java:
##########
@@ -29,19 +29,56 @@
import java.util.Map;
/**
- * Created by amidani on 26/04/2017.
+ * A Camel route builder that handles the final stage of profile imports by
storing
+ * processed profile data into Apache Unomi's storage system.
+ *
+ * <p>Features:
+ * <ul>
+ * <li>Final processing of imported profiles</li>
+ * <li>Integration with Unomi's storage system</li>
+ * <li>Support for both Kafka and direct endpoints</li>
+ * <li>Import completion handling</li>
+ * <li>Error handling and reporting</li>
+ * </ul>
+ * </p>
+ *
+ * @since 1.0
*/
public class ProfileImportToUnomiRouteBuilder extends
RouterAbstractRouteBuilder {
private static final Logger LOGGER =
LoggerFactory.getLogger(ProfileImportToUnomiRouteBuilder.class.getName());
+ /** Processor for storing profiles in Unomi */
private UnomiStorageProcessor unomiStorageProcessor;
+
+ /** Processor for handling import completion */
private ImportRouteCompletionProcessor importRouteCompletionProcessor;
+ /**
+ * Constructs a new route builder with Kafka configuration.
+ *
+ * @param kafkaProps map containing Kafka configuration properties
+ * @param configType the type of configuration (kafka/direct)
Review Comment:
Same fix — updated class and constructor Javadoc for the actual `configType`
values.
##########
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/processor/ImportRouteCompletionProcessor.java:
##########
@@ -26,15 +26,51 @@
import java.util.*;
/**
- * Created by amidani on 14/06/2017.
+ * A Camel processor that handles the completion of profile import routes.
+ * This processor manages the final stage of import operations, collecting
statistics,
+ * handling errors, and updating the import configuration with execution
results.
+ *
+ * <p>The processor performs the following operations:
+ * <ul>
+ * <li>Collects import statistics (success, failure, ignore counts)</li>
+ * <li>Manages error reporting with configurable limits</li>
Review Comment:
Adjusted Javadoc to describe only persisted statistics (success/failure
counts and errors). `ignoreCount` is counted locally but not written to the
execution record — docs no longer claim it is collected.
##########
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/exceptions/BadProfileDataFormatException.java:
##########
@@ -17,18 +17,57 @@
package org.apache.unomi.router.api.exceptions;
/**
- * Created by amidani on 13/06/2017.
+ * 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.
+ *
+ * <p>Common scenarios where this exception is thrown:
+ * <ul>
+ * <li>Invalid CSV format in import files</li>
+ * <li>Missing required profile fields</li>
+ * <li>Incorrect data types for profile properties</li>
+ * <li>Malformed multi-value fields</li>
+ * <li>Invalid date formats</li>
Review Comment:
Removed "invalid date formats" from the documented scenarios; date fields
are not format-validated separately today. Listed causes now match what
`LineSplitProcessor` actually throws for.
##########
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/bean/CollectProfileBean.java:
##########
@@ -22,17 +22,43 @@
import java.util.List;
/**
- * Created by amidani on 28/06/2017.
+ * A bean that handles the collection of profiles based on segment criteria.
+ * This class provides functionality to extract profiles from Unomi's
persistence
+ * layer based on segment membership.
+ *
+ * <p>Features:
+ * <ul>
+ * <li>Segment-based profile extraction</li>
+ * <li>Integration with Unomi's persistence service</li>
+ * <li>Batch profile retrieval capabilities</li>
Review Comment:
Removed the "batch profile retrieval" bullet. Docs now describe
segment-based query via `persistenceService.query(...)`, consistent with the
memory note (UNOMI-759).
##########
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ProfileImportService.java:
##########
@@ -21,9 +21,54 @@
import java.lang.reflect.InvocationTargetException;
/**
- * Created by amidani on 20/05/2017.
+ * Service interface for handling the import of individual profiles into
Apache Unomi.
+ * This service is responsible for the actual processing and storage of
imported profile data,
+ * including merging with existing profiles or creating new ones as needed.
+ *
+ * <p>Key responsibilities:
+ * <ul>
+ * <li>Processing individual profile imports</li>
+ * <li>Merging imported data with existing profiles</li>
+ * <li>Handling profile creation for new imports</li>
+ * <li>Managing profile deletion when specified</li>
+ * </ul>
+ * </p>
+ *
+ * <p>Usage in Unomi:
+ * <ul>
+ * <li>Called by import route processors to handle individual profile
data</li>
+ * <li>Used during batch import operations</li>
+ * <li>Integrated with Unomi's profile management system</li>
+ * </ul>
+ * </p>
+ *
+ * <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>
Review Comment:
Updated implementation considerations: property type conversion happens
upstream (e.g. `LineSplitProcessor`); this service merges/deletes/saves
prepared profiles only.
##########
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/exceptions/BadProfileDataFormatException.java:
##########
@@ -17,18 +17,57 @@
package org.apache.unomi.router.api.exceptions;
/**
- * Created by amidani on 13/06/2017.
+ * 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.
Review Comment:
Narrowed class Javadoc to **import** line processing only; export paths do
not throw or handle this exception.
##########
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/RouterCamelContext.java:
##########
@@ -49,7 +49,25 @@
import java.util.concurrent.TimeUnit;
/**
- * Created by amidani on 04/05/2017.
+ * The main Camel context manager for the Unomi Router component.
+ * This class manages the lifecycle of all import and export routes,
+ * handles route configuration updates, and maintains the Camel context.
+ *
+ * <p>Features:
+ * <ul>
+ * <li>Initializes and manages the Camel context</li>
+ * <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>
Review Comment:
Removed "monitoring through event notifications" from the feature list. The
class does not publish router events today (`fireEvent` is unused).
##########
extensions/router/router-core/src/main/java/org/apache/unomi/router/core/context/RouterCamelContext.java:
##########
@@ -79,8 +97,11 @@ public class RouterCamelContext implements
IRouterCamelContext {
private Integer configsRefreshInterval = 1000;
private ScheduledFuture<?> scheduledFuture;
+ /** Event topic fired when a router configuration or route is removed
(reserved for integrations). */
Review 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.
##########
extensions/router/router-api/src/main/java/org/apache/unomi/router/api/services/ProfileExportService.java:
##########
@@ -23,12 +23,67 @@
import java.util.Collection;
/**
- * Created by amidani on 30/06/2017.
+ * Service interface for handling the export of profiles from Apache Unomi.
+ * This service is responsible for extracting profiles based on segment
criteria
+ * and converting them into the appropriate export format (e.g., CSV).
+ *
+ * <p>Key responsibilities:
+ * <ul>
+ * <li>Extracting profiles based on segment criteria</li>
+ * <li>Converting profiles to export format</li>
+ * <li>Handling data formatting and transformation</li>
+ * <li>Managing export file generation</li>
+ * </ul>
+ * </p>
+ *
+ * <p>Usage in Unomi:
+ * <ul>
+ * <li>Called by export route processors to handle profile extraction</li>
+ * <li>Used during scheduled export operations</li>
+ * <li>Integrated with Unomi's segmentation system</li>
+ * </ul>
+ * </p>
+ *
+ * <p>Implementation considerations:
+ * <ul>
+ * <li>Must handle large data sets efficiently</li>
+ * <li>Should implement proper error handling</li>
+ * <li>Must respect profile property formatting</li>
+ * <li>Should handle multi-valued properties</li>
+ * </ul>
+ * </p>
+ *
+ * @see Profile
+ * @see ExportConfiguration
+ * @see PropertyType
+ * @since 1.0
*/
public interface ProfileExportService {
+ /**
+ * Extracts profiles belonging to a specified segment and formats them for
export.
+ * This method handles the bulk export operation, including:
+ * - Querying profiles based on segment criteria
+ * - Formatting profiles according to export configuration
+ * - Generating the export content
+ *
+ * @param exportConfiguration the configuration specifying export
parameters and format
Review 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]