CRecordFileRegistryGetFilePaths

Retrieve all relative paths of files registered in the The File Registry API that correspond to the given subdirectory. The number of returned files is limited to 1000.

This message is part of the The File Registry API API.

{
  "id": "fcbfda81-b40d-4bae-ad11-5a5d0a2da8f7",
  "name": "FILE_REGISTRY_GET_FILE_PATHS",
  "description": "Get information about all (max 1000) file paths registered in the registry for a given directory.",
  "slots": [
    {
      "key": "1",
      "name": "DIRECTORY",
      "direction": "REQUEST",
      "mandatory": "false",
      "type": "STRING",
      "description": "The relative directory to search for."
    }
    {
      "key": "2",
      "name": "PATHS",
      "direction": "ANSWER",
      "mandatory": "false",
      "type": "STRING_ARRAY",
      "description": "All file paths registered in the file registry."
    }
  ]
}

Message Arguments

Key Name Direction Mandatory Type Description
1 DIRECTORY REQUEST false STRING The relative directory to search for.
2 PATHS ANSWER false STRING_ARRAY All file paths registered in the file registry.

Usage

Request

final IId microServiceId = CIdFactory.fromObject("file.registry");
final CEnvelope env = CEnvelope.forMicroService(microServiceId);

final CRecord record = CRecordFileRegistryGetFilePaths.create();
CRecordFileRegistryGetFilePaths.setDirectory(record,
                                             "lib/");

sendRequest(env,
            record);

Catch the response

// in Target constructor
addMessageHandler(CRecordFileRegistryGetFilePaths.ID,
              this::asyncGetFilePaths);

// message handler
private boolean asyncGetFilePaths(@NotNull final CEnvelope aEnvelope,
                                  @NotNull final CRecord aRecord)
{
    if (aEnvelope.isAnswer())
    {
        if (aEnvelope.getResult()
                     .hasSuccess())
        {
            final String[] arr = CRecordFileRegistryGetFilePaths.getPaths(aRecord,
                                                                          null);
            ...
        }
        return true;
    }
    else
    {
        return false;
    }
}

Record Usage

In nyssr.net, we typically don't exchange interfaces between projects. Instead, we use platform-independent Records to describe message formats.

One or more descriptions of these Records are stored in the JSON or XML format as record.json or record.xml within a directory. The Record Generator, an included Swing tool, generates helper classes from these files. These classes can then be used to type-safely write or read messages.

See also