/*
- * jSite -
- * Copyright (C) 2006 David Roden
+ * jSite - CLI.java - Copyright © 2006–2012 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
}
}
- Configuration configuration = new Configuration(configFile);
- if (!configuration.createLockFile()) {
- outputWriter.println("Lock file found!");
- return;
+ ConfigurationLocator configurationLocator = new ConfigurationLocator();
+ if (configFile != null) {
+ configurationLocator.setCustomLocation(configFile);
}
+ Configuration configuration = new Configuration(configurationLocator, configurationLocator.findPreferredLocation());
projectInserter.addInsertListener(this);
projects = configuration.getProjects();
projectInserter.setProject(currentProject);
projectInserter.start(new ProgressListener() {
+ @Override
public void onProgress(long copied, long length) {
System.out.print("Uploaded: " + copied + " / " + length + " bytes...\r");
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertStarted(Project project) {
outputWriter.println("Starting Insert of project \"" + project.getName() + "\".");
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectUploadFinished(Project project) {
outputWriter.println("Project \"" + project.getName() + "\" has been uploaded, starting insert...");
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectURIGenerated(Project project, String uri) {
outputWriter.println("URI: " + uri);
}
/**
* {@inheritDoc}
*/
+ @Override
public void projectInsertProgress(Project project, int succeeded, int failed, int fatal, int total, boolean finalized) {
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;