/** * Compute the java.library.path that should be used for the worker. This helps it to load JNI libraries that are packaged in the uber * jar. * * @param stormRoot the root directory of the worker process * @param conf the config for the supervisor. * @return the java.library.path/LD_LIBRARY_PATH to use so native libraries load correctly. */ protected String javaLibraryPath(String stormRoot, Map<String, Object> conf) { String resourceRoot = stormRoot + File.separator + ServerConfigUtils.RESOURCES_SUBDIR; String os = System.getProperty("os.name").replaceAll("\\s+", "_"); String arch = System.getProperty("os.arch"); String archResourceRoot = resourceRoot + File.separator + os + "-" + arch; String ret = CPJ.join(archResourceRoot, resourceRoot, conf.get(DaemonConfig.JAVA_LIBRARY_PATH)); return ret; }
private String generateJoinedString(Set<String> activeTopologyIds) { return Joiner.on(",").join(activeTopologyIds); }
/** * Compute the classpath for the worker process. * * @param stormJar the topology jar * @param dependencyLocations any dependencies from the topology * @param topoVersion the version of the storm framework to use * @return the full classpath */ protected String getWorkerClassPath(String stormJar, List<String> dependencyLocations, SimpleVersion topoVersion) { List<String> workercp = new ArrayList<>(); workercp.addAll(asStringList(_topoConf.get(Config.TOPOLOGY_CLASSPATH_BEGINNING))); workercp.addAll(frameworkClasspath(topoVersion)); workercp.add(stormJar); workercp.addAll(dependencyLocations); workercp.addAll(asStringList(_topoConf.get(Config.TOPOLOGY_CLASSPATH))); return CPJ.join(workercp); }
/** * Reads a string encrypted by another instance with a shared key */ private void testEncryptsAndDecryptsMessage(Map<String, Object> topoConf) { String testText = "Tetraodontidae is a family of primarily marine and estuarine fish of the order" + " Tetraodontiformes. The family includes many familiar species, which are" + " variously called pufferfish, puffers, balloonfish, blowfish, bubblefish," + " globefish, swellfish, toadfish, toadies, honey toads, sugar toads, and sea" + " squab.[1] They are morphologically similar to the closely related" + " porcupinefish, which have large external spines (unlike the thinner, hidden" + " spines of Tetraodontidae, which are only visible when the fish has puffed up)." + " The scientific name refers to the four large teeth, fused into an upper and" + " lower plate, which are used for crushing the shells of crustaceans and" + " mollusks, their natural prey."; Kryo kryo = new Kryo(); BlowfishTupleSerializer writerBTS = new BlowfishTupleSerializer(kryo, topoConf); BlowfishTupleSerializer readerBTS = new BlowfishTupleSerializer(kryo, topoConf); int bufferSize = 1024; Output output = new Output(bufferSize, bufferSize); Input input = new Input(bufferSize); String[] stringList = testText.split(" "); ListDelegate delegate = new ListDelegate(); delegate.addAll(Arrays.asList(stringList)); writerBTS.write(kryo, output, delegate); input.setBuffer(output.getBuffer()); ListDelegate outDelegate = readerBTS.read(kryo, input, ListDelegate.class); Assert.assertEquals(testText, Joiner.on(" ").join(outDelegate.toArray())); } }
/** * Compute the java.library.path that should be used for the worker. * This helps it to load JNI libraries that are packaged in the uber jar. * @param stormRoot the root directory of the worker process * @param conf the config for the supervisor. * @return the java.library.path/LD_LIBRARY_PATH to use so native libraries load correctly. */ protected String javaLibraryPath(String stormRoot, Map<String, Object> conf) { String resourceRoot = stormRoot + Utils.FILE_PATH_SEPARATOR + ConfigUtils.RESOURCES_SUBDIR; String os = System.getProperty("os.name").replaceAll("\\s+", "_"); String arch = System.getProperty("os.arch"); String archResourceRoot = resourceRoot + Utils.FILE_PATH_SEPARATOR + os + "-" + arch; String ret = CPJ.join(archResourceRoot, resourceRoot, conf.get(Config.JAVA_LIBRARY_PATH)); return ret; }
public FieldSelector(String stream, String[] field) { this( stream, Joiner.on(".").join(field) ); }
private String generateJoinedString(Set<String> activeTopologyIds) { return Joiner.on(",").join(activeTopologyIds); }
/** * Compute the classpath for the worker process * @param stormJar the topology jar * @param dependencyLocations any dependencies from the topology * @return the full classpath */ protected String getWorkerClassPath(String stormJar, List<String> dependencyLocations) { List<String> workercp = new ArrayList<>(); workercp.addAll(frameworkClasspath()); workercp.add(stormJar); workercp.addAll(dependencyLocations); workercp.addAll(asStringList(_topoConf.get(Config.TOPOLOGY_CLASSPATH))); return CPJ.join(workercp); }