You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ke...@apache.org on 2010/07/14 21:32:44 UTC
svn commit: r964147 [2/3] - in /incubator/oodt/trunk/commons: ./
src/main/java/gov/nasa/jpl/oodt/commons/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/oodt/
src/main/java/org/apache/oodt/commons/ src/main/java/org/apache/oodt/c...
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java Wed Jul 14 19:32:42 2010
@@ -1,232 +1,232 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package gov.nasa.jpl.oodt.cas.commons.date;
-
-//JDK imports
-import java.text.DecimalFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.SimpleTimeZone;
-import java.util.TimeZone;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- */
-public class DateUtils {
-
- public static enum FormatType { UTC_FORMAT, LOCAL_FORMAT, TAI_FORMAT };
-
- public static Calendar tai93epoch = new GregorianCalendar(1993, GregorianCalendar.JANUARY, 1);
-
- public static Calendar julianEpoch = new GregorianCalendar(1970, GregorianCalendar.JANUARY, 1);
-
- private static SimpleDateFormat utcFormat = new SimpleDateFormat(
- "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- private static SimpleDateFormat taiFormat = new SimpleDateFormat(
- "yyyy-MM-dd'T'HH:mm:ss.SSS");
- private static SimpleDateFormat localFormat = new SimpleDateFormat(
- "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
-
- static {
- utcFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- taiFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- }
-
- static enum IndexType {
- DATE(0),
- LEAP_SECS(1);
-
- public int index;
-
- IndexType(int index) {
- this.index = index;
- }
- }
-
- //Info taken from ftp://oceans.gsfc.nasa.gov/COMMON/leapsec.dat
- static long[][] dateAndLeapSecs = {
- { 0 , 10 },
- { new GregorianCalendar(1972, GregorianCalendar.JULY, 1).getTimeInMillis() , 11 },
- { new GregorianCalendar(1973, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 12 },
- { new GregorianCalendar(1974, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 13 },
- { new GregorianCalendar(1975, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 14 },
- { new GregorianCalendar(1976, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 15 },
- { new GregorianCalendar(1977, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 16 },
- { new GregorianCalendar(1978, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 17 },
- { new GregorianCalendar(1979, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 18 },
- { new GregorianCalendar(1980, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 19 },
- { new GregorianCalendar(1981, GregorianCalendar.JULY, 1).getTimeInMillis() , 20 },
- { new GregorianCalendar(1982, GregorianCalendar.JULY, 1).getTimeInMillis() , 21 },
- { new GregorianCalendar(1983, GregorianCalendar.JULY, 1).getTimeInMillis() , 22 },
- { new GregorianCalendar(1985, GregorianCalendar.JULY, 1).getTimeInMillis() , 23 },
- { new GregorianCalendar(1988, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 24 },
- { new GregorianCalendar(1990, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 25 },
- { new GregorianCalendar(1991, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 26 },
- { new GregorianCalendar(1992, GregorianCalendar.JULY, 1).getTimeInMillis() , 27 },
- { new GregorianCalendar(1993, GregorianCalendar.JULY, 1).getTimeInMillis() , 28 },
- { new GregorianCalendar(1994, GregorianCalendar.JULY, 1).getTimeInMillis() , 29 },
- { new GregorianCalendar(1996, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 30 },
- { new GregorianCalendar(1997, GregorianCalendar.JULY, 1).getTimeInMillis() , 31 },
- { new GregorianCalendar(1999, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 32 },
- { new GregorianCalendar(2006, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 33 },
- { new GregorianCalendar(2009, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 34 },
- };
-
- private DateUtils() {}
-
- public static int getLeapSecsForDate(Calendar utcCal) throws Exception {
- long timeInMillis = utcCal.getTimeInMillis();
- for (int i = dateAndLeapSecs.length - 1; i >= 0; i--) {
- if (dateAndLeapSecs[i][IndexType.DATE.index] < timeInMillis)
- return (int) dateAndLeapSecs[i][IndexType.LEAP_SECS.index];
- }
- throw new Exception("No Leap Second found for given date!");
- }
-
- public static synchronized Calendar toTai(Calendar cal) throws Exception {
- Calendar taiCal = Calendar.getInstance(createTaiTimeZone(getLeapSecsForDate(cal)));
- taiCal.setTimeInMillis(cal.getTimeInMillis() + getLeapSecsForDate(cal) * 1000);
- return taiCal;
- }
-
- private static synchronized Calendar taiToUtc(Calendar taiCal) throws Exception {
- Calendar calUtc = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
- calUtc.setTimeInMillis(taiCal.getTimeInMillis() - taiCal.getTimeZone().getRawOffset());
- return calUtc;
- }
-
- private static Calendar taiToLocal(Calendar taiCal) throws Exception {
- return toLocal(taiToUtc(taiCal));
- }
-
- public static synchronized Calendar toLocal(Calendar cal) throws Exception {
- if (cal.getTimeZone().getID().equals("TAI")) {
- return taiToLocal(cal);
- } else {
- Calendar calLocal = Calendar.getInstance();
- calLocal.setTimeInMillis(cal.getTimeInMillis());
- return calLocal;
- }
- }
-
- public static synchronized Calendar toUtc(Calendar cal) throws Exception {
- if (cal.getTimeZone().getID().equals("TAI")) {
- return taiToUtc(cal);
- } else {
- Calendar calUtc = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
- calUtc.setTimeInMillis(cal.getTimeInMillis());
- return calUtc;
- }
- }
-
- public static Calendar getCurrentUtcTime() throws Exception {
- return toUtc(getCurrentLocalTime());
- }
-
- public static Calendar getCurrentLocalTime() throws Exception {
- return Calendar.getInstance();
- }
-
- public static Calendar getCurrentTaiTime() throws Exception {
- return toTai(getCurrentUtcTime());
- }
-
- public static String toCustomLocalFormat(Calendar cal, String format) {
- return new SimpleDateFormat(format).format(cal.getTime());
- }
-
- public static String toString(Calendar cal) {
- String timeZoneId = cal.getTimeZone().getID();
- if (timeZoneId.equals("UTC")) {
- return utcFormat.format(cal.getTime());
- }else if (timeZoneId.equals("TAI")) {
- return taiFormat.format(cal.getTime()) + "-0000"
- + (cal.getTimeZone().getRawOffset() / 1000);
- }else {
- return localFormat.format(cal.getTime());
- }
- }
-
- public static synchronized Calendar toLocalCustomFormatCalendar(String calString, String format) throws ParseException {
- Calendar localCal = Calendar.getInstance();
- localCal.setTime(new SimpleDateFormat(format).parse(calString));
- return localCal;
- }
-
- public static synchronized Calendar toCalendar(String calString, FormatType formatType)
- throws ParseException {
- Calendar cal = Calendar.getInstance();
- switch (formatType) {
- case LOCAL_FORMAT:
- cal.setTimeInMillis(localFormat.parse(calString).getTime());
- break;
- case TAI_FORMAT:
- cal.setTimeZone(createTaiTimeZone(Integer.parseInt(calString
- .substring(calString.length() - 2))));
- calString = calString.substring(0, calString.length() - 5);
- cal.setTimeInMillis(taiFormat.parse(calString).getTime());
- break;
- case UTC_FORMAT:
- cal.setTimeZone(TimeZone.getTimeZone("UTC"));
- cal.setTimeInMillis(utcFormat.parse(calString).getTime());
- break;
- default:
- cal.setTimeInMillis(localFormat.parse(calString).getTime());
- }
- return cal;
- }
-
- public static double getTimeInSecs(Calendar cal, Calendar epoch) throws Exception {
- return getTimeInMillis(cal, epoch) / 1000.0;
- }
-
- public static String toString(double seconds) {
- return new DecimalFormat("#.000").format(seconds);
- }
-
- public static long getTimeInMillis(Calendar cal, Calendar epoch) throws Exception {
- long epochDiffInMilli = epoch.getTimeInMillis() - julianEpoch.getTimeInMillis() ;
- if (cal.getTimeZone().getID().equals("TAI"))
- epochDiffInMilli += getLeapSecsForDate(epoch) * 1000;
- long milliseconds = cal.getTimeInMillis();
- return milliseconds - epochDiffInMilli;
- }
-
- private static TimeZone createTaiTimeZone(int leapSecs) {
- return new SimpleTimeZone(leapSecs * 1000, "TAI");
- }
-
- public static void main(String[] args) throws Exception {
- Calendar curTime = getCurrentLocalTime();
- System.out.println("Test Time: " + toString(toCalendar(toString(toTai(toCalendar("2008-01-20T16:29:55.000Z",
- FormatType.UTC_FORMAT))), FormatType.TAI_FORMAT)));
- System.out.println("Current Local Time: " + toString(curTime) + " " + curTime.getTimeInMillis());
- System.out.println("Current UTC Time: " + toString((curTime = toCalendar("2008-01-20T16:29:55.000Z",
- FormatType.UTC_FORMAT))) + " " + toString(getTimeInSecs(curTime, tai93epoch)));
- System.out.println("Current TAI Time: " + toString((curTime = toTai(toCalendar("2008-01-20T16:29:55.000Z",
- FormatType.UTC_FORMAT)))) + " " + toString(getTimeInSecs(curTime, tai93epoch)));
- System.out.println("Current UTC Time: " + toString(taiToUtc(curTime)));
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.commons.data;
+
+//JDK imports
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.SimpleTimeZone;
+import java.util.TimeZone;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ */
+public class DateUtils {
+
+ public static enum FormatType { UTC_FORMAT, LOCAL_FORMAT, TAI_FORMAT };
+
+ public static Calendar tai93epoch = new GregorianCalendar(1993, GregorianCalendar.JANUARY, 1);
+
+ public static Calendar julianEpoch = new GregorianCalendar(1970, GregorianCalendar.JANUARY, 1);
+
+ private static SimpleDateFormat utcFormat = new SimpleDateFormat(
+ "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ private static SimpleDateFormat taiFormat = new SimpleDateFormat(
+ "yyyy-MM-dd'T'HH:mm:ss.SSS");
+ private static SimpleDateFormat localFormat = new SimpleDateFormat(
+ "yyyy-MM-dd'T'HH:mm:ss.SSSZ");
+
+ static {
+ utcFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ taiFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ }
+
+ static enum IndexType {
+ DATE(0),
+ LEAP_SECS(1);
+
+ public int index;
+
+ IndexType(int index) {
+ this.index = index;
+ }
+ }
+
+ //Info taken from ftp://oceans.gsfc.nasa.gov/COMMON/leapsec.dat
+ static long[][] dateAndLeapSecs = {
+ { 0 , 10 },
+ { new GregorianCalendar(1972, GregorianCalendar.JULY, 1).getTimeInMillis() , 11 },
+ { new GregorianCalendar(1973, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 12 },
+ { new GregorianCalendar(1974, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 13 },
+ { new GregorianCalendar(1975, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 14 },
+ { new GregorianCalendar(1976, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 15 },
+ { new GregorianCalendar(1977, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 16 },
+ { new GregorianCalendar(1978, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 17 },
+ { new GregorianCalendar(1979, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 18 },
+ { new GregorianCalendar(1980, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 19 },
+ { new GregorianCalendar(1981, GregorianCalendar.JULY, 1).getTimeInMillis() , 20 },
+ { new GregorianCalendar(1982, GregorianCalendar.JULY, 1).getTimeInMillis() , 21 },
+ { new GregorianCalendar(1983, GregorianCalendar.JULY, 1).getTimeInMillis() , 22 },
+ { new GregorianCalendar(1985, GregorianCalendar.JULY, 1).getTimeInMillis() , 23 },
+ { new GregorianCalendar(1988, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 24 },
+ { new GregorianCalendar(1990, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 25 },
+ { new GregorianCalendar(1991, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 26 },
+ { new GregorianCalendar(1992, GregorianCalendar.JULY, 1).getTimeInMillis() , 27 },
+ { new GregorianCalendar(1993, GregorianCalendar.JULY, 1).getTimeInMillis() , 28 },
+ { new GregorianCalendar(1994, GregorianCalendar.JULY, 1).getTimeInMillis() , 29 },
+ { new GregorianCalendar(1996, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 30 },
+ { new GregorianCalendar(1997, GregorianCalendar.JULY, 1).getTimeInMillis() , 31 },
+ { new GregorianCalendar(1999, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 32 },
+ { new GregorianCalendar(2006, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 33 },
+ { new GregorianCalendar(2009, GregorianCalendar.JANUARY, 1).getTimeInMillis() , 34 },
+ };
+
+ private DateUtils() {}
+
+ public static int getLeapSecsForDate(Calendar utcCal) throws Exception {
+ long timeInMillis = utcCal.getTimeInMillis();
+ for (int i = dateAndLeapSecs.length - 1; i >= 0; i--) {
+ if (dateAndLeapSecs[i][IndexType.DATE.index] < timeInMillis)
+ return (int) dateAndLeapSecs[i][IndexType.LEAP_SECS.index];
+ }
+ throw new Exception("No Leap Second found for given date!");
+ }
+
+ public static synchronized Calendar toTai(Calendar cal) throws Exception {
+ Calendar taiCal = Calendar.getInstance(createTaiTimeZone(getLeapSecsForDate(cal)));
+ taiCal.setTimeInMillis(cal.getTimeInMillis() + getLeapSecsForDate(cal) * 1000);
+ return taiCal;
+ }
+
+ private static synchronized Calendar taiToUtc(Calendar taiCal) throws Exception {
+ Calendar calUtc = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ calUtc.setTimeInMillis(taiCal.getTimeInMillis() - taiCal.getTimeZone().getRawOffset());
+ return calUtc;
+ }
+
+ private static Calendar taiToLocal(Calendar taiCal) throws Exception {
+ return toLocal(taiToUtc(taiCal));
+ }
+
+ public static synchronized Calendar toLocal(Calendar cal) throws Exception {
+ if (cal.getTimeZone().getID().equals("TAI")) {
+ return taiToLocal(cal);
+ } else {
+ Calendar calLocal = Calendar.getInstance();
+ calLocal.setTimeInMillis(cal.getTimeInMillis());
+ return calLocal;
+ }
+ }
+
+ public static synchronized Calendar toUtc(Calendar cal) throws Exception {
+ if (cal.getTimeZone().getID().equals("TAI")) {
+ return taiToUtc(cal);
+ } else {
+ Calendar calUtc = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
+ calUtc.setTimeInMillis(cal.getTimeInMillis());
+ return calUtc;
+ }
+ }
+
+ public static Calendar getCurrentUtcTime() throws Exception {
+ return toUtc(getCurrentLocalTime());
+ }
+
+ public static Calendar getCurrentLocalTime() throws Exception {
+ return Calendar.getInstance();
+ }
+
+ public static Calendar getCurrentTaiTime() throws Exception {
+ return toTai(getCurrentUtcTime());
+ }
+
+ public static String toCustomLocalFormat(Calendar cal, String format) {
+ return new SimpleDateFormat(format).format(cal.getTime());
+ }
+
+ public static String toString(Calendar cal) {
+ String timeZoneId = cal.getTimeZone().getID();
+ if (timeZoneId.equals("UTC")) {
+ return utcFormat.format(cal.getTime());
+ }else if (timeZoneId.equals("TAI")) {
+ return taiFormat.format(cal.getTime()) + "-0000"
+ + (cal.getTimeZone().getRawOffset() / 1000);
+ }else {
+ return localFormat.format(cal.getTime());
+ }
+ }
+
+ public static synchronized Calendar toLocalCustomFormatCalendar(String calString, String format) throws ParseException {
+ Calendar localCal = Calendar.getInstance();
+ localCal.setTime(new SimpleDateFormat(format).parse(calString));
+ return localCal;
+ }
+
+ public static synchronized Calendar toCalendar(String calString, FormatType formatType)
+ throws ParseException {
+ Calendar cal = Calendar.getInstance();
+ switch (formatType) {
+ case LOCAL_FORMAT:
+ cal.setTimeInMillis(localFormat.parse(calString).getTime());
+ break;
+ case TAI_FORMAT:
+ cal.setTimeZone(createTaiTimeZone(Integer.parseInt(calString
+ .substring(calString.length() - 2))));
+ calString = calString.substring(0, calString.length() - 5);
+ cal.setTimeInMillis(taiFormat.parse(calString).getTime());
+ break;
+ case UTC_FORMAT:
+ cal.setTimeZone(TimeZone.getTimeZone("UTC"));
+ cal.setTimeInMillis(utcFormat.parse(calString).getTime());
+ break;
+ default:
+ cal.setTimeInMillis(localFormat.parse(calString).getTime());
+ }
+ return cal;
+ }
+
+ public static double getTimeInSecs(Calendar cal, Calendar epoch) throws Exception {
+ return getTimeInMillis(cal, epoch) / 1000.0;
+ }
+
+ public static String toString(double seconds) {
+ return new DecimalFormat("#.000").format(seconds);
+ }
+
+ public static long getTimeInMillis(Calendar cal, Calendar epoch) throws Exception {
+ long epochDiffInMilli = epoch.getTimeInMillis() - julianEpoch.getTimeInMillis() ;
+ if (cal.getTimeZone().getID().equals("TAI"))
+ epochDiffInMilli += getLeapSecsForDate(epoch) * 1000;
+ long milliseconds = cal.getTimeInMillis();
+ return milliseconds - epochDiffInMilli;
+ }
+
+ private static TimeZone createTaiTimeZone(int leapSecs) {
+ return new SimpleTimeZone(leapSecs * 1000, "TAI");
+ }
+
+ public static void main(String[] args) throws Exception {
+ Calendar curTime = getCurrentLocalTime();
+ System.out.println("Test Time: " + toString(toCalendar(toString(toTai(toCalendar("2008-01-20T16:29:55.000Z",
+ FormatType.UTC_FORMAT))), FormatType.TAI_FORMAT)));
+ System.out.println("Current Local Time: " + toString(curTime) + " " + curTime.getTimeInMillis());
+ System.out.println("Current UTC Time: " + toString((curTime = toCalendar("2008-01-20T16:29:55.000Z",
+ FormatType.UTC_FORMAT))) + " " + toString(getTimeInSecs(curTime, tai93epoch)));
+ System.out.println("Current TAI Time: " + toString((curTime = toTai(toCalendar("2008-01-20T16:29:55.000Z",
+ FormatType.UTC_FORMAT)))) + " " + toString(getTimeInSecs(curTime, tai93epoch)));
+ System.out.println("Current UTC Time: " + toString(taiToUtc(curTime)));
+ }
+
+}
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.exec;
+package org.apache.oodt.commons.exec;
//JDK imports
import java.io.BufferedReader;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.exec;
+package org.apache.oodt.commons.exec;
//JDK imports
import java.io.File;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/ExecUtils.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/ExecUtils.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/ExecUtils.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/ExecUtils.java Wed Jul 14 19:32:42 2010
@@ -16,10 +16,10 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.exec;
+package org.apache.oodt.commons.exec;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.io.LoggerOutputStream;
+import org.apache.oodt.commons.io.LoggerOutputStream;
//JDK imports
import java.io.File;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.exec;
+package org.apache.oodt.commons.exec;
/**
* @author mattmann
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java Wed Jul 14 19:32:42 2010
@@ -1,61 +1,61 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package gov.nasa.jpl.oodt.cas.commons.filter;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>A {@link TimeEvent} associated with a particular {@link Object}</p>.
- */
-public class ObjectTimeEvent<objType> extends TimeEvent {
-
- private objType timeObj;
-
- public ObjectTimeEvent(long startTime, long endTime, objType timeObj) {
- super(startTime, endTime);
- this.timeObj = timeObj;
- }
-
- public ObjectTimeEvent(long startTime, long endTime, double priority,
- objType timeObj) {
- super(startTime, endTime, priority);
- this.timeObj = timeObj;
- }
-
- public objType getTimeObject() {
- return this.timeObj;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof ObjectTimeEvent) {
- ObjectTimeEvent<?> ote = (ObjectTimeEvent<?>) obj;
- return super.equals(obj) && this.timeObj.equals(ote.timeObj);
- } else
- return false;
- }
-
- @Override
- public String toString() {
- return super.toString() + " - " + timeObj;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.commons.filter;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>A {@link TimeEvent} associated with a particular {@link Object}</p>.
+ */
+public class ObjectTimeEvent<objType> extends TimeEvent {
+
+ private objType timeObj;
+
+ public ObjectTimeEvent(long startTime, long endTime, objType timeObj) {
+ super(startTime, endTime);
+ this.timeObj = timeObj;
+ }
+
+ public ObjectTimeEvent(long startTime, long endTime, double priority,
+ objType timeObj) {
+ super(startTime, endTime, priority);
+ this.timeObj = timeObj;
+ }
+
+ public objType getTimeObject() {
+ return this.timeObj;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof ObjectTimeEvent) {
+ ObjectTimeEvent<?> ote = (ObjectTimeEvent<?>) obj;
+ return super.equals(obj) && this.timeObj.equals(ote.timeObj);
+ } else
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + " - " + timeObj;
+ }
+
+}
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java Wed Jul 14 19:32:42 2010
@@ -1,102 +1,102 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package gov.nasa.jpl.oodt.cas.commons.filter;
-
-//JDK imports
-import java.util.Arrays;
-import java.util.List;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * A basis for time-based queries results over a start/end datetime with
- * a duration
- * </p>.
- */
-public class TimeEvent implements Comparable<TimeEvent> {
-
- protected long startTime, endTime, dur;
-
- protected double priority;
-
- public TimeEvent(long startTime, long endTime) {
- this(startTime, endTime, 0);
- }
-
- public TimeEvent(long startTime, long endTime, double priority) {
- this.startTime = startTime;
- this.endTime = endTime;
- this.dur = this.endTime - this.startTime;
- this.priority = priority;
- }
-
- public void setPriority(double priority) {
- this.priority = priority;
- }
-
- public double getPriority() {
- return this.priority;
- }
-
- public long getStartTime() {
- return this.startTime;
- }
-
- public long getEndTime() {
- return this.endTime;
- }
-
- public long getDuration() {
- return this.dur;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof TimeEvent) {
- TimeEvent te = (TimeEvent) obj;
- return te.startTime == this.startTime && te.endTime == this.endTime;
- } else
- return false;
- }
-
- @Override
- public String toString() {
- return "[" + this.startTime + "," + this.endTime + "] - "
- + this.priority;
- }
-
- public static boolean happenAtSameTime(TimeEvent te1, TimeEvent te2) {
- return te1.getStartTime() == te2.getStartTime() && te1.getEndTime() == te2.getEndTime();
- }
-
- public int compareTo(TimeEvent te) {
- return new Long(this.startTime).compareTo(te.startTime);
- }
-
- public static List<? extends TimeEvent> getTimeOrderedEvents(List<? extends TimeEvent> events) {
- TimeEvent[] eventsArray = events
- .toArray(new TimeEvent[events.size()]);
- Arrays.sort(eventsArray);
- return Arrays.asList(eventsArray);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.commons.filter;
+
+//JDK imports
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * A basis for time-based queries results over a start/end datetime with
+ * a duration
+ * </p>.
+ */
+public class TimeEvent implements Comparable<TimeEvent> {
+
+ protected long startTime, endTime, dur;
+
+ protected double priority;
+
+ public TimeEvent(long startTime, long endTime) {
+ this(startTime, endTime, 0);
+ }
+
+ public TimeEvent(long startTime, long endTime, double priority) {
+ this.startTime = startTime;
+ this.endTime = endTime;
+ this.dur = this.endTime - this.startTime;
+ this.priority = priority;
+ }
+
+ public void setPriority(double priority) {
+ this.priority = priority;
+ }
+
+ public double getPriority() {
+ return this.priority;
+ }
+
+ public long getStartTime() {
+ return this.startTime;
+ }
+
+ public long getEndTime() {
+ return this.endTime;
+ }
+
+ public long getDuration() {
+ return this.dur;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof TimeEvent) {
+ TimeEvent te = (TimeEvent) obj;
+ return te.startTime == this.startTime && te.endTime == this.endTime;
+ } else
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return "[" + this.startTime + "," + this.endTime + "] - "
+ + this.priority;
+ }
+
+ public static boolean happenAtSameTime(TimeEvent te1, TimeEvent te2) {
+ return te1.getStartTime() == te2.getStartTime() && te1.getEndTime() == te2.getEndTime();
+ }
+
+ public int compareTo(TimeEvent te) {
+ return new Long(this.startTime).compareTo(te.startTime);
+ }
+
+ public static List<? extends TimeEvent> getTimeOrderedEvents(List<? extends TimeEvent> events) {
+ TimeEvent[] eventsArray = events
+ .toArray(new TimeEvent[events.size()]);
+ Arrays.sort(eventsArray);
+ return Arrays.asList(eventsArray);
+ }
+
+}
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java Wed Jul 14 19:32:42 2010
@@ -1,389 +1,389 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package gov.nasa.jpl.oodt.cas.commons.filter;
-
-//JDK imports
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
-*
-* @author bfoster
-* @version $Revision$
-*
-* <p>
-* Builds a time sorted hash where the top value has the earliest time. This hash
-* is a directional graph. It builds all possible paths from top node to leaf
-* nodes. At any time you can ask for the greatest weighted path in the hash -- that
-* is, the path from root node to a leaf node which fills the most time. Epsilon is
-* TimeEvent objects allowed time overlap (it is of the same unit of measurement that
-* is used in you TimeEvent objects added to this hash).
-* </p>.
-*/
-public class TimeEventWeightedHash {
-
- private TimeEventNode root;
-
- protected long epsilon;
-
- private MyLinkedHashSet<TimeEventNode> leafNodes;
-
- private TimeEventWeightedHash() {
- root = new TimeEventNode(new TimeEvent(-1, -1));
- leafNodes = new MyLinkedHashSet<TimeEventNode>();
- leafNodes.add(this.root);
- }
-
- public static TimeEventWeightedHash buildHash(List<? extends TimeEvent> events) {
- return buildHash(events, 0);
- }
-
- /**
- * Returns the Greatest Weighted Path of TimeEvents
- */
- public static TimeEventWeightedHash buildHash(List<? extends TimeEvent> events, long epsilon) {
- TimeEventWeightedHash hash = new TimeEventWeightedHash();
- hash.epsilon = epsilon;
- events = TimeEvent.getTimeOrderedEvents(events);
- for (TimeEvent event : events)
- hash.addEvent(event);
- return hash;
- }
-
- public List<? extends TimeEvent> getGreatestWeightedPathAsOrderedList() {
- WeightedNode wn = this.getGreatestWeightedPath();
- List<TimeEvent> gwpEvents = new LinkedList<TimeEvent>();
- while(wn != null) {
- gwpEvents.add(wn.getTimeEvent());
- wn = wn.getChild();
- }
-
- return gwpEvents;
- }
-
- private void addEvent(TimeEvent newEvent) {
- TimeEventNode newEventNode = new TimeEventNode(newEvent);
- MyLinkedHashSet<TimeEventNode> parentNodes = this.findParents(newEvent);
- MyLinkedHashSet<TimeEventNode> childrenNodes = this.findChildren(newEvent, parentNodes);
-
- if (childrenNodes.size() == 0)
- leafNodes.add(newEventNode);
-
- newEventNode.addParents(parentNodes);
- newEventNode.addChildren(childrenNodes);
-
- }
-
- private MyLinkedHashSet<TimeEventNode> findParents(TimeEvent newEvent) {
- MyLinkedHashSet<TimeEventNode> parentNodes = new MyLinkedHashSet<TimeEventNode>();
- MyLinkedHashSet<TimeEventNode> possibleParentNodes = new MyLinkedHashSet<TimeEventNode>();
- MyLinkedHashSet<TimeEventNode> possibleParentNodesAlreadyChecked = new MyLinkedHashSet<TimeEventNode>();
-
- //iterate through possible parent nodes add possible parent child as
- // possible parents if they do not conflict
- TimeEventNode curPPN = this.root;
- while (curPPN != null) {
- boolean ppnListChanged = false;
- for (TimeEventNode curChild : curPPN.getChildren()) {
- //if curChild does not conficts with te, then it is a possible parent
- if (happensBefore(curChild.getTimeEvent(), newEvent)
- && !possibleParentNodesAlreadyChecked.contains(curChild)) {
- possibleParentNodes.add(curChild);
- ppnListChanged = true;
- }
- }
- //if all children where not possible parents, then curPPN must be parent
- if (!ppnListChanged)
- parentNodes.add(curPPN);
-
- //get next curPPN
- possibleParentNodes.remove(curPPN);
- possibleParentNodesAlreadyChecked.add(curPPN);
- while((curPPN = possibleParentNodes.get(0)) != null
- && possibleParentNodesAlreadyChecked.contains(curPPN)) {
- possibleParentNodes.remove(curPPN);
- }
- }
-
- return parentNodes;
- }
-
- private MyLinkedHashSet<TimeEventNode> findChildren(TimeEvent newEvent, MyLinkedHashSet<TimeEventNode> parentNodes) {
- MyLinkedHashSet<TimeEventNode> childrenNodes = new MyLinkedHashSet<TimeEventNode>();
- MyLinkedHashSet<TimeEventNode> possibleChildrenNodes = new MyLinkedHashSet<TimeEventNode>();
- for (TimeEventNode parent : parentNodes) {
- possibleChildrenNodes.addAll(parent.getChildren());
- TimeEventNode curPCN = possibleChildrenNodes.get(0);
- while (curPCN != null) {
- if (happensBefore(newEvent, curPCN.getTimeEvent())) {
- childrenNodes.add(curPCN);
- }else {
- possibleChildrenNodes.addAll(curPCN.getChildren());
- }
- possibleChildrenNodes.remove(curPCN);
- curPCN = possibleChildrenNodes.get(0);
- }
- }
- return childrenNodes;
- }
-
- private boolean happensBefore(TimeEvent t1, TimeEvent t2) {
- long boundaryCheck = t2.getStartTime() - t1.getEndTime();
- return (boundaryCheck + epsilon) > 0;
- }
-
- private WeightedNode getGreatestWeightedPath() {
- TimeEventNode max = this.leafNodes.get(0);
- for (TimeEventNode ten : this.leafNodes) {
- if (ten.getPathWeight() > max.getPathWeight()
- || (ten.getPathWeight() == max.getPathWeight()
- && ten.getPathPriorityWeight() > max.getPathPriorityWeight()))
- max = ten;
- }
- WeightedNode root = new WeightedNode(max.getTimeEvent());
- TimeEventNode curTEN = max.greatestWieghtedParent;
- while (curTEN != null) {
- WeightedNode temp = new WeightedNode(curTEN.getTimeEvent());
- temp.setChild(root);
- root = temp;
- curTEN = curTEN.greatestWieghtedParent;
- }
- return root.getChild();
- }
-
- private class MyLinkedHashSet<E> extends HashSet<E> {
-
- private static final long serialVersionUID = -7319154087430025841L;
-
- private LinkedList<E> listSet;
-
- public MyLinkedHashSet() {
- this.listSet = new LinkedList<E>();
- }
-
- @Override
- public boolean add(E ten) {
- boolean wasAdded = false;
- if (wasAdded = super.add(ten))
- listSet.add(ten);
- return wasAdded;
- }
-
- @Override
- public boolean addAll(Collection<? extends E> collection) {
- boolean setChanged = false;
- for (E ten : collection) {
- if (this.add(ten))
- setChanged = true;
- }
- return setChanged;
- }
-
- @Override
- public boolean remove(Object ten) {
- if (super.remove(ten)) {
- this.listSet.remove(ten);
- return true;
- }else
- return false;
- }
-
- @Override
- public boolean removeAll(Collection<?> collection) {
- boolean setChanged = false;
- for (Object obj : collection) {
- if (this.remove(obj))
- setChanged = true;
- }
- return setChanged;
- }
-
- public E get(int index) {
- if (this.listSet.size() > index)
- return this.listSet.get(index);
- else
- return null;
- }
-
- public List<E> getList() {
- return this.listSet;
- }
-
- }
-
- private class TimeEventNode {
-
- private TimeEvent te;
-
- private MyLinkedHashSet<TimeEventNode> children;
-
- private MyLinkedHashSet<TimeEventNode> parents;
-
- private TimeEventNode greatestWieghtedParent;
-
- public TimeEventNode(TimeEvent te) {
- this.te = te;
- children = new MyLinkedHashSet<TimeEventNode>();
- parents = new MyLinkedHashSet<TimeEventNode>();
- }
-
- public long getPathWeight() {
- if (this.greatestWieghtedParent != null)
- return te.getDuration()
- + this.greatestWieghtedParent.getPathWeight();
- else
- return te.getDuration();
- }
-
- public double getPathPriorityWeight() {
- if (this.greatestWieghtedParent != null)
- return te.getPriority()
- + this.greatestWieghtedParent.getPathPriorityWeight();
- else
- return te.getPriority();
- }
-
- public TimeEvent getTimeEvent() {
- return this.te;
- }
-
- public void setTimeEvent(TimeEvent te) {
- this.te = te;
- }
-
- public void addChild(TimeEventNode child) {
- //remove parent to grandchild links
- for (TimeEventNode parent : this.parents) {
- parent.children.remove(child);
- child.parents.remove(parent);
- }
-
- //link to child
- this.children.add(child);
- child.parents.add(this);
- leafNodes.remove(this);
-
- //determine child's greatest weighted parent
- child.greatestWieghtedParent = this;
- for (TimeEventNode parent : child.parents) {
- long gwpPaW = child.greatestWieghtedParent.getPathWeight();
- long pPaW = parent.getPathWeight();
- double gwpPiW = child.greatestWieghtedParent.getPathPriorityWeight();
- double pPiW = parent.getPathPriorityWeight();
- if (pPaW > gwpPaW || (pPaW == gwpPaW && pPiW > gwpPiW))
- child.greatestWieghtedParent = parent;
- }
- }
-
- public void addParent(TimeEventNode parent) {
- parent.addChild(this);
- }
-
- public void addChildren(Collection<TimeEventNode> children) {
- for (TimeEventNode child : children)
- this.addChild(child);
- }
-
- public void addParents(Collection<TimeEventNode> parents) {
- for (TimeEventNode parent : parents)
- this.addParent(parent);
- }
-
- public MyLinkedHashSet<TimeEventNode> getChildren() {
- return this.children;
- }
-
- public MyLinkedHashSet<TimeEventNode> getParents() {
- return this.parents;
- }
-
- public boolean equals(Object obj) {
- if (obj instanceof TimeEventNode) {
- TimeEventNode ten = (TimeEventNode) obj;
- return this.te.equals(ten.te);
- } else
- return false;
- }
-
- public String toString() {
- return this.te.toString() + " -- " + this.getPathWeight();
- }
-
- }
-
- private class WeightedNode {
-
- private long pathWeight;
-
- private WeightedNode child;
-
- private TimeEvent te;
-
- private WeightedNode(TimeEvent te) {
- this.te = te;
- pathWeight = te.getDuration();
- }
-
- private void setChild(WeightedNode child) {
- this.child = child;
- if (child != null)
- this.pathWeight = this.te.getDuration() + child.getPathWeight();
- }
-
- public TimeEvent getTimeEvent() {
- return this.te;
- }
-
- public WeightedNode getChild() {
- return this.child;
- }
-
- public long getPathWeight() {
- return this.pathWeight;
- }
-
- public String toString() {
- return te.toString() + "\n"
- + (child != null ? child.toString() : "");
- }
-
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer("");
- LinkedList<TimeEventNode> printNodes = new LinkedList<TimeEventNode>();
- printNodes.add(this.root);
- sb.append(printNodes(printNodes, "-", 0));
- return sb.toString();
- }
-
- private StringBuffer printNodes(List<TimeEventNode> list,
- String spacer, long curPathWeight) {
- StringBuffer output = new StringBuffer("");
- for (TimeEventNode node : list) {
- output.append(spacer);
- output.append(node.te + " -- " + (curPathWeight + node.te.getDuration()) + "\n");
- output.append(printNodes(node.getChildren().getList(), " " + spacer, curPathWeight + node.te.getDuration()));
- }
- return output;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.commons.filter;
+
+//JDK imports
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+*
+* @author bfoster
+* @version $Revision$
+*
+* <p>
+* Builds a time sorted hash where the top value has the earliest time. This hash
+* is a directional graph. It builds all possible paths from top node to leaf
+* nodes. At any time you can ask for the greatest weighted path in the hash -- that
+* is, the path from root node to a leaf node which fills the most time. Epsilon is
+* TimeEvent objects allowed time overlap (it is of the same unit of measurement that
+* is used in you TimeEvent objects added to this hash).
+* </p>.
+*/
+public class TimeEventWeightedHash {
+
+ private TimeEventNode root;
+
+ protected long epsilon;
+
+ private MyLinkedHashSet<TimeEventNode> leafNodes;
+
+ private TimeEventWeightedHash() {
+ root = new TimeEventNode(new TimeEvent(-1, -1));
+ leafNodes = new MyLinkedHashSet<TimeEventNode>();
+ leafNodes.add(this.root);
+ }
+
+ public static TimeEventWeightedHash buildHash(List<? extends TimeEvent> events) {
+ return buildHash(events, 0);
+ }
+
+ /**
+ * Returns the Greatest Weighted Path of TimeEvents
+ */
+ public static TimeEventWeightedHash buildHash(List<? extends TimeEvent> events, long epsilon) {
+ TimeEventWeightedHash hash = new TimeEventWeightedHash();
+ hash.epsilon = epsilon;
+ events = TimeEvent.getTimeOrderedEvents(events);
+ for (TimeEvent event : events)
+ hash.addEvent(event);
+ return hash;
+ }
+
+ public List<? extends TimeEvent> getGreatestWeightedPathAsOrderedList() {
+ WeightedNode wn = this.getGreatestWeightedPath();
+ List<TimeEvent> gwpEvents = new LinkedList<TimeEvent>();
+ while(wn != null) {
+ gwpEvents.add(wn.getTimeEvent());
+ wn = wn.getChild();
+ }
+
+ return gwpEvents;
+ }
+
+ private void addEvent(TimeEvent newEvent) {
+ TimeEventNode newEventNode = new TimeEventNode(newEvent);
+ MyLinkedHashSet<TimeEventNode> parentNodes = this.findParents(newEvent);
+ MyLinkedHashSet<TimeEventNode> childrenNodes = this.findChildren(newEvent, parentNodes);
+
+ if (childrenNodes.size() == 0)
+ leafNodes.add(newEventNode);
+
+ newEventNode.addParents(parentNodes);
+ newEventNode.addChildren(childrenNodes);
+
+ }
+
+ private MyLinkedHashSet<TimeEventNode> findParents(TimeEvent newEvent) {
+ MyLinkedHashSet<TimeEventNode> parentNodes = new MyLinkedHashSet<TimeEventNode>();
+ MyLinkedHashSet<TimeEventNode> possibleParentNodes = new MyLinkedHashSet<TimeEventNode>();
+ MyLinkedHashSet<TimeEventNode> possibleParentNodesAlreadyChecked = new MyLinkedHashSet<TimeEventNode>();
+
+ //iterate through possible parent nodes add possible parent child as
+ // possible parents if they do not conflict
+ TimeEventNode curPPN = this.root;
+ while (curPPN != null) {
+ boolean ppnListChanged = false;
+ for (TimeEventNode curChild : curPPN.getChildren()) {
+ //if curChild does not conficts with te, then it is a possible parent
+ if (happensBefore(curChild.getTimeEvent(), newEvent)
+ && !possibleParentNodesAlreadyChecked.contains(curChild)) {
+ possibleParentNodes.add(curChild);
+ ppnListChanged = true;
+ }
+ }
+ //if all children where not possible parents, then curPPN must be parent
+ if (!ppnListChanged)
+ parentNodes.add(curPPN);
+
+ //get next curPPN
+ possibleParentNodes.remove(curPPN);
+ possibleParentNodesAlreadyChecked.add(curPPN);
+ while((curPPN = possibleParentNodes.get(0)) != null
+ && possibleParentNodesAlreadyChecked.contains(curPPN)) {
+ possibleParentNodes.remove(curPPN);
+ }
+ }
+
+ return parentNodes;
+ }
+
+ private MyLinkedHashSet<TimeEventNode> findChildren(TimeEvent newEvent, MyLinkedHashSet<TimeEventNode> parentNodes) {
+ MyLinkedHashSet<TimeEventNode> childrenNodes = new MyLinkedHashSet<TimeEventNode>();
+ MyLinkedHashSet<TimeEventNode> possibleChildrenNodes = new MyLinkedHashSet<TimeEventNode>();
+ for (TimeEventNode parent : parentNodes) {
+ possibleChildrenNodes.addAll(parent.getChildren());
+ TimeEventNode curPCN = possibleChildrenNodes.get(0);
+ while (curPCN != null) {
+ if (happensBefore(newEvent, curPCN.getTimeEvent())) {
+ childrenNodes.add(curPCN);
+ }else {
+ possibleChildrenNodes.addAll(curPCN.getChildren());
+ }
+ possibleChildrenNodes.remove(curPCN);
+ curPCN = possibleChildrenNodes.get(0);
+ }
+ }
+ return childrenNodes;
+ }
+
+ private boolean happensBefore(TimeEvent t1, TimeEvent t2) {
+ long boundaryCheck = t2.getStartTime() - t1.getEndTime();
+ return (boundaryCheck + epsilon) > 0;
+ }
+
+ private WeightedNode getGreatestWeightedPath() {
+ TimeEventNode max = this.leafNodes.get(0);
+ for (TimeEventNode ten : this.leafNodes) {
+ if (ten.getPathWeight() > max.getPathWeight()
+ || (ten.getPathWeight() == max.getPathWeight()
+ && ten.getPathPriorityWeight() > max.getPathPriorityWeight()))
+ max = ten;
+ }
+ WeightedNode root = new WeightedNode(max.getTimeEvent());
+ TimeEventNode curTEN = max.greatestWieghtedParent;
+ while (curTEN != null) {
+ WeightedNode temp = new WeightedNode(curTEN.getTimeEvent());
+ temp.setChild(root);
+ root = temp;
+ curTEN = curTEN.greatestWieghtedParent;
+ }
+ return root.getChild();
+ }
+
+ private class MyLinkedHashSet<E> extends HashSet<E> {
+
+ private static final long serialVersionUID = -7319154087430025841L;
+
+ private LinkedList<E> listSet;
+
+ public MyLinkedHashSet() {
+ this.listSet = new LinkedList<E>();
+ }
+
+ @Override
+ public boolean add(E ten) {
+ boolean wasAdded = false;
+ if (wasAdded = super.add(ten))
+ listSet.add(ten);
+ return wasAdded;
+ }
+
+ @Override
+ public boolean addAll(Collection<? extends E> collection) {
+ boolean setChanged = false;
+ for (E ten : collection) {
+ if (this.add(ten))
+ setChanged = true;
+ }
+ return setChanged;
+ }
+
+ @Override
+ public boolean remove(Object ten) {
+ if (super.remove(ten)) {
+ this.listSet.remove(ten);
+ return true;
+ }else
+ return false;
+ }
+
+ @Override
+ public boolean removeAll(Collection<?> collection) {
+ boolean setChanged = false;
+ for (Object obj : collection) {
+ if (this.remove(obj))
+ setChanged = true;
+ }
+ return setChanged;
+ }
+
+ public E get(int index) {
+ if (this.listSet.size() > index)
+ return this.listSet.get(index);
+ else
+ return null;
+ }
+
+ public List<E> getList() {
+ return this.listSet;
+ }
+
+ }
+
+ private class TimeEventNode {
+
+ private TimeEvent te;
+
+ private MyLinkedHashSet<TimeEventNode> children;
+
+ private MyLinkedHashSet<TimeEventNode> parents;
+
+ private TimeEventNode greatestWieghtedParent;
+
+ public TimeEventNode(TimeEvent te) {
+ this.te = te;
+ children = new MyLinkedHashSet<TimeEventNode>();
+ parents = new MyLinkedHashSet<TimeEventNode>();
+ }
+
+ public long getPathWeight() {
+ if (this.greatestWieghtedParent != null)
+ return te.getDuration()
+ + this.greatestWieghtedParent.getPathWeight();
+ else
+ return te.getDuration();
+ }
+
+ public double getPathPriorityWeight() {
+ if (this.greatestWieghtedParent != null)
+ return te.getPriority()
+ + this.greatestWieghtedParent.getPathPriorityWeight();
+ else
+ return te.getPriority();
+ }
+
+ public TimeEvent getTimeEvent() {
+ return this.te;
+ }
+
+ public void setTimeEvent(TimeEvent te) {
+ this.te = te;
+ }
+
+ public void addChild(TimeEventNode child) {
+ //remove parent to grandchild links
+ for (TimeEventNode parent : this.parents) {
+ parent.children.remove(child);
+ child.parents.remove(parent);
+ }
+
+ //link to child
+ this.children.add(child);
+ child.parents.add(this);
+ leafNodes.remove(this);
+
+ //determine child's greatest weighted parent
+ child.greatestWieghtedParent = this;
+ for (TimeEventNode parent : child.parents) {
+ long gwpPaW = child.greatestWieghtedParent.getPathWeight();
+ long pPaW = parent.getPathWeight();
+ double gwpPiW = child.greatestWieghtedParent.getPathPriorityWeight();
+ double pPiW = parent.getPathPriorityWeight();
+ if (pPaW > gwpPaW || (pPaW == gwpPaW && pPiW > gwpPiW))
+ child.greatestWieghtedParent = parent;
+ }
+ }
+
+ public void addParent(TimeEventNode parent) {
+ parent.addChild(this);
+ }
+
+ public void addChildren(Collection<TimeEventNode> children) {
+ for (TimeEventNode child : children)
+ this.addChild(child);
+ }
+
+ public void addParents(Collection<TimeEventNode> parents) {
+ for (TimeEventNode parent : parents)
+ this.addParent(parent);
+ }
+
+ public MyLinkedHashSet<TimeEventNode> getChildren() {
+ return this.children;
+ }
+
+ public MyLinkedHashSet<TimeEventNode> getParents() {
+ return this.parents;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof TimeEventNode) {
+ TimeEventNode ten = (TimeEventNode) obj;
+ return this.te.equals(ten.te);
+ } else
+ return false;
+ }
+
+ public String toString() {
+ return this.te.toString() + " -- " + this.getPathWeight();
+ }
+
+ }
+
+ private class WeightedNode {
+
+ private long pathWeight;
+
+ private WeightedNode child;
+
+ private TimeEvent te;
+
+ private WeightedNode(TimeEvent te) {
+ this.te = te;
+ pathWeight = te.getDuration();
+ }
+
+ private void setChild(WeightedNode child) {
+ this.child = child;
+ if (child != null)
+ this.pathWeight = this.te.getDuration() + child.getPathWeight();
+ }
+
+ public TimeEvent getTimeEvent() {
+ return this.te;
+ }
+
+ public WeightedNode getChild() {
+ return this.child;
+ }
+
+ public long getPathWeight() {
+ return this.pathWeight;
+ }
+
+ public String toString() {
+ return te.toString() + "\n"
+ + (child != null ? child.toString() : "");
+ }
+
+ }
+
+ public String toString() {
+ StringBuffer sb = new StringBuffer("");
+ LinkedList<TimeEventNode> printNodes = new LinkedList<TimeEventNode>();
+ printNodes.add(this.root);
+ sb.append(printNodes(printNodes, "-", 0));
+ return sb.toString();
+ }
+
+ private StringBuffer printNodes(List<TimeEventNode> list,
+ String spacer, long curPathWeight) {
+ StringBuffer output = new StringBuffer("");
+ for (TimeEventNode node : list) {
+ output.append(spacer);
+ output.append(node.te + " -- " + (curPathWeight + node.te.getDuration()) + "\n");
+ output.append(printNodes(node.getChildren().getList(), " " + spacer, curPathWeight + node.te.getDuration()));
+ }
+ return output;
+ }
+
+}
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/io/LoggerOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/io/LoggerOutputStream.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/io/LoggerOutputStream.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/io/LoggerOutputStream.java Wed Jul 14 19:32:42 2010
@@ -1,84 +1,84 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-package gov.nasa.jpl.oodt.cas.commons.io;
-
-//JDK imports
-import java.io.IOException;
-import java.io.OutputStream;
-import java.nio.CharBuffer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- *
- * @author bfoster
- * @version $Revision$
- *
- * <p>
- * Describe your class here
- * </p>.
- */
-public class LoggerOutputStream extends OutputStream {
-
- private Logger logger;
-
- private CharBuffer buffer;
-
- private Level logLevel;
-
- public LoggerOutputStream(Logger logger) throws InstantiationException {
- this(logger, Level.INFO);
- }
-
- public LoggerOutputStream(Logger logger, Level logLevel)
- throws InstantiationException {
- this(logger, 512, logLevel);
- }
-
- public LoggerOutputStream(Logger logger, int numOfBytesPerWrite)
- throws InstantiationException {
- this(logger, numOfBytesPerWrite, Level.INFO);
- }
-
- public LoggerOutputStream(Logger logger, int numOfBytesPerWrite,
- Level logLevel) throws InstantiationException {
- this.logger = logger;
- this.buffer = CharBuffer.wrap(new char[numOfBytesPerWrite]);
- this.logLevel = logLevel;
- }
-
- public void write(int b) throws IOException {
- if (this.buffer.hasRemaining()) {
- this.buffer.put((char) b);
- if (!this.buffer.hasRemaining())
- this.flush();
- } else
- this.logger.log(this.logLevel, ((char) b) + "");
- }
-
- public void flush() {
- if (this.buffer.position() > 0) {
- char[] flushContext = new char[this.buffer.position()];
- System.arraycopy(this.buffer.array(), 0, flushContext, 0, this.buffer.position());
- this.logger.log(this.logLevel, new String(flushContext));
- this.buffer.clear();
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.commons.io;
+
+//JDK imports
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.CharBuffer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ * @author bfoster
+ * @version $Revision$
+ *
+ * <p>
+ * Describe your class here
+ * </p>.
+ */
+public class LoggerOutputStream extends OutputStream {
+
+ private Logger logger;
+
+ private CharBuffer buffer;
+
+ private Level logLevel;
+
+ public LoggerOutputStream(Logger logger) throws InstantiationException {
+ this(logger, Level.INFO);
+ }
+
+ public LoggerOutputStream(Logger logger, Level logLevel)
+ throws InstantiationException {
+ this(logger, 512, logLevel);
+ }
+
+ public LoggerOutputStream(Logger logger, int numOfBytesPerWrite)
+ throws InstantiationException {
+ this(logger, numOfBytesPerWrite, Level.INFO);
+ }
+
+ public LoggerOutputStream(Logger logger, int numOfBytesPerWrite,
+ Level logLevel) throws InstantiationException {
+ this.logger = logger;
+ this.buffer = CharBuffer.wrap(new char[numOfBytesPerWrite]);
+ this.logLevel = logLevel;
+ }
+
+ public void write(int b) throws IOException {
+ if (this.buffer.hasRemaining()) {
+ this.buffer.put((char) b);
+ if (!this.buffer.hasRemaining())
+ this.flush();
+ } else
+ this.logger.log(this.logLevel, ((char) b) + "");
+ }
+
+ public void flush() {
+ if (this.buffer.position() > 0) {
+ char[] flushContext = new char[this.buffer.position()];
+ System.arraycopy(this.buffer.array(), 0, flushContext, 0, this.buffer.position());
+ this.logger.log(this.logLevel, new String(flushContext));
+ this.buffer.clear();
+ }
+ }
+
+}
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/CmdLineOption.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/CmdLineOption.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/CmdLineOption.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/CmdLineOption.java Wed Jul 14 19:32:42 2010
@@ -16,18 +16,18 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option;
+package org.apache.oodt.commons.option;
//JDK imports
import java.util.LinkedList;
import java.util.List;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.handler.CmdLineOptionHandler;
-import gov.nasa.jpl.oodt.cas.commons.option.handler.StdCmdLineOptionHandler;
-import gov.nasa.jpl.oodt.cas.commons.option.required.RequiredOption;
-import gov.nasa.jpl.oodt.cas.commons.option.validator.CmdLineOptionValidator;
-import gov.nasa.jpl.oodt.cas.commons.spring.SpringSetIdInjectionType;
+import org.apache.oodt.commons.option.handler.CmdLineOptionHandler;
+import org.apache.oodt.commons.option.handler.StdCmdLineOptionHandler;
+import org.apache.oodt.commons.option.required.RequiredOption;
+import org.apache.oodt.commons.option.validator.CmdLineOptionValidator;
+import org.apache.oodt.commons.spring.SpringSetIdInjectionType;
/**
*
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/CmdLineOptionInstance.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/CmdLineOptionInstance.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/CmdLineOptionInstance.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/CmdLineOptionInstance.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option;
+package org.apache.oodt.commons.option;
//JDK imports
import java.util.LinkedList;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/BeanInfo.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/BeanInfo.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/BeanInfo.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/BeanInfo.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.handler;
+package org.apache.oodt.commons.option.handler;
/**
*
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/CmdLineOptionBeanHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/CmdLineOptionBeanHandler.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/CmdLineOptionBeanHandler.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/CmdLineOptionBeanHandler.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.handler;
+package org.apache.oodt.commons.option.handler;
//JDK imports
import java.io.File;
@@ -29,8 +29,8 @@ import java.util.List;
import java.util.Set;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOption;
-import gov.nasa.jpl.oodt.cas.commons.spring.SpringSetIdInjectionType;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.spring.SpringSetIdInjectionType;
//Spring imports
import org.apache.commons.lang.StringUtils;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/CmdLineOptionHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/CmdLineOptionHandler.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/CmdLineOptionHandler.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/CmdLineOptionHandler.java Wed Jul 14 19:32:42 2010
@@ -16,13 +16,13 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.handler;
+package org.apache.oodt.commons.option.handler;
//JDK imports
import java.util.List;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOption;
//Spring imports
import org.apache.commons.lang.StringUtils;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/StdCmdLineOptionHandler.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/StdCmdLineOptionHandler.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/StdCmdLineOptionHandler.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/handler/StdCmdLineOptionHandler.java Wed Jul 14 19:32:42 2010
@@ -16,12 +16,12 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.handler;
+package org.apache.oodt.commons.option.handler;
//JDK imports
import java.util.List;
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOption;
/**
*
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/parser/CmdLineOptionParser.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.parser;
+package org.apache.oodt.commons.option.parser;
//JDK imports
import java.io.IOException;
@@ -25,10 +25,10 @@ import java.util.LinkedList;
import java.util.List;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOption;
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOptionInstance;
-import gov.nasa.jpl.oodt.cas.commons.option.util.CmdLineOptionUtils;
-import gov.nasa.jpl.oodt.cas.commons.option.util.CmdLineOptionsUsagePrinter;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.util.CmdLineOptionUtils;
+import org.apache.oodt.commons.option.util.CmdLineOptionsUsagePrinter;
/**
*
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/required/RequiredOption.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/required/RequiredOption.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/required/RequiredOption.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/required/RequiredOption.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.required;
+package org.apache.oodt.commons.option.required;
//OODT imports
import java.util.LinkedList;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/util/CmdLineOptionUtils.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/util/CmdLineOptionUtils.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/util/CmdLineOptionUtils.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/util/CmdLineOptionUtils.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.util;
+package org.apache.oodt.commons.option.util;
//JDK imports
import java.io.IOException;
@@ -28,11 +28,11 @@ import java.util.Map;
import java.util.Map.Entry;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOption;
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOptionInstance;
-import gov.nasa.jpl.oodt.cas.commons.option.parser.CmdLineOptionParser;
-import gov.nasa.jpl.oodt.cas.commons.option.required.RequiredOption;
-import gov.nasa.jpl.oodt.cas.commons.option.validator.CmdLineOptionValidator;
+import org.apache.oodt.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.parser.CmdLineOptionParser;
+import org.apache.oodt.commons.option.required.RequiredOption;
+import org.apache.oodt.commons.option.validator.CmdLineOptionValidator;
//Spring imports
import org.springframework.context.ApplicationContext;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/util/CmdLineOptionsUsagePrinter.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/util/CmdLineOptionsUsagePrinter.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/util/CmdLineOptionsUsagePrinter.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/util/CmdLineOptionsUsagePrinter.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.util;
+package org.apache.oodt.commons.option.util;
//JDK imports
import java.io.PrintStream;
@@ -24,7 +24,7 @@ import java.util.Collections;
import java.util.List;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOption;
+import org.apache.oodt.commons.option.CmdLineOption;
//Spring imports
import org.apache.commons.lang.StringUtils;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/AllowedArgsCmdLineOptionValidator.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/AllowedArgsCmdLineOptionValidator.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/AllowedArgsCmdLineOptionValidator.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/AllowedArgsCmdLineOptionValidator.java Wed Jul 14 19:32:42 2010
@@ -16,7 +16,7 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.validator;
+package org.apache.oodt.commons.option.validator;
//JDK imports
import java.util.LinkedList;
@@ -24,7 +24,7 @@ import java.util.List;
import java.util.logging.Level;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
//Spring imports
import org.springframework.beans.factory.annotation.Required;
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/ArgRegExpCmdLineOptionValidator.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/ArgRegExpCmdLineOptionValidator.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/ArgRegExpCmdLineOptionValidator.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/ArgRegExpCmdLineOptionValidator.java Wed Jul 14 19:32:42 2010
@@ -16,14 +16,14 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.validator;
+package org.apache.oodt.commons.option.validator;
//JDK imports
import java.util.logging.Level;
import java.util.regex.Pattern;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
/**
*
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/ClassExistsCmdLineOptionValidator.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/ClassExistsCmdLineOptionValidator.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/ClassExistsCmdLineOptionValidator.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/ClassExistsCmdLineOptionValidator.java Wed Jul 14 19:32:42 2010
@@ -16,13 +16,13 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.validator;
+package org.apache.oodt.commons.option.validator;
//JDK imports
import java.util.logging.Level;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
/**
*
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/CmdLineOptionValidator.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/CmdLineOptionValidator.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/CmdLineOptionValidator.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/CmdLineOptionValidator.java Wed Jul 14 19:32:42 2010
@@ -16,13 +16,13 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.validator;
+package org.apache.oodt.commons.option.validator;
//JDK imports
import java.util.logging.Logger;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
/**
*
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/FileExistCmdLineOptionValidator.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/FileExistCmdLineOptionValidator.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/FileExistCmdLineOptionValidator.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/FileExistCmdLineOptionValidator.java Wed Jul 14 19:32:42 2010
@@ -16,14 +16,14 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.validator;
+package org.apache.oodt.commons.option.validator;
//JDK imports
import java.io.File;
import java.util.logging.Level;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
/**
*
Modified: incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/NoRestrictionsCmdLineOptionValidator.java
URL: http://svn.apache.org/viewvc/incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/NoRestrictionsCmdLineOptionValidator.java?rev=964147&r1=964122&r2=964147&view=diff
==============================================================================
--- incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/NoRestrictionsCmdLineOptionValidator.java (original)
+++ incubator/oodt/trunk/commons/src/main/java/org/apache/oodt/commons/option/validator/NoRestrictionsCmdLineOptionValidator.java Wed Jul 14 19:32:42 2010
@@ -16,10 +16,10 @@
*/
-package gov.nasa.jpl.oodt.cas.commons.option.validator;
+package org.apache.oodt.commons.option.validator;
//OODT imports
-import gov.nasa.jpl.oodt.cas.commons.option.CmdLineOptionInstance;
+import org.apache.oodt.commons.option.CmdLineOptionInstance;
/**
*