use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class AsterixEventServiceClient method getDirectoryTransferPattern.
private Pattern getDirectoryTransferPattern(String username, String src, Nodeid srcNode, String destNodeIp, String destDir) {
String pargs = username + " " + src + " " + destNodeIp + " " + destDir;
Event event = new Event("directory_transfer", srcNode, pargs);
return new Pattern(null, 1, null, event);
}
use of org.apache.asterix.event.schema.pattern.Pattern in project asterixdb by apache.
the class AsterixEventServiceClient method initPattern.
private Patterns initPattern(String eventsDir) throws Exception {
Nodeid nodeid = new Nodeid(new Value(null, EventDriver.CLIENT_NODE.getId()));
List<Pattern> patternList = new ArrayList<Pattern>();
String workingDir = cluster.getWorkingDir().getDir();
String username = cluster.getUsername() == null ? System.getProperty("user.name") : cluster.getUsername();
patternList.add(getDirectoryTransferPattern(username, eventsDir, nodeid, cluster.getMasterNode().getClusterIp(), workingDir));
JAXBContext ctx = JAXBContext.newInstance(Configuration.class);
Marshaller marshaller = ctx.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
String outputPathDir = System.getProperty("java.io.tmpdir") + File.separator + "conf-" + System.getProperty("user.name");
new File(outputPathDir).mkdirs();
String outputPath = outputPathDir + File.separator + "configuration.xml";
marshaller.marshal(configuration, new FileOutputStream(outputPath));
patternList.add(getFileTransferPattern(username, outputPath, nodeid, cluster.getMasterNode().getClusterIp(), workingDir));
if (!cluster.getWorkingDir().isNFS()) {
for (Node node : cluster.getNode()) {
patternList.add(getDirectoryTransferPattern(username, eventsDir, nodeid, node.getClusterIp(), workingDir));
}
}
return new Patterns(patternList);
}
Aggregations