virtual void init() { CMasterActivity::init(); OwnedRoxieString fname(helper->getFileName()); Owned<IDistributedFile> fetchFile = queryThorFileManager().lookup(container.queryJob(), fname, false, 0 != (helper->getFetchFlags() & FFdatafileoptional), true); if (fetchFile) { if (isFileKey(fetchFile)) throw MakeActivityException(this, 0, "Attempting to read index as a flat file: %s", fname.get()); Owned<IFileDescriptor> fileDesc = getConfiguredFileDescriptor(*fetchFile); void *ekey; size32_t ekeylen; helper->getFileEncryptKey(ekeylen,ekey); bool encrypted = fileDesc->queryProperties().getPropBool("@encrypted"); if (0 != ekeylen) { memset(ekey,0,ekeylen); free(ekey); if (!encrypted) { Owned<IException> e = MakeActivityWarning(&container, TE_EncryptionMismatch, "Ignoring encryption key provided as file '%s' was not published as encrypted", fetchFile->queryLogicalName()); queryJobChannel().fireException(e); } } else if (encrypted) throw MakeActivityException(this, 0, "File '%s' was published as encrypted but no encryption key provided", fetchFile->queryLogicalName()); mapping.setown(getFileSlaveMaps(fetchFile->queryLogicalName(), *fileDesc, container.queryJob().queryUserDescriptor(), container.queryJob().querySlaveGroup(), container.queryLocalOrGrouped(), false, NULL, fetchFile->querySuperFile())); mapping->serializeFileOffsetMap(offsetMapMb); addReadFile(fetchFile); } }
inline bool isFileKey(IFileDescriptor *f) { return isFileKey(f->queryProperties()); }
inline bool isFileKey(IDistributedFile *f) { return isFileKey(f->queryAttributes()); }