Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper2/tool
In directory sc8-pr-cvs1:/tmp/cvs-serv15892/src/java/core/org/krysalis/ruper2/tool
Added Files:
GumpDownloaderTool.java
Log Message:
1) Added the GumpTool [need to make it generic some time]
2) Forced VFSProvider to load VFS classes during construction, so we know early if they are missing & try soemthing else.
3) Started a VRLProtocol selector, so we can ignore links we cannot download.
--- NEW FILE: GumpDownloaderTool.java ---
/**
* Copyright (C) The Apache Software Foundation. All rights reserved. *
* ------------------------------------------------------------------------- *
* This software is published under the terms of the Apache Software License *
* version 1.1, a copy of which has been included with this distribution in *
* the LICENSE file. *
*/
package org.krysalis.ruper2.tool;
import org.krysalis.ruper2.ResourceUpdater;
import org.krysalis.ruper2.config.RuperConfig;
import org.krysalis.ruper2.repository.DefaultRepository;
import org.krysalis.ruper2.repository.IRepository;
import org.krysalis.ruper2.repository.RepositorySet;
import org.krysalis.ruper2.resource.ResourceGroup;
import org.krysalis.version.util.cli.CommandLine;
import org.krysalis.version.util.cli.Option;
/**
*/
public class GumpDownloaderTool extends Tool {
private static Option l_targetOption = null;
private static Option l_groupOption = null;
private static Option l_configOption = null;
static {
l_configOption =
new Option("c", "config", true, "The configuration file");
l_groupOption = new Option("g", "group", true, "The group to go get");
l_targetOption =
new Option(
"t",
"target",
true,
"The target directory to put it into");
}
protected String getTitle() {
return "Ruper Resource Tool";
}
protected void init() {
getOptions().addOption(l_configOption);
getOptions().addOption(l_groupOption);
getOptions().addOption(l_targetOption);
}
private IRepository getTargetRepository(String targetDir) {
return new DefaultRepository("target", targetDir);
}
public void execute(CommandLine cmdline) throws Exception {
String groupName = cmdline.getMandatoryOptionValue(l_groupOption);
String targetDir = cmdline.getOptionValue(l_targetOption);
String configName = cmdline.getOptionValue(l_configOption);
ResourceUpdater ruper = new ResourceUpdater();
// Assigned the target (to copy into)
ruper.setDefaultTargetRepository(getTargetRepository(targetDir));
if (null != configName)
RuperConfig.configure(configName);
ruper.setDefaultRepositorySet(
RepositorySet.getRepositorySet("gump", false));
ResourceGroup group = new ResourceGroup(groupName);
// Update...
ruper.updateResourceGroup(group);
// Cleanup (to remove duplicates)
ruper.clean(group);
}
public static void main(String[] args) {
(new GumpDownloaderTool()).run(args);
}
}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.