From tga at ci.uchicago.edu Sun Oct 2 11:32:27 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Sun, 2 Oct 2011 11:32:27 -0500 (CDT) Subject: [Swift-commit] r5201 - in SwiftApps/SwiftR: . Swift/exec Message-ID: <20111002163227.93F979CCF6@svn.ci.uchicago.edu> Author: tga Date: 2011-10-02 11:32:26 -0500 (Sun, 02 Oct 2011) New Revision: 5201 Modified: SwiftApps/SwiftR/Swift/exec/configure-server-crayxt SwiftApps/SwiftR/Swift/exec/configure-server-crayxtauto SwiftApps/SwiftR/checkout-swift.sh Log: Make timeouts a bit longer for cray. Checkout svn rep instead of export so that version info is included. Modified: SwiftApps/SwiftR/Swift/exec/configure-server-crayxt =================================================================== --- SwiftApps/SwiftR/Swift/exec/configure-server-crayxt 2011-09-30 20:27:28 UTC (rev 5200) +++ SwiftApps/SwiftR/Swift/exec/configure-server-crayxt 2011-10-02 16:32:26 UTC (rev 5201) @@ -25,7 +25,7 @@ $LD_LIBRARY_PATH - 30 + 60 $R_LIBS_USER /dev/shm/$USER/ Modified: SwiftApps/SwiftR/Swift/exec/configure-server-crayxtauto =================================================================== --- SwiftApps/SwiftR/Swift/exec/configure-server-crayxtauto 2011-09-30 20:27:28 UTC (rev 5200) +++ SwiftApps/SwiftR/Swift/exec/configure-server-crayxtauto 2011-10-02 16:32:26 UTC (rev 5201) @@ -36,6 +36,7 @@ $nodes $cores + $cores $cores @@ -342,7 +358,7 @@ - + appends a value to an array @@ -404,7 +420,7 @@ - + @@ -615,7 +631,7 @@ type="TypeRow" name="member" /> - + Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java =================================================================== --- trunk/src/org/griphyn/vdl/engine/Karajan.java 2011-10-06 21:00:21 UTC (rev 5206) +++ trunk/src/org/griphyn/vdl/engine/Karajan.java 2011-10-06 21:19:33 UTC (rev 5207) @@ -86,7 +86,7 @@ } public static void compile(String in, PrintStream out, boolean provenanceEnabled) throws CompilationException { - Karajan me = new Karajan(); + Karajan karajan = new Karajan(); StringTemplateGroup templates; try { StringTemplateGroup main = new StringTemplateGroup(new InputStreamReader( @@ -112,8 +112,8 @@ } Program prog = programDoc.getProgram(); - me.setTemplateGroup(templates); - StringTemplate code = me.program(prog); + karajan.setTemplateGroup(templates); + StringTemplate code = karajan.program(prog); out.println(code.toString()); } @@ -370,7 +370,7 @@ checkIsTypeDefined(type); outerScope.addVariable(param.getName(), type); } - + Binding bind; if ((bind = proc.getBinding()) != null) { binding(bind, procST, innerScope); @@ -1022,12 +1022,34 @@ appST.setAttribute("stdout", expressionToKarajan(app.getStdout().getAbstractExpression(), scope)); if(app.getStderr()!=null) appST.setAttribute("stderr", expressionToKarajan(app.getStderr().getAbstractExpression(), scope)); + addProfiles(app, scope, appST); return appST; } catch(CompilationException e) { throw new CompilationException(e.getMessage()+" in application "+app.getExecutable()+" at "+app.getSrc(),e); } } + private void addProfiles(ApplicationBinding app, + VariableScope scope, + StringTemplate appST) + throws CompilationException { + Profile[] profiles = app.getProfileArray(); + if (profiles.length == 0) + return; + StringTemplate attributes = template("vdl_attributes"); + for (Profile profile : profiles) { + XmlObject xmlKey = profile.getAbstractExpressionArray(0); + XmlObject xmlValue = profile.getAbstractExpressionArray(1); + StringTemplate key = expressionToKarajan(xmlKey, scope); + StringTemplate value = expressionToKarajan(xmlValue, scope); + StringTemplate entry = template("map_entry"); + entry.setAttribute("key", key); + entry.setAttribute("value", value); + attributes.setAttribute("entries", entry); + } + appST.setAttribute("attributes", attributes); + } + /** Produces a Karajan function invocation from a SwiftScript invocation. * The Karajan invocation will have the same name as the SwiftScript * function, in the 'vdl' Karajan namespace. Parameters to the Modified: trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java =================================================================== --- trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java 2011-10-06 21:00:21 UTC (rev 5206) +++ trunk/src/org/griphyn/vdl/karajan/lib/TCProfile.java 2011-10-06 21:19:33 UTC (rev 5207) @@ -27,11 +27,19 @@ public class TCProfile extends VDLFunction { public static final Logger logger = Logger.getLogger(TCProfile.class); - public static final Arg OA_TR = new Arg.Optional("tr"); - public static final Arg PA_HOST = new Arg.Positional("host"); + public static final Arg OA_TR = new Arg.Optional("tr"); + /** + Allows for dynamic attributes from the SwiftScript + profile statements. + These override any other attributes. + */ + public static final Arg OA_ATTRS = new Arg.Positional("attributes"); + + public static final Arg PA_HOST = new Arg.Positional("host"); + static { - setArguments(TCProfile.class, new Arg[] { PA_HOST, OA_TR }); + setArguments(TCProfile.class, new Arg[] { PA_HOST, OA_ATTRS, OA_TR }); } private static Map PROFILE_T; @@ -52,14 +60,17 @@ public Object function(VariableStack stack) throws ExecutionException { TCCache tc = getTC(stack); String tr = null; + + Map dynamicAttributes = + readDynamicAttributes(stack); + if (OA_TR.isPresent(stack)) { tr = TypeUtil.toString(OA_TR.getValue(stack)); } BoundContact bc = (BoundContact) PA_HOST.getValue(stack); NamedArguments named = ArgUtil.getNamedReturn(stack); - Map attrs = null; - + Map attrs = null; attrs = attributesFromHost(bc, attrs, named); TCEntry tce = null; @@ -75,11 +86,46 @@ } named.add(GridExec.A_ENVIRONMENT, env); checkWalltime(tr, named); + attrs = addDynamicAttributes(attrs, dynamicAttributes); addAttributes(named, attrs); return null; } + + /** + Bring in the dynamic attributes from the Karajan stack + @return Map, may be null + */ + @SuppressWarnings("unchecked") + private Map + readDynamicAttributes(VariableStack stack) + throws ExecutionException { + Map result = null; + if (OA_ATTRS.isPresent(stack)) + result = (Map) OA_ATTRS.getValue(stack); + return result; + } - private void checkWalltime(String tr, NamedArguments attrs) { + /** + Store dynamic attributes into returned attributes, + overwriting if necessary + @param result Attributes so far known, may be null + @param dynamicAttributes Attributes to insert, may be null + @result Combination, may be null + */ + private Map + addDynamicAttributes(Map result, + Map dynamicAttributes) { + if (result == null && dynamicAttributes == null) + return null; + if (result == null) + return dynamicAttributes; + if (dynamicAttributes == null) + return result; + result.putAll(dynamicAttributes); + return result; + } + + private void checkWalltime(String tr, NamedArguments attrs) { Object walltime = null; if (attrs != null) { if (attrs.hasArgument("maxwalltime")) { From davidk at ci.uchicago.edu Thu Oct 6 21:46:55 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Thu, 6 Oct 2011 21:46:55 -0500 (CDT) Subject: [Swift-commit] r5208 - branches/release-0.93/bin Message-ID: <20111007024655.AB28B9CC9E@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-06 21:46:55 -0500 (Thu, 06 Oct 2011) New Revision: 5208 Modified: branches/release-0.93/bin/start-coaster-service Log: start-coaster-service can now use a relay host to start workers not directly available due to firewall restrictions Modified: branches/release-0.93/bin/start-coaster-service =================================================================== --- branches/release-0.93/bin/start-coaster-service 2011-10-06 21:19:33 UTC (rev 5207) +++ branches/release-0.93/bin/start-coaster-service 2011-10-07 02:46:55 UTC (rev 5208) @@ -43,7 +43,7 @@ # Copy and start worker script scp $SWIFT_BIN/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_WORK > /dev/null 2>&1 echo "Starting worker on $MACHINE" - ssh $WORKER_USERNAME@$MACHINE $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR & + ssh $WORKER_USERNAME@$MACHINE "$WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR" & echo $! >> $PID_FILE done } @@ -56,6 +56,11 @@ if [ -z "$PORT" ]; then crash "start-workers-ssh: Port number not specified, giving up" fi + + if [ -n "$WORKER_RELAY_HOST" ]; then + scp $SWIFT_BIN/$WORKER $WORKER_USERNAME@$WORKER_RELAY_HOST:/tmp > /dev/null 2>&1 + fi + for MACHINE in $WORKER_HOSTS do # Enable ssh tunneling if needed @@ -64,10 +69,20 @@ echo $! >> $PID_FILE fi - scp $SWIFT_BIN/$WORKER $MACHINE:$WORKER_WORK > /dev/null 2>&1 - echo Starting worker on $MACHINE - ssh $MACHINE $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR & - echo $! >> $PID_FILE + # Use a relay host + if [ -n "$WORKER_RELAY_HOST" ]; then + ssh $WORKER_USERNAME@$WORKER_RELAY_HOST ssh $MACHINE mkdir -p $WORKER_WORK > /dev/null 2>&1 + ssh $WORKER_USERNAME@$WORKER_RELAY_HOST "scp /tmp/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_WORK" > /dev/null 2>&1 + echo Starting worker on $MACHINE + ssh $WORKER_USERNAME@$WORKER_RELAY_HOST ssh $WORKER_USERNAME@$MACHINE "WORKER_LOGGING_LEVEL=$WORKER_LOGGING_LEVEL $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $WORKER_LOG_DIR" & + echo $! >> $PID_FILE + # Connect directly + else + scp $SWIFT_BIN/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_WORK > /dev/null 2>&1 + echo Starting worker on $MACHINE + ssh $WORKER_USERNAME@$MACHINE "$WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR" & + echo $! >> $PID_FILE + fi done return 0 } From davidk at ci.uchicago.edu Thu Oct 6 21:49:42 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Thu, 6 Oct 2011 21:49:42 -0500 (CDT) Subject: [Swift-commit] r5209 - trunk/bin Message-ID: <20111007024942.269CA9CC9E@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-06 21:49:42 -0500 (Thu, 06 Oct 2011) New Revision: 5209 Modified: trunk/bin/start-coaster-service Log: start-coaster-service can now use a relay host to start workers not directly available due to firewall restrictions Modified: trunk/bin/start-coaster-service =================================================================== --- trunk/bin/start-coaster-service 2011-10-07 02:46:55 UTC (rev 5208) +++ trunk/bin/start-coaster-service 2011-10-07 02:49:42 UTC (rev 5209) @@ -43,7 +43,7 @@ # Copy and start worker script scp $SWIFT_BIN/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_WORK > /dev/null 2>&1 echo "Starting worker on $MACHINE" - ssh $WORKER_USERNAME@$MACHINE $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR & + ssh $WORKER_USERNAME@$MACHINE "$WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR" & echo $! >> $PID_FILE done } @@ -56,6 +56,11 @@ if [ -z "$PORT" ]; then crash "start-workers-ssh: Port number not specified, giving up" fi + + if [ -n "$WORKER_RELAY_HOST" ]; then + scp $SWIFT_BIN/$WORKER $WORKER_USERNAME@$WORKER_RELAY_HOST:/tmp > /dev/null 2>&1 + fi + for MACHINE in $WORKER_HOSTS do # Enable ssh tunneling if needed @@ -64,10 +69,20 @@ echo $! >> $PID_FILE fi - scp $SWIFT_BIN/$WORKER $MACHINE:$WORKER_WORK > /dev/null 2>&1 - echo Starting worker on $MACHINE - ssh $MACHINE $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR & - echo $! >> $PID_FILE + # Use a relay host + if [ -n "$WORKER_RELAY_HOST" ]; then + ssh $WORKER_USERNAME@$WORKER_RELAY_HOST ssh $MACHINE mkdir -p $WORKER_WORK > /dev/null 2>&1 + ssh $WORKER_USERNAME@$WORKER_RELAY_HOST "scp /tmp/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_WORK" > /dev/null 2>&1 + echo Starting worker on $MACHINE + ssh $WORKER_USERNAME@$WORKER_RELAY_HOST ssh $WORKER_USERNAME@$MACHINE "WORKER_LOGGING_LEVEL=$WORKER_LOGGING_LEVEL $WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $WORKER_LOG_DIR" & + echo $! >> $PID_FILE + # Connect directly + else + scp $SWIFT_BIN/$WORKER $WORKER_USERNAME@$MACHINE:$WORKER_WORK > /dev/null 2>&1 + echo Starting worker on $MACHINE + ssh $WORKER_USERNAME@$MACHINE "$WORKER_WORK/$WORKER $EXECUTION_URL $MACHINE $LOG_DIR" & + echo $! >> $PID_FILE + fi done return 0 } @@ -242,7 +257,11 @@ # Generate sites.xml export EXECUTION_URL="http://$IPADDR:$SERVICE_PORT" echo Generating sites.xml -gensites persistent-coasters -p $CONFIG_FILE > $RUN_DIR/sites.xml +if [ -f "gensites.template" ]; then + gensites `cat gensites.template` -p $CONFIG_FILE > $RUN_DIR/sites.xml +else + gensites persistent-coasters -p $CONFIG_FILE > $RUN_DIR/sites.xml +fi # Generate config file if [ "$SHARED_FILESYSTEM" == "no" ]; then @@ -255,17 +274,3 @@ EOF fi -# Generate TC file -echo Generating tc.data -cat > $RUN_DIR/tc.data << EOF -persistent-coasters echo /bin/echo null null null -persistent-coasters cat /bin/cat null null null -persistent-coasters ls /bin/ls null null null -persistent-coasters grep /bin/grep null null null -persistent-coasters sort /bin/sort null null null -persistent-coasters paste /bin/paste null null null -persistent-coasters cp /bin/cp null null null -persistent-coasters wc /usr/bin/wc null null null -persistent-coasters hostname /bin/hostname null null null -EOF - From davidk at ci.uchicago.edu Fri Oct 7 13:28:23 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Fri, 7 Oct 2011 13:28:23 -0500 (CDT) Subject: [Swift-commit] r5210 - in trunk: bin tests Message-ID: <20111007182823.4522B9CCF7@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-07 13:28:23 -0500 (Fri, 07 Oct 2011) New Revision: 5210 Modified: trunk/bin/gensites trunk/tests/suite.sh Log: Fixed bug in gensites with _HOST_ Modified: trunk/bin/gensites =================================================================== --- trunk/bin/gensites 2011-10-07 02:49:42 UTC (rev 5209) +++ trunk/bin/gensites 2011-10-07 18:28:23 UTC (rev 5210) @@ -59,6 +59,7 @@ exit 0; } + # Parse command line arguments while [ $# -gt 0 ] do @@ -216,10 +217,14 @@ # Verify that the variables by the template are defined for TOKEN in NODES HOST WORK PROJECT QUEUE N_GRAN N_MAX SLOTS INTERNALHOSTNAME MAXTIME EXECUTION_URL do - # Need but can't find, due - if grep _${TOKEN}_ $TEMPLATE_PATH > /dev/null; then + # Test for HOST/GLOBUS_HOSTNAME - the only values which don't match + if [ "$TOKEN" == "HOST" ]; then + if [ -z "$GLOBUS_HOSTNAME" ]; then + crash "Not specified: GLOBUS_HOSTNAME" + fi + elif grep _${TOKEN}_ $TEMPLATE_PATH > /dev/null; then if [ -z "${!TOKEN}" ]; then - crash "Not specified: ${TOKEN}" + crash "Not specified: ${TOKEN}" fi fi done Modified: trunk/tests/suite.sh =================================================================== --- trunk/tests/suite.sh 2011-10-07 02:49:42 UTC (rev 5209) +++ trunk/tests/suite.sh 2011-10-07 18:28:23 UTC (rev 5210) @@ -966,7 +966,7 @@ IFCONFIG=/sbin/ifconfig fi $IFCONFIG > /dev/null 2>&1 || crash "Cannot run ifconfig!" -GLOBUS_HOSTNAME=$( $IFCONFIG | grep inet | head -1 | cut -d ':' -f 2 | \ +export GLOBUS_HOSTNAME=$( $IFCONFIG | grep inet | head -1 | cut -d ':' -f 2 | \ awk '{print $1}' ) [ $? != 0 ] && crash "Could not obtain GLOBUS_HOSTNAME!" @@ -977,7 +977,7 @@ if [ -f "$GROUP/sites.template.xml" ]; then TEMPLATE="$GROUP/sites.template.xml" elif [ -f "$GROUP/gensites.template" ]; then - TEMPLATE=`cat $GROUP/gensites.template` + TEMPLATE=`$GROUP/gensites.template` else TEMPLATE="$TESTDIR/sites/localhost.xml" fi @@ -991,11 +991,7 @@ # Call gensites TEMPLATE_DIRNAME=`dirname $TEMPLATE` TEMPLATE=`basename $TEMPLATE` - if [ "$TEMPLATE_DIRNAME" != "." ]; then - gensites -L $TEMPLATE_DIRNAME $TEMPLATE > sites.xml - else - gensites $TEMPLATE > sites.xml - fi + gensites -L $TEMPLATE_DIRNAME $TEMPLATE > sites.xml 2>&1 } # Generate tc.data From davidk at ci.uchicago.edu Fri Oct 7 13:39:00 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Fri, 7 Oct 2011 13:39:00 -0500 (CDT) Subject: [Swift-commit] r5211 - in branches/release-0.93: bin tests Message-ID: <20111007183900.3C7899CCF7@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-07 13:39:00 -0500 (Fri, 07 Oct 2011) New Revision: 5211 Modified: branches/release-0.93/bin/gensites branches/release-0.93/tests/suite.sh Log: Fix for gensites _HOST_ bug Modified: branches/release-0.93/bin/gensites =================================================================== --- branches/release-0.93/bin/gensites 2011-10-07 18:28:23 UTC (rev 5210) +++ branches/release-0.93/bin/gensites 2011-10-07 18:39:00 UTC (rev 5211) @@ -59,6 +59,7 @@ exit 0; } + # Parse command line arguments while [ $# -gt 0 ] do @@ -216,10 +217,14 @@ # Verify that the variables by the template are defined for TOKEN in NODES HOST WORK PROJECT QUEUE N_GRAN N_MAX SLOTS INTERNALHOSTNAME MAXTIME EXECUTION_URL do - # Need but can't find, due - if grep _${TOKEN}_ $TEMPLATE_PATH > /dev/null; then + # Test for HOST/GLOBUS_HOSTNAME - the only values which don't match + if [ "$TOKEN" == "HOST" ]; then + if [ -z "$GLOBUS_HOSTNAME" ]; then + crash "Not specified: GLOBUS_HOSTNAME" + fi + elif grep _${TOKEN}_ $TEMPLATE_PATH > /dev/null; then if [ -z "${!TOKEN}" ]; then - crash "Not specified: ${TOKEN}" + crash "Not specified: ${TOKEN}" fi fi done Modified: branches/release-0.93/tests/suite.sh =================================================================== --- branches/release-0.93/tests/suite.sh 2011-10-07 18:28:23 UTC (rev 5210) +++ branches/release-0.93/tests/suite.sh 2011-10-07 18:39:00 UTC (rev 5211) @@ -947,7 +947,7 @@ IFCONFIG=/sbin/ifconfig fi $IFCONFIG > /dev/null 2>&1 || crash "Cannot run ifconfig!" -GLOBUS_HOSTNAME=$( $IFCONFIG | grep inet | head -1 | cut -d ':' -f 2 | \ +export GLOBUS_HOSTNAME=$( $IFCONFIG | grep inet | head -1 | cut -d ':' -f 2 | \ awk '{print $1}' ) [ $? != 0 ] && crash "Could not obtain GLOBUS_HOSTNAME!" @@ -958,7 +958,7 @@ if [ -f "$GROUP/sites.template.xml" ]; then TEMPLATE="$GROUP/sites.template.xml" elif [ -f "$GROUP/gensites.template" ]; then - TEMPLATE=`cat $GROUP/gensites.template` + TEMPLATE=`$GROUP/gensites.template` else TEMPLATE="$TESTDIR/sites/localhost.xml" fi @@ -972,11 +972,7 @@ # Call gensites TEMPLATE_DIRNAME=`dirname $TEMPLATE` TEMPLATE=`basename $TEMPLATE` - if [ "$TEMPLATE_DIRNAME" != "." ]; then - gensites -L $TEMPLATE_DIRNAME $TEMPLATE > sites.xml - else - gensites $TEMPLATE > sites.xml - fi + gensites -L $TEMPLATE_DIRNAME $TEMPLATE > sites.xml } # Generate tc.data From davidk at ci.uchicago.edu Fri Oct 7 16:19:23 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Fri, 7 Oct 2011 16:19:23 -0500 (CDT) Subject: [Swift-commit] r5212 - branches/release-0.93/libexec Message-ID: <20111007211923.85BA39CCF7@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-07 16:19:23 -0500 (Fri, 07 Oct 2011) New Revision: 5212 Modified: branches/release-0.93/libexec/_swiftwrap.staging Log: Fix for bug #581 Modified: branches/release-0.93/libexec/_swiftwrap.staging =================================================================== --- branches/release-0.93/libexec/_swiftwrap.staging 2011-10-07 18:39:00 UTC (rev 5211) +++ branches/release-0.93/libexec/_swiftwrap.staging 2011-10-07 21:19:23 UTC (rev 5212) @@ -300,7 +300,7 @@ fi "$EXEC" "${CMDARGS[@]}" 1>"$STDOUT" 2>"$STDERR" <"$STDIN" fi -checkError $? "Application $EXEC failed with an exit code of $?" <<$STDERR +checkError $? "Application $EXEC failed with an exit code of $?" <$STDERR if [ ! -s "$STDOUT" ]; then log "Removing empty stdout" From lgadelha at ci.uchicago.edu Fri Oct 7 17:56:25 2011 From: lgadelha at ci.uchicago.edu (lgadelha at ci.uchicago.edu) Date: Fri, 7 Oct 2011 17:56:25 -0500 (CDT) Subject: [Swift-commit] r5213 - provenancedb Message-ID: <20111007225625.A635E9CCF7@svn.ci.uchicago.edu> Author: lgadelha Date: 2011-10-07 17:56:25 -0500 (Fri, 07 Oct 2011) New Revision: 5213 Modified: provenancedb/ProvSQL.g Log: Minor changes. Modified: provenancedb/ProvSQL.g =================================================================== --- provenancedb/ProvSQL.g 2011-10-07 21:19:23 UTC (rev 5212) +++ provenancedb/ProvSQL.g 2011-10-07 22:56:25 UTC (rev 5213) @@ -300,7 +300,14 @@ relations.add($a.text.split("\\.")[0]); whereClause += $a.text; } + ( + NOT + { + whereClause += " NOT "; + } + )? + ( b=OP { whereClause += $b.text; @@ -321,28 +328,61 @@ whereClause += $e.text; } ) - | f=entityAttribute - { - relations.add($f.text.split("\\.")[0]); - whereClause += $f.text; - } - + | BETWEEN { whereClause += " BETWEEN "; } - g=STRING + f=STRING { - whereClause += $g.text; + whereClause += $f.text; } AND { whereClause += " AND "; } - h=STRING + g=STRING { + whereClause += $g.text; + } + | + LIKE + { + whereClause += " BETWEEN "; + } + h=STRING + { whereClause += $h.text; } + | + ( + IN + { + whereClause += " IN "; + } + | + i=OP + { + whereClause += $i.text; + } + + ( + ALL + { + whereClause += " ALL "; + } + | + ANY + { + whereClause += " ANY "; + } + ) + + ) + '(' { System.out.print("("); } + squery + ')' { System.out.print(")"); } + ) ; entityAttribute : ID (DOT ID)?; @@ -360,6 +400,12 @@ OR : 'o' 'r'; +NOT : 'n' 'o' 't'; + +IN : 'i' 'n'; + +ANY : 'a' 'n' 'y'; + UNION : 'u' 'n' 'i' 'o' 'n'; INTERSECT @@ -375,6 +421,8 @@ BETWEEN : 'b' 'e' 't' 'w' 'e' 'e' 'n'; +LIKE : 'l' 'i' 'k' 'e'; + SEMICOLON : ';'; ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_'|'-')* From lgadelha at ci.uchicago.edu Sat Oct 8 23:38:12 2011 From: lgadelha at ci.uchicago.edu (lgadelha at ci.uchicago.edu) Date: Sat, 8 Oct 2011 23:38:12 -0500 (CDT) Subject: [Swift-commit] r5214 - provenancedb Message-ID: <20111009043812.EFA499CCC2@svn.ci.uchicago.edu> Author: lgadelha Date: 2011-10-08 23:38:12 -0500 (Sat, 08 Oct 2011) New Revision: 5214 Modified: provenancedb/ProvSQL.g Log: Minor changes. Modified: provenancedb/ProvSQL.g =================================================================== --- provenancedb/ProvSQL.g 2011-10-07 22:56:25 UTC (rev 5213) +++ provenancedb/ProvSQL.g 2011-10-09 04:38:12 UTC (rev 5214) @@ -262,20 +262,56 @@ ; selectExpression - : a=entityAttribute + : ( + a=entityAttribute { selectClause += $a.text; relations.add($a.text.split("\\.")[0]); if($a.text.split("\\.").length == 1) selectClause += ".*"; } - (COLON b=entityAttribute + | + b=AGGRFUN + { + selectclause+=$b.text; + } + '(' { selectclause+="("; } + c=entityAttribute { - selectClause += "," + $b.text; - relations.add($b.text.split("\\.")[0]); - if($b.text.split("\\.").length == 1) + selectClause += $c.text; + relations.add($c.text.split("\\.")[0]); + if($c.text.split("\\.").length == 1) selectClause += ".*"; } + ')' { selectclause+=")"; } + + ) + (COLON + ( + d=entityAttribute + { + selectClause += "," + $d.text; + relations.add($d.text.split("\\.")[0]); + if($d.text.split("\\.").length == 1) + selectClause += ".*"; + } + | + e=AGGRFUN + { + selectclause+=$e.text; + } + '(' { selectclause+="("; } + f=entityAttribute + { + selectClause += $f.text; + relations.add($f.text.split("\\.")[0]); + if($f.text.split("\\.").length == 1) + selectClause += ".*"; + } + ')' { selectclause+=")"; } + + + ) )* ; @@ -389,6 +425,8 @@ OP : '=' | '>' | '>=' | '<' | '<='; +AGGRFUN : 'avg' | 'max' | 'min' | 'count' | 'sum'; + SELECT : 's' 'e' 'l' 'e' 'c' 't'; DISTINCT From lgadelha at ci.uchicago.edu Sun Oct 9 16:19:24 2011 From: lgadelha at ci.uchicago.edu (lgadelha at ci.uchicago.edu) Date: Sun, 9 Oct 2011 16:19:24 -0500 (CDT) Subject: [Swift-commit] r5215 - provenancedb Message-ID: <20111009211924.521C89CCF8@svn.ci.uchicago.edu> Author: lgadelha Date: 2011-10-09 16:19:23 -0500 (Sun, 09 Oct 2011) New Revision: 5215 Modified: provenancedb/ProvSQL.g Log: Minor changes. Modified: provenancedb/ProvSQL.g =================================================================== --- provenancedb/ProvSQL.g 2011-10-09 04:38:12 UTC (rev 5214) +++ provenancedb/ProvSQL.g 2011-10-09 21:19:23 UTC (rev 5215) @@ -254,7 +254,42 @@ System.out.print(whereClause); } } - + ( + GROUP BY + { + System.out.print(" GROUP BY "); + } + a=entityAndAttribute + { + System.out.print($a.text); + } + ( + COLON + b=entityAndAttribute + { + System.out.print(","); + System.out.print($b.text); + } + )* + )? + ( + ORDER BY + { + System.out.print(" ORDER BY "); + } + c=entityAndAttribute + { + System.out.print($c.text); + } + ( + COLON + d=entityAndAttribute + { + System.out.print(","); + System.out.print($d.text); + } + )* + )? | '(' { System.out.print("("); } squery @@ -423,8 +458,17 @@ entityAttribute : ID (DOT ID)?; +entityAndAttribute + : ID DOT ID; + OP : '=' | '>' | '>=' | '<' | '<='; +GROUP : 'group'; + +ORDER : 'order'; + +BY : 'by'; + AGGRFUN : 'avg' | 'max' | 'min' | 'count' | 'sum'; SELECT : 's' 'e' 'l' 'e' 'c' 't'; From lgadelha at ci.uchicago.edu Sun Oct 9 17:38:10 2011 From: lgadelha at ci.uchicago.edu (lgadelha at ci.uchicago.edu) Date: Sun, 9 Oct 2011 17:38:10 -0500 (CDT) Subject: [Swift-commit] r5216 - provenancedb Message-ID: <20111009223810.1F6169CCF8@svn.ci.uchicago.edu> Author: lgadelha Date: 2011-10-09 17:38:09 -0500 (Sun, 09 Oct 2011) New Revision: 5216 Modified: provenancedb/ProvSQL.g Log: Minor changes. Modified: provenancedb/ProvSQL.g =================================================================== --- provenancedb/ProvSQL.g 2011-10-09 21:19:23 UTC (rev 5215) +++ provenancedb/ProvSQL.g 2011-10-09 22:38:09 UTC (rev 5216) @@ -271,7 +271,11 @@ System.out.print($b.text); } )* + ( + HAVING { System.out.print(" HAVING "); } + havingExpression )? + )? ( ORDER BY { @@ -289,7 +293,12 @@ System.out.print($d.text); } )* + ( + DESC { System.out.print(" DESC "); } + | + ASC { System.out.print(" ASC "); } )? + )? | '(' { System.out.print("("); } squery @@ -456,6 +465,113 @@ ) ; +havingExpression + : havingAtom + ( + (AND + { + System.out.print(" AND "); + } + | OR + { + System.out.print(" OR "); + } + ) havingAtom + )* + ; + + +havingAtom + : a=entityAndAttribute + { + System.out.print($a.text); + } + ( + NOT + { + System.out.print(" NOT "); + } + )? + + ( + b=OP + { + System.out.print($b.text); + } + ( + c=STRING + { + System.out.print($c.text); + } + | + d=INT + { + System.out.print($d.text); + } + | + e=FLOAT + { + System.out.print($e.text); + } + ) + | + BETWEEN + { + System.out.print(" BETWEEN "); + } + f=STRING + { + System.out.print($f.text); + } + AND + { + System.out.print(" AND "); + } + g=STRING + { + System.out.print($g.text); + } + | + LIKE + { + System.out.print(" BETWEEN "); + } + h=STRING + { + System.out.print($h.text); + } + | + ( + IN + { + System.out.print(" IN "); + } + | + i=OP + { + System.out.print($i.text); + } + + ( + ALL + { + System.out.print(" ALL "); + } + | + ANY + { + System.out.print(" ANY "); + } + ) + + ) + '(' { System.out.print("("); } + squery + ')' { System.out.print(")"); } + ) + ; + + entityAttribute : ID (DOT ID)?; entityAndAttribute @@ -473,6 +589,10 @@ SELECT : 's' 'e' 'l' 'e' 'c' 't'; +DESC : 'desc'; + +ASC : 'asc'; + DISTINCT : 'd' 'i' 's' 't' 'i' 'n' 'c' 't'; @@ -503,6 +623,8 @@ BETWEEN : 'b' 'e' 't' 'w' 'e' 'e' 'n'; +HAVING : 'having'; + LIKE : 'l' 'i' 'k' 'e'; SEMICOLON : ';'; From wozniak at ci.uchicago.edu Tue Oct 11 13:37:46 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Tue, 11 Oct 2011 13:37:46 -0500 (CDT) Subject: [Swift-commit] r5217 - in www/presentations: . OSCER_2011 Message-ID: <20111011183746.C99BE9CCCB@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-11 13:37:46 -0500 (Tue, 11 Oct 2011) New Revision: 5217 Added: www/presentations/OSCER_2011/ www/presentations/OSCER_2011/suli.pdf www/presentations/OSCER_2011/suli.pptx Removed: www/presentations/OSCER_2011/suli.pdf www/presentations/OSCER_2011/suli.pptx Log: Copy of SULI talk for OSCER Deleted: www/presentations/OSCER_2011/suli.pdf =================================================================== (Binary files differ) Copied: www/presentations/OSCER_2011/suli.pdf (from rev 4859, www/presentations/SULI_2011/suli.pdf) =================================================================== (Binary files differ) Deleted: www/presentations/OSCER_2011/suli.pptx =================================================================== (Binary files differ) Copied: www/presentations/OSCER_2011/suli.pptx (from rev 4859, www/presentations/SULI_2011/suli.pptx) =================================================================== (Binary files differ) From wozniak at ci.uchicago.edu Tue Oct 11 14:07:53 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Tue, 11 Oct 2011 14:07:53 -0500 (CDT) Subject: [Swift-commit] r5218 - www/presentations/OSCER_2011 Message-ID: <20111011190753.8DF249CCCB@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-11 14:07:53 -0500 (Tue, 11 Oct 2011) New Revision: 5218 Added: www/presentations/OSCER_2011/mpich-coasters.odg Log: Bring this in from ExM JSC paper Added: www/presentations/OSCER_2011/mpich-coasters.odg =================================================================== (Binary files differ) Property changes on: www/presentations/OSCER_2011/mpich-coasters.odg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream From wozniak at ci.uchicago.edu Tue Oct 11 14:13:16 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Tue, 11 Oct 2011 14:13:16 -0500 (CDT) Subject: [Swift-commit] r5219 - www/presentations/OSCER_2011 Message-ID: <20111011191316.F31489CCCB@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-11 14:13:16 -0500 (Tue, 11 Oct 2011) New Revision: 5219 Added: www/presentations/OSCER_2011/rem-async.odg Log: Bring this in from ExM JSC Added: www/presentations/OSCER_2011/rem-async.odg =================================================================== (Binary files differ) Property changes on: www/presentations/OSCER_2011/rem-async.odg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream From wozniak at ci.uchicago.edu Wed Oct 12 11:54:38 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Wed, 12 Oct 2011 11:54:38 -0500 (CDT) Subject: [Swift-commit] r5220 - trunk/libexec/log-processing Message-ID: <20111012165438.BBD6E9CCC8@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-12 11:54:38 -0500 (Wed, 12 Oct 2011) New Revision: 5220 Modified: trunk/libexec/log-processing/README.txt Log: More README connections Modified: trunk/libexec/log-processing/README.txt =================================================================== --- trunk/libexec/log-processing/README.txt 2011-10-11 19:13:16 UTC (rev 5219) +++ trunk/libexec/log-processing/README.txt 2011-10-12 16:54:38 UTC (rev 5220) @@ -1,21 +1,21 @@ Log Processing ============== -To properly generate log plots, you must enable VDL/Karajan logging. -TODO:How? - You should check the scripts that you intend to use to determine what log lines they require and ensure that you are generating -those lines via log4j.properties +those lines via +swift/etc/log4j.properties+. -Make sure log4.properties contains: +To properly generate log plots, you must enable VDL/Karajan logging. +Make sure +log4.properties+ contains: -------------------------------------- log4j.logger.swift=DEBUG log4j.logger.org.globus.cog.abstraction.coaster.service.job.manager.Cpu=DEBUG log4j.logger.org.globus.cog.abstraction.coaster.service.job.manager.Block=DEBUG -------------------------------------- -TODO: Does it work for coasters-based runs only? +The script programs referred to below are in ++swift/libexec/log-processing+. + Normalize event times in the log to the run start time ------------------------------------------------------ @@ -25,7 +25,6 @@ ./iso-to-secs < original.log > swift-run.log ------------------------------------------ - * Generate the log, assuming the log is titled +swift-run.log+ ------------------------------------------ @@ -57,9 +56,8 @@ . Build up a completed data file: + ------------------------------------------ -./cpu-job-completed.pl < swift-run.norm > completed.data +./cpu-job-complete.pl < swift-run.norm > completed.data ------------------------------------------ -TODO: This file: cpu-job-completed seems to be missing . Plot with the JFreeChart-based plotter in usertools/plotter: + @@ -107,23 +105,22 @@ swift_plotter.zsh -s buckets.cfg buckets.eps buckets.data ------------------------------------------ -Utilities -^^^^^^^^^ +== Utilities -* +iso-to-secs+ ++iso-to-secs+:: Convert human-readable log dates to Unix time -* +extract-start-time+ ++extract-start-time+:: Pull out the first Unix timestamp from the log file -* +normalise-event-start-time+ ++normalise-event-start-time+:: Convert Unix seconds to seconds from start time, given a start time file -* +normalise-event-start-time-to-any+ ++normalise-event-start-time-to-any+:: Convert Unix seconds to seconds from start time, given a start time number -* +sec-to-hour.pl+ ++sec-to-hour.pl+:: Convert seconds to hours in the Unix time column. -* +sec-to-min.pl+ ++sec-to-min.pl+:: Convert seconds to minutes in the Unix time column. From wozniak at ci.uchicago.edu Wed Oct 12 12:59:16 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Wed, 12 Oct 2011 12:59:16 -0500 (CDT) Subject: [Swift-commit] r5221 - www/presentations/OSCER_2011 Message-ID: <20111012175916.5FB799CCC8@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-12 12:59:16 -0500 (Wed, 12 Oct 2011) New Revision: 5221 Added: www/presentations/OSCER_2011/mpich-coasters.png www/presentations/OSCER_2011/namd-load-1024.png www/presentations/OSCER_2011/orig-namd-load-1024.png www/presentations/OSCER_2011/rem-async.png Modified: www/presentations/OSCER_2011/mpich-coasters.odg www/presentations/OSCER_2011/rem-async.odg www/presentations/OSCER_2011/suli.pptx Log: Complete version Modified: www/presentations/OSCER_2011/mpich-coasters.odg =================================================================== (Binary files differ) Added: www/presentations/OSCER_2011/mpich-coasters.png =================================================================== (Binary files differ) Property changes on: www/presentations/OSCER_2011/mpich-coasters.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: www/presentations/OSCER_2011/namd-load-1024.png =================================================================== (Binary files differ) Property changes on: www/presentations/OSCER_2011/namd-load-1024.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: www/presentations/OSCER_2011/orig-namd-load-1024.png =================================================================== (Binary files differ) Property changes on: www/presentations/OSCER_2011/orig-namd-load-1024.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: www/presentations/OSCER_2011/rem-async.odg =================================================================== (Binary files differ) Added: www/presentations/OSCER_2011/rem-async.png =================================================================== (Binary files differ) Property changes on: www/presentations/OSCER_2011/rem-async.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: www/presentations/OSCER_2011/suli.pptx =================================================================== (Binary files differ) From wozniak at ci.uchicago.edu Wed Oct 12 13:02:26 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Wed, 12 Oct 2011 13:02:26 -0500 (CDT) Subject: [Swift-commit] r5222 - www/presentations/OSCER_2011 Message-ID: <20111012180226.3C89F9CCC8@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-12 13:02:26 -0500 (Wed, 12 Oct 2011) New Revision: 5222 Added: www/presentations/OSCER_2011/oscer-examples.tgz www/presentations/OSCER_2011/oscer.pdf www/presentations/OSCER_2011/oscer.pptx Removed: www/presentations/OSCER_2011/suli-examples.tgz www/presentations/OSCER_2011/suli.pdf www/presentations/OSCER_2011/suli.pptx Log: Rename to OSCER Copied: www/presentations/OSCER_2011/oscer-examples.tgz (from rev 5217, www/presentations/OSCER_2011/suli-examples.tgz) =================================================================== (Binary files differ) Copied: www/presentations/OSCER_2011/oscer.pdf (from rev 5217, www/presentations/OSCER_2011/suli.pdf) =================================================================== (Binary files differ) Copied: www/presentations/OSCER_2011/oscer.pptx (from rev 5221, www/presentations/OSCER_2011/suli.pptx) =================================================================== (Binary files differ) Deleted: www/presentations/OSCER_2011/suli-examples.tgz =================================================================== (Binary files differ) Deleted: www/presentations/OSCER_2011/suli.pdf =================================================================== (Binary files differ) Deleted: www/presentations/OSCER_2011/suli.pptx =================================================================== (Binary files differ) From wozniak at ci.uchicago.edu Wed Oct 12 13:44:37 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Wed, 12 Oct 2011 13:44:37 -0500 (CDT) Subject: [Swift-commit] r5223 - in www/presentations/OSCER_2011: . examples Message-ID: <20111012184437.969459CCC8@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-12 13:44:37 -0500 (Wed, 12 Oct 2011) New Revision: 5223 Added: www/presentations/OSCER_2011/examples/ www/presentations/OSCER_2011/examples/01-app.swift www/presentations/OSCER_2011/examples/02-function.swift www/presentations/OSCER_2011/examples/03-wrapper.swift www/presentations/OSCER_2011/examples/04-arrays.swift www/presentations/OSCER_2011/examples/05-regexp.swift www/presentations/OSCER_2011/examples/06-filesys.swift www/presentations/OSCER_2011/examples/agenda.txt www/presentations/OSCER_2011/examples/annotate.sh www/presentations/OSCER_2011/examples/clean.sh www/presentations/OSCER_2011/examples/franklin.jpg www/presentations/OSCER_2011/examples/input.txt www/presentations/OSCER_2011/examples/input0.txt www/presentations/OSCER_2011/examples/input1.txt www/presentations/OSCER_2011/examples/input2.txt www/presentations/OSCER_2011/examples/script1.sh www/presentations/OSCER_2011/examples/script2.sh Removed: www/presentations/OSCER_2011/oscer-examples.tgz Log: Check in scripts; drop TGZ Added: www/presentations/OSCER_2011/examples/01-app.swift =================================================================== --- www/presentations/OSCER_2011/examples/01-app.swift (rev 0) +++ www/presentations/OSCER_2011/examples/01-app.swift 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,12 @@ + +type file; + +app (file o) copy (file i) +{ + cp @i @o; +} + +file input<"input.txt">; +file output<"output.txt"> = copy(input); + +// Lines may be reversed Added: www/presentations/OSCER_2011/examples/02-function.swift =================================================================== --- www/presentations/OSCER_2011/examples/02-function.swift (rev 0) +++ www/presentations/OSCER_2011/examples/02-function.swift 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,19 @@ + +type file; + +app (file o) copy(file i) +{ + cp @i @o; +} + +(string name) makeFileName() +{ + name = @strcat("input", ".txt"); + tracef("FILENAME: %s\n", name); +} + +string s = makeFileName(); + +file input; +file output<"output.txt"> = copy(input); + Added: www/presentations/OSCER_2011/examples/03-wrapper.swift =================================================================== --- www/presentations/OSCER_2011/examples/03-wrapper.swift (rev 0) +++ www/presentations/OSCER_2011/examples/03-wrapper.swift 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,14 @@ + +type file; + +app (file o1, file o2, file log) script(file i1, file i2) +{ + script1 @i1 @i2 @o1 @o2 stdout=@log; +} + +file input1<"input1.txt">; +file input2<"input2.txt">; +file output1<"output1.txt">; +file output2<"output2.txt">; +file log<"log.txt">; +(output1, output2, log) = script(input1, input2); Added: www/presentations/OSCER_2011/examples/04-arrays.swift =================================================================== --- www/presentations/OSCER_2011/examples/04-arrays.swift (rev 0) +++ www/presentations/OSCER_2011/examples/04-arrays.swift 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,30 @@ + +type file; + +app (file o, file log) script(file i[]) +{ + script2 @filenames(i) @o stdout=@log; +} + +(file result) noop() +{} + +(string result[]) makeFilenames() +{ + foreach i in [0:1] + { + string s = @strcat("input", i, ".txt"); + result[i] = s; + } +} + +string a[] = makeFilenames(); +file input[]; +foreach f, i in a +{ + tracef("FILENAME: %s\n", f); +} + +file output<"output.txt">; +file log<"log.txt">; +(output, log) = script(input); Added: www/presentations/OSCER_2011/examples/05-regexp.swift =================================================================== --- www/presentations/OSCER_2011/examples/05-regexp.swift (rev 0) +++ www/presentations/OSCER_2011/examples/05-regexp.swift 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,32 @@ + +type file; + +app (file o) convert (file i) +{ + convert @i @o; +} + +app (file o) rotate(int d, file i) +{ + convert "-rotate" d @i @o; +} + +file franklin_jpg<"franklin.jpg">; +file franklin_png; + +tracef("JPG: %M\n", franklin_jpg); +tracef("PNG: %M\n", franklin_png); + +franklin_png = convert(franklin_jpg); + +foreach i in [1:5] +{ + int d = i*60; + string s = @strcat("franklin-", d, ".png"); + tracef("ROTATE: %s\n", s); + file f = rotate(d, franklin_png); +} + Added: www/presentations/OSCER_2011/examples/06-filesys.swift =================================================================== --- www/presentations/OSCER_2011/examples/06-filesys.swift (rev 0) +++ www/presentations/OSCER_2011/examples/06-filesys.swift 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,44 @@ + +type file; + +app (file o) annotate(int d, file i) +{ + annotate @i d @o; +} + +app (file o) makelog(int d, file i) +{ + echo "degrees:" d stdout=@o; +} + +file franklin_pngs[]; + +file franklin_notes[]; + +file franklin_logs[]; + +foreach f,i in franklin_pngs +{ + tracef("ANNOTATE: %M -> %M\n", franklin_pngs[i], franklin_notes[i]); + string s = @filename(f); + string n = @strcut(s, "franklin-(.*).png"); + int d = @toint(n); + franklin_notes[i] = annotate(d, franklin_pngs[i]); +} + +foreach p,j in franklin_notes +{ + tracef("LOG: %M -> %M\n", franklin_notes[j], franklin_logs[j]); + string s = @filename(p); + string n = @strcut(s, "franklin-(.*)-note.png"); + int d = @toint(n); + franklin_logs[j] = makelog(d, franklin_notes[j]); +} Added: www/presentations/OSCER_2011/examples/agenda.txt =================================================================== --- www/presentations/OSCER_2011/examples/agenda.txt (rev 0) +++ www/presentations/OSCER_2011/examples/agenda.txt 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,23 @@ + +01 + basic script elements + how to run + demonstrate re-ordering + +02 + functions + strcat - built-in functions + (arithmetic) + +03 + demonstrate tc file + demonstrate stdout logging + +04 + demonstrate arrays, foreach + +05 + demonstrate regexp + +06 + demonstrate producer-consumer, concurrency Added: www/presentations/OSCER_2011/examples/annotate.sh =================================================================== --- www/presentations/OSCER_2011/examples/annotate.sh (rev 0) +++ www/presentations/OSCER_2011/examples/annotate.sh 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,22 @@ +#!/bin/bash + +set -x + +date "+%m/%d/%Y %I:%M%p" + +{ + INPUT=$1 + DEGREES=$2 + OUTPUT=$3 + + sleep $(( $DEGREES / 60 )) + + convert $INPUT \ + -stroke "#000C" \ + -pointsize 24 \ + -gravity northwest \ + -fill blue \ + -annotate +20+20 $DEGREES $OUTPUT || exit 1 +} 2>&1 + +exit 0 Property changes on: www/presentations/OSCER_2011/examples/annotate.sh ___________________________________________________________________ Added: svn:executable + * Added: www/presentations/OSCER_2011/examples/clean.sh =================================================================== --- www/presentations/OSCER_2011/examples/clean.sh (rev 0) +++ www/presentations/OSCER_2011/examples/clean.sh 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,5 @@ +#!/bin/sh + +rm -rfv *.log *.rlog *.kml *.xml *.d +rm -fv output*.txt log*.txt +rm -fv franklin*.png franklin*.txt Property changes on: www/presentations/OSCER_2011/examples/clean.sh ___________________________________________________________________ Added: svn:executable + * Added: www/presentations/OSCER_2011/examples/franklin.jpg =================================================================== (Binary files differ) Property changes on: www/presentations/OSCER_2011/examples/franklin.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: www/presentations/OSCER_2011/examples/input.txt =================================================================== Added: www/presentations/OSCER_2011/examples/input0.txt =================================================================== Added: www/presentations/OSCER_2011/examples/input1.txt =================================================================== Added: www/presentations/OSCER_2011/examples/input2.txt =================================================================== --- www/presentations/OSCER_2011/examples/input2.txt (rev 0) +++ www/presentations/OSCER_2011/examples/input2.txt 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1 @@ +DATA2 Added: www/presentations/OSCER_2011/examples/script1.sh =================================================================== --- www/presentations/OSCER_2011/examples/script1.sh (rev 0) +++ www/presentations/OSCER_2011/examples/script1.sh 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,18 @@ +#!/bin/bash + +set -x + +date "+%m/%d/%Y %I:%M%p" + +{ + INPUT1=$1 + INPUT2=$2 + OUTPUT1=$3 + OUTPUT2=$4 + + cat $INPUT1 $INPUT2 || exit 1 + + touch $OUTPUT1 $OUTPUT2 || exit 1 +} 2>&1 + +exit 0 Property changes on: www/presentations/OSCER_2011/examples/script1.sh ___________________________________________________________________ Added: svn:executable + * Added: www/presentations/OSCER_2011/examples/script2.sh =================================================================== --- www/presentations/OSCER_2011/examples/script2.sh (rev 0) +++ www/presentations/OSCER_2011/examples/script2.sh 2011-10-12 18:44:37 UTC (rev 5223) @@ -0,0 +1,19 @@ +#!/bin/bash + +echo "COMMAND: $0 $*" + +set -x + +date "+%m/%d/%Y %I:%M%p" + +{ + INPUT1=$1 + INPUT2=$2 + OUTPUT=$3 + + cat $INPUT1 $INPUT2 || exit 1 + + touch $OUTPUT || exit 1 +} 2>&1 + +exit 0 Property changes on: www/presentations/OSCER_2011/examples/script2.sh ___________________________________________________________________ Added: svn:executable + * Deleted: www/presentations/OSCER_2011/oscer-examples.tgz =================================================================== (Binary files differ) From wozniak at ci.uchicago.edu Wed Oct 12 13:53:30 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Wed, 12 Oct 2011 13:53:30 -0500 (CDT) Subject: [Swift-commit] r5224 - www/presentations/OSCER_2011/examples Message-ID: <20111012185330.64EF19CCC8@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-12 13:53:30 -0500 (Wed, 12 Oct 2011) New Revision: 5224 Modified: www/presentations/OSCER_2011/examples/input.txt www/presentations/OSCER_2011/examples/input0.txt www/presentations/OSCER_2011/examples/input1.txt www/presentations/OSCER_2011/examples/input2.txt Log: Put some data in the input files Modified: www/presentations/OSCER_2011/examples/input.txt =================================================================== --- www/presentations/OSCER_2011/examples/input.txt 2011-10-12 18:44:37 UTC (rev 5223) +++ www/presentations/OSCER_2011/examples/input.txt 2011-10-12 18:53:30 UTC (rev 5224) @@ -0,0 +1 @@ +DATA Modified: www/presentations/OSCER_2011/examples/input0.txt =================================================================== --- www/presentations/OSCER_2011/examples/input0.txt 2011-10-12 18:44:37 UTC (rev 5223) +++ www/presentations/OSCER_2011/examples/input0.txt 2011-10-12 18:53:30 UTC (rev 5224) @@ -0,0 +1 @@ +DATA 0 Modified: www/presentations/OSCER_2011/examples/input1.txt =================================================================== --- www/presentations/OSCER_2011/examples/input1.txt 2011-10-12 18:44:37 UTC (rev 5223) +++ www/presentations/OSCER_2011/examples/input1.txt 2011-10-12 18:53:30 UTC (rev 5224) @@ -0,0 +1 @@ +DATA 1 Modified: www/presentations/OSCER_2011/examples/input2.txt =================================================================== --- www/presentations/OSCER_2011/examples/input2.txt 2011-10-12 18:44:37 UTC (rev 5223) +++ www/presentations/OSCER_2011/examples/input2.txt 2011-10-12 18:53:30 UTC (rev 5224) @@ -1 +1 @@ -DATA2 +DATA 2 From ketan at ci.uchicago.edu Wed Oct 12 14:58:24 2011 From: ketan at ci.uchicago.edu (ketan at ci.uchicago.edu) Date: Wed, 12 Oct 2011 14:58:24 -0500 (CDT) Subject: [Swift-commit] r5225 - trunk/bin/grid Message-ID: <20111012195824.7D1C19CCC8@svn.ci.uchicago.edu> Author: ketan Date: 2011-10-12 14:58:24 -0500 (Wed, 12 Oct 2011) New Revision: 5225 Modified: trunk/bin/grid/foreachsite trunk/bin/grid/mk_catalog.rb trunk/bin/grid/my-swift-workers trunk/bin/grid/ress.rb Log: Modified: trunk/bin/grid/foreachsite =================================================================== --- trunk/bin/grid/foreachsite 2011-10-12 18:53:30 UTC (rev 5224) +++ trunk/bin/grid/foreachsite 2011-10-12 19:58:24 UTC (rev 5225) @@ -66,7 +66,6 @@ queue END - condor_submit condor.sub ) done Modified: trunk/bin/grid/mk_catalog.rb =================================================================== --- trunk/bin/grid/mk_catalog.rb 2011-10-12 18:53:30 UTC (rev 5224) +++ trunk/bin/grid/mk_catalog.rb 2011-10-12 19:58:24 UTC (rev 5225) @@ -146,7 +146,8 @@ ] def ress_query(class_ads) - cmd = "condor_status -pool engage-submit.renci.org" + cmd = "condor_status -pool engage-central.renci.org" + #cmd = "condor_status -pool osg-ress-1.fnal.gov" class_ads[0..-2].each do |class_ad| cmd << " -format \"%s|\" #{class_ad}" end Modified: trunk/bin/grid/my-swift-workers =================================================================== --- trunk/bin/grid/my-swift-workers 2011-10-12 18:53:30 UTC (rev 5224) +++ trunk/bin/grid/my-swift-workers 2011-10-12 19:58:24 UTC (rev 5225) @@ -22,7 +22,7 @@ class Site - attr_accessor :grid_resource, :gridftp, :data_dir, :app_dir, :name, :port + attr_accessor :grid_resource, :gridftp, :data_dir, :app_dir, :name, :sport, :wport attr_reader :submit_file # **Ketan: Generate the worker job @@ -49,7 +49,7 @@ globus_rsl = (maxwalltime=240) grid_resource = <%= @grid_resource %> executable = #{workerWrapper} - arguments = #{workerContact} <%= @name.gsub(/__.*/,"") %> /tmp + arguments = #{workerContact}:<%= @wport.to_i %> <%= @name.gsub(/__.*/,"") %> /tmp environment = WORKER_LOGGING_LEVEL=INFO Input = #{workerExecutable} Error = condor/$(Process).err @@ -93,7 +93,6 @@ $VERBOSE=ov jobs.split(" ").size end - end =begin @@ -200,12 +199,14 @@ site = Site.new site.name = name site.grid_resource = "gt2 #{value.url}/jobmanager-#{value.jm}" + #site.grid_resource = "gt2 #{value.url}/jobmanager-fork" site.gridftp = "gsiftp://#{value.url}" site.app_dir = value.app_dir site.data_dir = value.data_dir #site.port = start_port + ctr - site.port = service_ports[ctr] #**Ketan: assuming this is the worker that needs to connect back to its corresponding service - + site.sport = service_ports[ctr] #**Ketan: assuming this is the worker that needs to connect back to its corresponding service + site.wport = worker_ports[ctr] + sites.push site # **Ketan: can put the coasters_osg.xml template right here. @@ -219,12 +220,12 @@ sitename = asite.name %> - + passive 10000 2.99 16 - + <%=data_dir%>/swift_scratch <% ctr += 1 @@ -332,6 +333,5 @@ r=50 q=25 =end - #dump("coaster_osg.xml", coaster_sites, binding) Modified: trunk/bin/grid/ress.rb =================================================================== --- trunk/bin/grid/ress.rb 2011-10-12 18:53:30 UTC (rev 5224) +++ trunk/bin/grid/ress.rb 2011-10-12 19:58:24 UTC (rev 5225) @@ -47,9 +47,7 @@ value.app_dir += dir_suffix value.data_dir += dir_suffix end - yield name, value end end - From tga at ci.uchicago.edu Wed Oct 12 20:59:21 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Wed, 12 Oct 2011 20:59:21 -0500 (CDT) Subject: [Swift-commit] r5226 - in SwiftApps/SwiftR/Swift: . src Message-ID: <20111013015921.58A249CCC8@svn.ci.uchicago.edu> Author: tga Date: 2011-10-12 20:59:21 -0500 (Wed, 12 Oct 2011) New Revision: 5226 Modified: SwiftApps/SwiftR/Swift/DESCRIPTION SwiftApps/SwiftR/Swift/src/make.include Log: Version 0.3.1 for cran release Modified: SwiftApps/SwiftR/Swift/DESCRIPTION =================================================================== --- SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-12 19:58:24 UTC (rev 5225) +++ SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-13 01:59:21 UTC (rev 5226) @@ -1,12 +1,12 @@ Package: Swift Type: Package Title: R interface to Swift parallel scripting languaage -Version: 0.3.0 -Date: 2011-09-30 +Version: 0.3.1 +Date: 2011-10-12 Author: Michael Wilde Maintainer: Michael Wilde Description: Routines to invoke R functions on remote resources through Swift. License: Apache License LazyLoad: yes -Packaged: 2011-09-30; Tim Armstrong +Packaged: 2011-10-12; Tim Armstrong Modified: SwiftApps/SwiftR/Swift/src/make.include =================================================================== --- SwiftApps/SwiftR/Swift/src/make.include 2011-10-12 19:58:24 UTC (rev 5225) +++ SwiftApps/SwiftR/Swift/src/make.include 2011-10-13 01:59:21 UTC (rev 5226) @@ -2,5 +2,5 @@ SWIFT_SRC_TAG = release-0.92.1 COG_SRC_TAG = swift_0.92.1 -SWIFT_SRC_NAME = swift-0.92.1-SwiftR-r1 +SWIFT_SRC_NAME = swift-0.92.1-SwiftR-r2 SWIFT_SRC_PATCH = swift-0.92.1-changes.patch From wozniak at ci.uchicago.edu Thu Oct 13 13:55:18 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Thu, 13 Oct 2011 13:55:18 -0500 (CDT) Subject: [Swift-commit] r5227 - trunk/src/org/griphyn/vdl/karajan Message-ID: <20111013185518.EAB6E9CCE5@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-13 13:55:18 -0500 (Thu, 13 Oct 2011) New Revision: 5227 Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java Log: Replace 0.93 message with TRUNK Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java =================================================================== --- trunk/src/org/griphyn/vdl/karajan/Loader.java 2011-10-13 01:59:21 UTC (rev 5226) +++ trunk/src/org/griphyn/vdl/karajan/Loader.java 2011-10-13 18:55:18 UTC (rev 5227) @@ -81,7 +81,7 @@ public static void main(String[] argv) { logger.debug("Swift started"); - logger.info("Swift version: 0.93"); + logger.info("Swift version: TRUNK"); ArgumentParser ap = buildArgumentParser(); String project = null; try { From wozniak at ci.uchicago.edu Thu Oct 13 14:02:45 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Thu, 13 Oct 2011 14:02:45 -0500 (CDT) Subject: [Swift-commit] r5228 - www/presentations/OSCER_2011/examples Message-ID: <20111013190245.7D4D49CCE5@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-13 14:02:45 -0500 (Thu, 13 Oct 2011) New Revision: 5228 Modified: www/presentations/OSCER_2011/examples/04-arrays.swift Log: Drop noop() Modified: www/presentations/OSCER_2011/examples/04-arrays.swift =================================================================== --- www/presentations/OSCER_2011/examples/04-arrays.swift 2011-10-13 18:55:18 UTC (rev 5227) +++ www/presentations/OSCER_2011/examples/04-arrays.swift 2011-10-13 19:02:45 UTC (rev 5228) @@ -6,9 +6,6 @@ script2 @filenames(i) @o stdout=@log; } -(file result) noop() -{} - (string result[]) makeFilenames() { foreach i in [0:1] From wozniak at ci.uchicago.edu Thu Oct 13 14:23:06 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Thu, 13 Oct 2011 14:23:06 -0500 (CDT) Subject: [Swift-commit] r5229 - trunk/src/org/griphyn/vdl/karajan Message-ID: <20111013192306.728059CCE5@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-13 14:23:06 -0500 (Thu, 13 Oct 2011) New Revision: 5229 Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java Log: Drop unintended debugging line Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java =================================================================== --- trunk/src/org/griphyn/vdl/karajan/Loader.java 2011-10-13 19:02:45 UTC (rev 5228) +++ trunk/src/org/griphyn/vdl/karajan/Loader.java 2011-10-13 19:23:06 UTC (rev 5229) @@ -369,7 +369,6 @@ "etc" + File.separator + "sites.xml"; String poolFile = config.getPoolFile(); - System.out.println(defaultPoolFile); if (poolFile.equals(defaultPoolFile)) { Logger textLogger = Logger.getLogger("swift.textfiles"); textLogger.debug("using default sites file"); From wozniak at ci.uchicago.edu Thu Oct 13 14:54:53 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Thu, 13 Oct 2011 14:54:53 -0500 (CDT) Subject: [Swift-commit] r5230 - trunk/src/org/griphyn/vdl/engine Message-ID: <20111013195453.51A549CCE5@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-13 14:54:53 -0500 (Thu, 13 Oct 2011) New Revision: 5230 Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java Log: Demote XML validation message Modified: trunk/src/org/griphyn/vdl/engine/Karajan.java =================================================================== --- trunk/src/org/griphyn/vdl/engine/Karajan.java 2011-10-13 19:23:06 UTC (rev 5229) +++ trunk/src/org/griphyn/vdl/engine/Karajan.java 2011-10-13 19:54:53 UTC (rev 5230) @@ -130,7 +130,7 @@ programDoc = ProgramDocument.Factory.parse(new File(defs), options); if(programDoc.validate(options)) { - logger.info("Validation of XML intermediate file was successful"); + logger.debug("Validation of XML intermediate file was successful"); } else { logger.warn("Validation of XML intermediate file failed."); logger.warn("Validation errors:"); From wozniak at ci.uchicago.edu Thu Oct 13 14:55:45 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Thu, 13 Oct 2011 14:55:45 -0500 (CDT) Subject: [Swift-commit] r5231 - trunk/src/org/griphyn/vdl/karajan Message-ID: <20111013195545.940319CCE5@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-13 14:55:45 -0500 (Thu, 13 Oct 2011) New Revision: 5231 Modified: trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java Log: Demote stack dump but retain swift.home Modified: trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java =================================================================== --- trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java 2011-10-13 19:54:53 UTC (rev 5230) +++ trunk/src/org/griphyn/vdl/karajan/VDL2ExecutionContext.java 2011-10-13 19:55:45 UTC (rev 5231) @@ -63,9 +63,11 @@ } public void start(VariableStack stack) { - if (logger.isInfoEnabled()) { - logger.info(stack); + if (logger.isDebugEnabled()) { + logger.debug(stack); } + logger.info("swift.home = " + + System.getProperty("swift.home")); super.start(stack); } } From wozniak at ci.uchicago.edu Thu Oct 13 14:56:42 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Thu, 13 Oct 2011 14:56:42 -0500 (CDT) Subject: [Swift-commit] r5232 - in trunk: libexec src/org/griphyn/vdl/karajan Message-ID: <20111013195642.D7A309CCE5@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-13 14:56:42 -0500 (Thu, 13 Oct 2011) New Revision: 5232 Modified: trunk/libexec/vdl.k trunk/src/org/griphyn/vdl/karajan/Loader.java Log: Log Swift version after logging has been initialized Modified: trunk/libexec/vdl.k =================================================================== --- trunk/libexec/vdl.k 2011-10-13 19:55:45 UTC (rev 5231) +++ trunk/libexec/vdl.k 2011-10-13 19:56:42 UTC (rev 5232) @@ -20,6 +20,8 @@ log("info",sys:file:read("{swift.home}/libexec/version.txt")) echo(sys:file:read("{swift.home}/libexec/version.txt")) + log(LOG:INFO, "Swift version: TRUNK") + log("info","RUNID id=run:{VDL:RUNID}") echo("RunID: {VDL:RUNID}") ) Modified: trunk/src/org/griphyn/vdl/karajan/Loader.java =================================================================== --- trunk/src/org/griphyn/vdl/karajan/Loader.java 2011-10-13 19:55:45 UTC (rev 5231) +++ trunk/src/org/griphyn/vdl/karajan/Loader.java 2011-10-13 19:56:42 UTC (rev 5232) @@ -81,7 +81,6 @@ public static void main(String[] argv) { logger.debug("Swift started"); - logger.info("Swift version: TRUNK"); ArgumentParser ap = buildArgumentParser(); String project = null; try { From wozniak at ci.uchicago.edu Fri Oct 14 14:51:21 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Fri, 14 Oct 2011 14:51:21 -0500 (CDT) Subject: [Swift-commit] r5233 - www/presentations/OSCER_2011 Message-ID: <20111014195121.A8C229CD04@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-14 14:51:21 -0500 (Fri, 14 Oct 2011) New Revision: 5233 Modified: www/presentations/OSCER_2011/oscer.pptx Log: Presented version Modified: www/presentations/OSCER_2011/oscer.pptx =================================================================== (Binary files differ) From wozniak at ci.uchicago.edu Fri Oct 14 14:53:48 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Fri, 14 Oct 2011 14:53:48 -0500 (CDT) Subject: [Swift-commit] r5234 - www/presentations/OSCER_2011 Message-ID: <20111014195348.E12079CD04@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-14 14:53:48 -0500 (Fri, 14 Oct 2011) New Revision: 5234 Modified: www/presentations/OSCER_2011/oscer.pdf Log: PDF version for OSCER web site Modified: www/presentations/OSCER_2011/oscer.pdf =================================================================== (Binary files differ) From ketan at ci.uchicago.edu Sun Oct 16 12:38:35 2011 From: ketan at ci.uchicago.edu (ketan at ci.uchicago.edu) Date: Sun, 16 Oct 2011 12:38:35 -0500 (CDT) Subject: [Swift-commit] r5235 - branches/release-0.93/docs/siteguide Message-ID: <20111016173835.346279CD1C@svn.ci.uchicago.edu> Author: ketan Date: 2011-10-16 12:38:35 -0500 (Sun, 16 Oct 2011) New Revision: 5235 Modified: branches/release-0.93/docs/siteguide/beagle Log: Modified: branches/release-0.93/docs/siteguide/beagle =================================================================== --- branches/release-0.93/docs/siteguide/beagle 2011-10-14 19:53:48 UTC (rev 5234) +++ branches/release-0.93/docs/siteguide/beagle 2011-10-16 17:38:35 UTC (rev 5235) @@ -71,6 +71,10 @@ CI-CCR000013 24:cray:pack + + 24 50000 From davidk at ci.uchicago.edu Mon Oct 17 10:42:12 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Mon, 17 Oct 2011 10:42:12 -0500 (CDT) Subject: [Swift-commit] r5236 - in branches/release-0.93/tests/stress/persistent-coasters: . mcs mcs/10x10 mcs/500x10 Message-ID: <20111017154212.856E59CCC9@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-17 10:42:12 -0500 (Mon, 17 Oct 2011) New Revision: 5236 Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/ branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/ branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.swift branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/coaster-service.conf branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/gendata.pl branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/ branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.swift branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/coaster-service.conf branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/gendata.pl Log: MCS persistent coaster / provider staging tests Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,17 @@ +#!/bin/bash + +for file in `ls data/tmp.*|grep -v out` +do + if [ ! -f "$file.out" ]; then + echo $file.out was not created + exit 1 + fi + + FILE_SUM=`sum $data/$file` + OUT_SUM=`sum $data/$file.out` + + if [ "$FILE_SUM" != "$OUT_SUM" ]; then + echo Checksums of $file and $file.out are not the same + exit 1 + fi +done Property changes on: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,4 @@ +#!/bin/bash + +rm data/tmp.* +stop-coaster-service Property changes on: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,18 @@ +#!/bin/bash + +NUMFILES=10 +FILESIZE=10 +FILESIZE=$(($FILESIZE*1000000)) + +if [ -n "$GROUP" ]; then + cp $RUNDIR/* . +fi + +mkdir -p data +for count in `seq 1 $NUMFILES` +do + FILENAME=`mktemp -p data` + ./gendata.pl $FILESIZE > $FILENAME +done + +start-coaster-service Property changes on: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.swift =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.swift (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/catsn_random.swift 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,13 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +file input_files[]; + +foreach j in input_files { + file output; + output = cat(j); +} Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/coaster-service.conf =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/coaster-service.conf (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/coaster-service.conf 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,43 @@ +# Keep all interesting settings in one place +# User should modify this to fit environment + +# Location of SWIFT. If empty, PATH is referenced +export SWIFT= + +# Where to place/launch worker.pl on the remote machine +export WORKER_WORK=/nfs/proj-davidk/swiftwork + +# How to launch workers: local, ssh, futuregrid, or cobalt +export WORKER_MODE=ssh +export WORKER_USERNAME=$USER + +# Worker host names for ssh +export WORKER_HOSTS="crush.mcs.anl.gov thwomp.mcs.anl.gov stomp.mcs.anl.gov crank.mcs.anl.gov +steamroller.mcs.anl.gov grind.mcs.anl.gov churn.mcs.anl.gov trounce.mcs.anl.gov +thrash.mcs.anl.gov vanquish.mcs.anl.gov" + +# Directory to keep log files, relative to working directory when launching start-coaster-service +export LOG_DIR=logs + +# Manually define ports. If not specified, ports will be automatically generated +export LOCAL_PORT= +export SERVICE_PORT= + +# start-coaster-service tries to automatically detect IP address. +# Specify here if auto detection is not working correctly +export IPADDR= + +# Gensites values +export WORK=$HOME/work + +# If SHARED_FILESYSTEM is set to no, provider staging will be turned on +export SHARED_FILESYSTEM=no + +# If running outside of mcs network, set WORKER_RELAY_HOST below +# export WORKER_RELAY_HOST="login.mcs.anl.gov" + +export WORKER_LOGGING_LEVEL=DEBUG +export WORKER_LOG_DIR="/nfs/proj-davidk/logs" + +# Set applications here +#app cat=/bin/cat Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/gendata.pl =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/gendata.pl (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/gendata.pl 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use strict; + +my @characters=('a'..'z', 'A'..'Z', '0'..'9'); +my $string=""; +my $length = $ARGV[0]; +my $width_count=0; + +foreach (1..$length) +{ + if($width_count == 80) { + $string .= "\n"; + $width_count=0; + next; + } + $string .= $characters[rand @characters]; + $width_count++; +} + +print $string; Property changes on: branches/release-0.93/tests/stress/persistent-coasters/mcs/10x10/gendata.pl ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,17 @@ +#!/bin/bash + +for file in `ls data/tmp.*|grep -v out` +do + if [ ! -f "$file.out" ]; then + echo $file.out was not created + exit 1 + fi + + FILE_SUM=`sum $data/$file` + OUT_SUM=`sum $data/$file.out` + + if [ "$FILE_SUM" != "$OUT_SUM" ]; then + echo Checksums of $file and $file.out are not the same + exit 1 + fi +done Property changes on: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,4 @@ +#!/bin/bash + +rm data/tmp.* +stop-coaster-service Property changes on: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,18 @@ +#!/bin/bash + +NUMFILES=500 +FILESIZE=10 +FILESIZE=$(($FILESIZE*1000000)) + +if [ -n "$GROUP" ]; then + cp $RUNDIR/* . +fi + +mkdir -p data +for count in `seq 1 $NUMFILES` +do + FILENAME=`mktemp -p data` + ./gendata.pl $FILESIZE > $FILENAME +done + +start-coaster-service Property changes on: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.swift =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.swift (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/catsn_random.swift 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,13 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +file input_files[]; + +foreach j in input_files { + file output; + output = cat(j); +} Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/coaster-service.conf =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/coaster-service.conf (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/coaster-service.conf 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,43 @@ +# Keep all interesting settings in one place +# User should modify this to fit environment + +# Location of SWIFT. If empty, PATH is referenced +export SWIFT= + +# Where to place/launch worker.pl on the remote machine +export WORKER_WORK=/nfs/proj-davidk/swiftwork + +# How to launch workers: local, ssh, futuregrid, or cobalt +export WORKER_MODE=ssh +export WORKER_USERNAME=$USER + +# Worker host names for ssh +export WORKER_HOSTS="crush.mcs.anl.gov thwomp.mcs.anl.gov stomp.mcs.anl.gov crank.mcs.anl.gov +steamroller.mcs.anl.gov grind.mcs.anl.gov churn.mcs.anl.gov trounce.mcs.anl.gov +thrash.mcs.anl.gov vanquish.mcs.anl.gov" + +# Directory to keep log files, relative to working directory when launching start-coaster-service +export LOG_DIR=logs + +# Manually define ports. If not specified, ports will be automatically generated +export LOCAL_PORT= +export SERVICE_PORT= + +# start-coaster-service tries to automatically detect IP address. +# Specify here if auto detection is not working correctly +export IPADDR= + +# Gensites values +export WORK=$HOME/work + +# If SHARED_FILESYSTEM is set to no, provider staging will be turned on +export SHARED_FILESYSTEM=no + +# If running outside of mcs network, set WORKER_RELAY_HOST below +# export WORKER_RELAY_HOST="login.mcs.anl.gov" + +export WORKER_LOGGING_LEVEL=DEBUG +export WORKER_LOG_DIR="/nfs/proj-davidk/logs" + +# Set applications here +#app cat=/bin/cat Added: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/gendata.pl =================================================================== --- branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/gendata.pl (rev 0) +++ branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/gendata.pl 2011-10-17 15:42:12 UTC (rev 5236) @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use strict; + +my @characters=('a'..'z', 'A'..'Z', '0'..'9'); +my $string=""; +my $length = $ARGV[0]; +my $width_count=0; + +foreach (1..$length) +{ + if($width_count == 80) { + $string .= "\n"; + $width_count=0; + next; + } + $string .= $characters[rand @characters]; + $width_count++; +} + +print $string; Property changes on: branches/release-0.93/tests/stress/persistent-coasters/mcs/500x10/gendata.pl ___________________________________________________________________ Added: svn:executable + * From davidk at ci.uchicago.edu Mon Oct 17 10:44:28 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Mon, 17 Oct 2011 10:44:28 -0500 (CDT) Subject: [Swift-commit] r5237 - in trunk/tests: . groups stress stress/persistent-coasters stress/persistent-coasters/many-jobs stress/persistent-coasters/mcs stress/persistent-coasters/mcs/10x10 stress/persistent-coasters/mcs/500x10 stress/persistent-coasters/pass-fail-pass Message-ID: <20111017154428.B87479CCC9@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-17 10:44:28 -0500 (Mon, 17 Oct 2011) New Revision: 5237 Added: trunk/tests/groups/group-stress.sh trunk/tests/stress/ trunk/tests/stress/persistent-coasters/ trunk/tests/stress/persistent-coasters/many-jobs/ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0001.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.0002.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.0003.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.0004.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.0005.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.0006.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.0007.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.0008.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.0009.out.expected trunk/tests/stress/persistent-coasters/many-jobs/catsn.repeat trunk/tests/stress/persistent-coasters/many-jobs/catsn.setup.sh trunk/tests/stress/persistent-coasters/many-jobs/catsn.swift trunk/tests/stress/persistent-coasters/many-jobs/catsn.timeout trunk/tests/stress/persistent-coasters/many-jobs/coaster-service.conf trunk/tests/stress/persistent-coasters/many-jobs/data.txt trunk/tests/stress/persistent-coasters/mcs/ trunk/tests/stress/persistent-coasters/mcs/10x10/ trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.swift trunk/tests/stress/persistent-coasters/mcs/10x10/coaster-service.conf trunk/tests/stress/persistent-coasters/mcs/10x10/gendata.pl trunk/tests/stress/persistent-coasters/mcs/500x10/ trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.swift trunk/tests/stress/persistent-coasters/mcs/500x10/coaster-service.conf trunk/tests/stress/persistent-coasters/mcs/500x10/gendata.pl trunk/tests/stress/persistent-coasters/pass-fail-pass/ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0001.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0002.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0003.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0004.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0005.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0006.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0007.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0008.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0009.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.setup.sh trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.swift trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.timeout trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0001.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0002.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0003.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0004.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0005.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0006.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0007.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0008.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0009.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.swift trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0001.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0002.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0003.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0004.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0005.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0006.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0007.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0008.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0009.out.expected trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.setup.sh trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.swift trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.timeout trunk/tests/stress/persistent-coasters/pass-fail-pass/coaster-service.conf trunk/tests/stress/persistent-coasters/pass-fail-pass/data.txt trunk/tests/stress/persistent-coasters/pass-fail-pass/sites.template.xml Log: Adding stress tests to trunk Added: trunk/tests/groups/group-stress.sh =================================================================== --- trunk/tests/groups/group-stress.sh (rev 0) +++ trunk/tests/groups/group-stress.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,9 @@ + +# GROUPLIST definition to run all local tests + +GROUPLIST=( + $TESTDIR/stress/persistent-coasters/many-jobs \ + $TESTDIR/stress/persistent-coasters/pass-fail-pass \ + ) + +checkvars WORK Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0001.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0001.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0001.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0002.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0002.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0002.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0003.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0003.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0003.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0004.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0004.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0004.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0005.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0005.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0005.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0006.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0006.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0006.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0007.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0007.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0007.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0008.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0008.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0008.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.0009.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.0009.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.0009.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.repeat =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.repeat (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.repeat 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +1000 Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.setup.sh =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.setup.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.setup.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,4 @@ +#!/bin/bash + +cp $GROUP/coaster-service.conf . +cp $GROUP/data.txt . Property changes on: trunk/tests/stress/persistent-coasters/many-jobs/catsn.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.swift =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.swift (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.swift 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,12 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +file out[]; +foreach j in [1:@toint(@arg("n","10"))] { + file data<"data.txt">; + out[j] = cat(data); +} Added: trunk/tests/stress/persistent-coasters/many-jobs/catsn.timeout =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/catsn.timeout (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/catsn.timeout 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +999999 Added: trunk/tests/stress/persistent-coasters/many-jobs/coaster-service.conf =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/coaster-service.conf (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/coaster-service.conf 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,42 @@ +# Keep all interesting settings in one place +# User should modify this to fit environment + +# Location of SWIFT. If empty, PATH is searched +export SWIFT= + +# Where to copy worker.pl on the remote machine for sites.xml +export WORKER_WORK=$HOME/swiftwork + +# How to launch workers: local, ssh, cobalt, or futuregrid +export WORKER_MODE=ssh + +# SSH hosts to start workers on (ssh mode only) +export WORKER_HOSTS="localhost" + +# Do all the worker nodes you're using have a shared filesystem? (yes/no) +export SHARED_FILESYSTEM=yes + +# Username to use on worker nodes +export WORKER_USERNAME=$USER + +# Enable SSH tunneling? (yes/no) +export SSH_TUNNELING=no + +# Directory to keep log files, relative to working directory when launching start-coaster-service +export LOG_DIR=logs + +# Manually define ports. If not specified, an available port will be used +export LOCAL_PORT= +export SERVICE_PORT= + +# start-coaster-service tries to automatically detect the IP address of this system. Specify here if you have multiple network interfaces +export IPADDR= + +# Location of the swift-vm-boot scripts +export SWIFTVMBOOT_DIR=$HOME/swift-vm-boot + +# Swift information for creating sites.xml +export WORK=$HOME/swiftwork +export QUEUE=prod-devel +export MAXTIME=20 +export NODE=64 Added: trunk/tests/stress/persistent-coasters/many-jobs/data.txt =================================================================== --- trunk/tests/stress/persistent-coasters/many-jobs/data.txt (rev 0) +++ trunk/tests/stress/persistent-coasters/many-jobs/data.txt 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,17 @@ +#!/bin/bash + +for file in `ls data/tmp.*|grep -v out` +do + if [ ! -f "$file.out" ]; then + echo $file.out was not created + exit 1 + fi + + FILE_SUM=`sum $data/$file` + OUT_SUM=`sum $data/$file.out` + + if [ "$FILE_SUM" != "$OUT_SUM" ]; then + echo Checksums of $file and $file.out are not the same + exit 1 + fi +done Property changes on: trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.check.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,4 @@ +#!/bin/bash + +rm data/tmp.* +stop-coaster-service Property changes on: trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.clean.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,18 @@ +#!/bin/bash + +NUMFILES=10 +FILESIZE=10 +FILESIZE=$(($FILESIZE*1000000)) + +if [ -n "$GROUP" ]; then + cp $RUNDIR/* . +fi + +mkdir -p data +for count in `seq 1 $NUMFILES` +do + FILENAME=`mktemp -p data` + ./gendata.pl $FILESIZE > $FILENAME +done + +start-coaster-service Property changes on: trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.swift =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.swift (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/10x10/catsn_random.swift 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,13 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +file input_files[]; + +foreach j in input_files { + file output; + output = cat(j); +} Added: trunk/tests/stress/persistent-coasters/mcs/10x10/coaster-service.conf =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/10x10/coaster-service.conf (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/10x10/coaster-service.conf 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,43 @@ +# Keep all interesting settings in one place +# User should modify this to fit environment + +# Location of SWIFT. If empty, PATH is referenced +export SWIFT= + +# Where to place/launch worker.pl on the remote machine +export WORKER_WORK=/nfs/proj-davidk/swiftwork + +# How to launch workers: local, ssh, futuregrid, or cobalt +export WORKER_MODE=ssh +export WORKER_USERNAME=$USER + +# Worker host names for ssh +export WORKER_HOSTS="crush.mcs.anl.gov thwomp.mcs.anl.gov stomp.mcs.anl.gov crank.mcs.anl.gov +steamroller.mcs.anl.gov grind.mcs.anl.gov churn.mcs.anl.gov trounce.mcs.anl.gov +thrash.mcs.anl.gov vanquish.mcs.anl.gov" + +# Directory to keep log files, relative to working directory when launching start-coaster-service +export LOG_DIR=logs + +# Manually define ports. If not specified, ports will be automatically generated +export LOCAL_PORT= +export SERVICE_PORT= + +# start-coaster-service tries to automatically detect IP address. +# Specify here if auto detection is not working correctly +export IPADDR= + +# Gensites values +export WORK=$HOME/work + +# If SHARED_FILESYSTEM is set to no, provider staging will be turned on +export SHARED_FILESYSTEM=no + +# If running outside of mcs network, set WORKER_RELAY_HOST below +# export WORKER_RELAY_HOST="login.mcs.anl.gov" + +export WORKER_LOGGING_LEVEL=DEBUG +export WORKER_LOG_DIR="/nfs/proj-davidk/logs" + +# Set applications here +#app cat=/bin/cat Added: trunk/tests/stress/persistent-coasters/mcs/10x10/gendata.pl =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/10x10/gendata.pl (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/10x10/gendata.pl 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use strict; + +my @characters=('a'..'z', 'A'..'Z', '0'..'9'); +my $string=""; +my $length = $ARGV[0]; +my $width_count=0; + +foreach (1..$length) +{ + if($width_count == 80) { + $string .= "\n"; + $width_count=0; + next; + } + $string .= $characters[rand @characters]; + $width_count++; +} + +print $string; Property changes on: trunk/tests/stress/persistent-coasters/mcs/10x10/gendata.pl ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,17 @@ +#!/bin/bash + +for file in `ls data/tmp.*|grep -v out` +do + if [ ! -f "$file.out" ]; then + echo $file.out was not created + exit 1 + fi + + FILE_SUM=`sum $data/$file` + OUT_SUM=`sum $data/$file.out` + + if [ "$FILE_SUM" != "$OUT_SUM" ]; then + echo Checksums of $file and $file.out are not the same + exit 1 + fi +done Property changes on: trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.check.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,4 @@ +#!/bin/bash + +rm data/tmp.* +stop-coaster-service Property changes on: trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.clean.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,18 @@ +#!/bin/bash + +NUMFILES=500 +FILESIZE=10 +FILESIZE=$(($FILESIZE*1000000)) + +if [ -n "$GROUP" ]; then + cp $RUNDIR/* . +fi + +mkdir -p data +for count in `seq 1 $NUMFILES` +do + FILENAME=`mktemp -p data` + ./gendata.pl $FILESIZE > $FILENAME +done + +start-coaster-service Property changes on: trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.swift =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.swift (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/500x10/catsn_random.swift 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,13 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +file input_files[]; + +foreach j in input_files { + file output; + output = cat(j); +} Added: trunk/tests/stress/persistent-coasters/mcs/500x10/coaster-service.conf =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/500x10/coaster-service.conf (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/500x10/coaster-service.conf 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,43 @@ +# Keep all interesting settings in one place +# User should modify this to fit environment + +# Location of SWIFT. If empty, PATH is referenced +export SWIFT= + +# Where to place/launch worker.pl on the remote machine +export WORKER_WORK=/nfs/proj-davidk/swiftwork + +# How to launch workers: local, ssh, futuregrid, or cobalt +export WORKER_MODE=ssh +export WORKER_USERNAME=$USER + +# Worker host names for ssh +export WORKER_HOSTS="crush.mcs.anl.gov thwomp.mcs.anl.gov stomp.mcs.anl.gov crank.mcs.anl.gov +steamroller.mcs.anl.gov grind.mcs.anl.gov churn.mcs.anl.gov trounce.mcs.anl.gov +thrash.mcs.anl.gov vanquish.mcs.anl.gov" + +# Directory to keep log files, relative to working directory when launching start-coaster-service +export LOG_DIR=logs + +# Manually define ports. If not specified, ports will be automatically generated +export LOCAL_PORT= +export SERVICE_PORT= + +# start-coaster-service tries to automatically detect IP address. +# Specify here if auto detection is not working correctly +export IPADDR= + +# Gensites values +export WORK=$HOME/work + +# If SHARED_FILESYSTEM is set to no, provider staging will be turned on +export SHARED_FILESYSTEM=no + +# If running outside of mcs network, set WORKER_RELAY_HOST below +# export WORKER_RELAY_HOST="login.mcs.anl.gov" + +export WORKER_LOGGING_LEVEL=DEBUG +export WORKER_LOG_DIR="/nfs/proj-davidk/logs" + +# Set applications here +#app cat=/bin/cat Added: trunk/tests/stress/persistent-coasters/mcs/500x10/gendata.pl =================================================================== --- trunk/tests/stress/persistent-coasters/mcs/500x10/gendata.pl (rev 0) +++ trunk/tests/stress/persistent-coasters/mcs/500x10/gendata.pl 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,21 @@ +#!/usr/bin/perl + +use strict; + +my @characters=('a'..'z', 'A'..'Z', '0'..'9'); +my $string=""; +my $length = $ARGV[0]; +my $width_count=0; + +foreach (1..$length) +{ + if($width_count == 80) { + $string .= "\n"; + $width_count=0; + next; + } + $string .= $characters[rand @characters]; + $width_count++; +} + +print $string; Property changes on: trunk/tests/stress/persistent-coasters/mcs/500x10/gendata.pl ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0001.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0001.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0001.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0002.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0002.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0002.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0003.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0003.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0003.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0004.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0004.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0004.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0005.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0005.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0005.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0006.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0006.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0006.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0007.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0007.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0007.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0008.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0008.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0008.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0009.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0009.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.0009.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.setup.sh =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.setup.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.setup.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,7 @@ +#!/bin/bash + +cp $GROUP/coaster-service.conf . +cp $GROUP/data.txt . +if [ ! -f "$HOME/.swift/.coaster-service-pids" ]; then + start-coaster-service +fi Property changes on: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.swift =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.swift (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.swift 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,12 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +file out[]; +foreach j in [1:@toint(@arg("n","10"))] { + file data<"data.txt">; + out[j] = cat(data); +} Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.timeout =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.timeout (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/001-catsn.timeout 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +999999 Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0001.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0001.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0001.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0002.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0002.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0002.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0003.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0003.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0003.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0004.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0004.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0004.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0005.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0005.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0005.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0006.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0006.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0006.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0007.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0007.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0007.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0008.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0008.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0008.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0009.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0009.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.0009.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.swift =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.swift (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/002-catsnbroken.swift 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,12 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +file out[]; +foreach j in [1:@toint(@arg("n","10"))] { + file data<"nodata.txt">; + out[j] = cat(data); +} Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0001.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0001.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0001.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0002.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0002.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0002.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0003.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0003.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0003.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0004.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0004.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0004.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0005.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0005.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0005.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0006.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0006.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0006.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0007.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0007.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0007.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0008.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0008.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0008.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0009.out.expected =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0009.out.expected (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.0009.out.expected 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.setup.sh =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.setup.sh (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.setup.sh 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,4 @@ +#!/bin/bash + +cp $GROUP/coaster-service.conf . +cp $GROUP/data.txt . Property changes on: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.swift =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.swift (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.swift 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,12 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +file out[]; +foreach j in [1:@toint(@arg("n","10"))] { + file data<"data.txt">; + out[j] = cat(data); +} Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.timeout =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.timeout (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/003-catsn.timeout 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +999999 Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/coaster-service.conf =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/coaster-service.conf (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/coaster-service.conf 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,42 @@ +# Keep all interesting settings in one place +# User should modify this to fit environment + +# Location of SWIFT. If empty, PATH is searched +export SWIFT= + +# Where to copy worker.pl on the remote machine for sites.xml +export WORKER_WORK=$HOME/swiftwork + +# How to launch workers: local, ssh, cobalt, or futuregrid +export WORKER_MODE=ssh + +# SSH hosts to start workers on (ssh mode only) +export WORKER_HOSTS="localhost" + +# Do all the worker nodes you're using have a shared filesystem? (yes/no) +export SHARED_FILESYSTEM=yes + +# Username to use on worker nodes +export WORKER_USERNAME=$USER + +# Enable SSH tunneling? (yes/no) +export SSH_TUNNELING=no + +# Directory to keep log files, relative to working directory when launching start-coaster-service +export LOG_DIR=logs + +# Manually define ports. If not specified, an available port will be used +export LOCAL_PORT= +export SERVICE_PORT= + +# start-coaster-service tries to automatically detect the IP address of this system. Specify here if you have multiple network interfaces +export IPADDR= + +# Location of the swift-vm-boot scripts +export SWIFTVMBOOT_DIR=$HOME/swift-vm-boot + +# Swift information for creating sites.xml +export WORK=$HOME/swiftwork +export QUEUE=prod-devel +export MAXTIME=20 +export NODE=64 Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/data.txt =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/data.txt (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/data.txt 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/stress/persistent-coasters/pass-fail-pass/sites.template.xml =================================================================== --- trunk/tests/stress/persistent-coasters/pass-fail-pass/sites.template.xml (rev 0) +++ trunk/tests/stress/persistent-coasters/pass-fail-pass/sites.template.xml 2011-10-17 15:44:28 UTC (rev 5237) @@ -0,0 +1,9 @@ +persistent-coasters echo /bin/echo null null null +persistent-coasters cat /bin/cat null null null +persistent-coasters ls /bin/ls null null null +persistent-coasters grep /bin/grep null null null +persistent-coasters sort /bin/sort null null null +persistent-coasters paste /bin/paste null null null +persistent-coasters cp /bin/cp null null null +persistent-coasters wc /usr/bin/wc null null null +persistent-coasters hostname /bin/hostname null null null From davidk at ci.uchicago.edu Mon Oct 17 18:01:08 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Mon, 17 Oct 2011 18:01:08 -0500 (CDT) Subject: [Swift-commit] r5238 - in wwwdev: downloads inc main Message-ID: <20111017230108.3E70A9CCC9@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-17 18:01:08 -0500 (Mon, 17 Oct 2011) New Revision: 5238 Modified: wwwdev/downloads/index.php wwwdev/inc/downloads_sidebar.php wwwdev/main/index.php Log: Added latest Swift revision Modified: wwwdev/downloads/index.php =================================================================== --- wwwdev/downloads/index.php 2011-10-17 15:44:28 UTC (rev 5237) +++ wwwdev/downloads/index.php 2011-10-17 23:01:08 UTC (rev 5238) @@ -25,14 +25,14 @@

Latest Release

-

Swift 0.93 RC - 2011/8/17

+

Swift 0.93 RC3 - 2011/10/6

For the majority of users, this is the version you will want to download. This package contains the latest Stable release of Swift. Since Swift is written in Java, this package will run on all supported platforms with Java Runtime Environment 1.5 or greater.

Precompiled binary distribution -[swift-0.93.tar.gz] Modified: wwwdev/inc/downloads_sidebar.php =================================================================== --- wwwdev/inc/downloads_sidebar.php 2011-10-17 15:44:28 UTC (rev 5237) +++ wwwdev/inc/downloads_sidebar.php 2011-10-17 23:01:08 UTC (rev 5238) @@ -1,10 +1,8 @@

Latest Release

- -0.93 RC current version
2011/08/17 + +0.93 RC3 current version
2011/10/6
-Precompiled binary distribution -swift-0.93.tar.gz

 

Getting Started

Modified: wwwdev/main/index.php =================================================================== --- wwwdev/main/index.php 2011-10-17 15:44:28 UTC (rev 5237) +++ wwwdev/main/index.php 2011-10-17 23:01:08 UTC (rev 5238) @@ -62,9 +62,9 @@
-
0.93 RC current version
2011/08/17 -
view all downloads
-
Read our Quick Start Guide +
0.93 RC3 current version
2011/10/06 +
+
Read our Quick Start Guide and start using Swift today!
From davidk at ci.uchicago.edu Mon Oct 17 21:59:34 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Mon, 17 Oct 2011 21:59:34 -0500 (CDT) Subject: [Swift-commit] r5239 - in branches/release-0.93/tests/providers: . ranger ranger/gt2 ranger/local Message-ID: <20111018025934.575649CCC9@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-17 21:59:34 -0500 (Mon, 17 Oct 2011) New Revision: 5239 Added: branches/release-0.93/tests/providers/ranger/ branches/release-0.93/tests/providers/ranger/gt2/ branches/release-0.93/tests/providers/ranger/gt2/001-catsn-ranger.swift branches/release-0.93/tests/providers/ranger/gt2/cf branches/release-0.93/tests/providers/ranger/gt2/data.txt branches/release-0.93/tests/providers/ranger/gt2/sites.template.xml branches/release-0.93/tests/providers/ranger/gt2/start_proxy.sh branches/release-0.93/tests/providers/ranger/gt2/tc.template.data branches/release-0.93/tests/providers/ranger/local/ branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.check.sh branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.setup.sh branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.swift branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.timeout branches/release-0.93/tests/providers/ranger/local/catsn.0001.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0002.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0003.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0004.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0005.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0006.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0007.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0008.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0009.out.expected branches/release-0.93/tests/providers/ranger/local/catsn.0010.out.expected branches/release-0.93/tests/providers/ranger/local/data.txt branches/release-0.93/tests/providers/ranger/local/sites.template.xml branches/release-0.93/tests/providers/ranger/local/tc.template.data branches/release-0.93/tests/providers/ranger/local/title.txt Log: Provider tests for ranger Added: branches/release-0.93/tests/providers/ranger/gt2/001-catsn-ranger.swift =================================================================== --- branches/release-0.93/tests/providers/ranger/gt2/001-catsn-ranger.swift (rev 0) +++ branches/release-0.93/tests/providers/ranger/gt2/001-catsn-ranger.swift 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,15 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +string t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +string char[] = @strsplit(t, ""); + +file out[]; +foreach j in [1:@toint(@arg("n","10"))] { + file data<"data.txt">; + out[j] = cat(data); +} Added: branches/release-0.93/tests/providers/ranger/gt2/cf =================================================================== --- branches/release-0.93/tests/providers/ranger/gt2/cf (rev 0) +++ branches/release-0.93/tests/providers/ranger/gt2/cf 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,7 @@ +wrapperlog.always.transfer=true +sitedir.keep=true +execution.retries=0 +lazy.errors=false +status.mode=provider +use.provider.staging=true +provider.staging.pin.swiftfiles=false Added: branches/release-0.93/tests/providers/ranger/gt2/data.txt =================================================================== --- branches/release-0.93/tests/providers/ranger/gt2/data.txt (rev 0) +++ branches/release-0.93/tests/providers/ranger/gt2/data.txt 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +ranger testing yeehaw Added: branches/release-0.93/tests/providers/ranger/gt2/sites.template.xml =================================================================== --- branches/release-0.93/tests/providers/ranger/gt2/sites.template.xml (rev 0) +++ branches/release-0.93/tests/providers/ranger/gt2/sites.template.xml 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,16 @@ + + + + + 3600 + 00:00:03 + 1 + 16 + 16 + development + 0.9 + TG-DBS080004N + 16way + _WORK_ + + Added: branches/release-0.93/tests/providers/ranger/gt2/start_proxy.sh =================================================================== --- branches/release-0.93/tests/providers/ranger/gt2/start_proxy.sh (rev 0) +++ branches/release-0.93/tests/providers/ranger/gt2/start_proxy.sh 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +myproxy-logon -l dkelly -s myproxy.teragrid.org Property changes on: branches/release-0.93/tests/providers/ranger/gt2/start_proxy.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/providers/ranger/gt2/tc.template.data =================================================================== --- branches/release-0.93/tests/providers/ranger/gt2/tc.template.data (rev 0) +++ branches/release-0.93/tests/providers/ranger/gt2/tc.template.data 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +ranger cat /bin/cat Added: branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.check.sh =================================================================== --- branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.check.sh (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.check.sh 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,12 @@ +#!/bin/bash + +set -x + +for count in `seq --format "%04.f" 1 1 10` +do + [ -f catsn.$count.out ] || exit 1 + CONTENTS1=$( cat catsn.$count.out.expected ) + CONTENTS2=$( cat catsn.$count.out ) + [[ $CONTENTS1 == $CONTENTS2 ]] || exit 1 +done +exit 0 Property changes on: branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.check.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.setup.sh =================================================================== --- branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.setup.sh (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.setup.sh 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,7 @@ +#!/bin/bash + +cp -v $GROUP/data.txt . || exit 1 +cp -v $GROUP/*expected . || exit 1 + +export QUEUE=normal + Property changes on: branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.swift =================================================================== --- branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.swift (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.swift 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,15 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +string t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +string char[] = @strsplit(t, ""); + +file out[]; +foreach j in [1:@toint(@arg("n","10"))] { + file data<"data.txt">; + out[j] = cat(data); +} Added: branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.timeout =================================================================== --- branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.timeout (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/001-catsn-ranger.timeout 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,2 @@ +7200 + Added: branches/release-0.93/tests/providers/ranger/local/catsn.0001.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0001.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0001.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0002.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0002.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0002.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0003.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0003.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0003.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0004.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0004.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0004.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0005.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0005.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0005.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0006.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0006.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0006.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0007.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0007.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0007.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0008.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0008.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0008.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0009.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0009.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0009.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/catsn.0010.out.expected =================================================================== --- branches/release-0.93/tests/providers/ranger/local/catsn.0010.out.expected (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/catsn.0010.out.expected 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/data.txt =================================================================== --- branches/release-0.93/tests/providers/ranger/local/data.txt (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/data.txt 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Hello world Added: branches/release-0.93/tests/providers/ranger/local/sites.template.xml =================================================================== --- branches/release-0.93/tests/providers/ranger/local/sites.template.xml (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/sites.template.xml 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,17 @@ + + + + + 2 + 300 + 1 + 1 + 16 + 16 + development + 5.99 + 10000 + TG-DBS080004N + _WORK_ + + Added: branches/release-0.93/tests/providers/ranger/local/tc.template.data =================================================================== --- branches/release-0.93/tests/providers/ranger/local/tc.template.data (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/tc.template.data 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1,8 @@ +ranger echo /bin/echo INSTALLED INTEL32::LINUX null +ranger cat /bin/cat INSTALLED INTEL32::LINUX null +ranger ls /bin/ls INSTALLED INTEL32::LINUX null +ranger grep /bin/grep INSTALLED INTEL32::LINUX null +ranger sort /bin/sort INSTALLED INTEL32::LINUX null +ranger paste /bin/paste INSTALLED INTEL32::LINUX null +ranger wc /usr/bin/wc INSTALLED INTEL32::LINUX null + Added: branches/release-0.93/tests/providers/ranger/local/title.txt =================================================================== --- branches/release-0.93/tests/providers/ranger/local/title.txt (rev 0) +++ branches/release-0.93/tests/providers/ranger/local/title.txt 2011-10-18 02:59:34 UTC (rev 5239) @@ -0,0 +1 @@ +Ranger local SGE From davidk at ci.uchicago.edu Mon Oct 17 22:01:42 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Mon, 17 Oct 2011 22:01:42 -0500 (CDT) Subject: [Swift-commit] r5240 - in trunk/tests/providers: . ranger ranger/gt2 ranger/local Message-ID: <20111018030142.723EB9CCC9@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-17 22:01:42 -0500 (Mon, 17 Oct 2011) New Revision: 5240 Added: trunk/tests/providers/ranger/ trunk/tests/providers/ranger/gt2/ trunk/tests/providers/ranger/gt2/001-catsn-ranger.swift trunk/tests/providers/ranger/gt2/cf trunk/tests/providers/ranger/gt2/data.txt trunk/tests/providers/ranger/gt2/sites.template.xml trunk/tests/providers/ranger/gt2/start_proxy.sh trunk/tests/providers/ranger/gt2/tc.template.data trunk/tests/providers/ranger/local/ trunk/tests/providers/ranger/local/001-catsn-ranger.check.sh trunk/tests/providers/ranger/local/001-catsn-ranger.setup.sh trunk/tests/providers/ranger/local/001-catsn-ranger.swift trunk/tests/providers/ranger/local/001-catsn-ranger.timeout trunk/tests/providers/ranger/local/catsn.0001.out.expected trunk/tests/providers/ranger/local/catsn.0002.out.expected trunk/tests/providers/ranger/local/catsn.0003.out.expected trunk/tests/providers/ranger/local/catsn.0004.out.expected trunk/tests/providers/ranger/local/catsn.0005.out.expected trunk/tests/providers/ranger/local/catsn.0006.out.expected trunk/tests/providers/ranger/local/catsn.0007.out.expected trunk/tests/providers/ranger/local/catsn.0008.out.expected trunk/tests/providers/ranger/local/catsn.0009.out.expected trunk/tests/providers/ranger/local/catsn.0010.out.expected trunk/tests/providers/ranger/local/data.txt trunk/tests/providers/ranger/local/sites.template.xml trunk/tests/providers/ranger/local/tc.template.data trunk/tests/providers/ranger/local/title.txt Log: Ranger provider tests Added: trunk/tests/providers/ranger/gt2/001-catsn-ranger.swift =================================================================== --- trunk/tests/providers/ranger/gt2/001-catsn-ranger.swift (rev 0) +++ trunk/tests/providers/ranger/gt2/001-catsn-ranger.swift 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,15 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +string t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +string char[] = @strsplit(t, ""); + +file out[]; +foreach j in [1:@toint(@arg("n","10"))] { + file data<"data.txt">; + out[j] = cat(data); +} Added: trunk/tests/providers/ranger/gt2/cf =================================================================== --- trunk/tests/providers/ranger/gt2/cf (rev 0) +++ trunk/tests/providers/ranger/gt2/cf 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,7 @@ +wrapperlog.always.transfer=true +sitedir.keep=true +execution.retries=0 +lazy.errors=false +status.mode=provider +use.provider.staging=true +provider.staging.pin.swiftfiles=false Added: trunk/tests/providers/ranger/gt2/data.txt =================================================================== --- trunk/tests/providers/ranger/gt2/data.txt (rev 0) +++ trunk/tests/providers/ranger/gt2/data.txt 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +ranger testing yeehaw Added: trunk/tests/providers/ranger/gt2/sites.template.xml =================================================================== --- trunk/tests/providers/ranger/gt2/sites.template.xml (rev 0) +++ trunk/tests/providers/ranger/gt2/sites.template.xml 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,16 @@ + + + + + 3600 + 00:00:03 + 1 + 16 + 16 + development + 0.9 + TG-DBS080004N + 16way + _WORK_ + + Added: trunk/tests/providers/ranger/gt2/start_proxy.sh =================================================================== --- trunk/tests/providers/ranger/gt2/start_proxy.sh (rev 0) +++ trunk/tests/providers/ranger/gt2/start_proxy.sh 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +myproxy-logon -l dkelly -s myproxy.teragrid.org Property changes on: trunk/tests/providers/ranger/gt2/start_proxy.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/providers/ranger/gt2/tc.template.data =================================================================== --- trunk/tests/providers/ranger/gt2/tc.template.data (rev 0) +++ trunk/tests/providers/ranger/gt2/tc.template.data 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +ranger cat /bin/cat Added: trunk/tests/providers/ranger/local/001-catsn-ranger.check.sh =================================================================== --- trunk/tests/providers/ranger/local/001-catsn-ranger.check.sh (rev 0) +++ trunk/tests/providers/ranger/local/001-catsn-ranger.check.sh 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,12 @@ +#!/bin/bash + +set -x + +for count in `seq --format "%04.f" 1 1 10` +do + [ -f catsn.$count.out ] || exit 1 + CONTENTS1=$( cat catsn.$count.out.expected ) + CONTENTS2=$( cat catsn.$count.out ) + [[ $CONTENTS1 == $CONTENTS2 ]] || exit 1 +done +exit 0 Property changes on: trunk/tests/providers/ranger/local/001-catsn-ranger.check.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/providers/ranger/local/001-catsn-ranger.setup.sh =================================================================== --- trunk/tests/providers/ranger/local/001-catsn-ranger.setup.sh (rev 0) +++ trunk/tests/providers/ranger/local/001-catsn-ranger.setup.sh 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,7 @@ +#!/bin/bash + +cp -v $GROUP/data.txt . || exit 1 +cp -v $GROUP/*expected . || exit 1 + +export QUEUE=normal + Property changes on: trunk/tests/providers/ranger/local/001-catsn-ranger.setup.sh ___________________________________________________________________ Added: svn:executable + * Added: trunk/tests/providers/ranger/local/001-catsn-ranger.swift =================================================================== --- trunk/tests/providers/ranger/local/001-catsn-ranger.swift (rev 0) +++ trunk/tests/providers/ranger/local/001-catsn-ranger.swift 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,15 @@ +type file; + +app (file o) cat (file i) +{ + cat @i stdout=@o; +} + +string t = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; +string char[] = @strsplit(t, ""); + +file out[]; +foreach j in [1:@toint(@arg("n","10"))] { + file data<"data.txt">; + out[j] = cat(data); +} Added: trunk/tests/providers/ranger/local/001-catsn-ranger.timeout =================================================================== --- trunk/tests/providers/ranger/local/001-catsn-ranger.timeout (rev 0) +++ trunk/tests/providers/ranger/local/001-catsn-ranger.timeout 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,2 @@ +7200 + Added: trunk/tests/providers/ranger/local/catsn.0001.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0001.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0001.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0002.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0002.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0002.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0003.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0003.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0003.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0004.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0004.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0004.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0005.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0005.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0005.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0006.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0006.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0006.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0007.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0007.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0007.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0008.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0008.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0008.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0009.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0009.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0009.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/catsn.0010.out.expected =================================================================== --- trunk/tests/providers/ranger/local/catsn.0010.out.expected (rev 0) +++ trunk/tests/providers/ranger/local/catsn.0010.out.expected 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/data.txt =================================================================== --- trunk/tests/providers/ranger/local/data.txt (rev 0) +++ trunk/tests/providers/ranger/local/data.txt 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Hello world Added: trunk/tests/providers/ranger/local/sites.template.xml =================================================================== --- trunk/tests/providers/ranger/local/sites.template.xml (rev 0) +++ trunk/tests/providers/ranger/local/sites.template.xml 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,17 @@ + + + + + 2 + 300 + 1 + 1 + 16 + 16 + development + 5.99 + 10000 + TG-DBS080004N + _WORK_ + + Added: trunk/tests/providers/ranger/local/tc.template.data =================================================================== --- trunk/tests/providers/ranger/local/tc.template.data (rev 0) +++ trunk/tests/providers/ranger/local/tc.template.data 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1,8 @@ +ranger echo /bin/echo INSTALLED INTEL32::LINUX null +ranger cat /bin/cat INSTALLED INTEL32::LINUX null +ranger ls /bin/ls INSTALLED INTEL32::LINUX null +ranger grep /bin/grep INSTALLED INTEL32::LINUX null +ranger sort /bin/sort INSTALLED INTEL32::LINUX null +ranger paste /bin/paste INSTALLED INTEL32::LINUX null +ranger wc /usr/bin/wc INSTALLED INTEL32::LINUX null + Added: trunk/tests/providers/ranger/local/title.txt =================================================================== --- trunk/tests/providers/ranger/local/title.txt (rev 0) +++ trunk/tests/providers/ranger/local/title.txt 2011-10-18 03:01:42 UTC (rev 5240) @@ -0,0 +1 @@ +Ranger local SGE From lgadelha at ci.uchicago.edu Tue Oct 18 08:07:33 2011 From: lgadelha at ci.uchicago.edu (lgadelha at ci.uchicago.edu) Date: Tue, 18 Oct 2011 08:07:33 -0500 (CDT) Subject: [Swift-commit] r5241 - provenancedb Message-ID: <20111018130733.A99629CCA5@svn.ci.uchicago.edu> Author: lgadelha Date: 2011-10-18 08:07:33 -0500 (Tue, 18 Oct 2011) New Revision: 5241 Modified: provenancedb/ProvSQL.g Log: Minor changes. Modified: provenancedb/ProvSQL.g =================================================================== --- provenancedb/ProvSQL.g 2011-10-18 03:01:42 UTC (rev 5240) +++ provenancedb/ProvSQL.g 2011-10-18 13:07:33 UTC (rev 5241) @@ -305,9 +305,8 @@ ')' { System.out.print(")"); } ; -selectExpression - : ( - a=entityAttribute +selectAtom + : a=entityAttribute { selectClause += $a.text; relations.add($a.text.split("\\.")[0]); @@ -317,9 +316,9 @@ | b=AGGRFUN { - selectclause+=$b.text; + selectClause+=$b.text; } - '(' { selectclause+="("; } + '(' { selectClause+="("; } c=entityAttribute { selectClause += $c.text; @@ -327,34 +326,16 @@ if($c.text.split("\\.").length == 1) selectClause += ".*"; } - ')' { selectclause+=")"; } + ')' { selectClause+=")"; } + ; +selectExpression + : ( + selectAtom ) - (COLON + (COLON { selectClause+=","; } ( - d=entityAttribute - { - selectClause += "," + $d.text; - relations.add($d.text.split("\\.")[0]); - if($d.text.split("\\.").length == 1) - selectClause += ".*"; - } - | - e=AGGRFUN - { - selectclause+=$e.text; - } - '(' { selectclause+="("; } - f=entityAttribute - { - selectClause += $f.text; - relations.add($f.text.split("\\.")[0]); - if($f.text.split("\\.").length == 1) - selectClause += ".*"; - } - ')' { selectclause+=")"; } - - + selectAtom ) )* ; @@ -375,7 +356,7 @@ ; whereAtom - : a=entityAttribute + : a=entityAndAttribute { relations.add($a.text.split("\\.")[0]); whereClause += $a.text; @@ -583,11 +564,14 @@ ORDER : 'order'; +COMPARERUN + : 'compare_run'; + BY : 'by'; AGGRFUN : 'avg' | 'max' | 'min' | 'count' | 'sum'; -SELECT : 's' 'e' 'l' 'e' 'c' 't'; +SELECT : 'select'; DESC : 'desc'; From lgadelha at ci.uchicago.edu Tue Oct 18 13:37:00 2011 From: lgadelha at ci.uchicago.edu (lgadelha at ci.uchicago.edu) Date: Tue, 18 Oct 2011 13:37:00 -0500 (CDT) Subject: [Swift-commit] r5242 - provenancedb Message-ID: <20111018183700.A18BE9CC97@svn.ci.uchicago.edu> Author: lgadelha Date: 2011-10-18 13:37:00 -0500 (Tue, 18 Oct 2011) New Revision: 5242 Modified: provenancedb/ProvSQL.g Log: Minor changes. Modified: provenancedb/ProvSQL.g =================================================================== --- provenancedb/ProvSQL.g 2011-10-18 13:07:33 UTC (rev 5241) +++ provenancedb/ProvSQL.g 2011-10-18 18:37:00 UTC (rev 5242) @@ -41,6 +41,7 @@ schemaGraph.addVertex("a_ds_t"); schemaGraph.addVertex("a_ds_n"); schemaGraph.addVertex("ds_cont"); + schemaGraph.addVertex("compare_run"); schemaGraph.addEdge("a_run_t", "run"); schemaGraph.addEdge("a_run_n", "run"); schemaGraph.addEdge("run","proc"); @@ -59,6 +60,7 @@ schemaGraph.addEdge("ds", "in_mem"); schemaGraph.addEdge("ds", "ds_cont"); schemaGraph.addEdge("ds", "ds_cont"); + schemaGraph.addEdge("compare_run", "run"); return schemaGraph; } @@ -150,6 +152,7 @@ joinExpressions.put(schemaGraph.getEdge("ds", "in_mem"), "ds.id=in_mem.id"); joinExpressions.put(schemaGraph.getEdge("ds", "ds_cont"), "ds.id=ds_cont.in_id"); joinExpressions.put(schemaGraph.getEdge("ds", "ds_cont"), "ds.id=ds_cont.out_id"); + joinExpressions.put(schemaGraph.getEdge("compare_run", "ds_cont"), "ds.id=ds_cont.out_id"); Iterator i = jEdges.iterator(); if(i.hasNext()) { From tga at ci.uchicago.edu Tue Oct 18 22:10:18 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Tue, 18 Oct 2011 22:10:18 -0500 (CDT) Subject: [Swift-commit] r5245 - SwiftApps/SwiftR/Swift/man Message-ID: <20111019031018.D2D0E9CC97@svn.ci.uchicago.edu> Author: tga Date: 2011-10-18 22:10:18 -0500 (Tue, 18 Oct 2011) New Revision: 5245 Modified: SwiftApps/SwiftR/Swift/man/Swift-package.Rd Log: Shutdown in example Modified: SwiftApps/SwiftR/Swift/man/Swift-package.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/Swift-package.Rd 2011-10-19 02:41:04 UTC (rev 5244) +++ SwiftApps/SwiftR/Swift/man/Swift-package.Rd 2011-10-19 03:10:18 UTC (rev 5245) @@ -496,5 +496,5 @@ res = swiftapply(myfunc,arglist,callsperbatch=5) # res = swiftapply(myfunc,arglist,callsperbatch=2,site="pbs") - +swiftShutdown(job) } From tga at ci.uchicago.edu Wed Oct 19 12:37:08 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Wed, 19 Oct 2011 12:37:08 -0500 (CDT) Subject: [Swift-commit] r5246 - SwiftApps/SwiftR/Swift/exec Message-ID: <20111019173708.81DD49CC9A@svn.ci.uchicago.edu> Author: tga Date: 2011-10-19 12:37:08 -0500 (Wed, 19 Oct 2011) New Revision: 5246 Modified: SwiftApps/SwiftR/Swift/exec/start-swift Log: Echo swift's standard output on job failure Modified: SwiftApps/SwiftR/Swift/exec/start-swift =================================================================== --- SwiftApps/SwiftR/Swift/exec/start-swift 2011-10-19 03:10:18 UTC (rev 5245) +++ SwiftApps/SwiftR/Swift/exec/start-swift 2011-10-19 17:37:08 UTC (rev 5246) @@ -891,12 +891,17 @@ exitcode=$? # Do any cleanup if swift exits in this manner if [ "$exitcode" != 0 ]; then - echo "error: Swift exited unexpectedly with return code $exitcode" - if [ "$keepdir" = TRUE ]; then - echo "See logs in $trundir for more information" - else - echo "Turn on keep work option to retain logs" + echo "Error: Swift exited unexpectedly with return code $exitcode" + + + if [ ! -z "$swiftLoggingFlag" ]; then + echo "Verbose swift logging was disabled, enable for more information" fi + if [ ! "$keepdir" = TRUE ]; then + echo "Turn on keep work option to retain more logs" + fi + echo "Last 100 lines of Swift output follow. See logs in $trundir for more information" + tail -n 100 $trundir/$out # TODO: resultpipe used togo somewhere need to handle some other way ( echo "error: swift exited unexpectedly with return code $exitcode" > swift.error & From davidk at ci.uchicago.edu Wed Oct 19 13:47:58 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Wed, 19 Oct 2011 13:47:58 -0500 (CDT) Subject: [Swift-commit] r5247 - wwwdev/papers Message-ID: <20111019184758.2C73A9CC9A@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-19 13:47:58 -0500 (Wed, 19 Oct 2011) New Revision: 5247 Added: wwwdev/papers/UCC-coasters.pdf Modified: wwwdev/papers/index.php Log: Added UCC coasters paper Added: wwwdev/papers/UCC-coasters.pdf =================================================================== (Binary files differ) Property changes on: wwwdev/papers/UCC-coasters.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: wwwdev/papers/index.php =================================================================== --- wwwdev/papers/index.php 2011-10-19 17:37:08 UTC (rev 5246) +++ wwwdev/papers/index.php 2011-10-19 18:47:58 UTC (rev 5247) @@ -26,6 +26,14 @@

Swift Technology and SwiftScript Application Papers

+ Mihael Hategan, Justin Wozniak, Ketan Maheshwari + Coasters: uniform resource provisioning and access for clouds and grids + 4th IEEE/ACM International Conference on Utility and Cloud Computing + 2011 + [ pdf ] +
+ +
Michael Wilde, Mihael Hategan, Justin M. Wozniak, Ben Clifford, Daniel S. Katz, Ian Foster Swift: A language for distributed parallel scripting Parallel Computing From tga at ci.uchicago.edu Wed Oct 19 15:11:17 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Wed, 19 Oct 2011 15:11:17 -0500 (CDT) Subject: [Swift-commit] r5248 - SwiftApps/SwiftR/Swift Message-ID: <20111019201117.8730C9CC9A@svn.ci.uchicago.edu> Author: tga Date: 2011-10-19 15:11:17 -0500 (Wed, 19 Oct 2011) New Revision: 5248 Modified: SwiftApps/SwiftR/Swift/DESCRIPTION Log: Added in system requirements info Modified: SwiftApps/SwiftR/Swift/DESCRIPTION =================================================================== --- SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-19 18:47:58 UTC (rev 5247) +++ SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-19 20:11:17 UTC (rev 5248) @@ -5,6 +5,8 @@ Date: 2011-10-18 Author: Michael Wilde Maintainer: Michael Wilde +Depends: R (>= 2.11) +SystemRequirements: Perl (>= 5.10.0), Java (>= 1.6), bash Description: Routines to invoke R functions on remote resources through Swift. License: Apache License LazyLoad: yes From tga at ci.uchicago.edu Wed Oct 19 15:11:19 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Wed, 19 Oct 2011 15:11:19 -0500 (CDT) Subject: [Swift-commit] r5249 - in SwiftApps/SwiftR: . Swift Swift/R Swift/src Swift/tests Message-ID: <20111019201119.56D209CC9A@svn.ci.uchicago.edu> Author: tga Date: 2011-10-19 15:11:19 -0500 (Wed, 19 Oct 2011) New Revision: 5249 Added: SwiftApps/SwiftR/Swift/src/geturl.sh Modified: SwiftApps/SwiftR/Makefile SwiftApps/SwiftR/Swift/DESCRIPTION SwiftApps/SwiftR/Swift/R/Tests.R SwiftApps/SwiftR/Swift/src/Makefile SwiftApps/SwiftR/Swift/tests/runtests.R Log: Added test for prerequisites - bash/java/perl to test suite. Made a bit more portable by not relying exclusively on wget for build. Modified: SwiftApps/SwiftR/Makefile =================================================================== --- SwiftApps/SwiftR/Makefile 2011-10-19 20:11:17 UTC (rev 5248) +++ SwiftApps/SwiftR/Makefile 2011-10-19 20:11:19 UTC (rev 5249) @@ -7,7 +7,8 @@ PKG_FILES += Swift/DESCRIPTION PKG_FILES += Swift/NAMESPACE -PKG_FILES += Swift/src/Makefile Swift/src/make.include +PKG_FILES += Swift/src/Makefile Swift/src/make.include Swift/src/geturl.sh +PKG_FILES += $(shell find Swift/src/ -name '*.shasum') PKG_FILES += $(shell find Swift/src/swift-patches -not -path '*/.svn*') PACKAGE_DEPS = $(PKG_FILES) Makefile Modified: SwiftApps/SwiftR/Swift/DESCRIPTION =================================================================== --- SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-19 20:11:17 UTC (rev 5248) +++ SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-19 20:11:19 UTC (rev 5249) @@ -2,7 +2,7 @@ Type: Package Title: R interface to Swift parallel scripting languaage Version: 0.3.2 -Date: 2011-10-18 +Date: 2011-10-19 Author: Michael Wilde Maintainer: Michael Wilde Depends: R (>= 2.11) @@ -10,5 +10,4 @@ Description: Routines to invoke R functions on remote resources through Swift. License: Apache License LazyLoad: yes -Packaged: 2011-10-18; Tim Armstrong - +Packaged: 2011-10-19; Tim Armstrong Modified: SwiftApps/SwiftR/Swift/R/Tests.R =================================================================== --- SwiftApps/SwiftR/Swift/R/Tests.R 2011-10-19 20:11:17 UTC (rev 5248) +++ SwiftApps/SwiftR/Swift/R/Tests.R 2011-10-19 20:11:19 UTC (rev 5249) @@ -1,7 +1,24 @@ +prereqTest <- function() { + # Check that prerequisites exist + java <- system("java -version") + if (java != 0) { + cat("Java could not be found on path, Swift will not work\n") + } + perl <- system("/usr/bin/perl -v") + if (perl != 0) { + cat("Perl could not be found in /usr/bin, Swift will not work\n") + } + bash <- system("/usr/bin/env bash -version") + if (bash != 0) { + cat("Bash could not be found on path, Swift will not work\n") + } + return (java == 0) && (perl == 0) && (bash == 0) +} + basicSwiftTest <- function(...) { swiftInit(...) swiftTest_1.1() Modified: SwiftApps/SwiftR/Swift/src/Makefile =================================================================== --- SwiftApps/SwiftR/Swift/src/Makefile 2011-10-19 20:11:17 UTC (rev 5248) +++ SwiftApps/SwiftR/Swift/src/Makefile 2011-10-19 20:11:19 UTC (rev 5249) @@ -8,7 +8,7 @@ ANT_PKG = apache-ant-1.8.2-bin.tar.bz2 ANT_PKG_SHASUM = apache-ant-1.8.2-bin.shasum -ANT_PKG_URL = http://www.apache.org/dist//ant/binaries/$(ANT_PKG) +ANT_PKG_URL = http://www.apache.org/dist/ant/binaries/$(ANT_PKG) SWIFT_MODULE_SRC = $(SWIFT_SRC_NAME)/modules/swift @@ -27,7 +27,7 @@ # hack to avoid redoing if [ ! -f $(SWIFT_BIN) ]; then \ rm -f $(SWIFT_SRC_NAME).tar.gz && \ - wget http://cs.uchicago.edu/~tga/swiftR/swift-source/$(SWIFT_SRC_NAME).tar.gz && \ + sh geturl.sh "http://people.cs.uchicago.edu/~tga/swiftR/swift-source/$(SWIFT_SRC_NAME).tar.gz" && \ $(SHASUM) --check ${SWIFT_SRC_NAME}.shasum && \ tar xvzf ${SWIFT_SRC_NAME}.tar.gz && \ touch $(SWIFT_SRC_NAME)/.downloadedok ; \ @@ -67,7 +67,7 @@ # hack to avoid redoing if [ ! -f $(SWIFT_BIN) ]; then \ rm -f $(ANT_PKG) && \ - wget $(ANT_PKG_URL) && \ + sh geturl.sh $(ANT_PKG_URL) && \ $(SHASUM) --check $(ANT_PKG_SHASUM) && \ rm -rf $(ANT_DIR) && \ tar xjf $(ANT_PKG) && \ Added: SwiftApps/SwiftR/Swift/src/geturl.sh =================================================================== --- SwiftApps/SwiftR/Swift/src/geturl.sh (rev 0) +++ SwiftApps/SwiftR/Swift/src/geturl.sh 2011-10-19 20:11:19 UTC (rev 5249) @@ -0,0 +1,21 @@ +#!/bin/sh +# Fetch a file from a url, trying wget, curl and fetch + +WGET=${WGET:-wget} +CURL=${CURL:-curl} +FETCH=${FETCH:-fetch} + +URL="$1" + +if which ${WGET} > /dev/null ; then + ${WGET} "$URL" || die "Could not download $URL with $WGET" +elif which ${CURL} > /dev/null ; then + ${CURL} -O "$URL" || die "Could not download $URL with $CURL" +elif which ${FETCH} > /dev/null ; then + ${FETCH} "$URL" || die "Could not download $URL with $FETCH" +else + echo Could not find a utility to fetch from URLs. Tried to locate echo wget, curl + echo and fetch. Utility must be on path, or specified with WGET, CURL or FETCH + echo environment variable. + exit 1 +fi Property changes on: SwiftApps/SwiftR/Swift/src/geturl.sh ___________________________________________________________________ Added: svn:executable + * Modified: SwiftApps/SwiftR/Swift/tests/runtests.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/runtests.R 2011-10-19 20:11:17 UTC (rev 5248) +++ SwiftApps/SwiftR/Swift/tests/runtests.R 2011-10-19 20:11:19 UTC (rev 5249) @@ -1,5 +1,10 @@ #!/usr/bin/env Rscript library(Swift) + +if (!Swift:::prereqTest()) { + stop("System requirements for Swift not all available!") +} + #TODO: take command line options to setup options Swift:::runAllSwiftTests() From tga at ci.uchicago.edu Thu Oct 20 18:32:21 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Thu, 20 Oct 2011 18:32:21 -0500 (CDT) Subject: [Swift-commit] r5250 - in SwiftApps/SwiftR/Swift: . R man Message-ID: <20111020233221.1DD1D9CCA5@svn.ci.uchicago.edu> Author: tga Date: 2011-10-20 18:32:20 -0500 (Thu, 20 Oct 2011) New Revision: 5250 Added: SwiftApps/SwiftR/Swift/man/swiftTests.Rd Modified: SwiftApps/SwiftR/Swift/NAMESPACE SwiftApps/SwiftR/Swift/R/Tests.R SwiftApps/SwiftR/Swift/man/Swift-package.Rd SwiftApps/SwiftR/Swift/man/swiftExport.Rd SwiftApps/SwiftR/Swift/man/swiftInit.Rd SwiftApps/SwiftR/Swift/man/swiftLibrary.Rd SwiftApps/SwiftR/Swift/man/swiftapply.Rd Log: Fix documentation and visibility of runAllSwiftTests to conform with CRAN Modified: SwiftApps/SwiftR/Swift/NAMESPACE =================================================================== --- SwiftApps/SwiftR/Swift/NAMESPACE 2011-10-19 20:11:19 UTC (rev 5249) +++ SwiftApps/SwiftR/Swift/NAMESPACE 2011-10-20 23:32:20 UTC (rev 5250) @@ -12,3 +12,5 @@ export(swiftExportAll) export(swiftRemoveAll) +export(basicSwiftTest) +export(runAllSwiftTests) Modified: SwiftApps/SwiftR/Swift/R/Tests.R =================================================================== --- SwiftApps/SwiftR/Swift/R/Tests.R 2011-10-19 20:11:19 UTC (rev 5249) +++ SwiftApps/SwiftR/Swift/R/Tests.R 2011-10-20 23:32:20 UTC (rev 5250) @@ -21,8 +21,9 @@ basicSwiftTest <- function(...) { swiftInit(...) - swiftTest_1.1() + testRes <- swiftTest_1.1() swiftShutdown() + return (invisible(testRes)) } swiftTest_1.1 <- function() { @@ -800,12 +801,13 @@ startTime = proc.time()[["elapsed"]] - runTestSuite(makeFullTestSuite(...)) + testRes <- runTestSuite(makeFullTestSuite(...)) endTime <- proc.time()[["elapsed"]] runTime <- endTime - startTime cat("\n\n ===> Total elapsed test time = ",runTime," seconds.\n\n") + return (invisible(testRes)) } Modified: SwiftApps/SwiftR/Swift/man/Swift-package.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/Swift-package.Rd 2011-10-19 20:11:19 UTC (rev 5249) +++ SwiftApps/SwiftR/Swift/man/Swift-package.Rd 2011-10-20 23:32:20 UTC (rev 5250) @@ -479,6 +479,7 @@ \code{\link{swiftapply}} \code{\link{swiftLibrary}} \code{\link{swiftExport}} +\code{\link{runAllSwiftTests}} } \examples{ library(Swift) Modified: SwiftApps/SwiftR/Swift/man/swiftExport.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/swiftExport.Rd 2011-10-19 20:11:19 UTC (rev 5249) +++ SwiftApps/SwiftR/Swift/man/swiftExport.Rd 2011-10-20 23:32:20 UTC (rev 5250) @@ -88,7 +88,7 @@ %% ~Make other sections like Warning with \section{Warning }{....} ~ \seealso{ -\code{\link{Swift-package}} +\code{\link{Swift}} } \examples{ Modified: SwiftApps/SwiftR/Swift/man/swiftInit.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/swiftInit.Rd 2011-10-19 20:11:19 UTC (rev 5249) +++ SwiftApps/SwiftR/Swift/man/swiftInit.Rd 2011-10-20 23:32:20 UTC (rev 5250) @@ -157,7 +157,7 @@ \seealso{ %% ~~objects to See Also as \code{\link{help}}, ~~~ -\code{\link{Swift-package}} +\code{\link{Swift}} \code{\link{swiftShutdown}} } \examples{ Modified: SwiftApps/SwiftR/Swift/man/swiftLibrary.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/swiftLibrary.Rd 2011-10-19 20:11:19 UTC (rev 5249) +++ SwiftApps/SwiftR/Swift/man/swiftLibrary.Rd 2011-10-20 23:32:20 UTC (rev 5250) @@ -61,7 +61,7 @@ \seealso{ %% ~~objects to See Also as \code{\link{help}}, ~~~ -\code{\link{Swift-package}} +\code{\link{Swift}} } \examples{ library(Swift) Added: SwiftApps/SwiftR/Swift/man/swiftTests.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/swiftTests.Rd (rev 0) +++ SwiftApps/SwiftR/Swift/man/swiftTests.Rd 2011-10-20 23:32:20 UTC (rev 5250) @@ -0,0 +1,58 @@ +\name{swiftTests} +\alias{runAllSwiftTests} +\alias{basicSwiftTest} +%- Also NEED an '\alias' for EACH other topic documented here. +\title{ +Swift Test Suite +} +\description{ +These functions run automated tests for the Swift package. +} +\usage{ +runAllSwiftTests(...) +basicSwiftTest(...) +} +%- maybe also 'usage' for other objects documented here. +\arguments{ + \item{\dots}{ + Any arguments to be passed to \code{swiftInit} when starting up a + test cluster. +} +} +\details{ + Run the SwiftR test suite and report on successes and failures. + \code{basicSwiftTest} runs a single test as a sanity check for + the system. \code{runAllSwiftTests} tests a broader range of + SwiftR functionality. +} +\value{ + \code{runAllSwiftTests} returns a data structure describing the results of the test suite. + \code{basicSwiftTest} returns a boolean value, TRUE if the test was successful. + In the event of some failures the test suite may hang. +} +\references{ +\url{http://www.ci.uchicago.edu/swift} +} +\author{ +Swift was developed by: Mihael Hategan, Ben Clifford, Justin Wozniak, +Yong Zhao, Ian Foster, and Michael Wilde with contributions from Sarah +Kenny, Ioan Raicu, Luiz Gadelha, Allan Espinosa, Zhao Zhang, David +Kelly, Jon Monette, Glen Hocky, Tom Uram, Wenjun Wu, and other users. + +Swift R package developed by Michael Wilde, Tim Armstrong and the OpenMx project + +Maintainer: Michael Wilde +} + +\seealso{ +\code{\link{swiftInit}} +\code{\link{Swift}} +} +\examples{ +library(Swift) +runAllSwiftTests() +\dontrun{runAllSwiftTests(server="local", cores=4)} +\dontrun{runAllSwiftTests(server="ssh", cores=4, + hosts=c("larry.example.com", "moe.example.com", "curly.example.com"))} +\dontrun{basicSwiftTest(server="pbsauto", nodes=4, cores=8, time="00:30:00")} +} Modified: SwiftApps/SwiftR/Swift/man/swiftapply.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/swiftapply.Rd 2011-10-19 20:11:19 UTC (rev 5249) +++ SwiftApps/SwiftR/Swift/man/swiftapply.Rd 2011-10-20 23:32:20 UTC (rev 5250) @@ -143,7 +143,7 @@ \seealso{ %% ~~objects to See Also as \code{\link{help}}, ~~~ \code{\link{swiftInit}} -\code{\link{Swift-package}} +\code{\link{Swift}} } \examples{ \dontshow{library(Swift)} From tga at ci.uchicago.edu Thu Oct 20 18:32:32 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Thu, 20 Oct 2011 18:32:32 -0500 (CDT) Subject: [Swift-commit] r5251 - in SwiftApps/SwiftR/Swift: src tests tests/OpenMx tests/perf Message-ID: <20111020233232.959BF9CCA5@svn.ci.uchicago.edu> Author: tga Date: 2011-10-20 18:32:32 -0500 (Thu, 20 Oct 2011) New Revision: 5251 Added: SwiftApps/SwiftR/Swift/tests/perf/perfutils.R Removed: SwiftApps/SwiftR/Swift/tests/perf_tests.R Modified: SwiftApps/SwiftR/Swift/src/Makefile SwiftApps/SwiftR/Swift/tests/OpenMx/BootstrapParallelBigger.R SwiftApps/SwiftR/Swift/tests/OpenMx/RAM-3Factor-96Indicators-covdata-a.R SwiftApps/SwiftR/Swift/tests/perf/param_size.R SwiftApps/SwiftR/Swift/tests/perf/serialisation_overhead.R Log: Working on R check errors * Delete Swift/inst directory for CRAN package * Move perf_tests.R so it isn't automatically run by check script Modified: SwiftApps/SwiftR/Swift/src/Makefile =================================================================== --- SwiftApps/SwiftR/Swift/src/Makefile 2011-10-20 23:32:20 UTC (rev 5250) +++ SwiftApps/SwiftR/Swift/src/Makefile 2011-10-20 23:32:32 UTC (rev 5251) @@ -53,6 +53,7 @@ removeall: removebuild rm -rf ./$(SWIFT_INST) + rm -rf ../inst removebuild: Modified: SwiftApps/SwiftR/Swift/tests/OpenMx/BootstrapParallelBigger.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/OpenMx/BootstrapParallelBigger.R 2011-10-20 23:32:20 UTC (rev 5250) +++ SwiftApps/SwiftR/Swift/tests/OpenMx/BootstrapParallelBigger.R 2011-10-20 23:32:32 UTC (rev 5251) @@ -26,7 +26,7 @@ require(OpenMx) require(Swift) -source("Swift/tests/perf_tests.R") +source("Swift/tests/perf/perfutils.R") Modified: SwiftApps/SwiftR/Swift/tests/OpenMx/RAM-3Factor-96Indicators-covdata-a.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/OpenMx/RAM-3Factor-96Indicators-covdata-a.R 2011-10-20 23:32:20 UTC (rev 5250) +++ SwiftApps/SwiftR/Swift/tests/OpenMx/RAM-3Factor-96Indicators-covdata-a.R 2011-10-20 23:32:32 UTC (rev 5251) @@ -26,7 +26,7 @@ library(OpenMx) library(Swift) -source("Swift/tests/perf_tests.R") +source("Swift/tests/perf/perfutils.R") # --------------------------------------------------------------------- # Data for factor model. Modified: SwiftApps/SwiftR/Swift/tests/perf/param_size.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/perf/param_size.R 2011-10-20 23:32:20 UTC (rev 5250) +++ SwiftApps/SwiftR/Swift/tests/perf/param_size.R 2011-10-20 23:32:32 UTC (rev 5251) @@ -1,5 +1,5 @@ require(Swift) -source("Swift/tests/perf_tests.R") +source("Swift/tests/perf/perfutils.R") cores <- 4 intsize <- 4 Copied: SwiftApps/SwiftR/Swift/tests/perf/perfutils.R (from rev 5250, SwiftApps/SwiftR/Swift/tests/perf_tests.R) =================================================================== --- SwiftApps/SwiftR/Swift/tests/perf/perfutils.R (rev 0) +++ SwiftApps/SwiftR/Swift/tests/perf/perfutils.R 2011-10-20 23:32:32 UTC (rev 5251) @@ -0,0 +1,105 @@ +# Helper functions for building performance tests suites that don't quite fit in the +# main SwiftR code because they can detach the Swift package.. + + +swiftSetup <- function (...) { + libraries <- search() + if ("package:Swift" %in% libraries) { + library(Swift) + options(.swift.detach=T) + } + library(Swift) + swiftSess <- swiftInit(...) + options(.swift.printtiming=getOption("swift.printtiming")) + options(swift.printtiming=TRUE) + # Wait to start + Sys.sleep(10) + # Run some small jobs to ensure workers are started and warmed up + swiftapply(function (x) { x }, + rep(1, swiftSess$cores * swiftSess$nodes * 2), + callsperbatch=1) + return (swiftSess) +} + +swiftTearDown <- function (...) { + swiftShutdown() + options(swift.printtiming=getOption(".swift.printtiming")) + dt <- getOption(".swift.detach") + options(.swift.detach=NULL) + if (!is.null(dt) && dt) { + detach(package:Swift) + } +} + +sfSetup <- function(..., cpus=ncpus) { + libraries <- search() + if (!("package:snowfall" %in% libraries)) { + library(snowfall) + options(.snowfall.detach=T) + } + # Swift needs to be detached + if ("package:Swift" %in% libraries) { + detach(package:Swift) + options(.swift.reattach=T) + } + + sfInit(..., cpus=ncpus) + # warmup + sfLapply(rep(1, ncpus * 2), + function (x) { x }) + +} + +sfTearDown <- function (...) { + sfStop() + dt <- getOption(".snowfall.detach") + options(.snowfall.detach=NULL) + if (!is.null(dt) && dt) { + detach(package:snowfall) + } + rt <- getOption(".swift.reattach") + options(.swift.reattach=NULL) + if (!is.null(rt) && rt) { + library(Swift) + } +} + + + +makePerfTestGroup <- function (mode, name, f, allargs, prep=NULL, ...) { + params <- list(...) + paramstr <- paste(names(params), + rep("=", length(params)), + lapply(params, deparse), + sep="", collapse=", ") + if (mode == "swift") { + tg <- Swift:::makeParamTestGroup(name=paste("swift_",name, " ", paramstr,sep=""), + f=f, prep=prep, + allargs=allargs, + perfparams = params, + setup=function() {swiftSetup(...)}, + teardown = swiftTearDown) + } + else if (mode == "snowfall") { + tg <- Swift:::makeParamTestGroup(name=paste("sf_",name, paramstr, sep=""), + f=f,prep=prep, + allargs=allargs, + perfparams = params, + setup=function() {sfSetup(...)}, + teardown = sfTearDown) + + } + else { + print("Making serial test") + tg <- Swift:::makeParamTestGroup(name=paste("serial_",name, paramstr, sep=""), + f=f,prep=prep, + allargs=allargs, + perfparams = list(), + setup=function() + {try(detach(package:Swift)); try(detach(package:Snowfall))} ) + } + return (tg) +} + + + Modified: SwiftApps/SwiftR/Swift/tests/perf/serialisation_overhead.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/perf/serialisation_overhead.R 2011-10-20 23:32:20 UTC (rev 5250) +++ SwiftApps/SwiftR/Swift/tests/perf/serialisation_overhead.R 2011-10-20 23:32:32 UTC (rev 5251) @@ -1,6 +1,6 @@ require(Swift) -source("Swift/tests/perf_tests.R") +source("Swift/tests/perf/perfutils.R") source("Swift/tests/OpenMx/BootstrapParallelBigger.R") args = 128 Deleted: SwiftApps/SwiftR/Swift/tests/perf_tests.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/perf_tests.R 2011-10-20 23:32:20 UTC (rev 5250) +++ SwiftApps/SwiftR/Swift/tests/perf_tests.R 2011-10-20 23:32:32 UTC (rev 5251) @@ -1,105 +0,0 @@ -# Helper functions for building performance tests suites that don't quite fit in the -# main SwiftR code because they can detach the Swift package.. - - -swiftSetup <- function (...) { - libraries <- search() - if ("package:Swift" %in% libraries) { - library(Swift) - options(.swift.detach=T) - } - library(Swift) - swiftSess <- swiftInit(...) - options(.swift.printtiming=getOption("swift.printtiming")) - options(swift.printtiming=TRUE) - # Wait to start - Sys.sleep(10) - # Run some small jobs to ensure workers are started and warmed up - swiftapply(function (x) { x }, - rep(1, swiftSess$cores * swiftSess$nodes * 2), - callsperbatch=1) - return (swiftSess) -} - -swiftTearDown <- function (...) { - swiftShutdown() - options(swift.printtiming=getOption(".swift.printtiming")) - dt <- getOption(".swift.detach") - options(.swift.detach=NULL) - if (!is.null(dt) && dt) { - detach(package:Swift) - } -} - -sfSetup <- function(..., cpus=ncpus) { - libraries <- search() - if (!("package:snowfall" %in% libraries)) { - library(snowfall) - options(.snowfall.detach=T) - } - # Swift needs to be detached - if ("package:Swift" %in% libraries) { - detach(package:Swift) - options(.swift.reattach=T) - } - - sfInit(..., cpus=ncpus) - # warmup - sfLapply(rep(1, ncpus * 2), - function (x) { x }) - -} - -sfTearDown <- function (...) { - sfStop() - dt <- getOption(".snowfall.detach") - options(.snowfall.detach=NULL) - if (!is.null(dt) && dt) { - detach(package:snowfall) - } - rt <- getOption(".swift.reattach") - options(.swift.reattach=NULL) - if (!is.null(rt) && rt) { - library(Swift) - } -} - - - -makePerfTestGroup <- function (mode, name, f, allargs, prep=NULL, ...) { - params <- list(...) - paramstr <- paste(names(params), - rep("=", length(params)), - lapply(params, deparse), - sep="", collapse=", ") - if (mode == "swift") { - tg <- Swift:::makeParamTestGroup(name=paste("swift_",name, " ", paramstr,sep=""), - f=f, prep=prep, - allargs=allargs, - perfparams = params, - setup=function() {swiftSetup(...)}, - teardown = swiftTearDown) - } - else if (mode == "snowfall") { - tg <- Swift:::makeParamTestGroup(name=paste("sf_",name, paramstr, sep=""), - f=f,prep=prep, - allargs=allargs, - perfparams = params, - setup=function() {sfSetup(...)}, - teardown = sfTearDown) - - } - else { - print("Making serial test") - tg <- Swift:::makeParamTestGroup(name=paste("serial_",name, paramstr, sep=""), - f=f,prep=prep, - allargs=allargs, - perfparams = list(), - setup=function() - {try(detach(package:Swift)); try(detach(package:Snowfall))} ) - } - return (tg) -} - - - From tga at ci.uchicago.edu Thu Oct 20 18:36:10 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Thu, 20 Oct 2011 18:36:10 -0500 (CDT) Subject: [Swift-commit] r5252 - SwiftApps/SwiftR/Swift Message-ID: <20111020233610.D0F469CCA5@svn.ci.uchicago.edu> Author: tga Date: 2011-10-20 18:36:10 -0500 (Thu, 20 Oct 2011) New Revision: 5252 Modified: SwiftApps/SwiftR/Swift/DESCRIPTION Log: Bump SwiftR version number to encapsulate changes before resubmitting to CRAN Modified: SwiftApps/SwiftR/Swift/DESCRIPTION =================================================================== --- SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-20 23:32:32 UTC (rev 5251) +++ SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-20 23:36:10 UTC (rev 5252) @@ -1,8 +1,8 @@ Package: Swift Type: Package Title: R interface to Swift parallel scripting languaage -Version: 0.3.2 -Date: 2011-10-19 +Version: 0.3.3 +Date: 2011-10-20 Author: Michael Wilde Maintainer: Michael Wilde Depends: R (>= 2.11) @@ -10,4 +10,4 @@ Description: Routines to invoke R functions on remote resources through Swift. License: Apache License LazyLoad: yes -Packaged: 2011-10-19; Tim Armstrong +Packaged: 2011-10-20; Tim Armstrong From tga at ci.uchicago.edu Thu Oct 20 19:18:46 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Thu, 20 Oct 2011 19:18:46 -0500 (CDT) Subject: [Swift-commit] r5253 - SwiftApps/SwiftR/Swift/exec Message-ID: <20111021001846.8EA579CCA5@svn.ci.uchicago.edu> Author: tga Date: 2011-10-20 19:18:46 -0500 (Thu, 20 Oct 2011) New Revision: 5253 Modified: SwiftApps/SwiftR/Swift/exec/killtree Log: Don't print error message when killing swift process which has already exited Modified: SwiftApps/SwiftR/Swift/exec/killtree =================================================================== --- SwiftApps/SwiftR/Swift/exec/killtree 2011-10-20 23:36:10 UTC (rev 5252) +++ SwiftApps/SwiftR/Swift/exec/killtree 2011-10-21 00:18:46 UTC (rev 5253) @@ -13,7 +13,7 @@ children="$children $newkids" fi #echo kids $children - kill $pid + kill $pid &> /dev/null done tokill=$children done From hategan at ci.uchicago.edu Fri Oct 21 21:11:32 2011 From: hategan at ci.uchicago.edu (hategan at ci.uchicago.edu) Date: Fri, 21 Oct 2011 21:11:32 -0500 (CDT) Subject: [Swift-commit] r5254 - branches/release-0.93/src/org/griphyn/vdl/karajan/lib Message-ID: <20111022021132.BDBAC9CC9A@svn.ci.uchicago.edu> Author: hategan Date: 2011-10-21 21:11:32 -0500 (Fri, 21 Oct 2011) New Revision: 5254 Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/Execute.java Log: show stageins and stageouts in the ticker for provider staging Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/Execute.java =================================================================== --- branches/release-0.93/src/org/griphyn/vdl/karajan/lib/Execute.java 2011-10-21 00:18:46 UTC (rev 5253) +++ branches/release-0.93/src/org/griphyn/vdl/karajan/lib/Execute.java 2011-10-22 02:11:32 UTC (rev 5254) @@ -93,6 +93,12 @@ RuntimeStats.setProgress(stack, "Submitted"); getReplicationManager(stack).submitted(task, e.getStatus().getTime()); } + else if (c == Status.STAGE_IN) { + RuntimeStats.setProgress(stack, "Stage in"); + } + else if (c == Status.STAGE_OUT) { + RuntimeStats.setProgress(stack, "Stage out"); + } else if (c == Status.ACTIVE) { RuntimeStats.setProgress(stack, "Active"); getReplicationManager(stack).active(task, e.getStatus().getTime()); From wozniak at ci.uchicago.edu Sat Oct 22 21:06:03 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Sat, 22 Oct 2011 21:06:03 -0500 (CDT) Subject: [Swift-commit] r5255 - branches/release-0.93/tests/functions Message-ID: <20111023020603.AFEFE9CC9B@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-22 21:06:03 -0500 (Sat, 22 Oct 2011) New Revision: 5255 Modified: branches/release-0.93/tests/functions/100-assert-bool.check.sh branches/release-0.93/tests/functions/100-assert-int.check.sh branches/release-0.93/tests/functions/105-assert-loop.check.sh branches/release-0.93/tests/functions/106-assert-iter.check.sh branches/release-0.93/tests/functions/201-sprintf-k.check.sh branches/release-0.93/tests/functions/202-sprintf-k-array.check.sh branches/release-0.93/tests/functions/450-tracef.check.sh branches/release-0.93/tests/functions/500-exists.check.sh branches/release-0.93/tests/functions/500-exists.swift Log: Update stdout file name in tests Modified: branches/release-0.93/tests/functions/100-assert-bool.check.sh =================================================================== --- branches/release-0.93/tests/functions/100-assert-bool.check.sh 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/100-assert-bool.check.sh 2011-10-23 02:06:03 UTC (rev 5255) @@ -2,6 +2,6 @@ set -x -grep ASSERT_MESSAGE stdout.txt || exit 1 +grep ASSERT_MESSAGE 100-assert-bool.stdout || exit 1 exit 0 Modified: branches/release-0.93/tests/functions/100-assert-int.check.sh =================================================================== --- branches/release-0.93/tests/functions/100-assert-int.check.sh 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/100-assert-int.check.sh 2011-10-23 02:06:03 UTC (rev 5255) @@ -2,6 +2,6 @@ set -x -grep "assert failed" stdout.txt || exit 1 +grep "assert failed" 100-assert-int.stdout || exit 1 exit 0 Modified: branches/release-0.93/tests/functions/105-assert-loop.check.sh =================================================================== --- branches/release-0.93/tests/functions/105-assert-loop.check.sh 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/105-assert-loop.check.sh 2011-10-23 02:06:03 UTC (rev 5255) @@ -2,9 +2,9 @@ set -x -grep I_IS_4 stdout.txt || exit 1 +grep I_IS_4 105-assert-loop.stdout || exit 1 -LINES=$( grep -c "i:" stdout.txt ) +LINES=$( grep -c "i:" 105-assert-loop.stdout ) [[ ${LINES} == 5 ]] || exit 1 exit 0 Modified: branches/release-0.93/tests/functions/106-assert-iter.check.sh =================================================================== --- branches/release-0.93/tests/functions/106-assert-iter.check.sh 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/106-assert-iter.check.sh 2011-10-23 02:06:03 UTC (rev 5255) @@ -2,9 +2,9 @@ set -x -grep I_IS_4 stdout.txt || exit 1 +grep I_IS_4 106-assert-iter.stdout || exit 1 -LINES=$( grep -c "i:" stdout.txt ) +LINES=$( grep -c "i:" 106-assert-iter.stdout ) [[ ${LINES} == 5 ]] || exit 1 exit 0 Modified: branches/release-0.93/tests/functions/201-sprintf-k.check.sh =================================================================== --- branches/release-0.93/tests/functions/201-sprintf-k.check.sh 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/201-sprintf-k.check.sh 2011-10-23 02:06:03 UTC (rev 5255) @@ -2,12 +2,12 @@ set -x -OUTPUT=$( cat stdout.txt ) +OUTPUT=$( cat 201-sprintf-k.stdout ) [[ $? == 0 ]] || exit 1 echo $OUTPUT grep "ready.*delayed" [[ $? == 0 ]] || exit 1 -OUTPUT=$( grep delayed: stdout.txt | cut -d ' ' -f 2 ) +OUTPUT=$( grep delayed: 201-sprintf-k.stdout | cut -d ' ' -f 2 ) [[ $? == 0 ]] || exit 1 [[ ${OUTPUT[@]} == "4 6 8 10 12" ]] || exit 1 Modified: branches/release-0.93/tests/functions/202-sprintf-k-array.check.sh =================================================================== --- branches/release-0.93/tests/functions/202-sprintf-k-array.check.sh 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/202-sprintf-k-array.check.sh 2011-10-23 02:06:03 UTC (rev 5255) @@ -3,7 +3,7 @@ set -x # Grab partial output -OUTPUT=$( grep delayed: stdout.txt | head -4 | cut -d ' ' -f 2 ) +OUTPUT=$( grep delayed: 202-sprintf-k-array.stdout | head -4 | cut -d ' ' -f 2 ) [[ $? == 0 ]] || exit 1 # NOTE: we cannot guarantee that the "12" is before "array" @@ -12,7 +12,7 @@ [[ ${OUTPUT[@]} == "4 6 8 10" ]] || exit 1 # Grab whole output -OUTPUT=$( grep delayed: stdout.txt | cut -d ' ' -f 2 ) +OUTPUT=$( grep delayed: 202-sprintf-k-array.stdout | cut -d ' ' -f 2 ) # Output "10" is before "array" echo ${OUTPUT[@]} | grep "10.*array" Modified: branches/release-0.93/tests/functions/450-tracef.check.sh =================================================================== --- branches/release-0.93/tests/functions/450-tracef.check.sh 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/450-tracef.check.sh 2011-10-23 02:06:03 UTC (rev 5255) @@ -2,14 +2,14 @@ set -x -grep "int:3:3" stdout.txt || exit 1 -grep "string:4:4" stdout.txt || exit 1 -grep "fraction:3.14" stdout.txt || exit 1 -grep "file:file:.*/test.txt" stdout.txt || exit 1 -grep "array:\[9.0,91.0,19.0\]" stdout.txt || exit 1 -grep "pointer:.*Closed" stdout.txt || exit 1 +grep "int:3:3" 450-tracef.stdout || exit 1 +grep "string:4:4" 450-tracef.stdout || exit 1 +grep "fraction:3.14" 450-tracef.stdout || exit 1 +grep "file:file:.*/test.txt" 450-tracef.stdout || exit 1 +grep "array:\[9.0,91.0,19.0\]" 450-tracef.stdout || exit 1 +grep "pointer:.*Closed" 450-tracef.stdout || exit 1 -[[ $( grep -c "WORD" stdout.txt ) == 2 ]] || exit 1 -[[ $( grep "WORD" stdout.txt | wc -w ) == 5 ]] || exit 1 +[[ $( grep -c "WORD" 450-tracef.stdout ) == 2 ]] || exit 1 +[[ $( grep "WORD" 450-tracef.stdout | wc -w ) == 5 ]] || exit 1 exit 0 Modified: branches/release-0.93/tests/functions/500-exists.check.sh =================================================================== --- branches/release-0.93/tests/functions/500-exists.check.sh 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/500-exists.check.sh 2011-10-23 02:06:03 UTC (rev 5255) @@ -2,7 +2,7 @@ set -x -grep "file.txt: true" stdout.txt || exit 1 -grep "file-missing.txt: false" stdout.txt || exit 1 +grep "file.txt: true" 500-exists.stdout || exit 1 +grep "file-missing.txt: false" 500-exists.stdout || exit 1 exit 0 Modified: branches/release-0.93/tests/functions/500-exists.swift =================================================================== --- branches/release-0.93/tests/functions/500-exists.swift 2011-10-22 02:11:32 UTC (rev 5254) +++ branches/release-0.93/tests/functions/500-exists.swift 2011-10-23 02:06:03 UTC (rev 5255) @@ -7,5 +7,5 @@ b1 = @exists(s1); b2 = @exists(s2); -tracef("%s: %p\n%s: %p\n", +tracef("%s: %b\n%s: %b\n", s1, b1, s2, b2); From wozniak at ci.uchicago.edu Sat Oct 22 21:06:35 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Sat, 22 Oct 2011 21:06:35 -0500 (CDT) Subject: [Swift-commit] r5256 - branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript Message-ID: <20111023020635.6CA9E9CC9B@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-22 21:06:35 -0500 (Sat, 22 Oct 2011) New Revision: 5256 Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Fprintf.java branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Sprintf.java Log: Multiple toString/getValue fixes Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java =================================================================== --- branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java 2011-10-23 02:06:03 UTC (rev 5255) +++ branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java 2011-10-23 02:06:35 UTC (rev 5256) @@ -1,6 +1,6 @@ package org.griphyn.vdl.karajan.lib.swiftscript; -import org.apache.log4j.Logger; +// import org.apache.log4j.Logger; import org.globus.cog.karajan.arguments.Arg; import org.globus.cog.karajan.stack.VariableStack; import org.globus.cog.karajan.workflow.ExecutionException; @@ -16,8 +16,8 @@ */ public class Assert extends VDLFunction { - private static final Logger logger = - Logger.getLogger(Assert.class); + // private static final Logger logger = + // Logger.getLogger(Assert.class); static { setArguments(Assert.class, new Arg[] { Arg.VARGS }); @@ -31,7 +31,7 @@ if (args.length == 2) if (args[1].getType() == Types.STRING) - message = args[1].toString(); + message = (String) args[1].getValue(); else throw new ExecutionException ("Second argument to assert() must be a String!"); Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Fprintf.java =================================================================== --- branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Fprintf.java 2011-10-23 02:06:03 UTC (rev 5255) +++ branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Fprintf.java 2011-10-23 02:06:35 UTC (rev 5256) @@ -39,8 +39,8 @@ check(args); - String filename = args[0].toString(); - String spec = args[1].toString(); + String filename = (String) args[0].getValue(); + String spec = (String) args[1].getValue(); DSHandle[] vars = Sprintf.copyArray(args, 2, args.length-2); StringBuilder output = new StringBuilder(); @@ -59,10 +59,10 @@ ("fprintf(): requires at least 2 arguments!"); if (! args[0].getType().equals(Types.STRING)) throw new ExecutionException - ("fprintf(): first argument is a string filename!"); + ("fprintf(): first argument must be a string filename!"); if (! args[0].getType().equals(Types.STRING)) throw new ExecutionException - ("fprintf(): second argument is a string specifier!"); + ("fprintf(): second argument must be a string specifier!"); } private static void write(String filename, String msg) Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Sprintf.java =================================================================== --- branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Sprintf.java 2011-10-23 02:06:03 UTC (rev 5255) +++ branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Sprintf.java 2011-10-23 02:06:35 UTC (rev 5256) @@ -23,6 +23,7 @@ %%: % sign.
%M: Filename output: waits for close %p: Not typechecked, output as in trace().
+ %b: Typechecked boolean output.
%f: Typechecked float output.
%i: Typechecked int output.
%s: Typechecked string output.
@@ -119,6 +120,9 @@ if (c == 'M') { append_M(vars[arg], output); } + else if (c == 'b') { + append_b(vars[arg], output); + } else if (c == 'f') { append_f(vars[arg], output); } @@ -161,6 +165,17 @@ } } + private static void append_b(DSHandle arg, StringBuilder output) + throws ExecutionException { + if (arg.getType() == Types.BOOLEAN) { + output.append(arg.getValue()); + } + else { + throw new ExecutionException + ("tracef(): %b requires a boolean!"); + } + } + private static void append_f(DSHandle arg, StringBuilder output) throws ExecutionException { if (arg.getType() == Types.FLOAT) { From wozniak at ci.uchicago.edu Sat Oct 22 23:00:52 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Sat, 22 Oct 2011 23:00:52 -0500 (CDT) Subject: [Swift-commit] r5257 - trunk/tests/functions Message-ID: <20111023040052.7C5129CC9B@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-22 23:00:52 -0500 (Sat, 22 Oct 2011) New Revision: 5257 Modified: trunk/tests/functions/100-assert-bool.check.sh trunk/tests/functions/100-assert-int.check.sh trunk/tests/functions/105-assert-loop.check.sh trunk/tests/functions/106-assert-iter.check.sh trunk/tests/functions/201-sprintf-k.check.sh trunk/tests/functions/202-sprintf-k-array.check.sh trunk/tests/functions/450-tracef.check.sh trunk/tests/functions/500-exists.check.sh trunk/tests/functions/500-exists.swift Log: Tests: fixes to file naming and number formatting Modified: trunk/tests/functions/100-assert-bool.check.sh =================================================================== --- trunk/tests/functions/100-assert-bool.check.sh 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/100-assert-bool.check.sh 2011-10-23 04:00:52 UTC (rev 5257) @@ -2,6 +2,6 @@ set -x -grep ASSERT_MESSAGE stdout.txt || exit 1 +grep ASSERT_MESSAGE 100-assert-bool.stdout || exit 1 exit 0 Modified: trunk/tests/functions/100-assert-int.check.sh =================================================================== --- trunk/tests/functions/100-assert-int.check.sh 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/100-assert-int.check.sh 2011-10-23 04:00:52 UTC (rev 5257) @@ -2,6 +2,6 @@ set -x -grep "assert failed" stdout.txt || exit 1 +grep "assert failed" 100-assert-int.stdout || exit 1 exit 0 Modified: trunk/tests/functions/105-assert-loop.check.sh =================================================================== --- trunk/tests/functions/105-assert-loop.check.sh 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/105-assert-loop.check.sh 2011-10-23 04:00:52 UTC (rev 5257) @@ -2,9 +2,9 @@ set -x -grep I_IS_4 stdout.txt || exit 1 +grep I_IS_4 105-assert-loop.stdout || exit 1 -LINES=$( grep -c "i:" stdout.txt ) +LINES=$( grep -c "i:" 105-assert-loop.stdout ) [[ ${LINES} == 5 ]] || exit 1 exit 0 Modified: trunk/tests/functions/106-assert-iter.check.sh =================================================================== --- trunk/tests/functions/106-assert-iter.check.sh 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/106-assert-iter.check.sh 2011-10-23 04:00:52 UTC (rev 5257) @@ -2,9 +2,9 @@ set -x -grep I_IS_4 stdout.txt || exit 1 +grep I_IS_4 106-assert-iter.stdout || exit 1 -LINES=$( grep -c "i:" stdout.txt ) +LINES=$( grep -c "i:" 106-assert-iter.stdout ) [[ ${LINES} == 5 ]] || exit 1 exit 0 Modified: trunk/tests/functions/201-sprintf-k.check.sh =================================================================== --- trunk/tests/functions/201-sprintf-k.check.sh 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/201-sprintf-k.check.sh 2011-10-23 04:00:52 UTC (rev 5257) @@ -2,12 +2,12 @@ set -x -OUTPUT=$( cat stdout.txt ) +OUTPUT=$( cat 201-sprintf-k.stdout ) [[ $? == 0 ]] || exit 1 echo $OUTPUT grep "ready.*delayed" [[ $? == 0 ]] || exit 1 -OUTPUT=$( grep delayed: stdout.txt | cut -d ' ' -f 2 ) +OUTPUT=$( grep delayed: 201-sprintf-k.stdout | cut -d ' ' -f 2 ) [[ $? == 0 ]] || exit 1 [[ ${OUTPUT[@]} == "4 6 8 10 12" ]] || exit 1 Modified: trunk/tests/functions/202-sprintf-k-array.check.sh =================================================================== --- trunk/tests/functions/202-sprintf-k-array.check.sh 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/202-sprintf-k-array.check.sh 2011-10-23 04:00:52 UTC (rev 5257) @@ -3,7 +3,7 @@ set -x # Grab partial output -OUTPUT=$( grep delayed: stdout.txt | head -4 | cut -d ' ' -f 2 ) +OUTPUT=$( grep delayed: 202-sprintf-k-array.stdout | head -4 | cut -d ' ' -f 2 ) [[ $? == 0 ]] || exit 1 # NOTE: we cannot guarantee that the "12" is before "array" @@ -12,7 +12,7 @@ [[ ${OUTPUT[@]} == "4 6 8 10" ]] || exit 1 # Grab whole output -OUTPUT=$( grep delayed: stdout.txt | cut -d ' ' -f 2 ) +OUTPUT=$( grep delayed: 202-sprintf-k-array.stdout | cut -d ' ' -f 2 ) # Output "10" is before "array" echo ${OUTPUT[@]} | grep "10.*array" Modified: trunk/tests/functions/450-tracef.check.sh =================================================================== --- trunk/tests/functions/450-tracef.check.sh 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/450-tracef.check.sh 2011-10-23 04:00:52 UTC (rev 5257) @@ -2,14 +2,14 @@ set -x -grep "int:3:3" stdout.txt || exit 1 -grep "string:4:4" stdout.txt || exit 1 -grep "fraction:3.14" stdout.txt || exit 1 -grep "file:file:.*/test.txt" stdout.txt || exit 1 -grep "array:\[9.0,91.0,19.0\]" stdout.txt || exit 1 -grep "pointer:.*Closed" stdout.txt || exit 1 +grep "int:3:3" 450-tracef.stdout || exit 1 +grep "string:4:4" 450-tracef.stdout || exit 1 +grep "fraction:3.14" 450-tracef.stdout || exit 1 +grep "file:file:.*/test.txt" 450-tracef.stdout || exit 1 +grep "array:\[9,91,19\]" 450-tracef.stdout || exit 1 +grep "pointer:.*Closed" 450-tracef.stdout || exit 1 -[[ $( grep -c "WORD" stdout.txt ) == 2 ]] || exit 1 -[[ $( grep "WORD" stdout.txt | wc -w ) == 5 ]] || exit 1 +[[ $( grep -c "WORD" 450-tracef.stdout ) == 2 ]] || exit 1 +[[ $( grep "WORD" 450-tracef.stdout | wc -w ) == 5 ]] || exit 1 exit 0 Modified: trunk/tests/functions/500-exists.check.sh =================================================================== --- trunk/tests/functions/500-exists.check.sh 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/500-exists.check.sh 2011-10-23 04:00:52 UTC (rev 5257) @@ -2,7 +2,7 @@ set -x -grep "file.txt: true" stdout.txt || exit 1 -grep "file-missing.txt: false" stdout.txt || exit 1 +grep "file.txt: true" 500-exists.stdout || exit 1 +grep "file-missing.txt: false" 500-exists.stdout || exit 1 exit 0 Modified: trunk/tests/functions/500-exists.swift =================================================================== --- trunk/tests/functions/500-exists.swift 2011-10-23 02:06:35 UTC (rev 5256) +++ trunk/tests/functions/500-exists.swift 2011-10-23 04:00:52 UTC (rev 5257) @@ -7,5 +7,5 @@ b1 = @exists(s1); b2 = @exists(s2); -tracef("%s: %p\n%s: %p\n", +tracef("%s: %b\n%s: %b\n", s1, b1, s2, b2); From wozniak at ci.uchicago.edu Sat Oct 22 23:03:13 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Sat, 22 Oct 2011 23:03:13 -0500 (CDT) Subject: [Swift-commit] r5258 - trunk/src/org/griphyn/vdl/karajan/lib/swiftscript Message-ID: <20111023040313.3D5789CC9B@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-22 23:03:13 -0500 (Sat, 22 Oct 2011) New Revision: 5258 Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Fprintf.java trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Sprintf.java Log: New formatter %b (boolean); fixes for toString/getValue, PathParser Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java =================================================================== --- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java 2011-10-23 04:00:52 UTC (rev 5257) +++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Assert.java 2011-10-23 04:03:13 UTC (rev 5258) @@ -1,6 +1,6 @@ package org.griphyn.vdl.karajan.lib.swiftscript; -import org.apache.log4j.Logger; +// import org.apache.log4j.Logger; import org.globus.cog.karajan.arguments.Arg; import org.globus.cog.karajan.stack.VariableStack; import org.globus.cog.karajan.workflow.ExecutionException; @@ -16,8 +16,8 @@ */ public class Assert extends VDLFunction { - private static final Logger logger = - Logger.getLogger(Assert.class); + // private static final Logger logger = + // Logger.getLogger(Assert.class); static { setArguments(Assert.class, new Arg[] { Arg.VARGS }); @@ -31,7 +31,7 @@ if (args.length == 2) if (args[1].getType() == Types.STRING) - message = args[1].toString(); + message = (String) args[1].getValue(); else throw new ExecutionException ("Second argument to assert() must be a String!"); @@ -50,8 +50,8 @@ success = false; } else if (value.getType() == Types.INT) { - double d = ((Double) value.getValue()).doubleValue(); - if (d == 0.0) + double d = ((Integer) value.getValue()).intValue(); + if (d == 0) success = false; } else Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Fprintf.java =================================================================== --- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Fprintf.java 2011-10-23 04:00:52 UTC (rev 5257) +++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Fprintf.java 2011-10-23 04:03:13 UTC (rev 5258) @@ -39,8 +39,8 @@ check(args); - String filename = args[0].toString(); - String spec = args[1].toString(); + String filename = (String) args[0].getValue(); + String spec = (String) args[1].getValue(); DSHandle[] vars = Sprintf.copyArray(args, 2, args.length-2); StringBuilder output = new StringBuilder(); @@ -59,10 +59,10 @@ ("fprintf(): requires at least 2 arguments!"); if (! args[0].getType().equals(Types.STRING)) throw new ExecutionException - ("fprintf(): first argument is a string filename!"); + ("fprintf(): first argument must be a string filename!"); if (! args[0].getType().equals(Types.STRING)) throw new ExecutionException - ("fprintf(): second argument is a string specifier!"); + ("fprintf(): second argument must be a string specifier!"); } private static void write(String filename, String msg) Modified: trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Sprintf.java =================================================================== --- trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Sprintf.java 2011-10-23 04:00:52 UTC (rev 5257) +++ trunk/src/org/griphyn/vdl/karajan/lib/swiftscript/Sprintf.java 2011-10-23 04:03:13 UTC (rev 5258) @@ -23,6 +23,7 @@ %%: % sign.
%M: Filename output: waits for close %p: Not typechecked, output as in trace().
+ %b: Typechecked boolean output.
%f: Typechecked float output.
%i: Typechecked int output.
%s: Typechecked string output.
@@ -119,6 +120,9 @@ if (c == 'M') { append_M(vars[arg], output); } + else if (c == 'b') { + append_b(vars[arg], output); + } else if (c == 'f') { append_f(vars[arg], output); } @@ -161,6 +165,17 @@ } } + private static void append_b(DSHandle arg, StringBuilder output) + throws ExecutionException { + if (arg.getType() == Types.BOOLEAN) { + output.append(arg.getValue()); + } + else { + throw new ExecutionException + ("tracef(): %b requires a boolean!"); + } + } + private static void append_f(DSHandle arg, StringBuilder output) throws ExecutionException { if (arg.getType() == Types.FLOAT) { @@ -192,7 +207,7 @@ try { int size = node.size(); for (int i = 0; i < size; i++) { - String entry = ""+i; + String entry = "["+i+"]"; DSHandle handle = node.getField(Path.parse(entry)); output.append(handle.getValue()); From wozniak at ci.uchicago.edu Wed Oct 26 11:33:11 2011 From: wozniak at ci.uchicago.edu (wozniak at ci.uchicago.edu) Date: Wed, 26 Oct 2011 11:33:11 -0500 (CDT) Subject: [Swift-commit] r5259 - trunk/docs/userguide Message-ID: <20111026163311.588099CC9B@svn.ci.uchicago.edu> Author: wozniak Date: 2011-10-26 11:33:11 -0500 (Wed, 26 Oct 2011) New Revision: 5259 Modified: trunk/docs/userguide/profiles Log: Add documentation about Swift dynamic profiles Modified: trunk/docs/userguide/profiles =================================================================== --- trunk/docs/userguide/profiles 2011-10-23 04:03:13 UTC (rev 5258) +++ trunk/docs/userguide/profiles 2011-10-26 16:33:11 UTC (rev 5259) @@ -1,15 +1,15 @@ -Profiles --------- -Profiles are configuration parameters than can be specified either for -sites or for transformation catalog entries. They influence the -behaviour of Swift towards that site (for example, by changing the load -Swift will place on that sites) or when running a particular procedure. +== Profiles +Profiles influence the behaviour of Swift when running an +app+ task. +They are configuration parameters than can be specified for +sites, for transformation catalog entries, or on a task-by-task as a dynamic +profile. + Profile entries for a site are specified in the site catalog. Profile entries for specific procedures are specified in the transformation -catalog. +catalog. Profile entries for a given task are specified in the +app+ +definition as a dynamic profile. - Karajan namespace ~~~~~~~~~~~~~~~~~ maxSubmitRate limits the maximum rate of job submission, in jobs per @@ -105,7 +105,7 @@ used by the GRAM2 and GRAM4 providers. condor_requirements allows a requirements string to be specified when -Condor is used as an LRM behind GRAM2. Example: +Condor is used as an LRM behind GRAM2. Example: ---- Arch == "X86_64" || Arch="INTEL" @@ -171,7 +171,7 @@ maxnodes - Determines the maximum number of nodes that can be allocated in one coaster block. Default: unlimited. -maxtime - Indicates the maximum walltime, in seconds, that a coaster +maxtime - Indicates the maximum walltime, in seconds, that a coaster block can have. Default: unlimited. @@ -179,11 +179,11 @@ Swing window showing, graphically, the state of the coaster scheduler (blocks, jobs, etc.). Default: false -internalhostname - If the head node has multiple network interfaces, -only one of which is visible from the worker nodes. The choice of -which interface is the one that worker nodes can connect to is a -matter of the particular cluster. This must be set in the your -sites file to clarify to the workers which exact interface on the +internalhostname - If the head node has multiple network interfaces, +only one of which is visible from the worker nodes. The choice of +which interface is the one that worker nodes can connect to is a +matter of the particular cluster. This must be set in the your +sites file to clarify to the workers which exact interface on the head node they are to try to connect to. env namespace @@ -212,8 +212,43 @@ about the remote site to be gathered and returned to the submit side. (since Swift 0.9) -SWIFT_GEN_SCRIPTS - set in the env namespace profiles. This variable +SWIFT_GEN_SCRIPTS - set in the env namespace profiles. This variable just needs to be set, it doesn't matter what it is set to. If set, then Swift will keep the script that was used to execute the job in the job directory. The script will be called run.sh and will have the command line that Swift tried to execute with. + +=== Dynamic profiles + +To set a profile setting based on the value of a Swift variable, you +must use dynamic profiles. This allows you to set profile settings in +the +globus+ namespace. + +---- +app (file o) c(file i, int p) +{ + profile "mpi.processes" = 2+p; + profile "mpi.ppn" = 1; + + my_mpi_program @i @o; +} +---- + +This would be equivalent to the sites file settings: + +---- +4 +1 +---- + +except, of course, the number of MPI processes may not be dynamically +set by the value of Swift variable +p+ in the sites file. + +Additional beneficial use cases of dynamic profiles may be to set the ++maxwalltime+ or +queue+ profile settings. + +=== Profile debugging + +Swift profiles, generally speaking, are converted into Java CoG +"attributes", which are attached to each CoG task. Thus, when reading +the log or debugging, look for messages regarding "attributes". From jonmon at ci.uchicago.edu Thu Oct 27 22:50:31 2011 From: jonmon at ci.uchicago.edu (jonmon at ci.uchicago.edu) Date: Thu, 27 Oct 2011 22:50:31 -0500 (CDT) Subject: [Swift-commit] r5260 - branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript Message-ID: <20111028035031.4CD6E9CCA8@svn.ci.uchicago.edu> Author: jonmon Date: 2011-10-27 22:50:31 -0500 (Thu, 27 Oct 2011) New Revision: 5260 Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Java.java Log: Added fix for the @java function. Java.java:getMethod() was using toString() instead of getValue(). Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Java.java =================================================================== --- branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Java.java 2011-10-26 16:33:11 UTC (rev 5259) +++ branches/release-0.93/src/org/griphyn/vdl/karajan/lib/swiftscript/Java.java 2011-10-28 03:50:31 UTC (rev 5260) @@ -46,8 +46,8 @@ ("@java() requires at least two arguments"); try { - lib = args[0].toString(); - name = args[1].toString(); + lib = (String)args[0].getValue(); + name = (String)args[1].getValue(); clazz = Class.forName(lib); Method[] methods = clazz.getMethods(); result = null; From tga at ci.uchicago.edu Fri Oct 28 21:55:13 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Fri, 28 Oct 2011 21:55:13 -0500 (CDT) Subject: [Swift-commit] r5261 - in SwiftApps/SwiftR: . Swift/exec Swift/src Message-ID: <20111029025513.76B8A9CCA5@svn.ci.uchicago.edu> Author: tga Date: 2011-10-28 21:55:13 -0500 (Fri, 28 Oct 2011) New Revision: 5261 Modified: SwiftApps/SwiftR/Swift/exec/configure-server-crayxtauto SwiftApps/SwiftR/Swift/src/make.include SwiftApps/SwiftR/checkout-swift.sh Log: Getting crayxtauto working with Swift 0.93 which now supports it properly Modified: SwiftApps/SwiftR/Swift/exec/configure-server-crayxtauto =================================================================== --- SwiftApps/SwiftR/Swift/exec/configure-server-crayxtauto 2011-10-28 03:50:31 UTC (rev 5260) +++ SwiftApps/SwiftR/Swift/exec/configure-server-crayxtauto 2011-10-29 02:55:13 UTC (rev 5261) @@ -35,9 +35,7 @@ $nodes - $cores $cores - $cores Modified: SwiftApps/SwiftR/Swift/src/make.include =================================================================== --- SwiftApps/SwiftR/Swift/src/make.include 2011-10-28 03:50:31 UTC (rev 5260) +++ SwiftApps/SwiftR/Swift/src/make.include 2011-10-29 02:55:13 UTC (rev 5261) @@ -1,6 +1,13 @@ # Variables shared between makefiles +# Use 0.92.1 release SWIFT_SRC_TAG = release-0.92.1 COG_SRC_TAG = swift_0.92.1 SWIFT_SRC_NAME = swift-0.92.1-SwiftR-r2 + +# Use 0.93 release candidate branch +#SWIFT_SRC_TAG = branches/release-0.93 +#COG_SRC_TAG = branches/4.1.9/src/cog +#SWIFT_SRC_NAME = swift-0.93-SwiftR-r1 + SWIFT_SRC_PATCH = swift-0.92.1-changes.patch Modified: SwiftApps/SwiftR/checkout-swift.sh =================================================================== --- SwiftApps/SwiftR/checkout-swift.sh 2011-10-28 03:50:31 UTC (rev 5260) +++ SwiftApps/SwiftR/checkout-swift.sh 2011-10-29 02:55:13 UTC (rev 5261) @@ -24,10 +24,10 @@ echo Checking out CoG source -svn checkout https://cogkit.svn.sourceforge.net/svnroot/cogkit/tags/${COG_TAG} ${COG_SRC} +svn checkout https://cogkit.svn.sourceforge.net/svnroot/cogkit/${COG_TAG} ${COG_SRC} echo Checking out Swift source (cd ${COG_SRC}/modules && - svn checkout https://svn.ci.uchicago.edu/svn/vdl2/tags/${SWIFT_TAG} swift) + svn checkout https://svn.ci.uchicago.edu/svn/vdl2/${SWIFT_TAG} swift) patch -d ${COG_SRC} -p0 < $SWIFT_PATCH (cd ${COG_SRC} && xargs -d '\n' -n 1 --arg-file=../${SWIFT_PATCH}.deleted rm -rf) From hategan at ci.uchicago.edu Sat Oct 29 19:57:08 2011 From: hategan at ci.uchicago.edu (hategan at ci.uchicago.edu) Date: Sat, 29 Oct 2011 19:57:08 -0500 (CDT) Subject: [Swift-commit] r5262 - branches/release-0.93/src/org/griphyn/vdl/karajan Message-ID: <20111030005708.193C39CC82@svn.ci.uchicago.edu> Author: hategan Date: 2011-10-29 19:57:07 -0500 (Sat, 29 Oct 2011) New Revision: 5262 Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java Log: fixed deadlock Modified: branches/release-0.93/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java =================================================================== --- branches/release-0.93/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java 2011-10-29 02:55:13 UTC (rev 5261) +++ branches/release-0.93/src/org/griphyn/vdl/karajan/ArrayIndexFutureList.java 2011-10-30 00:57:07 UTC (rev 5262) @@ -11,6 +11,7 @@ import java.util.Set; import org.globus.cog.karajan.stack.VariableStack; +import org.globus.cog.karajan.workflow.events.EventBus; import org.globus.cog.karajan.workflow.events.EventTargetPair; import org.globus.cog.karajan.workflow.futures.FutureEvaluationException; import org.globus.cog.karajan.workflow.futures.FutureIterator; @@ -115,9 +116,14 @@ listeners = null; } - for (ListenerStackPair lsp : l) { + for (final ListenerStackPair lsp : l) { WaitingThreadsMonitor.removeThread(lsp.stack); - lsp.listener.futureModified(this, lsp.stack); + EventBus.post(new Runnable() { + @Override + public void run() { + lsp.listener.futureModified(ArrayIndexFutureList.this, lsp.stack); + } + }); } } From davidk at ci.uchicago.edu Sun Oct 30 16:43:59 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Sun, 30 Oct 2011 16:43:59 -0500 (CDT) Subject: [Swift-commit] r5263 - branches/release-0.93/tests/providers Message-ID: <20111030214359.045879CCA5@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-30 16:43:58 -0500 (Sun, 30 Oct 2011) New Revision: 5263 Removed: branches/release-0.93/tests/providers/pads/ Log: Removed duplicate pads tests From tga at ci.uchicago.edu Mon Oct 31 14:23:48 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Mon, 31 Oct 2011 14:23:48 -0500 (CDT) Subject: [Swift-commit] r5264 - SwiftApps/SwiftR Message-ID: <20111031192348.CB7289CCAA@svn.ci.uchicago.edu> Author: tga Date: 2011-10-31 14:23:48 -0500 (Mon, 31 Oct 2011) New Revision: 5264 Modified: SwiftApps/SwiftR/Makefile Log: swiftr makefile fix to not depend on GNU sed Modified: SwiftApps/SwiftR/Makefile =================================================================== --- SwiftApps/SwiftR/Makefile 2011-10-30 21:43:58 UTC (rev 5263) +++ SwiftApps/SwiftR/Makefile 2011-10-31 19:23:48 UTC (rev 5264) @@ -16,9 +16,10 @@ # Extract the version number from the R package description file # There should be a line in the file of the form: # Version: (major).(minor) -SWIFTR_VERSION=$(shell sed -n -r 's/^Version:(\W*)([[:digit:]]+\.[[:digit:].]+)/\2/p' Swift/DESCRIPTION) +SWIFTR_VERSION=$(shell sed -n 's/^Version:[ \t]*\([0-9][0-9]*\.[0-9\.]*\)[ \t]*$$/\1/p' Swift/DESCRIPTION) + GEN_PKG_NAME=Swift_$(SWIFTR_VERSION).tar.gz FULL_PKG=Swift_$(SWIFTR_VERSION)_full.tar.gz CRAN_PKG=Swift_$(SWIFTR_VERSION)_cran.tar.gz From davidk at ci.uchicago.edu Mon Oct 31 14:28:27 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Mon, 31 Oct 2011 14:28:27 -0500 (CDT) Subject: [Swift-commit] r5265 - in branches/release-0.93/tests: . functions Message-ID: <20111031192827.BF5959CCAA@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-31 14:28:27 -0500 (Mon, 31 Oct 2011) New Revision: 5265 Added: branches/release-0.93/tests/functions/401-java-sin.out.expected branches/release-0.93/tests/functions/401-java-sin.swift Modified: branches/release-0.93/tests/suite.sh Log: Added test for @java Reset .repeat values for each test Added: branches/release-0.93/tests/functions/401-java-sin.out.expected =================================================================== --- branches/release-0.93/tests/functions/401-java-sin.out.expected (rev 0) +++ branches/release-0.93/tests/functions/401-java-sin.out.expected 2011-10-31 19:28:27 UTC (rev 5265) @@ -0,0 +1 @@ +0.479425538604203 Added: branches/release-0.93/tests/functions/401-java-sin.swift =================================================================== --- branches/release-0.93/tests/functions/401-java-sin.swift (rev 0) +++ branches/release-0.93/tests/functions/401-java-sin.swift 2011-10-31 19:28:27 UTC (rev 5265) @@ -0,0 +1,10 @@ +type file; + +app (file result) sin(float x2) { + echo @strcat(@java("java.lang.Math", "sin", x2)) stdout=@filename(result); +} + +float x = 0.5; + +file output<"401-java-sin.out">; +output = sin(x); Modified: branches/release-0.93/tests/suite.sh =================================================================== --- branches/release-0.93/tests/suite.sh 2011-10-31 19:23:48 UTC (rev 5264) +++ branches/release-0.93/tests/suite.sh 2011-10-31 19:28:27 UTC (rev 5265) @@ -1087,7 +1087,9 @@ SCRIPT_BASENAME=`basename $TEST .swift` if [ -f "$GROUP/$SCRIPT_BASENAME.repeat" ]; then ITERS_LOCAL=`cat $GROUP/$SCRIPT_BASENAME.repeat` - fi + else + ITERS_LOCAL=1 + fi for (( i=0; $i<$ITERS_LOCAL; i=$i+1 )); do From davidk at ci.uchicago.edu Mon Oct 31 14:32:08 2011 From: davidk at ci.uchicago.edu (davidk at ci.uchicago.edu) Date: Mon, 31 Oct 2011 14:32:08 -0500 (CDT) Subject: [Swift-commit] r5266 - in trunk/tests: . functions Message-ID: <20111031193208.8D9219CCAA@svn.ci.uchicago.edu> Author: davidk Date: 2011-10-31 14:32:08 -0500 (Mon, 31 Oct 2011) New Revision: 5266 Added: trunk/tests/functions/401-java-sin.out.expected trunk/tests/functions/401-java-sin.swift Modified: trunk/tests/suite.sh Log: Added @java test Fix for .repeat Added: trunk/tests/functions/401-java-sin.out.expected =================================================================== --- trunk/tests/functions/401-java-sin.out.expected (rev 0) +++ trunk/tests/functions/401-java-sin.out.expected 2011-10-31 19:32:08 UTC (rev 5266) @@ -0,0 +1 @@ +0.479425538604203 Added: trunk/tests/functions/401-java-sin.swift =================================================================== --- trunk/tests/functions/401-java-sin.swift (rev 0) +++ trunk/tests/functions/401-java-sin.swift 2011-10-31 19:32:08 UTC (rev 5266) @@ -0,0 +1,10 @@ +type file; + +app (file result) sin(float x2) { + echo @strcat(@java("java.lang.Math", "sin", x2)) stdout=@filename(result); +} + +float x = 0.5; + +file output<"401-java-sin.out">; +output = sin(x); Modified: trunk/tests/suite.sh =================================================================== --- trunk/tests/suite.sh 2011-10-31 19:28:27 UTC (rev 5265) +++ trunk/tests/suite.sh 2011-10-31 19:32:08 UTC (rev 5266) @@ -1107,7 +1107,9 @@ TESTLINK="$TESTNAMEDIR/$TESTNAME" if [ -f "$GROUP/$SCRIPT_BASENAME.repeat" ]; then ITERS_LOCAL=`cat $GROUP/$SCRIPT_BASENAME.repeat` - fi + else + ITERS_LOCAL=1 + fi for (( i=0; $i<$ITERS_LOCAL; i=$i+1 )); do HOURMINSEC=$( date +"%H%M%S" ) From tga at ci.uchicago.edu Tue Oct 18 16:18:29 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Tue, 18 Oct 2011 21:18:29 -0000 Subject: [Swift-commit] r5243 - in SwiftApps/SwiftR: . Swift Swift/src/swift-patches Swift/tests Swift/tests/OpenMx Swift/tests/perf Message-ID: <20111018211757.C40DC9CC97@svn.ci.uchicago.edu> Author: tga Date: 2011-10-18 16:17:57 -0500 (Tue, 18 Oct 2011) New Revision: 5243 Modified: SwiftApps/SwiftR/Makefile SwiftApps/SwiftR/Swift/NAMESPACE SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch SwiftApps/SwiftR/Swift/tests/OpenMx/BootstrapParallelBigger.R SwiftApps/SwiftR/Swift/tests/OpenMx/RAM-3Factor-96Indicators-covdata-a.R SwiftApps/SwiftR/Swift/tests/perf/param_size.R SwiftApps/SwiftR/Swift/tests/perf_tests.R SwiftApps/SwiftR/Swift/tests/runtests.R Log: Removed files with spaces from swift source. Removed .svn directories from swift source tarball. Removed undocumented test functions from package exports and updated test scripts to use qualified names Modified: SwiftApps/SwiftR/Makefile =================================================================== --- SwiftApps/SwiftR/Makefile 2011-10-18 18:37:00 UTC (rev 5242) +++ SwiftApps/SwiftR/Makefile 2011-10-18 21:17:57 UTC (rev 5243) @@ -87,7 +87,7 @@ $(SWIFT_SRC_NAME).tar.gz: sh checkout-swift.sh $(SWIFT_SRC_NAME) $(SWIFT_PATCH_DIR)/$(SWIFT_SRC_PATCH) $(SWIFT_SRC_TAG) $(COG_SRC_TAG) cp -r $(SWIFT_PATCH_DIR) $(SWIFT_SRC_NAME)/SwiftR-patches - tar cvvzf $(SWIFT_SRC_NAME).tar.gz $(SWIFT_SRC_NAME) + tar --exclude='.svn' -cvvzf $(SWIFT_SRC_NAME).tar.gz $(SWIFT_SRC_NAME) rm -rf ./$(SWIFT_SRC_NAME) $(SWIFT_SRC_NAME).shasum: $(SWIFT_SRC_NAME).tar.gz Modified: SwiftApps/SwiftR/Swift/NAMESPACE =================================================================== --- SwiftApps/SwiftR/Swift/NAMESPACE 2011-10-18 18:37:00 UTC (rev 5242) +++ SwiftApps/SwiftR/Swift/NAMESPACE 2011-10-18 21:17:57 UTC (rev 5243) @@ -12,22 +12,3 @@ export(swiftExportAll) export(swiftRemoveAll) -export(runAllSwiftTests) -export(makeTestGroup) -export(makeParamTestGroup) -export(runTestGroup) -export(runTestSuite) -export(makeTestSuite) -export(printTestGroup) -export(mkTest) - -export(basicSwiftTest) -exportPattern("^swiftTest") -exportPattern("^testGroup") - -export(mkPerfTest) -export(doPerfTest) -export(analysePerf) -export(analyseSuitePerf) -export(mergeGroupResults) - Modified: SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch =================================================================== --- SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch 2011-10-18 18:37:00 UTC (rev 5242) +++ SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch 2011-10-18 21:17:57 UTC (rev 5243) @@ -1,6 +1,6 @@ Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java =================================================================== ---- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java (revision 3145) +--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java (revision 3296) +++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java (working copy) @@ -41,7 +41,7 @@ public static final Logger logger = Logger @@ -11,3 +11,19545 @@ public static final int CONNECT_TIMEOUT = 2 * 60 * 1000; +Index: modules/certmanagement/.classpath +=================================================================== +--- modules/certmanagement/.classpath (revision 3296) ++++ modules/certmanagement/.classpath (working copy) +@@ -1,11 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +Index: modules/certmanagement/project.properties +=================================================================== +--- modules/certmanagement/project.properties (revision 3296) ++++ modules/certmanagement/project.properties (working copy) +@@ -1,6 +0,0 @@ +-module.name = certmanagement +-long.name = Certificate Management Applications +-version = 1.0 +-project = Java CoG Kit +-lib.deps = mail.*,activation.* +- +Index: modules/certmanagement/launchers.xml +=================================================================== +--- modules/certmanagement/launchers.xml (revision 3296) ++++ modules/certmanagement/launchers.xml (working copy) +@@ -1,86 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +Index: modules/certmanagement/.project +=================================================================== +--- modules/certmanagement/.project (revision 3296) ++++ modules/certmanagement/.project (working copy) +@@ -1,18 +0,0 @@ +- +- +- certmanagement +- +- +- jglobus +- +- +- +- org.eclipse.jdt.core.javabuilder +- +- +- +- +- +- org.eclipse.jdt.core.javanature +- +- +Index: modules/certmanagement/dependencies.xml +=================================================================== +--- modules/certmanagement/dependencies.xml (revision 3296) ++++ modules/certmanagement/dependencies.xml (working copy) +@@ -1,8 +0,0 @@ +- +- +- +- +- +- +- +- +Index: modules/certmanagement/lib/activation.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/lib/mail.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/meta/description.txt +=================================================================== +--- modules/certmanagement/meta/description.txt (revision 3296) ++++ modules/certmanagement/meta/description.txt (working copy) +@@ -1,8 +0,0 @@ +-The certmanagement module contains a collection of certificate management +-applications and was contributed by: +- +-Jean-Claude Cote +-High Performance Computing / Calcul de haute performance +-National Research Council Canada / Conseil national de recherches Canada +-www.grid.nrc.ca +- +Index: modules/certmanagement/meta/certreq/screenshot.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/meta/certdestroy/screenshot.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/meta/myproxy/screenshot.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/meta/certinfo/screenshot.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/meta/certrenew/screenshot.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/src/org/globus/cog/security/cert/request/BouncyCastleOpenSSLKey.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/request/BouncyCastleOpenSSLKey.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/request/BouncyCastleOpenSSLKey.java (working copy) +@@ -1,130 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-package org.globus.cog.security.cert.request; +- +-import java.io.IOException; +-import java.io.InputStream; +-import java.io.ByteArrayInputStream; +-import java.security.InvalidKeyException; +-import java.security.GeneralSecurityException; +-import java.security.PrivateKey; +-import java.security.KeyFactory; +-import java.security.interfaces.RSAPrivateCrtKey; +-import java.security.spec.PKCS8EncodedKeySpec; +- +- +-import org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure; +-import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; +-import org.bouncycastle.asn1.DERObject; +-import org.bouncycastle.asn1.DERObjectIdentifier; +-import org.bouncycastle.asn1.DERInputStream; +-import org.bouncycastle.asn1.DERConstructedSequence; +-import org.bouncycastle.asn1.x509.AlgorithmIdentifier; +-import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; +-import org.globus.gsi.bc.BouncyCastleUtil; +- +-/** +- * BouncyCastle-based implementation of OpenSSLKey. +- */ +-public class BouncyCastleOpenSSLKey extends OpenSSLKey { +- +- public BouncyCastleOpenSSLKey(InputStream is) +- throws IOException, GeneralSecurityException { +- super(is); +- } +- +- public BouncyCastleOpenSSLKey(String file) +- throws IOException, GeneralSecurityException { +- super(file); +- } +- +- public BouncyCastleOpenSSLKey(PrivateKey key) { +- super(key); +- } +- +- public BouncyCastleOpenSSLKey(String algorithm, byte [] data) +- throws GeneralSecurityException { +- super(algorithm, data); +- } +- +- protected PrivateKey getKey(String alg, byte [] data) +- throws GeneralSecurityException { +- if (alg.equals("RSA")) { +- try { +- ByteArrayInputStream bis = new ByteArrayInputStream(data); +- DERInputStream derin = new DERInputStream(bis); +- DERObject keyInfo = derin.readObject(); +- +- DERObjectIdentifier rsa_oid = PKCSObjectIdentifiers.rsaEncryption; +- AlgorithmIdentifier rsa = new AlgorithmIdentifier(rsa_oid); +- PrivateKeyInfo pkeyinfo = new PrivateKeyInfo(rsa, keyInfo); +- DERObject derkey = pkeyinfo.getDERObject(); +- +- byte[] keyData = BouncyCastleUtil.toByteArray(derkey); +- +- // The DER object needs to be mangled to +- // create a proper ProvateKeyInfo object +- PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyData); +- KeyFactory kfac = KeyFactory.getInstance("RSA"); +- +- return kfac.generatePrivate(spec); +- } catch (IOException e) { +- // that should never happen +- return null; +- } +- +- } else { +- return null; +- } +- } +- +- protected byte[] getEncoded(PrivateKey key) { +- String format = key.getFormat(); +- if (format != null && +- (format.equalsIgnoreCase("PKCS#8") || +- format.equalsIgnoreCase("PKCS8"))) { +- try { +- DERObject keyInfo = BouncyCastleUtil.toDERObject(key.getEncoded()); +- PrivateKeyInfo pkey = new PrivateKeyInfo((DERConstructedSequence)keyInfo); +- DERObject derKey = pkey.getPrivateKey(); +- return BouncyCastleUtil.toByteArray(derKey); +- } catch (IOException e) { +- // that should never happen +- e.printStackTrace(); +- return null; +- } +- } else if (format != null && +- format.equalsIgnoreCase("PKCS#1") && +- key instanceof RSAPrivateCrtKey) { // this condition will rarely be true +- RSAPrivateCrtKey pKey = (RSAPrivateCrtKey)key; +- RSAPrivateKeyStructure st = +- new RSAPrivateKeyStructure(pKey.getModulus(), +- pKey.getPublicExponent(), +- pKey.getPrivateExponent(), +- pKey.getPrimeP(), +- pKey.getPrimeQ(), +- pKey.getPrimeExponentP(), +- pKey.getPrimeExponentQ(), +- pKey.getCrtCoefficient()); +- DERObject ob = st.getDERObject(); +- +- try { +- return BouncyCastleUtil.toByteArray(ob); +- } catch (IOException e) { +- // that should never happen +- return null; +- } +- } else { +- return null; +- } +- } +- +- protected String getProvider() { +- return "BC"; +- } +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRenewalRequest.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRenewalRequest.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRenewalRequest.java (working copy) +@@ -1,470 +0,0 @@ +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/** +- * Copyright (c) 2003, National Research Council of Canada +- * All rights reserved. +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy of this +- * software and associated documentation files (the "Software"), to deal in the Software +- * without restriction, including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice(s) and this licence appear in all copies of the Software or +- * substantial portions of the Software, and that both the above copyright notice(s) and this +- * license appear in supporting documentation. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE +- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE +- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL +- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE +- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Except as contained in this notice, the name of a copyright holder shall NOT be used in +- * advertising or otherwise to promote the sale, use or other dealings in this Software +- * without specific prior written authorization. Title to copyright in this software and any +- * associated documentation will at all times remain with copyright holders. +- */ +- +-package org.globus.cog.security.cert.request; +- +-import java.io.ByteArrayOutputStream; +-import java.io.File; +-import java.io.FileInputStream; +-import java.io.FileOutputStream; +-import java.io.IOException; +-import java.io.PrintStream; +-import java.security.GeneralSecurityException; +-import java.security.MessageDigest; +-import java.security.PrivateKey; +-import java.security.cert.X509Certificate; +- +-import org.bouncycastle.asn1.DERConstructedSet; +-import org.bouncycastle.asn1.x509.X509Name; +-import org.bouncycastle.jce.PKCS10CertificationRequest; +-import org.bouncycastle.util.encoders.Base64; +-import org.globus.common.CoGProperties; +-import org.globus.gsi.CertUtil; +-import org.globus.gsi.GSIConstants; +-import org.globus.gsi.GlobusCredential; +-import org.globus.gsi.OpenSSLKey; +-import org.globus.gsi.bc.BouncyCastleCertProcessingFactory; +-import org.globus.gsi.bc.BouncyCastleOpenSSLKey; +-import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; +-import org.globus.util.PEMUtils; +-import org.globus.util.Util; +-import org.ietf.jgss.GSSCredential; +- +-import cryptix.util.core.Hex; +- +- +-/** +- * GridCertRenewalRequest Command Line Client +- * @author Jean-Claude Cote +- */ +-public class GridCertRenewalRequest { +- +- public static final String usage = +- "\n" +- + "\ngrid-cert-request [-help] [ options ...]" +- + "\n-help" +- + "\n-usage " +- + "\nDisplays usage. " +- + "\n" +- + "\n-version " +- + "\nDisplays version. " +- + "\n" +- + "\n-debug " +- + "\nDisplays extra information (if problems occur). " +- + "\n" +- + "\n-nopassphrase " +- + "\nSignals that the new key will not be protected by a passphrase. " +- + "\n" +- + "\n-oldcert file " +- + "\nLocation of the certificate that is about to expire. If not set, $HOME/.globus/usercert.pem " +- + "\n" +- + "\n-oldkey file " +- + "\nLocation of the private key to the certificate that is about to expire. If not set, $HOME/.globus/userkey.pem" +- + "\n" +- + "\n-newkey file " +- + "\nLocation of the replacement key that is generated by grid-cert-renew. If not set, $HOME/.globus/userkey_new.pem is assumed. " +- + "\n" +- + "\n-newcertreq file " +- + "\nLocation of the certificate renewal request. If not set, $HOME/.globus/usercert_renew_request.pem is assumed. " +- + "\n" +- + "\n-force" +- + "\nReplaces any existing renewal request" +- + "\n" +- + "\nchallenge " +- + "\nChallenge text string, as instructed in the CA renewal notification message. This is the only required argument. " +- + "\n"; +- +- private static GlobusGSSCredentialImpl cred = null; +- private static String chalenge = ""; +- private static String newPrivKeyLoc = ""; +- private static String userCertRenewFile =""; +- private static String oldPassword = ""; +- private static boolean noPswd = false; +- private static String userCertFile = ""; +- private static String userKeyFile = ""; +- private static boolean force = false; +- private static String version = "1.0"; +- private static boolean verbose = false; +- +- public static void main(String[] args) { +- boolean bOk = parseCmdLine(args); +- +- if (bOk) { +- +- CertUtil.init(); +- +- // Get default location of cert. +- CoGProperties props = CoGProperties.getDefault(); +- +- // If cert file loc not specified use default. +- if (userCertFile.length() == 0){ +- userCertFile = props.getUserCertFile(); +- } +- // If key file loc not specified use default. +- if (userKeyFile.length() == 0){ +- userKeyFile = props.getUserKeyFile(); +- } +- +- // If renwal cert loc not specified +- if (userCertRenewFile.length() == 0){ +- userCertRenewFile = props.getUserCertFile().substring(0, props.getUserCertFile().length() - 4) + "_renew_request.pem"; +- } +- +- // If new key loc not specified +- if (newPrivKeyLoc.length() == 0){ +- newPrivKeyLoc = props.getUserKeyFile().substring(0, props.getUserKeyFile().length() - 4) + "_new.pem"; +- } +- +- // Check not to overwrite any of these files. +- if (force == false) { +- boolean bFileExists = false; +- File f = new File(userCertRenewFile); +- if (f.exists()) { +- System.out.println(userCertRenewFile + " exists"); +- bFileExists = true; +- } +- f = new File(newPrivKeyLoc); +- if (f.exists()) { +- System.out.println(newPrivKeyLoc + " exists"); +- bFileExists = true; +- } +- +- if (bFileExists) { +- System.out.println( +- "If you wish to overwrite, run the script again with -force."); +- bOk = false; +- } +- } +- } +- +- GlobusGSSCredentialImpl cred = null; +- if (bOk){ +- // Get password from user. +- String oldPassword = Util.getInput("Enter private key pass phrase: "); +- +- // Generate a proxy, and keypair from current cert and key +- int credLifetimeSeconds = 300; // life time of proxy 5 min. +- cred = createNewProxy(oldPassword, credLifetimeSeconds, 1024); +- if (cred == null){ +- bOk = false; +- } +- } +- +- String newPrivateKeyPassword = ""; +- if (bOk && !noPswd) { +- // Get password from user. +- bOk = false; +- int attempts = 0; +- +- while (bOk == false && attempts < 3) { +- newPrivateKeyPassword = Util.getInput("Enter new private key pass phrase: "); +- String password2 = +- Util.getInput("Verify password enter new private key pass phrase: "); +- if (newPrivateKeyPassword.compareTo(password2) != 0) { +- System.out.println("Verify failure"); +- } else { +- if (newPrivateKeyPassword.length() < 4) { +- System.out.println( +- "phrase is too short, needs to be at least 4 chars"); +- } else { +- bOk = true; +- } +- } +- attempts++; +- } +- } +- +- if (bOk){ +- try { +- genRenewRequest( cred, newPrivateKeyPassword, chalenge, newPrivKeyLoc, userCertRenewFile); +- } +- catch (GeneralSecurityException e) { +- e.printStackTrace(); +- bOk = false; +- } +- catch (IOException e) { +- e.printStackTrace(); +- bOk = false; +- } +- } +- } +- +- protected static boolean parseCmdLine(String[] args) { +- boolean bOk = true; +- if (args.length == 0) { +- System.out.println(usage); +- bOk = false; +- } else { +- for (int i = 0; i < args.length && bOk; i++) { +- if (args[i].equalsIgnoreCase("-version")) { +- System.out.println(version); +- } else if ( +- args[i].equalsIgnoreCase("-help") +- || args[i].equalsIgnoreCase("-h") +- || args[i].equalsIgnoreCase("-?")) { +- System.out.println(usage); +- bOk = false; +- } else if ( +- args[i].equalsIgnoreCase("-nopw") +- || args[i].equalsIgnoreCase("-nodes") +- || args[i].equalsIgnoreCase("-nopassphrase")) { +- // no password +- noPswd = true; +- } else if (args[i].equalsIgnoreCase("-verbose")) { +- verbose = true; +- } +- else if (args[i].equalsIgnoreCase("-oldcert")){ +- userCertFile = args[++i]; +- } +- else if (args[i].equalsIgnoreCase("-oldkey")){ +- userKeyFile = args[++i]; +- } +- else if (args[i].equalsIgnoreCase("-newkey")){ +- newPrivKeyLoc = args[++i]; +- } +- else if (args[i].equalsIgnoreCase("-newcertreq")){ +- userCertRenewFile = args[++i]; +- } +- else if (args[i].equalsIgnoreCase("-force")) { +- // overwrite existing credentials +- force = true; +- } else { +- // if last arg +- if (i == args.length - 1){ +- chalenge = args[i]; +- } +- else{ +- System.out.println( +- "Error: argument #" +- + i +- + "(" +- + args[i] +- + ") : unknown"); +- } +- } +- } +- } +- return bOk; +- } +- +- protected static GlobusGSSCredentialImpl createNewProxy(String keyPassword, int lifetime, int bits) { +- +- X509Certificate userCert = null; +- PrivateKey userKey = null; +- CertUtil.init(); +- +- try { +- OpenSSLKey key = new BouncyCastleOpenSSLKey(userKeyFile); +- +- if (key.isEncrypted()) { +- key.decrypt(keyPassword); +- } +- +- userKey = key.getPrivateKey(); +- } catch(IOException e) { +- System.out.println("Error: Failed to load key: " + userKeyFile); +- System.out.println("Make sure you have a valide private key installed."); +- e.printStackTrace(); +- return null; +- } catch(GeneralSecurityException e) { +- System.out.println("Error: Wrong grid pass phrase!"); +- e.printStackTrace(); +- return null; +- } +- +- try { +- userCert = CertUtil.loadCertificate(userCertFile); +- } catch(IOException e) { +- System.out.println("Error: Failed to load cert: " + userCertFile); +- System.out.println("Make sure you have a valide certificate installed."); +- e.printStackTrace(); +- return null; +- } catch(GeneralSecurityException e) { +- System.out.println("Error: Unable to load user certificate: " + +- e.getMessage()); +- e.printStackTrace(); +- return null; +- } +- +- BouncyCastleCertProcessingFactory factory = +- BouncyCastleCertProcessingFactory.getDefault(); +- +- boolean limited = false; +- +- int proxyType = (limited) ? +- GSIConstants.DELEGATION_LIMITED : +- GSIConstants.DELEGATION_FULL; +- +- try { +- GlobusCredential proxy = +- factory.createCredential(new X509Certificate[] {userCert}, +- userKey, +- bits, +- lifetime, +- proxyType); +- +- return new GlobusGSSCredentialImpl(proxy, +- GSSCredential.INITIATE_ONLY); +- +- } catch (Exception e) { +- System.out.println("Failed to create a proxy: " + e.getMessage()); +- e.printStackTrace(); +- return null; +- } +- } +- +- +- /** +- * The renewal request method is based on the Grid Canada's renew.sh script. +- * +- * @param newPrivateKeyPassword +- * @param chalenge +- * @param newPrivKeyLoc +- * @param userCertRenewFile +- * @return +- */ +- public static void genRenewRequest( GlobusGSSCredentialImpl cred, String newPrivateKeyPassword, String chalenge, String newPrivKeyLoc, String userCertRenewFile) throws GeneralSecurityException, IOException { +- +- File fTempDigest = null; +- try { +- // Extract the private key, encrypt it in new passphrase and save it as new user key +- // $OPENSSL rsa -des3 -in $TMPPROXY -out $RENEWALKEY +- OpenSSLKey key = new BouncyCastleOpenSSLKey(cred.getPrivateKey()); +- if (newPrivateKeyPassword.length() != 0) { +- key.encrypt(newPrivateKeyPassword); +- } +- key.writeTo(new File(newPrivKeyLoc).getAbsolutePath()); +- // set read only permissions +- Util.setFilePermissions(newPrivKeyLoc, 600); +- +- // copy proxy cert signed by user +- // $OPENSSL x509 -in $TMPPROXY >> $RENEWALREQ +- PrintStream ps = null; +- X509Certificate cert = null; +- byte[] data = null; +- X509Certificate[] certs = cred.getCertificateChain(); +- cert = certs[0]; +- data = cert.getEncoded(); +- ps = new PrintStream(new FileOutputStream(userCertRenewFile)); +- ////// part 1 ///// +- ps.print(toCertPEM(data)); +- +- // generate a digest which can not be copied +- // $OPENSSL x509 -in $TMPPROXY > $TMPPROXY.d +- // echo X$1 >> $TMPPROXY.d +- // $OPENSSL dgst < $TMPPROXY.d >> $RENEWALREQ +- fTempDigest = File.createTempFile("digest-", ".pem"); +- PrintStream psDigest = new PrintStream(new FileOutputStream(fTempDigest)); +- psDigest.print(toCertPEM(data)); +- psDigest.println("X" + chalenge); +- psDigest.close(); +- +- FileInputStream inDigest = null; +- inDigest = new FileInputStream(fTempDigest); +- int digestSize = inDigest.available(); +- byte[] digestData = new byte[digestSize]; +- inDigest.read(digestData, 0, digestSize); +- MessageDigest md = MessageDigest.getInstance("MD5"); +- int le = md.getDigestLength(); +- byte[] digest = md.digest(digestData); +- /////// part 2 /////// +- ps.println(Hex.toString(digest).toLowerCase()); +- +- // generate a cert req signed by the new key. +- // $OPENSSL x509 -in $TMPPROXY -x509toreq -signkey $RENEWALKEY >> $RENEWALREQ +- // Generate a certificate request. +- X509Name name = new X509Name(cert.getIssuerDN().getName()); +- DERConstructedSet derSet = new DERConstructedSet(); +- PKCS10CertificationRequest request = null; +- request = new PKCS10CertificationRequest("MD5WithRSA", name, cert.getPublicKey(), derSet, key.getPrivateKey()); +- /////// part 3 ///// +- ps.println("Certificate Request:"); +- ps.println(" Data:"); +- ps.print(cert.toString()); +- ps.print(toCertReqPEM(request.getEncoded())); +- ps.close(); +- } +- finally{ +- if(fTempDigest != null){ +- fTempDigest.delete(); +- } +- } +- } +- +- +- +- +- /** +- * Converts to PEM encoding. +- */ +- static private String toCertPEM(byte[] data) { +- byte[] enc_data = Base64.encode(data); +- String header = "-----BEGIN CERTIFICATE-----"; +- ByteArrayOutputStream out = new ByteArrayOutputStream(); +- try { +- PEMUtils.writeBase64( +- out, +- header, +- enc_data, +- "-----END CERTIFICATE-----"); +- } catch (IOException e) { +- } +- return new String(out.toByteArray()); +- } +- +- /** +- * Converts to PEM encoding. +- */ +- static private String toCertReqPEM(byte[] data) { +- byte[] enc_data = Base64.encode(data); +- String header = "-----BEGIN CERTIFICATE REQUEST-----"; +- ByteArrayOutputStream out = new ByteArrayOutputStream(); +- try { +- PEMUtils.writeBase64( +- out, +- header, +- enc_data, +- "-----END CERTIFICATE REQUEST-----"); +- } catch (IOException e) { +- } +- return new String(out.toByteArray()); +- } +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRequest.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRequest.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRequest.java (working copy) +@@ -1,453 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/** +- * Copyright (c) 2003, National Research Council of Canada +- * All rights reserved. +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy of this +- * software and associated documentation files (the "Software"), to deal in the Software +- * without restriction, including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice(s) and this licence appear in all copies of the Software or +- * substantial portions of the Software, and that both the above copyright notice(s) and this +- * license appear in supporting documentation. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE +- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE +- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL +- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE +- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Except as contained in this notice, the name of a copyright holder shall NOT be used in +- * advertising or otherwise to promote the sale, use or other dealings in this Software +- * without specific prior written authorization. Title to copyright in this software and any +- * associated documentation will at all times remain with copyright holders. +- */ +- +- +-package org.globus.cog.security.cert.request; +- +-import java.io.ByteArrayOutputStream; +-import java.io.File; +-import java.io.FileOutputStream; +-import java.io.IOException; +-import java.io.PrintStream; +-import java.security.KeyPair; +-import java.security.KeyPairGenerator; +-import java.security.PrivateKey; +-import java.security.PublicKey; +-import org.bouncycastle.asn1.DERConstructedSet; +-import org.bouncycastle.asn1.x509.X509Name; +-import org.bouncycastle.jce.PKCS10CertificationRequest; +-import org.bouncycastle.util.encoders.Base64; +-import org.globus.common.CoGProperties; +-import org.globus.gsi.CertUtil; +-import org.globus.cog.security.cert.request.OpenSSLKey; +-import org.globus.cog.security.cert.request.BouncyCastleOpenSSLKey; +-import org.globus.util.PEMUtils; +-import org.globus.util.Util; +- +-import java.util.StringTokenizer; +- +-/** +- * GridCertRequest Command Line Client +- * +- * Things remaining to be done: +- * Support for host or service certificate request. Perhaps this should not be +- * part of this tool since the COG kit is mostly a client library. +- * Prompt user for each component of the DN. (Interactive mode) +- * @author Jean-Claude Cote +- */ +-public final class GridCertRequest { +- +- public static final String usage = +- "\n" +- + "\ngrid-cert-request [-help] [ options ...]" +- + "\n" +- + "\n Example Usage:" +- + "\n" +- + "\n Creating a user certifcate:" +- + "\n grid-cert-request" +- + "\n" +- + "\n Creating a host or gatekeeper certifcate:" +- + "\n grid-cert-request -host [my.host.fqdn]" +- + "\n" +- + "\n Creating a LDAP server certificate:" +- + "\n grid-cert-request -service ldap -host [my.host.fqdn]" +- + "\n" +- + "\n Options:" +- + "\n" +- + "\n -version : Display version" +- + "\n -?, -h, -help, : Display usage" +- + "\n -usage" +- + "\n -cn , : Common name of the user" +- + "\n -commonname " +- + "\n -service : Create certificate for a service. Requires" +- + "\n the -host option and implies that the generated" +- + "\n key will not be password protected (ie implies -nopw). <>" +- + "\n -host : Create certificate for a host named <>" +- + "\n -dir : Changes the directory the private key and certificate" +- + "\n request will be placed in. By default user" +- + "\n certificates are placed in /home/user/.globus, host" +- + "\n certificates are placed in /etc/grid-security and" +- + "\n service certificates are place in" +- + "\n /etc/grid-security/." +- + "\n -prefix : Causes the generated files to be named" +- + "\n cert.pem, key.pem and" +- + "\n cert_request.pem" +- + "\n -nopw, : Create certificate without a passwd" +- + "\n -nodes," +- + "\n -nopassphrase," +- + "\n -verbose : Don't clear the screen <>" +- + "\n -int[eractive] : Prompt user for each component of the DN <>" +- + "\n -force : Overwrites preexisting certifictes"; +- +- private static String message = +- "\nA certificate request and private key will be created." +- + "\nYou will be asked to enter a PEM pass phrase." +- + "\nThis pass phrase is akin to your account password," +- + "\nand is used to protect your key file." +- + "\nIf you forget your pass phrase, you will need to" +- + "\nobtain a new certificate.\n"; +- +- private static String cn = null; +- private static String service = null; +- private static String gatekeeper = null; +- private static String hostName = null; +- private static String certDir = null; +- private static String certFile = null; +- private static String keyFile = null; +- private static String reqFile = null; +- private static boolean noPswd = false; +- private static boolean interactive = false; +- private static boolean force = false; +- private static boolean resubmit = false; +- private static String version = "1.0"; +- private static boolean verbose = false; +- private static String prefix = "user"; +- +- public static void main(String[] args) { +- +- boolean bOk = parseCmdLine(args); +- +- String userCertFile = ""; +- String userKeyFile = ""; +- String userCertReqFile = ""; +- if (bOk) { +- +- // Get default location of cert. +- CoGProperties props = CoGProperties.getDefault(); +- +- // If no alternate directory specified. +- if (certDir == null) { +- userCertFile = props.getUserCertFile(); +- userKeyFile = props.getUserKeyFile(); +- // Get root dir of default cert location. +- int pos = userKeyFile.lastIndexOf(File.separator); +- certDir = userKeyFile.substring(0, pos + 1); +- } else { +- // If alternate directory specified set cert locations. +- if (certDir.endsWith(File.separator) == false) { +- certDir += File.separator; +- } +- userCertFile = certDir + prefix + "cert.pem"; +- userKeyFile = certDir + prefix + "key.pem"; +- } +- +- // Cert request file name. +- userCertReqFile = +- userCertFile.substring(0, userCertFile.length() - 4) +- + "_request.pem"; +- } +- +- File fDir = null; +- fDir = new File(certDir); +- if (bOk) { +- // Create dir if does not exists. +- if (!fDir.exists()){ +- fDir.mkdir(); +- } +- +- // Make sure directory exists. +- if (!fDir.exists() || !fDir.isDirectory()) { +- System.out.println("The directory " + certDir + " does not exists."); +- bOk = false; +- } +- } +- +- // Make sure we can write to it. +- if (bOk) { +- if (!fDir.canWrite()) { +- System.out.println("Can't write to " + certDir); +- bOk = false; +- } +- } +- +- // Check not to overwrite any of these files. +- if (bOk) { +- if (force == false) { +- boolean bFileExists = false; +- File f = new File(userKeyFile); +- if (f.exists()) { +- System.out.println(userKeyFile + " exists"); +- bFileExists = true; +- } +- f = new File(userCertFile); +- if (f.exists()) { +- System.out.println(userCertFile + " exists"); +- bFileExists = true; +- } +- f = new File(userCertReqFile); +- if (f.exists()) { +- System.out.println(userCertReqFile + " exists"); +- bFileExists = true; +- } +- +- if (bFileExists) { +- System.out.println( +- "If you wish to overwrite, run the script again with -force."); +- bOk = false; +- } +- } +- } +- +- String password = ""; +- if (bOk && !noPswd) { +- // Get password from user. +- bOk = false; +- int attempts = 0; +- +- System.out.println(message); +- +- while (bOk == false && attempts < 3) { +- password = Util.getInput("Enter PEM pass phrase: "); +- String password2 = +- Util.getInput("Verify password Enter PEM pass phrase: "); +- if (password.compareTo(password2) != 0) { +- System.out.println("Verify failure"); +- } else { +- if (password.length() < 4) { +- System.out.println( +- "phrase is too short, needs to be at least 4 chars"); +- } else { +- bOk = true; +- } +- } +- attempts++; +- } +- } +- +- // Generate cert request. +- if (bOk) { +- +- try { +- System.out.println("writing new private key to " + userKeyFile); +- genCertificateRequest( +- cn, +- "ca at gridcanada.ca", +- password, +- userKeyFile, +- userCertFile, +- userCertReqFile); +- } catch (Exception e) { +- System.out.println("error: " + e); +- e.printStackTrace(); +- } +- } +- } +- +- protected static boolean parseCmdLine(String[] args) { +- boolean bOk = true; +- if (args.length == 0) { +- System.out.println(usage); +- bOk = false; +- } else { +- for (int i = 0; i < args.length && bOk; i++) { +- if (args[i].equalsIgnoreCase("-version")) { +- System.out.println(version); +- } else if ( +- args[i].equalsIgnoreCase("-help") +- || args[i].equalsIgnoreCase("-h") +- || args[i].equalsIgnoreCase("-?")) { +- System.out.println(usage); +- bOk = false; +- } else if ( +- args[i].equalsIgnoreCase("-cn") +- || args[i].equalsIgnoreCase("-commonname")) { +- // common name specified +- cn = args[++i]; +- } +- /* +- else if (args[i].equalsIgnoreCase("-service")) { +- // user certificate directory specified +- service = args[++i]; +- }*/ +- /* +- else if (args[i].equalsIgnoreCase("-host")) { +- // host name specified +- service = "host"; +- hostName = args[++i]; +- } +- */ +- else if (args[i].equalsIgnoreCase("-dir")) { +- // user certificate directory specified +- certDir = args[++i]; +- } else if (args[i].equalsIgnoreCase("-prefix")) { +- prefix = args[++i]; +- } else if ( +- args[i].equalsIgnoreCase("-nopw") +- || args[i].equalsIgnoreCase("-nodes") +- || args[i].equalsIgnoreCase("-nopassphrase")) { +- // no password +- noPswd = true; +- } else if (args[i].equalsIgnoreCase("-verbose")) { +- verbose = true; +- } +- /* +- else if ((args[i].equalsIgnoreCase("-int")) || (args[i].equalsIgnoreCase("-interactive"))) { +- // interactive mode +- interactive = true; +- } +- */ +- else if (args[i].equalsIgnoreCase("-force")) { +- // overwrite existing credentials +- force = true; +- } else { +- System.out.println( +- "Error: argument #" +- + i +- + "(" +- + args[i] +- + ") : unknown"); +- } +- } +- } +- return bOk; +- } +- +- /** +- * Generates a encrypted private key and certificate request. +- */ +- static public void genCertificateRequest( +- String dname, +- String emailAddressOfCA, +- String password, +- String privKeyLoc, +- String certLoc, +- String certReqLoc) +- throws Exception { +- +- String sigAlgName = "MD5WithRSA"; +- String keyAlgName = "RSA"; +- +- CertUtil.init(); +- +- // Generate a new key pair. +- KeyPairGenerator keygen = KeyPairGenerator.getInstance(keyAlgName); +- KeyPair keyPair = keygen.genKeyPair(); +- PrivateKey privKey = keyPair.getPrivate(); +- PublicKey pubKey = keyPair.getPublic(); +- +- // Generate the certificate request. +- X509Name name = new X509Name(dname); +- DERConstructedSet derSet = new DERConstructedSet(); +- PKCS10CertificationRequest request = +- new PKCS10CertificationRequest( +- sigAlgName, +- name, +- pubKey, +- derSet, +- privKey); +- +- // Save the certificate request to a .pem file. +- byte[] data = request.getEncoded(); +- PrintStream ps = new PrintStream(new FileOutputStream(certReqLoc)); +- +- // build / delimited name. +- String certSubject = ""; +- StringTokenizer tokens = new StringTokenizer(dname, ","); +- while(tokens.hasMoreTokens()){ +- certSubject = certSubject + "/" + tokens.nextToken(); +- } +- +- ps.print( "\n\n" +- + "Please mail the following certificate request to " + emailAddressOfCA + "\n" +- + "\n" +- + "==================================================================\n" +- + "\n" +- + "Certificate Subject:\n" +- + "\n" +- + certSubject +- + "\n" +- + "\n" +- + "The above string is known as your user certificate subject, and it \n" +- + "uniquely identifies this user.\n" +- + "\n" +- + "To install this user certificate, please save this e-mail message\n" +- + "into the following file.\n" +- + "\n" +- + "\n" +- + certLoc +- + "\n" +- + "\n" +- + "\n" +- + " You need not edit this message in any way. Simply \n" +- + " save this e-mail message to the file.\n" +- + "\n" +- + "\n" +- + "If you have any questions about the certificate contact\n" +- + "the Certificate Authority at " + emailAddressOfCA + "\n" +- + "\n"); +- ps.print(toPEM(data)); +- ps.close(); +- +- // Save private key to a .pem file. +- OpenSSLKey key = new BouncyCastleOpenSSLKey(privKey); +- if (password.length() != 0) { +- key.encrypt(password); +- } +- key.writeTo(new File(privKeyLoc).getAbsolutePath()); +- // set read only permissions +- Util.setFilePermissions(privKeyLoc, 600); +- +- // Create an empty cert file. +- File f = new File(certLoc); +- f.createNewFile(); +- } +- +- /** +- * Converts to PEM encoding. +- */ +- static public String toPEM(byte[] data) { +- byte[] enc_data = Base64.encode(data); +- String header = "-----BEGIN CERTIFICATE REQUEST-----"; +- ByteArrayOutputStream out = new ByteArrayOutputStream(); +- try { +- PEMUtils.writeBase64( +- out, +- header, +- enc_data, +- "-----END CERTIFICATE REQUEST-----"); +- } catch (IOException e) { +- throw new RuntimeException("Unexpected error: " + e.getMessage()); +- } +- return new String(out.toByteArray()); +- } +- +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/request/OpenSSLKey.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/request/OpenSSLKey.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/request/OpenSSLKey.java (working copy) +@@ -1,446 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-package org.globus.cog.security.cert.request; +- +-import java.util.StringTokenizer; +-import java.io.IOException; +-import java.io.InputStream; +-import java.io.OutputStream; +-import java.io.InputStreamReader; +-import java.io.ByteArrayOutputStream; +-import java.io.FileOutputStream; +-import java.io.Reader; +-import java.io.FileReader; +-import java.io.PrintWriter; +-import java.io.BufferedReader; +-import java.io.Writer; +-import java.security.SecureRandom; +-import java.security.MessageDigest; +-import java.security.InvalidKeyException; +-import java.security.NoSuchAlgorithmException; +-import java.security.PrivateKey; +-import java.security.Key; +-import java.security.GeneralSecurityException; +- +-import javax.crypto.Cipher; +-import javax.crypto.NoSuchPaddingException; +-import javax.crypto.spec.SecretKeySpec; +-import javax.crypto.spec.IvParameterSpec; +- +-import org.globus.util.Base64; +-import org.globus.util.PEMUtils; +-import org.globus.util.Util; +- +-/** +- * Represents a OpenSSL-style PEM-formatted private key. It supports encryption +- * and decryption of the key. Currently, only RSA keys are supported, +- * and only TripleDES encryption is supported. +- * This is based on work done by Ming Yung at DSTC. +- */ +-public abstract class OpenSSLKey { +- +- public static final String HEADER = "-----BEGIN RSA PRIVATE KEY-----"; +- +- private String keyAlg = null; +- private boolean isEncrypted = false; +- private byte[] encodedKey = null; +- private PrivateKey intKey = null; +- private IvParameterSpec iv = null; +- private Cipher cipher = null; +- private String encAlg = null; +- private byte[] keyData = null; +- +- /** +- * Reads a OpenSSL private key from the specified input stream. +- * The private key must be PEM encoded and can be encrypted. +- * +- * @param is input stream with OpenSSL key in PEM format. +- * @exception IOException if I/O problems. +- * @exception GeneralSecurityException if problems with the key +- */ +- public OpenSSLKey(InputStream is) +- throws IOException, GeneralSecurityException { +- InputStreamReader isr = new InputStreamReader(is); +- readPEM(isr); +- } +- +- /** +- * Reads a OpenSSL private key from the specified file. +- * The private key must be PEM encoded and can be encrypted. +- * +- * @param file file containing the OpenSSL key in PEM format. +- * @exception IOException if I/O problems. +- * @exception GeneralSecurityException if problems with the key +- */ +- public OpenSSLKey(String file) +- throws IOException, GeneralSecurityException { +- FileReader f = null; +- try { +- f = new FileReader(file); +- readPEM(f); +- } finally { +- if (f != null) f.close(); +- } +- } +- +- /** +- * Converts a RSAPrivateCrtKey into OpenSSL key. +- * +- * @param key private key - must be a RSAPrivateCrtKey +- */ +- public OpenSSLKey(PrivateKey key) { +- intKey = key; +- isEncrypted = false; +- keyData = getEncoded(key); +- } +- +- /** +- * Initializes the OpenSSL key from raw byte array. +- * +- * @param algorithm the algorithm of the key. Currently +- * only RSA algorithm is supported. +- * @param data the DER encoded key data. If RSA +- * algorithm, the key must be in +- * PKCS#1 format. +- * @exception GeneralSecurityException if any security +- * problems. +- */ +- public OpenSSLKey(String algorithm, byte [] data) +- throws GeneralSecurityException { +- keyData = data; +- isEncrypted = false; +- intKey = getKey(algorithm, data); +- } +- +- private void readPEM(Reader rd) +- throws IOException, GeneralSecurityException { +- +- BufferedReader in = new BufferedReader(rd); +- +- StringBuffer sb = new StringBuffer(); +- +- String next = null; +- +- while( (next = in.readLine()) != null) { +- if (next.indexOf("PRIVATE KEY") != -1) { +- keyAlg = getAlgorithm(next); +- break; +- } +- } +- +- if (next == null) { +- throw new InvalidKeyException("PRIVATE KEY section not found."); +- } +- +- if (keyAlg == null) { +- throw new InvalidKeyException("Algorithm not supported."); +- } +- +- next = in.readLine(); +- if (next.startsWith("Proc-Type: 4,ENCRYPTED")) { +- isEncrypted = true; +- checkEncrypted(in.readLine()); +- in.readLine(); +- } else { +- sb.append(next); +- } +- +- while ( (next = in.readLine()) != null ) { +- if (next.startsWith("-----END")) break; +- sb.append(next); +- } +- +- encodedKey = sb.toString().getBytes(); +- +- if (!isEncrypted()) { +- keyData = Base64.decode( encodedKey ); +- intKey = getKey(keyAlg, keyData); +- } else { +- keyData = null; +- } +- } +- +- /** +- * Check if the key was encrypted or not. +- * +- * @return true if the key is encrypted, false +- * otherwise. +- */ +- public boolean isEncrypted() { +- return isEncrypted; +- } +- +- /** +- * Decrypts the private key with given password. +- * Does nothing if the key is not encrypted. +- * +- * @param password password to decrypt the key with. +- * @exception GeneralSecurityException +- * whenever an error occurs during decryption. +- * @exception InvalidKeyException +- * whenever an error occurs during decryption. +- */ +- public void decrypt(String password) +- throws GeneralSecurityException, InvalidKeyException { +- decrypt(password.getBytes()); +- } +- +- /** +- * Decrypts the private key with given password. +- * Does nothing if the key is not encrypted. +- * +- * @param password password to decrypt the key with. +- * @exception GeneralSecurityException +- * whenever an error occurs during decryption. +- * @exception InvalidKeyException +- * whenever an error occurs during decryption. +- */ +- public void decrypt(byte [] password) +- throws GeneralSecurityException, InvalidKeyException { +- if (!isEncrypted()) return; +- +- byte [] enc = Base64.decode( encodedKey ); +- +- SecretKeySpec key = getSecretKey(password, iv.getIV()); +- +- cipher = getCipher(encAlg); +- cipher.init(Cipher.DECRYPT_MODE, key, iv); +- enc = cipher.doFinal(enc); +- +- intKey = getKey(keyAlg, enc); +- +- keyData = enc; +- +- isEncrypted = false; +- } +- +- /** +- * Encrypts the private key with given password. +- * Does nothing if the key is encrypted already. +- * +- * @param password password to encrypt the key with. +- * @exception GeneralSecurityException +- * whenever an error occurs during encryption. +- */ +- public void encrypt(String password) +- throws GeneralSecurityException { +- encrypt(password.getBytes()); +- } +- +- /** +- * Encrypts the private key with given password. +- * Does nothing if the key is encrypted already. +- * +- * @param password password to encrypt the key with. +- * @exception GeneralSecurityException +- * whenever an error occurs during encryption. +- */ +- public void encrypt(byte [] password) +- throws GeneralSecurityException { +- +- encAlg = "DESede"; +- +- if (isEncrypted()) return; +- +- if (iv == null) iv = generateIV(); +- +- Key key = getSecretKey(password, iv.getIV()); +- +- cipher = getCipher(encAlg); +- cipher.init(Cipher.ENCRYPT_MODE, key, iv); +- +- /* encrypt the raw PKCS11 */ +- +- keyData = cipher.doFinal( getEncoded(intKey) ); +- +- isEncrypted = true; +- } +- +- /** +- * Returns the JCE (RSAPrivateCrtKey) key. +- * +- * @return the private key, null if the key +- * was not decrypted yet. +- */ +- public PrivateKey getPrivateKey() { +- return intKey; +- } +- +- /** +- * Writes the private key to the specified output stream in PEM +- * format. If the key was encrypted it will be encoded as an encrypted +- * RSA key. If not, it will be encoded as a regular RSA key. +- * +- * @param output output stream to write the key to. +- * @exception IOException if I/O problems writing the key +- */ +- public void writeTo(OutputStream output) +- throws IOException { +- if (keyData == null) throw new IOException("No key info"); +- output.write( toPEM().getBytes() ); +- } +- +- /** +- * Writes the private key to the specified writer in PEM format. +- * If the key was encrypted it will be encoded as an encrypted +- * RSA key. If not, it will be encoded as a regular RSA key. +- * +- * @param writer writer to output the key to. +- * @exception IOException if I/O problems writing the key +- */ +- public void writeTo(Writer w) +- throws IOException { +- if (keyData == null) throw new IOException("No key info"); +- w.write( toPEM() ); +- } +- +- /** +- * Writes the private key to the specified file in PEM format. +- * If the key was encrypted it will be encoded as an encrypted +- * RSA key. If not, it will be encoded as a regular RSA key. +- * +- * @param file file to write the key to. +- * @exception IOException if I/O problems writing the key +- */ +- public void writeTo(String file) +- throws IOException { +- if (keyData == null) throw new IOException("No key info"); +- PrintWriter p = null; +- try { +- p = new PrintWriter(new FileOutputStream(file)); +- Util.setFilePermissions(file, 600); +- p.write( toPEM() ); +- } finally { +- if (p != null) p.close(); +- } +- } +- +- +- /** +- * Returns DER encoded byte array (PKCS#1). +- */ +- protected abstract byte[] getEncoded(PrivateKey key); +- +- /** +- * Returns PrivateKey object initialized from give byte array (in PKCS#1 format) +- */ +- protected abstract PrivateKey getKey(String alg, byte [] data) +- throws GeneralSecurityException; +- +- protected String getProvider() { +- return null; +- } +- +- private Cipher getCipher(String encAlg) +- throws GeneralSecurityException { +- if (cipher == null) { +- String provider = getProvider(); +- if (provider == null) { +- cipher = Cipher.getInstance(encAlg + "/CBC/PKCS5Padding"); +- } else { +- cipher = Cipher.getInstance(encAlg + "/CBC/PKCS5Padding", +- provider); +- } +- } +- return cipher; +- } +- +- private String getAlgorithm(String line) { +- if (line.indexOf("RSA") != -1) { +- return "RSA"; +- } else if (line.indexOf("DSA") != -1) { +- return "DSA"; +- } else { +- return null; +- } +- } +- +- private void checkEncrypted(String line) { +- String keyInfo = line.substring(10); +- StringTokenizer tknz = new StringTokenizer(keyInfo, ",", false); +- +- if (tknz.nextToken().equals("DES-EDE3-CBC")) { +- encAlg = "DESede"; +- } +- +- iv = getIV(tknz.nextToken()); +- } +- +- private IvParameterSpec getIV(String s) { +- byte[] ivBytes = new byte[8]; +- for (int j=0; j<8; j++) { +- ivBytes[j] = (byte)Integer.parseInt(s.substring(j*2, j*2 + 2), 16); +- } +- return new IvParameterSpec(ivBytes); +- } +- +- private IvParameterSpec generateIV() { +- byte [] b = new byte[8]; +- SecureRandom sr = new SecureRandom(); //.getInstance("PRNG"); +- sr.nextBytes(b); +- return new IvParameterSpec(b); +- } +- +- private SecretKeySpec getSecretKey(byte [] pwd, byte [] iv) +- throws NoSuchAlgorithmException { +- byte[] keyMat = new byte[24]; +- +- MessageDigest md = MessageDigest.getInstance("MD5"); +- md.update(pwd); +- md.update(iv); +- byte[] data = md.digest(); +- System.arraycopy(data, 0, keyMat, 0, 16); +- +- md.update(data); +- md.update(pwd); +- md.update(iv); +- data = md.digest(); +- System.arraycopy(data, 0, keyMat, 16, 8); +- +- return new SecretKeySpec(keyMat, encAlg); +- } +- +- // ------------------------------------------- +- +- /** +- * Converts to PEM encoding. +- * Assumes keyData is initialized. +- */ +- private String toPEM() { +- +- byte [] data = Base64.encode( keyData ); +- +- String header = HEADER; +- +- if (isEncrypted()) { +- StringBuffer buf = new StringBuffer(header); +- buf.append(PEMUtils.lineSep); +- buf.append("Proc-Type: 4,ENCRYPTED"); +- buf.append(PEMUtils.lineSep); +- buf.append("DEK-Info: DES-EDE3-CBC,").append(PEMUtils.toHex(iv.getIV())); +- buf.append(PEMUtils.lineSep); +- header = buf.toString(); +- } +- +- ByteArrayOutputStream out = new ByteArrayOutputStream(); +- +- try { +- PEMUtils.writeBase64(out, +- header, +- data, +- "-----END RSA PRIVATE KEY-----"); +- } catch (IOException e) { +- throw new RuntimeException("Unexpected error: " + +- e.getMessage()); +- } +- +- return new String(out.toByteArray()); +- } +- +- +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/management/CertInfoApplet.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/management/CertInfoApplet.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/management/CertInfoApplet.java (working copy) +@@ -1,175 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/** +- * Copyright (c) 2003, National Research Council of Canada +- * All rights reserved. +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy of this +- * software and associated documentation files (the "Software"), to deal in the Software +- * without restriction, including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice(s) and this licence appear in all copies of the Software or +- * substantial portions of the Software, and that both the above copyright notice(s) and this +- * license appear in supporting documentation. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE +- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE +- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL +- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE +- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Except as contained in this notice, the name of a copyright holder shall NOT be used in +- * advertising or otherwise to promote the sale, use or other dealings in this Software +- * without specific prior written authorization. Title to copyright in this software and any +- * associated documentation will at all times remain with copyright holders. +- */ +- +-package org.globus.cog.security.cert.management; +- +-import java.awt.Font; +-import java.awt.GridBagConstraints; +-import java.awt.GridBagLayout; +-import java.awt.Label; +-import java.awt.Panel; +-import java.security.cert.X509Certificate; +-import java.text.DateFormat; +-import java.text.SimpleDateFormat; +-import java.util.TimeZone; +- +-import org.globus.gsi.CertUtil; +- +-/** +- * @author Jean-Claude Cote +- */ +-public class CertInfoApplet extends GIPApplet { +- +- private static final String PROPERTY_FILE = "CertInfoApplet"; +- +- public void init() { +- super.init(); +- +- // Setup UI. +- Panel titlePanel = null; +- if (appletTitle.length() > 0) { +- titlePanel = new Panel(); +- titlePanel.add(new Label(appletTitle)); +- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); +- titlePanel.setBackground(bgColor); +- } +- +- Panel statusPanel = new Panel(); +- Font font = new Font("Courier", Font.PLAIN, 12); +- status.setFont(font); +- +- // Change the status area size +- status.setRows(25); +- statusPanel.add(status); +- +- Panel mainPanel = new Panel(); +- GridBagLayout gridbag = new GridBagLayout(); +- GridBagConstraints c = new GridBagConstraints(); +- if (titlePanel != null) { +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(titlePanel, c); +- mainPanel.add(titlePanel); +- } +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(statusPanel, c); +- mainPanel.add(statusPanel); +- mainPanel.setLayout(gridbag); +- +- this.add(mainPanel); +- this.setBackground(bgColor); +- } +- +- public void start() { +- +- try { +- X509Certificate cert = CertUtil.loadCertificate(userCertFile); +- +- boolean globusStyle = false; +- String dn = null; +- if (globusStyle) { +- dn = CertUtil.toGlobusID(cert.getSubjectDN().getName()); +- } else { +- dn = cert.getSubjectDN().getName(); +- } +- appendToStatus("subject : " + dn); +- +- dn = null; +- if (globusStyle) { +- dn = CertUtil.toGlobusID(cert.getIssuerDN().getName()); +- } else { +- dn = cert.getIssuerDN().getName(); +- } +- appendToStatus("issuer : " + dn); +- +- TimeZone tz = null; +- DateFormat df = null; +- if (globusStyle) { +- tz = TimeZone.getTimeZone("GMT"); +- df = new SimpleDateFormat("MMM dd HH:mm:ss yyyy z"); +- df.setTimeZone(tz); +- } +- +- String dt = null; +- if (globusStyle) { +- dt = df.format(cert.getNotBefore()); +- } else { +- dt = cert.getNotBefore().toString(); +- } +- appendToStatus("start date : " + dt); +- +- dt = null; +- if (globusStyle) { +- dt = df.format(cert.getNotAfter()); +- } else { +- dt = cert.getNotAfter().toString(); +- } +- appendToStatus("end date : " + dt); +- +- appendToStatus("certificate :"); +- appendToStatus(cert.toString()); +- +- } catch (Exception ex) { +- // Write exection to Java console. +- ex.printStackTrace(); +- +- // Write exception to status area. +- String message = ex.getMessage() + "\n"; +- StackTraceElement[] stackElements = ex.getStackTrace(); +- for (int i = 0; i < stackElements.length; i++) { +- message += stackElements[i].toString() + "\n"; +- } +- appendToStatus(message); +- } +- } +- +- /* (non-Javadoc) +- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() +- */ +- protected String getPropertyFileName() { +- // TODO Auto-generated method stub +- return PROPERTY_FILE; +- } +- +- +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/management/GIPMail.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/management/GIPMail.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/management/GIPMail.java (working copy) +@@ -1,70 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/* +- * Created on Nov 6, 2003 +- * +- * To change the template for this generated file go to +- * Window>Preferences>Java>Code Generation>Code and Comments +- */ +-package org.globus.cog.security.cert.management; +- +- +-import java.util.Properties; +- +-import javax.mail.Message; +-import javax.mail.MessagingException; +-import javax.mail.Session; +-import javax.mail.Transport; +-import javax.mail.internet.AddressException; +-import javax.mail.internet.InternetAddress; +-import javax.mail.internet.MimeMessage; +- +-/** +- * @author Jean-Claude Cote +- */ +-public class GIPMail { +- private static final String SMTP_HOST = "mail.nrc.ca"; +- private static final boolean debug = true; +- +- public static void postMail(String recipients[], String subject, String message, String from) { +- //Set the host smtp address +- Properties props = new Properties(); +- props.put("mail.smtp.host", SMTP_HOST); +- +- // create some properties and get the default Session +- Session session = Session.getDefaultInstance(props, null); +- session.setDebug(debug); +- +- // create a message +- Message msg = new MimeMessage(session); +- +- // set the from and to address +- InternetAddress addressFrom = null; +- try { +- addressFrom = new InternetAddress(from); +- msg.setFrom(addressFrom); +- +- InternetAddress[] addressTo = new InternetAddress[recipients.length]; +- for (int i = 0; i < recipients.length; i++) { +- addressTo[i] = new InternetAddress(recipients[i]); +- } +- msg.setRecipients(Message.RecipientType.TO, addressTo); +- // Setting the Subject and Content Type +- msg.setSubject(subject); +- msg.setContent(message, "text/plain"); +- Transport.send(msg); +- } +- catch (AddressException e) { +- e.printStackTrace(); +- } +- catch (MessagingException e1) { +- e1.printStackTrace(); +- } +- } +- +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/management/CertRenewApplet.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/management/CertRenewApplet.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/management/CertRenewApplet.java (working copy) +@@ -1,299 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/** +- * Copyright (c) 2003, National Research Council of Canada +- * All rights reserved. +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy of this +- * software and associated documentation files (the "Software"), to deal in the Software +- * without restriction, including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice(s) and this licence appear in all copies of the Software or +- * substantial portions of the Software, and that both the above copyright notice(s) and this +- * license appear in supporting documentation. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE +- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE +- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL +- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE +- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Except as contained in this notice, the name of a copyright holder shall NOT be used in +- * advertising or otherwise to promote the sale, use or other dealings in this Software +- * without specific prior written authorization. Title to copyright in this software and any +- * associated documentation will at all times remain with copyright holders. +- */ +- +-package org.globus.cog.security.cert.management; +- +-import java.awt.Button; +-import java.awt.FlowLayout; +-import java.awt.Font; +-import java.awt.GridBagConstraints; +-import java.awt.GridBagLayout; +-import java.awt.GridLayout; +-import java.awt.Label; +-import java.awt.Panel; +-import java.awt.TextField; +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +-import java.io.BufferedReader; +-import java.io.File; +-import java.io.FileInputStream; +-import java.io.FileNotFoundException; +-import java.io.IOException; +-import java.io.InputStreamReader; +- +-import org.globus.cog.security.cert.request.GridCertRenewalRequest; +-import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; +- +-/** +- * @author Jean-Claude Cote +- */ +-public class CertRenewApplet extends GIPApplet implements ActionListener { +- +- private static final String PROPERTY_FILE = "CertRenewApplet"; +- // Values configured by property file. +- private String renewAction = null; +- private String mailRenewRequest = null; +- +- private String oldPassPhraseLabel = "Old PassPhrase"; +- private String passPhraseLabel = "PassPhrase"; +- private String confPassPhraseLabel = "Confirm PassPhrase"; +- private String yourEmailAddressLabel = "Your e-mail address"; +- private String challengeLabel = "Challenge"; +- +- +- // UI elements. +- private Button mailButton = null; +- private Button renewButton = null; +- private TextField oldPasswordField = new TextField(); +- private TextField passwordField = new TextField(); +- private TextField confPasswordField = new TextField(); +- private TextField challengeField = new TextField(); +- private String certRenewEmailBody = ""; +- private TextField fromField = new TextField(); +- +- public void init() { +- super.init(); +- +- renewAction = getLocString("RenewRequestAction"); +- mailRenewRequest = getLocString("MailRenewAction"); +- +- // Setup UI. +- mailButton = new Button(mailRenewRequest); +- renewButton = new Button(renewAction); +- +- +- Panel titlePanel = null; +- if (appletTitle.length() > 0) { +- titlePanel = new Panel(); +- titlePanel.add(new Label(appletTitle)); +- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); +- titlePanel.setBackground(bgColor); +- } +- +- Panel inputPanel = new Panel(); +- inputPanel.add(new Label(oldPassPhraseLabel)); +- oldPasswordField.setEchoChar('*'); +- inputPanel.add(oldPasswordField); +- inputPanel.add(new Label(passPhraseLabel)); +- inputPanel.add(passwordField); +- passwordField.setEchoChar('*'); +- inputPanel.add(new Label(confPassPhraseLabel)); +- inputPanel.add(confPasswordField); +- confPasswordField.setEchoChar('*'); +- inputPanel.add(new Label(yourEmailAddressLabel)); +- inputPanel.add(fromField); +- inputPanel.add(new Label(challengeLabel)); +- inputPanel.add(challengeField); +- inputPanel.setLayout(new GridLayout(0, 2)); +- inputPanel.setBackground(bgColor); +- +- Panel buttonPanel = new Panel(); +- renewButton.addActionListener(this); +- buttonPanel.add(renewButton); +- mailButton.addActionListener(this); +- buttonPanel.add(mailButton); +- buttonPanel.setLayout(new FlowLayout()); +- +- Panel statusPanel = new Panel(); +- Font font = new Font("Courier", Font.PLAIN, 12); +- status.setFont(font); +- statusPanel.add(status); +- +- Panel mainPanel = new Panel(); +- GridBagLayout gridbag = new GridBagLayout(); +- GridBagConstraints c = new GridBagConstraints(); +- if (titlePanel != null) { +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(titlePanel, c); +- mainPanel.add(titlePanel); +- } +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(inputPanel, c); +- mainPanel.add(inputPanel); +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(buttonPanel, c); +- mainPanel.add(buttonPanel); +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(statusPanel, c); +- mainPanel.add(statusPanel); +- mainPanel.setLayout(gridbag); +- +- this.add(mainPanel); +- this.setBackground(bgColor); +- } +- +- public void actionPerformed(ActionEvent e) { +- +- boolean bOk = true; +- +- if (debug){ +- this.doDebugTests(); +- } +- +- // Get ui values. +- String from = fromField.getText(); +- String oldPassword = oldPasswordField.getText(); +- String password = passwordField.getText(); +- String password2 = confPasswordField.getText(); +- String chalenge = challengeField.getText(); +- +- // Get cog values. +- String userCertRenewFile = userCertFile.substring(0, userCertFile.length() - 4) + "_renew_request.pem"; +- String newPrivKeyFile = userKeyFile.substring(0, userKeyFile.length() - 4) + "_new.pem"; +- +- try { +- +- if (e.getActionCommand() == renewAction) { +- +- bOk = checkCertDir(); +- +- // Verify new password. +- if (bOk) { +- bOk = verifyPassword(password, password2); +- } +- +- if (bOk) { +- boolean bFileExists = false; +- File f = new File(newPrivKeyFile); +- if (f.exists()) { +- appendToStatus(newPrivKeyFile + getLocString("msg001")); +- bFileExists = true; +- } +- f = new File(userCertRenewFile); +- if (f.exists()) { +- appendToStatus(userCertRenewFile + getLocString("msg001")); +- bFileExists = true; +- } +- +- if (bFileExists) { +- appendToStatus(getLocString("msg002")); +- appendToStatus(getLocString("msg003")); +- bOk = false; +- } +- } +- +- if (bOk){ +- if (chalenge.length() == 0){ +- appendToStatus(getLocString("msg004")); +- bOk = false; +- } +- } +- +- // Generate renew request. +- if (bOk) { +- appendToStatus(getLocString("msg005") + chalenge); +- +- // Generate a proxy, and keypair from current cert and key +- // $GRID_PROXY_INIT -hours 1 -bits 1024 -out $TMPPROXY -cert $CERTFILE -key $KEYFILE +- int credLifetimeSeconds = 300; // life time of proxy 5 min. +- GlobusGSSCredentialImpl cred = createNewProxy(oldPassword, credLifetimeSeconds, 1024); +- if (cred != null){ +- GridCertRenewalRequest.genRenewRequest( +- cred, +- password, +- chalenge, +- newPrivKeyFile, +- userCertRenewFile ); +- appendToStatus(getLocString("msg006")); +- appendToStatus(getLocString("msg007") + newPrivKeyFile); +- appendToStatus(getLocString("msg008") + userCertRenewFile); +- appendToStatus(getLocString("msg009") + this.emailAddressOfCA + getLocString("msg010")); +- } +- } +- } +- else if (e.getActionCommand() == mailRenewRequest) { +- +- // Check from email address. +- if (bOk) { +- if (from.length() == 0) { +- appendToStatus(getLocString("msg011")); +- bOk = false; +- } +- } +- +- // Load mail body from cert renew file. +- String mailBody = loadFile(userCertRenewFile); +- +- // Send the request to the CA. +- if (bOk && mailBody.length() != 0) { +- if (sendMail(from, mailBody)) { +- appendToStatus(getLocString("msg012") + emailAddressOfCA ); +- } +- } +- +- } +- else { +- appendToStatus(getLocString("msg013") + e.getActionCommand() ); +- } +- } +- catch (Exception ex) { +- this.appendExceptionDetailsToStatus(ex); +- } +- } +- +- private String loadFile(String fileName) throws FileNotFoundException, IOException { +- File f = new File(fileName); +- String data = ""; +- BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream(f))); +- String sLine = in.readLine(); +- while (sLine != null) { +- data += sLine + "\n"; +- sLine = in.readLine(); +- } +- in.close(); +- return data; +- } +- +- /* (non-Javadoc) +- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() +- */ +- protected String getPropertyFileName() { +- // TODO Auto-generated method stub +- return PROPERTY_FILE; +- } +- +- +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/management/GIPApplet.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/management/GIPApplet.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/management/GIPApplet.java (working copy) +@@ -1,573 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/** +- * Copyright (c) 2004, National Research Council of Canada +- * All rights reserved. +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy of this +- * software and associated documentation files (the "Software"), to deal in the Software +- * without restriction, including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice(s) and this licence appear in all copies of the Software or +- * substantial portions of the Software, and that both the above copyright notice(s) and this +- * license appear in supporting documentation. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE +- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE +- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL +- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE +- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Except as contained in this notice, the name of a copyright holder shall NOT be used in +- * advertising or otherwise to promote the sale, use or other dealings in this Software +- * without specific prior written authorization. Title to copyright in this software and any +- * associated documentation will at all times remain with copyright holders. +- */ +- +- +-package org.globus.cog.security.cert.management; +- +-import java.applet.Applet; +-import java.awt.Button; +-import java.awt.Color; +-import java.awt.Container; +-import java.awt.Dialog; +-import java.awt.FlowLayout; +-import java.awt.Font; +-import java.awt.Frame; +-import java.awt.GridLayout; +-import java.awt.Label; +-import java.awt.Panel; +-import java.awt.TextArea; +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +-import java.io.File; +-import java.io.FileNotFoundException; +-import java.io.FileOutputStream; +-import java.io.IOException; +-import java.io.InputStream; +-import java.io.OutputStream; +-import java.net.InetAddress; +-import java.net.URL; +-import java.security.GeneralSecurityException; +-import java.security.PrivateKey; +-import java.security.cert.X509Certificate; +-import java.util.Enumeration; +-import java.util.Locale; +-import java.util.Properties; +-import java.util.ResourceBundle; +-import java.util.StringTokenizer; +- +-import org.globus.common.CoGProperties; +-import org.globus.gsi.CertUtil; +-import org.globus.gsi.GSIConstants; +-import org.globus.gsi.GlobusCredential; +-import org.globus.gsi.OpenSSLKey; +-import org.globus.gsi.bc.BouncyCastleCertProcessingFactory; +-import org.globus.gsi.bc.BouncyCastleOpenSSLKey; +-import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; +-import org.ietf.jgss.GSSCredential; +- +-/** +- * @author Jean-Claude Cote +- */ +-public abstract class GIPApplet extends Applet { +- +- protected static final boolean debug = true; +- protected String emailAddressOfCA = "jean-claude.cote at cnrc-nrc.gc.ca"; +- protected TextArea status = new TextArea(12, 50); +- +- protected Color bgColor = Color.white; +- +- private ResourceBundle resource = null; +- // Values configured by property file. +- private String emailSubject = null; +- protected String appletTitle = null; +- private String caCertFiles = null; +- +- // Cog values. +- protected String certDir = ""; +- protected String userCertFile = ""; +- protected String userKeyFile = ""; +- protected String userCertReqFile = ""; +- protected CoGProperties cogProps = CoGProperties.getDefault(); +- +- +- public void init() { +- +- CertUtil.init(); +- +- resetCertFileLoc(); +- +- loadParams(); +- +- loadProperties(); +- +- handleCAInstallation(); +- +- } +- +- protected void resetCertFileLoc() { +- // Get default location of cert. +- userCertFile = cogProps.getUserCertFile(); +- userKeyFile = cogProps.getUserKeyFile(); +- +- // Get root dir of default cert location. +- int pos = userKeyFile.lastIndexOf(File.separator); +- certDir = userKeyFile.substring(0, pos + 1); +- +- // Cert request file name. +- userCertReqFile = userCertFile.substring(0, userCertFile.length() - 4) + "_request.pem"; +- } +- +- private void loadParams(){ +- // Get param values. +- // set color to what ever user specified. +- String color = getParameter("backGroundColor"); +- if (color != null && color.length() > 0) { +- bgColor = Color.decode(getParameter("backGroundColor")); +- } +- +- // set ca email to what ever user specified. +- String ca = getParameter("emailAddressOfCA"); +- if (ca != null && ca.length() > 0) { +- emailAddressOfCA = getParameter("emailAddressOfCA"); +- } +- } +- +- protected abstract String getPropertyFileName(); +- +- +- public String getLocString( String key ){ +- return resource.getString(key); +- } +- +- private void loadProperties(){ +- +- Locale currentLocale = Locale.getDefault(); +- +- System.out.println("Getting resource bundle for: " + currentLocale.toString()); +- +- resource = ResourceBundle.getBundle("conf/" + getPropertyFileName(), currentLocale); +- +- System.out.println("Resource bundle data:"); +- Enumeration e = resource.getKeys(); +- String key = null; +- while( e.hasMoreElements() ){ +- key = (String)e.nextElement(); +- System.out.println(key + " = " + resource.getString(key)); +- } +- +- appletTitle = getLocString("AppletTitle"); +- emailSubject = getLocString("EmailSubject"); +- caCertFiles = getLocString("CACertFiles"); +- +- } +- +- protected void appendToStatus(String s) { +- String statusText = s + "\n"; +- status.append(statusText); +- } +- +- protected void appendExceptionDetailsToStatus(Exception ex) { +- // Write exection to Java console. +- ex.printStackTrace(); +- +- // Write exception to status area. +- String message = ex.getMessage() + "\n"; +- StackTraceElement[] stackElements = ex.getStackTrace(); +- for (int i = 0; i < stackElements.length; i++) { +- message += stackElements[i].toString() + "\n"; +- } +- appendToStatus(message); +- } +- +- protected GlobusGSSCredentialImpl createNewProxy(String keyPassword, int lifetime, int bits) { +- +- CertUtil.init(); +- +- X509Certificate userCert = null; +- PrivateKey userKey = null; +- +- CoGProperties props = CoGProperties.getDefault(); +- +- String userCertFile = props.getUserCertFile(); +- String userKeyFile = props.getUserKeyFile(); +- +- try { +- OpenSSLKey key = new BouncyCastleOpenSSLKey(userKeyFile); +- +- if (key.isEncrypted()) { +- key.decrypt(keyPassword); +- } +- +- userKey = key.getPrivateKey(); +- } catch(IOException e) { +- appendToStatus("Error: Failed to load key: " + userKeyFile); +- appendToStatus("Make sure you have a valide private key installed."); +- e.printStackTrace(); +- return null; +- } catch(GeneralSecurityException e) { +- appendToStatus("Error: Wrong grid pass phrase!"); +- e.printStackTrace(); +- return null; +- } +- +- try { +- userCert = CertUtil.loadCertificate(userCertFile); +- } catch(IOException e) { +- appendToStatus("Error: Failed to load cert: " + userCertFile); +- appendToStatus("Make sure you have a valide certificate installed."); +- e.printStackTrace(); +- return null; +- } catch(GeneralSecurityException e) { +- appendToStatus("Error: Unable to load user certificate: " + +- e.getMessage()); +- appendExceptionDetailsToStatus(e); +- return null; +- } +- +- BouncyCastleCertProcessingFactory factory = +- BouncyCastleCertProcessingFactory.getDefault(); +- +- boolean limited = false; +- +- int proxyType = (limited) ? +- GSIConstants.DELEGATION_LIMITED : +- GSIConstants.DELEGATION_FULL; +- +- try { +- GlobusCredential proxy = +- factory.createCredential(new X509Certificate[] {userCert}, +- userKey, +- bits, +- lifetime, +- proxyType); +- +- return new GlobusGSSCredentialImpl(proxy, +- GSSCredential.INITIATE_ONLY); +- +- } catch (Exception e) { +- appendToStatus("Failed to create a proxy: " + e.getMessage()); +- appendExceptionDetailsToStatus(e); +- return null; +- } +- } +- +- protected void doDebugTests() { +- try { +- System.err.println("doing some preleminary checks"); +- +- Properties p = System.getProperties(); +- p.list(System.out); +- +- InetAddress inetAdd = InetAddress.getLocalHost(); +- System.out.println(inetAdd.getHostName()); +- System.out.println(inetAdd.toString()); +- System.out.println(inetAdd.getCanonicalHostName()); +- +- System.out.println("trying to get property: org.globus.config.file"); +- String file = System.getProperty("org.globus.config.file"); +- System.out.println("got the property its values is: " + file); +- +- System.out.println("testing file acces"); +- File fff = new File("_a_test_b_.txt"); +- fff.createNewFile(); +- System.out.println("successfully created _a_test_b_.txt"); +- fff.delete(); +- System.out.println("successfully deleted _a_test_b_.txt"); +- System.out.println("preliminary checks ok"); +- } +- catch( Exception eee ){ +- eee.printStackTrace(); +- } +- } +- +- public boolean sendMail(String from, String content) { +- boolean sent = false; +- String[] recipients = new String[1]; +- recipients[0] = emailAddressOfCA; +- // Confirm operation. +- if (confirmedEmailOperation(emailAddressOfCA, from, emailSubject, content)){ +- GIPMail.postMail( recipients, emailSubject, content, from); +- sent = true; +- } +- return sent; +- } +- +- +- protected boolean checkCertDir() { +- boolean bOk = true; +- +- File fDir = null; +- fDir = new File(certDir); +- // Create dir if does not exists. +- if (!fDir.exists()) { +- fDir.mkdir(); +- } +- +- // Make sure directory exists. +- if (!fDir.exists() || !fDir.isDirectory()) { +- appendToStatus( "The directory " + certDir + " does not exists."); +- bOk = false; +- } +- +- // Make sure we can write to it. +- if (bOk) { +- if (!fDir.canWrite()) { +- appendToStatus("Can't write to " + certDir); +- bOk = false; +- } +- } +- +- return bOk; +- } +- +- protected boolean verifyPassword(String password, String password2) { +- boolean bOk; +- bOk = false; +- +- if (password.compareTo(password2) != 0) { +- appendToStatus("The passphrase do not match."); +- } +- else { +- if (password.length() < 4) { +- appendToStatus("The passphrase is too short, needs to be at least 4 chars"); +- } +- else { +- bOk = true; +- } +- } +- return bOk; +- } +- +- protected boolean checkCertsExists() { +- boolean bOk = true; +- +- boolean bFileExists = true; +- File f = new File(userKeyFile); +- if (!f.exists()) { +- appendToStatus(userKeyFile + " does not exists"); +- bFileExists = false; +- } +- f = new File(userCertFile); +- if (!f.exists()) { +- appendToStatus(userCertFile + " does not exists"); +- bFileExists = false; +- } +- +- if (!bFileExists) { +- appendToStatus("Looks like you do not have credentials installed."); +- appendToStatus("Please use the Certificate Request Applet to request a certificate."); +- bOk = false; +- } +- return bOk; +- } +- +- /** +- * Check if the given CA file is installed. +- */ +- protected boolean caFileInstalled( String caFileName ){ +- System.out.println("Entering caFileInstalled with: " + caFileName); +- boolean isCAInstalled = false; +- // Get the CA locations, this may return directories or file paths. +- String caCertLocations = cogProps.getCaCertLocations(); +- if (caCertLocations != null) { +- StringTokenizer s = new StringTokenizer(caCertLocations,","); +- while (s.hasMoreTokens()) { +- // Get the next dir or file. +- String caCertLocation = s.nextToken(); +- System.out.println("Checking caCertLocation: " + caCertLocation); +- File fLocation = new File(caCertLocation); +- if (fLocation.exists()) { +- if (fLocation.isDirectory()) { +- System.out.println("caCertLocation: " + caCertLocation + " is a directory"); +- // If it's a directory check its content for the CA we are looking for. +- String[] dirContent = fLocation.list(); +- for ( int i=0; i 0){ +- out.write(buffer,0,bytes); +- bytes = in.read(buffer); +- } +- in.close(); +- out.close(); +- } +- catch (FileNotFoundException e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } catch (IOException e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } +- } +- +- protected void handleCAInstallation() { +- StringTokenizer s = new StringTokenizer(caCertFiles,","); +- while(s.hasMoreTokens()){ +- String caCertFile = s.nextToken(); +- // Remove ".0" from cert file name and append .signing_policy +- String caSigningPolicy = caCertFile.substring(0, caCertFile.length() - 2) + ".signing_policy"; +- +- // If CA not installed install it now. +- if (caFileInstalled(caCertFile) && caFileInstalled(caSigningPolicy)){ +- appendToStatus("CA certificate already installed."); +- } +- else { +- // Get URL to cert file contain in jar. +- URL cacertURL = this.getClass().getResource("/cacerts/" + caCertFile); +- URL caSigningPolicyURL = this.getClass().getResource("/cacerts/" + caSigningPolicy ); +- if (cacertURL != null && caSigningPolicyURL != null) { +- installCAFile(caSigningPolicyURL); +- installCAFile(cacertURL); +- appendToStatus("Installed the " + caCertFile + " CA certificate and signing policy."); +- } +- else{ +- appendToStatus("Could not locate " + caCertFile + " CA certificate or its signing policy file in jar."); +- } +- } +- } +- } +- +- private boolean confirmedEmailOperation(String to, String from, String subject, String content){ +- boolean confirmation = false; +- +- //StringTokenizer tokens = new StringTokenizer(content,"\n"); +- +- String[] messages = new String[4];// + tokens.countTokens()]; +- messages[0] = "Are you sure you want to send this email?"; +- messages[1] = "to : " + to; +- messages[2] = "from : " + from; +- messages[3] = "subject : " + subject; +- /*int i = 4; +- while(tokens.hasMoreTokens()){ +- messages[i] = tokens.nextToken(); +- i++; +- }*/ +- +- Container container = this.getParent(); +- while (! (container instanceof Frame)) container = container.getParent(); +- Frame parent = (Frame) container; +- +- EmailConfirmationDialog d = new EmailConfirmationDialog(parent, messages, content); +- d.setModal(true); +- d.show(); +- appendToStatus("Confirmation " + d.getConfirmation() ); +- confirmation = d.getConfirmation(); +- return confirmation; +- } +- +-} +- +- +-class EmailConfirmationDialog extends Dialog implements ActionListener { +- +- private boolean confirmed = false; +- +- public boolean getConfirmation(){ +- return confirmed; +- } +- +- public EmailConfirmationDialog(Frame parent, String[] messages, String textArea) { +- +- super(parent, true); +- setTitle("Confirmation Dialog"); +- +- Font font = new Font("Courier", Font.PLAIN, 12); +- setFont(font); +- +- int rows = messages.length; +- Panel textPanel = new Panel(); +- textPanel.setLayout(new GridLayout(rows,1)); +- for(int i = 0; i < rows; i++){ +- textPanel.add(new Label(messages[i])); +- } +- add("North", textPanel); +- +- Panel textAreaPanel = new Panel(); +- TextArea ta = new TextArea(12,60); +- ta.setText(textArea); +- textAreaPanel.add(ta); +- add("Center", textAreaPanel); +- +- Panel p = new Panel(); +- p.setLayout(new FlowLayout()); +- Button yes = new Button("Yes"); +- yes.addActionListener(this); +- p.add(yes); +- Button no = new Button("No"); +- no.addActionListener(this); +- p.add(no); +- add("South", p); +- +- setLocation(100, 200); +- pack(); +- +- } +- +- public void actionPerformed(ActionEvent e) { +- this.hide(); +- this.dispose(); +- +- if (e.getActionCommand() == "Yes") { +- confirmed = true; +- } +- } +- +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/management/CertReqApplet.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/management/CertReqApplet.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/management/CertReqApplet.java (working copy) +@@ -1,412 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/** +- * Copyright (c) 2003, National Research Council of Canada +- * All rights reserved. +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy of this +- * software and associated documentation files (the "Software"), to deal in the Software +- * without restriction, including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice(s) and this licence appear in all copies of the Software or +- * substantial portions of the Software, and that both the above copyright notice(s) and this +- * license appear in supporting documentation. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE +- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE +- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL +- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE +- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Except as contained in this notice, the name of a copyright holder shall NOT be used in +- * advertising or otherwise to promote the sale, use or other dealings in this Software +- * without specific prior written authorization. Title to copyright in this software and any +- * associated documentation will at all times remain with copyright holders. +- */ +- +-package org.globus.cog.security.cert.management; +- +-import java.awt.Button; +-import java.awt.FlowLayout; +-import java.awt.Font; +-import java.awt.GridBagConstraints; +-import java.awt.GridBagLayout; +-import java.awt.GridLayout; +-import java.awt.Label; +-import java.awt.Panel; +-import java.awt.TextField; +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +-import java.io.BufferedReader; +-import java.io.File; +-import java.io.FileInputStream; +-import java.io.FileNotFoundException; +-import java.io.IOException; +-import java.io.InputStreamReader; +-import java.net.InetAddress; +-import java.net.UnknownHostException; +-import java.util.StringTokenizer; +- +-import org.globus.cog.security.cert.request.GridCertRequest; +- +-/** +- * @author Jean-Claude Cote +- */ +- +-public class CertReqApplet extends GIPApplet implements ActionListener { +- +- private static final String PROPERTY_FILE = "CertRequestApplet"; +- // Values configured by property file. +- private String emailSubject = null; +- private String genAction = null; +- private String mailRequest = null; +- +- private String countryNameLabel = "Country Name"; +- private String organizationLabel = "Organization"; +- private String organizationalUnitLabel = "Organizational Unit"; +- private String nameLabel = "Name"; +- private String passPhraseLabel = "PassPhrase"; +- private String confirmPassPhraseLabel = "Confirm PassPhrase"; +- private String yourEmailAddressLabel = "Your e-mail address"; +- private String serviceLabel = "Service"; +- private String hostLabel = "Host"; +- +- +- // UI elements. +- private Button mailButton = null; +- private Button genButton = null; +- private TextField passwordField = new TextField(); +- private TextField passwordConfField = new TextField(); +- private TextField countryField = new TextField("CA"); +- private TextField organizationField = new TextField("Grid"); +- private TextField organizationUnitField = new TextField(); +- private TextField nameField = new TextField(); +- private TextField hostField = new TextField(); +- private TextField serviceField = new TextField(); +- private String certReqFileContent = ""; +- private TextField fromField = new TextField(); +- +- String country = ""; +- String organization = ""; +- String organizationUnit = ""; +- String name = ""; +- String host = ""; +- String service = "host"; // ldap +- private boolean bHostCertReq = false; +- +- public void init() { +- super.init(); +- +- // Get param values. +- +- // Set certtype +- String type = getParameter("certificateRequestType"); +- if (type != null && type.length() > 0) { +- if (type.equalsIgnoreCase("host")){ +- bHostCertReq = true; +- } +- } +- +- // Try to find the FQDN. +- InetAddress inetAdd = null; +- try { +- inetAdd = InetAddress.getLocalHost(); +- } +- catch (UnknownHostException e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } +- String hostName = inetAdd.getCanonicalHostName(); +- System.out.println("GetCanonicalHostName returned: " + hostName); +- if (hostName != null && hostName.length() > 0){ +- StringTokenizer tokens = new StringTokenizer(hostName, "."); +- if(tokens.countTokens() > 3){ +- if (bHostCertReq){ +- host = hostName; +- } +- else{ +- String hostDomain = hostName.substring(hostName.indexOf(".") + 1,hostName.length()); +- organizationUnit = hostDomain; +- } +- } +- } +- +- +- genAction = getLocString("GenerateRequestAction"); +- mailRequest = getLocString("MailRequestAction"); +- +- // Setup UI. +- mailButton = new Button(mailRequest); +- genButton = new Button(genAction); +- +- Panel titlePanel = null; +- if (appletTitle.length() > 0) { +- titlePanel = new Panel(); +- titlePanel.add(new Label(appletTitle)); +- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); +- titlePanel.setBackground(bgColor); +- } +- +- Panel inputPanel = new Panel(); +- inputPanel.add(new Label(countryNameLabel)); +- inputPanel.add(countryField); +- inputPanel.add(new Label(organizationLabel)); +- inputPanel.add(organizationField); +- if (bHostCertReq){ +- inputPanel.add(new Label(hostLabel)); +- hostField.setText(host); +- inputPanel.add(hostField); +- inputPanel.add(new Label(serviceLabel)); +- serviceField.setText(service); +- inputPanel.add(serviceField); +- } +- else{ +- inputPanel.add(new Label(organizationalUnitLabel)); +- organizationUnitField.setText(organizationUnit); +- inputPanel.add(organizationUnitField); +- inputPanel.add(new Label(nameLabel)); +- nameField.setText(name); +- inputPanel.add(nameField); +- inputPanel.add(new Label(passPhraseLabel)); +- passwordField.setEchoChar('*'); +- inputPanel.add(passwordField); +- inputPanel.add(new Label(confirmPassPhraseLabel)); +- inputPanel.add(passwordConfField); +- passwordConfField.setEchoChar('*'); +- } +- inputPanel.add(new Label(yourEmailAddressLabel)); +- inputPanel.add(fromField); +- inputPanel.setLayout(new GridLayout(0, 2)); +- inputPanel.setBackground(bgColor); +- +- Panel buttonPanel = new Panel(); +- genButton.addActionListener(this); +- buttonPanel.add(genButton); +- mailButton.addActionListener(this); +- buttonPanel.add(mailButton); +- buttonPanel.setLayout(new FlowLayout()); +- +- Panel statusPanel = new Panel(); +- Font font = new Font("Courier", Font.PLAIN, 12); +- status.setFont(font); +- statusPanel.add(status); +- +- Panel mainPanel = new Panel(); +- GridBagLayout gridbag = new GridBagLayout(); +- GridBagConstraints c = new GridBagConstraints(); +- if (titlePanel != null) { +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(titlePanel, c); +- mainPanel.add(titlePanel); +- } +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(inputPanel, c); +- mainPanel.add(inputPanel); +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(buttonPanel, c); +- mainPanel.add(buttonPanel); +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(statusPanel, c); +- mainPanel.add(statusPanel); +- mainPanel.setLayout(gridbag); +- +- this.add(mainPanel); +- this.setBackground(bgColor); +- } +- +- public void actionPerformed(ActionEvent e) { +- +- boolean bOk = true; +- +- if (debug){ +- this.doDebugTests(); +- } +- +- country = countryField.getText(); +- organization = organizationField.getText(); +- organizationUnit = organizationUnitField.getText(); +- name = nameField.getText(); +- host = hostField.getText(); +- service = serviceField.getText(); +- String from = fromField.getText(); +- +- try { +- if (bOk) { +- +- if (bHostCertReq){ +- // Reset the cert file loc to user loc +- // need to do this since we may have changed the loc base on the type of service. +- resetCertFileLoc(); +- +- if(service.length() == 0){ +- service = "host"; +- } +- name = service + "/" + host; +- organizationUnit = name.substring(name.indexOf(".") + 1,name.length()); +- int i = userCertFile.lastIndexOf("user"); +- userCertFile = userCertFile.substring(0, i) + service + userCertFile.substring(i + 4, userCertFile.length()); +- userKeyFile = userKeyFile.substring(0, i) + service + userKeyFile.substring(i + 4, userKeyFile.length()); +- userCertReqFile = userCertReqFile.substring(0, i) + service + userCertReqFile.substring(i + 4, userCertReqFile.length()); +- } +- } +- +- if (e.getActionCommand() == genAction) { +- +- bOk = checkCertDir(); +- +- +- // Check not to overwrite any of these files. +- if (bOk) { +- bOk = checkCertsDoNotExists(); +- } +- +- String password = ""; +- if (bOk) { +- if (!bHostCertReq) { +- password = passwordField.getText(); +- String password2 = passwordConfField.getText(); +- bOk = verifyPassword(password, password2); +- } +- } +- +- +- // Generate cert request. +- if (bOk) { +- String cn = +- "C=" +- + country +- + ",O=" +- + organization +- + ",OU=" +- + organizationUnit +- + ",CN=" +- + name; +- +- appendToStatus("Generating cert request for: " + cn); +- appendToStatus("Writing new private key to " + userKeyFile); +- GridCertRequest.genCertificateRequest( +- cn, +- emailAddressOfCA, +- password, +- userKeyFile, +- userCertFile, +- userCertReqFile); +- certReqFileContent = readCertReqFile(userCertReqFile); +- appendToStatus(certReqFileContent); +- } +- } else if (e.getActionCommand() == mailRequest) { +- +- // Get recipient's email address. +- if (bOk) { +- if (from.length() == 0) { +- appendToStatus("Please specify your e-mail address."); +- bOk = false; +- } +- } +- +- // Get request from file if we generated it at an earlier date. +- if (bOk && certReqFileContent.length() == 0) { +- certReqFileContent = readCertReqFile(userCertReqFile); +- } +- +- // Send the request to the CA. +- if (bOk && certReqFileContent.length() != 0) { +- if (sendMail(from, certReqFileContent)) { +- appendToStatus("Your request has been mailed to " + emailAddressOfCA ); +- } +- } +- } else { +- appendToStatus("Error: Unknown action " + e.getActionCommand() ); +- } +- } catch (Exception ex) { +- // Write exection to Java console. +- ex.printStackTrace(); +- +- // Write exception to status area. +- String message = ex.getMessage() + "\n"; +- StackTraceElement[] stackElements = ex.getStackTrace(); +- for (int i = 0; i < stackElements.length; i++) { +- message += stackElements[i].toString() + "\n"; +- } +- appendToStatus(message); +- } +- } +- +- private boolean checkCertsDoNotExists() { +- boolean bFileExists = false; +- File f = new File(userKeyFile); +- if (f.exists()) { +- appendToStatus(userKeyFile + " exists"); +- bFileExists = true; +- } +- f = new File(userCertFile); +- if (f.exists()) { +- appendToStatus(userCertFile + " exists"); +- bFileExists = true; +- } +- f = new File(userCertReqFile); +- if (f.exists()) { +- appendToStatus(userCertReqFile + " exists"); +- bFileExists = true; +- } +- +- if (bFileExists) { +- appendToStatus("Looks like you already have credential."); +- appendToStatus("If you wish to create new ones you will need to move them to another location."); +- } +- return !bFileExists; +- } +- +- private String readCertReqFile( +- String userCertReqFile) +- throws FileNotFoundException, IOException { +- +- File fUserCertReqFile = new File(userCertReqFile); +- if (!fUserCertReqFile.exists() || !fUserCertReqFile.canRead()) { +- appendToStatus( +- "Can't read certificate request file: " + userCertReqFile); +- return ""; +- } +- +- String certReqData = ""; +- BufferedReader in = +- new BufferedReader( +- new InputStreamReader(new FileInputStream(userCertReqFile))); +- String sLine = in.readLine(); +- while (sLine != null) { +- certReqData += sLine + "\n"; +- sLine = in.readLine(); +- } +- in.close(); +- +- return certReqData; +- } +- +- /* (non-Javadoc) +- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() +- */ +- protected String getPropertyFileName() { +- // TODO Auto-generated method stub +- return PROPERTY_FILE; +- } +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/management/CertDestroyApplet.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/management/CertDestroyApplet.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/management/CertDestroyApplet.java (working copy) +@@ -1,387 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/** +- * Copyright (c) 2003, National Research Council of Canada +- * All rights reserved. +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy of this +- * software and associated documentation files (the "Software"), to deal in the Software +- * without restriction, including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice(s) and this licence appear in all copies of the Software or +- * substantial portions of the Software, and that both the above copyright notice(s) and this +- * license appear in supporting documentation. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE +- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE +- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL +- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE +- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Except as contained in this notice, the name of a copyright holder shall NOT be used in +- * advertising or otherwise to promote the sale, use or other dealings in this Software +- * without specific prior written authorization. Title to copyright in this software and any +- * associated documentation will at all times remain with copyright holders. +- */ +- +-package org.globus.cog.security.cert.management; +- +-import java.awt.Button; +-import java.awt.Container; +-import java.awt.Dialog; +-import java.awt.FlowLayout; +-import java.awt.Font; +-import java.awt.Frame; +-import java.awt.GridBagConstraints; +-import java.awt.GridBagLayout; +-import java.awt.GridLayout; +-import java.awt.Label; +-import java.awt.Panel; +-import java.awt.TextField; +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +-import java.io.File; +-import java.io.IOException; +-import java.security.GeneralSecurityException; +-import java.security.cert.X509Certificate; +- +-import org.globus.gsi.CertUtil; +-import org.globus.gsi.OpenSSLKey; +-import org.globus.gsi.bc.BouncyCastleOpenSSLKey; +- +-/** +- * @author Jean-Claude Cote +- */ +-public class CertDestroyApplet extends GIPApplet implements ActionListener { +- +- private static final String PROPERTY_FILE = "CertDestroyApplet"; +- // Values configured by property file. +- private String destroyCredential = null; +- private String mailNotification = null; +- +- private String passPhraseLabel = "PassPhrase"; +- private String yourEmailAddressLabel = "Your e-mail address"; +- +- +- // UI elements. +- private Button mailNotificationButton = null; +- private Button destroyCredentialButton = null; +- private TextField passwordField = new TextField(); +- private TextField fromField = new TextField(); +- +- private X509Certificate cert = null; +- +- +- public void init() { +- super.init(); +- +- destroyCredential = getLocString("DestroyCredential"); +- mailNotification = getLocString("NotifyCA"); +- +- // Setup UI. +- mailNotificationButton = new Button(mailNotification); +- destroyCredentialButton = new Button(destroyCredential); +- +- +- Panel titlePanel = null; +- if (appletTitle.length() > 0) { +- titlePanel = new Panel(); +- titlePanel.add(new Label(appletTitle)); +- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); +- titlePanel.setBackground(bgColor); +- } +- +- Panel inputPanel = new Panel(); +- inputPanel.add(new Label(passPhraseLabel)); +- passwordField.setEchoChar('*'); +- inputPanel.add(passwordField); +- inputPanel.add(new Label(yourEmailAddressLabel)); +- inputPanel.add(fromField); +- inputPanel.setLayout(new GridLayout(0, 2)); +- inputPanel.setBackground(bgColor); +- +- Panel buttonPanel = new Panel(); +- destroyCredentialButton.addActionListener(this); +- buttonPanel.add(destroyCredentialButton); +- mailNotificationButton.addActionListener(this); +- buttonPanel.add(mailNotificationButton); +- buttonPanel.setLayout(new FlowLayout()); +- +- Panel statusPanel = new Panel(); +- Font font = new Font("Courier", Font.PLAIN, 12); +- status.setFont(font); +- statusPanel.add(status); +- +- Panel mainPanel = new Panel(); +- GridBagLayout gridbag = new GridBagLayout(); +- GridBagConstraints c = new GridBagConstraints(); +- if (titlePanel != null) { +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(titlePanel, c); +- mainPanel.add(titlePanel); +- } +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(inputPanel, c); +- mainPanel.add(inputPanel); +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(buttonPanel, c); +- mainPanel.add(buttonPanel); +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(statusPanel, c); +- mainPanel.add(statusPanel); +- mainPanel.setLayout(gridbag); +- +- this.add(mainPanel); +- this.setBackground(bgColor); +- } +- +- public void actionPerformed(ActionEvent actionEvent) { +- +- boolean bOk = true; +- +- try { +- // Load cert. +- if (cert == null){ +- try { +- cert = CertUtil.loadCertificate(userCertFile); +- } +- catch (IOException e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- bOk = false; +- } +- catch (GeneralSecurityException e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- bOk = false; +- } +- } +- +- if (actionEvent.getActionCommand() == destroyCredential) { +- +- String keyPassword = passwordField.getText(); +- +- try { +- OpenSSLKey key = new BouncyCastleOpenSSLKey(userKeyFile); +- +- if (key.isEncrypted()) { +- key.decrypt(keyPassword); +- } +- } catch(IOException e1) { +- appendToStatus("Error: Failed to load key: " + userKeyFile); +- appendToStatus("Make sure you have a valide private key installed."); +- e1.printStackTrace(); +- bOk = false; +- } catch(GeneralSecurityException e2) { +- appendToStatus("Error: Wrong grid pass phrase!"); +- e2.printStackTrace(); +- bOk = false; +- } +- +- if (bOk){ +- boolean confirmed = confirmAction(); +- +- if (confirmed) { +- File f = new File(userKeyFile); +- if (f.exists()) { +- if( f.delete() ){ +- appendToStatus(userKeyFile + " deleted."); +- } +- else{ +- appendToStatus("Error: Could not delete " + userKeyFile); +- } +- } +- else{ +- appendToStatus("Error: " + userKeyFile + " does not exists."); +- } +- f = new File(userCertFile); +- if (f.exists()) { +- if( f.delete() ){ +- appendToStatus(userCertFile + " deleted."); +- } +- else{ +- appendToStatus("Error: Could not delete " + userCertFile); +- } +- } +- else{ +- appendToStatus("Error: " + userCertFile + " does not exists."); +- } +- f = new File(userCertReqFile); +- if (f.exists()) { +- if( f.delete() ){ +- appendToStatus(userCertReqFile + " deleted."); +- } +- else{ +- appendToStatus("Error: Could not delete " + userCertReqFile); +- } +- } +- else{ +- appendToStatus("Error: " + userCertReqFile + " does not exists."); +- } +- } +- } +- } else if (actionEvent.getActionCommand() == mailNotification) { +- +- // Get recipient's email address. +- if (bOk) { +- if (fromField.getText().length() == 0) { +- appendToStatus("Please specify your e-mail address."); +- bOk = false; +- } +- } +- +- if (bOk){ +- String notificationEmail = buildNotificationEmail(); +- +- // Send the request to the CA. +- if (notificationEmail.length() > 0) { +- if (sendMail(fromField.getText(), notificationEmail)) { +- appendToStatus("Your notification has been mailed to " + emailAddressOfCA ); +- } +- } +- } +- +- } else { +- appendToStatus("Error: Unknown action " + actionEvent.getActionCommand() ); +- } +- } catch (Exception ex) { +- // Write exection to Java console. +- ex.printStackTrace(); +- +- // Write exception to status area. +- String message = ex.getMessage() + "\n"; +- StackTraceElement[] stackElements = ex.getStackTrace(); +- for (int i = 0; i < stackElements.length; i++) { +- message += stackElements[i].toString() + "\n"; +- } +- appendToStatus(message); +- } +- } +- +- private String buildNotificationEmail(){ +- return "\n\n" +- + "Plase revoke my certificate\n" +- + "\n" +- + "==================================================================\n" +- + "\n" +- + "subject : " + cert.getSubjectDN().getName() +- + "\n" +- + "issuer : " + cert.getIssuerDN().getName() +- + "\n" +- + "start date : " + cert.getNotBefore().toString() +- + "\n" +- + "end date : " + cert.getNotAfter().toString() +- + "\n" +- + "==================================================================\n"; +- } +- +- public boolean confirmAction(){ +- boolean confirmation = false; +- +- String[] messages = new String[5]; +- messages[0] = "Are you sure you want to destroy this certificate?"; +- String dn = null; +- dn = cert.getSubjectDN().getName(); +- messages[1] = "subject : " + dn; +- dn = cert.getIssuerDN().getName(); +- messages[2] = "issuer : " + dn; +- String dt = null; +- dt = cert.getNotBefore().toString(); +- messages[3] = "start date : " + dt; +- dt = cert.getNotAfter().toString(); +- messages[4] = "end date : " + dt; +- +- Container container = this.getParent(); +- while (! (container instanceof Frame)) container = container.getParent(); +- Frame parent = (Frame) container; +- +- ConfirmationDialog d = new ConfirmationDialog(parent, messages); +- d.setModal(true); +- d.show(); +- appendToStatus("Confirmation " + d.getConfirmation() ); +- confirmation = d.getConfirmation(); +- return confirmation; +- } +- +- /* (non-Javadoc) +- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() +- */ +- protected String getPropertyFileName() { +- // TODO Auto-generated method stub +- return PROPERTY_FILE; +- } +- +- +-} +- +- +-class ConfirmationDialog extends Dialog implements ActionListener { +- +- private boolean confirmed = false; +- +- public boolean getConfirmation(){ +- return confirmed; +- } +- +- public ConfirmationDialog(Frame parent, String[] messages) { +- +- super(parent, true); +- setTitle("Confirmation Dialog"); +- +- Font font = new Font("Courier", Font.PLAIN, 12); +- setFont(font); +- +- int rows = messages.length; +- Panel textPanel = new Panel(); +- textPanel.setLayout(new GridLayout(rows,1)); +- for(int i = 0; i < rows; i++){ +- textPanel.add(new Label(messages[i])); +- } +- add("Center", textPanel); +- +- Panel p = new Panel(); +- p.setLayout(new FlowLayout()); +- Button yes = new Button("Yes"); +- yes.addActionListener(this); +- p.add(yes); +- Button no = new Button("No"); +- no.addActionListener(this); +- p.add(no); +- add("South", p); +- +- setSize(300, 100); +- setLocation(100, 200); +- pack(); +- +- } +- +- public void actionPerformed(ActionEvent e) { +- this.hide(); +- this.dispose(); +- +- if (e.getActionCommand() == "Yes") { +- confirmed = true; +- } +- } +- +-} +Index: modules/certmanagement/src/org/globus/cog/security/cert/management/MyProxyApplet.java +=================================================================== +--- modules/certmanagement/src/org/globus/cog/security/cert/management/MyProxyApplet.java (revision 3296) ++++ modules/certmanagement/src/org/globus/cog/security/cert/management/MyProxyApplet.java (working copy) +@@ -1,387 +0,0 @@ +- +-// ---------------------------------------------------------------------- +-// This code is developed as part of the Java CoG Kit project +-// The terms of the license can be found at http://www.cogkit.org/license +-// This message may not be removed or altered. +-// ---------------------------------------------------------------------- +- +-/** +- * Copyright (c) 2003, National Research Council of Canada +- * All rights reserved. +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy of this +- * software and associated documentation files (the "Software"), to deal in the Software +- * without restriction, including without limitation the rights to use, copy, modify, merge, +- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the +- * Software is furnished to do so, subject to the following conditions: +- * +- * The above copyright notice(s) and this licence appear in all copies of the Software or +- * substantial portions of the Software, and that both the above copyright notice(s) and this +- * license appear in supporting documentation. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE +- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE +- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL +- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER +- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE +- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE +- * POSSIBILITY OF SUCH DAMAGE. +- * +- * Except as contained in this notice, the name of a copyright holder shall NOT be used in +- * advertising or otherwise to promote the sale, use or other dealings in this Software +- * without specific prior written authorization. Title to copyright in this software and any +- * associated documentation will at all times remain with copyright holders. +- */ +- +-package org.globus.cog.security.cert.management; +- +-import java.awt.Button; +-import java.awt.FlowLayout; +-import java.awt.Font; +-import java.awt.GridBagConstraints; +-import java.awt.GridBagLayout; +-import java.awt.GridLayout; +-import java.awt.Label; +-import java.awt.Panel; +-import java.awt.TextField; +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +-import java.io.File; +-import java.io.FileOutputStream; +-import java.io.OutputStream; +- +-import org.globus.gsi.CertUtil; +-import org.globus.myproxy.CredentialInfo; +-import org.globus.myproxy.MyProxy; +-import org.globus.myproxy.MyProxyException; +-import org.globus.util.Util; +-import org.gridforum.jgss.ExtendedGSSCredential; +-import org.ietf.jgss.GSSCredential; +- +-/** +- * @author Jean-Claude Cote +- */ +- +-public class MyProxyApplet extends GIPApplet implements ActionListener { +- +- private static final int KEY_LENGTH = 512; +- private static final int MYPROXY_SERVER_PORT = 7512; +- public static final int PORTAL_LIFETIME_HOURS = 2; +- private static final String PROPERTY_FILE = "MyProxyApplet"; +- private int credLifetimeNumDays = 7; +- +- // Values configured by property file. +- private String putAction = null; +- private String getAction = null; +- private String infoAction = null; +- private String destroyAction = null; +- private String myProxyHostLabel = null; +- private String myProxyAccountNameLabel = null; +- private String gridPassPhraseLabel = null; +- private String myProxyPassPhraseLabel = null; +- private String myProxyPassPhraseConfirmationLabel = null; +- +- +- private Button putButton = null; +- private Button infoButton = null; +- private Button destroyButton = null; +- private Button getButton = null; +- private TextField myProxyHost = new TextField(); +- private TextField myProxyUserNameField = new TextField(); +- private TextField keyPasswordField = new TextField(); +- private TextField myproxyPasswordField = new TextField(); +- private TextField myproxyPasswordFieldConfirmation = new TextField(); +- private TextField lifetimeField = new TextField("7"); +- private String hostname = null; +- private String username = null; +- private String keyPassword = null; +- private String myproxyPassword = null; +- private GSSCredential credential = null; +- +- +- public void init(){ +- super.init(); +- // set host name. +- String host = getParameter("myProxyHost"); +- if (host != null && host.length() > 0) { +- myProxyHost.setText(getParameter("myProxyHost")); +- } +- +- getAction = getLocString("getAction"); +- putAction = getLocString("putAction"); +- infoAction = getLocString("infoAction"); +- destroyAction = getLocString("destroyAction"); +- +- // Setup UI. +- putButton = new Button(putAction); +- infoButton = new Button(infoAction); +- getButton = new Button(getAction); +- destroyButton = new Button(destroyAction); +- +- Panel titlePanel = null; +- if (appletTitle.length() > 0) { +- titlePanel = new Panel(); +- titlePanel.add(new Label(appletTitle)); +- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); +- titlePanel.setBackground(bgColor); +- } +- +- Panel inputPanel = new Panel(); +- inputPanel.add(new Label(getLocString("MyProxy_host"))); +- inputPanel.add(myProxyHost); +- inputPanel.add(new Label(getLocString("MyProxy_Account_Name"))); +- inputPanel.add(myProxyUserNameField); +- inputPanel.add(new Label(getLocString("Grid_PassPhrase"))); +- keyPasswordField.setEchoChar('*'); +- inputPanel.add(keyPasswordField); +- inputPanel.add(new Label(getLocString("MyProxy_PassPhrase"))); +- myproxyPasswordField.setEchoChar('*'); +- inputPanel.add(myproxyPasswordField); +- inputPanel.add(new Label(getLocString("MyProxy_PassPhrase_Confirmation"))); +- myproxyPasswordFieldConfirmation.setEchoChar('*'); +- inputPanel.add(myproxyPasswordFieldConfirmation); +- inputPanel.add(new Label(getLocString("Lifetime"))); +- inputPanel.add(lifetimeField); +- inputPanel.setLayout(new GridLayout(0, 2)); +- inputPanel.setBackground(bgColor); +- +- Panel buttonPanel = new Panel(); +- putButton.addActionListener(this); +- buttonPanel.add(putButton); +- infoButton.addActionListener(this); +- buttonPanel.add(infoButton); +- getButton.addActionListener(this); +- buttonPanel.add(getButton); +- destroyButton.addActionListener(this); +- buttonPanel.add(destroyButton); +- buttonPanel.setLayout(new FlowLayout()); +- +- Panel statusPanel = new Panel(); +- Font font = new Font("Courier", Font.PLAIN, 12); +- status.setFont(font); +- statusPanel.add(status); +- +- Panel mainPanel = new Panel(); +- GridBagLayout gridbag = new GridBagLayout(); +- GridBagConstraints c = new GridBagConstraints(); +- if (titlePanel != null) { +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(titlePanel, c); +- mainPanel.add(titlePanel); +- } +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(inputPanel, c); +- mainPanel.add(inputPanel); +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(buttonPanel, c); +- mainPanel.add(buttonPanel); +- c.weightx = 1.0; +- c.gridwidth = GridBagConstraints.REMAINDER; //end row +- gridbag.setConstraints(statusPanel, c); +- mainPanel.add(statusPanel); +- mainPanel.setLayout(gridbag); +- +- this.add(mainPanel); +- this.setBackground(bgColor); +- } +- +- public void actionPerformed(ActionEvent e) { +- if(debug){ +- doDebugTests(); +- } +- +- keyPassword = keyPasswordField.getText(); +- hostname = myProxyHost.getText(); +- username = myProxyUserNameField.getText(); +- myproxyPassword = myproxyPasswordField.getText(); +- String myproxyPassword2 = myproxyPasswordFieldConfirmation.getText(); +- String tempLifetimeString = lifetimeField.getText(); +- +- boolean bOk = true; +- +- if (tempLifetimeString.length() == 0 ) { +- tempLifetimeString = "7"; +- } +- +- credLifetimeNumDays = Integer.parseInt(tempLifetimeString); +- +- if (username.length() == 0 ) { +- appendToStatus(getLocString("msg001")); +- bOk = false; +- } +- +- if( bOk ) { +- if (myproxyPassword.compareTo(myproxyPassword2) != 0) { +- appendToStatus(getLocString("msg003")); +- bOk = false; +- } +- else { +- if (myproxyPassword.length() < 5) { +- appendToStatus(getLocString("msg004")); +- bOk = false; +- } +- } +- } +- +- +- if( bOk ) { +- if( e.getActionCommand() == infoAction ) { +- doInfo(); +- } +- else if( e.getActionCommand() == destroyAction ) { +- if( keyPassword.length() == 0) { +- appendToStatus(getLocString("msg002")); +- bOk = false; +- } +- // Check that certs exists. +- if (bOk) { +- bOk = checkCertsExists(); +- } +- doDestroy(); +- } +- else if( e.getActionCommand() == putAction ){ +- if( keyPassword.length() == 0) { +- appendToStatus(getLocString("msg002")); +- bOk = false; +- } +- // Check that certs exists. +- if (bOk) { +- bOk = checkCertsExists(); +- } +- doPut(); +- } +- else if( e.getActionCommand() == getAction ){ +- doGet(); +- } +- else { +- appendToStatus(getLocString("msg005") + e.getActionCommand() ); +- } +- } +- } +- +- private void doGet() { +- int credLifetime = credLifetimeNumDays * 24 * 3600; +- CertUtil.init(); +- MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT); +- if( credential == null && keyPassword.length() > 0){ +- credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH); +- } +- GSSCredential cred = null; +- try { +- cred = myProxy.get(credential, username, myproxyPassword, credLifetime); +- +- // create a file +- String outputFile = cogProps.getProxyFile(); +- File f = new File(outputFile); +- String path = f.getPath(); +- +- OutputStream out = null; +- try { +- out = new FileOutputStream(path); +- // set read only permissions +- Util.setFilePermissions(path, 600); +- // write the contents +- byte [] data = ((ExtendedGSSCredential)cred).export(ExtendedGSSCredential.IMPEXP_OPAQUE); +- out.write(data); +- } +- finally { +- if (out != null) { +- try { out.close(); } catch(Exception e) {} +- } +- } +- +- appendToStatus("A proxy has been received for user " + username + " in " + path); +- +- } +- catch(Exception e) { +- appendExceptionDetailsToStatus(e); +- } +- } +- +- private void doInfo() { +- int credLifetime = credLifetimeNumDays * 24 * 3600; +- CertUtil.init(); +- boolean bInfOk = false; +- MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT); +- if( credential == null && keyPassword.length() > 0){ +- credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH); +- } +- CredentialInfo inf = null; +- try { +- inf = myProxy.info(credential, username, myproxyPassword); +- bInfOk = true; +- } +- catch(MyProxyException e){ +- appendExceptionDetailsToStatus(e); +- } +- if( bInfOk ){ +- appendToStatus(getLocString("msg006") + hostname + " " + inf.getOwner() ); +- } +- } +- +- private void doDestroy() { +- int credLifetime = credLifetimeNumDays * 24 * 3600; +- CertUtil.init(); +- boolean bDestroyOk = false; +- MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT); +- if( credential == null ){ +- credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH); +- } +- if( credential != null ){ +- try { +- myProxy.destroy(credential, username, myproxyPassword); +- bDestroyOk= true; +- } +- catch(MyProxyException e){ +- appendExceptionDetailsToStatus(e); +- } +- if( bDestroyOk){ +- appendToStatus(getLocString("msg007") + username ); +- } +- } +- } +- +- +- private void doPut() { +- int lifetime = PORTAL_LIFETIME_HOURS * 3600; +- int credLifetime = credLifetimeNumDays * 24 * 3600; +- +- CertUtil.init(); +- boolean bPutOk = false; +- MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT); +- if( credential == null ) { +- credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH); +- } +- if( credential != null ){ +- try { +- myProxy.put(credential, username, myproxyPassword, lifetime); +- bPutOk = true; +- } +- catch(MyProxyException e){ +- appendExceptionDetailsToStatus(e); +- } +- if( bPutOk ){ +- appendToStatus(getLocString("msg008") + credLifetime / 3600 + getLocString("msg009") + (credLifetime / (3600 * 24)) + getLocString("msg010") + username + getLocString("msg011") + hostname + "."); +- } +- } +- } +- +- /* (non-Javadoc) +- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() +- */ +- protected String getPropertyFileName() { +- // TODO Auto-generated method stub +- return PROPERTY_FILE; +- } +-} +- +Index: modules/certmanagement/applets/CertDestroyApplet.html +=================================================================== +--- modules/certmanagement/applets/CertDestroyApplet.html (revision 3296) ++++ modules/certmanagement/applets/CertDestroyApplet.html (working copy) +@@ -1,49 +0,0 @@ +- +- +-

+-NRC-CNRC Certificate Revocation Tool +-

+- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
+-Notes:
+-
+-Jean-Claude Cote
+-
+- +- +- +\ No newline at end of file +Index: modules/certmanagement/applets/jce.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/applets/certrenew_applet.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/applets/CertInfoApplet.html +=================================================================== +--- modules/certmanagement/applets/CertInfoApplet.html (revision 3296) ++++ modules/certmanagement/applets/CertInfoApplet.html (working copy) +@@ -1,49 +0,0 @@ +- +- +- +-

+-NRC-CNRC Certificate Info Tool +-

+- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
+- +-Notes:
+-
+-Jean-Claude Cote
+-
+- +- +- +\ No newline at end of file +Index: modules/certmanagement/applets/myproxy.jsp +=================================================================== +--- modules/certmanagement/applets/myproxy.jsp (revision 3296) ++++ modules/certmanagement/applets/myproxy.jsp (working copy) +@@ -1,15 +0,0 @@ +- +-

+-

+- +- +- +- +- +- +- Plugin tag OBJECT or EMBED not supported by browser. +- +- +- +-
+-

+\ No newline at end of file +Index: modules/certmanagement/applets/certreq.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/applets/warning.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/applets/certinfo.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/applets/certrenew.jsp +=================================================================== +--- modules/certmanagement/applets/certrenew.jsp (revision 3296) ++++ modules/certmanagement/applets/certrenew.jsp (working copy) +@@ -1,15 +0,0 @@ +- +-

+-

+- +- +- +- +- +- +- +- Plugin tag OBJECT or EMBED not supported by browser. +- +- +-
+-

+\ No newline at end of file +Index: modules/certmanagement/applets/certmanagement.html +=================================================================== +--- modules/certmanagement/applets/certmanagement.html (revision 3296) ++++ modules/certmanagement/applets/certmanagement.html (working copy) +@@ -1,87 +0,0 @@ +- +- +- +-

Certificate Management Tools

+- +-
+-The certificate management module is a set of tools that make it easier for users to manage their certificates. For instance there are tools to generate a certificate request, store credential on MyProxy server, view local credential, renew certificates and revoke certificates.
+-
+-Administrators have to choice of deploying these tools as signed Java Applets and/or as signed Java WebStart Applets.
+-
+-The benefits of signed Java Applet are integration into web pages however they required Java capable browsers. Java singed WebStart Applets do not have this requirement. The WebStart mechanism also has the advantage of caching the jars used by the applets. One disadvantage to the WebStart mechanism is that the Applet will not integrate into web page.
+-
+-Both of these deployment methods are appealing because they don?t require any installation of OGSA or CoG by the client. The deployment mechanism will install the necessary jars to run the certificate management tools.
+-
+- +-
+-Applets (html)
+-
+-These applets are signed by my personal credentials which are certified by Grid Canada CA.
+-
+-Most browsers come with a list of known CA that they trust. Since Grid Canada CA is not known to your browser you will get a warning "The security certificate was issued by a company that is not trusted". Since we trust Grid Canada simply ignore the warning.
+-
+-Certificate Request
+-Host Certificate Request
+-Certificate Information
+-MyProxy
+-Certificate Renewal
+-Certificate Revocation
+-
+-
+-Applets (jsp)
+-
+-These applets are signed by my personal credentials which are certified by Grid Canada CA.
+-
+-Most browsers come with a list of known CA that they trust. Since Grid Canada CA is not known to your browser you will get a warning "The security certificate was issued by a company that is not trusted". Since we trust Grid Canada simply ignore the warning.
+-
+-Certificate Request
+-Host Certificate Request
+-Certificate Information
+-MyProxy
+-Certificate Renewal
+-Certificate Revocation
+-
+-
+-WebStart Applets
+-
+-In order for the Java WebStart client to verify the signature of the jars it needs to know the CA that issued the signing certificate to the entity that signed the jars. That means that before using any of the applets a user needs to import the Globus and Sun's "JCE Code Signing CA" certificate authorities into their Java WebStart client.
+-
+-Download the CA certificates:
+-Grid Cadanda CA
+-JCE Code Signing CA
+-
+-Here are the steps to install the CA certificates into Java WebStart:
+-
+-Start Java WebStart console
+-Go to File->Perferences
+-Go to Root Certificates
+-Click on Import
+-Select the file containing the Root Certificate
+-Click open and give it a name can be anything
+-
+-Only then will Java WebStart be able to validate the signature of the jars.
+-
+-Note: At the moment the jce jar is not signed properly by Bouncy Castle. Once we use the latest jar it will be ok but for the moment you will get a "error parsing certificate" warning dialog. Simply press the X button do not press the abort button.
+-
+-Certificate Request
+-Host Certificate Request
+-Certificate Information
+-MyProxy
+-Certificate Renewal
+-Certificate Revocation
+-
+-
+-Readme
+-
+-
+-Jean-Claude Cote
+-High Performance Computing / Calcul de haute performance
+-National Research Council Canada / Conseil national de recherches Canada
+-www.grid.nrc.ca
+-
+- +- +- +- +- +- +Index: modules/certmanagement/applets/hostcertreq.jsp +=================================================================== +--- modules/certmanagement/applets/hostcertreq.jsp (revision 3296) ++++ modules/certmanagement/applets/hostcertreq.jsp (working copy) +@@ -1,16 +0,0 @@ +- +-

+-

+- +- +- +- +- +- +- +- +- Plugin tag OBJECT or EMBED not supported by browser. +- +- +-
+-

+\ No newline at end of file +Index: modules/certmanagement/applets/JCE Code Signing CA.pem +=================================================================== +--- modules/certmanagement/applets/JCE Code Signing CA.pem (revision 3296) ++++ modules/certmanagement/applets/JCE Code Signing CA.pem (working copy) +@@ -1,19 +0,0 @@ +------BEGIN CERTIFICATE----- +-MIIDwDCCA36gAwIBAgIBEDALBgcqhkjOOAQDBQAwgZAxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJD +-QTESMBAGA1UEBxMJUGFsbyBBbHRvMR0wGwYDVQQKExRTdW4gTWljcm9zeXN0ZW1zIEluYzEjMCEG +-A1UECxMaSmF2YSBTb2Z0d2FyZSBDb2RlIFNpZ25pbmcxHDAaBgNVBAMTE0pDRSBDb2RlIFNpZ25p +-bmcgQ0EwHhcNMDEwNDI1MDcwMDAwWhcNMjAwNDI1MDcwMDAwWjCBkDELMAkGA1UEBhMCVVMxCzAJ +-BgNVBAgTAkNBMRIwEAYDVQQHEwlQYWxvIEFsdG8xHTAbBgNVBAoTFFN1biBNaWNyb3N5c3RlbXMg +-SW5jMSMwIQYDVQQLExpKYXZhIFNvZnR3YXJlIENvZGUgU2lnbmluZzEcMBoGA1UEAxMTSkNFIENv +-ZGUgU2lnbmluZyBDQTCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQDrrzcEHspRHmldsPKP9rVJH8ak +-mQXXKb90t2r1Gdge5Bv4CgGamP9wq+JKVoZsU7P84ciBjDHwxPOwi+ZwBuz3aWjbg0xyKYkpNhdc +-O0oHoCACKkaXUR1wyAgYC84Mbpt29wXj5/vTYXnhYJokjQaVgzxRIOEwzzhXgqYacg3O0wIVAIQl +-ReG6ualiq3noWzC4iWsb/3t1AoGBAKvJdHt07+5CtWpTTTvdkAZyaJEPC6Qpdi5VO9WuTWVcfio6 +-BKZnptBxqqXXt+LBcg2k0aoeklRMIAAJorAJQRkzALLDXK5C+LGLynyW2BB/N0Rbqsx4yNdydjdr +-QJmoVWb6qAMei0oRAmnLTLglBhygd9LJrNI96QoQ+nZwt/vcA4GEAAKBgC0JmFysuJzHmX7uIBkq +-NJD516urrt1rcpUNZvjvJ49Esu0oRMf+r7CmJ28AZ0WCWweoVlY70ilRYV5pOdcudHcSzxlK9S3I +-y3JhxE5v+kdDPxS7+rwYZijC2WaLei0vwmCSSxT+WD4hf2hivmxISfmgS16FnRkQ+RVFURtx1PcL +-o2YwZDARBglghkgBhvhCAQEEBAMCAAcwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBRl4vSG +-ydNO8JFOWKJq9dh4WprBpjAdBgNVHQ4EFgQUZeL0hsnTTvCRTliiavXYeFqawaYwCwYHKoZIzjgE +-AwUAAy8AMCwCFCr3zzyXXfl4tgjXQbTZDUVM5LScAhRFzXVpDiH6HdazKbLp9zMdM/38SQ== +------END CERTIFICATE----- +Index: modules/certmanagement/applets/certreq.jsp +=================================================================== +--- modules/certmanagement/applets/certreq.jsp (revision 3296) ++++ modules/certmanagement/applets/certreq.jsp (working copy) +@@ -1,15 +0,0 @@ +- +-

+-

+- +- +- +- +- +- +- +- Plugin tag OBJECT or EMBED not supported by browser. +- +- +-
+-

+\ No newline at end of file +Index: modules/certmanagement/applets/MyProxyApplet.html +=================================================================== +--- modules/certmanagement/applets/MyProxyApplet.html (revision 3296) ++++ modules/certmanagement/applets/MyProxyApplet.html (working copy) +@@ -1,56 +0,0 @@ +- +- +- +-

+-NRC-CNRC MyProxy Tool +-

+- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
+-
+- +-Notes:
+-
+-This applet uses the same cog.properties files as the CoG kit.
+-
+-
+-Jean-Claude Cote
+-
+- +- +- +\ No newline at end of file +Index: modules/certmanagement/applets/readme.html +=================================================================== +--- modules/certmanagement/applets/readme.html (revision 3296) ++++ modules/certmanagement/applets/readme.html (working copy) +@@ -1,311 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +-The certificate management module is a set of tools that make it easier +-for users to manage their certificates +- +- +- +- +- +- +-
+- +-

 

+- +-

The +-certificate management module is a set of tools that make it easier for users +-to manage their certificates. For instance there are tools to generate a +-certificate request, store credential on MyProxy server, view local credential, +-renew certificates and revoke certificates.

+- +-

 

+- +-

Administrators +-have to choice of deploying these tools as signed Java Applets and/or as signed +-Java WebStart Applets.

+- +-

 

+- +-

The +-benefits of signed Java Applet are integration into web pages however they +-required Java capable browsers. Java singed WebStart Applets do not have this +-requirement. The WebStart mechanism also has the advantage of caching the jars +-used by the applets. One disadvantage to the WebStart mechanism is that the +-Applet will not integrate into web page.

+- +-

 

+- +-

Both +-of these deployment methods are appealing because they don?t require any +-installation of OGSA or CoG by the client. The deployment mechanism will +-install the necessary jars to run the certificate management tools.

+- +-

 

+- +-

This +-module consists of .java files for the actual applets and of .jsp and .html +-pages to launch the Java Applets and .jnlp files to launch the WebStart +-Applets. These files contain parameters that can be changed by an administrator +-to change such things as the Certificate Authority, MyProxy server location and +-background color of the applet.

+- +-

 

+- +-

These +-applets need to be signed

+- +-

 

+- +-

(explain +-how this is done)

+- +-

 

+- +-

These applets are +-signed by my personal credentials which are certified by Grid Canada CA. The applets +-should really be signed by a NRC certificate, issued by Grid Candad CA.
+-
+-Most browsers come with a list of known CA that they trust. Since Grid Canada +-CA is not known to your browser you will get a warning "The security +-certificate was issued by a company that is not trusted". But we know Grid +-Canada is ok.

+- +-

 

+- +-

In +-order for the Java WebStart client to verify the signature of the jars it needs +-to know the CA that issued the signing certificate to the entity that signed +-the jars. That means that before using any of the applets a user needs to +-import the Globus and Sun's "JCE Code Signing CA" certificate +-authorities into their Java WebStart client. Here are the steps to do so:

+- +-

 

+- +-

Start Java WebStart +-console

+- +-

Go to +-File->Perferences

+- +-

Go to Root +-Certificates

+- +-

Click on Import

+- +-

Select the file +-containing the Root Certificate

+- +-

Click open and give +-it a name can be anything

+- +-

 

+- +-

Only then will Java +-WebStart be able to validate the signature of the jars.

+- +-

 

+- +-

 

+- +-

A +-user must trust the entity that signed the applets.


+- +- +- +- +- +-

 

+- +-

At +-the moment the jce jar is not signed properly by Bouncy Castle. Once we use the +-latest jar it will be ok but for the moment you will get this dialog. Simply +-press the X not the abort button.

+- +-

 

+- +- +- +- +-

 

+- +-

Once +-the user grants the applets security access it will start.

+- +-

 

+- +-

The +-first step a new grid user will have to do is get credentials. To do this you +-need to generate a certificate request and have it signed by your certificate +-authority. Use the CertReqApplet to do this:

+- +-

 

+- +- +- +- +-

 

+- +-

(description +-of params goes here)

+- +-

 

+- +-

Once +-you get a response from your CA place it in your usercert.pem as described in +-the email. You can now use the certificate info applet to see your local +-credentials.

+- +-

 

+- +- +- +- +-

 

+- +-

Supposing +-you were going away on a business trip you may want to put some temporary +-credential on a MyProxy server. See myproxy command line tool for more details +-on what this means.

+- +-

 

+- +- +- +- +-

 

+- +-

(description +-of params goes here)

+- +-

 

+- +-

After +-a certain amount of time your credential will expire. Before this happens your +-CA will send you a renewal notification with a challenge phrase. You can use +-the certificate renew applet to generate your renewal request.

+- +-

 

+- +- +- +- +-

 

+- +-

(description +-of params goes here)

+- +-

 

+- +-

 

+- +-

If +-for some reason your credentials get compromised or you simply don?t need them +-anymore you may want to destroy your credentials and notify your CA that you +-did so. The certificate revocation applet can be used to delete the certificate +-files and notify your CA.

+- +-

 

+- +- +- +- +-

 

+- +-

(description +-of params goes here)

+- +-

 

+- +-

 

+- +-

 

+- +-

Jean-Claude +-Cote

+- +-

High +-Performance Computing / Calcul de haute performance

+- +-

National +-Research Council Canada / Conseil national de recherches Canada

+- +-

www.grid.nrc.ca

+- +-

 

+- +-

 

+- +-
+- +- +- +- +Index: modules/certmanagement/applets/certdestroy.jsp +=================================================================== +--- modules/certmanagement/applets/certdestroy.jsp (revision 3296) ++++ modules/certmanagement/applets/certdestroy.jsp (working copy) +@@ -1,15 +0,0 @@ +- +-

+-

+- +- +- +- +- +- +- +- Plugin tag OBJECT or EMBED not supported by browser. +- +- +-
+-

+\ No newline at end of file +Index: modules/certmanagement/applets/certinfo.jsp +=================================================================== +--- modules/certmanagement/applets/certinfo.jsp (revision 3296) ++++ modules/certmanagement/applets/certinfo.jsp (working copy) +@@ -1,14 +0,0 @@ +- +-

+-

+- +- +- +- +- +- +- Plugin tag OBJECT or EMBED not supported by browser. +- +- +-
+-

+\ No newline at end of file +Index: modules/certmanagement/applets/myproxy.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/applets/CertRenewApplet.html +=================================================================== +--- modules/certmanagement/applets/CertRenewApplet.html (revision 3296) ++++ modules/certmanagement/applets/CertRenewApplet.html (working copy) +@@ -1,56 +0,0 @@ +- +- +- +-

+-NRC-CNRC Certificate Renew Tool +-

+- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
+-Notes:
+-This applet uses the same cog.properties files as the CoG kit.
+-If you have a cog.properties file it the keys will be generate according to those settings.
+-If you do not have a cog.properties file the keys will be generated in your home dir in a directory named ".globus".
+-
+-To prevent any accidents this applet does not overwrite any existing key files. It is up to the user to move or rename any existing keys.
+-
+-Jean-Claude Cote
+-
+- +- +- +\ No newline at end of file +Index: modules/certmanagement/applets/certrevocation_applet.jpg +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/certmanagement/applets/HostCertReqApplet.html +=================================================================== +--- modules/certmanagement/applets/HostCertReqApplet.html (revision 3296) ++++ modules/certmanagement/applets/HostCertReqApplet.html (working copy) +@@ -1,57 +0,0 @@ +- +- +-

+-NRC-CNRC Host Certificate Request Tool +-

+- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
+-Notes:
+-
+-This applet uses the same cog.properties files as the CoG kit.
+-If you have a cog.properties file it the keys will be generate according to those settings.
+-If you do not have a cog.properties file the keys will be generated in your home dir in a directory named ".globus".
+-
+-To prevent any accidents this applet does not overwrite any existing key files. It is up to the user to move or rename any existing keys.
+-
+-Jean-Claude Cote
+-
+- +- +- +\ No newline at end of file +Index: modules/certmanagement/applets/CertReqApplet.html +=================================================================== +--- modules/certmanagement/applets/CertReqApplet.html (revision 3296) ++++ modules/certmanagement/applets/CertReqApplet.html (working copy) +@@ -1,55 +0,0 @@ +- +- +-

+-NRC-CNRC Certificate Request Tool +-

+- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
+-Notes:
+-
+-This applet uses the same cog.properties files as the CoG kit.
+-If you have a cog.properties file it the keys will be generate according to those settings.
+-If you do not have a cog.properties file the keys will be generated in your home dir in a directory named ".globus".
+-
+-To prevent any accidents this applet does not overwrite any existing key files. It is up to the user to move or rename any existing keys.
+-
+-Jean-Claude Cote
+-
+- +- +- +\ No newline at end of file +Index: modules/certmanagement/resources/cacerts/5f54f417.signing_policy +=================================================================== +--- modules/certmanagement/resources/cacerts/5f54f417.signing_policy (revision 3296) ++++ modules/certmanagement/resources/cacerts/5f54f417.signing_policy (working copy) +@@ -1,33 +0,0 @@ +-# ca-signing-policy.conf, see ca-signing-policy.doc for more information +-# +-# This is the configuration file describing the policy for what CAs are +-# allowed to sign whoses certificates. +-# +-# This file is parsed from start to finish with a given CA and subject +-# name. +-# subject names may include the following wildcard characters: +-# * Matches any number of characters. +-# ? Matches any single character. +-# +-# CA names must be specified (no wildcards). Names containing whitespaces +-# must be included in single quotes, e.g. 'Certification Authority'. +-# Names must not contain new line symbols. +-# The value of condition attribute is represented as a set of regular +-# expressions. Each regular expression must be included in double quotes. +-# +-# This policy file dictates the following policy: +-# -The Globus CA can sign Globus certificates +-# +-# Format: +-#------------------------------------------------------------------------ +-# token type | def.authority | value +-#--------------|---------------|----------------------------------------- +-# EACL entry #1| +- +- access_id_CA X509 '/C=CA/O=Grid/CN=Grid Canada CA' +- +- pos_rights globus CA:sign +- +- cond_subjects globus '"/C=CA/O=Grid/*"' +- +-# end of EACL +Index: modules/certmanagement/resources/cacerts/5f54f417.0 +=================================================================== +--- modules/certmanagement/resources/cacerts/5f54f417.0 (revision 3296) ++++ modules/certmanagement/resources/cacerts/5f54f417.0 (working copy) +@@ -1,13 +0,0 @@ +------BEGIN CERTIFICATE----- +-MIIB3jCCAUegAwIBAgIBADANBgkqhkiG9w0BAQQFADA1MQswCQYDVQQGEwJDQTEN +-MAsGA1UEChMER3JpZDEXMBUGA1UEAxMOR3JpZCBDYW5hZGEgQ0EwHhcNMDIwNDEx +-MDM1OTI5WhcNMDcwNDEwMDM1OTI5WjA1MQswCQYDVQQGEwJDQTENMAsGA1UEChME +-R3JpZDEXMBUGA1UEAxMOR3JpZCBDYW5hZGEgQ0EwgZ8wDQYJKoZIhvcNAQEBBQAD +-gY0AMIGJAoGBAKwipADYu61Errh59EhJKA61rVV3eHOn9BwdNrxgkaed8SqZxRz6 +-zsoPt0ALRFNNOovgYGzMo8qV4mScl2ONtDdBWDPB+uhJ+okuQUQodA9PzdwgGr3M +-SOlDMfWSgoE7rdh/xYKQ7Q4Ddq14NqZYvmCvLfqdK0C/7TkAvJWtdEnnAgMBAAEw +-DQYJKoZIhvcNAQEEBQADgYEAhl1IByLyk0+dYKVI69SMMrmGkA965g+op9QF2L1T +-tPQUtiP7hliMP6zGgR/LoYMRfWGLPjuW/Wwg8I8VTpGr9JqrsHvS7xcHO5A/l4zF +-hTl1ytiQ0eNN3jXjJ6u13fdXF1tmhCeZLQpvNaik+TM0OB64+J0Lf/0m3i+l6feK +-oeU= +------END CERTIFICATE----- +Index: modules/certmanagement/resources/cacerts/42864e48.signing_policy +=================================================================== +--- modules/certmanagement/resources/cacerts/42864e48.signing_policy (revision 3296) ++++ modules/certmanagement/resources/cacerts/42864e48.signing_policy (working copy) +@@ -1,33 +0,0 @@ +-# ca-signing-policy.conf, see ca-signing-policy.doc for more information +-# +-# This is the configuration file describing the policy for what CAs are +-# allowed to sign whoses certificates. +-# +-# This file is parsed from start to finish with a given CA and subject +-# name. +-# subject names may include the following wildcard characters: +-# * Matches any number of characters. +-# ? Matches any single character. +-# +-# CA names must be specified (no wildcards). Names containing whitespaces +-# must be included in single quotes, e.g. 'Certification Authority'. +-# Names must not contain new line symbols. +-# The value of condition attribute is represented as a set of regular +-# expressions. Each regular expression must be included in double quotes. +-# +-# This policy file dictates the following policy: +-# -The Globus CA can sign Globus certificates +-# +-# Format: +-#------------------------------------------------------------------------ +-# token type | def.authority | value +-#--------------|---------------|----------------------------------------- +-# EACL entry #1| +- +- access_id_CA X509 '/C=US/O=Globus/CN=Globus Certification Authority' +- +- pos_rights globus CA:sign +- +- cond_subjects globus '"/C=us/O=Globus/*" "/C=US/O=Globus/*" "/O=Grid/O=Globus/*"' +- +-# end of EACL +Index: modules/certmanagement/resources/cacerts/42864e48.0 +=================================================================== +--- modules/certmanagement/resources/cacerts/42864e48.0 (revision 3296) ++++ modules/certmanagement/resources/cacerts/42864e48.0 (working copy) +@@ -1,14 +0,0 @@ +------BEGIN CERTIFICATE----- +-MIICJzCCAZCgAwIBAgIBADANBgkqhkiG9w0BAQQFADBHMQswCQYDVQQGEwJVUzEP +-MA0GA1UEChMGR2xvYnVzMScwJQYDVQQDEx5HbG9idXMgQ2VydGlmaWNhdGlvbiBB +-dXRob3JpdHkwHhcNOTgwMTIzMTkyMDI0WhcNMDQwMTIzMTkyMDI0WjBHMQswCQYD +-VQQGEwJVUzEPMA0GA1UEChMGR2xvYnVzMScwJQYDVQQDEx5HbG9idXMgQ2VydGlm +-aWNhdGlvbiBBdXRob3JpdHkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAPab +-enNkxgduNcEQgpL226qoksXAhw/Hles3Zx2vvapP/hsysE5SFwKuXmgMRxzVNzZn +-7yTyRcm14eu30YqjBsg2ajQfBBVcMHEoMfq5Vz8+hAYQdtS5ky/cghdc5sETWmtp +-ypMHR0PlgRrpWrGKbHFFwOLI7QwNlGxiD3FTOu9lAgMBAAGjIzAhMAwGA1UdEwQF +-MAMBAf8wEQYJYIZIAYb4QgEBBAQDAgAHMA0GCSqGSIb3DQEBBAUAA4GBAFy0eT7d +-UgE5gbQhpKwY011eDlS1bdT9eADRG4kjO5B9Z12dUNVzBt/H8k8uS3McSvCipEyu +-85LRxEeotkYLAfJWM2tVo3P3zv2lRk2Xy1lmq4tUXti2PSM3sVIxUY9Cf5bdWPh4 +-tY50uxhH7ljOgZY2Lo7x8X1YicNH1dr/JAks +------END CERTIFICATE----- +Index: modules/certmanagement/resources/conf/CertRenewApplet.properties +=================================================================== +--- modules/certmanagement/resources/conf/CertRenewApplet.properties (revision 3296) ++++ modules/certmanagement/resources/conf/CertRenewApplet.properties (working copy) +@@ -1,22 +0,0 @@ +-AppletTitle= +-EmailSubject=Certificate Renew Request Generated by CertRenewApplet +-CACertFiles=5f54f417.0,42864e48.0 +- +-RenewRequestAction=Renew Request +-MailRenewAction=Mail my Renewal Request +- +- +-msg001 = \ exists +-msg002 = Looks like you already have renew credentials. +-msg003 = If you wish to create new ones you will need to move them to another location. +-msg004 = Please provide the chalenge that was mailed to you. +-msg005 = Generating a certificate renewal request using chalenge:\ +-msg006 = A new private key as been generated. +-msg007 = A new private key as been saved to\ +-msg008 = Your certificate renewal request can be found in:\ +-msg009 = Please mail the content of this file to:\ +-msg010 = \ or simply use the mail button. +-msg011 = Please specify your e-mail address. +-msg012 = Your request has been mailed to\ +-msg013 = Error: Unknown action\ +- +Index: modules/certmanagement/resources/conf/MyProxyApplet_fr_CA.properties +=================================================================== +--- modules/certmanagement/resources/conf/MyProxyApplet_fr_CA.properties (revision 3296) ++++ modules/certmanagement/resources/conf/MyProxyApplet_fr_CA.properties (working copy) +@@ -1,28 +0,0 @@ +-AppletTitle= +-EmailSubject= +-CACertFiles=5f54f417.0,42864e48.0 +- +-getAction=Get +-putAction=Put +-infoAction=Info +-destroyAction=Destroy +- +-MyProxy_host = MyProxy host +-MyProxy_Account_Name = MyProxy Account Name +-Grid_PassPhrase = Grid PassPhrase +-MyProxy_PassPhrase = MyProxy PassPhrase +-MyProxy_PassPhrase_Confirmation = PassPhrase Confirmation +-Lifetime = Lifetime (days) +- +-msg001 = MyProxy account name missing. +-msg002 = Grid passphrase mising. +-msg003 = The myproxy passwords do not match. +-msg004 = The myproxy password is too short, needs to be at least 6 chars +-msg005 = Error: Unknown action\ +-msg006 = You have a proxy on\ +-msg007 = Your proxy has been removed from\ +-msg008 = A proxy valid for\ +-msg009 = \ hours ( +-msg010 = \ days) for user\ +-msg011 = \ now exists on\ +- +Index: modules/certmanagement/resources/conf/CertRequestApplet.properties +=================================================================== +--- modules/certmanagement/resources/conf/CertRequestApplet.properties (revision 3296) ++++ modules/certmanagement/resources/conf/CertRequestApplet.properties (working copy) +@@ -1,9 +0,0 @@ +-AppletTitle= +-EmailSubject=Certificate Request Generated by CertReqApplet +-CACertFiles=5f54f417.0,42864e48.0 +- +-GenerateRequestAction=Generate Request +-MailRequestAction=Mail my Request +- +- +- +Index: modules/certmanagement/resources/conf/CertDestroyApplet.properties +=================================================================== +--- modules/certmanagement/resources/conf/CertDestroyApplet.properties (revision 3296) ++++ modules/certmanagement/resources/conf/CertDestroyApplet.properties (working copy) +@@ -1,13 +0,0 @@ +-AppletTitle= +-EmailSubject=Certificate Revocation Request +-CACertFiles=5f54f417.0,42864e48.0 +- +-DestroyCredential = Destroy Credential +-NotifyCA = Notify CA +- +- +- +- +- +- +- +Index: modules/certmanagement/resources/conf/MyProxyApplet.properties +=================================================================== +--- modules/certmanagement/resources/conf/MyProxyApplet.properties (revision 3296) ++++ modules/certmanagement/resources/conf/MyProxyApplet.properties (working copy) +@@ -1,28 +0,0 @@ +-AppletTitle= +-EmailSubject= +-CACertFiles=5f54f417.0,42864e48.0 +- +-getAction=Get +-putAction=Put +-infoAction=Info +-destroyAction=Destroy +- +-MyProxy_host = MyProxy host +-MyProxy_Account_Name = MyProxy Account Name +-Grid_PassPhrase = Grid PassPhrase +-MyProxy_PassPhrase = MyProxy PassPhrase +-MyProxy_PassPhrase_Confirmation = PassPhrase Confirmation +-Lifetime = Lifetime (days) +- +-msg001 = MyProxy account name missing. +-msg002 = Grid passphrase mising. +-msg003 = The myproxy passwords do not match. +-msg004 = The myproxy password is too short, needs to be at least 6 chars +-msg005 = Error: Unknown action\ +-msg006 = You have a proxy on\ +-msg007 = Your proxy has been removed from\ +-msg008 = A proxy valid for\ +-msg009 = \ hours ( +-msg010 = \ days) for user\ +-msg011 = \ now exists on\ +- +Index: modules/certmanagement/resources/conf/CertInfoApplet.properties +=================================================================== +--- modules/certmanagement/resources/conf/CertInfoApplet.properties (revision 3296) ++++ modules/certmanagement/resources/conf/CertInfoApplet.properties (working copy) +@@ -1,8 +0,0 @@ +-AppletTitle= +-EmailSubject=None +-CACertFiles=5f54f417.0,42864e48.0 +- +- +- +- +- +Index: modules/certmanagement/resources/conf/MyProxyApplet_en_CA.properties +=================================================================== +--- modules/certmanagement/resources/conf/MyProxyApplet_en_CA.properties (revision 3296) ++++ modules/certmanagement/resources/conf/MyProxyApplet_en_CA.properties (working copy) +@@ -1,28 +0,0 @@ +-AppletTitle= +-EmailSubject= +-CACertFiles=5f54f417.0,42864e48.0 +- +-getAction=Get +-putAction=Put +-infoAction=Info +-destroyAction=Destroy +- +-MyProxy_host = MyProxy host +-MyProxy_Account_Name = MyProxy Account Name +-Grid_PassPhrase = Grid PassPhrase +-MyProxy_PassPhrase = MyProxy PassPhrase +-MyProxy_PassPhrase_Confirmation = PassPhrase Confirmation +-Lifetime = Lifetime (days) +- +-msg001 = MyProxy account name missing. +-msg002 = Grid passphrase mising. +-msg003 = The myproxy passwords do not match. +-msg004 = The myproxy password is too short, needs to be at least 6 chars +-msg005 = Error: Unknown action\ +-msg006 = You have a proxy on\ +-msg007 = Your proxy has been removed from\ +-msg008 = A proxy valid for\ +-msg009 = \ hours ( +-msg010 = \ days) for user\ +-msg011 = \ now exists on\ +- +Index: modules/certmanagement/etc/MANIFEST.MF.tail +=================================================================== +--- modules/certmanagement/etc/MANIFEST.MF.tail (revision 3296) ++++ modules/certmanagement/etc/MANIFEST.MF.tail (working copy) +@@ -1 +0,0 @@ +- +Index: modules/certmanagement/etc/MANIFEST.MF.head +=================================================================== +--- modules/certmanagement/etc/MANIFEST.MF.head (revision 3296) ++++ modules/certmanagement/etc/MANIFEST.MF.head (working copy) +@@ -1 +0,0 @@ +-Manifest-Version: 1.0 +Index: modules/certmanagement/readme.txt +=================================================================== +--- modules/certmanagement/readme.txt (revision 3296) ++++ modules/certmanagement/readme.txt (working copy) +@@ -1,79 +0,0 @@ +- Certificate Management Module +- ----------------------------- +- +- +-The certificate management module has a main page called certmanagement.html. This +-page contains links to the various html, jsp and jnlp launchers. It also contains +-some information regarding the use of the various applets. +- +-Remember to set the set the codebase property in the cog's main webstart.properties. +-This should be set to the location where you will deploy your applets. +- +-codebase=http://localhost:8080/certmanagement +- +- +-How to sign using your own certificate: +- +-The webstart.properties also contains all the fields required to change the signer +-of the applets. Simply edit this file to your liking. +- +-keystore=${user.home}/.globus/javacogkit.jks +-storetype=JKS +-storepass=password +-signalias=javacogkit +- +- +-How to use and install a different CA: +- +-The applets will install the CA certificates files listed in the +-conf/*.properties files. Currently they are configured to install the +-Grid Canada (5f54f417.0) and Globus (42864e48.0) CA certificates, like so: +- +- CACertFiles=5f54f417.0,42864e48.0 +- +-The cacerts directory must contain the actual CA certificates you want the +-certmanagement applets to install on the clients machine. These files get copied +-into the cog-certmanagement.jar. The applets will extract the certificates and +-install them in the clients ~/.globus/certificates directory. +- +-So if you want to install your own CA certificate file simply add it to the cacerts +-directory and add an entry for it in the conf/*.properties files. +- +-You may also want to specify your own email address to send certificate request to. +-The default is ca at globus.org. There is also a default myproxy server address that +-should be changed. See the launchers.xml file: +- +- +- +- +- +- +- +- +-How to build: +- +-ant dist (copies jars required by certmanagement module into the dist directory) +-ant compile +-ant deploy.webstart (build jars and generates the jnlp files) +- +- +-Things remaingin: +- +-Still making use of my original GridCertRequest class. Make use of +-GridCertRequest.java located in modules/certrequest. +-Finish internalization, framework is in place but not all strings are +-internazonalized. +- +- +-Jean-Claude Cote +-High Performance Computing / Calcul de haute performance +-National Research Council Canada / Conseil national de recherches Canada +-www.grid.nrc.ca +- +- +- +- +- +- +- +- +Index: modules/certmanagement/build.xml +=================================================================== +--- modules/certmanagement/build.xml (revision 3296) ++++ modules/certmanagement/build.xml (working copy) +@@ -1,154 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- Available targets: +- help: +- prints out this help message +- +- dist: +- creates a distribution directory of the +- ${project} ${long.name} +- +- jar: +- creates a jar file for the ${project} ${long.name} +- named ${jar.filename} +- +- javadoc: +- creates the documentation +- +- clean: +- removes the compiled classes +- +- distclean: +- deletes the distribution directory +- +- all: +- dist and javadoc +- +- deploy.webstart: +- deploys the module as a webstart application +- +- dist.joint: +- builds everything into one jar file. Should only +- be used globally (from all) +- +- fixeol: +- +- change newlines to the unix standard +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +Index: modules/transfer-gui/tools/SignJarCommand.pl +=================================================================== +--- modules/transfer-gui/tools/SignJarCommand.pl (revision 3296) ++++ modules/transfer-gui/tools/SignJarCommand.pl (working copy) +@@ -1,29 +0,0 @@ +-#!/bin/perl +-if (opendir(DIR, "lib")) { +- +- $output_file=">tmp"; +- open(OUTPUT_FILE, $output_file); +- @entries = readdir(DIR); +- closedir(DIR); +- $alias = "mykey"; +- $keystore="mykeystore"; +- $storepass="mcs123"; +- `keytool -genkey -alias $alias -keystore $keystore -keypass mcs123 -storepass $storepass`; +- $sign_jar_cmd_base = "jarsigner -keystore $keystore -storepass $storepass "; +- $sign_jar_cmd = $sign_jar_cmd_base."gui.jar ".$alias; +- `$sign_jar_cmd`; +- foreach (@entries) { +- if ($_ ne "." && $_ ne "..") { +- $entry = "lib/".$_; +- $sign_jar_cmd = $sign_jar_cmd_base.$entry." ".$alias; +- print $sign_jar_cmd; +- print "\n"; +- `$sign_jar_cmd`; +- +- } +- } +- +- close(OUTPUT_FILE); +- +- +-} +\ No newline at end of file +Index: modules/transfer-gui/tools/path.pl +=================================================================== +--- modules/transfer-gui/tools/path.pl (revision 3296) ++++ modules/transfer-gui/tools/path.pl (working copy) +@@ -1,20 +0,0 @@ +-#!/bin/perl +-if (opendir(DIR, "lib")) { +- +- $output_file=">tmp"; +- open(OUTPUT_FILE, $output_file); +- @entries = readdir(DIR); +- $scalar = @entries; +- print $scalar; +- closedir(DIR); +- foreach (@entries) { +- if ($_ ne "." && $_ ne "..") { +- $entry = ""; +- print OUTPUT_FILE $entry; +- print OUTPUT_FILE "\n"; +- } +- } +- close(OUTPUT_FILE); +- +- +-} +\ No newline at end of file +Index: modules/transfer-gui/project.properties +=================================================================== +--- modules/transfer-gui/project.properties (revision 3296) ++++ modules/transfer-gui/project.properties (working copy) +@@ -1,13 +0,0 @@ +-#=================================================================== +-# This code is developed as part of the Java CoG Kit project +-# The terms of the license can be found at http://www.cogkit.org/license +-# This message may not be removed or altered. +-#==================================================================== +-# +-module.name = transfer-gui +-long.name = File Transfer Graphical Interface +-version = 0.1 +-project = Java CoG Kit +-debug = true +-lib.deps = GlobusPortal*.jar, bcprov-jdk*.jar, cog-ogce*.jar, gridant*.jar, ant-contrib*.jar, appframework*.jar, axis*.jar, beansbinding*.jar, commons-cli*.jar, concurrent*.jar, globus*.jar, swing-layout*.jar, swing-worker*.jar +- +Index: modules/transfer-gui/log4j_gui_default.properties +=================================================================== +--- modules/transfer-gui/log4j_gui_default.properties (revision 3296) ++++ modules/transfer-gui/log4j_gui_default.properties (working copy) +@@ -1,22 +0,0 @@ +-# Set root category priority to WARN and its only appender to A1. +- +-log4j.rootCategory=ERROR, A1 +- +-# A1 is set to be a ConsoleAppender. +- +-log4j.appender.A1=org.apache.log4j.FileAppender +- +-# A1 uses PatternLayout. +-log4j.appender.A1.file=logoutput +-log4j.appender.A1.layout=org.apache.log4j.PatternLayout +-log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n +- +-# Display any warnings generated by our code +-log4j.category.org.globus=DEBUG +- +-# Enable SOAP Message Logging +-# log4j.category.org.globus.wsrf.handlers.MessageLoggingHandler=DEBUG +- +-# Comment out the line below if you want to log every authorization +-# decision the notification consumer makes. +-#log4j.category.org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain=WARN +Index: modules/transfer-gui/launchers.xml +=================================================================== +--- modules/transfer-gui/launchers.xml (revision 3296) ++++ modules/transfer-gui/launchers.xml (working copy) +@@ -1,30 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +Index: modules/transfer-gui/dependencies.xml +=================================================================== +--- modules/transfer-gui/dependencies.xml (revision 3296) ++++ modules/transfer-gui/dependencies.xml (working copy) +@@ -1,20 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +Index: modules/transfer-gui/lib/axis.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/gridant-old.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/globus_wsrf_rft_client.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/globus_delegation_stubs.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/globus_delegation_service.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/globus_wsrf_rft.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/GlobusPortal-0.0.1.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/wsrf_core_stubs.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/xercesImpl.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/commons-cli-2.0.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/beansbinding-1.2.1.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/bcprov-jdk15-139.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/ant-launcher.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/concurrent.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/cog-ogce.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/globus_delegation_client.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/globus_delegation_test.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/globus_wsrf_rft_stubs.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/gridsdk.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/gridant.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/ogsa.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/wsrf_core.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/appframework-1.0.3.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/swing-worker-1.1.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/xml4j.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/swing-layout-1.0.3.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/ant-contrib-1.0b3.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/lib/wsrf_tools.jar +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIView.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIView.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIView.java (working copy) +@@ -1,961 +0,0 @@ +-/* +- * GridFTPGUIView.java +- */ +- +-package org.globus.transfer.reliable.client; +- +-import org.jdesktop.application.Action; +-import org.jdesktop.application.ResourceMap; +-import org.jdesktop.application.SingleFrameApplication; +-import org.jdesktop.application.FrameView; +-import org.jdesktop.application.TaskMonitor; +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +-import java.io.BufferedInputStream; +-import java.io.BufferedReader; +-import java.io.File; +-import java.io.FileInputStream; +-import java.io.FileReader; +-import java.io.FileWriter; +-import java.io.IOException; +-import java.io.InputStream; +-import java.util.Properties; +- +-import javax.swing.Timer; +-import javax.swing.Icon; +-import javax.swing.JDialog; +-import javax.swing.JFileChooser; +-import javax.swing.JFrame; +-import javax.swing.JInternalFrame; +-import javax.swing.JOptionPane; +- +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.apache.log4j.PropertyConfigurator; +-import org.globus.common.CoGProperties; +-import org.globus.gsi.CertUtil; +-import org.globus.gsi.GlobusCredential; +-import org.globus.ogce.beans.filetransfer.FtpProperties; +-import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; +-import org.globus.ogce.beans.filetransfer.gui.remote.common.DisplayInterface; +-import org.globus.ogce.beans.filetransfer.gui.remote.ftp.FtpClient; +-import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.GridClient; +-import org.globus.ogce.util.StringUtil; +-import org.globus.tools.proxy.GridProxyInit; +-import org.globus.tools.ui.util.CustomFileFilter; +-import org.globus.tools.ui.util.UITools; +-import org.globus.transfer.reliable.client.credential.CredManager; +-import org.globus.transfer.reliable.client.credential.CredentialDialog; +-import org.globus.transfer.reliable.client.credential.ProxyInfo; +-import org.globus.transfer.reliable.client.credential.myproxy.MyProxyLogonGUI; +-import org.globus.transfer.reliable.client.utils.LogFileUtils; +-import org.globus.transfer.reliable.client.utils.UIConstants; +-import org.globus.transfer.reliable.client.utils.Utils; +-import org.globus.util.ConfigUtil; +-import org.globus.util.Util; +- +-/** +- * The application's main frame. +- */ +-public class GridFTPGUIView extends FrameView { +- private Log logger = LogFactory.getLog(GridFTPGUIView.class); +- +- public GridFTPGUIView(SingleFrameApplication app) { +- super(app); +- +- initComponents(); +- // +- //fileTransferMainPanel1.add(fileTransferMainPanel1.getDesktopPane()); +- //mainPanel.add(fileTransferMainPanel1.getDesktopPane()); +- //mainPanel.add(fileTransferPanel.getDesktopPane()); +- // status bar initialization - message timeout, idle icon and busy animation, etc +- ResourceMap resourceMap = getResourceMap(); +- int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout"); +- messageTimer = new Timer(messageTimeout, new ActionListener() { +- public void actionPerformed(ActionEvent e) { +- statusMessageLabel.setText(""); +- } +- }); +- messageTimer.setRepeats(false); +- int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate"); +- for (int i = 0; i < busyIcons.length; i++) { +- busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]"); +- } +- busyIconTimer = new Timer(busyAnimationRate, new ActionListener() { +- public void actionPerformed(ActionEvent e) { +- busyIconIndex = (busyIconIndex + 1) % busyIcons.length; +- statusAnimationLabel.setIcon(busyIcons[busyIconIndex]); +- } +- }); +- idleIcon = resourceMap.getIcon("StatusBar.idleIcon"); +- statusAnimationLabel.setIcon(idleIcon); +- progressBar.setVisible(false); +- +- // connecting action tasks to status bar via TaskMonitor +- TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext()); +- taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() { +- public void propertyChange(java.beans.PropertyChangeEvent evt) { +- String propertyName = evt.getPropertyName(); +- if ("started".equals(propertyName)) { +- if (!busyIconTimer.isRunning()) { +- statusAnimationLabel.setIcon(busyIcons[0]); +- busyIconIndex = 0; +- busyIconTimer.start(); +- } +- progressBar.setVisible(true); +- progressBar.setIndeterminate(true); +- } else if ("done".equals(propertyName)) { +- busyIconTimer.stop(); +- statusAnimationLabel.setIcon(idleIcon); +- progressBar.setVisible(false); +- progressBar.setValue(0); +- } else if ("message".equals(propertyName)) { +- String text = (String)(evt.getNewValue()); +- statusMessageLabel.setText((text == null) ? "" : text); +- messageTimer.restart(); +- } else if ("progress".equals(propertyName)) { +- int value = (Integer)(evt.getNewValue()); +- progressBar.setVisible(true); +- progressBar.setIndeterminate(false); +- progressBar.setValue(value); +- } +- } +- }); +- } +- +- @Action +- public void showAboutBox() { +- if (aboutBox == null) { +- JFrame mainFrame = GridFTPGUIApp.getApplication().getMainFrame(); +- aboutBox = new GridFTPGUIAboutBox(mainFrame); +- aboutBox.setLocationRelativeTo(mainFrame); +- } +- GridFTPGUIApp.getApplication().show(aboutBox); +- } +- +- /** This method is called from within the constructor to +- * initialize the form. +- * WARNING: Do NOT modify this code. The content of this method is +- * always regenerated by the Form Editor. +- */ +- // //GEN-BEGIN:initComponents +- private void initComponents() { +- +- mainPanel = new javax.swing.JPanel(); +- jToolBar1 = new javax.swing.JToolBar(); +- credential_button = new javax.swing.JButton(); +- jButton1 = new javax.swing.JButton(); +- gridftp_button = new javax.swing.JButton(); +- jButton4 = new javax.swing.JButton(); +- local_button = new javax.swing.JButton(); +- jButton5 = new javax.swing.JButton(); +- jButton7 = new javax.swing.JButton(); +- jButton8 = new javax.swing.JButton(); +- javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator(); +- jDesktopPane1 = fileTransferMainPanel1.getDesktopPane(); +- menuBar = new javax.swing.JMenuBar(); +- javax.swing.JMenu fileMenu = new javax.swing.JMenu(); +- jMenuItem6 = new javax.swing.JMenuItem(); +- jMenuItem7 = new javax.swing.JMenuItem(); +- javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); +- jMenu1 = new javax.swing.JMenu(); +- jMenuItem1 = new javax.swing.JMenuItem(); +- jMenuItem8 = new javax.swing.JMenuItem(); +- jMenuItem9 = new javax.swing.JMenuItem(); +- jMenuItem10 = new javax.swing.JMenuItem(); +- jMenuItem2 = new javax.swing.JMenuItem(); +- jMenu2 = new javax.swing.JMenu(); +- jMenu3 = new javax.swing.JMenu(); +- jMenuItem3 = new javax.swing.JMenuItem(); +- jMenuItem4 = new javax.swing.JMenuItem(); +- jMenuItem5 = new javax.swing.JMenuItem(); +- jMenuItem11 = new javax.swing.JMenuItem(); +- jMenuItem12 = new javax.swing.JMenuItem(); +- javax.swing.JMenu helpMenu = new javax.swing.JMenu(); +- javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); +- statusPanel = new javax.swing.JPanel(); +- statusMessageLabel = new javax.swing.JLabel(); +- statusAnimationLabel = new javax.swing.JLabel(); +- progressBar = new javax.swing.JProgressBar(); +- +- mainPanel.setName("mainPanel"); // NOI18N +- +- jToolBar1.setRollover(true); +- jToolBar1.setName("jToolBar1"); // NOI18N +- +- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(GridFTPGUIView.class); +- +- credential_button.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N +- credential_button.setText(resourceMap.getString("credential_button.text")); // NOI18N +- credential_button.setToolTipText(resourceMap.getString("credential_button.toolTipText")); // NOI18N +- credential_button.setFocusable(false); +- credential_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); +- credential_button.setName("credential_button"); // NOI18N +- credential_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); +- credential_button.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- credential_buttonActionPerformed(evt); +- } +- }); +- jToolBar1.add(credential_button); +- +- +- jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N +- jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N +- jButton1.setToolTipText(resourceMap.getString("jButton1.toolTipText")); // NOI18N +- jButton1.setFocusable(false); +- jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); +- jButton1.setName("jButton1"); // NOI18N +- jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); +- jButton1.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jButton1ActionPerformed(evt); +- } +- }); +- //jToolBar1.add(jButton1); +- +- gridftp_button.setIcon(resourceMap.getIcon("gridftp_button.icon")); // NOI18N +- gridftp_button.setText(resourceMap.getString("gridftp_button.text")); // NOI18N +- gridftp_button.setToolTipText(resourceMap.getString("gridftp_button.toolTipText")); // NOI18N +- gridftp_button.setFocusable(false); +- gridftp_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); +- gridftp_button.setName("gridftp_button"); // NOI18N +- gridftp_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); +- gridftp_button.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- gridftp_buttonActionPerformed(evt); +- } +- }); +- jToolBar1.add(gridftp_button); +- +- jButton4.setIcon(resourceMap.getIcon("jButton4.icon")); // NOI18N +- jButton4.setText(resourceMap.getString("jButton4.text")); // NOI18N +- jButton4.setFocusable(false); +- jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); +- jButton4.setName("jButton4"); // NOI18N +- jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); +- jButton4.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jButton4ActionPerformed(evt); +- } +- }); +- //jToolBar1.add(jButton4); +- +- local_button.setIcon(resourceMap.getIcon("local_button.icon")); // NOI18N +- local_button.setText(resourceMap.getString("local_button.text")); // NOI18N +- local_button.setFocusable(false); +- local_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); +- local_button.setName("local_button"); // NOI18N +- local_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); +- local_button.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- local_buttonActionPerformed(evt); +- } +- }); +- jToolBar1.add(local_button); +- +- jButton5.setIcon(resourceMap.getIcon("jButton5.icon")); // NOI18N +- jButton5.setText(resourceMap.getString("jButton5.text")); // NOI18N +- jButton5.setFocusable(false); +- jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); +- jButton5.setName("jButton5"); // NOI18N +- jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); +- jButton5.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jButton5ActionPerformed(evt); +- } +- }); +- jToolBar1.add(jButton5); +- +- jButton7.setIcon(resourceMap.getIcon("jButton7.icon")); // NOI18N +- jButton7.setText("MyProxy"); // NOI18N +- jButton7.setFocusable(false); +- jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); +- jButton7.setName("jButton7"); // NOI18N +- jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); +- jButton7.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jButton7ActionPerformed(evt); +- } +- }); +- //jToolBar1.add(jButton7); +- +- jButton8.setIcon(resourceMap.getIcon("jButton8.icon")); // NOI18N +- jButton8.setText(resourceMap.getString("jButton8.text")); // NOI18N +- jButton8.setFocusable(false); +- jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); +- jButton8.setName("jButton8"); // NOI18N +- jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); +- jButton8.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jButton8ActionPerformed(evt); +- } +- }); +- //jToolBar1.add(jButton8); +- +- statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N +- +- jDesktopPane1.setBackground(resourceMap.getColor("jDesktopPane1.background")); // NOI18N +- jDesktopPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); +- jDesktopPane1.setName("jDesktopPane1"); // NOI18N +- +- org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel); +- mainPanel.setLayout(mainPanelLayout); +- mainPanelLayout.setHorizontalGroup( +- mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() +- .addContainerGap() +- .add(statusPanelSeparator, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 834, Short.MAX_VALUE)) +- .add(jToolBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 846, Short.MAX_VALUE) +- .add(jDesktopPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 846, Short.MAX_VALUE) +- ); +- mainPanelLayout.setVerticalGroup( +- mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() +- .add(jToolBar1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) +- .add(jDesktopPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 563, Short.MAX_VALUE) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(statusPanelSeparator, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) +- .addContainerGap()) +- ); +- +- menuBar.setName("menuBar"); // NOI18N +- +- fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N +- fileMenu.setName("fileMenu"); // NOI18N +- +- jMenuItem6.setText(resourceMap.getString("jMenuItem6.text")); // NOI18N +- jMenuItem6.setName("jMenuItem6"); // NOI18N +- jMenuItem6.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem6ActionPerformed(evt); +- } +- }); +- fileMenu.add(jMenuItem6); +- +- jMenuItem7.setText(resourceMap.getString("jMenuItem7.text")); // NOI18N +- jMenuItem7.setName("jMenuItem7"); // NOI18N +- jMenuItem7.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem7ActionPerformed(evt); +- } +- }); +- fileMenu.add(jMenuItem7); +- +- javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getActionMap(GridFTPGUIView.class, this); +- exitMenuItem.setAction(actionMap.get("quit")); // NOI18N +- exitMenuItem.setName("exitMenuItem"); // NOI18N +- fileMenu.add(exitMenuItem); +- +- menuBar.add(fileMenu); +- +- jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N +- jMenu1.setName("jMenu1"); // NOI18N +- jMenu1.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenu1ActionPerformed(evt); +- } +- }); +- +- jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N +- jMenuItem1.setName("jMenuItem1"); // NOI18N +- jMenuItem1.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem1ActionPerformed(evt); +- } +- }); +- jMenu1.add(jMenuItem1); +- +- jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N +- jMenuItem2.setName("jMenuItem2"); // NOI18N +- jMenuItem2.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem2ActionPerformed(evt); +- } +- }); +- jMenu1.add(jMenuItem2); +- +- menuBar.add(jMenu1); +- +- jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N +- jMenu2.setName("jMenu2"); // NOI18N +- jMenu2.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenu2ActionPerformed(evt); +- } +- }); +- +- jMenuItem3.setText(resourceMap.getString("jMenuItem3.text")); // NOI18N +- jMenuItem3.setName("jMenuItem3"); // NOI18N +- jMenuItem3.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem3ActionPerformed(evt); +- } +- }); +- jMenu2.add(jMenuItem3); +- +- jMenuItem4.setText(resourceMap.getString("jMenuItem4.text")); // NOI18N +- jMenuItem4.setName("jMenuItem4"); // NOI18N +- jMenuItem4.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem4ActionPerformed(evt); +- } +- }); +- jMenu2.add(jMenuItem4); +- +- jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N +- jMenuItem5.setName("jMenuItem5"); // NOI18N +- jMenuItem5.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem5ActionPerformed(evt); +- } +- }); +- jMenu2.add(jMenuItem5); +- +- menuBar.add(jMenu2); +- +- jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N +- jMenu3.setName("jMenu3"); // NOI18N +- jMenu3.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenu3ActionPerformed(evt); +- } +- }); +- +- jMenuItem11.setText(resourceMap.getString("jMenuItem11.text")); // NOI18N +- jMenuItem11.setName("jMenuItem11"); // NOI18N +- jMenuItem11.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem11ActionPerformed(evt); +- } +- }); +- jMenu3.add(jMenuItem11); +- +- jMenuItem12.setText(resourceMap.getString("jMenuItem12.text")); // NOI18N +- jMenuItem12.setName("jMenuItem12"); // NOI18N +- jMenuItem12.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- jMenuItem12ActionPerformed(evt); +- } +- }); +- jMenu3.add(jMenuItem12); +- menuBar.add(jMenu3); +- helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N +- helpMenu.setName("helpMenu"); // NOI18N +- +- aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N +- aboutMenuItem.setName("aboutMenuItem"); // NOI18N +- helpMenu.add(aboutMenuItem); +- +- menuBar.add(helpMenu); +- +- statusPanel.setName("statusPanel"); // NOI18N +- +- statusMessageLabel.setName("statusMessageLabel"); // NOI18N +- +- statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); +- statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N +- +- progressBar.setName("progressBar"); // NOI18N +- org.jdesktop.layout.GroupLayout statusPanelLayout = new org.jdesktop.layout.GroupLayout(statusPanel); +- statusPanel.setLayout(statusPanelLayout); +- final javax.swing.JLabel proxyInfoLabel = new javax.swing.JLabel(); +- //proxyInfoLabel.setSize(3000, 20); +- +- Thread t = new Thread() { +- public void run() { +- while (true) { +- StringBuffer buf = new StringBuffer(); +- try { +- ProxyInfo info = CredManager.getProxyInfo(); +- buf.append("") +- .append("Proxy Subject: ").append(info.getSubject()) +- .append("
") +- .append("Time Left: ").append(info.getTimeLeft()) +- .append(""); +- } catch (Exception e) { +- buf.append("") +- .append("Proxy Subject: ").append(e.getMessage()) +- .append("
") +- .append("Time Left: ").append(0) +- .append(""); +- } +- +- proxyInfoLabel.setText(buf.toString()); +- try { +- Thread.sleep(60000); +- } catch (InterruptedException e) { +- } +- } +- +- } +- }; +- t.start(); +- statusPanelLayout.setHorizontalGroup( +- statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(statusPanelLayout.createSequentialGroup() +- .addContainerGap() +- .add(proxyInfoLabel) +- //.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 662, Short.MAX_VALUE) +-// .add(progressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) +-// .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +-// .add(statusAnimationLabel) +- //.addContainerGap() +- ) +- ); +- statusPanelLayout.setVerticalGroup( +- statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(org.jdesktop.layout.GroupLayout.TRAILING, statusPanelLayout.createSequentialGroup() +- .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +- .add(statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(proxyInfoLabel) +-// .add(statusAnimationLabel) +-// .add(progressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) +- ) +- .add(3, 3, 3)) +- ); +- +- setComponent(mainPanel); +- setMenuBar(menuBar); +- setStatusBar(statusPanel); +- }//
//GEN-END:initComponents +- +- protected void credential_buttonActionPerformed(ActionEvent evt) { +- CredentialDialog d = new CredentialDialog(null, false); +- d.setLocation(100, 100); +- d.setVisible(true); +- +- } +- +- private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed +- localFrameHandle(); +- }//GEN-LAST:event_jMenuItem2ActionPerformed +- +- private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed +- +- }//GEN-LAST:event_jMenu1ActionPerformed +- +- private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed +- +- }//GEN-LAST:event_jMenu2ActionPerformed +- +- private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed +- +- }//GEN-LAST:event_jMenu2ActionPerformed +- +- private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed +- createProxy(); +- }//GEN-LAST:event_jMenuItem3ActionPerformed +- +- private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed +- CoGProperties props = CoGProperties.getDefault(); +- +- String proxyFileName = props.getProxyFile(); +- if (proxyFileName.length() > 0) { +- +- File proxyFile = new File(proxyFileName); +- if (!proxyFile.exists()) { +- JOptionPane.showMessageDialog( +- mainPanel, +- "Your Grid proxy certificate is already destroyed.", +- "Security Message", +- JOptionPane.WARNING_MESSAGE); +- return; +- } +- +- Util.destroy(proxyFile); +- JOptionPane.showMessageDialog( +- mainPanel, +- "Your Grid proxy certificate has been destroyed.", +- "Security Message", +- JOptionPane.INFORMATION_MESSAGE); +- +- } else +- JOptionPane.showMessageDialog( +- mainPanel, +- "Your Grid proxy certificate is not read or is destroyed", +- "Security Message", +- JOptionPane.INFORMATION_MESSAGE); +- }//GEN-LAST:event_jMenuItem4ActionPerformed +- +- private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed +- showProxyInfo(); +- }//GEN-LAST:event_jMenuItem5ActionPerformed +- +- private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed +- fileTransferMainPanel1.createRemoteFrame(1, null, 2811); +- }//GEN-LAST:event_jMenuItem1ActionPerformed +- +- private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed +- loadFile(); +- }//GEN-LAST:event_jMenuItem6ActionPerformed +- +- private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed +- saveFile(); +- }//GEN-LAST:event_jMenuItem7ActionPerformed +- +- private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed +- File logConfigFile = new File(UIConstants.LOG_CONFIG); +- String logLocation = null; +- if (!logConfigFile.exists()) { +- String dir; +- try { +- dir = new File(".").getCanonicalPath(); +- logLocation = dir + File.separator + "logoutput"; +- } catch (IOException e) { +- +- } +- +- } else { +- InputStream is = null; +- try { +- is = new BufferedInputStream(new FileInputStream(logConfigFile)); +- Properties prop = new Properties(); +- prop.load(is); +- logLocation = prop.getProperty("log4j.appender.A1.file"); +- } catch (Exception e) { +- logLocation="can not get log file location"; +- } finally { +- try { +- is.close(); +- } catch (IOException e) { +- +- } +- } +- } +- +- JOptionPane.showMessageDialog(null, logLocation, "Log Location", JOptionPane.INFORMATION_MESSAGE); +- }//GEN-LAST:event_jMenuItem7ActionPerformed +- +- private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed +- JFileChooser chooser = new JFileChooser(); +- chooser.setDialogTitle("Choose Log File"); +- int flag = chooser.showSaveDialog(null); +- if (flag == JFileChooser.APPROVE_OPTION) { +- File f = chooser.getSelectedFile(); +- try { +- logFileName = f.getCanonicalPath(); +- File logConfigFile = new File(UIConstants.LOG_CONFIG); +- if (!logConfigFile.exists() || !logConfigFile.isFile()) { +- LogFileUtils.createNewLogConfigFile(logFileName); +- } else { +- LogFileUtils.updateLogConfigFile(logFileName); +- } +- PropertyConfigurator.configure(UIConstants.LOG_CONFIG); +- } catch (IOException e) { +- logFileName = "error_log"; +- } +- } +- }//GEN-LAST:event_jMenuItem7ActionPerformed +- +- private void localFrameHandle() { +- boolean isRFTEnabled; +- try { +- isRFTEnabled = (new Boolean((String)Utils.getProperty("rft_enabled", "rft.properties"))).booleanValue(); +- } catch (Exception e) { +- isRFTEnabled = false; +- } +- if (isRFTEnabled) { +- JOptionPane.showMessageDialog(null, "RFT is enabled, you can not use local dialog", +- "Message", JOptionPane.ERROR_MESSAGE); +- } else { +- fileTransferMainPanel1.createNewLocalFrame(); +- } +- } +- private void local_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed +- localFrameHandle(); +- +- }//GEN-LAST:event_jButton3ActionPerformed +- +- private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed +- jMenuItem10ActionPerformed(evt); +- }//GEN-LAST:event_jButton3ActionPerformed +- +- private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed +- MyProxyLogonGUI.main(null); +- }//GEN-LAST:event_jButton3ActionPerformed +- +- private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed +- JFileChooser chooser = new JFileChooser(); +- chooser.setDialogTitle("Choose Log File"); +- int flag = chooser.showSaveDialog(null); +- if (flag == JFileChooser.APPROVE_OPTION) { +- File f = chooser.getSelectedFile(); +- try { +- logFileName = f.getCanonicalPath(); +- File logConfigFile = new File(UIConstants.LOG_CONFIG); +- if (!logConfigFile.exists() || !logConfigFile.isFile()) { +- LogFileUtils.createNewLogConfigFile(logFileName); +- } else { +- LogFileUtils.updateLogConfigFile(logFileName); +- } +- } catch (IOException e) { +- logFileName = "error_log"; +- } +- } +- +- }//GEN-LAST:event_jButton3ActionPerformed +- +- private void gridftp_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed +- fileTransferMainPanel1.createRemoteFrame(1, null, 2811); +- }//GEN-LAST:event_jButton2ActionPerformed +- +- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed +- createProxy(); +- }//GEN-LAST:event_jButton1ActionPerformed +- +- private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed +- fileTransferMainPanel1.createRemoteFrame(3, null, 21); +- }//GEN-LAST:event_jMenuItem8ActionPerformed +- +- private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed +- JOptionPane.showMessageDialog(mainPanel, "Not yet implemented"); +- fileTransferMainPanel1.createRemoteFrame(2, null, 0); +- }//GEN-LAST:event_jMenuItem9ActionPerformed +- +- private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed +- JFrame frame = new JFrame("Advanced Options"); +- RFTPanel rftPanel = new RFTPanel(); +- rftPanel.setFrame(frame); +- frame.getContentPane().add(rftPanel); +- frame.setSize(500, 500); +- frame.setLocation(100, 100); +- //frame.pack(); +- frame.setVisible(true); +- }//GEN-LAST:event_jMenuItem9ActionPerformed +- +- private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed +- fileTransferMainPanel1.createRemoteFrame(3, null, 21); +- }//GEN-LAST:event_jButton4ActionPerformed +- +- private void createProxy() { +- GridProxyInit proxyInitFrame = new GridProxyInit(null, true); +- proxyInitFrame.setRunAsApplication(false); +- proxyInitFrame.setCloseOnSuccess(true); +- proxyInitFrame.pack(); +- UITools.center(mainPanel, proxyInitFrame); +- proxyInitFrame.setVisible(true); +- } +- +- +- +- private void showProxyInfo() { +- ProxyInfo proxyInfo = null; +- +- try { +- proxyInfo = CredManager.getProxyInfo(); +- } catch (Exception e) { +- JOptionPane.showMessageDialog( +- mainPanel, +- "Unable to load Grid proxy certificate.\nError: " +- + e.getMessage(), +- "Security Message", +- JOptionPane.WARNING_MESSAGE); +- } +- +- JOptionPane.showMessageDialog(mainPanel, proxyInfo, +- "Grid Proxy Certificate Information",JOptionPane.INFORMATION_MESSAGE); +- } +- +- public void saveFile() { +- //Determine the name of the file to save to +- JFileChooser fileChooser = new JFileChooser(ConfigUtil.globus_dir); +- fileChooser.setFileFilter(new CustomFileFilter(".ftp", +- "GridFTP sites list file (*.ftp)")); +- int popdownState = fileChooser.showSaveDialog(mainPanel); +- if (popdownState == JFileChooser.CANCEL_OPTION) { +- return; +- } +- File saveFile = fileChooser.getSelectedFile(); +- String fileName = saveFile.getAbsolutePath(); +- if (!fileName.endsWith(".ftp")) { +- fileName = fileName + ".ftp"; +- saveFile = new File(fileName); +- } +- +- //writing the default job file name into ftp.properties +- FtpProperties props = null; +- try { +- props = new FtpProperties(FtpProperties.configFile); +- props.setFtpFile(saveFile.getAbsolutePath()); +- logger.info("\nThe ftp file default location saved=" +- + props.getFtpFile()); +- props.save(FtpProperties.configFile); +- +- } catch (Exception e) { +- logger.debug("The system could not open the specified file\n"); +- } +- +- //Saving the names of the gatekeeper into a file. +- FileWriter fileout = null; +- try { +- fileout = new FileWriter(saveFile.getAbsolutePath()); +- fileout.write(getAllOpenSites()); +- fileout.close(); +- } catch (Exception e) { +- logger.info("IOException occured when creating" +- + " output stream :" + e.getMessage()); +- } finally { +- if (fileout != null) { +- try { +- fileout.close(); +- } catch (Exception e) { +- e.printStackTrace(); +- } +- } +- } +- } +- +- public String getAllOpenSites() { +- String s = new String(""); +- DisplayInterface gc = null; +- for (int i = 0; i < remCounter; i++) { +- +- try { +- gc = (GridClient) frame2[i]; +- s += "gridftp:" + gc.getHost() + ":" + gc.getPort() + "\n"; +- } catch (Exception e) { +- logger.debug("The file does not save the ftp sites " +- + "needs to handle user and password."); +- FtpClient fc = (FtpClient) frame2[i]; +- s += "ftp:" + fc.getHost() + ":" + fc.getPort() + ":" + fc.getUser() + +- ":" + fc.getPwd() + "\n"; +- } +- +- } +- return s; +- } +- +- public void loadFile() { +- +- JFileChooser filechooser = new JFileChooser(ConfigUtil.globus_dir); +- // filechooser.setCurrentDirectory( new File(".") ); +- filechooser.setFileFilter(new CustomFileFilter(".ftp", +- "Ftp file (*.ftp)")); +- filechooser.setApproveButtonText("Load"); +- filechooser.setDialogTitle("Load Ftp File"); +- +- if (filechooser.showOpenDialog(mainPanel) != JFileChooser.APPROVE_OPTION) { +- return; +- } +- File file = filechooser.getSelectedFile(); +- loadFile(file.getAbsolutePath()); +- +- } +- +- public void loadFile(String filename) { +- try { +- readFile(filename); +- +- } catch (IOException e) { +- String msg = "Failed to load gatekeeper file:\n " + e.getMessage(); +- JOptionPane.showMessageDialog(mainPanel, +- msg, +- "Error Loading Ftp File", +- JOptionPane.ERROR_MESSAGE); +- } +- +- } +- +- public void readFile(String filename) throws IOException { +- BufferedReader in = null; +- try { +- in = new BufferedReader(new FileReader(filename)); +- String machine; +- while ((machine = in.readLine()) != null) { +- machine = machine.trim(); +- if (machine.equals("") || machine.startsWith("#")) { +- logger.info("Machine name commented."); +- } else { +- StringUtil splitString = new StringUtil(machine); +- String[] tokens = splitString.split(":"); +- int noTokens = tokens.length; +- for (int i = 0; i < noTokens; i++) { +- // tokens[i] = tokens[i].trim(); +- } +- int port1 = Integer.parseInt(tokens[2]); +- //Protocol:host:port:user:passwd +- if (tokens[0].equals("gridftp")) { +- fileTransferMainPanel1.createRemoteFrame(1, tokens[1], port1); +- System.out.println("\nMachine line =" + machine); +- } else if (noTokens > 3) { +- logger.info("\nMachine line =" + +- machine.substring(0, +- machine.lastIndexOf(":"))); +- +- fileTransferMainPanel1.createRemoteFrame(3, tokens[1], port1, tokens[3] +- , tokens[4]); +- } else { +- fileTransferMainPanel1.createRemoteFrame(3, tokens[1], port1); +- } +- } +- } +- } finally { +- if (in != null) { +- try { +- in.close(); +- } catch (Exception e) { +- e.printStackTrace(); +- } +- } +- } +- +- } +- +- public static String getErrorLogFileName() { +- return logFileName; +- } +- +- protected JInternalFrame messageFrame; +- +- //Counters are used to allow the users to add any no of local or remote +- //file browser beans. +- protected int remCounter = 0; +- protected DisplayInterface frame2[]; +- private FileTransferMainPanel fileTransferMainPanel1 = new FileTransferMainPanel(); +- // Variables declaration - do not modify//GEN-BEGIN:variables +- private javax.swing.JButton jButton1; +- private javax.swing.JButton gridftp_button; +- private javax.swing.JButton local_button; +- private javax.swing.JButton jButton4; +- private javax.swing.JButton jButton5; +- private javax.swing.JButton jButton6; +- private javax.swing.JButton jButton7; +- private javax.swing.JButton jButton8; +- private javax.swing.JButton credential_button; +- private javax.swing.JDesktopPane jDesktopPane1; +- private javax.swing.JMenu jMenu1; +- private javax.swing.JMenu jMenu2; +- private javax.swing.JMenu jMenu3; +- private javax.swing.JMenuItem jMenuItem1; +- private javax.swing.JMenuItem jMenuItem2; +- private javax.swing.JMenuItem jMenuItem3; +- private javax.swing.JMenuItem jMenuItem4; +- private javax.swing.JMenuItem jMenuItem5; +- private javax.swing.JMenuItem jMenuItem6; +- private javax.swing.JMenuItem jMenuItem7; +- private javax.swing.JMenuItem jMenuItem8; +- private javax.swing.JMenuItem jMenuItem9; +- private javax.swing.JMenuItem jMenuItem10; +- private javax.swing.JMenuItem jMenuItem11; +- private javax.swing.JMenuItem jMenuItem12; +- private javax.swing.JToolBar jToolBar1; +- private javax.swing.JPanel mainPanel; +- private javax.swing.JMenuBar menuBar; +- private javax.swing.JProgressBar progressBar; +- private javax.swing.JLabel statusAnimationLabel; +- private javax.swing.JLabel statusMessageLabel; +- private javax.swing.JPanel statusPanel; +- // End of variables declaration//GEN-END:variables +- +- private final Timer messageTimer; +- private final Timer busyIconTimer; +- private final Icon idleIcon; +- private final Icon[] busyIcons = new Icon[15]; +- private int busyIconIndex = 0; +- +- private JDialog aboutBox; +- +- private static String logFileName = "error_log"; +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileDeleteClient.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileDeleteClient.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileDeleteClient.java (working copy) +@@ -1,201 +0,0 @@ +-/* +- * Portions of this file Copyright 1999-2005 University of Chicago +- * Portions of this file Copyright 1999-2005 The University of Southern California. +- * +- * This file or a portion of this file is licensed under the +- * terms of the Globus Toolkit Public License, found at +- * http://www.globus.org/toolkit/download/license.html. +- * If you redistribute this file, with or without +- * modifications, you must include this notice in the file. +- */ +- +-package org.globus.transfer.reliable.client; +- +-import java.io.BufferedReader; +-import java.io.File; +-import java.io.FileReader; +-import java.io.FileWriter; +-import java.util.Calendar; +-import java.util.Vector; +- +-import javax.xml.namespace.QName; +-import javax.xml.rpc.Stub; +-import org.apache.axis.message.addressing.Address; +-import org.apache.axis.message.addressing.EndpointReferenceType; +-import org.globus.rft.generated.DeleteOptionsType; +-import org.globus.rft.generated.DeleteRequestType; +-import org.globus.rft.generated.DeleteType; +-import org.globus.rft.generated.ReliableFileTransferPortType; +-import org.globus.rft.generated.StartOutputType; +-import org.globus.rft.generated.Start; +-import org.oasis.wsrf.lifetime.SetTerminationTime; +-import org.oasis.wsrf.lifetime.SetTerminationTimeResponse; +- +-import org.globus.wsrf.encoding.ObjectSerializer; +-import org.globus.wsrf.impl.security.authentication.Constants; +-/** +- */ +-public class ReliableFileDeleteClient extends BaseRFTClient { +- +- public static String optionString = +- "rft-delete [options] -f \n" +- + "Where options can be:\n" +- + "-h Defaults to 'localhost'.\n" +- + "-r Defaults to TCP port 8443.\n" +- + "-l lifetime of the created resource in minutes Defaults to 60 mins.\n" +- + "-m security mechanism Allowed values: 'msg' for secure messages, 'conv' for\n" +- + " secure conversation and 'trans' for secure transport. Defaults to \n" +- + " 'trans'.\n" +- + " -p protection type Allowed values: 'sig' for signature and 'enc' for encryption.\n" +- + " Defaults to 'sig'.\n" +- + " -z authorization Defaults to 'host' authorization. Allowed values: 'self' for\n" +- + " self authorization and 'host' for host authorization.\n" +- + " -file file to write EPR of created Reliable" +- + " File Transfer Resource\n"; +- +- public static DeleteRequestType +- getDeleteRequest(String path, EndpointReferenceType epr) { +- DeleteRequestType deleteRequest = new DeleteRequestType(); +- File requestFile = new File(path); +- BufferedReader reader = null; +- +- try { +- reader = new BufferedReader(new FileReader(requestFile)); +- } catch (java.io.FileNotFoundException fnfe) { +- System.err.println(fnfe); +- System.exit(-1); +- } +- +- Vector requestData = new Vector(); +- +- try { +- +- String line = reader.readLine(); +- while (line != null) { +- if (!line.startsWith("#")) { +- requestData.add(line); +- } +- line = reader.readLine(); +- +- } +- +- reader.close(); +- } catch (java.io.IOException ioe) { +- System.err.println("IOException:" + ioe.getMessage()); +- System.exit(-1); +- } +- DeleteType deleteArray[] = new DeleteType[requestData.size() - 1]; +- String subjectName = (String) requestData.elementAt(0); +- for (int i = 0; i < deleteArray.length; i++) { +- deleteArray[i] = new DeleteType(); +- deleteArray[i].setFile((String) requestData.elementAt(i + 1)); +- } +- transferCount = (requestData.size() - 1) / 2; +- if (transferCount <=0 ) { +- System.err.println("Invalid transfer file format"); +- System.exit(-1); +- } +- DeleteOptionsType deleteOptions = new DeleteOptionsType(); +- deleteOptions.setSubjectName(subjectName); +- deleteRequest.setDeleteOptions(deleteOptions); +- deleteRequest.setDeletion(deleteArray); +- deleteRequest.setTransferCredentialEndpoint(epr); +- deleteRequest.setConcurrency(new Integer(1)); +- deleteRequest.setMaxAttempts(new Integer(10)); +- return deleteRequest; +- } +- +- /** +- * @param args +- * @throws Exception +- */ +- public static void main(String[] args) throws Exception { +- DeleteRequestType deleteRequestType = null; +- if (args.length < 1) { +- printUsage(); +- System.exit(-1); +- } +- cmd = args; +- parseArgs(); +- +- if (PORT == null) { +- if (authType.equals(Constants.GSI_TRANSPORT)) { +- PORT = "8443"; +- } else { +- PORT ="8080"; +- } +- } +- if (authType.equals(Constants.GSI_TRANSPORT)) { +- PROTOCOL = "https"; +- } +- String rftFactoryAddress = +- PROTOCOL + "://"+ HOST+ ":" + PORT + SERVICE_URL_ROOT +- + "ReliableFileTransferFactoryService"; +- String rftServiceAddress = PROTOCOL+ "://" + HOST + ":" + PORT + +- SERVICE_URL_ROOT + "ReliableFileTransferService"; +- +- System.out.println("creating a rft resource"); +- // do delegation +- EndpointReferenceType credEPR = delegateCredential(HOST, PORT); +- +- deleteRequestType = getDeleteRequest(PATH_TO_FILE, credEPR); +- +- EndpointReferenceType rftepr = createRFT(rftFactoryAddress, +- deleteRequestType); +- +- if (outFileName != null) { +- FileWriter writer = null; +- try { +- writer = new FileWriter(outFileName); +- QName qName = new QName("", "RFT_EPR"); +- writer.write(ObjectSerializer.toString(rftepr, +- qName)); +- } finally { +- if (writer != null) { +- writer.close(); +- } +- } +- } +- +- rftepr.setAddress(new Address(rftServiceAddress)); +- ReliableFileTransferPortType rft = rftLocator +- .getReliableFileTransferPortTypePort(rftepr); +- //For secure notifications +- setSecurity((Stub)rft); +- subscribe(rft); +- System.out.println("Subscribed for overall status"); +- //End subscription code +- Calendar termTime = Calendar.getInstance(); +- termTime.add(Calendar.MINUTE, TERM_TIME); +- SetTerminationTime reqTermTime = new SetTerminationTime(); +- reqTermTime.setRequestedTerminationTime(termTime); +- System.out.println("Termination time to set: " + TERM_TIME +- + " minutes"); +- SetTerminationTimeResponse termRes = rft +- .setTerminationTime(reqTermTime); +- StartOutputType startresp = rft.start(new Start()); +- while (finished < transferCount && transferCount !=0) { +- if (failed == transferCount || +- (failed + finished == transferCount) +- || finished == transferCount) { +- break; +- } else { +- Thread.sleep(1000); +- } +- } +- if ((finished == transferCount) && (finished != 0)) { +- System.out.println( "All Transfers are completed"); +- System.exit(0); +- } +- if ((failed == transferCount) && (failed != 0)) { +- System.out.println( "All Transfers failed !"); +- System.exit(-1); +- } +- if ((failed + finished) == transferCount) { +- System.out.println( "Transfers Done"); +- System.exit(-1); +- } +- +- +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParamPanel.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParamPanel.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParamPanel.java (working copy) +@@ -1,370 +0,0 @@ +-/* +- * RFTTransferParam.java +- * +- * +- */ +- +-package org.globus.transfer.reliable.client; +- +-import java.io.File; +-import java.io.FileInputStream; +-import java.util.HashMap; +-import java.util.Map; +-import java.util.Properties; +- +-import javax.swing.JFileChooser; +-import javax.swing.JOptionPane; +-import javax.swing.filechooser.FileFilter; +- +-import org.globus.wsrf.impl.security.authorization.HostAuthorization; +-import org.globus.wsrf.impl.security.authorization.SelfAuthorization; +-import org.globus.wsrf.security.Constants; +- +-/** +- * +- * @author vic +- */ +-public class RFTTransferParamPanel extends javax.swing.JPanel { +- private Map authTypeMap = new HashMap(); +- private Map authzTypeMap = new HashMap(); +- /** Creates new form RFTTransferParam */ +- public RFTTransferParamPanel() { +- authTypeMap.put("GSI_TRANSPORT", Constants.GSI_TRANSPORT); +- authTypeMap.put("GSI_SEC_CONV", Constants.GSI_SEC_CONV); +- authTypeMap.put("GSI_SEC_MSG", Constants.GSI_SEC_MSG); +- +- authzTypeMap.put("HOST", HostAuthorization.getInstance()); +- authzTypeMap.put("SELF", SelfAuthorization.getInstance()); +- initComponents(); +- } +- +- public String getFrom() { +- return fromField.getText(); +- } +- +- public String getServerHost() { +- return serverHostField.getText(); +- } +- +- public String getServerPort() { +- return serverPortField.getText(); +- } +- +- public String getTo() { +- return toField.getText(); +- } +- +- public void setServerHost(String t) { +- serverHostField.setText(t); +- } +- +- public void setServerPort(String t) { +- serverPortField.setText(t); +- } +- +- public int getConcurrent() { +- String value = concurrencyField.getText(); +- int con = 1; +- if (null != value) { +- try { +- con = Integer.valueOf(value); +- } catch (NumberFormatException e) { +- con = 1; +- } +- } +- +- return con; +- } +- +- public void setConcurrent(String c) { +- concurrencyField.setText(c); +- } +- +- /** This method is called from within the constructor to +- * initialize the form. +- * WARNING: Do NOT modify this code. The content of this method is +- * always regenerated by the Form Editor. +- */ +- // //GEN-BEGIN:initComponents +- private void initComponents() { +- +- jScrollPane1 = new javax.swing.JScrollPane(); +- jList1 = new javax.swing.JList(); +- jLabel1 = new javax.swing.JLabel(); +- serverHostField = new javax.swing.JTextField(); +- jLabel2 = new javax.swing.JLabel(); +- serverPortField = new javax.swing.JTextField(); +- jLabel3 = new javax.swing.JLabel(); +- fromField = new javax.swing.JTextField(); +- jLabel4 = new javax.swing.JLabel(); +- toField = new javax.swing.JTextField(); +- concurrencyLabel = new javax.swing.JLabel(); +- concurrencyField = new javax.swing.JTextField(); +- rftHelpButton = new javax.swing.JButton("RFT?"); +- +- jScrollPane1.setName("jScrollPane1"); // NOI18N +- +- jList1.setModel(new javax.swing.AbstractListModel() { +- String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; +- public int getSize() { return strings.length; } +- public Object getElementAt(int i) { return strings[i]; } +- }); +- jList1.setName("jList1"); // NOI18N +- jScrollPane1.setViewportView(jList1); +- +- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(RFTTransferParamPanel.class); +- setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("Form.border.title"))); // NOI18N +- setName("Form"); // NOI18N +- +- jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N +- jLabel1.setName("jLabel1"); // NOI18N +- +- concurrencyLabel.setText(resourceMap.getString("concurrencyLabel.text")); +- concurrencyLabel.setName("concurrencyLabel"); +- +- concurrencyField.setText(resourceMap.getString("concurrencyField.text")); // NOI18N +- concurrencyField.setName("concurrencyField"); // NOI18N +- +- serverHostField.setText(resourceMap.getString("serverHostField.text")); // NOI18N +- serverHostField.setName("serverHostField"); // NOI18N +- +- jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N +- jLabel2.setName("jLabel2"); // NOI18N +- +- serverPortField.setText(resourceMap.getString("serverPortField.text")); // NOI18N +- serverPortField.setName("serverPortField"); // NOI18N +- +- +- +- jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N +- jLabel3.setName("jLabel3"); // NOI18N +- +- fromField.setText(resourceMap.getString("fromField.text")); // NOI18N +- fromField.setName("fromField"); // NOI18N +- +- jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N +- jLabel4.setName("jLabel4"); // NOI18N +- +- toField.setText(resourceMap.getString("toField.text")); // NOI18N +- toField.setName("toField"); // NOI18N +- +- enable_rft = new javax.swing.JLabel(); +- enable_rft.setText("Enable RFT"); +- enable_rft_checkbox = new javax.swing.JCheckBox(); +- enable_rft_checkbox.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- enable_rft_checkboxActionPerformed(evt); +- } +- }); +- +- rftHelpButton.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- rftHelpButtonActionPerformed(evt); +- } +- }); +- Properties prop = new Properties(); +- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; +- File dir = new File(globusDir, "GridFTP_GUI"); +- File propFile = new File(dir, "rft.properties"); +- +- if (propFile.exists()) { +- try { +- prop.load(new FileInputStream(propFile)); +- setEnableRFT((new Boolean((String)prop.get("rft_enabled"))).booleanValue()); +- setServerHost((String)prop.getProperty("host")); +- setServerPort((String)prop.getProperty("port")); +- setConcurrent((String)prop.getProperty("concurrent")); +- } catch (Exception e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } +- } +- +- if (enable_rft_checkbox.isSelected()) { +- System.out.println("checkbox selected"); +- jLabel1.setEnabled(true); +- serverHostField.setEditable(true); +- jLabel2.setEnabled(true); +- serverPortField.setEditable(true); +- concurrencyLabel.setEnabled(true); +- concurrencyField.setEditable(true); +- } else { +- jLabel1.setEnabled(false); +- serverHostField.setEditable(false); +- jLabel2.setEnabled(false); +- serverPortField.setEditable(false); +- concurrencyLabel.setEnabled(false); +- concurrencyField.setEditable(false); +- } +- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); +- this.setLayout(layout); +- +- layout.setHorizontalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .addContainerGap() +- .add(64, 64, 64) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(enable_rft) +- .add(jLabel1) +- .add(jLabel2) +- .add(concurrencyLabel) +- ) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(rftHelpButton) +- .add(50, 50, 50) +- .add(50, 50, 50) +- .add(50, 50, 50) +- .add(50, 50, 50) +- ) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) +- .add(enable_rft_checkbox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE) +- .add(serverHostField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE) +- .add(serverPortField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, Short.MAX_VALUE) +- .add(concurrencyField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, Short.MAX_VALUE) +- +- ) +- +- ) +- +- )) +- ); +- +- layout.setVerticalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- //.add(26, 26, 26) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- //.add(100, 100, 100) +- .add(rftHelpButton)) +- .add(11, 11, 11) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(enable_rft) +- .add(10, 10, 10) +- .add(enable_rft_checkbox)) +- .add(11, 11, 11) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(jLabel1) +- .add(10, 10, 10) +- .add(serverHostField, 1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30)) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(jLabel2) +- .add(10, 10, 10) +- .add(serverPortField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(concurrencyLabel) +- .add(10, 10, 10) +- .add(concurrencyField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- +- .addContainerGap(18, Short.MAX_VALUE)) +- ); +- +- }// //GEN-END:initComponents +- +- public boolean isRFTEnabled() { +- return enable_rft_checkbox.isSelected(); +- } +- +- public void setEnableRFT(boolean enabled) { +- enable_rft_checkbox.setSelected(enabled); +- } +- +- private void loadFileButtonActionPerformed(java.awt.event.ActionEvent evt) { +- JFileChooser fileChooser = new JFileChooser("."); +- fileChooser.addChoosableFileFilter(new MyFilter()); +- int status = fileChooser.showDialog(this, "load"); +- if (status == JFileChooser.APPROVE_OPTION) { +- +- } +- } +- +- +- +- private void enable_rft_checkboxActionPerformed(java.awt.event.ActionEvent evt) { +- if (enable_rft_checkbox.isSelected()) { +- jLabel1.setEnabled(true); +- jLabel2.setEnabled(true); +- serverHostField.setEditable(true); +- serverPortField.setEditable(true); +- concurrencyLabel.setEnabled(true); +- concurrencyField.setEditable(true); +- } else { +- jLabel1.setEnabled(false); +- jLabel2.setEnabled(false); +- serverHostField.setEditable(false); +- serverPortField.setEditable(false); +- concurrencyField.setEditable(false); +- concurrencyLabel.setEnabled(false); +- } +- } +- +- private void rftHelpButtonActionPerformed(java.awt.event.ActionEvent evt) { +- String msg = "RFT is a GridFTP client that handles failures more reliably. It is a \n" + +- "Web Services Resource Framework (WSRF) compliant web service \n" + +- "that provides job scheduler-like functionality for data movement.\n" + +- "It can recover from source and/or destination server crashes during\n"+ +- "a transfer, network failures, RFT service failures, file system failures\n" + +- "etc. More information on RFT is available at\n" + +- "http://www.globus.org/toolkit/docs/4.2/4.2.0/data/rft/index.html"; +- JOptionPane.showMessageDialog(null, msg, "What is RFT", JOptionPane.INFORMATION_MESSAGE); +- } +- +- // Variables declaration - do not modify//GEN-BEGIN:variables +- private javax.swing.JTextField fromField; +- private javax.swing.JLabel jLabel1; +- private javax.swing.JLabel jLabel2; +- private javax.swing.JLabel jLabel3; +- private javax.swing.JLabel jLabel4; +- private javax.swing.JList jList1; +- private javax.swing.JScrollPane jScrollPane1; +- private javax.swing.JTextField serverHostField; +- private javax.swing.JTextField serverPortField; +- private javax.swing.JTextField toField; +- private javax.swing.JLabel enable_rft; +- private javax.swing.JCheckBox enable_rft_checkbox; +- private javax.swing.JLabel concurrencyLabel; +- private javax.swing.JTextField concurrencyField; +- private javax.swing.JButton rftHelpButton; +- // End of variables declaration//GEN-END:variables +- +- public class MyFilter extends FileFilter { +- +- public boolean accept(File f) { +- if (f.isDirectory()) { +- return true; +- } +- +- String extension = getExtension(f); +- if (extension != null) { +- if (extension.equals("xfr")) { +- return true; +- } else { +- return false; +- } +- } +- +- return false; +- } +- +- public String getDescription() { +- return ".xfr files"; +- } +- +- public String getExtension(File f) { +- String ext = null; +- String s = f.getName(); +- int i = s.lastIndexOf('.'); +- +- if (i > 0 && i < s.length() - 1) { +- ext = s.substring(i + 1).toLowerCase(); +- } +- return ext; +- } +- } +- +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/client-security-config.xml +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/client-security-config.xml (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/client-security-config.xml (working copy) +@@ -1,8 +0,0 @@ +- +- +- +- +- +- +- +- +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIApp.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIApp.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIApp.java (working copy) +@@ -1,46 +0,0 @@ +-/* +- * GridFTPGUIApp.java +- */ +- +-package org.globus.transfer.reliable.client; +- +-import org.jdesktop.application.Application; +-import org.jdesktop.application.SingleFrameApplication; +- +-/** +- * The main class of the application. +- */ +-public class GridFTPGUIApp extends SingleFrameApplication { +- +- +- /** +- * At startup create and show the main frame of the application. +- */ +- @Override protected void startup() { +- show(new GridFTPGUIView(this)); +- } +- +- /** +- * This method is to initialize the specified window by injecting resources. +- * Windows shown in our application come fully initialized from the GUI +- * builder, so this additional configuration is not needed. +- */ +- @Override protected void configureWindow(java.awt.Window root) { +- } +- +- /** +- * A convenient static getter for the application instance. +- * @return the instance of GridFTPGUIApp +- */ +- public static GridFTPGUIApp getApplication() { +- return Application.getInstance(GridFTPGUIApp.class); +- } +- +- /** +- * Main method launching the application. +- */ +- public static void main(String[] args) { +- //PropertyConfigurator.configure("log4j.properties"); +- launch(GridFTPGUIApp.class, args); +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptions.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptions.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptions.java (working copy) +@@ -1,65 +0,0 @@ +-package org.globus.transfer.reliable.client; +- +-public class RFTOptions { +- private int concurrent; +- private int parallelStream; +- private int tcpBufferSize; +- private String destDN; +- private String sourceDN; +- +- +- public RFTOptions() { +- +- } +- +- public RFTOptions(int concurrent, int parallelStream, +- int tcpBufferSize, String destDN, String sourceDN) { +- super(); +- this.concurrent = concurrent; +- this.parallelStream = parallelStream; +- this.tcpBufferSize = tcpBufferSize; +- this.destDN = destDN; +- this.sourceDN = sourceDN; +- } +- +- public int getConcurrent() { +- return concurrent; +- } +- +- public void setConcurrent(int concurrent) { +- this.concurrent = concurrent; +- } +- +- public int getParallelStream() { +- return parallelStream; +- } +- +- public void setParallelStream(int parallelStream) { +- this.parallelStream = parallelStream; +- } +- +- public int getTcpBufferSize() { +- return tcpBufferSize; +- } +- +- public void setTcpBufferSize(int tcpBufferSize) { +- this.tcpBufferSize = tcpBufferSize; +- } +- +- public String getDestDN() { +- return destDN; +- } +- +- public void setDestDN(String destDN) { +- this.destDN = destDN; +- } +- +- public String getSourceDN() { +- return sourceDN; +- } +- +- public void setSourceDN(String sourceDN) { +- this.sourceDN = sourceDN; +- } +- +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIAboutBox.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIAboutBox.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIAboutBox.java (working copy) +@@ -1,141 +0,0 @@ +-/* +- * GridFTPGUIAboutBox.java +- */ +- +-package org.globus.transfer.reliable.client; +- +-import org.jdesktop.application.Action; +- +-public class GridFTPGUIAboutBox extends javax.swing.JDialog { +- +- public GridFTPGUIAboutBox(java.awt.Frame parent) { +- super(parent); +- initComponents(); +- getRootPane().setDefaultButton(closeButton); +- } +- +- @Action public void closeAboutBox() { +- setVisible(false); +- } +- +- /** This method is called from within the constructor to +- * initialize the form. +- * WARNING: Do NOT modify this code. The content of this method is +- * always regenerated by the Form Editor. +- */ +- // //GEN-BEGIN:initComponents +- private void initComponents() { +- +- closeButton = new javax.swing.JButton(); +- javax.swing.JLabel appTitleLabel = new javax.swing.JLabel(); +- javax.swing.JLabel versionLabel = new javax.swing.JLabel(); +- javax.swing.JLabel appVersionLabel = new javax.swing.JLabel(); +- javax.swing.JLabel vendorLabel = new javax.swing.JLabel(); +- javax.swing.JLabel appVendorLabel = new javax.swing.JLabel(); +- javax.swing.JLabel homepageLabel = new javax.swing.JLabel(); +- javax.swing.JLabel appHomepageLabel = new javax.swing.JLabel(); +- javax.swing.JLabel appDescLabel = new javax.swing.JLabel(); +- imageLabel = new javax.swing.JLabel(); +- +- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); +- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(GridFTPGUIAboutBox.class); +- setTitle(resourceMap.getString("title")); // NOI18N +- setModal(true); +- setName("aboutBox"); // NOI18N +- setResizable(false); +- +- javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getActionMap(GridFTPGUIAboutBox.class, this); +- closeButton.setAction(actionMap.get("closeAboutBox")); // NOI18N +- closeButton.setName("closeButton"); // NOI18N +- +- appTitleLabel.setFont(appTitleLabel.getFont().deriveFont(appTitleLabel.getFont().getStyle() | java.awt.Font.BOLD, appTitleLabel.getFont().getSize()+4)); +- appTitleLabel.setText(resourceMap.getString("Application.title")); // NOI18N +- appTitleLabel.setName("appTitleLabel"); // NOI18N +- +- versionLabel.setFont(versionLabel.getFont().deriveFont(versionLabel.getFont().getStyle() | java.awt.Font.BOLD)); +- versionLabel.setText(resourceMap.getString("versionLabel.text")); // NOI18N +- versionLabel.setName("versionLabel"); // NOI18N +- +- appVersionLabel.setText(resourceMap.getString("Application.version")); // NOI18N +- appVersionLabel.setName("appVersionLabel"); // NOI18N +- +- vendorLabel.setFont(vendorLabel.getFont().deriveFont(vendorLabel.getFont().getStyle() | java.awt.Font.BOLD)); +- vendorLabel.setText(resourceMap.getString("vendorLabel.text")); // NOI18N +- vendorLabel.setName("vendorLabel"); // NOI18N +- +- appVendorLabel.setText(resourceMap.getString("Application.vendor")); // NOI18N +- appVendorLabel.setName("appVendorLabel"); // NOI18N +- +- homepageLabel.setFont(homepageLabel.getFont().deriveFont(homepageLabel.getFont().getStyle() | java.awt.Font.BOLD)); +- homepageLabel.setText(resourceMap.getString("homepageLabel.text")); // NOI18N +- homepageLabel.setName("homepageLabel"); // NOI18N +- +- appHomepageLabel.setText(resourceMap.getString("Application.homepage")); // NOI18N +- appHomepageLabel.setName("appHomepageLabel"); // NOI18N +- +- appDescLabel.setText(resourceMap.getString("appDescLabel.text")); // NOI18N +- appDescLabel.setName("appDescLabel"); // NOI18N +- +- imageLabel.setIcon(resourceMap.getIcon("imageLabel.icon")); // NOI18N +- imageLabel.setName("imageLabel"); // NOI18N +- +- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); +- getContentPane().setLayout(layout); +- layout.setHorizontalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .addContainerGap() +- .add(imageLabel) +- .add(32, 32, 32) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) +- .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(versionLabel) +- .add(vendorLabel) +- .add(homepageLabel)) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(appVersionLabel) +- .add(appVendorLabel) +- .add(appHomepageLabel))) +- .add(org.jdesktop.layout.GroupLayout.LEADING, appTitleLabel) +- .add(org.jdesktop.layout.GroupLayout.LEADING, appDescLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE) +- .add(closeButton)) +- .addContainerGap()) +- ); +- layout.setVerticalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() +- .addContainerGap() +- .add(appTitleLabel) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(appDescLabel) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(versionLabel) +- .add(appVersionLabel)) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(vendorLabel) +- .add(appVendorLabel)) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(homepageLabel) +- .add(appHomepageLabel)) +- .add(119, 119, Short.MAX_VALUE) +- .add(closeButton)) +- .add(imageLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)) +- .addContainerGap()) +- ); +- +- pack(); +- }// //GEN-END:initComponents +- +- // Variables declaration - do not modify//GEN-BEGIN:variables +- private javax.swing.JButton closeButton; +- private javax.swing.JLabel imageLabel; +- // End of variables declaration//GEN-END:variables +- +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTPanel.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTPanel.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTPanel.java (working copy) +@@ -1,398 +0,0 @@ +-/* +- * RFTPanel.java +- * +- * +- */ +- +-package org.globus.transfer.reliable.client; +- +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +- +-import java.io.File; +-import java.io.FileOutputStream; +-import java.util.Properties; +- +-import javax.swing.JFrame; +-import javax.swing.JOptionPane; +-import javax.swing.filechooser.FileFilter; +- +-import org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel; +- +- +-public class RFTPanel extends javax.swing.JPanel { +- private int jobID = 0; +- private JFrame frame = null; +- /** Creates new form RFTPanel */ +- public RFTPanel() { +- initComponents(); +- actionListener = new RFTButtonActionListener(this); +- } +- +- /** This method is called from within the constructor to +- * initialize the form. +- * WARNING: Do NOT modify this code. The content of this method is +- * always regenerated by the Form Editor. +- */ +- // //GEN-BEGIN:initComponents +- private void initComponents() { +- +- rftQueuePanel = new org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel(); +- rftQueuePanel.createHeader(new String[]{"Jobid", "From", "To", "Status", "%", "Errors"}); +- rftQueuePanel.addPopupItems(new String[]{"Info", "Cancel", "Delete"}, new ButtonActionListener()); +- rFTOptions1 = new RFTOptionsPanel(); +- rFTTransferParam1 = new RFTTransferParamPanel(); +- startButton = new javax.swing.JButton(); +- stopButton = new javax.swing.JButton(); +- okButton = new javax.swing.JButton(); +- +- setAutoscrolls(true); +- setName("Form"); // NOI18N +- +- rftQueuePanel.setName("rftQueuePanel"); // NOI18N +- +- rFTOptions1.setName("rFTOptions1"); // NOI18N +- +- rFTTransferParam1.setName("rFTTransferParam1"); // NOI18N +- +- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(RFTPanel.class); +- startButton.setText(resourceMap.getString("startButton.text")); // NOI18N +- startButton.setName("startButton"); // NOI18N +- startButton.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- startButtonActionPerformed(evt); +- } +- }); +- +- stopButton.setText(resourceMap.getString("stopButton.text")); // NOI18N +- stopButton.setName("stopButton"); // NOI18N +- stopButton.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- stopButtonActionPerformed(evt); +- } +- }); +- +- okButton.setText(resourceMap.getString("restartButton.text")); // NOI18N +- okButton.setName("restartButton"); // NOI18N +- okButton.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- okButtonActionPerformed(evt); +- } +- }); +- +- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); +- this.setLayout(layout); +- layout.setHorizontalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() +- .add(rFTOptions1, 100, 300, 400) +- .addContainerGap()) +- .add(rFTTransferParam1, 100, 300, 400) +- .add(layout.createSequentialGroup() +- .add(200, 200, 200) +- .add(okButton) +- ) +- ); +- +- layout.linkSize(new java.awt.Component[] {okButton}, org.jdesktop.layout.GroupLayout.HORIZONTAL); +- +- layout.setVerticalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .add(rFTOptions1, 80, 100, 130) +- .add(rFTTransferParam1, 150, 200, 250) +- .add(18, 18, 18) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(okButton)) +- .add(92, 92, 92)) +- ); +- +- +- }// //GEN-END:initComponents +- +- +- private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed +- new Thread(new Runnable() { +- public void run() { +- RFTTransferParam param = new RFTTransferParam(rFTTransferParam1.getFrom(), +- rFTTransferParam1.getTo(), rFTTransferParam1.getServerHost(), +- rFTTransferParam1.getServerPort()); +- RFTOptions options = new RFTOptions(rFTTransferParam1.getConcurrent(), +- rFTOptions1.getParallelStream(), rFTOptions1.getTcpBufferSize(), +- rFTOptions1.getDestSN(), rFTOptions1.getSourceSN()); +- RFTJob job = new RFTJob(++jobID, options, param); +- try { +- actionListener.startButtonAction(job, rftQueuePanel); +- } catch (Exception e) { +- JOptionPane.showMessageDialog(null,e.getMessage(), "Error", +- JOptionPane.WARNING_MESSAGE); +- int index = rftQueuePanel.getRowIndex(Integer.toString(jobID)); +- rftQueuePanel.setColumnValue(index, 3, "Failed"); +- rftQueuePanel.setColumnValue(index, 5, e.getMessage()); +- e.printStackTrace(); +- } +- } +- }).start(); +- }//GEN-LAST:event_startButtonActionPerformed +- +- private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed +- new Thread(new Runnable() { +- public void run() { +- String jobID = rftQueuePanel.getSelectedJob(); +- try { +- actionListener.stopButtonAction(jobID); +- } catch (Exception e) { +- JOptionPane.showMessageDialog(null,e.getMessage(), "Error", +- JOptionPane.WARNING_MESSAGE); +- int index = rftQueuePanel.getRowIndex(jobID, 0); +- rftQueuePanel.setColumnValue(index, 4, "Failed"); +- rftQueuePanel.setColumnValue(index, 6, e.getMessage()); +- e.printStackTrace(); +- } +- } +- }).start(); +- }//GEN-LAST:event_stopButtonActionPerformed +- +- private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed +- Properties prop = new Properties(); +- try { +- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; +- File dir = new File(globusDir, "GridFTP_GUI"); +- if (!dir.exists() || !dir.isDirectory()) { +- dir.mkdirs(); +- } +- +- File prop_file = new File(dir, "rft.properties"); +- +- prop.setProperty("rft_enabled", String.valueOf(rFTTransferParam1.isRFTEnabled())); +- prop.setProperty("host", rFTTransferParam1.getServerHost()); +- prop.setProperty("port", rFTTransferParam1.getServerPort()); +- prop.setProperty("concurrent", Integer.toString(rFTTransferParam1.getConcurrent())); +- prop.setProperty("parallelstream", Integer.toString(rFTOptions1.getParallelStream())); +- prop.setProperty("tcpbuffersize", Integer.toString(rFTOptions1.getTcpBufferSize())); +- prop.store(new FileOutputStream(prop_file), null); +- } catch (Exception e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } +- this.frame.setVisible(false); +- }//GEN-LAST:event_stopButtonActionPerformed +- +- public void setFrame(JFrame f) { +- this.frame = f; +- } +- +- /** +- * delete a transfer from queue panel and cancel actually transfer +- * @param jobid +- */ +- public void deleteTransfer(String jobid) { +- try { +- actionListener.stopButtonAction(jobid); +- } catch (Exception e) { +- int index = rftQueuePanel.getRowIndex(jobid, 0); +- rftQueuePanel.setColumnValue(index, 3, "Failed"); +- rftQueuePanel.setColumnValue(index, 5, e.getMessage()); +- e.printStackTrace(); +- } +- rftQueuePanel.deleteTransfer(jobid); +- } +- +- /** +- * clear queue panel and cancel all transfer +- */ +- public void clear() { +- if (rftQueuePanel.tableSize() > 0) { +- Object aobj[] = {"Yes", "No"}; +- int k = JOptionPane.showOptionDialog(null, " Do you wish to clear all the jobs and stop the unfinished jobs ?", "Cancellation Alert", -1, 2, null, aobj, aobj[0]); +- if (k != 1) { +- +- +- int tableSize = rftQueuePanel.tableSize(); +- +- //cancel all transfer +- for (int i = 0; i < tableSize; i++) { +- String jobID = rftQueuePanel.getColumnValue(i, 0); +- try { +- actionListener.stopButtonAction(jobID); +- } catch (Exception e) { +- int index = rftQueuePanel.getRowIndex(jobID); +- rftQueuePanel.setColumnValue(index, 3, "Failed"); +- rftQueuePanel.setColumnValue(index, 5, e.getMessage()); +- e.printStackTrace(); +- } +- } +- +- //clear from queue panel +- rftQueuePanel.clear(); +- +- } +- } +- } +- +- public QueuePanel getQueuePanel() { +- return rftQueuePanel; +- } +- +- public static void main(String[] args) { +- Integer i = org.globus.wsrf.security.Constants.SIGNATURE; +- JFrame frame = new JFrame(); +- RFTPanel panel = new RFTPanel(); +- frame.getContentPane().add(panel); +- frame.pack(); +- frame.setVisible(true); +- +- } +- +- +- private RFTButtonActionListener actionListener; +- // Variables declaration - do not modify//GEN-BEGIN:variables +- private javax.swing.JLabel jLabel11; +- private RFTOptionsPanel rFTOptions1; +- private RFTTransferParamPanel rFTTransferParam1; +- private javax.swing.JButton okButton; +- private org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel rftQueuePanel; +- private javax.swing.JButton startButton; +- private javax.swing.JButton stopButton; +- // End of variables declaration//GEN-END:variables +- +- class ButtonActionListener implements ActionListener { +- public void actionPerformed(ActionEvent ae) { +- String actionCommand = ae.getActionCommand(); +- if (actionCommand.equals("Save")) { +- Thread saveThread = new Thread() { +- public void run() { +- if (rftQueuePanel.tableSize() > 0) { +- //theApp.saveQueueToFile("rft"); +- } +- } +- }; +- saveThread.start(); +- } else if (actionCommand.equals("Load")) { +- Thread loadThread = new Thread() { +- public void run() { +- //theApp.loadQueueFromFile("rft"); +- } +- }; +- loadThread.start(); +- } else if (actionCommand.equals("Stop")) { +- Thread controlThread = new Thread() { +- public void run() { +- if (rftQueuePanel.tableSize() > 0) { +- //theApp.controlExecutionQueue(false, "rft"); +- } +- } +- }; +- controlThread.start(); +- } else if (actionCommand.equals("Start")) { +- Thread controlThread = new Thread() { +- public void run() { +- if (rftQueuePanel.tableSize() > 0) { +- //theApp.controlExecutionQueue(true, "rft"); +- } +- } +- }; +- controlThread.start(); +- } else if (actionCommand.equals("Clear")) { +- Thread controlThread = new Thread() { +- public void run() { +- if (rftQueuePanel.tableSize() > 0) { +- clear(); +- } +- } +- }; +- controlThread.start(); +- } else if (actionCommand.equals("Info")) { +- String job = rftQueuePanel.getSelectedJob(); +- int row = rftQueuePanel.getRowIndex(job, 0); +- String msg = " Job ID : " + +- rftQueuePanel.getColumnValue(row, 0) +- + "\n From : " +- + rftQueuePanel.getColumnValue(row, 1) + +- "\n To : " + +- rftQueuePanel.getColumnValue(row, 2) + +- "\n Status : " + +- rftQueuePanel.getColumnValue(row, 3) +- + "\n Errors : " + +- rftQueuePanel.getColumnValue(row, 5) + +- "\n"; +- +- JOptionPane.showMessageDialog(null, +- msg, +- "RFT Job Information", +- JOptionPane.PLAIN_MESSAGE); +- +- } else if (actionCommand.equals("Cancel")) { +- Thread controlThread = new Thread() { +- public void run() { +- String jobID = rftQueuePanel.getSelectedJob(); +- try { +- actionListener.stopButtonAction(jobID); +- } catch (Exception e) { +- JOptionPane.showMessageDialog(null,e.getMessage(), "Error", +- JOptionPane.WARNING_MESSAGE); +- int index = rftQueuePanel.getRowIndex(jobID); +- rftQueuePanel.setColumnValue(index, 3, "Failed"); +- rftQueuePanel.setColumnValue(index, 5, e.getMessage()); +- e.printStackTrace(); +- } +- } +- }; +- controlThread.start(); +- +- } else if (actionCommand.equals("Delete")) { +- String jobID = rftQueuePanel.getSelectedJob(); +- int row = rftQueuePanel.getRowIndex(jobID, 0); +- if (!rftQueuePanel.getColumnValue(row, 3).equals("Finished")) { +- Object aobj[] = {"Yes", "No"}; +- int k = JOptionPane.showOptionDialog(null, " This job is not Finished yet. Do you wish to cancel the job and delete it?", "Deletion Alert", -1, 2, null, aobj, aobj[0]); +- if (k == 1) { +- return; +- } else { +- deleteTransfer(jobID); +- } +- } else { +- deleteTransfer(jobID); +- } +- +- } +- } +- +- } +- +- public class MyFilter extends FileFilter { +- +- public boolean accept(File f) { +- if (f.isDirectory()) { +- return true; +- } +- +- String extension = getExtension(f); +- if (extension != null) { +- if (extension.equals("xfr")) { +- return true; +- } else { +- return false; +- } +- } +- +- return false; +- } +- +- public String getDescription() { +- return ".xfr files"; +- } +- +- public String getExtension(File f) { +- String ext = null; +- String s = f.getName(); +- int i = s.lastIndexOf('.'); +- +- if (i > 0 && i < s.length() - 1) { +- ext = s.substring(i + 1).toLowerCase(); +- } +- return ext; +- } +- } +- +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/webstart/ProgramStarter.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/webstart/ProgramStarter.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/webstart/ProgramStarter.java (working copy) +@@ -1,210 +0,0 @@ +-package org.globus.transfer.reliable.client.webstart; +- +-import java.io.BufferedOutputStream; +-import java.io.File; +-import java.io.FileOutputStream; +-import java.io.IOException; +-import java.io.InputStream; +-import java.net.URL; +-import java.net.URLConnection; +-import java.util.Enumeration; +-import java.util.zip.ZipEntry; +-import java.util.zip.ZipFile; +- +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.apache.log4j.PropertyConfigurator; +-import org.apache.tools.ant.Project; +-import org.apache.tools.ant.ProjectHelper; +-import org.globus.transfer.reliable.client.utils.UIConstants; +- +-/** +- * This class is intended for launching the client using Java Web Start. +- * It can download, untar GT ws-core automatically, specify system properties +- * for the client and launch it. +- * +- * @author Liu Wantao liuwt at uchicago.edu +- * +- */ +-public class ProgramStarter { +- private static Log logger = LogFactory.getLog(ProgramStarter.class); +- private static String JWSCacheDir = System.getProperty("deployment.user.cachedir"); +- private static String GLOBUS_LOCATION = JWSCacheDir + File.separator + "ws_core1"; +- private static String downloadLink = "http://www-unix.globus.org/ftppub/gt4/4.0/4.0.7/ws-core/bin/ws-core-4.0.7-bin.zip"; +- private static String gtFileName = JWSCacheDir + File.separator + "ws-core-4.0.7-bin.zip"; +- +- +- /** +- * Download GT ws-core automatically +- * @param link +- * @return +- */ +- private boolean downloadGT(String link) { +- logger.debug("download GT ws-core from:" + link); +- +- boolean ret = false; +- InputStream inStream = null; +- FileOutputStream fos = null; +- try { +- URL url = new URL(link); +- URLConnection conn = url.openConnection(); +- inStream = conn.getInputStream(); +- fos = new FileOutputStream(gtFileName); +- byte[] buffer = new byte[5 * 1024 * 1024]; +- int length = -1; +- +- while ((length = inStream.read(buffer)) != -1) { +- fos.write(buffer, 0, length); +- } +- +- ret = true; +- } catch (Exception e) { +- logger.error(e.getMessage(), e); +- ret = false; +- } finally { +- try { +- inStream.close(); +- fos.close(); +- } catch (Exception e) { +- +- } +- } +- +- return ret; +- } +- +- /** +- * extract GT ws-core from downloaded zip file +- * @param zipFileName +- * +- */ +- private void extractGT(String zipFileName) { +- logger.debug("extract GT ws-core from:" + zipFileName); +- InputStream input = null; +- BufferedOutputStream bos = null; +- ZipFile zfile = null; +- +- try { +- zfile = new ZipFile(zipFileName); +- Enumeration zlist = zfile.entries(); +- ZipEntry entry = null; +- byte[] buf = new byte[8192]; +- +- //iterate every entry in the zip file +- while (zlist.hasMoreElements()) { +- //System.out.println(entry.getName()); +- entry = (ZipEntry) zlist.nextElement(); +- if (entry.isDirectory()) { +- continue; +- } +- +- String name = entry.getName(); +- name = name.substring(name.indexOf("/")); +- input = zfile.getInputStream(entry); +- File file = new File(GLOBUS_LOCATION, name); +- if (!file.getParentFile().exists()) { +- file.getParentFile().mkdirs(); +- } +- bos = new BufferedOutputStream(new FileOutputStream(file)); +- +- int length = -1; +- while ((length = input.read(buf)) != -1) { +- bos.write(buf, 0, length); +- } +- +- bos.flush(); +- } +- } catch (IOException e) { +- logger.error(e.getMessage(), e); +- } finally { +- try { +- zfile.close(); +- input.close(); +- bos.close(); +- } catch (Exception e) { +- +- } +- } +- } +- +- /** +- * set GLOBUS_LOCATION and axis.ClientConfigFile for the GUI client +- * @param globus_location +- */ +- private void setEnv(String globus_location) { +- System.setProperty("GLOBUS_LOCATION", GLOBUS_LOCATION); +- String path = GLOBUS_LOCATION + File.separator + "client-config.wsdd"; +- System.setProperty("axis.ClientConfigFile", path); +- } +- +- /** +- * check if GT ws_core is exist in local disk +- * @return +- */ +- private boolean isGTExist() { +- File gt = new File(GLOBUS_LOCATION); +- if (gt.exists() && gt.isDirectory()) { +- return true; +- } +- +- return false; +- } +- +- private void loadGUI() { +- org.globus.transfer.reliable.client.GridFTPGUIApp.main(null); +- } +- +- private void invokeAnt() { +- try { +- URL url = Thread.currentThread().getContextClassLoader().getResource("scripts/build.xml"); +- //System.out.println(new File(".").getCanonicalPath()); +- logger.debug(url); +- Project p = new Project(); +- p.init(); +- p.setProperty("JWSCacheDir", JWSCacheDir); +- ProjectHelper helper = ProjectHelper.getProjectHelper(); +- helper.parse(p, url); +- p.executeTarget(p.getDefaultTarget()); +- } catch (Exception e) { +- e.printStackTrace(); +- logger.debug(e.getMessage(), e); +- } +- +- } +- +- private void configLog() { +- File logLocationFile = new File(UIConstants.LOG_CONFIG); +- +- if (!logLocationFile.exists()) { +- loadDefaultLog(); +- } else { +- try { +- PropertyConfigurator.configure(UIConstants.LOG_CONFIG); +- } catch (Exception e) { +- loadDefaultLog(); +- } +- } +- } +- +- private void loadDefaultLog() { +- URL url = Thread.currentThread().getContextClassLoader().getResource(UIConstants.DEFAULT_LOG_CONFIG); +- PropertyConfigurator.configure(url); +- } +- +- public static void main(String[] args) { +- ProgramStarter starter = new ProgramStarter(); +- starter.configLog(); +- starter.invokeAnt(); +- +- if (!starter.isGTExist()) { +- if (starter.downloadGT(downloadLink)) { +- starter.extractGT(gtFileName); +- } else { +- System.exit(1); +- } +- } +- +- starter.setEnv(GLOBUS_LOCATION); +- starter.loadGUI(); +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferFileParser.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferFileParser.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferFileParser.java (working copy) +@@ -1,76 +0,0 @@ +-package org.globus.transfer.reliable.client; +- +-import java.io.BufferedReader; +-import java.io.File; +-import java.io.FileReader; +-import java.io.IOException; +-import java.util.Vector; +- +-import org.globus.rft.generated.TransferType; +- +-public class RFTTransferFileParser { +- Vector requestData = new Vector(); +- +- public void loadTransferFile(String filePath) throws Exception { +- File transferFile = new File(filePath); +- if (!transferFile.exists() || !transferFile.isFile() +- || !transferFile.canRead()) { +- throw new IllegalArgumentException(filePath +- + " is not an illegal transfer file"); +- } +- +- BufferedReader reader = null; +- try { +- reader = new BufferedReader(new FileReader(transferFile)); +- +- +- String line = reader.readLine(); +- while (line != null) { +- if (!line.startsWith("#")) { +- if (!line.trim().equals("")) { +- requestData.add(line); +- } +- } +- line = reader.readLine(); +- } +- +- +- } catch (IOException e) { +- throw e; +- } finally { +- reader.close(); +- } +- } +- +- public TransferType[] getTransferType() throws Exception { +- int transferCount = (requestData.size() - 11) / 2; +- +- if (transferCount <= 0) { +- throw new Exception("Invalid transfer file format"); +- } +- +- TransferType[] transfers1 = new TransferType[transferCount]; +- int i = 11; +- for (int j = 0; j < transfers1.length; j++) { +- transfers1[j] = new TransferType(); +- transfers1[j].setSourceUrl((String) requestData.elementAt(i++)); +- transfers1[j].setDestinationUrl((String) requestData +- .elementAt(i++)); +- } +- +- return transfers1; +- } +- +- public RFTOptions getRFTOptions() { +- int i = 0; +- RFTOptions options = new RFTOptions(); +- +- options.setTcpBufferSize(Integer.valueOf((String) requestData.elementAt(i++))); +- options.setParallelStream(Integer.valueOf((String) requestData.elementAt(i++))); +- options.setConcurrent(Integer.valueOf((String) requestData.elementAt(i++)).intValue()); +- options.setSourceDN((String) requestData.elementAt(i++)); +- options.setDestDN((String) requestData.elementAt(i++)); +- +- return options; +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/Utils.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/Utils.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/Utils.java (working copy) +@@ -1,52 +0,0 @@ +-/* +- * To change this template, choose Tools | Templates +- * and open the template in the editor. +- */ +- +-package org.globus.transfer.reliable.client.utils; +- +-import java.io.File; +-import java.io.FileInputStream; +-import java.io.FileNotFoundException; +-import java.io.IOException; +-import java.util.Properties; +- +-/** +- * Some utility functions +- * @author Wantao +- */ +-public class Utils { +- +- /** +- * get all file system root +- * @return +- */ +- public static File[] getFileSystemRoots() { +- //File file = new File("."); +- File[] roots = File.listRoots(); +- +- return roots; +- } +- +- public static String getProperty(String propertyName, String propertyFileName) { +- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; +- File dir = new File(globusDir, "GridFTP_GUI"); +- File propFile = new File(dir, propertyFileName); +- String ret = null; +- if (!propFile.exists()) { +- return null; +- } +- +- Properties prop = new Properties(); +- try { +- prop.load(new FileInputStream(propFile)); +- ret = prop.getProperty(propertyName); +- +- } catch (Exception e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } +- +- return ret; +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/LogFileUtils.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/LogFileUtils.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/LogFileUtils.java (working copy) +@@ -1,72 +0,0 @@ +-package org.globus.transfer.reliable.client.utils; +- +-import java.io.BufferedInputStream; +-import java.io.FileInputStream; +-import java.io.FileOutputStream; +-import java.io.IOException; +-import java.io.InputStream; +-import java.util.Properties; +- +-/** +- * some utility functions for log +- * @author Liu Wantao liuwt at uchicago.edu +- * +- */ +-public class LogFileUtils { +- +- /** +- * create a new log4j configuration file +- * @param logFileLocation +- */ +- public static void createNewLogConfigFile(String logFileLocation) { +- FileOutputStream fos = null; +- try { +- fos = new FileOutputStream(UIConstants.LOG_CONFIG); +- Properties prop = new Properties(); +- prop.setProperty("log4j.rootCategory", "ERROR, A1"); +- prop.setProperty("log4j.appender.A1", "org.apache.log4j.FileAppender"); +- prop.setProperty("log4j.appender.A1.file", logFileLocation); +- prop.setProperty("log4j.appender.A1.layout", "org.apache.log4j.PatternLayout"); +- prop.setProperty("log4j.appender.A1.layout.ConversionPattern", "%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n"); +- prop.setProperty("log4j.category.org.globus", "DEBUG"); +- prop.store(fos, null); +- } catch (Exception e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } finally { +- try { +- fos.close(); +- } catch (IOException e) { +- } +- } +- } +- +- public static void updateLogConfigFile(String logFileLocation) { +- InputStream is = null; +- FileOutputStream fos = null; +- try { +- is = new BufferedInputStream(new FileInputStream(UIConstants.LOG_CONFIG)); +- Properties prop = new Properties(); +- prop.load(is); +- prop.setProperty("log4j.appender.A1.file", logFileLocation); +- +- fos = new FileOutputStream(UIConstants.LOG_CONFIG); +- prop.store(fos, null); +- +- } catch (Exception e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } finally { +- try { +- is.close(); +- fos.close(); +- } catch (IOException e) { +- } +- } +- } +- +- public static void main(String[] args) { +- createNewLogConfigFile("fd"); +- updateLogConfigFile("fefefe"); +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/UIConstants.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/UIConstants.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/UIConstants.java (working copy) +@@ -1,15 +0,0 @@ +-package org.globus.transfer.reliable.client.utils; +- +-/** +- * +- * @author Liu Wantao liuwt at uchicago.edu +- */ +-public class UIConstants { +- public static int MAXSITES = 10; +- public static String ILLEGAL_HOST = "illegal host"; +- public static String HTTP_PROTOCOL = "http"; +- public static String HTTPS_PROTOCOL = "https"; +- public static String DONE_STATUS = "done"; +- public static String DEFAULT_LOG_CONFIG = "log4j_gui_default.properties"; +- public static String LOG_CONFIG = ".log4j.properties"; +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParam.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParam.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParam.java (working copy) +@@ -1,52 +0,0 @@ +-package org.globus.transfer.reliable.client; +- +- +-import org.globus.rft.generated.TransferType; +- +-public class RFTTransferParam { +- private TransferType[] transfers1 = null; +- private String serverHost = null; +- private String serverPort = null; +- +- public RFTTransferParam(String from, String to, String serverHost, +- String serverPort) { +- transfers1 = new TransferType[1]; +- transfers1[0] = new TransferType(); +- transfers1[0].setSourceUrl(from); +- transfers1[0].setDestinationUrl(to); +- this.serverHost = serverHost; +- this.serverPort = serverPort; +- } +- +- public RFTTransferParam(TransferType[] transferTypes, String serverHost, +- String serverPort) throws Exception { +- transfers1 = transferTypes; +- this.serverHost = serverHost; +- this.serverPort = serverPort; +- +- } +- +- public TransferType[] getTransfers1() { +- return transfers1; +- } +- +- public void setTransfers1(TransferType[] transfers1) { +- this.transfers1 = transfers1; +- } +- +- public String getServerHost() { +- return serverHost; +- } +- +- public void setServerHost(String serverHost) { +- this.serverHost = serverHost; +- } +- +- public String getServerPort() { +- return serverPort; +- } +- +- public void setServerPort(String serverPort) { +- this.serverPort = serverPort; +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileTransferClient.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileTransferClient.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileTransferClient.java (working copy) +@@ -1,245 +0,0 @@ +-/* +- * Portions of this file Copyright 1999-2005 University of Chicago +- * Portions of this file Copyright 1999-2005 The University of Southern California. +- * +- * This file or a portion of this file is licensed under the +- * terms of the Globus Toolkit Public License, found at +- * http://www.globus.org/toolkit/download/license.html. +- * If you redistribute this file, with or without +- * modifications, you must include this notice in the file. +- */ +- +-package org.globus.transfer.reliable.client; +- +-import java.io.BufferedReader; +-import java.io.File; +-import java.io.FileReader; +-import java.io.FileWriter; +-import java.util.Calendar; +-import java.util.Vector; +- +-import javax.xml.namespace.QName; +-import javax.xml.rpc.Stub; +-import org.apache.axis.message.addressing.Address; +-import org.apache.axis.message.addressing.EndpointReferenceType; +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +- +-import org.globus.gsi.GSIConstants; +-import org.globus.rft.generated.RFTOptionsType; +-import org.globus.rft.generated.ReliableFileTransferPortType; +-import org.globus.rft.generated.TransferRequestType; +-import org.globus.rft.generated.TransferType; +-import org.globus.rft.generated.Start; +-import org.globus.rft.generated.StartOutputType; +- +-import org.oasis.wsrf.lifetime.SetTerminationTime; +-import org.oasis.wsrf.lifetime.SetTerminationTimeResponse; +- +-import org.globus.wsrf.encoding.ObjectSerializer; +- +-/** +- * Command line client for RFT service +- */ +-public class ReliableFileTransferClient extends BaseRFTClient { +- private static Log logger = LogFactory.getLog(ReliableFileTransferClient.class); +- +- /** +- * Constructor +- */ +- public ReliableFileTransferClient() { +- super(); +- } +- +- /** +- * Gets the transfer attribute of the ReliableFileTransferClient class +- * @param epr +- * @param path +- * @return The transfer value +- */ +- public static TransferRequestType getTransfer( +- String path, EndpointReferenceType epr) { +- File requestFile = new File(path); +- BufferedReader reader = null; +- +- try { +- reader = new BufferedReader(new FileReader(requestFile)); +- } catch (java.io.FileNotFoundException fnfe) { +- logger.debug(fnfe.getMessage(), fnfe); +- System.err.println(fnfe); +- System.exit(-1); +- } +- +- Vector requestData = new Vector(); +- +- try { +- +- String line = reader.readLine(); +- while (line != null) { +- if (!line.startsWith("#")) { +- if (!line.trim().equals("")) { +- requestData.add(line); +- } +- } +- line = reader.readLine(); +- +- } +- +- reader.close(); +- } catch (java.io.IOException ioe) { +- logger.debug(ioe.getMessage(), ioe); +- System.err.println("IOException:" + ioe.getMessage()); +- System.exit(-1); +- } +- +- transferCount = (requestData.size() - 11) / 2; +- +- if(transferCount <= 0) { +- System.err.println("Invalid transfer file format"); +- System.exit(-1); +- } +- TransferType[] transfers1 = new TransferType[transferCount]; +- RFTOptionsType multirftOptions = new RFTOptionsType(); +- int i = 0; +- multirftOptions.setBinary(Boolean.valueOf( +- (String) requestData.elementAt(i++))); +- multirftOptions.setBlockSize(Integer.valueOf( +- (String) requestData.elementAt(i++))); +- multirftOptions.setTcpBufferSize(Integer.valueOf( +- (String) requestData.elementAt(i++))); +- multirftOptions.setNotpt(Boolean.valueOf( +- (String) requestData.elementAt(i++))); +- multirftOptions.setParallelStreams(Integer.valueOf( +- (String) requestData.elementAt(i++))); +- multirftOptions.setDcau(Boolean.valueOf( +- (String) requestData.elementAt(i++))); +- int concurrency = Integer.valueOf((String) requestData.elementAt(i++)) +- .intValue(); +- +- String sourceSubjectName = (String) requestData.elementAt(i++); +- if (sourceSubjectName != null) { +- multirftOptions.setSourceSubjectName(sourceSubjectName); +- } +- String destinationSubjectName = (String) requestData.elementAt(i++); +- if (destinationSubjectName != null) { +- multirftOptions.setDestinationSubjectName(destinationSubjectName); +- } +- boolean allOrNone = Boolean.valueOf( +- (String) requestData.elementAt(i++)).booleanValue(); +- int maxAttempts = Integer.valueOf((String) requestData.elementAt(i++)) +- .intValue(); +- System.out.println("Number of transfers in this request: " +- + transferCount); +- +- for (int j = 0; j < transfers1.length; j++) { +- transfers1[j] = new TransferType(); +- transfers1[j].setSourceUrl((String) requestData.elementAt(i++)); +- transfers1[j] +- .setDestinationUrl((String) requestData.elementAt(i++)); +- } +- +- TransferRequestType transferRequest = new TransferRequestType(); +- transferRequest.setTransfer(transfers1); +- transferRequest.setRftOptions(multirftOptions); +- transferRequest.setConcurrency(new Integer(concurrency)); +- transferRequest.setAllOrNone(new Boolean(allOrNone)); +- transferRequest.setMaxAttempts(new Integer(maxAttempts)); +- transferRequest.setTransferCredentialEndpoint(epr); +- return transferRequest; +- } +- +- +- /** +- * @param args +- * @exception Exception +- */ +- public static void main(String args[]) throws Exception { +- +- if(args.length < 1) { +- printUsage(); +- System.exit(-1); +- } +- cmd = args; +- parseArgs(); +- +- TransferRequestType transferType = null; +- if (PORT == null) { +- if (authType.equals(GSIConstants.GSI_TRANSPORT)) { +- PORT = "8443"; +- } else { +- PORT ="8080"; +- } +- } +- if (authType.equals(GSIConstants.GSI_TRANSPORT)) { +- PROTOCOL = "https"; +- } +- String rftFactoryAddress = +- PROTOCOL + "://"+ HOST+ ":" + PORT + SERVICE_URL_ROOT +- + "ReliableFileTransferFactoryService"; +- String rftServiceAddress = PROTOCOL+ "://" + HOST + ":" + PORT + +- SERVICE_URL_ROOT + "ReliableFileTransferService"; +- +- EndpointReferenceType credEPR = delegateCredential(HOST, PORT); +- +- transferType = getTransfer(PATH_TO_FILE, credEPR); +- +- EndpointReferenceType rftepr = createRFT(rftFactoryAddress, +- transferType); +- if (outFileName != null) { +- FileWriter writer = null; +- try { +- writer = new FileWriter(outFileName); +- QName qName = new QName("", "RFT_EPR"); +- writer.write(ObjectSerializer.toString(rftepr, +- qName)); +- } finally { +- if (writer != null) { +- writer.close(); +- } +- } +- } +- rftepr.setAddress(new Address(rftServiceAddress)); +- ReliableFileTransferPortType rft = rftLocator +- .getReliableFileTransferPortTypePort(rftepr); +- setSecurity((Stub)rft); +- +- //For secure notifications +- subscribe(rft); +- System.out.println("Subscribed for overall status"); +- //End subscription code +- Calendar termTime = Calendar.getInstance(); +- termTime.add(Calendar.MINUTE, TERM_TIME); +- SetTerminationTime reqTermTime = new SetTerminationTime(); +- reqTermTime.setRequestedTerminationTime(termTime); +- System.out.println("Termination time to set: " + TERM_TIME +- + " minutes"); +- SetTerminationTimeResponse termRes = rft +- .setTerminationTime(reqTermTime); +- StartOutputType startresp = rft.start(new Start()); +- +- while (finished < transferCount && transferCount != 0) { +- if (failed == transferCount || +- (failed + finished == transferCount)) { +- break; +- } else { +- Thread.sleep(1000); +- } +- } +- if ((finished == transferCount) && (finished != 0)) { +- System.out.println( "All Transfers are completed"); +- System.exit(0); +- } +- if ((failed == transferCount) && (failed != 0)) { +- System.out.println( "All Transfers failed !"); +- System.exit(-1); +- } +- if ((failed + finished) == transferCount) { +- System.out.println( "Transfers Done"); +- System.exit(-1); +- } +- +- } +- +- +-} +- +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/BaseRFTClient.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/BaseRFTClient.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/BaseRFTClient.java (working copy) +@@ -1,417 +0,0 @@ +-/* +- * Portions of this file Copyright 1999-2005 University of Chicago +- * Portions of this file Copyright 1999-2005 The University of Southern California. +- * +- * This file or a portion of this file is licensed under the +- * terms of the Globus Toolkit Public License, found at +- * http://www.globus.org/toolkit/download/license.html. +- * If you redistribute this file, with or without +- * modifications, you must include this notice in the file. +- */ +-package org.globus.transfer.reliable.client; +- +-import java.net.URL; +-import java.security.cert.X509Certificate; +-import java.util.Calendar; +-import java.util.List; +-import java.util.Vector; +-import java.util.Map; +-import java.util.HashMap; +- +-import javax.xml.rpc.Stub; +- +-import org.globus.axis.util.Util; +- +-import org.apache.axis.message.addressing.EndpointReferenceType; +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.globus.delegation.DelegationConstants; +-import org.globus.delegation.DelegationUtil; +-import org.globus.gsi.GlobusCredential; +-import org.globus.wsrf.impl.security.util.AuthUtil; +-import org.globus.ogsa.impl.security.authorization.SelfAuthorization; +-import org.globus.rft.generated.BaseRequestType; +-import org.globus.rft.generated.CreateReliableFileTransferInputType; +-import org.globus.rft.generated.CreateReliableFileTransferOutputType; +-import org.globus.rft.generated.DeleteRequestType; +-import org.globus.rft.generated.OverallStatus; +-import org.globus.rft.generated.RFTFaultResourcePropertyType; +-import org.globus.rft.generated.ReliableFileTransferFactoryPortType; +-import org.globus.rft.generated.ReliableFileTransferPortType; +-import org.globus.rft.generated.TransferRequestType; +-import org.globus.rft.generated.service.ReliableFileTransferFactoryServiceAddressingLocator; +-import org.globus.rft.generated.service.ReliableFileTransferServiceAddressingLocator; +-import org.globus.transfer.reliable.client.utils.LogFileUtils; +-import org.globus.transfer.reliable.service.RFTConstants; +- +-import org.globus.wsrf.container.ServiceContainer; +-import org.globus.wsrf.NotificationConsumerManager; +-import org.globus.wsrf.NotifyCallback; +-import org.globus.wsrf.WSNConstants; +-import org.globus.wsrf.client.BaseClient; +-import org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType; +-import org.globus.wsrf.impl.security.authorization.Authorization; +-import org.globus.wsrf.impl.security.authorization.HostAuthorization; +-import org.globus.wsrf.impl.security.authorization.ResourcePDPConfig; +-import org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain; +-import org.globus.wsrf.impl.security.descriptor.GSISecureMsgAuthMethod; +-import org.globus.wsrf.impl.security.descriptor.GSISecureConvAuthMethod; +-import org.globus.wsrf.impl.security.descriptor.GSITransportAuthMethod; +-import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor; +-import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor; +-import org.globus.wsrf.security.Constants; +-import org.globus.wsrf.utils.AddressingUtils; +-import org.oasis.wsn.Subscribe; +-import org.oasis.wsn.TopicExpressionType; +-import org.oasis.wsrf.faults.BaseFaultType; +-import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType; +- +-/** +- * BaseClient for RFT service +- */ +-public class BaseRFTClient extends BaseClient implements NotifyCallback { +- private static Log logger = LogFactory.getLog(BaseRFTClient.class); +- public static ReliableFileTransferServiceAddressingLocator rftLocator = +- new ReliableFileTransferServiceAddressingLocator(); +- +- static final String SERVICE_URL_ROOT = "/wsrf/services/"; +- +- public static ReliableFileTransferFactoryServiceAddressingLocator +- rftFactoryLocator = +- new ReliableFileTransferFactoryServiceAddressingLocator(); +- +- private static ReliableFileTransferFactoryPortType factoryPort; +- +- private static NotificationConsumerManager consumer = null; +- +- public static int transferCount = 0; +- +- public static int finished = 0; +- +- public static int failed = 0; +- +- +- public static URL endpoint = null; +- +- public static String HOST = "127.0.0.1"; +- +- public static String PORT = null; +- +- public static String PROTOCOL = "http"; +- +- public static int TERM_TIME = 60; +- +- public static String PATH_TO_FILE = null; +- +- public static String AUTHZ = "host"; +- +- public static String cmd[]; +- +- public static String outFileName = null; +- +- public static Object authType = Constants.GSI_TRANSPORT; +- +- public static Object authVal = Constants.SIGNATURE; +- +- public static Authorization authzVal = HostAuthorization.getInstance(); +- +- public static String optionString = +- "rft [options] -f \n" +- + "Where options can be:\n" +- + "-h Defaults to 'localhost'.\n" +- + "-r Defaults to TCP port 8443.\n" +- + "-l lifetime of the created resource in minutes Defaults to 60 mins.\n" +- + "-m security mechanism Allowed values: 'msg' for secure messages, 'conv' for\n" +- + " secure conversation and 'trans' for secure transport. Defaults to \n" +- + " 'trans'.\n" +- + " -p protection type Allowed values: 'sig' for signature and 'enc' for encryption.\n" +- + " Defaults to 'sig'.\n" +- + " -z authorization Defaults to 'host' authorization. Allowed values: 'self' for\n" +- + " self authorization and 'host' for host authorization.\n" +- + " -file filename to write EPR of created Reliable" +- + " File Transfer Resource\n"; +- +- static { +- Util.registerTransport(); +- } +- +- +- public BaseRFTClient() { +- super(); +- } +- +- public static void parseArgs() { +- for(int i =0; i< cmd.length; i++) { +- if ((cmd[i].equals("--help")) || (cmd[i].equals("-help"))) { +- System.out.println( optionString ); +- System.exit(0); +- } else if(cmd[i].equals("-h")) { +- HOST = getValue(i); +- i++; +- } else if(cmd[i].equals("-r")) { +- PORT = getValue(i); +- i++; +- } else if(cmd[i].equals("-l")) { +- TERM_TIME = Integer.parseInt(getValue(i)); +- i++; +- } else if(cmd[i].equals("-z")) { +- AUTHZ = getValue(i); +- authzVal = AuthUtil.getClientAuthorization(AUTHZ); +- i++; +- } else if(cmd[i].equals("-m")) { +- String secType = getValue(i); +- if (secType.equals("msg")) { +- authType = Constants.GSI_SEC_MSG; +- } else if (secType.equals("conv")) { +- authType = Constants.GSI_SEC_CONV; +- } else if(secType.equals("trans")) { +- authType = Constants.GSI_TRANSPORT; +- } +- } else if (cmd[i].equals("-p")) { +- String prot = getValue(i); +- if (prot.equals("sig")) { +- authVal = Constants.SIGNATURE; +- } else if(prot.equals("enc")) { +- authVal = Constants.ENCRYPTION; +- } +- } else if (cmd[i].equals("-file")) { +- outFileName = getValue(i); +- } else if (cmd[i].equals("-f")) { +- PATH_TO_FILE = getValue(i); +- } +- } +- if (PATH_TO_FILE == null) { +- printUsage(); +- System.exit(-1); +- } +- } +- protected static String getValue(int i) { +- if (i + 1 > cmd.length) { +- System.err.println(cmd[i] + " needs a argument"); +- System.exit(-1); +- } +- return cmd[i+1]; +- } +- +- /** +- * @param request +- * @return rft epr +- * @exception Exception +- */ +- public static EndpointReferenceType createRFT(String rftFactoryAddress, +- BaseRequestType request) +- throws Exception { +- endpoint = new URL(rftFactoryAddress); +- factoryPort = rftFactoryLocator +- .getReliableFileTransferFactoryPortTypePort(endpoint); +- CreateReliableFileTransferInputType input = +- new CreateReliableFileTransferInputType(); +- //input.setTransferJob(transferType); +- if(request instanceof TransferRequestType) { +- input.setTransferRequest((TransferRequestType)request); +- } else { +- input.setDeleteRequest((DeleteRequestType)request); +- } +- Calendar termTime = Calendar.getInstance(); +- termTime.add(Calendar.HOUR, 1); +- input.setInitialTerminationTime(termTime); +- setSecurity((Stub)factoryPort); +- CreateReliableFileTransferOutputType response = factoryPort +- .createReliableFileTransfer(input); +- +- return response.getReliableTransferEPR(); +- } +- /** +- * Prints the usage +- */ +- public static void printUsage() { +- System.out.println(optionString); +- } +- /** +- * +- * @param topicPath +- * @param producer +- * @param message +- */ +- public void deliver(List topicPath, EndpointReferenceType producer, +- Object message) { +- ResourcePropertyValueChangeNotificationType changeMessage = +- ((ResourcePropertyValueChangeNotificationElementType) message) +- .getResourcePropertyValueChangeNotification(); +- BaseFaultType fault = null; +- try { +- +- if (changeMessage != null) { +- +- OverallStatus overallStatus = (OverallStatus) changeMessage +- .getNewValue().get_any()[0].getValueAsType( +- RFTConstants.OVERALL_STATUS_RESOURCE, +- OverallStatus.class); +- System.out.println("\n Overall status of transfer:"); +- System.out.println("Finished/Active/Failed/Retrying/Pending"); +- System.out.print(overallStatus.getTransfersFinished() + "/"); +- System.out.print(overallStatus.getTransfersActive() + "/"); +- System.out.print(overallStatus.getTransfersFailed() + "/"); +- System.out.print(overallStatus.getTransfersRestarted() + "/"); +- System.out.println(overallStatus.getTransfersPending()); +- if ( finished < overallStatus.getTransfersFinished()) { +- finished = overallStatus.getTransfersFinished(); +- } +- if (failed < overallStatus.getTransfersFailed()) { +- failed = overallStatus.getTransfersFailed(); +- } +- transferCount = overallStatus.getTransfersFinished() + overallStatus.getTransfersActive() +- + overallStatus.getTransfersFailed() + overallStatus.getTransfersRestarted() +- + overallStatus.getTransfersPending(); +- RFTFaultResourcePropertyType faultRP = overallStatus.getFault(); +- if(faultRP != null) { +- fault = getFaultFromRP(faultRP); +- } +- if (fault != null) { +- System.err.println("Error:" + fault.getDescription(0)); +- } +- +- } +- } catch (Exception e) { +- logger.debug(e.getMessage(), e); +- System.err.println(e.getMessage()); +- } +- } +- +- /** +- * @param host +- * @param port +- * @return +- * @throws Exception +- */ +- public static EndpointReferenceType +- delegateCredential(String host, String port) throws Exception { +- ClientSecurityDescriptor desc = getClientSecDesc(); +- // Credential to sign with, assuming default credential +- GlobusCredential credential = GlobusCredential.getDefaultCredential(); +- //desc.setGSITransport(Constants.GSI_TRANSPORT); +- //desc.setAuthz(AuthUtil.getClientAuthorization("self")); +- +- +- String factoryUrl = PROTOCOL + "://" + host + ":" +- + port + SERVICE_URL_ROOT +- + DelegationConstants.FACTORY_PATH; +- +- // lifetime in seconds +- int lifetime = TERM_TIME * 60; +- +- // Get the public key to delegate on. +- EndpointReferenceType delegEpr = AddressingUtils +- .createEndpointReference(factoryUrl, null); +- X509Certificate[] certsToDelegateOn = DelegationUtil +- .getCertificateChainRP(delegEpr, desc); +- X509Certificate certToSign = certsToDelegateOn[0]; +- +- // send to delegation service and get epr. +- // Authz set to null, so HostAuthz will be done. +- return DelegationUtil.delegate(factoryUrl, +- credential, certToSign, lifetime, false, +- desc); +- } +- +- public static void setSecurity(Stub stub) { +- stub._setProperty(Constants.CLIENT_DESCRIPTOR, +- getClientSecDesc()); +- } +- +- public static void +- subscribe(ReliableFileTransferPortType rft) +- throws Exception { +- Subscribe request = new Subscribe(); +- request.setUseNotify(Boolean.TRUE); +- if(PROTOCOL.equals("http")) { +- consumer = NotificationConsumerManager.getInstance(); +- } else if (PROTOCOL.equals("https")) { +- Map properties = new HashMap(); +- properties.put(ServiceContainer.CLASS, +- "org.globus.wsrf.container.GSIServiceContainer"); +- consumer = NotificationConsumerManager.getInstance(properties); +- } +- consumer.startListening(); +- EndpointReferenceType consumerEPR = null; +- ResourceSecurityDescriptor resDesc = new ResourceSecurityDescriptor(); +- Vector authMethod = new Vector(); +- if(AUTHZ.equalsIgnoreCase("host")) { +- ResourcePDPConfig pdpConfig = new ResourcePDPConfig("host"); +- pdpConfig.setProperty(Authorization.HOST_PREFIX, +- HostAuthorization.URL_PROPERTY,endpoint); +- ServiceAuthorizationChain authz = new ServiceAuthorizationChain(); +- authz.initialize(pdpConfig, "chainName", "someId"); +- resDesc.setAuthzChain(authz); +- } else if(AUTHZ.equalsIgnoreCase("self")) { +- resDesc.setAuthz("self"); +- } +- if (PROTOCOL.equals("http")) { +- if (authType.equals(Constants.GSI_SEC_MSG)) { +- authMethod.add(GSISecureMsgAuthMethod.BOTH); +- } else if (authType.equals(Constants.GSI_SEC_CONV)) { +- authMethod.add(GSISecureConvAuthMethod.BOTH); +- } +- } else if (PROTOCOL.equals("https")) { +- authMethod.add(GSITransportAuthMethod.BOTH); +- } +- resDesc.setAuthMethods(authMethod); +- consumerEPR = consumer.createNotificationConsumer( +- new BaseRFTClient(), resDesc); +- request.setConsumerReference(consumerEPR); +- TopicExpressionType topicExpression = new TopicExpressionType(); +- topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT); +- topicExpression.setValue(RFTConstants.OVERALL_STATUS_RESOURCE); +- request.setTopicExpression(topicExpression); +- +- rft.subscribe(request); +- } +- +- private BaseFaultType getFaultFromRP(RFTFaultResourcePropertyType faultRP) { +- if(faultRP.getRftAuthenticationFaultType() != null) { +- return faultRP.getRftAuthenticationFaultType(); +- } else if(faultRP.getRftAuthorizationFaultType() != null) { +- return faultRP.getRftAuthorizationFaultType(); +- } else if(faultRP.getRftDatabaseFaultType() != null) { +- return faultRP.getRftDatabaseFaultType(); +- } else if(faultRP.getRftRepeatedlyStartedFaultType() != null) { +- return faultRP.getRftRepeatedlyStartedFaultType(); +- } else if(faultRP.getRftTransferFaultType() != null) { +- return faultRP.getRftTransferFaultType(); +- } else if(faultRP.getTransferTransientFaultType() != null) { +- return faultRP.getTransferTransientFaultType(); +- } else { +- return null; +- } +- } +- +- public static void setAuthzValue(String authz) { +- if ("SELF".equals(authz)) { +- authzVal = HostAuthorization.getInstance(); +- } else if ("HOST".equals(authz)) { +- authzVal = HostAuthorization.getInstance(); +- } +- +- } +- +- public static ClientSecurityDescriptor getClientSecDesc() { +- ClientSecurityDescriptor desc = new ClientSecurityDescriptor(); +- if (authType.equals(Constants.GSI_SEC_MSG)) { +- desc.setGSISecureMsg((Integer)authVal); +- } else if (authType.equals(Constants.GSI_SEC_CONV)) { +- desc.setGSISecureConv((Integer)authVal); +- } else if (authType.equals(Constants.GSI_TRANSPORT)) { +- desc.setGSITransport((Integer)authVal); +- Util.registerTransport(); +- } +- desc.setAuthz(authzVal); +- return desc; +- } +- +- public static ReliableFileTransferFactoryPortType +- getFactoryPort(String rftFactoryAddress) throws Exception { +- endpoint = new URL(rftFactoryAddress); +- return rftFactoryLocator.getReliableFileTransferFactoryPortTypePort(endpoint); +- } +- +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTJob.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTJob.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTJob.java (working copy) +@@ -1,36 +0,0 @@ +-/* +- * To change this template, choose Tools | Templates +- * and open the template in the editor. +- */ +- +-package org.globus.transfer.reliable.client; +- +-/** +- * Application level job object, encapsules parameters and options related to a RFT transfer, +- * each job has a unique jobID, which is an incremental integer +- * @author Liu Wantao liuwt at uchicago.edu +- */ +-public class RFTJob { +- private int jobID = 0; +- private RFTOptions options; +- private RFTTransferParam param; +- +- public RFTJob(int jobID, RFTOptions options, RFTTransferParam param) { +- this.jobID = jobID; +- this.options = options; +- this.param = param; +- } +- +- public int getJobID() { +- return jobID; +- } +- +- public RFTOptions getOptions() { +- return options; +- } +- +- public RFTTransferParam getParam() { +- return param; +- } +- +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptionsPanel.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptionsPanel.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptionsPanel.java (working copy) +@@ -1,195 +0,0 @@ +-package org.globus.transfer.reliable.client; +- +-import java.awt.event.ItemEvent; +-import java.awt.event.ItemListener; +-import javax.swing.JFrame; +- +-public class RFTOptionsPanel extends javax.swing.JPanel implements ItemListener { +- +- /** Creates new form RFTOptions */ +- public RFTOptionsPanel() { +- initComponents(); +- } +- +- /** This method is called from within the constructor to +- * initialize the form. +- * WARNING: Do NOT modify this code. The content of this method is +- * always regenerated by the Form Editor. +- */ +- // //GEN-BEGIN:initComponents +- private void initComponents() { +- jLabel3 = new javax.swing.JLabel(); +- tcpBufferSize = new javax.swing.JTextField(); +- jLabel4 = new javax.swing.JLabel(); +- jLabel5 = new javax.swing.JLabel(); +- jLabel7 = new javax.swing.JLabel(); +- parallelStream = new javax.swing.JTextField(); +- jLabel9 = new javax.swing.JLabel(); +- concurrent = new javax.swing.JTextField(); +- jLabel10 = new javax.swing.JLabel(); +- sourceSN = new javax.swing.JTextField(); +- jLabel11 = new javax.swing.JLabel(); +- destSN = new javax.swing.JTextField(); +- +- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(RFTOptionsPanel.class); +- setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("Form.border.title"))); // NOI18N +- setName("Form"); // NOI18N +- +- jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N +- jLabel3.setName("jLabel3"); // NOI18N +- +- tcpBufferSize.setText(resourceMap.getString("tcpBufferSize.text")); // NOI18N +- tcpBufferSize.setName("tcpBufferSize"); // NOI18N +- +- jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N +- jLabel4.setName("jLabel4"); // NOI18N +- +- jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N +- jLabel5.setName("jLabel5"); // NOI18N +- +- +- jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N +- jLabel7.setName("jLabel7"); // NOI18N +- +- parallelStream.setText(resourceMap.getString("parallelStream.text")); // NOI18N +- parallelStream.setName("parallelStream"); // NOI18N +- +- jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N +- jLabel9.setName("jLabel9"); // NOI18N +- +- concurrent.setText(resourceMap.getString("concurrent.text")); // NOI18N +- concurrent.setName("concurrent"); // NOI18N +- +- jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N +- jLabel10.setName("jLabel10"); // NOI18N +- +- sourceSN.setText(resourceMap.getString("sourceSN.text")); // NOI18N +- sourceSN.setName("sourceSN"); // NOI18N +- +- jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N +- jLabel11.setName("jLabel11"); // NOI18N +- +- destSN.setText(resourceMap.getString("destSN.text")); // NOI18N +- destSN.setName("destSN"); // NOI18N +- +- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); +- this.setLayout(layout); +- +- layout.setHorizontalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .addContainerGap() +- .add(64, 64, 64) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(jLabel7) +- .add(jLabel3)) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) +- .add(parallelStream, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE) +- .add(tcpBufferSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, Short.MAX_VALUE)) +- +- ) +- )) +- ); +- layout.setVerticalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .add(26, 26, 26) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(jLabel7) +- .add(parallelStream, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) +- +- ) +- .add(11, 11, 11) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(jLabel3) +- .add(tcpBufferSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) +- ) +- ) +- ) +- ); +- +- }// //GEN-END:initComponents +- +- +- +- public boolean getAllOrNone() { +- return isAllorNone; +- } +- +- public boolean getBinary() { +- return isBinary; +- } +- +- public boolean getDCAU() { +- return isDCAU; +- } +- +- public String getDestSN() { +- return destSN.getText(); +- } +- +- public boolean getNoTpt() { +- return isNoTpt; +- } +- +- public int getParallelStream() { +- String value = parallelStream.getText(); +- int ret = 1; +- if (null != value) { +- try { +- ret = Integer.valueOf(value); +- } catch (NumberFormatException e) { +- ret = 1; +- } +- } +- +- return ret; +- } +- +- public String getSourceSN() { +- return sourceSN.getText(); +- } +- +- public int getTcpBufferSize() { +- String value = tcpBufferSize.getText(); +- int ret = 16000; +- if (null != value) { +- try { +- ret = Integer.valueOf(value); +- } catch (NumberFormatException e) { +- ret = 16000; +- } +- } +- +- return ret; +- } +- +- public static void main(String[] args) { +- JFrame f = new JFrame(); +- f.getContentPane().add(new RFTOptionsPanel()); +- f.setVisible(true); +- } +- // Variables declaration - do not modify//GEN-BEGIN:variables +- private javax.swing.JTextField concurrent; +- private javax.swing.JTextField destSN; +- private javax.swing.JLabel jLabel10; +- private javax.swing.JLabel jLabel11; +- private javax.swing.JLabel jLabel3; +- private javax.swing.JLabel jLabel4; +- private javax.swing.JLabel jLabel5; +- private javax.swing.JLabel jLabel7; +- private javax.swing.JLabel jLabel9; +- private javax.swing.JTextField parallelStream; +- private javax.swing.JTextField sourceSN; +- private javax.swing.JTextField tcpBufferSize; +- private boolean isBinary = true; +- private boolean isNoTpt = false; +- private boolean isDCAU = true; +- private boolean isAllorNone = false; +- +- public void itemStateChanged(ItemEvent e) { +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTOptionsPanel.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTOptionsPanel.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTOptionsPanel.properties (working copy) +@@ -1,28 +0,0 @@ +-# To change this template, choose Tools | Templates +-# and open the template in the editor. +- +-Form.border.title=Optimization Parameter +-jLabel1.text=Binary +-jLabel2.text=BlockSize +-jLabel3.text=TCP Buffer Size +-jLabel4.text=Bytes +-jLabel5.text=Bytes +-jLabel6.text=Notpt +-jLabel7.text=Parallel TCP Streams +-jLabel8.text=DCAU +-jLabel9.text=Concurrency +-jLabel10.text=Source Subject +-jLabel11.text=Destination Subject +-jLabel12.text=All or None +-jLabel13.text=Max Attempts +-binary.text= +-blockSize.text=16000 +-tcpBufferSize.text=16000 +-noTpt.text= +-dCAU.text= +-parallelStream.text=1 +-concurrent.text=1 +-sourceSN.text=null +-destSN.text=null +-allOrNone.text= +-maxAttempts.text=10 +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/window_new_gridftp.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/LocalFileSystemView.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/LocalFileSystemView.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/LocalFileSystemView.properties (working copy) +@@ -1,2 +0,0 @@ +-Form.title=Local System +-jLabel1.text=jLabel1 +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIView.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIView.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIView.properties (working copy) +@@ -1,80 +0,0 @@ +-# Resources for the GridFTPGUIView class +- +-# top-level menus +- +-fileMenu.text = File +-helpMenu.text = Help +- +-# @Action resources +- +-showAboutBox.Action.text = &About... +-showAboutBox.Action.shortDescription = Show the application's information dialog +- +-# status bar resources +- +-StatusBar.messageTimeout = 5000 +-StatusBar.busyAnimationRate = 30 +-StatusBar.idleIcon = busyicons/idle-icon.png +-StatusBar.busyIcons[0] = busyicons/busy-icon0.png +-StatusBar.busyIcons[1] = busyicons/busy-icon1.png +-StatusBar.busyIcons[2] = busyicons/busy-icon2.png +-StatusBar.busyIcons[3] = busyicons/busy-icon3.png +-StatusBar.busyIcons[4] = busyicons/busy-icon4.png +-StatusBar.busyIcons[5] = busyicons/busy-icon5.png +-StatusBar.busyIcons[6] = busyicons/busy-icon6.png +-StatusBar.busyIcons[7] = busyicons/busy-icon7.png +-StatusBar.busyIcons[8] = busyicons/busy-icon8.png +-StatusBar.busyIcons[9] = busyicons/busy-icon9.png +-StatusBar.busyIcons[10] = busyicons/busy-icon10.png +-StatusBar.busyIcons[11] = busyicons/busy-icon11.png +-StatusBar.busyIcons[12] = busyicons/busy-icon12.png +-StatusBar.busyIcons[13] = busyicons/busy-icon13.png +-StatusBar.busyIcons[14] = busyicons/busy-icon14.png +-jMenu1.text=Connect +-jMenuItem1.text=GridFTP +-jMenuItem2.text=Local +-jMenu2.text=Security +-jMenu3.text=Log +-jMenuItem3.text=Create Grid Proxy +-jMenuItem4.text=Destroy Grid Proxy +-jMenuItem5.text=Grid Proxy Info +-jMenuItem6.text=Load +-jMenuItem7.text=Save +-jMenuItem11.text=Log Location +-jMenuItem12.text=Log Config +-#NOI18N +-local_button.icon=window_new.png +-local_button.text=Local +-#NOI18N +-jButton5.icon=rft.png +-jButton5.text=Advanced +-#NOI18N +- +-gridftp_button.icon=window_new_gridftp.png +-gridftp_button.toolTipText=Open remote directory +-gridftp_button.text=GridFTP +-#NOI18N +- +-jButton1.icon=unlock.png +-jButton1.toolTipText=Create a new credential +-jButton1.text=Generate Credential +-#NOI18N +-jButton7.icon=unlock.png +-jButton7.toolTipText=Obtain a credential from Myproxy +-jButton7.text=Obtain Credential +-#NOI18N +-jButton8.icon=unlock.png +-jButton8.toolTipText=setup a log file +-jButton8.text=Log Config +- +-credential_button.icon=unlock.png +-credential_button.toolTipText=create credential +-credential_button.text= Credential +-#NOI18N +-jDesktopPane1.background=236, 233, 216 +-jMenuItem8.text=FTP +-jMenuItem9.text=WebDAV +-jMenuItem10.text=RFT +-jButton4.text=FTP +-#NOI18N +-jButton4.icon=window_new_ftp.png +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTTransferParamPanel.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTTransferParamPanel.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTTransferParamPanel.properties (working copy) +@@ -1,16 +0,0 @@ +-# To change this template, choose Tools | Templates +-# and open the template in the editor. +- +-Form.border.title=Reliable File Transfer Service (RFT) Parameters +-jLabel1.text=Service Host +-serverHostField.text= +-jLabel2.text=Service Port +-serverPortField.text= +-jLabel3.text=From +-fromField.text= +-jLabel4.text=To +-toField.text= +-jLabel5.text=AuthType +-jLabel6.text=AuthzType +-concurrencyLabel.text=Concurrency +-concurrencyField.text= +\ No newline at end of file +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/about.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIApp.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIApp.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIApp.properties (working copy) +@@ -1,11 +0,0 @@ +-# Application global resources +- +-Application.name = GridFTP GUI +-Application.title = GridFTP GUI +-Application.version = 1.0.1 +-Application.vendor = Globus Toolkit +-Application.homepage = http://www.globus.org +-Application.description = A simple GUI interface for GridFTP +-Application.vendorId = Globus +-Application.id = Globus +-Application.lookAndFeel = default +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/about-small.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIAboutBox.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIAboutBox.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIAboutBox.properties (working copy) +@@ -1,13 +0,0 @@ +-title = About: ${Application.title} ${Application.version} +- +-closeAboutBox.Action.text = &Close +- +-appDescLabel.text=A GUI Client for GridFTP +- +-versionLabel.text=Version: +- +-vendorLabel.text=Vendor\: +- +-homepageLabel.text=Homepage\: +-#NOI18N +-imageLabel.icon=about-small.png +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/window_new.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/window_globus.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTPanel.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTPanel.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTPanel.properties (working copy) +@@ -1,16 +0,0 @@ +-startButton.text=Start +-stopButton.text=Stop +-restartButton.text=OK +-jLabel1.text=Finished +-jLabel3.text=Active +-jLabel5.text=Failed +-jLabel7.text=Restared +-jLabel9.text=Pending +-jLabel11.text=Cancelled +-jPanel1.border.title=Overall Status +-finishedField.text=0 +-activeField.text=0 +-failedField.text=0 +-restartedField.text=0 +-pendingField.text=0 +-cancelledField.text=0 +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJFrame.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJFrame.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJFrame.properties (working copy) +@@ -1 +0,0 @@ +-jButton1.text=aaaaa +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/window_new_ftp.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/splash.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon4.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon5.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon6.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon7.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon8.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon9.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/idle-icon.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon10.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon11.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon12.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon13.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon14.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon0.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon1.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon2.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon3.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/unlock.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/rft.png +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJDialog.properties +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJDialog.properties (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJDialog.properties (working copy) +@@ -1,5 +0,0 @@ +-# To change this template, choose Tools | Templates +-# and open the template in the editor. +- +-jButton1.text=jButton1 +-jButton2.text=jButton2 +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogon.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogon.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogon.java (working copy) +@@ -1,954 +0,0 @@ +-/* +- * Copyright 2007 The Board of Trustees of the University of Illinois. +- * All rights reserved. +- * +- * Developed by: +- * +- * MyProxy Team +- * National Center for Supercomputing Applications +- * University of Illinois +- * http://myproxy.ncsa.uiuc.edu/ +- * +- * Permission is hereby granted, free of charge, to any person obtaining +- * a copy of this software and associated documentation files (the +- * "Software"), to deal with the Software without restriction, including +- * without limitation the rights to use, copy, modify, merge, publish, +- * distribute, sublicense, and/or sell copies of the Software, and to +- * permit persons to whom the Software is furnished to do so, subject to +- * the following conditions: +- * +- * Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimers. +- * +- * Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimers in the +- * documentation and/or other materials provided with the distribution. +- * +- * Neither the names of the National Center for Supercomputing +- * Applications, the University of Illinois, nor the names of its +- * contributors may be used to endorse or promote products derived from +- * this Software without specific prior written permission. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +- * IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR +- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. +- */ +-package org.globus.transfer.reliable.client.credential.myproxy; +- +-import java.io.BufferedInputStream; +-import java.io.BufferedOutputStream; +-import java.io.BufferedReader; +-import java.io.ByteArrayInputStream; +-import java.io.ByteArrayOutputStream; +-import java.io.EOFException; +-import java.io.File; +-import java.io.FileInputStream; +-import java.io.FileOutputStream; +-import java.io.IOException; +-import java.io.InputStream; +-import java.io.InputStreamReader; +-import java.io.PrintStream; +-import java.net.InetAddress; +-import java.net.ProtocolException; +-import java.security.GeneralSecurityException; +-import java.security.KeyPair; +-import java.security.KeyPairGenerator; +-import java.security.PrivateKey; +-import java.security.cert.CertPath; +-import java.security.cert.CertPathValidator; +-import java.security.cert.CertificateEncodingException; +-import java.security.cert.CertificateException; +-import java.security.cert.CertificateFactory; +-import java.security.cert.PKIXParameters; +-import java.security.cert.TrustAnchor; +-import java.security.cert.X509CRL; +-import java.security.cert.X509Certificate; +-import java.util.ArrayList; +-import java.util.Arrays; +-import java.util.Collection; +-import java.util.HashSet; +-import java.util.Iterator; +-import java.util.Set; +-import java.util.logging.Level; +-import java.util.logging.Logger; +- +-import javax.net.ssl.SSLContext; +-import javax.net.ssl.SSLSocket; +-import javax.net.ssl.SSLSocketFactory; +-import javax.net.ssl.TrustManager; +-import javax.net.ssl.X509TrustManager; +-import javax.security.auth.login.FailedLoginException; +-import javax.security.auth.x500.X500Principal; +- +-import org.bouncycastle.asn1.ASN1InputStream; +-import org.bouncycastle.asn1.ASN1Sequence; +-import org.bouncycastle.asn1.DERObject; +-import org.bouncycastle.asn1.DEROutputStream; +-import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; +-import org.bouncycastle.jce.PKCS10CertificationRequest; +-import org.bouncycastle.util.encoders.Base64; +- +-/** +- * The MyProxyLogon class provides an interface for retrieving credentials from +- * a MyProxy server. +- *

+- * First, use setHost, setPort, +- * setUsername, setPassphrase, +- * setCredentialName, setLifetime and +- * requestTrustRoots to configure. Then call connect, +- * logon, getCredentials, then +- * disconnect. Use getCertificates and +- * getPrivateKey to access the retrieved credentials, or +- * writeProxyFile or saveCredentialsToFile to +- * write them to a file. Use writeTrustRoots, +- * getTrustedCAs, getCRLs, +- * getTrustRootData, and getTrustRootFilenames +- * for trust root information. +- * @version 1.0 +- * @see MyProxy Project Home Page +- */ +-public class MyProxyLogon { +- static Logger logger = Logger.getLogger(MyProxyLogon.class.getName()); +- public final static String version = "1.0"; +- public final static String BouncyCastleLicense = org.bouncycastle.LICENSE.licenseText; +- +- protected enum State { +- READY, CONNECTED, LOGGEDON, DONE +- } +- +- private class MyTrustManager implements X509TrustManager { +- public X509Certificate[] getAcceptedIssuers() { +- X509Certificate[] issuers = null; +- String certDirPath = MyProxyLogon.getExistingTrustRootPath(); +- if (certDirPath == null) { +- return null; +- } +- File dir = new File(certDirPath); +- if (!dir.isDirectory()) { +- return null; +- } +- String[] certFilenames = dir.list(); +- String[] certData = new String[certFilenames.length]; +- for (int i = 0; i < certFilenames.length; i++) { +- try { +- FileInputStream fileStream = new FileInputStream( +- certDirPath + File.separator + certFilenames[i]); +- byte[] buffer = new byte[fileStream.available()]; +- fileStream.read(buffer); +- certData[i] = new String(buffer); +- } catch (Exception e) { +- // ignore +- } +- } +- try { +- issuers = getX509CertsFromStringList(certData, certFilenames); +- } catch (Exception e) { +- // ignore +- } +- return issuers; +- } +- +- public void checkClientTrusted(X509Certificate[] certs, String authType) +- throws CertificateException { +- throw new CertificateException( +- "checkClientTrusted not implemented by edu.uiuc.ncsa.MyProxy.MyProxyLogon.MyTrustManager"); +- } +- +- public void checkServerTrusted(X509Certificate[] certs, String authType) +- throws CertificateException { +- checkServerCertPath(certs); +- checkServerDN(certs[0]); +- } +- +- private void checkServerCertPath(X509Certificate[] certs) +- throws CertificateException { +- try { +- CertPathValidator validator = CertPathValidator +- .getInstance(CertPathValidator.getDefaultType()); +- CertificateFactory certFactory = CertificateFactory +- .getInstance("X.509"); +- CertPath certPath = certFactory.generateCertPath(Arrays +- .asList(certs)); +- X509Certificate[] acceptedIssuers = getAcceptedIssuers(); +- if (acceptedIssuers == null) { +- String certDir = MyProxyLogon.getExistingTrustRootPath(); +- if (certDir != null) { +- throw new CertificateException( +- "no CA certificates found in " + certDir); +- } else if (!requestTrustRoots) { +- throw new CertificateException( +- "no CA certificates directory found"); +- } +- logger +- .info("no trusted CAs configured -- bootstrapping trust from MyProxy server"); +- acceptedIssuers = new X509Certificate[1]; +- acceptedIssuers[0] = certs[certs.length - 1]; +- } +- Set trustAnchors = new HashSet( +- acceptedIssuers.length); +- for (int i = 0; i < acceptedIssuers.length; i++) { +- TrustAnchor ta = new TrustAnchor(acceptedIssuers[i], null); +- trustAnchors.add(ta); +- } +- PKIXParameters pkixParameters = new PKIXParameters(trustAnchors); +- pkixParameters.setRevocationEnabled(false); +- validator.validate(certPath, pkixParameters); +- } catch (CertificateException e) { +- throw e; +- } catch (GeneralSecurityException e) { +- throw new CertificateException(e); +- } +- } +- +- private void checkServerDN(X509Certificate cert) +- throws CertificateException { +- String subject = cert.getSubjectX500Principal().getName(); +- logger.fine("MyProxy server DN: " + subject); +- int index = subject.indexOf("CN="); +- if (index == -1) { +- throw new CertificateException("Server certificate subject (" +- + subject + "does not contain a CN component."); +- } +- String CN = subject.substring(index + 3); +- index = CN.indexOf(','); +- if (index >= 0) { +- CN = CN.substring(0, index); +- } +- if ((index = CN.indexOf('/')) >= 0) { +- String service = CN.substring(0, index); +- CN = CN.substring(index + 1); +- if (!service.equals("host") && !service.equals("myproxy")) { +- throw new CertificateException( +- "Server certificate subject CN contains unknown service element: " +- + subject); +- } +- } +- String myHostname = host; +- if (myHostname.equals("localhost")) { +- try { +- myHostname = InetAddress.getLocalHost().getHostName(); +- } catch (Exception e) { +- // ignore +- } +- } +- if (!CN.equals(myHostname)) { +- throw new CertificateException( +- "Server certificate subject CN (" + CN +- + ") does not match server hostname (" + host +- + ")."); +- } +- } +- } +- +- private final static int b64linelen = 64; +- private final static String X509_USER_PROXY_FILE = "x509up_u"; +- private final static String VERSION = "VERSION=MYPROXYv2"; +- private final static String GETCOMMAND = "COMMAND=0"; +- private final static String TRUSTROOTS = "TRUSTED_CERTS="; +- private final static String USERNAME = "USERNAME="; +- private final static String PASSPHRASE = "PASSPHRASE="; +- private final static String LIFETIME = "LIFETIME="; +- private final static String CREDNAME = "CRED_NAME="; +- private final static String RESPONSE = "RESPONSE="; +- private final static String ERROR = "ERROR="; +- private final static String DN = "CN=ignore"; +- private final static String TRUSTED_CERT_PATH = "/.globus/certificates"; +- +- protected final static int keySize = 1024; +- protected final int MIN_PASS_PHRASE_LEN = 6; +- protected final static String keyAlg = "RSA"; +- protected final static String pkcs10SigAlgName = "SHA1withRSA"; +- protected final static String pkcs10Provider = "SunRsaSign"; +- protected State state = State.READY; +- protected String host = "localhost"; +- protected String username; +- protected String credname; +- protected String passphrase; +- protected int port = 7512; +- protected int lifetime = 43200; +- protected boolean requestTrustRoots = false; +- protected SSLSocket socket; +- protected BufferedInputStream socketIn; +- protected BufferedOutputStream socketOut; +- protected KeyPair keypair; +- protected Collection certificateChain; +- protected String[] trustrootFilenames; +- protected String[] trustrootData; +- +- /** +- * Constructs a MyProxyLogon object. +- */ +- public MyProxyLogon() { +- super(); +- host = System.getenv("MYPROXY_SERVER"); +- if (host == null) { +- host = "localhost"; +- } +- String portString = System.getenv("MYPROXY_SERVER_PORT"); +- if (portString != null) { +- port = Integer.parseInt(portString); +- } +- username = System.getProperty("user.name"); +- } +- +- /** +- * Gets the hostname of the MyProxy server. +- * @return MyProxy server hostname +- */ +- public String getHost() { +- return this.host; +- } +- +- /** +- * Sets the hostname of the MyProxy server. Defaults to localhost. +- * @param host +- * MyProxy server hostname +- */ +- public void setHost(String host) { +- this.host = host; +- } +- +- /** +- * Gets the port of the MyProxy server. +- * @return MyProxy server port +- */ +- public int getPort() { +- return this.port; +- } +- +- /** +- * Sets the port of the MyProxy server. Defaults to 7512. +- * @param port +- * MyProxy server port +- */ +- public void setPort(int port) { +- this.port = port; +- } +- +- /** +- * Gets the MyProxy username. +- * @return MyProxy server port +- */ +- public String getUsername() { +- return this.username; +- } +- +- /** +- * Sets the MyProxy username. Defaults to user.name. +- * @param username +- * MyProxy username +- */ +- public void setUsername(String username) { +- this.username = username; +- } +- +- /** +- * Gets the optional MyProxy credential name. +- * @return credential name +- */ +- public String getCredentialName() { +- return this.credname; +- } +- +- /** +- * Sets the optional MyProxy credential name. +- * @param credname +- * credential name +- */ +- public void setCredentialName(String credname) { +- this.credname = credname; +- } +- +- /** +- * Sets the MyProxy passphrase. +- * @param passphrase +- * MyProxy passphrase +- */ +- public void setPassphrase(String passphrase) { +- this.passphrase = passphrase; +- } +- +- /** +- * Gets the requested credential lifetime. +- * @return Credential lifetime +- */ +- public int getLifetime() { +- return this.lifetime; +- } +- +- /** +- * Sets the requested credential lifetime. Defaults to 43200 seconds (12 +- * hours). +- * @param seconds +- * Credential lifetime +- */ +- public void setLifetime(int seconds) { +- this.lifetime = seconds; +- } +- +- /** +- * Gets the certificates returned from the MyProxy server by +- * getCredentials(). +- * @return Collection of java.security.cert.Certificate objects +- */ +- public Collection getCertificates() { +- return this.certificateChain; +- } +- +- /** +- * Gets the private key generated by getCredentials(). +- * @return PrivateKey +- */ +- public PrivateKey getPrivateKey() { +- return this.keypair.getPrivate(); +- } +- +- /** +- * Sets whether to request trust roots (CA certificates, CRLs, signing +- * policy files) from the MyProxy server. Defaults to false (i.e., not +- * to request trust roots). +- * @param flag +- * If true, request trust roots. If false, don't request trust +- * roots. +- */ +- public void requestTrustRoots(boolean flag) { +- this.requestTrustRoots = flag; +- } +- +- /** +- * Gets trust root filenames. +- * @return trust root filenames +- */ +- public String[] getTrustRootFilenames() { +- return this.trustrootFilenames; +- } +- +- /** +- * Gets trust root data corresponding to the trust root filenames. +- * @return trust root data +- */ +- public String[] getTrustRootData() { +- return this.trustrootData; +- } +- +- /** +- * Connects to the MyProxy server at the desired host and port. Requires +- * host authentication via SSL. The host's certificate subject must +- * match the requested hostname. If CA certificates are found in the +- * standard GSI locations, they will be used to verify the server's +- * certificate. If trust roots are requested and no CA certificates are +- * found, the server's certificate will still be accepted. +- */ +- public void connect() throws IOException, GeneralSecurityException { +- SSLContext sc = SSLContext.getInstance("SSL"); +- TrustManager[] trustAllCerts = new TrustManager[] { new MyTrustManager() }; +- sc.init(null, trustAllCerts, new java.security.SecureRandom()); +- SSLSocketFactory sf = sc.getSocketFactory(); +- this.socket = (SSLSocket) sf.createSocket(this.host, this.port); +- this.socket.setEnabledProtocols(new String[] { "SSLv3" }); +- this.socket.startHandshake(); +- this.socketIn = new BufferedInputStream(this.socket.getInputStream()); +- this.socketOut = new BufferedOutputStream(this.socket.getOutputStream()); +- this.state = State.CONNECTED; +- } +- +- /** +- * Disconnects from the MyProxy server. +- */ +- public void disconnect() throws IOException { +- this.socket.close(); +- this.socket = null; +- this.socketIn = null; +- this.socketOut = null; +- this.state = State.READY; +- } +- +- /** +- * Logs on to the MyProxy server by issuing the MyProxy GET command. +- */ +- public void logon() throws IOException, GeneralSecurityException { +- String line; +- char response; +- +- if (this.state != State.CONNECTED) { +- this.connect(); +- } +- +- this.socketOut.write('0'); +- this.socketOut.flush(); +- this.socketOut.write(VERSION.getBytes()); +- this.socketOut.write('\n'); +- this.socketOut.write(GETCOMMAND.getBytes()); +- this.socketOut.write('\n'); +- this.socketOut.write(USERNAME.getBytes()); +- this.socketOut.write(this.username.getBytes()); +- this.socketOut.write('\n'); +- this.socketOut.write(PASSPHRASE.getBytes()); +- this.socketOut.write(this.passphrase.getBytes()); +- this.socketOut.write('\n'); +- this.socketOut.write(LIFETIME.getBytes()); +- this.socketOut.write(Integer.toString(this.lifetime).getBytes()); +- this.socketOut.write('\n'); +- if (this.credname != null) { +- this.socketOut.write(CREDNAME.getBytes()); +- this.socketOut.write(this.credname.getBytes()); +- this.socketOut.write('\n'); +- } +- if (this.requestTrustRoots) { +- this.socketOut.write(TRUSTROOTS.getBytes()); +- this.socketOut.write("1\n".getBytes()); +- } +- this.socketOut.flush(); +- +- line = readLine(this.socketIn); +- if (line == null) { +- throw new EOFException(); +- } +- if (!line.equals(VERSION)) { +- throw new ProtocolException("bad MyProxy protocol VERSION string: " +- + line); +- } +- line = readLine(this.socketIn); +- if (line == null) { +- throw new EOFException(); +- } +- if (!line.startsWith(RESPONSE) +- || line.length() != RESPONSE.length() + 1) { +- throw new ProtocolException( +- "bad MyProxy protocol RESPONSE string: " + line); +- } +- response = line.charAt(RESPONSE.length()); +- if (response == '1') { +- StringBuffer errString; +- +- errString = new StringBuffer("MyProxy logon failed"); +- while ((line = readLine(this.socketIn)) != null) { +- if (line.startsWith(ERROR)) { +- errString.append('\n'); +- errString.append(line.substring(ERROR.length())); +- } +- } +- throw new FailedLoginException(errString.toString()); +- } else if (response == '2') { +- throw new ProtocolException( +- "MyProxy authorization RESPONSE not implemented"); +- } else if (response != '0') { +- throw new ProtocolException( +- "unknown MyProxy protocol RESPONSE string: " + line); +- } +- while ((line = readLine(this.socketIn)) != null) { +- if (line.startsWith(TRUSTROOTS)) { +- String filenameList = line.substring(TRUSTROOTS.length()); +- this.trustrootFilenames = filenameList.split(","); +- this.trustrootData = new String[this.trustrootFilenames.length]; +- for (int i = 0; i < this.trustrootFilenames.length; i++) { +- String lineStart = "FILEDATA_" + this.trustrootFilenames[i] +- + "="; +- line = readLine(this.socketIn); +- if (line == null) { +- throw new EOFException(); +- } +- if (!line.startsWith(lineStart)) { +- throw new ProtocolException( +- "bad MyProxy protocol RESPONSE: expecting " +- + lineStart + " but received " + line); +- } +- this.trustrootData[i] = new String(Base64.decode(line +- .substring(lineStart.length()))); +- } +- } +- } +- this.state = State.LOGGEDON; +- } +- +- /** +- * Retrieves credentials from the MyProxy server. +- */ +- public void getCredentials() throws IOException, GeneralSecurityException { +- int numCertificates; +- KeyPairGenerator keyGenerator; +- PKCS10CertificationRequest pkcs10; +- CertificateFactory certFactory; +- +- if (this.state != State.LOGGEDON) { +- this.logon(); +- } +- +- keyGenerator = KeyPairGenerator.getInstance(keyAlg); +- keyGenerator.initialize(keySize); +- this.keypair = keyGenerator.genKeyPair(); +- pkcs10 = new PKCS10CertificationRequest(pkcs10SigAlgName, +- new X500Principal(DN), this.keypair.getPublic(), null, +- this.keypair.getPrivate(), pkcs10Provider); +- this.socketOut.write(pkcs10.getEncoded()); +- this.socketOut.flush(); +- numCertificates = this.socketIn.read(); +- if (numCertificates == -1) { +- System.err.println("connection aborted"); +- System.exit(1); +- } else if (numCertificates == 0 || numCertificates < 0) { +- System.err.print("bad number of certificates sent by server: "); +- System.err.println(Integer.toString(numCertificates)); +- System.exit(1); +- } +- certFactory = CertificateFactory.getInstance("X.509"); +- this.certificateChain = certFactory.generateCertificates(this.socketIn); +- this.state = State.DONE; +- } +- +- /** +- * Writes the retrieved credentials to the Globus proxy file location. +- */ +- public void writeProxyFile() throws IOException, GeneralSecurityException { +- saveCredentialsToFile(getProxyLocation()); +- } +- +- /** +- * Writes the retrieved credentials to the specified filename. +- */ +- public void saveCredentialsToFile(String filename) throws IOException, +- GeneralSecurityException { +- Iterator iter; +- X509Certificate certificate; +- PrintStream printStream; +- +- iter = this.certificateChain.iterator(); +- certificate = (X509Certificate) iter.next(); +- File outFile = new File(filename); +- outFile.delete(); +- outFile.createNewFile(); +- setFilePermissions(filename, "0600"); +- printStream = new PrintStream(new FileOutputStream(outFile)); +- printCert(certificate, printStream); +- printKey(keypair.getPrivate(), printStream); +- while (iter.hasNext()) { +- certificate = (X509Certificate) iter.next(); +- printCert(certificate, printStream); +- } +- } +- +- /** +- * Writes the retrieved trust roots to the Globus trusted certificates +- * directory. +- * @return true if trust roots are written successfully, false if no +- * trust roots are available to be written +- */ +- public boolean writeTrustRoots() throws IOException { +- return writeTrustRoots(getTrustRootPath()); +- } +- +- /** +- * Writes the retrieved trust roots to a trusted certificates directory. +- * @param directory +- * path where the trust roots should be written +- * @return true if trust roots are written successfully, false if no +- * trust roots are available to be written +- */ +- public boolean writeTrustRoots(String directory) throws IOException { +- if (this.trustrootFilenames == null || this.trustrootData == null) { +- return false; +- } +- File rootDir = new File(directory); +- if (!rootDir.exists()) { +- rootDir.mkdirs(); +- } +- for (int i = 0; i < trustrootFilenames.length; i++) { +- FileOutputStream out = new FileOutputStream(directory +- + File.separator + this.trustrootFilenames[i]); +- out.write(this.trustrootData[i].getBytes()); +- out.close(); +- } +- return true; +- } +- +- /** +- * Gets the trusted CA certificates returned by the MyProxy server. +- * @return trusted CA certificates, or null if none available +- */ +- public X509Certificate[] getTrustedCAs() throws CertificateException { +- if (trustrootData == null) +- return null; +- return getX509CertsFromStringList(trustrootData, trustrootFilenames); +- } +- +- private static X509Certificate[] getX509CertsFromStringList( +- String[] certList, String[] nameList) throws CertificateException { +- CertificateFactory certFactory = CertificateFactory +- .getInstance("X.509"); +- Collection c = new ArrayList( +- certList.length); +- for (int i = 0; i < certList.length; i++) { +- int index = -1; +- String certData = certList[i]; +- if (certData != null) { +- index = certData.indexOf("-----BEGIN CERTIFICATE-----"); +- } +- if (index >= 0) { +- certData = certData.substring(index); +- ByteArrayInputStream inputStream = new ByteArrayInputStream( +- certData.getBytes()); +- try { +- X509Certificate cert = (X509Certificate) certFactory +- .generateCertificate(inputStream); +- c.add(cert); +- } catch (Exception e) { +- if (nameList != null) { +- logger.warning(nameList[i] +- + " can not be parsed as an X509Certificate."); +- } else { +- logger.warning("failed to parse an X509Certificate"); +- } +- } +- } +- } +- if (c.isEmpty()) +- return null; +- return c.toArray(new X509Certificate[0]); +- } +- +- /** +- * Gets the CRLs returned by the MyProxy server. +- * @return CRLs or null if none available +- */ +- public X509CRL[] getCRLs() throws CertificateException { +- if (trustrootData == null) +- return null; +- CertificateFactory certFactory = CertificateFactory +- .getInstance("X.509"); +- Collection c = new ArrayList(trustrootData.length); +- for (int i = 0; i < trustrootData.length; i++) { +- String crlData = trustrootData[i]; +- int index = crlData.indexOf("-----BEGIN X509 CRL-----"); +- if (index >= 0) { +- crlData = crlData.substring(index); +- ByteArrayInputStream inputStream = new ByteArrayInputStream( +- crlData.getBytes()); +- try { +- X509CRL crl = (X509CRL) certFactory +- .generateCRL(inputStream); +- c.add(crl); +- } catch (Exception e) { +- logger.warning(this.trustrootFilenames[i] +- + " can not be parsed as an X509CRL."); +- } +- } +- } +- if (c.isEmpty()) +- return null; +- return c.toArray(new X509CRL[0]); +- } +- +- /** +- * Returns the trusted certificates directory location where +- * writeTrustRoots() will store certificates. +- */ +- public static String getTrustRootPath() { +- String path; +- +- path = System.getenv("X509_CERT_DIR"); +- if (path == null) { +- path = System.getProperty("X509_CERT_DIR"); +- } +- if (path == null) { +- path = System.getProperty("user.home") + TRUSTED_CERT_PATH; +- } +- return path; +- } +- +- /** +- * Gets the existing trusted CA certificates directory. +- * @return directory path string or null if none found +- */ +- public static String getExistingTrustRootPath() { +- String path, GL; +- +- GL = System.getenv("GLOBUS_LOCATION"); +- if (GL == null) { +- GL = System.getProperty("GLOBUS_LOCATION"); +- } +- +- path = System.getenv("X509_CERT_DIR"); +- if (path == null) { +- path = System.getProperty("X509_CERT_DIR"); +- } +- if (path == null) { +- path = getDir(System.getProperty("user.home") + TRUSTED_CERT_PATH); +- } +- if (path == null) { +- path = getDir("/etc/grid-security/certificates"); +- } +- if (path == null) { +- path = getDir(GL + File.separator + "share" + File.separator +- + "certificates"); +- } +- +- return path; +- } +- +- /** +- * Returns the default Globus proxy file location. +- */ +- public static String getProxyLocation() throws IOException { +- String loc, suffix = null; +- Process proc; +- BufferedReader bufferedReader; +- +- loc = System.getenv("X509_USER_PROXY"); +- if (loc == null) { +- loc = System.getProperty("X509_USER_PROXY"); +- } +- if (loc != null) { +- return loc; +- } +- +- try { +- proc = Runtime.getRuntime().exec("id -u"); +- bufferedReader = new BufferedReader(new InputStreamReader(proc +- .getInputStream())); +- suffix = bufferedReader.readLine(); +- } catch (IOException e) { +- // will fail on windows +- } +- +- if (suffix == null) { +- suffix = System.getProperty("user.name"); +- if (suffix != null) { +- suffix = suffix.toLowerCase(); +- } else { +- suffix = "nousername"; +- } +- } +- String tmpdir = System.getProperty("java.io.tmpdir"); +- if (!tmpdir.endsWith(File.separator)) { +- tmpdir += File.separator; +- } +- System.out.println("location"); +- return tmpdir + X509_USER_PROXY_FILE + suffix; +- } +- +- /** +- * Provides a simple command-line interface. +- */ +- public static void main(String[] args) { +- try { +- MyProxyLogon m = new MyProxyLogon(); +- // Console cons = System.console(); +- String passphrase = null; +- X509Certificate[] CAcerts; +- X509CRL[] CRLs; +- MyProxyLogon.logger.setLevel(Level.ALL); +- +- // if (cons != null) { +- // char[] pass = cons.readPassword("[%s]", "MyProxy Passphrase: +- // "); +- // if (pass != null) { +- // passphrase = new String(pass); +- // } +- // } else { +- System.out +- .println("Warning: terminal will echo passphrase as you type."); +- System.out.print("MyProxy Passphrase: "); +- passphrase = readLine(System.in); +- // } +- if (passphrase == null) { +- System.err.println("Error reading passphrase."); +- System.exit(1); +- } +- m.setPassphrase(passphrase); +- m.requestTrustRoots(true); +- m.getCredentials(); +- m.writeProxyFile(); +- System.out.println("Credential written successfully."); +- CAcerts = m.getTrustedCAs(); +- if (CAcerts != null) { +- System.out.println(Integer.toString(CAcerts.length) +- + " CA certificates received."); +- } +- CRLs = m.getCRLs(); +- if (CRLs != null) { +- System.out.println(Integer.toString(CRLs.length) +- + " CRLs received."); +- } +- if (m.writeTrustRoots()) { +- System.out.println("Wrote trust roots to " +- + MyProxyLogon.getTrustRootPath() + "."); +- } else { +- System.out +- .println("Received no trust roots from MyProxy server."); +- } +- } catch (Exception e) { +- e.printStackTrace(System.err); +- } +- } +- +- private static void printB64(byte[] data, PrintStream out) { +- byte[] b64data; +- +- b64data = Base64.encode(data); +- for (int i = 0; i < b64data.length; i += b64linelen) { +- if ((b64data.length - i) > b64linelen) { +- out.write(b64data, i, b64linelen); +- } else { +- out.write(b64data, i, b64data.length - i); +- } +- out.println(); +- } +- } +- +- private static void printCert(X509Certificate certificate, PrintStream out) +- throws CertificateEncodingException { +- out.println("-----BEGIN CERTIFICATE-----"); +- printB64(certificate.getEncoded(), out); +- out.println("-----END CERTIFICATE-----"); +- } +- +- private static void printKey(PrivateKey key, PrintStream out) +- throws IOException { +- out.println("-----BEGIN RSA PRIVATE KEY-----"); +- ByteArrayInputStream inStream = new ByteArrayInputStream(key +- .getEncoded()); +- ASN1InputStream derInputStream = new ASN1InputStream(inStream); +- DERObject keyInfo = derInputStream.readObject(); +- PrivateKeyInfo pkey = new PrivateKeyInfo((ASN1Sequence) keyInfo); +- DERObject derKey = pkey.getPrivateKey(); +- ByteArrayOutputStream bout = new ByteArrayOutputStream(); +- DEROutputStream der = new DEROutputStream(bout); +- der.writeObject(derKey); +- printB64(bout.toByteArray(), out); +- out.println("-----END RSA PRIVATE KEY-----"); +- } +- +- private static void setFilePermissions(String file, String mode) { +- String command = "chmod " + mode + " " + file; +- try { +- Runtime.getRuntime().exec(command); +- } catch (IOException e) { +- logger.warning("Failed to run: " + command); // windows +- } +- } +- +- private static String readLine(InputStream is) throws IOException { +- StringBuffer sb = new StringBuffer(); +- for (int c = is.read(); c > 0 && c != '\n'; c = is.read()) { +- sb.append((char) c); +- } +- if (sb.length() > 0) { +- return new String(sb); +- } +- return null; +- } +- +- private static String getDir(String path) { +- if (path == null) +- return null; +- File f = new File(path); +- if (f.isDirectory() && f.canRead()) { +- return f.getAbsolutePath(); +- } +- return null; +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogonGUI.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogonGUI.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogonGUI.java (working copy) +@@ -1,478 +0,0 @@ +-/* +- * Copyright 2007 The Board of Trustees of the University of Illinois. +- * All rights reserved. +- * +- * Developed by: +- * +- * MyProxy Team +- * National Center for Supercomputing Applications +- * University of Illinois +- * http://myproxy.ncsa.uiuc.edu/ +- * +- * Permission is hereby granted, free of charge, to any person obtaining +- * a copy of this software and associated documentation files (the +- * "Software"), to deal with the Software without restriction, including +- * without limitation the rights to use, copy, modify, merge, publish, +- * distribute, sublicense, and/or sell copies of the Software, and to +- * permit persons to whom the Software is furnished to do so, subject to +- * the following conditions: +- * +- * Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimers. +- * +- * Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimers in the +- * documentation and/or other materials provided with the distribution. +- * +- * Neither the names of the National Center for Supercomputing +- * Applications, the University of Illinois, nor the names of its +- * contributors may be used to endorse or promote products derived from +- * this Software without specific prior written permission. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +- * IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR +- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. +- */ +-package org.globus.transfer.reliable.client.credential.myproxy; +- +-import java.awt.Component; +-import java.awt.GridBagConstraints; +-import java.awt.GridBagLayout; +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +-import java.awt.event.WindowAdapter; +-import java.awt.event.WindowEvent; +-import java.io.File; +-import java.io.FileInputStream; +-import java.io.FileNotFoundException; +-import java.io.FileOutputStream; +-import java.io.IOException; +-import java.net.InetAddress; +-import java.net.UnknownHostException; +-import java.util.Properties; +- +-import javax.swing.AbstractButton; +-import javax.swing.BorderFactory; +-import javax.swing.JButton; +-import javax.swing.JCheckBox; +-import javax.swing.JFrame; +-import javax.swing.JLabel; +-import javax.swing.JPanel; +-import javax.swing.JPasswordField; +-import javax.swing.JScrollPane; +-import javax.swing.JTextArea; +-import javax.swing.JTextField; +-import javax.swing.SwingUtilities; +-import javax.swing.WindowConstants; +- +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.globus.transfer.reliable.client.utils.LogFileUtils; +- +-/** +- * The MyProxyLogonGUI class provides a Swing user interface to +- * {@link MyProxyLogon}. +- * @version 1.0 +- */ +-public class MyProxyLogonGUI extends JPanel implements ActionListener { +- private static final long serialVersionUID = 1L; +- static Log logger = LogFactory.getLog(MyProxyLogonGUI.class.getName()); +- public final static String version = "1.0"; +- +- protected MyProxyLogon myproxy; +- +- protected Properties properties; +- protected static final String PROPERTIES_PATH = "/.MyProxyLogon"; +- +- protected JTextField usernameField; +- protected JLabel usernameFieldLabel; +- protected static final String usernameFieldString = "Username"; +- protected static final String usernameFieldProperty = "Username"; +- +- protected JPasswordField passwordField; +- protected JLabel passwordFieldLabel; +- protected static final String passwordFieldString = "Passphrase"; +- protected static final String passwordFieldProperty = "Passphrase"; +- protected static final String passwordInfoString = "Enter passphrase to logon.\n"; +- +- protected JTextField crednameField; +- protected JLabel crednameFieldLabel; +- protected static final String crednameFieldString = "Credential Name"; +- protected static final String crednameFieldProperty = "CredentialName"; +- +- protected JTextField lifetimeField; +- protected JLabel lifetimeFieldLabel; +- protected static final String lifetimeFieldString = "Lifetime (hours)"; +- protected static final String lifetimeFieldProperty = "Lifetime"; +- +- protected JTextField hostnameField; +- protected JLabel hostnameFieldLabel; +- protected static final String hostnameFieldString = "Hostname"; +- protected static final String hostnameFieldProperty = "Hostname"; +- +- protected JTextField portField; +- protected JLabel portFieldLabel; +- protected static final String portFieldString = "Port"; +- protected static final String portFieldProperty = "Port"; +- +- protected JTextField outputField; +- protected JLabel outputFieldLabel; +- protected static final String outputFieldString = "Output"; +- protected static final String outputFieldProperty = "Output"; +- +- protected JCheckBox trustRootsCheckBox; +- protected static final String trustRootsProperty = "TrustRoots"; +- protected static final String trustRootsPropertyYes = "yes"; +- protected static final String trustRootsPropertyNo = "no"; +- +- protected JButton button; +- protected static final String buttonFieldString = "Logon"; +- +- protected JTextArea statusTextArea; +- protected JScrollPane statusScrollPane; +- +- /** +- * Constructs a MyProxyLogonGUI object. +- */ +- public MyProxyLogonGUI() { +- myproxy = new MyProxyLogon(); +- +- loadProperties(); +- +- GridBagLayout gridbag = new GridBagLayout(); +- GridBagConstraints c = new GridBagConstraints(); +- setLayout(gridbag); +- setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); +- +- usernameField = createField(usernameFieldString, properties +- .getProperty(usernameFieldProperty, myproxy.getUsername())); +- usernameFieldLabel = createLabel(usernameFieldString, usernameField); +- usernameField.setToolTipText("Enter your MyProxy username."); +- +- passwordField = new JPasswordField(10); +- passwordField.setActionCommand(passwordFieldString); +- passwordField.addActionListener(this); +- passwordFieldLabel = createLabel(passwordFieldString, passwordField); +- passwordField.setToolTipText("Enter your MyProxy passphrase."); +- +- crednameField = createField(crednameFieldString, +- properties.getProperty(crednameFieldProperty, myproxy +- .getCredentialName())); +- crednameFieldLabel = createLabel(crednameFieldString, hostnameField); +- crednameField +- .setToolTipText("Optionally enter your MyProxy credential name. Leave blank to use your default credential."); +- +- lifetimeField = createField(lifetimeFieldString, properties +- .getProperty(lifetimeFieldProperty, Integer.toString(myproxy +- .getLifetime() / 3600))); +- lifetimeFieldLabel = createLabel(lifetimeFieldString, lifetimeField); +- lifetimeField +- .setToolTipText("Enter the number of hours for your requested credentials to be valid."); +- +- hostnameField = createField(hostnameFieldString, properties +- .getProperty(hostnameFieldProperty, myproxy.getHost())); +- hostnameFieldLabel = createLabel(hostnameFieldString, hostnameField); +- hostnameField +- .setToolTipText("Enter the hostname of your MyProxy server (for example: myproxy.ncsa.uiuc.edu)."); +- +- portField = createField(portFieldString, properties.getProperty( +- portFieldProperty, Integer.toString(myproxy.getPort()))); +- portFieldLabel = createLabel(portFieldString, portField); +- portField +- .setToolTipText("Enter the TCP port of your MyProxy server (usually 7512)."); +- +- String trustRootPath = MyProxyLogon.getTrustRootPath(); +- String existingTrustRootPath = MyProxyLogon.getExistingTrustRootPath(); +- trustRootsCheckBox = new JCheckBox("Write trust roots to " +- + trustRootPath + "."); +- String trustRootsPropVal = properties.getProperty(trustRootsProperty); +- if (trustRootsPropVal != null +- && trustRootsPropVal.equals(trustRootsPropertyYes)) { +- trustRootsCheckBox.setSelected(true); +- } else if (trustRootsPropVal != null +- && trustRootsPropVal.equals(trustRootsPropertyNo)) { +- trustRootsCheckBox.setSelected(false); +- } else if (existingTrustRootPath == null +- || trustRootPath.equals(existingTrustRootPath)) { +- trustRootsCheckBox.setSelected(true); +- } else { +- trustRootsCheckBox.setSelected(false); +- } +- trustRootsCheckBox +- .setToolTipText("Check this box to download the latest CA certificates, certificate revocation lists, and CA signing policy files from MyProxy."); +- +- String proxyLoc; +- try { +- proxyLoc = MyProxyLogon.getProxyLocation(); +- } catch (Exception e) { +- proxyLoc = ""; +- } +- outputField = createField(outputFieldString, properties.getProperty( +- outputFieldProperty, proxyLoc)); +- outputFieldLabel = createLabel(outputFieldString, outputField); +- outputField +- .setToolTipText("Enter the path to store your credential from MyProxy. Leave blank if you don't want to retrieve a credential."); +- +- JLabel[] labels = { usernameFieldLabel, passwordFieldLabel, +- crednameFieldLabel, lifetimeFieldLabel, hostnameFieldLabel, +- portFieldLabel, outputFieldLabel }; +- JTextField[] textFields = { usernameField, passwordField, +- crednameField, lifetimeField, hostnameField, portField, +- outputField }; +- int numLabels = labels.length; +- +- c.anchor = GridBagConstraints.LINE_END; +- for (int i = 0; i < numLabels; i++) { +- c.gridwidth = GridBagConstraints.RELATIVE; +- c.fill = GridBagConstraints.NONE; +- c.weightx = 0.0; +- add(labels[i], c); +- +- c.gridwidth = GridBagConstraints.REMAINDER; +- c.fill = GridBagConstraints.HORIZONTAL; +- c.weightx = 1.0; +- add(textFields[i], c); +- } +- +- button = new JButton(buttonFieldString); +- button.setActionCommand(buttonFieldString); +- button.addActionListener(this); +- button.setVerticalTextPosition(AbstractButton.CENTER); +- button.setHorizontalTextPosition(AbstractButton.CENTER); +- button.setToolTipText("Press this button to logon to MyProxy."); +- +- statusTextArea = new JTextArea(4, 10); +- statusTextArea.setEditable(false); +- statusTextArea.setLineWrap(true); +- statusTextArea.setWrapStyleWord(true); +- statusScrollPane = new JScrollPane(statusTextArea); +- statusTextArea.setText(passwordInfoString); +- statusTextArea.setToolTipText("This area contains status messages."); +- +- c.gridwidth = GridBagConstraints.REMAINDER; // last +- c.fill = GridBagConstraints.HORIZONTAL; +- c.weightx = 1.0; +- add(trustRootsCheckBox, c); +- add(button, c); +- add(statusScrollPane, c); +- } +- +- /** +- * Handles GUI events. +- */ +- public void actionPerformed(ActionEvent e) { +- if (verifyInput()) { +- if (passwordFieldString.equals(e.getActionCommand()) +- || buttonFieldString.equals(e.getActionCommand())) { +- logon(); +- } +- } +- } +- +- /** +- * Calls createAndShowGUI(). +- */ +- public static void main(String[] args) { +- SwingUtilities.invokeLater(new Runnable() { +- public void run() { +- createAndShowGUI(); +- } +- }); +- } +- +- protected void logon() { +- try { +- myproxy.setUsername(usernameField.getText()); +- myproxy.setPassphrase(new String(passwordField.getPassword())); +- if (crednameField.getText().length() > 0) { +- myproxy.setCredentialName(crednameField.getText()); +- } +- myproxy +- .setLifetime(Integer.parseInt(lifetimeField.getText()) * 3600); +- myproxy.setHost(hostnameField.getText()); +- myproxy.setPort(Integer.parseInt(portField.getText())); +- myproxy.requestTrustRoots(trustRootsCheckBox.isSelected()); +- statusTextArea.setText("Connecting to " + myproxy.getHost() +- + "...\n"); +- myproxy.connect(); +- statusTextArea.setText("Logging on...\n"); +- myproxy.logon(); +- if (outputField.getText().length() == 0) { +- statusTextArea.setText("Logon successful.\n"); +- } else { +- statusTextArea.setText("Getting credentials...\n"); +- myproxy.getCredentials(); +- statusTextArea.setText("Writing credentials...\n"); +- myproxy.saveCredentialsToFile(outputField.getText()); +- statusTextArea.setText("Credentials written to " +- + outputField.getText() + ".\n"); +- } +- if (trustRootsCheckBox.isSelected() && myproxy.writeTrustRoots()) { +- statusTextArea.append("Trust roots written to " +- + MyProxyLogon.getTrustRootPath() + ".\n"); +- } +- saveProperties(); +- } catch (Exception exception) { +- logger.debug(exception.getMessage(), exception); +- statusTextArea.append("Error: " + exception.getMessage()); +- } finally { +- try { +- myproxy.disconnect(); +- } catch (Exception e2) { +- } +- } +- } +- +- protected void saveProperties() { +- try { +- FileOutputStream out = new FileOutputStream(System +- .getProperty("user.home") +- + PROPERTIES_PATH); +- properties.setProperty(usernameFieldProperty, usernameField +- .getText()); +- properties.setProperty(crednameFieldProperty, crednameField +- .getText()); +- properties.setProperty(lifetimeFieldProperty, lifetimeField +- .getText()); +- properties.setProperty(hostnameFieldProperty, hostnameField +- .getText()); +- properties.setProperty(portFieldProperty, portField.getText()); +- properties.setProperty(outputFieldProperty, outputField.getText()); +- properties.setProperty(trustRootsProperty, trustRootsCheckBox +- .isSelected() ? trustRootsPropertyYes +- : trustRootsPropertyNo); +- properties.store(out, MyProxyLogonGUI.class.getName()); +- } catch (FileNotFoundException e) { +- logger.debug(e.getMessage(), e); +- e.printStackTrace(); +- } catch (IOException e) { +- logger.debug(e.getMessage(), e); +- e.printStackTrace(); +- } +- } +- +- protected void loadProperties() { +- try { +- properties = new Properties(); +- FileInputStream in = new FileInputStream(System +- .getProperty("user.home") +- + PROPERTIES_PATH); +- properties.load(in); +- } catch (FileNotFoundException e) { +- // ok, nothing to load +- } catch (IOException e) { +- logger.debug(e.getMessage(), e); +- e.printStackTrace(); +- } +- } +- +- /** +- * Create the GUI and show it. For thread safety, this method should be +- * invoked from the event dispatch thread. +- */ +- public static void createAndShowGUI() { +- final JFrame frame = new JFrame("MyProxyLogon " + version); +- MyProxyLogonGUI gui = new MyProxyLogonGUI(); +- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); +- frame.add(gui); +- frame.setLocation(50, 50); +- frame.pack(); +- frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); +- gui.passwordField.requestFocusInWindow(); +- frame.addWindowListener(new WindowAdapter() +- { +- public void windowClosing(WindowEvent e) { +- frame.dispose(); +- } +- }); +- +- frame.setVisible(true); +- } +- +- private JTextField createField(String fieldString, String text) { +- JTextField field = new JTextField(10); +- field.setActionCommand(fieldString); +- field.addActionListener(this); +- if (text != null) { +- field.setText(text); +- field.setColumns(text.length()); +- } +- return field; +- } +- +- private JLabel createLabel(String fieldString, Component c) { +- JLabel label = new JLabel(fieldString + ": "); +- label.setLabelFor(c); +- return label; +- } +- +- private boolean verifyInput() { +- boolean valid = true; +- StringBuffer infoString = new StringBuffer(); +- if (usernameField.getText().length() == 0) { +- valid = false; +- infoString.append("Please specify a username.\n"); +- } +- if (passwordField.getPassword().length == 0) { +- valid = false; +- infoString.append(passwordInfoString); +- } else if (passwordField.getPassword().length < myproxy.MIN_PASS_PHRASE_LEN) { +- valid = false; +- infoString.append("Passphrase must be at least "); +- infoString.append(Integer.toString(myproxy.MIN_PASS_PHRASE_LEN)); +- infoString.append(" characters in length.\n"); +- } +- if (lifetimeField.getText().length() == 0) { +- lifetimeField.setText(Integer +- .toString(myproxy.getLifetime() / 3600)); +- } +- try { +- Integer.parseInt(lifetimeField.getText()); +- } catch (NumberFormatException e) { +- logger.debug(e.getMessage(), e); +- valid = false; +- infoString.append("Lifetime is not a valid integer.\n"); +- } +- if (hostnameField.getText().length() == 0) { +- valid = false; +- infoString.append("Please specify a MyProxy server hostname.\n"); +- } else { +- try { +- InetAddress.getByName(hostnameField.getText()); +- } catch (UnknownHostException e) { +- logger.debug(e.getMessage(), e); +- valid = false; +- infoString.append("Hostname \""); +- infoString.append(hostnameField.getText()); +- infoString +- .append("\" is not valid. Please specify a valid MyProxy server hostname.\n"); +- } +- } +- if (portField.getText().length() == 0) { +- portField.setText(Integer.toString(myproxy.getPort())); +- } +- try { +- Integer.parseInt(portField.getText()); +- } catch (NumberFormatException e) { +- logger.debug(e.getMessage(), e); +- valid = false; +- infoString +- .append("Port is not a valid integer. Please specify a valid MyProxy server port (default: 7514).\n"); +- } +- if (outputField.getText().length() > 0) { +- File f = new File(outputField.getText()); +- if (f.exists() && !f.canWrite()) { +- valid = false; +- infoString.append(f.getPath()); +- infoString +- .append(" exists and is not writable. Please specify a valid output file or specify no output path to only perform authentication.\n"); +- } +- } +- statusTextArea.setText(new String(infoString)); +- return valid; +- } +-} +\ No newline at end of file +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredManager.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredManager.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredManager.java (working copy) +@@ -1,32 +0,0 @@ +-package org.globus.transfer.reliable.client.credential; +- +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.globus.common.CoGProperties; +-import org.globus.gsi.CertUtil; +-import org.globus.gsi.GlobusCredential; +-import org.globus.util.Util; +- +- +-public class CredManager { +- private static Log logger = LogFactory.getLog(CredManager.class); +- +- public static ProxyInfo getProxyInfo() throws Exception { +- GlobusCredential proxy = null; +- String file = null; +- ProxyInfo ret = null; +- +- try { +- file = CoGProperties.getDefault().getProxyFile(); +- proxy = new GlobusCredential(file); +- } catch (Exception e) { +- logger.debug("Unable to load the user proxy : " +- + e.getMessage()); +- throw e; +- } +- +- ret = new ProxyInfo(CertUtil.toGlobusID(proxy.getSubject()), +- proxy.getStrength(),Util.formatTimeSec(proxy.getTimeLeft())); +- return ret; +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredentialDialog.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredentialDialog.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredentialDialog.java (working copy) +@@ -1,120 +0,0 @@ +-package org.globus.transfer.reliable.client.credential; +- +-import org.globus.tools.proxy.GridProxyInit; +-import org.globus.transfer.reliable.client.credential.myproxy.MyProxyLogonGUI; +- +-public class CredentialDialog extends javax.swing.JDialog { +- +- /** Creates new form CredentialDialog */ +- public CredentialDialog(java.awt.Frame parent, boolean modal) { +- super(parent, modal); +- initComponents(); +- } +- +- /** This method is called from within the constructor to +- * initialize the form. +- * WARNING: Do NOT modify this code. The content of this method is +- * always regenerated by the Form Editor. +- */ +- // +- private void initComponents() { +- +- jLabel1 = new javax.swing.JLabel(); +- generate_proxy = new javax.swing.JButton(); +- jLabel2 = new javax.swing.JLabel(); +- Myproxy = new javax.swing.JButton(); +- +- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); +- setTitle("Credential"); +- +- jLabel1.setText("If you want to generate a proxy certificate on your local \nmachine, please select this"); +- +- generate_proxy.setText("generate"); +- generate_proxy.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- generate_proxyActionPerformed(evt); +- } +- }); +- +- jLabel2.setText("If you want to get a proxy certificate from MyPorxy, please select this"); +- +- Myproxy.setText("Myproxy"); +- Myproxy.addActionListener(new java.awt.event.ActionListener() { +- public void actionPerformed(java.awt.event.ActionEvent evt) { +- MyproxyActionPerformed(evt); +- } +- }); +- +- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); +- getContentPane().setLayout(layout); +- layout.setHorizontalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .addContainerGap() +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 474, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) +- .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 484, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(generate_proxy) +- .add(Myproxy)) +- .addContainerGap(47, Short.MAX_VALUE)) +- ); +- layout.setVerticalGroup( +- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) +- .add(layout.createSequentialGroup() +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) +- .add(generate_proxy)) +- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) +- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) +- .add(jLabel2) +- .add(Myproxy)) +- .addContainerGap(81, Short.MAX_VALUE)) +- ); +- +- pack(); +- }// +- +- private void generate_proxyActionPerformed(java.awt.event.ActionEvent evt) { +- GridProxyInit proxyInitFrame = new GridProxyInit(null, true); +- proxyInitFrame.setRunAsApplication(false); +- proxyInitFrame.setCloseOnSuccess(true); +- proxyInitFrame.setLocation(50, 50); +- proxyInitFrame.pack(); +- //UITools.center(mainPanel, proxyInitFrame); +- this.setVisible(false); +- proxyInitFrame.setVisible(true); +- +- } +- +- private void MyproxyActionPerformed(java.awt.event.ActionEvent evt) { +- MyProxyLogonGUI.main(null); +- this.setVisible(false); +- } +- +- /** +- * @param args the command line arguments +- */ +- public static void main(String args[]) { +- java.awt.EventQueue.invokeLater(new Runnable() { +- public void run() { +- CredentialDialog dialog = new CredentialDialog(new javax.swing.JFrame(), true); +- dialog.addWindowListener(new java.awt.event.WindowAdapter() { +- public void windowClosing(java.awt.event.WindowEvent e) { +- System.exit(0); +- } +- }); +- dialog.setVisible(true); +- } +- }); +- } +- +- // Variables declaration - do not modify +- private javax.swing.JButton Myproxy; +- private javax.swing.JButton generate_proxy; +- private javax.swing.JLabel jLabel1; +- private javax.swing.JLabel jLabel2; +- // End of variables declaration +- +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/ProxyInfo.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/ProxyInfo.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/ProxyInfo.java (working copy) +@@ -1,36 +0,0 @@ +-package org.globus.transfer.reliable.client.credential; +- +-public class ProxyInfo { +- private String subject; +- private int strength; +- private String timeLeft; +- +- public ProxyInfo(String subject, int strength, String timeLeft) { +- super(); +- this.subject = subject; +- this.strength = strength; +- this.timeLeft = timeLeft; +- } +- +- public String getSubject() { +- return subject; +- } +- +- public int getStrength() { +- return strength; +- } +- +- public String getTimeLeft() { +- return timeLeft; +- } +- +- public String toString() { +- StringBuffer buf = new StringBuffer(); +- buf.append("Subject: ").append(subject).append("\n") +- .append("Strength: ").append(strength).append(" bits\n") +- .append("Time Left: ").append(timeLeft); +- +- return buf.toString(); +- } +- +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTClient.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTClient.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTClient.java (working copy) +@@ -1,380 +0,0 @@ +-/* +- * To change this template, choose Tools | Templates +- * and open the template in the editor. +- */ +- +-package org.globus.transfer.reliable.client; +- +- +-import java.io.FileWriter; +-import java.util.Calendar; +-import java.util.HashMap; +-import java.util.List; +-import java.util.Map; +-import java.util.Vector; +- +-import javax.xml.namespace.QName; +-import javax.xml.rpc.Stub; +-import org.apache.axis.message.addressing.Address; +-import org.apache.axis.message.addressing.EndpointReferenceType; +-import org.globus.gsi.GSIConstants; +-import org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel; +-import org.globus.rft.generated.Cancel; +-import org.globus.rft.generated.GetStatusSet; +-import org.globus.rft.generated.GetStatusSetResponse; +-import org.globus.rft.generated.RFTFaultResourcePropertyType; +-import org.globus.rft.generated.RFTOptionsType; +-import org.globus.rft.generated.ReliableFileTransferPortType; +-import org.globus.rft.generated.RequestStatusType; +-import org.globus.rft.generated.Start; +-import org.globus.rft.generated.StartOutputType; +-import org.globus.rft.generated.TransferRequestType; +-import org.globus.rft.generated.TransferStatusType; +-import org.globus.transfer.reliable.client.BaseRFTClient; +-import org.globus.transfer.reliable.client.utils.UIConstants; +-import org.globus.transfer.reliable.service.RFTConstants; +-import org.globus.wsrf.NotificationConsumerManager; +-import org.globus.wsrf.WSNConstants; +-import org.globus.wsrf.container.ServiceContainer; +-import org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType; +-import org.globus.wsrf.encoding.ObjectSerializer; +-import org.globus.wsrf.impl.security.authorization.Authorization; +-import org.globus.wsrf.impl.security.authorization.HostAuthorization; +-import org.globus.wsrf.impl.security.authorization.ResourcePDPConfig; +-import org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain; +-import org.globus.wsrf.impl.security.descriptor.GSISecureConvAuthMethod; +-import org.globus.wsrf.impl.security.descriptor.GSISecureMsgAuthMethod; +-import org.globus.wsrf.impl.security.descriptor.GSITransportAuthMethod; +-import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor; +-import org.globus.wsrf.security.Constants; +-import org.oasis.wsn.Subscribe; +-import org.oasis.wsn.TopicExpressionType; +-import org.oasis.wsrf.faults.BaseFaultType; +-import org.oasis.wsrf.lifetime.SetTerminationTime; +-import org.oasis.wsrf.lifetime.SetTerminationTimeResponse; +-import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType; +- +-/** +- * A Client for RFT, extends BaseRFTClient +- * @author Liu Wantao liuwt at uchicago.edu +- */ +-public class RFTClient extends BaseRFTClient { +- private static NotificationConsumerManager consumer = null; +- private Map epr2ID = new HashMap(); +- private Map ID2Stub = new HashMap(); +- private QueuePanel queuePanel = null; +- private RFTButtonActionListener listener = null; +- private TransferStatusReporter reporter = null; +- +- public RFTClient() { +- super(); +- } +- +- public RFTClient(RFTButtonActionListener listener, QueuePanel queuePanel) { +- super(); +- this.listener = listener; +- this.queuePanel = queuePanel; +- +- new TransferStatusReporter().start(); +- } +- +- +- /** +- * Generate RFT transfer request +- * @param options RFT options +- * @param rftParam RFT Transfer Parameters +- * @param epr +- * @return +- */ +- public TransferRequestType getTransferRequestType(RFTOptions options, RFTTransferParam rftParam, EndpointReferenceType epr) { +- +- //set RFT options +- RFTOptionsType rftOptions = new RFTOptionsType(); +- +- rftOptions.setParallelStreams(options.getParallelStream()); +- rftOptions.setTcpBufferSize(options.getTcpBufferSize()); +- +- String sourceSubjectName = options.getSourceDN(); +- if (null != sourceSubjectName) { +- rftOptions.setSourceSubjectName(sourceSubjectName); +- } +- String destSubjectName = options.getDestDN(); +- if (null != destSubjectName) { +- rftOptions.setDestinationSubjectName(destSubjectName); +- } +- +- TransferRequestType request = new TransferRequestType(); +- request.setRftOptions(rftOptions); +- request.setTransfer(rftParam.getTransfers1()); +- request.setConcurrency(options.getConcurrent()); +- request.setTransferCredentialEndpoint(epr); +- +- return request; +- } +- +- /** +- * Respond to click event of Start button +- * @param job +- * @throws java.lang.IllegalArgumentException +- */ +- public void startTransfer(RFTJob job) throws Exception { +- RFTOptions options = job.getOptions(); +- RFTTransferParam rftParam = job.getParam(); +- int jobID = job.getJobID(); +- +- String host = rftParam.getServerHost(); +- if (null == host) { +- throw new IllegalArgumentException(UIConstants.ILLEGAL_HOST); +- } +- String port = rftParam.getServerPort(); +- if (null == port) { +- if (authType.equals(GSIConstants.GSI_TRANSPORT)) { +- port = "8443"; +- } else { +- port ="8080"; +- } +- } +- +- if (authType.equals(GSIConstants.GSI_TRANSPORT)) { +- PROTOCOL = UIConstants.HTTPS_PROTOCOL; +- } +- +- String rftFactoryAddress = PROTOCOL + "://"+ host + ":" + port + "/wsrf/services/" +- + "ReliableFileTransferFactoryService"; +- String rftServiceAddress = PROTOCOL+ "://" + host + ":" + port + "/wsrf/services/" +- + "ReliableFileTransferService"; +- +- EndpointReferenceType credEPR = delegateCredential(host, port); +- TransferRequestType transferType = getTransferRequestType(options, rftParam, credEPR); +- EndpointReferenceType rftepr = createRFT(rftFactoryAddress, transferType); +- +- rftepr.setAddress(new Address(rftServiceAddress)); +- ReliableFileTransferPortType rft = rftLocator +- .getReliableFileTransferPortTypePort(rftepr); +- //setAuthzValue(authzType); +- setSecurity((Stub)rft); +- +- //write epr to a file +- QName qname = new QName("http://www.globus.org/namespaces/2004/10/rft", "TransferKey"); +- String resourceKey = rftepr.getProperties().get(qname).getValue(); +- FileWriter writer = new FileWriter(resourceKey); +- try { +- QName qName1 = new QName("", "RFT_EPR"); +- writer.write(ObjectSerializer.toString(rftepr, qName1)); +- } finally { +- if(null != writer) { +- writer.close(); +- } +- } +- +- //For secure notifications +- epr2ID.put(createMapKey(rftepr), Integer.toString(jobID)); +- ID2Stub.put(Integer.toString(jobID), rft); +- subscribeRFT(rft); +- System.out.println("Subscribed for overall status"); +- //End subscription code +- Calendar termTime = Calendar.getInstance(); +- termTime.add(Calendar.MINUTE, TERM_TIME); +- SetTerminationTime reqTermTime = new SetTerminationTime(); +- reqTermTime.setRequestedTerminationTime(termTime); +- System.out.println("Termination time to set: " + TERM_TIME + " minutes"); +- SetTerminationTimeResponse termRes = rft.setTerminationTime(reqTermTime); +- StartOutputType startresp = rft.start(new Start()); +- } +- +- /** +- * Cancel a specified transfer +- * @param jobID +- * @throws Exception +- */ +- public void stopTransfer(String jobID) throws Exception { +- ReliableFileTransferPortType rft = (ReliableFileTransferPortType)ID2Stub.get(jobID); +- Cancel cancel = new Cancel(); +- rft.cancel(cancel); +- } +- +- /** +- * Subscribe resource properties of RFT service +- * @param rft +- * @throws Exception +- */ +- public void subscribeRFT(ReliableFileTransferPortType rft) throws Exception { +- Subscribe request = new Subscribe(); +- request.setUseNotify(Boolean.TRUE); +- if (PROTOCOL.equals("http")) { +- consumer = NotificationConsumerManager.getInstance(); +- } else if (PROTOCOL.equals("https")) { +- Map properties = new HashMap(); +- properties.put(ServiceContainer.CLASS, "org.globus.wsrf.container.GSIServiceContainer"); +- consumer = NotificationConsumerManager.getInstance(properties); +- } +- consumer.startListening(); +- EndpointReferenceType consumerEPR = null; +- ResourceSecurityDescriptor resDesc = new ResourceSecurityDescriptor(); +- Vector authMethod = new Vector(); +- if (AUTHZ.equalsIgnoreCase("host")) { +- ResourcePDPConfig pdpConfig = new ResourcePDPConfig("host"); +- pdpConfig.setProperty(Authorization.HOST_PREFIX, +- HostAuthorization.URL_PROPERTY, endpoint); +- ServiceAuthorizationChain authz = new ServiceAuthorizationChain(); +- authz.initialize(pdpConfig, "chainName", "someId"); +- resDesc.setAuthzChain(authz); +- } else if (AUTHZ.equalsIgnoreCase("self")) { +- resDesc.setAuthz("self"); +- } +- if (PROTOCOL.equals("http")) { +- if (authType.equals(Constants.GSI_SEC_MSG)) { +- authMethod.add(GSISecureMsgAuthMethod.BOTH); +- } else if (authType.equals(Constants.GSI_SEC_CONV)) { +- authMethod.add(GSISecureConvAuthMethod.BOTH); +- } +- } else if (PROTOCOL.equals("https")) { +- authMethod.add(GSITransportAuthMethod.BOTH); +- } +- resDesc.setAuthMethods(authMethod); +- consumerEPR = consumer.createNotificationConsumer(this, resDesc); +- request.setConsumerReference(consumerEPR); +- TopicExpressionType topicExpression = new TopicExpressionType(); +- topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT); +- topicExpression.setValue(RFTConstants.REQUEST_STATUS_RESOURCE); +- request.setTopicExpression(topicExpression); +- rft.subscribe(request); +- +- topicExpression.setValue(RFTConstants.OVERALL_STATUS_RESOURCE); +- request.setTopicExpression(topicExpression); +- rft.subscribe(request); +- } +- +- /** +- * Call back method for subscription +- */ +- public void deliver(List topicPath, EndpointReferenceType producer, Object message) { +- ResourcePropertyValueChangeNotificationType changeMessage = +- ((ResourcePropertyValueChangeNotificationElementType) message) +- .getResourcePropertyValueChangeNotification(); +- BaseFaultType fault = null; +- //System.out.println(((QName)topicPath.get(0)).toString()); +- try { +- if (changeMessage != null) { +- QName topicQName = (QName) topicPath.get(0); +- if (RFTConstants.REQUEST_STATUS_RESOURCE.equals(topicQName)) { +- RequestStatusType requestStatus = (RequestStatusType) changeMessage +- .getNewValue().get_any()[0].getValueAsType( +- RFTConstants.REQUEST_STATUS_RESOURCE, +- RequestStatusType.class); +- System.out.println("\n Transfer Request Status:" +- + requestStatus.getRequestStatus().getValue()); +- +- String jobID = (String) epr2ID.get(createMapKey(producer)); +- int rowIndex = queuePanel.getRowIndex(jobID); +- queuePanel.setColumnValue(rowIndex, 5, requestStatus +- .getRequestStatus().getValue()); +- +- RFTFaultResourcePropertyType faultRP = requestStatus +- .getFault(); +- if (faultRP != null) { +- fault = getFaultFromRP(faultRP); +- } +- if (fault != null) { +- System.err.println("Error:" + fault.getDescription(0)); +- queuePanel.setColumnValue(rowIndex, 7, fault +- .getDescription(0).get_value()); +- } +- } else if (RFTConstants.OVERALL_STATUS_RESOURCE.equals(topicQName)) { +-// OverallStatus overallStatus = (OverallStatus) changeMessage +-// .getNewValue().get_any()[0].getValueAsType( +-// RFTConstants.OVERALL_STATUS_RESOURCE, +-// OverallStatus.class); +-// int finished = overallStatus.getTransfersFinished(); +-// int active = overallStatus.getTransfersActive(); +-// int failed = overallStatus.getTransfersFailed(); +-// int retrying = overallStatus.getTransfersRestarted(); +-// int pending = overallStatus.getTransfersPending(); +-// int cancelled = overallStatus.getTransfersCancelled(); +-// System.out.println("\n Overall status of transfer:"); +-// System.out.println("Finished/Active/Failed/Retrying/Pending/Cancelled"); +-// System.out.print(overallStatus.getTransfersFinished() + "/"); +-// System.out.print(overallStatus.getTransfersActive() + "/"); +-// System.out.print(overallStatus.getTransfersFailed() + "/"); +-// System.out.print(overallStatus.getTransfersRestarted() + "/"); +-// System.out.print(overallStatus.getTransfersPending() + "/"); +-// System.out.print(overallStatus.getTransfersCancelled()); +- //listener.updateOverallStatus(finished, active, failed, retrying, pending, cancelled); +- } +- +- +- } +- } catch (Exception e) { +- e.printStackTrace(); +- System.err.println(e.getMessage()); +- } +- } +- +- private BaseFaultType getFaultFromRP(RFTFaultResourcePropertyType faultRP) { +- if(faultRP.getRftAuthenticationFaultType() != null) { +- return faultRP.getRftAuthenticationFaultType(); +- } else if(faultRP.getRftAuthorizationFaultType() != null) { +- return faultRP.getRftAuthorizationFaultType(); +- } else if(faultRP.getRftDatabaseFaultType() != null) { +- return faultRP.getRftDatabaseFaultType(); +- } else if(faultRP.getRftRepeatedlyStartedFaultType() != null) { +- return faultRP.getRftRepeatedlyStartedFaultType(); +- } else if(faultRP.getRftTransferFaultType() != null) { +- return faultRP.getRftTransferFaultType(); +- } else if(faultRP.getTransferTransientFaultType() != null) { +- return faultRP.getTransferTransientFaultType(); +- } else { +- return null; +- } +- } +- +- private String createMapKey(EndpointReferenceType epr) { +- String ret = null; +- if (null != epr) { +- String address = epr.getAddress().toString(); +- QName qname = new QName("http://www.globus.org/namespaces/2004/10/rft", "TransferKey"); +- String resourceKey = epr.getProperties().get(qname).getValue(); +- ret = new String(address + ":" + resourceKey); +- } +- +- return ret; +- } +- +- class TransferStatusReporter extends Thread { +- public void run() { +- while (true) { +- //int length = queuePanel.tableSize(); +- int i = 0; +- while (i < queuePanel.tableSize()) { +- String isRFT = queuePanel.getColumnValue(i, 7); +- String status = queuePanel.getColumnValue(i, 3); +- if ("true".equals(isRFT) && +- !("Finished".equals(status)) && !"Expanding_Done".equals(status)) { +- int jobID = Integer.parseInt(queuePanel.getColumnValue(i, 0)); +- ReliableFileTransferPortType rft = (ReliableFileTransferPortType)ID2Stub.get(Integer.toString(jobID)); +- if (null != rft) { +- try { +- GetStatusSetResponse response = rft.getStatusSet(new GetStatusSet(1, 1)); +- TransferStatusType statusType = response.getTransferStatusSet(0); +- String jobStatus = statusType.getStatus().getValue(); +- queuePanel.setColumnValue(i , 3, jobStatus); +- } catch (Exception e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } +- } +- } +- i++; +- } +- +- try { +- Thread.sleep(10); +- } catch (InterruptedException e) { +- // TODO Auto-generated catch block +- e.printStackTrace(); +- } +- } +- +- } +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/eprmgmt/EPRManager.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/eprmgmt/EPRManager.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/eprmgmt/EPRManager.java (working copy) +@@ -1,189 +0,0 @@ +-package org.globus.transfer.reliable.client.eprmgmt; +- +-import java.io.File; +-import java.io.FileFilter; +-import java.io.FileReader; +-import java.io.FileWriter; +-import java.io.Reader; +-import java.io.Writer; +-import java.util.ArrayList; +-import java.util.Iterator; +-import java.util.List; +- +-import javax.xml.namespace.QName; +- +-import org.apache.axis.message.addressing.EndpointReferenceType; +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.globus.wsrf.encoding.ObjectDeserializer; +-import org.globus.wsrf.encoding.ObjectSerializer; +-import org.xml.sax.InputSource; +- +-public class EPRManager { +- private final static String ERP_FILE_SUFFIX = ".epr"; +- private List eprList; +- private static Log logger = LogFactory.getLog(EPRManager.class); +- +- public EPRManager() { +- eprList = new ArrayList(); +- } +- +- public boolean deleteEPRFile(String location, String resourceKey) throws IllegalArgumentException { +- if (null == location) { +- throw new IllegalArgumentException("EPR location can not be null"); +- } +- +- if (null == resourceKey || "".equals(resourceKey.trim())) { +- throw new IllegalArgumentException("resource key can not be null"); +- } +- +- String eprFileName = resourceKey + ERP_FILE_SUFFIX; +- File file = new File(location, eprFileName); +- return file.delete(); +- } +- +- public void addEPR (EndpointReferenceType epr) { +- eprList.add(epr); +- } +- +- public void removeEPR (EndpointReferenceType epr) { +- eprList.remove(epr); +- } +- +- +- public int getNumEPR () { +- return eprList.size(); +- } +- +- public EndpointReferenceType getEPR (int index) throws IllegalArgumentException { +- if (index < 0 || index >= eprList.size()) { +- throw new IllegalArgumentException("index is invalid"); +- } +- +- return eprList.get(index); +- } +- +- public EndpointReferenceType getEPR (String resourceKey) throws IllegalArgumentException{ +- if (null == resourceKey) { +- throw new IllegalArgumentException("resource key can not be null"); +- } +- +- Iterator iter = eprList.iterator(); +- EndpointReferenceType ret = null; +- while (iter.hasNext()) { +- ret = iter.next(); +- if (resourceKey.equals(ret.getProperties().get_any()[0].getValue())) { +- return ret; +- } +- } +- +- return null; +- } +- +- public String getResourceKey (int index) throws IllegalArgumentException { +- if (index < 0 || index >= eprList.size()) { +- throw new IllegalArgumentException("index is invalid"); +- } +- +- EndpointReferenceType epr = eprList.get(index); +- return epr.getProperties().get_any()[0].getValue(); +- } +- +- public List getEPRList () { +- return eprList; +- } +- +- public void writeEPRList (String location) throws Exception{ +- if (null == location) { +- throw new IllegalArgumentException("EPR location can not be null"); +- } +- +- File eprDir = new File(location); +- if (!eprDir.exists() || !eprDir.isDirectory()) { +- eprDir.mkdirs(); +- } +- +- Iterator iter = eprList.iterator(); +- while (iter.hasNext()) { +- saveEPR(iter.next(), eprDir); +- } +- +- } +- +- public void readEPRList (String location) throws Exception { +- if (null == location) { +- throw new IllegalArgumentException("EPR location can not be null"); +- } +- +- File eprDir = new File(location); +- if (!eprDir.exists() || !eprDir.isDirectory()) { +- throw new Exception("the directory for storing EPR does not exist, read operation failed"); +- } +- +- List savedEPRs = readAll(eprDir); +- eprList.addAll(savedEPRs); +- } +- +- private void saveEPR(EndpointReferenceType epr, File eprDir) throws Exception { +- if (null == epr) { +- throw new Exception("can not save a null EPR"); +- } +- +- String resourceKey = epr.getProperties().get_any()[0].getValue(); +- if (null == resourceKey || "".equals(resourceKey.trim())) { +- resourceKey = new Long(System.currentTimeMillis()).toString(); +- } +- +- QName qname = new QName("", "epr"); +- String eprFileName = resourceKey + ERP_FILE_SUFFIX; +- File file = new File(eprDir, eprFileName); +- Writer writer = null; +- try { +- writer = new FileWriter(file); +- ObjectSerializer.serialize(writer, epr, qname); +- } catch (Exception e) { +- logger.debug(e.getMessage(), e); +- throw e; +- } finally { +- if (null != writer) { +- writer.close(); +- } +- } +- +- } +- +- private List readAll(File eprDir) throws Exception { +- List ret = new ArrayList(); +- File[] eprFiles = eprDir.listFiles(new FileFilter() { +- public boolean accept(File file) { +- if(file.isFile() && file.getName().endsWith(ERP_FILE_SUFFIX)) { +- return true; +- } +- +- return false; +- } +- }); +- +- if (null != eprFiles) { +- Reader reader = null; +- for (int i = 0; i < eprFiles.length; i++) { +- try { +- reader = new FileReader(eprFiles[i]); +- InputSource inputSource = new InputSource(reader); +- EndpointReferenceType epr = (EndpointReferenceType)ObjectDeserializer.deserialize( +- inputSource, EndpointReferenceType.class); +- ret.add(epr); +- } catch (Exception e) { +- logger.debug(e.getMessage(), e); +- } finally { +- if (null != reader) { +- reader.close(); +- reader = null; +- } +- } +- } +- } +- +- return ret; +- } +-} +Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTButtonActionListener.java +=================================================================== +--- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTButtonActionListener.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTButtonActionListener.java (working copy) +@@ -1,71 +0,0 @@ +-/* +- * To change this template, choose Tools | Templates +- * and open the template in the editor. +- */ +- +-package org.globus.transfer.reliable.client; +- +-import org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel; +-import org.globus.rft.generated.TransferType; +- +-/** +- * Action listener of buttons in the GUI +- * @author Liu Wnatao liuwt at uchicago.edu +- */ +-public class RFTButtonActionListener { +- private QueuePanel queuePanel = null; +- private RFTClient rftClient = null; +- private RFTPanel panel = null; +- +- public RFTButtonActionListener(RFTPanel panel) { +- this.panel = panel; +- this.queuePanel = panel.getQueuePanel(); +- this.rftClient = new RFTClient(this, queuePanel); +- } +- +- /** +- * action for click event of Start button +- * @param options +- * @param rftParam +- */ +- public void startButtonAction(RFTJob job, QueuePanel queuePanel) throws Exception { +-// int jobID = job.getJobID(); +-// RFTOptions options = job.getOptions(); +- RFTTransferParam param = job.getParam(); +- +- TransferType transfer = param.getTransfers1()[0]; +- String[] cols = {Integer.toString(job.getJobID()), transfer.getSourceUrl(), +- transfer.getDestinationUrl(), "started", "0", "No errors"}; +- queuePanel.addTransfer(cols); +- rftClient.startTransfer(job); +- } +- +- /** +- * action for click event of Stop button +- * @param queuePanel +- */ +- public void stopButtonAction(String jobID) throws Exception { +- +- int selectedRowIndex = queuePanel.getRowIndex(jobID, 0); +- String id = queuePanel.getColumnValue(selectedRowIndex, 0); +- rftClient.stopTransfer(id); +- queuePanel.setColumnValue(selectedRowIndex, 3, "Cancelled"); +- queuePanel.setColumnValue(selectedRowIndex, 4, "0"); +- queuePanel.setColumnValue(selectedRowIndex, 5, "No errors"); +- } +- +- public void loadFileButtonAction(RFTJob job, QueuePanel queuePanel) throws Exception { +- RFTTransferParam param = job.getParam(); +- TransferType[] transfers = param.getTransfers1(); +- +- for (int i = 0; i < transfers.length; i++) { +- String[] cols = {Integer.toString(job.getJobID()), +- transfers[i].getSourceUrl(), +- transfers[i].getDestinationUrl(), "started", "0", "No errors"}; +- queuePanel.addTransfer(cols); +- } +- +- rftClient.startTransfer(job); +- } +- +-} +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/QueuePanel.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/QueuePanel.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/QueuePanel.java (working copy) +@@ -1,297 +0,0 @@ +-package org.globus.ogce.beans.filetransfer.gui.monitor; +- +-import org.apache.log4j.Logger; +- +-import javax.swing.*; +-import javax.swing.border.BevelBorder; +-import javax.swing.border.Border; +-import javax.swing.table.DefaultTableModel; +-import java.awt.*; +-import java.awt.event.ActionListener; +-import java.awt.event.MouseEvent; +-import java.awt.event.MouseListener; +-import java.util.Vector; +- +-/** +- * A panel which Displays a set of jobs in a queue. The user can add any +- * number of columns to the table. It is assumed that the Jobid is the +- * first column and it is used to distinguish values contained in each row. +- * +- * @author Beulah Kurian Alunkal +- * @version 1.0 +- */ +-public class QueuePanel extends JPanel implements MouseListener { +- private static Logger logger = +- Logger.getLogger(QueuePanel.class.getName()); +- +- private JTable queueTable = null; +- private JPopupMenu jpopup = null; +- JTable completeTable = null; +- +- public QueuePanel() { +- setLayout(new BorderLayout()); +- setSize(200, 300); +- setVisible(true); +- queueTable +- = new JTable(); +- +- JScrollPane jobsScrollPane +- = new JScrollPane(queueTable); +- +- add(jobsScrollPane, BorderLayout.CENTER); +- +- //Current transfers border +- Border jobsBorder = BorderFactory.createTitledBorder( +- BorderFactory.createBevelBorder(BevelBorder.LOWERED), +- "Transfer Queue"); +- setBorder(jobsBorder); +- queueTable.addMouseListener(this); +- +- jpopup = new JPopupMenu(); +- +- completeTable = queueTable; +- } // end of constructor +- +- public void createHeader(String cols[]) { +- QueueTableModel tableModel = new QueueTableModel(); +- Vector columnIDs = new Vector(); +- for (int i = 0; i < cols.length; i++) { +- columnIDs.add(cols[i]); +- } +- tableModel.setColumnIdentifiers(columnIDs); +- queueTable.setModel(tableModel); +- +- queueTable.getTableHeader().setReorderingAllowed(false); +- +- +- } +- +- public void addTransfer(String cols[]) { +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- int row = tableModel.getRowCount(); +- Vector rowData = new Vector(); +- for (int i = 0; i < cols.length; i++) { +- rowData.add(cols[i]); +- } +- tableModel.insertRow(row, rowData); +- return; +- } +- +- +- public void updateTransfer(String cols[]) { +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- if (tableModel.getRowCount() > 0) { +- int selectedRow = getRowIndex(cols[0]); +- for (int i = 0; i < cols.length; i++) { +- if (cols[i] != null) { +- tableModel.setValueAt(cols[i], selectedRow, i); +- } +- } +- } +- } +- +- public void setFocus(String jobID) { +- queueTable.repaint(); +- int row = getRowIndex(jobID); +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- int noRows = tableModel.getRowCount(); +- if (noRows > 1) { +- if (row < noRows - 1) { +- row += 1; +- } +- queueTable.scrollRectToVisible(queueTable.getCellRect(row, 0, true)); +- // queueTable.revalidate(); +- +- } +- } +- +- public void deleteTransfer(String jobid) { +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- int selectedRow = getRowIndex(jobid); +- tableModel.removeRow(selectedRow); +- +- } +- +- public JPopupMenu getPopupMenu() { +- return jpopup; +- } +- +- public int getRowIndex(String jobid) { +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- int noRows = tableModel.getRowCount(); +- int selectedRow = 0; +- for (int j = 0; j < noRows; j++) { +- if (jobid.equals(getColumnValue(j, 0))) { +- selectedRow = j; +- break; +- } +- } +- return selectedRow; +- } +- +- public int getRowIndex(java.lang.String value, int col) +- { +- javax.swing.table.DefaultTableModel tableModel = getModel(); +- int noRows = tableModel.getRowCount(); +- int selectedRow = 0; +- for(int j = 0; j < noRows; j++) +- { +- if(!value.equals(getColumnValue(j, col))) +- continue; +- selectedRow = j; +- break; +- } +- +- return selectedRow; +- } +- +- public void clear() { +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- int rowCount = tableModel.getRowCount(); +- if (rowCount > 0) { +- for (int row = 0; row < rowCount; row++) { +- tableModel.removeRow(0); +- +- } +- +- } +- return; +- } +- +- public int tableSize() { +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- int rowCount = tableModel.getRowCount(); +- return rowCount; +- } +- +- public DefaultTableModel getModel() { +- return (DefaultTableModel) queueTable.getModel(); +- } +- +- public String getSelectedJob() { +- int selectedRow = queueTable.getSelectedRow(); +- return getColumnValue(selectedRow, 0); +- } +- +- public String getColumnValue(int row, int col) { +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- return (String) tableModel.getValueAt(row, col); +- } +- +- public void setColumnValue(int row, int col, String value) { +- DefaultTableModel tableModel +- = (DefaultTableModel) getModel(); +- tableModel.setValueAt(value, row, col); +- } +- +- //#################################################### +- // MouseListener methods +- //#################################################### +- public void mousePressed(MouseEvent me) { +- Point clickPoint = new Point(me.getX(), me.getY()); +- +- int selectedRow = queueTable.rowAtPoint(clickPoint); +- +- +- queueTable.setRowSelectionInterval(selectedRow, selectedRow); +- +- if (me.isPopupTrigger()) { +- +- //Popup menu trigger button was pressed, so display +- //the choices for interacting with the selected transfer job +- +- //to show the popup uncomment this line. +- jpopup.show(queueTable, me.getX(), me.getY()); +- +- +- } +- if (me.getClickCount() == 2) { +- //Double click event +- logger.info("Double clicked"); +- } +- } +- +- public void mouseClicked(MouseEvent me) { +- } +- +- public void mouseReleased(MouseEvent me) { +- if (me.isPopupTrigger()) { +- mousePressed(me); +- } +- +- } +- +- public void mouseEntered(MouseEvent me) { +- } +- +- public void mouseExited(MouseEvent me) { +- } +- +- public void createButtonsPanel(String args[], ActionListener parent) { +- JPanel buttonPanel = new JPanel(); +- buttonPanel.setLayout(new GridLayout(1, 0)); +- for (int i = 0; i < args.length; i++) { +- JButton newButton = new JButton(args[i]); +- newButton.addActionListener(parent); +- buttonPanel.add(newButton); +- } +- add(buttonPanel, BorderLayout.SOUTH); +- } +- +- public void createCheckBoxPanel(JCheckBox args[]) { +- JPanel checkBoxPanel = new JPanel(); +- // checkBoxPanel.setLayout(new GridLayout(1,0)); +- for (int i = 0; i < args.length; i++) { +- checkBoxPanel.add(args[i]); +- } +- // checkBoxPanel.setBorder(new TitledBorder(new BevelBorder(BevelBorder.RAISED),"Display")); +- add(checkBoxPanel, BorderLayout.NORTH); +- } +- +- public void addPopupItems(String items[], ActionListener parent) { +- int sep = 0; +- for (int i = 0; i < items.length; i++) { +- +- JMenuItem menuItem = new JMenuItem(items[i]); +- menuItem.addActionListener(parent); +- jpopup.add(menuItem); +- sep++; +- if (sep == 2) { +- jpopup.addSeparator(); +- sep = 0; +- } +- } +- } +- +- public void showRows(String status, int col) { +- if (status.equals("All")) { +- queueTable = completeTable; +- } else { +- logger.info("Not yet implemented"); +- /* int noRows = tableModel.getRowCount(); +- +- for(int j =0 ; j< noRows;j++){ +- if(status.equals(getColumnValue(j,col))){ +- // addTransfer( +- +- } +- }*/ +- } +- } +- +-} // end of class +- +-class QueueTableModel extends DefaultTableModel { +- public boolean isCellEditable(int row, int col) { +- return false; +- } +-} +- +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/QueuePanel.class +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/UrlCopyPanel.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/UrlCopyPanel.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/UrlCopyPanel.java (working copy) +@@ -1,533 +0,0 @@ +-package org.globus.ogce.beans.filetransfer.gui.monitor; +- +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.globus.gsi.gssapi.auth.Authorization; +-import org.globus.gsi.gssapi.auth.IdentityAuthorization; +-import org.globus.io.urlcopy.UrlCopy; +-import org.globus.io.urlcopy.UrlCopyListener; +-import org.globus.ogce.beans.filetransfer.gui.MainInterface; +-import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.GridClient; +-import org.globus.ogce.beans.filetransfer.transfer.TransferInterface; +-import org.globus.tools.ui.util.UITools; +-import org.globus.transfer.reliable.client.utils.Utils; +-import org.globus.util.GlobusURL; +- +-import javax.swing.*; +-import java.awt.*; +-import java.awt.event.*; +-import java.io.PrintWriter; +-import java.io.StringWriter; +-import java.util.Hashtable; +- +-public class UrlCopyPanel extends JPanel implements TransferInterface, UrlCopyListener//, ActionListener +-{ +- static Log logger = +- LogFactory.getLog(UrlCopyPanel.class.getName()); +- +- QueuePanel urlcopyQueuePanel = null; +- UrlCopyOptions urlcopyOptions = null; +- Hashtable jobs = null; +- String currentJob = null; +- String errorMsg = null; +- MainInterface theApp = null; +- String finalStatus = "Unknown"; +- boolean active = false; +- +- public UrlCopyPanel() { +- this(null); +- } +- +- public UrlCopyPanel(MainInterface theApp) { +- setLayout(new BorderLayout()); +- this.theApp = theApp; +- urlcopyQueuePanel = new QueuePanel(); +- urlcopyQueuePanel.createHeader(new String[]{"Jobid", "From", "To", +- "Status", "Current", "%", "Errors", "RFT"}); +- add(urlcopyQueuePanel, BorderLayout.CENTER); +- urlcopyOptions = new UrlCopyOptions(); +- // add(urlcopyOptions.getPanel(), BorderLayout.SOUTH); +- jobs = new Hashtable(); +- //urlcopyQueuePanel.createButtonsPanel(new String[]{"Start", "Stop", "Load", "Save", "Clear"}, new ButtonActionListener()); +- urlcopyQueuePanel.addPopupItems(new String[]{"Info", "Cancel", "Restart", +- "Delete"}, new ButtonActionListener()); +- // createCheckBoxPanel(); +- +- } +- +- public void addTransfer(String jobid, String from, String to) { +- +- urlcopyQueuePanel.addTransfer(new String[]{jobid, from, to, "Submitted", +- "0", "0", "N/A"}); +- +- } +- +- public void addTransfer(String jobid, String from, String to, String rft) { +- +- urlcopyQueuePanel.addTransfer(new String[]{jobid, from, to, "Submitted", +- "0", "0", "N/A", rft}); +- +- } +- +- public void startTransfer(String jobid) { +- currentJob = jobid; +- +- if (!((isJob("Cancelled", jobid, false) || (isJob("Finished", jobid, false))))) { +- active = true; +- String from = urlcopyQueuePanel.getColumnValue( +- urlcopyQueuePanel.getRowIndex(jobid), 1); +- String to = urlcopyQueuePanel.getColumnValue( +- urlcopyQueuePanel.getRowIndex(jobid), 2); +- callUrlCopyTransfer(jobid, from, to); +- active = false; +- } else { +- return; +- } +- +- } +- +- public void updateTransfer(String jobid, String status, +- String current, String percent, String errorMsg) { +- +- urlcopyQueuePanel.updateTransfer(new String[]{jobid, null, null, status, +- current, percent +- , errorMsg}); +- +- } +- +- public void deleteTransfer(String jobid) { +- cancelTransfer(jobid); +- urlcopyQueuePanel.deleteTransfer(jobid); +- } +- +- public void cancelTransfer(String jobid) { +- if (isJob("Finished", jobid)) { +- logger.info("Job Finished id = " + jobid); +- } else { +- logger.info("Job Finished id = " + jobid); +- updateTransfer(jobid, "Cancelled", null, null, null); +- UrlCopy urlcopy = (UrlCopy) jobs.get(jobid); +- urlcopy.cancel(); +- } +- } +- +- public boolean callUrlCopyTransfer(String jobid, String from, String to) { +- System.out.println("from:" + from); +- System.out.println("to:" + to); +- +- GlobusURL froms = null; +- GlobusURL tos = null; +- UrlCopy c = null; +- if (from.equals(to)) { +- updateTransfer(jobid, "Cancelled", +- null, null, "Destination and Source are same."); +- } +- logger.info("\nJOB :: \n ID = " + jobid); +- logger.info("\nFrom = " + from); +- logger.info("\nTo = " + to); +- try { +- +- froms = new GlobusURL(from); +- tos = new GlobusURL(to); +- c = new UrlCopy(); +- c.setSourceUrl(froms); +- c.setDestinationUrl(tos); +- Authorization auth = null; +- if (null != GridClient.subject1 && !"".equals(GridClient.subject1.trim())) { +- auth = new IdentityAuthorization(GridClient.subject1); +- } +- +- c.setSourceAuthorization(auth); +- c.setDestinationAuthorization(auth); +- if (from.startsWith("gsiftp") && to.startsWith("gsiftp")) { +- c.setUseThirdPartyCopy(true); +- } else { +- c.setUseThirdPartyCopy(false); +- } +- int bufferSize; +- try { +- bufferSize = Integer.parseInt(Utils.getProperty("tcpbuffersize", "rft.properties")); +- } catch (Exception e) { +- bufferSize = 16000; +- } +- c.setBufferSize(bufferSize); +- c.setAppendMode(urlcopyOptions.getAppendMode()); +- c.setDCAU(urlcopyOptions.getDCAU()); +- c.addUrlCopyListener(this); +- jobs.put(jobid, c); +- +- long st = System.currentTimeMillis(); +- if (!(c.isCanceled())) { +- printOutput("\n\n------------------------------\n"); +- printOutput("Started Job: " + jobid); +- printOutput("\n------------------------------\n"); +- updateTransfer(currentJob, "Active", +- null, null, "No errors"); +- +- c.copy(); +- +- finalStatus = "Finished"; +- updateTransfer(currentJob, "Finished", +- null, null, "No errors"); +- +- urlcopyQueuePanel.setFocus(currentJob); +- long ft = System.currentTimeMillis(); +- long time = ft - st; +- printOutput("\nFrom :" + c.getSourceUrl() + +- "\nTo :" + c.getDestinationUrl() + +- "\nTotal time in millisec = " + time); +- +- +- } +- return true; +- +- } catch (Exception te) { +- +- String error = getStackTrace(te); +- String errorMsg = null; +- +- te.printStackTrace(); +- errorMsg = processErrorMessage(error); +- if (errorMsg == null) { +- errorMsg = te.getMessage(); +- } +- if (errorMsg.indexOf("Root error message: null") >= 0) { +- errorMsg = "File exists"; +- } +- finalStatus = "Failed : " + errorMsg; +- updateTransfer(currentJob, "Failed", +- null, null, errorMsg); +- urlcopyQueuePanel.setFocus(currentJob); +- printError("\n\n\nFrom :" + c.getSourceUrl() + +- "\nTo :" + c.getDestinationUrl() + +- "Error during actual transfer:\n" + +- error); +- return false; +- +- } +- +- +- } +- +- public String getFinalStatus() { +- return finalStatus; +- } +- +- public QueuePanel getQueuePanel() { +- return urlcopyQueuePanel; +- } +- +- public String processErrorMessage(String error) { +- String errorMsg = null; +- if ((error.indexOf("Permission denied")) > 0) { +- errorMsg = "Permission denied"; +- } else if ((error.indexOf("Expired credentials")) +- > 0) { +- errorMsg = "Credentials expired"; +- } else if (((error.indexOf("FileNotFoundException")) > 0) +- || ((error.indexOf("No such file or directory")) > 0)) { +- errorMsg = "Destination Directory is not present. Please create one."; +- +- } else if ((error.indexOf("ClassCastException")) +- > 0) { +- errorMsg = "Destination rejected third party transfer"; +- } else if (((error.indexOf("not enough space on the disk")) > 0) || ((error.indexOf("Disc quota exceeded")) > 0)) { +- errorMsg = "No space in Destination Disk. "; +- } else if ((error.indexOf("Connection reset")) +- > 0) { +- errorMsg = "Network Connection lost."; +- +- } else if (((error.indexOf("Timeout")) > 0) || +- ((error.indexOf("timed out")) > 0) || +- (((error.indexOf("timeout"))) > 0)) { +- errorMsg = "Connection Timed out. Check for firewalls. "; +- } else if (((error.indexOf("close failed")) > 0) || +- (((error.indexOf("closing"))) > 0)) { +- errorMsg = "Transfer was cancelled."; +- } +- return errorMsg; +- } +- +- Exception _exception; +- +- public void transfer(long current, long total) { +- long progress = 0; +- if (total == -1) { +- if (current == -1) { +- printOutput("This is a third party transfer."); +- } else { +- logger.info("\nJOB :: \n ID = " + currentJob + " " + current); +- } +- } else { +- double fraction = (double) current / (double) total; +- float fvalue = Math.round(Math.round(fraction * 100)); +- progress = (long) fvalue; +- logger.info("\n" + current + " out of " + total + " Percent =" + progress); +- } +- String currValue = "N/A"; +- String progressValue = "N/A"; +- if (progress != 0) { +- progressValue = progress + ""; +- } +- +- if (current > 0) { +- currValue = current + ""; +- } +- updateTransfer(currentJob, "Active", +- currValue, progressValue, "No errors"); +- } +- +- public void transferError(Exception e) { +- _exception = e; +- +- } +- +- public void transferCompleted() { +- if (_exception == null) { +- printOutput("Transfer completed successfully"); +- +- } else { +- printError("Error during transfer : " + _exception.getMessage()); +- logger.debug("Error during transfer : " + _exception.getMessage()); +- +- _exception.printStackTrace(System.out); +- +- } +- } +- +- public JPanel getOptionsPanel() { +- return urlcopyOptions.getPanel(); +- } +- +- public void createCheckBoxPanel() { +- JCheckBox allButton = new JCheckBox("All", true); +- allButton.addItemListener(new ItemListener() { +- public void itemStateChanged(ItemEvent e) { +- if (e.getStateChange() == ItemEvent.DESELECTED) { +- urlcopyQueuePanel.showRows("All", 3); +- } +- } +- }); +- JCheckBox activeButton = new JCheckBox("Active"); +- JCheckBox finishedButton = new JCheckBox("Finished"); +- JCheckBox failedButton = new JCheckBox("Failed"); +- JCheckBox othersButton = new JCheckBox("Others"); +- urlcopyQueuePanel.createCheckBoxPanel(new JCheckBox[]{allButton, activeButton, finishedButton, failedButton, othersButton}); +- } +- +- public void clear() { +- if (urlcopyQueuePanel.tableSize() > 0) { +- Object aobj[] = {"Yes", "No"}; +- int k = JOptionPane.showOptionDialog(null, " Do you wish to clear all the jobs and stop the unfinished jobs ?", "Cancellation Alert", -1, 2, null, aobj, aobj[0]); +- if (k == 1) { +- return; +- } else { +- if (!isJob("Finished", currentJob, false)) { +- cancelTransfer(currentJob); +- } +- theApp.clearQueue("urlcopy"); +- try { +- Thread.sleep(5000); +- } catch (Exception e) { +- e.printStackTrace(); +- } +- urlcopyQueuePanel.clear(); +- return; +- +- } +- } else { +- return; +- } +- } +- +- private String getStackTrace(Exception e) { +- StringWriter sw = new StringWriter(); +- PrintWriter pw = new PrintWriter(sw); +- e.printStackTrace(pw); +- return sw.toString(); +- } +- +- public void printOutput(String msg) { +- theApp.msgOut(msg); +- } +- +- public void printError(String msg) { +- theApp.msgOut(msg); +- } +- +- public static void main(String args[]) { +- JFrame frame = new JFrame("Java CoG Kit -UrlCopy File Transfer"); +- +- frame.addWindowListener(new WindowAdapter() { +- public void windowClosing(WindowEvent e) { +- System.exit(0); +- } +- }); +- +- +- Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); +- +- UrlCopyPanel urlcopyPanel = new UrlCopyPanel(); +- // frame.getContentPane().setLayout(new BorderLayout()); +- frame.getContentPane().add(urlcopyPanel); +- // frame.getContentPane().add(urlcopyPanel.getOptionsPanel().getPanel(), BorderLayout.SOUTH); +- frame.pack(); +- frame.setSize(d.width / 2, d.height / 2); +- frame.setVisible(true); +- UITools.center(null, frame); +- for (int i = 1; i < 10; i++) { +- urlcopyPanel.addTransfer("" + i, "gsiftp://arbat.mcs.anl.gov:6223/homes/alunkal/dead.letter", "gsiftp://arbat.mcs.anl.gov:6223/homes/alunkal/test" + i); +- } +- int j = 1; +- while (j < 9) { +- urlcopyPanel.startTransfer(j + ""); +- j++; +- } +- +- } +- +- public boolean isJob(String status, String job) { +- return isJob(status, job, true); +- } +- +- public boolean isJob(String status, String job, boolean alert) { +- int row = urlcopyQueuePanel.getRowIndex(job); +- if (row >= 0) { +- logger.info("VALUE OF THE CURRENT JOB =" + urlcopyQueuePanel.getColumnValue(row, 3)); +- if (urlcopyQueuePanel.getColumnValue(row, 3).equals(status)) { +- if (alert) { +- JOptionPane.showMessageDialog(null, +- "The job is already " + status, +- "URLCOPY Job Information", +- JOptionPane.PLAIN_MESSAGE); +- } +- return true; +- } else { +- return false; +- } +- } +- return false; +- } +- +- class ButtonActionListener implements ActionListener { +- public void actionPerformed(ActionEvent ae) { +- String actionCommand = ae.getActionCommand(); +- if (actionCommand.equals("Save")) { +- Thread saveThread = new Thread() { +- public void run() { +- if (urlcopyQueuePanel.tableSize() > 0) { +- theApp.saveQueueToFile("urlcopy"); +- } +- } +- }; +- saveThread.start(); +- } else if (actionCommand.equals("Load")) { +- Thread loadThread = new Thread() { +- public void run() { +- theApp.loadQueueFromFile("urlcopy"); +- } +- }; +- loadThread.start(); +- } else if (actionCommand.equals("Stop")) { +- Thread controlThread = new Thread() { +- public void run() { +- if (urlcopyQueuePanel.tableSize() > 0) { +- theApp.controlExecutionQueue(false, "urlcopy"); +- } +- } +- }; +- controlThread.start(); +- } else if (actionCommand.equals("Start")) { +- Thread controlThread = new Thread() { +- public void run() { +- if (urlcopyQueuePanel.tableSize() > 0) { +- theApp.controlExecutionQueue(true, "urlcopy"); +- } +- } +- }; +- controlThread.start(); +- } else if (actionCommand.equals("Clear")) { +- Thread controlThread = new Thread() { +- public void run() { +- if (urlcopyQueuePanel.tableSize() > 0) { +- clear(); +- } +- } +- }; +- controlThread.start(); +- } else if (actionCommand.equals("Info")) { +- String job = urlcopyQueuePanel.getSelectedJob(); +- +- int row = urlcopyQueuePanel.getRowIndex(job); +- String msg = " Job ID : " + +- urlcopyQueuePanel.getColumnValue(row, 0) +- + "\n From : " +- + urlcopyQueuePanel.getColumnValue(row, 1) + +- "\n To : " + +- urlcopyQueuePanel.getColumnValue(row, 2) + +- "\n Status : " + +- urlcopyQueuePanel.getColumnValue(row, 3) +- + "\n Errors : " + +- urlcopyQueuePanel.getColumnValue(row, 6) + +- "\n"; +- +- JOptionPane.showMessageDialog(null, +- msg, +- "URLCOPY Job Information", +- JOptionPane.PLAIN_MESSAGE); +- +- } else if (actionCommand.equals("Cancel")) { +- Thread controlThread = new Thread() { +- public void run() { +- String job = urlcopyQueuePanel.getSelectedJob(); +- cancelTransfer(job); +- +- } +- }; +- controlThread.start(); +- +- } else if (actionCommand.equals("Restart")) { +- Thread controlThread = new Thread() { +- public void run() { +- String job = urlcopyQueuePanel.getSelectedJob(); +- if ((isJob("Cancelled", job) || (isJob("Finished", job)))) { +- return; +- } +- while (active) { +- try { +- Thread.sleep(200); +- logger.info("Waiting for the previous job"); +- } catch (Exception e) { +- e.printStackTrace(); +- } +- } +- startTransfer(job); +- } +- }; +- controlThread.start(); +- +- } else if (actionCommand.equals("Delete")) { +- String job = urlcopyQueuePanel.getSelectedJob(); +- int row = urlcopyQueuePanel.getRowIndex(job); +- if (!urlcopyQueuePanel.getColumnValue(row, 3).equals("Finished") +- && !urlcopyQueuePanel.getColumnValue(row, 3).equals("Expanding_Done")) { +- Object aobj[] = {"Yes", "No"}; +- int k = JOptionPane.showOptionDialog(null, " This job is not Finished yet. Do you wish to cancel the job and delete it?", "Deletion Alert", -1, 2, null, aobj, aobj[0]); +- if (k == 1) { +- return; +- } else { +- deleteTransfer(job); +- } +- } else { +- deleteTransfer(job); +- } +- +- } +- } +- +- } +- +- +-}// end of class +- +- +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/FileTransferMainPanel.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/FileTransferMainPanel.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/FileTransferMainPanel.java (working copy) +@@ -1,775 +0,0 @@ +-package org.globus.ogce.beans.filetransfer.gui; +- +-import org.apache.log4j.Logger; +-import org.globus.ogce.beans.filetransfer.FtpProperties; +-import org.globus.ogce.beans.filetransfer.gui.local.DirEvent; +-import org.globus.ogce.beans.filetransfer.gui.local.DirListener; +-import org.globus.ogce.beans.filetransfer.gui.local.LocalTreePanel; +-import org.globus.ogce.beans.filetransfer.gui.monitor.MonitorPanel; +-import org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel; +-import org.globus.ogce.beans.filetransfer.gui.remote.common.DisplayInterface; +-import org.globus.ogce.beans.filetransfer.gui.remote.ftp.FtpClient; +-import org.globus.ogce.beans.filetransfer.gui.remote.ftp.FtpDirEvent; +-import org.globus.ogce.beans.filetransfer.gui.remote.ftp.FtpDirListener; +-import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.GridClient; +-import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.RemDirEvent; +-import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.RemDirListener; +-import org.globus.ogce.beans.filetransfer.transfer.DirTransferRequest; +-import org.globus.ogce.beans.filetransfer.transfer.FileRequest; +-import org.globus.ogce.beans.filetransfer.transfer.RFTFileTransfer; +-import org.globus.ogce.beans.filetransfer.transfer.UrlCopyFileTransfer; +-import org.globus.ogce.beans.filetransfer.util.DirQueue; +-import org.globus.ogce.beans.filetransfer.util.FileOperations; +-import org.globus.ogce.beans.filetransfer.util.GridBrokerQueue; +-import org.globus.ogce.beans.filetransfer.util.MessagePanel; +-import org.globus.rft.generated.TransferType; +-import org.globus.tools.ui.util.UITools; +-import org.globus.transfer.reliable.client.RFTClient; +-import org.globus.transfer.reliable.client.RFTJob; +-import org.globus.transfer.reliable.client.RFTOptions; +-import org.globus.transfer.reliable.client.RFTTransferParam; +-import org.globus.transfer.reliable.client.utils.Utils; +-import org.globus.util.ConfigUtil; +- +-import javax.swing.*; +-import javax.swing.event.InternalFrameAdapter; +-import javax.swing.event.InternalFrameEvent; +-import java.awt.*; +-import java.beans.PropertyVetoException; +-import java.io.File; +-import java.io.FileInputStream; +-import java.io.IOException; +-import java.io.Serializable; +-import java.util.Hashtable; +-import java.util.Properties; +- +-/** +- * This is a panel that integrates the LocalTreeBean and RemoteTreeBean to +- * demonstrate the use of grid gui beans in the design of composite beans +- * that provide File Transfer in Grids with drag and drop functionality. +- * +- * @author Beulah Kurian Alunkal +- +- */ +-public class FileTransferMainPanel extends MainInterface +- implements DirListener, +- RemDirListener, FtpDirListener, Serializable { +- public static FileTransferMainPanel mainPanel = new FileTransferMainPanel(true); +- private static Logger logger = +- Logger.getLogger(FileTransferMainPanel.class.getName()); +- protected String defaultDir = ConfigUtil.globus_dir; +- protected LocalTreePanel frame1[]; +- protected DisplayInterface frame2[]; +- +- //Counters are used to allow the users to add any no of local or remote +- //file browser beans. +- protected int remCounter = 0; +- protected int lclCounter = 0; +- private JFrame sFrame = null, mFrame = null; +- +- +- //Hashtables to retrive the ftp clients selected. +- public Hashtable gridIFTable,ftpIFTable; +- protected boolean draglocal; +- +- //Queues for storing the requests. +- protected GridBrokerQueue mainQueue = null; +- protected GridBrokerQueue requestQueue = null; +- protected DirQueue saveQueue = null; +- +- protected DisplayInterface fromRemote = null; +- protected LocalTreePanel fromLocal = null; +- protected RFTFileTransfer rftFileTransfer = null; +- protected UrlCopyFileTransfer urlcopyFileTransfer = null; +- protected FileRequest fileRequest = null; +- protected MonitorPanel monitorPanel = null; +- String from = null; +- +- protected JPanel panel = null; +- DirTransferRequest dirRequest = null; +- int maxSites = 10; +- //Parameters for bookmark. +- String profile, user, host, pass; +- int port = 0; +- int scH = 0, scW = 0; +- JDesktopPane desktop = null; +- protected JInternalFrame messageFrame; +- protected MessagePanel messagePanel = null; +- +- +- //RFT transfer +- public static int jobID = 0; +- private QueuePanel queuePanel = null; +- private RFTClient rftClient = null; +- public static int transferID = 1; +- +- +- /*In general for a bean default constructor*/ +- public FileTransferMainPanel() { +- init(); +- setLayout(new GridLayout(1, 1)); +- //add(monitorPanel); +- } +- /*Static variable uses this contructor to create a hidden bean*/ +- +- public FileTransferMainPanel(boolean val) { +- init(); +- sFrame = new JFrame("Status Window"); +- sFrame.getContentPane().setLayout(new GridLayout(1, 1)); +- sFrame.getContentPane().add(monitorPanel); +- sFrame.pack(); +- sFrame.setSize(350, 400); +- sFrame.setVisible(false); +- UITools.center(this,sFrame); +- +- mFrame = new JFrame("Messages Window"); +- mFrame.getContentPane().setLayout(new GridLayout(1, 1)); +- mFrame.getContentPane().add(messagePanel); +- mFrame.pack(); +- mFrame.setSize(350, 400); +- mFrame.setVisible(false); +- } +- +- public void showStatusWindow() { +- sFrame.setVisible(true); +- } +- +- public void showMessagesWindow() { +- mFrame.setVisible(true); +- } +- /* Normal constructor used by all graphical interfaces */ +- public FileTransferMainPanel(String label) { +- init(); +- } +- +- public void init() { +- // setBorder(new TitledBorder(new BevelBorder(BevelBorder.LOWERED),"")); +- Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); +- scW = dimension.width - 90; +- scH = dimension.height - 90 * 2; +- setBounds(0, 0, scW + 50, scH); +- System.out.println("Creating a File Transfer Listener"); +- // this.panel = panel; +- // this.desktop = desktop; +- desktop = new JDesktopPane(); +- gridIFTable = new Hashtable(); +- ftpIFTable = new Hashtable(); +- +- mainQueue = new GridBrokerQueue(); +- requestQueue = new GridBrokerQueue(); +- saveQueue = new DirQueue(); +- +- frame1 = new LocalTreePanel[maxSites]; +- frame2 = new DisplayInterface[maxSites]; +- +- createInitialFrames(); +- rftFileTransfer = new RFTFileTransfer(this, monitorPanel); +- urlcopyFileTransfer = new UrlCopyFileTransfer(this, monitorPanel); +- fileRequest = new FileRequest(requestQueue, monitorPanel); +- System.out.println("Adding Creating a File Transfer Listener"); +- desktop.putClientProperty("JDesktopPane.dragMode", "outline"); +- } +- +- public JPanel createMonitorPanel() { +- return monitorPanel; +- } +- +- protected void createInitialFrames() { +- JInternalFrame mFrame = new JInternalFrame( +- "Monitor Frame" +- , true, false, true, true); +- mFrame.setVisible(true); +- mFrame.getContentPane().setLayout(new GridLayout(1, 1)); +- monitorPanel = new MonitorPanel(this); +- mFrame.getContentPane().add(monitorPanel); +- mFrame.pack(); +- mFrame.setSize(350, 330); +- //dimensionnew.width / 5 - 30, dimensionnew.height - 95); +- mFrame.setLocation(5, 10); +- +- desktop.add(mFrame); +- +- createNewLocalFrame(); +- +- String newline = new String(System.getProperty("line.separator")); +- String msgTxt = new String("File Transfer Component"+ newline + +- "Here the Server messages be shown" +- + newline); +- +- +- messageFrame = new JInternalFrame( +- "Message Window" +- , true, false, true, true); +- messageFrame.setVisible(true); +- +- messageFrame.getContentPane().setLayout(new GridLayout(1, 1)); +- messagePanel = new MessagePanel(msgTxt); +- messageFrame.getContentPane().add(messagePanel); +- messageFrame.pack(); +- messageFrame.setLocation(5, 340); +- messageFrame.setSize(350, 135); +- //messageFrame.setVisible(true); +- desktop.add(messageFrame); +- +- rftClient = new RFTClient(null, monitorPanel.getUrlCopyPanel().getQueuePanel()); +- +- } +- +- public MonitorPanel getMonitorFrame() { +- return monitorPanel; +- } +- +- public void processRequest() { +- fileRequest.updateQueue(dirRequest); +- } +- +- public void msgOut(String s) { +- messagePanel.msgOut(s); +- } +- +- public void clearQueue(String provider) { +- logger.info("Invoked the clearQueue in main"); +- logger.info("\nPlease wait... Clearing the queues."); +- if (provider.equals("rft")) { +- rftFileTransfer.clearAllQueues(); +- } else if (provider.equals("urlcopy")) { +- urlcopyFileTransfer.clearAllQueues(); +- } else { +- fileRequest.clearRequestQueue(); +- } +- } +- +- +- public void controlExecutionQueue(boolean start, String provider) { +- if (!start) { +- JOptionPane.showMessageDialog(panel, "Will stop the job execution" + +- " only after the current active job is done. "); +- } else { +- logger.info("Calling the start transfer "); +- } +- if (provider.equals("rft")) { +- rftFileTransfer.setControl(start); +- } else if (provider.equals("urlcopy")) { +- urlcopyFileTransfer.setControl(start); +- } else { +- fileRequest.setControl(start); +- } +- } +- +- public JDesktopPane getDesktopPane() { +- return desktop; +- } +- +- public void saveQueueToFile(String provider) { +- JFileChooser fileChooser = new JFileChooser(defaultDir); +- fileChooser.setApproveButtonText("Save"); +- fileChooser.setDialogTitle("Save Jobs to File"); +- int popdownState = fileChooser.showSaveDialog(panel); +- if (popdownState == JFileChooser.CANCEL_OPTION) { +- return; +- } else { +- File saveFile = fileChooser.getSelectedFile(); +- //writing the default job file name into ftp.properties +- FtpProperties props = null; +- try { +- props = new FtpProperties(FtpProperties.configFile); +- if (provider.equals("rft")) { +- props.setRFTFile(saveFile.getAbsolutePath()); +- } else { +- props.setQueueFile(saveFile.getAbsolutePath()); +- } +- logger.info("\nThe Queue file default location saved=" +- + props.getQueueFile()); +- props.save(FtpProperties.configFile); +- +- } catch (Exception e) { +- logger.debug("The system could not open the specified file\n"); +- } +- saveQueueToFile(saveFile, provider); +- +- } +- +- } +- +- public void saveQueueToFile(File saveFile, String provider) { +- GridBrokerQueue saveQueue = null; +- String displayString = null; +- if (provider.equals("rft")) { +- saveQueue = rftFileTransfer.getSaveQueue(); +- displayString = "RFT Jobs: "; +- } else { +- saveQueue = urlcopyFileTransfer.getSaveQueue(); +- displayString = "Local Provider Jobs: "; +- } +- if (saveQueue.size() > 0) { +- int savedJobsCount = FileOperations.saveQueueToFile(saveQueue, +- saveFile, +- this, +- provider); +- JOptionPane.showMessageDialog(panel, displayString + +- "Successfully saved " + +- savedJobsCount + " jobs " + +- " are not completed yet."); +- } else { +- JOptionPane.showMessageDialog(panel, displayString + "All jobs are done." + +- " Nothing needs to be saved "); +- saveFile.delete(); +- } +- } +- +- public void setSaveQueue(GridBrokerQueue saveQueue, String provider) { +- if (provider.equals("rft")) { +- rftFileTransfer.setSaveQueue(saveQueue); +- } else { +- urlcopyFileTransfer.setSaveQueue(saveQueue); +- } +- } +- +- +- public void loadQueueFromFile(String provider) { +- JFileChooser fileChooser = new JFileChooser(defaultDir); +- fileChooser.setApproveButtonText("Load"); +- fileChooser.setDialogTitle("Load Jobs File"); +- int popdownState = fileChooser.showOpenDialog(panel); +- if (popdownState == JFileChooser.CANCEL_OPTION) { +- return; +- } else { +- +- File loadFile = fileChooser.getSelectedFile(); +- monitorPanel.clear(provider); +- loadQueueFromFile(loadFile, false, provider); +- } +- } +- +- public void loadQueueFromFile(File loadFile, boolean startup, String provider) { +- FileOperations fop = new FileOperations(); +- int filesCount = fop.loadQueueFromFile(loadFile, this, provider); +- String msg = null; +- if (filesCount > 0) { +- msg = "Successfully loaded " + filesCount + " jobs"; +- +- } else { +- msg = "Trying to load an invalid file. Each line in the file should consists of fromUrl, \n" + +- " toUrl and job id separated by semicolon. "; +- JOptionPane.showMessageDialog(panel, msg); +- } +- } +- +- +- public JPanel createNewLocalFrame() { +- if (lclCounter >= maxSites) { +- String msg = "You cannot open more than 10 local windows" + +- " at the same time. \n Please close few of them" + +- " to open new ones."; +- JOptionPane.showMessageDialog(panel, msg); +- return null; +- } +- +- frame1[lclCounter] = new LocalTreePanel("Local File System"); +- frame1[lclCounter].addDirListener(this); +- JInternalFrame localIF = new JInternalFrame("Local System", +- true, true, true, true); +- localIF.setVisible(true); +- localIF.getContentPane().setLayout(new GridLayout(1, 1)); +- localIF.getContentPane().add(frame1[lclCounter]); +- localIF.pack(); +- +- localIF.setSize(300, 450); +- localIF.setLocation(scW / 3 + 50 + (lclCounter) * 20, +- 10 + (lclCounter) * 20); +- localIF.addInternalFrameListener(new InternalFrameAdapter() { +- public void internalFrameClosing(InternalFrameEvent e) { +- lclCounter--; +- System.gc(); +- } +- }); +- desktop.add(localIF); +- try { +- localIF.setSelected(true); +- } catch (PropertyVetoException propertyvetoexception1) { +- propertyvetoexception1.printStackTrace(); +- } +- JPanel localPanel = frame1[lclCounter]; +- System.out.println("Local count incremented."); +- lclCounter++; +- return localPanel; +- } +- +- public void registerLocalComponent(LocalTreePanel local) { +- frame1[lclCounter] = local; +- frame1[lclCounter].addDirListener(this); +- lclCounter++; +- } +- +- public void registerRemoteComponent(DisplayInterface display, int index) { +- if (index == 1) { +- GridClient gc = (GridClient) display; +- gc.addRemDirListener(this); +- frame2[remCounter] = gc; +- } else { +- FtpClient fc = (FtpClient) display; +- fc.addFtpDirListener(this); +- frame2[remCounter] = fc; +- } +- +- remCounter++; +- } +- +- /** +- * Creates a frame for remote file transfer client either ftp or gridftp +- * based on the request. +- * +- * @param ftpindex indicates the client +- */ +- +- public JPanel createRemoteFrame(int ftpindex, String host, +- int port) { +- return createRemoteFrame(ftpindex, host, port, "anonymous", "password"); +- } +- +- public JPanel createRemoteFrame(int ftpindex, String host, int port, +- String user, String pwd) { +- if (remCounter >= maxSites) { +- String msg = "You cannot open more than 10 remote windows" + +- " at the same time. \n Please close few of them" + +- " to open new ones."; +- JOptionPane.showMessageDialog(panel, msg); +- return null; +- } +- if (ftpindex == 1) { +- frame2[remCounter] = new GridClient("Remote System -GridFTP "); +- final GridClient gc = (GridClient) frame2[remCounter]; +- gc.addRemDirListener(this); +- final JInternalFrame gridIF = new JInternalFrame( +- "Remote System -GridFTP" +- , true, true, true, true); +- gridIF.setVisible(true); +- gridIF.getContentPane().setLayout(new GridLayout(1, 1)); +- gridIF.getContentPane().add(gc); +- gridIF.pack(); +- JFrame topLevelFrame = (JFrame)getDesktopPane().getTopLevelAncestor(); +- int frameWidth = topLevelFrame.getWidth(); +- int frameHeight = topLevelFrame.getHeight(); +- gridIF.setSize(frameWidth / 4, frameHeight / 2); +- gridIF.setLocation((topLevelFrame.getX() + frameWidth / 5) - remCounter * 20, topLevelFrame.getY() + frameHeight / 10 + remCounter * 20); +- //gridIF.setSize(300, 450); +- //dimensionnew.width / 5 - 30, dimensionnew.height - 95); +- //gridIF.setLocation(scW / 2 + 210 - (remCounter) * 20, 10 + (remCounter) * 20); +- +- +- gridIF.addInternalFrameListener(new InternalFrameAdapter() { +- public void internalFrameClosing(InternalFrameEvent e) { +- gc.disconnect(); +- // gridIF = null; +- System.gc(); +- } +- }); +- desktop.add(gridIF); +- try { +- gridIF.setSelected(true); +- } catch (PropertyVetoException propertyvetoexception1) { +- propertyvetoexception1.printStackTrace(); +- } +- gridIFTable.put(gc, gridIF); +- remCounter++; +- if (host != null) { +- gc.setHost(host); +- if (port != 0) { +- gc.setPort(port); +- } +- if (!gc.setConnectDetails(false)) { +- return null; +- } +- +- } else { +- gc.connectDlg(null); +- UITools.center(panel, gc.dlgConnect); +- } +- return gc; +- } else if (ftpindex == 3) { +- frame2[remCounter] = new FtpClient("Remote System -FTP"); +- final FtpClient fc = (FtpClient) frame2[remCounter]; +- fc.addFtpDirListener(this); +- JInternalFrame ftpIF = new JInternalFrame( +- "Remote System -FTP", +- true, true, true, true); +- ftpIF.getContentPane().setLayout(new GridLayout(1, 1)); +- ftpIF.getContentPane().add(fc); +- ftpIF.pack(); +- ftpIF.setSize(300, 450); +- //dimensionnew.width / 5 - 30, dimensionnew.height - 95); +- ftpIF.setLocation(scW / 2 + 210 - (remCounter) * 20, +- 10 + (remCounter) * 20); +- +- ftpIF.addInternalFrameListener(new InternalFrameAdapter() { +- public void internalFrameClosing(InternalFrameEvent e) { +- fc.remoteTreeFrame._actionDisconnect(); +- // gridIF = null; +- System.gc(); +- } +- +- }); +- desktop.add(ftpIF); +- try { +- ftpIF.setSelected(true); +- } catch (PropertyVetoException propertyvetoexception1) { +- propertyvetoexception1.printStackTrace(); +- } +- ftpIFTable.put(fc, ftpIF); +- ftpIF.setVisible(true); +- remCounter++; +- if (host != null) { +- fc.setHost(host); +- if (port != 0) { +- fc.setPort(port); +- } +- if (user != null) { +- fc.setUser(user); +- } +- if (user != null) { +- fc.setPwd(pwd); +- } +- if (!fc.setConnectDetails(false)) { +- return null; +- } +- } else { +- fc.connectDlg(null); +- UITools.center(panel, fc.dlgConnect); +- } +- return fc; +- } else { +- logger.info("Extended Feature "); +- return null; +- } +- } // end of createRemoteFrame() +- +- /** +- * Methods to listen to the drag and drop events. +- * +- */ +- public void dragLocal(DirEvent e, String from, LocalTreePanel local) { +- String rftEnabled = Utils.getProperty("rft_enabled", "rft.properties"); +- if ("true".equals(rftEnabled)) { +- JOptionPane.showMessageDialog(null, "RFT is enabled, you can not transfer between local machine" + +- "and GridFTP server", "Error", JOptionPane.ERROR_MESSAGE); +- return; +- } +- +- draglocal = true; +- fromLocal = local; +- this.from = from; +- logger.info("Dragging Local files..."); +- } +- +- public void dragGridFtp(RemDirEvent e, String from, +- GridClient gc) { +- System.out.println("dragGridFTP"); +- this.from = from; +- draglocal = false; +- fromRemote = gc; +- logger.info("Dragging monitorPanel file..."); +- } +- +- public void dragFtp(FtpDirEvent e, String from, +- FtpClient fc) { +- this.from = from; +- draglocal = false; +- fromRemote = fc; +- logger.info("From Remote =" + fromRemote.getRootURL()); +- logger.info("Dragging Ftp file..."); +- } +- +- public void dropLocal(DirEvent e, String to, LocalTreePanel toLocal) { +- +- boolean dropLocal = true; +- logger.info("Dropping the file..."); +- dirRequest = new DirTransferRequest(this, +- fromLocal, toLocal, +- fromRemote, null, +- from, to, +- draglocal, dropLocal, +- monitorPanel.getProvider()); +- +- new AlertThread(this).start(); +- +- +- }//end of the function +- +- public void dropGridFtp(RemDirEvent e, String to, GridClient toRemote) { +- dirRequest = new DirTransferRequest(this, +- fromLocal, null, +- fromRemote, toRemote, +- from, to, +- draglocal, false, +- monitorPanel.getProvider()); +- +- //----------------invode rft to transfer the file-------------------------------------- +- Properties prop = getRFTProperties("rft.properties"); +- if (null != prop) { +- String rftEnabled = prop.getProperty("rft_enabled"); +- +- //using RFT +- if ("true".equals(rftEnabled)) { +- String fromHost = fromRemote.getHost(); +- String fromPort = Integer.toString(fromRemote.getPort()); +- String toHost = toRemote.getHost(); +- String toPort = Integer.toString(toRemote.getPort()); +- String destSN = toRemote.getSubject(); +- String sourceSN = ((GridClient)fromRemote).getSubject(); +- RFTWorker worker = new RFTWorker(prop, from, fromHost, fromPort, +- to, toHost, toPort, sourceSN, destSN); +- worker.start(); +- } else { +- new AlertThread(this).start(); +- } +- } else { +- new AlertThread(this).start(); +- } +- +- +- //----------------invoke rft end------------------------------------------------------- +- +- } +- +- +- public void dropFtp(FtpDirEvent e, String to, FtpClient toRemote) { +- dirRequest = new DirTransferRequest(this, +- fromLocal, null, +- fromRemote, toRemote, +- from, to, +- draglocal, false, +- monitorPanel.getProvider()); +- new AlertThread(this).start(); +- } +- +- private Properties getRFTProperties(String fileName) { +- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; +- File dir = new File(globusDir, "GridFTP_GUI"); +- File propFile = new File(dir, fileName); +- if (!propFile.exists()) { +- return null; +- } +- FileInputStream fis = null; +- Properties prop = new Properties(); +- try { +- fis = new FileInputStream(propFile); +- prop.load(fis); +- } catch (Exception e) { +- e.printStackTrace(); +- } finally { +- try { +- fis.close(); +- } catch (IOException e) { +- } +- } +- +- return prop; +- } +- /** +- * Methods to increment the counter to keep track of the no of remote +- * clients currently active. +- */ +- public void ftpCounter(FtpDirEvent e, FtpClient gc) { +- if (remCounter > 0) { +- JInternalFrame gridframe = (JInternalFrame) ftpIFTable.get(gc); +- gridframe.setVisible(false); +- remCounter--; +- logger.info("\nFtp site is disconnected. "); +- } +- +- } +- +- public void gridCounter(RemDirEvent e, GridClient gc) { +- if (remCounter > 0) { +- JInternalFrame gridframe = (JInternalFrame) gridIFTable.get(gc); +- gridframe.setVisible(false); +- remCounter--; +- logger.info("\nGridFTP site is disconnected. "); +- } +- +- } +- +- public void startActualTransfer(String provider) { +- if (provider.equals("rft")) { +- rftFileTransfer.run(); +- } else { +- urlcopyFileTransfer.run(); +- } +- +- } +- +- public void startActualTransfer(GridBrokerQueue requestQueue, +- String provider) { +- System.out.println("TESTING : Request Queue file size=" + requestQueue.size()); +- //monitorPanel.setFocusTab(1); +- if (provider.equals("rft")) { +- monitorPanel.setFocusTab(1); +- rftFileTransfer.updateQueues(requestQueue); +- monitorPanel.setFocusTab(1); +- } else +- { +- monitorPanel.setFocusTab(0); +- urlcopyFileTransfer.updateQueues(requestQueue); +- } +- } +- +- public FileTransferMainPanel(JPanel panel, JDesktopPane desktop) { +- this(); +- } +- +- class RFTWorker extends Thread { +- Properties prop = null; +- String from; +- String fromHost; +- String fromPort; +- String to; +- String toHost; +- String toPort; +- String sourceSN; +- String destSN; +- +- public RFTWorker(Properties prop, String from, String fromHost, String fromPort, +- String to, String toHost, String toPort, String sourceSN, String destSN) { +- this.prop = prop; +- this.from = from; +- this.fromHost = fromHost; +- this.fromPort = fromPort; +- this.to = to; +- this.toHost = toHost; +- this.toPort = toPort; +- this.sourceSN = sourceSN; +- this.destSN = destSN; +- } +- +- public void run() { +- String rftFrom = "gsiftp://" + fromHost + ":" + fromPort + from; +- String rftTo = "gsiftp://" + toHost + ":" + toPort + to; +- +- RFTTransferParam param = new RFTTransferParam(rftFrom, rftTo, +- prop.getProperty("host"), prop.getProperty("port")); +- int concurrent = Integer.parseInt(prop.getProperty("concurrent")); +- int parallelStream = Integer.parseInt(prop.getProperty("parallelstream")); +- int bufferSize = Integer.parseInt(prop.getProperty("tcpbuffersize")); +- RFTOptions options = new RFTOptions(concurrent, parallelStream, bufferSize, +- destSN, sourceSN); +- RFTJob job = new RFTJob(++FileTransferMainPanel.jobID, options, param); +- TransferType transfer = param.getTransfers1()[0]; +- monitorPanel.setFocusTab(0); +- monitorPanel.getUrlCopyPanel().addTransfer(Integer.toString(FileTransferMainPanel.jobID), +- rftFrom, rftTo, "true"); +- +- try { +- //queuePanel.addTransfer(cols); +- rftClient.startTransfer(job); +- } catch (Exception e1) { +- e1.printStackTrace(); +- JOptionPane.showMessageDialog(null,e1.getMessage(), "Error", +- JOptionPane.WARNING_MESSAGE); +- monitorPanel.getUrlCopyPanel().updateTransfer(Integer.toString(FileTransferMainPanel.jobID), +- "Failed", "N/A", "N/A", e1.getMessage()); +- +- } +- } +- } +- +-} +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/local/LocalTreePanel.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/local/LocalTreePanel.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/local/LocalTreePanel.java (working copy) +@@ -1,1463 +0,0 @@ +-//LocalTreePanel.java to display the local tree window +-package org.globus.ogce.beans.filetransfer.gui.local; +- +-import org.apache.log4j.Logger; +-import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; +-import org.globus.ogce.beans.filetransfer.util.DirQueue; +-import org.globus.ogce.beans.filetransfer.util.GridTransferable; +-import org.globus.ogce.beans.filetransfer.util.SortFtpString; +-import org.globus.tools.ui.util.UITools; +- +-import javax.swing.*; +-import javax.swing.event.*; +-import javax.swing.tree.*; +-import java.awt.*; +-import java.awt.dnd.*; +-import java.awt.event.*; +-import java.beans.PropertyChangeListener; +-import java.beans.PropertyChangeSupport; +-import java.io.File; +-import java.io.IOException; +-import java.io.Serializable; +-import java.net.URL; +-import java.util.Enumeration; +-import java.util.Iterator; +-import java.util.List; +-import java.util.StringTokenizer; +-import java.util.Vector; +- +- +-public class LocalTreePanel extends JPanel +- implements ActionListener, DragSourceListener, +- DragGestureListener, DropTargetListener, Serializable { +- private static Logger logger = +- Logger.getLogger(LocalTreePanel.class.getName()); +- public long firstClickTime = 0; +- protected DefaultMutableTreeNode rootNode; +- protected DefaultTreeModel treeModel; +- protected JTree tree; +- protected DefaultMutableTreeNode seekNode; +- protected DefaultMutableTreeNode lastExp; +- +- protected JToolBar toolBar; +- public Toolkit toolkit; +- public String osname; +- +- public String selectedPath; +- public JLabel statusText; +- public JTextField txtField; +- public boolean noselection; +- public DragSource dragsource = null; +- private int opSystem; +- public int FrameId = 0; +- String dirname; +- public LocalEditFrame editFrame; +- String selectedDestination = null; +- boolean bean = false; +- +- //FileToTransfer fileToTransfer; +- private String draggedValues[]; +- +- private DirQueue queue; +- private String oldTextField; +- private String as1 = ""; +- private String asn = new String(""); +- TreePath destinationPath; +- protected TreePath SelectedTreePath = null; +- protected TreePath dragtreepath = null; +- private boolean dragEnable = true; +- File deleteFile = null; +- boolean deleteFlag = true; +- DefaultMutableTreeNode defaultmutabletreenode = null; +- MutableTreeNode mutabletreenode = null; +- JButton deleteButton = null; +- JScrollPane jscrollpane = null; +- public String LclFile_Sep = new String(System.getProperty("file.separator")); +- String userHome = System.getProperty("user.home") + LclFile_Sep; +- boolean home = true; +- private PropertyChangeSupport pceListeners; +- +- +- +- protected Vector dirlisteners = new Vector(); +- +- /** Register an action listener to be notified when a button is pressed */ +- public void addDirListener(DirListener l) { +- dirlisteners.addElement(l); +- } +- +- /** Remove an Answer listener from our list of interested listeners */ +- public void removeDirListener(DirListener l) { +- dirlisteners.removeElement(l); +- } +- +- /** Send an event to all registered listeners */ +- public void fireDirEvent(DirEvent e, String path, +- LocalTreePanel local) { +- +- Vector list = (Vector) dirlisteners.clone(); +- for (int i = 0; i < list.size(); i++) { +- DirListener listener = (DirListener) list.elementAt(i); +- try { +- switch (e.getID()) { +- case DirEvent.DIR: +- listener.dropLocal(e, path, local); +- break; +- case DirEvent.LOCALDRAG: +- listener.dragLocal(e, path, local); +- break; +- +- } +- } catch (Exception direx) { +- direx.printStackTrace(); +- } +- } +- } +- +- +- public LocalTreePanel() { +- bean = true; +- init(); +- FileTransferMainPanel.mainPanel.registerLocalComponent(this); +- //statusOut("Please click on the view status button to view details of transfer. "); +- +- } +- +- public LocalTreePanel(String label) { +- init(); +- } +- +- public void init() { +- seekNode = null; +- lastExp = null; +- toolkit = Toolkit.getDefaultToolkit(); +- selectedPath = new String(); +- noselection = true; +- +- osname = new String(System.getProperty("os.name")); +- if (osname.indexOf("Windows") >= 0) { +- opSystem = 0; +- } +- +- if ((osname.indexOf("Linux") >= 0) +- || (osname.indexOf("Solaris") >= 0) +- || (osname.indexOf("Unix") >= 0) +- || (osname.indexOf("Mac") >= 0) +- || (osname.indexOf("Irix") >= 0) +- || (osname.indexOf("AIX") >= 0) +- || (osname.indexOf("HP-UX") >= 0) +- || (osname.indexOf("MPE") >= 0) +- || (osname.indexOf("FreeBSD") >= 0)) { +- opSystem = 1; +- } +- if ((osname.indexOf("OS/2") >= 0) +- || (osname.indexOf("NetWare") >= 0)) { +- opSystem = 2; +- } +- +- rootNode = new DefaultMutableTreeNode("Local System"); +- treeModel = new DefaultTreeModel(rootNode); +- treeModel.addTreeModelListener(new LclTreeModelListener()); +- mk_Drives(); +- tree = new JTree(treeModel); +- +- tree.addTreeWillExpandListener(new MyTreeWillExpandListener()); +- tree.addMouseListener(new MyAdapter()); // for double clicking +- tree.addTreeSelectionListener(new TreeSelectionListener() { +- +- public void valueChanged(TreeSelectionEvent treeselectionevent) { +- DefaultMutableTreeNode defaultmutabletreenode = +- (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); +- if (defaultmutabletreenode == null) { +- return; +- } else { +- javax.swing.tree.TreeNode atreenode[] = null; +- atreenode = defaultmutabletreenode.getPath(); +- selectedPath = returnPath(atreenode); +- SelectedTreePath = treeselectionevent.getNewLeadSelectionPath(); +- return; +- } +- } +- +- }); +- tree.setEditable(false); +- tree.getSelectionModel().setSelectionMode(4); +- tree.setShowsRootHandles(true); +- ToolTipManager.sharedInstance().registerComponent(tree); +- LclRenderer lclrenderer = new LclRenderer(); +- tree.setCellRenderer(lclrenderer); +- tree.putClientProperty("JTree.lineStyle", "Angled"); +- jscrollpane = new JScrollPane(tree); +- new DropTarget(tree, this); +- dragsource = DragSource.getDefaultDragSource(); +- dragsource.createDefaultDragGestureRecognizer(tree, 3, this); +- +- toolBar = new JToolBar(); +- toolBar.setFloatable(false); +- +- +- JButton jbutton = createButton("images/16x16/reload.png", +- "Click here to Refresh", +- "4"); +- toolBar.add(jbutton); +- jbutton = createButton("images/16x16/up.png", +- "Click here to go one Directory Up", +- "6"); +- toolBar.add(jbutton); +- jbutton = createButton("images/16x16/view_text.png", +- "Click here to view Directory Info", +- "3"); +- toolBar.add(jbutton); +- JToggleButton jbutton1 = createToggleButton("images/16x16/folder_home.png", +- "Toggle between root and home directories", +- "2"); +- toolBar.add(jbutton1); +- +- +- toolBar.addSeparator(); +- toolBar.addSeparator(); +- jbutton = createButton("images/16x16/folder.png", +- "Click here to Create a new Directory", +- "7"); +- toolBar.add(jbutton); +- +- +- jbutton = createButton("images/16x16/folder_rename.png", +- "Click here to Rename a File/Directory", +- "5"); +- toolBar.add(jbutton); +- +- deleteButton = createButton("images/16x16/folder_delete.png", +- "Click here to delete a File/Directory", +- "1"); +- toolBar.add(deleteButton); +- +- if (bean) { +- toolBar.addSeparator(); +- toolBar.addSeparator(); +- toolBar.addSeparator(); +- +- jbutton = createButton("images/16x16/view_text.png", +- "View the status window.", +- "8"); +- toolBar.add(jbutton); +- jbutton = createButton("images/16x16/view_msg.png", +- "View the messages window.", +- "9"); +- toolBar.add(jbutton); +- } +- +- +- JPanel jpanel = new JPanel(); +- jpanel.setLayout(new BorderLayout()); +- txtField = new JTextField("Address Bar"); +- setOldField(); +- txtField.addActionListener(this); +- jpanel.add(txtField, "South"); +- JPanel jpanel1 = new JPanel(new BorderLayout()); +- statusText = new JLabel("Status : Local Files displayed "); +- //jpanel1.add(statusText, "West"); +- +- +- jpanel.add(toolBar, "North"); +- +- setLayout(new BorderLayout()); +- add(jpanel, "North"); +- add(jscrollpane, "Center"); +- add(jpanel1, "South"); +- setVisible(true); +- queue = new DirQueue(); +- } +- +- public String getTextField() { +- return txtField.getText(); +- } +- +- public void setFrameId(int id) { +- FrameId = id; +- } +- +- public int getFrameId() { +- return FrameId; +- } +- +- public void setOldField() { +- oldTextField = txtField.getText(); +- } +- +- public void setTextField(String newValue) { +- chDir(newValue); +- pceListeners.firePropertyChange("txtField", oldTextField, newValue); +- setOldField(); +- } +- +- public void addPropertyChangeListener(PropertyChangeListener l) { +- if (pceListeners == null) { +- pceListeners = new PropertyChangeSupport(this); +- } +- pceListeners.addPropertyChangeListener(l); +- } +- +- public void removePropertyChangeListener(PropertyChangeListener l) { +- pceListeners.removePropertyChangeListener(l); +- } +- +- public void actionPerformed(ActionEvent actionevent) { +- if (actionevent.getSource() == txtField) { +- setTextField(txtField.getText()); +- } else { +- String s = actionevent.getActionCommand(); +- int i = 0; +- try { +- i = Integer.valueOf(s).intValue(); +- } catch (NumberFormatException numberformatexception) { +- numberformatexception.printStackTrace(); +- } +- switch (i) { +- case 1: // delete the file +- removeCurrentNode(); +- break; +- +- case 2: //toggle home and root +- toggleHomeRoot(); +- break; +- +- case 3: // display dir info +- _actionDirInfo(""); +- break; +- +- case 4: // refresh the window +- _actionRefresh(); +- break; +- +- case 5: // rename the file or dir +- _actionRename(); +- break; +- +- case 6: // go up one directory +- _actionGo1DirUp(); +- break; +- +- case 7: +- _actionMakeDir(); +- break; +- +- case 8: +- FileTransferMainPanel.mainPanel.showStatusWindow(); +- break; +- +- case 9: +- FileTransferMainPanel.mainPanel.showMessagesWindow(); +- break; +- +- } +- } +- +- } +- +- public void toggleHomeRoot() { +- clear(); +- if (!home) { +- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(null, userHome); +- addObject(defaultmutabletreenode1, ""); +- home = true; +- JOptionPane.showMessageDialog(this, +- "Changed to new address: " + userHome); +- txtField.setText(userHome); +- } else { +- +- if (opSystem == 1) { +- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(null, "//"); +- addObject(defaultmutabletreenode1, ""); +- home = false; +- JOptionPane.showMessageDialog(this, +- "Changed to new address: //"); +- txtField.setText("//"); +- } else { +- mk_Drives(); +- home = false; +- JOptionPane.showMessageDialog(this, +- "Changed to new address: System drives"); +- txtField.setText("Local System drives"); +- } +- } +- +- } +- +- public void displayFile() { +- String as[] = returnSelectedFiles(true); +- if (as != null) { +- editFrame = new LocalEditFrame(as, LclFile_Sep); +- editFrame.addWindowListener(new WindowAdapter() { +- +- public void windowClosing(WindowEvent windowevent) { +- editFrame = null; +- System.gc(); +- } +- +- }); +- editFrame.pack(); +- editFrame.setVisible(true); +- } +- } +- +- public void clear() { +- rootNode.removeAllChildren(); +- treeModel.reload(); +- } +- +- public JButton createButton(String s, String s1, String s2) { +- ClassLoader classLoader = getClass().getClassLoader(); +- URL jarCogImage = classLoader.getResource(s); +- JButton jbutton = new JButton(new ImageIcon(jarCogImage)); +- jbutton.setActionCommand(s2); +- jbutton.addActionListener(this); +- jbutton.setToolTipText(s1); +- Dimension dimension = new Dimension(20, 20); +- jbutton.setMaximumSize(dimension); +- jbutton.setMinimumSize(dimension); +- jbutton.setPreferredSize(dimension); +- jbutton.setRequestFocusEnabled(false); +- return jbutton; +- } +- +- public JToggleButton createToggleButton(String s, String s1, String s2) { +- ClassLoader classLoader = getClass().getClassLoader(); +- URL jarCogImage = classLoader.getResource(s); +- JToggleButton jbutton = new JToggleButton(new ImageIcon(jarCogImage)); +- jbutton.setActionCommand(s2); +- jbutton.addActionListener(this); +- jbutton.setToolTipText(s1); +- Dimension dimension = new Dimension(20, 20); +- jbutton.setMaximumSize(dimension); +- jbutton.setMinimumSize(dimension); +- jbutton.setPreferredSize(dimension); +- jbutton.setRequestFocusEnabled(false); +- return jbutton; +- } +- +- public void mk_Drives() { +- +- File[] roots = File.listRoots(); +- try { +- for (int i = 0; i < roots.length; i++) { +- File root = roots[i]; +- if (root.isDirectory()) { +- DefaultMutableTreeNode defaultmutabletreenode = addObject(null, root.getCanonicalPath()); +- addObject(defaultmutabletreenode, ""); +- } +- } +- } catch (IOException e) { +- e.printStackTrace(); +- } +- +- //For Windows, let home = false +- if (opSystem == 0) { +- home = false; +- } +- +- } +- +- public DefaultMutableTreeNode addObject(Object obj) { +- DefaultMutableTreeNode defaultmutabletreenode = null; +- TreePath treepath = tree.getSelectionPath(); +- if (treepath == null) { +- toolkit.beep(); +- return null; +- } +- defaultmutabletreenode = (DefaultMutableTreeNode) treepath.getLastPathComponent(); +- if (defaultmutabletreenode == rootNode) { +- toolkit.beep(); +- return null; +- } else { +- return addObject(defaultmutabletreenode, obj, true); +- } +- } +- +- public DefaultMutableTreeNode addObject +- (DefaultMutableTreeNode defaultmutabletreenode, Object obj) { +- return addObject(defaultmutabletreenode, obj, false); +- } +- +- public DefaultMutableTreeNode addObject +- (DefaultMutableTreeNode defaultmutabletreenode, Object obj, +- boolean flag) { +- DefaultMutableTreeNode defaultmutabletreenode1 = +- new DefaultMutableTreeNode(obj); +- if (defaultmutabletreenode == null) { +- defaultmutabletreenode = rootNode; +- } +- treeModel.insertNodeInto(defaultmutabletreenode1, +- defaultmutabletreenode, +- defaultmutabletreenode.getChildCount()); +- if (flag) { +- tree.scrollPathToVisible(new TreePath(defaultmutabletreenode1.getPath())); +- } +- return defaultmutabletreenode1; +- } +- +- public void listDir(DefaultMutableTreeNode defaultmutabletreenode, +- String s, +- boolean flag) { +- +- File file = new File(s); +- +- String as[] = null; +- as = file.list(); +- if (as == null) { +- return; +- } +- int i = as.length; +- SortFtpString.startSort(as); +- if (i == 0) { +- addObject(defaultmutabletreenode, "", false); +- return; +- } +- for (int j = 0; j < i; j++) { +- File file1; +- if (file.toString().endsWith(LclFile_Sep)) { +- file1 = new File(file.toString() + as[j]); +- } else { +- file1 = new File(file.toString() + LclFile_Sep + as[j]); +- } +- if (file1.isDirectory()) { +- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(defaultmutabletreenode, as[j] + LclFile_Sep, flag); +- addObject(defaultmutabletreenode1, "", false); +- } +- } +- +- for (int k = 0; k < i; k++) { +- File file2; +- if (file.toString().endsWith(LclFile_Sep)) { +- file2 = new File(file.toString() + as[k]); +- } else { +- file2 = new File(file.toString() + LclFile_Sep + as[k]); +- } +- if (!file2.isDirectory()) { +- addObject(defaultmutabletreenode, as[k], flag); +- } +- Font font = new Font("Dialog", Font.PLAIN, 12); +- Enumeration keys = UIManager.getLookAndFeelDefaults() +- .keys(); +- +- while (keys.hasMoreElements()) { +- Object key = keys.nextElement(); +- +- if (UIManager.get(key) instanceof Font) { +- UIManager.put(key, font); +- } +- } +- } +- +- } +- +- public TreePath[] returnSelectedPaths() { +- DefaultMutableTreeNode defaultmutabletreenode = +- (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); +- TreePath atreepath[] = null; +- if (defaultmutabletreenode == null) { +- return atreepath; +- } +- //atreepath = tree.getSelectionModel().getSelectionPaths(); +- if (defaultmutabletreenode.isLeaf()) { +- atreepath = tree.getSelectionModel().getSelectionPaths(); +- return atreepath; +- } else { +- TreePath atreepath1[] = tree.getSelectionPaths(); +- return atreepath1; +- // return null; +- } +- +- } +- +- public String[] returnSelectedPaths1() { +- TreePath atreepath[] = tree.getSelectionModel().getSelectionPaths(); +- String s = null; +- String as[] = null; +- if (atreepath != null) { +- int i = atreepath.length; +- as = new String[i]; +- for (int j = 0; j < i; j++) { +- Object aobj[] = atreepath[j].getPath(); +- int k = aobj.length; +- for (int l = 1; l < k; l++) { +- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) aobj[l]; +- if (!defaultmutabletreenode.isLeaf()) { +- if (l == 1 && defaultmutabletreenode +- != rootNode) { +- s = new String(); +- } +- s = s.concat(aobj[l].toString()); +- } +- } +- +- as[j] = new String(s); +- } +- +- } +- return as; +- } +- +- public String[] returnSelectedFiles(boolean flag) { +- TreePath atreepath[] = returnSelectedPaths(); +- String as[] = null; +- if (atreepath != null) { +- int i = atreepath.length; +- as = new String[i]; +- for (int j = 0; j < i; j++) { +- Object aobj[] = atreepath[j].getPath(); +- int k = aobj.length; +- String s = new String(); +- for (int l = 1; l < k; l++) { +- s = s.concat(aobj[l].toString()); +- } +- +- if (flag) { +- as[j] = new String("file:" + s); +- } else { +- as[j] = new String(s); +- } +- } +- +- } +- return as; +- } +- +- +- public DefaultMutableTreeNode seekParent(DefaultMutableTreeNode defaultmutabletreenode, String s) { +- if (defaultmutabletreenode == null) { +- +- return null; +- } +- +- int i = defaultmutabletreenode.getChildCount(); +- for (int j = 0; j < i; j++) { +- javax.swing.tree.TreeNode treenode = +- defaultmutabletreenode.getChildAt(j); +- String s1 = treenode.toString(); +- if (s.compareTo(s1) == 0) { +- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treenode; +- return defaultmutabletreenode1; +- } +- } +- +- +- return null; +- } +- +- +- public boolean chDir(String s) { +- String s1 = s; +- if (s1.endsWith(LclFile_Sep)) { +- s1 = s1.substring(0, s1.lastIndexOf(LclFile_Sep)); +- } else { +- return false; +- } +- //JOptionPane.showMessageDialog(null, "string s1=" + s1); +- StringTokenizer stringtokenizer = new StringTokenizer(s1, LclFile_Sep); +- Vector vector = new Vector(); +- for (; stringtokenizer.hasMoreTokens(); vector.addElement(stringtokenizer.nextToken() + LclFile_Sep)) { +- logger.info("Adding the file separator"); +- } +- if (opSystem == 0) { +- String s2 = s1.substring(0, 1).toUpperCase(); +- char c = s2.charAt(0); +- char ac[] = ((String) vector.firstElement()).toCharArray(); +- ac[0] = c; +- vector.setElementAt(new String(ac), 0); +- } +- if (opSystem == 1) { +- vector.add(0, new String(LclFile_Sep)); +- } +- clear(); +- mk_Drives(); +- +- // treeModel.reload(); +- DefaultMutableTreeNode defaultmutabletreenode = rootNode; +- +- int i = vector.size(); +- +- for (int j = 0; j < i; j++) { +- +- defaultmutabletreenode = seekParent(defaultmutabletreenode, (String) vector.elementAt(j)); +- if (defaultmutabletreenode != null) { +- tree.expandPath(new TreePath(defaultmutabletreenode.getPath())); +- } +- +- } +- +- if (defaultmutabletreenode == null) { +- setOldField(); +- +- //statusOut("Status : Ready "); +- } else { +- //statusOut("Changed to " + s + "directory"); +- //statusOut("Status : Ready "); +- } +- return true; +- } +- +- public void whereIsNode(DefaultMutableTreeNode defaultmutabletreenode, int i, String s) { +- seekNode = null; +- for (int j = 0; j < i; j++) { +- DefaultMutableTreeNode defaultmutabletreenode1 = +- (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(j); +- if (defaultmutabletreenode1.isLeaf()) { +- continue; +- } +- javax.swing.tree.TreeNode atreenode[] = defaultmutabletreenode1.getPath(); +- TreePath treepath = new TreePath(atreenode); +- String s1 = defaultmutabletreenode1.toString(); +- if (s1.equals(s)) { +- j = i + 1; +- seekNode = defaultmutabletreenode1; +- break; +- } +- if (!tree.isExpanded(treepath)) { +- continue; +- } +- if (s1.equals(s)) { +- j = i + 1; +- seekNode = defaultmutabletreenode1; +- break; +- } +- whereIsNode(defaultmutabletreenode1, defaultmutabletreenode1.getChildCount(), s); +- } +- +- } +- +- public void _actionRefresh() { +- String s = txtField.getText(); +- chDir(s); +- logger.info("The window was refreshed at dir = " + s); +- +- } +- +- +- public synchronized void statusOut(String s) { +- //statusText.setText(s); +- +- } +- +- class LclRenderer extends DefaultTreeCellRenderer { +- +- public Component getTreeCellRendererComponent +- (JTree jtree, Object obj, boolean flag, +- boolean flag1, boolean flag2, int i, +- boolean flag3) { +- super.getTreeCellRendererComponent(jtree, obj, flag, +- flag1, flag2, i, flag3); +- if (!flag2) { +- setToolTipText("Local Path"); +- if (isLocalSystem(obj)) { +- setIcon(LclSystemIcon); +- setToolTipText("Local Hirarchy"); +- } +- if (isLocalDrive(obj)) { +- setIcon(LclDriveIcon); +- setToolTipText("Local Drives"); +- } +- } else { +- setToolTipText("fileClickMessage"); +- } +- return this; +- } +- +- protected boolean isLocalSystem(Object obj) { +- DefaultMutableTreeNode defaultmutabletreenode = +- (DefaultMutableTreeNode) obj; +- Object obj1 = defaultmutabletreenode.getUserObject(); +- String s = obj1.toString(); +- return s.indexOf("local") >= 0; +- } +- +- protected boolean isLocalDrive(Object obj) { +- DefaultMutableTreeNode defaultmutabletreenode = +- (DefaultMutableTreeNode) obj; +- Object obj1 = defaultmutabletreenode.getUserObject(); +- String s = obj1.toString(); +- return s.indexOf("NodeLabel") >= 0; +- } +- +- +- ImageIcon LclSystemIcon; +- ImageIcon LclDriveIcon; +- ImageIcon LclFileIcon; +- +- public LclRenderer() { +- LclSystemIcon = new ImageIcon("images/16x16/konsole2.png"); +- LclDriveIcon = new ImageIcon("images/16x16/filesave.png"); +- LclFileIcon = new ImageIcon("file.gif"); +- super.setBorderSelectionColor(null); +- super.setBackgroundNonSelectionColor(null); +- super.setTextNonSelectionColor(Color.blue); +- super.setLeafIcon(LclFileIcon); +- } +- } +- +- class MyTreeWillExpandListener +- implements TreeWillExpandListener { +- MyTreeWillExpandListener() { +- } +- +- public void treeWillExpand(TreeExpansionEvent treeexpansionevent) { +- DefaultMutableTreeNode defaultmutabletreenode = null; +- Object aobj[] = null; +- aobj = treeexpansionevent.getPath().getPath(); +- int i = aobj.length; +- defaultmutabletreenode = (DefaultMutableTreeNode) aobj[i - 1]; +- if (defaultmutabletreenode == rootNode) { +- statusOut("Node was not selected to expand."); +- return; +- } else { +- +- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treeModel.getChild(aobj[i - 1], 0); +- treeModel.removeNodeFromParent(defaultmutabletreenode1); +- String s1 = returnPath(aobj); +- statusOut("Please wait..Expanding dir " + s1); +- listDir(defaultmutabletreenode, s1, false); +- +- txtField.setText(s1); +- +- noselection = false; +- tree.getSelectionModel().clearSelection(); +- statusOut("Status: Ready"); +- return; +- } +- } +- +- public void treeWillCollapse(TreeExpansionEvent treeexpansionevent) { +- DefaultMutableTreeNode defaultmutabletreenode = null; +- tree.getSelectionModel().clearSelection(); +- Object aobj[] = null; +- aobj = treeexpansionevent.getPath().getPath(); +- int i = aobj.length; +- if (i > 1) { +- defaultmutabletreenode = (DefaultMutableTreeNode) aobj[i - 1]; +- } else { +- defaultmutabletreenode = rootNode; +- } +- if (defaultmutabletreenode == rootNode) { +- // txtField.setText("Local Path "); +- noselection = true; +- treeModel.reload(defaultmutabletreenode); +- return; +- } +- noselection = false; +- defaultmutabletreenode.removeAllChildren(); +- addObject(defaultmutabletreenode, ""); +- aobj = ((DefaultMutableTreeNode) defaultmutabletreenode.getParent()).getPath(); +- lastExp = null; +- getLastExpandeNode(rootNode, treeexpansionevent.getPath()); +- if (lastExp != null) { +- javax.swing.tree.TreeNode atreenode[] = treeModel.getPathToRoot(lastExp); +- TreePath treepath = new TreePath(atreenode); +- Object aobj1[] = treepath.getPath(); +- String s1 = returnPath(aobj1); +- txtField.setText(s1); +- } else { +- +- //txtField.setText("Local Path "); +- noselection = true; +- } +- treeModel.reload(defaultmutabletreenode); +- } +- +- } +- +- class LclTreeModelListener +- implements TreeModelListener { +- +- public void treeNodesChanged(TreeModelEvent treemodelevent) { +- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) treemodelevent.getTreePath().getLastPathComponent(); +- try { +- int i = treemodelevent.getChildIndices()[0]; +- defaultmutabletreenode = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(i); +- } catch (NullPointerException nullpointerexception) { +- nullpointerexception.printStackTrace(); +- } +- javax.swing.tree.TreeNode atreenode[] = null; +- atreenode = defaultmutabletreenode.getPath(); +- File file = new File(returnPath(atreenode)); +- File file1 = new File(selectedPath); +- file1.renameTo(file); +- } +- +- public void treeNodesInserted(TreeModelEvent treemodelevent) { +- } +- +- public void treeNodesRemoved(TreeModelEvent treemodelevent) { +- } +- +- public void treeStructureChanged(TreeModelEvent treemodelevent) { +- } +- +- LclTreeModelListener() { +- } +- } +- +- +- public String returnPath(Object aobj[]) { +- int i = aobj.length; +- String s = new String(); +- for (int j = 1; j < i; j++) { +- s = s.concat(aobj[j].toString()); +- } +- return s; +- } +- +- public void setSelectedSource() { +- draggedValues = returnSelectedFiles(false); +- File lcl = new File(draggedValues[0]); +- fireDirEvent(new DirEvent(this, DirEvent.LOCALDRAG), +- lcl.getAbsolutePath(), this); +- } +- +- public void setSelectedDestination() { +- String as[] = returnSelectedPaths1(); +- if (as == null || as[0] == null) { +- as = new String[1]; +- as[0] = new String(txtField.getText()); +- } +- this.selectedDestination = as[0]; +- } +- +- public void transfer() { +- fireDirEvent(new DirEvent(this, DirEvent.DIR), selectedDestination, this); +- } +- +- public void dragGestureRecognized(DragGestureEvent draggestureevent) { +- draggedValues = returnSelectedFiles(false); +- +- dragtreepath = SelectedTreePath; +- if (draggedValues == null) { +- +- return; +- } else if (!(dragEnable)) { +- JOptionPane.showMessageDialog(null, "Please wait till the status\n bar shows drag enabled."); +- return; +- +- } else { +- GridTransferable Gridtransferable = +- new GridTransferable(draggedValues); +- +- draggestureevent.startDrag(DragSource.DefaultCopyDrop, +- Gridtransferable, this); +- queue.deleteAll(); +- File lcl = new File(draggedValues[0]); +- fireDirEvent(new DirEvent(this, DirEvent.LOCALDRAG), +- lcl.getAbsolutePath(), this); +- statusOut("Please wait. Copying the directory ... "); +- return; +- } +- } +- +- public void setDragEnabled(boolean flag) { +- dragEnable = flag; +- if (flag) { +- +- tree.setBackground(Color.white); +- statusOut("Successfully done dragging."); +- statusOut("Status : Ready "); +- } else { +- tree.setBackground(Color.lightGray); +- statusOut("Frame disabled. Please wait ... till" + +- " the color changes back to white."); +- } +- +- } +- +- +- public void dragEnter(DragSourceDragEvent dragsourcedragevent) { +- } +- +- public void dragOver(DragSourceDragEvent dragsourcedragevent) { +- } +- +- public void dragExit(DragSourceEvent dragsourceevent) { +- } +- +- public void dropActionChanged(DragSourceDragEvent dragsourcedragevent) { +- } +- +- public void dragDropEnd(DragSourceDropEvent dragsourcedropevent) { +- if (dragsourcedropevent.getDropSuccess()) { +- int i = dragsourcedropevent.getDropAction(); +- logger.info("Value of i :" + i); +- } +- } +- +- public void dragEnter(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { +-// int i = droptargetdragevent.getDropAction(); +-// if ((i & 1) != 0) { +-// statusOut("Dragging ..."); +-// } +-// if ((i & 2) != 0) { +-// statusOut("Moving ..."); +-// } +-// if ((i & 0x40000000) != 0) { +-// statusOut("Linking ..."); +-// } +-// if (!isDragAcceptable(droptargetdragevent)) { +-// droptargetdragevent.rejectDrag(); +-// return; +-// } else { +-// return; +-// } +- +- } +- +- public void dragExit(java.awt.dnd.DropTargetEvent droptargetevent) { +- } +- +- public void dragOver(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { +- +- //set cursor location. Needed in setCursor method +- Point cursorLocationBis = droptargetdragevent.getLocation(); +- TreePath dPath = +- tree.getPathForLocation(cursorLocationBis.x, cursorLocationBis.y); +- +- tree.setSelectionPath(dPath); +- tree.scrollPathToVisible(dPath); +- cursorLocationBis = null; +- +- } +- +- public void dropActionChanged(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { +- if (!isDragAcceptable(droptargetdragevent)) { +- droptargetdragevent.rejectDrag(); +- return; +- } else { +- return; +- } +- } +- +- public void drop(java.awt.dnd.DropTargetDropEvent droptargetdropevent) { +- if (!isDropAcceptable(droptargetdropevent)) { +- droptargetdropevent.rejectDrop(); +- return; +- } else if (!(dragEnable)) { +- return; +- } +- //get new parent node +- Point loc = droptargetdropevent.getLocation(); +- destinationPath = tree.getPathForLocation(loc.x, loc.y); +- +- +- final String msg = testDropTarget(destinationPath, dragtreepath); +- if (msg != null) { +- droptargetdropevent.rejectDrop(); +- +- SwingUtilities.invokeLater(new Runnable() { +- public void run() { +- JOptionPane.showMessageDialog( +- null, msg, "Error Dialog", JOptionPane.ERROR_MESSAGE +- ); +- } +- }); +- return; +- } +- +- +- java.awt.datatransfer.Transferable transferable = droptargetdropevent.getTransferable(); +- java.awt.datatransfer.DataFlavor adataflavor[] = transferable.getTransferDataFlavors(); +- for (int i = 0; i < adataflavor.length; i++) { +- java.awt.datatransfer.DataFlavor dataflavor = adataflavor[i]; +- try { +- if (dataflavor.equals(java.awt.datatransfer.DataFlavor.javaFileListFlavor)) { +- List list = (List) transferable.getTransferData(dataflavor); +- Iterator iterator = list.iterator(); +- Vector vector = new Vector(); +- String s; +- for (; iterator.hasNext(); vector.add(s)) { +- s = iterator.next().toString(); +- } +- +- +- doCopyAction(vector); +- } +- } catch (java.awt.datatransfer.UnsupportedFlavorException unsupportedflavorexception) { +- logger.debug("Exception = " + unsupportedflavorexception.toString()); +- } catch (IOException ioexception) { +- logger.debug("Exception = " + ioexception.toString()); +- } +- } +- +- droptargetdropevent.dropComplete(true); +- +- } +- +- private String testDropTarget(TreePath destination, TreePath dropper) { +- //Typical Tests for dropping +- +- //Test 1. +- boolean destinationPathIsNull = destination == null; +- if (destinationPathIsNull) { +- return "Invalid drop location."; +- } +- if (destination.equals(dropper)) { +- logger.info("destination =" + destination + +- "\nsource= " + dropper); +- _actionRefresh(); +- return "Destination cannot be same as source"; +- } +- +- +- return null; +- } +- +- public boolean isDragAcceptable(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { +- return (droptargetdragevent.getDropAction() & 3) != 0; +- } +- +- public boolean isDropAcceptable(java.awt.dnd.DropTargetDropEvent droptargetdropevent) { +- return (droptargetdropevent.getDropAction() & 3) != 0; +- } +- +- +- public void doCopyAction(Vector vector) { +- +- int i = vector.size(); +- +- String s = null; +- String as[] = returnSelectedPaths1(); +- +- if (as == null || as[0] == null) { +- as = new String[1]; +- as[0] = new String(txtField.getText()); +- } +- +- +- Object aobj[] = destinationPath.getPath(); +- int k = aobj.length; +- for (int l = 1; l < k; l++) { +- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) aobj[l]; +- if (!defaultmutabletreenode.isLeaf()) { +- if (l == 1 && defaultmutabletreenode != rootNode) { +- s = new String(); +- } +- s = s.concat(aobj[l].toString()); +- } +- } +- asn = as[0]; +- for (int j = 0; j < i; j++) { +- as1 = (String) vector.elementAt(j); +- +- +- } +- //System.out.println("transfer data"); +- logger.info("Called the drop listener"); +-// System.out.println("called the drop listener"); +-// FileTransferMainPanel.mainPanel.showStatusWindow(); +-// FileTransferMainPanel.mainPanel.showMessagesWindow(); +- fireDirEvent(new DirEvent(this, DirEvent.DIR), as[0], this); +- } +- +- public void getLastExpandeNode(DefaultMutableTreeNode defaultmutabletreenode, TreePath treepath) { +- int i = defaultmutabletreenode.getChildCount(); +- for (int j = 0; j < i; j++) { +- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(j); +- if (!defaultmutabletreenode1.isLeaf()) { +- javax.swing.tree.TreeNode atreenode[] = defaultmutabletreenode1.getPath(); +- TreePath treepath1 = new TreePath(atreenode); +- if (!treepath1.equals(treepath) && tree.isExpanded(treepath1)) { +- lastExp = defaultmutabletreenode1; +- getLastExpandeNode(defaultmutabletreenode1, treepath); +- } +- } +- } +- +- } +- +- public void removeCurrentNode() { +- int i = tree.getSelectionModel().getSelectionCount(); +- if (i == 0) { +- toolkit.beep(); +- statusOut("Nothing was selected"); +- statusOut("Status : Ready "); +- return; +- } +- for (int j = 0; j < i; j++) { +- TreePath treepath = tree.getSelectionPath(); +- if (treepath != null) { +- +- defaultmutabletreenode +- = (DefaultMutableTreeNode) treepath.getLastPathComponent(); +- mutabletreenode = (MutableTreeNode) defaultmutabletreenode.getParent(); +- javax.swing.tree.TreeNode atreenode[] = null; +- atreenode = defaultmutabletreenode.getPath(); +- String s = returnPath(atreenode); +- if (mutabletreenode != null && mutabletreenode != rootNode) { +- String msg = null; +- deleteFile = new File(s); +- +- if (deleteFile.isDirectory()) { +- msg = "directory"; +- +- } else { +- msg = "file"; +- } +- Object aobj[] = { +- "Cancel", "Delete"}; +- int k = JOptionPane.showOptionDialog(this, "Do you really want to delete this " + msg, "Delete Alert", -1, 2, null, aobj, aobj[0]); +- if (k != 0) { +- if (deleteFile.isDirectory()) { +- dirDelete(); +- } else { +- deleteFlag = deleteFile.delete(); +- +- if (deleteFlag) { +- logger.info("\nThe" + msg + "is successfully deleted " + deleteFile); +- treeModel.removeNodeFromParent(defaultmutabletreenode); +- if (treeModel.getChildCount(mutabletreenode) == 0) { +- addObject((DefaultMutableTreeNode) mutabletreenode, ""); +- } +- statusOut("Successfully deleted" + +- " File: " + deleteFile); +- statusOut("Status : Ready "); +- } else { +- toolkit.beep(); +- statusOut("Permission Denied"); +- statusOut("Status : Ready "); +- JOptionPane.showMessageDialog(null, deleteFile + " : Permission Denied."); +- } +- } +- } else { +- toolkit.beep(); +- statusOut("No selection was made"); +- statusOut("Status : Ready "); +- } +- } +- } +- } +- } +- +- public void dirDelete() { +- Thread dirDelete = new Thread() { +- public void run() { +- deleteButton.setEnabled(false); +- setDragEnabled(false); +- deleteFlag = deleteDir(deleteFile); +- if (deleteFlag) { +- logger.info("\nThe Directory is successfully" + +- " deleted " + deleteFile); +- treeModel.removeNodeFromParent(defaultmutabletreenode); +- if (treeModel.getChildCount(mutabletreenode) == 0) { +- addObject((DefaultMutableTreeNode) mutabletreenode, ""); +- } +- _actionRefresh(); +- statusOut("Successfully deleted" + +- " Directory: " + deleteFile); +- statusOut("Status : Ready "); +- } else { +- toolkit.beep(); +- JOptionPane.showMessageDialog(null, deleteFile +- + " : Permission Denied."); +- statusOut("Directory: Permission Denied"); +- statusOut("Status : Ready "); +- } +- deleteButton.setEnabled(true); +- setDragEnabled(true); +- } +- }; +- dirDelete.start(); +- } +- +- public boolean deleteDir(File dirname) { +- +- File[] files = dirname.listFiles(); +- +- for (int i = 0; i < files.length; i++) { +- File current = files[i]; +- if (current.isDirectory()) { +- deleteDir(current); +- +- } else { +- current.delete(); +- statusOut("Deleting: " + current.getName()); +- logger.info("Deleted the file " + current.getName()); +- } +- } +- +- logger.info("Deleted the directory " + dirname.getName()); +- boolean flag = dirname.delete(); +- return flag; +- +- +- } +- +- public boolean mkNewDir(String dir, String path) { +- File newfile = new File(path); +- if (!(newfile.exists())) { +- try { +- newfile.mkdirs(); +- return true; +- } catch (Exception e) { +- logger.debug("\nThere is no permission to create directory" + path); +- return false; +- +- } +- } else { +- logger.info("\nDirectory already exists : " + path); +- return true; +- +- } +- } +- +- public void _actionMakeDir(String s) { +- String as[] = returnSelectedPaths1(); +- if (as == null || as[0] == null) { +- if (noselection) { +- toolkit.beep(); +- statusOut("no Path"); +- return; +- } +- as = new String[1]; +- as[0] = new String(txtField.getText()); +- } +- +- File file = new File(as[0] + s); //"newFolder"); +- if (file.exists()) { +- JOptionPane.showMessageDialog(this, "File name already exists."); +- return; +- } +- if (file.mkdir()) { +- statusOut("New Folder created : " + s); +- statusOut("Status : Ready "); +- } else { +- statusOut("New Folder could not be created : " + s); +- statusOut("Status : Ready "); +- JOptionPane.showMessageDialog(this, "Permission denied."); +- return; +- } +- chDir(as[0]); +- whereIsNode(rootNode, rootNode.getChildCount(), s + LclFile_Sep); +- if (seekNode != null) { +- javax.swing.tree.TreeNode atreenode[] +- = treeModel.getPathToRoot(seekNode); +- TreePath treepath1 +- = new TreePath(atreenode); +- tree.scrollPathToVisible(treepath1); +- tree.setSelectionPath(treepath1); +- } +- +- } +- +- public void _actionMakeDir() { +- String dirname = JOptionPane.showInputDialog("Please Enter the Dir Name:"); +- if (dirname != null) { +- _actionMakeDir(dirname); +- } +- } +- +- public File[] _actionDirInfo(String s1) { +- File file = null; +- String as[] = null; +- File as2[] = null; +- //LclDirInfoFrame lclDirInfoFrame; +- +- if (s1.equals("")) { +- //JOptionPane.showMessageDialog(null, "into actionDirInfor"); +- file = new File(txtField.getText() + "."); +- as = file.list(); +- } else { +- file = new File(s1 + "."); +- as2 = file.listFiles(); +- return as2; +- } +- if (as == null && as2 == null) { +- return null; +- } +- +- SortFtpString.startSort(as); +- String s = txtField.getText(); +- if (s.endsWith(LclFile_Sep)) { +- s = s.substring(0, s.lastIndexOf(LclFile_Sep)); +- } +- String as1[] = new String[4]; +- as1[0] = new String("Info Window"); +- as1[1] = new String("Name"); +- as1[2] = new String("Size"); +- as1[3] = new String("Last Modified"); +- +- new LclDirInfoFrame(as1, s + LclFile_Sep, as); +- return null; +- } +- +- +- public void _actionGo1DirUp() { +- String s = txtField.getText(); +- if (s.endsWith(LclFile_Sep)) { +- s = s.substring(0, s.lastIndexOf(LclFile_Sep)); +- } +- StringTokenizer stringtokenizer = new StringTokenizer(s, LclFile_Sep); +- Vector vector = new Vector(); +- for (; stringtokenizer.hasMoreTokens(); vector.addElement(stringtokenizer.nextToken() + LclFile_Sep)) { +- logger.info("Adding the separator"); +- } +- int i = vector.size(); +- +- +- if (i < 2) { +- try { +- tree.fireTreeWillCollapse(new TreePath(rootNode.getPath())); +- } catch (ExpandVetoException expandvetoexception) { +- expandvetoexception.printStackTrace(); +- } +- } else { +- vector.removeElementAt(i - 1); +- i = vector.size(); +- String s1 = new String(); +- for (int j = 0; j < i; j++) { +- s1 = s1.concat(vector.elementAt(j).toString()); +- } +- +- chDir(s1); +- } +- } +- +- public void _actionRename() { +- String tpath[] = returnSelectedFiles(false); +- +- if (tpath == null) { +- toolkit.beep(); +- statusOut("No Selection made"); +- return; +- } else { +- new LclRenameDialog(this, tpath[0]); +- return; +- } +- +- } +- +- class MyAdapter extends MouseAdapter { +- public void mouseClicked(MouseEvent evt) { +- //JOptionPane.showMessageDialog(null, "into mouseclicked method"); +- long clickTime = System.currentTimeMillis(); +- long clickInterval = clickTime - firstClickTime; +- if (clickInterval < 300) { +- Thread display = new Thread() { +- public void run() { +- displayFile(); +- firstClickTime = 0; +- } +- }; +- display.start(); +- } else { +- firstClickTime = clickTime; +- } // end of if - else +- } // end of mouseclicked +- +- } // end of class +- public static void main(String arg[]){ +- LocalTreePanel localPanel = new LocalTreePanel(); +- JFrame sFrame = new JFrame("Local File System"); +- sFrame.getContentPane().setLayout(new GridLayout(1, 1)); +- sFrame.getContentPane().add(localPanel); +- sFrame.pack(); +- sFrame.setSize(300, 400); +- sFrame.setVisible(true); +- UITools.center(null, sFrame); +- +- } +-} +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/gridftp/GridClient.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/gridftp/GridClient.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/gridftp/GridClient.java (working copy) +@@ -1,1288 +0,0 @@ +-package org.globus.ogce.beans.filetransfer.gui.remote.gridftp; +- +-import org.apache.commons.logging.Log; +-import org.apache.commons.logging.LogFactory; +-import org.apache.log4j.Logger; +-import org.globus.common.CoGProperties; +-import org.globus.ftp.*; +-import org.globus.ftp.exception.ServerException; +-import org.globus.gsi.GlobusCredential; +-import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; +-import org.globus.gsi.gssapi.auth.Authorization; +-import org.globus.gsi.gssapi.auth.IdentityAuthorization; +-import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; +-import org.globus.ogce.beans.filetransfer.gui.monitor.WindowProgress; +-import org.globus.ogce.beans.filetransfer.gui.remote.common.DisplayInterface; +-import org.globus.ogce.beans.filetransfer.gui.remote.common.GridEvent; +-import org.globus.ogce.beans.filetransfer.gui.remote.common.GridListener; +-import org.globus.ogce.beans.filetransfer.gui.remote.common.RemoteTreeFrame; +-import org.globus.ogce.beans.filetransfer.util.DirQueue; +-import org.globus.tools.ui.util.UITools; +-import org.ietf.jgss.GSSCredential; +- +-import javax.swing.*; +-import java.awt.*; +-import java.awt.event.*; +-import java.beans.PropertyChangeEvent; +-import java.beans.PropertyChangeListener; +-import java.io.*; +-import java.util.Vector; +- +- +-public class GridClient extends JPanel implements PropertyChangeListener, DisplayInterface, GridListener, ActionListener, Runnable, Serializable { +- private static Log logger = LogFactory.getLog(GridClient.class.getName()); +- +- private GridFTPClient client; +- private GridFTPClient client1; +- private GridFTPClient client2; +- private GridFTPClient client3; +- WindowProgress wndPreload = null; +- +- private final int GRID_FTP_PORT = 2811; +- +- public String host; +- +- private int port; +- +- private String profile; +- +- private String subject = null; +- +- public RemoteTreeFrame remoteTreeFrame; +- +- public String remoterootDir; +- +- public boolean isConnected = false; +- +- public boolean busy; +- +- +- private boolean put = false; +- +- +- protected JComboBox txtHost; +- +- protected JTextField txtPort; +- +- protected JTextField txtUName; +- +- protected JTextField txtprofileName; +- +- protected JTextField txtSubject; +- +- public JDialog dlgConnect; +- +- private String FileSep; +- +- private GridBagConstraints gbc; +- +- private DirQueue queue; +- +- private String status = null, url = null; +- +- private boolean bean = false; +- protected Vector remdirlisteners = new Vector(); +- public static String subject1; +- /** Register an action listener to be notified when a button is pressed */ +- public void addRemDirListener(RemDirListener l) { +- remdirlisteners.addElement(l); +- } +- +- /** Remove an Answer listener from our list of interested listeners */ +- public void removeRemDirListener(RemDirListener l) { +- remdirlisteners.removeElement(l); +- } +- +- /** Send an event to all registered listeners */ +- public void fireRemDirEvent(RemDirEvent e, DirQueue dirqueue, String path, GridClient gc) { +- // Make a copy of the list and fire the events using that copy. +- Vector list = (Vector) remdirlisteners.clone(); +- for (int i = 0; i < list.size(); i++) { +- RemDirListener listener = (RemDirListener) list.elementAt(i); +- try { +- switch (e.getID()) { +- case RemDirEvent.DIR: +- listener.dropGridFtp(e, path, gc); +- break; +- case RemDirEvent.REMOTEDRAG: +- listener.dragGridFtp(e, path, gc); +- break; +- case RemDirEvent.COUNTER: +- listener.gridCounter(e, gc); +- break; +- +- } +- } catch (Exception direx) { +- direx.printStackTrace(); +- } +- } +- } +- +- public GridClient() { +- this(null, true); +- bean = true; +- FileTransferMainPanel.mainPanel.registerRemoteComponent(this, 1); +- remoteTreeFrame.statusOut("Status: Not connected"); +- } +- +- public GridClient(String s) { +- this(s, false); +- } +- +- public GridClient(String s, boolean bean) { +- +- remoteTreeFrame = new RemoteTreeFrame(this, bean); +- remoteTreeFrame.setVisible(true); +- setLayout(new GridLayout(1, 1)); +- add(remoteTreeFrame); +- setVisible(true); +- +- remoteTreeFrame.addPropertyChangeListener(this); +- +- remoteTreeFrame.addGridListener(this); +- +- txtHost = null; +- txtPort = null; +- host = null; +- port = GRID_FTP_PORT; +- FileSep = null; +- +- isConnected = false; +- dlgConnect = null; +- gbc = new GridBagConstraints(); +- queue = new DirQueue(); +- remoteTreeFrame.setProtocol("gsiftp"); +- remoteTreeFrame.setPort(GRID_FTP_PORT); +- } +- +- public String getStatus() { +- return status; +- } +- +- public String getUrl() { +- return url; +- } +- +- public void setStatus(String status) { +- this.status = status; +- remoteTreeFrame.statusOut(status); +- } +- +- public void setUrl(String url) { +- this.url = url; +- remoteTreeFrame.setUrl(url); +- } +- +- private JComboBox initComboBox() { +- JComboBox box = new JComboBox(); +- FileReader reader = null; +- BufferedReader bufReader = null; +- +- try { +- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; +- File f = new File(globusDir, "sitesName"); +- reader = new FileReader(f); +- bufReader = new BufferedReader(reader); +- String line = null; +- while ((line = bufReader.readLine()) != null) { +- box.addItem(line); +- } +- } catch (Exception e) { +- logger.debug(e.getMessage(), e); +- } finally { +- try { +- if (null != reader) { +- reader.close(); +- } +- if (null != bufReader) { +- bufReader.close(); +- } +- } catch (IOException e) { +- } +- } +- +- return box; +- } +- +- public void connectDlg(JFrame frame) { +- if (isConnected) { +- remoteTreeFrame.statusOut("Connection Exists"); +- return; +- } +- remoteTreeFrame.statusOut("Please wait. Connecting"); +- dlgConnect = new JDialog(frame); +- System.out.println("dlgConnect"); +- dlgConnect.setTitle("Connect to GridFTP"); +- UITools.center(frame, dlgConnect); +- dlgConnect.addWindowListener(new WindowAdapter() { +- public void windowClosing(WindowEvent windowevent) { +- windowevent.getWindow().dispose(); +- System.gc(); +- dlgConnect.removeAll(); +- remoteTreeFrame.setConnected(false); +- } +- }); +- txtHost = initComboBox(); +- +- txtHost.setPreferredSize(new Dimension(225, 20)); +- txtHost.setEditable(true); +- txtHost.setFont(new Font("Times New Roman", 0, 15)); +- txtprofileName = new JTextField(20); +- txtprofileName.setText(GRID_FTP_PORT + ""); +- txtprofileName.setFont(new Font("Times New Roman", 0, 15)); +- txtSubject = new JTextField(20); +- txtSubject.setFont(new Font("Times New Roman", 0, 15)); +- JLabel jhost = new JLabel("Host "); +- JLabel jprofile = new JLabel("Port "); +- JLabel jsubject = new JLabel("Subject "); +- JButton jbutton = new JButton("ok"); +- jbutton.addActionListener(this); +- jbutton.setActionCommand("10"); +- JButton jbutton1 = new JButton("cancel"); +- jbutton1.addActionListener(this); +- jbutton1.setActionCommand("11"); +- JPanel jpanel4 = new JPanel(); +- jpanel4.add(jbutton); +- jpanel4.add(jbutton1); +- +- Container container = dlgConnect.getContentPane(); +- container.setLayout(new BorderLayout()); +- JPanel jp = new JPanel(); +- jp.setLayout(new GridBagLayout()); +- jp.setPreferredSize(new Dimension(350, 200)); +- +- jp.add(jhost, getGBC(0, 16, 0.300000000000000000, 1.0, 0, 2, 1, 2)); +- jp.add(txtHost, getGBC(0, 16, 0.7000000000000000, 0.0, 1, 3, 4, 1)); +- jp.add(jprofile, getGBC(0, 16, 0.30000000000000000, 1.0, 0, 4, 1, 2)); +- jp.add(txtprofileName, getGBC(0, 16, 0.70000000000000000, 0.0, 1, 5, 4, 1)); +- jp.add(jsubject, getGBC(0, 16, 0.30000000000000000, 1.0, 0, 6, 1, 2)); +- jp.add(txtSubject, getGBC(0, 16, 0.70000000000000000, 0.0, 1, 7, 4, 1)); +- jp.add(jpanel4, getGBC(0, 16, 0.30000000000000000, 1.0, 1, 8, 4, 1)); +- container.add(jp, BorderLayout.CENTER); +- +- txtHost.addKeyListener(new KeyAdapter() { +- public void keyTyped(KeyEvent keyevent) { +- char c = keyevent.getKeyChar(); +- if (c == '\n') { +- txtprofileName.requestFocus(); +- } +- } +- }); +- txtprofileName.addKeyListener(new KeyAdapter() { +- public void keyTyped(KeyEvent keyevent) { +- remoteTreeFrame.statusOut("Please wait. Connecting"); +- char c = keyevent.getKeyChar(); +- if (c == '\n') { +- doConnectOK(); +- } +- } +- }); +- +- dlgConnect.pack(); +- dlgConnect.setVisible(true); +- dlgConnect.show(); +- +- } +- +- protected GridBagConstraints getGBC(int i, int j, double d, double d1, int k, int l, int i1, int j1) { +- gbc.fill = i; +- gbc.anchor = j; +- gbc.weightx = d; +- gbc.weighty = d1; +- gbc.gridx = k; +- gbc.gridy = l; +- gbc.gridwidth = i1; +- gbc.gridheight = j1; +- return gbc; +- } +- +- public void doConnectOK() { +- +- dlgConnect.setVisible(false); +- dlgConnect.dispose(); +- dlgConnect.removeAll(); +- dlgConnect = null; +- System.gc(); +- wndPreload = new WindowProgress("Connecting ... Please wait", 25); +- centerWindow(wndPreload); +- // wndPreload.setVisible(true); +- wndPreload.setProgressValue(5); +- try { +- port = Integer.parseInt(txtprofileName.getText()); +- } catch (Exception e) { +- e.printStackTrace(System.out); +- remoteTreeFrame.setConnected(false); +- } +- +- host = txtHost.getSelectedItem().toString(); +- subject = txtSubject.getText(); +- subject1 = subject; +- profile = host + ":" + port;//txtprofileName.getText(); +- if (profile.length() <= 0) { +- profile = host; +- } +- wndPreload.setProgressValue(8); +- setConnectDetails(true); +- +- //save the site name to a file +- if (-1 == txtHost.getSelectedIndex()) { +- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; +- File sitesNameFile = new File(globusDir, "sitesName"); +- FileWriter writer = null; +- try { +- File dir = new File(globusDir); +- if (!dir.isDirectory() || !dir.exists()) { +- dir.mkdirs(); +- } +- if (!sitesNameFile.exists() || !sitesNameFile.isFile()) { +- sitesNameFile.createNewFile(); +- } +- +- writer = new FileWriter(sitesNameFile, true); +- writer.write(host); +- writer.write("\n"); +- } catch (Exception e) { +- logger.debug(e.getMessage(), e); +- } finally { +- try { +- writer.close(); +- } catch (IOException e) { +- } +- } +- } +- } +- +- public boolean setConnectDetails(boolean interactive) { +- remoteTreeFrame.setProtocol("gsiftp"); +- remoteTreeFrame.setHost(host); +- remoteTreeFrame.setPort(port); +- if (wndPreload != null) { +- wndPreload.setProgressValue(10); +- } +- final boolean isInteractive = interactive; +- Thread connectThread = new Thread(){ +- public void run(){ +- remoteTreeFrame._actionConnect(isInteractive); +- } +- }; +- connectThread.start(); +- if (wndPreload != null) { +- wndPreload.setProgressValue(24); +- } +- if (wndPreload != null) { +- wndPreload.setProgressValue(25); +- wndPreload.setVisible(false); +- +- wndPreload = null; +- } +- if (isConnected) { +- return true; +- } else { +- return false; +- } +- } +- +- public void refresh() { +- remoteTreeFrame._actionRefresh(); +- +- } +- +- public void connectRemote() { +- System.out.println("\n HOST = " + host + " port = " + port); +- try { +- client = new GridFTPClient(host, port); +- client1 = new GridFTPClient(host, port); +- client2 = new GridFTPClient(host, port); +- client3 = new GridFTPClient(host, port); +- if (null != subject && !"".equals(subject.trim())) { +- Authorization auth = new IdentityAuthorization(subject); +- client.setAuthorization(auth); +- client1.setAuthorization(auth); +- client2.setAuthorization(auth); +- client3.setAuthorization(auth); +- } +- } catch (ServerException fte) { +- JOptionPane.showMessageDialog(this, "The host: " + +- host + "\n or the port number: " + +- port + " is invalid.\n Please try again. "); +- logger.debug("ServerException instantiating client."); +- logger.debug(fte.getMessage(), fte); +- +- //connectDlg(null); +- // remoteTreeFrame.setConnected(false); +- return; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "The host : " + +- host + "\n or the port number: " + +- port + " is invalid.\n Please try again."); +- logger.debug("IOException instantiating client."); +- logger.debug(ioe.getMessage(), ioe); +- //connectDlg(null); +- // remoteTreeFrame.setConnected(false); +- return; +- } +- if (wndPreload != null) { +- wndPreload.setProgressValue(13); +- } +- String file = null; +- GlobusCredential credentials = null; +- GSSCredential proxy = null; +- +- try { +- if (file == null) { +- file = CoGProperties.getDefault().getProxyFile(); +- } +- credentials = new GlobusCredential(file); +- proxy = new GlobusGSSCredentialImpl(credentials, +- GSSCredential.ACCEPT_ONLY); +- +- } catch (Exception e) { +- System.err.println("Unable to load the user proxy : " + e.getMessage()); +- JOptionPane.showMessageDialog( +- this, +- "Authentication Failed.\n\n" +- + e.getMessage(), +- "Security Message", +- JOptionPane.WARNING_MESSAGE); +- //connectDlg(null); +- logger.debug(e.getMessage(), e); +- // remoteTreeFrame.setConnected(false); +- return; +- } +- if (wndPreload != null) { +- wndPreload.setProgressValue(16); +- } +- try { +- client.authenticate(null); +- client1.authenticate(null); +- client2.authenticate(null); +- client3.authenticate(null); +- } catch (ServerException fte) { +- JOptionPane.showMessageDialog( +- this, +- "Authentication Failed.\n\n" +- + fte.getMessage(), +- "Security Message", +- JOptionPane.WARNING_MESSAGE); +- logger.debug("Credentials are not valid. Use the Security menu"); +- logger.debug(fte.getMessage(), fte); +- //remoteTreeFrame.setConnected(false); +- return; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog( +- this, +- "Authentication Failed.\n\n" +- + ioe.getMessage(), +- "Security Message", +- JOptionPane.WARNING_MESSAGE); +- logger.debug("Credentials are not valid. Use the Security Menu"); +- logger.debug(ioe.getMessage(), ioe); +- //remoteTreeFrame.setConnected(false); +- return; +- } +- if (wndPreload != null) { +- wndPreload.setProgressValue(18); +- } +- try { +- client.setDataChannelAuthentication(DataChannelAuthentication.NONE); +- client1.setDataChannelAuthentication(DataChannelAuthentication.NONE); +- client2.setDataChannelAuthentication(DataChannelAuthentication.NONE); +- client3.setDataChannelAuthentication(DataChannelAuthentication.NONE); +- logger.debug("Setting Data Channel Authorization to none."); +- } catch (ServerException fte) { +- JOptionPane.showMessageDialog(this, "Error setting Data " + +- "Channel Authentication."); +- logger.debug(fte.getMessage(), fte); +- // remoteTreeFrame.setConnected(false); +- return; +- } catch (IOException ioe) { +- logger.debug(ioe.getMessage(), ioe); +- JOptionPane.showMessageDialog(this, "Error setting Data " + +- "Channel Authentication."); +- // remoteTreeFrame.setConnected(false); +- return; +- } +- if (wndPreload != null) { +- wndPreload.setProgressValue(20); +- } +- isConnected = true; +- remoteTreeFrame.setConnected(true); +- } +- +- public void disconnect() { +- remoteTreeFrame._actionDisconnect(); +- } +- +- public boolean createClient(GridFTPClient newClient) { +- try { +- // newClient.close(); +- newClient = null; +- newClient = new GridFTPClient(host, port); +- newClient.authenticate(null); +- +- return true; +- } catch (Exception e) { +- return false; +- } +- } +- +- public String getCurrentDir() { +- try { +- remoterootDir = client.getCurrentDir(); +- } catch (ServerException fte) { +- logger.debug("ServerException getting remote root directory."); +- logger.debug(fte.getMessage(), fte); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return null; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException getting remote root directory."); +- logger.debug(ioe.getMessage(), ioe); +- remoteTreeFrame.setConnected(false); +- return null; +- } catch (Exception ioe) { +- logger.debug("Exception getting remote root directory."); +- logger.debug(ioe.getMessage(), ioe); +- return null; +- } +- +- remoteTreeFrame.setServerOpSys(1); +- //client.pwd(); +- +- return remoterootDir; +- } +- +- +- public void disconnectRemote(boolean connectionAndGUI) { +- if (client != null || client1 != null || client2 != null || client3 != null) { +- +- +- try { +- client.close(); +- client = null; +- if (client1 != null) { +- client1.close(); +- client1 = null; +- } +- if (client2 != null) { +- client2.close(); +- client2 = null; +- } +- if (client3 != null) { +- client3.close(); +- client3 = null; +- } +- +- +- } catch (ServerException fte) { +- logger.debug("ServerException disconnecting."); +- logger.debug(fte.getMessage(), fte); +- } catch (IOException ioe) { +- logger.debug("IOException disconnecting."); +- logger.debug(ioe.getMessage(), ioe); +- } +- } +- if (isConnected) { +- isConnected = false; +- } +- if(connectionAndGUI){ +- System.gc(); +- fireRemDirEvent(new RemDirEvent(this, RemDirEvent.COUNTER), null, "", this); +- } +- logger.debug("Returned correctly after disconnect."); +- return; +- } +- +- public void propertyChange(PropertyChangeEvent evt) { +- System.out.println("\n In the property change method."); +- host = remoteTreeFrame.getHost(); +- remoteTreeFrame.statusOut("Connecting. Please wait ...."); +- isConnected = false; +- setConnectDetails(true); +- logger.debug("Remote url changed.display the authorization dialog "); +- } +- +- public Vector listDir(String dirname) { +- logger.debug("\nEntered the listdir function in grid client."); +- Vector listing = null; +- if (client1 == null) { +- logger.debug("Client null...Trying to create a new instance"); +- try { +- client1 = new GridFTPClient(host, port); +- System.out.println("subject:" + subject); +- if (null != subject && !"".equals(subject.trim())) { +- Authorization auth = new IdentityAuthorization(subject); +- //client.setAuthorization(auth); +- client1.setAuthorization(auth); +-// client2.setAuthorization(auth); +-// client3.setAuthorization(auth); +- } +- client1.authenticate(null); +- client1.setDataChannelAuthentication(DataChannelAuthentication.NONE); +- } catch (Exception e) { +- logger.debug("Client null...Failed the trial to create one."); +- remoteTreeFrame.setConnected(false); +- return null; +- } +- } +- try { +- client1.setClientWaitParams(200 * 900000, 300); +- client1.changeDir(dirname); +- client1.setPassive(); +- client1.setLocalActive(); +-// client1.setLocalPassive(); +-// client1.setActive(); +- +- client1.setLocalNoDataChannelAuthentication(); +- logger.debug("\nSET THE PARAMETERS." + client1); +- //listing = client1.list(); +- listing = client1.mlsd(); +- logger.debug("Returned correctly from list."); +- } catch (ServerException fte) { +- logger.debug("ServerException listing directory." + client1); +- fte.printStackTrace(System.out); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return null; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException listing directory."); +- logger.debug(ioe.getMessage()); +- ioe.printStackTrace(System.out); +- remoteTreeFrame.setConnected(false); +- return null; +- } catch (Exception ioe) { +- logger.debug("Exception listing the remote directory."); +- logger.debug(ioe.getMessage()); +- ioe.printStackTrace(); +- return null; +- } +- +- return listing; +- //remoteTreeFrame.setList(listing); +- } +- +- public Vector listAllDir(String dirname) { +- Vector listing = null; +- Vector list = new Vector(); +- if (client == null) { +- logger.debug("Client null...Trying to create a new instance"); +- try { +- client = new GridFTPClient(host, port); +- client.authenticate(null); +- client.setDataChannelAuthentication(DataChannelAuthentication.NONE); +- } catch (Exception e) { +- logger.debug("Client null...Failed the trial to create one."); +- remoteTreeFrame.setConnected(false); +- return null; +- } +- +- +- } +- +- final ByteArrayOutputStream received = new ByteArrayOutputStream(1000); +- String output = null; +- try { +- client.setClientWaitParams(200 * 900000, 300); +- client.changeDir(dirname); +- +- client.setPassive(); +- client.setLocalActive(); +-// client.setLocalPassive(); +-// client.setActive(); +- +- client.setLocalNoDataChannelAuthentication(); +- client.list("*", "-d", new DataSink() { +- public void write(Buffer buffer) +- throws IOException { +- +- received.write(buffer.getBuffer(), +- 0, +- buffer.getLength()); +- +- } +- +- public void close() +- throws IOException { +- }; +- }); +- output = received.toString(); +- logger.debug("\nReceived of directory listing\n" + output); +- BufferedReader reader = new BufferedReader(new StringReader(received.toString())); +- +- +- String line = null; +- +- while ((line = reader.readLine()) != null) { +- /* if (logger.isDebugEnabled()) { +- logger.debug("line ->" + line); +- }*/ +- if (line.startsWith("total")) { +- continue; +- } +- list.addElement(line); +- logger.debug("\nline = " + line); +- } +- +- listing = list; +- } catch (Exception e) { +- logger.debug("Parameterized list also failed"); +- e.printStackTrace(System.out); +- } +- +- return listing; +- +- } +- +- public Vector listTransferDir(String dirname) { +- Vector listing = null; +- if (client2 == null) { +- logger.debug("Client null...Trying to create a new instance"); +- try { +- client2 = new GridFTPClient(host, port); +- client2.authenticate(null); +- client2.setDataChannelAuthentication(DataChannelAuthentication.NONE); +- } catch (Exception e) { +- logger.debug("Client null...Failed the trial to create one."); +- JOptionPane.showMessageDialog(this, "Please drag a smaller" + +- "directory.\n Server is not" + +- " to remain connected."); +- remoteTreeFrame.setConnected(false); +- return null; +- } +- +- } +- try { +- client2.setClientWaitParams(200 * 900000, 300); +- client2.changeDir(dirname); +- client2.setPassive(); +- client2.setLocalActive(); +-// client2.setLocalPassive(); +-// client2.setActive(); +- +- client2.setLocalNoDataChannelAuthentication(); +- listing = client2.mlsd(); +- logger.debug("Returned correctly from list."); +- } catch (ServerException fte) { +- logger.debug("ServerException listing directory."); +- fte.printStackTrace(System.out); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return null; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException listing directory."); +- logger.debug(ioe.getMessage()); +- ioe.printStackTrace(System.out); +- remoteTreeFrame.setConnected(false); +- return null; +- } catch (Exception ioe) { +- logger.debug("Exception listing the remote directory."); +- logger.debug(ioe.getMessage()); +- ioe.printStackTrace(System.out); +- return null; +- } +- +- return listing; +- //remoteTreeFrame.setList(listing); +- } +- +- public Vector listDeleteDir(String dirname) { +- Vector listing = null; +- if (client3 == null) { +- logger.debug("Client null...returning from listCurrentDirectory"); +- try { +- client3 = new GridFTPClient(host, port); +- client3.authenticate(null); +- client3.setDataChannelAuthentication(DataChannelAuthentication.NONE); +- } catch (Exception e) { +- logger.debug("Client null...Failed the trial to create one."); +- remoteTreeFrame.setConnected(false); +- return null; +- } +- } +- try { +- client3.setClientWaitParams(200 * 900000, 300); +- client3.changeDir(dirname); +- client3.setPassive(); +- client3.setLocalActive(); +-// client3.setLocalPassive(); +-// client3.setActive(); +- +- client3.setLocalNoDataChannelAuthentication(); +- listing = client3.list(); +- logger.debug("Returned correctly from list."); +- } catch (ServerException fte) { +- logger.debug("ServerException listing directory."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return null; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException listing directory."); +- logger.debug(ioe.getMessage()); +- ioe.printStackTrace(System.out); +- remoteTreeFrame.setConnected(false); +- return null; +- } catch (Exception ioe) { +- logger.debug("Exception listing the remote directory."); +- logger.debug(ioe.getMessage()); +- ioe.printStackTrace(System.out); +- return null; +- } +- +- return listing; +- //remoteTreeFrame.setList(listing); +- } +- +- public void pwd() { +- try { +- client.getCurrentDir(); +- logger.debug("Returned correctly from pwd."); +- } catch (ServerException fte) { +- logger.debug("ServerException showing pwd."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- +- return; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException showing pwd."); +- logger.debug(ioe.getMessage()); +- remoteTreeFrame.setConnected(false); +- return; +- } +- } +- +- public void get(String remote, File local) { +- /* try { +- client.get(remote,local); +- logger.debug("Returned correctly from pwd."); +- } +- catch (ServerException fte) { +- logger.debug("ServerException showing pwd."); +- logger.debug(fte.getMessage()); +- return ; +- } +- catch (IOException ioe) { +- logger.debug("IOException showing pwd."); +- logger.debug(ioe.getMessage()); +- return ; +- }*/ +- } +- +- public void put(File local, String remote) { +- /* try { +- client.put(local,remote,false); +- logger.debug("Returned correctly from pwd."); +- } +- catch (ServerException fte) { +- logger.debug("ServerException showing pwd."); +- logger.debug(fte.getMessage()); +- return ; +- } +- catch (IOException ioe) { +- logger.debug("IOException showing pwd."); +- logger.debug(ioe.getMessage()); +- return ; +- }*/ +- } +- +- public boolean chdir(String s) { +- try { +- client.changeDir(s); +- logger.debug("Returned correctly from change dir command"); +- return true; +- } catch (ServerException fte) { +- logger.debug("ServerException during change dir command."); +- +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return false; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException during change dir command."); +- logger.debug(ioe.getMessage()); +- remoteTreeFrame.setConnected(false); +- return false; +- } catch (Exception ioe) { +- logger.debug("Exception during change dir command."); +- logger.debug(ioe.getMessage()); +- return false; +- } +- +- } +- +- +- public void setType(boolean flag) { +- if (flag) { +- try { +- client.setType(Session.TYPE_ASCII); +- logger.debug("Returned correctly from setType."); +- } catch (ServerException fte) { +- logger.debug("ServerException during setType."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException during setType."); +- logger.debug(ioe.getMessage()); +- remoteTreeFrame.setConnected(false); +- return; +- } +- } else { +- try { +- client.setType(Session.TYPE_IMAGE); +- logger.debug("Returned correctly from setType."); +- } catch (ServerException fte) { +- logger.debug("ServerException during setType."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException in setType."); +- logger.debug(ioe.getMessage()); +- remoteTreeFrame.setConnected(false); +- return; +- } +- } +- } +- +- public boolean rename(String s, String s1) { +- try { +- client.rename(s, s1); +- logger.debug("Returned correctly from rename."); +- return true; +- } catch (ServerException fte) { +- logger.debug("ServerException renaming directory."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return false; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException renaming directory."); +- logger.debug(ioe.getMessage()); +- ioe.printStackTrace(System.out); +- remoteTreeFrame.setConnected(false); +- return false; +- } +- } +- +- public boolean exists(String s1) { +- try { +- return client.exists(s1); +- } catch (ServerException fte) { +- logger.debug("ServerException renaming directory."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return false; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException renaming directory."); +- logger.debug(ioe.getMessage()); +- ioe.printStackTrace(System.out); +- remoteTreeFrame.setConnected(false); +- return false; +- } +- } +- +- public boolean mkdir(String s) { +- try { +- if (!exists(s)) { +- client.makeDir(s); +- logger.debug("Returned correctly from make directory."); +- } else { +- System.out.println("The already directory exists"); +- } +- return true; +- } catch (ServerException fte) { +- logger.debug("Directory exists or Permission denied."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("exists") > 0) { +- remoteTreeFrame.setError("exists"); +- return true; +- } else if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- logger.debug(errorMsg); +- return false; +- } else { +- logger.debug(errorMsg); +- return false; +- } +- +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("No network connection or Firewall prevents it."); +- logger.debug(ioe.getMessage()); +- remoteTreeFrame.setConnected(false); +- return false; +- } +- } +- +- public boolean mkdirs(String dir, String path) { +- try { +- int index = dir.lastIndexOf("/"); +- int index1 = path.lastIndexOf("/"); +- +- logger.info("\nSTART DIR = " + dir + " index = " + index); +- logger.info("\npath = " + path + " index1 = " + index1); +- logger.info("\nMAKING DIR = " + path.substring(0, index1)); +- if (index1 > index) { +- mkdirs(dir, path.substring(0, index1)); +- +- } +- +- if (mkdir(path)) { +- return true; +- } else { +- return false; +- } +- } catch (Exception e) { +- return true; +- } +- +- } +- +- public boolean removeDir(String s) { +- try { +- client.deleteDir(s); +- logger.debug("Returned correctly after deleting directory."); +- return true; +- } catch (ServerException fte) { +- logger.debug("ServerException deleting directory."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return false; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException deleting directory."); +- logger.debug(ioe.getMessage()); +- remoteTreeFrame.setConnected(false); +- return false; +- } +- } +- +- public boolean removeFile(String s) { +- try { +- client.deleteFile(s); +- logger.debug("Returned correctly after deleting file."); +- return true; +- } catch (ServerException fte) { +- logger.debug("ServerException deleting file."); +- String errorMsg = fte.getMessage(); +- if (errorMsg.indexOf("Timeout") > 0) { +- JOptionPane.showMessageDialog(this, "Connection Timed Out"); +- remoteTreeFrame.setConnected(false); +- } +- logger.debug(errorMsg); +- return false; +- } catch (IOException ioe) { +- JOptionPane.showMessageDialog(this, "Disconnected due to" + +- " Network problems"); +- logger.debug("IOException deleting file."); +- logger.debug(ioe.getMessage()); +- remoteTreeFrame.setConnected(false); +- return false; +- } +- } +- +- public void setHost(String host) { +- this.host = host; +- } +- +- public String getHost() { +- return host; +- } +- +- public void setPort(int port) { +- this.port = port; +- } +- +- public int getPort() { +- return port; +- } +- +- public String getSubject() { +- if ("".equals(subject.trim())) { +- subject = null; +- } +- +- return subject; +- } +- +- public void rootDirRemote() { +- remoteTreeFrame.setRootRemote(remoterootDir); +- } +- +- public String getRootURL() { +- return remoteTreeFrame.getBaseUrl(); +- } +- +- public void setDragDetails(GridEvent e, String from) { +- remoteTreeFrame.statusOut("Copying the file ..."); +- fireRemDirEvent(new RemDirEvent(this, RemDirEvent.REMOTEDRAG), null, from, this); +- } +- +- public void setDropDetails(GridEvent e, String to) { +- fireRemDirEvent(new RemDirEvent(this, RemDirEvent.DIR), null, to, this); +- +- } +- +- /*This method sets the selected source directory for transfer*/ +- public void setSelectedSource() { +- remoteTreeFrame.right.setSelectedSource(); +- } +- +- /*This method sets the selected destination directory for transfer*/ +- public void setSelectedDestination() { +- remoteTreeFrame.right.setSelectedDestination(); +- } +- +- /*Please make sure to call the transfer method of the Destination Bean*/ +- public void transfer() { +- remoteTreeFrame.right.transfer(); +- } +- +- public void callGridEditFrame(GridEvent e, String filesep, String seldir[]) { +- /* editFrame = new GridRemEditFrame(this,seldir, filesep); +- editFrame.addWindowListener(new WindowAdapter() { +- +-public void windowClosing(WindowEvent windowevent) +-{ +- editFrame = null; +- System.gc(); +-} +- +- }); +- editFrame.pack(); +- editFrame.setVisible(true); +- */ +- } +- +- +- public void run() { +- +- doConnectOK(); +- +- } +- +- public void actionPerformed(ActionEvent ae) { +- String s = ae.getActionCommand(); +- int i = 0; +- try { +- i = Integer.valueOf(s).intValue(); +- } catch (NumberFormatException numberformatexception) { +- //theApp.toolkit.beep(); +- remoteTreeFrame.statusOut("Action Error: " + numberformatexception.getMessage()); +- } +- //RemRenameDialog RemRenameDialog; +- switch (i) { +- default : +- break; +- +- case 10: // dialog enter the remote details ok button +- Thread connect = new Thread(this); +- connect.start(); +- remoteTreeFrame.statusOut("Connecting ... Please wait"); +- break; +- case 11: // cancel button +- if (!bean) { +- remoteTreeFrame.setConnected(false); +- } +- dlgConnect.dispose(); +- break; +- +- } +- +- } +- +- public static void centerWindow(Window guiComponent) { +- +- //Center the window +- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); +- Dimension frameSize = guiComponent.getSize(); +- +- if (frameSize.height > screenSize.height) { +- frameSize.height = screenSize.height; +- } +- +- if (frameSize.width > screenSize.width) { +- frameSize.width = screenSize.width; +- } +- +- guiComponent.setLocation((screenSize.width - frameSize.width) / 2, +- (screenSize.height - frameSize.height) / 2); +- } +- public static void main(String arg[]){ +- GridClient gridftpPanel = new GridClient(); +- JFrame sFrame = new JFrame("Remote FTP System: "+arg[0]); +- sFrame.getContentPane().setLayout(new GridLayout(1, 1)); +- sFrame.getContentPane().add(gridftpPanel); +- sFrame.pack(); +- sFrame.setSize(300, 400); +- sFrame.setVisible(true); +- UITools.center(null, sFrame); +- gridftpPanel.setHost(arg[0]); +- gridftpPanel.setConnectDetails(true); +- } +-} +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTreeFrame.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTreeFrame.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTreeFrame.java (working copy) +@@ -1,986 +0,0 @@ +-//RemoteTreeFrame.java which calls the RemoteTree.java +-package org.globus.ogce.beans.filetransfer.gui.remote.common; +- +-import org.apache.log4j.Logger; +-import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; +-import org.globus.util.GlobusURL; +- +-import javax.swing.*; +-import javax.swing.tree.DefaultMutableTreeNode; +-import javax.swing.tree.TreePath; +-import java.awt.*; +-import java.awt.event.ActionEvent; +-import java.awt.event.ActionListener; +-import java.awt.event.KeyAdapter; +-import java.awt.event.KeyEvent; +-import java.beans.PropertyChangeListener; +-import java.beans.PropertyChangeSupport; +-import java.io.File; +-import java.net.URL; +-import java.util.StringTokenizer; +-import java.util.Vector; +- +-/** +- * This class renders graphical interface to the remote ftp client +- * It can be used by any class that implements DisplayInterface. +- * +- * @author Beulah Kurian Alunkal +- +- */ +-public class RemoteTreeFrame extends JPanel implements ActionListener { +- private static Logger logger = +- Logger.getLogger(RemoteTreeFrame.class.getName()); +- JButton dirInfoButton = null; +- public boolean bean = false; +- +- protected Vector gridlisteners = new Vector(); +- +- /** Register an action listener to be notified when a button is pressed */ +- public void addGridListener(GridListener l) { +- gridlisteners.addElement(l); +- } +- +- /** Remove an Answer listener from our list of interested listeners */ +- public void removeGridListener(GridListener l) { +- gridlisteners.removeElement(l); +- } +- +- /** Send an event to all registered listeners */ +- public void fireGridEvent(GridEvent e, String from, String s1, String s2[]) { +- Vector list = (Vector) gridlisteners.clone(); +- for (int i = 0; i < list.size(); i++) { +- GridListener listener = (GridListener) list.elementAt(i); +- switch (e.getID()) { +- case GridEvent.GRIDDRAG: +- listener.setDragDetails(e, from); +- break; +- case GridEvent.GRIDDROP: +- listener.setDropDetails(e, s1); +- break; +- case GridEvent.GRIDEDIT: +- listener.callGridEditFrame(e, s1, s2); +- break; +- } +- } +- } +- +- public RemoteTreeFrame(DisplayInterface displayInterface, boolean bean) { +- +- this.bean = bean; +- this.displayInterface = displayInterface; +- init(); +- } +- +- public RemoteTreeFrame() { +- init(); +- } +- +- public void init() { +- try { +- url = new GlobusURL("ftp://dummy.edu:0/dev/null"); +- } catch (Exception e) { +- logger.debug("This is a real bad error"); +- } +- host = url.getHost(); +- protocol = url.getProtocol(); +- port = url.getPort(); +- user = "user"; +- pwd = "pass"; +- file = ""; +- rightView = null; +- ServerOpSys = 0; +- connected = false; +- vector = null; +- rootRemote = " "; +- currentdir = " "; +- +- this.FrameId = FrameId; +- +- toolBar = new JToolBar(); +- toolBar.setFloatable(false); +- +- JButton jbutton = createButton("images/16x16/reload.png", +- "Click here to Refresh", +- "4"); +- toolBar.add(jbutton); +- jbutton = createButton("images/16x16/up.png", +- "Click here to go one Directory Up", +- "6"); +- toolBar.add(jbutton); +- dirInfoButton = createButton("images/16x16/view_text.png", +- "Directory Info currently disabled", +- "0"); +- toolBar.add(dirInfoButton); +- +- +- JToggleButton jbutton1 = createToggleButton("images/16x16/folder_home.png", +- "Toggle between root and home directories", +- "2"); +- toolBar.add(jbutton1); +- toolBar.addSeparator(); +- +- +- toolBar.addSeparator(); +- +- +- jbutton = createButton("images/16x16/folder.png", +- "Click here to Create a new Directory", +- "7"); +- toolBar.add(jbutton); +- +- +- jbutton = createButton("images/16x16/folder_rename.png", +- "Click here to Rename a File/Directory", +- "5"); +- +- toolBar.add(jbutton); +- +- deleteButton = createButton("images/16x16/folder_delete.png", +- "Click here to delete a File/Directory", +- "1"); +- toolBar.add(deleteButton); +- +- if (bean) { +- toolBar.addSeparator(); +- toolBar.addSeparator(); +- toolBar.addSeparator(); +- jbutton = createButton("images/16x16/view_text.png", +- "View the status window", +- "8"); +- toolBar.add(jbutton); +- jbutton = createButton("images/16x16/view_msg.png", +- "View the messages window", +- "9"); +- toolBar.add(jbutton); +- } +- +- +- toolBar.addSeparator(); +- toolBar.addSeparator(); +- toolBar.addSeparator(); +- toolBar.addSeparator(); +- disconnect = createButton("images/16x16/folder_delete.png", "Disconnect", "12"); +- disconnect.setEnabled(false); +- toolBar.add(disconnect); +- setBackground(Color.lightGray); +- +- JPanel jpanel = new JPanel(); +- jpanel.setLayout(new BorderLayout()); +- urlField = new JTextField(url.getURL()); +- urlField.addActionListener(this); +- //urlField.setActionCommand("14"); +- urlField.addKeyListener(new KeyAdapter() { +- +- public void keyTyped(KeyEvent keyevent) { +- char c = keyevent.getKeyChar(); +- if (c == '\n') { +- setUrl(urlField.getText()); +- } +- } +- +- }); +- right = new RemoteTree(this, "Remote Tree -> Not connected", rootRemote, displayInterface); +- +- rightView = right.sc_pane; +- jpanel.add(toolBar, "North"); +- jpanel.add(urlField, "South"); +- JPanel jpanel1 = new JPanel(new BorderLayout()); +- statusText = new JLabel(" Status : Remote Window "); +- //jpanel1.add(statusText); +- setLayout(new BorderLayout()); +- add(jpanel, "North"); +- add(rightView, "Center"); +- add(jpanel1, "South"); +- setToolsEn(true); +- right.setDragEnabled(false); +- disconnect.setEnabled(false); +- } +- +- public void addPropertyChangeListener(PropertyChangeListener l) { +- if (pceListeners == null) { +- pceListeners = new PropertyChangeSupport(this); +- } +- pceListeners.addPropertyChangeListener(l); +- } +- +- public void removePropertyChangeListener(PropertyChangeListener l) { +- pceListeners.removePropertyChangeListener(l); +- } +- +- public void getUrlFromField() { +- try { +- urlstring = urlField.getText(); +- } catch (Exception e) { +- error("getURLFromField", "unkown format"); +- logger.info(e); +- } +- } +- +- +- public void setUrl(String newUrl) { +- try { +- GlobusURL oldUrl = url; +- url = new GlobusURL(newUrl); +- logger.info("\nOld url=" + oldUrl); +- logger.info("\nNew url=" + url); +- if ((oldUrl.getHost()).equals(url.getHost())) { +- if(!connected){ +- statusOut("Connecting ... Please wait"); +- _actionConnect(true); +- }else{ +- +- getUrlFromField(); +- filepath = getFile(); +- statusOut("Changed the directory to " + filepath); +- index = filepath.lastIndexOf("/"); +- dirname = filepath.substring(0, index); +- if (dirname != null) { +- if (dirname.indexOf(rootRemote) > 0) { +- _actionChngDir(dirname); +- } +- } +- } +- } else { +- host = url.getHost(); +- port = url.getPort(); +- statusOut("Connecting ... Please wait"); +- pceListeners.firePropertyChange("url", oldUrl.getURL(), newUrl); +- } +- urlField.setText(newUrl); +- } catch (Exception e) { +- JOptionPane.showMessageDialog(this, "Please enter a valid URL."); +- //error("setURL", newUrl); +- } +- +- } +- +- public String getFile() { +- file = url.getPath(); +- return file; +- } +- +- public String getHost() { +- +- return host; +- } +- +- public String getProtocol() { +- +- return protocol; +- } +- +- public String getUrl() { +- return url.getURL(); +- } +- +- public int getPort() { +- +- return port; +- } +- +- public String getUser() { +- return user; +- } +- +- public String getPassword() { +- return pwd; +- } +- +- +- /** +- * Method is used to retrieve the url of the site without file appended +- * +- * @return string which represents the url +- */ +- public String getBaseUrl() { +- GlobusURL tempurl = null; +- if (protocol.equals("ftp")) { +- try { +- tempurl = new GlobusURL(protocol + "://" + user + ":" + pwd + "@" + host + ":" + port + "/"); +- } catch (Exception e) { +- logger.info("exception in globus url formation"); +- } +- +- return tempurl.getURL(); +- } else { +- setDirToFile(""); +- return getUrl(); +- } +- } +- +- +- public void setFrameId(int id) { +- FrameId = id; +- } +- +- public int getFrameId() { +- return FrameId; +- } +- +- /** +- * Method retrieves only the file from the entire url. +- * +- * @return path of the current directory +- */ +- public String getDirFromFile() { +- getUrlFromField(); +- filepath = getFile(); +- index = filepath.lastIndexOf("/"); +- dirname = filepath.substring(0, index) + "/"; +- return dirname; +- } +- +- public void setDirToFile(String dirname) { +- setFile(dirname); +- // getUrlFromField(); +- } +- +- private void message(String s) { +- msg.setText(s); +- } +- +- private void error(String method, String e) { +- message("Error: " + method + " <" + e + ">"); +- } +- +- +- private void parseURL() { +- try { +- host = getHost(); +- } catch (Exception e) { +- error("parseURL, host", url.getURL()); +- } +- try { +- port = getPort(); +- } catch (Exception e) { +- error("parseURL, port", url.getURL()); +- } +- try { +- protocol = getProtocol(); +- } catch (Exception e) { +- error("parseURL, protocol", url.getURL()); +- } +- try { +- file = getFile(); +- } catch (Exception e) { +- error("parseURL, filename", url.getURL()); +- } +- } +- +- private void updateURL() { +- try { +- +- url = new GlobusURL(protocol + "://" + host + ":" + port + "/" + file); +- urlField.setText(url.getURL()); +- } catch (Exception e) { +- error("update : filename", "file");//url.getPath()); +- } +- } +- +- public void setFile(String filename) { +- parseURL(); +- file = filename; +- updateURL(); +- } +- +- public void setHost(String h) { +- parseURL(); +- this.host = h; +- updateURL(); +- } +- +- public void setProtocol(String protocol) { +- parseURL(); +- this.protocol = protocol; +- updateURL(); +- } +- +- public void setUser(String user) { +- parseURL(); +- this.user = user; +- updateURL(); +- } +- +- public void setPassword(String pwd) { +- parseURL(); +- this.pwd = pwd; +- updateURL(); +- } +- +- +- public void setPort(int port) { +- parseURL(); +- this.port = port; +- updateURL(); +- } +- +- public void setServerOpSys(int no) { +- ServerOpSys = no; +- } +- +- public void setConnected(boolean value) { +- connected = value; +- if (value) { +- right.setDragEnabled(true); //do nothing +- disconnect.enable(); +- } else { +- _actionDisconnect(); +- } +- // disconnect.enable(); +- } +- +- public boolean getConnected() { +- return connected; +- } +- +- public void setRootRemote(String r) { +- currentdir = r; +- +- } +- +- +- public void setIsDir(boolean isDir) { +- this.isDir = isDir; +- } +- +- public void _actionConnect(boolean interactive) { +- connected = false; +- statusOut("Connecting ... Please wait"); +- displayInterface.connectRemote(); +- if (!connected) { +- // JOptionPane.showMessageDialog(this, "Please try again."); +- if (interactive) { +- displayInterface.connectDlg(null); +- } else { +- _actionDisconnect(); +- } +- return; +- } +- +- +- remove(rightView); +- updateURL(); +- rootpath = ""; +- +- //rootRemote = "//"; +- userHomeDir = displayInterface.getCurrentDir(); +- rootRemote = userHomeDir; +- +- createRemoteTree(); +- dirInfoButton.setEnabled(false); +- +- } +- +- public void createRemoteTree() { +- right = new RemoteTree(this, "Remote System" + " ->" + host, rootRemote, displayInterface); +- rightView = right.sc_pane; +- if (connected) { +- right.dropTarget.setActive(true); +- } +- add(rightView); +- setToolsEn(true); +- validate(); +- if (rootRemote.equals("//")) { +- rootpath = "//"; +- } else { +- rootpath = getDirFromFile(); +- } +- if (rootpath.length() > 0) { +- if (rootpath.endsWith("/")) { +- rootpath = rootpath.substring(0, rootpath.length() - 1); +- } +- if (!rootRemote.equals("//")) { +- rootpath = rootpath.substring(0, rootpath.lastIndexOf("/")) + "/"; +- } +- +- } else { +- rootpath = "//"; +- } +- statusOut("Successfully connected to " + host + "At root " + rootpath); +- } +- +- public void _actionDisconnect() { +- if(bean){ +- /* rootRemote = ""; +- try { +- url = new GlobusURL("ftp://dummy.edu:0/dev/null"); +- } catch (Exception e) { +- logger.debug("This is a real bad error"); +- } +- urlField.setText(url.getURL()); +- right = new RemoteTree(this, "Remote Tree -> Not connected", rootRemote, displayInterface); +- +- rightView = right.sc_pane; +- add(rightView); */ +- right.tree.removeAll(); +- right.tree.setBackground(Color.lightGray); +- displayInterface.disconnectRemote(false); +- }else{ +- displayInterface.disconnectRemote(true); +- right.tree.removeAll(); +- right.dropTarget.setActive(false); +- remove(rightView); +- setVisible(false); +- System.gc(); +- EventQueue.invokeLater(new Runnable() { +- public void run() { +- urlField.setText("Remote site address bar"); +- } +- +- }); +- } +- disconnect.setEnabled(false); +- if (connected) { +- connected = false; +- }else{ +- return; +- } +- +- } +- +- public void _actionRename() { +- if (connected) { +- String tpath[] = right.returnSelectedFiles(); +- +- if (tpath == null) { +- statusOut("No Selection made"); +- return; +- } else { +- new RemoteRenameDialog(this, tpath[0]); +- return; +- } +- +- } else { +- JOptionPane.showMessageDialog(this, "Remote site is disconnected already"); +- _actionDisconnect(); +- return; +- } +- +- } +- +- +- public DefaultMutableTreeNode seekParent(DefaultMutableTreeNode defaultmutabletreenode, String s) { +- if (defaultmutabletreenode == null) { +- return null; +- } +- +- int i = defaultmutabletreenode.getChildCount(); +- +- for (int j = 0; j < i; j++) { +- javax.swing.tree.TreeNode treenode = defaultmutabletreenode.getChildAt(j); +- String s1 = treenode.toString(); +- if (s.compareTo(s1) == 0) { +- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treenode; +- return defaultmutabletreenode1; +- } +- } +- +- return null; +- } +- +- public void _actionChngDir(String s) { +- if (connected) { +- String s1 = s; +- int l = 0; +- if (rootpath.length() <= 0) { +- l = 0; +- } else { +- l = rootpath.lastIndexOf("/"); +- } +- if (s1.lastIndexOf("/") > l + 1) { +- s1 = s1.substring(l + 1, s1.lastIndexOf("/")); +- StringTokenizer stringtokenizer = new StringTokenizer(s1, "/"); +- Vector vector = new Vector(); +- for (; stringtokenizer.hasMoreTokens(); vector.addElement(stringtokenizer.nextToken() + "/")) { +- logger.info("Appending the file separator"); +- } +- +- clear(); +- //right.makeRemoteInfo(); +- DefaultMutableTreeNode defaultmutabletreenode1 = right.addObject(null, right.RemoteRoot); +- right.addObject(defaultmutabletreenode1, ""); +- right.treeModel.reload(); +- +- DefaultMutableTreeNode defaultmutabletreenode = right.rootNode; +- +- String path = ""; +- int i = vector.size(); +- +- for (int j = 0; j < i; j++) { +- if (flag != false) { +- path = rootpath + (String) vector.elementAt(j); +- flag = false; +- } else { +- path = (String) vector.elementAt(j); +- } +- defaultmutabletreenode = seekParent(defaultmutabletreenode, path); +- +- if (defaultmutabletreenode != null) { +- right.tree.expandPath(new TreePath(defaultmutabletreenode.getPath())); +- } +- +- } +- if (defaultmutabletreenode == null) { +- statusOut("Path not changed "); +- } else { +- statusOut("Changed to " + s + " directory"); +- } +- } else { +- return; +- } +- } else { +- JOptionPane.showMessageDialog(this, "Remote site is disconnected already"); +- _actionDisconnect(); +- } +- +- } +- +- public void _actionRefresh() { +- if (connected) { +- flag = true; +- right.tree.getSelectionModel().clearSelection(); +- String s = getDirFromFile(); +- if (s == null) { +- _actionChngDir(rootRemote); +- } else { +- _actionChngDir(s); +- } +- statusOut("Status: Ready"); +- } else { +- JOptionPane.showMessageDialog(this, "Remote site is disconnected already"); +- _actionDisconnect(); +- } +- +- } +- +- public void _actionGo1DirUp() { +- if (connected) { +- String s = getDirFromFile(); +- if (s == null) { +- return; +- } else { +- if (s.endsWith("/")) { +- s = s.substring(0, s.lastIndexOf("/")); +- } +- StringTokenizer stringtokenizer = new StringTokenizer(s, "/"); +- Vector vector = new Vector(); +- for (; stringtokenizer.hasMoreTokens(); vector.addElement(stringtokenizer.nextToken() + "/")) { +- logger.info("appending separators."); +- } +- int i = vector.size(); +- if (i < 2) { +- clear(); +- +- DefaultMutableTreeNode defaultmutabletreenode = right.addObject(null, right.RemoteRoot); +- right.addObject(defaultmutabletreenode, ""); +- +- right.treeModel.reload(); +- setDirToFile(right.RemoteRoot); +- } else { +- vector.removeElementAt(i - 1); +- i = vector.size(); +- String s1 = new String(); +- for (int j = 0; j < i; j++) { +- s1 = s1.concat(vector.elementAt(j).toString()); +- } +- +- flag = true; +- _actionChngDir("/" + s1); +- } +- +- } +- } else { +- JOptionPane.showMessageDialog(this, "Remote site is disconnected already"); +- _actionDisconnect(); +- } +- +- } +- +- public void whereIsNode(DefaultMutableTreeNode defaultmutabletreenode, int i, String s) { +- seekNode = null; +- for (int j = 0; j < i; j++) { +- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(j); +- if (defaultmutabletreenode1.isLeaf()) { +- continue; +- } +- javax.swing.tree.TreeNode atreenode[] = defaultmutabletreenode1.getPath(); +- TreePath treepath = new TreePath(atreenode); +- String s1 = defaultmutabletreenode1.toString(); +- if (s1.equals(s)) { +- j = i + 1; +- seekNode = defaultmutabletreenode1; +- break; +- } +- if (!right.tree.isExpanded(treepath)) { +- continue; +- } +- if (s1.equals(s)) { +- j = i + 1; +- seekNode = defaultmutabletreenode1; +- break; +- } +- whereIsNode(defaultmutabletreenode1, defaultmutabletreenode1.getChildCount(), s); +- } +- } +- +- public void setError(String errorMsg) { +- this.errorMsg = errorMsg; +- } +- +- public void _actionMakeDir(String s) { +- if (connected) { +- String as[] = right.returnSelectedPaths1(); +- if (as == null || as[0] == null) { +- as = new String[1]; +- as[0] = new String(getDirFromFile()); +- } +- String dirname = null; +- if (s.equals("")) { +- String dirname1 = JOptionPane.showInputDialog("Please Enter the Dir Name:"); +- if (dirname1 != null) { +- dirname = as[0] + dirname1; +- } +- +- } else { +- +- dirname = as[0] + s; +- +- } +- if (dirname != null) { +- +- if (displayInterface.mkdir(dirname)) { +- if (errorMsg.equals("exists")) { +- JOptionPane.showMessageDialog(this, +- "This filename already exists. "); +- return; +- } +- String path = as[0] + s + "/"; +- flag = true; +- _actionChngDir(path); +- whereIsNode(right.rootNode, right.rootNode.getChildCount(), +- "New Folder" + right.RemoteRoot); +- if (seekNode != null) { +- javax.swing.tree.TreeNode atreenode[] +- = right.treeModel.getPathToRoot(seekNode); +- TreePath treepath = new TreePath(atreenode); +- right.tree.scrollPathToVisible(treepath); +- right.tree.setSelectionPath(treepath); +- } +- } else { +- JOptionPane.showMessageDialog(this, +- "Permission Denied."); +- } +- } +- } else { +- JOptionPane.showMessageDialog(this, +- "Remote site is disconnected already"); +- _actionDisconnect(); +- } +- +- } +- +- +- public void actionPerformed(ActionEvent actionevent) { +- String s = actionevent.getActionCommand(); +- int i = 0; +- try { +- i = Integer.valueOf(s).intValue(); +- } catch (NumberFormatException numberformatexception) { +- //theApp.toolkit.beep(); +- statusOut("Action Error: " + numberformatexception.getMessage()); +- } +- //RemRenameDialog RemRenameDialog; +- switch (i) { +- default : +- break; +- case 1: //delete node +- right.removeCurrentNode(); +- break; +- case 2: //shift between home and root +- shiftHomeToRoot(); +- break; +- case 4: // refresh. right now refreshes to show the home dir +- _actionRefresh(); +- break; +- case 5: // rename +- _actionRename(); +- break; +- case 6: // goes to home dir +- _actionGo1DirUp(); +- break; +- case 7: // create new folder +- _actionMakeDir(""); +- break; +- +- case 8: +- FileTransferMainPanel.mainPanel.showStatusWindow(); +- break; +- +- case 9: +- FileTransferMainPanel.mainPanel.showMessagesWindow(); +- break; +- +- case 12: //remote site disconnect +- _actionDisconnect(); +- break; +- case 14: +- getUrlFromField(); +- filepath = getFile(); +- index = filepath.lastIndexOf("/"); +- dirname = filepath.substring(0, index); +- _actionChngDir(dirname); +- break; +- } +- dirInfoButton.setEnabled(false); +- } +- +- public void shiftHomeToRoot() { +- if (!connected) { +- JOptionPane.showMessageDialog(this, +- "Remote host could not be connected."); +- _actionDisconnect(); +- return; +- } +- remove(rightView); +- updateURL(); +- rootpath = ""; +- +- if (home) { +- rootRemote = "//"; +- home = false; +- } else { +- rootRemote = userHomeDir; +- home = true; +- } +- createRemoteTree(); +- JOptionPane.showMessageDialog(this, +- "Changed to new root " + rootRemote); +- } +- +- public void displayRemoteFile() { +- String as[] = right.returnSelectedFiles(); +- if (as == null) { +- // theApp.toolkit.beep(); +- statusOut("noAction"); +- return; +- } +- int i = as.length; +- if (i == 0) { +- // theApp.toolkit.beep(); +- statusOut("noAction"); +- return; +- } else { +- String s = "/"; +- +- fireGridEvent(new GridEvent(this, GridEvent.GRIDEDIT), null, s, as); +- //theApp.createEditFrame(as, ftpClnt, right.Remote_fileSep); +- return; +- } +- } +- +- public JButton createButton(String s, String s1, String s2) { +- ClassLoader classLoader = getClass().getClassLoader(); +- URL jarCogImage = classLoader.getResource(s); +- JButton jbutton = new JButton(new ImageIcon(jarCogImage)); +- jbutton.setActionCommand(s2); +- jbutton.addActionListener(this); +- jbutton.setToolTipText(s1); +- Dimension dimension = new Dimension(20, 20); +- jbutton.setMaximumSize(dimension); +- jbutton.setMinimumSize(dimension); +- jbutton.setPreferredSize(dimension); +- jbutton.setRequestFocusEnabled(false); +- return jbutton; +- } +- +- public JToggleButton createToggleButton(String s, String s1, String s2) { +- ClassLoader classLoader = getClass().getClassLoader(); +- URL jarCogImage = classLoader.getResource(s); +- JToggleButton jbutton = new JToggleButton(new ImageIcon(jarCogImage)); +- jbutton.setActionCommand(s2); +- jbutton.addActionListener(this); +- jbutton.setToolTipText(s1); +- Dimension dimension = new Dimension(20, 20); +- jbutton.setMaximumSize(dimension); +- jbutton.setMinimumSize(dimension); +- jbutton.setPreferredSize(dimension); +- jbutton.setRequestFocusEnabled(false); +- return jbutton; +- } +- +- public synchronized void statusOut(String s) { +- //statusText.setText(s); +- } +- +- public void setToolsEn(boolean flag) { +- for (int i = 0; i <= 60; i++) { +- Component component = toolBar.getComponentAtIndex(i); +- if (component == null) { +- break; +- } +- component.setEnabled(flag); +- } +- } +- +- +- public void clear() { +- right.rootNode.removeAllChildren(); +- right.treeModel.reload(); +- } +- +- +- public void setFilesFromRemDir(File f[]) { +- files = f; +- } +- +- public void setRemFlag(boolean b) { +- remflag = b; +- } +- +- public void enableDeleteButton(boolean flag) { +- deleteButton.setEnabled(flag); +- } +- +- private JButton deleteButton = null; +- private JTextField urlField; +- private JLabel msg; +- private GlobusURL url; +- +- private String protocol; +- private String host; +- private int port; +- private String user; +- private String file; +- private String pwd; +- private PropertyChangeSupport pceListeners; +- +- protected String rootRemote = null; +- private String userHomeDir = null; +- protected String currentdir; +- public boolean isDir = false; +- public File[] files = null; +- public boolean remflag = false; +- +- public DisplayInterface displayInterface = null; +- protected JScrollPane rightView; +- protected JButton disconnect = null; +- protected DefaultMutableTreeNode seekNode; +- public int FrameId; +- +- public JLabel statusText; +- public RemoteTree right; +- public int ServerOpSys; +- public boolean connected; +- public boolean flag = true; +- public String rootpath; +- public JToolBar toolBar; +- //variables used frequently +- String filepath; +- int index; +- String dirname; +- Vector vector; +- public String RemoteFileSep = "/"; +- boolean home = true; +- String urlstring = null; +- String errorMsg = "No errors"; +-} +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTree.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTree.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTree.java (working copy) +@@ -1,1055 +0,0 @@ +-//RemoteTree.java displays the remote tree structure d the remote files +-package org.globus.ogce.beans.filetransfer.gui.remote.common; +- +- +-import org.apache.log4j.Logger; +-import org.globus.ftp.FileInfo; +-import org.globus.ftp.MlsxEntry; +-import org.globus.ogce.beans.filetransfer.util.DirInfo; +-import org.globus.ogce.beans.filetransfer.util.DirQueue; +-import org.globus.ogce.beans.filetransfer.util.GridTransferable; +-import org.globus.ogce.beans.filetransfer.util.SortVectorStrings; +-import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; +- +-import javax.swing.*; +-import javax.swing.event.*; +-import javax.swing.tree.DefaultMutableTreeNode; +-import javax.swing.tree.DefaultTreeModel; +-import javax.swing.tree.MutableTreeNode; +-import javax.swing.tree.TreePath; +-import java.awt.*; +-import java.awt.dnd.*; +-import java.awt.event.MouseAdapter; +-import java.awt.event.MouseEvent; +-import java.io.IOException; +-import java.util.*; +-import java.util.List; +- +-/** +- * This class implements the tree and drag and drop listeners +- * +- * @author Beulah Kurian Alunkal +- * @version 1.0 +- */ +-public class RemoteTree extends JTree implements TreeExpansionListener, TreeWillExpandListener, DragSourceListener, DragGestureListener, java.awt.dnd.DropTargetListener { +- private static Logger logger = +- Logger.getLogger(RemoteTree.class.getName()); +- +- protected DefaultTreeModel treeModel; +- boolean dirflag; +- private TreeSet InfoVec; +- public String rootName; +- private Object draggedValues[]; +- public DropTarget dropTarget; +- +- public RemoteTreeFrame theApp; +- public JScrollPane sc_pane = null; +- public JTree tree; +- public String RemoteRoot; +- public String selectedPath; +- public Vector RemVector; +- +- public DefaultMutableTreeNode rootNode; +- public DefaultMutableTreeNode lastExp; +- public Toolkit toolkit; +- public boolean pathView; +- public Vector vector; +- public Vector vector1; +- +- public long firstClickTime = 0; +- private boolean noselection = true; +- TreePath destinationPath; +- protected TreePath SelectedTreePath = null; +- protected TreePath dragtreepath = null; +- private DirQueue queue; +- +- private DisplayInterface displayInterface = null; +- private boolean dragEnable = true; +- String deleteFile = null; +- boolean deleteFlag = true; +- DefaultMutableTreeNode defaultmutabletreenode = null; +- MutableTreeNode mutabletreenode = null; +- String selectedDestination = ""; +- +- +- public RemoteTree(RemoteTreeFrame RemoteTreeframe, String s, String remoteRoot, DisplayInterface displayInterface) { +- +- InfoVec = new TreeSet(); +- selectedPath = new String(); +- RemVector = null; +- toolkit = Toolkit.getDefaultToolkit(); +- theApp = RemoteTreeframe; +- rootName = s; +- if (theApp.connected) { +- RemoteRoot = remoteRoot; +- } else { +- RemoteRoot = new String(); +- } +- makeRemoteInfo(); +- queue = new DirQueue(); +- this.displayInterface = displayInterface; +- } +- +- public void makeRemoteInfo() { +- rootNode = new DefaultMutableTreeNode(rootName); +- treeModel = new DefaultTreeModel(rootNode); +- treeModel.addTreeModelListener(new RemTreeModelListener()); +- RemoteRoot = theApp.rootRemote + "/"; +- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(null, RemoteRoot); +- addObject(defaultmutabletreenode1, ""); +- //makeDirInfo(RemoteRoot); +- if (theApp.connected) { +- theApp.setDirToFile(RemoteRoot); +- } +- tree = new JTree(treeModel); +- dropTarget = new DropTarget(tree, this); +- dropTarget.setActive(true); +- tree.setEditable(false); +- tree.getSelectionModel().setSelectionMode(4); +- sc_pane = new JScrollPane(tree); +- tree.addTreeWillExpandListener(this); +- tree.addMouseListener(new MyAdapter()); // for double clicking +- ToolTipManager.sharedInstance().registerComponent(tree); +- RemRenderer remrenderer = new RemRenderer(theApp); +- tree.setCellRenderer(remrenderer); +- tree.putClientProperty("JTree.lineStyle", "Angled"); +- tree.addTreeSelectionListener(new TreeSelectionListener() { +- public void valueChanged(TreeSelectionEvent treeselectionevent) { +- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); +- if (defaultmutabletreenode == null) { +- return; +- } else { +- javax.swing.tree.TreeNode atreenode[] = null; +- atreenode = defaultmutabletreenode.getPath(); +- selectedPath = returnPath(atreenode); +- SelectedTreePath = treeselectionevent.getNewLeadSelectionPath(); +- return; +- } +- } +- }); +- DragSource dragsource = DragSource.getDefaultDragSource(); +- dragsource.createDefaultDragGestureRecognizer(tree, 3, this); +- } +- +- public void getLastExpandeNode(DefaultMutableTreeNode defaultmutabletreenode, TreePath treepath) { +- int i = defaultmutabletreenode.getChildCount(); +- for (int j = 0; j < i; j++) { +- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(j); +- if (!defaultmutabletreenode1.isLeaf()) { +- javax.swing.tree.TreeNode atreenode[] = defaultmutabletreenode1.getPath(); +- TreePath treepath1 = new TreePath(atreenode); +- if (!treepath1.equals(treepath) && tree.isExpanded(treepath1)) { +- lastExp = defaultmutabletreenode1; +- getLastExpandeNode(defaultmutabletreenode1, treepath); +- } +- } +- } +- } +- +- public String returnPath(Object aobj[]) { +- int i = aobj.length; +- String s = new String(); +- for (int j = 1; j < i; j++) { +- s = s.concat(aobj[j].toString()); +- } +- return s; +- } +- +- public void createNodes(DefaultMutableTreeNode defaultmutabletreenode, boolean flag, String s) { +- if (flag) { +- DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(s); +- defaultmutabletreenode.add(defaultmutabletreenode1); +- DefaultMutableTreeNode defaultmutabletreenode2 = new DefaultMutableTreeNode(""); +- defaultmutabletreenode1.add(defaultmutabletreenode2); +- } else { +- DefaultMutableTreeNode defaultmutabletreenode3 = new DefaultMutableTreeNode(s); +- defaultmutabletreenode.add(defaultmutabletreenode3); +- } +- } +- +- public DefaultMutableTreeNode addObject(Object obj) { +- DefaultMutableTreeNode defaultmutabletreenode = null; +- TreePath treepath = tree.getSelectionPath(); +- if (treepath == null) { +- toolkit.beep(); +- return null; +- } +- defaultmutabletreenode = (DefaultMutableTreeNode) treepath.getLastPathComponent(); +- if (defaultmutabletreenode == rootNode) { +- toolkit.beep(); +- return null; +- } else { +- return addObject(defaultmutabletreenode, obj, true); +- } +- } +- +- public DefaultMutableTreeNode addObject(DefaultMutableTreeNode defaultmutabletreenode, Object obj) { +- return addObject(defaultmutabletreenode, obj, false); +- } +- +- public DefaultMutableTreeNode addObject(DefaultMutableTreeNode defaultmutabletreenode, Object obj, boolean flag) { +- DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(obj); +- if (defaultmutabletreenode == null) { +- defaultmutabletreenode = rootNode; +- } +- treeModel.insertNodeInto(defaultmutabletreenode1, defaultmutabletreenode, defaultmutabletreenode.getChildCount()); +- if (flag) { +- tree.scrollPathToVisible(new TreePath(defaultmutabletreenode1.getPath())); +- } +- return defaultmutabletreenode1; +- } +- +- public void statusOut(String msg) { +- //theApp.statusOut(msg); +- } +- +- public void removeCurrentNode() { +- int i = tree.getSelectionModel().getSelectionCount(); +- if (i == 0) { +- toolkit.beep(); +- statusOut("Nothing was selected"); +- statusOut("Status : Ready "); +- return; +- } +- for (int j = 0; j < i; j++) { +- TreePath treepath = tree.getSelectionPath(); +- if (treepath != null) { +- +- defaultmutabletreenode = (DefaultMutableTreeNode) treepath.getLastPathComponent(); +- mutabletreenode = (MutableTreeNode) defaultmutabletreenode.getParent(); +- javax.swing.tree.TreeNode atreenode[] = null; +- atreenode = defaultmutabletreenode.getPath(); +- deleteFile = returnPath(atreenode); +- String msg = null; +- if (mutabletreenode != null) { +- if (deleteFile.endsWith("/")) { +- msg = "Directory"; +- } else { +- msg = "File"; +- } +- Object aobj[] = {"Cancel", "Delete"}; +- int k = JOptionPane.showOptionDialog(theApp, "Do you really want to delete this " + msg + " ?", "Delete Alert", -1, 2, null, aobj, aobj[0]); +- if (k != 0) { +- +- if (deleteFile.endsWith("/")) { +- dirDelete(); +- +- +- } else { +- deleteFlag = displayInterface.removeFile(deleteFile); +- +- if (deleteFlag) { +- treeModel.removeNodeFromParent(defaultmutabletreenode); +- if (treeModel.getChildCount(mutabletreenode) == 0) { +- addObject((DefaultMutableTreeNode) mutabletreenode, ""); +- } +- statusOut("Successfully deleted :" + deleteFile); +- } else { +- JOptionPane.showMessageDialog(this, msg + " : Permission Denied."); +- } +- +- statusOut("Status : Ready "); +- } +- } +- } +- } else { +- toolkit.beep(); +- statusOut("No selection was made"); +- statusOut("Status : Ready "); +- } +- } +- } // end of removecurrentNode +- +- public void dirDelete() { +- Thread dirDelete = new Thread() { +- public void run() { +- theApp.enableDeleteButton(false); +- setDragEnabled(false); +- deleteFlag = deleteDir(deleteFile); +- if (deleteFlag) { +- treeModel.removeNodeFromParent(defaultmutabletreenode); +- if (treeModel.getChildCount(mutabletreenode) == 0) { +- addObject((DefaultMutableTreeNode) mutabletreenode +- , ""); +- } +- theApp._actionRefresh(); +- statusOut("Successfully deleted: " + deleteFile); +- } else { +- JOptionPane.showMessageDialog(theApp, deleteFile + +- " : Permission Denied."); +- } +- theApp.enableDeleteButton(true); +- setDragEnabled(true); +- } +- }; +- dirDelete.start(); +- statusOut("Status : Ready "); +- } +- +- public boolean deleteDir(String dirname) { +- if (!theApp.connected) { +- JOptionPane.showMessageDialog(this, "Connection got disconnected"); +- theApp._actionDisconnect(); +- return false; +- } else { +- Vector vector = displayInterface.listDeleteDir(dirname); +- if (vector == null) { +- logger.info("\nThis is an empty directory."); +- } else { +- FileInfo temp[] = new FileInfo[vector.size()]; +- int p = 0; +- Enumeration enum1 = vector.elements(); +- while (enum1.hasMoreElements()) { +- FileInfo file = (FileInfo) enum1.nextElement(); +- temp[p] = file; +- p++; +- } +- +- +- for (int i = 0; i < temp.length; i++) { +- FileInfo current = temp[i]; +- String currentFullpath = dirname + "/" + current.getName(); +- if (current.isDirectory()) { +- +- // statusOut( "Deleting the files in directory : " + currentFullpath); +- deleteDir(currentFullpath); +- +- } else { +- displayInterface.removeFile(currentFullpath); +- logger.info("\nDeleting: " + currentFullpath); +- statusOut("\nDeleting: " + current.getName()); +- } +- } +- +- +- } +- boolean flag = displayInterface.removeDir(dirname); +- if (flag) { +- logger.info("\nDeleted the directory " + dirname); +- +- } +- return flag; +- } +- } +- +- public void doServList(String s) { +- Vector vector = null; +- if (!theApp.connected) { +- JOptionPane.showMessageDialog(this, "Connection got disconnected"); +- theApp._actionDisconnect(); +- return; +- } +- displayInterface.setType(true); +- vector = displayInterface.listDir(s); +- +- if (RemVector != null) { +- RemVector.clear(); +- } +- RemVector = (Vector) vector.clone(); +- InfoVec.addAll(vector); +- pathView = true; +- } // end of doServList +- +- public Vector ReturnInfoVec() { +- return RemVector; +- } +- +- +- public DefaultMutableTreeNode seekParent(DefaultMutableTreeNode defaultmutabletreenode, String s) { +- if (defaultmutabletreenode == null || s.compareTo(RemoteRoot) == 0) { +- return null; +- } +- int i = defaultmutabletreenode.getChildCount(); +- String s1 = s.substring(s.indexOf("/") + 1); +- for (int j = 0; j < i; j++) { +- javax.swing.tree.TreeNode treenode = defaultmutabletreenode.getChildAt(j); +- String s2 = treenode.toString(); +- if (s1.compareTo(s2) == 0) { +- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treenode; +- return defaultmutabletreenode1; +- } +- } +- return null; +- } +- +- public String[] returnSelectedPaths1() { +- TreePath atreepath[] = tree.getSelectionModel().getSelectionPaths(); +- String s = null; +- String as[] = null; +- if (atreepath != null) { +- int i = atreepath.length; +- as = new String[i]; +- for (int j = 0; j < i; j++) { +- Object aobj[] = atreepath[j].getPath(); +- int k = aobj.length; +- for (int l = 1; l < k; l++) { +- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) aobj[l]; +- if (!defaultmutabletreenode.isLeaf()) { +- if (l == 1) { +- s = new String("/"); +- } +- s = s.concat(aobj[l].toString()); +- } +- } +- if (s != null) { +- as[j] = new String(s); +- } +- } +- } +- return as; +- } +- +- public TreePath[] returnSelectedPaths() { +- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); +- TreePath atreepath[] = null; +- if (defaultmutabletreenode == null) { +- return atreepath; +- } +- if (defaultmutabletreenode.isLeaf()) { +- atreepath = tree.getSelectionModel().getSelectionPaths(); +- return atreepath; +- } else { +- TreePath atreepath1[] = tree.getSelectionPaths(); +- return atreepath1; +- } +- } +- +- public String[] returnSelectedFiles() { +- TreePath atreepath[] = returnSelectedPaths(); +- String as[] = null; +- if (atreepath != null) { +- int i = atreepath.length; +- as = new String[i]; +- for (int j = 0; j < i; j++) { +- Object aobj[] = atreepath[j].getPath(); +- int k = aobj.length; +- String s = new String(""); +- for (int l = 1; l < k; l++) { +- s = s.concat(aobj[l].toString()); +- } +- as[j] = new String(s); +- } +- } +- return as; +- } +- +- public void makeDirInfo(String s) //DefaultMutableTreeNode defaultmutabletreenode, String s) +- { +- vector = new Vector(); +- vector1 = new Vector(); +- if (theApp.getConnected() == false) { +- return; +- } +- doServList(s); +- if (RemVector.size() == 0) { +- // DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(""); +- //defaultmutabletreenode.add(defaultmutabletreenode1); +- return; +- } +- for (int i = 0; i < RemVector.size(); i++) { +- //The tokenizer uses the default delimiter set, which is "\t\n\r": +- StringTokenizer stringtokenizer = new StringTokenizer((String) RemVector.elementAt(i)); +- int j = stringtokenizer.countTokens(); +- String s1 = new String(); +- int i1 = 0; +- if (theApp.ServerOpSys == 2) { +- for (int j1 = 1; j1 <= j; j1++) { +- if (j1 <= 3) { +- stringtokenizer.nextToken(); +- } +- if (j1 == 4) { +- s1 = stringtokenizer.nextToken(); +- } +- if (j1 > 4) { +- s1 = s1 + " " + stringtokenizer.nextToken(); +- } +- } +- i1 = ((String) RemVector.elementAt(i)).lastIndexOf("

"); +- } else { +- for (int k1 = 1; k1 <= j; k1++) { +- if (k1 <= 8) { +- stringtokenizer.nextToken(); +- } +- if (k1 == 9) { +- s1 = stringtokenizer.nextToken(); +- } +- if (k1 > 9) { +- s1 = s1 + " " + stringtokenizer.nextToken(); +- } +- } +- } +- if (((String) RemVector.elementAt(i)).charAt(0) == 'd' || i1 > 0) { +- if (s1.compareTo(".") != 0 && s1.compareTo("..") != 0) { +- vector.addElement(s1 + "/"); +- } +- } else if (((String) RemVector.elementAt(i)).charAt(0) != 'l' && !(((String) RemVector.elementAt(i)).startsWith("total"))) //startsWith("total")) +- { +- vector1.addElement(s1); +- } +- } +- SortVectorStrings.startSort(vector); +- SortVectorStrings.startSort(vector1); +- } +- +- public void treeWillExpand(TreeExpansionEvent treeexpansionevent) { +- logger.info("\nenter the tree will expand."); +- if (!theApp.connected) { +- JOptionPane.showMessageDialog(this, "Connection got disconnected"); +- theApp._actionDisconnect(); +- return; +- } +- DefaultMutableTreeNode defaultmutabletreenode = null; +- Object aobj[] = null; +- aobj = treeexpansionevent.getPath().getPath(); +- int i = aobj.length; +- defaultmutabletreenode = (DefaultMutableTreeNode) aobj[i - 1]; +- if (defaultmutabletreenode == rootNode) { +- return; +- } else { +- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treeModel.getChild(aobj[i - 1], 0); +- treeModel.removeNodeFromParent(defaultmutabletreenode1); +- String s1 = returnPath(aobj); +- statusOut("Please wait..Expanding dir " + s1); +- listDir(defaultmutabletreenode, s1, false); +- if (!theApp.connected) { +- JOptionPane.showMessageDialog(null, "Connection got disconnected"); +- theApp._actionDisconnect(); +- statusOut("Application disconnected."); +- return; +- } else { +- +- theApp.setDirToFile(s1); +- noselection = false; +- tree.getSelectionModel().clearSelection(); +- statusOut("Status: Ready"); +- return; +- } +- } +- } +- +- public void listDir(DefaultMutableTreeNode defaultmutabletreenode, String s, boolean flag) { +- +- logger.info("\nEntered the listdir function."); +- FileInfo file2,file1; +- if (!theApp.connected) { +- JOptionPane.showMessageDialog(this, "Connection got disconnected"); +- theApp._actionDisconnect(); +- return; +- } +- +- vector = null; +- vector = displayInterface.listDir(s); +- logger.info("\nGot the list."); +- +- if (vector == null) { +- logger.info("\nThe vector is null.Using the Parameterized LIST Aand Customized Parser"); +- +- vector = displayInterface.listAllDir(s); +- statusOut("Parsing failed. Using new Parser"); +- +- FileParser parser = new FileParser(); +- vector = parser.parse(vector, "unix", "/"); +- +- +- /* if (vector == null){ +- JOptionPane.showMessageDialog(null,"Connection reset. Please try connecting again."); +- theApp._actionDisconnect(); +- return ; +- }*/ +- +- } +- //FileInfo temp[] = new FileInfo[vector.size()]; +- MlsxEntry temp[] = new MlsxEntry[vector.size()]; +- String as[] = new String[vector.size()]; +- int p = 0; +- Enumeration enum1 = vector.elements(); +- while (enum1.hasMoreElements()) { +- MlsxEntry entry = (MlsxEntry) enum1.nextElement(); +- if (null != entry) { +- as[p] = entry.getFileName(); +- temp[p] = entry; +- p++; +- } +- //System.out.println(entry); +- +- } +- +- if (as == null) { +- return; +- } +- int i = as.length; +- //SortFtpString.startSort(as); +- if ((i == 0) || (as[0] == null)) { +- addObject(defaultmutabletreenode, "", false); +- return; +- } +- statusOut("Listing the directories..."); +- String fullName = null; +- for (int j = 0; j < i; j++) { +- if (s.endsWith("/")) { +- fullName = s + as[j]; +- //temp[j].setName(s + as[j]); +- } else { +- fullName = s + "/" + as[j]; +- //temp[j].setName(s + "/" + as[j]); +- } +- //file1 = (FileInfo) temp[j]; +- +- if ("dir".equals(temp[j].get("type"))) { +- +- if (temp[j].get("unix.slink") != null) { +- ; +- } else { +- +-// if ((file1.getName().equals("//dev")) || +-// (file1.isDevice())) { +-// logger.info("\nIt is a device directory"); +-// addObject(defaultmutabletreenode, as[j], flag); +-// statusOut("Disabled the device directory" + file1.getName()); +-// +-// } else if ((file1.getName().equals("?"))) { +-// logger.info("\nDir name could not be parsed"); +-// statusOut("The Parser could not parse filename"); +-// +-// } else { +- //System.out.println(as[j]); +- DefaultMutableTreeNode defaultmutabletreenode1 +- = addObject(defaultmutabletreenode, as[j] + "/", flag); +- addObject(defaultmutabletreenode1, "", false); +- //} +- } +- } +- } +- statusOut("Listing the files..."); +- +- for (int k = 0; k < i; k++) { +- if (s.endsWith("/")) { +- fullName = s + as[k]; +- //temp[k].setName(s + as[k]); +- } else { +- fullName = s + "/" + as[k]; +- //temp[k].setName(s + "/" + as[k]); +- } +- //file2 = temp[k]; +- +- if ("file".equals(temp[k].get("type"))) { +- if (temp[k].get("unix.slink") != null) { +- logger.info("\nThis is a softlink."); +-// } else if ((file2.getName().equals("?"))) { +-// logger.info("\nFile name could not be parsed"); +-// statusOut("The Parser could not parse file"); +-// +- } else { +- addObject(defaultmutabletreenode, as[k], flag); +- statusOut("Done. Status: Ready"); +- } +- +- } +- +- } +- +- +- } +- /* Alternate parsing method +- +- }catch(Exception e){ +- logger.info("The vector is returned as Strings "); +- String buffer[] = new String[vector.size()]; +- while (enum.hasMoreElements()) { +- String sbuffer = (String)enum.nextElement(); +- StringTokenizer stringtokenizer = new StringTokenizer(sbuffer); +- int m = stringtokenizer.countTokens(); +- String s1 = new String(); +- int i1 = 0; +- for(int k1 = 1; k1 <= m; k1++) +- { +- if(k1 <= 8) +- stringtokenizer.nextToken(); +- if(k1 == 9) +- s1 = stringtokenizer.nextToken(); +- if(k1 > 9) +- s1 = s1 + " " + stringtokenizer.nextToken(); +- } +- as[p] = s1; +- buffer[p] = sbuffer; +- p ++ ; +- } +- +- if (as == null) +- return ; +- int i = as.length; +- if (i == 0) { +- addObject(defaultmutabletreenode,"",false); +- return ; +- } +- +- for (int j = 0; j < i; j ++ ) { +- +- +- if (s.endsWith("/")){ +- as[j] = s+as[j]; +- } +- else{ +- if(buffer[i].charAt(0) == 'd' ){ +- if(as[j].compareTo (".") != 0 && as[j].compareTo("..") != 0){ +- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(defaultmutabletreenode,as[j] +- +"/",flag); +- addObject(defaultmutabletreenode1,"",false); +- } +- } +- } +- } +- for (int k = 0; k < i; k ++ ) { +- if(buffer[i].charAt(0) == 'd' ){ +- addObject(defaultmutabletreenode,as[k],flag); +- } +- +- } +- }*/ +- +- +- +- public void treeWillCollapse(TreeExpansionEvent treeexpansionevent) { +- DefaultMutableTreeNode defaultmutabletreenode = null; +- tree.getSelectionModel().clearSelection(); +- Object aobj[] = null; +- aobj = treeexpansionevent.getPath().getPath(); +- int i = aobj.length; +- if (i > 1) { +- defaultmutabletreenode = (DefaultMutableTreeNode) aobj[i - 1]; +- } else { +- defaultmutabletreenode = rootNode; +- } +- if (defaultmutabletreenode == rootNode) { +- // txtField.setText("Local Path "); +- noselection = true; +- treeModel.reload(defaultmutabletreenode); +- return; +- } +- noselection = false; +- defaultmutabletreenode.removeAllChildren(); +- addObject(defaultmutabletreenode, ""); +- aobj = ((DefaultMutableTreeNode) defaultmutabletreenode.getParent()).getPath(); +- lastExp = null; +- getLastExpandeNode(rootNode, treeexpansionevent.getPath()); +- if (lastExp != null) { +- javax.swing.tree.TreeNode atreenode[] = treeModel.getPathToRoot(lastExp); +- TreePath treepath = new TreePath(atreenode); +- Object aobj1[] = treepath.getPath(); +- String s1 = returnPath(aobj1); +- theApp.setDirToFile(s1); +- } else { +- //txtField.setText("Local Path "); +- noselection = true; +- } +- treeModel.reload(defaultmutabletreenode); +- } +- +- public void buildirStructure(DefaultMutableTreeNode defaultmutabletreenode) { +- for (int k = 0; k < vector.size(); k++) { +- createNodes(defaultmutabletreenode, true, vector.elementAt(k).toString()); +- } +- if (vector1.size() == 0) { +- //createNodes(defaultmutabletreenode, false, ""); +- return; +- } else { +- for (int l = 0; l < vector1.size(); l++) { +- //JOptionPane.showMessageDialog(null, vector1.elementAt(l)); +- createNodes(defaultmutabletreenode, false, vector1.elementAt(l).toString()); +- } +- } +- } +- +- public void treeExpanded(TreeExpansionEvent treeexpansionevent) { +- } +- +- public void treeCollapsed(TreeExpansionEvent treeexpansionevent) { +- } +- +- +- public void transferfile(String startdir, String currdir, String fullpath) { +- +- final DirInfo dirInfo = new DirInfo(fullpath, startdir, currdir); +- queue.put(dirInfo); +- return; +- +- } +- +- public void dragGestureRecognized(DragGestureEvent draggestureevent) { +- if (!theApp.connected) { +- return; +- } +- TreePath treepath[] = null; +- Object aobj1[] = null; +- String fullpath = ""; +- +- try { +- treepath = returnSelectedPaths(); +- dragtreepath = SelectedTreePath; +- aobj1 = treepath[0].getPath(); +- fullpath = returnPath(aobj1); +- logger.info("\nfull path=" + fullpath); +- +- } catch (NullPointerException e) { +- logger.info("Drag Recognized failed."); +- } +- +- +- if (treepath == null || aobj1 == null || dragtreepath == null || fullpath == null) { +- return; +- } else if (!(dragEnable)) { +- JOptionPane.showMessageDialog(this, "Please wait till the status\n bar shows drag enabled."); +- return; +- } else { +- draggedValues = returnSelectedFiles(); +- GridTransferable Gridtransferable = new GridTransferable(draggedValues); +- draggestureevent.startDrag(DragSource.DefaultCopyDrop, Gridtransferable, this); +- String tempto[] = {""}; +- queue.deleteAll(); +- statusOut("Copying the file ..."); +- String startdir = draggedValues[0].toString(); +- logger.info("\nfull path =" + fullpath); +- theApp.fireGridEvent(new GridEvent(theApp, GridEvent.GRIDDRAG), startdir, "", tempto); +- theApp.setDirToFile(fullpath.substring(0, +- fullpath.lastIndexOf("/")) + "/"); +- +- } +- } +- +- public void setDragEnabled(boolean flag) { +- dragEnable = flag; +- if (flag) { +- +- tree.setBackground(Color.white); +- statusOut("Successfully done dragging."); +- statusOut("Status : Ready "); +- } else { +- tree.setBackground(Color.lightGray); +- statusOut("Current window disabled. Please wait ... till" + +- " the color changes back to white."); +- +- } +- +- } +- +- public void dragEnter(DragSourceDragEvent dragsourcedragevent) { +- } +- +- public void dragOver(DragSourceDragEvent dragsourcedragevent) { +- } +- +- public void dragExit(DragSourceEvent dragsourceevent) { +- } +- +- public void dropActionChanged(DragSourceDragEvent dragsourcedragevent) { +- } +- +- public void dragDropEnd(DragSourceDropEvent dragsourcedropevent) { +- if (dragsourcedropevent.getDropSuccess()) { +- int i = dragsourcedropevent.getDropAction(); +- logger.info("value of i:" + i); +- } +- } +- +- +- public void dragEnter(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { +-// int i = droptargetdragevent.getDropAction(); +-// if ((i & 1) != 0) { +-// statusOut("Copying"); +-// } +-// if ((i & 2) != 0) { +-// statusOut("Moving"); +-// } +-// if ((i & 1073741824) != 0) { +-// statusOut("Linking"); +-// } +-// if (!isDragAcceptable(droptargetdragevent)) { +-// droptargetdragevent.rejectDrag(); +-// return; +-// } else { +-// return; +-// } +- } +- +- public void dragExit(java.awt.dnd.DropTargetEvent droptargetevent) { +- } +- +- public void dragOver(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { +- //set cursor location. Needed in setCursor method +- Point cursorLocationBis = droptargetdragevent.getLocation(); +- TreePath dPath = tree.getPathForLocation(cursorLocationBis.x, cursorLocationBis.y); +- tree.setSelectionPath(dPath); +- } +- +- public void dropActionChanged(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { +- if (!isDragAcceptable(droptargetdragevent)) { +- droptargetdragevent.rejectDrag(); +- return; +- } else { +- return; +- } +- } +- +- public void drop(java.awt.dnd.DropTargetDropEvent droptargetdropevent) { +- if (!isDropAcceptable(droptargetdropevent)) { +- droptargetdropevent.rejectDrop(); +- return; +- } else if (!(dragEnable)) { +- return; +- } +- Point loc = droptargetdropevent.getLocation(); +- destinationPath = tree.getPathForLocation(loc.x, loc.y); +- final String msg = testDropTarget(destinationPath, dragtreepath); +- if (msg != null) { +- SwingUtilities.invokeLater(new Runnable() { +- +- public void run() { +- JOptionPane.showMessageDialog(theApp, msg, "Error Dialog", JOptionPane.ERROR_MESSAGE); +- } +- }); +- return; +- } +- droptargetdropevent.acceptDrop(1); +- java.awt.datatransfer.Transferable transferable = droptargetdropevent.getTransferable(); +- java.awt.datatransfer.DataFlavor adataflavor[] = transferable.getTransferDataFlavors(); +- for (int i = 0; i < adataflavor.length; i++) { +- java.awt.datatransfer.DataFlavor dataflavor = adataflavor[i]; +- try { +- if (dataflavor.equals(java.awt.datatransfer.DataFlavor.javaFileListFlavor)) { +- List list = (List) transferable.getTransferData(dataflavor); +- Iterator iterator = list.iterator(); +- Vector vector = new Vector(); +- String s; +- for (; iterator.hasNext(); vector.add(s)) { +- s = iterator.next().toString(); +- } +- doCopyAction(vector); +- //droptargetdropevent.rejectDrop(); +- } +- } catch (java.awt.datatransfer.UnsupportedFlavorException unsupportedflavorexception) { +- logger.debug("Exception _ufe = " + unsupportedflavorexception.toString()); +- } catch (IOException ioexception) { +- logger.debug("Exception _ioe = " + ioexception.toString()); +- } +- } +- droptargetdropevent.dropComplete(true); +- } +- +- private String testDropTarget(TreePath destination, TreePath dropper) { +- //Typical Tests for dropping +- //Test 1. +- boolean destinationPathIsNull = destination == null; +- if (destinationPathIsNull) { +- return "Invalid drop location."; +- } +- if (destination.equals(dropper)) { +- logger.info("\nDestination =" + destination + +- "\nSource= " + dropper); +- theApp._actionRefresh(); +- return "Destination cannot be same as source"; +- } +- return null; +- } +- +- public boolean isDragAcceptable(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { +- return (droptargetdragevent.getDropAction() & 3) != 0; +- } +- +- public boolean isDropAcceptable(java.awt.dnd.DropTargetDropEvent droptargetdropevent) { +- return (droptargetdropevent.getDropAction() & 3) != 0; +- } +- +- +- public void doCopyAction(Vector vector) { +- +- int i = vector.size(); +- String as[] = returnSelectedPaths1(); +- if (as == null || as[0] == null) { +- as = new String[1]; +- as[0] = new String(theApp.getDirFromFile()); +- } +- String as1 = ""; +- for (int j = 0; j < i; j++) { +- as1 = (String) vector.elementAt(j); +- } // end of for loop +- // dragtreepath = as1; +- +- String temp[] = {""}; +- if(theApp.bean){ +- FileTransferMainPanel.mainPanel.showStatusWindow(); +- FileTransferMainPanel.mainPanel.showMessagesWindow(); +- } +- theApp.fireGridEvent(new GridEvent(theApp, GridEvent.GRIDDROP), null, as[0], temp); +- theApp.setDirToFile(as[0]); +- +- return; +- } // end of doCopyAction +- +- public void setSelectedSource() { +- draggedValues = returnSelectedFiles(); +- String tempto[] = {""}; +- String startdir = draggedValues[0].toString(); +- theApp.fireGridEvent(new GridEvent(theApp, GridEvent.GRIDDRAG), startdir, "", tempto); +- } +- +- public void setSelectedDestination() { +- String as[] = returnSelectedPaths1(); +- if (as == null || as[0] == null) { +- as = new String[1]; +- as[0] = new String(theApp.getDirFromFile()); +- } +- this.selectedDestination = as[0]; +- } +- +- public void transfer() { +- String temp[] = {""}; +- theApp.fireGridEvent(new GridEvent(theApp, GridEvent.GRIDDROP), null, selectedDestination, temp); +- } +- +- +- class MyAdapter extends MouseAdapter { +- +- public MyAdapter() { +- } +- +- public void mouseClicked(MouseEvent evt) { +- long clickTime = System.currentTimeMillis(); +- long clickInterval = clickTime - firstClickTime; +- if (clickInterval < 300) { +- theApp.displayRemoteFile(); +- firstClickTime = 0; +- } else { +- firstClickTime = clickTime; +- } // end of if - else +- } // end of mouseclicked +- } +- +- +- class RemTreeModelListener implements TreeModelListener { +- public void treeNodesChanged(TreeModelEvent treemodelevent) { +- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) treemodelevent.getTreePath().getLastPathComponent(); +- try { +- int i = treemodelevent.getChildIndices()[0]; +- defaultmutabletreenode = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(i); +- } catch (NullPointerException nullpointerexception) { +- nullpointerexception.getMessage(); +- } +- javax.swing.tree.TreeNode atreenode[] = null; +- atreenode = defaultmutabletreenode.getPath(); +- // file1.renameTo(file); +- displayInterface.rename(selectedPath, returnPath(atreenode)); +- } +- +- public void treeNodesInserted(TreeModelEvent treemodelevent) { +- } +- +- public void treeNodesRemoved(TreeModelEvent treemodelevent) { +- } +- +- public void treeStructureChanged(TreeModelEvent treemodelevent) { +- } +- +- RemTreeModelListener() { +- } +- } +-} +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/AbstractFileTransfer.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/AbstractFileTransfer.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/AbstractFileTransfer.java (working copy) +@@ -1,148 +0,0 @@ +-package org.globus.ogce.beans.filetransfer.transfer; +- +-import org.apache.log4j.Logger; +-import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; +-import org.globus.ogce.beans.filetransfer.gui.MainInterface; +-import org.globus.ogce.beans.filetransfer.gui.monitor.MonitorPanel; +-import org.globus.ogce.beans.filetransfer.gui.monitor.UrlCopyPanel; +-import org.globus.ogce.beans.filetransfer.util.FileToTransfer; +-import org.globus.ogce.beans.filetransfer.util.GridBrokerQueue; +- +-import javax.swing.*; +- +-public abstract class AbstractFileTransfer extends Thread { +- private static Logger logger = +- Logger.getLogger(AbstractFileTransfer.class.getName()); +- +- private MainInterface theApp; +- +- private GridBrokerQueue mainQueue = null; +- private GridBrokerQueue saveQueue = null; +- +- private MonitorPanel monitorFrame = null; +- +- private int jobID = 0; +- private boolean active = false; +- private boolean start = true; +- private boolean previousTransfer = false; +- +- protected TransferInterface serviceProvider = null; +- FileToTransfer ftt = null; +- +- +- public AbstractFileTransfer(MainInterface theApp, MonitorPanel monitorFrame) { +- super("AbstractFileTransfer"); +- this.theApp = theApp; +- this.monitorFrame = monitorFrame; +- mainQueue = new GridBrokerQueue(); +- saveQueue = new GridBrokerQueue(); +- logger.info("Constructor"); +- previousTransfer = false; +- } +- +- public abstract void setTransferProvider(); +- +- public AbstractFileTransfer() { +- this(null, null); +- } +- +- public void setControl(boolean start) { +- this.start = start; +- if (start) { +- run(); +- } +- } +- +- public void setSaveQueue(GridBrokerQueue saveQueue) { +- this.saveQueue = saveQueue; +- } +- +- public GridBrokerQueue getSaveQueue() { +- return saveQueue; +- } +- +- public void updateQueues(GridBrokerQueue requestQueue) { +- setControl(false); +- int length = requestQueue.size(); +- for (int i = 0; i < length; i++) { +- jobID = ++FileTransferMainPanel.jobID; +- FileToTransfer ftt = (FileToTransfer) requestQueue.get(); +- +- ftt.setJobID(jobID + ""); +- mainQueue.put(ftt); +- saveQueue.put(ftt); +- ((UrlCopyPanel)serviceProvider).addTransfer(jobID + "", ftt.getFrom(), ftt.getTo(), "false"); +- +- } +- setControl(true); +- } +- +- public void clearAllQueues() { +- mainQueue.deleteAll(); +- saveQueue.deleteAll(); +- jobID = 0; +- active = false; +- previousTransfer = false; +- run(); +- } +- +- public void run() { +- if (active) { +- return; +- } +- +- if (mainQueue.size() > 0) { +- while ((mainQueue.size() > 0) && (start)) { +- +- active = true; +- if (previousTransfer) { +- logger.info("Process the previous request"); +- previousTransfer = false; +- } else { +- ftt = (FileToTransfer) mainQueue.get(); +- } +- serviceProvider.startTransfer(ftt.getJobID()); +- String result = "Unknown"; +- long time = 0; +- int index = -1; +- System.out.println("\nThe result is :" + result); +- while ((!result.equals("Finished")) && (index < 0)) { +- try { +- Thread.sleep(500); +- result = serviceProvider.getFinalStatus(); +- System.out.println("\nCURRENT Status = " + result); +- time += 500; +- System.out.println("\nThe result is :" + result); +- if (result != null) { +- index = result.indexOf("Failed"); +- } +- +- } catch (Exception e) { +- logger.info("Exception sleeping."); +- } +- } +- if (result.equals("Finished")) { +- saveQueue.get(); +- } else if (!((result.indexOf("Permission denied") > 0) || (result.indexOf("File exists") > 0)) && active) { +- +- String msg = "One of the jobs failed: " + +- result + "\nDo you wish to continue with" + +- " other jobs ?"; +- Object options[] = {"Yes", "No"}; +- int k = JOptionPane.showOptionDialog(theApp, +- msg, "Directory Transfer Alert", -1, +- JOptionPane.INFORMATION_MESSAGE, null, options, +- options[0]); +- if (k == 1) { +- setControl(false); +- previousTransfer = true; +- } else { +- saveQueue.get(); +- } +- } +- } +- +- } +- active = false; +- } +-} +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/FileRequest.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/FileRequest.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/FileRequest.java (working copy) +@@ -1,127 +0,0 @@ +-package org.globus.ogce.beans.filetransfer.transfer; +- +- +-import org.apache.log4j.Logger; +-import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; +-import org.globus.ogce.beans.filetransfer.gui.monitor.MonitorPanel; +-import org.globus.ogce.beans.filetransfer.gui.monitor.RequestPanel; +-import org.globus.ogce.beans.filetransfer.util.GridBrokerQueue; +- +-public class FileRequest extends Thread { +- private static Logger logger = +- Logger.getLogger(FileRequest.class.getName()); +- +- private GridBrokerQueue requestQueue = null; +- boolean active = false; +- boolean start = true; +- int dirJobID = 0; +- private RequestPanel requestPanel = null; +- DirTransferRequest request = null; +- private MonitorPanel monitorFrame = null; +- +- public FileRequest(GridBrokerQueue requestQueue, MonitorPanel monitorFrame) { +- super("FileRequest"); +- this.requestQueue = requestQueue; +- this.monitorFrame = monitorFrame; +- requestPanel = monitorFrame.getRequestPanel(); +- } +- +- public FileRequest() { +- this(null, null); +- } +- +- public void setControl(boolean start) { +- this.start = start; +- if (start) { +- run(); +- } +- } +- +- public void clearRequestQueue() { +- requestQueue.deleteAll(); +- dirJobID = 0; +- } +- +- public void updateQueue(DirTransferRequest request) { +- +- dirJobID++; +- DirRequestJob job = new DirRequestJob(dirJobID + "", request); +- setControl(false); +- requestQueue.put(job); +- +- requestPanel.addTransfer(dirJobID + "", request.getFrom(), request.getTo()); +- //monitorFrame.setFocusTab(2); +- setControl(true); +- } +- +- public void run() { +- if (active) { +- return; +- } +- +- logger.info("\n In the transfer method." + +- "\nQueue size =" + requestQueue.size()); +- +- DirRequestJob job = null; +- String jobid = null; +- if (requestQueue.size() > 0) { +- while ((requestQueue.size() > 0) && (start)) { +- active = true; +- job = (DirRequestJob) requestQueue.get(); +- jobid = job.getJobID(); +- request = job.getDirTransferRequest(); +- requestPanel.setCurrentRequestObject(request); +- requestPanel.updateTransfer(jobid, "Active", "N/A", "No Errors"); +- if (request != null) { +- request.run(); +- } else { +- logger.info("The object from the queue was null"); +- } +- String result = "N/A"; +- String errors = "N/A"; +- while (!(result.equals("Finished") +- || result.equals("Failed") +- || result.equals("Suspended"))) { +- System.out.println("result:" + result); +- try { +- Thread.sleep(1000); +- result = request.getStatus(); +- logger.info("Result is :" + result); +- if (result.equals("Failed")) { +- errors = "Thread killed"; +- } +- requestPanel.updateTransfer(jobid, result, +- request.getTotalFiles(), +- errors); +- } catch (Exception e) { +- e.printStackTrace(); +- } +- } +- requestPanel.updateTransfer(jobid, result, +- request.getTotalFiles(), +- errors); +- } +- active = false; +- } +- } +-} +- +-class DirRequestJob { +- private String jobID = null; +- private DirTransferRequest dirRequest = null; +- +- public DirRequestJob(String jobID, DirTransferRequest dirRequest) { +- this.jobID = jobID; +- this.dirRequest = dirRequest; +- } +- +- public String getJobID() { +- return jobID; +- } +- +- public DirTransferRequest getDirTransferRequest() { +- return dirRequest; +- } +-} +- +- +Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/DirTransferRequest.java +=================================================================== +--- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/DirTransferRequest.java (revision 3296) ++++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/DirTransferRequest.java (working copy) +@@ -1,402 +0,0 @@ +-package org.globus.ogce.beans.filetransfer.transfer; +- +-import org.apache.log4j.Logger; +-import org.globus.ftp.FileInfo; +-import org.globus.ftp.MlsxEntry; +-import org.globus.ogce.beans.filetransfer.gui.MainInterface; +-import org.globus.ogce.beans.filetransfer.gui.local.LocalTreePanel; +-import org.globus.ogce.beans.filetransfer.gui.remote.common.DisplayInterface; +-import org.globus.ogce.beans.filetransfer.util.FileToTransfer; +-import org.globus.ogce.beans.filetransfer.util.GridBrokerQueue; +- +-import javax.swing.*; +-import java.io.File; +-import java.util.Enumeration; +-import java.util.Vector; +- +-public class DirTransferRequest { +- +- private static Logger logger = +- Logger.getLogger(DirTransferRequest.class.getName()); +- +- LocalTreePanel toLocal = null, fromLocal = null; +- DisplayInterface toRemote = null, fromRemote = null; +- String to = "",from = ""; +- +- String fromFileSep = "", toFileSep = ""; +- boolean dragLocal = true; +- DisplayInterface display = null; +- boolean dropLocal = false; +- private MainInterface theApp = null; +- int submitCount = 0; +- String rootfrom = null,rootto = null; +- GridBrokerQueue requestQueue = null; +- String provider = null; +- int noOfFiles = 0; +- String fromFullURL = null; +- String toFullURL = null; +- boolean start = true; +- Thread newThread = null; +- String status = null; +- Vector dirVector = null; +- +- public DirTransferRequest(MainInterface theApp, +- LocalTreePanel fromLocal, +- LocalTreePanel toLocal, +- DisplayInterface fromRemote, +- DisplayInterface toRemote, +- String from, String to, +- boolean dragLocal, boolean dropLocal, +- String provider) { +- this.toLocal = toLocal; +- this.fromLocal = fromLocal; +- this.toRemote = toRemote; +- this.fromRemote = fromRemote; +- this.to = to; +- this.from = from; +- this.dragLocal = dragLocal; +- this.dropLocal = dropLocal; +- this.theApp = theApp; +- this.provider = provider; +- requestQueue = new GridBrokerQueue(); +- dirVector = new Vector(); +- } +- +- public void suspend() { +- status = "Suspended"; +- start = false; +- newThread.suspend(); +- } +- +- public void resume() { +- start = true; +- status = "Resumed"; +- newThread.resume(); +- // theApp.startActualTransfer(requestQueue,provider); +- } +- +- public void kill() { +- +- requestQueue.deleteAll(); +- // suspend(); +- status = "Failed"; +- newThread.stop(); +- newThread = null; +- +- } +- +- public String getTotalFiles() { +- return noOfFiles + ""; +- } +- +- public String getFrom() { +- if (dragLocal) { +- fromFullURL = "file:///"; +- } else { +- fromFullURL = fromRemote.getRootURL(); +- } +- fromFullURL += from; +- return fromFullURL; +- } +- +- public String getTo() { +- if (dropLocal) { +- toFullURL = "file:///"; +- } else { +- toFullURL = toRemote.getRootURL(); +- } +- toFullURL += to; +- return toFullURL; +- } +- +- public void run() { +- newThread = new Thread() { +- public void run() { +- putRequest(); +- } +- }; +- newThread.start(); +- } +- +- +- public void putRequest() { +- +- status = "Active"; +- if (dropLocal) { +- rootto = "file:///"; +- toFileSep = toLocal.LclFile_Sep; +- } else { +- rootto = toRemote.getRootURL(); +- toFileSep = "/"; +- } +- boolean isDir = false; +- File dir = null; +- if (dragLocal) { +- rootfrom = "file:///"; +- dir = new File(from); +- isDir = dir.isDirectory(); +- fromFileSep = fromLocal.LclFile_Sep; +- } else { +- rootfrom = fromRemote.getRootURL(); +- isDir = fromRemote.chdir(from); +- fromFileSep = "/"; +- } +- +- if (isDir) { +- String fromCopy = from; +- if (from.endsWith(fromFileSep)) { +- from = from.substring(0, from.length() - 1); +- } +- int index = from.lastIndexOf(fromFileSep); +- String firstDir = from.substring(index + 1); +- logger.info("This is a directory"); +- firstDir.replace(fromFileSep.charAt(0), toFileSep.charAt(0)); +- String fromSource = getFrom(); +- String toDest = getTo() + firstDir; +- +- if (!toDest.startsWith("file")) { +- toDest = toDest.replaceAll("///", "//"); +- } +- +- logger.info("From :" + fromSource + "To: " + toDest); +- if (fromSource.equals(toDest)) { +- String alertMsg = "Destination cannot be same as Source."; +- JOptionPane.showMessageDialog(theApp, alertMsg); +- status = "Failed"; +- return; +- } +- firstDir = firstDir + fromFileSep; +- logger.info("First Dir:" + firstDir); +- if (dragLocal) { +- if (createDestDir(firstDir, "")) { +- transferLocal(dir, firstDir); +- if (checkVector()) { +- status = "Finished"; +- } else { +- status = "Failed"; +- } +- } else { +- return; +- } +- +- } else { +- if (createDestDir(firstDir, "")) { +- transferRemote(from + fromFileSep, firstDir); +- if (checkVector()) { +- status = "Finished"; +- } else { +- status = "Failed"; +- } +- } else { +- return; +- } +- } +- } else { +- logger.info("This is a file"); +- putFile(from); +- status = "Finished"; +- } +- +- if (start && status.equals("Finished")) { +- theApp.startActualTransfer(requestQueue, provider); +- } +- } +- +- public String getStatus() { +- return status; +- } +- +- public void transferLocal(File fromDir, String startdir) { +- if (!start) { +- return; +- } +- +- File[] files = fromDir.listFiles(); +- logger.info("\nLISTING DIR: " + fromDir); +- +- for (int i = 0; i < files.length; i++) { +- File current = files[i]; +- if (current.isDirectory()) { +- +- if (!createDestDir(current.getName(), startdir)) { +- logger.info("\nDir creation failed =" + current.getName()); +- break; +- } else { +- logger.info("\nDir created successfully =" + current.getName()); +- transferLocal(current, startdir + current.getName() + fromFileSep); +- } +- } else { +- putFile(fromDir.getAbsolutePath() + fromFileSep + current.getName()); +- } +- } +- } +- +- public void putFile(String fromFullPath) { +- noOfFiles++; +- theApp.msgOut("\nCounting number of files :" + noOfFiles); +- String fromSourceURL = rootfrom + fromFullPath; +- int index = from.lastIndexOf(fromFileSep); +- String toFullPath = fromFullPath.substring(index + 1); +- toFullPath = toFullPath.replace(fromFileSep.charAt(0), toFileSep.charAt(0)); +- String toDestinationURL = rootto + to + toFullPath; +- +- String checkFrom = fromSourceURL.replaceAll("//", "/"); +- String checkTo = toDestinationURL.replaceAll("//", "/"); +- checkFrom = checkFrom.replaceAll("//", "/"); +- checkTo = checkTo.replaceAll("//", "/"); +- +- if (checkFrom.equals(checkTo)) { +- String alertMsg = "Destination cannot be same as Source."; +- JOptionPane.showMessageDialog(theApp, alertMsg); +- status = "Failed"; +- return; +- } else { +- FileToTransfer fileToTransfer = new FileToTransfer(fromSourceURL, toDestinationURL, provider); +- +- requestQueue.put(fileToTransfer); +- return; +- } +- +- } +- +- public boolean createDestDir(String newDir, String location) { +- newDir = newDir.replace(fromFileSep.charAt(0), toFileSep.charAt(0)); +- location = location.replace(fromFileSep.charAt(0), toFileSep.charAt(0)); +- String remoteNewDir = null; +- if (location != null) { +- remoteNewDir = to + location + newDir; +- } else { +- remoteNewDir = to + newDir; +- } +- String toCheck = remoteNewDir.replaceAll("//", "/"); +- if (toCheck.endsWith(toFileSep)) { +- toCheck = toCheck.substring(0, toCheck.length() - 1); +- } +- if (toCheck.equals(from)) { +- String alertMsg = "Destination cannot be same as Source."; +- JOptionPane.showMessageDialog(theApp, alertMsg); +- status = "Failed"; +- return false; +- } +- if (remoteNewDir.indexOf(from) >= 0) { +- logger.info("\nStore in hashtable remote dir =" + remoteNewDir + +- "\nFrom : " + from); +- dirVector.add(remoteNewDir); +- return true; +- } else { +- +- logger.info("\nCreating remote dir =" + remoteNewDir + +- "\nAT : " + to + location); +- +- boolean created = createDestDir(remoteNewDir); +- if (created) { +- logger.info("DESTINATION DIRECTORY CREATED"); +- } else { +- logger.info("DESTINATION DIRECTORY not created"); +- } +- return created; +- } +- } +- +- public boolean createDestDir(String remoteNewDir) { +- theApp.msgOut("\nCreating remote dir =" + remoteNewDir); +- if (dropLocal) { +- +- try { +- File newfile = new File(remoteNewDir); +- if (newfile.exists()) { +- return true; +- } +- if (newfile.mkdir()) { +- logger.info("Directory successfully created : " + remoteNewDir); +- +- return true; +- } else { +- String alertMsg = "You do not have permissions to " + +- "to create new directories in the local machine.\n Transfer failed. Please set the permissions and try again."; +- JOptionPane.showMessageDialog(theApp, alertMsg); +- status = "Failed"; +- return false; +- } +- } catch (Exception e) { +- return false; +- } +- } else { +- if (toRemote.mkdir(remoteNewDir)) { +- logger.info("Directory successfully created : " + remoteNewDir); +- return true; +- } else { +- String alertMsg = "You do not have permissions to " + +- "to create new directories at Destination.\n" + +- " Transfer failed. Please set the permissions and try again. "; +- JOptionPane.showMessageDialog(theApp, alertMsg); +- status = "Failed"; +- return false; +- } +- } +- +- } +- +- /** +- * This method was to avoid recursive creation and travesing of +- * directory when a directory is dragged and dropped into a one of its +- * child directories. +- * +- */ +- public boolean checkVector() { +- boolean success = true; +- while (dirVector.size() > 0) { +- String newDir = (String) dirVector.remove(0); +- if (!createDestDir(newDir)) { +- success = false; +- break; +- } +- } +- return success; +- } +- //Here there is no way to get the absolute path. So send the fullpath. +- +- public void transferRemote(String fullpath, String startdir) { +- if (!start) { +- return; +- } +- Vector vector = fromRemote.listTransferDir(fullpath); +- if (vector == null) { +- logger.info("\nThis is an empty directory."); +- } else { +- Enumeration enum1 = vector.elements(); +- while (enum1.hasMoreElements()) { +- MlsxEntry current = (MlsxEntry) enum1.nextElement(); +- if (null != current.getFileName() && +- !"cdir".equals(current.get("type")) && !"pdir".equals(current.get("type"))) { +- //System.out.println(current); +- //it's a soft link +- if (current.get("unix.slink") != null) { +- ; +- } else { +- if ("dir".equals(current.get("type"))) { +-// if ((current.getName().equals("//dev")) || +-// (current.isDevice())) { +-// ; +-// } else { +- if(!".".equals(current.getFileName()) && !"..".equals(current.getFileName())) { +- if (!createDestDir(current.getFileName(), startdir)) { +- break; +- } +- transferRemote(fullpath + current.getFileName() +- + fromFileSep, +- startdir + current.getFileName() +- + fromFileSep); +- } +- +- //} +- +- } else { +- putFile(fullpath + fromFileSep + current.getFileName()); +- } +- } +- } +- } +- } +- } +-} +Index: modules/transfer-gui/src/scripts/gui.bat +=================================================================== +--- modules/transfer-gui/src/scripts/gui.bat (revision 3296) ++++ modules/transfer-gui/src/scripts/gui.bat (working copy) +@@ -1,19 +0,0 @@ +- at echo off +- +-if "%GLOBUS_LOCATION%" == "" goto nogl +-goto run +- +-:nogl +- +- echo Error: GLOBUS_LOCATION not set +- goto end +- +-:run +- +- set _RUNJAVA=java +- if not "%JAVA_HOME%" == "" set _RUNJAVA="%JAVA_HOME%\bin\java" +- %_RUNJAVA% -DGLOBUS_LOCATION="%GLOBUS_LOCATION%" -Daxis.ClientConfigFile="%GLOBUS_LOCATION%"\client-config.wsdd -jar gui.jar +- +-:end +- +- +\ No newline at end of file +Index: modules/transfer-gui/src/scripts/gui.sh +=================================================================== +--- modules/transfer-gui/src/scripts/gui.sh (revision 3296) ++++ modules/transfer-gui/src/scripts/gui.sh (working copy) +@@ -1,14 +0,0 @@ +-# !/bin/sh +- +-if [ ! -d "$GLOBUS_LOCATION" ] then +- echo "Error: GLOBUS_LOCATION invalid or not set: $GLOBUS_LOCATION" 1>&2 +- exit 1 +-fi +- +-if [ "X$JAVA_HOME" = "X" ] then +- _RUNJAVA=java +-else +- _RUNJAVA="$JAVA_HOME"/bin/java +-fi +- +-exec $_RUNJAVA -Daxis.ClientConfigFile="$GLOBUS_LOCATION"\client-config.wsdd -jar gui.jar +\ No newline at end of file +Index: modules/transfer-gui/src/scripts/build.xml +=================================================================== +--- modules/transfer-gui/src/scripts/build.xml (revision 3296) ++++ modules/transfer-gui/src/scripts/build.xml (working copy) +@@ -1,62 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +\ No newline at end of file +Index: modules/transfer-gui/docs/todo.txt +=================================================================== +--- modules/transfer-gui/docs/todo.txt (revision 3296) ++++ modules/transfer-gui/docs/todo.txt (working copy) +@@ -1,9 +0,0 @@ +-Todo list: +-1. The GUI is based on OGCE now, we need to transfer it to Cog4 first. This task involves some interface changes. +-2. merge "Generate Credential" button and "Myproxy" button into one "authentication" button. When users click it, a dialog will popup and +- provide two options for users: +- 1) generate a proxy from local certificate; +- 2) get a short-term proxy from a Myproxy server; +- Some explanation text will help users to make a decision and prevent confusion. +-3. Add a "Advanced options" button to replace "RFT" button. Clicking that button will also popup a dialog to set RFT service address, port, +- parallel streams, TCP buffer, concurrency and whether reliable transfer is enforced or not. +\ No newline at end of file +Index: modules/transfer-gui/docs/Notes +=================================================================== +--- modules/transfer-gui/docs/Notes (revision 3296) ++++ modules/transfer-gui/docs/Notes (working copy) +@@ -1,3 +0,0 @@ +-www.globus.org +-/www/www-unix.globus.org/cog/demo/ogce +-DOE service credential:http://www.doegrids.org/pages/ModelCertificateDeployment.html +\ No newline at end of file +Index: modules/transfer-gui/docs/User Guide for GridFTP and RFT GUI.doc +=================================================================== +Cannot display: file marked as a binary type. +svn:mime-type = application/octet-stream +Index: modules/transfer-gui/etc/MANIFEST.MF.tail +=================================================================== +--- modules/transfer-gui/etc/MANIFEST.MF.tail (revision 3296) ++++ modules/transfer-gui/etc/MANIFEST.MF.tail (working copy) +@@ -1 +0,0 @@ +- +Index: modules/transfer-gui/etc/MANIFEST.MF.head +=================================================================== +--- modules/transfer-gui/etc/MANIFEST.MF.head (revision 3296) ++++ modules/transfer-gui/etc/MANIFEST.MF.head (working copy) +@@ -1 +0,0 @@ +-Manifest-Version: 1.0 +Index: modules/transfer-gui/etc/log4j.properties.module +=================================================================== +--- modules/transfer-gui/etc/log4j.properties.module (revision 3296) ++++ modules/transfer-gui/etc/log4j.properties.module (working copy) +@@ -1 +0,0 @@ +-log4j.logger.org.globus.cog.example=INFO +Index: modules/transfer-gui/build.xml +=================================================================== +--- modules/transfer-gui/build.xml (revision 3296) ++++ modules/transfer-gui/build.xml (working copy) +@@ -1,168 +0,0 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- Available targets: +- help: +- prints out this help message +- +- dist: +- creates a distribution directory of the +- ${project} ${long.name} +- +- jar: +- creates a jar file for the ${project} ${long.name} +- named ${jar.filename} +- +- javadoc: +- creates the documentation +- +- clean: +- removes the compiled classes +- +- distclean: +- deletes the distribution directory +- +- all: +- dist and javadoc +- +- deploy.webstart: +- deploys the module as a webstart application +- +- dist.joint: +- builds everything into one jar file. Should only +- be used globally (from all) +- +- fixeol: +- change newlines to the unix standard +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- Modified: SwiftApps/SwiftR/Swift/tests/OpenMx/BootstrapParallelBigger.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/OpenMx/BootstrapParallelBigger.R 2011-10-18 18:37:00 UTC (rev 5242) +++ SwiftApps/SwiftR/Swift/tests/OpenMx/BootstrapParallelBigger.R 2011-10-18 21:17:57 UTC (rev 5243) @@ -194,7 +194,7 @@ # An example test suite which runs on a ssh cluster # on multiple cores of a machine and in vanilla R -sampleTestSuite <- makeTestSuite( +sampleTestSuite <- Swift:::makeTestSuite( groups=list( # 16 cores makeBootstrapTestGroup(mode="swift", server="ssh", cores=2, Modified: SwiftApps/SwiftR/Swift/tests/OpenMx/RAM-3Factor-96Indicators-covdata-a.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/OpenMx/RAM-3Factor-96Indicators-covdata-a.R 2011-10-18 18:37:00 UTC (rev 5242) +++ SwiftApps/SwiftR/Swift/tests/OpenMx/RAM-3Factor-96Indicators-covdata-a.R 2011-10-18 21:17:57 UTC (rev 5243) @@ -147,7 +147,7 @@ return (threeFactorCI at output) } -sampleTestSuite <- makeTestSuite( +sampleTestSuite <- Swift:::makeTestSuite( groups=list(makeCITestGroup(mode="swift", argsList=list(defaultArgs), server="local", cores=4 ))) Modified: SwiftApps/SwiftR/Swift/tests/perf/param_size.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/perf/param_size.R 2011-10-18 18:37:00 UTC (rev 5242) +++ SwiftApps/SwiftR/Swift/tests/perf/param_size.R 2011-10-18 21:17:57 UTC (rev 5243) @@ -22,7 +22,7 @@ return(args) } -ts <- makeTestSuite(groups=list( +ts <- Swift:::makeTestSuite(groups=list( makePerfTestGroup(mode="swift", name="ArgSize", f=test, prep=makeArray, allargs=param.bytes, @@ -32,9 +32,9 @@ allargs=param.bytes, server="ssh", cores=1, hosts="nettle wapato dandelion cattail") )) -res <- runTestSuite(ts) +res <- Swift:::runTestSuite(ts) -anl <- mergeGroupResults(analyseSuitePerf(res, +anl <- mergeGroupResults(Swift:::analyseSuitePerf(res, argnames=c("procs", "arr.bytes"), perfparams=c('server'))) Modified: SwiftApps/SwiftR/Swift/tests/perf_tests.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/perf_tests.R 2011-10-18 18:37:00 UTC (rev 5242) +++ SwiftApps/SwiftR/Swift/tests/perf_tests.R 2011-10-18 21:17:57 UTC (rev 5243) @@ -73,7 +73,7 @@ lapply(params, deparse), sep="", collapse=", ") if (mode == "swift") { - tg <- makeParamTestGroup(name=paste("swift_",name, " ", paramstr,sep=""), + tg <- Swift:::makeParamTestGroup(name=paste("swift_",name, " ", paramstr,sep=""), f=f, prep=prep, allargs=allargs, perfparams = params, @@ -81,7 +81,7 @@ teardown = swiftTearDown) } else if (mode == "snowfall") { - tg <- makeParamTestGroup(name=paste("sf_",name, paramstr, sep=""), + tg <- Swift:::makeParamTestGroup(name=paste("sf_",name, paramstr, sep=""), f=f,prep=prep, allargs=allargs, perfparams = params, @@ -91,7 +91,7 @@ } else { print("Making serial test") - tg <- makeParamTestGroup(name=paste("serial_",name, paramstr, sep=""), + tg <- Swift:::makeParamTestGroup(name=paste("serial_",name, paramstr, sep=""), f=f,prep=prep, allargs=allargs, perfparams = list(), Modified: SwiftApps/SwiftR/Swift/tests/runtests.R =================================================================== --- SwiftApps/SwiftR/Swift/tests/runtests.R 2011-10-18 18:37:00 UTC (rev 5242) +++ SwiftApps/SwiftR/Swift/tests/runtests.R 2011-10-18 21:17:57 UTC (rev 5243) @@ -2,4 +2,4 @@ library(Swift) #TODO: take command line options to setup options -runAllSwiftTests() +Swift:::runAllSwiftTests() From tga at ci.uchicago.edu Tue Oct 18 21:41:32 2011 From: tga at ci.uchicago.edu (tga at ci.uchicago.edu) Date: Wed, 19 Oct 2011 02:41:32 -0000 Subject: [Swift-commit] r5244 - in SwiftApps/SwiftR: . Swift Swift/R Swift/man Swift/src/swift-patches Message-ID: <20111019024104.D30C79CC97@svn.ci.uchicago.edu> Author: tga Date: 2011-10-18 21:41:04 -0500 (Tue, 18 Oct 2011) New Revision: 5244 Added: SwiftApps/SwiftR/Swift/man/getNodeList.Rd SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch.deleted Modified: SwiftApps/SwiftR/Swift/DESCRIPTION SwiftApps/SwiftR/Swift/R/Init.R SwiftApps/SwiftR/Swift/man/swiftInit.Rd SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch SwiftApps/SwiftR/checkout-swift.sh Log: Fixes for CRAN package Modified: SwiftApps/SwiftR/Swift/DESCRIPTION =================================================================== --- SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-18 21:17:57 UTC (rev 5243) +++ SwiftApps/SwiftR/Swift/DESCRIPTION 2011-10-19 02:41:04 UTC (rev 5244) @@ -1,12 +1,12 @@ Package: Swift Type: Package Title: R interface to Swift parallel scripting languaage -Version: 0.3.1 -Date: 2011-10-12 +Version: 0.3.2 +Date: 2011-10-18 Author: Michael Wilde Maintainer: Michael Wilde Description: Routines to invoke R functions on remote resources through Swift. License: Apache License LazyLoad: yes -Packaged: 2011-10-12; Tim Armstrong +Packaged: 2011-10-18; Tim Armstrong Modified: SwiftApps/SwiftR/Swift/R/Init.R =================================================================== --- SwiftApps/SwiftR/Swift/R/Init.R 2011-10-18 21:17:57 UTC (rev 5243) +++ SwiftApps/SwiftR/Swift/R/Init.R 2011-10-19 02:41:04 UTC (rev 5244) @@ -1,11 +1,11 @@ # This file contains functions involved in starting up and shutting down # SwiftR -.onLoad <- function (libname, packagename) { +.onLoad <- function (lib, pkg) { detectSystemInfo() } -.First.lib <- function(libname, packagename) { +.First.lib <- function(lib, pkg) { # When the library is loaded, set up the # list of workers .swift.workers <<- list() Added: SwiftApps/SwiftR/Swift/man/getNodeList.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/getNodeList.Rd (rev 0) +++ SwiftApps/SwiftR/Swift/man/getNodeList.Rd 2011-10-19 02:41:04 UTC (rev 5244) @@ -0,0 +1,34 @@ +\name{getNodeList} +\alias{getNodeList} +\title{ +Retrieve the names of all nodes for cluster batch job +} +\description{ +When R is running in the context of a pbs, sge or cobalt batch job, +finds the list of hosts assigned to the job. +} +\usage{ +getNodeList(server = getOption("swift.server")) +} +\arguments{ + \item{server}{ Optional. If set to "pbs", "pbsf", "sge" or "cobalt" - + corresponding to values of the server argument of \code{swiftInit} - + then it will only try to get the node list via the appropriate + mechanism for that batch scheduler. + + If unset, the value is obtained from the swift.server option. + + If the argument value cannot be obtained directly or via options, + then it will try to find the node list using any of the above batch + schedulers. +} +} +\value{ +This function will return a data frame where the first column +is the unique host name for the cluster node, and the second +column is the number of processes assigned to run on that node. +} + +\seealso{ +\code{\link{swiftInit}} +} Modified: SwiftApps/SwiftR/Swift/man/swiftInit.Rd =================================================================== --- SwiftApps/SwiftR/Swift/man/swiftInit.Rd 2011-10-18 21:17:57 UTC (rev 5243) +++ SwiftApps/SwiftR/Swift/man/swiftInit.Rd 2011-10-19 02:41:04 UTC (rev 5244) @@ -30,7 +30,7 @@ How Swift will run the jobs: for example, if "local" is chosen, they will be run on the local machine, or if "pbs" is chosen, they will be run through the pbs scheduler. - This must correspond to a server type started by swiftInit() + This must correspond to a server type started by \code{swiftInit()} If server argument is not provided, the swift.server option will be used, and if that is unavailable, "local" will be assumed. } Modified: SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch =================================================================== --- SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch 2011-10-18 21:17:57 UTC (rev 5243) +++ SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch 2011-10-19 02:41:04 UTC (rev 5244) @@ -1,6 +1,6 @@ Index: modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java =================================================================== ---- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java (revision 3296) +--- modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java (revision 3145) +++ modules/provider-coaster/src/org/globus/cog/abstraction/coaster/service/CoasterService.java (working copy) @@ -41,7 +41,7 @@ public static final Logger logger = Logger @@ -11,19545 +11,3 @@ public static final int CONNECT_TIMEOUT = 2 * 60 * 1000; -Index: modules/certmanagement/.classpath -=================================================================== ---- modules/certmanagement/.classpath (revision 3296) -+++ modules/certmanagement/.classpath (working copy) -@@ -1,11 +0,0 @@ -- -- -- -- -- -- -- -- -- -- -- -Index: modules/certmanagement/project.properties -=================================================================== ---- modules/certmanagement/project.properties (revision 3296) -+++ modules/certmanagement/project.properties (working copy) -@@ -1,6 +0,0 @@ --module.name = certmanagement --long.name = Certificate Management Applications --version = 1.0 --project = Java CoG Kit --lib.deps = mail.*,activation.* -- -Index: modules/certmanagement/launchers.xml -=================================================================== ---- modules/certmanagement/launchers.xml (revision 3296) -+++ modules/certmanagement/launchers.xml (working copy) -@@ -1,86 +0,0 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -Index: modules/certmanagement/.project -=================================================================== ---- modules/certmanagement/.project (revision 3296) -+++ modules/certmanagement/.project (working copy) -@@ -1,18 +0,0 @@ -- -- -- certmanagement -- -- -- jglobus -- -- -- -- org.eclipse.jdt.core.javabuilder -- -- -- -- -- -- org.eclipse.jdt.core.javanature -- -- -Index: modules/certmanagement/dependencies.xml -=================================================================== ---- modules/certmanagement/dependencies.xml (revision 3296) -+++ modules/certmanagement/dependencies.xml (working copy) -@@ -1,8 +0,0 @@ -- -- -- -- -- -- -- -- -Index: modules/certmanagement/lib/activation.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/lib/mail.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/meta/description.txt -=================================================================== ---- modules/certmanagement/meta/description.txt (revision 3296) -+++ modules/certmanagement/meta/description.txt (working copy) -@@ -1,8 +0,0 @@ --The certmanagement module contains a collection of certificate management --applications and was contributed by: -- --Jean-Claude Cote --High Performance Computing / Calcul de haute performance --National Research Council Canada / Conseil national de recherches Canada --www.grid.nrc.ca -- -Index: modules/certmanagement/meta/certreq/screenshot.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/meta/certdestroy/screenshot.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/meta/myproxy/screenshot.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/meta/certinfo/screenshot.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/meta/certrenew/screenshot.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/src/org/globus/cog/security/cert/request/BouncyCastleOpenSSLKey.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/request/BouncyCastleOpenSSLKey.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/request/BouncyCastleOpenSSLKey.java (working copy) -@@ -1,130 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --package org.globus.cog.security.cert.request; -- --import java.io.IOException; --import java.io.InputStream; --import java.io.ByteArrayInputStream; --import java.security.InvalidKeyException; --import java.security.GeneralSecurityException; --import java.security.PrivateKey; --import java.security.KeyFactory; --import java.security.interfaces.RSAPrivateCrtKey; --import java.security.spec.PKCS8EncodedKeySpec; -- -- --import org.bouncycastle.asn1.pkcs.RSAPrivateKeyStructure; --import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; --import org.bouncycastle.asn1.DERObject; --import org.bouncycastle.asn1.DERObjectIdentifier; --import org.bouncycastle.asn1.DERInputStream; --import org.bouncycastle.asn1.DERConstructedSequence; --import org.bouncycastle.asn1.x509.AlgorithmIdentifier; --import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; --import org.globus.gsi.bc.BouncyCastleUtil; -- --/** -- * BouncyCastle-based implementation of OpenSSLKey. -- */ --public class BouncyCastleOpenSSLKey extends OpenSSLKey { -- -- public BouncyCastleOpenSSLKey(InputStream is) -- throws IOException, GeneralSecurityException { -- super(is); -- } -- -- public BouncyCastleOpenSSLKey(String file) -- throws IOException, GeneralSecurityException { -- super(file); -- } -- -- public BouncyCastleOpenSSLKey(PrivateKey key) { -- super(key); -- } -- -- public BouncyCastleOpenSSLKey(String algorithm, byte [] data) -- throws GeneralSecurityException { -- super(algorithm, data); -- } -- -- protected PrivateKey getKey(String alg, byte [] data) -- throws GeneralSecurityException { -- if (alg.equals("RSA")) { -- try { -- ByteArrayInputStream bis = new ByteArrayInputStream(data); -- DERInputStream derin = new DERInputStream(bis); -- DERObject keyInfo = derin.readObject(); -- -- DERObjectIdentifier rsa_oid = PKCSObjectIdentifiers.rsaEncryption; -- AlgorithmIdentifier rsa = new AlgorithmIdentifier(rsa_oid); -- PrivateKeyInfo pkeyinfo = new PrivateKeyInfo(rsa, keyInfo); -- DERObject derkey = pkeyinfo.getDERObject(); -- -- byte[] keyData = BouncyCastleUtil.toByteArray(derkey); -- -- // The DER object needs to be mangled to -- // create a proper ProvateKeyInfo object -- PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyData); -- KeyFactory kfac = KeyFactory.getInstance("RSA"); -- -- return kfac.generatePrivate(spec); -- } catch (IOException e) { -- // that should never happen -- return null; -- } -- -- } else { -- return null; -- } -- } -- -- protected byte[] getEncoded(PrivateKey key) { -- String format = key.getFormat(); -- if (format != null && -- (format.equalsIgnoreCase("PKCS#8") || -- format.equalsIgnoreCase("PKCS8"))) { -- try { -- DERObject keyInfo = BouncyCastleUtil.toDERObject(key.getEncoded()); -- PrivateKeyInfo pkey = new PrivateKeyInfo((DERConstructedSequence)keyInfo); -- DERObject derKey = pkey.getPrivateKey(); -- return BouncyCastleUtil.toByteArray(derKey); -- } catch (IOException e) { -- // that should never happen -- e.printStackTrace(); -- return null; -- } -- } else if (format != null && -- format.equalsIgnoreCase("PKCS#1") && -- key instanceof RSAPrivateCrtKey) { // this condition will rarely be true -- RSAPrivateCrtKey pKey = (RSAPrivateCrtKey)key; -- RSAPrivateKeyStructure st = -- new RSAPrivateKeyStructure(pKey.getModulus(), -- pKey.getPublicExponent(), -- pKey.getPrivateExponent(), -- pKey.getPrimeP(), -- pKey.getPrimeQ(), -- pKey.getPrimeExponentP(), -- pKey.getPrimeExponentQ(), -- pKey.getCrtCoefficient()); -- DERObject ob = st.getDERObject(); -- -- try { -- return BouncyCastleUtil.toByteArray(ob); -- } catch (IOException e) { -- // that should never happen -- return null; -- } -- } else { -- return null; -- } -- } -- -- protected String getProvider() { -- return "BC"; -- } --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRenewalRequest.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRenewalRequest.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRenewalRequest.java (working copy) -@@ -1,470 +0,0 @@ --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/** -- * Copyright (c) 2003, National Research Council of Canada -- * All rights reserved. -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy of this -- * software and associated documentation files (the "Software"), to deal in the Software -- * without restriction, including without limitation the rights to use, copy, modify, merge, -- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the -- * Software is furnished to do so, subject to the following conditions: -- * -- * The above copyright notice(s) and this licence appear in all copies of the Software or -- * substantial portions of the Software, and that both the above copyright notice(s) and this -- * license appear in supporting documentation. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE -- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE -- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL -- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE -- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * Except as contained in this notice, the name of a copyright holder shall NOT be used in -- * advertising or otherwise to promote the sale, use or other dealings in this Software -- * without specific prior written authorization. Title to copyright in this software and any -- * associated documentation will at all times remain with copyright holders. -- */ -- --package org.globus.cog.security.cert.request; -- --import java.io.ByteArrayOutputStream; --import java.io.File; --import java.io.FileInputStream; --import java.io.FileOutputStream; --import java.io.IOException; --import java.io.PrintStream; --import java.security.GeneralSecurityException; --import java.security.MessageDigest; --import java.security.PrivateKey; --import java.security.cert.X509Certificate; -- --import org.bouncycastle.asn1.DERConstructedSet; --import org.bouncycastle.asn1.x509.X509Name; --import org.bouncycastle.jce.PKCS10CertificationRequest; --import org.bouncycastle.util.encoders.Base64; --import org.globus.common.CoGProperties; --import org.globus.gsi.CertUtil; --import org.globus.gsi.GSIConstants; --import org.globus.gsi.GlobusCredential; --import org.globus.gsi.OpenSSLKey; --import org.globus.gsi.bc.BouncyCastleCertProcessingFactory; --import org.globus.gsi.bc.BouncyCastleOpenSSLKey; --import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; --import org.globus.util.PEMUtils; --import org.globus.util.Util; --import org.ietf.jgss.GSSCredential; -- --import cryptix.util.core.Hex; -- -- --/** -- * GridCertRenewalRequest Command Line Client -- * @author Jean-Claude Cote -- */ --public class GridCertRenewalRequest { -- -- public static final String usage = -- "\n" -- + "\ngrid-cert-request [-help] [ options ...]" -- + "\n-help" -- + "\n-usage " -- + "\nDisplays usage. " -- + "\n" -- + "\n-version " -- + "\nDisplays version. " -- + "\n" -- + "\n-debug " -- + "\nDisplays extra information (if problems occur). " -- + "\n" -- + "\n-nopassphrase " -- + "\nSignals that the new key will not be protected by a passphrase. " -- + "\n" -- + "\n-oldcert file " -- + "\nLocation of the certificate that is about to expire. If not set, $HOME/.globus/usercert.pem " -- + "\n" -- + "\n-oldkey file " -- + "\nLocation of the private key to the certificate that is about to expire. If not set, $HOME/.globus/userkey.pem" -- + "\n" -- + "\n-newkey file " -- + "\nLocation of the replacement key that is generated by grid-cert-renew. If not set, $HOME/.globus/userkey_new.pem is assumed. " -- + "\n" -- + "\n-newcertreq file " -- + "\nLocation of the certificate renewal request. If not set, $HOME/.globus/usercert_renew_request.pem is assumed. " -- + "\n" -- + "\n-force" -- + "\nReplaces any existing renewal request" -- + "\n" -- + "\nchallenge " -- + "\nChallenge text string, as instructed in the CA renewal notification message. This is the only required argument. " -- + "\n"; -- -- private static GlobusGSSCredentialImpl cred = null; -- private static String chalenge = ""; -- private static String newPrivKeyLoc = ""; -- private static String userCertRenewFile =""; -- private static String oldPassword = ""; -- private static boolean noPswd = false; -- private static String userCertFile = ""; -- private static String userKeyFile = ""; -- private static boolean force = false; -- private static String version = "1.0"; -- private static boolean verbose = false; -- -- public static void main(String[] args) { -- boolean bOk = parseCmdLine(args); -- -- if (bOk) { -- -- CertUtil.init(); -- -- // Get default location of cert. -- CoGProperties props = CoGProperties.getDefault(); -- -- // If cert file loc not specified use default. -- if (userCertFile.length() == 0){ -- userCertFile = props.getUserCertFile(); -- } -- // If key file loc not specified use default. -- if (userKeyFile.length() == 0){ -- userKeyFile = props.getUserKeyFile(); -- } -- -- // If renwal cert loc not specified -- if (userCertRenewFile.length() == 0){ -- userCertRenewFile = props.getUserCertFile().substring(0, props.getUserCertFile().length() - 4) + "_renew_request.pem"; -- } -- -- // If new key loc not specified -- if (newPrivKeyLoc.length() == 0){ -- newPrivKeyLoc = props.getUserKeyFile().substring(0, props.getUserKeyFile().length() - 4) + "_new.pem"; -- } -- -- // Check not to overwrite any of these files. -- if (force == false) { -- boolean bFileExists = false; -- File f = new File(userCertRenewFile); -- if (f.exists()) { -- System.out.println(userCertRenewFile + " exists"); -- bFileExists = true; -- } -- f = new File(newPrivKeyLoc); -- if (f.exists()) { -- System.out.println(newPrivKeyLoc + " exists"); -- bFileExists = true; -- } -- -- if (bFileExists) { -- System.out.println( -- "If you wish to overwrite, run the script again with -force."); -- bOk = false; -- } -- } -- } -- -- GlobusGSSCredentialImpl cred = null; -- if (bOk){ -- // Get password from user. -- String oldPassword = Util.getInput("Enter private key pass phrase: "); -- -- // Generate a proxy, and keypair from current cert and key -- int credLifetimeSeconds = 300; // life time of proxy 5 min. -- cred = createNewProxy(oldPassword, credLifetimeSeconds, 1024); -- if (cred == null){ -- bOk = false; -- } -- } -- -- String newPrivateKeyPassword = ""; -- if (bOk && !noPswd) { -- // Get password from user. -- bOk = false; -- int attempts = 0; -- -- while (bOk == false && attempts < 3) { -- newPrivateKeyPassword = Util.getInput("Enter new private key pass phrase: "); -- String password2 = -- Util.getInput("Verify password enter new private key pass phrase: "); -- if (newPrivateKeyPassword.compareTo(password2) != 0) { -- System.out.println("Verify failure"); -- } else { -- if (newPrivateKeyPassword.length() < 4) { -- System.out.println( -- "phrase is too short, needs to be at least 4 chars"); -- } else { -- bOk = true; -- } -- } -- attempts++; -- } -- } -- -- if (bOk){ -- try { -- genRenewRequest( cred, newPrivateKeyPassword, chalenge, newPrivKeyLoc, userCertRenewFile); -- } -- catch (GeneralSecurityException e) { -- e.printStackTrace(); -- bOk = false; -- } -- catch (IOException e) { -- e.printStackTrace(); -- bOk = false; -- } -- } -- } -- -- protected static boolean parseCmdLine(String[] args) { -- boolean bOk = true; -- if (args.length == 0) { -- System.out.println(usage); -- bOk = false; -- } else { -- for (int i = 0; i < args.length && bOk; i++) { -- if (args[i].equalsIgnoreCase("-version")) { -- System.out.println(version); -- } else if ( -- args[i].equalsIgnoreCase("-help") -- || args[i].equalsIgnoreCase("-h") -- || args[i].equalsIgnoreCase("-?")) { -- System.out.println(usage); -- bOk = false; -- } else if ( -- args[i].equalsIgnoreCase("-nopw") -- || args[i].equalsIgnoreCase("-nodes") -- || args[i].equalsIgnoreCase("-nopassphrase")) { -- // no password -- noPswd = true; -- } else if (args[i].equalsIgnoreCase("-verbose")) { -- verbose = true; -- } -- else if (args[i].equalsIgnoreCase("-oldcert")){ -- userCertFile = args[++i]; -- } -- else if (args[i].equalsIgnoreCase("-oldkey")){ -- userKeyFile = args[++i]; -- } -- else if (args[i].equalsIgnoreCase("-newkey")){ -- newPrivKeyLoc = args[++i]; -- } -- else if (args[i].equalsIgnoreCase("-newcertreq")){ -- userCertRenewFile = args[++i]; -- } -- else if (args[i].equalsIgnoreCase("-force")) { -- // overwrite existing credentials -- force = true; -- } else { -- // if last arg -- if (i == args.length - 1){ -- chalenge = args[i]; -- } -- else{ -- System.out.println( -- "Error: argument #" -- + i -- + "(" -- + args[i] -- + ") : unknown"); -- } -- } -- } -- } -- return bOk; -- } -- -- protected static GlobusGSSCredentialImpl createNewProxy(String keyPassword, int lifetime, int bits) { -- -- X509Certificate userCert = null; -- PrivateKey userKey = null; -- CertUtil.init(); -- -- try { -- OpenSSLKey key = new BouncyCastleOpenSSLKey(userKeyFile); -- -- if (key.isEncrypted()) { -- key.decrypt(keyPassword); -- } -- -- userKey = key.getPrivateKey(); -- } catch(IOException e) { -- System.out.println("Error: Failed to load key: " + userKeyFile); -- System.out.println("Make sure you have a valide private key installed."); -- e.printStackTrace(); -- return null; -- } catch(GeneralSecurityException e) { -- System.out.println("Error: Wrong grid pass phrase!"); -- e.printStackTrace(); -- return null; -- } -- -- try { -- userCert = CertUtil.loadCertificate(userCertFile); -- } catch(IOException e) { -- System.out.println("Error: Failed to load cert: " + userCertFile); -- System.out.println("Make sure you have a valide certificate installed."); -- e.printStackTrace(); -- return null; -- } catch(GeneralSecurityException e) { -- System.out.println("Error: Unable to load user certificate: " + -- e.getMessage()); -- e.printStackTrace(); -- return null; -- } -- -- BouncyCastleCertProcessingFactory factory = -- BouncyCastleCertProcessingFactory.getDefault(); -- -- boolean limited = false; -- -- int proxyType = (limited) ? -- GSIConstants.DELEGATION_LIMITED : -- GSIConstants.DELEGATION_FULL; -- -- try { -- GlobusCredential proxy = -- factory.createCredential(new X509Certificate[] {userCert}, -- userKey, -- bits, -- lifetime, -- proxyType); -- -- return new GlobusGSSCredentialImpl(proxy, -- GSSCredential.INITIATE_ONLY); -- -- } catch (Exception e) { -- System.out.println("Failed to create a proxy: " + e.getMessage()); -- e.printStackTrace(); -- return null; -- } -- } -- -- -- /** -- * The renewal request method is based on the Grid Canada's renew.sh script. -- * -- * @param newPrivateKeyPassword -- * @param chalenge -- * @param newPrivKeyLoc -- * @param userCertRenewFile -- * @return -- */ -- public static void genRenewRequest( GlobusGSSCredentialImpl cred, String newPrivateKeyPassword, String chalenge, String newPrivKeyLoc, String userCertRenewFile) throws GeneralSecurityException, IOException { -- -- File fTempDigest = null; -- try { -- // Extract the private key, encrypt it in new passphrase and save it as new user key -- // $OPENSSL rsa -des3 -in $TMPPROXY -out $RENEWALKEY -- OpenSSLKey key = new BouncyCastleOpenSSLKey(cred.getPrivateKey()); -- if (newPrivateKeyPassword.length() != 0) { -- key.encrypt(newPrivateKeyPassword); -- } -- key.writeTo(new File(newPrivKeyLoc).getAbsolutePath()); -- // set read only permissions -- Util.setFilePermissions(newPrivKeyLoc, 600); -- -- // copy proxy cert signed by user -- // $OPENSSL x509 -in $TMPPROXY >> $RENEWALREQ -- PrintStream ps = null; -- X509Certificate cert = null; -- byte[] data = null; -- X509Certificate[] certs = cred.getCertificateChain(); -- cert = certs[0]; -- data = cert.getEncoded(); -- ps = new PrintStream(new FileOutputStream(userCertRenewFile)); -- ////// part 1 ///// -- ps.print(toCertPEM(data)); -- -- // generate a digest which can not be copied -- // $OPENSSL x509 -in $TMPPROXY > $TMPPROXY.d -- // echo X$1 >> $TMPPROXY.d -- // $OPENSSL dgst < $TMPPROXY.d >> $RENEWALREQ -- fTempDigest = File.createTempFile("digest-", ".pem"); -- PrintStream psDigest = new PrintStream(new FileOutputStream(fTempDigest)); -- psDigest.print(toCertPEM(data)); -- psDigest.println("X" + chalenge); -- psDigest.close(); -- -- FileInputStream inDigest = null; -- inDigest = new FileInputStream(fTempDigest); -- int digestSize = inDigest.available(); -- byte[] digestData = new byte[digestSize]; -- inDigest.read(digestData, 0, digestSize); -- MessageDigest md = MessageDigest.getInstance("MD5"); -- int le = md.getDigestLength(); -- byte[] digest = md.digest(digestData); -- /////// part 2 /////// -- ps.println(Hex.toString(digest).toLowerCase()); -- -- // generate a cert req signed by the new key. -- // $OPENSSL x509 -in $TMPPROXY -x509toreq -signkey $RENEWALKEY >> $RENEWALREQ -- // Generate a certificate request. -- X509Name name = new X509Name(cert.getIssuerDN().getName()); -- DERConstructedSet derSet = new DERConstructedSet(); -- PKCS10CertificationRequest request = null; -- request = new PKCS10CertificationRequest("MD5WithRSA", name, cert.getPublicKey(), derSet, key.getPrivateKey()); -- /////// part 3 ///// -- ps.println("Certificate Request:"); -- ps.println(" Data:"); -- ps.print(cert.toString()); -- ps.print(toCertReqPEM(request.getEncoded())); -- ps.close(); -- } -- finally{ -- if(fTempDigest != null){ -- fTempDigest.delete(); -- } -- } -- } -- -- -- -- -- /** -- * Converts to PEM encoding. -- */ -- static private String toCertPEM(byte[] data) { -- byte[] enc_data = Base64.encode(data); -- String header = "-----BEGIN CERTIFICATE-----"; -- ByteArrayOutputStream out = new ByteArrayOutputStream(); -- try { -- PEMUtils.writeBase64( -- out, -- header, -- enc_data, -- "-----END CERTIFICATE-----"); -- } catch (IOException e) { -- } -- return new String(out.toByteArray()); -- } -- -- /** -- * Converts to PEM encoding. -- */ -- static private String toCertReqPEM(byte[] data) { -- byte[] enc_data = Base64.encode(data); -- String header = "-----BEGIN CERTIFICATE REQUEST-----"; -- ByteArrayOutputStream out = new ByteArrayOutputStream(); -- try { -- PEMUtils.writeBase64( -- out, -- header, -- enc_data, -- "-----END CERTIFICATE REQUEST-----"); -- } catch (IOException e) { -- } -- return new String(out.toByteArray()); -- } --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRequest.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRequest.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/request/GridCertRequest.java (working copy) -@@ -1,453 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/** -- * Copyright (c) 2003, National Research Council of Canada -- * All rights reserved. -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy of this -- * software and associated documentation files (the "Software"), to deal in the Software -- * without restriction, including without limitation the rights to use, copy, modify, merge, -- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the -- * Software is furnished to do so, subject to the following conditions: -- * -- * The above copyright notice(s) and this licence appear in all copies of the Software or -- * substantial portions of the Software, and that both the above copyright notice(s) and this -- * license appear in supporting documentation. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE -- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE -- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL -- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE -- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * Except as contained in this notice, the name of a copyright holder shall NOT be used in -- * advertising or otherwise to promote the sale, use or other dealings in this Software -- * without specific prior written authorization. Title to copyright in this software and any -- * associated documentation will at all times remain with copyright holders. -- */ -- -- --package org.globus.cog.security.cert.request; -- --import java.io.ByteArrayOutputStream; --import java.io.File; --import java.io.FileOutputStream; --import java.io.IOException; --import java.io.PrintStream; --import java.security.KeyPair; --import java.security.KeyPairGenerator; --import java.security.PrivateKey; --import java.security.PublicKey; --import org.bouncycastle.asn1.DERConstructedSet; --import org.bouncycastle.asn1.x509.X509Name; --import org.bouncycastle.jce.PKCS10CertificationRequest; --import org.bouncycastle.util.encoders.Base64; --import org.globus.common.CoGProperties; --import org.globus.gsi.CertUtil; --import org.globus.cog.security.cert.request.OpenSSLKey; --import org.globus.cog.security.cert.request.BouncyCastleOpenSSLKey; --import org.globus.util.PEMUtils; --import org.globus.util.Util; -- --import java.util.StringTokenizer; -- --/** -- * GridCertRequest Command Line Client -- * -- * Things remaining to be done: -- * Support for host or service certificate request. Perhaps this should not be -- * part of this tool since the COG kit is mostly a client library. -- * Prompt user for each component of the DN. (Interactive mode) -- * @author Jean-Claude Cote -- */ --public final class GridCertRequest { -- -- public static final String usage = -- "\n" -- + "\ngrid-cert-request [-help] [ options ...]" -- + "\n" -- + "\n Example Usage:" -- + "\n" -- + "\n Creating a user certifcate:" -- + "\n grid-cert-request" -- + "\n" -- + "\n Creating a host or gatekeeper certifcate:" -- + "\n grid-cert-request -host [my.host.fqdn]" -- + "\n" -- + "\n Creating a LDAP server certificate:" -- + "\n grid-cert-request -service ldap -host [my.host.fqdn]" -- + "\n" -- + "\n Options:" -- + "\n" -- + "\n -version : Display version" -- + "\n -?, -h, -help, : Display usage" -- + "\n -usage" -- + "\n -cn , : Common name of the user" -- + "\n -commonname " -- + "\n -service : Create certificate for a service. Requires" -- + "\n the -host option and implies that the generated" -- + "\n key will not be password protected (ie implies -nopw). <>" -- + "\n -host : Create certificate for a host named <>" -- + "\n -dir : Changes the directory the private key and certificate" -- + "\n request will be placed in. By default user" -- + "\n certificates are placed in /home/user/.globus, host" -- + "\n certificates are placed in /etc/grid-security and" -- + "\n service certificates are place in" -- + "\n /etc/grid-security/." -- + "\n -prefix : Causes the generated files to be named" -- + "\n cert.pem, key.pem and" -- + "\n cert_request.pem" -- + "\n -nopw, : Create certificate without a passwd" -- + "\n -nodes," -- + "\n -nopassphrase," -- + "\n -verbose : Don't clear the screen <>" -- + "\n -int[eractive] : Prompt user for each component of the DN <>" -- + "\n -force : Overwrites preexisting certifictes"; -- -- private static String message = -- "\nA certificate request and private key will be created." -- + "\nYou will be asked to enter a PEM pass phrase." -- + "\nThis pass phrase is akin to your account password," -- + "\nand is used to protect your key file." -- + "\nIf you forget your pass phrase, you will need to" -- + "\nobtain a new certificate.\n"; -- -- private static String cn = null; -- private static String service = null; -- private static String gatekeeper = null; -- private static String hostName = null; -- private static String certDir = null; -- private static String certFile = null; -- private static String keyFile = null; -- private static String reqFile = null; -- private static boolean noPswd = false; -- private static boolean interactive = false; -- private static boolean force = false; -- private static boolean resubmit = false; -- private static String version = "1.0"; -- private static boolean verbose = false; -- private static String prefix = "user"; -- -- public static void main(String[] args) { -- -- boolean bOk = parseCmdLine(args); -- -- String userCertFile = ""; -- String userKeyFile = ""; -- String userCertReqFile = ""; -- if (bOk) { -- -- // Get default location of cert. -- CoGProperties props = CoGProperties.getDefault(); -- -- // If no alternate directory specified. -- if (certDir == null) { -- userCertFile = props.getUserCertFile(); -- userKeyFile = props.getUserKeyFile(); -- // Get root dir of default cert location. -- int pos = userKeyFile.lastIndexOf(File.separator); -- certDir = userKeyFile.substring(0, pos + 1); -- } else { -- // If alternate directory specified set cert locations. -- if (certDir.endsWith(File.separator) == false) { -- certDir += File.separator; -- } -- userCertFile = certDir + prefix + "cert.pem"; -- userKeyFile = certDir + prefix + "key.pem"; -- } -- -- // Cert request file name. -- userCertReqFile = -- userCertFile.substring(0, userCertFile.length() - 4) -- + "_request.pem"; -- } -- -- File fDir = null; -- fDir = new File(certDir); -- if (bOk) { -- // Create dir if does not exists. -- if (!fDir.exists()){ -- fDir.mkdir(); -- } -- -- // Make sure directory exists. -- if (!fDir.exists() || !fDir.isDirectory()) { -- System.out.println("The directory " + certDir + " does not exists."); -- bOk = false; -- } -- } -- -- // Make sure we can write to it. -- if (bOk) { -- if (!fDir.canWrite()) { -- System.out.println("Can't write to " + certDir); -- bOk = false; -- } -- } -- -- // Check not to overwrite any of these files. -- if (bOk) { -- if (force == false) { -- boolean bFileExists = false; -- File f = new File(userKeyFile); -- if (f.exists()) { -- System.out.println(userKeyFile + " exists"); -- bFileExists = true; -- } -- f = new File(userCertFile); -- if (f.exists()) { -- System.out.println(userCertFile + " exists"); -- bFileExists = true; -- } -- f = new File(userCertReqFile); -- if (f.exists()) { -- System.out.println(userCertReqFile + " exists"); -- bFileExists = true; -- } -- -- if (bFileExists) { -- System.out.println( -- "If you wish to overwrite, run the script again with -force."); -- bOk = false; -- } -- } -- } -- -- String password = ""; -- if (bOk && !noPswd) { -- // Get password from user. -- bOk = false; -- int attempts = 0; -- -- System.out.println(message); -- -- while (bOk == false && attempts < 3) { -- password = Util.getInput("Enter PEM pass phrase: "); -- String password2 = -- Util.getInput("Verify password Enter PEM pass phrase: "); -- if (password.compareTo(password2) != 0) { -- System.out.println("Verify failure"); -- } else { -- if (password.length() < 4) { -- System.out.println( -- "phrase is too short, needs to be at least 4 chars"); -- } else { -- bOk = true; -- } -- } -- attempts++; -- } -- } -- -- // Generate cert request. -- if (bOk) { -- -- try { -- System.out.println("writing new private key to " + userKeyFile); -- genCertificateRequest( -- cn, -- "ca at gridcanada.ca", -- password, -- userKeyFile, -- userCertFile, -- userCertReqFile); -- } catch (Exception e) { -- System.out.println("error: " + e); -- e.printStackTrace(); -- } -- } -- } -- -- protected static boolean parseCmdLine(String[] args) { -- boolean bOk = true; -- if (args.length == 0) { -- System.out.println(usage); -- bOk = false; -- } else { -- for (int i = 0; i < args.length && bOk; i++) { -- if (args[i].equalsIgnoreCase("-version")) { -- System.out.println(version); -- } else if ( -- args[i].equalsIgnoreCase("-help") -- || args[i].equalsIgnoreCase("-h") -- || args[i].equalsIgnoreCase("-?")) { -- System.out.println(usage); -- bOk = false; -- } else if ( -- args[i].equalsIgnoreCase("-cn") -- || args[i].equalsIgnoreCase("-commonname")) { -- // common name specified -- cn = args[++i]; -- } -- /* -- else if (args[i].equalsIgnoreCase("-service")) { -- // user certificate directory specified -- service = args[++i]; -- }*/ -- /* -- else if (args[i].equalsIgnoreCase("-host")) { -- // host name specified -- service = "host"; -- hostName = args[++i]; -- } -- */ -- else if (args[i].equalsIgnoreCase("-dir")) { -- // user certificate directory specified -- certDir = args[++i]; -- } else if (args[i].equalsIgnoreCase("-prefix")) { -- prefix = args[++i]; -- } else if ( -- args[i].equalsIgnoreCase("-nopw") -- || args[i].equalsIgnoreCase("-nodes") -- || args[i].equalsIgnoreCase("-nopassphrase")) { -- // no password -- noPswd = true; -- } else if (args[i].equalsIgnoreCase("-verbose")) { -- verbose = true; -- } -- /* -- else if ((args[i].equalsIgnoreCase("-int")) || (args[i].equalsIgnoreCase("-interactive"))) { -- // interactive mode -- interactive = true; -- } -- */ -- else if (args[i].equalsIgnoreCase("-force")) { -- // overwrite existing credentials -- force = true; -- } else { -- System.out.println( -- "Error: argument #" -- + i -- + "(" -- + args[i] -- + ") : unknown"); -- } -- } -- } -- return bOk; -- } -- -- /** -- * Generates a encrypted private key and certificate request. -- */ -- static public void genCertificateRequest( -- String dname, -- String emailAddressOfCA, -- String password, -- String privKeyLoc, -- String certLoc, -- String certReqLoc) -- throws Exception { -- -- String sigAlgName = "MD5WithRSA"; -- String keyAlgName = "RSA"; -- -- CertUtil.init(); -- -- // Generate a new key pair. -- KeyPairGenerator keygen = KeyPairGenerator.getInstance(keyAlgName); -- KeyPair keyPair = keygen.genKeyPair(); -- PrivateKey privKey = keyPair.getPrivate(); -- PublicKey pubKey = keyPair.getPublic(); -- -- // Generate the certificate request. -- X509Name name = new X509Name(dname); -- DERConstructedSet derSet = new DERConstructedSet(); -- PKCS10CertificationRequest request = -- new PKCS10CertificationRequest( -- sigAlgName, -- name, -- pubKey, -- derSet, -- privKey); -- -- // Save the certificate request to a .pem file. -- byte[] data = request.getEncoded(); -- PrintStream ps = new PrintStream(new FileOutputStream(certReqLoc)); -- -- // build / delimited name. -- String certSubject = ""; -- StringTokenizer tokens = new StringTokenizer(dname, ","); -- while(tokens.hasMoreTokens()){ -- certSubject = certSubject + "/" + tokens.nextToken(); -- } -- -- ps.print( "\n\n" -- + "Please mail the following certificate request to " + emailAddressOfCA + "\n" -- + "\n" -- + "==================================================================\n" -- + "\n" -- + "Certificate Subject:\n" -- + "\n" -- + certSubject -- + "\n" -- + "\n" -- + "The above string is known as your user certificate subject, and it \n" -- + "uniquely identifies this user.\n" -- + "\n" -- + "To install this user certificate, please save this e-mail message\n" -- + "into the following file.\n" -- + "\n" -- + "\n" -- + certLoc -- + "\n" -- + "\n" -- + "\n" -- + " You need not edit this message in any way. Simply \n" -- + " save this e-mail message to the file.\n" -- + "\n" -- + "\n" -- + "If you have any questions about the certificate contact\n" -- + "the Certificate Authority at " + emailAddressOfCA + "\n" -- + "\n"); -- ps.print(toPEM(data)); -- ps.close(); -- -- // Save private key to a .pem file. -- OpenSSLKey key = new BouncyCastleOpenSSLKey(privKey); -- if (password.length() != 0) { -- key.encrypt(password); -- } -- key.writeTo(new File(privKeyLoc).getAbsolutePath()); -- // set read only permissions -- Util.setFilePermissions(privKeyLoc, 600); -- -- // Create an empty cert file. -- File f = new File(certLoc); -- f.createNewFile(); -- } -- -- /** -- * Converts to PEM encoding. -- */ -- static public String toPEM(byte[] data) { -- byte[] enc_data = Base64.encode(data); -- String header = "-----BEGIN CERTIFICATE REQUEST-----"; -- ByteArrayOutputStream out = new ByteArrayOutputStream(); -- try { -- PEMUtils.writeBase64( -- out, -- header, -- enc_data, -- "-----END CERTIFICATE REQUEST-----"); -- } catch (IOException e) { -- throw new RuntimeException("Unexpected error: " + e.getMessage()); -- } -- return new String(out.toByteArray()); -- } -- --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/request/OpenSSLKey.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/request/OpenSSLKey.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/request/OpenSSLKey.java (working copy) -@@ -1,446 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --package org.globus.cog.security.cert.request; -- --import java.util.StringTokenizer; --import java.io.IOException; --import java.io.InputStream; --import java.io.OutputStream; --import java.io.InputStreamReader; --import java.io.ByteArrayOutputStream; --import java.io.FileOutputStream; --import java.io.Reader; --import java.io.FileReader; --import java.io.PrintWriter; --import java.io.BufferedReader; --import java.io.Writer; --import java.security.SecureRandom; --import java.security.MessageDigest; --import java.security.InvalidKeyException; --import java.security.NoSuchAlgorithmException; --import java.security.PrivateKey; --import java.security.Key; --import java.security.GeneralSecurityException; -- --import javax.crypto.Cipher; --import javax.crypto.NoSuchPaddingException; --import javax.crypto.spec.SecretKeySpec; --import javax.crypto.spec.IvParameterSpec; -- --import org.globus.util.Base64; --import org.globus.util.PEMUtils; --import org.globus.util.Util; -- --/** -- * Represents a OpenSSL-style PEM-formatted private key. It supports encryption -- * and decryption of the key. Currently, only RSA keys are supported, -- * and only TripleDES encryption is supported. -- * This is based on work done by Ming Yung at DSTC. -- */ --public abstract class OpenSSLKey { -- -- public static final String HEADER = "-----BEGIN RSA PRIVATE KEY-----"; -- -- private String keyAlg = null; -- private boolean isEncrypted = false; -- private byte[] encodedKey = null; -- private PrivateKey intKey = null; -- private IvParameterSpec iv = null; -- private Cipher cipher = null; -- private String encAlg = null; -- private byte[] keyData = null; -- -- /** -- * Reads a OpenSSL private key from the specified input stream. -- * The private key must be PEM encoded and can be encrypted. -- * -- * @param is input stream with OpenSSL key in PEM format. -- * @exception IOException if I/O problems. -- * @exception GeneralSecurityException if problems with the key -- */ -- public OpenSSLKey(InputStream is) -- throws IOException, GeneralSecurityException { -- InputStreamReader isr = new InputStreamReader(is); -- readPEM(isr); -- } -- -- /** -- * Reads a OpenSSL private key from the specified file. -- * The private key must be PEM encoded and can be encrypted. -- * -- * @param file file containing the OpenSSL key in PEM format. -- * @exception IOException if I/O problems. -- * @exception GeneralSecurityException if problems with the key -- */ -- public OpenSSLKey(String file) -- throws IOException, GeneralSecurityException { -- FileReader f = null; -- try { -- f = new FileReader(file); -- readPEM(f); -- } finally { -- if (f != null) f.close(); -- } -- } -- -- /** -- * Converts a RSAPrivateCrtKey into OpenSSL key. -- * -- * @param key private key - must be a RSAPrivateCrtKey -- */ -- public OpenSSLKey(PrivateKey key) { -- intKey = key; -- isEncrypted = false; -- keyData = getEncoded(key); -- } -- -- /** -- * Initializes the OpenSSL key from raw byte array. -- * -- * @param algorithm the algorithm of the key. Currently -- * only RSA algorithm is supported. -- * @param data the DER encoded key data. If RSA -- * algorithm, the key must be in -- * PKCS#1 format. -- * @exception GeneralSecurityException if any security -- * problems. -- */ -- public OpenSSLKey(String algorithm, byte [] data) -- throws GeneralSecurityException { -- keyData = data; -- isEncrypted = false; -- intKey = getKey(algorithm, data); -- } -- -- private void readPEM(Reader rd) -- throws IOException, GeneralSecurityException { -- -- BufferedReader in = new BufferedReader(rd); -- -- StringBuffer sb = new StringBuffer(); -- -- String next = null; -- -- while( (next = in.readLine()) != null) { -- if (next.indexOf("PRIVATE KEY") != -1) { -- keyAlg = getAlgorithm(next); -- break; -- } -- } -- -- if (next == null) { -- throw new InvalidKeyException("PRIVATE KEY section not found."); -- } -- -- if (keyAlg == null) { -- throw new InvalidKeyException("Algorithm not supported."); -- } -- -- next = in.readLine(); -- if (next.startsWith("Proc-Type: 4,ENCRYPTED")) { -- isEncrypted = true; -- checkEncrypted(in.readLine()); -- in.readLine(); -- } else { -- sb.append(next); -- } -- -- while ( (next = in.readLine()) != null ) { -- if (next.startsWith("-----END")) break; -- sb.append(next); -- } -- -- encodedKey = sb.toString().getBytes(); -- -- if (!isEncrypted()) { -- keyData = Base64.decode( encodedKey ); -- intKey = getKey(keyAlg, keyData); -- } else { -- keyData = null; -- } -- } -- -- /** -- * Check if the key was encrypted or not. -- * -- * @return true if the key is encrypted, false -- * otherwise. -- */ -- public boolean isEncrypted() { -- return isEncrypted; -- } -- -- /** -- * Decrypts the private key with given password. -- * Does nothing if the key is not encrypted. -- * -- * @param password password to decrypt the key with. -- * @exception GeneralSecurityException -- * whenever an error occurs during decryption. -- * @exception InvalidKeyException -- * whenever an error occurs during decryption. -- */ -- public void decrypt(String password) -- throws GeneralSecurityException, InvalidKeyException { -- decrypt(password.getBytes()); -- } -- -- /** -- * Decrypts the private key with given password. -- * Does nothing if the key is not encrypted. -- * -- * @param password password to decrypt the key with. -- * @exception GeneralSecurityException -- * whenever an error occurs during decryption. -- * @exception InvalidKeyException -- * whenever an error occurs during decryption. -- */ -- public void decrypt(byte [] password) -- throws GeneralSecurityException, InvalidKeyException { -- if (!isEncrypted()) return; -- -- byte [] enc = Base64.decode( encodedKey ); -- -- SecretKeySpec key = getSecretKey(password, iv.getIV()); -- -- cipher = getCipher(encAlg); -- cipher.init(Cipher.DECRYPT_MODE, key, iv); -- enc = cipher.doFinal(enc); -- -- intKey = getKey(keyAlg, enc); -- -- keyData = enc; -- -- isEncrypted = false; -- } -- -- /** -- * Encrypts the private key with given password. -- * Does nothing if the key is encrypted already. -- * -- * @param password password to encrypt the key with. -- * @exception GeneralSecurityException -- * whenever an error occurs during encryption. -- */ -- public void encrypt(String password) -- throws GeneralSecurityException { -- encrypt(password.getBytes()); -- } -- -- /** -- * Encrypts the private key with given password. -- * Does nothing if the key is encrypted already. -- * -- * @param password password to encrypt the key with. -- * @exception GeneralSecurityException -- * whenever an error occurs during encryption. -- */ -- public void encrypt(byte [] password) -- throws GeneralSecurityException { -- -- encAlg = "DESede"; -- -- if (isEncrypted()) return; -- -- if (iv == null) iv = generateIV(); -- -- Key key = getSecretKey(password, iv.getIV()); -- -- cipher = getCipher(encAlg); -- cipher.init(Cipher.ENCRYPT_MODE, key, iv); -- -- /* encrypt the raw PKCS11 */ -- -- keyData = cipher.doFinal( getEncoded(intKey) ); -- -- isEncrypted = true; -- } -- -- /** -- * Returns the JCE (RSAPrivateCrtKey) key. -- * -- * @return the private key, null if the key -- * was not decrypted yet. -- */ -- public PrivateKey getPrivateKey() { -- return intKey; -- } -- -- /** -- * Writes the private key to the specified output stream in PEM -- * format. If the key was encrypted it will be encoded as an encrypted -- * RSA key. If not, it will be encoded as a regular RSA key. -- * -- * @param output output stream to write the key to. -- * @exception IOException if I/O problems writing the key -- */ -- public void writeTo(OutputStream output) -- throws IOException { -- if (keyData == null) throw new IOException("No key info"); -- output.write( toPEM().getBytes() ); -- } -- -- /** -- * Writes the private key to the specified writer in PEM format. -- * If the key was encrypted it will be encoded as an encrypted -- * RSA key. If not, it will be encoded as a regular RSA key. -- * -- * @param writer writer to output the key to. -- * @exception IOException if I/O problems writing the key -- */ -- public void writeTo(Writer w) -- throws IOException { -- if (keyData == null) throw new IOException("No key info"); -- w.write( toPEM() ); -- } -- -- /** -- * Writes the private key to the specified file in PEM format. -- * If the key was encrypted it will be encoded as an encrypted -- * RSA key. If not, it will be encoded as a regular RSA key. -- * -- * @param file file to write the key to. -- * @exception IOException if I/O problems writing the key -- */ -- public void writeTo(String file) -- throws IOException { -- if (keyData == null) throw new IOException("No key info"); -- PrintWriter p = null; -- try { -- p = new PrintWriter(new FileOutputStream(file)); -- Util.setFilePermissions(file, 600); -- p.write( toPEM() ); -- } finally { -- if (p != null) p.close(); -- } -- } -- -- -- /** -- * Returns DER encoded byte array (PKCS#1). -- */ -- protected abstract byte[] getEncoded(PrivateKey key); -- -- /** -- * Returns PrivateKey object initialized from give byte array (in PKCS#1 format) -- */ -- protected abstract PrivateKey getKey(String alg, byte [] data) -- throws GeneralSecurityException; -- -- protected String getProvider() { -- return null; -- } -- -- private Cipher getCipher(String encAlg) -- throws GeneralSecurityException { -- if (cipher == null) { -- String provider = getProvider(); -- if (provider == null) { -- cipher = Cipher.getInstance(encAlg + "/CBC/PKCS5Padding"); -- } else { -- cipher = Cipher.getInstance(encAlg + "/CBC/PKCS5Padding", -- provider); -- } -- } -- return cipher; -- } -- -- private String getAlgorithm(String line) { -- if (line.indexOf("RSA") != -1) { -- return "RSA"; -- } else if (line.indexOf("DSA") != -1) { -- return "DSA"; -- } else { -- return null; -- } -- } -- -- private void checkEncrypted(String line) { -- String keyInfo = line.substring(10); -- StringTokenizer tknz = new StringTokenizer(keyInfo, ",", false); -- -- if (tknz.nextToken().equals("DES-EDE3-CBC")) { -- encAlg = "DESede"; -- } -- -- iv = getIV(tknz.nextToken()); -- } -- -- private IvParameterSpec getIV(String s) { -- byte[] ivBytes = new byte[8]; -- for (int j=0; j<8; j++) { -- ivBytes[j] = (byte)Integer.parseInt(s.substring(j*2, j*2 + 2), 16); -- } -- return new IvParameterSpec(ivBytes); -- } -- -- private IvParameterSpec generateIV() { -- byte [] b = new byte[8]; -- SecureRandom sr = new SecureRandom(); //.getInstance("PRNG"); -- sr.nextBytes(b); -- return new IvParameterSpec(b); -- } -- -- private SecretKeySpec getSecretKey(byte [] pwd, byte [] iv) -- throws NoSuchAlgorithmException { -- byte[] keyMat = new byte[24]; -- -- MessageDigest md = MessageDigest.getInstance("MD5"); -- md.update(pwd); -- md.update(iv); -- byte[] data = md.digest(); -- System.arraycopy(data, 0, keyMat, 0, 16); -- -- md.update(data); -- md.update(pwd); -- md.update(iv); -- data = md.digest(); -- System.arraycopy(data, 0, keyMat, 16, 8); -- -- return new SecretKeySpec(keyMat, encAlg); -- } -- -- // ------------------------------------------- -- -- /** -- * Converts to PEM encoding. -- * Assumes keyData is initialized. -- */ -- private String toPEM() { -- -- byte [] data = Base64.encode( keyData ); -- -- String header = HEADER; -- -- if (isEncrypted()) { -- StringBuffer buf = new StringBuffer(header); -- buf.append(PEMUtils.lineSep); -- buf.append("Proc-Type: 4,ENCRYPTED"); -- buf.append(PEMUtils.lineSep); -- buf.append("DEK-Info: DES-EDE3-CBC,").append(PEMUtils.toHex(iv.getIV())); -- buf.append(PEMUtils.lineSep); -- header = buf.toString(); -- } -- -- ByteArrayOutputStream out = new ByteArrayOutputStream(); -- -- try { -- PEMUtils.writeBase64(out, -- header, -- data, -- "-----END RSA PRIVATE KEY-----"); -- } catch (IOException e) { -- throw new RuntimeException("Unexpected error: " + -- e.getMessage()); -- } -- -- return new String(out.toByteArray()); -- } -- -- --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/management/CertInfoApplet.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/management/CertInfoApplet.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/management/CertInfoApplet.java (working copy) -@@ -1,175 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/** -- * Copyright (c) 2003, National Research Council of Canada -- * All rights reserved. -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy of this -- * software and associated documentation files (the "Software"), to deal in the Software -- * without restriction, including without limitation the rights to use, copy, modify, merge, -- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the -- * Software is furnished to do so, subject to the following conditions: -- * -- * The above copyright notice(s) and this licence appear in all copies of the Software or -- * substantial portions of the Software, and that both the above copyright notice(s) and this -- * license appear in supporting documentation. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE -- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE -- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL -- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE -- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * Except as contained in this notice, the name of a copyright holder shall NOT be used in -- * advertising or otherwise to promote the sale, use or other dealings in this Software -- * without specific prior written authorization. Title to copyright in this software and any -- * associated documentation will at all times remain with copyright holders. -- */ -- --package org.globus.cog.security.cert.management; -- --import java.awt.Font; --import java.awt.GridBagConstraints; --import java.awt.GridBagLayout; --import java.awt.Label; --import java.awt.Panel; --import java.security.cert.X509Certificate; --import java.text.DateFormat; --import java.text.SimpleDateFormat; --import java.util.TimeZone; -- --import org.globus.gsi.CertUtil; -- --/** -- * @author Jean-Claude Cote -- */ --public class CertInfoApplet extends GIPApplet { -- -- private static final String PROPERTY_FILE = "CertInfoApplet"; -- -- public void init() { -- super.init(); -- -- // Setup UI. -- Panel titlePanel = null; -- if (appletTitle.length() > 0) { -- titlePanel = new Panel(); -- titlePanel.add(new Label(appletTitle)); -- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); -- titlePanel.setBackground(bgColor); -- } -- -- Panel statusPanel = new Panel(); -- Font font = new Font("Courier", Font.PLAIN, 12); -- status.setFont(font); -- -- // Change the status area size -- status.setRows(25); -- statusPanel.add(status); -- -- Panel mainPanel = new Panel(); -- GridBagLayout gridbag = new GridBagLayout(); -- GridBagConstraints c = new GridBagConstraints(); -- if (titlePanel != null) { -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(titlePanel, c); -- mainPanel.add(titlePanel); -- } -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(statusPanel, c); -- mainPanel.add(statusPanel); -- mainPanel.setLayout(gridbag); -- -- this.add(mainPanel); -- this.setBackground(bgColor); -- } -- -- public void start() { -- -- try { -- X509Certificate cert = CertUtil.loadCertificate(userCertFile); -- -- boolean globusStyle = false; -- String dn = null; -- if (globusStyle) { -- dn = CertUtil.toGlobusID(cert.getSubjectDN().getName()); -- } else { -- dn = cert.getSubjectDN().getName(); -- } -- appendToStatus("subject : " + dn); -- -- dn = null; -- if (globusStyle) { -- dn = CertUtil.toGlobusID(cert.getIssuerDN().getName()); -- } else { -- dn = cert.getIssuerDN().getName(); -- } -- appendToStatus("issuer : " + dn); -- -- TimeZone tz = null; -- DateFormat df = null; -- if (globusStyle) { -- tz = TimeZone.getTimeZone("GMT"); -- df = new SimpleDateFormat("MMM dd HH:mm:ss yyyy z"); -- df.setTimeZone(tz); -- } -- -- String dt = null; -- if (globusStyle) { -- dt = df.format(cert.getNotBefore()); -- } else { -- dt = cert.getNotBefore().toString(); -- } -- appendToStatus("start date : " + dt); -- -- dt = null; -- if (globusStyle) { -- dt = df.format(cert.getNotAfter()); -- } else { -- dt = cert.getNotAfter().toString(); -- } -- appendToStatus("end date : " + dt); -- -- appendToStatus("certificate :"); -- appendToStatus(cert.toString()); -- -- } catch (Exception ex) { -- // Write exection to Java console. -- ex.printStackTrace(); -- -- // Write exception to status area. -- String message = ex.getMessage() + "\n"; -- StackTraceElement[] stackElements = ex.getStackTrace(); -- for (int i = 0; i < stackElements.length; i++) { -- message += stackElements[i].toString() + "\n"; -- } -- appendToStatus(message); -- } -- } -- -- /* (non-Javadoc) -- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() -- */ -- protected String getPropertyFileName() { -- // TODO Auto-generated method stub -- return PROPERTY_FILE; -- } -- -- --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/management/GIPMail.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/management/GIPMail.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/management/GIPMail.java (working copy) -@@ -1,70 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/* -- * Created on Nov 6, 2003 -- * -- * To change the template for this generated file go to -- * Window>Preferences>Java>Code Generation>Code and Comments -- */ --package org.globus.cog.security.cert.management; -- -- --import java.util.Properties; -- --import javax.mail.Message; --import javax.mail.MessagingException; --import javax.mail.Session; --import javax.mail.Transport; --import javax.mail.internet.AddressException; --import javax.mail.internet.InternetAddress; --import javax.mail.internet.MimeMessage; -- --/** -- * @author Jean-Claude Cote -- */ --public class GIPMail { -- private static final String SMTP_HOST = "mail.nrc.ca"; -- private static final boolean debug = true; -- -- public static void postMail(String recipients[], String subject, String message, String from) { -- //Set the host smtp address -- Properties props = new Properties(); -- props.put("mail.smtp.host", SMTP_HOST); -- -- // create some properties and get the default Session -- Session session = Session.getDefaultInstance(props, null); -- session.setDebug(debug); -- -- // create a message -- Message msg = new MimeMessage(session); -- -- // set the from and to address -- InternetAddress addressFrom = null; -- try { -- addressFrom = new InternetAddress(from); -- msg.setFrom(addressFrom); -- -- InternetAddress[] addressTo = new InternetAddress[recipients.length]; -- for (int i = 0; i < recipients.length; i++) { -- addressTo[i] = new InternetAddress(recipients[i]); -- } -- msg.setRecipients(Message.RecipientType.TO, addressTo); -- // Setting the Subject and Content Type -- msg.setSubject(subject); -- msg.setContent(message, "text/plain"); -- Transport.send(msg); -- } -- catch (AddressException e) { -- e.printStackTrace(); -- } -- catch (MessagingException e1) { -- e1.printStackTrace(); -- } -- } -- --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/management/CertRenewApplet.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/management/CertRenewApplet.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/management/CertRenewApplet.java (working copy) -@@ -1,299 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/** -- * Copyright (c) 2003, National Research Council of Canada -- * All rights reserved. -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy of this -- * software and associated documentation files (the "Software"), to deal in the Software -- * without restriction, including without limitation the rights to use, copy, modify, merge, -- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the -- * Software is furnished to do so, subject to the following conditions: -- * -- * The above copyright notice(s) and this licence appear in all copies of the Software or -- * substantial portions of the Software, and that both the above copyright notice(s) and this -- * license appear in supporting documentation. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE -- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE -- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL -- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE -- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * Except as contained in this notice, the name of a copyright holder shall NOT be used in -- * advertising or otherwise to promote the sale, use or other dealings in this Software -- * without specific prior written authorization. Title to copyright in this software and any -- * associated documentation will at all times remain with copyright holders. -- */ -- --package org.globus.cog.security.cert.management; -- --import java.awt.Button; --import java.awt.FlowLayout; --import java.awt.Font; --import java.awt.GridBagConstraints; --import java.awt.GridBagLayout; --import java.awt.GridLayout; --import java.awt.Label; --import java.awt.Panel; --import java.awt.TextField; --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; --import java.io.BufferedReader; --import java.io.File; --import java.io.FileInputStream; --import java.io.FileNotFoundException; --import java.io.IOException; --import java.io.InputStreamReader; -- --import org.globus.cog.security.cert.request.GridCertRenewalRequest; --import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; -- --/** -- * @author Jean-Claude Cote -- */ --public class CertRenewApplet extends GIPApplet implements ActionListener { -- -- private static final String PROPERTY_FILE = "CertRenewApplet"; -- // Values configured by property file. -- private String renewAction = null; -- private String mailRenewRequest = null; -- -- private String oldPassPhraseLabel = "Old PassPhrase"; -- private String passPhraseLabel = "PassPhrase"; -- private String confPassPhraseLabel = "Confirm PassPhrase"; -- private String yourEmailAddressLabel = "Your e-mail address"; -- private String challengeLabel = "Challenge"; -- -- -- // UI elements. -- private Button mailButton = null; -- private Button renewButton = null; -- private TextField oldPasswordField = new TextField(); -- private TextField passwordField = new TextField(); -- private TextField confPasswordField = new TextField(); -- private TextField challengeField = new TextField(); -- private String certRenewEmailBody = ""; -- private TextField fromField = new TextField(); -- -- public void init() { -- super.init(); -- -- renewAction = getLocString("RenewRequestAction"); -- mailRenewRequest = getLocString("MailRenewAction"); -- -- // Setup UI. -- mailButton = new Button(mailRenewRequest); -- renewButton = new Button(renewAction); -- -- -- Panel titlePanel = null; -- if (appletTitle.length() > 0) { -- titlePanel = new Panel(); -- titlePanel.add(new Label(appletTitle)); -- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); -- titlePanel.setBackground(bgColor); -- } -- -- Panel inputPanel = new Panel(); -- inputPanel.add(new Label(oldPassPhraseLabel)); -- oldPasswordField.setEchoChar('*'); -- inputPanel.add(oldPasswordField); -- inputPanel.add(new Label(passPhraseLabel)); -- inputPanel.add(passwordField); -- passwordField.setEchoChar('*'); -- inputPanel.add(new Label(confPassPhraseLabel)); -- inputPanel.add(confPasswordField); -- confPasswordField.setEchoChar('*'); -- inputPanel.add(new Label(yourEmailAddressLabel)); -- inputPanel.add(fromField); -- inputPanel.add(new Label(challengeLabel)); -- inputPanel.add(challengeField); -- inputPanel.setLayout(new GridLayout(0, 2)); -- inputPanel.setBackground(bgColor); -- -- Panel buttonPanel = new Panel(); -- renewButton.addActionListener(this); -- buttonPanel.add(renewButton); -- mailButton.addActionListener(this); -- buttonPanel.add(mailButton); -- buttonPanel.setLayout(new FlowLayout()); -- -- Panel statusPanel = new Panel(); -- Font font = new Font("Courier", Font.PLAIN, 12); -- status.setFont(font); -- statusPanel.add(status); -- -- Panel mainPanel = new Panel(); -- GridBagLayout gridbag = new GridBagLayout(); -- GridBagConstraints c = new GridBagConstraints(); -- if (titlePanel != null) { -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(titlePanel, c); -- mainPanel.add(titlePanel); -- } -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(inputPanel, c); -- mainPanel.add(inputPanel); -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(buttonPanel, c); -- mainPanel.add(buttonPanel); -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(statusPanel, c); -- mainPanel.add(statusPanel); -- mainPanel.setLayout(gridbag); -- -- this.add(mainPanel); -- this.setBackground(bgColor); -- } -- -- public void actionPerformed(ActionEvent e) { -- -- boolean bOk = true; -- -- if (debug){ -- this.doDebugTests(); -- } -- -- // Get ui values. -- String from = fromField.getText(); -- String oldPassword = oldPasswordField.getText(); -- String password = passwordField.getText(); -- String password2 = confPasswordField.getText(); -- String chalenge = challengeField.getText(); -- -- // Get cog values. -- String userCertRenewFile = userCertFile.substring(0, userCertFile.length() - 4) + "_renew_request.pem"; -- String newPrivKeyFile = userKeyFile.substring(0, userKeyFile.length() - 4) + "_new.pem"; -- -- try { -- -- if (e.getActionCommand() == renewAction) { -- -- bOk = checkCertDir(); -- -- // Verify new password. -- if (bOk) { -- bOk = verifyPassword(password, password2); -- } -- -- if (bOk) { -- boolean bFileExists = false; -- File f = new File(newPrivKeyFile); -- if (f.exists()) { -- appendToStatus(newPrivKeyFile + getLocString("msg001")); -- bFileExists = true; -- } -- f = new File(userCertRenewFile); -- if (f.exists()) { -- appendToStatus(userCertRenewFile + getLocString("msg001")); -- bFileExists = true; -- } -- -- if (bFileExists) { -- appendToStatus(getLocString("msg002")); -- appendToStatus(getLocString("msg003")); -- bOk = false; -- } -- } -- -- if (bOk){ -- if (chalenge.length() == 0){ -- appendToStatus(getLocString("msg004")); -- bOk = false; -- } -- } -- -- // Generate renew request. -- if (bOk) { -- appendToStatus(getLocString("msg005") + chalenge); -- -- // Generate a proxy, and keypair from current cert and key -- // $GRID_PROXY_INIT -hours 1 -bits 1024 -out $TMPPROXY -cert $CERTFILE -key $KEYFILE -- int credLifetimeSeconds = 300; // life time of proxy 5 min. -- GlobusGSSCredentialImpl cred = createNewProxy(oldPassword, credLifetimeSeconds, 1024); -- if (cred != null){ -- GridCertRenewalRequest.genRenewRequest( -- cred, -- password, -- chalenge, -- newPrivKeyFile, -- userCertRenewFile ); -- appendToStatus(getLocString("msg006")); -- appendToStatus(getLocString("msg007") + newPrivKeyFile); -- appendToStatus(getLocString("msg008") + userCertRenewFile); -- appendToStatus(getLocString("msg009") + this.emailAddressOfCA + getLocString("msg010")); -- } -- } -- } -- else if (e.getActionCommand() == mailRenewRequest) { -- -- // Check from email address. -- if (bOk) { -- if (from.length() == 0) { -- appendToStatus(getLocString("msg011")); -- bOk = false; -- } -- } -- -- // Load mail body from cert renew file. -- String mailBody = loadFile(userCertRenewFile); -- -- // Send the request to the CA. -- if (bOk && mailBody.length() != 0) { -- if (sendMail(from, mailBody)) { -- appendToStatus(getLocString("msg012") + emailAddressOfCA ); -- } -- } -- -- } -- else { -- appendToStatus(getLocString("msg013") + e.getActionCommand() ); -- } -- } -- catch (Exception ex) { -- this.appendExceptionDetailsToStatus(ex); -- } -- } -- -- private String loadFile(String fileName) throws FileNotFoundException, IOException { -- File f = new File(fileName); -- String data = ""; -- BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream(f))); -- String sLine = in.readLine(); -- while (sLine != null) { -- data += sLine + "\n"; -- sLine = in.readLine(); -- } -- in.close(); -- return data; -- } -- -- /* (non-Javadoc) -- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() -- */ -- protected String getPropertyFileName() { -- // TODO Auto-generated method stub -- return PROPERTY_FILE; -- } -- -- --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/management/GIPApplet.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/management/GIPApplet.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/management/GIPApplet.java (working copy) -@@ -1,573 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/** -- * Copyright (c) 2004, National Research Council of Canada -- * All rights reserved. -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy of this -- * software and associated documentation files (the "Software"), to deal in the Software -- * without restriction, including without limitation the rights to use, copy, modify, merge, -- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the -- * Software is furnished to do so, subject to the following conditions: -- * -- * The above copyright notice(s) and this licence appear in all copies of the Software or -- * substantial portions of the Software, and that both the above copyright notice(s) and this -- * license appear in supporting documentation. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE -- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE -- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL -- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE -- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * Except as contained in this notice, the name of a copyright holder shall NOT be used in -- * advertising or otherwise to promote the sale, use or other dealings in this Software -- * without specific prior written authorization. Title to copyright in this software and any -- * associated documentation will at all times remain with copyright holders. -- */ -- -- --package org.globus.cog.security.cert.management; -- --import java.applet.Applet; --import java.awt.Button; --import java.awt.Color; --import java.awt.Container; --import java.awt.Dialog; --import java.awt.FlowLayout; --import java.awt.Font; --import java.awt.Frame; --import java.awt.GridLayout; --import java.awt.Label; --import java.awt.Panel; --import java.awt.TextArea; --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; --import java.io.File; --import java.io.FileNotFoundException; --import java.io.FileOutputStream; --import java.io.IOException; --import java.io.InputStream; --import java.io.OutputStream; --import java.net.InetAddress; --import java.net.URL; --import java.security.GeneralSecurityException; --import java.security.PrivateKey; --import java.security.cert.X509Certificate; --import java.util.Enumeration; --import java.util.Locale; --import java.util.Properties; --import java.util.ResourceBundle; --import java.util.StringTokenizer; -- --import org.globus.common.CoGProperties; --import org.globus.gsi.CertUtil; --import org.globus.gsi.GSIConstants; --import org.globus.gsi.GlobusCredential; --import org.globus.gsi.OpenSSLKey; --import org.globus.gsi.bc.BouncyCastleCertProcessingFactory; --import org.globus.gsi.bc.BouncyCastleOpenSSLKey; --import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; --import org.ietf.jgss.GSSCredential; -- --/** -- * @author Jean-Claude Cote -- */ --public abstract class GIPApplet extends Applet { -- -- protected static final boolean debug = true; -- protected String emailAddressOfCA = "jean-claude.cote at cnrc-nrc.gc.ca"; -- protected TextArea status = new TextArea(12, 50); -- -- protected Color bgColor = Color.white; -- -- private ResourceBundle resource = null; -- // Values configured by property file. -- private String emailSubject = null; -- protected String appletTitle = null; -- private String caCertFiles = null; -- -- // Cog values. -- protected String certDir = ""; -- protected String userCertFile = ""; -- protected String userKeyFile = ""; -- protected String userCertReqFile = ""; -- protected CoGProperties cogProps = CoGProperties.getDefault(); -- -- -- public void init() { -- -- CertUtil.init(); -- -- resetCertFileLoc(); -- -- loadParams(); -- -- loadProperties(); -- -- handleCAInstallation(); -- -- } -- -- protected void resetCertFileLoc() { -- // Get default location of cert. -- userCertFile = cogProps.getUserCertFile(); -- userKeyFile = cogProps.getUserKeyFile(); -- -- // Get root dir of default cert location. -- int pos = userKeyFile.lastIndexOf(File.separator); -- certDir = userKeyFile.substring(0, pos + 1); -- -- // Cert request file name. -- userCertReqFile = userCertFile.substring(0, userCertFile.length() - 4) + "_request.pem"; -- } -- -- private void loadParams(){ -- // Get param values. -- // set color to what ever user specified. -- String color = getParameter("backGroundColor"); -- if (color != null && color.length() > 0) { -- bgColor = Color.decode(getParameter("backGroundColor")); -- } -- -- // set ca email to what ever user specified. -- String ca = getParameter("emailAddressOfCA"); -- if (ca != null && ca.length() > 0) { -- emailAddressOfCA = getParameter("emailAddressOfCA"); -- } -- } -- -- protected abstract String getPropertyFileName(); -- -- -- public String getLocString( String key ){ -- return resource.getString(key); -- } -- -- private void loadProperties(){ -- -- Locale currentLocale = Locale.getDefault(); -- -- System.out.println("Getting resource bundle for: " + currentLocale.toString()); -- -- resource = ResourceBundle.getBundle("conf/" + getPropertyFileName(), currentLocale); -- -- System.out.println("Resource bundle data:"); -- Enumeration e = resource.getKeys(); -- String key = null; -- while( e.hasMoreElements() ){ -- key = (String)e.nextElement(); -- System.out.println(key + " = " + resource.getString(key)); -- } -- -- appletTitle = getLocString("AppletTitle"); -- emailSubject = getLocString("EmailSubject"); -- caCertFiles = getLocString("CACertFiles"); -- -- } -- -- protected void appendToStatus(String s) { -- String statusText = s + "\n"; -- status.append(statusText); -- } -- -- protected void appendExceptionDetailsToStatus(Exception ex) { -- // Write exection to Java console. -- ex.printStackTrace(); -- -- // Write exception to status area. -- String message = ex.getMessage() + "\n"; -- StackTraceElement[] stackElements = ex.getStackTrace(); -- for (int i = 0; i < stackElements.length; i++) { -- message += stackElements[i].toString() + "\n"; -- } -- appendToStatus(message); -- } -- -- protected GlobusGSSCredentialImpl createNewProxy(String keyPassword, int lifetime, int bits) { -- -- CertUtil.init(); -- -- X509Certificate userCert = null; -- PrivateKey userKey = null; -- -- CoGProperties props = CoGProperties.getDefault(); -- -- String userCertFile = props.getUserCertFile(); -- String userKeyFile = props.getUserKeyFile(); -- -- try { -- OpenSSLKey key = new BouncyCastleOpenSSLKey(userKeyFile); -- -- if (key.isEncrypted()) { -- key.decrypt(keyPassword); -- } -- -- userKey = key.getPrivateKey(); -- } catch(IOException e) { -- appendToStatus("Error: Failed to load key: " + userKeyFile); -- appendToStatus("Make sure you have a valide private key installed."); -- e.printStackTrace(); -- return null; -- } catch(GeneralSecurityException e) { -- appendToStatus("Error: Wrong grid pass phrase!"); -- e.printStackTrace(); -- return null; -- } -- -- try { -- userCert = CertUtil.loadCertificate(userCertFile); -- } catch(IOException e) { -- appendToStatus("Error: Failed to load cert: " + userCertFile); -- appendToStatus("Make sure you have a valide certificate installed."); -- e.printStackTrace(); -- return null; -- } catch(GeneralSecurityException e) { -- appendToStatus("Error: Unable to load user certificate: " + -- e.getMessage()); -- appendExceptionDetailsToStatus(e); -- return null; -- } -- -- BouncyCastleCertProcessingFactory factory = -- BouncyCastleCertProcessingFactory.getDefault(); -- -- boolean limited = false; -- -- int proxyType = (limited) ? -- GSIConstants.DELEGATION_LIMITED : -- GSIConstants.DELEGATION_FULL; -- -- try { -- GlobusCredential proxy = -- factory.createCredential(new X509Certificate[] {userCert}, -- userKey, -- bits, -- lifetime, -- proxyType); -- -- return new GlobusGSSCredentialImpl(proxy, -- GSSCredential.INITIATE_ONLY); -- -- } catch (Exception e) { -- appendToStatus("Failed to create a proxy: " + e.getMessage()); -- appendExceptionDetailsToStatus(e); -- return null; -- } -- } -- -- protected void doDebugTests() { -- try { -- System.err.println("doing some preleminary checks"); -- -- Properties p = System.getProperties(); -- p.list(System.out); -- -- InetAddress inetAdd = InetAddress.getLocalHost(); -- System.out.println(inetAdd.getHostName()); -- System.out.println(inetAdd.toString()); -- System.out.println(inetAdd.getCanonicalHostName()); -- -- System.out.println("trying to get property: org.globus.config.file"); -- String file = System.getProperty("org.globus.config.file"); -- System.out.println("got the property its values is: " + file); -- -- System.out.println("testing file acces"); -- File fff = new File("_a_test_b_.txt"); -- fff.createNewFile(); -- System.out.println("successfully created _a_test_b_.txt"); -- fff.delete(); -- System.out.println("successfully deleted _a_test_b_.txt"); -- System.out.println("preliminary checks ok"); -- } -- catch( Exception eee ){ -- eee.printStackTrace(); -- } -- } -- -- public boolean sendMail(String from, String content) { -- boolean sent = false; -- String[] recipients = new String[1]; -- recipients[0] = emailAddressOfCA; -- // Confirm operation. -- if (confirmedEmailOperation(emailAddressOfCA, from, emailSubject, content)){ -- GIPMail.postMail( recipients, emailSubject, content, from); -- sent = true; -- } -- return sent; -- } -- -- -- protected boolean checkCertDir() { -- boolean bOk = true; -- -- File fDir = null; -- fDir = new File(certDir); -- // Create dir if does not exists. -- if (!fDir.exists()) { -- fDir.mkdir(); -- } -- -- // Make sure directory exists. -- if (!fDir.exists() || !fDir.isDirectory()) { -- appendToStatus( "The directory " + certDir + " does not exists."); -- bOk = false; -- } -- -- // Make sure we can write to it. -- if (bOk) { -- if (!fDir.canWrite()) { -- appendToStatus("Can't write to " + certDir); -- bOk = false; -- } -- } -- -- return bOk; -- } -- -- protected boolean verifyPassword(String password, String password2) { -- boolean bOk; -- bOk = false; -- -- if (password.compareTo(password2) != 0) { -- appendToStatus("The passphrase do not match."); -- } -- else { -- if (password.length() < 4) { -- appendToStatus("The passphrase is too short, needs to be at least 4 chars"); -- } -- else { -- bOk = true; -- } -- } -- return bOk; -- } -- -- protected boolean checkCertsExists() { -- boolean bOk = true; -- -- boolean bFileExists = true; -- File f = new File(userKeyFile); -- if (!f.exists()) { -- appendToStatus(userKeyFile + " does not exists"); -- bFileExists = false; -- } -- f = new File(userCertFile); -- if (!f.exists()) { -- appendToStatus(userCertFile + " does not exists"); -- bFileExists = false; -- } -- -- if (!bFileExists) { -- appendToStatus("Looks like you do not have credentials installed."); -- appendToStatus("Please use the Certificate Request Applet to request a certificate."); -- bOk = false; -- } -- return bOk; -- } -- -- /** -- * Check if the given CA file is installed. -- */ -- protected boolean caFileInstalled( String caFileName ){ -- System.out.println("Entering caFileInstalled with: " + caFileName); -- boolean isCAInstalled = false; -- // Get the CA locations, this may return directories or file paths. -- String caCertLocations = cogProps.getCaCertLocations(); -- if (caCertLocations != null) { -- StringTokenizer s = new StringTokenizer(caCertLocations,","); -- while (s.hasMoreTokens()) { -- // Get the next dir or file. -- String caCertLocation = s.nextToken(); -- System.out.println("Checking caCertLocation: " + caCertLocation); -- File fLocation = new File(caCertLocation); -- if (fLocation.exists()) { -- if (fLocation.isDirectory()) { -- System.out.println("caCertLocation: " + caCertLocation + " is a directory"); -- // If it's a directory check its content for the CA we are looking for. -- String[] dirContent = fLocation.list(); -- for ( int i=0; i 0){ -- out.write(buffer,0,bytes); -- bytes = in.read(buffer); -- } -- in.close(); -- out.close(); -- } -- catch (FileNotFoundException e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } catch (IOException e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } -- } -- -- protected void handleCAInstallation() { -- StringTokenizer s = new StringTokenizer(caCertFiles,","); -- while(s.hasMoreTokens()){ -- String caCertFile = s.nextToken(); -- // Remove ".0" from cert file name and append .signing_policy -- String caSigningPolicy = caCertFile.substring(0, caCertFile.length() - 2) + ".signing_policy"; -- -- // If CA not installed install it now. -- if (caFileInstalled(caCertFile) && caFileInstalled(caSigningPolicy)){ -- appendToStatus("CA certificate already installed."); -- } -- else { -- // Get URL to cert file contain in jar. -- URL cacertURL = this.getClass().getResource("/cacerts/" + caCertFile); -- URL caSigningPolicyURL = this.getClass().getResource("/cacerts/" + caSigningPolicy ); -- if (cacertURL != null && caSigningPolicyURL != null) { -- installCAFile(caSigningPolicyURL); -- installCAFile(cacertURL); -- appendToStatus("Installed the " + caCertFile + " CA certificate and signing policy."); -- } -- else{ -- appendToStatus("Could not locate " + caCertFile + " CA certificate or its signing policy file in jar."); -- } -- } -- } -- } -- -- private boolean confirmedEmailOperation(String to, String from, String subject, String content){ -- boolean confirmation = false; -- -- //StringTokenizer tokens = new StringTokenizer(content,"\n"); -- -- String[] messages = new String[4];// + tokens.countTokens()]; -- messages[0] = "Are you sure you want to send this email?"; -- messages[1] = "to : " + to; -- messages[2] = "from : " + from; -- messages[3] = "subject : " + subject; -- /*int i = 4; -- while(tokens.hasMoreTokens()){ -- messages[i] = tokens.nextToken(); -- i++; -- }*/ -- -- Container container = this.getParent(); -- while (! (container instanceof Frame)) container = container.getParent(); -- Frame parent = (Frame) container; -- -- EmailConfirmationDialog d = new EmailConfirmationDialog(parent, messages, content); -- d.setModal(true); -- d.show(); -- appendToStatus("Confirmation " + d.getConfirmation() ); -- confirmation = d.getConfirmation(); -- return confirmation; -- } -- --} -- -- --class EmailConfirmationDialog extends Dialog implements ActionListener { -- -- private boolean confirmed = false; -- -- public boolean getConfirmation(){ -- return confirmed; -- } -- -- public EmailConfirmationDialog(Frame parent, String[] messages, String textArea) { -- -- super(parent, true); -- setTitle("Confirmation Dialog"); -- -- Font font = new Font("Courier", Font.PLAIN, 12); -- setFont(font); -- -- int rows = messages.length; -- Panel textPanel = new Panel(); -- textPanel.setLayout(new GridLayout(rows,1)); -- for(int i = 0; i < rows; i++){ -- textPanel.add(new Label(messages[i])); -- } -- add("North", textPanel); -- -- Panel textAreaPanel = new Panel(); -- TextArea ta = new TextArea(12,60); -- ta.setText(textArea); -- textAreaPanel.add(ta); -- add("Center", textAreaPanel); -- -- Panel p = new Panel(); -- p.setLayout(new FlowLayout()); -- Button yes = new Button("Yes"); -- yes.addActionListener(this); -- p.add(yes); -- Button no = new Button("No"); -- no.addActionListener(this); -- p.add(no); -- add("South", p); -- -- setLocation(100, 200); -- pack(); -- -- } -- -- public void actionPerformed(ActionEvent e) { -- this.hide(); -- this.dispose(); -- -- if (e.getActionCommand() == "Yes") { -- confirmed = true; -- } -- } -- --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/management/CertReqApplet.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/management/CertReqApplet.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/management/CertReqApplet.java (working copy) -@@ -1,412 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/** -- * Copyright (c) 2003, National Research Council of Canada -- * All rights reserved. -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy of this -- * software and associated documentation files (the "Software"), to deal in the Software -- * without restriction, including without limitation the rights to use, copy, modify, merge, -- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the -- * Software is furnished to do so, subject to the following conditions: -- * -- * The above copyright notice(s) and this licence appear in all copies of the Software or -- * substantial portions of the Software, and that both the above copyright notice(s) and this -- * license appear in supporting documentation. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE -- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE -- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL -- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE -- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * Except as contained in this notice, the name of a copyright holder shall NOT be used in -- * advertising or otherwise to promote the sale, use or other dealings in this Software -- * without specific prior written authorization. Title to copyright in this software and any -- * associated documentation will at all times remain with copyright holders. -- */ -- --package org.globus.cog.security.cert.management; -- --import java.awt.Button; --import java.awt.FlowLayout; --import java.awt.Font; --import java.awt.GridBagConstraints; --import java.awt.GridBagLayout; --import java.awt.GridLayout; --import java.awt.Label; --import java.awt.Panel; --import java.awt.TextField; --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; --import java.io.BufferedReader; --import java.io.File; --import java.io.FileInputStream; --import java.io.FileNotFoundException; --import java.io.IOException; --import java.io.InputStreamReader; --import java.net.InetAddress; --import java.net.UnknownHostException; --import java.util.StringTokenizer; -- --import org.globus.cog.security.cert.request.GridCertRequest; -- --/** -- * @author Jean-Claude Cote -- */ -- --public class CertReqApplet extends GIPApplet implements ActionListener { -- -- private static final String PROPERTY_FILE = "CertRequestApplet"; -- // Values configured by property file. -- private String emailSubject = null; -- private String genAction = null; -- private String mailRequest = null; -- -- private String countryNameLabel = "Country Name"; -- private String organizationLabel = "Organization"; -- private String organizationalUnitLabel = "Organizational Unit"; -- private String nameLabel = "Name"; -- private String passPhraseLabel = "PassPhrase"; -- private String confirmPassPhraseLabel = "Confirm PassPhrase"; -- private String yourEmailAddressLabel = "Your e-mail address"; -- private String serviceLabel = "Service"; -- private String hostLabel = "Host"; -- -- -- // UI elements. -- private Button mailButton = null; -- private Button genButton = null; -- private TextField passwordField = new TextField(); -- private TextField passwordConfField = new TextField(); -- private TextField countryField = new TextField("CA"); -- private TextField organizationField = new TextField("Grid"); -- private TextField organizationUnitField = new TextField(); -- private TextField nameField = new TextField(); -- private TextField hostField = new TextField(); -- private TextField serviceField = new TextField(); -- private String certReqFileContent = ""; -- private TextField fromField = new TextField(); -- -- String country = ""; -- String organization = ""; -- String organizationUnit = ""; -- String name = ""; -- String host = ""; -- String service = "host"; // ldap -- private boolean bHostCertReq = false; -- -- public void init() { -- super.init(); -- -- // Get param values. -- -- // Set certtype -- String type = getParameter("certificateRequestType"); -- if (type != null && type.length() > 0) { -- if (type.equalsIgnoreCase("host")){ -- bHostCertReq = true; -- } -- } -- -- // Try to find the FQDN. -- InetAddress inetAdd = null; -- try { -- inetAdd = InetAddress.getLocalHost(); -- } -- catch (UnknownHostException e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } -- String hostName = inetAdd.getCanonicalHostName(); -- System.out.println("GetCanonicalHostName returned: " + hostName); -- if (hostName != null && hostName.length() > 0){ -- StringTokenizer tokens = new StringTokenizer(hostName, "."); -- if(tokens.countTokens() > 3){ -- if (bHostCertReq){ -- host = hostName; -- } -- else{ -- String hostDomain = hostName.substring(hostName.indexOf(".") + 1,hostName.length()); -- organizationUnit = hostDomain; -- } -- } -- } -- -- -- genAction = getLocString("GenerateRequestAction"); -- mailRequest = getLocString("MailRequestAction"); -- -- // Setup UI. -- mailButton = new Button(mailRequest); -- genButton = new Button(genAction); -- -- Panel titlePanel = null; -- if (appletTitle.length() > 0) { -- titlePanel = new Panel(); -- titlePanel.add(new Label(appletTitle)); -- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); -- titlePanel.setBackground(bgColor); -- } -- -- Panel inputPanel = new Panel(); -- inputPanel.add(new Label(countryNameLabel)); -- inputPanel.add(countryField); -- inputPanel.add(new Label(organizationLabel)); -- inputPanel.add(organizationField); -- if (bHostCertReq){ -- inputPanel.add(new Label(hostLabel)); -- hostField.setText(host); -- inputPanel.add(hostField); -- inputPanel.add(new Label(serviceLabel)); -- serviceField.setText(service); -- inputPanel.add(serviceField); -- } -- else{ -- inputPanel.add(new Label(organizationalUnitLabel)); -- organizationUnitField.setText(organizationUnit); -- inputPanel.add(organizationUnitField); -- inputPanel.add(new Label(nameLabel)); -- nameField.setText(name); -- inputPanel.add(nameField); -- inputPanel.add(new Label(passPhraseLabel)); -- passwordField.setEchoChar('*'); -- inputPanel.add(passwordField); -- inputPanel.add(new Label(confirmPassPhraseLabel)); -- inputPanel.add(passwordConfField); -- passwordConfField.setEchoChar('*'); -- } -- inputPanel.add(new Label(yourEmailAddressLabel)); -- inputPanel.add(fromField); -- inputPanel.setLayout(new GridLayout(0, 2)); -- inputPanel.setBackground(bgColor); -- -- Panel buttonPanel = new Panel(); -- genButton.addActionListener(this); -- buttonPanel.add(genButton); -- mailButton.addActionListener(this); -- buttonPanel.add(mailButton); -- buttonPanel.setLayout(new FlowLayout()); -- -- Panel statusPanel = new Panel(); -- Font font = new Font("Courier", Font.PLAIN, 12); -- status.setFont(font); -- statusPanel.add(status); -- -- Panel mainPanel = new Panel(); -- GridBagLayout gridbag = new GridBagLayout(); -- GridBagConstraints c = new GridBagConstraints(); -- if (titlePanel != null) { -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(titlePanel, c); -- mainPanel.add(titlePanel); -- } -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(inputPanel, c); -- mainPanel.add(inputPanel); -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(buttonPanel, c); -- mainPanel.add(buttonPanel); -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(statusPanel, c); -- mainPanel.add(statusPanel); -- mainPanel.setLayout(gridbag); -- -- this.add(mainPanel); -- this.setBackground(bgColor); -- } -- -- public void actionPerformed(ActionEvent e) { -- -- boolean bOk = true; -- -- if (debug){ -- this.doDebugTests(); -- } -- -- country = countryField.getText(); -- organization = organizationField.getText(); -- organizationUnit = organizationUnitField.getText(); -- name = nameField.getText(); -- host = hostField.getText(); -- service = serviceField.getText(); -- String from = fromField.getText(); -- -- try { -- if (bOk) { -- -- if (bHostCertReq){ -- // Reset the cert file loc to user loc -- // need to do this since we may have changed the loc base on the type of service. -- resetCertFileLoc(); -- -- if(service.length() == 0){ -- service = "host"; -- } -- name = service + "/" + host; -- organizationUnit = name.substring(name.indexOf(".") + 1,name.length()); -- int i = userCertFile.lastIndexOf("user"); -- userCertFile = userCertFile.substring(0, i) + service + userCertFile.substring(i + 4, userCertFile.length()); -- userKeyFile = userKeyFile.substring(0, i) + service + userKeyFile.substring(i + 4, userKeyFile.length()); -- userCertReqFile = userCertReqFile.substring(0, i) + service + userCertReqFile.substring(i + 4, userCertReqFile.length()); -- } -- } -- -- if (e.getActionCommand() == genAction) { -- -- bOk = checkCertDir(); -- -- -- // Check not to overwrite any of these files. -- if (bOk) { -- bOk = checkCertsDoNotExists(); -- } -- -- String password = ""; -- if (bOk) { -- if (!bHostCertReq) { -- password = passwordField.getText(); -- String password2 = passwordConfField.getText(); -- bOk = verifyPassword(password, password2); -- } -- } -- -- -- // Generate cert request. -- if (bOk) { -- String cn = -- "C=" -- + country -- + ",O=" -- + organization -- + ",OU=" -- + organizationUnit -- + ",CN=" -- + name; -- -- appendToStatus("Generating cert request for: " + cn); -- appendToStatus("Writing new private key to " + userKeyFile); -- GridCertRequest.genCertificateRequest( -- cn, -- emailAddressOfCA, -- password, -- userKeyFile, -- userCertFile, -- userCertReqFile); -- certReqFileContent = readCertReqFile(userCertReqFile); -- appendToStatus(certReqFileContent); -- } -- } else if (e.getActionCommand() == mailRequest) { -- -- // Get recipient's email address. -- if (bOk) { -- if (from.length() == 0) { -- appendToStatus("Please specify your e-mail address."); -- bOk = false; -- } -- } -- -- // Get request from file if we generated it at an earlier date. -- if (bOk && certReqFileContent.length() == 0) { -- certReqFileContent = readCertReqFile(userCertReqFile); -- } -- -- // Send the request to the CA. -- if (bOk && certReqFileContent.length() != 0) { -- if (sendMail(from, certReqFileContent)) { -- appendToStatus("Your request has been mailed to " + emailAddressOfCA ); -- } -- } -- } else { -- appendToStatus("Error: Unknown action " + e.getActionCommand() ); -- } -- } catch (Exception ex) { -- // Write exection to Java console. -- ex.printStackTrace(); -- -- // Write exception to status area. -- String message = ex.getMessage() + "\n"; -- StackTraceElement[] stackElements = ex.getStackTrace(); -- for (int i = 0; i < stackElements.length; i++) { -- message += stackElements[i].toString() + "\n"; -- } -- appendToStatus(message); -- } -- } -- -- private boolean checkCertsDoNotExists() { -- boolean bFileExists = false; -- File f = new File(userKeyFile); -- if (f.exists()) { -- appendToStatus(userKeyFile + " exists"); -- bFileExists = true; -- } -- f = new File(userCertFile); -- if (f.exists()) { -- appendToStatus(userCertFile + " exists"); -- bFileExists = true; -- } -- f = new File(userCertReqFile); -- if (f.exists()) { -- appendToStatus(userCertReqFile + " exists"); -- bFileExists = true; -- } -- -- if (bFileExists) { -- appendToStatus("Looks like you already have credential."); -- appendToStatus("If you wish to create new ones you will need to move them to another location."); -- } -- return !bFileExists; -- } -- -- private String readCertReqFile( -- String userCertReqFile) -- throws FileNotFoundException, IOException { -- -- File fUserCertReqFile = new File(userCertReqFile); -- if (!fUserCertReqFile.exists() || !fUserCertReqFile.canRead()) { -- appendToStatus( -- "Can't read certificate request file: " + userCertReqFile); -- return ""; -- } -- -- String certReqData = ""; -- BufferedReader in = -- new BufferedReader( -- new InputStreamReader(new FileInputStream(userCertReqFile))); -- String sLine = in.readLine(); -- while (sLine != null) { -- certReqData += sLine + "\n"; -- sLine = in.readLine(); -- } -- in.close(); -- -- return certReqData; -- } -- -- /* (non-Javadoc) -- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() -- */ -- protected String getPropertyFileName() { -- // TODO Auto-generated method stub -- return PROPERTY_FILE; -- } --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/management/CertDestroyApplet.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/management/CertDestroyApplet.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/management/CertDestroyApplet.java (working copy) -@@ -1,387 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/** -- * Copyright (c) 2003, National Research Council of Canada -- * All rights reserved. -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy of this -- * software and associated documentation files (the "Software"), to deal in the Software -- * without restriction, including without limitation the rights to use, copy, modify, merge, -- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the -- * Software is furnished to do so, subject to the following conditions: -- * -- * The above copyright notice(s) and this licence appear in all copies of the Software or -- * substantial portions of the Software, and that both the above copyright notice(s) and this -- * license appear in supporting documentation. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE -- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE -- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL -- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE -- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * Except as contained in this notice, the name of a copyright holder shall NOT be used in -- * advertising or otherwise to promote the sale, use or other dealings in this Software -- * without specific prior written authorization. Title to copyright in this software and any -- * associated documentation will at all times remain with copyright holders. -- */ -- --package org.globus.cog.security.cert.management; -- --import java.awt.Button; --import java.awt.Container; --import java.awt.Dialog; --import java.awt.FlowLayout; --import java.awt.Font; --import java.awt.Frame; --import java.awt.GridBagConstraints; --import java.awt.GridBagLayout; --import java.awt.GridLayout; --import java.awt.Label; --import java.awt.Panel; --import java.awt.TextField; --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; --import java.io.File; --import java.io.IOException; --import java.security.GeneralSecurityException; --import java.security.cert.X509Certificate; -- --import org.globus.gsi.CertUtil; --import org.globus.gsi.OpenSSLKey; --import org.globus.gsi.bc.BouncyCastleOpenSSLKey; -- --/** -- * @author Jean-Claude Cote -- */ --public class CertDestroyApplet extends GIPApplet implements ActionListener { -- -- private static final String PROPERTY_FILE = "CertDestroyApplet"; -- // Values configured by property file. -- private String destroyCredential = null; -- private String mailNotification = null; -- -- private String passPhraseLabel = "PassPhrase"; -- private String yourEmailAddressLabel = "Your e-mail address"; -- -- -- // UI elements. -- private Button mailNotificationButton = null; -- private Button destroyCredentialButton = null; -- private TextField passwordField = new TextField(); -- private TextField fromField = new TextField(); -- -- private X509Certificate cert = null; -- -- -- public void init() { -- super.init(); -- -- destroyCredential = getLocString("DestroyCredential"); -- mailNotification = getLocString("NotifyCA"); -- -- // Setup UI. -- mailNotificationButton = new Button(mailNotification); -- destroyCredentialButton = new Button(destroyCredential); -- -- -- Panel titlePanel = null; -- if (appletTitle.length() > 0) { -- titlePanel = new Panel(); -- titlePanel.add(new Label(appletTitle)); -- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); -- titlePanel.setBackground(bgColor); -- } -- -- Panel inputPanel = new Panel(); -- inputPanel.add(new Label(passPhraseLabel)); -- passwordField.setEchoChar('*'); -- inputPanel.add(passwordField); -- inputPanel.add(new Label(yourEmailAddressLabel)); -- inputPanel.add(fromField); -- inputPanel.setLayout(new GridLayout(0, 2)); -- inputPanel.setBackground(bgColor); -- -- Panel buttonPanel = new Panel(); -- destroyCredentialButton.addActionListener(this); -- buttonPanel.add(destroyCredentialButton); -- mailNotificationButton.addActionListener(this); -- buttonPanel.add(mailNotificationButton); -- buttonPanel.setLayout(new FlowLayout()); -- -- Panel statusPanel = new Panel(); -- Font font = new Font("Courier", Font.PLAIN, 12); -- status.setFont(font); -- statusPanel.add(status); -- -- Panel mainPanel = new Panel(); -- GridBagLayout gridbag = new GridBagLayout(); -- GridBagConstraints c = new GridBagConstraints(); -- if (titlePanel != null) { -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(titlePanel, c); -- mainPanel.add(titlePanel); -- } -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(inputPanel, c); -- mainPanel.add(inputPanel); -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(buttonPanel, c); -- mainPanel.add(buttonPanel); -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(statusPanel, c); -- mainPanel.add(statusPanel); -- mainPanel.setLayout(gridbag); -- -- this.add(mainPanel); -- this.setBackground(bgColor); -- } -- -- public void actionPerformed(ActionEvent actionEvent) { -- -- boolean bOk = true; -- -- try { -- // Load cert. -- if (cert == null){ -- try { -- cert = CertUtil.loadCertificate(userCertFile); -- } -- catch (IOException e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- bOk = false; -- } -- catch (GeneralSecurityException e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- bOk = false; -- } -- } -- -- if (actionEvent.getActionCommand() == destroyCredential) { -- -- String keyPassword = passwordField.getText(); -- -- try { -- OpenSSLKey key = new BouncyCastleOpenSSLKey(userKeyFile); -- -- if (key.isEncrypted()) { -- key.decrypt(keyPassword); -- } -- } catch(IOException e1) { -- appendToStatus("Error: Failed to load key: " + userKeyFile); -- appendToStatus("Make sure you have a valide private key installed."); -- e1.printStackTrace(); -- bOk = false; -- } catch(GeneralSecurityException e2) { -- appendToStatus("Error: Wrong grid pass phrase!"); -- e2.printStackTrace(); -- bOk = false; -- } -- -- if (bOk){ -- boolean confirmed = confirmAction(); -- -- if (confirmed) { -- File f = new File(userKeyFile); -- if (f.exists()) { -- if( f.delete() ){ -- appendToStatus(userKeyFile + " deleted."); -- } -- else{ -- appendToStatus("Error: Could not delete " + userKeyFile); -- } -- } -- else{ -- appendToStatus("Error: " + userKeyFile + " does not exists."); -- } -- f = new File(userCertFile); -- if (f.exists()) { -- if( f.delete() ){ -- appendToStatus(userCertFile + " deleted."); -- } -- else{ -- appendToStatus("Error: Could not delete " + userCertFile); -- } -- } -- else{ -- appendToStatus("Error: " + userCertFile + " does not exists."); -- } -- f = new File(userCertReqFile); -- if (f.exists()) { -- if( f.delete() ){ -- appendToStatus(userCertReqFile + " deleted."); -- } -- else{ -- appendToStatus("Error: Could not delete " + userCertReqFile); -- } -- } -- else{ -- appendToStatus("Error: " + userCertReqFile + " does not exists."); -- } -- } -- } -- } else if (actionEvent.getActionCommand() == mailNotification) { -- -- // Get recipient's email address. -- if (bOk) { -- if (fromField.getText().length() == 0) { -- appendToStatus("Please specify your e-mail address."); -- bOk = false; -- } -- } -- -- if (bOk){ -- String notificationEmail = buildNotificationEmail(); -- -- // Send the request to the CA. -- if (notificationEmail.length() > 0) { -- if (sendMail(fromField.getText(), notificationEmail)) { -- appendToStatus("Your notification has been mailed to " + emailAddressOfCA ); -- } -- } -- } -- -- } else { -- appendToStatus("Error: Unknown action " + actionEvent.getActionCommand() ); -- } -- } catch (Exception ex) { -- // Write exection to Java console. -- ex.printStackTrace(); -- -- // Write exception to status area. -- String message = ex.getMessage() + "\n"; -- StackTraceElement[] stackElements = ex.getStackTrace(); -- for (int i = 0; i < stackElements.length; i++) { -- message += stackElements[i].toString() + "\n"; -- } -- appendToStatus(message); -- } -- } -- -- private String buildNotificationEmail(){ -- return "\n\n" -- + "Plase revoke my certificate\n" -- + "\n" -- + "==================================================================\n" -- + "\n" -- + "subject : " + cert.getSubjectDN().getName() -- + "\n" -- + "issuer : " + cert.getIssuerDN().getName() -- + "\n" -- + "start date : " + cert.getNotBefore().toString() -- + "\n" -- + "end date : " + cert.getNotAfter().toString() -- + "\n" -- + "==================================================================\n"; -- } -- -- public boolean confirmAction(){ -- boolean confirmation = false; -- -- String[] messages = new String[5]; -- messages[0] = "Are you sure you want to destroy this certificate?"; -- String dn = null; -- dn = cert.getSubjectDN().getName(); -- messages[1] = "subject : " + dn; -- dn = cert.getIssuerDN().getName(); -- messages[2] = "issuer : " + dn; -- String dt = null; -- dt = cert.getNotBefore().toString(); -- messages[3] = "start date : " + dt; -- dt = cert.getNotAfter().toString(); -- messages[4] = "end date : " + dt; -- -- Container container = this.getParent(); -- while (! (container instanceof Frame)) container = container.getParent(); -- Frame parent = (Frame) container; -- -- ConfirmationDialog d = new ConfirmationDialog(parent, messages); -- d.setModal(true); -- d.show(); -- appendToStatus("Confirmation " + d.getConfirmation() ); -- confirmation = d.getConfirmation(); -- return confirmation; -- } -- -- /* (non-Javadoc) -- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() -- */ -- protected String getPropertyFileName() { -- // TODO Auto-generated method stub -- return PROPERTY_FILE; -- } -- -- --} -- -- --class ConfirmationDialog extends Dialog implements ActionListener { -- -- private boolean confirmed = false; -- -- public boolean getConfirmation(){ -- return confirmed; -- } -- -- public ConfirmationDialog(Frame parent, String[] messages) { -- -- super(parent, true); -- setTitle("Confirmation Dialog"); -- -- Font font = new Font("Courier", Font.PLAIN, 12); -- setFont(font); -- -- int rows = messages.length; -- Panel textPanel = new Panel(); -- textPanel.setLayout(new GridLayout(rows,1)); -- for(int i = 0; i < rows; i++){ -- textPanel.add(new Label(messages[i])); -- } -- add("Center", textPanel); -- -- Panel p = new Panel(); -- p.setLayout(new FlowLayout()); -- Button yes = new Button("Yes"); -- yes.addActionListener(this); -- p.add(yes); -- Button no = new Button("No"); -- no.addActionListener(this); -- p.add(no); -- add("South", p); -- -- setSize(300, 100); -- setLocation(100, 200); -- pack(); -- -- } -- -- public void actionPerformed(ActionEvent e) { -- this.hide(); -- this.dispose(); -- -- if (e.getActionCommand() == "Yes") { -- confirmed = true; -- } -- } -- --} -Index: modules/certmanagement/src/org/globus/cog/security/cert/management/MyProxyApplet.java -=================================================================== ---- modules/certmanagement/src/org/globus/cog/security/cert/management/MyProxyApplet.java (revision 3296) -+++ modules/certmanagement/src/org/globus/cog/security/cert/management/MyProxyApplet.java (working copy) -@@ -1,387 +0,0 @@ -- --// ---------------------------------------------------------------------- --// This code is developed as part of the Java CoG Kit project --// The terms of the license can be found at http://www.cogkit.org/license --// This message may not be removed or altered. --// ---------------------------------------------------------------------- -- --/** -- * Copyright (c) 2003, National Research Council of Canada -- * All rights reserved. -- * -- * Permission is hereby granted, free of charge, to any person obtaining a copy of this -- * software and associated documentation files (the "Software"), to deal in the Software -- * without restriction, including without limitation the rights to use, copy, modify, merge, -- * publish, distribute, and/or sell copies of the Software, and to permit persons to whom the -- * Software is furnished to do so, subject to the following conditions: -- * -- * The above copyright notice(s) and this licence appear in all copies of the Software or -- * substantial portions of the Software, and that both the above copyright notice(s) and this -- * license appear in supporting documentation. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -- * NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE -- * COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE -- * FOR ANY CLAIM, OR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL -- * DAMAGES, OR ANY DAMAGES WHATSOEVER (INCLUDING, BUT NOT -- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS -- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWSOEVER -- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -- * OTHERWISE) ARISING IN ANY WAY OUT OF OR IN CONNECTION WITH THE -- * SOFTWARE OR THE USE OF THE SOFTWARE, EVEN IF ADVISED OF THE -- * POSSIBILITY OF SUCH DAMAGE. -- * -- * Except as contained in this notice, the name of a copyright holder shall NOT be used in -- * advertising or otherwise to promote the sale, use or other dealings in this Software -- * without specific prior written authorization. Title to copyright in this software and any -- * associated documentation will at all times remain with copyright holders. -- */ -- --package org.globus.cog.security.cert.management; -- --import java.awt.Button; --import java.awt.FlowLayout; --import java.awt.Font; --import java.awt.GridBagConstraints; --import java.awt.GridBagLayout; --import java.awt.GridLayout; --import java.awt.Label; --import java.awt.Panel; --import java.awt.TextField; --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; --import java.io.File; --import java.io.FileOutputStream; --import java.io.OutputStream; -- --import org.globus.gsi.CertUtil; --import org.globus.myproxy.CredentialInfo; --import org.globus.myproxy.MyProxy; --import org.globus.myproxy.MyProxyException; --import org.globus.util.Util; --import org.gridforum.jgss.ExtendedGSSCredential; --import org.ietf.jgss.GSSCredential; -- --/** -- * @author Jean-Claude Cote -- */ -- --public class MyProxyApplet extends GIPApplet implements ActionListener { -- -- private static final int KEY_LENGTH = 512; -- private static final int MYPROXY_SERVER_PORT = 7512; -- public static final int PORTAL_LIFETIME_HOURS = 2; -- private static final String PROPERTY_FILE = "MyProxyApplet"; -- private int credLifetimeNumDays = 7; -- -- // Values configured by property file. -- private String putAction = null; -- private String getAction = null; -- private String infoAction = null; -- private String destroyAction = null; -- private String myProxyHostLabel = null; -- private String myProxyAccountNameLabel = null; -- private String gridPassPhraseLabel = null; -- private String myProxyPassPhraseLabel = null; -- private String myProxyPassPhraseConfirmationLabel = null; -- -- -- private Button putButton = null; -- private Button infoButton = null; -- private Button destroyButton = null; -- private Button getButton = null; -- private TextField myProxyHost = new TextField(); -- private TextField myProxyUserNameField = new TextField(); -- private TextField keyPasswordField = new TextField(); -- private TextField myproxyPasswordField = new TextField(); -- private TextField myproxyPasswordFieldConfirmation = new TextField(); -- private TextField lifetimeField = new TextField("7"); -- private String hostname = null; -- private String username = null; -- private String keyPassword = null; -- private String myproxyPassword = null; -- private GSSCredential credential = null; -- -- -- public void init(){ -- super.init(); -- // set host name. -- String host = getParameter("myProxyHost"); -- if (host != null && host.length() > 0) { -- myProxyHost.setText(getParameter("myProxyHost")); -- } -- -- getAction = getLocString("getAction"); -- putAction = getLocString("putAction"); -- infoAction = getLocString("infoAction"); -- destroyAction = getLocString("destroyAction"); -- -- // Setup UI. -- putButton = new Button(putAction); -- infoButton = new Button(infoAction); -- getButton = new Button(getAction); -- destroyButton = new Button(destroyAction); -- -- Panel titlePanel = null; -- if (appletTitle.length() > 0) { -- titlePanel = new Panel(); -- titlePanel.add(new Label(appletTitle)); -- titlePanel.setFont(new Font("Arial", Font.BOLD, 24)); -- titlePanel.setBackground(bgColor); -- } -- -- Panel inputPanel = new Panel(); -- inputPanel.add(new Label(getLocString("MyProxy_host"))); -- inputPanel.add(myProxyHost); -- inputPanel.add(new Label(getLocString("MyProxy_Account_Name"))); -- inputPanel.add(myProxyUserNameField); -- inputPanel.add(new Label(getLocString("Grid_PassPhrase"))); -- keyPasswordField.setEchoChar('*'); -- inputPanel.add(keyPasswordField); -- inputPanel.add(new Label(getLocString("MyProxy_PassPhrase"))); -- myproxyPasswordField.setEchoChar('*'); -- inputPanel.add(myproxyPasswordField); -- inputPanel.add(new Label(getLocString("MyProxy_PassPhrase_Confirmation"))); -- myproxyPasswordFieldConfirmation.setEchoChar('*'); -- inputPanel.add(myproxyPasswordFieldConfirmation); -- inputPanel.add(new Label(getLocString("Lifetime"))); -- inputPanel.add(lifetimeField); -- inputPanel.setLayout(new GridLayout(0, 2)); -- inputPanel.setBackground(bgColor); -- -- Panel buttonPanel = new Panel(); -- putButton.addActionListener(this); -- buttonPanel.add(putButton); -- infoButton.addActionListener(this); -- buttonPanel.add(infoButton); -- getButton.addActionListener(this); -- buttonPanel.add(getButton); -- destroyButton.addActionListener(this); -- buttonPanel.add(destroyButton); -- buttonPanel.setLayout(new FlowLayout()); -- -- Panel statusPanel = new Panel(); -- Font font = new Font("Courier", Font.PLAIN, 12); -- status.setFont(font); -- statusPanel.add(status); -- -- Panel mainPanel = new Panel(); -- GridBagLayout gridbag = new GridBagLayout(); -- GridBagConstraints c = new GridBagConstraints(); -- if (titlePanel != null) { -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(titlePanel, c); -- mainPanel.add(titlePanel); -- } -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(inputPanel, c); -- mainPanel.add(inputPanel); -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(buttonPanel, c); -- mainPanel.add(buttonPanel); -- c.weightx = 1.0; -- c.gridwidth = GridBagConstraints.REMAINDER; //end row -- gridbag.setConstraints(statusPanel, c); -- mainPanel.add(statusPanel); -- mainPanel.setLayout(gridbag); -- -- this.add(mainPanel); -- this.setBackground(bgColor); -- } -- -- public void actionPerformed(ActionEvent e) { -- if(debug){ -- doDebugTests(); -- } -- -- keyPassword = keyPasswordField.getText(); -- hostname = myProxyHost.getText(); -- username = myProxyUserNameField.getText(); -- myproxyPassword = myproxyPasswordField.getText(); -- String myproxyPassword2 = myproxyPasswordFieldConfirmation.getText(); -- String tempLifetimeString = lifetimeField.getText(); -- -- boolean bOk = true; -- -- if (tempLifetimeString.length() == 0 ) { -- tempLifetimeString = "7"; -- } -- -- credLifetimeNumDays = Integer.parseInt(tempLifetimeString); -- -- if (username.length() == 0 ) { -- appendToStatus(getLocString("msg001")); -- bOk = false; -- } -- -- if( bOk ) { -- if (myproxyPassword.compareTo(myproxyPassword2) != 0) { -- appendToStatus(getLocString("msg003")); -- bOk = false; -- } -- else { -- if (myproxyPassword.length() < 5) { -- appendToStatus(getLocString("msg004")); -- bOk = false; -- } -- } -- } -- -- -- if( bOk ) { -- if( e.getActionCommand() == infoAction ) { -- doInfo(); -- } -- else if( e.getActionCommand() == destroyAction ) { -- if( keyPassword.length() == 0) { -- appendToStatus(getLocString("msg002")); -- bOk = false; -- } -- // Check that certs exists. -- if (bOk) { -- bOk = checkCertsExists(); -- } -- doDestroy(); -- } -- else if( e.getActionCommand() == putAction ){ -- if( keyPassword.length() == 0) { -- appendToStatus(getLocString("msg002")); -- bOk = false; -- } -- // Check that certs exists. -- if (bOk) { -- bOk = checkCertsExists(); -- } -- doPut(); -- } -- else if( e.getActionCommand() == getAction ){ -- doGet(); -- } -- else { -- appendToStatus(getLocString("msg005") + e.getActionCommand() ); -- } -- } -- } -- -- private void doGet() { -- int credLifetime = credLifetimeNumDays * 24 * 3600; -- CertUtil.init(); -- MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT); -- if( credential == null && keyPassword.length() > 0){ -- credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH); -- } -- GSSCredential cred = null; -- try { -- cred = myProxy.get(credential, username, myproxyPassword, credLifetime); -- -- // create a file -- String outputFile = cogProps.getProxyFile(); -- File f = new File(outputFile); -- String path = f.getPath(); -- -- OutputStream out = null; -- try { -- out = new FileOutputStream(path); -- // set read only permissions -- Util.setFilePermissions(path, 600); -- // write the contents -- byte [] data = ((ExtendedGSSCredential)cred).export(ExtendedGSSCredential.IMPEXP_OPAQUE); -- out.write(data); -- } -- finally { -- if (out != null) { -- try { out.close(); } catch(Exception e) {} -- } -- } -- -- appendToStatus("A proxy has been received for user " + username + " in " + path); -- -- } -- catch(Exception e) { -- appendExceptionDetailsToStatus(e); -- } -- } -- -- private void doInfo() { -- int credLifetime = credLifetimeNumDays * 24 * 3600; -- CertUtil.init(); -- boolean bInfOk = false; -- MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT); -- if( credential == null && keyPassword.length() > 0){ -- credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH); -- } -- CredentialInfo inf = null; -- try { -- inf = myProxy.info(credential, username, myproxyPassword); -- bInfOk = true; -- } -- catch(MyProxyException e){ -- appendExceptionDetailsToStatus(e); -- } -- if( bInfOk ){ -- appendToStatus(getLocString("msg006") + hostname + " " + inf.getOwner() ); -- } -- } -- -- private void doDestroy() { -- int credLifetime = credLifetimeNumDays * 24 * 3600; -- CertUtil.init(); -- boolean bDestroyOk = false; -- MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT); -- if( credential == null ){ -- credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH); -- } -- if( credential != null ){ -- try { -- myProxy.destroy(credential, username, myproxyPassword); -- bDestroyOk= true; -- } -- catch(MyProxyException e){ -- appendExceptionDetailsToStatus(e); -- } -- if( bDestroyOk){ -- appendToStatus(getLocString("msg007") + username ); -- } -- } -- } -- -- -- private void doPut() { -- int lifetime = PORTAL_LIFETIME_HOURS * 3600; -- int credLifetime = credLifetimeNumDays * 24 * 3600; -- -- CertUtil.init(); -- boolean bPutOk = false; -- MyProxy myProxy = new MyProxy(hostname, MYPROXY_SERVER_PORT); -- if( credential == null ) { -- credential = createNewProxy(keyPassword, credLifetime, KEY_LENGTH); -- } -- if( credential != null ){ -- try { -- myProxy.put(credential, username, myproxyPassword, lifetime); -- bPutOk = true; -- } -- catch(MyProxyException e){ -- appendExceptionDetailsToStatus(e); -- } -- if( bPutOk ){ -- appendToStatus(getLocString("msg008") + credLifetime / 3600 + getLocString("msg009") + (credLifetime / (3600 * 24)) + getLocString("msg010") + username + getLocString("msg011") + hostname + "."); -- } -- } -- } -- -- /* (non-Javadoc) -- * @see ca.gc.nrc.gip.applets.GIPApplet#getPropertyFileLoc() -- */ -- protected String getPropertyFileName() { -- // TODO Auto-generated method stub -- return PROPERTY_FILE; -- } --} -- -Index: modules/certmanagement/applets/CertDestroyApplet.html -=================================================================== ---- modules/certmanagement/applets/CertDestroyApplet.html (revision 3296) -+++ modules/certmanagement/applets/CertDestroyApplet.html (working copy) -@@ -1,49 +0,0 @@ -- -- --

--NRC-CNRC Certificate Revocation Tool --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--Notes:
--
--Jean-Claude Cote
--
-- -- -- -\ No newline at end of file -Index: modules/certmanagement/applets/jce.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/applets/certrenew_applet.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/applets/CertInfoApplet.html -=================================================================== ---- modules/certmanagement/applets/CertInfoApplet.html (revision 3296) -+++ modules/certmanagement/applets/CertInfoApplet.html (working copy) -@@ -1,49 +0,0 @@ -- -- -- --

--NRC-CNRC Certificate Info Tool --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- --Notes:
--
--Jean-Claude Cote
--
-- -- -- -\ No newline at end of file -Index: modules/certmanagement/applets/myproxy.jsp -=================================================================== ---- modules/certmanagement/applets/myproxy.jsp (revision 3296) -+++ modules/certmanagement/applets/myproxy.jsp (working copy) -@@ -1,15 +0,0 @@ -- --

--

-- -- -- -- -- -- -- Plugin tag OBJECT or EMBED not supported by browser. -- -- -- --
--

-\ No newline at end of file -Index: modules/certmanagement/applets/certreq.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/applets/warning.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/applets/certinfo.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/applets/certrenew.jsp -=================================================================== ---- modules/certmanagement/applets/certrenew.jsp (revision 3296) -+++ modules/certmanagement/applets/certrenew.jsp (working copy) -@@ -1,15 +0,0 @@ -- --

--

-- -- -- -- -- -- -- -- Plugin tag OBJECT or EMBED not supported by browser. -- -- --
--

-\ No newline at end of file -Index: modules/certmanagement/applets/certmanagement.html -=================================================================== ---- modules/certmanagement/applets/certmanagement.html (revision 3296) -+++ modules/certmanagement/applets/certmanagement.html (working copy) -@@ -1,87 +0,0 @@ -- -- -- --

Certificate Management Tools

-- --
--The certificate management module is a set of tools that make it easier for users to manage their certificates. For instance there are tools to generate a certificate request, store credential on MyProxy server, view local credential, renew certificates and revoke certificates.
--
--Administrators have to choice of deploying these tools as signed Java Applets and/or as signed Java WebStart Applets.
--
--The benefits of signed Java Applet are integration into web pages however they required Java capable browsers. Java singed WebStart Applets do not have this requirement. The WebStart mechanism also has the advantage of caching the jars used by the applets. One disadvantage to the WebStart mechanism is that the Applet will not integrate into web page.
--
--Both of these deployment methods are appealing because they don?t require any installation of OGSA or CoG by the client. The deployment mechanism will install the necessary jars to run the certificate management tools.
--
-- --
--Applets (html)
--
--These applets are signed by my personal credentials which are certified by Grid Canada CA.
--
--Most browsers come with a list of known CA that they trust. Since Grid Canada CA is not known to your browser you will get a warning "The security certificate was issued by a company that is not trusted". Since we trust Grid Canada simply ignore the warning.
--
--Certificate Request
--Host Certificate Request
--Certificate Information
--MyProxy
--Certificate Renewal
--Certificate Revocation
--
--
--Applets (jsp)
--
--These applets are signed by my personal credentials which are certified by Grid Canada CA.
--
--Most browsers come with a list of known CA that they trust. Since Grid Canada CA is not known to your browser you will get a warning "The security certificate was issued by a company that is not trusted". Since we trust Grid Canada simply ignore the warning.
--
--Certificate Request
--Host Certificate Request
--Certificate Information
--MyProxy
--Certificate Renewal
--Certificate Revocation
--
--
--WebStart Applets
--
--In order for the Java WebStart client to verify the signature of the jars it needs to know the CA that issued the signing certificate to the entity that signed the jars. That means that before using any of the applets a user needs to import the Globus and Sun's "JCE Code Signing CA" certificate authorities into their Java WebStart client.
--
--Download the CA certificates:
--Grid Cadanda CA
--JCE Code Signing CA
--
--Here are the steps to install the CA certificates into Java WebStart:
--
--Start Java WebStart console
--Go to File->Perferences
--Go to Root Certificates
--Click on Import
--Select the file containing the Root Certificate
--Click open and give it a name can be anything
--
--Only then will Java WebStart be able to validate the signature of the jars.
--
--Note: At the moment the jce jar is not signed properly by Bouncy Castle. Once we use the latest jar it will be ok but for the moment you will get a "error parsing certificate" warning dialog. Simply press the X button do not press the abort button.
--
--Certificate Request
--Host Certificate Request
--Certificate Information
--MyProxy
--Certificate Renewal
--Certificate Revocation
--
--
--Readme
--
--
--Jean-Claude Cote
--High Performance Computing / Calcul de haute performance
--National Research Council Canada / Conseil national de recherches Canada
--www.grid.nrc.ca
--
-- -- -- -- -- -- -Index: modules/certmanagement/applets/hostcertreq.jsp -=================================================================== ---- modules/certmanagement/applets/hostcertreq.jsp (revision 3296) -+++ modules/certmanagement/applets/hostcertreq.jsp (working copy) -@@ -1,16 +0,0 @@ -- --

--

-- -- -- -- -- -- -- -- -- Plugin tag OBJECT or EMBED not supported by browser. -- -- --
--

-\ No newline at end of file -Index: modules/certmanagement/applets/JCE Code Signing CA.pem -=================================================================== ---- modules/certmanagement/applets/JCE Code Signing CA.pem (revision 3296) -+++ modules/certmanagement/applets/JCE Code Signing CA.pem (working copy) -@@ -1,19 +0,0 @@ -------BEGIN CERTIFICATE----- --MIIDwDCCA36gAwIBAgIBEDALBgcqhkjOOAQDBQAwgZAxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJD --QTESMBAGA1UEBxMJUGFsbyBBbHRvMR0wGwYDVQQKExRTdW4gTWljcm9zeXN0ZW1zIEluYzEjMCEG --A1UECxMaSmF2YSBTb2Z0d2FyZSBDb2RlIFNpZ25pbmcxHDAaBgNVBAMTE0pDRSBDb2RlIFNpZ25p --bmcgQ0EwHhcNMDEwNDI1MDcwMDAwWhcNMjAwNDI1MDcwMDAwWjCBkDELMAkGA1UEBhMCVVMxCzAJ --BgNVBAgTAkNBMRIwEAYDVQQHEwlQYWxvIEFsdG8xHTAbBgNVBAoTFFN1biBNaWNyb3N5c3RlbXMg --SW5jMSMwIQYDVQQLExpKYXZhIFNvZnR3YXJlIENvZGUgU2lnbmluZzEcMBoGA1UEAxMTSkNFIENv --ZGUgU2lnbmluZyBDQTCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQDrrzcEHspRHmldsPKP9rVJH8ak --mQXXKb90t2r1Gdge5Bv4CgGamP9wq+JKVoZsU7P84ciBjDHwxPOwi+ZwBuz3aWjbg0xyKYkpNhdc --O0oHoCACKkaXUR1wyAgYC84Mbpt29wXj5/vTYXnhYJokjQaVgzxRIOEwzzhXgqYacg3O0wIVAIQl --ReG6ualiq3noWzC4iWsb/3t1AoGBAKvJdHt07+5CtWpTTTvdkAZyaJEPC6Qpdi5VO9WuTWVcfio6 --BKZnptBxqqXXt+LBcg2k0aoeklRMIAAJorAJQRkzALLDXK5C+LGLynyW2BB/N0Rbqsx4yNdydjdr --QJmoVWb6qAMei0oRAmnLTLglBhygd9LJrNI96QoQ+nZwt/vcA4GEAAKBgC0JmFysuJzHmX7uIBkq --NJD516urrt1rcpUNZvjvJ49Esu0oRMf+r7CmJ28AZ0WCWweoVlY70ilRYV5pOdcudHcSzxlK9S3I --y3JhxE5v+kdDPxS7+rwYZijC2WaLei0vwmCSSxT+WD4hf2hivmxISfmgS16FnRkQ+RVFURtx1PcL --o2YwZDARBglghkgBhvhCAQEEBAMCAAcwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBRl4vSG --ydNO8JFOWKJq9dh4WprBpjAdBgNVHQ4EFgQUZeL0hsnTTvCRTliiavXYeFqawaYwCwYHKoZIzjgE --AwUAAy8AMCwCFCr3zzyXXfl4tgjXQbTZDUVM5LScAhRFzXVpDiH6HdazKbLp9zMdM/38SQ== -------END CERTIFICATE----- -Index: modules/certmanagement/applets/certreq.jsp -=================================================================== ---- modules/certmanagement/applets/certreq.jsp (revision 3296) -+++ modules/certmanagement/applets/certreq.jsp (working copy) -@@ -1,15 +0,0 @@ -- --

--

-- -- -- -- -- -- -- -- Plugin tag OBJECT or EMBED not supported by browser. -- -- --
--

-\ No newline at end of file -Index: modules/certmanagement/applets/MyProxyApplet.html -=================================================================== ---- modules/certmanagement/applets/MyProxyApplet.html (revision 3296) -+++ modules/certmanagement/applets/MyProxyApplet.html (working copy) -@@ -1,56 +0,0 @@ -- -- -- --

--NRC-CNRC MyProxy Tool --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--
-- --Notes:
--
--This applet uses the same cog.properties files as the CoG kit.
--
--
--Jean-Claude Cote
--
-- -- -- -\ No newline at end of file -Index: modules/certmanagement/applets/readme.html -=================================================================== ---- modules/certmanagement/applets/readme.html (revision 3296) -+++ modules/certmanagement/applets/readme.html (working copy) -@@ -1,311 +0,0 @@ -- -- -- -- -- -- -- -- -- -- --The certificate management module is a set of tools that make it easier --for users to manage their certificates -- -- -- -- -- -- --
-- --

 

-- --

The --certificate management module is a set of tools that make it easier for users --to manage their certificates. For instance there are tools to generate a --certificate request, store credential on MyProxy server, view local credential, --renew certificates and revoke certificates.

-- --

 

-- --

Administrators --have to choice of deploying these tools as signed Java Applets and/or as signed --Java WebStart Applets.

-- --

 

-- --

The --benefits of signed Java Applet are integration into web pages however they --required Java capable browsers. Java singed WebStart Applets do not have this --requirement. The WebStart mechanism also has the advantage of caching the jars --used by the applets. One disadvantage to the WebStart mechanism is that the --Applet will not integrate into web page.

-- --

 

-- --

Both --of these deployment methods are appealing because they don?t require any --installation of OGSA or CoG by the client. The deployment mechanism will --install the necessary jars to run the certificate management tools.

-- --

 

-- --

This --module consists of .java files for the actual applets and of .jsp and .html --pages to launch the Java Applets and .jnlp files to launch the WebStart --Applets. These files contain parameters that can be changed by an administrator --to change such things as the Certificate Authority, MyProxy server location and --background color of the applet.

-- --

 

-- --

These --applets need to be signed

-- --

 

-- --

(explain --how this is done)

-- --

 

-- --

These applets are --signed by my personal credentials which are certified by Grid Canada CA. The applets --should really be signed by a NRC certificate, issued by Grid Candad CA.
--
--Most browsers come with a list of known CA that they trust. Since Grid Canada --CA is not known to your browser you will get a warning "The security --certificate was issued by a company that is not trusted". But we know Grid --Canada is ok.

-- --

 

-- --

In --order for the Java WebStart client to verify the signature of the jars it needs --to know the CA that issued the signing certificate to the entity that signed --the jars. That means that before using any of the applets a user needs to --import the Globus and Sun's "JCE Code Signing CA" certificate --authorities into their Java WebStart client. Here are the steps to do so:

-- --

 

-- --

Start Java WebStart --console

-- --

Go to --File->Perferences

-- --

Go to Root --Certificates

-- --

Click on Import

-- --

Select the file --containing the Root Certificate

-- --

Click open and give --it a name can be anything

-- --

 

-- --

Only then will Java --WebStart be able to validate the signature of the jars.

-- --

 

-- --

 

-- --

A --user must trust the entity that signed the applets.


-- -- -- -- -- --

 

-- --

At --the moment the jce jar is not signed properly by Bouncy Castle. Once we use the --latest jar it will be ok but for the moment you will get this dialog. Simply --press the X not the abort button.

-- --

 

-- -- -- -- --

 

-- --

Once --the user grants the applets security access it will start.

-- --

 

-- --

The --first step a new grid user will have to do is get credentials. To do this you --need to generate a certificate request and have it signed by your certificate --authority. Use the CertReqApplet to do this:

-- --

 

-- -- -- -- --

 

-- --

(description --of params goes here)

-- --

 

-- --

Once --you get a response from your CA place it in your usercert.pem as described in --the email. You can now use the certificate info applet to see your local --credentials.

-- --

 

-- -- -- -- --

 

-- --

Supposing --you were going away on a business trip you may want to put some temporary --credential on a MyProxy server. See myproxy command line tool for more details --on what this means.

-- --

 

-- -- -- -- --

 

-- --

(description --of params goes here)

-- --

 

-- --

After --a certain amount of time your credential will expire. Before this happens your --CA will send you a renewal notification with a challenge phrase. You can use --the certificate renew applet to generate your renewal request.

-- --

 

-- -- -- -- --

 

-- --

(description --of params goes here)

-- --

 

-- --

 

-- --

If --for some reason your credentials get compromised or you simply don?t need them --anymore you may want to destroy your credentials and notify your CA that you --did so. The certificate revocation applet can be used to delete the certificate --files and notify your CA.

-- --

 

-- -- -- -- --

 

-- --

(description --of params goes here)

-- --

 

-- --

 

-- --

 

-- --

Jean-Claude --Cote

-- --

High --Performance Computing / Calcul de haute performance

-- --

National --Research Council Canada / Conseil national de recherches Canada

-- --

www.grid.nrc.ca

-- --

 

-- --

 

-- --
-- -- -- -- -Index: modules/certmanagement/applets/certdestroy.jsp -=================================================================== ---- modules/certmanagement/applets/certdestroy.jsp (revision 3296) -+++ modules/certmanagement/applets/certdestroy.jsp (working copy) -@@ -1,15 +0,0 @@ -- --

--

-- -- -- -- -- -- -- -- Plugin tag OBJECT or EMBED not supported by browser. -- -- --
--

-\ No newline at end of file -Index: modules/certmanagement/applets/certinfo.jsp -=================================================================== ---- modules/certmanagement/applets/certinfo.jsp (revision 3296) -+++ modules/certmanagement/applets/certinfo.jsp (working copy) -@@ -1,14 +0,0 @@ -- --

--

-- -- -- -- -- -- -- Plugin tag OBJECT or EMBED not supported by browser. -- -- --
--

-\ No newline at end of file -Index: modules/certmanagement/applets/myproxy.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/applets/CertRenewApplet.html -=================================================================== ---- modules/certmanagement/applets/CertRenewApplet.html (revision 3296) -+++ modules/certmanagement/applets/CertRenewApplet.html (working copy) -@@ -1,56 +0,0 @@ -- -- -- --

--NRC-CNRC Certificate Renew Tool --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--Notes:
--This applet uses the same cog.properties files as the CoG kit.
--If you have a cog.properties file it the keys will be generate according to those settings.
--If you do not have a cog.properties file the keys will be generated in your home dir in a directory named ".globus".
--
--To prevent any accidents this applet does not overwrite any existing key files. It is up to the user to move or rename any existing keys.
--
--Jean-Claude Cote
--
-- -- -- -\ No newline at end of file -Index: modules/certmanagement/applets/certrevocation_applet.jpg -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/certmanagement/applets/HostCertReqApplet.html -=================================================================== ---- modules/certmanagement/applets/HostCertReqApplet.html (revision 3296) -+++ modules/certmanagement/applets/HostCertReqApplet.html (working copy) -@@ -1,57 +0,0 @@ -- -- --

--NRC-CNRC Host Certificate Request Tool --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--Notes:
--
--This applet uses the same cog.properties files as the CoG kit.
--If you have a cog.properties file it the keys will be generate according to those settings.
--If you do not have a cog.properties file the keys will be generated in your home dir in a directory named ".globus".
--
--To prevent any accidents this applet does not overwrite any existing key files. It is up to the user to move or rename any existing keys.
--
--Jean-Claude Cote
--
-- -- -- -\ No newline at end of file -Index: modules/certmanagement/applets/CertReqApplet.html -=================================================================== ---- modules/certmanagement/applets/CertReqApplet.html (revision 3296) -+++ modules/certmanagement/applets/CertReqApplet.html (working copy) -@@ -1,55 +0,0 @@ -- -- --

--NRC-CNRC Certificate Request Tool --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
--Notes:
--
--This applet uses the same cog.properties files as the CoG kit.
--If you have a cog.properties file it the keys will be generate according to those settings.
--If you do not have a cog.properties file the keys will be generated in your home dir in a directory named ".globus".
--
--To prevent any accidents this applet does not overwrite any existing key files. It is up to the user to move or rename any existing keys.
--
--Jean-Claude Cote
--
-- -- -- -\ No newline at end of file -Index: modules/certmanagement/resources/cacerts/5f54f417.signing_policy -=================================================================== ---- modules/certmanagement/resources/cacerts/5f54f417.signing_policy (revision 3296) -+++ modules/certmanagement/resources/cacerts/5f54f417.signing_policy (working copy) -@@ -1,33 +0,0 @@ --# ca-signing-policy.conf, see ca-signing-policy.doc for more information --# --# This is the configuration file describing the policy for what CAs are --# allowed to sign whoses certificates. --# --# This file is parsed from start to finish with a given CA and subject --# name. --# subject names may include the following wildcard characters: --# * Matches any number of characters. --# ? Matches any single character. --# --# CA names must be specified (no wildcards). Names containing whitespaces --# must be included in single quotes, e.g. 'Certification Authority'. --# Names must not contain new line symbols. --# The value of condition attribute is represented as a set of regular --# expressions. Each regular expression must be included in double quotes. --# --# This policy file dictates the following policy: --# -The Globus CA can sign Globus certificates --# --# Format: --#------------------------------------------------------------------------ --# token type | def.authority | value --#--------------|---------------|----------------------------------------- --# EACL entry #1| -- -- access_id_CA X509 '/C=CA/O=Grid/CN=Grid Canada CA' -- -- pos_rights globus CA:sign -- -- cond_subjects globus '"/C=CA/O=Grid/*"' -- --# end of EACL -Index: modules/certmanagement/resources/cacerts/5f54f417.0 -=================================================================== ---- modules/certmanagement/resources/cacerts/5f54f417.0 (revision 3296) -+++ modules/certmanagement/resources/cacerts/5f54f417.0 (working copy) -@@ -1,13 +0,0 @@ -------BEGIN CERTIFICATE----- --MIIB3jCCAUegAwIBAgIBADANBgkqhkiG9w0BAQQFADA1MQswCQYDVQQGEwJDQTEN --MAsGA1UEChMER3JpZDEXMBUGA1UEAxMOR3JpZCBDYW5hZGEgQ0EwHhcNMDIwNDEx --MDM1OTI5WhcNMDcwNDEwMDM1OTI5WjA1MQswCQYDVQQGEwJDQTENMAsGA1UEChME --R3JpZDEXMBUGA1UEAxMOR3JpZCBDYW5hZGEgQ0EwgZ8wDQYJKoZIhvcNAQEBBQAD --gY0AMIGJAoGBAKwipADYu61Errh59EhJKA61rVV3eHOn9BwdNrxgkaed8SqZxRz6 --zsoPt0ALRFNNOovgYGzMo8qV4mScl2ONtDdBWDPB+uhJ+okuQUQodA9PzdwgGr3M --SOlDMfWSgoE7rdh/xYKQ7Q4Ddq14NqZYvmCvLfqdK0C/7TkAvJWtdEnnAgMBAAEw --DQYJKoZIhvcNAQEEBQADgYEAhl1IByLyk0+dYKVI69SMMrmGkA965g+op9QF2L1T --tPQUtiP7hliMP6zGgR/LoYMRfWGLPjuW/Wwg8I8VTpGr9JqrsHvS7xcHO5A/l4zF --hTl1ytiQ0eNN3jXjJ6u13fdXF1tmhCeZLQpvNaik+TM0OB64+J0Lf/0m3i+l6feK --oeU= -------END CERTIFICATE----- -Index: modules/certmanagement/resources/cacerts/42864e48.signing_policy -=================================================================== ---- modules/certmanagement/resources/cacerts/42864e48.signing_policy (revision 3296) -+++ modules/certmanagement/resources/cacerts/42864e48.signing_policy (working copy) -@@ -1,33 +0,0 @@ --# ca-signing-policy.conf, see ca-signing-policy.doc for more information --# --# This is the configuration file describing the policy for what CAs are --# allowed to sign whoses certificates. --# --# This file is parsed from start to finish with a given CA and subject --# name. --# subject names may include the following wildcard characters: --# * Matches any number of characters. --# ? Matches any single character. --# --# CA names must be specified (no wildcards). Names containing whitespaces --# must be included in single quotes, e.g. 'Certification Authority'. --# Names must not contain new line symbols. --# The value of condition attribute is represented as a set of regular --# expressions. Each regular expression must be included in double quotes. --# --# This policy file dictates the following policy: --# -The Globus CA can sign Globus certificates --# --# Format: --#------------------------------------------------------------------------ --# token type | def.authority | value --#--------------|---------------|----------------------------------------- --# EACL entry #1| -- -- access_id_CA X509 '/C=US/O=Globus/CN=Globus Certification Authority' -- -- pos_rights globus CA:sign -- -- cond_subjects globus '"/C=us/O=Globus/*" "/C=US/O=Globus/*" "/O=Grid/O=Globus/*"' -- --# end of EACL -Index: modules/certmanagement/resources/cacerts/42864e48.0 -=================================================================== ---- modules/certmanagement/resources/cacerts/42864e48.0 (revision 3296) -+++ modules/certmanagement/resources/cacerts/42864e48.0 (working copy) -@@ -1,14 +0,0 @@ -------BEGIN CERTIFICATE----- --MIICJzCCAZCgAwIBAgIBADANBgkqhkiG9w0BAQQFADBHMQswCQYDVQQGEwJVUzEP --MA0GA1UEChMGR2xvYnVzMScwJQYDVQQDEx5HbG9idXMgQ2VydGlmaWNhdGlvbiBB --dXRob3JpdHkwHhcNOTgwMTIzMTkyMDI0WhcNMDQwMTIzMTkyMDI0WjBHMQswCQYD --VQQGEwJVUzEPMA0GA1UEChMGR2xvYnVzMScwJQYDVQQDEx5HbG9idXMgQ2VydGlm --aWNhdGlvbiBBdXRob3JpdHkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAPab --enNkxgduNcEQgpL226qoksXAhw/Hles3Zx2vvapP/hsysE5SFwKuXmgMRxzVNzZn --7yTyRcm14eu30YqjBsg2ajQfBBVcMHEoMfq5Vz8+hAYQdtS5ky/cghdc5sETWmtp --ypMHR0PlgRrpWrGKbHFFwOLI7QwNlGxiD3FTOu9lAgMBAAGjIzAhMAwGA1UdEwQF --MAMBAf8wEQYJYIZIAYb4QgEBBAQDAgAHMA0GCSqGSIb3DQEBBAUAA4GBAFy0eT7d --UgE5gbQhpKwY011eDlS1bdT9eADRG4kjO5B9Z12dUNVzBt/H8k8uS3McSvCipEyu --85LRxEeotkYLAfJWM2tVo3P3zv2lRk2Xy1lmq4tUXti2PSM3sVIxUY9Cf5bdWPh4 --tY50uxhH7ljOgZY2Lo7x8X1YicNH1dr/JAks -------END CERTIFICATE----- -Index: modules/certmanagement/resources/conf/CertRenewApplet.properties -=================================================================== ---- modules/certmanagement/resources/conf/CertRenewApplet.properties (revision 3296) -+++ modules/certmanagement/resources/conf/CertRenewApplet.properties (working copy) -@@ -1,22 +0,0 @@ --AppletTitle= --EmailSubject=Certificate Renew Request Generated by CertRenewApplet --CACertFiles=5f54f417.0,42864e48.0 -- --RenewRequestAction=Renew Request --MailRenewAction=Mail my Renewal Request -- -- --msg001 = \ exists --msg002 = Looks like you already have renew credentials. --msg003 = If you wish to create new ones you will need to move them to another location. --msg004 = Please provide the chalenge that was mailed to you. --msg005 = Generating a certificate renewal request using chalenge:\ --msg006 = A new private key as been generated. --msg007 = A new private key as been saved to\ --msg008 = Your certificate renewal request can be found in:\ --msg009 = Please mail the content of this file to:\ --msg010 = \ or simply use the mail button. --msg011 = Please specify your e-mail address. --msg012 = Your request has been mailed to\ --msg013 = Error: Unknown action\ -- -Index: modules/certmanagement/resources/conf/MyProxyApplet_fr_CA.properties -=================================================================== ---- modules/certmanagement/resources/conf/MyProxyApplet_fr_CA.properties (revision 3296) -+++ modules/certmanagement/resources/conf/MyProxyApplet_fr_CA.properties (working copy) -@@ -1,28 +0,0 @@ --AppletTitle= --EmailSubject= --CACertFiles=5f54f417.0,42864e48.0 -- --getAction=Get --putAction=Put --infoAction=Info --destroyAction=Destroy -- --MyProxy_host = MyProxy host --MyProxy_Account_Name = MyProxy Account Name --Grid_PassPhrase = Grid PassPhrase --MyProxy_PassPhrase = MyProxy PassPhrase --MyProxy_PassPhrase_Confirmation = PassPhrase Confirmation --Lifetime = Lifetime (days) -- --msg001 = MyProxy account name missing. --msg002 = Grid passphrase mising. --msg003 = The myproxy passwords do not match. --msg004 = The myproxy password is too short, needs to be at least 6 chars --msg005 = Error: Unknown action\ --msg006 = You have a proxy on\ --msg007 = Your proxy has been removed from\ --msg008 = A proxy valid for\ --msg009 = \ hours ( --msg010 = \ days) for user\ --msg011 = \ now exists on\ -- -Index: modules/certmanagement/resources/conf/CertRequestApplet.properties -=================================================================== ---- modules/certmanagement/resources/conf/CertRequestApplet.properties (revision 3296) -+++ modules/certmanagement/resources/conf/CertRequestApplet.properties (working copy) -@@ -1,9 +0,0 @@ --AppletTitle= --EmailSubject=Certificate Request Generated by CertReqApplet --CACertFiles=5f54f417.0,42864e48.0 -- --GenerateRequestAction=Generate Request --MailRequestAction=Mail my Request -- -- -- -Index: modules/certmanagement/resources/conf/CertDestroyApplet.properties -=================================================================== ---- modules/certmanagement/resources/conf/CertDestroyApplet.properties (revision 3296) -+++ modules/certmanagement/resources/conf/CertDestroyApplet.properties (working copy) -@@ -1,13 +0,0 @@ --AppletTitle= --EmailSubject=Certificate Revocation Request --CACertFiles=5f54f417.0,42864e48.0 -- --DestroyCredential = Destroy Credential --NotifyCA = Notify CA -- -- -- -- -- -- -- -Index: modules/certmanagement/resources/conf/MyProxyApplet.properties -=================================================================== ---- modules/certmanagement/resources/conf/MyProxyApplet.properties (revision 3296) -+++ modules/certmanagement/resources/conf/MyProxyApplet.properties (working copy) -@@ -1,28 +0,0 @@ --AppletTitle= --EmailSubject= --CACertFiles=5f54f417.0,42864e48.0 -- --getAction=Get --putAction=Put --infoAction=Info --destroyAction=Destroy -- --MyProxy_host = MyProxy host --MyProxy_Account_Name = MyProxy Account Name --Grid_PassPhrase = Grid PassPhrase --MyProxy_PassPhrase = MyProxy PassPhrase --MyProxy_PassPhrase_Confirmation = PassPhrase Confirmation --Lifetime = Lifetime (days) -- --msg001 = MyProxy account name missing. --msg002 = Grid passphrase mising. --msg003 = The myproxy passwords do not match. --msg004 = The myproxy password is too short, needs to be at least 6 chars --msg005 = Error: Unknown action\ --msg006 = You have a proxy on\ --msg007 = Your proxy has been removed from\ --msg008 = A proxy valid for\ --msg009 = \ hours ( --msg010 = \ days) for user\ --msg011 = \ now exists on\ -- -Index: modules/certmanagement/resources/conf/CertInfoApplet.properties -=================================================================== ---- modules/certmanagement/resources/conf/CertInfoApplet.properties (revision 3296) -+++ modules/certmanagement/resources/conf/CertInfoApplet.properties (working copy) -@@ -1,8 +0,0 @@ --AppletTitle= --EmailSubject=None --CACertFiles=5f54f417.0,42864e48.0 -- -- -- -- -- -Index: modules/certmanagement/resources/conf/MyProxyApplet_en_CA.properties -=================================================================== ---- modules/certmanagement/resources/conf/MyProxyApplet_en_CA.properties (revision 3296) -+++ modules/certmanagement/resources/conf/MyProxyApplet_en_CA.properties (working copy) -@@ -1,28 +0,0 @@ --AppletTitle= --EmailSubject= --CACertFiles=5f54f417.0,42864e48.0 -- --getAction=Get --putAction=Put --infoAction=Info --destroyAction=Destroy -- --MyProxy_host = MyProxy host --MyProxy_Account_Name = MyProxy Account Name --Grid_PassPhrase = Grid PassPhrase --MyProxy_PassPhrase = MyProxy PassPhrase --MyProxy_PassPhrase_Confirmation = PassPhrase Confirmation --Lifetime = Lifetime (days) -- --msg001 = MyProxy account name missing. --msg002 = Grid passphrase mising. --msg003 = The myproxy passwords do not match. --msg004 = The myproxy password is too short, needs to be at least 6 chars --msg005 = Error: Unknown action\ --msg006 = You have a proxy on\ --msg007 = Your proxy has been removed from\ --msg008 = A proxy valid for\ --msg009 = \ hours ( --msg010 = \ days) for user\ --msg011 = \ now exists on\ -- -Index: modules/certmanagement/etc/MANIFEST.MF.tail -=================================================================== ---- modules/certmanagement/etc/MANIFEST.MF.tail (revision 3296) -+++ modules/certmanagement/etc/MANIFEST.MF.tail (working copy) -@@ -1 +0,0 @@ -- -Index: modules/certmanagement/etc/MANIFEST.MF.head -=================================================================== ---- modules/certmanagement/etc/MANIFEST.MF.head (revision 3296) -+++ modules/certmanagement/etc/MANIFEST.MF.head (working copy) -@@ -1 +0,0 @@ --Manifest-Version: 1.0 -Index: modules/certmanagement/readme.txt -=================================================================== ---- modules/certmanagement/readme.txt (revision 3296) -+++ modules/certmanagement/readme.txt (working copy) -@@ -1,79 +0,0 @@ -- Certificate Management Module -- ----------------------------- -- -- --The certificate management module has a main page called certmanagement.html. This --page contains links to the various html, jsp and jnlp launchers. It also contains --some information regarding the use of the various applets. -- --Remember to set the set the codebase property in the cog's main webstart.properties. --This should be set to the location where you will deploy your applets. -- --codebase=http://localhost:8080/certmanagement -- -- --How to sign using your own certificate: -- --The webstart.properties also contains all the fields required to change the signer --of the applets. Simply edit this file to your liking. -- --keystore=${user.home}/.globus/javacogkit.jks --storetype=JKS --storepass=password --signalias=javacogkit -- -- --How to use and install a different CA: -- --The applets will install the CA certificates files listed in the --conf/*.properties files. Currently they are configured to install the --Grid Canada (5f54f417.0) and Globus (42864e48.0) CA certificates, like so: -- -- CACertFiles=5f54f417.0,42864e48.0 -- --The cacerts directory must contain the actual CA certificates you want the --certmanagement applets to install on the clients machine. These files get copied --into the cog-certmanagement.jar. The applets will extract the certificates and --install them in the clients ~/.globus/certificates directory. -- --So if you want to install your own CA certificate file simply add it to the cacerts --directory and add an entry for it in the conf/*.properties files. -- --You may also want to specify your own email address to send certificate request to. --The default is ca at globus.org. There is also a default myproxy server address that --should be changed. See the launchers.xml file: -- -- -- -- -- -- -- -- --How to build: -- --ant dist (copies jars required by certmanagement module into the dist directory) --ant compile --ant deploy.webstart (build jars and generates the jnlp files) -- -- --Things remaingin: -- --Still making use of my original GridCertRequest class. Make use of --GridCertRequest.java located in modules/certrequest. --Finish internalization, framework is in place but not all strings are --internazonalized. -- -- --Jean-Claude Cote --High Performance Computing / Calcul de haute performance --National Research Council Canada / Conseil national de recherches Canada --www.grid.nrc.ca -- -- -- -- -- -- -- -- -Index: modules/certmanagement/build.xml -=================================================================== ---- modules/certmanagement/build.xml (revision 3296) -+++ modules/certmanagement/build.xml (working copy) -@@ -1,154 +0,0 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Available targets: -- help: -- prints out this help message -- -- dist: -- creates a distribution directory of the -- ${project} ${long.name} -- -- jar: -- creates a jar file for the ${project} ${long.name} -- named ${jar.filename} -- -- javadoc: -- creates the documentation -- -- clean: -- removes the compiled classes -- -- distclean: -- deletes the distribution directory -- -- all: -- dist and javadoc -- -- deploy.webstart: -- deploys the module as a webstart application -- -- dist.joint: -- builds everything into one jar file. Should only -- be used globally (from all) -- -- fixeol: -- -- change newlines to the unix standard -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -Index: modules/transfer-gui/tools/SignJarCommand.pl -=================================================================== ---- modules/transfer-gui/tools/SignJarCommand.pl (revision 3296) -+++ modules/transfer-gui/tools/SignJarCommand.pl (working copy) -@@ -1,29 +0,0 @@ --#!/bin/perl --if (opendir(DIR, "lib")) { -- -- $output_file=">tmp"; -- open(OUTPUT_FILE, $output_file); -- @entries = readdir(DIR); -- closedir(DIR); -- $alias = "mykey"; -- $keystore="mykeystore"; -- $storepass="mcs123"; -- `keytool -genkey -alias $alias -keystore $keystore -keypass mcs123 -storepass $storepass`; -- $sign_jar_cmd_base = "jarsigner -keystore $keystore -storepass $storepass "; -- $sign_jar_cmd = $sign_jar_cmd_base."gui.jar ".$alias; -- `$sign_jar_cmd`; -- foreach (@entries) { -- if ($_ ne "." && $_ ne "..") { -- $entry = "lib/".$_; -- $sign_jar_cmd = $sign_jar_cmd_base.$entry." ".$alias; -- print $sign_jar_cmd; -- print "\n"; -- `$sign_jar_cmd`; -- -- } -- } -- -- close(OUTPUT_FILE); -- -- --} -\ No newline at end of file -Index: modules/transfer-gui/tools/path.pl -=================================================================== ---- modules/transfer-gui/tools/path.pl (revision 3296) -+++ modules/transfer-gui/tools/path.pl (working copy) -@@ -1,20 +0,0 @@ --#!/bin/perl --if (opendir(DIR, "lib")) { -- -- $output_file=">tmp"; -- open(OUTPUT_FILE, $output_file); -- @entries = readdir(DIR); -- $scalar = @entries; -- print $scalar; -- closedir(DIR); -- foreach (@entries) { -- if ($_ ne "." && $_ ne "..") { -- $entry = ""; -- print OUTPUT_FILE $entry; -- print OUTPUT_FILE "\n"; -- } -- } -- close(OUTPUT_FILE); -- -- --} -\ No newline at end of file -Index: modules/transfer-gui/project.properties -=================================================================== ---- modules/transfer-gui/project.properties (revision 3296) -+++ modules/transfer-gui/project.properties (working copy) -@@ -1,13 +0,0 @@ --#=================================================================== --# This code is developed as part of the Java CoG Kit project --# The terms of the license can be found at http://www.cogkit.org/license --# This message may not be removed or altered. --#==================================================================== --# --module.name = transfer-gui --long.name = File Transfer Graphical Interface --version = 0.1 --project = Java CoG Kit --debug = true --lib.deps = GlobusPortal*.jar, bcprov-jdk*.jar, cog-ogce*.jar, gridant*.jar, ant-contrib*.jar, appframework*.jar, axis*.jar, beansbinding*.jar, commons-cli*.jar, concurrent*.jar, globus*.jar, swing-layout*.jar, swing-worker*.jar -- -Index: modules/transfer-gui/log4j_gui_default.properties -=================================================================== ---- modules/transfer-gui/log4j_gui_default.properties (revision 3296) -+++ modules/transfer-gui/log4j_gui_default.properties (working copy) -@@ -1,22 +0,0 @@ --# Set root category priority to WARN and its only appender to A1. -- --log4j.rootCategory=ERROR, A1 -- --# A1 is set to be a ConsoleAppender. -- --log4j.appender.A1=org.apache.log4j.FileAppender -- --# A1 uses PatternLayout. --log4j.appender.A1.file=logoutput --log4j.appender.A1.layout=org.apache.log4j.PatternLayout --log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n -- --# Display any warnings generated by our code --log4j.category.org.globus=DEBUG -- --# Enable SOAP Message Logging --# log4j.category.org.globus.wsrf.handlers.MessageLoggingHandler=DEBUG -- --# Comment out the line below if you want to log every authorization --# decision the notification consumer makes. --#log4j.category.org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain=WARN -Index: modules/transfer-gui/launchers.xml -=================================================================== ---- modules/transfer-gui/launchers.xml (revision 3296) -+++ modules/transfer-gui/launchers.xml (working copy) -@@ -1,30 +0,0 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -Index: modules/transfer-gui/dependencies.xml -=================================================================== ---- modules/transfer-gui/dependencies.xml (revision 3296) -+++ modules/transfer-gui/dependencies.xml (working copy) -@@ -1,20 +0,0 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -Index: modules/transfer-gui/lib/axis.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/gridant-old.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/globus_wsrf_rft_client.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/globus_delegation_stubs.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/globus_delegation_service.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/globus_wsrf_rft.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/GlobusPortal-0.0.1.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/wsrf_core_stubs.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/xercesImpl.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/commons-cli-2.0.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/beansbinding-1.2.1.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/bcprov-jdk15-139.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/ant-launcher.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/concurrent.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/cog-ogce.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/globus_delegation_client.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/globus_delegation_test.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/globus_wsrf_rft_stubs.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/gridsdk.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/gridant.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/ogsa.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/wsrf_core.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/appframework-1.0.3.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/swing-worker-1.1.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/xml4j.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/swing-layout-1.0.3.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/ant-contrib-1.0b3.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/lib/wsrf_tools.jar -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIView.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIView.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIView.java (working copy) -@@ -1,961 +0,0 @@ --/* -- * GridFTPGUIView.java -- */ -- --package org.globus.transfer.reliable.client; -- --import org.jdesktop.application.Action; --import org.jdesktop.application.ResourceMap; --import org.jdesktop.application.SingleFrameApplication; --import org.jdesktop.application.FrameView; --import org.jdesktop.application.TaskMonitor; --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; --import java.io.BufferedInputStream; --import java.io.BufferedReader; --import java.io.File; --import java.io.FileInputStream; --import java.io.FileReader; --import java.io.FileWriter; --import java.io.IOException; --import java.io.InputStream; --import java.util.Properties; -- --import javax.swing.Timer; --import javax.swing.Icon; --import javax.swing.JDialog; --import javax.swing.JFileChooser; --import javax.swing.JFrame; --import javax.swing.JInternalFrame; --import javax.swing.JOptionPane; -- --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; --import org.apache.log4j.PropertyConfigurator; --import org.globus.common.CoGProperties; --import org.globus.gsi.CertUtil; --import org.globus.gsi.GlobusCredential; --import org.globus.ogce.beans.filetransfer.FtpProperties; --import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; --import org.globus.ogce.beans.filetransfer.gui.remote.common.DisplayInterface; --import org.globus.ogce.beans.filetransfer.gui.remote.ftp.FtpClient; --import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.GridClient; --import org.globus.ogce.util.StringUtil; --import org.globus.tools.proxy.GridProxyInit; --import org.globus.tools.ui.util.CustomFileFilter; --import org.globus.tools.ui.util.UITools; --import org.globus.transfer.reliable.client.credential.CredManager; --import org.globus.transfer.reliable.client.credential.CredentialDialog; --import org.globus.transfer.reliable.client.credential.ProxyInfo; --import org.globus.transfer.reliable.client.credential.myproxy.MyProxyLogonGUI; --import org.globus.transfer.reliable.client.utils.LogFileUtils; --import org.globus.transfer.reliable.client.utils.UIConstants; --import org.globus.transfer.reliable.client.utils.Utils; --import org.globus.util.ConfigUtil; --import org.globus.util.Util; -- --/** -- * The application's main frame. -- */ --public class GridFTPGUIView extends FrameView { -- private Log logger = LogFactory.getLog(GridFTPGUIView.class); -- -- public GridFTPGUIView(SingleFrameApplication app) { -- super(app); -- -- initComponents(); -- // -- //fileTransferMainPanel1.add(fileTransferMainPanel1.getDesktopPane()); -- //mainPanel.add(fileTransferMainPanel1.getDesktopPane()); -- //mainPanel.add(fileTransferPanel.getDesktopPane()); -- // status bar initialization - message timeout, idle icon and busy animation, etc -- ResourceMap resourceMap = getResourceMap(); -- int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout"); -- messageTimer = new Timer(messageTimeout, new ActionListener() { -- public void actionPerformed(ActionEvent e) { -- statusMessageLabel.setText(""); -- } -- }); -- messageTimer.setRepeats(false); -- int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate"); -- for (int i = 0; i < busyIcons.length; i++) { -- busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]"); -- } -- busyIconTimer = new Timer(busyAnimationRate, new ActionListener() { -- public void actionPerformed(ActionEvent e) { -- busyIconIndex = (busyIconIndex + 1) % busyIcons.length; -- statusAnimationLabel.setIcon(busyIcons[busyIconIndex]); -- } -- }); -- idleIcon = resourceMap.getIcon("StatusBar.idleIcon"); -- statusAnimationLabel.setIcon(idleIcon); -- progressBar.setVisible(false); -- -- // connecting action tasks to status bar via TaskMonitor -- TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext()); -- taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() { -- public void propertyChange(java.beans.PropertyChangeEvent evt) { -- String propertyName = evt.getPropertyName(); -- if ("started".equals(propertyName)) { -- if (!busyIconTimer.isRunning()) { -- statusAnimationLabel.setIcon(busyIcons[0]); -- busyIconIndex = 0; -- busyIconTimer.start(); -- } -- progressBar.setVisible(true); -- progressBar.setIndeterminate(true); -- } else if ("done".equals(propertyName)) { -- busyIconTimer.stop(); -- statusAnimationLabel.setIcon(idleIcon); -- progressBar.setVisible(false); -- progressBar.setValue(0); -- } else if ("message".equals(propertyName)) { -- String text = (String)(evt.getNewValue()); -- statusMessageLabel.setText((text == null) ? "" : text); -- messageTimer.restart(); -- } else if ("progress".equals(propertyName)) { -- int value = (Integer)(evt.getNewValue()); -- progressBar.setVisible(true); -- progressBar.setIndeterminate(false); -- progressBar.setValue(value); -- } -- } -- }); -- } -- -- @Action -- public void showAboutBox() { -- if (aboutBox == null) { -- JFrame mainFrame = GridFTPGUIApp.getApplication().getMainFrame(); -- aboutBox = new GridFTPGUIAboutBox(mainFrame); -- aboutBox.setLocationRelativeTo(mainFrame); -- } -- GridFTPGUIApp.getApplication().show(aboutBox); -- } -- -- /** This method is called from within the constructor to -- * initialize the form. -- * WARNING: Do NOT modify this code. The content of this method is -- * always regenerated by the Form Editor. -- */ -- // //GEN-BEGIN:initComponents -- private void initComponents() { -- -- mainPanel = new javax.swing.JPanel(); -- jToolBar1 = new javax.swing.JToolBar(); -- credential_button = new javax.swing.JButton(); -- jButton1 = new javax.swing.JButton(); -- gridftp_button = new javax.swing.JButton(); -- jButton4 = new javax.swing.JButton(); -- local_button = new javax.swing.JButton(); -- jButton5 = new javax.swing.JButton(); -- jButton7 = new javax.swing.JButton(); -- jButton8 = new javax.swing.JButton(); -- javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator(); -- jDesktopPane1 = fileTransferMainPanel1.getDesktopPane(); -- menuBar = new javax.swing.JMenuBar(); -- javax.swing.JMenu fileMenu = new javax.swing.JMenu(); -- jMenuItem6 = new javax.swing.JMenuItem(); -- jMenuItem7 = new javax.swing.JMenuItem(); -- javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem(); -- jMenu1 = new javax.swing.JMenu(); -- jMenuItem1 = new javax.swing.JMenuItem(); -- jMenuItem8 = new javax.swing.JMenuItem(); -- jMenuItem9 = new javax.swing.JMenuItem(); -- jMenuItem10 = new javax.swing.JMenuItem(); -- jMenuItem2 = new javax.swing.JMenuItem(); -- jMenu2 = new javax.swing.JMenu(); -- jMenu3 = new javax.swing.JMenu(); -- jMenuItem3 = new javax.swing.JMenuItem(); -- jMenuItem4 = new javax.swing.JMenuItem(); -- jMenuItem5 = new javax.swing.JMenuItem(); -- jMenuItem11 = new javax.swing.JMenuItem(); -- jMenuItem12 = new javax.swing.JMenuItem(); -- javax.swing.JMenu helpMenu = new javax.swing.JMenu(); -- javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem(); -- statusPanel = new javax.swing.JPanel(); -- statusMessageLabel = new javax.swing.JLabel(); -- statusAnimationLabel = new javax.swing.JLabel(); -- progressBar = new javax.swing.JProgressBar(); -- -- mainPanel.setName("mainPanel"); // NOI18N -- -- jToolBar1.setRollover(true); -- jToolBar1.setName("jToolBar1"); // NOI18N -- -- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(GridFTPGUIView.class); -- -- credential_button.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N -- credential_button.setText(resourceMap.getString("credential_button.text")); // NOI18N -- credential_button.setToolTipText(resourceMap.getString("credential_button.toolTipText")); // NOI18N -- credential_button.setFocusable(false); -- credential_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); -- credential_button.setName("credential_button"); // NOI18N -- credential_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); -- credential_button.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- credential_buttonActionPerformed(evt); -- } -- }); -- jToolBar1.add(credential_button); -- -- -- jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N -- jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N -- jButton1.setToolTipText(resourceMap.getString("jButton1.toolTipText")); // NOI18N -- jButton1.setFocusable(false); -- jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); -- jButton1.setName("jButton1"); // NOI18N -- jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); -- jButton1.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jButton1ActionPerformed(evt); -- } -- }); -- //jToolBar1.add(jButton1); -- -- gridftp_button.setIcon(resourceMap.getIcon("gridftp_button.icon")); // NOI18N -- gridftp_button.setText(resourceMap.getString("gridftp_button.text")); // NOI18N -- gridftp_button.setToolTipText(resourceMap.getString("gridftp_button.toolTipText")); // NOI18N -- gridftp_button.setFocusable(false); -- gridftp_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); -- gridftp_button.setName("gridftp_button"); // NOI18N -- gridftp_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); -- gridftp_button.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- gridftp_buttonActionPerformed(evt); -- } -- }); -- jToolBar1.add(gridftp_button); -- -- jButton4.setIcon(resourceMap.getIcon("jButton4.icon")); // NOI18N -- jButton4.setText(resourceMap.getString("jButton4.text")); // NOI18N -- jButton4.setFocusable(false); -- jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); -- jButton4.setName("jButton4"); // NOI18N -- jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); -- jButton4.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jButton4ActionPerformed(evt); -- } -- }); -- //jToolBar1.add(jButton4); -- -- local_button.setIcon(resourceMap.getIcon("local_button.icon")); // NOI18N -- local_button.setText(resourceMap.getString("local_button.text")); // NOI18N -- local_button.setFocusable(false); -- local_button.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); -- local_button.setName("local_button"); // NOI18N -- local_button.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); -- local_button.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- local_buttonActionPerformed(evt); -- } -- }); -- jToolBar1.add(local_button); -- -- jButton5.setIcon(resourceMap.getIcon("jButton5.icon")); // NOI18N -- jButton5.setText(resourceMap.getString("jButton5.text")); // NOI18N -- jButton5.setFocusable(false); -- jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); -- jButton5.setName("jButton5"); // NOI18N -- jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); -- jButton5.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jButton5ActionPerformed(evt); -- } -- }); -- jToolBar1.add(jButton5); -- -- jButton7.setIcon(resourceMap.getIcon("jButton7.icon")); // NOI18N -- jButton7.setText("MyProxy"); // NOI18N -- jButton7.setFocusable(false); -- jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); -- jButton7.setName("jButton7"); // NOI18N -- jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); -- jButton7.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jButton7ActionPerformed(evt); -- } -- }); -- //jToolBar1.add(jButton7); -- -- jButton8.setIcon(resourceMap.getIcon("jButton8.icon")); // NOI18N -- jButton8.setText(resourceMap.getString("jButton8.text")); // NOI18N -- jButton8.setFocusable(false); -- jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); -- jButton8.setName("jButton8"); // NOI18N -- jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM); -- jButton8.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jButton8ActionPerformed(evt); -- } -- }); -- //jToolBar1.add(jButton8); -- -- statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N -- -- jDesktopPane1.setBackground(resourceMap.getColor("jDesktopPane1.background")); // NOI18N -- jDesktopPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); -- jDesktopPane1.setName("jDesktopPane1"); // NOI18N -- -- org.jdesktop.layout.GroupLayout mainPanelLayout = new org.jdesktop.layout.GroupLayout(mainPanel); -- mainPanel.setLayout(mainPanelLayout); -- mainPanelLayout.setHorizontalGroup( -- mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() -- .addContainerGap() -- .add(statusPanelSeparator, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 834, Short.MAX_VALUE)) -- .add(jToolBar1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 846, Short.MAX_VALUE) -- .add(jDesktopPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 846, Short.MAX_VALUE) -- ); -- mainPanelLayout.setVerticalGroup( -- mainPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(org.jdesktop.layout.GroupLayout.TRAILING, mainPanelLayout.createSequentialGroup() -- .add(jToolBar1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) -- .add(jDesktopPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 563, Short.MAX_VALUE) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(statusPanelSeparator, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) -- .addContainerGap()) -- ); -- -- menuBar.setName("menuBar"); // NOI18N -- -- fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N -- fileMenu.setName("fileMenu"); // NOI18N -- -- jMenuItem6.setText(resourceMap.getString("jMenuItem6.text")); // NOI18N -- jMenuItem6.setName("jMenuItem6"); // NOI18N -- jMenuItem6.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem6ActionPerformed(evt); -- } -- }); -- fileMenu.add(jMenuItem6); -- -- jMenuItem7.setText(resourceMap.getString("jMenuItem7.text")); // NOI18N -- jMenuItem7.setName("jMenuItem7"); // NOI18N -- jMenuItem7.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem7ActionPerformed(evt); -- } -- }); -- fileMenu.add(jMenuItem7); -- -- javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getActionMap(GridFTPGUIView.class, this); -- exitMenuItem.setAction(actionMap.get("quit")); // NOI18N -- exitMenuItem.setName("exitMenuItem"); // NOI18N -- fileMenu.add(exitMenuItem); -- -- menuBar.add(fileMenu); -- -- jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N -- jMenu1.setName("jMenu1"); // NOI18N -- jMenu1.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenu1ActionPerformed(evt); -- } -- }); -- -- jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N -- jMenuItem1.setName("jMenuItem1"); // NOI18N -- jMenuItem1.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem1ActionPerformed(evt); -- } -- }); -- jMenu1.add(jMenuItem1); -- -- jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N -- jMenuItem2.setName("jMenuItem2"); // NOI18N -- jMenuItem2.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem2ActionPerformed(evt); -- } -- }); -- jMenu1.add(jMenuItem2); -- -- menuBar.add(jMenu1); -- -- jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N -- jMenu2.setName("jMenu2"); // NOI18N -- jMenu2.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenu2ActionPerformed(evt); -- } -- }); -- -- jMenuItem3.setText(resourceMap.getString("jMenuItem3.text")); // NOI18N -- jMenuItem3.setName("jMenuItem3"); // NOI18N -- jMenuItem3.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem3ActionPerformed(evt); -- } -- }); -- jMenu2.add(jMenuItem3); -- -- jMenuItem4.setText(resourceMap.getString("jMenuItem4.text")); // NOI18N -- jMenuItem4.setName("jMenuItem4"); // NOI18N -- jMenuItem4.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem4ActionPerformed(evt); -- } -- }); -- jMenu2.add(jMenuItem4); -- -- jMenuItem5.setText(resourceMap.getString("jMenuItem5.text")); // NOI18N -- jMenuItem5.setName("jMenuItem5"); // NOI18N -- jMenuItem5.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem5ActionPerformed(evt); -- } -- }); -- jMenu2.add(jMenuItem5); -- -- menuBar.add(jMenu2); -- -- jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N -- jMenu3.setName("jMenu3"); // NOI18N -- jMenu3.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenu3ActionPerformed(evt); -- } -- }); -- -- jMenuItem11.setText(resourceMap.getString("jMenuItem11.text")); // NOI18N -- jMenuItem11.setName("jMenuItem11"); // NOI18N -- jMenuItem11.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem11ActionPerformed(evt); -- } -- }); -- jMenu3.add(jMenuItem11); -- -- jMenuItem12.setText(resourceMap.getString("jMenuItem12.text")); // NOI18N -- jMenuItem12.setName("jMenuItem12"); // NOI18N -- jMenuItem12.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- jMenuItem12ActionPerformed(evt); -- } -- }); -- jMenu3.add(jMenuItem12); -- menuBar.add(jMenu3); -- helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N -- helpMenu.setName("helpMenu"); // NOI18N -- -- aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N -- aboutMenuItem.setName("aboutMenuItem"); // NOI18N -- helpMenu.add(aboutMenuItem); -- -- menuBar.add(helpMenu); -- -- statusPanel.setName("statusPanel"); // NOI18N -- -- statusMessageLabel.setName("statusMessageLabel"); // NOI18N -- -- statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); -- statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N -- -- progressBar.setName("progressBar"); // NOI18N -- org.jdesktop.layout.GroupLayout statusPanelLayout = new org.jdesktop.layout.GroupLayout(statusPanel); -- statusPanel.setLayout(statusPanelLayout); -- final javax.swing.JLabel proxyInfoLabel = new javax.swing.JLabel(); -- //proxyInfoLabel.setSize(3000, 20); -- -- Thread t = new Thread() { -- public void run() { -- while (true) { -- StringBuffer buf = new StringBuffer(); -- try { -- ProxyInfo info = CredManager.getProxyInfo(); -- buf.append("") -- .append("Proxy Subject: ").append(info.getSubject()) -- .append("
") -- .append("Time Left: ").append(info.getTimeLeft()) -- .append(""); -- } catch (Exception e) { -- buf.append("") -- .append("Proxy Subject: ").append(e.getMessage()) -- .append("
") -- .append("Time Left: ").append(0) -- .append(""); -- } -- -- proxyInfoLabel.setText(buf.toString()); -- try { -- Thread.sleep(60000); -- } catch (InterruptedException e) { -- } -- } -- -- } -- }; -- t.start(); -- statusPanelLayout.setHorizontalGroup( -- statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(statusPanelLayout.createSequentialGroup() -- .addContainerGap() -- .add(proxyInfoLabel) -- //.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 662, Short.MAX_VALUE) --// .add(progressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) --// .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) --// .add(statusAnimationLabel) -- //.addContainerGap() -- ) -- ); -- statusPanelLayout.setVerticalGroup( -- statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(org.jdesktop.layout.GroupLayout.TRAILING, statusPanelLayout.createSequentialGroup() -- .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -- .add(statusPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(proxyInfoLabel) --// .add(statusAnimationLabel) --// .add(progressBar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) -- ) -- .add(3, 3, 3)) -- ); -- -- setComponent(mainPanel); -- setMenuBar(menuBar); -- setStatusBar(statusPanel); -- }//
//GEN-END:initComponents -- -- protected void credential_buttonActionPerformed(ActionEvent evt) { -- CredentialDialog d = new CredentialDialog(null, false); -- d.setLocation(100, 100); -- d.setVisible(true); -- -- } -- -- private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed -- localFrameHandle(); -- }//GEN-LAST:event_jMenuItem2ActionPerformed -- -- private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed -- -- }//GEN-LAST:event_jMenu1ActionPerformed -- -- private void jMenu2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed -- -- }//GEN-LAST:event_jMenu2ActionPerformed -- -- private void jMenu3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu2ActionPerformed -- -- }//GEN-LAST:event_jMenu2ActionPerformed -- -- private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed -- createProxy(); -- }//GEN-LAST:event_jMenuItem3ActionPerformed -- -- private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed -- CoGProperties props = CoGProperties.getDefault(); -- -- String proxyFileName = props.getProxyFile(); -- if (proxyFileName.length() > 0) { -- -- File proxyFile = new File(proxyFileName); -- if (!proxyFile.exists()) { -- JOptionPane.showMessageDialog( -- mainPanel, -- "Your Grid proxy certificate is already destroyed.", -- "Security Message", -- JOptionPane.WARNING_MESSAGE); -- return; -- } -- -- Util.destroy(proxyFile); -- JOptionPane.showMessageDialog( -- mainPanel, -- "Your Grid proxy certificate has been destroyed.", -- "Security Message", -- JOptionPane.INFORMATION_MESSAGE); -- -- } else -- JOptionPane.showMessageDialog( -- mainPanel, -- "Your Grid proxy certificate is not read or is destroyed", -- "Security Message", -- JOptionPane.INFORMATION_MESSAGE); -- }//GEN-LAST:event_jMenuItem4ActionPerformed -- -- private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed -- showProxyInfo(); -- }//GEN-LAST:event_jMenuItem5ActionPerformed -- -- private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed -- fileTransferMainPanel1.createRemoteFrame(1, null, 2811); -- }//GEN-LAST:event_jMenuItem1ActionPerformed -- -- private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed -- loadFile(); -- }//GEN-LAST:event_jMenuItem6ActionPerformed -- -- private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed -- saveFile(); -- }//GEN-LAST:event_jMenuItem7ActionPerformed -- -- private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed -- File logConfigFile = new File(UIConstants.LOG_CONFIG); -- String logLocation = null; -- if (!logConfigFile.exists()) { -- String dir; -- try { -- dir = new File(".").getCanonicalPath(); -- logLocation = dir + File.separator + "logoutput"; -- } catch (IOException e) { -- -- } -- -- } else { -- InputStream is = null; -- try { -- is = new BufferedInputStream(new FileInputStream(logConfigFile)); -- Properties prop = new Properties(); -- prop.load(is); -- logLocation = prop.getProperty("log4j.appender.A1.file"); -- } catch (Exception e) { -- logLocation="can not get log file location"; -- } finally { -- try { -- is.close(); -- } catch (IOException e) { -- -- } -- } -- } -- -- JOptionPane.showMessageDialog(null, logLocation, "Log Location", JOptionPane.INFORMATION_MESSAGE); -- }//GEN-LAST:event_jMenuItem7ActionPerformed -- -- private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed -- JFileChooser chooser = new JFileChooser(); -- chooser.setDialogTitle("Choose Log File"); -- int flag = chooser.showSaveDialog(null); -- if (flag == JFileChooser.APPROVE_OPTION) { -- File f = chooser.getSelectedFile(); -- try { -- logFileName = f.getCanonicalPath(); -- File logConfigFile = new File(UIConstants.LOG_CONFIG); -- if (!logConfigFile.exists() || !logConfigFile.isFile()) { -- LogFileUtils.createNewLogConfigFile(logFileName); -- } else { -- LogFileUtils.updateLogConfigFile(logFileName); -- } -- PropertyConfigurator.configure(UIConstants.LOG_CONFIG); -- } catch (IOException e) { -- logFileName = "error_log"; -- } -- } -- }//GEN-LAST:event_jMenuItem7ActionPerformed -- -- private void localFrameHandle() { -- boolean isRFTEnabled; -- try { -- isRFTEnabled = (new Boolean((String)Utils.getProperty("rft_enabled", "rft.properties"))).booleanValue(); -- } catch (Exception e) { -- isRFTEnabled = false; -- } -- if (isRFTEnabled) { -- JOptionPane.showMessageDialog(null, "RFT is enabled, you can not use local dialog", -- "Message", JOptionPane.ERROR_MESSAGE); -- } else { -- fileTransferMainPanel1.createNewLocalFrame(); -- } -- } -- private void local_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed -- localFrameHandle(); -- -- }//GEN-LAST:event_jButton3ActionPerformed -- -- private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed -- jMenuItem10ActionPerformed(evt); -- }//GEN-LAST:event_jButton3ActionPerformed -- -- private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed -- MyProxyLogonGUI.main(null); -- }//GEN-LAST:event_jButton3ActionPerformed -- -- private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed -- JFileChooser chooser = new JFileChooser(); -- chooser.setDialogTitle("Choose Log File"); -- int flag = chooser.showSaveDialog(null); -- if (flag == JFileChooser.APPROVE_OPTION) { -- File f = chooser.getSelectedFile(); -- try { -- logFileName = f.getCanonicalPath(); -- File logConfigFile = new File(UIConstants.LOG_CONFIG); -- if (!logConfigFile.exists() || !logConfigFile.isFile()) { -- LogFileUtils.createNewLogConfigFile(logFileName); -- } else { -- LogFileUtils.updateLogConfigFile(logFileName); -- } -- } catch (IOException e) { -- logFileName = "error_log"; -- } -- } -- -- }//GEN-LAST:event_jButton3ActionPerformed -- -- private void gridftp_buttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed -- fileTransferMainPanel1.createRemoteFrame(1, null, 2811); -- }//GEN-LAST:event_jButton2ActionPerformed -- -- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed -- createProxy(); -- }//GEN-LAST:event_jButton1ActionPerformed -- -- private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed -- fileTransferMainPanel1.createRemoteFrame(3, null, 21); -- }//GEN-LAST:event_jMenuItem8ActionPerformed -- -- private void jMenuItem9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed -- JOptionPane.showMessageDialog(mainPanel, "Not yet implemented"); -- fileTransferMainPanel1.createRemoteFrame(2, null, 0); -- }//GEN-LAST:event_jMenuItem9ActionPerformed -- -- private void jMenuItem10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem9ActionPerformed -- JFrame frame = new JFrame("Advanced Options"); -- RFTPanel rftPanel = new RFTPanel(); -- rftPanel.setFrame(frame); -- frame.getContentPane().add(rftPanel); -- frame.setSize(500, 500); -- frame.setLocation(100, 100); -- //frame.pack(); -- frame.setVisible(true); -- }//GEN-LAST:event_jMenuItem9ActionPerformed -- -- private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed -- fileTransferMainPanel1.createRemoteFrame(3, null, 21); -- }//GEN-LAST:event_jButton4ActionPerformed -- -- private void createProxy() { -- GridProxyInit proxyInitFrame = new GridProxyInit(null, true); -- proxyInitFrame.setRunAsApplication(false); -- proxyInitFrame.setCloseOnSuccess(true); -- proxyInitFrame.pack(); -- UITools.center(mainPanel, proxyInitFrame); -- proxyInitFrame.setVisible(true); -- } -- -- -- -- private void showProxyInfo() { -- ProxyInfo proxyInfo = null; -- -- try { -- proxyInfo = CredManager.getProxyInfo(); -- } catch (Exception e) { -- JOptionPane.showMessageDialog( -- mainPanel, -- "Unable to load Grid proxy certificate.\nError: " -- + e.getMessage(), -- "Security Message", -- JOptionPane.WARNING_MESSAGE); -- } -- -- JOptionPane.showMessageDialog(mainPanel, proxyInfo, -- "Grid Proxy Certificate Information",JOptionPane.INFORMATION_MESSAGE); -- } -- -- public void saveFile() { -- //Determine the name of the file to save to -- JFileChooser fileChooser = new JFileChooser(ConfigUtil.globus_dir); -- fileChooser.setFileFilter(new CustomFileFilter(".ftp", -- "GridFTP sites list file (*.ftp)")); -- int popdownState = fileChooser.showSaveDialog(mainPanel); -- if (popdownState == JFileChooser.CANCEL_OPTION) { -- return; -- } -- File saveFile = fileChooser.getSelectedFile(); -- String fileName = saveFile.getAbsolutePath(); -- if (!fileName.endsWith(".ftp")) { -- fileName = fileName + ".ftp"; -- saveFile = new File(fileName); -- } -- -- //writing the default job file name into ftp.properties -- FtpProperties props = null; -- try { -- props = new FtpProperties(FtpProperties.configFile); -- props.setFtpFile(saveFile.getAbsolutePath()); -- logger.info("\nThe ftp file default location saved=" -- + props.getFtpFile()); -- props.save(FtpProperties.configFile); -- -- } catch (Exception e) { -- logger.debug("The system could not open the specified file\n"); -- } -- -- //Saving the names of the gatekeeper into a file. -- FileWriter fileout = null; -- try { -- fileout = new FileWriter(saveFile.getAbsolutePath()); -- fileout.write(getAllOpenSites()); -- fileout.close(); -- } catch (Exception e) { -- logger.info("IOException occured when creating" -- + " output stream :" + e.getMessage()); -- } finally { -- if (fileout != null) { -- try { -- fileout.close(); -- } catch (Exception e) { -- e.printStackTrace(); -- } -- } -- } -- } -- -- public String getAllOpenSites() { -- String s = new String(""); -- DisplayInterface gc = null; -- for (int i = 0; i < remCounter; i++) { -- -- try { -- gc = (GridClient) frame2[i]; -- s += "gridftp:" + gc.getHost() + ":" + gc.getPort() + "\n"; -- } catch (Exception e) { -- logger.debug("The file does not save the ftp sites " -- + "needs to handle user and password."); -- FtpClient fc = (FtpClient) frame2[i]; -- s += "ftp:" + fc.getHost() + ":" + fc.getPort() + ":" + fc.getUser() + -- ":" + fc.getPwd() + "\n"; -- } -- -- } -- return s; -- } -- -- public void loadFile() { -- -- JFileChooser filechooser = new JFileChooser(ConfigUtil.globus_dir); -- // filechooser.setCurrentDirectory( new File(".") ); -- filechooser.setFileFilter(new CustomFileFilter(".ftp", -- "Ftp file (*.ftp)")); -- filechooser.setApproveButtonText("Load"); -- filechooser.setDialogTitle("Load Ftp File"); -- -- if (filechooser.showOpenDialog(mainPanel) != JFileChooser.APPROVE_OPTION) { -- return; -- } -- File file = filechooser.getSelectedFile(); -- loadFile(file.getAbsolutePath()); -- -- } -- -- public void loadFile(String filename) { -- try { -- readFile(filename); -- -- } catch (IOException e) { -- String msg = "Failed to load gatekeeper file:\n " + e.getMessage(); -- JOptionPane.showMessageDialog(mainPanel, -- msg, -- "Error Loading Ftp File", -- JOptionPane.ERROR_MESSAGE); -- } -- -- } -- -- public void readFile(String filename) throws IOException { -- BufferedReader in = null; -- try { -- in = new BufferedReader(new FileReader(filename)); -- String machine; -- while ((machine = in.readLine()) != null) { -- machine = machine.trim(); -- if (machine.equals("") || machine.startsWith("#")) { -- logger.info("Machine name commented."); -- } else { -- StringUtil splitString = new StringUtil(machine); -- String[] tokens = splitString.split(":"); -- int noTokens = tokens.length; -- for (int i = 0; i < noTokens; i++) { -- // tokens[i] = tokens[i].trim(); -- } -- int port1 = Integer.parseInt(tokens[2]); -- //Protocol:host:port:user:passwd -- if (tokens[0].equals("gridftp")) { -- fileTransferMainPanel1.createRemoteFrame(1, tokens[1], port1); -- System.out.println("\nMachine line =" + machine); -- } else if (noTokens > 3) { -- logger.info("\nMachine line =" + -- machine.substring(0, -- machine.lastIndexOf(":"))); -- -- fileTransferMainPanel1.createRemoteFrame(3, tokens[1], port1, tokens[3] -- , tokens[4]); -- } else { -- fileTransferMainPanel1.createRemoteFrame(3, tokens[1], port1); -- } -- } -- } -- } finally { -- if (in != null) { -- try { -- in.close(); -- } catch (Exception e) { -- e.printStackTrace(); -- } -- } -- } -- -- } -- -- public static String getErrorLogFileName() { -- return logFileName; -- } -- -- protected JInternalFrame messageFrame; -- -- //Counters are used to allow the users to add any no of local or remote -- //file browser beans. -- protected int remCounter = 0; -- protected DisplayInterface frame2[]; -- private FileTransferMainPanel fileTransferMainPanel1 = new FileTransferMainPanel(); -- // Variables declaration - do not modify//GEN-BEGIN:variables -- private javax.swing.JButton jButton1; -- private javax.swing.JButton gridftp_button; -- private javax.swing.JButton local_button; -- private javax.swing.JButton jButton4; -- private javax.swing.JButton jButton5; -- private javax.swing.JButton jButton6; -- private javax.swing.JButton jButton7; -- private javax.swing.JButton jButton8; -- private javax.swing.JButton credential_button; -- private javax.swing.JDesktopPane jDesktopPane1; -- private javax.swing.JMenu jMenu1; -- private javax.swing.JMenu jMenu2; -- private javax.swing.JMenu jMenu3; -- private javax.swing.JMenuItem jMenuItem1; -- private javax.swing.JMenuItem jMenuItem2; -- private javax.swing.JMenuItem jMenuItem3; -- private javax.swing.JMenuItem jMenuItem4; -- private javax.swing.JMenuItem jMenuItem5; -- private javax.swing.JMenuItem jMenuItem6; -- private javax.swing.JMenuItem jMenuItem7; -- private javax.swing.JMenuItem jMenuItem8; -- private javax.swing.JMenuItem jMenuItem9; -- private javax.swing.JMenuItem jMenuItem10; -- private javax.swing.JMenuItem jMenuItem11; -- private javax.swing.JMenuItem jMenuItem12; -- private javax.swing.JToolBar jToolBar1; -- private javax.swing.JPanel mainPanel; -- private javax.swing.JMenuBar menuBar; -- private javax.swing.JProgressBar progressBar; -- private javax.swing.JLabel statusAnimationLabel; -- private javax.swing.JLabel statusMessageLabel; -- private javax.swing.JPanel statusPanel; -- // End of variables declaration//GEN-END:variables -- -- private final Timer messageTimer; -- private final Timer busyIconTimer; -- private final Icon idleIcon; -- private final Icon[] busyIcons = new Icon[15]; -- private int busyIconIndex = 0; -- -- private JDialog aboutBox; -- -- private static String logFileName = "error_log"; --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileDeleteClient.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileDeleteClient.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileDeleteClient.java (working copy) -@@ -1,201 +0,0 @@ --/* -- * Portions of this file Copyright 1999-2005 University of Chicago -- * Portions of this file Copyright 1999-2005 The University of Southern California. -- * -- * This file or a portion of this file is licensed under the -- * terms of the Globus Toolkit Public License, found at -- * http://www.globus.org/toolkit/download/license.html. -- * If you redistribute this file, with or without -- * modifications, you must include this notice in the file. -- */ -- --package org.globus.transfer.reliable.client; -- --import java.io.BufferedReader; --import java.io.File; --import java.io.FileReader; --import java.io.FileWriter; --import java.util.Calendar; --import java.util.Vector; -- --import javax.xml.namespace.QName; --import javax.xml.rpc.Stub; --import org.apache.axis.message.addressing.Address; --import org.apache.axis.message.addressing.EndpointReferenceType; --import org.globus.rft.generated.DeleteOptionsType; --import org.globus.rft.generated.DeleteRequestType; --import org.globus.rft.generated.DeleteType; --import org.globus.rft.generated.ReliableFileTransferPortType; --import org.globus.rft.generated.StartOutputType; --import org.globus.rft.generated.Start; --import org.oasis.wsrf.lifetime.SetTerminationTime; --import org.oasis.wsrf.lifetime.SetTerminationTimeResponse; -- --import org.globus.wsrf.encoding.ObjectSerializer; --import org.globus.wsrf.impl.security.authentication.Constants; --/** -- */ --public class ReliableFileDeleteClient extends BaseRFTClient { -- -- public static String optionString = -- "rft-delete [options] -f \n" -- + "Where options can be:\n" -- + "-h Defaults to 'localhost'.\n" -- + "-r Defaults to TCP port 8443.\n" -- + "-l lifetime of the created resource in minutes Defaults to 60 mins.\n" -- + "-m security mechanism Allowed values: 'msg' for secure messages, 'conv' for\n" -- + " secure conversation and 'trans' for secure transport. Defaults to \n" -- + " 'trans'.\n" -- + " -p protection type Allowed values: 'sig' for signature and 'enc' for encryption.\n" -- + " Defaults to 'sig'.\n" -- + " -z authorization Defaults to 'host' authorization. Allowed values: 'self' for\n" -- + " self authorization and 'host' for host authorization.\n" -- + " -file file to write EPR of created Reliable" -- + " File Transfer Resource\n"; -- -- public static DeleteRequestType -- getDeleteRequest(String path, EndpointReferenceType epr) { -- DeleteRequestType deleteRequest = new DeleteRequestType(); -- File requestFile = new File(path); -- BufferedReader reader = null; -- -- try { -- reader = new BufferedReader(new FileReader(requestFile)); -- } catch (java.io.FileNotFoundException fnfe) { -- System.err.println(fnfe); -- System.exit(-1); -- } -- -- Vector requestData = new Vector(); -- -- try { -- -- String line = reader.readLine(); -- while (line != null) { -- if (!line.startsWith("#")) { -- requestData.add(line); -- } -- line = reader.readLine(); -- -- } -- -- reader.close(); -- } catch (java.io.IOException ioe) { -- System.err.println("IOException:" + ioe.getMessage()); -- System.exit(-1); -- } -- DeleteType deleteArray[] = new DeleteType[requestData.size() - 1]; -- String subjectName = (String) requestData.elementAt(0); -- for (int i = 0; i < deleteArray.length; i++) { -- deleteArray[i] = new DeleteType(); -- deleteArray[i].setFile((String) requestData.elementAt(i + 1)); -- } -- transferCount = (requestData.size() - 1) / 2; -- if (transferCount <=0 ) { -- System.err.println("Invalid transfer file format"); -- System.exit(-1); -- } -- DeleteOptionsType deleteOptions = new DeleteOptionsType(); -- deleteOptions.setSubjectName(subjectName); -- deleteRequest.setDeleteOptions(deleteOptions); -- deleteRequest.setDeletion(deleteArray); -- deleteRequest.setTransferCredentialEndpoint(epr); -- deleteRequest.setConcurrency(new Integer(1)); -- deleteRequest.setMaxAttempts(new Integer(10)); -- return deleteRequest; -- } -- -- /** -- * @param args -- * @throws Exception -- */ -- public static void main(String[] args) throws Exception { -- DeleteRequestType deleteRequestType = null; -- if (args.length < 1) { -- printUsage(); -- System.exit(-1); -- } -- cmd = args; -- parseArgs(); -- -- if (PORT == null) { -- if (authType.equals(Constants.GSI_TRANSPORT)) { -- PORT = "8443"; -- } else { -- PORT ="8080"; -- } -- } -- if (authType.equals(Constants.GSI_TRANSPORT)) { -- PROTOCOL = "https"; -- } -- String rftFactoryAddress = -- PROTOCOL + "://"+ HOST+ ":" + PORT + SERVICE_URL_ROOT -- + "ReliableFileTransferFactoryService"; -- String rftServiceAddress = PROTOCOL+ "://" + HOST + ":" + PORT + -- SERVICE_URL_ROOT + "ReliableFileTransferService"; -- -- System.out.println("creating a rft resource"); -- // do delegation -- EndpointReferenceType credEPR = delegateCredential(HOST, PORT); -- -- deleteRequestType = getDeleteRequest(PATH_TO_FILE, credEPR); -- -- EndpointReferenceType rftepr = createRFT(rftFactoryAddress, -- deleteRequestType); -- -- if (outFileName != null) { -- FileWriter writer = null; -- try { -- writer = new FileWriter(outFileName); -- QName qName = new QName("", "RFT_EPR"); -- writer.write(ObjectSerializer.toString(rftepr, -- qName)); -- } finally { -- if (writer != null) { -- writer.close(); -- } -- } -- } -- -- rftepr.setAddress(new Address(rftServiceAddress)); -- ReliableFileTransferPortType rft = rftLocator -- .getReliableFileTransferPortTypePort(rftepr); -- //For secure notifications -- setSecurity((Stub)rft); -- subscribe(rft); -- System.out.println("Subscribed for overall status"); -- //End subscription code -- Calendar termTime = Calendar.getInstance(); -- termTime.add(Calendar.MINUTE, TERM_TIME); -- SetTerminationTime reqTermTime = new SetTerminationTime(); -- reqTermTime.setRequestedTerminationTime(termTime); -- System.out.println("Termination time to set: " + TERM_TIME -- + " minutes"); -- SetTerminationTimeResponse termRes = rft -- .setTerminationTime(reqTermTime); -- StartOutputType startresp = rft.start(new Start()); -- while (finished < transferCount && transferCount !=0) { -- if (failed == transferCount || -- (failed + finished == transferCount) -- || finished == transferCount) { -- break; -- } else { -- Thread.sleep(1000); -- } -- } -- if ((finished == transferCount) && (finished != 0)) { -- System.out.println( "All Transfers are completed"); -- System.exit(0); -- } -- if ((failed == transferCount) && (failed != 0)) { -- System.out.println( "All Transfers failed !"); -- System.exit(-1); -- } -- if ((failed + finished) == transferCount) { -- System.out.println( "Transfers Done"); -- System.exit(-1); -- } -- -- -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParamPanel.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParamPanel.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParamPanel.java (working copy) -@@ -1,370 +0,0 @@ --/* -- * RFTTransferParam.java -- * -- * -- */ -- --package org.globus.transfer.reliable.client; -- --import java.io.File; --import java.io.FileInputStream; --import java.util.HashMap; --import java.util.Map; --import java.util.Properties; -- --import javax.swing.JFileChooser; --import javax.swing.JOptionPane; --import javax.swing.filechooser.FileFilter; -- --import org.globus.wsrf.impl.security.authorization.HostAuthorization; --import org.globus.wsrf.impl.security.authorization.SelfAuthorization; --import org.globus.wsrf.security.Constants; -- --/** -- * -- * @author vic -- */ --public class RFTTransferParamPanel extends javax.swing.JPanel { -- private Map authTypeMap = new HashMap(); -- private Map authzTypeMap = new HashMap(); -- /** Creates new form RFTTransferParam */ -- public RFTTransferParamPanel() { -- authTypeMap.put("GSI_TRANSPORT", Constants.GSI_TRANSPORT); -- authTypeMap.put("GSI_SEC_CONV", Constants.GSI_SEC_CONV); -- authTypeMap.put("GSI_SEC_MSG", Constants.GSI_SEC_MSG); -- -- authzTypeMap.put("HOST", HostAuthorization.getInstance()); -- authzTypeMap.put("SELF", SelfAuthorization.getInstance()); -- initComponents(); -- } -- -- public String getFrom() { -- return fromField.getText(); -- } -- -- public String getServerHost() { -- return serverHostField.getText(); -- } -- -- public String getServerPort() { -- return serverPortField.getText(); -- } -- -- public String getTo() { -- return toField.getText(); -- } -- -- public void setServerHost(String t) { -- serverHostField.setText(t); -- } -- -- public void setServerPort(String t) { -- serverPortField.setText(t); -- } -- -- public int getConcurrent() { -- String value = concurrencyField.getText(); -- int con = 1; -- if (null != value) { -- try { -- con = Integer.valueOf(value); -- } catch (NumberFormatException e) { -- con = 1; -- } -- } -- -- return con; -- } -- -- public void setConcurrent(String c) { -- concurrencyField.setText(c); -- } -- -- /** This method is called from within the constructor to -- * initialize the form. -- * WARNING: Do NOT modify this code. The content of this method is -- * always regenerated by the Form Editor. -- */ -- // //GEN-BEGIN:initComponents -- private void initComponents() { -- -- jScrollPane1 = new javax.swing.JScrollPane(); -- jList1 = new javax.swing.JList(); -- jLabel1 = new javax.swing.JLabel(); -- serverHostField = new javax.swing.JTextField(); -- jLabel2 = new javax.swing.JLabel(); -- serverPortField = new javax.swing.JTextField(); -- jLabel3 = new javax.swing.JLabel(); -- fromField = new javax.swing.JTextField(); -- jLabel4 = new javax.swing.JLabel(); -- toField = new javax.swing.JTextField(); -- concurrencyLabel = new javax.swing.JLabel(); -- concurrencyField = new javax.swing.JTextField(); -- rftHelpButton = new javax.swing.JButton("RFT?"); -- -- jScrollPane1.setName("jScrollPane1"); // NOI18N -- -- jList1.setModel(new javax.swing.AbstractListModel() { -- String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; -- public int getSize() { return strings.length; } -- public Object getElementAt(int i) { return strings[i]; } -- }); -- jList1.setName("jList1"); // NOI18N -- jScrollPane1.setViewportView(jList1); -- -- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(RFTTransferParamPanel.class); -- setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("Form.border.title"))); // NOI18N -- setName("Form"); // NOI18N -- -- jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N -- jLabel1.setName("jLabel1"); // NOI18N -- -- concurrencyLabel.setText(resourceMap.getString("concurrencyLabel.text")); -- concurrencyLabel.setName("concurrencyLabel"); -- -- concurrencyField.setText(resourceMap.getString("concurrencyField.text")); // NOI18N -- concurrencyField.setName("concurrencyField"); // NOI18N -- -- serverHostField.setText(resourceMap.getString("serverHostField.text")); // NOI18N -- serverHostField.setName("serverHostField"); // NOI18N -- -- jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N -- jLabel2.setName("jLabel2"); // NOI18N -- -- serverPortField.setText(resourceMap.getString("serverPortField.text")); // NOI18N -- serverPortField.setName("serverPortField"); // NOI18N -- -- -- -- jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N -- jLabel3.setName("jLabel3"); // NOI18N -- -- fromField.setText(resourceMap.getString("fromField.text")); // NOI18N -- fromField.setName("fromField"); // NOI18N -- -- jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N -- jLabel4.setName("jLabel4"); // NOI18N -- -- toField.setText(resourceMap.getString("toField.text")); // NOI18N -- toField.setName("toField"); // NOI18N -- -- enable_rft = new javax.swing.JLabel(); -- enable_rft.setText("Enable RFT"); -- enable_rft_checkbox = new javax.swing.JCheckBox(); -- enable_rft_checkbox.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- enable_rft_checkboxActionPerformed(evt); -- } -- }); -- -- rftHelpButton.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- rftHelpButtonActionPerformed(evt); -- } -- }); -- Properties prop = new Properties(); -- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; -- File dir = new File(globusDir, "GridFTP_GUI"); -- File propFile = new File(dir, "rft.properties"); -- -- if (propFile.exists()) { -- try { -- prop.load(new FileInputStream(propFile)); -- setEnableRFT((new Boolean((String)prop.get("rft_enabled"))).booleanValue()); -- setServerHost((String)prop.getProperty("host")); -- setServerPort((String)prop.getProperty("port")); -- setConcurrent((String)prop.getProperty("concurrent")); -- } catch (Exception e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } -- } -- -- if (enable_rft_checkbox.isSelected()) { -- System.out.println("checkbox selected"); -- jLabel1.setEnabled(true); -- serverHostField.setEditable(true); -- jLabel2.setEnabled(true); -- serverPortField.setEditable(true); -- concurrencyLabel.setEnabled(true); -- concurrencyField.setEditable(true); -- } else { -- jLabel1.setEnabled(false); -- serverHostField.setEditable(false); -- jLabel2.setEnabled(false); -- serverPortField.setEditable(false); -- concurrencyLabel.setEnabled(false); -- concurrencyField.setEditable(false); -- } -- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); -- this.setLayout(layout); -- -- layout.setHorizontalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .addContainerGap() -- .add(64, 64, 64) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(enable_rft) -- .add(jLabel1) -- .add(jLabel2) -- .add(concurrencyLabel) -- ) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(rftHelpButton) -- .add(50, 50, 50) -- .add(50, 50, 50) -- .add(50, 50, 50) -- .add(50, 50, 50) -- ) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) -- .add(enable_rft_checkbox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE) -- .add(serverHostField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE) -- .add(serverPortField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, Short.MAX_VALUE) -- .add(concurrencyField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, Short.MAX_VALUE) -- -- ) -- -- ) -- -- )) -- ); -- -- layout.setVerticalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- //.add(26, 26, 26) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- //.add(100, 100, 100) -- .add(rftHelpButton)) -- .add(11, 11, 11) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(enable_rft) -- .add(10, 10, 10) -- .add(enable_rft_checkbox)) -- .add(11, 11, 11) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(jLabel1) -- .add(10, 10, 10) -- .add(serverHostField, 1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30)) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(jLabel2) -- .add(10, 10, 10) -- .add(serverPortField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(concurrencyLabel) -- .add(10, 10, 10) -- .add(concurrencyField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- -- .addContainerGap(18, Short.MAX_VALUE)) -- ); -- -- }// //GEN-END:initComponents -- -- public boolean isRFTEnabled() { -- return enable_rft_checkbox.isSelected(); -- } -- -- public void setEnableRFT(boolean enabled) { -- enable_rft_checkbox.setSelected(enabled); -- } -- -- private void loadFileButtonActionPerformed(java.awt.event.ActionEvent evt) { -- JFileChooser fileChooser = new JFileChooser("."); -- fileChooser.addChoosableFileFilter(new MyFilter()); -- int status = fileChooser.showDialog(this, "load"); -- if (status == JFileChooser.APPROVE_OPTION) { -- -- } -- } -- -- -- -- private void enable_rft_checkboxActionPerformed(java.awt.event.ActionEvent evt) { -- if (enable_rft_checkbox.isSelected()) { -- jLabel1.setEnabled(true); -- jLabel2.setEnabled(true); -- serverHostField.setEditable(true); -- serverPortField.setEditable(true); -- concurrencyLabel.setEnabled(true); -- concurrencyField.setEditable(true); -- } else { -- jLabel1.setEnabled(false); -- jLabel2.setEnabled(false); -- serverHostField.setEditable(false); -- serverPortField.setEditable(false); -- concurrencyField.setEditable(false); -- concurrencyLabel.setEnabled(false); -- } -- } -- -- private void rftHelpButtonActionPerformed(java.awt.event.ActionEvent evt) { -- String msg = "RFT is a GridFTP client that handles failures more reliably. It is a \n" + -- "Web Services Resource Framework (WSRF) compliant web service \n" + -- "that provides job scheduler-like functionality for data movement.\n" + -- "It can recover from source and/or destination server crashes during\n"+ -- "a transfer, network failures, RFT service failures, file system failures\n" + -- "etc. More information on RFT is available at\n" + -- "http://www.globus.org/toolkit/docs/4.2/4.2.0/data/rft/index.html"; -- JOptionPane.showMessageDialog(null, msg, "What is RFT", JOptionPane.INFORMATION_MESSAGE); -- } -- -- // Variables declaration - do not modify//GEN-BEGIN:variables -- private javax.swing.JTextField fromField; -- private javax.swing.JLabel jLabel1; -- private javax.swing.JLabel jLabel2; -- private javax.swing.JLabel jLabel3; -- private javax.swing.JLabel jLabel4; -- private javax.swing.JList jList1; -- private javax.swing.JScrollPane jScrollPane1; -- private javax.swing.JTextField serverHostField; -- private javax.swing.JTextField serverPortField; -- private javax.swing.JTextField toField; -- private javax.swing.JLabel enable_rft; -- private javax.swing.JCheckBox enable_rft_checkbox; -- private javax.swing.JLabel concurrencyLabel; -- private javax.swing.JTextField concurrencyField; -- private javax.swing.JButton rftHelpButton; -- // End of variables declaration//GEN-END:variables -- -- public class MyFilter extends FileFilter { -- -- public boolean accept(File f) { -- if (f.isDirectory()) { -- return true; -- } -- -- String extension = getExtension(f); -- if (extension != null) { -- if (extension.equals("xfr")) { -- return true; -- } else { -- return false; -- } -- } -- -- return false; -- } -- -- public String getDescription() { -- return ".xfr files"; -- } -- -- public String getExtension(File f) { -- String ext = null; -- String s = f.getName(); -- int i = s.lastIndexOf('.'); -- -- if (i > 0 && i < s.length() - 1) { -- ext = s.substring(i + 1).toLowerCase(); -- } -- return ext; -- } -- } -- --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/client-security-config.xml -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/client-security-config.xml (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/client-security-config.xml (working copy) -@@ -1,8 +0,0 @@ -- -- -- -- -- -- -- -- -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIApp.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIApp.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIApp.java (working copy) -@@ -1,46 +0,0 @@ --/* -- * GridFTPGUIApp.java -- */ -- --package org.globus.transfer.reliable.client; -- --import org.jdesktop.application.Application; --import org.jdesktop.application.SingleFrameApplication; -- --/** -- * The main class of the application. -- */ --public class GridFTPGUIApp extends SingleFrameApplication { -- -- -- /** -- * At startup create and show the main frame of the application. -- */ -- @Override protected void startup() { -- show(new GridFTPGUIView(this)); -- } -- -- /** -- * This method is to initialize the specified window by injecting resources. -- * Windows shown in our application come fully initialized from the GUI -- * builder, so this additional configuration is not needed. -- */ -- @Override protected void configureWindow(java.awt.Window root) { -- } -- -- /** -- * A convenient static getter for the application instance. -- * @return the instance of GridFTPGUIApp -- */ -- public static GridFTPGUIApp getApplication() { -- return Application.getInstance(GridFTPGUIApp.class); -- } -- -- /** -- * Main method launching the application. -- */ -- public static void main(String[] args) { -- //PropertyConfigurator.configure("log4j.properties"); -- launch(GridFTPGUIApp.class, args); -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptions.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptions.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptions.java (working copy) -@@ -1,65 +0,0 @@ --package org.globus.transfer.reliable.client; -- --public class RFTOptions { -- private int concurrent; -- private int parallelStream; -- private int tcpBufferSize; -- private String destDN; -- private String sourceDN; -- -- -- public RFTOptions() { -- -- } -- -- public RFTOptions(int concurrent, int parallelStream, -- int tcpBufferSize, String destDN, String sourceDN) { -- super(); -- this.concurrent = concurrent; -- this.parallelStream = parallelStream; -- this.tcpBufferSize = tcpBufferSize; -- this.destDN = destDN; -- this.sourceDN = sourceDN; -- } -- -- public int getConcurrent() { -- return concurrent; -- } -- -- public void setConcurrent(int concurrent) { -- this.concurrent = concurrent; -- } -- -- public int getParallelStream() { -- return parallelStream; -- } -- -- public void setParallelStream(int parallelStream) { -- this.parallelStream = parallelStream; -- } -- -- public int getTcpBufferSize() { -- return tcpBufferSize; -- } -- -- public void setTcpBufferSize(int tcpBufferSize) { -- this.tcpBufferSize = tcpBufferSize; -- } -- -- public String getDestDN() { -- return destDN; -- } -- -- public void setDestDN(String destDN) { -- this.destDN = destDN; -- } -- -- public String getSourceDN() { -- return sourceDN; -- } -- -- public void setSourceDN(String sourceDN) { -- this.sourceDN = sourceDN; -- } -- --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIAboutBox.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIAboutBox.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/GridFTPGUIAboutBox.java (working copy) -@@ -1,141 +0,0 @@ --/* -- * GridFTPGUIAboutBox.java -- */ -- --package org.globus.transfer.reliable.client; -- --import org.jdesktop.application.Action; -- --public class GridFTPGUIAboutBox extends javax.swing.JDialog { -- -- public GridFTPGUIAboutBox(java.awt.Frame parent) { -- super(parent); -- initComponents(); -- getRootPane().setDefaultButton(closeButton); -- } -- -- @Action public void closeAboutBox() { -- setVisible(false); -- } -- -- /** This method is called from within the constructor to -- * initialize the form. -- * WARNING: Do NOT modify this code. The content of this method is -- * always regenerated by the Form Editor. -- */ -- // //GEN-BEGIN:initComponents -- private void initComponents() { -- -- closeButton = new javax.swing.JButton(); -- javax.swing.JLabel appTitleLabel = new javax.swing.JLabel(); -- javax.swing.JLabel versionLabel = new javax.swing.JLabel(); -- javax.swing.JLabel appVersionLabel = new javax.swing.JLabel(); -- javax.swing.JLabel vendorLabel = new javax.swing.JLabel(); -- javax.swing.JLabel appVendorLabel = new javax.swing.JLabel(); -- javax.swing.JLabel homepageLabel = new javax.swing.JLabel(); -- javax.swing.JLabel appHomepageLabel = new javax.swing.JLabel(); -- javax.swing.JLabel appDescLabel = new javax.swing.JLabel(); -- imageLabel = new javax.swing.JLabel(); -- -- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); -- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(GridFTPGUIAboutBox.class); -- setTitle(resourceMap.getString("title")); // NOI18N -- setModal(true); -- setName("aboutBox"); // NOI18N -- setResizable(false); -- -- javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getActionMap(GridFTPGUIAboutBox.class, this); -- closeButton.setAction(actionMap.get("closeAboutBox")); // NOI18N -- closeButton.setName("closeButton"); // NOI18N -- -- appTitleLabel.setFont(appTitleLabel.getFont().deriveFont(appTitleLabel.getFont().getStyle() | java.awt.Font.BOLD, appTitleLabel.getFont().getSize()+4)); -- appTitleLabel.setText(resourceMap.getString("Application.title")); // NOI18N -- appTitleLabel.setName("appTitleLabel"); // NOI18N -- -- versionLabel.setFont(versionLabel.getFont().deriveFont(versionLabel.getFont().getStyle() | java.awt.Font.BOLD)); -- versionLabel.setText(resourceMap.getString("versionLabel.text")); // NOI18N -- versionLabel.setName("versionLabel"); // NOI18N -- -- appVersionLabel.setText(resourceMap.getString("Application.version")); // NOI18N -- appVersionLabel.setName("appVersionLabel"); // NOI18N -- -- vendorLabel.setFont(vendorLabel.getFont().deriveFont(vendorLabel.getFont().getStyle() | java.awt.Font.BOLD)); -- vendorLabel.setText(resourceMap.getString("vendorLabel.text")); // NOI18N -- vendorLabel.setName("vendorLabel"); // NOI18N -- -- appVendorLabel.setText(resourceMap.getString("Application.vendor")); // NOI18N -- appVendorLabel.setName("appVendorLabel"); // NOI18N -- -- homepageLabel.setFont(homepageLabel.getFont().deriveFont(homepageLabel.getFont().getStyle() | java.awt.Font.BOLD)); -- homepageLabel.setText(resourceMap.getString("homepageLabel.text")); // NOI18N -- homepageLabel.setName("homepageLabel"); // NOI18N -- -- appHomepageLabel.setText(resourceMap.getString("Application.homepage")); // NOI18N -- appHomepageLabel.setName("appHomepageLabel"); // NOI18N -- -- appDescLabel.setText(resourceMap.getString("appDescLabel.text")); // NOI18N -- appDescLabel.setName("appDescLabel"); // NOI18N -- -- imageLabel.setIcon(resourceMap.getIcon("imageLabel.icon")); // NOI18N -- imageLabel.setName("imageLabel"); // NOI18N -- -- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); -- getContentPane().setLayout(layout); -- layout.setHorizontalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .addContainerGap() -- .add(imageLabel) -- .add(32, 32, 32) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) -- .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup() -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(versionLabel) -- .add(vendorLabel) -- .add(homepageLabel)) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(appVersionLabel) -- .add(appVendorLabel) -- .add(appHomepageLabel))) -- .add(org.jdesktop.layout.GroupLayout.LEADING, appTitleLabel) -- .add(org.jdesktop.layout.GroupLayout.LEADING, appDescLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 368, Short.MAX_VALUE) -- .add(closeButton)) -- .addContainerGap()) -- ); -- layout.setVerticalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() -- .addContainerGap() -- .add(appTitleLabel) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(appDescLabel) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(versionLabel) -- .add(appVersionLabel)) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(vendorLabel) -- .add(appVendorLabel)) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(homepageLabel) -- .add(appHomepageLabel)) -- .add(119, 119, Short.MAX_VALUE) -- .add(closeButton)) -- .add(imageLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 252, Short.MAX_VALUE)) -- .addContainerGap()) -- ); -- -- pack(); -- }// //GEN-END:initComponents -- -- // Variables declaration - do not modify//GEN-BEGIN:variables -- private javax.swing.JButton closeButton; -- private javax.swing.JLabel imageLabel; -- // End of variables declaration//GEN-END:variables -- --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTPanel.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTPanel.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTPanel.java (working copy) -@@ -1,398 +0,0 @@ --/* -- * RFTPanel.java -- * -- * -- */ -- --package org.globus.transfer.reliable.client; -- --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; -- --import java.io.File; --import java.io.FileOutputStream; --import java.util.Properties; -- --import javax.swing.JFrame; --import javax.swing.JOptionPane; --import javax.swing.filechooser.FileFilter; -- --import org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel; -- -- --public class RFTPanel extends javax.swing.JPanel { -- private int jobID = 0; -- private JFrame frame = null; -- /** Creates new form RFTPanel */ -- public RFTPanel() { -- initComponents(); -- actionListener = new RFTButtonActionListener(this); -- } -- -- /** This method is called from within the constructor to -- * initialize the form. -- * WARNING: Do NOT modify this code. The content of this method is -- * always regenerated by the Form Editor. -- */ -- // //GEN-BEGIN:initComponents -- private void initComponents() { -- -- rftQueuePanel = new org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel(); -- rftQueuePanel.createHeader(new String[]{"Jobid", "From", "To", "Status", "%", "Errors"}); -- rftQueuePanel.addPopupItems(new String[]{"Info", "Cancel", "Delete"}, new ButtonActionListener()); -- rFTOptions1 = new RFTOptionsPanel(); -- rFTTransferParam1 = new RFTTransferParamPanel(); -- startButton = new javax.swing.JButton(); -- stopButton = new javax.swing.JButton(); -- okButton = new javax.swing.JButton(); -- -- setAutoscrolls(true); -- setName("Form"); // NOI18N -- -- rftQueuePanel.setName("rftQueuePanel"); // NOI18N -- -- rFTOptions1.setName("rFTOptions1"); // NOI18N -- -- rFTTransferParam1.setName("rFTTransferParam1"); // NOI18N -- -- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(RFTPanel.class); -- startButton.setText(resourceMap.getString("startButton.text")); // NOI18N -- startButton.setName("startButton"); // NOI18N -- startButton.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- startButtonActionPerformed(evt); -- } -- }); -- -- stopButton.setText(resourceMap.getString("stopButton.text")); // NOI18N -- stopButton.setName("stopButton"); // NOI18N -- stopButton.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- stopButtonActionPerformed(evt); -- } -- }); -- -- okButton.setText(resourceMap.getString("restartButton.text")); // NOI18N -- okButton.setName("restartButton"); // NOI18N -- okButton.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- okButtonActionPerformed(evt); -- } -- }); -- -- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); -- this.setLayout(layout); -- layout.setHorizontalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() -- .add(rFTOptions1, 100, 300, 400) -- .addContainerGap()) -- .add(rFTTransferParam1, 100, 300, 400) -- .add(layout.createSequentialGroup() -- .add(200, 200, 200) -- .add(okButton) -- ) -- ); -- -- layout.linkSize(new java.awt.Component[] {okButton}, org.jdesktop.layout.GroupLayout.HORIZONTAL); -- -- layout.setVerticalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .add(rFTOptions1, 80, 100, 130) -- .add(rFTTransferParam1, 150, 200, 250) -- .add(18, 18, 18) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(okButton)) -- .add(92, 92, 92)) -- ); -- -- -- }// //GEN-END:initComponents -- -- -- private void startButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startButtonActionPerformed -- new Thread(new Runnable() { -- public void run() { -- RFTTransferParam param = new RFTTransferParam(rFTTransferParam1.getFrom(), -- rFTTransferParam1.getTo(), rFTTransferParam1.getServerHost(), -- rFTTransferParam1.getServerPort()); -- RFTOptions options = new RFTOptions(rFTTransferParam1.getConcurrent(), -- rFTOptions1.getParallelStream(), rFTOptions1.getTcpBufferSize(), -- rFTOptions1.getDestSN(), rFTOptions1.getSourceSN()); -- RFTJob job = new RFTJob(++jobID, options, param); -- try { -- actionListener.startButtonAction(job, rftQueuePanel); -- } catch (Exception e) { -- JOptionPane.showMessageDialog(null,e.getMessage(), "Error", -- JOptionPane.WARNING_MESSAGE); -- int index = rftQueuePanel.getRowIndex(Integer.toString(jobID)); -- rftQueuePanel.setColumnValue(index, 3, "Failed"); -- rftQueuePanel.setColumnValue(index, 5, e.getMessage()); -- e.printStackTrace(); -- } -- } -- }).start(); -- }//GEN-LAST:event_startButtonActionPerformed -- -- private void stopButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed -- new Thread(new Runnable() { -- public void run() { -- String jobID = rftQueuePanel.getSelectedJob(); -- try { -- actionListener.stopButtonAction(jobID); -- } catch (Exception e) { -- JOptionPane.showMessageDialog(null,e.getMessage(), "Error", -- JOptionPane.WARNING_MESSAGE); -- int index = rftQueuePanel.getRowIndex(jobID, 0); -- rftQueuePanel.setColumnValue(index, 4, "Failed"); -- rftQueuePanel.setColumnValue(index, 6, e.getMessage()); -- e.printStackTrace(); -- } -- } -- }).start(); -- }//GEN-LAST:event_stopButtonActionPerformed -- -- private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stopButtonActionPerformed -- Properties prop = new Properties(); -- try { -- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; -- File dir = new File(globusDir, "GridFTP_GUI"); -- if (!dir.exists() || !dir.isDirectory()) { -- dir.mkdirs(); -- } -- -- File prop_file = new File(dir, "rft.properties"); -- -- prop.setProperty("rft_enabled", String.valueOf(rFTTransferParam1.isRFTEnabled())); -- prop.setProperty("host", rFTTransferParam1.getServerHost()); -- prop.setProperty("port", rFTTransferParam1.getServerPort()); -- prop.setProperty("concurrent", Integer.toString(rFTTransferParam1.getConcurrent())); -- prop.setProperty("parallelstream", Integer.toString(rFTOptions1.getParallelStream())); -- prop.setProperty("tcpbuffersize", Integer.toString(rFTOptions1.getTcpBufferSize())); -- prop.store(new FileOutputStream(prop_file), null); -- } catch (Exception e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } -- this.frame.setVisible(false); -- }//GEN-LAST:event_stopButtonActionPerformed -- -- public void setFrame(JFrame f) { -- this.frame = f; -- } -- -- /** -- * delete a transfer from queue panel and cancel actually transfer -- * @param jobid -- */ -- public void deleteTransfer(String jobid) { -- try { -- actionListener.stopButtonAction(jobid); -- } catch (Exception e) { -- int index = rftQueuePanel.getRowIndex(jobid, 0); -- rftQueuePanel.setColumnValue(index, 3, "Failed"); -- rftQueuePanel.setColumnValue(index, 5, e.getMessage()); -- e.printStackTrace(); -- } -- rftQueuePanel.deleteTransfer(jobid); -- } -- -- /** -- * clear queue panel and cancel all transfer -- */ -- public void clear() { -- if (rftQueuePanel.tableSize() > 0) { -- Object aobj[] = {"Yes", "No"}; -- int k = JOptionPane.showOptionDialog(null, " Do you wish to clear all the jobs and stop the unfinished jobs ?", "Cancellation Alert", -1, 2, null, aobj, aobj[0]); -- if (k != 1) { -- -- -- int tableSize = rftQueuePanel.tableSize(); -- -- //cancel all transfer -- for (int i = 0; i < tableSize; i++) { -- String jobID = rftQueuePanel.getColumnValue(i, 0); -- try { -- actionListener.stopButtonAction(jobID); -- } catch (Exception e) { -- int index = rftQueuePanel.getRowIndex(jobID); -- rftQueuePanel.setColumnValue(index, 3, "Failed"); -- rftQueuePanel.setColumnValue(index, 5, e.getMessage()); -- e.printStackTrace(); -- } -- } -- -- //clear from queue panel -- rftQueuePanel.clear(); -- -- } -- } -- } -- -- public QueuePanel getQueuePanel() { -- return rftQueuePanel; -- } -- -- public static void main(String[] args) { -- Integer i = org.globus.wsrf.security.Constants.SIGNATURE; -- JFrame frame = new JFrame(); -- RFTPanel panel = new RFTPanel(); -- frame.getContentPane().add(panel); -- frame.pack(); -- frame.setVisible(true); -- -- } -- -- -- private RFTButtonActionListener actionListener; -- // Variables declaration - do not modify//GEN-BEGIN:variables -- private javax.swing.JLabel jLabel11; -- private RFTOptionsPanel rFTOptions1; -- private RFTTransferParamPanel rFTTransferParam1; -- private javax.swing.JButton okButton; -- private org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel rftQueuePanel; -- private javax.swing.JButton startButton; -- private javax.swing.JButton stopButton; -- // End of variables declaration//GEN-END:variables -- -- class ButtonActionListener implements ActionListener { -- public void actionPerformed(ActionEvent ae) { -- String actionCommand = ae.getActionCommand(); -- if (actionCommand.equals("Save")) { -- Thread saveThread = new Thread() { -- public void run() { -- if (rftQueuePanel.tableSize() > 0) { -- //theApp.saveQueueToFile("rft"); -- } -- } -- }; -- saveThread.start(); -- } else if (actionCommand.equals("Load")) { -- Thread loadThread = new Thread() { -- public void run() { -- //theApp.loadQueueFromFile("rft"); -- } -- }; -- loadThread.start(); -- } else if (actionCommand.equals("Stop")) { -- Thread controlThread = new Thread() { -- public void run() { -- if (rftQueuePanel.tableSize() > 0) { -- //theApp.controlExecutionQueue(false, "rft"); -- } -- } -- }; -- controlThread.start(); -- } else if (actionCommand.equals("Start")) { -- Thread controlThread = new Thread() { -- public void run() { -- if (rftQueuePanel.tableSize() > 0) { -- //theApp.controlExecutionQueue(true, "rft"); -- } -- } -- }; -- controlThread.start(); -- } else if (actionCommand.equals("Clear")) { -- Thread controlThread = new Thread() { -- public void run() { -- if (rftQueuePanel.tableSize() > 0) { -- clear(); -- } -- } -- }; -- controlThread.start(); -- } else if (actionCommand.equals("Info")) { -- String job = rftQueuePanel.getSelectedJob(); -- int row = rftQueuePanel.getRowIndex(job, 0); -- String msg = " Job ID : " + -- rftQueuePanel.getColumnValue(row, 0) -- + "\n From : " -- + rftQueuePanel.getColumnValue(row, 1) + -- "\n To : " + -- rftQueuePanel.getColumnValue(row, 2) + -- "\n Status : " + -- rftQueuePanel.getColumnValue(row, 3) -- + "\n Errors : " + -- rftQueuePanel.getColumnValue(row, 5) + -- "\n"; -- -- JOptionPane.showMessageDialog(null, -- msg, -- "RFT Job Information", -- JOptionPane.PLAIN_MESSAGE); -- -- } else if (actionCommand.equals("Cancel")) { -- Thread controlThread = new Thread() { -- public void run() { -- String jobID = rftQueuePanel.getSelectedJob(); -- try { -- actionListener.stopButtonAction(jobID); -- } catch (Exception e) { -- JOptionPane.showMessageDialog(null,e.getMessage(), "Error", -- JOptionPane.WARNING_MESSAGE); -- int index = rftQueuePanel.getRowIndex(jobID); -- rftQueuePanel.setColumnValue(index, 3, "Failed"); -- rftQueuePanel.setColumnValue(index, 5, e.getMessage()); -- e.printStackTrace(); -- } -- } -- }; -- controlThread.start(); -- -- } else if (actionCommand.equals("Delete")) { -- String jobID = rftQueuePanel.getSelectedJob(); -- int row = rftQueuePanel.getRowIndex(jobID, 0); -- if (!rftQueuePanel.getColumnValue(row, 3).equals("Finished")) { -- Object aobj[] = {"Yes", "No"}; -- int k = JOptionPane.showOptionDialog(null, " This job is not Finished yet. Do you wish to cancel the job and delete it?", "Deletion Alert", -1, 2, null, aobj, aobj[0]); -- if (k == 1) { -- return; -- } else { -- deleteTransfer(jobID); -- } -- } else { -- deleteTransfer(jobID); -- } -- -- } -- } -- -- } -- -- public class MyFilter extends FileFilter { -- -- public boolean accept(File f) { -- if (f.isDirectory()) { -- return true; -- } -- -- String extension = getExtension(f); -- if (extension != null) { -- if (extension.equals("xfr")) { -- return true; -- } else { -- return false; -- } -- } -- -- return false; -- } -- -- public String getDescription() { -- return ".xfr files"; -- } -- -- public String getExtension(File f) { -- String ext = null; -- String s = f.getName(); -- int i = s.lastIndexOf('.'); -- -- if (i > 0 && i < s.length() - 1) { -- ext = s.substring(i + 1).toLowerCase(); -- } -- return ext; -- } -- } -- --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/webstart/ProgramStarter.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/webstart/ProgramStarter.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/webstart/ProgramStarter.java (working copy) -@@ -1,210 +0,0 @@ --package org.globus.transfer.reliable.client.webstart; -- --import java.io.BufferedOutputStream; --import java.io.File; --import java.io.FileOutputStream; --import java.io.IOException; --import java.io.InputStream; --import java.net.URL; --import java.net.URLConnection; --import java.util.Enumeration; --import java.util.zip.ZipEntry; --import java.util.zip.ZipFile; -- --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; --import org.apache.log4j.PropertyConfigurator; --import org.apache.tools.ant.Project; --import org.apache.tools.ant.ProjectHelper; --import org.globus.transfer.reliable.client.utils.UIConstants; -- --/** -- * This class is intended for launching the client using Java Web Start. -- * It can download, untar GT ws-core automatically, specify system properties -- * for the client and launch it. -- * -- * @author Liu Wantao liuwt at uchicago.edu -- * -- */ --public class ProgramStarter { -- private static Log logger = LogFactory.getLog(ProgramStarter.class); -- private static String JWSCacheDir = System.getProperty("deployment.user.cachedir"); -- private static String GLOBUS_LOCATION = JWSCacheDir + File.separator + "ws_core1"; -- private static String downloadLink = "http://www-unix.globus.org/ftppub/gt4/4.0/4.0.7/ws-core/bin/ws-core-4.0.7-bin.zip"; -- private static String gtFileName = JWSCacheDir + File.separator + "ws-core-4.0.7-bin.zip"; -- -- -- /** -- * Download GT ws-core automatically -- * @param link -- * @return -- */ -- private boolean downloadGT(String link) { -- logger.debug("download GT ws-core from:" + link); -- -- boolean ret = false; -- InputStream inStream = null; -- FileOutputStream fos = null; -- try { -- URL url = new URL(link); -- URLConnection conn = url.openConnection(); -- inStream = conn.getInputStream(); -- fos = new FileOutputStream(gtFileName); -- byte[] buffer = new byte[5 * 1024 * 1024]; -- int length = -1; -- -- while ((length = inStream.read(buffer)) != -1) { -- fos.write(buffer, 0, length); -- } -- -- ret = true; -- } catch (Exception e) { -- logger.error(e.getMessage(), e); -- ret = false; -- } finally { -- try { -- inStream.close(); -- fos.close(); -- } catch (Exception e) { -- -- } -- } -- -- return ret; -- } -- -- /** -- * extract GT ws-core from downloaded zip file -- * @param zipFileName -- * -- */ -- private void extractGT(String zipFileName) { -- logger.debug("extract GT ws-core from:" + zipFileName); -- InputStream input = null; -- BufferedOutputStream bos = null; -- ZipFile zfile = null; -- -- try { -- zfile = new ZipFile(zipFileName); -- Enumeration zlist = zfile.entries(); -- ZipEntry entry = null; -- byte[] buf = new byte[8192]; -- -- //iterate every entry in the zip file -- while (zlist.hasMoreElements()) { -- //System.out.println(entry.getName()); -- entry = (ZipEntry) zlist.nextElement(); -- if (entry.isDirectory()) { -- continue; -- } -- -- String name = entry.getName(); -- name = name.substring(name.indexOf("/")); -- input = zfile.getInputStream(entry); -- File file = new File(GLOBUS_LOCATION, name); -- if (!file.getParentFile().exists()) { -- file.getParentFile().mkdirs(); -- } -- bos = new BufferedOutputStream(new FileOutputStream(file)); -- -- int length = -1; -- while ((length = input.read(buf)) != -1) { -- bos.write(buf, 0, length); -- } -- -- bos.flush(); -- } -- } catch (IOException e) { -- logger.error(e.getMessage(), e); -- } finally { -- try { -- zfile.close(); -- input.close(); -- bos.close(); -- } catch (Exception e) { -- -- } -- } -- } -- -- /** -- * set GLOBUS_LOCATION and axis.ClientConfigFile for the GUI client -- * @param globus_location -- */ -- private void setEnv(String globus_location) { -- System.setProperty("GLOBUS_LOCATION", GLOBUS_LOCATION); -- String path = GLOBUS_LOCATION + File.separator + "client-config.wsdd"; -- System.setProperty("axis.ClientConfigFile", path); -- } -- -- /** -- * check if GT ws_core is exist in local disk -- * @return -- */ -- private boolean isGTExist() { -- File gt = new File(GLOBUS_LOCATION); -- if (gt.exists() && gt.isDirectory()) { -- return true; -- } -- -- return false; -- } -- -- private void loadGUI() { -- org.globus.transfer.reliable.client.GridFTPGUIApp.main(null); -- } -- -- private void invokeAnt() { -- try { -- URL url = Thread.currentThread().getContextClassLoader().getResource("scripts/build.xml"); -- //System.out.println(new File(".").getCanonicalPath()); -- logger.debug(url); -- Project p = new Project(); -- p.init(); -- p.setProperty("JWSCacheDir", JWSCacheDir); -- ProjectHelper helper = ProjectHelper.getProjectHelper(); -- helper.parse(p, url); -- p.executeTarget(p.getDefaultTarget()); -- } catch (Exception e) { -- e.printStackTrace(); -- logger.debug(e.getMessage(), e); -- } -- -- } -- -- private void configLog() { -- File logLocationFile = new File(UIConstants.LOG_CONFIG); -- -- if (!logLocationFile.exists()) { -- loadDefaultLog(); -- } else { -- try { -- PropertyConfigurator.configure(UIConstants.LOG_CONFIG); -- } catch (Exception e) { -- loadDefaultLog(); -- } -- } -- } -- -- private void loadDefaultLog() { -- URL url = Thread.currentThread().getContextClassLoader().getResource(UIConstants.DEFAULT_LOG_CONFIG); -- PropertyConfigurator.configure(url); -- } -- -- public static void main(String[] args) { -- ProgramStarter starter = new ProgramStarter(); -- starter.configLog(); -- starter.invokeAnt(); -- -- if (!starter.isGTExist()) { -- if (starter.downloadGT(downloadLink)) { -- starter.extractGT(gtFileName); -- } else { -- System.exit(1); -- } -- } -- -- starter.setEnv(GLOBUS_LOCATION); -- starter.loadGUI(); -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferFileParser.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferFileParser.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferFileParser.java (working copy) -@@ -1,76 +0,0 @@ --package org.globus.transfer.reliable.client; -- --import java.io.BufferedReader; --import java.io.File; --import java.io.FileReader; --import java.io.IOException; --import java.util.Vector; -- --import org.globus.rft.generated.TransferType; -- --public class RFTTransferFileParser { -- Vector requestData = new Vector(); -- -- public void loadTransferFile(String filePath) throws Exception { -- File transferFile = new File(filePath); -- if (!transferFile.exists() || !transferFile.isFile() -- || !transferFile.canRead()) { -- throw new IllegalArgumentException(filePath -- + " is not an illegal transfer file"); -- } -- -- BufferedReader reader = null; -- try { -- reader = new BufferedReader(new FileReader(transferFile)); -- -- -- String line = reader.readLine(); -- while (line != null) { -- if (!line.startsWith("#")) { -- if (!line.trim().equals("")) { -- requestData.add(line); -- } -- } -- line = reader.readLine(); -- } -- -- -- } catch (IOException e) { -- throw e; -- } finally { -- reader.close(); -- } -- } -- -- public TransferType[] getTransferType() throws Exception { -- int transferCount = (requestData.size() - 11) / 2; -- -- if (transferCount <= 0) { -- throw new Exception("Invalid transfer file format"); -- } -- -- TransferType[] transfers1 = new TransferType[transferCount]; -- int i = 11; -- for (int j = 0; j < transfers1.length; j++) { -- transfers1[j] = new TransferType(); -- transfers1[j].setSourceUrl((String) requestData.elementAt(i++)); -- transfers1[j].setDestinationUrl((String) requestData -- .elementAt(i++)); -- } -- -- return transfers1; -- } -- -- public RFTOptions getRFTOptions() { -- int i = 0; -- RFTOptions options = new RFTOptions(); -- -- options.setTcpBufferSize(Integer.valueOf((String) requestData.elementAt(i++))); -- options.setParallelStream(Integer.valueOf((String) requestData.elementAt(i++))); -- options.setConcurrent(Integer.valueOf((String) requestData.elementAt(i++)).intValue()); -- options.setSourceDN((String) requestData.elementAt(i++)); -- options.setDestDN((String) requestData.elementAt(i++)); -- -- return options; -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/Utils.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/Utils.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/Utils.java (working copy) -@@ -1,52 +0,0 @@ --/* -- * To change this template, choose Tools | Templates -- * and open the template in the editor. -- */ -- --package org.globus.transfer.reliable.client.utils; -- --import java.io.File; --import java.io.FileInputStream; --import java.io.FileNotFoundException; --import java.io.IOException; --import java.util.Properties; -- --/** -- * Some utility functions -- * @author Wantao -- */ --public class Utils { -- -- /** -- * get all file system root -- * @return -- */ -- public static File[] getFileSystemRoots() { -- //File file = new File("."); -- File[] roots = File.listRoots(); -- -- return roots; -- } -- -- public static String getProperty(String propertyName, String propertyFileName) { -- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; -- File dir = new File(globusDir, "GridFTP_GUI"); -- File propFile = new File(dir, propertyFileName); -- String ret = null; -- if (!propFile.exists()) { -- return null; -- } -- -- Properties prop = new Properties(); -- try { -- prop.load(new FileInputStream(propFile)); -- ret = prop.getProperty(propertyName); -- -- } catch (Exception e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } -- -- return ret; -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/LogFileUtils.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/LogFileUtils.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/LogFileUtils.java (working copy) -@@ -1,72 +0,0 @@ --package org.globus.transfer.reliable.client.utils; -- --import java.io.BufferedInputStream; --import java.io.FileInputStream; --import java.io.FileOutputStream; --import java.io.IOException; --import java.io.InputStream; --import java.util.Properties; -- --/** -- * some utility functions for log -- * @author Liu Wantao liuwt at uchicago.edu -- * -- */ --public class LogFileUtils { -- -- /** -- * create a new log4j configuration file -- * @param logFileLocation -- */ -- public static void createNewLogConfigFile(String logFileLocation) { -- FileOutputStream fos = null; -- try { -- fos = new FileOutputStream(UIConstants.LOG_CONFIG); -- Properties prop = new Properties(); -- prop.setProperty("log4j.rootCategory", "ERROR, A1"); -- prop.setProperty("log4j.appender.A1", "org.apache.log4j.FileAppender"); -- prop.setProperty("log4j.appender.A1.file", logFileLocation); -- prop.setProperty("log4j.appender.A1.layout", "org.apache.log4j.PatternLayout"); -- prop.setProperty("log4j.appender.A1.layout.ConversionPattern", "%d{ISO8601} %-5p %c{2} [%t,%M:%L] %m%n"); -- prop.setProperty("log4j.category.org.globus", "DEBUG"); -- prop.store(fos, null); -- } catch (Exception e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } finally { -- try { -- fos.close(); -- } catch (IOException e) { -- } -- } -- } -- -- public static void updateLogConfigFile(String logFileLocation) { -- InputStream is = null; -- FileOutputStream fos = null; -- try { -- is = new BufferedInputStream(new FileInputStream(UIConstants.LOG_CONFIG)); -- Properties prop = new Properties(); -- prop.load(is); -- prop.setProperty("log4j.appender.A1.file", logFileLocation); -- -- fos = new FileOutputStream(UIConstants.LOG_CONFIG); -- prop.store(fos, null); -- -- } catch (Exception e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } finally { -- try { -- is.close(); -- fos.close(); -- } catch (IOException e) { -- } -- } -- } -- -- public static void main(String[] args) { -- createNewLogConfigFile("fd"); -- updateLogConfigFile("fefefe"); -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/UIConstants.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/UIConstants.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/utils/UIConstants.java (working copy) -@@ -1,15 +0,0 @@ --package org.globus.transfer.reliable.client.utils; -- --/** -- * -- * @author Liu Wantao liuwt at uchicago.edu -- */ --public class UIConstants { -- public static int MAXSITES = 10; -- public static String ILLEGAL_HOST = "illegal host"; -- public static String HTTP_PROTOCOL = "http"; -- public static String HTTPS_PROTOCOL = "https"; -- public static String DONE_STATUS = "done"; -- public static String DEFAULT_LOG_CONFIG = "log4j_gui_default.properties"; -- public static String LOG_CONFIG = ".log4j.properties"; --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParam.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParam.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTTransferParam.java (working copy) -@@ -1,52 +0,0 @@ --package org.globus.transfer.reliable.client; -- -- --import org.globus.rft.generated.TransferType; -- --public class RFTTransferParam { -- private TransferType[] transfers1 = null; -- private String serverHost = null; -- private String serverPort = null; -- -- public RFTTransferParam(String from, String to, String serverHost, -- String serverPort) { -- transfers1 = new TransferType[1]; -- transfers1[0] = new TransferType(); -- transfers1[0].setSourceUrl(from); -- transfers1[0].setDestinationUrl(to); -- this.serverHost = serverHost; -- this.serverPort = serverPort; -- } -- -- public RFTTransferParam(TransferType[] transferTypes, String serverHost, -- String serverPort) throws Exception { -- transfers1 = transferTypes; -- this.serverHost = serverHost; -- this.serverPort = serverPort; -- -- } -- -- public TransferType[] getTransfers1() { -- return transfers1; -- } -- -- public void setTransfers1(TransferType[] transfers1) { -- this.transfers1 = transfers1; -- } -- -- public String getServerHost() { -- return serverHost; -- } -- -- public void setServerHost(String serverHost) { -- this.serverHost = serverHost; -- } -- -- public String getServerPort() { -- return serverPort; -- } -- -- public void setServerPort(String serverPort) { -- this.serverPort = serverPort; -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileTransferClient.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileTransferClient.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/ReliableFileTransferClient.java (working copy) -@@ -1,245 +0,0 @@ --/* -- * Portions of this file Copyright 1999-2005 University of Chicago -- * Portions of this file Copyright 1999-2005 The University of Southern California. -- * -- * This file or a portion of this file is licensed under the -- * terms of the Globus Toolkit Public License, found at -- * http://www.globus.org/toolkit/download/license.html. -- * If you redistribute this file, with or without -- * modifications, you must include this notice in the file. -- */ -- --package org.globus.transfer.reliable.client; -- --import java.io.BufferedReader; --import java.io.File; --import java.io.FileReader; --import java.io.FileWriter; --import java.util.Calendar; --import java.util.Vector; -- --import javax.xml.namespace.QName; --import javax.xml.rpc.Stub; --import org.apache.axis.message.addressing.Address; --import org.apache.axis.message.addressing.EndpointReferenceType; --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; -- --import org.globus.gsi.GSIConstants; --import org.globus.rft.generated.RFTOptionsType; --import org.globus.rft.generated.ReliableFileTransferPortType; --import org.globus.rft.generated.TransferRequestType; --import org.globus.rft.generated.TransferType; --import org.globus.rft.generated.Start; --import org.globus.rft.generated.StartOutputType; -- --import org.oasis.wsrf.lifetime.SetTerminationTime; --import org.oasis.wsrf.lifetime.SetTerminationTimeResponse; -- --import org.globus.wsrf.encoding.ObjectSerializer; -- --/** -- * Command line client for RFT service -- */ --public class ReliableFileTransferClient extends BaseRFTClient { -- private static Log logger = LogFactory.getLog(ReliableFileTransferClient.class); -- -- /** -- * Constructor -- */ -- public ReliableFileTransferClient() { -- super(); -- } -- -- /** -- * Gets the transfer attribute of the ReliableFileTransferClient class -- * @param epr -- * @param path -- * @return The transfer value -- */ -- public static TransferRequestType getTransfer( -- String path, EndpointReferenceType epr) { -- File requestFile = new File(path); -- BufferedReader reader = null; -- -- try { -- reader = new BufferedReader(new FileReader(requestFile)); -- } catch (java.io.FileNotFoundException fnfe) { -- logger.debug(fnfe.getMessage(), fnfe); -- System.err.println(fnfe); -- System.exit(-1); -- } -- -- Vector requestData = new Vector(); -- -- try { -- -- String line = reader.readLine(); -- while (line != null) { -- if (!line.startsWith("#")) { -- if (!line.trim().equals("")) { -- requestData.add(line); -- } -- } -- line = reader.readLine(); -- -- } -- -- reader.close(); -- } catch (java.io.IOException ioe) { -- logger.debug(ioe.getMessage(), ioe); -- System.err.println("IOException:" + ioe.getMessage()); -- System.exit(-1); -- } -- -- transferCount = (requestData.size() - 11) / 2; -- -- if(transferCount <= 0) { -- System.err.println("Invalid transfer file format"); -- System.exit(-1); -- } -- TransferType[] transfers1 = new TransferType[transferCount]; -- RFTOptionsType multirftOptions = new RFTOptionsType(); -- int i = 0; -- multirftOptions.setBinary(Boolean.valueOf( -- (String) requestData.elementAt(i++))); -- multirftOptions.setBlockSize(Integer.valueOf( -- (String) requestData.elementAt(i++))); -- multirftOptions.setTcpBufferSize(Integer.valueOf( -- (String) requestData.elementAt(i++))); -- multirftOptions.setNotpt(Boolean.valueOf( -- (String) requestData.elementAt(i++))); -- multirftOptions.setParallelStreams(Integer.valueOf( -- (String) requestData.elementAt(i++))); -- multirftOptions.setDcau(Boolean.valueOf( -- (String) requestData.elementAt(i++))); -- int concurrency = Integer.valueOf((String) requestData.elementAt(i++)) -- .intValue(); -- -- String sourceSubjectName = (String) requestData.elementAt(i++); -- if (sourceSubjectName != null) { -- multirftOptions.setSourceSubjectName(sourceSubjectName); -- } -- String destinationSubjectName = (String) requestData.elementAt(i++); -- if (destinationSubjectName != null) { -- multirftOptions.setDestinationSubjectName(destinationSubjectName); -- } -- boolean allOrNone = Boolean.valueOf( -- (String) requestData.elementAt(i++)).booleanValue(); -- int maxAttempts = Integer.valueOf((String) requestData.elementAt(i++)) -- .intValue(); -- System.out.println("Number of transfers in this request: " -- + transferCount); -- -- for (int j = 0; j < transfers1.length; j++) { -- transfers1[j] = new TransferType(); -- transfers1[j].setSourceUrl((String) requestData.elementAt(i++)); -- transfers1[j] -- .setDestinationUrl((String) requestData.elementAt(i++)); -- } -- -- TransferRequestType transferRequest = new TransferRequestType(); -- transferRequest.setTransfer(transfers1); -- transferRequest.setRftOptions(multirftOptions); -- transferRequest.setConcurrency(new Integer(concurrency)); -- transferRequest.setAllOrNone(new Boolean(allOrNone)); -- transferRequest.setMaxAttempts(new Integer(maxAttempts)); -- transferRequest.setTransferCredentialEndpoint(epr); -- return transferRequest; -- } -- -- -- /** -- * @param args -- * @exception Exception -- */ -- public static void main(String args[]) throws Exception { -- -- if(args.length < 1) { -- printUsage(); -- System.exit(-1); -- } -- cmd = args; -- parseArgs(); -- -- TransferRequestType transferType = null; -- if (PORT == null) { -- if (authType.equals(GSIConstants.GSI_TRANSPORT)) { -- PORT = "8443"; -- } else { -- PORT ="8080"; -- } -- } -- if (authType.equals(GSIConstants.GSI_TRANSPORT)) { -- PROTOCOL = "https"; -- } -- String rftFactoryAddress = -- PROTOCOL + "://"+ HOST+ ":" + PORT + SERVICE_URL_ROOT -- + "ReliableFileTransferFactoryService"; -- String rftServiceAddress = PROTOCOL+ "://" + HOST + ":" + PORT + -- SERVICE_URL_ROOT + "ReliableFileTransferService"; -- -- EndpointReferenceType credEPR = delegateCredential(HOST, PORT); -- -- transferType = getTransfer(PATH_TO_FILE, credEPR); -- -- EndpointReferenceType rftepr = createRFT(rftFactoryAddress, -- transferType); -- if (outFileName != null) { -- FileWriter writer = null; -- try { -- writer = new FileWriter(outFileName); -- QName qName = new QName("", "RFT_EPR"); -- writer.write(ObjectSerializer.toString(rftepr, -- qName)); -- } finally { -- if (writer != null) { -- writer.close(); -- } -- } -- } -- rftepr.setAddress(new Address(rftServiceAddress)); -- ReliableFileTransferPortType rft = rftLocator -- .getReliableFileTransferPortTypePort(rftepr); -- setSecurity((Stub)rft); -- -- //For secure notifications -- subscribe(rft); -- System.out.println("Subscribed for overall status"); -- //End subscription code -- Calendar termTime = Calendar.getInstance(); -- termTime.add(Calendar.MINUTE, TERM_TIME); -- SetTerminationTime reqTermTime = new SetTerminationTime(); -- reqTermTime.setRequestedTerminationTime(termTime); -- System.out.println("Termination time to set: " + TERM_TIME -- + " minutes"); -- SetTerminationTimeResponse termRes = rft -- .setTerminationTime(reqTermTime); -- StartOutputType startresp = rft.start(new Start()); -- -- while (finished < transferCount && transferCount != 0) { -- if (failed == transferCount || -- (failed + finished == transferCount)) { -- break; -- } else { -- Thread.sleep(1000); -- } -- } -- if ((finished == transferCount) && (finished != 0)) { -- System.out.println( "All Transfers are completed"); -- System.exit(0); -- } -- if ((failed == transferCount) && (failed != 0)) { -- System.out.println( "All Transfers failed !"); -- System.exit(-1); -- } -- if ((failed + finished) == transferCount) { -- System.out.println( "Transfers Done"); -- System.exit(-1); -- } -- -- } -- -- --} -- -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/BaseRFTClient.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/BaseRFTClient.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/BaseRFTClient.java (working copy) -@@ -1,417 +0,0 @@ --/* -- * Portions of this file Copyright 1999-2005 University of Chicago -- * Portions of this file Copyright 1999-2005 The University of Southern California. -- * -- * This file or a portion of this file is licensed under the -- * terms of the Globus Toolkit Public License, found at -- * http://www.globus.org/toolkit/download/license.html. -- * If you redistribute this file, with or without -- * modifications, you must include this notice in the file. -- */ --package org.globus.transfer.reliable.client; -- --import java.net.URL; --import java.security.cert.X509Certificate; --import java.util.Calendar; --import java.util.List; --import java.util.Vector; --import java.util.Map; --import java.util.HashMap; -- --import javax.xml.rpc.Stub; -- --import org.globus.axis.util.Util; -- --import org.apache.axis.message.addressing.EndpointReferenceType; --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; --import org.globus.delegation.DelegationConstants; --import org.globus.delegation.DelegationUtil; --import org.globus.gsi.GlobusCredential; --import org.globus.wsrf.impl.security.util.AuthUtil; --import org.globus.ogsa.impl.security.authorization.SelfAuthorization; --import org.globus.rft.generated.BaseRequestType; --import org.globus.rft.generated.CreateReliableFileTransferInputType; --import org.globus.rft.generated.CreateReliableFileTransferOutputType; --import org.globus.rft.generated.DeleteRequestType; --import org.globus.rft.generated.OverallStatus; --import org.globus.rft.generated.RFTFaultResourcePropertyType; --import org.globus.rft.generated.ReliableFileTransferFactoryPortType; --import org.globus.rft.generated.ReliableFileTransferPortType; --import org.globus.rft.generated.TransferRequestType; --import org.globus.rft.generated.service.ReliableFileTransferFactoryServiceAddressingLocator; --import org.globus.rft.generated.service.ReliableFileTransferServiceAddressingLocator; --import org.globus.transfer.reliable.client.utils.LogFileUtils; --import org.globus.transfer.reliable.service.RFTConstants; -- --import org.globus.wsrf.container.ServiceContainer; --import org.globus.wsrf.NotificationConsumerManager; --import org.globus.wsrf.NotifyCallback; --import org.globus.wsrf.WSNConstants; --import org.globus.wsrf.client.BaseClient; --import org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType; --import org.globus.wsrf.impl.security.authorization.Authorization; --import org.globus.wsrf.impl.security.authorization.HostAuthorization; --import org.globus.wsrf.impl.security.authorization.ResourcePDPConfig; --import org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain; --import org.globus.wsrf.impl.security.descriptor.GSISecureMsgAuthMethod; --import org.globus.wsrf.impl.security.descriptor.GSISecureConvAuthMethod; --import org.globus.wsrf.impl.security.descriptor.GSITransportAuthMethod; --import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor; --import org.globus.wsrf.impl.security.descriptor.ClientSecurityDescriptor; --import org.globus.wsrf.security.Constants; --import org.globus.wsrf.utils.AddressingUtils; --import org.oasis.wsn.Subscribe; --import org.oasis.wsn.TopicExpressionType; --import org.oasis.wsrf.faults.BaseFaultType; --import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType; -- --/** -- * BaseClient for RFT service -- */ --public class BaseRFTClient extends BaseClient implements NotifyCallback { -- private static Log logger = LogFactory.getLog(BaseRFTClient.class); -- public static ReliableFileTransferServiceAddressingLocator rftLocator = -- new ReliableFileTransferServiceAddressingLocator(); -- -- static final String SERVICE_URL_ROOT = "/wsrf/services/"; -- -- public static ReliableFileTransferFactoryServiceAddressingLocator -- rftFactoryLocator = -- new ReliableFileTransferFactoryServiceAddressingLocator(); -- -- private static ReliableFileTransferFactoryPortType factoryPort; -- -- private static NotificationConsumerManager consumer = null; -- -- public static int transferCount = 0; -- -- public static int finished = 0; -- -- public static int failed = 0; -- -- -- public static URL endpoint = null; -- -- public static String HOST = "127.0.0.1"; -- -- public static String PORT = null; -- -- public static String PROTOCOL = "http"; -- -- public static int TERM_TIME = 60; -- -- public static String PATH_TO_FILE = null; -- -- public static String AUTHZ = "host"; -- -- public static String cmd[]; -- -- public static String outFileName = null; -- -- public static Object authType = Constants.GSI_TRANSPORT; -- -- public static Object authVal = Constants.SIGNATURE; -- -- public static Authorization authzVal = HostAuthorization.getInstance(); -- -- public static String optionString = -- "rft [options] -f \n" -- + "Where options can be:\n" -- + "-h Defaults to 'localhost'.\n" -- + "-r Defaults to TCP port 8443.\n" -- + "-l lifetime of the created resource in minutes Defaults to 60 mins.\n" -- + "-m security mechanism Allowed values: 'msg' for secure messages, 'conv' for\n" -- + " secure conversation and 'trans' for secure transport. Defaults to \n" -- + " 'trans'.\n" -- + " -p protection type Allowed values: 'sig' for signature and 'enc' for encryption.\n" -- + " Defaults to 'sig'.\n" -- + " -z authorization Defaults to 'host' authorization. Allowed values: 'self' for\n" -- + " self authorization and 'host' for host authorization.\n" -- + " -file filename to write EPR of created Reliable" -- + " File Transfer Resource\n"; -- -- static { -- Util.registerTransport(); -- } -- -- -- public BaseRFTClient() { -- super(); -- } -- -- public static void parseArgs() { -- for(int i =0; i< cmd.length; i++) { -- if ((cmd[i].equals("--help")) || (cmd[i].equals("-help"))) { -- System.out.println( optionString ); -- System.exit(0); -- } else if(cmd[i].equals("-h")) { -- HOST = getValue(i); -- i++; -- } else if(cmd[i].equals("-r")) { -- PORT = getValue(i); -- i++; -- } else if(cmd[i].equals("-l")) { -- TERM_TIME = Integer.parseInt(getValue(i)); -- i++; -- } else if(cmd[i].equals("-z")) { -- AUTHZ = getValue(i); -- authzVal = AuthUtil.getClientAuthorization(AUTHZ); -- i++; -- } else if(cmd[i].equals("-m")) { -- String secType = getValue(i); -- if (secType.equals("msg")) { -- authType = Constants.GSI_SEC_MSG; -- } else if (secType.equals("conv")) { -- authType = Constants.GSI_SEC_CONV; -- } else if(secType.equals("trans")) { -- authType = Constants.GSI_TRANSPORT; -- } -- } else if (cmd[i].equals("-p")) { -- String prot = getValue(i); -- if (prot.equals("sig")) { -- authVal = Constants.SIGNATURE; -- } else if(prot.equals("enc")) { -- authVal = Constants.ENCRYPTION; -- } -- } else if (cmd[i].equals("-file")) { -- outFileName = getValue(i); -- } else if (cmd[i].equals("-f")) { -- PATH_TO_FILE = getValue(i); -- } -- } -- if (PATH_TO_FILE == null) { -- printUsage(); -- System.exit(-1); -- } -- } -- protected static String getValue(int i) { -- if (i + 1 > cmd.length) { -- System.err.println(cmd[i] + " needs a argument"); -- System.exit(-1); -- } -- return cmd[i+1]; -- } -- -- /** -- * @param request -- * @return rft epr -- * @exception Exception -- */ -- public static EndpointReferenceType createRFT(String rftFactoryAddress, -- BaseRequestType request) -- throws Exception { -- endpoint = new URL(rftFactoryAddress); -- factoryPort = rftFactoryLocator -- .getReliableFileTransferFactoryPortTypePort(endpoint); -- CreateReliableFileTransferInputType input = -- new CreateReliableFileTransferInputType(); -- //input.setTransferJob(transferType); -- if(request instanceof TransferRequestType) { -- input.setTransferRequest((TransferRequestType)request); -- } else { -- input.setDeleteRequest((DeleteRequestType)request); -- } -- Calendar termTime = Calendar.getInstance(); -- termTime.add(Calendar.HOUR, 1); -- input.setInitialTerminationTime(termTime); -- setSecurity((Stub)factoryPort); -- CreateReliableFileTransferOutputType response = factoryPort -- .createReliableFileTransfer(input); -- -- return response.getReliableTransferEPR(); -- } -- /** -- * Prints the usage -- */ -- public static void printUsage() { -- System.out.println(optionString); -- } -- /** -- * -- * @param topicPath -- * @param producer -- * @param message -- */ -- public void deliver(List topicPath, EndpointReferenceType producer, -- Object message) { -- ResourcePropertyValueChangeNotificationType changeMessage = -- ((ResourcePropertyValueChangeNotificationElementType) message) -- .getResourcePropertyValueChangeNotification(); -- BaseFaultType fault = null; -- try { -- -- if (changeMessage != null) { -- -- OverallStatus overallStatus = (OverallStatus) changeMessage -- .getNewValue().get_any()[0].getValueAsType( -- RFTConstants.OVERALL_STATUS_RESOURCE, -- OverallStatus.class); -- System.out.println("\n Overall status of transfer:"); -- System.out.println("Finished/Active/Failed/Retrying/Pending"); -- System.out.print(overallStatus.getTransfersFinished() + "/"); -- System.out.print(overallStatus.getTransfersActive() + "/"); -- System.out.print(overallStatus.getTransfersFailed() + "/"); -- System.out.print(overallStatus.getTransfersRestarted() + "/"); -- System.out.println(overallStatus.getTransfersPending()); -- if ( finished < overallStatus.getTransfersFinished()) { -- finished = overallStatus.getTransfersFinished(); -- } -- if (failed < overallStatus.getTransfersFailed()) { -- failed = overallStatus.getTransfersFailed(); -- } -- transferCount = overallStatus.getTransfersFinished() + overallStatus.getTransfersActive() -- + overallStatus.getTransfersFailed() + overallStatus.getTransfersRestarted() -- + overallStatus.getTransfersPending(); -- RFTFaultResourcePropertyType faultRP = overallStatus.getFault(); -- if(faultRP != null) { -- fault = getFaultFromRP(faultRP); -- } -- if (fault != null) { -- System.err.println("Error:" + fault.getDescription(0)); -- } -- -- } -- } catch (Exception e) { -- logger.debug(e.getMessage(), e); -- System.err.println(e.getMessage()); -- } -- } -- -- /** -- * @param host -- * @param port -- * @return -- * @throws Exception -- */ -- public static EndpointReferenceType -- delegateCredential(String host, String port) throws Exception { -- ClientSecurityDescriptor desc = getClientSecDesc(); -- // Credential to sign with, assuming default credential -- GlobusCredential credential = GlobusCredential.getDefaultCredential(); -- //desc.setGSITransport(Constants.GSI_TRANSPORT); -- //desc.setAuthz(AuthUtil.getClientAuthorization("self")); -- -- -- String factoryUrl = PROTOCOL + "://" + host + ":" -- + port + SERVICE_URL_ROOT -- + DelegationConstants.FACTORY_PATH; -- -- // lifetime in seconds -- int lifetime = TERM_TIME * 60; -- -- // Get the public key to delegate on. -- EndpointReferenceType delegEpr = AddressingUtils -- .createEndpointReference(factoryUrl, null); -- X509Certificate[] certsToDelegateOn = DelegationUtil -- .getCertificateChainRP(delegEpr, desc); -- X509Certificate certToSign = certsToDelegateOn[0]; -- -- // send to delegation service and get epr. -- // Authz set to null, so HostAuthz will be done. -- return DelegationUtil.delegate(factoryUrl, -- credential, certToSign, lifetime, false, -- desc); -- } -- -- public static void setSecurity(Stub stub) { -- stub._setProperty(Constants.CLIENT_DESCRIPTOR, -- getClientSecDesc()); -- } -- -- public static void -- subscribe(ReliableFileTransferPortType rft) -- throws Exception { -- Subscribe request = new Subscribe(); -- request.setUseNotify(Boolean.TRUE); -- if(PROTOCOL.equals("http")) { -- consumer = NotificationConsumerManager.getInstance(); -- } else if (PROTOCOL.equals("https")) { -- Map properties = new HashMap(); -- properties.put(ServiceContainer.CLASS, -- "org.globus.wsrf.container.GSIServiceContainer"); -- consumer = NotificationConsumerManager.getInstance(properties); -- } -- consumer.startListening(); -- EndpointReferenceType consumerEPR = null; -- ResourceSecurityDescriptor resDesc = new ResourceSecurityDescriptor(); -- Vector authMethod = new Vector(); -- if(AUTHZ.equalsIgnoreCase("host")) { -- ResourcePDPConfig pdpConfig = new ResourcePDPConfig("host"); -- pdpConfig.setProperty(Authorization.HOST_PREFIX, -- HostAuthorization.URL_PROPERTY,endpoint); -- ServiceAuthorizationChain authz = new ServiceAuthorizationChain(); -- authz.initialize(pdpConfig, "chainName", "someId"); -- resDesc.setAuthzChain(authz); -- } else if(AUTHZ.equalsIgnoreCase("self")) { -- resDesc.setAuthz("self"); -- } -- if (PROTOCOL.equals("http")) { -- if (authType.equals(Constants.GSI_SEC_MSG)) { -- authMethod.add(GSISecureMsgAuthMethod.BOTH); -- } else if (authType.equals(Constants.GSI_SEC_CONV)) { -- authMethod.add(GSISecureConvAuthMethod.BOTH); -- } -- } else if (PROTOCOL.equals("https")) { -- authMethod.add(GSITransportAuthMethod.BOTH); -- } -- resDesc.setAuthMethods(authMethod); -- consumerEPR = consumer.createNotificationConsumer( -- new BaseRFTClient(), resDesc); -- request.setConsumerReference(consumerEPR); -- TopicExpressionType topicExpression = new TopicExpressionType(); -- topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT); -- topicExpression.setValue(RFTConstants.OVERALL_STATUS_RESOURCE); -- request.setTopicExpression(topicExpression); -- -- rft.subscribe(request); -- } -- -- private BaseFaultType getFaultFromRP(RFTFaultResourcePropertyType faultRP) { -- if(faultRP.getRftAuthenticationFaultType() != null) { -- return faultRP.getRftAuthenticationFaultType(); -- } else if(faultRP.getRftAuthorizationFaultType() != null) { -- return faultRP.getRftAuthorizationFaultType(); -- } else if(faultRP.getRftDatabaseFaultType() != null) { -- return faultRP.getRftDatabaseFaultType(); -- } else if(faultRP.getRftRepeatedlyStartedFaultType() != null) { -- return faultRP.getRftRepeatedlyStartedFaultType(); -- } else if(faultRP.getRftTransferFaultType() != null) { -- return faultRP.getRftTransferFaultType(); -- } else if(faultRP.getTransferTransientFaultType() != null) { -- return faultRP.getTransferTransientFaultType(); -- } else { -- return null; -- } -- } -- -- public static void setAuthzValue(String authz) { -- if ("SELF".equals(authz)) { -- authzVal = HostAuthorization.getInstance(); -- } else if ("HOST".equals(authz)) { -- authzVal = HostAuthorization.getInstance(); -- } -- -- } -- -- public static ClientSecurityDescriptor getClientSecDesc() { -- ClientSecurityDescriptor desc = new ClientSecurityDescriptor(); -- if (authType.equals(Constants.GSI_SEC_MSG)) { -- desc.setGSISecureMsg((Integer)authVal); -- } else if (authType.equals(Constants.GSI_SEC_CONV)) { -- desc.setGSISecureConv((Integer)authVal); -- } else if (authType.equals(Constants.GSI_TRANSPORT)) { -- desc.setGSITransport((Integer)authVal); -- Util.registerTransport(); -- } -- desc.setAuthz(authzVal); -- return desc; -- } -- -- public static ReliableFileTransferFactoryPortType -- getFactoryPort(String rftFactoryAddress) throws Exception { -- endpoint = new URL(rftFactoryAddress); -- return rftFactoryLocator.getReliableFileTransferFactoryPortTypePort(endpoint); -- } -- --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTJob.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTJob.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTJob.java (working copy) -@@ -1,36 +0,0 @@ --/* -- * To change this template, choose Tools | Templates -- * and open the template in the editor. -- */ -- --package org.globus.transfer.reliable.client; -- --/** -- * Application level job object, encapsules parameters and options related to a RFT transfer, -- * each job has a unique jobID, which is an incremental integer -- * @author Liu Wantao liuwt at uchicago.edu -- */ --public class RFTJob { -- private int jobID = 0; -- private RFTOptions options; -- private RFTTransferParam param; -- -- public RFTJob(int jobID, RFTOptions options, RFTTransferParam param) { -- this.jobID = jobID; -- this.options = options; -- this.param = param; -- } -- -- public int getJobID() { -- return jobID; -- } -- -- public RFTOptions getOptions() { -- return options; -- } -- -- public RFTTransferParam getParam() { -- return param; -- } -- --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptionsPanel.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptionsPanel.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTOptionsPanel.java (working copy) -@@ -1,195 +0,0 @@ --package org.globus.transfer.reliable.client; -- --import java.awt.event.ItemEvent; --import java.awt.event.ItemListener; --import javax.swing.JFrame; -- --public class RFTOptionsPanel extends javax.swing.JPanel implements ItemListener { -- -- /** Creates new form RFTOptions */ -- public RFTOptionsPanel() { -- initComponents(); -- } -- -- /** This method is called from within the constructor to -- * initialize the form. -- * WARNING: Do NOT modify this code. The content of this method is -- * always regenerated by the Form Editor. -- */ -- // //GEN-BEGIN:initComponents -- private void initComponents() { -- jLabel3 = new javax.swing.JLabel(); -- tcpBufferSize = new javax.swing.JTextField(); -- jLabel4 = new javax.swing.JLabel(); -- jLabel5 = new javax.swing.JLabel(); -- jLabel7 = new javax.swing.JLabel(); -- parallelStream = new javax.swing.JTextField(); -- jLabel9 = new javax.swing.JLabel(); -- concurrent = new javax.swing.JTextField(); -- jLabel10 = new javax.swing.JLabel(); -- sourceSN = new javax.swing.JTextField(); -- jLabel11 = new javax.swing.JLabel(); -- destSN = new javax.swing.JTextField(); -- -- org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(org.globus.transfer.reliable.client.GridFTPGUIApp.class).getContext().getResourceMap(RFTOptionsPanel.class); -- setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("Form.border.title"))); // NOI18N -- setName("Form"); // NOI18N -- -- jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N -- jLabel3.setName("jLabel3"); // NOI18N -- -- tcpBufferSize.setText(resourceMap.getString("tcpBufferSize.text")); // NOI18N -- tcpBufferSize.setName("tcpBufferSize"); // NOI18N -- -- jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N -- jLabel4.setName("jLabel4"); // NOI18N -- -- jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N -- jLabel5.setName("jLabel5"); // NOI18N -- -- -- jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N -- jLabel7.setName("jLabel7"); // NOI18N -- -- parallelStream.setText(resourceMap.getString("parallelStream.text")); // NOI18N -- parallelStream.setName("parallelStream"); // NOI18N -- -- jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N -- jLabel9.setName("jLabel9"); // NOI18N -- -- concurrent.setText(resourceMap.getString("concurrent.text")); // NOI18N -- concurrent.setName("concurrent"); // NOI18N -- -- jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N -- jLabel10.setName("jLabel10"); // NOI18N -- -- sourceSN.setText(resourceMap.getString("sourceSN.text")); // NOI18N -- sourceSN.setName("sourceSN"); // NOI18N -- -- jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N -- jLabel11.setName("jLabel11"); // NOI18N -- -- destSN.setText(resourceMap.getString("destSN.text")); // NOI18N -- destSN.setName("destSN"); // NOI18N -- -- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); -- this.setLayout(layout); -- -- layout.setHorizontalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .addContainerGap() -- .add(64, 64, 64) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(jLabel7) -- .add(jLabel3)) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) -- .add(parallelStream, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 76, Short.MAX_VALUE) -- .add(tcpBufferSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, Short.MAX_VALUE)) -- -- ) -- )) -- ); -- layout.setVerticalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .add(26, 26, 26) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(jLabel7) -- .add(parallelStream, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) -- -- ) -- .add(11, 11, 11) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(jLabel3) -- .add(tcpBufferSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) -- ) -- ) -- ) -- ); -- -- }// //GEN-END:initComponents -- -- -- -- public boolean getAllOrNone() { -- return isAllorNone; -- } -- -- public boolean getBinary() { -- return isBinary; -- } -- -- public boolean getDCAU() { -- return isDCAU; -- } -- -- public String getDestSN() { -- return destSN.getText(); -- } -- -- public boolean getNoTpt() { -- return isNoTpt; -- } -- -- public int getParallelStream() { -- String value = parallelStream.getText(); -- int ret = 1; -- if (null != value) { -- try { -- ret = Integer.valueOf(value); -- } catch (NumberFormatException e) { -- ret = 1; -- } -- } -- -- return ret; -- } -- -- public String getSourceSN() { -- return sourceSN.getText(); -- } -- -- public int getTcpBufferSize() { -- String value = tcpBufferSize.getText(); -- int ret = 16000; -- if (null != value) { -- try { -- ret = Integer.valueOf(value); -- } catch (NumberFormatException e) { -- ret = 16000; -- } -- } -- -- return ret; -- } -- -- public static void main(String[] args) { -- JFrame f = new JFrame(); -- f.getContentPane().add(new RFTOptionsPanel()); -- f.setVisible(true); -- } -- // Variables declaration - do not modify//GEN-BEGIN:variables -- private javax.swing.JTextField concurrent; -- private javax.swing.JTextField destSN; -- private javax.swing.JLabel jLabel10; -- private javax.swing.JLabel jLabel11; -- private javax.swing.JLabel jLabel3; -- private javax.swing.JLabel jLabel4; -- private javax.swing.JLabel jLabel5; -- private javax.swing.JLabel jLabel7; -- private javax.swing.JLabel jLabel9; -- private javax.swing.JTextField parallelStream; -- private javax.swing.JTextField sourceSN; -- private javax.swing.JTextField tcpBufferSize; -- private boolean isBinary = true; -- private boolean isNoTpt = false; -- private boolean isDCAU = true; -- private boolean isAllorNone = false; -- -- public void itemStateChanged(ItemEvent e) { -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTOptionsPanel.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTOptionsPanel.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTOptionsPanel.properties (working copy) -@@ -1,28 +0,0 @@ --# To change this template, choose Tools | Templates --# and open the template in the editor. -- --Form.border.title=Optimization Parameter --jLabel1.text=Binary --jLabel2.text=BlockSize --jLabel3.text=TCP Buffer Size --jLabel4.text=Bytes --jLabel5.text=Bytes --jLabel6.text=Notpt --jLabel7.text=Parallel TCP Streams --jLabel8.text=DCAU --jLabel9.text=Concurrency --jLabel10.text=Source Subject --jLabel11.text=Destination Subject --jLabel12.text=All or None --jLabel13.text=Max Attempts --binary.text= --blockSize.text=16000 --tcpBufferSize.text=16000 --noTpt.text= --dCAU.text= --parallelStream.text=1 --concurrent.text=1 --sourceSN.text=null --destSN.text=null --allOrNone.text= --maxAttempts.text=10 -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/window_new_gridftp.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/LocalFileSystemView.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/LocalFileSystemView.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/LocalFileSystemView.properties (working copy) -@@ -1,2 +0,0 @@ --Form.title=Local System --jLabel1.text=jLabel1 -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIView.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIView.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIView.properties (working copy) -@@ -1,80 +0,0 @@ --# Resources for the GridFTPGUIView class -- --# top-level menus -- --fileMenu.text = File --helpMenu.text = Help -- --# @Action resources -- --showAboutBox.Action.text = &About... --showAboutBox.Action.shortDescription = Show the application's information dialog -- --# status bar resources -- --StatusBar.messageTimeout = 5000 --StatusBar.busyAnimationRate = 30 --StatusBar.idleIcon = busyicons/idle-icon.png --StatusBar.busyIcons[0] = busyicons/busy-icon0.png --StatusBar.busyIcons[1] = busyicons/busy-icon1.png --StatusBar.busyIcons[2] = busyicons/busy-icon2.png --StatusBar.busyIcons[3] = busyicons/busy-icon3.png --StatusBar.busyIcons[4] = busyicons/busy-icon4.png --StatusBar.busyIcons[5] = busyicons/busy-icon5.png --StatusBar.busyIcons[6] = busyicons/busy-icon6.png --StatusBar.busyIcons[7] = busyicons/busy-icon7.png --StatusBar.busyIcons[8] = busyicons/busy-icon8.png --StatusBar.busyIcons[9] = busyicons/busy-icon9.png --StatusBar.busyIcons[10] = busyicons/busy-icon10.png --StatusBar.busyIcons[11] = busyicons/busy-icon11.png --StatusBar.busyIcons[12] = busyicons/busy-icon12.png --StatusBar.busyIcons[13] = busyicons/busy-icon13.png --StatusBar.busyIcons[14] = busyicons/busy-icon14.png --jMenu1.text=Connect --jMenuItem1.text=GridFTP --jMenuItem2.text=Local --jMenu2.text=Security --jMenu3.text=Log --jMenuItem3.text=Create Grid Proxy --jMenuItem4.text=Destroy Grid Proxy --jMenuItem5.text=Grid Proxy Info --jMenuItem6.text=Load --jMenuItem7.text=Save --jMenuItem11.text=Log Location --jMenuItem12.text=Log Config --#NOI18N --local_button.icon=window_new.png --local_button.text=Local --#NOI18N --jButton5.icon=rft.png --jButton5.text=Advanced --#NOI18N -- --gridftp_button.icon=window_new_gridftp.png --gridftp_button.toolTipText=Open remote directory --gridftp_button.text=GridFTP --#NOI18N -- --jButton1.icon=unlock.png --jButton1.toolTipText=Create a new credential --jButton1.text=Generate Credential --#NOI18N --jButton7.icon=unlock.png --jButton7.toolTipText=Obtain a credential from Myproxy --jButton7.text=Obtain Credential --#NOI18N --jButton8.icon=unlock.png --jButton8.toolTipText=setup a log file --jButton8.text=Log Config -- --credential_button.icon=unlock.png --credential_button.toolTipText=create credential --credential_button.text= Credential --#NOI18N --jDesktopPane1.background=236, 233, 216 --jMenuItem8.text=FTP --jMenuItem9.text=WebDAV --jMenuItem10.text=RFT --jButton4.text=FTP --#NOI18N --jButton4.icon=window_new_ftp.png -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTTransferParamPanel.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTTransferParamPanel.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTTransferParamPanel.properties (working copy) -@@ -1,16 +0,0 @@ --# To change this template, choose Tools | Templates --# and open the template in the editor. -- --Form.border.title=Reliable File Transfer Service (RFT) Parameters --jLabel1.text=Service Host --serverHostField.text= --jLabel2.text=Service Port --serverPortField.text= --jLabel3.text=From --fromField.text= --jLabel4.text=To --toField.text= --jLabel5.text=AuthType --jLabel6.text=AuthzType --concurrencyLabel.text=Concurrency --concurrencyField.text= -\ No newline at end of file -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/about.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIApp.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIApp.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIApp.properties (working copy) -@@ -1,11 +0,0 @@ --# Application global resources -- --Application.name = GridFTP GUI --Application.title = GridFTP GUI --Application.version = 1.0.1 --Application.vendor = Globus Toolkit --Application.homepage = http://www.globus.org --Application.description = A simple GUI interface for GridFTP --Application.vendorId = Globus --Application.id = Globus --Application.lookAndFeel = default -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/about-small.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIAboutBox.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIAboutBox.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/GridFTPGUIAboutBox.properties (working copy) -@@ -1,13 +0,0 @@ --title = About: ${Application.title} ${Application.version} -- --closeAboutBox.Action.text = &Close -- --appDescLabel.text=A GUI Client for GridFTP -- --versionLabel.text=Version: -- --vendorLabel.text=Vendor\: -- --homepageLabel.text=Homepage\: --#NOI18N --imageLabel.icon=about-small.png -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/window_new.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/window_globus.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTPanel.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTPanel.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/RFTPanel.properties (working copy) -@@ -1,16 +0,0 @@ --startButton.text=Start --stopButton.text=Stop --restartButton.text=OK --jLabel1.text=Finished --jLabel3.text=Active --jLabel5.text=Failed --jLabel7.text=Restared --jLabel9.text=Pending --jLabel11.text=Cancelled --jPanel1.border.title=Overall Status --finishedField.text=0 --activeField.text=0 --failedField.text=0 --restartedField.text=0 --pendingField.text=0 --cancelledField.text=0 -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJFrame.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJFrame.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJFrame.properties (working copy) -@@ -1 +0,0 @@ --jButton1.text=aaaaa -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/window_new_ftp.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/splash.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon4.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon5.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon6.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon7.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon8.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon9.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/idle-icon.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon10.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon11.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon12.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon13.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon14.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon0.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon1.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon2.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/busyicons/busy-icon3.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/unlock.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/rft.png -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJDialog.properties -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJDialog.properties (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/resources/NewJDialog.properties (working copy) -@@ -1,5 +0,0 @@ --# To change this template, choose Tools | Templates --# and open the template in the editor. -- --jButton1.text=jButton1 --jButton2.text=jButton2 -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogon.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogon.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogon.java (working copy) -@@ -1,954 +0,0 @@ --/* -- * Copyright 2007 The Board of Trustees of the University of Illinois. -- * All rights reserved. -- * -- * Developed by: -- * -- * MyProxy Team -- * National Center for Supercomputing Applications -- * University of Illinois -- * http://myproxy.ncsa.uiuc.edu/ -- * -- * Permission is hereby granted, free of charge, to any person obtaining -- * a copy of this software and associated documentation files (the -- * "Software"), to deal with the Software without restriction, including -- * without limitation the rights to use, copy, modify, merge, publish, -- * distribute, sublicense, and/or sell copies of the Software, and to -- * permit persons to whom the Software is furnished to do so, subject to -- * the following conditions: -- * -- * Redistributions of source code must retain the above copyright -- * notice, this list of conditions and the following disclaimers. -- * -- * Redistributions in binary form must reproduce the above copyright -- * notice, this list of conditions and the following disclaimers in the -- * documentation and/or other materials provided with the distribution. -- * -- * Neither the names of the National Center for Supercomputing -- * Applications, the University of Illinois, nor the names of its -- * contributors may be used to endorse or promote products derived from -- * this Software without specific prior written permission. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- * IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR -- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -- */ --package org.globus.transfer.reliable.client.credential.myproxy; -- --import java.io.BufferedInputStream; --import java.io.BufferedOutputStream; --import java.io.BufferedReader; --import java.io.ByteArrayInputStream; --import java.io.ByteArrayOutputStream; --import java.io.EOFException; --import java.io.File; --import java.io.FileInputStream; --import java.io.FileOutputStream; --import java.io.IOException; --import java.io.InputStream; --import java.io.InputStreamReader; --import java.io.PrintStream; --import java.net.InetAddress; --import java.net.ProtocolException; --import java.security.GeneralSecurityException; --import java.security.KeyPair; --import java.security.KeyPairGenerator; --import java.security.PrivateKey; --import java.security.cert.CertPath; --import java.security.cert.CertPathValidator; --import java.security.cert.CertificateEncodingException; --import java.security.cert.CertificateException; --import java.security.cert.CertificateFactory; --import java.security.cert.PKIXParameters; --import java.security.cert.TrustAnchor; --import java.security.cert.X509CRL; --import java.security.cert.X509Certificate; --import java.util.ArrayList; --import java.util.Arrays; --import java.util.Collection; --import java.util.HashSet; --import java.util.Iterator; --import java.util.Set; --import java.util.logging.Level; --import java.util.logging.Logger; -- --import javax.net.ssl.SSLContext; --import javax.net.ssl.SSLSocket; --import javax.net.ssl.SSLSocketFactory; --import javax.net.ssl.TrustManager; --import javax.net.ssl.X509TrustManager; --import javax.security.auth.login.FailedLoginException; --import javax.security.auth.x500.X500Principal; -- --import org.bouncycastle.asn1.ASN1InputStream; --import org.bouncycastle.asn1.ASN1Sequence; --import org.bouncycastle.asn1.DERObject; --import org.bouncycastle.asn1.DEROutputStream; --import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; --import org.bouncycastle.jce.PKCS10CertificationRequest; --import org.bouncycastle.util.encoders.Base64; -- --/** -- * The MyProxyLogon class provides an interface for retrieving credentials from -- * a MyProxy server. -- *

-- * First, use setHost, setPort, -- * setUsername, setPassphrase, -- * setCredentialName, setLifetime and -- * requestTrustRoots to configure. Then call connect, -- * logon, getCredentials, then -- * disconnect. Use getCertificates and -- * getPrivateKey to access the retrieved credentials, or -- * writeProxyFile or saveCredentialsToFile to -- * write them to a file. Use writeTrustRoots, -- * getTrustedCAs, getCRLs, -- * getTrustRootData, and getTrustRootFilenames -- * for trust root information. -- * @version 1.0 -- * @see MyProxy Project Home Page -- */ --public class MyProxyLogon { -- static Logger logger = Logger.getLogger(MyProxyLogon.class.getName()); -- public final static String version = "1.0"; -- public final static String BouncyCastleLicense = org.bouncycastle.LICENSE.licenseText; -- -- protected enum State { -- READY, CONNECTED, LOGGEDON, DONE -- } -- -- private class MyTrustManager implements X509TrustManager { -- public X509Certificate[] getAcceptedIssuers() { -- X509Certificate[] issuers = null; -- String certDirPath = MyProxyLogon.getExistingTrustRootPath(); -- if (certDirPath == null) { -- return null; -- } -- File dir = new File(certDirPath); -- if (!dir.isDirectory()) { -- return null; -- } -- String[] certFilenames = dir.list(); -- String[] certData = new String[certFilenames.length]; -- for (int i = 0; i < certFilenames.length; i++) { -- try { -- FileInputStream fileStream = new FileInputStream( -- certDirPath + File.separator + certFilenames[i]); -- byte[] buffer = new byte[fileStream.available()]; -- fileStream.read(buffer); -- certData[i] = new String(buffer); -- } catch (Exception e) { -- // ignore -- } -- } -- try { -- issuers = getX509CertsFromStringList(certData, certFilenames); -- } catch (Exception e) { -- // ignore -- } -- return issuers; -- } -- -- public void checkClientTrusted(X509Certificate[] certs, String authType) -- throws CertificateException { -- throw new CertificateException( -- "checkClientTrusted not implemented by edu.uiuc.ncsa.MyProxy.MyProxyLogon.MyTrustManager"); -- } -- -- public void checkServerTrusted(X509Certificate[] certs, String authType) -- throws CertificateException { -- checkServerCertPath(certs); -- checkServerDN(certs[0]); -- } -- -- private void checkServerCertPath(X509Certificate[] certs) -- throws CertificateException { -- try { -- CertPathValidator validator = CertPathValidator -- .getInstance(CertPathValidator.getDefaultType()); -- CertificateFactory certFactory = CertificateFactory -- .getInstance("X.509"); -- CertPath certPath = certFactory.generateCertPath(Arrays -- .asList(certs)); -- X509Certificate[] acceptedIssuers = getAcceptedIssuers(); -- if (acceptedIssuers == null) { -- String certDir = MyProxyLogon.getExistingTrustRootPath(); -- if (certDir != null) { -- throw new CertificateException( -- "no CA certificates found in " + certDir); -- } else if (!requestTrustRoots) { -- throw new CertificateException( -- "no CA certificates directory found"); -- } -- logger -- .info("no trusted CAs configured -- bootstrapping trust from MyProxy server"); -- acceptedIssuers = new X509Certificate[1]; -- acceptedIssuers[0] = certs[certs.length - 1]; -- } -- Set trustAnchors = new HashSet( -- acceptedIssuers.length); -- for (int i = 0; i < acceptedIssuers.length; i++) { -- TrustAnchor ta = new TrustAnchor(acceptedIssuers[i], null); -- trustAnchors.add(ta); -- } -- PKIXParameters pkixParameters = new PKIXParameters(trustAnchors); -- pkixParameters.setRevocationEnabled(false); -- validator.validate(certPath, pkixParameters); -- } catch (CertificateException e) { -- throw e; -- } catch (GeneralSecurityException e) { -- throw new CertificateException(e); -- } -- } -- -- private void checkServerDN(X509Certificate cert) -- throws CertificateException { -- String subject = cert.getSubjectX500Principal().getName(); -- logger.fine("MyProxy server DN: " + subject); -- int index = subject.indexOf("CN="); -- if (index == -1) { -- throw new CertificateException("Server certificate subject (" -- + subject + "does not contain a CN component."); -- } -- String CN = subject.substring(index + 3); -- index = CN.indexOf(','); -- if (index >= 0) { -- CN = CN.substring(0, index); -- } -- if ((index = CN.indexOf('/')) >= 0) { -- String service = CN.substring(0, index); -- CN = CN.substring(index + 1); -- if (!service.equals("host") && !service.equals("myproxy")) { -- throw new CertificateException( -- "Server certificate subject CN contains unknown service element: " -- + subject); -- } -- } -- String myHostname = host; -- if (myHostname.equals("localhost")) { -- try { -- myHostname = InetAddress.getLocalHost().getHostName(); -- } catch (Exception e) { -- // ignore -- } -- } -- if (!CN.equals(myHostname)) { -- throw new CertificateException( -- "Server certificate subject CN (" + CN -- + ") does not match server hostname (" + host -- + ")."); -- } -- } -- } -- -- private final static int b64linelen = 64; -- private final static String X509_USER_PROXY_FILE = "x509up_u"; -- private final static String VERSION = "VERSION=MYPROXYv2"; -- private final static String GETCOMMAND = "COMMAND=0"; -- private final static String TRUSTROOTS = "TRUSTED_CERTS="; -- private final static String USERNAME = "USERNAME="; -- private final static String PASSPHRASE = "PASSPHRASE="; -- private final static String LIFETIME = "LIFETIME="; -- private final static String CREDNAME = "CRED_NAME="; -- private final static String RESPONSE = "RESPONSE="; -- private final static String ERROR = "ERROR="; -- private final static String DN = "CN=ignore"; -- private final static String TRUSTED_CERT_PATH = "/.globus/certificates"; -- -- protected final static int keySize = 1024; -- protected final int MIN_PASS_PHRASE_LEN = 6; -- protected final static String keyAlg = "RSA"; -- protected final static String pkcs10SigAlgName = "SHA1withRSA"; -- protected final static String pkcs10Provider = "SunRsaSign"; -- protected State state = State.READY; -- protected String host = "localhost"; -- protected String username; -- protected String credname; -- protected String passphrase; -- protected int port = 7512; -- protected int lifetime = 43200; -- protected boolean requestTrustRoots = false; -- protected SSLSocket socket; -- protected BufferedInputStream socketIn; -- protected BufferedOutputStream socketOut; -- protected KeyPair keypair; -- protected Collection certificateChain; -- protected String[] trustrootFilenames; -- protected String[] trustrootData; -- -- /** -- * Constructs a MyProxyLogon object. -- */ -- public MyProxyLogon() { -- super(); -- host = System.getenv("MYPROXY_SERVER"); -- if (host == null) { -- host = "localhost"; -- } -- String portString = System.getenv("MYPROXY_SERVER_PORT"); -- if (portString != null) { -- port = Integer.parseInt(portString); -- } -- username = System.getProperty("user.name"); -- } -- -- /** -- * Gets the hostname of the MyProxy server. -- * @return MyProxy server hostname -- */ -- public String getHost() { -- return this.host; -- } -- -- /** -- * Sets the hostname of the MyProxy server. Defaults to localhost. -- * @param host -- * MyProxy server hostname -- */ -- public void setHost(String host) { -- this.host = host; -- } -- -- /** -- * Gets the port of the MyProxy server. -- * @return MyProxy server port -- */ -- public int getPort() { -- return this.port; -- } -- -- /** -- * Sets the port of the MyProxy server. Defaults to 7512. -- * @param port -- * MyProxy server port -- */ -- public void setPort(int port) { -- this.port = port; -- } -- -- /** -- * Gets the MyProxy username. -- * @return MyProxy server port -- */ -- public String getUsername() { -- return this.username; -- } -- -- /** -- * Sets the MyProxy username. Defaults to user.name. -- * @param username -- * MyProxy username -- */ -- public void setUsername(String username) { -- this.username = username; -- } -- -- /** -- * Gets the optional MyProxy credential name. -- * @return credential name -- */ -- public String getCredentialName() { -- return this.credname; -- } -- -- /** -- * Sets the optional MyProxy credential name. -- * @param credname -- * credential name -- */ -- public void setCredentialName(String credname) { -- this.credname = credname; -- } -- -- /** -- * Sets the MyProxy passphrase. -- * @param passphrase -- * MyProxy passphrase -- */ -- public void setPassphrase(String passphrase) { -- this.passphrase = passphrase; -- } -- -- /** -- * Gets the requested credential lifetime. -- * @return Credential lifetime -- */ -- public int getLifetime() { -- return this.lifetime; -- } -- -- /** -- * Sets the requested credential lifetime. Defaults to 43200 seconds (12 -- * hours). -- * @param seconds -- * Credential lifetime -- */ -- public void setLifetime(int seconds) { -- this.lifetime = seconds; -- } -- -- /** -- * Gets the certificates returned from the MyProxy server by -- * getCredentials(). -- * @return Collection of java.security.cert.Certificate objects -- */ -- public Collection getCertificates() { -- return this.certificateChain; -- } -- -- /** -- * Gets the private key generated by getCredentials(). -- * @return PrivateKey -- */ -- public PrivateKey getPrivateKey() { -- return this.keypair.getPrivate(); -- } -- -- /** -- * Sets whether to request trust roots (CA certificates, CRLs, signing -- * policy files) from the MyProxy server. Defaults to false (i.e., not -- * to request trust roots). -- * @param flag -- * If true, request trust roots. If false, don't request trust -- * roots. -- */ -- public void requestTrustRoots(boolean flag) { -- this.requestTrustRoots = flag; -- } -- -- /** -- * Gets trust root filenames. -- * @return trust root filenames -- */ -- public String[] getTrustRootFilenames() { -- return this.trustrootFilenames; -- } -- -- /** -- * Gets trust root data corresponding to the trust root filenames. -- * @return trust root data -- */ -- public String[] getTrustRootData() { -- return this.trustrootData; -- } -- -- /** -- * Connects to the MyProxy server at the desired host and port. Requires -- * host authentication via SSL. The host's certificate subject must -- * match the requested hostname. If CA certificates are found in the -- * standard GSI locations, they will be used to verify the server's -- * certificate. If trust roots are requested and no CA certificates are -- * found, the server's certificate will still be accepted. -- */ -- public void connect() throws IOException, GeneralSecurityException { -- SSLContext sc = SSLContext.getInstance("SSL"); -- TrustManager[] trustAllCerts = new TrustManager[] { new MyTrustManager() }; -- sc.init(null, trustAllCerts, new java.security.SecureRandom()); -- SSLSocketFactory sf = sc.getSocketFactory(); -- this.socket = (SSLSocket) sf.createSocket(this.host, this.port); -- this.socket.setEnabledProtocols(new String[] { "SSLv3" }); -- this.socket.startHandshake(); -- this.socketIn = new BufferedInputStream(this.socket.getInputStream()); -- this.socketOut = new BufferedOutputStream(this.socket.getOutputStream()); -- this.state = State.CONNECTED; -- } -- -- /** -- * Disconnects from the MyProxy server. -- */ -- public void disconnect() throws IOException { -- this.socket.close(); -- this.socket = null; -- this.socketIn = null; -- this.socketOut = null; -- this.state = State.READY; -- } -- -- /** -- * Logs on to the MyProxy server by issuing the MyProxy GET command. -- */ -- public void logon() throws IOException, GeneralSecurityException { -- String line; -- char response; -- -- if (this.state != State.CONNECTED) { -- this.connect(); -- } -- -- this.socketOut.write('0'); -- this.socketOut.flush(); -- this.socketOut.write(VERSION.getBytes()); -- this.socketOut.write('\n'); -- this.socketOut.write(GETCOMMAND.getBytes()); -- this.socketOut.write('\n'); -- this.socketOut.write(USERNAME.getBytes()); -- this.socketOut.write(this.username.getBytes()); -- this.socketOut.write('\n'); -- this.socketOut.write(PASSPHRASE.getBytes()); -- this.socketOut.write(this.passphrase.getBytes()); -- this.socketOut.write('\n'); -- this.socketOut.write(LIFETIME.getBytes()); -- this.socketOut.write(Integer.toString(this.lifetime).getBytes()); -- this.socketOut.write('\n'); -- if (this.credname != null) { -- this.socketOut.write(CREDNAME.getBytes()); -- this.socketOut.write(this.credname.getBytes()); -- this.socketOut.write('\n'); -- } -- if (this.requestTrustRoots) { -- this.socketOut.write(TRUSTROOTS.getBytes()); -- this.socketOut.write("1\n".getBytes()); -- } -- this.socketOut.flush(); -- -- line = readLine(this.socketIn); -- if (line == null) { -- throw new EOFException(); -- } -- if (!line.equals(VERSION)) { -- throw new ProtocolException("bad MyProxy protocol VERSION string: " -- + line); -- } -- line = readLine(this.socketIn); -- if (line == null) { -- throw new EOFException(); -- } -- if (!line.startsWith(RESPONSE) -- || line.length() != RESPONSE.length() + 1) { -- throw new ProtocolException( -- "bad MyProxy protocol RESPONSE string: " + line); -- } -- response = line.charAt(RESPONSE.length()); -- if (response == '1') { -- StringBuffer errString; -- -- errString = new StringBuffer("MyProxy logon failed"); -- while ((line = readLine(this.socketIn)) != null) { -- if (line.startsWith(ERROR)) { -- errString.append('\n'); -- errString.append(line.substring(ERROR.length())); -- } -- } -- throw new FailedLoginException(errString.toString()); -- } else if (response == '2') { -- throw new ProtocolException( -- "MyProxy authorization RESPONSE not implemented"); -- } else if (response != '0') { -- throw new ProtocolException( -- "unknown MyProxy protocol RESPONSE string: " + line); -- } -- while ((line = readLine(this.socketIn)) != null) { -- if (line.startsWith(TRUSTROOTS)) { -- String filenameList = line.substring(TRUSTROOTS.length()); -- this.trustrootFilenames = filenameList.split(","); -- this.trustrootData = new String[this.trustrootFilenames.length]; -- for (int i = 0; i < this.trustrootFilenames.length; i++) { -- String lineStart = "FILEDATA_" + this.trustrootFilenames[i] -- + "="; -- line = readLine(this.socketIn); -- if (line == null) { -- throw new EOFException(); -- } -- if (!line.startsWith(lineStart)) { -- throw new ProtocolException( -- "bad MyProxy protocol RESPONSE: expecting " -- + lineStart + " but received " + line); -- } -- this.trustrootData[i] = new String(Base64.decode(line -- .substring(lineStart.length()))); -- } -- } -- } -- this.state = State.LOGGEDON; -- } -- -- /** -- * Retrieves credentials from the MyProxy server. -- */ -- public void getCredentials() throws IOException, GeneralSecurityException { -- int numCertificates; -- KeyPairGenerator keyGenerator; -- PKCS10CertificationRequest pkcs10; -- CertificateFactory certFactory; -- -- if (this.state != State.LOGGEDON) { -- this.logon(); -- } -- -- keyGenerator = KeyPairGenerator.getInstance(keyAlg); -- keyGenerator.initialize(keySize); -- this.keypair = keyGenerator.genKeyPair(); -- pkcs10 = new PKCS10CertificationRequest(pkcs10SigAlgName, -- new X500Principal(DN), this.keypair.getPublic(), null, -- this.keypair.getPrivate(), pkcs10Provider); -- this.socketOut.write(pkcs10.getEncoded()); -- this.socketOut.flush(); -- numCertificates = this.socketIn.read(); -- if (numCertificates == -1) { -- System.err.println("connection aborted"); -- System.exit(1); -- } else if (numCertificates == 0 || numCertificates < 0) { -- System.err.print("bad number of certificates sent by server: "); -- System.err.println(Integer.toString(numCertificates)); -- System.exit(1); -- } -- certFactory = CertificateFactory.getInstance("X.509"); -- this.certificateChain = certFactory.generateCertificates(this.socketIn); -- this.state = State.DONE; -- } -- -- /** -- * Writes the retrieved credentials to the Globus proxy file location. -- */ -- public void writeProxyFile() throws IOException, GeneralSecurityException { -- saveCredentialsToFile(getProxyLocation()); -- } -- -- /** -- * Writes the retrieved credentials to the specified filename. -- */ -- public void saveCredentialsToFile(String filename) throws IOException, -- GeneralSecurityException { -- Iterator iter; -- X509Certificate certificate; -- PrintStream printStream; -- -- iter = this.certificateChain.iterator(); -- certificate = (X509Certificate) iter.next(); -- File outFile = new File(filename); -- outFile.delete(); -- outFile.createNewFile(); -- setFilePermissions(filename, "0600"); -- printStream = new PrintStream(new FileOutputStream(outFile)); -- printCert(certificate, printStream); -- printKey(keypair.getPrivate(), printStream); -- while (iter.hasNext()) { -- certificate = (X509Certificate) iter.next(); -- printCert(certificate, printStream); -- } -- } -- -- /** -- * Writes the retrieved trust roots to the Globus trusted certificates -- * directory. -- * @return true if trust roots are written successfully, false if no -- * trust roots are available to be written -- */ -- public boolean writeTrustRoots() throws IOException { -- return writeTrustRoots(getTrustRootPath()); -- } -- -- /** -- * Writes the retrieved trust roots to a trusted certificates directory. -- * @param directory -- * path where the trust roots should be written -- * @return true if trust roots are written successfully, false if no -- * trust roots are available to be written -- */ -- public boolean writeTrustRoots(String directory) throws IOException { -- if (this.trustrootFilenames == null || this.trustrootData == null) { -- return false; -- } -- File rootDir = new File(directory); -- if (!rootDir.exists()) { -- rootDir.mkdirs(); -- } -- for (int i = 0; i < trustrootFilenames.length; i++) { -- FileOutputStream out = new FileOutputStream(directory -- + File.separator + this.trustrootFilenames[i]); -- out.write(this.trustrootData[i].getBytes()); -- out.close(); -- } -- return true; -- } -- -- /** -- * Gets the trusted CA certificates returned by the MyProxy server. -- * @return trusted CA certificates, or null if none available -- */ -- public X509Certificate[] getTrustedCAs() throws CertificateException { -- if (trustrootData == null) -- return null; -- return getX509CertsFromStringList(trustrootData, trustrootFilenames); -- } -- -- private static X509Certificate[] getX509CertsFromStringList( -- String[] certList, String[] nameList) throws CertificateException { -- CertificateFactory certFactory = CertificateFactory -- .getInstance("X.509"); -- Collection c = new ArrayList( -- certList.length); -- for (int i = 0; i < certList.length; i++) { -- int index = -1; -- String certData = certList[i]; -- if (certData != null) { -- index = certData.indexOf("-----BEGIN CERTIFICATE-----"); -- } -- if (index >= 0) { -- certData = certData.substring(index); -- ByteArrayInputStream inputStream = new ByteArrayInputStream( -- certData.getBytes()); -- try { -- X509Certificate cert = (X509Certificate) certFactory -- .generateCertificate(inputStream); -- c.add(cert); -- } catch (Exception e) { -- if (nameList != null) { -- logger.warning(nameList[i] -- + " can not be parsed as an X509Certificate."); -- } else { -- logger.warning("failed to parse an X509Certificate"); -- } -- } -- } -- } -- if (c.isEmpty()) -- return null; -- return c.toArray(new X509Certificate[0]); -- } -- -- /** -- * Gets the CRLs returned by the MyProxy server. -- * @return CRLs or null if none available -- */ -- public X509CRL[] getCRLs() throws CertificateException { -- if (trustrootData == null) -- return null; -- CertificateFactory certFactory = CertificateFactory -- .getInstance("X.509"); -- Collection c = new ArrayList(trustrootData.length); -- for (int i = 0; i < trustrootData.length; i++) { -- String crlData = trustrootData[i]; -- int index = crlData.indexOf("-----BEGIN X509 CRL-----"); -- if (index >= 0) { -- crlData = crlData.substring(index); -- ByteArrayInputStream inputStream = new ByteArrayInputStream( -- crlData.getBytes()); -- try { -- X509CRL crl = (X509CRL) certFactory -- .generateCRL(inputStream); -- c.add(crl); -- } catch (Exception e) { -- logger.warning(this.trustrootFilenames[i] -- + " can not be parsed as an X509CRL."); -- } -- } -- } -- if (c.isEmpty()) -- return null; -- return c.toArray(new X509CRL[0]); -- } -- -- /** -- * Returns the trusted certificates directory location where -- * writeTrustRoots() will store certificates. -- */ -- public static String getTrustRootPath() { -- String path; -- -- path = System.getenv("X509_CERT_DIR"); -- if (path == null) { -- path = System.getProperty("X509_CERT_DIR"); -- } -- if (path == null) { -- path = System.getProperty("user.home") + TRUSTED_CERT_PATH; -- } -- return path; -- } -- -- /** -- * Gets the existing trusted CA certificates directory. -- * @return directory path string or null if none found -- */ -- public static String getExistingTrustRootPath() { -- String path, GL; -- -- GL = System.getenv("GLOBUS_LOCATION"); -- if (GL == null) { -- GL = System.getProperty("GLOBUS_LOCATION"); -- } -- -- path = System.getenv("X509_CERT_DIR"); -- if (path == null) { -- path = System.getProperty("X509_CERT_DIR"); -- } -- if (path == null) { -- path = getDir(System.getProperty("user.home") + TRUSTED_CERT_PATH); -- } -- if (path == null) { -- path = getDir("/etc/grid-security/certificates"); -- } -- if (path == null) { -- path = getDir(GL + File.separator + "share" + File.separator -- + "certificates"); -- } -- -- return path; -- } -- -- /** -- * Returns the default Globus proxy file location. -- */ -- public static String getProxyLocation() throws IOException { -- String loc, suffix = null; -- Process proc; -- BufferedReader bufferedReader; -- -- loc = System.getenv("X509_USER_PROXY"); -- if (loc == null) { -- loc = System.getProperty("X509_USER_PROXY"); -- } -- if (loc != null) { -- return loc; -- } -- -- try { -- proc = Runtime.getRuntime().exec("id -u"); -- bufferedReader = new BufferedReader(new InputStreamReader(proc -- .getInputStream())); -- suffix = bufferedReader.readLine(); -- } catch (IOException e) { -- // will fail on windows -- } -- -- if (suffix == null) { -- suffix = System.getProperty("user.name"); -- if (suffix != null) { -- suffix = suffix.toLowerCase(); -- } else { -- suffix = "nousername"; -- } -- } -- String tmpdir = System.getProperty("java.io.tmpdir"); -- if (!tmpdir.endsWith(File.separator)) { -- tmpdir += File.separator; -- } -- System.out.println("location"); -- return tmpdir + X509_USER_PROXY_FILE + suffix; -- } -- -- /** -- * Provides a simple command-line interface. -- */ -- public static void main(String[] args) { -- try { -- MyProxyLogon m = new MyProxyLogon(); -- // Console cons = System.console(); -- String passphrase = null; -- X509Certificate[] CAcerts; -- X509CRL[] CRLs; -- MyProxyLogon.logger.setLevel(Level.ALL); -- -- // if (cons != null) { -- // char[] pass = cons.readPassword("[%s]", "MyProxy Passphrase: -- // "); -- // if (pass != null) { -- // passphrase = new String(pass); -- // } -- // } else { -- System.out -- .println("Warning: terminal will echo passphrase as you type."); -- System.out.print("MyProxy Passphrase: "); -- passphrase = readLine(System.in); -- // } -- if (passphrase == null) { -- System.err.println("Error reading passphrase."); -- System.exit(1); -- } -- m.setPassphrase(passphrase); -- m.requestTrustRoots(true); -- m.getCredentials(); -- m.writeProxyFile(); -- System.out.println("Credential written successfully."); -- CAcerts = m.getTrustedCAs(); -- if (CAcerts != null) { -- System.out.println(Integer.toString(CAcerts.length) -- + " CA certificates received."); -- } -- CRLs = m.getCRLs(); -- if (CRLs != null) { -- System.out.println(Integer.toString(CRLs.length) -- + " CRLs received."); -- } -- if (m.writeTrustRoots()) { -- System.out.println("Wrote trust roots to " -- + MyProxyLogon.getTrustRootPath() + "."); -- } else { -- System.out -- .println("Received no trust roots from MyProxy server."); -- } -- } catch (Exception e) { -- e.printStackTrace(System.err); -- } -- } -- -- private static void printB64(byte[] data, PrintStream out) { -- byte[] b64data; -- -- b64data = Base64.encode(data); -- for (int i = 0; i < b64data.length; i += b64linelen) { -- if ((b64data.length - i) > b64linelen) { -- out.write(b64data, i, b64linelen); -- } else { -- out.write(b64data, i, b64data.length - i); -- } -- out.println(); -- } -- } -- -- private static void printCert(X509Certificate certificate, PrintStream out) -- throws CertificateEncodingException { -- out.println("-----BEGIN CERTIFICATE-----"); -- printB64(certificate.getEncoded(), out); -- out.println("-----END CERTIFICATE-----"); -- } -- -- private static void printKey(PrivateKey key, PrintStream out) -- throws IOException { -- out.println("-----BEGIN RSA PRIVATE KEY-----"); -- ByteArrayInputStream inStream = new ByteArrayInputStream(key -- .getEncoded()); -- ASN1InputStream derInputStream = new ASN1InputStream(inStream); -- DERObject keyInfo = derInputStream.readObject(); -- PrivateKeyInfo pkey = new PrivateKeyInfo((ASN1Sequence) keyInfo); -- DERObject derKey = pkey.getPrivateKey(); -- ByteArrayOutputStream bout = new ByteArrayOutputStream(); -- DEROutputStream der = new DEROutputStream(bout); -- der.writeObject(derKey); -- printB64(bout.toByteArray(), out); -- out.println("-----END RSA PRIVATE KEY-----"); -- } -- -- private static void setFilePermissions(String file, String mode) { -- String command = "chmod " + mode + " " + file; -- try { -- Runtime.getRuntime().exec(command); -- } catch (IOException e) { -- logger.warning("Failed to run: " + command); // windows -- } -- } -- -- private static String readLine(InputStream is) throws IOException { -- StringBuffer sb = new StringBuffer(); -- for (int c = is.read(); c > 0 && c != '\n'; c = is.read()) { -- sb.append((char) c); -- } -- if (sb.length() > 0) { -- return new String(sb); -- } -- return null; -- } -- -- private static String getDir(String path) { -- if (path == null) -- return null; -- File f = new File(path); -- if (f.isDirectory() && f.canRead()) { -- return f.getAbsolutePath(); -- } -- return null; -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogonGUI.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogonGUI.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/myproxy/MyProxyLogonGUI.java (working copy) -@@ -1,478 +0,0 @@ --/* -- * Copyright 2007 The Board of Trustees of the University of Illinois. -- * All rights reserved. -- * -- * Developed by: -- * -- * MyProxy Team -- * National Center for Supercomputing Applications -- * University of Illinois -- * http://myproxy.ncsa.uiuc.edu/ -- * -- * Permission is hereby granted, free of charge, to any person obtaining -- * a copy of this software and associated documentation files (the -- * "Software"), to deal with the Software without restriction, including -- * without limitation the rights to use, copy, modify, merge, publish, -- * distribute, sublicense, and/or sell copies of the Software, and to -- * permit persons to whom the Software is furnished to do so, subject to -- * the following conditions: -- * -- * Redistributions of source code must retain the above copyright -- * notice, this list of conditions and the following disclaimers. -- * -- * Redistributions in binary form must reproduce the above copyright -- * notice, this list of conditions and the following disclaimers in the -- * documentation and/or other materials provided with the distribution. -- * -- * Neither the names of the National Center for Supercomputing -- * Applications, the University of Illinois, nor the names of its -- * contributors may be used to endorse or promote products derived from -- * this Software without specific prior written permission. -- * -- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -- * IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR -- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE. -- */ --package org.globus.transfer.reliable.client.credential.myproxy; -- --import java.awt.Component; --import java.awt.GridBagConstraints; --import java.awt.GridBagLayout; --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; --import java.awt.event.WindowAdapter; --import java.awt.event.WindowEvent; --import java.io.File; --import java.io.FileInputStream; --import java.io.FileNotFoundException; --import java.io.FileOutputStream; --import java.io.IOException; --import java.net.InetAddress; --import java.net.UnknownHostException; --import java.util.Properties; -- --import javax.swing.AbstractButton; --import javax.swing.BorderFactory; --import javax.swing.JButton; --import javax.swing.JCheckBox; --import javax.swing.JFrame; --import javax.swing.JLabel; --import javax.swing.JPanel; --import javax.swing.JPasswordField; --import javax.swing.JScrollPane; --import javax.swing.JTextArea; --import javax.swing.JTextField; --import javax.swing.SwingUtilities; --import javax.swing.WindowConstants; -- --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; --import org.globus.transfer.reliable.client.utils.LogFileUtils; -- --/** -- * The MyProxyLogonGUI class provides a Swing user interface to -- * {@link MyProxyLogon}. -- * @version 1.0 -- */ --public class MyProxyLogonGUI extends JPanel implements ActionListener { -- private static final long serialVersionUID = 1L; -- static Log logger = LogFactory.getLog(MyProxyLogonGUI.class.getName()); -- public final static String version = "1.0"; -- -- protected MyProxyLogon myproxy; -- -- protected Properties properties; -- protected static final String PROPERTIES_PATH = "/.MyProxyLogon"; -- -- protected JTextField usernameField; -- protected JLabel usernameFieldLabel; -- protected static final String usernameFieldString = "Username"; -- protected static final String usernameFieldProperty = "Username"; -- -- protected JPasswordField passwordField; -- protected JLabel passwordFieldLabel; -- protected static final String passwordFieldString = "Passphrase"; -- protected static final String passwordFieldProperty = "Passphrase"; -- protected static final String passwordInfoString = "Enter passphrase to logon.\n"; -- -- protected JTextField crednameField; -- protected JLabel crednameFieldLabel; -- protected static final String crednameFieldString = "Credential Name"; -- protected static final String crednameFieldProperty = "CredentialName"; -- -- protected JTextField lifetimeField; -- protected JLabel lifetimeFieldLabel; -- protected static final String lifetimeFieldString = "Lifetime (hours)"; -- protected static final String lifetimeFieldProperty = "Lifetime"; -- -- protected JTextField hostnameField; -- protected JLabel hostnameFieldLabel; -- protected static final String hostnameFieldString = "Hostname"; -- protected static final String hostnameFieldProperty = "Hostname"; -- -- protected JTextField portField; -- protected JLabel portFieldLabel; -- protected static final String portFieldString = "Port"; -- protected static final String portFieldProperty = "Port"; -- -- protected JTextField outputField; -- protected JLabel outputFieldLabel; -- protected static final String outputFieldString = "Output"; -- protected static final String outputFieldProperty = "Output"; -- -- protected JCheckBox trustRootsCheckBox; -- protected static final String trustRootsProperty = "TrustRoots"; -- protected static final String trustRootsPropertyYes = "yes"; -- protected static final String trustRootsPropertyNo = "no"; -- -- protected JButton button; -- protected static final String buttonFieldString = "Logon"; -- -- protected JTextArea statusTextArea; -- protected JScrollPane statusScrollPane; -- -- /** -- * Constructs a MyProxyLogonGUI object. -- */ -- public MyProxyLogonGUI() { -- myproxy = new MyProxyLogon(); -- -- loadProperties(); -- -- GridBagLayout gridbag = new GridBagLayout(); -- GridBagConstraints c = new GridBagConstraints(); -- setLayout(gridbag); -- setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); -- -- usernameField = createField(usernameFieldString, properties -- .getProperty(usernameFieldProperty, myproxy.getUsername())); -- usernameFieldLabel = createLabel(usernameFieldString, usernameField); -- usernameField.setToolTipText("Enter your MyProxy username."); -- -- passwordField = new JPasswordField(10); -- passwordField.setActionCommand(passwordFieldString); -- passwordField.addActionListener(this); -- passwordFieldLabel = createLabel(passwordFieldString, passwordField); -- passwordField.setToolTipText("Enter your MyProxy passphrase."); -- -- crednameField = createField(crednameFieldString, -- properties.getProperty(crednameFieldProperty, myproxy -- .getCredentialName())); -- crednameFieldLabel = createLabel(crednameFieldString, hostnameField); -- crednameField -- .setToolTipText("Optionally enter your MyProxy credential name. Leave blank to use your default credential."); -- -- lifetimeField = createField(lifetimeFieldString, properties -- .getProperty(lifetimeFieldProperty, Integer.toString(myproxy -- .getLifetime() / 3600))); -- lifetimeFieldLabel = createLabel(lifetimeFieldString, lifetimeField); -- lifetimeField -- .setToolTipText("Enter the number of hours for your requested credentials to be valid."); -- -- hostnameField = createField(hostnameFieldString, properties -- .getProperty(hostnameFieldProperty, myproxy.getHost())); -- hostnameFieldLabel = createLabel(hostnameFieldString, hostnameField); -- hostnameField -- .setToolTipText("Enter the hostname of your MyProxy server (for example: myproxy.ncsa.uiuc.edu)."); -- -- portField = createField(portFieldString, properties.getProperty( -- portFieldProperty, Integer.toString(myproxy.getPort()))); -- portFieldLabel = createLabel(portFieldString, portField); -- portField -- .setToolTipText("Enter the TCP port of your MyProxy server (usually 7512)."); -- -- String trustRootPath = MyProxyLogon.getTrustRootPath(); -- String existingTrustRootPath = MyProxyLogon.getExistingTrustRootPath(); -- trustRootsCheckBox = new JCheckBox("Write trust roots to " -- + trustRootPath + "."); -- String trustRootsPropVal = properties.getProperty(trustRootsProperty); -- if (trustRootsPropVal != null -- && trustRootsPropVal.equals(trustRootsPropertyYes)) { -- trustRootsCheckBox.setSelected(true); -- } else if (trustRootsPropVal != null -- && trustRootsPropVal.equals(trustRootsPropertyNo)) { -- trustRootsCheckBox.setSelected(false); -- } else if (existingTrustRootPath == null -- || trustRootPath.equals(existingTrustRootPath)) { -- trustRootsCheckBox.setSelected(true); -- } else { -- trustRootsCheckBox.setSelected(false); -- } -- trustRootsCheckBox -- .setToolTipText("Check this box to download the latest CA certificates, certificate revocation lists, and CA signing policy files from MyProxy."); -- -- String proxyLoc; -- try { -- proxyLoc = MyProxyLogon.getProxyLocation(); -- } catch (Exception e) { -- proxyLoc = ""; -- } -- outputField = createField(outputFieldString, properties.getProperty( -- outputFieldProperty, proxyLoc)); -- outputFieldLabel = createLabel(outputFieldString, outputField); -- outputField -- .setToolTipText("Enter the path to store your credential from MyProxy. Leave blank if you don't want to retrieve a credential."); -- -- JLabel[] labels = { usernameFieldLabel, passwordFieldLabel, -- crednameFieldLabel, lifetimeFieldLabel, hostnameFieldLabel, -- portFieldLabel, outputFieldLabel }; -- JTextField[] textFields = { usernameField, passwordField, -- crednameField, lifetimeField, hostnameField, portField, -- outputField }; -- int numLabels = labels.length; -- -- c.anchor = GridBagConstraints.LINE_END; -- for (int i = 0; i < numLabels; i++) { -- c.gridwidth = GridBagConstraints.RELATIVE; -- c.fill = GridBagConstraints.NONE; -- c.weightx = 0.0; -- add(labels[i], c); -- -- c.gridwidth = GridBagConstraints.REMAINDER; -- c.fill = GridBagConstraints.HORIZONTAL; -- c.weightx = 1.0; -- add(textFields[i], c); -- } -- -- button = new JButton(buttonFieldString); -- button.setActionCommand(buttonFieldString); -- button.addActionListener(this); -- button.setVerticalTextPosition(AbstractButton.CENTER); -- button.setHorizontalTextPosition(AbstractButton.CENTER); -- button.setToolTipText("Press this button to logon to MyProxy."); -- -- statusTextArea = new JTextArea(4, 10); -- statusTextArea.setEditable(false); -- statusTextArea.setLineWrap(true); -- statusTextArea.setWrapStyleWord(true); -- statusScrollPane = new JScrollPane(statusTextArea); -- statusTextArea.setText(passwordInfoString); -- statusTextArea.setToolTipText("This area contains status messages."); -- -- c.gridwidth = GridBagConstraints.REMAINDER; // last -- c.fill = GridBagConstraints.HORIZONTAL; -- c.weightx = 1.0; -- add(trustRootsCheckBox, c); -- add(button, c); -- add(statusScrollPane, c); -- } -- -- /** -- * Handles GUI events. -- */ -- public void actionPerformed(ActionEvent e) { -- if (verifyInput()) { -- if (passwordFieldString.equals(e.getActionCommand()) -- || buttonFieldString.equals(e.getActionCommand())) { -- logon(); -- } -- } -- } -- -- /** -- * Calls createAndShowGUI(). -- */ -- public static void main(String[] args) { -- SwingUtilities.invokeLater(new Runnable() { -- public void run() { -- createAndShowGUI(); -- } -- }); -- } -- -- protected void logon() { -- try { -- myproxy.setUsername(usernameField.getText()); -- myproxy.setPassphrase(new String(passwordField.getPassword())); -- if (crednameField.getText().length() > 0) { -- myproxy.setCredentialName(crednameField.getText()); -- } -- myproxy -- .setLifetime(Integer.parseInt(lifetimeField.getText()) * 3600); -- myproxy.setHost(hostnameField.getText()); -- myproxy.setPort(Integer.parseInt(portField.getText())); -- myproxy.requestTrustRoots(trustRootsCheckBox.isSelected()); -- statusTextArea.setText("Connecting to " + myproxy.getHost() -- + "...\n"); -- myproxy.connect(); -- statusTextArea.setText("Logging on...\n"); -- myproxy.logon(); -- if (outputField.getText().length() == 0) { -- statusTextArea.setText("Logon successful.\n"); -- } else { -- statusTextArea.setText("Getting credentials...\n"); -- myproxy.getCredentials(); -- statusTextArea.setText("Writing credentials...\n"); -- myproxy.saveCredentialsToFile(outputField.getText()); -- statusTextArea.setText("Credentials written to " -- + outputField.getText() + ".\n"); -- } -- if (trustRootsCheckBox.isSelected() && myproxy.writeTrustRoots()) { -- statusTextArea.append("Trust roots written to " -- + MyProxyLogon.getTrustRootPath() + ".\n"); -- } -- saveProperties(); -- } catch (Exception exception) { -- logger.debug(exception.getMessage(), exception); -- statusTextArea.append("Error: " + exception.getMessage()); -- } finally { -- try { -- myproxy.disconnect(); -- } catch (Exception e2) { -- } -- } -- } -- -- protected void saveProperties() { -- try { -- FileOutputStream out = new FileOutputStream(System -- .getProperty("user.home") -- + PROPERTIES_PATH); -- properties.setProperty(usernameFieldProperty, usernameField -- .getText()); -- properties.setProperty(crednameFieldProperty, crednameField -- .getText()); -- properties.setProperty(lifetimeFieldProperty, lifetimeField -- .getText()); -- properties.setProperty(hostnameFieldProperty, hostnameField -- .getText()); -- properties.setProperty(portFieldProperty, portField.getText()); -- properties.setProperty(outputFieldProperty, outputField.getText()); -- properties.setProperty(trustRootsProperty, trustRootsCheckBox -- .isSelected() ? trustRootsPropertyYes -- : trustRootsPropertyNo); -- properties.store(out, MyProxyLogonGUI.class.getName()); -- } catch (FileNotFoundException e) { -- logger.debug(e.getMessage(), e); -- e.printStackTrace(); -- } catch (IOException e) { -- logger.debug(e.getMessage(), e); -- e.printStackTrace(); -- } -- } -- -- protected void loadProperties() { -- try { -- properties = new Properties(); -- FileInputStream in = new FileInputStream(System -- .getProperty("user.home") -- + PROPERTIES_PATH); -- properties.load(in); -- } catch (FileNotFoundException e) { -- // ok, nothing to load -- } catch (IOException e) { -- logger.debug(e.getMessage(), e); -- e.printStackTrace(); -- } -- } -- -- /** -- * Create the GUI and show it. For thread safety, this method should be -- * invoked from the event dispatch thread. -- */ -- public static void createAndShowGUI() { -- final JFrame frame = new JFrame("MyProxyLogon " + version); -- MyProxyLogonGUI gui = new MyProxyLogonGUI(); -- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); -- frame.add(gui); -- frame.setLocation(50, 50); -- frame.pack(); -- frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); -- gui.passwordField.requestFocusInWindow(); -- frame.addWindowListener(new WindowAdapter() -- { -- public void windowClosing(WindowEvent e) { -- frame.dispose(); -- } -- }); -- -- frame.setVisible(true); -- } -- -- private JTextField createField(String fieldString, String text) { -- JTextField field = new JTextField(10); -- field.setActionCommand(fieldString); -- field.addActionListener(this); -- if (text != null) { -- field.setText(text); -- field.setColumns(text.length()); -- } -- return field; -- } -- -- private JLabel createLabel(String fieldString, Component c) { -- JLabel label = new JLabel(fieldString + ": "); -- label.setLabelFor(c); -- return label; -- } -- -- private boolean verifyInput() { -- boolean valid = true; -- StringBuffer infoString = new StringBuffer(); -- if (usernameField.getText().length() == 0) { -- valid = false; -- infoString.append("Please specify a username.\n"); -- } -- if (passwordField.getPassword().length == 0) { -- valid = false; -- infoString.append(passwordInfoString); -- } else if (passwordField.getPassword().length < myproxy.MIN_PASS_PHRASE_LEN) { -- valid = false; -- infoString.append("Passphrase must be at least "); -- infoString.append(Integer.toString(myproxy.MIN_PASS_PHRASE_LEN)); -- infoString.append(" characters in length.\n"); -- } -- if (lifetimeField.getText().length() == 0) { -- lifetimeField.setText(Integer -- .toString(myproxy.getLifetime() / 3600)); -- } -- try { -- Integer.parseInt(lifetimeField.getText()); -- } catch (NumberFormatException e) { -- logger.debug(e.getMessage(), e); -- valid = false; -- infoString.append("Lifetime is not a valid integer.\n"); -- } -- if (hostnameField.getText().length() == 0) { -- valid = false; -- infoString.append("Please specify a MyProxy server hostname.\n"); -- } else { -- try { -- InetAddress.getByName(hostnameField.getText()); -- } catch (UnknownHostException e) { -- logger.debug(e.getMessage(), e); -- valid = false; -- infoString.append("Hostname \""); -- infoString.append(hostnameField.getText()); -- infoString -- .append("\" is not valid. Please specify a valid MyProxy server hostname.\n"); -- } -- } -- if (portField.getText().length() == 0) { -- portField.setText(Integer.toString(myproxy.getPort())); -- } -- try { -- Integer.parseInt(portField.getText()); -- } catch (NumberFormatException e) { -- logger.debug(e.getMessage(), e); -- valid = false; -- infoString -- .append("Port is not a valid integer. Please specify a valid MyProxy server port (default: 7514).\n"); -- } -- if (outputField.getText().length() > 0) { -- File f = new File(outputField.getText()); -- if (f.exists() && !f.canWrite()) { -- valid = false; -- infoString.append(f.getPath()); -- infoString -- .append(" exists and is not writable. Please specify a valid output file or specify no output path to only perform authentication.\n"); -- } -- } -- statusTextArea.setText(new String(infoString)); -- return valid; -- } --} -\ No newline at end of file -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredManager.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredManager.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredManager.java (working copy) -@@ -1,32 +0,0 @@ --package org.globus.transfer.reliable.client.credential; -- --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; --import org.globus.common.CoGProperties; --import org.globus.gsi.CertUtil; --import org.globus.gsi.GlobusCredential; --import org.globus.util.Util; -- -- --public class CredManager { -- private static Log logger = LogFactory.getLog(CredManager.class); -- -- public static ProxyInfo getProxyInfo() throws Exception { -- GlobusCredential proxy = null; -- String file = null; -- ProxyInfo ret = null; -- -- try { -- file = CoGProperties.getDefault().getProxyFile(); -- proxy = new GlobusCredential(file); -- } catch (Exception e) { -- logger.debug("Unable to load the user proxy : " -- + e.getMessage()); -- throw e; -- } -- -- ret = new ProxyInfo(CertUtil.toGlobusID(proxy.getSubject()), -- proxy.getStrength(),Util.formatTimeSec(proxy.getTimeLeft())); -- return ret; -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredentialDialog.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredentialDialog.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/CredentialDialog.java (working copy) -@@ -1,120 +0,0 @@ --package org.globus.transfer.reliable.client.credential; -- --import org.globus.tools.proxy.GridProxyInit; --import org.globus.transfer.reliable.client.credential.myproxy.MyProxyLogonGUI; -- --public class CredentialDialog extends javax.swing.JDialog { -- -- /** Creates new form CredentialDialog */ -- public CredentialDialog(java.awt.Frame parent, boolean modal) { -- super(parent, modal); -- initComponents(); -- } -- -- /** This method is called from within the constructor to -- * initialize the form. -- * WARNING: Do NOT modify this code. The content of this method is -- * always regenerated by the Form Editor. -- */ -- // -- private void initComponents() { -- -- jLabel1 = new javax.swing.JLabel(); -- generate_proxy = new javax.swing.JButton(); -- jLabel2 = new javax.swing.JLabel(); -- Myproxy = new javax.swing.JButton(); -- -- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); -- setTitle("Credential"); -- -- jLabel1.setText("If you want to generate a proxy certificate on your local \nmachine, please select this"); -- -- generate_proxy.setText("generate"); -- generate_proxy.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- generate_proxyActionPerformed(evt); -- } -- }); -- -- jLabel2.setText("If you want to get a proxy certificate from MyPorxy, please select this"); -- -- Myproxy.setText("Myproxy"); -- Myproxy.addActionListener(new java.awt.event.ActionListener() { -- public void actionPerformed(java.awt.event.ActionEvent evt) { -- MyproxyActionPerformed(evt); -- } -- }); -- -- org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); -- getContentPane().setLayout(layout); -- layout.setHorizontalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .addContainerGap() -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 474, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) -- .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 484, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(generate_proxy) -- .add(Myproxy)) -- .addContainerGap(47, Short.MAX_VALUE)) -- ); -- layout.setVerticalGroup( -- layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) -- .add(layout.createSequentialGroup() -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 32, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) -- .add(generate_proxy)) -- .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) -- .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) -- .add(jLabel2) -- .add(Myproxy)) -- .addContainerGap(81, Short.MAX_VALUE)) -- ); -- -- pack(); -- }// -- -- private void generate_proxyActionPerformed(java.awt.event.ActionEvent evt) { -- GridProxyInit proxyInitFrame = new GridProxyInit(null, true); -- proxyInitFrame.setRunAsApplication(false); -- proxyInitFrame.setCloseOnSuccess(true); -- proxyInitFrame.setLocation(50, 50); -- proxyInitFrame.pack(); -- //UITools.center(mainPanel, proxyInitFrame); -- this.setVisible(false); -- proxyInitFrame.setVisible(true); -- -- } -- -- private void MyproxyActionPerformed(java.awt.event.ActionEvent evt) { -- MyProxyLogonGUI.main(null); -- this.setVisible(false); -- } -- -- /** -- * @param args the command line arguments -- */ -- public static void main(String args[]) { -- java.awt.EventQueue.invokeLater(new Runnable() { -- public void run() { -- CredentialDialog dialog = new CredentialDialog(new javax.swing.JFrame(), true); -- dialog.addWindowListener(new java.awt.event.WindowAdapter() { -- public void windowClosing(java.awt.event.WindowEvent e) { -- System.exit(0); -- } -- }); -- dialog.setVisible(true); -- } -- }); -- } -- -- // Variables declaration - do not modify -- private javax.swing.JButton Myproxy; -- private javax.swing.JButton generate_proxy; -- private javax.swing.JLabel jLabel1; -- private javax.swing.JLabel jLabel2; -- // End of variables declaration -- --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/ProxyInfo.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/ProxyInfo.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/credential/ProxyInfo.java (working copy) -@@ -1,36 +0,0 @@ --package org.globus.transfer.reliable.client.credential; -- --public class ProxyInfo { -- private String subject; -- private int strength; -- private String timeLeft; -- -- public ProxyInfo(String subject, int strength, String timeLeft) { -- super(); -- this.subject = subject; -- this.strength = strength; -- this.timeLeft = timeLeft; -- } -- -- public String getSubject() { -- return subject; -- } -- -- public int getStrength() { -- return strength; -- } -- -- public String getTimeLeft() { -- return timeLeft; -- } -- -- public String toString() { -- StringBuffer buf = new StringBuffer(); -- buf.append("Subject: ").append(subject).append("\n") -- .append("Strength: ").append(strength).append(" bits\n") -- .append("Time Left: ").append(timeLeft); -- -- return buf.toString(); -- } -- --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTClient.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTClient.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTClient.java (working copy) -@@ -1,380 +0,0 @@ --/* -- * To change this template, choose Tools | Templates -- * and open the template in the editor. -- */ -- --package org.globus.transfer.reliable.client; -- -- --import java.io.FileWriter; --import java.util.Calendar; --import java.util.HashMap; --import java.util.List; --import java.util.Map; --import java.util.Vector; -- --import javax.xml.namespace.QName; --import javax.xml.rpc.Stub; --import org.apache.axis.message.addressing.Address; --import org.apache.axis.message.addressing.EndpointReferenceType; --import org.globus.gsi.GSIConstants; --import org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel; --import org.globus.rft.generated.Cancel; --import org.globus.rft.generated.GetStatusSet; --import org.globus.rft.generated.GetStatusSetResponse; --import org.globus.rft.generated.RFTFaultResourcePropertyType; --import org.globus.rft.generated.RFTOptionsType; --import org.globus.rft.generated.ReliableFileTransferPortType; --import org.globus.rft.generated.RequestStatusType; --import org.globus.rft.generated.Start; --import org.globus.rft.generated.StartOutputType; --import org.globus.rft.generated.TransferRequestType; --import org.globus.rft.generated.TransferStatusType; --import org.globus.transfer.reliable.client.BaseRFTClient; --import org.globus.transfer.reliable.client.utils.UIConstants; --import org.globus.transfer.reliable.service.RFTConstants; --import org.globus.wsrf.NotificationConsumerManager; --import org.globus.wsrf.WSNConstants; --import org.globus.wsrf.container.ServiceContainer; --import org.globus.wsrf.core.notification.ResourcePropertyValueChangeNotificationElementType; --import org.globus.wsrf.encoding.ObjectSerializer; --import org.globus.wsrf.impl.security.authorization.Authorization; --import org.globus.wsrf.impl.security.authorization.HostAuthorization; --import org.globus.wsrf.impl.security.authorization.ResourcePDPConfig; --import org.globus.wsrf.impl.security.authorization.ServiceAuthorizationChain; --import org.globus.wsrf.impl.security.descriptor.GSISecureConvAuthMethod; --import org.globus.wsrf.impl.security.descriptor.GSISecureMsgAuthMethod; --import org.globus.wsrf.impl.security.descriptor.GSITransportAuthMethod; --import org.globus.wsrf.impl.security.descriptor.ResourceSecurityDescriptor; --import org.globus.wsrf.security.Constants; --import org.oasis.wsn.Subscribe; --import org.oasis.wsn.TopicExpressionType; --import org.oasis.wsrf.faults.BaseFaultType; --import org.oasis.wsrf.lifetime.SetTerminationTime; --import org.oasis.wsrf.lifetime.SetTerminationTimeResponse; --import org.oasis.wsrf.properties.ResourcePropertyValueChangeNotificationType; -- --/** -- * A Client for RFT, extends BaseRFTClient -- * @author Liu Wantao liuwt at uchicago.edu -- */ --public class RFTClient extends BaseRFTClient { -- private static NotificationConsumerManager consumer = null; -- private Map epr2ID = new HashMap(); -- private Map ID2Stub = new HashMap(); -- private QueuePanel queuePanel = null; -- private RFTButtonActionListener listener = null; -- private TransferStatusReporter reporter = null; -- -- public RFTClient() { -- super(); -- } -- -- public RFTClient(RFTButtonActionListener listener, QueuePanel queuePanel) { -- super(); -- this.listener = listener; -- this.queuePanel = queuePanel; -- -- new TransferStatusReporter().start(); -- } -- -- -- /** -- * Generate RFT transfer request -- * @param options RFT options -- * @param rftParam RFT Transfer Parameters -- * @param epr -- * @return -- */ -- public TransferRequestType getTransferRequestType(RFTOptions options, RFTTransferParam rftParam, EndpointReferenceType epr) { -- -- //set RFT options -- RFTOptionsType rftOptions = new RFTOptionsType(); -- -- rftOptions.setParallelStreams(options.getParallelStream()); -- rftOptions.setTcpBufferSize(options.getTcpBufferSize()); -- -- String sourceSubjectName = options.getSourceDN(); -- if (null != sourceSubjectName) { -- rftOptions.setSourceSubjectName(sourceSubjectName); -- } -- String destSubjectName = options.getDestDN(); -- if (null != destSubjectName) { -- rftOptions.setDestinationSubjectName(destSubjectName); -- } -- -- TransferRequestType request = new TransferRequestType(); -- request.setRftOptions(rftOptions); -- request.setTransfer(rftParam.getTransfers1()); -- request.setConcurrency(options.getConcurrent()); -- request.setTransferCredentialEndpoint(epr); -- -- return request; -- } -- -- /** -- * Respond to click event of Start button -- * @param job -- * @throws java.lang.IllegalArgumentException -- */ -- public void startTransfer(RFTJob job) throws Exception { -- RFTOptions options = job.getOptions(); -- RFTTransferParam rftParam = job.getParam(); -- int jobID = job.getJobID(); -- -- String host = rftParam.getServerHost(); -- if (null == host) { -- throw new IllegalArgumentException(UIConstants.ILLEGAL_HOST); -- } -- String port = rftParam.getServerPort(); -- if (null == port) { -- if (authType.equals(GSIConstants.GSI_TRANSPORT)) { -- port = "8443"; -- } else { -- port ="8080"; -- } -- } -- -- if (authType.equals(GSIConstants.GSI_TRANSPORT)) { -- PROTOCOL = UIConstants.HTTPS_PROTOCOL; -- } -- -- String rftFactoryAddress = PROTOCOL + "://"+ host + ":" + port + "/wsrf/services/" -- + "ReliableFileTransferFactoryService"; -- String rftServiceAddress = PROTOCOL+ "://" + host + ":" + port + "/wsrf/services/" -- + "ReliableFileTransferService"; -- -- EndpointReferenceType credEPR = delegateCredential(host, port); -- TransferRequestType transferType = getTransferRequestType(options, rftParam, credEPR); -- EndpointReferenceType rftepr = createRFT(rftFactoryAddress, transferType); -- -- rftepr.setAddress(new Address(rftServiceAddress)); -- ReliableFileTransferPortType rft = rftLocator -- .getReliableFileTransferPortTypePort(rftepr); -- //setAuthzValue(authzType); -- setSecurity((Stub)rft); -- -- //write epr to a file -- QName qname = new QName("http://www.globus.org/namespaces/2004/10/rft", "TransferKey"); -- String resourceKey = rftepr.getProperties().get(qname).getValue(); -- FileWriter writer = new FileWriter(resourceKey); -- try { -- QName qName1 = new QName("", "RFT_EPR"); -- writer.write(ObjectSerializer.toString(rftepr, qName1)); -- } finally { -- if(null != writer) { -- writer.close(); -- } -- } -- -- //For secure notifications -- epr2ID.put(createMapKey(rftepr), Integer.toString(jobID)); -- ID2Stub.put(Integer.toString(jobID), rft); -- subscribeRFT(rft); -- System.out.println("Subscribed for overall status"); -- //End subscription code -- Calendar termTime = Calendar.getInstance(); -- termTime.add(Calendar.MINUTE, TERM_TIME); -- SetTerminationTime reqTermTime = new SetTerminationTime(); -- reqTermTime.setRequestedTerminationTime(termTime); -- System.out.println("Termination time to set: " + TERM_TIME + " minutes"); -- SetTerminationTimeResponse termRes = rft.setTerminationTime(reqTermTime); -- StartOutputType startresp = rft.start(new Start()); -- } -- -- /** -- * Cancel a specified transfer -- * @param jobID -- * @throws Exception -- */ -- public void stopTransfer(String jobID) throws Exception { -- ReliableFileTransferPortType rft = (ReliableFileTransferPortType)ID2Stub.get(jobID); -- Cancel cancel = new Cancel(); -- rft.cancel(cancel); -- } -- -- /** -- * Subscribe resource properties of RFT service -- * @param rft -- * @throws Exception -- */ -- public void subscribeRFT(ReliableFileTransferPortType rft) throws Exception { -- Subscribe request = new Subscribe(); -- request.setUseNotify(Boolean.TRUE); -- if (PROTOCOL.equals("http")) { -- consumer = NotificationConsumerManager.getInstance(); -- } else if (PROTOCOL.equals("https")) { -- Map properties = new HashMap(); -- properties.put(ServiceContainer.CLASS, "org.globus.wsrf.container.GSIServiceContainer"); -- consumer = NotificationConsumerManager.getInstance(properties); -- } -- consumer.startListening(); -- EndpointReferenceType consumerEPR = null; -- ResourceSecurityDescriptor resDesc = new ResourceSecurityDescriptor(); -- Vector authMethod = new Vector(); -- if (AUTHZ.equalsIgnoreCase("host")) { -- ResourcePDPConfig pdpConfig = new ResourcePDPConfig("host"); -- pdpConfig.setProperty(Authorization.HOST_PREFIX, -- HostAuthorization.URL_PROPERTY, endpoint); -- ServiceAuthorizationChain authz = new ServiceAuthorizationChain(); -- authz.initialize(pdpConfig, "chainName", "someId"); -- resDesc.setAuthzChain(authz); -- } else if (AUTHZ.equalsIgnoreCase("self")) { -- resDesc.setAuthz("self"); -- } -- if (PROTOCOL.equals("http")) { -- if (authType.equals(Constants.GSI_SEC_MSG)) { -- authMethod.add(GSISecureMsgAuthMethod.BOTH); -- } else if (authType.equals(Constants.GSI_SEC_CONV)) { -- authMethod.add(GSISecureConvAuthMethod.BOTH); -- } -- } else if (PROTOCOL.equals("https")) { -- authMethod.add(GSITransportAuthMethod.BOTH); -- } -- resDesc.setAuthMethods(authMethod); -- consumerEPR = consumer.createNotificationConsumer(this, resDesc); -- request.setConsumerReference(consumerEPR); -- TopicExpressionType topicExpression = new TopicExpressionType(); -- topicExpression.setDialect(WSNConstants.SIMPLE_TOPIC_DIALECT); -- topicExpression.setValue(RFTConstants.REQUEST_STATUS_RESOURCE); -- request.setTopicExpression(topicExpression); -- rft.subscribe(request); -- -- topicExpression.setValue(RFTConstants.OVERALL_STATUS_RESOURCE); -- request.setTopicExpression(topicExpression); -- rft.subscribe(request); -- } -- -- /** -- * Call back method for subscription -- */ -- public void deliver(List topicPath, EndpointReferenceType producer, Object message) { -- ResourcePropertyValueChangeNotificationType changeMessage = -- ((ResourcePropertyValueChangeNotificationElementType) message) -- .getResourcePropertyValueChangeNotification(); -- BaseFaultType fault = null; -- //System.out.println(((QName)topicPath.get(0)).toString()); -- try { -- if (changeMessage != null) { -- QName topicQName = (QName) topicPath.get(0); -- if (RFTConstants.REQUEST_STATUS_RESOURCE.equals(topicQName)) { -- RequestStatusType requestStatus = (RequestStatusType) changeMessage -- .getNewValue().get_any()[0].getValueAsType( -- RFTConstants.REQUEST_STATUS_RESOURCE, -- RequestStatusType.class); -- System.out.println("\n Transfer Request Status:" -- + requestStatus.getRequestStatus().getValue()); -- -- String jobID = (String) epr2ID.get(createMapKey(producer)); -- int rowIndex = queuePanel.getRowIndex(jobID); -- queuePanel.setColumnValue(rowIndex, 5, requestStatus -- .getRequestStatus().getValue()); -- -- RFTFaultResourcePropertyType faultRP = requestStatus -- .getFault(); -- if (faultRP != null) { -- fault = getFaultFromRP(faultRP); -- } -- if (fault != null) { -- System.err.println("Error:" + fault.getDescription(0)); -- queuePanel.setColumnValue(rowIndex, 7, fault -- .getDescription(0).get_value()); -- } -- } else if (RFTConstants.OVERALL_STATUS_RESOURCE.equals(topicQName)) { --// OverallStatus overallStatus = (OverallStatus) changeMessage --// .getNewValue().get_any()[0].getValueAsType( --// RFTConstants.OVERALL_STATUS_RESOURCE, --// OverallStatus.class); --// int finished = overallStatus.getTransfersFinished(); --// int active = overallStatus.getTransfersActive(); --// int failed = overallStatus.getTransfersFailed(); --// int retrying = overallStatus.getTransfersRestarted(); --// int pending = overallStatus.getTransfersPending(); --// int cancelled = overallStatus.getTransfersCancelled(); --// System.out.println("\n Overall status of transfer:"); --// System.out.println("Finished/Active/Failed/Retrying/Pending/Cancelled"); --// System.out.print(overallStatus.getTransfersFinished() + "/"); --// System.out.print(overallStatus.getTransfersActive() + "/"); --// System.out.print(overallStatus.getTransfersFailed() + "/"); --// System.out.print(overallStatus.getTransfersRestarted() + "/"); --// System.out.print(overallStatus.getTransfersPending() + "/"); --// System.out.print(overallStatus.getTransfersCancelled()); -- //listener.updateOverallStatus(finished, active, failed, retrying, pending, cancelled); -- } -- -- -- } -- } catch (Exception e) { -- e.printStackTrace(); -- System.err.println(e.getMessage()); -- } -- } -- -- private BaseFaultType getFaultFromRP(RFTFaultResourcePropertyType faultRP) { -- if(faultRP.getRftAuthenticationFaultType() != null) { -- return faultRP.getRftAuthenticationFaultType(); -- } else if(faultRP.getRftAuthorizationFaultType() != null) { -- return faultRP.getRftAuthorizationFaultType(); -- } else if(faultRP.getRftDatabaseFaultType() != null) { -- return faultRP.getRftDatabaseFaultType(); -- } else if(faultRP.getRftRepeatedlyStartedFaultType() != null) { -- return faultRP.getRftRepeatedlyStartedFaultType(); -- } else if(faultRP.getRftTransferFaultType() != null) { -- return faultRP.getRftTransferFaultType(); -- } else if(faultRP.getTransferTransientFaultType() != null) { -- return faultRP.getTransferTransientFaultType(); -- } else { -- return null; -- } -- } -- -- private String createMapKey(EndpointReferenceType epr) { -- String ret = null; -- if (null != epr) { -- String address = epr.getAddress().toString(); -- QName qname = new QName("http://www.globus.org/namespaces/2004/10/rft", "TransferKey"); -- String resourceKey = epr.getProperties().get(qname).getValue(); -- ret = new String(address + ":" + resourceKey); -- } -- -- return ret; -- } -- -- class TransferStatusReporter extends Thread { -- public void run() { -- while (true) { -- //int length = queuePanel.tableSize(); -- int i = 0; -- while (i < queuePanel.tableSize()) { -- String isRFT = queuePanel.getColumnValue(i, 7); -- String status = queuePanel.getColumnValue(i, 3); -- if ("true".equals(isRFT) && -- !("Finished".equals(status)) && !"Expanding_Done".equals(status)) { -- int jobID = Integer.parseInt(queuePanel.getColumnValue(i, 0)); -- ReliableFileTransferPortType rft = (ReliableFileTransferPortType)ID2Stub.get(Integer.toString(jobID)); -- if (null != rft) { -- try { -- GetStatusSetResponse response = rft.getStatusSet(new GetStatusSet(1, 1)); -- TransferStatusType statusType = response.getTransferStatusSet(0); -- String jobStatus = statusType.getStatus().getValue(); -- queuePanel.setColumnValue(i , 3, jobStatus); -- } catch (Exception e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } -- } -- } -- i++; -- } -- -- try { -- Thread.sleep(10); -- } catch (InterruptedException e) { -- // TODO Auto-generated catch block -- e.printStackTrace(); -- } -- } -- -- } -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/eprmgmt/EPRManager.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/eprmgmt/EPRManager.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/eprmgmt/EPRManager.java (working copy) -@@ -1,189 +0,0 @@ --package org.globus.transfer.reliable.client.eprmgmt; -- --import java.io.File; --import java.io.FileFilter; --import java.io.FileReader; --import java.io.FileWriter; --import java.io.Reader; --import java.io.Writer; --import java.util.ArrayList; --import java.util.Iterator; --import java.util.List; -- --import javax.xml.namespace.QName; -- --import org.apache.axis.message.addressing.EndpointReferenceType; --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; --import org.globus.wsrf.encoding.ObjectDeserializer; --import org.globus.wsrf.encoding.ObjectSerializer; --import org.xml.sax.InputSource; -- --public class EPRManager { -- private final static String ERP_FILE_SUFFIX = ".epr"; -- private List eprList; -- private static Log logger = LogFactory.getLog(EPRManager.class); -- -- public EPRManager() { -- eprList = new ArrayList(); -- } -- -- public boolean deleteEPRFile(String location, String resourceKey) throws IllegalArgumentException { -- if (null == location) { -- throw new IllegalArgumentException("EPR location can not be null"); -- } -- -- if (null == resourceKey || "".equals(resourceKey.trim())) { -- throw new IllegalArgumentException("resource key can not be null"); -- } -- -- String eprFileName = resourceKey + ERP_FILE_SUFFIX; -- File file = new File(location, eprFileName); -- return file.delete(); -- } -- -- public void addEPR (EndpointReferenceType epr) { -- eprList.add(epr); -- } -- -- public void removeEPR (EndpointReferenceType epr) { -- eprList.remove(epr); -- } -- -- -- public int getNumEPR () { -- return eprList.size(); -- } -- -- public EndpointReferenceType getEPR (int index) throws IllegalArgumentException { -- if (index < 0 || index >= eprList.size()) { -- throw new IllegalArgumentException("index is invalid"); -- } -- -- return eprList.get(index); -- } -- -- public EndpointReferenceType getEPR (String resourceKey) throws IllegalArgumentException{ -- if (null == resourceKey) { -- throw new IllegalArgumentException("resource key can not be null"); -- } -- -- Iterator iter = eprList.iterator(); -- EndpointReferenceType ret = null; -- while (iter.hasNext()) { -- ret = iter.next(); -- if (resourceKey.equals(ret.getProperties().get_any()[0].getValue())) { -- return ret; -- } -- } -- -- return null; -- } -- -- public String getResourceKey (int index) throws IllegalArgumentException { -- if (index < 0 || index >= eprList.size()) { -- throw new IllegalArgumentException("index is invalid"); -- } -- -- EndpointReferenceType epr = eprList.get(index); -- return epr.getProperties().get_any()[0].getValue(); -- } -- -- public List getEPRList () { -- return eprList; -- } -- -- public void writeEPRList (String location) throws Exception{ -- if (null == location) { -- throw new IllegalArgumentException("EPR location can not be null"); -- } -- -- File eprDir = new File(location); -- if (!eprDir.exists() || !eprDir.isDirectory()) { -- eprDir.mkdirs(); -- } -- -- Iterator iter = eprList.iterator(); -- while (iter.hasNext()) { -- saveEPR(iter.next(), eprDir); -- } -- -- } -- -- public void readEPRList (String location) throws Exception { -- if (null == location) { -- throw new IllegalArgumentException("EPR location can not be null"); -- } -- -- File eprDir = new File(location); -- if (!eprDir.exists() || !eprDir.isDirectory()) { -- throw new Exception("the directory for storing EPR does not exist, read operation failed"); -- } -- -- List savedEPRs = readAll(eprDir); -- eprList.addAll(savedEPRs); -- } -- -- private void saveEPR(EndpointReferenceType epr, File eprDir) throws Exception { -- if (null == epr) { -- throw new Exception("can not save a null EPR"); -- } -- -- String resourceKey = epr.getProperties().get_any()[0].getValue(); -- if (null == resourceKey || "".equals(resourceKey.trim())) { -- resourceKey = new Long(System.currentTimeMillis()).toString(); -- } -- -- QName qname = new QName("", "epr"); -- String eprFileName = resourceKey + ERP_FILE_SUFFIX; -- File file = new File(eprDir, eprFileName); -- Writer writer = null; -- try { -- writer = new FileWriter(file); -- ObjectSerializer.serialize(writer, epr, qname); -- } catch (Exception e) { -- logger.debug(e.getMessage(), e); -- throw e; -- } finally { -- if (null != writer) { -- writer.close(); -- } -- } -- -- } -- -- private List readAll(File eprDir) throws Exception { -- List ret = new ArrayList(); -- File[] eprFiles = eprDir.listFiles(new FileFilter() { -- public boolean accept(File file) { -- if(file.isFile() && file.getName().endsWith(ERP_FILE_SUFFIX)) { -- return true; -- } -- -- return false; -- } -- }); -- -- if (null != eprFiles) { -- Reader reader = null; -- for (int i = 0; i < eprFiles.length; i++) { -- try { -- reader = new FileReader(eprFiles[i]); -- InputSource inputSource = new InputSource(reader); -- EndpointReferenceType epr = (EndpointReferenceType)ObjectDeserializer.deserialize( -- inputSource, EndpointReferenceType.class); -- ret.add(epr); -- } catch (Exception e) { -- logger.debug(e.getMessage(), e); -- } finally { -- if (null != reader) { -- reader.close(); -- reader = null; -- } -- } -- } -- } -- -- return ret; -- } --} -Index: modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTButtonActionListener.java -=================================================================== ---- modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTButtonActionListener.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/transfer/reliable/client/RFTButtonActionListener.java (working copy) -@@ -1,71 +0,0 @@ --/* -- * To change this template, choose Tools | Templates -- * and open the template in the editor. -- */ -- --package org.globus.transfer.reliable.client; -- --import org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel; --import org.globus.rft.generated.TransferType; -- --/** -- * Action listener of buttons in the GUI -- * @author Liu Wnatao liuwt at uchicago.edu -- */ --public class RFTButtonActionListener { -- private QueuePanel queuePanel = null; -- private RFTClient rftClient = null; -- private RFTPanel panel = null; -- -- public RFTButtonActionListener(RFTPanel panel) { -- this.panel = panel; -- this.queuePanel = panel.getQueuePanel(); -- this.rftClient = new RFTClient(this, queuePanel); -- } -- -- /** -- * action for click event of Start button -- * @param options -- * @param rftParam -- */ -- public void startButtonAction(RFTJob job, QueuePanel queuePanel) throws Exception { --// int jobID = job.getJobID(); --// RFTOptions options = job.getOptions(); -- RFTTransferParam param = job.getParam(); -- -- TransferType transfer = param.getTransfers1()[0]; -- String[] cols = {Integer.toString(job.getJobID()), transfer.getSourceUrl(), -- transfer.getDestinationUrl(), "started", "0", "No errors"}; -- queuePanel.addTransfer(cols); -- rftClient.startTransfer(job); -- } -- -- /** -- * action for click event of Stop button -- * @param queuePanel -- */ -- public void stopButtonAction(String jobID) throws Exception { -- -- int selectedRowIndex = queuePanel.getRowIndex(jobID, 0); -- String id = queuePanel.getColumnValue(selectedRowIndex, 0); -- rftClient.stopTransfer(id); -- queuePanel.setColumnValue(selectedRowIndex, 3, "Cancelled"); -- queuePanel.setColumnValue(selectedRowIndex, 4, "0"); -- queuePanel.setColumnValue(selectedRowIndex, 5, "No errors"); -- } -- -- public void loadFileButtonAction(RFTJob job, QueuePanel queuePanel) throws Exception { -- RFTTransferParam param = job.getParam(); -- TransferType[] transfers = param.getTransfers1(); -- -- for (int i = 0; i < transfers.length; i++) { -- String[] cols = {Integer.toString(job.getJobID()), -- transfers[i].getSourceUrl(), -- transfers[i].getDestinationUrl(), "started", "0", "No errors"}; -- queuePanel.addTransfer(cols); -- } -- -- rftClient.startTransfer(job); -- } -- --} -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/QueuePanel.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/QueuePanel.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/QueuePanel.java (working copy) -@@ -1,297 +0,0 @@ --package org.globus.ogce.beans.filetransfer.gui.monitor; -- --import org.apache.log4j.Logger; -- --import javax.swing.*; --import javax.swing.border.BevelBorder; --import javax.swing.border.Border; --import javax.swing.table.DefaultTableModel; --import java.awt.*; --import java.awt.event.ActionListener; --import java.awt.event.MouseEvent; --import java.awt.event.MouseListener; --import java.util.Vector; -- --/** -- * A panel which Displays a set of jobs in a queue. The user can add any -- * number of columns to the table. It is assumed that the Jobid is the -- * first column and it is used to distinguish values contained in each row. -- * -- * @author Beulah Kurian Alunkal -- * @version 1.0 -- */ --public class QueuePanel extends JPanel implements MouseListener { -- private static Logger logger = -- Logger.getLogger(QueuePanel.class.getName()); -- -- private JTable queueTable = null; -- private JPopupMenu jpopup = null; -- JTable completeTable = null; -- -- public QueuePanel() { -- setLayout(new BorderLayout()); -- setSize(200, 300); -- setVisible(true); -- queueTable -- = new JTable(); -- -- JScrollPane jobsScrollPane -- = new JScrollPane(queueTable); -- -- add(jobsScrollPane, BorderLayout.CENTER); -- -- //Current transfers border -- Border jobsBorder = BorderFactory.createTitledBorder( -- BorderFactory.createBevelBorder(BevelBorder.LOWERED), -- "Transfer Queue"); -- setBorder(jobsBorder); -- queueTable.addMouseListener(this); -- -- jpopup = new JPopupMenu(); -- -- completeTable = queueTable; -- } // end of constructor -- -- public void createHeader(String cols[]) { -- QueueTableModel tableModel = new QueueTableModel(); -- Vector columnIDs = new Vector(); -- for (int i = 0; i < cols.length; i++) { -- columnIDs.add(cols[i]); -- } -- tableModel.setColumnIdentifiers(columnIDs); -- queueTable.setModel(tableModel); -- -- queueTable.getTableHeader().setReorderingAllowed(false); -- -- -- } -- -- public void addTransfer(String cols[]) { -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- int row = tableModel.getRowCount(); -- Vector rowData = new Vector(); -- for (int i = 0; i < cols.length; i++) { -- rowData.add(cols[i]); -- } -- tableModel.insertRow(row, rowData); -- return; -- } -- -- -- public void updateTransfer(String cols[]) { -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- if (tableModel.getRowCount() > 0) { -- int selectedRow = getRowIndex(cols[0]); -- for (int i = 0; i < cols.length; i++) { -- if (cols[i] != null) { -- tableModel.setValueAt(cols[i], selectedRow, i); -- } -- } -- } -- } -- -- public void setFocus(String jobID) { -- queueTable.repaint(); -- int row = getRowIndex(jobID); -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- int noRows = tableModel.getRowCount(); -- if (noRows > 1) { -- if (row < noRows - 1) { -- row += 1; -- } -- queueTable.scrollRectToVisible(queueTable.getCellRect(row, 0, true)); -- // queueTable.revalidate(); -- -- } -- } -- -- public void deleteTransfer(String jobid) { -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- int selectedRow = getRowIndex(jobid); -- tableModel.removeRow(selectedRow); -- -- } -- -- public JPopupMenu getPopupMenu() { -- return jpopup; -- } -- -- public int getRowIndex(String jobid) { -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- int noRows = tableModel.getRowCount(); -- int selectedRow = 0; -- for (int j = 0; j < noRows; j++) { -- if (jobid.equals(getColumnValue(j, 0))) { -- selectedRow = j; -- break; -- } -- } -- return selectedRow; -- } -- -- public int getRowIndex(java.lang.String value, int col) -- { -- javax.swing.table.DefaultTableModel tableModel = getModel(); -- int noRows = tableModel.getRowCount(); -- int selectedRow = 0; -- for(int j = 0; j < noRows; j++) -- { -- if(!value.equals(getColumnValue(j, col))) -- continue; -- selectedRow = j; -- break; -- } -- -- return selectedRow; -- } -- -- public void clear() { -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- int rowCount = tableModel.getRowCount(); -- if (rowCount > 0) { -- for (int row = 0; row < rowCount; row++) { -- tableModel.removeRow(0); -- -- } -- -- } -- return; -- } -- -- public int tableSize() { -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- int rowCount = tableModel.getRowCount(); -- return rowCount; -- } -- -- public DefaultTableModel getModel() { -- return (DefaultTableModel) queueTable.getModel(); -- } -- -- public String getSelectedJob() { -- int selectedRow = queueTable.getSelectedRow(); -- return getColumnValue(selectedRow, 0); -- } -- -- public String getColumnValue(int row, int col) { -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- return (String) tableModel.getValueAt(row, col); -- } -- -- public void setColumnValue(int row, int col, String value) { -- DefaultTableModel tableModel -- = (DefaultTableModel) getModel(); -- tableModel.setValueAt(value, row, col); -- } -- -- //#################################################### -- // MouseListener methods -- //#################################################### -- public void mousePressed(MouseEvent me) { -- Point clickPoint = new Point(me.getX(), me.getY()); -- -- int selectedRow = queueTable.rowAtPoint(clickPoint); -- -- -- queueTable.setRowSelectionInterval(selectedRow, selectedRow); -- -- if (me.isPopupTrigger()) { -- -- //Popup menu trigger button was pressed, so display -- //the choices for interacting with the selected transfer job -- -- //to show the popup uncomment this line. -- jpopup.show(queueTable, me.getX(), me.getY()); -- -- -- } -- if (me.getClickCount() == 2) { -- //Double click event -- logger.info("Double clicked"); -- } -- } -- -- public void mouseClicked(MouseEvent me) { -- } -- -- public void mouseReleased(MouseEvent me) { -- if (me.isPopupTrigger()) { -- mousePressed(me); -- } -- -- } -- -- public void mouseEntered(MouseEvent me) { -- } -- -- public void mouseExited(MouseEvent me) { -- } -- -- public void createButtonsPanel(String args[], ActionListener parent) { -- JPanel buttonPanel = new JPanel(); -- buttonPanel.setLayout(new GridLayout(1, 0)); -- for (int i = 0; i < args.length; i++) { -- JButton newButton = new JButton(args[i]); -- newButton.addActionListener(parent); -- buttonPanel.add(newButton); -- } -- add(buttonPanel, BorderLayout.SOUTH); -- } -- -- public void createCheckBoxPanel(JCheckBox args[]) { -- JPanel checkBoxPanel = new JPanel(); -- // checkBoxPanel.setLayout(new GridLayout(1,0)); -- for (int i = 0; i < args.length; i++) { -- checkBoxPanel.add(args[i]); -- } -- // checkBoxPanel.setBorder(new TitledBorder(new BevelBorder(BevelBorder.RAISED),"Display")); -- add(checkBoxPanel, BorderLayout.NORTH); -- } -- -- public void addPopupItems(String items[], ActionListener parent) { -- int sep = 0; -- for (int i = 0; i < items.length; i++) { -- -- JMenuItem menuItem = new JMenuItem(items[i]); -- menuItem.addActionListener(parent); -- jpopup.add(menuItem); -- sep++; -- if (sep == 2) { -- jpopup.addSeparator(); -- sep = 0; -- } -- } -- } -- -- public void showRows(String status, int col) { -- if (status.equals("All")) { -- queueTable = completeTable; -- } else { -- logger.info("Not yet implemented"); -- /* int noRows = tableModel.getRowCount(); -- -- for(int j =0 ; j< noRows;j++){ -- if(status.equals(getColumnValue(j,col))){ -- // addTransfer( -- -- } -- }*/ -- } -- } -- --} // end of class -- --class QueueTableModel extends DefaultTableModel { -- public boolean isCellEditable(int row, int col) { -- return false; -- } --} -- -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/QueuePanel.class -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/UrlCopyPanel.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/UrlCopyPanel.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/monitor/UrlCopyPanel.java (working copy) -@@ -1,533 +0,0 @@ --package org.globus.ogce.beans.filetransfer.gui.monitor; -- --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; --import org.globus.gsi.gssapi.auth.Authorization; --import org.globus.gsi.gssapi.auth.IdentityAuthorization; --import org.globus.io.urlcopy.UrlCopy; --import org.globus.io.urlcopy.UrlCopyListener; --import org.globus.ogce.beans.filetransfer.gui.MainInterface; --import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.GridClient; --import org.globus.ogce.beans.filetransfer.transfer.TransferInterface; --import org.globus.tools.ui.util.UITools; --import org.globus.transfer.reliable.client.utils.Utils; --import org.globus.util.GlobusURL; -- --import javax.swing.*; --import java.awt.*; --import java.awt.event.*; --import java.io.PrintWriter; --import java.io.StringWriter; --import java.util.Hashtable; -- --public class UrlCopyPanel extends JPanel implements TransferInterface, UrlCopyListener//, ActionListener --{ -- static Log logger = -- LogFactory.getLog(UrlCopyPanel.class.getName()); -- -- QueuePanel urlcopyQueuePanel = null; -- UrlCopyOptions urlcopyOptions = null; -- Hashtable jobs = null; -- String currentJob = null; -- String errorMsg = null; -- MainInterface theApp = null; -- String finalStatus = "Unknown"; -- boolean active = false; -- -- public UrlCopyPanel() { -- this(null); -- } -- -- public UrlCopyPanel(MainInterface theApp) { -- setLayout(new BorderLayout()); -- this.theApp = theApp; -- urlcopyQueuePanel = new QueuePanel(); -- urlcopyQueuePanel.createHeader(new String[]{"Jobid", "From", "To", -- "Status", "Current", "%", "Errors", "RFT"}); -- add(urlcopyQueuePanel, BorderLayout.CENTER); -- urlcopyOptions = new UrlCopyOptions(); -- // add(urlcopyOptions.getPanel(), BorderLayout.SOUTH); -- jobs = new Hashtable(); -- //urlcopyQueuePanel.createButtonsPanel(new String[]{"Start", "Stop", "Load", "Save", "Clear"}, new ButtonActionListener()); -- urlcopyQueuePanel.addPopupItems(new String[]{"Info", "Cancel", "Restart", -- "Delete"}, new ButtonActionListener()); -- // createCheckBoxPanel(); -- -- } -- -- public void addTransfer(String jobid, String from, String to) { -- -- urlcopyQueuePanel.addTransfer(new String[]{jobid, from, to, "Submitted", -- "0", "0", "N/A"}); -- -- } -- -- public void addTransfer(String jobid, String from, String to, String rft) { -- -- urlcopyQueuePanel.addTransfer(new String[]{jobid, from, to, "Submitted", -- "0", "0", "N/A", rft}); -- -- } -- -- public void startTransfer(String jobid) { -- currentJob = jobid; -- -- if (!((isJob("Cancelled", jobid, false) || (isJob("Finished", jobid, false))))) { -- active = true; -- String from = urlcopyQueuePanel.getColumnValue( -- urlcopyQueuePanel.getRowIndex(jobid), 1); -- String to = urlcopyQueuePanel.getColumnValue( -- urlcopyQueuePanel.getRowIndex(jobid), 2); -- callUrlCopyTransfer(jobid, from, to); -- active = false; -- } else { -- return; -- } -- -- } -- -- public void updateTransfer(String jobid, String status, -- String current, String percent, String errorMsg) { -- -- urlcopyQueuePanel.updateTransfer(new String[]{jobid, null, null, status, -- current, percent -- , errorMsg}); -- -- } -- -- public void deleteTransfer(String jobid) { -- cancelTransfer(jobid); -- urlcopyQueuePanel.deleteTransfer(jobid); -- } -- -- public void cancelTransfer(String jobid) { -- if (isJob("Finished", jobid)) { -- logger.info("Job Finished id = " + jobid); -- } else { -- logger.info("Job Finished id = " + jobid); -- updateTransfer(jobid, "Cancelled", null, null, null); -- UrlCopy urlcopy = (UrlCopy) jobs.get(jobid); -- urlcopy.cancel(); -- } -- } -- -- public boolean callUrlCopyTransfer(String jobid, String from, String to) { -- System.out.println("from:" + from); -- System.out.println("to:" + to); -- -- GlobusURL froms = null; -- GlobusURL tos = null; -- UrlCopy c = null; -- if (from.equals(to)) { -- updateTransfer(jobid, "Cancelled", -- null, null, "Destination and Source are same."); -- } -- logger.info("\nJOB :: \n ID = " + jobid); -- logger.info("\nFrom = " + from); -- logger.info("\nTo = " + to); -- try { -- -- froms = new GlobusURL(from); -- tos = new GlobusURL(to); -- c = new UrlCopy(); -- c.setSourceUrl(froms); -- c.setDestinationUrl(tos); -- Authorization auth = null; -- if (null != GridClient.subject1 && !"".equals(GridClient.subject1.trim())) { -- auth = new IdentityAuthorization(GridClient.subject1); -- } -- -- c.setSourceAuthorization(auth); -- c.setDestinationAuthorization(auth); -- if (from.startsWith("gsiftp") && to.startsWith("gsiftp")) { -- c.setUseThirdPartyCopy(true); -- } else { -- c.setUseThirdPartyCopy(false); -- } -- int bufferSize; -- try { -- bufferSize = Integer.parseInt(Utils.getProperty("tcpbuffersize", "rft.properties")); -- } catch (Exception e) { -- bufferSize = 16000; -- } -- c.setBufferSize(bufferSize); -- c.setAppendMode(urlcopyOptions.getAppendMode()); -- c.setDCAU(urlcopyOptions.getDCAU()); -- c.addUrlCopyListener(this); -- jobs.put(jobid, c); -- -- long st = System.currentTimeMillis(); -- if (!(c.isCanceled())) { -- printOutput("\n\n------------------------------\n"); -- printOutput("Started Job: " + jobid); -- printOutput("\n------------------------------\n"); -- updateTransfer(currentJob, "Active", -- null, null, "No errors"); -- -- c.copy(); -- -- finalStatus = "Finished"; -- updateTransfer(currentJob, "Finished", -- null, null, "No errors"); -- -- urlcopyQueuePanel.setFocus(currentJob); -- long ft = System.currentTimeMillis(); -- long time = ft - st; -- printOutput("\nFrom :" + c.getSourceUrl() + -- "\nTo :" + c.getDestinationUrl() + -- "\nTotal time in millisec = " + time); -- -- -- } -- return true; -- -- } catch (Exception te) { -- -- String error = getStackTrace(te); -- String errorMsg = null; -- -- te.printStackTrace(); -- errorMsg = processErrorMessage(error); -- if (errorMsg == null) { -- errorMsg = te.getMessage(); -- } -- if (errorMsg.indexOf("Root error message: null") >= 0) { -- errorMsg = "File exists"; -- } -- finalStatus = "Failed : " + errorMsg; -- updateTransfer(currentJob, "Failed", -- null, null, errorMsg); -- urlcopyQueuePanel.setFocus(currentJob); -- printError("\n\n\nFrom :" + c.getSourceUrl() + -- "\nTo :" + c.getDestinationUrl() + -- "Error during actual transfer:\n" + -- error); -- return false; -- -- } -- -- -- } -- -- public String getFinalStatus() { -- return finalStatus; -- } -- -- public QueuePanel getQueuePanel() { -- return urlcopyQueuePanel; -- } -- -- public String processErrorMessage(String error) { -- String errorMsg = null; -- if ((error.indexOf("Permission denied")) > 0) { -- errorMsg = "Permission denied"; -- } else if ((error.indexOf("Expired credentials")) -- > 0) { -- errorMsg = "Credentials expired"; -- } else if (((error.indexOf("FileNotFoundException")) > 0) -- || ((error.indexOf("No such file or directory")) > 0)) { -- errorMsg = "Destination Directory is not present. Please create one."; -- -- } else if ((error.indexOf("ClassCastException")) -- > 0) { -- errorMsg = "Destination rejected third party transfer"; -- } else if (((error.indexOf("not enough space on the disk")) > 0) || ((error.indexOf("Disc quota exceeded")) > 0)) { -- errorMsg = "No space in Destination Disk. "; -- } else if ((error.indexOf("Connection reset")) -- > 0) { -- errorMsg = "Network Connection lost."; -- -- } else if (((error.indexOf("Timeout")) > 0) || -- ((error.indexOf("timed out")) > 0) || -- (((error.indexOf("timeout"))) > 0)) { -- errorMsg = "Connection Timed out. Check for firewalls. "; -- } else if (((error.indexOf("close failed")) > 0) || -- (((error.indexOf("closing"))) > 0)) { -- errorMsg = "Transfer was cancelled."; -- } -- return errorMsg; -- } -- -- Exception _exception; -- -- public void transfer(long current, long total) { -- long progress = 0; -- if (total == -1) { -- if (current == -1) { -- printOutput("This is a third party transfer."); -- } else { -- logger.info("\nJOB :: \n ID = " + currentJob + " " + current); -- } -- } else { -- double fraction = (double) current / (double) total; -- float fvalue = Math.round(Math.round(fraction * 100)); -- progress = (long) fvalue; -- logger.info("\n" + current + " out of " + total + " Percent =" + progress); -- } -- String currValue = "N/A"; -- String progressValue = "N/A"; -- if (progress != 0) { -- progressValue = progress + ""; -- } -- -- if (current > 0) { -- currValue = current + ""; -- } -- updateTransfer(currentJob, "Active", -- currValue, progressValue, "No errors"); -- } -- -- public void transferError(Exception e) { -- _exception = e; -- -- } -- -- public void transferCompleted() { -- if (_exception == null) { -- printOutput("Transfer completed successfully"); -- -- } else { -- printError("Error during transfer : " + _exception.getMessage()); -- logger.debug("Error during transfer : " + _exception.getMessage()); -- -- _exception.printStackTrace(System.out); -- -- } -- } -- -- public JPanel getOptionsPanel() { -- return urlcopyOptions.getPanel(); -- } -- -- public void createCheckBoxPanel() { -- JCheckBox allButton = new JCheckBox("All", true); -- allButton.addItemListener(new ItemListener() { -- public void itemStateChanged(ItemEvent e) { -- if (e.getStateChange() == ItemEvent.DESELECTED) { -- urlcopyQueuePanel.showRows("All", 3); -- } -- } -- }); -- JCheckBox activeButton = new JCheckBox("Active"); -- JCheckBox finishedButton = new JCheckBox("Finished"); -- JCheckBox failedButton = new JCheckBox("Failed"); -- JCheckBox othersButton = new JCheckBox("Others"); -- urlcopyQueuePanel.createCheckBoxPanel(new JCheckBox[]{allButton, activeButton, finishedButton, failedButton, othersButton}); -- } -- -- public void clear() { -- if (urlcopyQueuePanel.tableSize() > 0) { -- Object aobj[] = {"Yes", "No"}; -- int k = JOptionPane.showOptionDialog(null, " Do you wish to clear all the jobs and stop the unfinished jobs ?", "Cancellation Alert", -1, 2, null, aobj, aobj[0]); -- if (k == 1) { -- return; -- } else { -- if (!isJob("Finished", currentJob, false)) { -- cancelTransfer(currentJob); -- } -- theApp.clearQueue("urlcopy"); -- try { -- Thread.sleep(5000); -- } catch (Exception e) { -- e.printStackTrace(); -- } -- urlcopyQueuePanel.clear(); -- return; -- -- } -- } else { -- return; -- } -- } -- -- private String getStackTrace(Exception e) { -- StringWriter sw = new StringWriter(); -- PrintWriter pw = new PrintWriter(sw); -- e.printStackTrace(pw); -- return sw.toString(); -- } -- -- public void printOutput(String msg) { -- theApp.msgOut(msg); -- } -- -- public void printError(String msg) { -- theApp.msgOut(msg); -- } -- -- public static void main(String args[]) { -- JFrame frame = new JFrame("Java CoG Kit -UrlCopy File Transfer"); -- -- frame.addWindowListener(new WindowAdapter() { -- public void windowClosing(WindowEvent e) { -- System.exit(0); -- } -- }); -- -- -- Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); -- -- UrlCopyPanel urlcopyPanel = new UrlCopyPanel(); -- // frame.getContentPane().setLayout(new BorderLayout()); -- frame.getContentPane().add(urlcopyPanel); -- // frame.getContentPane().add(urlcopyPanel.getOptionsPanel().getPanel(), BorderLayout.SOUTH); -- frame.pack(); -- frame.setSize(d.width / 2, d.height / 2); -- frame.setVisible(true); -- UITools.center(null, frame); -- for (int i = 1; i < 10; i++) { -- urlcopyPanel.addTransfer("" + i, "gsiftp://arbat.mcs.anl.gov:6223/homes/alunkal/dead.letter", "gsiftp://arbat.mcs.anl.gov:6223/homes/alunkal/test" + i); -- } -- int j = 1; -- while (j < 9) { -- urlcopyPanel.startTransfer(j + ""); -- j++; -- } -- -- } -- -- public boolean isJob(String status, String job) { -- return isJob(status, job, true); -- } -- -- public boolean isJob(String status, String job, boolean alert) { -- int row = urlcopyQueuePanel.getRowIndex(job); -- if (row >= 0) { -- logger.info("VALUE OF THE CURRENT JOB =" + urlcopyQueuePanel.getColumnValue(row, 3)); -- if (urlcopyQueuePanel.getColumnValue(row, 3).equals(status)) { -- if (alert) { -- JOptionPane.showMessageDialog(null, -- "The job is already " + status, -- "URLCOPY Job Information", -- JOptionPane.PLAIN_MESSAGE); -- } -- return true; -- } else { -- return false; -- } -- } -- return false; -- } -- -- class ButtonActionListener implements ActionListener { -- public void actionPerformed(ActionEvent ae) { -- String actionCommand = ae.getActionCommand(); -- if (actionCommand.equals("Save")) { -- Thread saveThread = new Thread() { -- public void run() { -- if (urlcopyQueuePanel.tableSize() > 0) { -- theApp.saveQueueToFile("urlcopy"); -- } -- } -- }; -- saveThread.start(); -- } else if (actionCommand.equals("Load")) { -- Thread loadThread = new Thread() { -- public void run() { -- theApp.loadQueueFromFile("urlcopy"); -- } -- }; -- loadThread.start(); -- } else if (actionCommand.equals("Stop")) { -- Thread controlThread = new Thread() { -- public void run() { -- if (urlcopyQueuePanel.tableSize() > 0) { -- theApp.controlExecutionQueue(false, "urlcopy"); -- } -- } -- }; -- controlThread.start(); -- } else if (actionCommand.equals("Start")) { -- Thread controlThread = new Thread() { -- public void run() { -- if (urlcopyQueuePanel.tableSize() > 0) { -- theApp.controlExecutionQueue(true, "urlcopy"); -- } -- } -- }; -- controlThread.start(); -- } else if (actionCommand.equals("Clear")) { -- Thread controlThread = new Thread() { -- public void run() { -- if (urlcopyQueuePanel.tableSize() > 0) { -- clear(); -- } -- } -- }; -- controlThread.start(); -- } else if (actionCommand.equals("Info")) { -- String job = urlcopyQueuePanel.getSelectedJob(); -- -- int row = urlcopyQueuePanel.getRowIndex(job); -- String msg = " Job ID : " + -- urlcopyQueuePanel.getColumnValue(row, 0) -- + "\n From : " -- + urlcopyQueuePanel.getColumnValue(row, 1) + -- "\n To : " + -- urlcopyQueuePanel.getColumnValue(row, 2) + -- "\n Status : " + -- urlcopyQueuePanel.getColumnValue(row, 3) -- + "\n Errors : " + -- urlcopyQueuePanel.getColumnValue(row, 6) + -- "\n"; -- -- JOptionPane.showMessageDialog(null, -- msg, -- "URLCOPY Job Information", -- JOptionPane.PLAIN_MESSAGE); -- -- } else if (actionCommand.equals("Cancel")) { -- Thread controlThread = new Thread() { -- public void run() { -- String job = urlcopyQueuePanel.getSelectedJob(); -- cancelTransfer(job); -- -- } -- }; -- controlThread.start(); -- -- } else if (actionCommand.equals("Restart")) { -- Thread controlThread = new Thread() { -- public void run() { -- String job = urlcopyQueuePanel.getSelectedJob(); -- if ((isJob("Cancelled", job) || (isJob("Finished", job)))) { -- return; -- } -- while (active) { -- try { -- Thread.sleep(200); -- logger.info("Waiting for the previous job"); -- } catch (Exception e) { -- e.printStackTrace(); -- } -- } -- startTransfer(job); -- } -- }; -- controlThread.start(); -- -- } else if (actionCommand.equals("Delete")) { -- String job = urlcopyQueuePanel.getSelectedJob(); -- int row = urlcopyQueuePanel.getRowIndex(job); -- if (!urlcopyQueuePanel.getColumnValue(row, 3).equals("Finished") -- && !urlcopyQueuePanel.getColumnValue(row, 3).equals("Expanding_Done")) { -- Object aobj[] = {"Yes", "No"}; -- int k = JOptionPane.showOptionDialog(null, " This job is not Finished yet. Do you wish to cancel the job and delete it?", "Deletion Alert", -1, 2, null, aobj, aobj[0]); -- if (k == 1) { -- return; -- } else { -- deleteTransfer(job); -- } -- } else { -- deleteTransfer(job); -- } -- -- } -- } -- -- } -- -- --}// end of class -- -- -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/FileTransferMainPanel.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/FileTransferMainPanel.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/FileTransferMainPanel.java (working copy) -@@ -1,775 +0,0 @@ --package org.globus.ogce.beans.filetransfer.gui; -- --import org.apache.log4j.Logger; --import org.globus.ogce.beans.filetransfer.FtpProperties; --import org.globus.ogce.beans.filetransfer.gui.local.DirEvent; --import org.globus.ogce.beans.filetransfer.gui.local.DirListener; --import org.globus.ogce.beans.filetransfer.gui.local.LocalTreePanel; --import org.globus.ogce.beans.filetransfer.gui.monitor.MonitorPanel; --import org.globus.ogce.beans.filetransfer.gui.monitor.QueuePanel; --import org.globus.ogce.beans.filetransfer.gui.remote.common.DisplayInterface; --import org.globus.ogce.beans.filetransfer.gui.remote.ftp.FtpClient; --import org.globus.ogce.beans.filetransfer.gui.remote.ftp.FtpDirEvent; --import org.globus.ogce.beans.filetransfer.gui.remote.ftp.FtpDirListener; --import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.GridClient; --import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.RemDirEvent; --import org.globus.ogce.beans.filetransfer.gui.remote.gridftp.RemDirListener; --import org.globus.ogce.beans.filetransfer.transfer.DirTransferRequest; --import org.globus.ogce.beans.filetransfer.transfer.FileRequest; --import org.globus.ogce.beans.filetransfer.transfer.RFTFileTransfer; --import org.globus.ogce.beans.filetransfer.transfer.UrlCopyFileTransfer; --import org.globus.ogce.beans.filetransfer.util.DirQueue; --import org.globus.ogce.beans.filetransfer.util.FileOperations; --import org.globus.ogce.beans.filetransfer.util.GridBrokerQueue; --import org.globus.ogce.beans.filetransfer.util.MessagePanel; --import org.globus.rft.generated.TransferType; --import org.globus.tools.ui.util.UITools; --import org.globus.transfer.reliable.client.RFTClient; --import org.globus.transfer.reliable.client.RFTJob; --import org.globus.transfer.reliable.client.RFTOptions; --import org.globus.transfer.reliable.client.RFTTransferParam; --import org.globus.transfer.reliable.client.utils.Utils; --import org.globus.util.ConfigUtil; -- --import javax.swing.*; --import javax.swing.event.InternalFrameAdapter; --import javax.swing.event.InternalFrameEvent; --import java.awt.*; --import java.beans.PropertyVetoException; --import java.io.File; --import java.io.FileInputStream; --import java.io.IOException; --import java.io.Serializable; --import java.util.Hashtable; --import java.util.Properties; -- --/** -- * This is a panel that integrates the LocalTreeBean and RemoteTreeBean to -- * demonstrate the use of grid gui beans in the design of composite beans -- * that provide File Transfer in Grids with drag and drop functionality. -- * -- * @author Beulah Kurian Alunkal -- -- */ --public class FileTransferMainPanel extends MainInterface -- implements DirListener, -- RemDirListener, FtpDirListener, Serializable { -- public static FileTransferMainPanel mainPanel = new FileTransferMainPanel(true); -- private static Logger logger = -- Logger.getLogger(FileTransferMainPanel.class.getName()); -- protected String defaultDir = ConfigUtil.globus_dir; -- protected LocalTreePanel frame1[]; -- protected DisplayInterface frame2[]; -- -- //Counters are used to allow the users to add any no of local or remote -- //file browser beans. -- protected int remCounter = 0; -- protected int lclCounter = 0; -- private JFrame sFrame = null, mFrame = null; -- -- -- //Hashtables to retrive the ftp clients selected. -- public Hashtable gridIFTable,ftpIFTable; -- protected boolean draglocal; -- -- //Queues for storing the requests. -- protected GridBrokerQueue mainQueue = null; -- protected GridBrokerQueue requestQueue = null; -- protected DirQueue saveQueue = null; -- -- protected DisplayInterface fromRemote = null; -- protected LocalTreePanel fromLocal = null; -- protected RFTFileTransfer rftFileTransfer = null; -- protected UrlCopyFileTransfer urlcopyFileTransfer = null; -- protected FileRequest fileRequest = null; -- protected MonitorPanel monitorPanel = null; -- String from = null; -- -- protected JPanel panel = null; -- DirTransferRequest dirRequest = null; -- int maxSites = 10; -- //Parameters for bookmark. -- String profile, user, host, pass; -- int port = 0; -- int scH = 0, scW = 0; -- JDesktopPane desktop = null; -- protected JInternalFrame messageFrame; -- protected MessagePanel messagePanel = null; -- -- -- //RFT transfer -- public static int jobID = 0; -- private QueuePanel queuePanel = null; -- private RFTClient rftClient = null; -- public static int transferID = 1; -- -- -- /*In general for a bean default constructor*/ -- public FileTransferMainPanel() { -- init(); -- setLayout(new GridLayout(1, 1)); -- //add(monitorPanel); -- } -- /*Static variable uses this contructor to create a hidden bean*/ -- -- public FileTransferMainPanel(boolean val) { -- init(); -- sFrame = new JFrame("Status Window"); -- sFrame.getContentPane().setLayout(new GridLayout(1, 1)); -- sFrame.getContentPane().add(monitorPanel); -- sFrame.pack(); -- sFrame.setSize(350, 400); -- sFrame.setVisible(false); -- UITools.center(this,sFrame); -- -- mFrame = new JFrame("Messages Window"); -- mFrame.getContentPane().setLayout(new GridLayout(1, 1)); -- mFrame.getContentPane().add(messagePanel); -- mFrame.pack(); -- mFrame.setSize(350, 400); -- mFrame.setVisible(false); -- } -- -- public void showStatusWindow() { -- sFrame.setVisible(true); -- } -- -- public void showMessagesWindow() { -- mFrame.setVisible(true); -- } -- /* Normal constructor used by all graphical interfaces */ -- public FileTransferMainPanel(String label) { -- init(); -- } -- -- public void init() { -- // setBorder(new TitledBorder(new BevelBorder(BevelBorder.LOWERED),"")); -- Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize(); -- scW = dimension.width - 90; -- scH = dimension.height - 90 * 2; -- setBounds(0, 0, scW + 50, scH); -- System.out.println("Creating a File Transfer Listener"); -- // this.panel = panel; -- // this.desktop = desktop; -- desktop = new JDesktopPane(); -- gridIFTable = new Hashtable(); -- ftpIFTable = new Hashtable(); -- -- mainQueue = new GridBrokerQueue(); -- requestQueue = new GridBrokerQueue(); -- saveQueue = new DirQueue(); -- -- frame1 = new LocalTreePanel[maxSites]; -- frame2 = new DisplayInterface[maxSites]; -- -- createInitialFrames(); -- rftFileTransfer = new RFTFileTransfer(this, monitorPanel); -- urlcopyFileTransfer = new UrlCopyFileTransfer(this, monitorPanel); -- fileRequest = new FileRequest(requestQueue, monitorPanel); -- System.out.println("Adding Creating a File Transfer Listener"); -- desktop.putClientProperty("JDesktopPane.dragMode", "outline"); -- } -- -- public JPanel createMonitorPanel() { -- return monitorPanel; -- } -- -- protected void createInitialFrames() { -- JInternalFrame mFrame = new JInternalFrame( -- "Monitor Frame" -- , true, false, true, true); -- mFrame.setVisible(true); -- mFrame.getContentPane().setLayout(new GridLayout(1, 1)); -- monitorPanel = new MonitorPanel(this); -- mFrame.getContentPane().add(monitorPanel); -- mFrame.pack(); -- mFrame.setSize(350, 330); -- //dimensionnew.width / 5 - 30, dimensionnew.height - 95); -- mFrame.setLocation(5, 10); -- -- desktop.add(mFrame); -- -- createNewLocalFrame(); -- -- String newline = new String(System.getProperty("line.separator")); -- String msgTxt = new String("File Transfer Component"+ newline + -- "Here the Server messages be shown" -- + newline); -- -- -- messageFrame = new JInternalFrame( -- "Message Window" -- , true, false, true, true); -- messageFrame.setVisible(true); -- -- messageFrame.getContentPane().setLayout(new GridLayout(1, 1)); -- messagePanel = new MessagePanel(msgTxt); -- messageFrame.getContentPane().add(messagePanel); -- messageFrame.pack(); -- messageFrame.setLocation(5, 340); -- messageFrame.setSize(350, 135); -- //messageFrame.setVisible(true); -- desktop.add(messageFrame); -- -- rftClient = new RFTClient(null, monitorPanel.getUrlCopyPanel().getQueuePanel()); -- -- } -- -- public MonitorPanel getMonitorFrame() { -- return monitorPanel; -- } -- -- public void processRequest() { -- fileRequest.updateQueue(dirRequest); -- } -- -- public void msgOut(String s) { -- messagePanel.msgOut(s); -- } -- -- public void clearQueue(String provider) { -- logger.info("Invoked the clearQueue in main"); -- logger.info("\nPlease wait... Clearing the queues."); -- if (provider.equals("rft")) { -- rftFileTransfer.clearAllQueues(); -- } else if (provider.equals("urlcopy")) { -- urlcopyFileTransfer.clearAllQueues(); -- } else { -- fileRequest.clearRequestQueue(); -- } -- } -- -- -- public void controlExecutionQueue(boolean start, String provider) { -- if (!start) { -- JOptionPane.showMessageDialog(panel, "Will stop the job execution" + -- " only after the current active job is done. "); -- } else { -- logger.info("Calling the start transfer "); -- } -- if (provider.equals("rft")) { -- rftFileTransfer.setControl(start); -- } else if (provider.equals("urlcopy")) { -- urlcopyFileTransfer.setControl(start); -- } else { -- fileRequest.setControl(start); -- } -- } -- -- public JDesktopPane getDesktopPane() { -- return desktop; -- } -- -- public void saveQueueToFile(String provider) { -- JFileChooser fileChooser = new JFileChooser(defaultDir); -- fileChooser.setApproveButtonText("Save"); -- fileChooser.setDialogTitle("Save Jobs to File"); -- int popdownState = fileChooser.showSaveDialog(panel); -- if (popdownState == JFileChooser.CANCEL_OPTION) { -- return; -- } else { -- File saveFile = fileChooser.getSelectedFile(); -- //writing the default job file name into ftp.properties -- FtpProperties props = null; -- try { -- props = new FtpProperties(FtpProperties.configFile); -- if (provider.equals("rft")) { -- props.setRFTFile(saveFile.getAbsolutePath()); -- } else { -- props.setQueueFile(saveFile.getAbsolutePath()); -- } -- logger.info("\nThe Queue file default location saved=" -- + props.getQueueFile()); -- props.save(FtpProperties.configFile); -- -- } catch (Exception e) { -- logger.debug("The system could not open the specified file\n"); -- } -- saveQueueToFile(saveFile, provider); -- -- } -- -- } -- -- public void saveQueueToFile(File saveFile, String provider) { -- GridBrokerQueue saveQueue = null; -- String displayString = null; -- if (provider.equals("rft")) { -- saveQueue = rftFileTransfer.getSaveQueue(); -- displayString = "RFT Jobs: "; -- } else { -- saveQueue = urlcopyFileTransfer.getSaveQueue(); -- displayString = "Local Provider Jobs: "; -- } -- if (saveQueue.size() > 0) { -- int savedJobsCount = FileOperations.saveQueueToFile(saveQueue, -- saveFile, -- this, -- provider); -- JOptionPane.showMessageDialog(panel, displayString + -- "Successfully saved " + -- savedJobsCount + " jobs " + -- " are not completed yet."); -- } else { -- JOptionPane.showMessageDialog(panel, displayString + "All jobs are done." + -- " Nothing needs to be saved "); -- saveFile.delete(); -- } -- } -- -- public void setSaveQueue(GridBrokerQueue saveQueue, String provider) { -- if (provider.equals("rft")) { -- rftFileTransfer.setSaveQueue(saveQueue); -- } else { -- urlcopyFileTransfer.setSaveQueue(saveQueue); -- } -- } -- -- -- public void loadQueueFromFile(String provider) { -- JFileChooser fileChooser = new JFileChooser(defaultDir); -- fileChooser.setApproveButtonText("Load"); -- fileChooser.setDialogTitle("Load Jobs File"); -- int popdownState = fileChooser.showOpenDialog(panel); -- if (popdownState == JFileChooser.CANCEL_OPTION) { -- return; -- } else { -- -- File loadFile = fileChooser.getSelectedFile(); -- monitorPanel.clear(provider); -- loadQueueFromFile(loadFile, false, provider); -- } -- } -- -- public void loadQueueFromFile(File loadFile, boolean startup, String provider) { -- FileOperations fop = new FileOperations(); -- int filesCount = fop.loadQueueFromFile(loadFile, this, provider); -- String msg = null; -- if (filesCount > 0) { -- msg = "Successfully loaded " + filesCount + " jobs"; -- -- } else { -- msg = "Trying to load an invalid file. Each line in the file should consists of fromUrl, \n" + -- " toUrl and job id separated by semicolon. "; -- JOptionPane.showMessageDialog(panel, msg); -- } -- } -- -- -- public JPanel createNewLocalFrame() { -- if (lclCounter >= maxSites) { -- String msg = "You cannot open more than 10 local windows" + -- " at the same time. \n Please close few of them" + -- " to open new ones."; -- JOptionPane.showMessageDialog(panel, msg); -- return null; -- } -- -- frame1[lclCounter] = new LocalTreePanel("Local File System"); -- frame1[lclCounter].addDirListener(this); -- JInternalFrame localIF = new JInternalFrame("Local System", -- true, true, true, true); -- localIF.setVisible(true); -- localIF.getContentPane().setLayout(new GridLayout(1, 1)); -- localIF.getContentPane().add(frame1[lclCounter]); -- localIF.pack(); -- -- localIF.setSize(300, 450); -- localIF.setLocation(scW / 3 + 50 + (lclCounter) * 20, -- 10 + (lclCounter) * 20); -- localIF.addInternalFrameListener(new InternalFrameAdapter() { -- public void internalFrameClosing(InternalFrameEvent e) { -- lclCounter--; -- System.gc(); -- } -- }); -- desktop.add(localIF); -- try { -- localIF.setSelected(true); -- } catch (PropertyVetoException propertyvetoexception1) { -- propertyvetoexception1.printStackTrace(); -- } -- JPanel localPanel = frame1[lclCounter]; -- System.out.println("Local count incremented."); -- lclCounter++; -- return localPanel; -- } -- -- public void registerLocalComponent(LocalTreePanel local) { -- frame1[lclCounter] = local; -- frame1[lclCounter].addDirListener(this); -- lclCounter++; -- } -- -- public void registerRemoteComponent(DisplayInterface display, int index) { -- if (index == 1) { -- GridClient gc = (GridClient) display; -- gc.addRemDirListener(this); -- frame2[remCounter] = gc; -- } else { -- FtpClient fc = (FtpClient) display; -- fc.addFtpDirListener(this); -- frame2[remCounter] = fc; -- } -- -- remCounter++; -- } -- -- /** -- * Creates a frame for remote file transfer client either ftp or gridftp -- * based on the request. -- * -- * @param ftpindex indicates the client -- */ -- -- public JPanel createRemoteFrame(int ftpindex, String host, -- int port) { -- return createRemoteFrame(ftpindex, host, port, "anonymous", "password"); -- } -- -- public JPanel createRemoteFrame(int ftpindex, String host, int port, -- String user, String pwd) { -- if (remCounter >= maxSites) { -- String msg = "You cannot open more than 10 remote windows" + -- " at the same time. \n Please close few of them" + -- " to open new ones."; -- JOptionPane.showMessageDialog(panel, msg); -- return null; -- } -- if (ftpindex == 1) { -- frame2[remCounter] = new GridClient("Remote System -GridFTP "); -- final GridClient gc = (GridClient) frame2[remCounter]; -- gc.addRemDirListener(this); -- final JInternalFrame gridIF = new JInternalFrame( -- "Remote System -GridFTP" -- , true, true, true, true); -- gridIF.setVisible(true); -- gridIF.getContentPane().setLayout(new GridLayout(1, 1)); -- gridIF.getContentPane().add(gc); -- gridIF.pack(); -- JFrame topLevelFrame = (JFrame)getDesktopPane().getTopLevelAncestor(); -- int frameWidth = topLevelFrame.getWidth(); -- int frameHeight = topLevelFrame.getHeight(); -- gridIF.setSize(frameWidth / 4, frameHeight / 2); -- gridIF.setLocation((topLevelFrame.getX() + frameWidth / 5) - remCounter * 20, topLevelFrame.getY() + frameHeight / 10 + remCounter * 20); -- //gridIF.setSize(300, 450); -- //dimensionnew.width / 5 - 30, dimensionnew.height - 95); -- //gridIF.setLocation(scW / 2 + 210 - (remCounter) * 20, 10 + (remCounter) * 20); -- -- -- gridIF.addInternalFrameListener(new InternalFrameAdapter() { -- public void internalFrameClosing(InternalFrameEvent e) { -- gc.disconnect(); -- // gridIF = null; -- System.gc(); -- } -- }); -- desktop.add(gridIF); -- try { -- gridIF.setSelected(true); -- } catch (PropertyVetoException propertyvetoexception1) { -- propertyvetoexception1.printStackTrace(); -- } -- gridIFTable.put(gc, gridIF); -- remCounter++; -- if (host != null) { -- gc.setHost(host); -- if (port != 0) { -- gc.setPort(port); -- } -- if (!gc.setConnectDetails(false)) { -- return null; -- } -- -- } else { -- gc.connectDlg(null); -- UITools.center(panel, gc.dlgConnect); -- } -- return gc; -- } else if (ftpindex == 3) { -- frame2[remCounter] = new FtpClient("Remote System -FTP"); -- final FtpClient fc = (FtpClient) frame2[remCounter]; -- fc.addFtpDirListener(this); -- JInternalFrame ftpIF = new JInternalFrame( -- "Remote System -FTP", -- true, true, true, true); -- ftpIF.getContentPane().setLayout(new GridLayout(1, 1)); -- ftpIF.getContentPane().add(fc); -- ftpIF.pack(); -- ftpIF.setSize(300, 450); -- //dimensionnew.width / 5 - 30, dimensionnew.height - 95); -- ftpIF.setLocation(scW / 2 + 210 - (remCounter) * 20, -- 10 + (remCounter) * 20); -- -- ftpIF.addInternalFrameListener(new InternalFrameAdapter() { -- public void internalFrameClosing(InternalFrameEvent e) { -- fc.remoteTreeFrame._actionDisconnect(); -- // gridIF = null; -- System.gc(); -- } -- -- }); -- desktop.add(ftpIF); -- try { -- ftpIF.setSelected(true); -- } catch (PropertyVetoException propertyvetoexception1) { -- propertyvetoexception1.printStackTrace(); -- } -- ftpIFTable.put(fc, ftpIF); -- ftpIF.setVisible(true); -- remCounter++; -- if (host != null) { -- fc.setHost(host); -- if (port != 0) { -- fc.setPort(port); -- } -- if (user != null) { -- fc.setUser(user); -- } -- if (user != null) { -- fc.setPwd(pwd); -- } -- if (!fc.setConnectDetails(false)) { -- return null; -- } -- } else { -- fc.connectDlg(null); -- UITools.center(panel, fc.dlgConnect); -- } -- return fc; -- } else { -- logger.info("Extended Feature "); -- return null; -- } -- } // end of createRemoteFrame() -- -- /** -- * Methods to listen to the drag and drop events. -- * -- */ -- public void dragLocal(DirEvent e, String from, LocalTreePanel local) { -- String rftEnabled = Utils.getProperty("rft_enabled", "rft.properties"); -- if ("true".equals(rftEnabled)) { -- JOptionPane.showMessageDialog(null, "RFT is enabled, you can not transfer between local machine" + -- "and GridFTP server", "Error", JOptionPane.ERROR_MESSAGE); -- return; -- } -- -- draglocal = true; -- fromLocal = local; -- this.from = from; -- logger.info("Dragging Local files..."); -- } -- -- public void dragGridFtp(RemDirEvent e, String from, -- GridClient gc) { -- System.out.println("dragGridFTP"); -- this.from = from; -- draglocal = false; -- fromRemote = gc; -- logger.info("Dragging monitorPanel file..."); -- } -- -- public void dragFtp(FtpDirEvent e, String from, -- FtpClient fc) { -- this.from = from; -- draglocal = false; -- fromRemote = fc; -- logger.info("From Remote =" + fromRemote.getRootURL()); -- logger.info("Dragging Ftp file..."); -- } -- -- public void dropLocal(DirEvent e, String to, LocalTreePanel toLocal) { -- -- boolean dropLocal = true; -- logger.info("Dropping the file..."); -- dirRequest = new DirTransferRequest(this, -- fromLocal, toLocal, -- fromRemote, null, -- from, to, -- draglocal, dropLocal, -- monitorPanel.getProvider()); -- -- new AlertThread(this).start(); -- -- -- }//end of the function -- -- public void dropGridFtp(RemDirEvent e, String to, GridClient toRemote) { -- dirRequest = new DirTransferRequest(this, -- fromLocal, null, -- fromRemote, toRemote, -- from, to, -- draglocal, false, -- monitorPanel.getProvider()); -- -- //----------------invode rft to transfer the file-------------------------------------- -- Properties prop = getRFTProperties("rft.properties"); -- if (null != prop) { -- String rftEnabled = prop.getProperty("rft_enabled"); -- -- //using RFT -- if ("true".equals(rftEnabled)) { -- String fromHost = fromRemote.getHost(); -- String fromPort = Integer.toString(fromRemote.getPort()); -- String toHost = toRemote.getHost(); -- String toPort = Integer.toString(toRemote.getPort()); -- String destSN = toRemote.getSubject(); -- String sourceSN = ((GridClient)fromRemote).getSubject(); -- RFTWorker worker = new RFTWorker(prop, from, fromHost, fromPort, -- to, toHost, toPort, sourceSN, destSN); -- worker.start(); -- } else { -- new AlertThread(this).start(); -- } -- } else { -- new AlertThread(this).start(); -- } -- -- -- //----------------invoke rft end------------------------------------------------------- -- -- } -- -- -- public void dropFtp(FtpDirEvent e, String to, FtpClient toRemote) { -- dirRequest = new DirTransferRequest(this, -- fromLocal, null, -- fromRemote, toRemote, -- from, to, -- draglocal, false, -- monitorPanel.getProvider()); -- new AlertThread(this).start(); -- } -- -- private Properties getRFTProperties(String fileName) { -- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; -- File dir = new File(globusDir, "GridFTP_GUI"); -- File propFile = new File(dir, fileName); -- if (!propFile.exists()) { -- return null; -- } -- FileInputStream fis = null; -- Properties prop = new Properties(); -- try { -- fis = new FileInputStream(propFile); -- prop.load(fis); -- } catch (Exception e) { -- e.printStackTrace(); -- } finally { -- try { -- fis.close(); -- } catch (IOException e) { -- } -- } -- -- return prop; -- } -- /** -- * Methods to increment the counter to keep track of the no of remote -- * clients currently active. -- */ -- public void ftpCounter(FtpDirEvent e, FtpClient gc) { -- if (remCounter > 0) { -- JInternalFrame gridframe = (JInternalFrame) ftpIFTable.get(gc); -- gridframe.setVisible(false); -- remCounter--; -- logger.info("\nFtp site is disconnected. "); -- } -- -- } -- -- public void gridCounter(RemDirEvent e, GridClient gc) { -- if (remCounter > 0) { -- JInternalFrame gridframe = (JInternalFrame) gridIFTable.get(gc); -- gridframe.setVisible(false); -- remCounter--; -- logger.info("\nGridFTP site is disconnected. "); -- } -- -- } -- -- public void startActualTransfer(String provider) { -- if (provider.equals("rft")) { -- rftFileTransfer.run(); -- } else { -- urlcopyFileTransfer.run(); -- } -- -- } -- -- public void startActualTransfer(GridBrokerQueue requestQueue, -- String provider) { -- System.out.println("TESTING : Request Queue file size=" + requestQueue.size()); -- //monitorPanel.setFocusTab(1); -- if (provider.equals("rft")) { -- monitorPanel.setFocusTab(1); -- rftFileTransfer.updateQueues(requestQueue); -- monitorPanel.setFocusTab(1); -- } else -- { -- monitorPanel.setFocusTab(0); -- urlcopyFileTransfer.updateQueues(requestQueue); -- } -- } -- -- public FileTransferMainPanel(JPanel panel, JDesktopPane desktop) { -- this(); -- } -- -- class RFTWorker extends Thread { -- Properties prop = null; -- String from; -- String fromHost; -- String fromPort; -- String to; -- String toHost; -- String toPort; -- String sourceSN; -- String destSN; -- -- public RFTWorker(Properties prop, String from, String fromHost, String fromPort, -- String to, String toHost, String toPort, String sourceSN, String destSN) { -- this.prop = prop; -- this.from = from; -- this.fromHost = fromHost; -- this.fromPort = fromPort; -- this.to = to; -- this.toHost = toHost; -- this.toPort = toPort; -- this.sourceSN = sourceSN; -- this.destSN = destSN; -- } -- -- public void run() { -- String rftFrom = "gsiftp://" + fromHost + ":" + fromPort + from; -- String rftTo = "gsiftp://" + toHost + ":" + toPort + to; -- -- RFTTransferParam param = new RFTTransferParam(rftFrom, rftTo, -- prop.getProperty("host"), prop.getProperty("port")); -- int concurrent = Integer.parseInt(prop.getProperty("concurrent")); -- int parallelStream = Integer.parseInt(prop.getProperty("parallelstream")); -- int bufferSize = Integer.parseInt(prop.getProperty("tcpbuffersize")); -- RFTOptions options = new RFTOptions(concurrent, parallelStream, bufferSize, -- destSN, sourceSN); -- RFTJob job = new RFTJob(++FileTransferMainPanel.jobID, options, param); -- TransferType transfer = param.getTransfers1()[0]; -- monitorPanel.setFocusTab(0); -- monitorPanel.getUrlCopyPanel().addTransfer(Integer.toString(FileTransferMainPanel.jobID), -- rftFrom, rftTo, "true"); -- -- try { -- //queuePanel.addTransfer(cols); -- rftClient.startTransfer(job); -- } catch (Exception e1) { -- e1.printStackTrace(); -- JOptionPane.showMessageDialog(null,e1.getMessage(), "Error", -- JOptionPane.WARNING_MESSAGE); -- monitorPanel.getUrlCopyPanel().updateTransfer(Integer.toString(FileTransferMainPanel.jobID), -- "Failed", "N/A", "N/A", e1.getMessage()); -- -- } -- } -- } -- --} -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/local/LocalTreePanel.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/local/LocalTreePanel.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/local/LocalTreePanel.java (working copy) -@@ -1,1463 +0,0 @@ --//LocalTreePanel.java to display the local tree window --package org.globus.ogce.beans.filetransfer.gui.local; -- --import org.apache.log4j.Logger; --import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; --import org.globus.ogce.beans.filetransfer.util.DirQueue; --import org.globus.ogce.beans.filetransfer.util.GridTransferable; --import org.globus.ogce.beans.filetransfer.util.SortFtpString; --import org.globus.tools.ui.util.UITools; -- --import javax.swing.*; --import javax.swing.event.*; --import javax.swing.tree.*; --import java.awt.*; --import java.awt.dnd.*; --import java.awt.event.*; --import java.beans.PropertyChangeListener; --import java.beans.PropertyChangeSupport; --import java.io.File; --import java.io.IOException; --import java.io.Serializable; --import java.net.URL; --import java.util.Enumeration; --import java.util.Iterator; --import java.util.List; --import java.util.StringTokenizer; --import java.util.Vector; -- -- --public class LocalTreePanel extends JPanel -- implements ActionListener, DragSourceListener, -- DragGestureListener, DropTargetListener, Serializable { -- private static Logger logger = -- Logger.getLogger(LocalTreePanel.class.getName()); -- public long firstClickTime = 0; -- protected DefaultMutableTreeNode rootNode; -- protected DefaultTreeModel treeModel; -- protected JTree tree; -- protected DefaultMutableTreeNode seekNode; -- protected DefaultMutableTreeNode lastExp; -- -- protected JToolBar toolBar; -- public Toolkit toolkit; -- public String osname; -- -- public String selectedPath; -- public JLabel statusText; -- public JTextField txtField; -- public boolean noselection; -- public DragSource dragsource = null; -- private int opSystem; -- public int FrameId = 0; -- String dirname; -- public LocalEditFrame editFrame; -- String selectedDestination = null; -- boolean bean = false; -- -- //FileToTransfer fileToTransfer; -- private String draggedValues[]; -- -- private DirQueue queue; -- private String oldTextField; -- private String as1 = ""; -- private String asn = new String(""); -- TreePath destinationPath; -- protected TreePath SelectedTreePath = null; -- protected TreePath dragtreepath = null; -- private boolean dragEnable = true; -- File deleteFile = null; -- boolean deleteFlag = true; -- DefaultMutableTreeNode defaultmutabletreenode = null; -- MutableTreeNode mutabletreenode = null; -- JButton deleteButton = null; -- JScrollPane jscrollpane = null; -- public String LclFile_Sep = new String(System.getProperty("file.separator")); -- String userHome = System.getProperty("user.home") + LclFile_Sep; -- boolean home = true; -- private PropertyChangeSupport pceListeners; -- -- -- -- protected Vector dirlisteners = new Vector(); -- -- /** Register an action listener to be notified when a button is pressed */ -- public void addDirListener(DirListener l) { -- dirlisteners.addElement(l); -- } -- -- /** Remove an Answer listener from our list of interested listeners */ -- public void removeDirListener(DirListener l) { -- dirlisteners.removeElement(l); -- } -- -- /** Send an event to all registered listeners */ -- public void fireDirEvent(DirEvent e, String path, -- LocalTreePanel local) { -- -- Vector list = (Vector) dirlisteners.clone(); -- for (int i = 0; i < list.size(); i++) { -- DirListener listener = (DirListener) list.elementAt(i); -- try { -- switch (e.getID()) { -- case DirEvent.DIR: -- listener.dropLocal(e, path, local); -- break; -- case DirEvent.LOCALDRAG: -- listener.dragLocal(e, path, local); -- break; -- -- } -- } catch (Exception direx) { -- direx.printStackTrace(); -- } -- } -- } -- -- -- public LocalTreePanel() { -- bean = true; -- init(); -- FileTransferMainPanel.mainPanel.registerLocalComponent(this); -- //statusOut("Please click on the view status button to view details of transfer. "); -- -- } -- -- public LocalTreePanel(String label) { -- init(); -- } -- -- public void init() { -- seekNode = null; -- lastExp = null; -- toolkit = Toolkit.getDefaultToolkit(); -- selectedPath = new String(); -- noselection = true; -- -- osname = new String(System.getProperty("os.name")); -- if (osname.indexOf("Windows") >= 0) { -- opSystem = 0; -- } -- -- if ((osname.indexOf("Linux") >= 0) -- || (osname.indexOf("Solaris") >= 0) -- || (osname.indexOf("Unix") >= 0) -- || (osname.indexOf("Mac") >= 0) -- || (osname.indexOf("Irix") >= 0) -- || (osname.indexOf("AIX") >= 0) -- || (osname.indexOf("HP-UX") >= 0) -- || (osname.indexOf("MPE") >= 0) -- || (osname.indexOf("FreeBSD") >= 0)) { -- opSystem = 1; -- } -- if ((osname.indexOf("OS/2") >= 0) -- || (osname.indexOf("NetWare") >= 0)) { -- opSystem = 2; -- } -- -- rootNode = new DefaultMutableTreeNode("Local System"); -- treeModel = new DefaultTreeModel(rootNode); -- treeModel.addTreeModelListener(new LclTreeModelListener()); -- mk_Drives(); -- tree = new JTree(treeModel); -- -- tree.addTreeWillExpandListener(new MyTreeWillExpandListener()); -- tree.addMouseListener(new MyAdapter()); // for double clicking -- tree.addTreeSelectionListener(new TreeSelectionListener() { -- -- public void valueChanged(TreeSelectionEvent treeselectionevent) { -- DefaultMutableTreeNode defaultmutabletreenode = -- (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); -- if (defaultmutabletreenode == null) { -- return; -- } else { -- javax.swing.tree.TreeNode atreenode[] = null; -- atreenode = defaultmutabletreenode.getPath(); -- selectedPath = returnPath(atreenode); -- SelectedTreePath = treeselectionevent.getNewLeadSelectionPath(); -- return; -- } -- } -- -- }); -- tree.setEditable(false); -- tree.getSelectionModel().setSelectionMode(4); -- tree.setShowsRootHandles(true); -- ToolTipManager.sharedInstance().registerComponent(tree); -- LclRenderer lclrenderer = new LclRenderer(); -- tree.setCellRenderer(lclrenderer); -- tree.putClientProperty("JTree.lineStyle", "Angled"); -- jscrollpane = new JScrollPane(tree); -- new DropTarget(tree, this); -- dragsource = DragSource.getDefaultDragSource(); -- dragsource.createDefaultDragGestureRecognizer(tree, 3, this); -- -- toolBar = new JToolBar(); -- toolBar.setFloatable(false); -- -- -- JButton jbutton = createButton("images/16x16/reload.png", -- "Click here to Refresh", -- "4"); -- toolBar.add(jbutton); -- jbutton = createButton("images/16x16/up.png", -- "Click here to go one Directory Up", -- "6"); -- toolBar.add(jbutton); -- jbutton = createButton("images/16x16/view_text.png", -- "Click here to view Directory Info", -- "3"); -- toolBar.add(jbutton); -- JToggleButton jbutton1 = createToggleButton("images/16x16/folder_home.png", -- "Toggle between root and home directories", -- "2"); -- toolBar.add(jbutton1); -- -- -- toolBar.addSeparator(); -- toolBar.addSeparator(); -- jbutton = createButton("images/16x16/folder.png", -- "Click here to Create a new Directory", -- "7"); -- toolBar.add(jbutton); -- -- -- jbutton = createButton("images/16x16/folder_rename.png", -- "Click here to Rename a File/Directory", -- "5"); -- toolBar.add(jbutton); -- -- deleteButton = createButton("images/16x16/folder_delete.png", -- "Click here to delete a File/Directory", -- "1"); -- toolBar.add(deleteButton); -- -- if (bean) { -- toolBar.addSeparator(); -- toolBar.addSeparator(); -- toolBar.addSeparator(); -- -- jbutton = createButton("images/16x16/view_text.png", -- "View the status window.", -- "8"); -- toolBar.add(jbutton); -- jbutton = createButton("images/16x16/view_msg.png", -- "View the messages window.", -- "9"); -- toolBar.add(jbutton); -- } -- -- -- JPanel jpanel = new JPanel(); -- jpanel.setLayout(new BorderLayout()); -- txtField = new JTextField("Address Bar"); -- setOldField(); -- txtField.addActionListener(this); -- jpanel.add(txtField, "South"); -- JPanel jpanel1 = new JPanel(new BorderLayout()); -- statusText = new JLabel("Status : Local Files displayed "); -- //jpanel1.add(statusText, "West"); -- -- -- jpanel.add(toolBar, "North"); -- -- setLayout(new BorderLayout()); -- add(jpanel, "North"); -- add(jscrollpane, "Center"); -- add(jpanel1, "South"); -- setVisible(true); -- queue = new DirQueue(); -- } -- -- public String getTextField() { -- return txtField.getText(); -- } -- -- public void setFrameId(int id) { -- FrameId = id; -- } -- -- public int getFrameId() { -- return FrameId; -- } -- -- public void setOldField() { -- oldTextField = txtField.getText(); -- } -- -- public void setTextField(String newValue) { -- chDir(newValue); -- pceListeners.firePropertyChange("txtField", oldTextField, newValue); -- setOldField(); -- } -- -- public void addPropertyChangeListener(PropertyChangeListener l) { -- if (pceListeners == null) { -- pceListeners = new PropertyChangeSupport(this); -- } -- pceListeners.addPropertyChangeListener(l); -- } -- -- public void removePropertyChangeListener(PropertyChangeListener l) { -- pceListeners.removePropertyChangeListener(l); -- } -- -- public void actionPerformed(ActionEvent actionevent) { -- if (actionevent.getSource() == txtField) { -- setTextField(txtField.getText()); -- } else { -- String s = actionevent.getActionCommand(); -- int i = 0; -- try { -- i = Integer.valueOf(s).intValue(); -- } catch (NumberFormatException numberformatexception) { -- numberformatexception.printStackTrace(); -- } -- switch (i) { -- case 1: // delete the file -- removeCurrentNode(); -- break; -- -- case 2: //toggle home and root -- toggleHomeRoot(); -- break; -- -- case 3: // display dir info -- _actionDirInfo(""); -- break; -- -- case 4: // refresh the window -- _actionRefresh(); -- break; -- -- case 5: // rename the file or dir -- _actionRename(); -- break; -- -- case 6: // go up one directory -- _actionGo1DirUp(); -- break; -- -- case 7: -- _actionMakeDir(); -- break; -- -- case 8: -- FileTransferMainPanel.mainPanel.showStatusWindow(); -- break; -- -- case 9: -- FileTransferMainPanel.mainPanel.showMessagesWindow(); -- break; -- -- } -- } -- -- } -- -- public void toggleHomeRoot() { -- clear(); -- if (!home) { -- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(null, userHome); -- addObject(defaultmutabletreenode1, ""); -- home = true; -- JOptionPane.showMessageDialog(this, -- "Changed to new address: " + userHome); -- txtField.setText(userHome); -- } else { -- -- if (opSystem == 1) { -- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(null, "//"); -- addObject(defaultmutabletreenode1, ""); -- home = false; -- JOptionPane.showMessageDialog(this, -- "Changed to new address: //"); -- txtField.setText("//"); -- } else { -- mk_Drives(); -- home = false; -- JOptionPane.showMessageDialog(this, -- "Changed to new address: System drives"); -- txtField.setText("Local System drives"); -- } -- } -- -- } -- -- public void displayFile() { -- String as[] = returnSelectedFiles(true); -- if (as != null) { -- editFrame = new LocalEditFrame(as, LclFile_Sep); -- editFrame.addWindowListener(new WindowAdapter() { -- -- public void windowClosing(WindowEvent windowevent) { -- editFrame = null; -- System.gc(); -- } -- -- }); -- editFrame.pack(); -- editFrame.setVisible(true); -- } -- } -- -- public void clear() { -- rootNode.removeAllChildren(); -- treeModel.reload(); -- } -- -- public JButton createButton(String s, String s1, String s2) { -- ClassLoader classLoader = getClass().getClassLoader(); -- URL jarCogImage = classLoader.getResource(s); -- JButton jbutton = new JButton(new ImageIcon(jarCogImage)); -- jbutton.setActionCommand(s2); -- jbutton.addActionListener(this); -- jbutton.setToolTipText(s1); -- Dimension dimension = new Dimension(20, 20); -- jbutton.setMaximumSize(dimension); -- jbutton.setMinimumSize(dimension); -- jbutton.setPreferredSize(dimension); -- jbutton.setRequestFocusEnabled(false); -- return jbutton; -- } -- -- public JToggleButton createToggleButton(String s, String s1, String s2) { -- ClassLoader classLoader = getClass().getClassLoader(); -- URL jarCogImage = classLoader.getResource(s); -- JToggleButton jbutton = new JToggleButton(new ImageIcon(jarCogImage)); -- jbutton.setActionCommand(s2); -- jbutton.addActionListener(this); -- jbutton.setToolTipText(s1); -- Dimension dimension = new Dimension(20, 20); -- jbutton.setMaximumSize(dimension); -- jbutton.setMinimumSize(dimension); -- jbutton.setPreferredSize(dimension); -- jbutton.setRequestFocusEnabled(false); -- return jbutton; -- } -- -- public void mk_Drives() { -- -- File[] roots = File.listRoots(); -- try { -- for (int i = 0; i < roots.length; i++) { -- File root = roots[i]; -- if (root.isDirectory()) { -- DefaultMutableTreeNode defaultmutabletreenode = addObject(null, root.getCanonicalPath()); -- addObject(defaultmutabletreenode, ""); -- } -- } -- } catch (IOException e) { -- e.printStackTrace(); -- } -- -- //For Windows, let home = false -- if (opSystem == 0) { -- home = false; -- } -- -- } -- -- public DefaultMutableTreeNode addObject(Object obj) { -- DefaultMutableTreeNode defaultmutabletreenode = null; -- TreePath treepath = tree.getSelectionPath(); -- if (treepath == null) { -- toolkit.beep(); -- return null; -- } -- defaultmutabletreenode = (DefaultMutableTreeNode) treepath.getLastPathComponent(); -- if (defaultmutabletreenode == rootNode) { -- toolkit.beep(); -- return null; -- } else { -- return addObject(defaultmutabletreenode, obj, true); -- } -- } -- -- public DefaultMutableTreeNode addObject -- (DefaultMutableTreeNode defaultmutabletreenode, Object obj) { -- return addObject(defaultmutabletreenode, obj, false); -- } -- -- public DefaultMutableTreeNode addObject -- (DefaultMutableTreeNode defaultmutabletreenode, Object obj, -- boolean flag) { -- DefaultMutableTreeNode defaultmutabletreenode1 = -- new DefaultMutableTreeNode(obj); -- if (defaultmutabletreenode == null) { -- defaultmutabletreenode = rootNode; -- } -- treeModel.insertNodeInto(defaultmutabletreenode1, -- defaultmutabletreenode, -- defaultmutabletreenode.getChildCount()); -- if (flag) { -- tree.scrollPathToVisible(new TreePath(defaultmutabletreenode1.getPath())); -- } -- return defaultmutabletreenode1; -- } -- -- public void listDir(DefaultMutableTreeNode defaultmutabletreenode, -- String s, -- boolean flag) { -- -- File file = new File(s); -- -- String as[] = null; -- as = file.list(); -- if (as == null) { -- return; -- } -- int i = as.length; -- SortFtpString.startSort(as); -- if (i == 0) { -- addObject(defaultmutabletreenode, "", false); -- return; -- } -- for (int j = 0; j < i; j++) { -- File file1; -- if (file.toString().endsWith(LclFile_Sep)) { -- file1 = new File(file.toString() + as[j]); -- } else { -- file1 = new File(file.toString() + LclFile_Sep + as[j]); -- } -- if (file1.isDirectory()) { -- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(defaultmutabletreenode, as[j] + LclFile_Sep, flag); -- addObject(defaultmutabletreenode1, "", false); -- } -- } -- -- for (int k = 0; k < i; k++) { -- File file2; -- if (file.toString().endsWith(LclFile_Sep)) { -- file2 = new File(file.toString() + as[k]); -- } else { -- file2 = new File(file.toString() + LclFile_Sep + as[k]); -- } -- if (!file2.isDirectory()) { -- addObject(defaultmutabletreenode, as[k], flag); -- } -- Font font = new Font("Dialog", Font.PLAIN, 12); -- Enumeration keys = UIManager.getLookAndFeelDefaults() -- .keys(); -- -- while (keys.hasMoreElements()) { -- Object key = keys.nextElement(); -- -- if (UIManager.get(key) instanceof Font) { -- UIManager.put(key, font); -- } -- } -- } -- -- } -- -- public TreePath[] returnSelectedPaths() { -- DefaultMutableTreeNode defaultmutabletreenode = -- (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); -- TreePath atreepath[] = null; -- if (defaultmutabletreenode == null) { -- return atreepath; -- } -- //atreepath = tree.getSelectionModel().getSelectionPaths(); -- if (defaultmutabletreenode.isLeaf()) { -- atreepath = tree.getSelectionModel().getSelectionPaths(); -- return atreepath; -- } else { -- TreePath atreepath1[] = tree.getSelectionPaths(); -- return atreepath1; -- // return null; -- } -- -- } -- -- public String[] returnSelectedPaths1() { -- TreePath atreepath[] = tree.getSelectionModel().getSelectionPaths(); -- String s = null; -- String as[] = null; -- if (atreepath != null) { -- int i = atreepath.length; -- as = new String[i]; -- for (int j = 0; j < i; j++) { -- Object aobj[] = atreepath[j].getPath(); -- int k = aobj.length; -- for (int l = 1; l < k; l++) { -- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) aobj[l]; -- if (!defaultmutabletreenode.isLeaf()) { -- if (l == 1 && defaultmutabletreenode -- != rootNode) { -- s = new String(); -- } -- s = s.concat(aobj[l].toString()); -- } -- } -- -- as[j] = new String(s); -- } -- -- } -- return as; -- } -- -- public String[] returnSelectedFiles(boolean flag) { -- TreePath atreepath[] = returnSelectedPaths(); -- String as[] = null; -- if (atreepath != null) { -- int i = atreepath.length; -- as = new String[i]; -- for (int j = 0; j < i; j++) { -- Object aobj[] = atreepath[j].getPath(); -- int k = aobj.length; -- String s = new String(); -- for (int l = 1; l < k; l++) { -- s = s.concat(aobj[l].toString()); -- } -- -- if (flag) { -- as[j] = new String("file:" + s); -- } else { -- as[j] = new String(s); -- } -- } -- -- } -- return as; -- } -- -- -- public DefaultMutableTreeNode seekParent(DefaultMutableTreeNode defaultmutabletreenode, String s) { -- if (defaultmutabletreenode == null) { -- -- return null; -- } -- -- int i = defaultmutabletreenode.getChildCount(); -- for (int j = 0; j < i; j++) { -- javax.swing.tree.TreeNode treenode = -- defaultmutabletreenode.getChildAt(j); -- String s1 = treenode.toString(); -- if (s.compareTo(s1) == 0) { -- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treenode; -- return defaultmutabletreenode1; -- } -- } -- -- -- return null; -- } -- -- -- public boolean chDir(String s) { -- String s1 = s; -- if (s1.endsWith(LclFile_Sep)) { -- s1 = s1.substring(0, s1.lastIndexOf(LclFile_Sep)); -- } else { -- return false; -- } -- //JOptionPane.showMessageDialog(null, "string s1=" + s1); -- StringTokenizer stringtokenizer = new StringTokenizer(s1, LclFile_Sep); -- Vector vector = new Vector(); -- for (; stringtokenizer.hasMoreTokens(); vector.addElement(stringtokenizer.nextToken() + LclFile_Sep)) { -- logger.info("Adding the file separator"); -- } -- if (opSystem == 0) { -- String s2 = s1.substring(0, 1).toUpperCase(); -- char c = s2.charAt(0); -- char ac[] = ((String) vector.firstElement()).toCharArray(); -- ac[0] = c; -- vector.setElementAt(new String(ac), 0); -- } -- if (opSystem == 1) { -- vector.add(0, new String(LclFile_Sep)); -- } -- clear(); -- mk_Drives(); -- -- // treeModel.reload(); -- DefaultMutableTreeNode defaultmutabletreenode = rootNode; -- -- int i = vector.size(); -- -- for (int j = 0; j < i; j++) { -- -- defaultmutabletreenode = seekParent(defaultmutabletreenode, (String) vector.elementAt(j)); -- if (defaultmutabletreenode != null) { -- tree.expandPath(new TreePath(defaultmutabletreenode.getPath())); -- } -- -- } -- -- if (defaultmutabletreenode == null) { -- setOldField(); -- -- //statusOut("Status : Ready "); -- } else { -- //statusOut("Changed to " + s + "directory"); -- //statusOut("Status : Ready "); -- } -- return true; -- } -- -- public void whereIsNode(DefaultMutableTreeNode defaultmutabletreenode, int i, String s) { -- seekNode = null; -- for (int j = 0; j < i; j++) { -- DefaultMutableTreeNode defaultmutabletreenode1 = -- (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(j); -- if (defaultmutabletreenode1.isLeaf()) { -- continue; -- } -- javax.swing.tree.TreeNode atreenode[] = defaultmutabletreenode1.getPath(); -- TreePath treepath = new TreePath(atreenode); -- String s1 = defaultmutabletreenode1.toString(); -- if (s1.equals(s)) { -- j = i + 1; -- seekNode = defaultmutabletreenode1; -- break; -- } -- if (!tree.isExpanded(treepath)) { -- continue; -- } -- if (s1.equals(s)) { -- j = i + 1; -- seekNode = defaultmutabletreenode1; -- break; -- } -- whereIsNode(defaultmutabletreenode1, defaultmutabletreenode1.getChildCount(), s); -- } -- -- } -- -- public void _actionRefresh() { -- String s = txtField.getText(); -- chDir(s); -- logger.info("The window was refreshed at dir = " + s); -- -- } -- -- -- public synchronized void statusOut(String s) { -- //statusText.setText(s); -- -- } -- -- class LclRenderer extends DefaultTreeCellRenderer { -- -- public Component getTreeCellRendererComponent -- (JTree jtree, Object obj, boolean flag, -- boolean flag1, boolean flag2, int i, -- boolean flag3) { -- super.getTreeCellRendererComponent(jtree, obj, flag, -- flag1, flag2, i, flag3); -- if (!flag2) { -- setToolTipText("Local Path"); -- if (isLocalSystem(obj)) { -- setIcon(LclSystemIcon); -- setToolTipText("Local Hirarchy"); -- } -- if (isLocalDrive(obj)) { -- setIcon(LclDriveIcon); -- setToolTipText("Local Drives"); -- } -- } else { -- setToolTipText("fileClickMessage"); -- } -- return this; -- } -- -- protected boolean isLocalSystem(Object obj) { -- DefaultMutableTreeNode defaultmutabletreenode = -- (DefaultMutableTreeNode) obj; -- Object obj1 = defaultmutabletreenode.getUserObject(); -- String s = obj1.toString(); -- return s.indexOf("local") >= 0; -- } -- -- protected boolean isLocalDrive(Object obj) { -- DefaultMutableTreeNode defaultmutabletreenode = -- (DefaultMutableTreeNode) obj; -- Object obj1 = defaultmutabletreenode.getUserObject(); -- String s = obj1.toString(); -- return s.indexOf("NodeLabel") >= 0; -- } -- -- -- ImageIcon LclSystemIcon; -- ImageIcon LclDriveIcon; -- ImageIcon LclFileIcon; -- -- public LclRenderer() { -- LclSystemIcon = new ImageIcon("images/16x16/konsole2.png"); -- LclDriveIcon = new ImageIcon("images/16x16/filesave.png"); -- LclFileIcon = new ImageIcon("file.gif"); -- super.setBorderSelectionColor(null); -- super.setBackgroundNonSelectionColor(null); -- super.setTextNonSelectionColor(Color.blue); -- super.setLeafIcon(LclFileIcon); -- } -- } -- -- class MyTreeWillExpandListener -- implements TreeWillExpandListener { -- MyTreeWillExpandListener() { -- } -- -- public void treeWillExpand(TreeExpansionEvent treeexpansionevent) { -- DefaultMutableTreeNode defaultmutabletreenode = null; -- Object aobj[] = null; -- aobj = treeexpansionevent.getPath().getPath(); -- int i = aobj.length; -- defaultmutabletreenode = (DefaultMutableTreeNode) aobj[i - 1]; -- if (defaultmutabletreenode == rootNode) { -- statusOut("Node was not selected to expand."); -- return; -- } else { -- -- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treeModel.getChild(aobj[i - 1], 0); -- treeModel.removeNodeFromParent(defaultmutabletreenode1); -- String s1 = returnPath(aobj); -- statusOut("Please wait..Expanding dir " + s1); -- listDir(defaultmutabletreenode, s1, false); -- -- txtField.setText(s1); -- -- noselection = false; -- tree.getSelectionModel().clearSelection(); -- statusOut("Status: Ready"); -- return; -- } -- } -- -- public void treeWillCollapse(TreeExpansionEvent treeexpansionevent) { -- DefaultMutableTreeNode defaultmutabletreenode = null; -- tree.getSelectionModel().clearSelection(); -- Object aobj[] = null; -- aobj = treeexpansionevent.getPath().getPath(); -- int i = aobj.length; -- if (i > 1) { -- defaultmutabletreenode = (DefaultMutableTreeNode) aobj[i - 1]; -- } else { -- defaultmutabletreenode = rootNode; -- } -- if (defaultmutabletreenode == rootNode) { -- // txtField.setText("Local Path "); -- noselection = true; -- treeModel.reload(defaultmutabletreenode); -- return; -- } -- noselection = false; -- defaultmutabletreenode.removeAllChildren(); -- addObject(defaultmutabletreenode, ""); -- aobj = ((DefaultMutableTreeNode) defaultmutabletreenode.getParent()).getPath(); -- lastExp = null; -- getLastExpandeNode(rootNode, treeexpansionevent.getPath()); -- if (lastExp != null) { -- javax.swing.tree.TreeNode atreenode[] = treeModel.getPathToRoot(lastExp); -- TreePath treepath = new TreePath(atreenode); -- Object aobj1[] = treepath.getPath(); -- String s1 = returnPath(aobj1); -- txtField.setText(s1); -- } else { -- -- //txtField.setText("Local Path "); -- noselection = true; -- } -- treeModel.reload(defaultmutabletreenode); -- } -- -- } -- -- class LclTreeModelListener -- implements TreeModelListener { -- -- public void treeNodesChanged(TreeModelEvent treemodelevent) { -- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) treemodelevent.getTreePath().getLastPathComponent(); -- try { -- int i = treemodelevent.getChildIndices()[0]; -- defaultmutabletreenode = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(i); -- } catch (NullPointerException nullpointerexception) { -- nullpointerexception.printStackTrace(); -- } -- javax.swing.tree.TreeNode atreenode[] = null; -- atreenode = defaultmutabletreenode.getPath(); -- File file = new File(returnPath(atreenode)); -- File file1 = new File(selectedPath); -- file1.renameTo(file); -- } -- -- public void treeNodesInserted(TreeModelEvent treemodelevent) { -- } -- -- public void treeNodesRemoved(TreeModelEvent treemodelevent) { -- } -- -- public void treeStructureChanged(TreeModelEvent treemodelevent) { -- } -- -- LclTreeModelListener() { -- } -- } -- -- -- public String returnPath(Object aobj[]) { -- int i = aobj.length; -- String s = new String(); -- for (int j = 1; j < i; j++) { -- s = s.concat(aobj[j].toString()); -- } -- return s; -- } -- -- public void setSelectedSource() { -- draggedValues = returnSelectedFiles(false); -- File lcl = new File(draggedValues[0]); -- fireDirEvent(new DirEvent(this, DirEvent.LOCALDRAG), -- lcl.getAbsolutePath(), this); -- } -- -- public void setSelectedDestination() { -- String as[] = returnSelectedPaths1(); -- if (as == null || as[0] == null) { -- as = new String[1]; -- as[0] = new String(txtField.getText()); -- } -- this.selectedDestination = as[0]; -- } -- -- public void transfer() { -- fireDirEvent(new DirEvent(this, DirEvent.DIR), selectedDestination, this); -- } -- -- public void dragGestureRecognized(DragGestureEvent draggestureevent) { -- draggedValues = returnSelectedFiles(false); -- -- dragtreepath = SelectedTreePath; -- if (draggedValues == null) { -- -- return; -- } else if (!(dragEnable)) { -- JOptionPane.showMessageDialog(null, "Please wait till the status\n bar shows drag enabled."); -- return; -- -- } else { -- GridTransferable Gridtransferable = -- new GridTransferable(draggedValues); -- -- draggestureevent.startDrag(DragSource.DefaultCopyDrop, -- Gridtransferable, this); -- queue.deleteAll(); -- File lcl = new File(draggedValues[0]); -- fireDirEvent(new DirEvent(this, DirEvent.LOCALDRAG), -- lcl.getAbsolutePath(), this); -- statusOut("Please wait. Copying the directory ... "); -- return; -- } -- } -- -- public void setDragEnabled(boolean flag) { -- dragEnable = flag; -- if (flag) { -- -- tree.setBackground(Color.white); -- statusOut("Successfully done dragging."); -- statusOut("Status : Ready "); -- } else { -- tree.setBackground(Color.lightGray); -- statusOut("Frame disabled. Please wait ... till" + -- " the color changes back to white."); -- } -- -- } -- -- -- public void dragEnter(DragSourceDragEvent dragsourcedragevent) { -- } -- -- public void dragOver(DragSourceDragEvent dragsourcedragevent) { -- } -- -- public void dragExit(DragSourceEvent dragsourceevent) { -- } -- -- public void dropActionChanged(DragSourceDragEvent dragsourcedragevent) { -- } -- -- public void dragDropEnd(DragSourceDropEvent dragsourcedropevent) { -- if (dragsourcedropevent.getDropSuccess()) { -- int i = dragsourcedropevent.getDropAction(); -- logger.info("Value of i :" + i); -- } -- } -- -- public void dragEnter(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { --// int i = droptargetdragevent.getDropAction(); --// if ((i & 1) != 0) { --// statusOut("Dragging ..."); --// } --// if ((i & 2) != 0) { --// statusOut("Moving ..."); --// } --// if ((i & 0x40000000) != 0) { --// statusOut("Linking ..."); --// } --// if (!isDragAcceptable(droptargetdragevent)) { --// droptargetdragevent.rejectDrag(); --// return; --// } else { --// return; --// } -- -- } -- -- public void dragExit(java.awt.dnd.DropTargetEvent droptargetevent) { -- } -- -- public void dragOver(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { -- -- //set cursor location. Needed in setCursor method -- Point cursorLocationBis = droptargetdragevent.getLocation(); -- TreePath dPath = -- tree.getPathForLocation(cursorLocationBis.x, cursorLocationBis.y); -- -- tree.setSelectionPath(dPath); -- tree.scrollPathToVisible(dPath); -- cursorLocationBis = null; -- -- } -- -- public void dropActionChanged(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { -- if (!isDragAcceptable(droptargetdragevent)) { -- droptargetdragevent.rejectDrag(); -- return; -- } else { -- return; -- } -- } -- -- public void drop(java.awt.dnd.DropTargetDropEvent droptargetdropevent) { -- if (!isDropAcceptable(droptargetdropevent)) { -- droptargetdropevent.rejectDrop(); -- return; -- } else if (!(dragEnable)) { -- return; -- } -- //get new parent node -- Point loc = droptargetdropevent.getLocation(); -- destinationPath = tree.getPathForLocation(loc.x, loc.y); -- -- -- final String msg = testDropTarget(destinationPath, dragtreepath); -- if (msg != null) { -- droptargetdropevent.rejectDrop(); -- -- SwingUtilities.invokeLater(new Runnable() { -- public void run() { -- JOptionPane.showMessageDialog( -- null, msg, "Error Dialog", JOptionPane.ERROR_MESSAGE -- ); -- } -- }); -- return; -- } -- -- -- java.awt.datatransfer.Transferable transferable = droptargetdropevent.getTransferable(); -- java.awt.datatransfer.DataFlavor adataflavor[] = transferable.getTransferDataFlavors(); -- for (int i = 0; i < adataflavor.length; i++) { -- java.awt.datatransfer.DataFlavor dataflavor = adataflavor[i]; -- try { -- if (dataflavor.equals(java.awt.datatransfer.DataFlavor.javaFileListFlavor)) { -- List list = (List) transferable.getTransferData(dataflavor); -- Iterator iterator = list.iterator(); -- Vector vector = new Vector(); -- String s; -- for (; iterator.hasNext(); vector.add(s)) { -- s = iterator.next().toString(); -- } -- -- -- doCopyAction(vector); -- } -- } catch (java.awt.datatransfer.UnsupportedFlavorException unsupportedflavorexception) { -- logger.debug("Exception = " + unsupportedflavorexception.toString()); -- } catch (IOException ioexception) { -- logger.debug("Exception = " + ioexception.toString()); -- } -- } -- -- droptargetdropevent.dropComplete(true); -- -- } -- -- private String testDropTarget(TreePath destination, TreePath dropper) { -- //Typical Tests for dropping -- -- //Test 1. -- boolean destinationPathIsNull = destination == null; -- if (destinationPathIsNull) { -- return "Invalid drop location."; -- } -- if (destination.equals(dropper)) { -- logger.info("destination =" + destination + -- "\nsource= " + dropper); -- _actionRefresh(); -- return "Destination cannot be same as source"; -- } -- -- -- return null; -- } -- -- public boolean isDragAcceptable(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { -- return (droptargetdragevent.getDropAction() & 3) != 0; -- } -- -- public boolean isDropAcceptable(java.awt.dnd.DropTargetDropEvent droptargetdropevent) { -- return (droptargetdropevent.getDropAction() & 3) != 0; -- } -- -- -- public void doCopyAction(Vector vector) { -- -- int i = vector.size(); -- -- String s = null; -- String as[] = returnSelectedPaths1(); -- -- if (as == null || as[0] == null) { -- as = new String[1]; -- as[0] = new String(txtField.getText()); -- } -- -- -- Object aobj[] = destinationPath.getPath(); -- int k = aobj.length; -- for (int l = 1; l < k; l++) { -- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) aobj[l]; -- if (!defaultmutabletreenode.isLeaf()) { -- if (l == 1 && defaultmutabletreenode != rootNode) { -- s = new String(); -- } -- s = s.concat(aobj[l].toString()); -- } -- } -- asn = as[0]; -- for (int j = 0; j < i; j++) { -- as1 = (String) vector.elementAt(j); -- -- -- } -- //System.out.println("transfer data"); -- logger.info("Called the drop listener"); --// System.out.println("called the drop listener"); --// FileTransferMainPanel.mainPanel.showStatusWindow(); --// FileTransferMainPanel.mainPanel.showMessagesWindow(); -- fireDirEvent(new DirEvent(this, DirEvent.DIR), as[0], this); -- } -- -- public void getLastExpandeNode(DefaultMutableTreeNode defaultmutabletreenode, TreePath treepath) { -- int i = defaultmutabletreenode.getChildCount(); -- for (int j = 0; j < i; j++) { -- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(j); -- if (!defaultmutabletreenode1.isLeaf()) { -- javax.swing.tree.TreeNode atreenode[] = defaultmutabletreenode1.getPath(); -- TreePath treepath1 = new TreePath(atreenode); -- if (!treepath1.equals(treepath) && tree.isExpanded(treepath1)) { -- lastExp = defaultmutabletreenode1; -- getLastExpandeNode(defaultmutabletreenode1, treepath); -- } -- } -- } -- -- } -- -- public void removeCurrentNode() { -- int i = tree.getSelectionModel().getSelectionCount(); -- if (i == 0) { -- toolkit.beep(); -- statusOut("Nothing was selected"); -- statusOut("Status : Ready "); -- return; -- } -- for (int j = 0; j < i; j++) { -- TreePath treepath = tree.getSelectionPath(); -- if (treepath != null) { -- -- defaultmutabletreenode -- = (DefaultMutableTreeNode) treepath.getLastPathComponent(); -- mutabletreenode = (MutableTreeNode) defaultmutabletreenode.getParent(); -- javax.swing.tree.TreeNode atreenode[] = null; -- atreenode = defaultmutabletreenode.getPath(); -- String s = returnPath(atreenode); -- if (mutabletreenode != null && mutabletreenode != rootNode) { -- String msg = null; -- deleteFile = new File(s); -- -- if (deleteFile.isDirectory()) { -- msg = "directory"; -- -- } else { -- msg = "file"; -- } -- Object aobj[] = { -- "Cancel", "Delete"}; -- int k = JOptionPane.showOptionDialog(this, "Do you really want to delete this " + msg, "Delete Alert", -1, 2, null, aobj, aobj[0]); -- if (k != 0) { -- if (deleteFile.isDirectory()) { -- dirDelete(); -- } else { -- deleteFlag = deleteFile.delete(); -- -- if (deleteFlag) { -- logger.info("\nThe" + msg + "is successfully deleted " + deleteFile); -- treeModel.removeNodeFromParent(defaultmutabletreenode); -- if (treeModel.getChildCount(mutabletreenode) == 0) { -- addObject((DefaultMutableTreeNode) mutabletreenode, ""); -- } -- statusOut("Successfully deleted" + -- " File: " + deleteFile); -- statusOut("Status : Ready "); -- } else { -- toolkit.beep(); -- statusOut("Permission Denied"); -- statusOut("Status : Ready "); -- JOptionPane.showMessageDialog(null, deleteFile + " : Permission Denied."); -- } -- } -- } else { -- toolkit.beep(); -- statusOut("No selection was made"); -- statusOut("Status : Ready "); -- } -- } -- } -- } -- } -- -- public void dirDelete() { -- Thread dirDelete = new Thread() { -- public void run() { -- deleteButton.setEnabled(false); -- setDragEnabled(false); -- deleteFlag = deleteDir(deleteFile); -- if (deleteFlag) { -- logger.info("\nThe Directory is successfully" + -- " deleted " + deleteFile); -- treeModel.removeNodeFromParent(defaultmutabletreenode); -- if (treeModel.getChildCount(mutabletreenode) == 0) { -- addObject((DefaultMutableTreeNode) mutabletreenode, ""); -- } -- _actionRefresh(); -- statusOut("Successfully deleted" + -- " Directory: " + deleteFile); -- statusOut("Status : Ready "); -- } else { -- toolkit.beep(); -- JOptionPane.showMessageDialog(null, deleteFile -- + " : Permission Denied."); -- statusOut("Directory: Permission Denied"); -- statusOut("Status : Ready "); -- } -- deleteButton.setEnabled(true); -- setDragEnabled(true); -- } -- }; -- dirDelete.start(); -- } -- -- public boolean deleteDir(File dirname) { -- -- File[] files = dirname.listFiles(); -- -- for (int i = 0; i < files.length; i++) { -- File current = files[i]; -- if (current.isDirectory()) { -- deleteDir(current); -- -- } else { -- current.delete(); -- statusOut("Deleting: " + current.getName()); -- logger.info("Deleted the file " + current.getName()); -- } -- } -- -- logger.info("Deleted the directory " + dirname.getName()); -- boolean flag = dirname.delete(); -- return flag; -- -- -- } -- -- public boolean mkNewDir(String dir, String path) { -- File newfile = new File(path); -- if (!(newfile.exists())) { -- try { -- newfile.mkdirs(); -- return true; -- } catch (Exception e) { -- logger.debug("\nThere is no permission to create directory" + path); -- return false; -- -- } -- } else { -- logger.info("\nDirectory already exists : " + path); -- return true; -- -- } -- } -- -- public void _actionMakeDir(String s) { -- String as[] = returnSelectedPaths1(); -- if (as == null || as[0] == null) { -- if (noselection) { -- toolkit.beep(); -- statusOut("no Path"); -- return; -- } -- as = new String[1]; -- as[0] = new String(txtField.getText()); -- } -- -- File file = new File(as[0] + s); //"newFolder"); -- if (file.exists()) { -- JOptionPane.showMessageDialog(this, "File name already exists."); -- return; -- } -- if (file.mkdir()) { -- statusOut("New Folder created : " + s); -- statusOut("Status : Ready "); -- } else { -- statusOut("New Folder could not be created : " + s); -- statusOut("Status : Ready "); -- JOptionPane.showMessageDialog(this, "Permission denied."); -- return; -- } -- chDir(as[0]); -- whereIsNode(rootNode, rootNode.getChildCount(), s + LclFile_Sep); -- if (seekNode != null) { -- javax.swing.tree.TreeNode atreenode[] -- = treeModel.getPathToRoot(seekNode); -- TreePath treepath1 -- = new TreePath(atreenode); -- tree.scrollPathToVisible(treepath1); -- tree.setSelectionPath(treepath1); -- } -- -- } -- -- public void _actionMakeDir() { -- String dirname = JOptionPane.showInputDialog("Please Enter the Dir Name:"); -- if (dirname != null) { -- _actionMakeDir(dirname); -- } -- } -- -- public File[] _actionDirInfo(String s1) { -- File file = null; -- String as[] = null; -- File as2[] = null; -- //LclDirInfoFrame lclDirInfoFrame; -- -- if (s1.equals("")) { -- //JOptionPane.showMessageDialog(null, "into actionDirInfor"); -- file = new File(txtField.getText() + "."); -- as = file.list(); -- } else { -- file = new File(s1 + "."); -- as2 = file.listFiles(); -- return as2; -- } -- if (as == null && as2 == null) { -- return null; -- } -- -- SortFtpString.startSort(as); -- String s = txtField.getText(); -- if (s.endsWith(LclFile_Sep)) { -- s = s.substring(0, s.lastIndexOf(LclFile_Sep)); -- } -- String as1[] = new String[4]; -- as1[0] = new String("Info Window"); -- as1[1] = new String("Name"); -- as1[2] = new String("Size"); -- as1[3] = new String("Last Modified"); -- -- new LclDirInfoFrame(as1, s + LclFile_Sep, as); -- return null; -- } -- -- -- public void _actionGo1DirUp() { -- String s = txtField.getText(); -- if (s.endsWith(LclFile_Sep)) { -- s = s.substring(0, s.lastIndexOf(LclFile_Sep)); -- } -- StringTokenizer stringtokenizer = new StringTokenizer(s, LclFile_Sep); -- Vector vector = new Vector(); -- for (; stringtokenizer.hasMoreTokens(); vector.addElement(stringtokenizer.nextToken() + LclFile_Sep)) { -- logger.info("Adding the separator"); -- } -- int i = vector.size(); -- -- -- if (i < 2) { -- try { -- tree.fireTreeWillCollapse(new TreePath(rootNode.getPath())); -- } catch (ExpandVetoException expandvetoexception) { -- expandvetoexception.printStackTrace(); -- } -- } else { -- vector.removeElementAt(i - 1); -- i = vector.size(); -- String s1 = new String(); -- for (int j = 0; j < i; j++) { -- s1 = s1.concat(vector.elementAt(j).toString()); -- } -- -- chDir(s1); -- } -- } -- -- public void _actionRename() { -- String tpath[] = returnSelectedFiles(false); -- -- if (tpath == null) { -- toolkit.beep(); -- statusOut("No Selection made"); -- return; -- } else { -- new LclRenameDialog(this, tpath[0]); -- return; -- } -- -- } -- -- class MyAdapter extends MouseAdapter { -- public void mouseClicked(MouseEvent evt) { -- //JOptionPane.showMessageDialog(null, "into mouseclicked method"); -- long clickTime = System.currentTimeMillis(); -- long clickInterval = clickTime - firstClickTime; -- if (clickInterval < 300) { -- Thread display = new Thread() { -- public void run() { -- displayFile(); -- firstClickTime = 0; -- } -- }; -- display.start(); -- } else { -- firstClickTime = clickTime; -- } // end of if - else -- } // end of mouseclicked -- -- } // end of class -- public static void main(String arg[]){ -- LocalTreePanel localPanel = new LocalTreePanel(); -- JFrame sFrame = new JFrame("Local File System"); -- sFrame.getContentPane().setLayout(new GridLayout(1, 1)); -- sFrame.getContentPane().add(localPanel); -- sFrame.pack(); -- sFrame.setSize(300, 400); -- sFrame.setVisible(true); -- UITools.center(null, sFrame); -- -- } --} -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/gridftp/GridClient.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/gridftp/GridClient.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/gridftp/GridClient.java (working copy) -@@ -1,1288 +0,0 @@ --package org.globus.ogce.beans.filetransfer.gui.remote.gridftp; -- --import org.apache.commons.logging.Log; --import org.apache.commons.logging.LogFactory; --import org.apache.log4j.Logger; --import org.globus.common.CoGProperties; --import org.globus.ftp.*; --import org.globus.ftp.exception.ServerException; --import org.globus.gsi.GlobusCredential; --import org.globus.gsi.gssapi.GlobusGSSCredentialImpl; --import org.globus.gsi.gssapi.auth.Authorization; --import org.globus.gsi.gssapi.auth.IdentityAuthorization; --import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; --import org.globus.ogce.beans.filetransfer.gui.monitor.WindowProgress; --import org.globus.ogce.beans.filetransfer.gui.remote.common.DisplayInterface; --import org.globus.ogce.beans.filetransfer.gui.remote.common.GridEvent; --import org.globus.ogce.beans.filetransfer.gui.remote.common.GridListener; --import org.globus.ogce.beans.filetransfer.gui.remote.common.RemoteTreeFrame; --import org.globus.ogce.beans.filetransfer.util.DirQueue; --import org.globus.tools.ui.util.UITools; --import org.ietf.jgss.GSSCredential; -- --import javax.swing.*; --import java.awt.*; --import java.awt.event.*; --import java.beans.PropertyChangeEvent; --import java.beans.PropertyChangeListener; --import java.io.*; --import java.util.Vector; -- -- --public class GridClient extends JPanel implements PropertyChangeListener, DisplayInterface, GridListener, ActionListener, Runnable, Serializable { -- private static Log logger = LogFactory.getLog(GridClient.class.getName()); -- -- private GridFTPClient client; -- private GridFTPClient client1; -- private GridFTPClient client2; -- private GridFTPClient client3; -- WindowProgress wndPreload = null; -- -- private final int GRID_FTP_PORT = 2811; -- -- public String host; -- -- private int port; -- -- private String profile; -- -- private String subject = null; -- -- public RemoteTreeFrame remoteTreeFrame; -- -- public String remoterootDir; -- -- public boolean isConnected = false; -- -- public boolean busy; -- -- -- private boolean put = false; -- -- -- protected JComboBox txtHost; -- -- protected JTextField txtPort; -- -- protected JTextField txtUName; -- -- protected JTextField txtprofileName; -- -- protected JTextField txtSubject; -- -- public JDialog dlgConnect; -- -- private String FileSep; -- -- private GridBagConstraints gbc; -- -- private DirQueue queue; -- -- private String status = null, url = null; -- -- private boolean bean = false; -- protected Vector remdirlisteners = new Vector(); -- public static String subject1; -- /** Register an action listener to be notified when a button is pressed */ -- public void addRemDirListener(RemDirListener l) { -- remdirlisteners.addElement(l); -- } -- -- /** Remove an Answer listener from our list of interested listeners */ -- public void removeRemDirListener(RemDirListener l) { -- remdirlisteners.removeElement(l); -- } -- -- /** Send an event to all registered listeners */ -- public void fireRemDirEvent(RemDirEvent e, DirQueue dirqueue, String path, GridClient gc) { -- // Make a copy of the list and fire the events using that copy. -- Vector list = (Vector) remdirlisteners.clone(); -- for (int i = 0; i < list.size(); i++) { -- RemDirListener listener = (RemDirListener) list.elementAt(i); -- try { -- switch (e.getID()) { -- case RemDirEvent.DIR: -- listener.dropGridFtp(e, path, gc); -- break; -- case RemDirEvent.REMOTEDRAG: -- listener.dragGridFtp(e, path, gc); -- break; -- case RemDirEvent.COUNTER: -- listener.gridCounter(e, gc); -- break; -- -- } -- } catch (Exception direx) { -- direx.printStackTrace(); -- } -- } -- } -- -- public GridClient() { -- this(null, true); -- bean = true; -- FileTransferMainPanel.mainPanel.registerRemoteComponent(this, 1); -- remoteTreeFrame.statusOut("Status: Not connected"); -- } -- -- public GridClient(String s) { -- this(s, false); -- } -- -- public GridClient(String s, boolean bean) { -- -- remoteTreeFrame = new RemoteTreeFrame(this, bean); -- remoteTreeFrame.setVisible(true); -- setLayout(new GridLayout(1, 1)); -- add(remoteTreeFrame); -- setVisible(true); -- -- remoteTreeFrame.addPropertyChangeListener(this); -- -- remoteTreeFrame.addGridListener(this); -- -- txtHost = null; -- txtPort = null; -- host = null; -- port = GRID_FTP_PORT; -- FileSep = null; -- -- isConnected = false; -- dlgConnect = null; -- gbc = new GridBagConstraints(); -- queue = new DirQueue(); -- remoteTreeFrame.setProtocol("gsiftp"); -- remoteTreeFrame.setPort(GRID_FTP_PORT); -- } -- -- public String getStatus() { -- return status; -- } -- -- public String getUrl() { -- return url; -- } -- -- public void setStatus(String status) { -- this.status = status; -- remoteTreeFrame.statusOut(status); -- } -- -- public void setUrl(String url) { -- this.url = url; -- remoteTreeFrame.setUrl(url); -- } -- -- private JComboBox initComboBox() { -- JComboBox box = new JComboBox(); -- FileReader reader = null; -- BufferedReader bufReader = null; -- -- try { -- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; -- File f = new File(globusDir, "sitesName"); -- reader = new FileReader(f); -- bufReader = new BufferedReader(reader); -- String line = null; -- while ((line = bufReader.readLine()) != null) { -- box.addItem(line); -- } -- } catch (Exception e) { -- logger.debug(e.getMessage(), e); -- } finally { -- try { -- if (null != reader) { -- reader.close(); -- } -- if (null != bufReader) { -- bufReader.close(); -- } -- } catch (IOException e) { -- } -- } -- -- return box; -- } -- -- public void connectDlg(JFrame frame) { -- if (isConnected) { -- remoteTreeFrame.statusOut("Connection Exists"); -- return; -- } -- remoteTreeFrame.statusOut("Please wait. Connecting"); -- dlgConnect = new JDialog(frame); -- System.out.println("dlgConnect"); -- dlgConnect.setTitle("Connect to GridFTP"); -- UITools.center(frame, dlgConnect); -- dlgConnect.addWindowListener(new WindowAdapter() { -- public void windowClosing(WindowEvent windowevent) { -- windowevent.getWindow().dispose(); -- System.gc(); -- dlgConnect.removeAll(); -- remoteTreeFrame.setConnected(false); -- } -- }); -- txtHost = initComboBox(); -- -- txtHost.setPreferredSize(new Dimension(225, 20)); -- txtHost.setEditable(true); -- txtHost.setFont(new Font("Times New Roman", 0, 15)); -- txtprofileName = new JTextField(20); -- txtprofileName.setText(GRID_FTP_PORT + ""); -- txtprofileName.setFont(new Font("Times New Roman", 0, 15)); -- txtSubject = new JTextField(20); -- txtSubject.setFont(new Font("Times New Roman", 0, 15)); -- JLabel jhost = new JLabel("Host "); -- JLabel jprofile = new JLabel("Port "); -- JLabel jsubject = new JLabel("Subject "); -- JButton jbutton = new JButton("ok"); -- jbutton.addActionListener(this); -- jbutton.setActionCommand("10"); -- JButton jbutton1 = new JButton("cancel"); -- jbutton1.addActionListener(this); -- jbutton1.setActionCommand("11"); -- JPanel jpanel4 = new JPanel(); -- jpanel4.add(jbutton); -- jpanel4.add(jbutton1); -- -- Container container = dlgConnect.getContentPane(); -- container.setLayout(new BorderLayout()); -- JPanel jp = new JPanel(); -- jp.setLayout(new GridBagLayout()); -- jp.setPreferredSize(new Dimension(350, 200)); -- -- jp.add(jhost, getGBC(0, 16, 0.300000000000000000, 1.0, 0, 2, 1, 2)); -- jp.add(txtHost, getGBC(0, 16, 0.7000000000000000, 0.0, 1, 3, 4, 1)); -- jp.add(jprofile, getGBC(0, 16, 0.30000000000000000, 1.0, 0, 4, 1, 2)); -- jp.add(txtprofileName, getGBC(0, 16, 0.70000000000000000, 0.0, 1, 5, 4, 1)); -- jp.add(jsubject, getGBC(0, 16, 0.30000000000000000, 1.0, 0, 6, 1, 2)); -- jp.add(txtSubject, getGBC(0, 16, 0.70000000000000000, 0.0, 1, 7, 4, 1)); -- jp.add(jpanel4, getGBC(0, 16, 0.30000000000000000, 1.0, 1, 8, 4, 1)); -- container.add(jp, BorderLayout.CENTER); -- -- txtHost.addKeyListener(new KeyAdapter() { -- public void keyTyped(KeyEvent keyevent) { -- char c = keyevent.getKeyChar(); -- if (c == '\n') { -- txtprofileName.requestFocus(); -- } -- } -- }); -- txtprofileName.addKeyListener(new KeyAdapter() { -- public void keyTyped(KeyEvent keyevent) { -- remoteTreeFrame.statusOut("Please wait. Connecting"); -- char c = keyevent.getKeyChar(); -- if (c == '\n') { -- doConnectOK(); -- } -- } -- }); -- -- dlgConnect.pack(); -- dlgConnect.setVisible(true); -- dlgConnect.show(); -- -- } -- -- protected GridBagConstraints getGBC(int i, int j, double d, double d1, int k, int l, int i1, int j1) { -- gbc.fill = i; -- gbc.anchor = j; -- gbc.weightx = d; -- gbc.weighty = d1; -- gbc.gridx = k; -- gbc.gridy = l; -- gbc.gridwidth = i1; -- gbc.gridheight = j1; -- return gbc; -- } -- -- public void doConnectOK() { -- -- dlgConnect.setVisible(false); -- dlgConnect.dispose(); -- dlgConnect.removeAll(); -- dlgConnect = null; -- System.gc(); -- wndPreload = new WindowProgress("Connecting ... Please wait", 25); -- centerWindow(wndPreload); -- // wndPreload.setVisible(true); -- wndPreload.setProgressValue(5); -- try { -- port = Integer.parseInt(txtprofileName.getText()); -- } catch (Exception e) { -- e.printStackTrace(System.out); -- remoteTreeFrame.setConnected(false); -- } -- -- host = txtHost.getSelectedItem().toString(); -- subject = txtSubject.getText(); -- subject1 = subject; -- profile = host + ":" + port;//txtprofileName.getText(); -- if (profile.length() <= 0) { -- profile = host; -- } -- wndPreload.setProgressValue(8); -- setConnectDetails(true); -- -- //save the site name to a file -- if (-1 == txtHost.getSelectedIndex()) { -- String globusDir = System.getProperty("user.home") + File.separator + ".globus"; -- File sitesNameFile = new File(globusDir, "sitesName"); -- FileWriter writer = null; -- try { -- File dir = new File(globusDir); -- if (!dir.isDirectory() || !dir.exists()) { -- dir.mkdirs(); -- } -- if (!sitesNameFile.exists() || !sitesNameFile.isFile()) { -- sitesNameFile.createNewFile(); -- } -- -- writer = new FileWriter(sitesNameFile, true); -- writer.write(host); -- writer.write("\n"); -- } catch (Exception e) { -- logger.debug(e.getMessage(), e); -- } finally { -- try { -- writer.close(); -- } catch (IOException e) { -- } -- } -- } -- } -- -- public boolean setConnectDetails(boolean interactive) { -- remoteTreeFrame.setProtocol("gsiftp"); -- remoteTreeFrame.setHost(host); -- remoteTreeFrame.setPort(port); -- if (wndPreload != null) { -- wndPreload.setProgressValue(10); -- } -- final boolean isInteractive = interactive; -- Thread connectThread = new Thread(){ -- public void run(){ -- remoteTreeFrame._actionConnect(isInteractive); -- } -- }; -- connectThread.start(); -- if (wndPreload != null) { -- wndPreload.setProgressValue(24); -- } -- if (wndPreload != null) { -- wndPreload.setProgressValue(25); -- wndPreload.setVisible(false); -- -- wndPreload = null; -- } -- if (isConnected) { -- return true; -- } else { -- return false; -- } -- } -- -- public void refresh() { -- remoteTreeFrame._actionRefresh(); -- -- } -- -- public void connectRemote() { -- System.out.println("\n HOST = " + host + " port = " + port); -- try { -- client = new GridFTPClient(host, port); -- client1 = new GridFTPClient(host, port); -- client2 = new GridFTPClient(host, port); -- client3 = new GridFTPClient(host, port); -- if (null != subject && !"".equals(subject.trim())) { -- Authorization auth = new IdentityAuthorization(subject); -- client.setAuthorization(auth); -- client1.setAuthorization(auth); -- client2.setAuthorization(auth); -- client3.setAuthorization(auth); -- } -- } catch (ServerException fte) { -- JOptionPane.showMessageDialog(this, "The host: " + -- host + "\n or the port number: " + -- port + " is invalid.\n Please try again. "); -- logger.debug("ServerException instantiating client."); -- logger.debug(fte.getMessage(), fte); -- -- //connectDlg(null); -- // remoteTreeFrame.setConnected(false); -- return; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "The host : " + -- host + "\n or the port number: " + -- port + " is invalid.\n Please try again."); -- logger.debug("IOException instantiating client."); -- logger.debug(ioe.getMessage(), ioe); -- //connectDlg(null); -- // remoteTreeFrame.setConnected(false); -- return; -- } -- if (wndPreload != null) { -- wndPreload.setProgressValue(13); -- } -- String file = null; -- GlobusCredential credentials = null; -- GSSCredential proxy = null; -- -- try { -- if (file == null) { -- file = CoGProperties.getDefault().getProxyFile(); -- } -- credentials = new GlobusCredential(file); -- proxy = new GlobusGSSCredentialImpl(credentials, -- GSSCredential.ACCEPT_ONLY); -- -- } catch (Exception e) { -- System.err.println("Unable to load the user proxy : " + e.getMessage()); -- JOptionPane.showMessageDialog( -- this, -- "Authentication Failed.\n\n" -- + e.getMessage(), -- "Security Message", -- JOptionPane.WARNING_MESSAGE); -- //connectDlg(null); -- logger.debug(e.getMessage(), e); -- // remoteTreeFrame.setConnected(false); -- return; -- } -- if (wndPreload != null) { -- wndPreload.setProgressValue(16); -- } -- try { -- client.authenticate(null); -- client1.authenticate(null); -- client2.authenticate(null); -- client3.authenticate(null); -- } catch (ServerException fte) { -- JOptionPane.showMessageDialog( -- this, -- "Authentication Failed.\n\n" -- + fte.getMessage(), -- "Security Message", -- JOptionPane.WARNING_MESSAGE); -- logger.debug("Credentials are not valid. Use the Security menu"); -- logger.debug(fte.getMessage(), fte); -- //remoteTreeFrame.setConnected(false); -- return; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog( -- this, -- "Authentication Failed.\n\n" -- + ioe.getMessage(), -- "Security Message", -- JOptionPane.WARNING_MESSAGE); -- logger.debug("Credentials are not valid. Use the Security Menu"); -- logger.debug(ioe.getMessage(), ioe); -- //remoteTreeFrame.setConnected(false); -- return; -- } -- if (wndPreload != null) { -- wndPreload.setProgressValue(18); -- } -- try { -- client.setDataChannelAuthentication(DataChannelAuthentication.NONE); -- client1.setDataChannelAuthentication(DataChannelAuthentication.NONE); -- client2.setDataChannelAuthentication(DataChannelAuthentication.NONE); -- client3.setDataChannelAuthentication(DataChannelAuthentication.NONE); -- logger.debug("Setting Data Channel Authorization to none."); -- } catch (ServerException fte) { -- JOptionPane.showMessageDialog(this, "Error setting Data " + -- "Channel Authentication."); -- logger.debug(fte.getMessage(), fte); -- // remoteTreeFrame.setConnected(false); -- return; -- } catch (IOException ioe) { -- logger.debug(ioe.getMessage(), ioe); -- JOptionPane.showMessageDialog(this, "Error setting Data " + -- "Channel Authentication."); -- // remoteTreeFrame.setConnected(false); -- return; -- } -- if (wndPreload != null) { -- wndPreload.setProgressValue(20); -- } -- isConnected = true; -- remoteTreeFrame.setConnected(true); -- } -- -- public void disconnect() { -- remoteTreeFrame._actionDisconnect(); -- } -- -- public boolean createClient(GridFTPClient newClient) { -- try { -- // newClient.close(); -- newClient = null; -- newClient = new GridFTPClient(host, port); -- newClient.authenticate(null); -- -- return true; -- } catch (Exception e) { -- return false; -- } -- } -- -- public String getCurrentDir() { -- try { -- remoterootDir = client.getCurrentDir(); -- } catch (ServerException fte) { -- logger.debug("ServerException getting remote root directory."); -- logger.debug(fte.getMessage(), fte); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return null; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException getting remote root directory."); -- logger.debug(ioe.getMessage(), ioe); -- remoteTreeFrame.setConnected(false); -- return null; -- } catch (Exception ioe) { -- logger.debug("Exception getting remote root directory."); -- logger.debug(ioe.getMessage(), ioe); -- return null; -- } -- -- remoteTreeFrame.setServerOpSys(1); -- //client.pwd(); -- -- return remoterootDir; -- } -- -- -- public void disconnectRemote(boolean connectionAndGUI) { -- if (client != null || client1 != null || client2 != null || client3 != null) { -- -- -- try { -- client.close(); -- client = null; -- if (client1 != null) { -- client1.close(); -- client1 = null; -- } -- if (client2 != null) { -- client2.close(); -- client2 = null; -- } -- if (client3 != null) { -- client3.close(); -- client3 = null; -- } -- -- -- } catch (ServerException fte) { -- logger.debug("ServerException disconnecting."); -- logger.debug(fte.getMessage(), fte); -- } catch (IOException ioe) { -- logger.debug("IOException disconnecting."); -- logger.debug(ioe.getMessage(), ioe); -- } -- } -- if (isConnected) { -- isConnected = false; -- } -- if(connectionAndGUI){ -- System.gc(); -- fireRemDirEvent(new RemDirEvent(this, RemDirEvent.COUNTER), null, "", this); -- } -- logger.debug("Returned correctly after disconnect."); -- return; -- } -- -- public void propertyChange(PropertyChangeEvent evt) { -- System.out.println("\n In the property change method."); -- host = remoteTreeFrame.getHost(); -- remoteTreeFrame.statusOut("Connecting. Please wait ...."); -- isConnected = false; -- setConnectDetails(true); -- logger.debug("Remote url changed.display the authorization dialog "); -- } -- -- public Vector listDir(String dirname) { -- logger.debug("\nEntered the listdir function in grid client."); -- Vector listing = null; -- if (client1 == null) { -- logger.debug("Client null...Trying to create a new instance"); -- try { -- client1 = new GridFTPClient(host, port); -- System.out.println("subject:" + subject); -- if (null != subject && !"".equals(subject.trim())) { -- Authorization auth = new IdentityAuthorization(subject); -- //client.setAuthorization(auth); -- client1.setAuthorization(auth); --// client2.setAuthorization(auth); --// client3.setAuthorization(auth); -- } -- client1.authenticate(null); -- client1.setDataChannelAuthentication(DataChannelAuthentication.NONE); -- } catch (Exception e) { -- logger.debug("Client null...Failed the trial to create one."); -- remoteTreeFrame.setConnected(false); -- return null; -- } -- } -- try { -- client1.setClientWaitParams(200 * 900000, 300); -- client1.changeDir(dirname); -- client1.setPassive(); -- client1.setLocalActive(); --// client1.setLocalPassive(); --// client1.setActive(); -- -- client1.setLocalNoDataChannelAuthentication(); -- logger.debug("\nSET THE PARAMETERS." + client1); -- //listing = client1.list(); -- listing = client1.mlsd(); -- logger.debug("Returned correctly from list."); -- } catch (ServerException fte) { -- logger.debug("ServerException listing directory." + client1); -- fte.printStackTrace(System.out); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return null; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException listing directory."); -- logger.debug(ioe.getMessage()); -- ioe.printStackTrace(System.out); -- remoteTreeFrame.setConnected(false); -- return null; -- } catch (Exception ioe) { -- logger.debug("Exception listing the remote directory."); -- logger.debug(ioe.getMessage()); -- ioe.printStackTrace(); -- return null; -- } -- -- return listing; -- //remoteTreeFrame.setList(listing); -- } -- -- public Vector listAllDir(String dirname) { -- Vector listing = null; -- Vector list = new Vector(); -- if (client == null) { -- logger.debug("Client null...Trying to create a new instance"); -- try { -- client = new GridFTPClient(host, port); -- client.authenticate(null); -- client.setDataChannelAuthentication(DataChannelAuthentication.NONE); -- } catch (Exception e) { -- logger.debug("Client null...Failed the trial to create one."); -- remoteTreeFrame.setConnected(false); -- return null; -- } -- -- -- } -- -- final ByteArrayOutputStream received = new ByteArrayOutputStream(1000); -- String output = null; -- try { -- client.setClientWaitParams(200 * 900000, 300); -- client.changeDir(dirname); -- -- client.setPassive(); -- client.setLocalActive(); --// client.setLocalPassive(); --// client.setActive(); -- -- client.setLocalNoDataChannelAuthentication(); -- client.list("*", "-d", new DataSink() { -- public void write(Buffer buffer) -- throws IOException { -- -- received.write(buffer.getBuffer(), -- 0, -- buffer.getLength()); -- -- } -- -- public void close() -- throws IOException { -- }; -- }); -- output = received.toString(); -- logger.debug("\nReceived of directory listing\n" + output); -- BufferedReader reader = new BufferedReader(new StringReader(received.toString())); -- -- -- String line = null; -- -- while ((line = reader.readLine()) != null) { -- /* if (logger.isDebugEnabled()) { -- logger.debug("line ->" + line); -- }*/ -- if (line.startsWith("total")) { -- continue; -- } -- list.addElement(line); -- logger.debug("\nline = " + line); -- } -- -- listing = list; -- } catch (Exception e) { -- logger.debug("Parameterized list also failed"); -- e.printStackTrace(System.out); -- } -- -- return listing; -- -- } -- -- public Vector listTransferDir(String dirname) { -- Vector listing = null; -- if (client2 == null) { -- logger.debug("Client null...Trying to create a new instance"); -- try { -- client2 = new GridFTPClient(host, port); -- client2.authenticate(null); -- client2.setDataChannelAuthentication(DataChannelAuthentication.NONE); -- } catch (Exception e) { -- logger.debug("Client null...Failed the trial to create one."); -- JOptionPane.showMessageDialog(this, "Please drag a smaller" + -- "directory.\n Server is not" + -- " to remain connected."); -- remoteTreeFrame.setConnected(false); -- return null; -- } -- -- } -- try { -- client2.setClientWaitParams(200 * 900000, 300); -- client2.changeDir(dirname); -- client2.setPassive(); -- client2.setLocalActive(); --// client2.setLocalPassive(); --// client2.setActive(); -- -- client2.setLocalNoDataChannelAuthentication(); -- listing = client2.mlsd(); -- logger.debug("Returned correctly from list."); -- } catch (ServerException fte) { -- logger.debug("ServerException listing directory."); -- fte.printStackTrace(System.out); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return null; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException listing directory."); -- logger.debug(ioe.getMessage()); -- ioe.printStackTrace(System.out); -- remoteTreeFrame.setConnected(false); -- return null; -- } catch (Exception ioe) { -- logger.debug("Exception listing the remote directory."); -- logger.debug(ioe.getMessage()); -- ioe.printStackTrace(System.out); -- return null; -- } -- -- return listing; -- //remoteTreeFrame.setList(listing); -- } -- -- public Vector listDeleteDir(String dirname) { -- Vector listing = null; -- if (client3 == null) { -- logger.debug("Client null...returning from listCurrentDirectory"); -- try { -- client3 = new GridFTPClient(host, port); -- client3.authenticate(null); -- client3.setDataChannelAuthentication(DataChannelAuthentication.NONE); -- } catch (Exception e) { -- logger.debug("Client null...Failed the trial to create one."); -- remoteTreeFrame.setConnected(false); -- return null; -- } -- } -- try { -- client3.setClientWaitParams(200 * 900000, 300); -- client3.changeDir(dirname); -- client3.setPassive(); -- client3.setLocalActive(); --// client3.setLocalPassive(); --// client3.setActive(); -- -- client3.setLocalNoDataChannelAuthentication(); -- listing = client3.list(); -- logger.debug("Returned correctly from list."); -- } catch (ServerException fte) { -- logger.debug("ServerException listing directory."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return null; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException listing directory."); -- logger.debug(ioe.getMessage()); -- ioe.printStackTrace(System.out); -- remoteTreeFrame.setConnected(false); -- return null; -- } catch (Exception ioe) { -- logger.debug("Exception listing the remote directory."); -- logger.debug(ioe.getMessage()); -- ioe.printStackTrace(System.out); -- return null; -- } -- -- return listing; -- //remoteTreeFrame.setList(listing); -- } -- -- public void pwd() { -- try { -- client.getCurrentDir(); -- logger.debug("Returned correctly from pwd."); -- } catch (ServerException fte) { -- logger.debug("ServerException showing pwd."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- -- return; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException showing pwd."); -- logger.debug(ioe.getMessage()); -- remoteTreeFrame.setConnected(false); -- return; -- } -- } -- -- public void get(String remote, File local) { -- /* try { -- client.get(remote,local); -- logger.debug("Returned correctly from pwd."); -- } -- catch (ServerException fte) { -- logger.debug("ServerException showing pwd."); -- logger.debug(fte.getMessage()); -- return ; -- } -- catch (IOException ioe) { -- logger.debug("IOException showing pwd."); -- logger.debug(ioe.getMessage()); -- return ; -- }*/ -- } -- -- public void put(File local, String remote) { -- /* try { -- client.put(local,remote,false); -- logger.debug("Returned correctly from pwd."); -- } -- catch (ServerException fte) { -- logger.debug("ServerException showing pwd."); -- logger.debug(fte.getMessage()); -- return ; -- } -- catch (IOException ioe) { -- logger.debug("IOException showing pwd."); -- logger.debug(ioe.getMessage()); -- return ; -- }*/ -- } -- -- public boolean chdir(String s) { -- try { -- client.changeDir(s); -- logger.debug("Returned correctly from change dir command"); -- return true; -- } catch (ServerException fte) { -- logger.debug("ServerException during change dir command."); -- -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return false; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException during change dir command."); -- logger.debug(ioe.getMessage()); -- remoteTreeFrame.setConnected(false); -- return false; -- } catch (Exception ioe) { -- logger.debug("Exception during change dir command."); -- logger.debug(ioe.getMessage()); -- return false; -- } -- -- } -- -- -- public void setType(boolean flag) { -- if (flag) { -- try { -- client.setType(Session.TYPE_ASCII); -- logger.debug("Returned correctly from setType."); -- } catch (ServerException fte) { -- logger.debug("ServerException during setType."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException during setType."); -- logger.debug(ioe.getMessage()); -- remoteTreeFrame.setConnected(false); -- return; -- } -- } else { -- try { -- client.setType(Session.TYPE_IMAGE); -- logger.debug("Returned correctly from setType."); -- } catch (ServerException fte) { -- logger.debug("ServerException during setType."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException in setType."); -- logger.debug(ioe.getMessage()); -- remoteTreeFrame.setConnected(false); -- return; -- } -- } -- } -- -- public boolean rename(String s, String s1) { -- try { -- client.rename(s, s1); -- logger.debug("Returned correctly from rename."); -- return true; -- } catch (ServerException fte) { -- logger.debug("ServerException renaming directory."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return false; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException renaming directory."); -- logger.debug(ioe.getMessage()); -- ioe.printStackTrace(System.out); -- remoteTreeFrame.setConnected(false); -- return false; -- } -- } -- -- public boolean exists(String s1) { -- try { -- return client.exists(s1); -- } catch (ServerException fte) { -- logger.debug("ServerException renaming directory."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return false; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException renaming directory."); -- logger.debug(ioe.getMessage()); -- ioe.printStackTrace(System.out); -- remoteTreeFrame.setConnected(false); -- return false; -- } -- } -- -- public boolean mkdir(String s) { -- try { -- if (!exists(s)) { -- client.makeDir(s); -- logger.debug("Returned correctly from make directory."); -- } else { -- System.out.println("The already directory exists"); -- } -- return true; -- } catch (ServerException fte) { -- logger.debug("Directory exists or Permission denied."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("exists") > 0) { -- remoteTreeFrame.setError("exists"); -- return true; -- } else if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- logger.debug(errorMsg); -- return false; -- } else { -- logger.debug(errorMsg); -- return false; -- } -- -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("No network connection or Firewall prevents it."); -- logger.debug(ioe.getMessage()); -- remoteTreeFrame.setConnected(false); -- return false; -- } -- } -- -- public boolean mkdirs(String dir, String path) { -- try { -- int index = dir.lastIndexOf("/"); -- int index1 = path.lastIndexOf("/"); -- -- logger.info("\nSTART DIR = " + dir + " index = " + index); -- logger.info("\npath = " + path + " index1 = " + index1); -- logger.info("\nMAKING DIR = " + path.substring(0, index1)); -- if (index1 > index) { -- mkdirs(dir, path.substring(0, index1)); -- -- } -- -- if (mkdir(path)) { -- return true; -- } else { -- return false; -- } -- } catch (Exception e) { -- return true; -- } -- -- } -- -- public boolean removeDir(String s) { -- try { -- client.deleteDir(s); -- logger.debug("Returned correctly after deleting directory."); -- return true; -- } catch (ServerException fte) { -- logger.debug("ServerException deleting directory."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return false; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException deleting directory."); -- logger.debug(ioe.getMessage()); -- remoteTreeFrame.setConnected(false); -- return false; -- } -- } -- -- public boolean removeFile(String s) { -- try { -- client.deleteFile(s); -- logger.debug("Returned correctly after deleting file."); -- return true; -- } catch (ServerException fte) { -- logger.debug("ServerException deleting file."); -- String errorMsg = fte.getMessage(); -- if (errorMsg.indexOf("Timeout") > 0) { -- JOptionPane.showMessageDialog(this, "Connection Timed Out"); -- remoteTreeFrame.setConnected(false); -- } -- logger.debug(errorMsg); -- return false; -- } catch (IOException ioe) { -- JOptionPane.showMessageDialog(this, "Disconnected due to" + -- " Network problems"); -- logger.debug("IOException deleting file."); -- logger.debug(ioe.getMessage()); -- remoteTreeFrame.setConnected(false); -- return false; -- } -- } -- -- public void setHost(String host) { -- this.host = host; -- } -- -- public String getHost() { -- return host; -- } -- -- public void setPort(int port) { -- this.port = port; -- } -- -- public int getPort() { -- return port; -- } -- -- public String getSubject() { -- if ("".equals(subject.trim())) { -- subject = null; -- } -- -- return subject; -- } -- -- public void rootDirRemote() { -- remoteTreeFrame.setRootRemote(remoterootDir); -- } -- -- public String getRootURL() { -- return remoteTreeFrame.getBaseUrl(); -- } -- -- public void setDragDetails(GridEvent e, String from) { -- remoteTreeFrame.statusOut("Copying the file ..."); -- fireRemDirEvent(new RemDirEvent(this, RemDirEvent.REMOTEDRAG), null, from, this); -- } -- -- public void setDropDetails(GridEvent e, String to) { -- fireRemDirEvent(new RemDirEvent(this, RemDirEvent.DIR), null, to, this); -- -- } -- -- /*This method sets the selected source directory for transfer*/ -- public void setSelectedSource() { -- remoteTreeFrame.right.setSelectedSource(); -- } -- -- /*This method sets the selected destination directory for transfer*/ -- public void setSelectedDestination() { -- remoteTreeFrame.right.setSelectedDestination(); -- } -- -- /*Please make sure to call the transfer method of the Destination Bean*/ -- public void transfer() { -- remoteTreeFrame.right.transfer(); -- } -- -- public void callGridEditFrame(GridEvent e, String filesep, String seldir[]) { -- /* editFrame = new GridRemEditFrame(this,seldir, filesep); -- editFrame.addWindowListener(new WindowAdapter() { -- --public void windowClosing(WindowEvent windowevent) --{ -- editFrame = null; -- System.gc(); --} -- -- }); -- editFrame.pack(); -- editFrame.setVisible(true); -- */ -- } -- -- -- public void run() { -- -- doConnectOK(); -- -- } -- -- public void actionPerformed(ActionEvent ae) { -- String s = ae.getActionCommand(); -- int i = 0; -- try { -- i = Integer.valueOf(s).intValue(); -- } catch (NumberFormatException numberformatexception) { -- //theApp.toolkit.beep(); -- remoteTreeFrame.statusOut("Action Error: " + numberformatexception.getMessage()); -- } -- //RemRenameDialog RemRenameDialog; -- switch (i) { -- default : -- break; -- -- case 10: // dialog enter the remote details ok button -- Thread connect = new Thread(this); -- connect.start(); -- remoteTreeFrame.statusOut("Connecting ... Please wait"); -- break; -- case 11: // cancel button -- if (!bean) { -- remoteTreeFrame.setConnected(false); -- } -- dlgConnect.dispose(); -- break; -- -- } -- -- } -- -- public static void centerWindow(Window guiComponent) { -- -- //Center the window -- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); -- Dimension frameSize = guiComponent.getSize(); -- -- if (frameSize.height > screenSize.height) { -- frameSize.height = screenSize.height; -- } -- -- if (frameSize.width > screenSize.width) { -- frameSize.width = screenSize.width; -- } -- -- guiComponent.setLocation((screenSize.width - frameSize.width) / 2, -- (screenSize.height - frameSize.height) / 2); -- } -- public static void main(String arg[]){ -- GridClient gridftpPanel = new GridClient(); -- JFrame sFrame = new JFrame("Remote FTP System: "+arg[0]); -- sFrame.getContentPane().setLayout(new GridLayout(1, 1)); -- sFrame.getContentPane().add(gridftpPanel); -- sFrame.pack(); -- sFrame.setSize(300, 400); -- sFrame.setVisible(true); -- UITools.center(null, sFrame); -- gridftpPanel.setHost(arg[0]); -- gridftpPanel.setConnectDetails(true); -- } --} -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTreeFrame.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTreeFrame.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTreeFrame.java (working copy) -@@ -1,986 +0,0 @@ --//RemoteTreeFrame.java which calls the RemoteTree.java --package org.globus.ogce.beans.filetransfer.gui.remote.common; -- --import org.apache.log4j.Logger; --import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; --import org.globus.util.GlobusURL; -- --import javax.swing.*; --import javax.swing.tree.DefaultMutableTreeNode; --import javax.swing.tree.TreePath; --import java.awt.*; --import java.awt.event.ActionEvent; --import java.awt.event.ActionListener; --import java.awt.event.KeyAdapter; --import java.awt.event.KeyEvent; --import java.beans.PropertyChangeListener; --import java.beans.PropertyChangeSupport; --import java.io.File; --import java.net.URL; --import java.util.StringTokenizer; --import java.util.Vector; -- --/** -- * This class renders graphical interface to the remote ftp client -- * It can be used by any class that implements DisplayInterface. -- * -- * @author Beulah Kurian Alunkal -- -- */ --public class RemoteTreeFrame extends JPanel implements ActionListener { -- private static Logger logger = -- Logger.getLogger(RemoteTreeFrame.class.getName()); -- JButton dirInfoButton = null; -- public boolean bean = false; -- -- protected Vector gridlisteners = new Vector(); -- -- /** Register an action listener to be notified when a button is pressed */ -- public void addGridListener(GridListener l) { -- gridlisteners.addElement(l); -- } -- -- /** Remove an Answer listener from our list of interested listeners */ -- public void removeGridListener(GridListener l) { -- gridlisteners.removeElement(l); -- } -- -- /** Send an event to all registered listeners */ -- public void fireGridEvent(GridEvent e, String from, String s1, String s2[]) { -- Vector list = (Vector) gridlisteners.clone(); -- for (int i = 0; i < list.size(); i++) { -- GridListener listener = (GridListener) list.elementAt(i); -- switch (e.getID()) { -- case GridEvent.GRIDDRAG: -- listener.setDragDetails(e, from); -- break; -- case GridEvent.GRIDDROP: -- listener.setDropDetails(e, s1); -- break; -- case GridEvent.GRIDEDIT: -- listener.callGridEditFrame(e, s1, s2); -- break; -- } -- } -- } -- -- public RemoteTreeFrame(DisplayInterface displayInterface, boolean bean) { -- -- this.bean = bean; -- this.displayInterface = displayInterface; -- init(); -- } -- -- public RemoteTreeFrame() { -- init(); -- } -- -- public void init() { -- try { -- url = new GlobusURL("ftp://dummy.edu:0/dev/null"); -- } catch (Exception e) { -- logger.debug("This is a real bad error"); -- } -- host = url.getHost(); -- protocol = url.getProtocol(); -- port = url.getPort(); -- user = "user"; -- pwd = "pass"; -- file = ""; -- rightView = null; -- ServerOpSys = 0; -- connected = false; -- vector = null; -- rootRemote = " "; -- currentdir = " "; -- -- this.FrameId = FrameId; -- -- toolBar = new JToolBar(); -- toolBar.setFloatable(false); -- -- JButton jbutton = createButton("images/16x16/reload.png", -- "Click here to Refresh", -- "4"); -- toolBar.add(jbutton); -- jbutton = createButton("images/16x16/up.png", -- "Click here to go one Directory Up", -- "6"); -- toolBar.add(jbutton); -- dirInfoButton = createButton("images/16x16/view_text.png", -- "Directory Info currently disabled", -- "0"); -- toolBar.add(dirInfoButton); -- -- -- JToggleButton jbutton1 = createToggleButton("images/16x16/folder_home.png", -- "Toggle between root and home directories", -- "2"); -- toolBar.add(jbutton1); -- toolBar.addSeparator(); -- -- -- toolBar.addSeparator(); -- -- -- jbutton = createButton("images/16x16/folder.png", -- "Click here to Create a new Directory", -- "7"); -- toolBar.add(jbutton); -- -- -- jbutton = createButton("images/16x16/folder_rename.png", -- "Click here to Rename a File/Directory", -- "5"); -- -- toolBar.add(jbutton); -- -- deleteButton = createButton("images/16x16/folder_delete.png", -- "Click here to delete a File/Directory", -- "1"); -- toolBar.add(deleteButton); -- -- if (bean) { -- toolBar.addSeparator(); -- toolBar.addSeparator(); -- toolBar.addSeparator(); -- jbutton = createButton("images/16x16/view_text.png", -- "View the status window", -- "8"); -- toolBar.add(jbutton); -- jbutton = createButton("images/16x16/view_msg.png", -- "View the messages window", -- "9"); -- toolBar.add(jbutton); -- } -- -- -- toolBar.addSeparator(); -- toolBar.addSeparator(); -- toolBar.addSeparator(); -- toolBar.addSeparator(); -- disconnect = createButton("images/16x16/folder_delete.png", "Disconnect", "12"); -- disconnect.setEnabled(false); -- toolBar.add(disconnect); -- setBackground(Color.lightGray); -- -- JPanel jpanel = new JPanel(); -- jpanel.setLayout(new BorderLayout()); -- urlField = new JTextField(url.getURL()); -- urlField.addActionListener(this); -- //urlField.setActionCommand("14"); -- urlField.addKeyListener(new KeyAdapter() { -- -- public void keyTyped(KeyEvent keyevent) { -- char c = keyevent.getKeyChar(); -- if (c == '\n') { -- setUrl(urlField.getText()); -- } -- } -- -- }); -- right = new RemoteTree(this, "Remote Tree -> Not connected", rootRemote, displayInterface); -- -- rightView = right.sc_pane; -- jpanel.add(toolBar, "North"); -- jpanel.add(urlField, "South"); -- JPanel jpanel1 = new JPanel(new BorderLayout()); -- statusText = new JLabel(" Status : Remote Window "); -- //jpanel1.add(statusText); -- setLayout(new BorderLayout()); -- add(jpanel, "North"); -- add(rightView, "Center"); -- add(jpanel1, "South"); -- setToolsEn(true); -- right.setDragEnabled(false); -- disconnect.setEnabled(false); -- } -- -- public void addPropertyChangeListener(PropertyChangeListener l) { -- if (pceListeners == null) { -- pceListeners = new PropertyChangeSupport(this); -- } -- pceListeners.addPropertyChangeListener(l); -- } -- -- public void removePropertyChangeListener(PropertyChangeListener l) { -- pceListeners.removePropertyChangeListener(l); -- } -- -- public void getUrlFromField() { -- try { -- urlstring = urlField.getText(); -- } catch (Exception e) { -- error("getURLFromField", "unkown format"); -- logger.info(e); -- } -- } -- -- -- public void setUrl(String newUrl) { -- try { -- GlobusURL oldUrl = url; -- url = new GlobusURL(newUrl); -- logger.info("\nOld url=" + oldUrl); -- logger.info("\nNew url=" + url); -- if ((oldUrl.getHost()).equals(url.getHost())) { -- if(!connected){ -- statusOut("Connecting ... Please wait"); -- _actionConnect(true); -- }else{ -- -- getUrlFromField(); -- filepath = getFile(); -- statusOut("Changed the directory to " + filepath); -- index = filepath.lastIndexOf("/"); -- dirname = filepath.substring(0, index); -- if (dirname != null) { -- if (dirname.indexOf(rootRemote) > 0) { -- _actionChngDir(dirname); -- } -- } -- } -- } else { -- host = url.getHost(); -- port = url.getPort(); -- statusOut("Connecting ... Please wait"); -- pceListeners.firePropertyChange("url", oldUrl.getURL(), newUrl); -- } -- urlField.setText(newUrl); -- } catch (Exception e) { -- JOptionPane.showMessageDialog(this, "Please enter a valid URL."); -- //error("setURL", newUrl); -- } -- -- } -- -- public String getFile() { -- file = url.getPath(); -- return file; -- } -- -- public String getHost() { -- -- return host; -- } -- -- public String getProtocol() { -- -- return protocol; -- } -- -- public String getUrl() { -- return url.getURL(); -- } -- -- public int getPort() { -- -- return port; -- } -- -- public String getUser() { -- return user; -- } -- -- public String getPassword() { -- return pwd; -- } -- -- -- /** -- * Method is used to retrieve the url of the site without file appended -- * -- * @return string which represents the url -- */ -- public String getBaseUrl() { -- GlobusURL tempurl = null; -- if (protocol.equals("ftp")) { -- try { -- tempurl = new GlobusURL(protocol + "://" + user + ":" + pwd + "@" + host + ":" + port + "/"); -- } catch (Exception e) { -- logger.info("exception in globus url formation"); -- } -- -- return tempurl.getURL(); -- } else { -- setDirToFile(""); -- return getUrl(); -- } -- } -- -- -- public void setFrameId(int id) { -- FrameId = id; -- } -- -- public int getFrameId() { -- return FrameId; -- } -- -- /** -- * Method retrieves only the file from the entire url. -- * -- * @return path of the current directory -- */ -- public String getDirFromFile() { -- getUrlFromField(); -- filepath = getFile(); -- index = filepath.lastIndexOf("/"); -- dirname = filepath.substring(0, index) + "/"; -- return dirname; -- } -- -- public void setDirToFile(String dirname) { -- setFile(dirname); -- // getUrlFromField(); -- } -- -- private void message(String s) { -- msg.setText(s); -- } -- -- private void error(String method, String e) { -- message("Error: " + method + " <" + e + ">"); -- } -- -- -- private void parseURL() { -- try { -- host = getHost(); -- } catch (Exception e) { -- error("parseURL, host", url.getURL()); -- } -- try { -- port = getPort(); -- } catch (Exception e) { -- error("parseURL, port", url.getURL()); -- } -- try { -- protocol = getProtocol(); -- } catch (Exception e) { -- error("parseURL, protocol", url.getURL()); -- } -- try { -- file = getFile(); -- } catch (Exception e) { -- error("parseURL, filename", url.getURL()); -- } -- } -- -- private void updateURL() { -- try { -- -- url = new GlobusURL(protocol + "://" + host + ":" + port + "/" + file); -- urlField.setText(url.getURL()); -- } catch (Exception e) { -- error("update : filename", "file");//url.getPath()); -- } -- } -- -- public void setFile(String filename) { -- parseURL(); -- file = filename; -- updateURL(); -- } -- -- public void setHost(String h) { -- parseURL(); -- this.host = h; -- updateURL(); -- } -- -- public void setProtocol(String protocol) { -- parseURL(); -- this.protocol = protocol; -- updateURL(); -- } -- -- public void setUser(String user) { -- parseURL(); -- this.user = user; -- updateURL(); -- } -- -- public void setPassword(String pwd) { -- parseURL(); -- this.pwd = pwd; -- updateURL(); -- } -- -- -- public void setPort(int port) { -- parseURL(); -- this.port = port; -- updateURL(); -- } -- -- public void setServerOpSys(int no) { -- ServerOpSys = no; -- } -- -- public void setConnected(boolean value) { -- connected = value; -- if (value) { -- right.setDragEnabled(true); //do nothing -- disconnect.enable(); -- } else { -- _actionDisconnect(); -- } -- // disconnect.enable(); -- } -- -- public boolean getConnected() { -- return connected; -- } -- -- public void setRootRemote(String r) { -- currentdir = r; -- -- } -- -- -- public void setIsDir(boolean isDir) { -- this.isDir = isDir; -- } -- -- public void _actionConnect(boolean interactive) { -- connected = false; -- statusOut("Connecting ... Please wait"); -- displayInterface.connectRemote(); -- if (!connected) { -- // JOptionPane.showMessageDialog(this, "Please try again."); -- if (interactive) { -- displayInterface.connectDlg(null); -- } else { -- _actionDisconnect(); -- } -- return; -- } -- -- -- remove(rightView); -- updateURL(); -- rootpath = ""; -- -- //rootRemote = "//"; -- userHomeDir = displayInterface.getCurrentDir(); -- rootRemote = userHomeDir; -- -- createRemoteTree(); -- dirInfoButton.setEnabled(false); -- -- } -- -- public void createRemoteTree() { -- right = new RemoteTree(this, "Remote System" + " ->" + host, rootRemote, displayInterface); -- rightView = right.sc_pane; -- if (connected) { -- right.dropTarget.setActive(true); -- } -- add(rightView); -- setToolsEn(true); -- validate(); -- if (rootRemote.equals("//")) { -- rootpath = "//"; -- } else { -- rootpath = getDirFromFile(); -- } -- if (rootpath.length() > 0) { -- if (rootpath.endsWith("/")) { -- rootpath = rootpath.substring(0, rootpath.length() - 1); -- } -- if (!rootRemote.equals("//")) { -- rootpath = rootpath.substring(0, rootpath.lastIndexOf("/")) + "/"; -- } -- -- } else { -- rootpath = "//"; -- } -- statusOut("Successfully connected to " + host + "At root " + rootpath); -- } -- -- public void _actionDisconnect() { -- if(bean){ -- /* rootRemote = ""; -- try { -- url = new GlobusURL("ftp://dummy.edu:0/dev/null"); -- } catch (Exception e) { -- logger.debug("This is a real bad error"); -- } -- urlField.setText(url.getURL()); -- right = new RemoteTree(this, "Remote Tree -> Not connected", rootRemote, displayInterface); -- -- rightView = right.sc_pane; -- add(rightView); */ -- right.tree.removeAll(); -- right.tree.setBackground(Color.lightGray); -- displayInterface.disconnectRemote(false); -- }else{ -- displayInterface.disconnectRemote(true); -- right.tree.removeAll(); -- right.dropTarget.setActive(false); -- remove(rightView); -- setVisible(false); -- System.gc(); -- EventQueue.invokeLater(new Runnable() { -- public void run() { -- urlField.setText("Remote site address bar"); -- } -- -- }); -- } -- disconnect.setEnabled(false); -- if (connected) { -- connected = false; -- }else{ -- return; -- } -- -- } -- -- public void _actionRename() { -- if (connected) { -- String tpath[] = right.returnSelectedFiles(); -- -- if (tpath == null) { -- statusOut("No Selection made"); -- return; -- } else { -- new RemoteRenameDialog(this, tpath[0]); -- return; -- } -- -- } else { -- JOptionPane.showMessageDialog(this, "Remote site is disconnected already"); -- _actionDisconnect(); -- return; -- } -- -- } -- -- -- public DefaultMutableTreeNode seekParent(DefaultMutableTreeNode defaultmutabletreenode, String s) { -- if (defaultmutabletreenode == null) { -- return null; -- } -- -- int i = defaultmutabletreenode.getChildCount(); -- -- for (int j = 0; j < i; j++) { -- javax.swing.tree.TreeNode treenode = defaultmutabletreenode.getChildAt(j); -- String s1 = treenode.toString(); -- if (s.compareTo(s1) == 0) { -- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treenode; -- return defaultmutabletreenode1; -- } -- } -- -- return null; -- } -- -- public void _actionChngDir(String s) { -- if (connected) { -- String s1 = s; -- int l = 0; -- if (rootpath.length() <= 0) { -- l = 0; -- } else { -- l = rootpath.lastIndexOf("/"); -- } -- if (s1.lastIndexOf("/") > l + 1) { -- s1 = s1.substring(l + 1, s1.lastIndexOf("/")); -- StringTokenizer stringtokenizer = new StringTokenizer(s1, "/"); -- Vector vector = new Vector(); -- for (; stringtokenizer.hasMoreTokens(); vector.addElement(stringtokenizer.nextToken() + "/")) { -- logger.info("Appending the file separator"); -- } -- -- clear(); -- //right.makeRemoteInfo(); -- DefaultMutableTreeNode defaultmutabletreenode1 = right.addObject(null, right.RemoteRoot); -- right.addObject(defaultmutabletreenode1, ""); -- right.treeModel.reload(); -- -- DefaultMutableTreeNode defaultmutabletreenode = right.rootNode; -- -- String path = ""; -- int i = vector.size(); -- -- for (int j = 0; j < i; j++) { -- if (flag != false) { -- path = rootpath + (String) vector.elementAt(j); -- flag = false; -- } else { -- path = (String) vector.elementAt(j); -- } -- defaultmutabletreenode = seekParent(defaultmutabletreenode, path); -- -- if (defaultmutabletreenode != null) { -- right.tree.expandPath(new TreePath(defaultmutabletreenode.getPath())); -- } -- -- } -- if (defaultmutabletreenode == null) { -- statusOut("Path not changed "); -- } else { -- statusOut("Changed to " + s + " directory"); -- } -- } else { -- return; -- } -- } else { -- JOptionPane.showMessageDialog(this, "Remote site is disconnected already"); -- _actionDisconnect(); -- } -- -- } -- -- public void _actionRefresh() { -- if (connected) { -- flag = true; -- right.tree.getSelectionModel().clearSelection(); -- String s = getDirFromFile(); -- if (s == null) { -- _actionChngDir(rootRemote); -- } else { -- _actionChngDir(s); -- } -- statusOut("Status: Ready"); -- } else { -- JOptionPane.showMessageDialog(this, "Remote site is disconnected already"); -- _actionDisconnect(); -- } -- -- } -- -- public void _actionGo1DirUp() { -- if (connected) { -- String s = getDirFromFile(); -- if (s == null) { -- return; -- } else { -- if (s.endsWith("/")) { -- s = s.substring(0, s.lastIndexOf("/")); -- } -- StringTokenizer stringtokenizer = new StringTokenizer(s, "/"); -- Vector vector = new Vector(); -- for (; stringtokenizer.hasMoreTokens(); vector.addElement(stringtokenizer.nextToken() + "/")) { -- logger.info("appending separators."); -- } -- int i = vector.size(); -- if (i < 2) { -- clear(); -- -- DefaultMutableTreeNode defaultmutabletreenode = right.addObject(null, right.RemoteRoot); -- right.addObject(defaultmutabletreenode, ""); -- -- right.treeModel.reload(); -- setDirToFile(right.RemoteRoot); -- } else { -- vector.removeElementAt(i - 1); -- i = vector.size(); -- String s1 = new String(); -- for (int j = 0; j < i; j++) { -- s1 = s1.concat(vector.elementAt(j).toString()); -- } -- -- flag = true; -- _actionChngDir("/" + s1); -- } -- -- } -- } else { -- JOptionPane.showMessageDialog(this, "Remote site is disconnected already"); -- _actionDisconnect(); -- } -- -- } -- -- public void whereIsNode(DefaultMutableTreeNode defaultmutabletreenode, int i, String s) { -- seekNode = null; -- for (int j = 0; j < i; j++) { -- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(j); -- if (defaultmutabletreenode1.isLeaf()) { -- continue; -- } -- javax.swing.tree.TreeNode atreenode[] = defaultmutabletreenode1.getPath(); -- TreePath treepath = new TreePath(atreenode); -- String s1 = defaultmutabletreenode1.toString(); -- if (s1.equals(s)) { -- j = i + 1; -- seekNode = defaultmutabletreenode1; -- break; -- } -- if (!right.tree.isExpanded(treepath)) { -- continue; -- } -- if (s1.equals(s)) { -- j = i + 1; -- seekNode = defaultmutabletreenode1; -- break; -- } -- whereIsNode(defaultmutabletreenode1, defaultmutabletreenode1.getChildCount(), s); -- } -- } -- -- public void setError(String errorMsg) { -- this.errorMsg = errorMsg; -- } -- -- public void _actionMakeDir(String s) { -- if (connected) { -- String as[] = right.returnSelectedPaths1(); -- if (as == null || as[0] == null) { -- as = new String[1]; -- as[0] = new String(getDirFromFile()); -- } -- String dirname = null; -- if (s.equals("")) { -- String dirname1 = JOptionPane.showInputDialog("Please Enter the Dir Name:"); -- if (dirname1 != null) { -- dirname = as[0] + dirname1; -- } -- -- } else { -- -- dirname = as[0] + s; -- -- } -- if (dirname != null) { -- -- if (displayInterface.mkdir(dirname)) { -- if (errorMsg.equals("exists")) { -- JOptionPane.showMessageDialog(this, -- "This filename already exists. "); -- return; -- } -- String path = as[0] + s + "/"; -- flag = true; -- _actionChngDir(path); -- whereIsNode(right.rootNode, right.rootNode.getChildCount(), -- "New Folder" + right.RemoteRoot); -- if (seekNode != null) { -- javax.swing.tree.TreeNode atreenode[] -- = right.treeModel.getPathToRoot(seekNode); -- TreePath treepath = new TreePath(atreenode); -- right.tree.scrollPathToVisible(treepath); -- right.tree.setSelectionPath(treepath); -- } -- } else { -- JOptionPane.showMessageDialog(this, -- "Permission Denied."); -- } -- } -- } else { -- JOptionPane.showMessageDialog(this, -- "Remote site is disconnected already"); -- _actionDisconnect(); -- } -- -- } -- -- -- public void actionPerformed(ActionEvent actionevent) { -- String s = actionevent.getActionCommand(); -- int i = 0; -- try { -- i = Integer.valueOf(s).intValue(); -- } catch (NumberFormatException numberformatexception) { -- //theApp.toolkit.beep(); -- statusOut("Action Error: " + numberformatexception.getMessage()); -- } -- //RemRenameDialog RemRenameDialog; -- switch (i) { -- default : -- break; -- case 1: //delete node -- right.removeCurrentNode(); -- break; -- case 2: //shift between home and root -- shiftHomeToRoot(); -- break; -- case 4: // refresh. right now refreshes to show the home dir -- _actionRefresh(); -- break; -- case 5: // rename -- _actionRename(); -- break; -- case 6: // goes to home dir -- _actionGo1DirUp(); -- break; -- case 7: // create new folder -- _actionMakeDir(""); -- break; -- -- case 8: -- FileTransferMainPanel.mainPanel.showStatusWindow(); -- break; -- -- case 9: -- FileTransferMainPanel.mainPanel.showMessagesWindow(); -- break; -- -- case 12: //remote site disconnect -- _actionDisconnect(); -- break; -- case 14: -- getUrlFromField(); -- filepath = getFile(); -- index = filepath.lastIndexOf("/"); -- dirname = filepath.substring(0, index); -- _actionChngDir(dirname); -- break; -- } -- dirInfoButton.setEnabled(false); -- } -- -- public void shiftHomeToRoot() { -- if (!connected) { -- JOptionPane.showMessageDialog(this, -- "Remote host could not be connected."); -- _actionDisconnect(); -- return; -- } -- remove(rightView); -- updateURL(); -- rootpath = ""; -- -- if (home) { -- rootRemote = "//"; -- home = false; -- } else { -- rootRemote = userHomeDir; -- home = true; -- } -- createRemoteTree(); -- JOptionPane.showMessageDialog(this, -- "Changed to new root " + rootRemote); -- } -- -- public void displayRemoteFile() { -- String as[] = right.returnSelectedFiles(); -- if (as == null) { -- // theApp.toolkit.beep(); -- statusOut("noAction"); -- return; -- } -- int i = as.length; -- if (i == 0) { -- // theApp.toolkit.beep(); -- statusOut("noAction"); -- return; -- } else { -- String s = "/"; -- -- fireGridEvent(new GridEvent(this, GridEvent.GRIDEDIT), null, s, as); -- //theApp.createEditFrame(as, ftpClnt, right.Remote_fileSep); -- return; -- } -- } -- -- public JButton createButton(String s, String s1, String s2) { -- ClassLoader classLoader = getClass().getClassLoader(); -- URL jarCogImage = classLoader.getResource(s); -- JButton jbutton = new JButton(new ImageIcon(jarCogImage)); -- jbutton.setActionCommand(s2); -- jbutton.addActionListener(this); -- jbutton.setToolTipText(s1); -- Dimension dimension = new Dimension(20, 20); -- jbutton.setMaximumSize(dimension); -- jbutton.setMinimumSize(dimension); -- jbutton.setPreferredSize(dimension); -- jbutton.setRequestFocusEnabled(false); -- return jbutton; -- } -- -- public JToggleButton createToggleButton(String s, String s1, String s2) { -- ClassLoader classLoader = getClass().getClassLoader(); -- URL jarCogImage = classLoader.getResource(s); -- JToggleButton jbutton = new JToggleButton(new ImageIcon(jarCogImage)); -- jbutton.setActionCommand(s2); -- jbutton.addActionListener(this); -- jbutton.setToolTipText(s1); -- Dimension dimension = new Dimension(20, 20); -- jbutton.setMaximumSize(dimension); -- jbutton.setMinimumSize(dimension); -- jbutton.setPreferredSize(dimension); -- jbutton.setRequestFocusEnabled(false); -- return jbutton; -- } -- -- public synchronized void statusOut(String s) { -- //statusText.setText(s); -- } -- -- public void setToolsEn(boolean flag) { -- for (int i = 0; i <= 60; i++) { -- Component component = toolBar.getComponentAtIndex(i); -- if (component == null) { -- break; -- } -- component.setEnabled(flag); -- } -- } -- -- -- public void clear() { -- right.rootNode.removeAllChildren(); -- right.treeModel.reload(); -- } -- -- -- public void setFilesFromRemDir(File f[]) { -- files = f; -- } -- -- public void setRemFlag(boolean b) { -- remflag = b; -- } -- -- public void enableDeleteButton(boolean flag) { -- deleteButton.setEnabled(flag); -- } -- -- private JButton deleteButton = null; -- private JTextField urlField; -- private JLabel msg; -- private GlobusURL url; -- -- private String protocol; -- private String host; -- private int port; -- private String user; -- private String file; -- private String pwd; -- private PropertyChangeSupport pceListeners; -- -- protected String rootRemote = null; -- private String userHomeDir = null; -- protected String currentdir; -- public boolean isDir = false; -- public File[] files = null; -- public boolean remflag = false; -- -- public DisplayInterface displayInterface = null; -- protected JScrollPane rightView; -- protected JButton disconnect = null; -- protected DefaultMutableTreeNode seekNode; -- public int FrameId; -- -- public JLabel statusText; -- public RemoteTree right; -- public int ServerOpSys; -- public boolean connected; -- public boolean flag = true; -- public String rootpath; -- public JToolBar toolBar; -- //variables used frequently -- String filepath; -- int index; -- String dirname; -- Vector vector; -- public String RemoteFileSep = "/"; -- boolean home = true; -- String urlstring = null; -- String errorMsg = "No errors"; --} -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTree.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTree.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/gui/remote/common/RemoteTree.java (working copy) -@@ -1,1055 +0,0 @@ --//RemoteTree.java displays the remote tree structure d the remote files --package org.globus.ogce.beans.filetransfer.gui.remote.common; -- -- --import org.apache.log4j.Logger; --import org.globus.ftp.FileInfo; --import org.globus.ftp.MlsxEntry; --import org.globus.ogce.beans.filetransfer.util.DirInfo; --import org.globus.ogce.beans.filetransfer.util.DirQueue; --import org.globus.ogce.beans.filetransfer.util.GridTransferable; --import org.globus.ogce.beans.filetransfer.util.SortVectorStrings; --import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; -- --import javax.swing.*; --import javax.swing.event.*; --import javax.swing.tree.DefaultMutableTreeNode; --import javax.swing.tree.DefaultTreeModel; --import javax.swing.tree.MutableTreeNode; --import javax.swing.tree.TreePath; --import java.awt.*; --import java.awt.dnd.*; --import java.awt.event.MouseAdapter; --import java.awt.event.MouseEvent; --import java.io.IOException; --import java.util.*; --import java.util.List; -- --/** -- * This class implements the tree and drag and drop listeners -- * -- * @author Beulah Kurian Alunkal -- * @version 1.0 -- */ --public class RemoteTree extends JTree implements TreeExpansionListener, TreeWillExpandListener, DragSourceListener, DragGestureListener, java.awt.dnd.DropTargetListener { -- private static Logger logger = -- Logger.getLogger(RemoteTree.class.getName()); -- -- protected DefaultTreeModel treeModel; -- boolean dirflag; -- private TreeSet InfoVec; -- public String rootName; -- private Object draggedValues[]; -- public DropTarget dropTarget; -- -- public RemoteTreeFrame theApp; -- public JScrollPane sc_pane = null; -- public JTree tree; -- public String RemoteRoot; -- public String selectedPath; -- public Vector RemVector; -- -- public DefaultMutableTreeNode rootNode; -- public DefaultMutableTreeNode lastExp; -- public Toolkit toolkit; -- public boolean pathView; -- public Vector vector; -- public Vector vector1; -- -- public long firstClickTime = 0; -- private boolean noselection = true; -- TreePath destinationPath; -- protected TreePath SelectedTreePath = null; -- protected TreePath dragtreepath = null; -- private DirQueue queue; -- -- private DisplayInterface displayInterface = null; -- private boolean dragEnable = true; -- String deleteFile = null; -- boolean deleteFlag = true; -- DefaultMutableTreeNode defaultmutabletreenode = null; -- MutableTreeNode mutabletreenode = null; -- String selectedDestination = ""; -- -- -- public RemoteTree(RemoteTreeFrame RemoteTreeframe, String s, String remoteRoot, DisplayInterface displayInterface) { -- -- InfoVec = new TreeSet(); -- selectedPath = new String(); -- RemVector = null; -- toolkit = Toolkit.getDefaultToolkit(); -- theApp = RemoteTreeframe; -- rootName = s; -- if (theApp.connected) { -- RemoteRoot = remoteRoot; -- } else { -- RemoteRoot = new String(); -- } -- makeRemoteInfo(); -- queue = new DirQueue(); -- this.displayInterface = displayInterface; -- } -- -- public void makeRemoteInfo() { -- rootNode = new DefaultMutableTreeNode(rootName); -- treeModel = new DefaultTreeModel(rootNode); -- treeModel.addTreeModelListener(new RemTreeModelListener()); -- RemoteRoot = theApp.rootRemote + "/"; -- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(null, RemoteRoot); -- addObject(defaultmutabletreenode1, ""); -- //makeDirInfo(RemoteRoot); -- if (theApp.connected) { -- theApp.setDirToFile(RemoteRoot); -- } -- tree = new JTree(treeModel); -- dropTarget = new DropTarget(tree, this); -- dropTarget.setActive(true); -- tree.setEditable(false); -- tree.getSelectionModel().setSelectionMode(4); -- sc_pane = new JScrollPane(tree); -- tree.addTreeWillExpandListener(this); -- tree.addMouseListener(new MyAdapter()); // for double clicking -- ToolTipManager.sharedInstance().registerComponent(tree); -- RemRenderer remrenderer = new RemRenderer(theApp); -- tree.setCellRenderer(remrenderer); -- tree.putClientProperty("JTree.lineStyle", "Angled"); -- tree.addTreeSelectionListener(new TreeSelectionListener() { -- public void valueChanged(TreeSelectionEvent treeselectionevent) { -- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); -- if (defaultmutabletreenode == null) { -- return; -- } else { -- javax.swing.tree.TreeNode atreenode[] = null; -- atreenode = defaultmutabletreenode.getPath(); -- selectedPath = returnPath(atreenode); -- SelectedTreePath = treeselectionevent.getNewLeadSelectionPath(); -- return; -- } -- } -- }); -- DragSource dragsource = DragSource.getDefaultDragSource(); -- dragsource.createDefaultDragGestureRecognizer(tree, 3, this); -- } -- -- public void getLastExpandeNode(DefaultMutableTreeNode defaultmutabletreenode, TreePath treepath) { -- int i = defaultmutabletreenode.getChildCount(); -- for (int j = 0; j < i; j++) { -- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(j); -- if (!defaultmutabletreenode1.isLeaf()) { -- javax.swing.tree.TreeNode atreenode[] = defaultmutabletreenode1.getPath(); -- TreePath treepath1 = new TreePath(atreenode); -- if (!treepath1.equals(treepath) && tree.isExpanded(treepath1)) { -- lastExp = defaultmutabletreenode1; -- getLastExpandeNode(defaultmutabletreenode1, treepath); -- } -- } -- } -- } -- -- public String returnPath(Object aobj[]) { -- int i = aobj.length; -- String s = new String(); -- for (int j = 1; j < i; j++) { -- s = s.concat(aobj[j].toString()); -- } -- return s; -- } -- -- public void createNodes(DefaultMutableTreeNode defaultmutabletreenode, boolean flag, String s) { -- if (flag) { -- DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(s); -- defaultmutabletreenode.add(defaultmutabletreenode1); -- DefaultMutableTreeNode defaultmutabletreenode2 = new DefaultMutableTreeNode(""); -- defaultmutabletreenode1.add(defaultmutabletreenode2); -- } else { -- DefaultMutableTreeNode defaultmutabletreenode3 = new DefaultMutableTreeNode(s); -- defaultmutabletreenode.add(defaultmutabletreenode3); -- } -- } -- -- public DefaultMutableTreeNode addObject(Object obj) { -- DefaultMutableTreeNode defaultmutabletreenode = null; -- TreePath treepath = tree.getSelectionPath(); -- if (treepath == null) { -- toolkit.beep(); -- return null; -- } -- defaultmutabletreenode = (DefaultMutableTreeNode) treepath.getLastPathComponent(); -- if (defaultmutabletreenode == rootNode) { -- toolkit.beep(); -- return null; -- } else { -- return addObject(defaultmutabletreenode, obj, true); -- } -- } -- -- public DefaultMutableTreeNode addObject(DefaultMutableTreeNode defaultmutabletreenode, Object obj) { -- return addObject(defaultmutabletreenode, obj, false); -- } -- -- public DefaultMutableTreeNode addObject(DefaultMutableTreeNode defaultmutabletreenode, Object obj, boolean flag) { -- DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(obj); -- if (defaultmutabletreenode == null) { -- defaultmutabletreenode = rootNode; -- } -- treeModel.insertNodeInto(defaultmutabletreenode1, defaultmutabletreenode, defaultmutabletreenode.getChildCount()); -- if (flag) { -- tree.scrollPathToVisible(new TreePath(defaultmutabletreenode1.getPath())); -- } -- return defaultmutabletreenode1; -- } -- -- public void statusOut(String msg) { -- //theApp.statusOut(msg); -- } -- -- public void removeCurrentNode() { -- int i = tree.getSelectionModel().getSelectionCount(); -- if (i == 0) { -- toolkit.beep(); -- statusOut("Nothing was selected"); -- statusOut("Status : Ready "); -- return; -- } -- for (int j = 0; j < i; j++) { -- TreePath treepath = tree.getSelectionPath(); -- if (treepath != null) { -- -- defaultmutabletreenode = (DefaultMutableTreeNode) treepath.getLastPathComponent(); -- mutabletreenode = (MutableTreeNode) defaultmutabletreenode.getParent(); -- javax.swing.tree.TreeNode atreenode[] = null; -- atreenode = defaultmutabletreenode.getPath(); -- deleteFile = returnPath(atreenode); -- String msg = null; -- if (mutabletreenode != null) { -- if (deleteFile.endsWith("/")) { -- msg = "Directory"; -- } else { -- msg = "File"; -- } -- Object aobj[] = {"Cancel", "Delete"}; -- int k = JOptionPane.showOptionDialog(theApp, "Do you really want to delete this " + msg + " ?", "Delete Alert", -1, 2, null, aobj, aobj[0]); -- if (k != 0) { -- -- if (deleteFile.endsWith("/")) { -- dirDelete(); -- -- -- } else { -- deleteFlag = displayInterface.removeFile(deleteFile); -- -- if (deleteFlag) { -- treeModel.removeNodeFromParent(defaultmutabletreenode); -- if (treeModel.getChildCount(mutabletreenode) == 0) { -- addObject((DefaultMutableTreeNode) mutabletreenode, ""); -- } -- statusOut("Successfully deleted :" + deleteFile); -- } else { -- JOptionPane.showMessageDialog(this, msg + " : Permission Denied."); -- } -- -- statusOut("Status : Ready "); -- } -- } -- } -- } else { -- toolkit.beep(); -- statusOut("No selection was made"); -- statusOut("Status : Ready "); -- } -- } -- } // end of removecurrentNode -- -- public void dirDelete() { -- Thread dirDelete = new Thread() { -- public void run() { -- theApp.enableDeleteButton(false); -- setDragEnabled(false); -- deleteFlag = deleteDir(deleteFile); -- if (deleteFlag) { -- treeModel.removeNodeFromParent(defaultmutabletreenode); -- if (treeModel.getChildCount(mutabletreenode) == 0) { -- addObject((DefaultMutableTreeNode) mutabletreenode -- , ""); -- } -- theApp._actionRefresh(); -- statusOut("Successfully deleted: " + deleteFile); -- } else { -- JOptionPane.showMessageDialog(theApp, deleteFile + -- " : Permission Denied."); -- } -- theApp.enableDeleteButton(true); -- setDragEnabled(true); -- } -- }; -- dirDelete.start(); -- statusOut("Status : Ready "); -- } -- -- public boolean deleteDir(String dirname) { -- if (!theApp.connected) { -- JOptionPane.showMessageDialog(this, "Connection got disconnected"); -- theApp._actionDisconnect(); -- return false; -- } else { -- Vector vector = displayInterface.listDeleteDir(dirname); -- if (vector == null) { -- logger.info("\nThis is an empty directory."); -- } else { -- FileInfo temp[] = new FileInfo[vector.size()]; -- int p = 0; -- Enumeration enum1 = vector.elements(); -- while (enum1.hasMoreElements()) { -- FileInfo file = (FileInfo) enum1.nextElement(); -- temp[p] = file; -- p++; -- } -- -- -- for (int i = 0; i < temp.length; i++) { -- FileInfo current = temp[i]; -- String currentFullpath = dirname + "/" + current.getName(); -- if (current.isDirectory()) { -- -- // statusOut( "Deleting the files in directory : " + currentFullpath); -- deleteDir(currentFullpath); -- -- } else { -- displayInterface.removeFile(currentFullpath); -- logger.info("\nDeleting: " + currentFullpath); -- statusOut("\nDeleting: " + current.getName()); -- } -- } -- -- -- } -- boolean flag = displayInterface.removeDir(dirname); -- if (flag) { -- logger.info("\nDeleted the directory " + dirname); -- -- } -- return flag; -- } -- } -- -- public void doServList(String s) { -- Vector vector = null; -- if (!theApp.connected) { -- JOptionPane.showMessageDialog(this, "Connection got disconnected"); -- theApp._actionDisconnect(); -- return; -- } -- displayInterface.setType(true); -- vector = displayInterface.listDir(s); -- -- if (RemVector != null) { -- RemVector.clear(); -- } -- RemVector = (Vector) vector.clone(); -- InfoVec.addAll(vector); -- pathView = true; -- } // end of doServList -- -- public Vector ReturnInfoVec() { -- return RemVector; -- } -- -- -- public DefaultMutableTreeNode seekParent(DefaultMutableTreeNode defaultmutabletreenode, String s) { -- if (defaultmutabletreenode == null || s.compareTo(RemoteRoot) == 0) { -- return null; -- } -- int i = defaultmutabletreenode.getChildCount(); -- String s1 = s.substring(s.indexOf("/") + 1); -- for (int j = 0; j < i; j++) { -- javax.swing.tree.TreeNode treenode = defaultmutabletreenode.getChildAt(j); -- String s2 = treenode.toString(); -- if (s1.compareTo(s2) == 0) { -- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treenode; -- return defaultmutabletreenode1; -- } -- } -- return null; -- } -- -- public String[] returnSelectedPaths1() { -- TreePath atreepath[] = tree.getSelectionModel().getSelectionPaths(); -- String s = null; -- String as[] = null; -- if (atreepath != null) { -- int i = atreepath.length; -- as = new String[i]; -- for (int j = 0; j < i; j++) { -- Object aobj[] = atreepath[j].getPath(); -- int k = aobj.length; -- for (int l = 1; l < k; l++) { -- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) aobj[l]; -- if (!defaultmutabletreenode.isLeaf()) { -- if (l == 1) { -- s = new String("/"); -- } -- s = s.concat(aobj[l].toString()); -- } -- } -- if (s != null) { -- as[j] = new String(s); -- } -- } -- } -- return as; -- } -- -- public TreePath[] returnSelectedPaths() { -- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); -- TreePath atreepath[] = null; -- if (defaultmutabletreenode == null) { -- return atreepath; -- } -- if (defaultmutabletreenode.isLeaf()) { -- atreepath = tree.getSelectionModel().getSelectionPaths(); -- return atreepath; -- } else { -- TreePath atreepath1[] = tree.getSelectionPaths(); -- return atreepath1; -- } -- } -- -- public String[] returnSelectedFiles() { -- TreePath atreepath[] = returnSelectedPaths(); -- String as[] = null; -- if (atreepath != null) { -- int i = atreepath.length; -- as = new String[i]; -- for (int j = 0; j < i; j++) { -- Object aobj[] = atreepath[j].getPath(); -- int k = aobj.length; -- String s = new String(""); -- for (int l = 1; l < k; l++) { -- s = s.concat(aobj[l].toString()); -- } -- as[j] = new String(s); -- } -- } -- return as; -- } -- -- public void makeDirInfo(String s) //DefaultMutableTreeNode defaultmutabletreenode, String s) -- { -- vector = new Vector(); -- vector1 = new Vector(); -- if (theApp.getConnected() == false) { -- return; -- } -- doServList(s); -- if (RemVector.size() == 0) { -- // DefaultMutableTreeNode defaultmutabletreenode1 = new DefaultMutableTreeNode(""); -- //defaultmutabletreenode.add(defaultmutabletreenode1); -- return; -- } -- for (int i = 0; i < RemVector.size(); i++) { -- //The tokenizer uses the default delimiter set, which is "\t\n\r": -- StringTokenizer stringtokenizer = new StringTokenizer((String) RemVector.elementAt(i)); -- int j = stringtokenizer.countTokens(); -- String s1 = new String(); -- int i1 = 0; -- if (theApp.ServerOpSys == 2) { -- for (int j1 = 1; j1 <= j; j1++) { -- if (j1 <= 3) { -- stringtokenizer.nextToken(); -- } -- if (j1 == 4) { -- s1 = stringtokenizer.nextToken(); -- } -- if (j1 > 4) { -- s1 = s1 + " " + stringtokenizer.nextToken(); -- } -- } -- i1 = ((String) RemVector.elementAt(i)).lastIndexOf("

"); -- } else { -- for (int k1 = 1; k1 <= j; k1++) { -- if (k1 <= 8) { -- stringtokenizer.nextToken(); -- } -- if (k1 == 9) { -- s1 = stringtokenizer.nextToken(); -- } -- if (k1 > 9) { -- s1 = s1 + " " + stringtokenizer.nextToken(); -- } -- } -- } -- if (((String) RemVector.elementAt(i)).charAt(0) == 'd' || i1 > 0) { -- if (s1.compareTo(".") != 0 && s1.compareTo("..") != 0) { -- vector.addElement(s1 + "/"); -- } -- } else if (((String) RemVector.elementAt(i)).charAt(0) != 'l' && !(((String) RemVector.elementAt(i)).startsWith("total"))) //startsWith("total")) -- { -- vector1.addElement(s1); -- } -- } -- SortVectorStrings.startSort(vector); -- SortVectorStrings.startSort(vector1); -- } -- -- public void treeWillExpand(TreeExpansionEvent treeexpansionevent) { -- logger.info("\nenter the tree will expand."); -- if (!theApp.connected) { -- JOptionPane.showMessageDialog(this, "Connection got disconnected"); -- theApp._actionDisconnect(); -- return; -- } -- DefaultMutableTreeNode defaultmutabletreenode = null; -- Object aobj[] = null; -- aobj = treeexpansionevent.getPath().getPath(); -- int i = aobj.length; -- defaultmutabletreenode = (DefaultMutableTreeNode) aobj[i - 1]; -- if (defaultmutabletreenode == rootNode) { -- return; -- } else { -- DefaultMutableTreeNode defaultmutabletreenode1 = (DefaultMutableTreeNode) treeModel.getChild(aobj[i - 1], 0); -- treeModel.removeNodeFromParent(defaultmutabletreenode1); -- String s1 = returnPath(aobj); -- statusOut("Please wait..Expanding dir " + s1); -- listDir(defaultmutabletreenode, s1, false); -- if (!theApp.connected) { -- JOptionPane.showMessageDialog(null, "Connection got disconnected"); -- theApp._actionDisconnect(); -- statusOut("Application disconnected."); -- return; -- } else { -- -- theApp.setDirToFile(s1); -- noselection = false; -- tree.getSelectionModel().clearSelection(); -- statusOut("Status: Ready"); -- return; -- } -- } -- } -- -- public void listDir(DefaultMutableTreeNode defaultmutabletreenode, String s, boolean flag) { -- -- logger.info("\nEntered the listdir function."); -- FileInfo file2,file1; -- if (!theApp.connected) { -- JOptionPane.showMessageDialog(this, "Connection got disconnected"); -- theApp._actionDisconnect(); -- return; -- } -- -- vector = null; -- vector = displayInterface.listDir(s); -- logger.info("\nGot the list."); -- -- if (vector == null) { -- logger.info("\nThe vector is null.Using the Parameterized LIST Aand Customized Parser"); -- -- vector = displayInterface.listAllDir(s); -- statusOut("Parsing failed. Using new Parser"); -- -- FileParser parser = new FileParser(); -- vector = parser.parse(vector, "unix", "/"); -- -- -- /* if (vector == null){ -- JOptionPane.showMessageDialog(null,"Connection reset. Please try connecting again."); -- theApp._actionDisconnect(); -- return ; -- }*/ -- -- } -- //FileInfo temp[] = new FileInfo[vector.size()]; -- MlsxEntry temp[] = new MlsxEntry[vector.size()]; -- String as[] = new String[vector.size()]; -- int p = 0; -- Enumeration enum1 = vector.elements(); -- while (enum1.hasMoreElements()) { -- MlsxEntry entry = (MlsxEntry) enum1.nextElement(); -- if (null != entry) { -- as[p] = entry.getFileName(); -- temp[p] = entry; -- p++; -- } -- //System.out.println(entry); -- -- } -- -- if (as == null) { -- return; -- } -- int i = as.length; -- //SortFtpString.startSort(as); -- if ((i == 0) || (as[0] == null)) { -- addObject(defaultmutabletreenode, "", false); -- return; -- } -- statusOut("Listing the directories..."); -- String fullName = null; -- for (int j = 0; j < i; j++) { -- if (s.endsWith("/")) { -- fullName = s + as[j]; -- //temp[j].setName(s + as[j]); -- } else { -- fullName = s + "/" + as[j]; -- //temp[j].setName(s + "/" + as[j]); -- } -- //file1 = (FileInfo) temp[j]; -- -- if ("dir".equals(temp[j].get("type"))) { -- -- if (temp[j].get("unix.slink") != null) { -- ; -- } else { -- --// if ((file1.getName().equals("//dev")) || --// (file1.isDevice())) { --// logger.info("\nIt is a device directory"); --// addObject(defaultmutabletreenode, as[j], flag); --// statusOut("Disabled the device directory" + file1.getName()); --// --// } else if ((file1.getName().equals("?"))) { --// logger.info("\nDir name could not be parsed"); --// statusOut("The Parser could not parse filename"); --// --// } else { -- //System.out.println(as[j]); -- DefaultMutableTreeNode defaultmutabletreenode1 -- = addObject(defaultmutabletreenode, as[j] + "/", flag); -- addObject(defaultmutabletreenode1, "", false); -- //} -- } -- } -- } -- statusOut("Listing the files..."); -- -- for (int k = 0; k < i; k++) { -- if (s.endsWith("/")) { -- fullName = s + as[k]; -- //temp[k].setName(s + as[k]); -- } else { -- fullName = s + "/" + as[k]; -- //temp[k].setName(s + "/" + as[k]); -- } -- //file2 = temp[k]; -- -- if ("file".equals(temp[k].get("type"))) { -- if (temp[k].get("unix.slink") != null) { -- logger.info("\nThis is a softlink."); --// } else if ((file2.getName().equals("?"))) { --// logger.info("\nFile name could not be parsed"); --// statusOut("The Parser could not parse file"); --// -- } else { -- addObject(defaultmutabletreenode, as[k], flag); -- statusOut("Done. Status: Ready"); -- } -- -- } -- -- } -- -- -- } -- /* Alternate parsing method -- -- }catch(Exception e){ -- logger.info("The vector is returned as Strings "); -- String buffer[] = new String[vector.size()]; -- while (enum.hasMoreElements()) { -- String sbuffer = (String)enum.nextElement(); -- StringTokenizer stringtokenizer = new StringTokenizer(sbuffer); -- int m = stringtokenizer.countTokens(); -- String s1 = new String(); -- int i1 = 0; -- for(int k1 = 1; k1 <= m; k1++) -- { -- if(k1 <= 8) -- stringtokenizer.nextToken(); -- if(k1 == 9) -- s1 = stringtokenizer.nextToken(); -- if(k1 > 9) -- s1 = s1 + " " + stringtokenizer.nextToken(); -- } -- as[p] = s1; -- buffer[p] = sbuffer; -- p ++ ; -- } -- -- if (as == null) -- return ; -- int i = as.length; -- if (i == 0) { -- addObject(defaultmutabletreenode,"",false); -- return ; -- } -- -- for (int j = 0; j < i; j ++ ) { -- -- -- if (s.endsWith("/")){ -- as[j] = s+as[j]; -- } -- else{ -- if(buffer[i].charAt(0) == 'd' ){ -- if(as[j].compareTo (".") != 0 && as[j].compareTo("..") != 0){ -- DefaultMutableTreeNode defaultmutabletreenode1 = addObject(defaultmutabletreenode,as[j] -- +"/",flag); -- addObject(defaultmutabletreenode1,"",false); -- } -- } -- } -- } -- for (int k = 0; k < i; k ++ ) { -- if(buffer[i].charAt(0) == 'd' ){ -- addObject(defaultmutabletreenode,as[k],flag); -- } -- -- } -- }*/ -- -- -- -- public void treeWillCollapse(TreeExpansionEvent treeexpansionevent) { -- DefaultMutableTreeNode defaultmutabletreenode = null; -- tree.getSelectionModel().clearSelection(); -- Object aobj[] = null; -- aobj = treeexpansionevent.getPath().getPath(); -- int i = aobj.length; -- if (i > 1) { -- defaultmutabletreenode = (DefaultMutableTreeNode) aobj[i - 1]; -- } else { -- defaultmutabletreenode = rootNode; -- } -- if (defaultmutabletreenode == rootNode) { -- // txtField.setText("Local Path "); -- noselection = true; -- treeModel.reload(defaultmutabletreenode); -- return; -- } -- noselection = false; -- defaultmutabletreenode.removeAllChildren(); -- addObject(defaultmutabletreenode, ""); -- aobj = ((DefaultMutableTreeNode) defaultmutabletreenode.getParent()).getPath(); -- lastExp = null; -- getLastExpandeNode(rootNode, treeexpansionevent.getPath()); -- if (lastExp != null) { -- javax.swing.tree.TreeNode atreenode[] = treeModel.getPathToRoot(lastExp); -- TreePath treepath = new TreePath(atreenode); -- Object aobj1[] = treepath.getPath(); -- String s1 = returnPath(aobj1); -- theApp.setDirToFile(s1); -- } else { -- //txtField.setText("Local Path "); -- noselection = true; -- } -- treeModel.reload(defaultmutabletreenode); -- } -- -- public void buildirStructure(DefaultMutableTreeNode defaultmutabletreenode) { -- for (int k = 0; k < vector.size(); k++) { -- createNodes(defaultmutabletreenode, true, vector.elementAt(k).toString()); -- } -- if (vector1.size() == 0) { -- //createNodes(defaultmutabletreenode, false, ""); -- return; -- } else { -- for (int l = 0; l < vector1.size(); l++) { -- //JOptionPane.showMessageDialog(null, vector1.elementAt(l)); -- createNodes(defaultmutabletreenode, false, vector1.elementAt(l).toString()); -- } -- } -- } -- -- public void treeExpanded(TreeExpansionEvent treeexpansionevent) { -- } -- -- public void treeCollapsed(TreeExpansionEvent treeexpansionevent) { -- } -- -- -- public void transferfile(String startdir, String currdir, String fullpath) { -- -- final DirInfo dirInfo = new DirInfo(fullpath, startdir, currdir); -- queue.put(dirInfo); -- return; -- -- } -- -- public void dragGestureRecognized(DragGestureEvent draggestureevent) { -- if (!theApp.connected) { -- return; -- } -- TreePath treepath[] = null; -- Object aobj1[] = null; -- String fullpath = ""; -- -- try { -- treepath = returnSelectedPaths(); -- dragtreepath = SelectedTreePath; -- aobj1 = treepath[0].getPath(); -- fullpath = returnPath(aobj1); -- logger.info("\nfull path=" + fullpath); -- -- } catch (NullPointerException e) { -- logger.info("Drag Recognized failed."); -- } -- -- -- if (treepath == null || aobj1 == null || dragtreepath == null || fullpath == null) { -- return; -- } else if (!(dragEnable)) { -- JOptionPane.showMessageDialog(this, "Please wait till the status\n bar shows drag enabled."); -- return; -- } else { -- draggedValues = returnSelectedFiles(); -- GridTransferable Gridtransferable = new GridTransferable(draggedValues); -- draggestureevent.startDrag(DragSource.DefaultCopyDrop, Gridtransferable, this); -- String tempto[] = {""}; -- queue.deleteAll(); -- statusOut("Copying the file ..."); -- String startdir = draggedValues[0].toString(); -- logger.info("\nfull path =" + fullpath); -- theApp.fireGridEvent(new GridEvent(theApp, GridEvent.GRIDDRAG), startdir, "", tempto); -- theApp.setDirToFile(fullpath.substring(0, -- fullpath.lastIndexOf("/")) + "/"); -- -- } -- } -- -- public void setDragEnabled(boolean flag) { -- dragEnable = flag; -- if (flag) { -- -- tree.setBackground(Color.white); -- statusOut("Successfully done dragging."); -- statusOut("Status : Ready "); -- } else { -- tree.setBackground(Color.lightGray); -- statusOut("Current window disabled. Please wait ... till" + -- " the color changes back to white."); -- -- } -- -- } -- -- public void dragEnter(DragSourceDragEvent dragsourcedragevent) { -- } -- -- public void dragOver(DragSourceDragEvent dragsourcedragevent) { -- } -- -- public void dragExit(DragSourceEvent dragsourceevent) { -- } -- -- public void dropActionChanged(DragSourceDragEvent dragsourcedragevent) { -- } -- -- public void dragDropEnd(DragSourceDropEvent dragsourcedropevent) { -- if (dragsourcedropevent.getDropSuccess()) { -- int i = dragsourcedropevent.getDropAction(); -- logger.info("value of i:" + i); -- } -- } -- -- -- public void dragEnter(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { --// int i = droptargetdragevent.getDropAction(); --// if ((i & 1) != 0) { --// statusOut("Copying"); --// } --// if ((i & 2) != 0) { --// statusOut("Moving"); --// } --// if ((i & 1073741824) != 0) { --// statusOut("Linking"); --// } --// if (!isDragAcceptable(droptargetdragevent)) { --// droptargetdragevent.rejectDrag(); --// return; --// } else { --// return; --// } -- } -- -- public void dragExit(java.awt.dnd.DropTargetEvent droptargetevent) { -- } -- -- public void dragOver(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { -- //set cursor location. Needed in setCursor method -- Point cursorLocationBis = droptargetdragevent.getLocation(); -- TreePath dPath = tree.getPathForLocation(cursorLocationBis.x, cursorLocationBis.y); -- tree.setSelectionPath(dPath); -- } -- -- public void dropActionChanged(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { -- if (!isDragAcceptable(droptargetdragevent)) { -- droptargetdragevent.rejectDrag(); -- return; -- } else { -- return; -- } -- } -- -- public void drop(java.awt.dnd.DropTargetDropEvent droptargetdropevent) { -- if (!isDropAcceptable(droptargetdropevent)) { -- droptargetdropevent.rejectDrop(); -- return; -- } else if (!(dragEnable)) { -- return; -- } -- Point loc = droptargetdropevent.getLocation(); -- destinationPath = tree.getPathForLocation(loc.x, loc.y); -- final String msg = testDropTarget(destinationPath, dragtreepath); -- if (msg != null) { -- SwingUtilities.invokeLater(new Runnable() { -- -- public void run() { -- JOptionPane.showMessageDialog(theApp, msg, "Error Dialog", JOptionPane.ERROR_MESSAGE); -- } -- }); -- return; -- } -- droptargetdropevent.acceptDrop(1); -- java.awt.datatransfer.Transferable transferable = droptargetdropevent.getTransferable(); -- java.awt.datatransfer.DataFlavor adataflavor[] = transferable.getTransferDataFlavors(); -- for (int i = 0; i < adataflavor.length; i++) { -- java.awt.datatransfer.DataFlavor dataflavor = adataflavor[i]; -- try { -- if (dataflavor.equals(java.awt.datatransfer.DataFlavor.javaFileListFlavor)) { -- List list = (List) transferable.getTransferData(dataflavor); -- Iterator iterator = list.iterator(); -- Vector vector = new Vector(); -- String s; -- for (; iterator.hasNext(); vector.add(s)) { -- s = iterator.next().toString(); -- } -- doCopyAction(vector); -- //droptargetdropevent.rejectDrop(); -- } -- } catch (java.awt.datatransfer.UnsupportedFlavorException unsupportedflavorexception) { -- logger.debug("Exception _ufe = " + unsupportedflavorexception.toString()); -- } catch (IOException ioexception) { -- logger.debug("Exception _ioe = " + ioexception.toString()); -- } -- } -- droptargetdropevent.dropComplete(true); -- } -- -- private String testDropTarget(TreePath destination, TreePath dropper) { -- //Typical Tests for dropping -- //Test 1. -- boolean destinationPathIsNull = destination == null; -- if (destinationPathIsNull) { -- return "Invalid drop location."; -- } -- if (destination.equals(dropper)) { -- logger.info("\nDestination =" + destination + -- "\nSource= " + dropper); -- theApp._actionRefresh(); -- return "Destination cannot be same as source"; -- } -- return null; -- } -- -- public boolean isDragAcceptable(java.awt.dnd.DropTargetDragEvent droptargetdragevent) { -- return (droptargetdragevent.getDropAction() & 3) != 0; -- } -- -- public boolean isDropAcceptable(java.awt.dnd.DropTargetDropEvent droptargetdropevent) { -- return (droptargetdropevent.getDropAction() & 3) != 0; -- } -- -- -- public void doCopyAction(Vector vector) { -- -- int i = vector.size(); -- String as[] = returnSelectedPaths1(); -- if (as == null || as[0] == null) { -- as = new String[1]; -- as[0] = new String(theApp.getDirFromFile()); -- } -- String as1 = ""; -- for (int j = 0; j < i; j++) { -- as1 = (String) vector.elementAt(j); -- } // end of for loop -- // dragtreepath = as1; -- -- String temp[] = {""}; -- if(theApp.bean){ -- FileTransferMainPanel.mainPanel.showStatusWindow(); -- FileTransferMainPanel.mainPanel.showMessagesWindow(); -- } -- theApp.fireGridEvent(new GridEvent(theApp, GridEvent.GRIDDROP), null, as[0], temp); -- theApp.setDirToFile(as[0]); -- -- return; -- } // end of doCopyAction -- -- public void setSelectedSource() { -- draggedValues = returnSelectedFiles(); -- String tempto[] = {""}; -- String startdir = draggedValues[0].toString(); -- theApp.fireGridEvent(new GridEvent(theApp, GridEvent.GRIDDRAG), startdir, "", tempto); -- } -- -- public void setSelectedDestination() { -- String as[] = returnSelectedPaths1(); -- if (as == null || as[0] == null) { -- as = new String[1]; -- as[0] = new String(theApp.getDirFromFile()); -- } -- this.selectedDestination = as[0]; -- } -- -- public void transfer() { -- String temp[] = {""}; -- theApp.fireGridEvent(new GridEvent(theApp, GridEvent.GRIDDROP), null, selectedDestination, temp); -- } -- -- -- class MyAdapter extends MouseAdapter { -- -- public MyAdapter() { -- } -- -- public void mouseClicked(MouseEvent evt) { -- long clickTime = System.currentTimeMillis(); -- long clickInterval = clickTime - firstClickTime; -- if (clickInterval < 300) { -- theApp.displayRemoteFile(); -- firstClickTime = 0; -- } else { -- firstClickTime = clickTime; -- } // end of if - else -- } // end of mouseclicked -- } -- -- -- class RemTreeModelListener implements TreeModelListener { -- public void treeNodesChanged(TreeModelEvent treemodelevent) { -- DefaultMutableTreeNode defaultmutabletreenode = (DefaultMutableTreeNode) treemodelevent.getTreePath().getLastPathComponent(); -- try { -- int i = treemodelevent.getChildIndices()[0]; -- defaultmutabletreenode = (DefaultMutableTreeNode) defaultmutabletreenode.getChildAt(i); -- } catch (NullPointerException nullpointerexception) { -- nullpointerexception.getMessage(); -- } -- javax.swing.tree.TreeNode atreenode[] = null; -- atreenode = defaultmutabletreenode.getPath(); -- // file1.renameTo(file); -- displayInterface.rename(selectedPath, returnPath(atreenode)); -- } -- -- public void treeNodesInserted(TreeModelEvent treemodelevent) { -- } -- -- public void treeNodesRemoved(TreeModelEvent treemodelevent) { -- } -- -- public void treeStructureChanged(TreeModelEvent treemodelevent) { -- } -- -- RemTreeModelListener() { -- } -- } --} -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/AbstractFileTransfer.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/AbstractFileTransfer.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/AbstractFileTransfer.java (working copy) -@@ -1,148 +0,0 @@ --package org.globus.ogce.beans.filetransfer.transfer; -- --import org.apache.log4j.Logger; --import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; --import org.globus.ogce.beans.filetransfer.gui.MainInterface; --import org.globus.ogce.beans.filetransfer.gui.monitor.MonitorPanel; --import org.globus.ogce.beans.filetransfer.gui.monitor.UrlCopyPanel; --import org.globus.ogce.beans.filetransfer.util.FileToTransfer; --import org.globus.ogce.beans.filetransfer.util.GridBrokerQueue; -- --import javax.swing.*; -- --public abstract class AbstractFileTransfer extends Thread { -- private static Logger logger = -- Logger.getLogger(AbstractFileTransfer.class.getName()); -- -- private MainInterface theApp; -- -- private GridBrokerQueue mainQueue = null; -- private GridBrokerQueue saveQueue = null; -- -- private MonitorPanel monitorFrame = null; -- -- private int jobID = 0; -- private boolean active = false; -- private boolean start = true; -- private boolean previousTransfer = false; -- -- protected TransferInterface serviceProvider = null; -- FileToTransfer ftt = null; -- -- -- public AbstractFileTransfer(MainInterface theApp, MonitorPanel monitorFrame) { -- super("AbstractFileTransfer"); -- this.theApp = theApp; -- this.monitorFrame = monitorFrame; -- mainQueue = new GridBrokerQueue(); -- saveQueue = new GridBrokerQueue(); -- logger.info("Constructor"); -- previousTransfer = false; -- } -- -- public abstract void setTransferProvider(); -- -- public AbstractFileTransfer() { -- this(null, null); -- } -- -- public void setControl(boolean start) { -- this.start = start; -- if (start) { -- run(); -- } -- } -- -- public void setSaveQueue(GridBrokerQueue saveQueue) { -- this.saveQueue = saveQueue; -- } -- -- public GridBrokerQueue getSaveQueue() { -- return saveQueue; -- } -- -- public void updateQueues(GridBrokerQueue requestQueue) { -- setControl(false); -- int length = requestQueue.size(); -- for (int i = 0; i < length; i++) { -- jobID = ++FileTransferMainPanel.jobID; -- FileToTransfer ftt = (FileToTransfer) requestQueue.get(); -- -- ftt.setJobID(jobID + ""); -- mainQueue.put(ftt); -- saveQueue.put(ftt); -- ((UrlCopyPanel)serviceProvider).addTransfer(jobID + "", ftt.getFrom(), ftt.getTo(), "false"); -- -- } -- setControl(true); -- } -- -- public void clearAllQueues() { -- mainQueue.deleteAll(); -- saveQueue.deleteAll(); -- jobID = 0; -- active = false; -- previousTransfer = false; -- run(); -- } -- -- public void run() { -- if (active) { -- return; -- } -- -- if (mainQueue.size() > 0) { -- while ((mainQueue.size() > 0) && (start)) { -- -- active = true; -- if (previousTransfer) { -- logger.info("Process the previous request"); -- previousTransfer = false; -- } else { -- ftt = (FileToTransfer) mainQueue.get(); -- } -- serviceProvider.startTransfer(ftt.getJobID()); -- String result = "Unknown"; -- long time = 0; -- int index = -1; -- System.out.println("\nThe result is :" + result); -- while ((!result.equals("Finished")) && (index < 0)) { -- try { -- Thread.sleep(500); -- result = serviceProvider.getFinalStatus(); -- System.out.println("\nCURRENT Status = " + result); -- time += 500; -- System.out.println("\nThe result is :" + result); -- if (result != null) { -- index = result.indexOf("Failed"); -- } -- -- } catch (Exception e) { -- logger.info("Exception sleeping."); -- } -- } -- if (result.equals("Finished")) { -- saveQueue.get(); -- } else if (!((result.indexOf("Permission denied") > 0) || (result.indexOf("File exists") > 0)) && active) { -- -- String msg = "One of the jobs failed: " + -- result + "\nDo you wish to continue with" + -- " other jobs ?"; -- Object options[] = {"Yes", "No"}; -- int k = JOptionPane.showOptionDialog(theApp, -- msg, "Directory Transfer Alert", -1, -- JOptionPane.INFORMATION_MESSAGE, null, options, -- options[0]); -- if (k == 1) { -- setControl(false); -- previousTransfer = true; -- } else { -- saveQueue.get(); -- } -- } -- } -- -- } -- active = false; -- } --} -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/FileRequest.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/FileRequest.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/FileRequest.java (working copy) -@@ -1,127 +0,0 @@ --package org.globus.ogce.beans.filetransfer.transfer; -- -- --import org.apache.log4j.Logger; --import org.globus.ogce.beans.filetransfer.gui.FileTransferMainPanel; --import org.globus.ogce.beans.filetransfer.gui.monitor.MonitorPanel; --import org.globus.ogce.beans.filetransfer.gui.monitor.RequestPanel; --import org.globus.ogce.beans.filetransfer.util.GridBrokerQueue; -- --public class FileRequest extends Thread { -- private static Logger logger = -- Logger.getLogger(FileRequest.class.getName()); -- -- private GridBrokerQueue requestQueue = null; -- boolean active = false; -- boolean start = true; -- int dirJobID = 0; -- private RequestPanel requestPanel = null; -- DirTransferRequest request = null; -- private MonitorPanel monitorFrame = null; -- -- public FileRequest(GridBrokerQueue requestQueue, MonitorPanel monitorFrame) { -- super("FileRequest"); -- this.requestQueue = requestQueue; -- this.monitorFrame = monitorFrame; -- requestPanel = monitorFrame.getRequestPanel(); -- } -- -- public FileRequest() { -- this(null, null); -- } -- -- public void setControl(boolean start) { -- this.start = start; -- if (start) { -- run(); -- } -- } -- -- public void clearRequestQueue() { -- requestQueue.deleteAll(); -- dirJobID = 0; -- } -- -- public void updateQueue(DirTransferRequest request) { -- -- dirJobID++; -- DirRequestJob job = new DirRequestJob(dirJobID + "", request); -- setControl(false); -- requestQueue.put(job); -- -- requestPanel.addTransfer(dirJobID + "", request.getFrom(), request.getTo()); -- //monitorFrame.setFocusTab(2); -- setControl(true); -- } -- -- public void run() { -- if (active) { -- return; -- } -- -- logger.info("\n In the transfer method." + -- "\nQueue size =" + requestQueue.size()); -- -- DirRequestJob job = null; -- String jobid = null; -- if (requestQueue.size() > 0) { -- while ((requestQueue.size() > 0) && (start)) { -- active = true; -- job = (DirRequestJob) requestQueue.get(); -- jobid = job.getJobID(); -- request = job.getDirTransferRequest(); -- requestPanel.setCurrentRequestObject(request); -- requestPanel.updateTransfer(jobid, "Active", "N/A", "No Errors"); -- if (request != null) { -- request.run(); -- } else { -- logger.info("The object from the queue was null"); -- } -- String result = "N/A"; -- String errors = "N/A"; -- while (!(result.equals("Finished") -- || result.equals("Failed") -- || result.equals("Suspended"))) { -- System.out.println("result:" + result); -- try { -- Thread.sleep(1000); -- result = request.getStatus(); -- logger.info("Result is :" + result); -- if (result.equals("Failed")) { -- errors = "Thread killed"; -- } -- requestPanel.updateTransfer(jobid, result, -- request.getTotalFiles(), -- errors); -- } catch (Exception e) { -- e.printStackTrace(); -- } -- } -- requestPanel.updateTransfer(jobid, result, -- request.getTotalFiles(), -- errors); -- } -- active = false; -- } -- } --} -- --class DirRequestJob { -- private String jobID = null; -- private DirTransferRequest dirRequest = null; -- -- public DirRequestJob(String jobID, DirTransferRequest dirRequest) { -- this.jobID = jobID; -- this.dirRequest = dirRequest; -- } -- -- public String getJobID() { -- return jobID; -- } -- -- public DirTransferRequest getDirTransferRequest() { -- return dirRequest; -- } --} -- -- -Index: modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/DirTransferRequest.java -=================================================================== ---- modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/DirTransferRequest.java (revision 3296) -+++ modules/transfer-gui/src/org/globus/ogce/beans/filetransfer/transfer/DirTransferRequest.java (working copy) -@@ -1,402 +0,0 @@ --package org.globus.ogce.beans.filetransfer.transfer; -- --import org.apache.log4j.Logger; --import org.globus.ftp.FileInfo; --import org.globus.ftp.MlsxEntry; --import org.globus.ogce.beans.filetransfer.gui.MainInterface; --import org.globus.ogce.beans.filetransfer.gui.local.LocalTreePanel; --import org.globus.ogce.beans.filetransfer.gui.remote.common.DisplayInterface; --import org.globus.ogce.beans.filetransfer.util.FileToTransfer; --import org.globus.ogce.beans.filetransfer.util.GridBrokerQueue; -- --import javax.swing.*; --import java.io.File; --import java.util.Enumeration; --import java.util.Vector; -- --public class DirTransferRequest { -- -- private static Logger logger = -- Logger.getLogger(DirTransferRequest.class.getName()); -- -- LocalTreePanel toLocal = null, fromLocal = null; -- DisplayInterface toRemote = null, fromRemote = null; -- String to = "",from = ""; -- -- String fromFileSep = "", toFileSep = ""; -- boolean dragLocal = true; -- DisplayInterface display = null; -- boolean dropLocal = false; -- private MainInterface theApp = null; -- int submitCount = 0; -- String rootfrom = null,rootto = null; -- GridBrokerQueue requestQueue = null; -- String provider = null; -- int noOfFiles = 0; -- String fromFullURL = null; -- String toFullURL = null; -- boolean start = true; -- Thread newThread = null; -- String status = null; -- Vector dirVector = null; -- -- public DirTransferRequest(MainInterface theApp, -- LocalTreePanel fromLocal, -- LocalTreePanel toLocal, -- DisplayInterface fromRemote, -- DisplayInterface toRemote, -- String from, String to, -- boolean dragLocal, boolean dropLocal, -- String provider) { -- this.toLocal = toLocal; -- this.fromLocal = fromLocal; -- this.toRemote = toRemote; -- this.fromRemote = fromRemote; -- this.to = to; -- this.from = from; -- this.dragLocal = dragLocal; -- this.dropLocal = dropLocal; -- this.theApp = theApp; -- this.provider = provider; -- requestQueue = new GridBrokerQueue(); -- dirVector = new Vector(); -- } -- -- public void suspend() { -- status = "Suspended"; -- start = false; -- newThread.suspend(); -- } -- -- public void resume() { -- start = true; -- status = "Resumed"; -- newThread.resume(); -- // theApp.startActualTransfer(requestQueue,provider); -- } -- -- public void kill() { -- -- requestQueue.deleteAll(); -- // suspend(); -- status = "Failed"; -- newThread.stop(); -- newThread = null; -- -- } -- -- public String getTotalFiles() { -- return noOfFiles + ""; -- } -- -- public String getFrom() { -- if (dragLocal) { -- fromFullURL = "file:///"; -- } else { -- fromFullURL = fromRemote.getRootURL(); -- } -- fromFullURL += from; -- return fromFullURL; -- } -- -- public String getTo() { -- if (dropLocal) { -- toFullURL = "file:///"; -- } else { -- toFullURL = toRemote.getRootURL(); -- } -- toFullURL += to; -- return toFullURL; -- } -- -- public void run() { -- newThread = new Thread() { -- public void run() { -- putRequest(); -- } -- }; -- newThread.start(); -- } -- -- -- public void putRequest() { -- -- status = "Active"; -- if (dropLocal) { -- rootto = "file:///"; -- toFileSep = toLocal.LclFile_Sep; -- } else { -- rootto = toRemote.getRootURL(); -- toFileSep = "/"; -- } -- boolean isDir = false; -- File dir = null; -- if (dragLocal) { -- rootfrom = "file:///"; -- dir = new File(from); -- isDir = dir.isDirectory(); -- fromFileSep = fromLocal.LclFile_Sep; -- } else { -- rootfrom = fromRemote.getRootURL(); -- isDir = fromRemote.chdir(from); -- fromFileSep = "/"; -- } -- -- if (isDir) { -- String fromCopy = from; -- if (from.endsWith(fromFileSep)) { -- from = from.substring(0, from.length() - 1); -- } -- int index = from.lastIndexOf(fromFileSep); -- String firstDir = from.substring(index + 1); -- logger.info("This is a directory"); -- firstDir.replace(fromFileSep.charAt(0), toFileSep.charAt(0)); -- String fromSource = getFrom(); -- String toDest = getTo() + firstDir; -- -- if (!toDest.startsWith("file")) { -- toDest = toDest.replaceAll("///", "//"); -- } -- -- logger.info("From :" + fromSource + "To: " + toDest); -- if (fromSource.equals(toDest)) { -- String alertMsg = "Destination cannot be same as Source."; -- JOptionPane.showMessageDialog(theApp, alertMsg); -- status = "Failed"; -- return; -- } -- firstDir = firstDir + fromFileSep; -- logger.info("First Dir:" + firstDir); -- if (dragLocal) { -- if (createDestDir(firstDir, "")) { -- transferLocal(dir, firstDir); -- if (checkVector()) { -- status = "Finished"; -- } else { -- status = "Failed"; -- } -- } else { -- return; -- } -- -- } else { -- if (createDestDir(firstDir, "")) { -- transferRemote(from + fromFileSep, firstDir); -- if (checkVector()) { -- status = "Finished"; -- } else { -- status = "Failed"; -- } -- } else { -- return; -- } -- } -- } else { -- logger.info("This is a file"); -- putFile(from); -- status = "Finished"; -- } -- -- if (start && status.equals("Finished")) { -- theApp.startActualTransfer(requestQueue, provider); -- } -- } -- -- public String getStatus() { -- return status; -- } -- -- public void transferLocal(File fromDir, String startdir) { -- if (!start) { -- return; -- } -- -- File[] files = fromDir.listFiles(); -- logger.info("\nLISTING DIR: " + fromDir); -- -- for (int i = 0; i < files.length; i++) { -- File current = files[i]; -- if (current.isDirectory()) { -- -- if (!createDestDir(current.getName(), startdir)) { -- logger.info("\nDir creation failed =" + current.getName()); -- break; -- } else { -- logger.info("\nDir created successfully =" + current.getName()); -- transferLocal(current, startdir + current.getName() + fromFileSep); -- } -- } else { -- putFile(fromDir.getAbsolutePath() + fromFileSep + current.getName()); -- } -- } -- } -- -- public void putFile(String fromFullPath) { -- noOfFiles++; -- theApp.msgOut("\nCounting number of files :" + noOfFiles); -- String fromSourceURL = rootfrom + fromFullPath; -- int index = from.lastIndexOf(fromFileSep); -- String toFullPath = fromFullPath.substring(index + 1); -- toFullPath = toFullPath.replace(fromFileSep.charAt(0), toFileSep.charAt(0)); -- String toDestinationURL = rootto + to + toFullPath; -- -- String checkFrom = fromSourceURL.replaceAll("//", "/"); -- String checkTo = toDestinationURL.replaceAll("//", "/"); -- checkFrom = checkFrom.replaceAll("//", "/"); -- checkTo = checkTo.replaceAll("//", "/"); -- -- if (checkFrom.equals(checkTo)) { -- String alertMsg = "Destination cannot be same as Source."; -- JOptionPane.showMessageDialog(theApp, alertMsg); -- status = "Failed"; -- return; -- } else { -- FileToTransfer fileToTransfer = new FileToTransfer(fromSourceURL, toDestinationURL, provider); -- -- requestQueue.put(fileToTransfer); -- return; -- } -- -- } -- -- public boolean createDestDir(String newDir, String location) { -- newDir = newDir.replace(fromFileSep.charAt(0), toFileSep.charAt(0)); -- location = location.replace(fromFileSep.charAt(0), toFileSep.charAt(0)); -- String remoteNewDir = null; -- if (location != null) { -- remoteNewDir = to + location + newDir; -- } else { -- remoteNewDir = to + newDir; -- } -- String toCheck = remoteNewDir.replaceAll("//", "/"); -- if (toCheck.endsWith(toFileSep)) { -- toCheck = toCheck.substring(0, toCheck.length() - 1); -- } -- if (toCheck.equals(from)) { -- String alertMsg = "Destination cannot be same as Source."; -- JOptionPane.showMessageDialog(theApp, alertMsg); -- status = "Failed"; -- return false; -- } -- if (remoteNewDir.indexOf(from) >= 0) { -- logger.info("\nStore in hashtable remote dir =" + remoteNewDir + -- "\nFrom : " + from); -- dirVector.add(remoteNewDir); -- return true; -- } else { -- -- logger.info("\nCreating remote dir =" + remoteNewDir + -- "\nAT : " + to + location); -- -- boolean created = createDestDir(remoteNewDir); -- if (created) { -- logger.info("DESTINATION DIRECTORY CREATED"); -- } else { -- logger.info("DESTINATION DIRECTORY not created"); -- } -- return created; -- } -- } -- -- public boolean createDestDir(String remoteNewDir) { -- theApp.msgOut("\nCreating remote dir =" + remoteNewDir); -- if (dropLocal) { -- -- try { -- File newfile = new File(remoteNewDir); -- if (newfile.exists()) { -- return true; -- } -- if (newfile.mkdir()) { -- logger.info("Directory successfully created : " + remoteNewDir); -- -- return true; -- } else { -- String alertMsg = "You do not have permissions to " + -- "to create new directories in the local machine.\n Transfer failed. Please set the permissions and try again."; -- JOptionPane.showMessageDialog(theApp, alertMsg); -- status = "Failed"; -- return false; -- } -- } catch (Exception e) { -- return false; -- } -- } else { -- if (toRemote.mkdir(remoteNewDir)) { -- logger.info("Directory successfully created : " + remoteNewDir); -- return true; -- } else { -- String alertMsg = "You do not have permissions to " + -- "to create new directories at Destination.\n" + -- " Transfer failed. Please set the permissions and try again. "; -- JOptionPane.showMessageDialog(theApp, alertMsg); -- status = "Failed"; -- return false; -- } -- } -- -- } -- -- /** -- * This method was to avoid recursive creation and travesing of -- * directory when a directory is dragged and dropped into a one of its -- * child directories. -- * -- */ -- public boolean checkVector() { -- boolean success = true; -- while (dirVector.size() > 0) { -- String newDir = (String) dirVector.remove(0); -- if (!createDestDir(newDir)) { -- success = false; -- break; -- } -- } -- return success; -- } -- //Here there is no way to get the absolute path. So send the fullpath. -- -- public void transferRemote(String fullpath, String startdir) { -- if (!start) { -- return; -- } -- Vector vector = fromRemote.listTransferDir(fullpath); -- if (vector == null) { -- logger.info("\nThis is an empty directory."); -- } else { -- Enumeration enum1 = vector.elements(); -- while (enum1.hasMoreElements()) { -- MlsxEntry current = (MlsxEntry) enum1.nextElement(); -- if (null != current.getFileName() && -- !"cdir".equals(current.get("type")) && !"pdir".equals(current.get("type"))) { -- //System.out.println(current); -- //it's a soft link -- if (current.get("unix.slink") != null) { -- ; -- } else { -- if ("dir".equals(current.get("type"))) { --// if ((current.getName().equals("//dev")) || --// (current.isDevice())) { --// ; --// } else { -- if(!".".equals(current.getFileName()) && !"..".equals(current.getFileName())) { -- if (!createDestDir(current.getFileName(), startdir)) { -- break; -- } -- transferRemote(fullpath + current.getFileName() -- + fromFileSep, -- startdir + current.getFileName() -- + fromFileSep); -- } -- -- //} -- -- } else { -- putFile(fullpath + fromFileSep + current.getFileName()); -- } -- } -- } -- } -- } -- } --} -Index: modules/transfer-gui/src/scripts/gui.bat -=================================================================== ---- modules/transfer-gui/src/scripts/gui.bat (revision 3296) -+++ modules/transfer-gui/src/scripts/gui.bat (working copy) -@@ -1,19 +0,0 @@ -- at echo off -- --if "%GLOBUS_LOCATION%" == "" goto nogl --goto run -- --:nogl -- -- echo Error: GLOBUS_LOCATION not set -- goto end -- --:run -- -- set _RUNJAVA=java -- if not "%JAVA_HOME%" == "" set _RUNJAVA="%JAVA_HOME%\bin\java" -- %_RUNJAVA% -DGLOBUS_LOCATION="%GLOBUS_LOCATION%" -Daxis.ClientConfigFile="%GLOBUS_LOCATION%"\client-config.wsdd -jar gui.jar -- --:end -- -- -\ No newline at end of file -Index: modules/transfer-gui/src/scripts/gui.sh -=================================================================== ---- modules/transfer-gui/src/scripts/gui.sh (revision 3296) -+++ modules/transfer-gui/src/scripts/gui.sh (working copy) -@@ -1,14 +0,0 @@ --# !/bin/sh -- --if [ ! -d "$GLOBUS_LOCATION" ] then -- echo "Error: GLOBUS_LOCATION invalid or not set: $GLOBUS_LOCATION" 1>&2 -- exit 1 --fi -- --if [ "X$JAVA_HOME" = "X" ] then -- _RUNJAVA=java --else -- _RUNJAVA="$JAVA_HOME"/bin/java --fi -- --exec $_RUNJAVA -Daxis.ClientConfigFile="$GLOBUS_LOCATION"\client-config.wsdd -jar gui.jar -\ No newline at end of file -Index: modules/transfer-gui/src/scripts/build.xml -=================================================================== ---- modules/transfer-gui/src/scripts/build.xml (revision 3296) -+++ modules/transfer-gui/src/scripts/build.xml (working copy) -@@ -1,62 +0,0 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -\ No newline at end of file -Index: modules/transfer-gui/docs/todo.txt -=================================================================== ---- modules/transfer-gui/docs/todo.txt (revision 3296) -+++ modules/transfer-gui/docs/todo.txt (working copy) -@@ -1,9 +0,0 @@ --Todo list: --1. The GUI is based on OGCE now, we need to transfer it to Cog4 first. This task involves some interface changes. --2. merge "Generate Credential" button and "Myproxy" button into one "authentication" button. When users click it, a dialog will popup and -- provide two options for users: -- 1) generate a proxy from local certificate; -- 2) get a short-term proxy from a Myproxy server; -- Some explanation text will help users to make a decision and prevent confusion. --3. Add a "Advanced options" button to replace "RFT" button. Clicking that button will also popup a dialog to set RFT service address, port, -- parallel streams, TCP buffer, concurrency and whether reliable transfer is enforced or not. -\ No newline at end of file -Index: modules/transfer-gui/docs/Notes -=================================================================== ---- modules/transfer-gui/docs/Notes (revision 3296) -+++ modules/transfer-gui/docs/Notes (working copy) -@@ -1,3 +0,0 @@ --www.globus.org --/www/www-unix.globus.org/cog/demo/ogce --DOE service credential:http://www.doegrids.org/pages/ModelCertificateDeployment.html -\ No newline at end of file -Index: modules/transfer-gui/docs/User Guide for GridFTP and RFT GUI.doc -=================================================================== -Cannot display: file marked as a binary type. -svn:mime-type = application/octet-stream -Index: modules/transfer-gui/etc/MANIFEST.MF.tail -=================================================================== ---- modules/transfer-gui/etc/MANIFEST.MF.tail (revision 3296) -+++ modules/transfer-gui/etc/MANIFEST.MF.tail (working copy) -@@ -1 +0,0 @@ -- -Index: modules/transfer-gui/etc/MANIFEST.MF.head -=================================================================== ---- modules/transfer-gui/etc/MANIFEST.MF.head (revision 3296) -+++ modules/transfer-gui/etc/MANIFEST.MF.head (working copy) -@@ -1 +0,0 @@ --Manifest-Version: 1.0 -Index: modules/transfer-gui/etc/log4j.properties.module -=================================================================== ---- modules/transfer-gui/etc/log4j.properties.module (revision 3296) -+++ modules/transfer-gui/etc/log4j.properties.module (working copy) -@@ -1 +0,0 @@ --log4j.logger.org.globus.cog.example=INFO -Index: modules/transfer-gui/build.xml -=================================================================== ---- modules/transfer-gui/build.xml (revision 3296) -+++ modules/transfer-gui/build.xml (working copy) -@@ -1,168 +0,0 @@ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Available targets: -- help: -- prints out this help message -- -- dist: -- creates a distribution directory of the -- ${project} ${long.name} -- -- jar: -- creates a jar file for the ${project} ${long.name} -- named ${jar.filename} -- -- javadoc: -- creates the documentation -- -- clean: -- removes the compiled classes -- -- distclean: -- deletes the distribution directory -- -- all: -- dist and javadoc -- -- deploy.webstart: -- deploys the module as a webstart application -- -- dist.joint: -- builds everything into one jar file. Should only -- be used globally (from all) -- -- fixeol: -- change newlines to the unix standard -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Added: SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch.deleted =================================================================== --- SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch.deleted (rev 0) +++ SwiftApps/SwiftR/Swift/src/swift-patches/swift-0.92.1-changes.patch.deleted 2011-10-19 02:41:04 UTC (rev 5244) @@ -0,0 +1,2 @@ +modules/transfer-gui/ +modules/certmanagement/ Modified: SwiftApps/SwiftR/checkout-swift.sh =================================================================== --- SwiftApps/SwiftR/checkout-swift.sh 2011-10-18 21:17:57 UTC (rev 5243) +++ SwiftApps/SwiftR/checkout-swift.sh 2011-10-19 02:41:04 UTC (rev 5244) @@ -1,5 +1,6 @@ #!/bin/sh set -e +set -x COG_SRC=$1 SWIFT_PATCH=$2 SWIFT_TAG=$3 @@ -29,3 +30,4 @@ svn checkout https://svn.ci.uchicago.edu/svn/vdl2/tags/${SWIFT_TAG} swift) patch -d ${COG_SRC} -p0 < $SWIFT_PATCH +(cd ${COG_SRC} && xargs -d '\n' -n 1 --arg-file=../${SWIFT_PATCH}.deleted rm -rf)