projects
/
jSite.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bug when JAR file is stored in path with non-US-ASCII characters
[jSite.git]
/
src
/
main
/
java
/
de
/
todesbaum
/
jsite
/
main
/
CLI.java
diff --git
a/src/main/java/de/todesbaum/jsite/main/CLI.java
b/src/main/java/de/todesbaum/jsite/main/CLI.java
index
0cf9cc4
..
df08244
100644
(file)
--- a/
src/main/java/de/todesbaum/jsite/main/CLI.java
+++ b/
src/main/java/de/todesbaum/jsite/main/CLI.java
@@
-1,5
+1,5
@@
/*
/*
- * jSite - CLI.java - Copyright © 2006–201
2
David Roden
+ * jSite - CLI.java - Copyright © 2006–201
4
David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-19,6
+19,7
@@
package de.todesbaum.jsite.main;
import java.io.PrintWriter;
package de.todesbaum.jsite.main;
import java.io.PrintWriter;
+import java.util.List;
import net.pterodactylus.util.io.StreamCopier.ProgressListener;
import de.todesbaum.jsite.application.Freenet7Interface;
import net.pterodactylus.util.io.StreamCopier.ProgressListener;
import de.todesbaum.jsite.application.Freenet7Interface;
@@
-26,6
+27,7
@@
import de.todesbaum.jsite.application.InsertListener;
import de.todesbaum.jsite.application.Node;
import de.todesbaum.jsite.application.Project;
import de.todesbaum.jsite.application.ProjectInserter;
import de.todesbaum.jsite.application.Node;
import de.todesbaum.jsite.application.Project;
import de.todesbaum.jsite.application.ProjectInserter;
+import de.todesbaum.jsite.main.JarFileLocator.DefaultJarFileLocator;
/**
* Command-line interface for jSite.
/**
* Command-line interface for jSite.
@@
-50,7
+52,7
@@
public class CLI implements InsertListener {
private Node[] nodes;
/** The projects. */
private Node[] nodes;
/** The projects. */
- private
Project[]
projects;
+ private
List<Project>
projects;
/** Whether the insert has finished. */
private boolean finished = false;
/** Whether the insert has finished. */
private boolean finished = false;
@@
-88,7
+90,7
@@
public class CLI implements InsertListener {
}
}
}
}
- ConfigurationLocator configurationLocator = new ConfigurationLocator();
+ ConfigurationLocator configurationLocator = new ConfigurationLocator(
new DefaultJarFileLocator(getClass().getClassLoader())
);
if (configFile != null) {
configurationLocator.setCustomLocation(configFile);
}
if (configFile != null) {
configurationLocator.setCustomLocation(configFile);
}
@@
-103,6
+105,7
@@
public class CLI implements InsertListener {
freenetInterface.setNode(node);
projectInserter.setFreenetInterface(freenetInterface);
freenetInterface.setNode(node);
projectInserter.setFreenetInterface(freenetInterface);
+ projectInserter.setPriority(configuration.getPriority());
Project currentProject = null;
for (String argument : args) {
Project currentProject = null;
for (String argument : args) {
@@
-220,6
+223,7
@@
public class CLI implements InsertListener {
projectInserter.setProject(currentProject);
projectInserter.start(new ProgressListener() {
projectInserter.setProject(currentProject);
projectInserter.start(new ProgressListener() {
+ @Override
public void onProgress(long copied, long length) {
System.out.print("Uploaded: " + copied + " / " + length + " bytes...\r");
}
public void onProgress(long copied, long length) {
System.out.print("Uploaded: " + copied + " / " + length + " bytes...\r");
}
@@
-243,6
+247,7
@@
public class CLI implements InsertListener {
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertStarted(Project project) {
outputWriter.println("Starting Insert of project \"" + project.getName() + "\".");
}
public void projectInsertStarted(Project project) {
outputWriter.println("Starting Insert of project \"" + project.getName() + "\".");
}
@@
-250,6
+255,7
@@
public class CLI implements InsertListener {
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/
+ @Override
public void projectUploadFinished(Project project) {
outputWriter.println("Project \"" + project.getName() + "\" has been uploaded, starting insert...");
}
public void projectUploadFinished(Project project) {
outputWriter.println("Project \"" + project.getName() + "\" has been uploaded, starting insert...");
}
@@
-257,6
+263,7
@@
public class CLI implements InsertListener {
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/
+ @Override
public void projectURIGenerated(Project project, String uri) {
outputWriter.println("URI: " + uri);
}
public void projectURIGenerated(Project project, String uri) {
outputWriter.println("URI: " + uri);
}
@@
-264,13
+271,18
@@
public class CLI implements InsertListener {
/**
* {@inheritDoc}
*/
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized) {
public void projectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized) {
+ if (total == 0) {
+ return;
+ }
outputWriter.println("Progress: " + succeeded + " done, " + failed + " failed, " + fatal + " fatal, " + total + " total" + (finalized ? " (finalized)" : "") + ", " + ((succeeded + failed + fatal) * 100 / total) + "%");
}
/**
* {@inheritDoc}
*/
outputWriter.println("Progress: " + succeeded + " done, " + failed + " failed, " + fatal + " fatal, " + total + " total" + (finalized ? " (finalized)" : "") + ", " + ((succeeded + failed + fatal) * 100 / total) + "%");
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertFinished(Project project, boolean success, Throwable cause) {
outputWriter.println("Request URI: " + project.getFinalRequestURI(0));
finished = true;
public void projectInsertFinished(Project project, boolean success, Throwable cause) {
outputWriter.println("Request URI: " + project.getFinalRequestURI(0));
finished = true;