NIFIDEV-145: Bug fixes and pulled bootstrap into the assembly pom

This commit is contained in:
Mark Payne 2014-12-09 14:37:31 -05:00
parent eed4a9bb81
commit e544191f1d
2 changed files with 17 additions and 10 deletions

View File

@ -119,6 +119,11 @@
<artifactId>nifi-runtime</artifactId> <artifactId>nifi-runtime</artifactId>
<version>${framework.version}</version> <version>${framework.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-bootstrap</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>org.apache.nifi</groupId> <groupId>org.apache.nifi</groupId>
<artifactId>nifi-resources</artifactId> <artifactId>nifi-resources</artifactId>

View File

@ -30,7 +30,6 @@ import java.net.InetSocketAddress;
import java.net.Socket; import java.net.Socket;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -250,7 +249,13 @@ public class RunNiFi {
builder.directory(new File(specifiedWorkingDir)); builder.directory(new File(specifiedWorkingDir));
} }
final File workingDir = builder.directory(); final File bootstrapConfigAbsoluteFile = bootstrapConfigFile.getAbsoluteFile();
final File binDir = bootstrapConfigAbsoluteFile.getParentFile();
final File workingDir = binDir.getParentFile();
if ( specifiedWorkingDir == null ) {
builder.directory(workingDir);
}
final String libFilename = replaceNull(props.get("lib.dir"), "./lib").trim(); final String libFilename = replaceNull(props.get("lib.dir"), "./lib").trim();
File libDir = getFile(libFilename, workingDir); File libDir = getFile(libFilename, workingDir);
@ -295,13 +300,10 @@ public class RunNiFi {
throw new RuntimeException("Could not find conf directory at " + confDir.getAbsolutePath()); throw new RuntimeException("Could not find conf directory at " + confDir.getAbsolutePath());
} }
final Path workingDirPath = workingDir.toPath();
final List<String> cpFiles = new ArrayList<>(confFiles.length + libFiles.length); final List<String> cpFiles = new ArrayList<>(confFiles.length + libFiles.length);
cpFiles.add(confDir.getAbsolutePath()); cpFiles.add(confDir.getAbsolutePath());
for ( final File file : libFiles ) { for ( final File file : libFiles ) {
final Path path = workingDirPath.relativize(file.toPath()); cpFiles.add(file.getAbsolutePath());
final String cpPath = path.toString();
cpFiles.add(cpPath);
} }
final StringBuilder classPathBuilder = new StringBuilder(); final StringBuilder classPathBuilder = new StringBuilder();
@ -380,12 +382,12 @@ public class RunNiFi {
} }
private File getFile(final String filename, final File workingDir) { private File getFile(final String filename, final File workingDir) {
File libDir = new File(filename); File file = new File(filename);
if ( !libDir.isAbsolute() ) { if ( !file.isAbsolute() ) {
libDir = new File(workingDir, filename); file = new File(workingDir, filename);
} }
return libDir; return file;
} }
private String replaceNull(final String value, final String replacement) { private String replaceNull(final String value, final String replacement) {