this.dir = dir;
this.spec = spec;
}
public Location createStreamProcesses() {
Location configDir = null;
try {
configDir = createStreamLibrary(dir);
CompileStreamBinaries compileBinaries = new CompileStreamBinaries(configDir);
StreamConfigGenerator generator = new StreamConfigGenerator(spec);
Location outputSpec = createFile(configDir, "output_spec.cfg");
Location packetSchema = createFile(configDir, "packet_schema.txt");
Location ifresXml = createFile(configDir, "ifres.xml");
Map.Entry<String, String> ifqContent = generator.generateHostIfq();
String ifqFile = String.format("%s.ifq", ifqContent.getKey());
Location hostIfq = createFile(configDir, ifqFile);
writeToLocation(outputSpec, generator.generateOutputSpec());
writeToLocation(packetSchema, generator.generatePacketSchema());
writeToLocation(ifresXml, generator.generateIfresXML());
writeToLocation(hostIfq, generator.generateHostIfq().getValue());
Map<String, String> gsqlFiles = generator.generateQueryFiles();
Collection<String> fileContent = gsqlFiles.values();
Location file = createFile(configDir, Constants.GSQL_FILE);
writeToLocation(file, Joiner.on(";\n").join(fileContent));
compileBinaries.generateBinaries();
} catch (Throwable t) {
LOG.error(t.getMessage(), t);