src/StreamletAttributeFinder.h
branchv_0
changeset 61 640ba8948d69
parent 60 bb7ca5891755
child 62 a467e8cbd16b
equal deleted inserted replaced
60:bb7ca5891755 61:640ba8948d69
    72 	string_t getStreamletCommand(const RequestedField& field) {
    72 	string_t getStreamletCommand(const RequestedField& field) {
    73 		const char* streamletPathChars = getenv("RELPIPE_IN_FILESYSTEM_STREAMLET_PATH");
    73 		const char* streamletPathChars = getenv("RELPIPE_IN_FILESYSTEM_STREAMLET_PATH");
    74 		if (streamletPathChars) {
    74 		if (streamletPathChars) {
    75 			for (string_t path : splitBySeparator(convertor.from_bytes(streamletPathChars))) {
    75 			for (string_t path : splitBySeparator(convertor.from_bytes(streamletPathChars))) {
    76 				fs::path file = fs::path(path) / fs::path(field.name);
    76 				fs::path file = fs::path(path) / fs::path(field.name);
    77 				if (fs::exists(file) && ::access(file.c_str(), X_OK) == 0) return file.wstring();  // n.b. must be set executable using e.g. chmod – files executable through only ACL, are actually not executable
    77 				if (fs::exists(file) && ::access(file.c_str(), X_OK) == 0) return file.wstring(); // n.b. must be set executable using e.g. chmod – files executable through only ACL, are actually not executable
    78 			}
    78 			}
    79 			throw RelpipeWriterException(L"Streamlet „" + field.name + L"“ was not found at $RELPIPE_IN_FILESYSTEM_STREAMLET_PATH");
    79 			throw RelpipeWriterException(L"Streamlet „" + field.name + L"“ was not found at $RELPIPE_IN_FILESYSTEM_STREAMLET_PATH");
    80 		} else {
    80 		} else {
    81 			throw RelpipeWriterException(L"Missing environment variable RELPIPE_IN_FILESYSTEM_STREAMLET_PATH → unable to find streamlet.");
    81 			throw RelpipeWriterException(L"Missing environment variable RELPIPE_IN_FILESYSTEM_STREAMLET_PATH → unable to find streamlet.");
    82 		}
    82 		}
   102 				else throw RelpipeWriterException(L"Protocol violation from exec sub-process while reading: „" + metadata.attributeName + L"“. Expected OUTPUT_ATTRIBUTE but got: " + m.toString());
   102 				else throw RelpipeWriterException(L"Protocol violation from exec sub-process while reading: „" + metadata.attributeName + L"“. Expected OUTPUT_ATTRIBUTE but got: " + m.toString());
   103 			}
   103 			}
   104 
   104 
   105 			SubProcess::Message m = subProcesses[field.id]->read();
   105 			SubProcess::Message m = subProcesses[field.id]->read();
   106 			if (m.code != StreamletMsg::WAITING_FOR_INPUT_ATTRIBUTES) throw RelpipeWriterException(L"Protocol violation from exec sub-process. Expected WAITING_FOR_INPUT_ATTRIBUTES but got: " + m.toString());
   106 			if (m.code != StreamletMsg::WAITING_FOR_INPUT_ATTRIBUTES) throw RelpipeWriterException(L"Protocol violation from exec sub-process. Expected WAITING_FOR_INPUT_ATTRIBUTES but got: " + m.toString());
   107 			// FIXME: generic protocol violation error messages / method for checking responses
       
   108 		}
   107 		}
   109 	}
   108 	}
   110 
   109 
   111 public:
   110 public:
   112 
   111