Protocol Abstractions
Relevant source files
The following files were used as context for generating this wiki page:
Protocol Abstractions in flext-tap-ldap define the structural contracts and interfaces that enable seamless integration between LDAP directory services, LDIF (LDAP Data Interchange Format) processing, and the Singer tap ecosystem. These abstractions decouple the high-level business logic of the tap from the underlying library implementations (such as flext-ldap and flext-ldif), ensuring that the system remains modular, testable, and compliant with the FLEXT architectural patterns.
The abstraction layer primarily focuses on three areas: LDAP client operations, LDIF stream processing, and technical validation/transformation logic. By utilizing specific mixins and internal classes, the project provides testing convenience wrappers that delegate actual execution to canonical libraries while maintaining a consistent interface for the Singer tap.
Sources: src/flext_tap_ldap/tap.py, src/flext_tap_ldap/client.py:20-25, src/flext_tap_ldap/_utilities/_processor.py:24-30
LDAP Client Infrastructure
The LDAP client infrastructure is encapsulated within FlextTapLdapClient, which provides a unified interface for connection management, health checks, and search operations. It utilizes the Parameter Object Pattern for configuration and follows a delegation model where the LDAPClient wrapper handles testing convenience while routing core requests to the FlextLdap library.
Client Architecture and Search Flow
The client supports both standard LDAP searches and specialized Oracle OID (Oracle Internet Directory) searches. The search flow involves normalizing search scopes, extending attributes (if in Oracle mode), and processing raw results into JSON mappings suitable for Singer records.
The diagram shows the synchronous search execution path within the LDAPClient wrapper.
Sources: src/flext_tap_ldap/client.py:91-115, src/flext_tap_ldap/client.py:214-239
Key Client Components
| Component | Description |
|---|---|
LDAPClient | A testing convenience wrapper that delegates to FlextLdap API. |
health_check | Performs a connection test and returns status, URI, and response time. |
search | Synchronous method to retrieve entries based on DN, filter, and scope. |
search_with_oracle_support | Specialized search handling event loop management for Oracle-specific attributes. |
Sources: src/flext_tap_ldap/client.py:34-89, src/flext_tap_ldap/client.py:126-140
LDIF Processing and Stream Abstractions
The project abstracts LDIF file and content processing through the u.TapLdap namespace. This includes dedicated classes for parsing, validating, and transforming LDIF data, which are then utilized by the Singer stream implementations.
Processor and Transformer Logic
The Processor class handles loading LDIF data from files or strings, while the Transformer applies rule-based modifications (mapping, adding, or removing attributes) to entries before they are emitted as Singer records.
This sequence illustrates how LDIF data moves from a raw file through the processor and transformer within a stream context.
Sources: src/flext_tap_ldap/_utilities/_processor.py:165-225, src/flext_tap_ldap/_utilities/_processor.py:421-480
Stream Implementation Types
The tap defines specialized streams for different LDAP and LDIF data sources:
- LDAP Base Streams: Includes
UsersStream,GroupsStream,OrganizationalUnitsStream, andSchemaStreamfor direct directory extraction. - LdifStream: Processes LDIF files from a directory or specific list, converting entries into Singer
RECORDmessages. - LdifAnalysisStream: Generates summary statistics (entry counts, object class distribution) from LDIF sources using
flext-ldifanalysis capabilities.
Sources: src/flext_tap_ldap/tap.py:130-145, src/flext_tap_ldap/ldif_streams.py:110-125, src/flext_tap_ldap/ldif_streams.py:240-250
Client Support Utilities
FlextTapLdapUtilitiesClientSupport provides static helpers for normalization and Oracle-specific enrichment. These utilities ensure that data retrieved from diverse LDAP environments is consistent with the tap's internal JSON-based processing.
Oracle OID Enrichment
When oracle_oid_mode is enabled, the tap extends requested attributes and normalizes specific Oracle fields (e.g., mapping orclPassword to userPassword and ensuring orclContainer entries also possess the organizationalUnit object class).
The diagram describes the normalization logic applied to entries originating from Oracle Internet Directory.
Sources: src/flext_tap_ldap/_utilities/client_support.py:73-100, src/flext_tap_ldap/_utilities/client_support.py:102-136
Test Protocol Extensions
In the testing domain, protocols are aggregated to provide a unified interface for unit and integration tests. TestsFlextTapLdapProtocols combines project-specific protocols with the base FlextTestsProtocols.
The class diagram shows the inheritance structure used for test-specific protocol abstractions.
Sources: tests/protocols.py:19-24
Summary
Protocol Abstractions in flext-tap-ldap provide a robust foundation for LDAP data extraction by standardizing how the tap interacts with directory services and LDIF data. By encapsulating complex logic into the Processor, Transformer, and LDAPClient classes, the system ensures that data flows predictably from source to Singer output, while remaining flexible enough to handle environmental specificities like Oracle OID or paged LDIF directory traversals.
Sources: src/flext_tap_ldap/tap.py:53-85, src/flext_tap_ldap/_utilities/_processor.py:20-22