Update of /cvsroot/commonjava/commonjava-projects/commonjava-console/src/java/org/commonjava/console/option
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26752/src/java/org/commonjava/console/option
Modified Files:
OptionFormat.java
Log Message:
updated documentation in project.xml files, and added functionality to:
Console:
- provide convenient way to prompt the user for more information
Config:
- Provide snap-in container stacking, or scoping
- Provide a JBoss service implementation of a snap-in container
Probably other things, but I don't honestly remember everything...
Index: OptionFormat.java
===================================================================
RCS file: /cvsroot/commonjava/commonjava-projects/commonjava-console/src/java/org/commonjava/console/option/OptionFormat.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- OptionFormat.java 18 Sep 2003 00:46:59 -0000 1.1
+++ OptionFormat.java 18 Feb 2004 06:12:32 -0000 1.2
@@ -17,6 +17,7 @@
package org.commonjava.console.option;
+import java.io.File;
import java.text.SimpleDateFormat;
/** typesafe enumeration class that contains several implementations of itself,
@@ -252,6 +253,23 @@
}
};
+ /** Validation format for command line parameters representing a directory. The
+ * isValid() method returns true if the dir doesn't yet exist, or if it does,
+ * if the dir is actually a directory, not a regular file.
+ *
+ * The return type for the getValue() method is actually java.io.File.
+ */
+ public static final OptionFormat DIR_FORMAT = new OptionFormat("Directory Format"){
+ public boolean isValid(String value){
+ File f = new File(value);
+ return !f.exists() || f.isDirectory();
+ }
+
+ public Object getValue(String value){
+ return new java.io.File(value);
+ }
+ };
+
/** Validation format for command line parameters representing a java package. The
* isValid() method checks the input against a regular expression for validity.
*/
@@ -299,6 +317,7 @@
DATE_FORMAT_MM_dd_yyyy,
DATE_FORMAT_yyyy_MM_dd_hh_mm_ss,
FILE_FORMAT,
+ DIR_FORMAT,
JAVA_PACKAGE_FORMAT,
JAVA_CLASS_FORMAT
};
|