use of org.apache.storm.hack.relocation.Relocator in project storm by apache.
the class DefaultShader method addJavaSource.
private void addJavaSource(Set<String> resources, JarOutputStream jos, String name, InputStream is, List<Relocator> relocators) throws IOException {
jos.putNextEntry(new JarEntry(name));
String sourceContent = IOUtil.toString(new InputStreamReader(is, "UTF-8"));
for (Relocator relocator : relocators) {
sourceContent = relocator.applyToSourceContent(sourceContent);
}
OutputStreamWriter writer = new OutputStreamWriter(jos, "UTF-8");
writer.append(sourceContent);
writer.flush();
resources.add(name);
}
use of org.apache.storm.hack.relocation.Relocator in project storm by apache.
the class StormShadeRequest method makeRequest.
public static ShadeRequest makeRequest() {
ShadeRequest request = new ShadeRequest();
request.setRelocators(Arrays.asList((Relocator) new SimpleRelocator("backtype.storm", "org.apache.storm"), (Relocator) new SimpleRelocator("storm.trident", "org.apache.storm.trident"), (Relocator) new SimpleRelocator("org.apache.thrift7", "org.apache.storm.thrift")));
request.setResourceTransformers(Arrays.asList((ResourceTransformer) new ClojureTransformer()));
return request;
}
use of org.apache.storm.hack.relocation.Relocator in project storm by apache.
the class ClojureTransformer method processResource.
@Override
public void processResource(String s, InputStream inputStream, List<Relocator> relocators) throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
int b;
while ((b = inputStream.read()) != -1) {
out.write(b);
}
String data = out.toString();
for (Relocator rel : relocators) {
data = rel.applyToSourceContent(data);
}
this.entries.put(s, data);
}
Aggregations