@Override
    protected void process(String hostName, ResolvedKerberosKeytab resolvedKeytab, ResolvedKerberosPrincipal resolvedPrincipal, Map<String, ? extends Collection<String>> serviceComponentFilter) throws IOException {
      if (dataDir != null) {
        String principal = resolvedPrincipal.getPrincipal();
        String keytabFilePath = resolvedKeytab.getFile();
        LOG.info("Processing principal {} for host {} and keytab file path {}", principal, hostName, keytabFilePath);

        if (keytabFilePath != null) {
          String sha1Keytab = DigestUtils.sha256Hex(keytabFilePath);
          File keytabFile = Paths.get(dataDir, hostName, sha1Keytab).toFile();

          if (keytabFile.canRead()) {
            Map<String, String> keytabMap = new HashMap<>();

            keytabMap.put(KerberosIdentityDataFileReader.HOSTNAME, hostName);
            keytabMap.put(KerberosIdentityDataFileReader.PRINCIPAL, principal);
            keytabMap.put(KerberosIdentityDataFileReader.KEYTAB_FILE_PATH, keytabFilePath);
            keytabMap.put(KerberosIdentityDataFileReader.KEYTAB_FILE_OWNER_NAME, resolvedKeytab.getOwnerName());
            keytabMap.put(KerberosIdentityDataFileReader.KEYTAB_FILE_OWNER_ACCESS, resolvedKeytab.getOwnerAccess());
            keytabMap.put(KerberosIdentityDataFileReader.KEYTAB_FILE_GROUP_NAME, resolvedKeytab.getGroupName());
            keytabMap.put(KerberosIdentityDataFileReader.KEYTAB_FILE_GROUP_ACCESS, resolvedKeytab.getGroupAccess());

            BufferedInputStream bufferedIn = new BufferedInputStream(new FileInputStream(keytabFile));
            byte[] keytabContent;
            try {
              keytabContent = IOUtils.toByteArray(bufferedIn);
            } finally {
              bufferedIn.close();
            }
            String keytabContentBase64 = Base64.encodeBase64String(keytabContent);
            keytabMap.put(KerberosServerAction.KEYTAB_CONTENT_BASE64, keytabContentBase64);

            kcp.add(keytabMap);
          } else {
            LOG.warn("Keytab file for principal {} and host {} can not to be read at path {}",
                principal, hostName, keytabFile.getAbsolutePath());
          }
        }
      }
    }
SetKeytabCommandParameterProcessor is an implementation of {@link KerberosCommandParameterProcessor}
that handles the case for setting keytab files.
<p>
Specifically, this implementation add addition the keytab file details and its contents to the
command parameters. It also only performs operations only for services and components that are
known to be installed; therefore, the service/component filter may be altered to enforce this.
ambari-server/src/main/java/org/apache/ambari/server/events/publishers/AgentCommandsPublisher.java