Update of /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/tool
In directory sc8-pr-cvs1:/tmp/cvs-serv13800/src/java/core/org/krysalis/ruper/tool
Modified Files:
Tool.java RepositoryTool.java
Added Files:
ResourceTool.java FileTool.java
Log Message:
Tools and APIs (still not happy w/ this stuff)
--- NEW FILE: ResourceTool.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.ruper.tool;
import org.krysalis.ruper.ResourceUpdater;
import org.krysalis.ruper.query.ResourceRequest;
import org.krysalis.ruper.query.ResourceResult;
import org.krysalis.ruper.resource.ResourceSpecifier;
import org.krysalis.version.util.cli.CommandLine;
import org.krysalis.version.util.cli.Option;
import org.krysalis.version.util.debug.DebugUtils;
/**
*/
public class ResourceTool extends Tool {
private static Option l_resourceOption = null;
static {
l_resourceOption = new Option("r", "resource", false, "resoruce");
}
protected void init() {
getOptions().addOption(l_resourceOption);
}
public void printHelp() {
//:TODO:
}
public void execute(CommandLine cmdline) throws Exception {
String resource = cmdline.getOptionValue(l_resourceOption);
ResourceUpdater ru = new ResourceUpdater();
ResourceSpecifier specifier = new ResourceSpecifier(resource);
ResourceRequest request = new ResourceRequest(specifier);
ResourceResult result = ru.query(request);
DebugUtils.dump(result);
}
public static void main(String[] args) {
(new ResourceTool()).run(args);
}
}
--- NEW FILE: FileTool.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.ruper.tool;
import org.krysalis.ruper.api.tool.FileUpdater;
import org.krysalis.ruper.query.ResourceResult;
import org.krysalis.version.util.cli.CommandLine;
import org.krysalis.version.util.cli.Option;
import org.krysalis.version.util.debug.DebugUtils;
/**
*/
public class FileTool extends Tool {
private static Option l_fileOption = null;
static {
l_fileOption = new Option("f", "file", false, "resoruce");
}
protected void init() {
getOptions().addOption(l_fileOption);
}
public void printHelp() {
//:TODO:
}
public void execute(CommandLine cmdline) throws Exception {
String resource = cmdline.getOptionValue(l_fileOption);
FileUpdater fu = new FileUpdater();
ResourceResult result = fu.determineFileUpdates(resource);
DebugUtils.dump(result);
}
public static void main(String[] args) {
(new ResourceTool()).run(args);
}
}
Index: Tool.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/tool/Tool.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Tool.java 29 Aug 2003 22:17:37 -0000 1.1
--- Tool.java 7 Sep 2003 23:30:00 -0000 1.2
***************
*** 33,36 ****
--- 33,37 ----
}
+ protected abstract void init();
protected abstract void printHelp();
protected abstract void execute(CommandLine cmdline) throws Exception;
***************
*** 55,58 ****
--- 56,61 ----
public void run(String args[]) {
+ init();
+
CommandLine cmdline = parseCommandLine(args);
Index: RepositoryTool.java
===================================================================
RCS file: /cvsroot/metamorphosis/ruper2/src/java/core/org/krysalis/ruper/tool/RepositoryTool.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** RepositoryTool.java 5 Sep 2003 05:51:47 -0000 1.6
--- RepositoryTool.java 7 Sep 2003 23:30:00 -0000 1.7
***************
*** 14,17 ****
--- 14,18 ----
import org.krysalis.ruper.util.select.AllSelector;
import org.krysalis.version.util.cli.CommandLine;
+ import org.krysalis.version.util.cli.Option;
import org.krysalis.version.util.debug.DebugUtils;
***************
*** 20,23 ****
--- 21,28 ----
public class RepositoryTool extends Tool {
+ protected void init()
+ {
+ }
+
public void printHelp() {
//:TODO:
***************
*** 26,30 ****
public void execute(CommandLine cmdline) throws Exception {
! //:TODO: Get from Manager/Factory, testing/plying hack...
RepositoryWrapper repo =
new RepositoryWrapper(
--- 31,35 ----
public void execute(CommandLine cmdline) throws Exception {
! //:TODO: Get from Manager/Factory, testing/playing hack...
RepositoryWrapper repo =
new RepositoryWrapper(
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
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.