Wednesday, November 19, 2025

OIC - Using Dynamic Paths for OCI Object Storage in OIC Integrations | Handling “Subfolders” in OCI Object Storage bucket

Use Case

In Oracle Integration Cloud (OIC), when working with Oracle Object Storage, “folders” inside a bucket are not real directories. They are simply part of the object name (key).
Because of this, OIC cannot dynamically navigate subfolders the same way as SFTP or FTP directories.

So when an integration requires:

  • Upload Path
  • Archive Path
  • Error/Reject Path
  • Dynamic Environment-specific Paths (DEV/TEST/PROD)

…you must pass these paths as string fields and build the full object name by concatenating path + filename.

This approach is required to handle dynamic folder structures, avoid hardcoding paths, and support multiple environments using a single integration.


Solution Overview

To manage folder-like object prefixes correctly in OIC:

  1. Create lookup/variables for folder paths (upload, archive, error).
  2. Pass these as integration input or derive from a lookup.
  3. Concatenate the path with the file name to create the full object key.
  4. Use the Object Storage adapter with the generated key (object name).
  5. Avoid assuming physical directories—treat each folder as a prefix.

Solution Steps

Step 1: Create Path Fields

Create the following fields in your integration or lookup:

  • BucketName - bkt-dev-payment
  • uploadPath – e.g., /incoming/employee/ or / for no subfolder.
  • archivePath – e.g., /archive/employee/ or / for no subfolder
  • errorPath – e.g., /error/employee/ or / for no subfolder.

Ensure each ends with a trailing slash.


Step 2: Accept or Fetch File Name

From the source system or from the file adapter, capture the file name:

Example:
EMPLOYEE_20251119.csv


Step 3: Construct the Object Key

Use an assign activity in OIC:

fullObjectName = uploadPath || fileName

Examples:

incoming/employee/EMPLOYEE_20251119.csv
archive/employee/EMPLOYEE_20251119.csv

This string is the actual object key in Object Storage.


Step 4: Configure Object Storage Adapter

In the adapter configuration:

  • Select "Specify Object Name"
  • Map it to the concatenated value (fullObjectName)

No directory browsing is required because subfolders are just text prefixes.


Step 5: Write or Read the Object

Use the adapter normally — OIC will treat the full object key as the complete path.

  • Write → Upload to path-like object key
  • Read → Fetch file using the exact key
  • Move/Archive → Upload the same file under the archive key and delete the original

Step 6: Repeat for Archive and Error Handling

During archiving:

archiveObjectName = archivePath || fileName

During error processing:

errorObjectName = errorPath || fileName

Solution with screenshots:

Upload/archive/getfile:
URI: /n/{namespaceName}/b/{bucketName}/o/{subfolder}{objectName}
Map the subfolder path from lookup:
dvm:lookupValue("<LookupName>_Common_CCS_Interface_SFTP_Lookup",
                "IntegrationId",
                $Var_InterfaceId,
                "ArchiveBucketSubfolder",
                "/")




List files:
Create a variable and store the bucket sub folder path 
fn:substring-after(
    dvm:lookupValue(
        "<LookupName>_Common_CCS_Interface_SFTP_Lookup",
        "IntegrationId",
        $Var_InterfaceID,
        "BucketSubfolder",
        "/"
    ),
    "/"
)
Add the bucket subfolderpath as prefix to the object name
concat(
    Var_BucketSubfolderPath,
    replace(
        lookupValue(
            "<LookupName>_Common_CCS_Interface_SFTP_Lookup",
            "IntegrationId",
            Var_InterfaceID,
            "SourceFileName",
            "NA"
        ),
        "YYYYMMDD",
        concat(
            substring(FileProcessingDate, 3.0, 2.0),
            substring(FileProcessingDate, 5.0, 2.0),
            substring(FileProcessingDate, 7.0, 2.0)
        )
    )
)






Rename file:
This is same as list files, need to add the subfolder prefix to the object name.




Final Note

This approach is the recommended design pattern because Object Storage does not support directory navigation. Treating paths as string prefixes ensures full flexibility and environment portability in all OIC integrations.


No comments:

Post a Comment

Featured Post

OIC - Using Dynamic Paths for OCI Object Storage in OIC Integrations | Handling “Subfolders” in OCI Object Storage bucket

Use Case In Oracle Integration Cloud (OIC), when working with Oracle Object Storage, “folders” inside a bucket are not real directories . T...