<%@ Import Namespace="edu.jhu.Cas" %>
<%@ Register TagPrefix="uc1" TagName="Trailer" Src="Trailer.ascx" %>
<%@ Register TagPrefix="uc2" TagName="Header" Src="top.ascx" %>
<%@ Import Namespace="edu.jhu.Cas.Util" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Web" %>

<%@ Page Language="c#" %>

<%
    string text = Request.Params["lmessage"];
    if (null == text) text = "";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>CasJobs Tools</title>
    <link href="cjobs.css" rel="stylesheet" />
</head>
<body>
    <uc2:Header ID="Header" runat="server" />
    <p >
        <%=text%>
    </p>
    <div class="textWidth">
        <h1>
            CasJobs Command Line Tool&nbsp;
        </h1>
        <div>
            Download 'casjobs.jar' <a href="download/casjobs.jar">here</a>
            <br>
            Download sample config file <a href="download/CasJobs.config.x">here</a> (Save this
            as casjobs.config, not casjobs.config.x)
            <br>
            Download source 'casjobs.src.zip' <a href="download/casjobs.src.zip">here</a>
            (includes libraries and ant script)
        </div>
        <h4>
            Description</h4>
        A java command line tool for completing various tasks using CasJobs web services.
        With this program you can:
        <p>
            <li>View MyDB Tables</li>
            <li>Submit jobs to all available queues.</li>
            <li>Submit jobs and wait for them to complete</li>
            <li>Extract data from tables and automatically download the output.</li></p>
	    <p>The CL tool is currently compatible with <b>Java SDK v1.5 or higher (v1.6 recommended)</b>. 
	    Compatibility is not usually tied to OS but rather the Java SDK version.
        </p>
        <br>
	<p>
	    <h4>Compatibility</h4>
	    <p>This program was compiled with Sun JDK v1.6.  Compatibility with Java environments
	    from other vendors or with lower version numbers is untested.
	    </p>
	</p>
        <p>
            <h4>
                Installation</h4>
            <p>
                <i>CasJobs.config.x must first be renamed to CasJobs.config</i></p>
            <p>
                <i>Before first use, you must enter your wsid and password in the Casjobs.config file. Your wsid is located
                    at the top of the profile page <a href="changedetails.aspx">here</a>.</i></p>
            <p>
                The CasJobsCL tool is distributed in executable *.jar format. Also included is a
                config file, called 'CasJobs.config', which must be included in the same directory
                as the executable. To run the program, type 'java -jar casjobs.jar' and append desired
                arguments. To simplify calling the program, you can add a script in your path that
                calls casjobs.jar.
            </p>
            <p>
                This program can be configured to use a <i>proxy</i> by adding these lines to its
                config file.
                <div >
                    proxySet=true<br>
                    proxyHost=proxy.somedomain.org<br>
                    proxyPort=3128
                </div>
            </p>
            <p>
                <h4>
                    Examples</h4>
                <p>
                    From now on, 'casjobs' is assumed to be an alias for 'java -jar casjobs.jar'</p>
                <div class="code">
                    casjobs --help commands</div>
                <ul>
                    Lists all commands and their usage.</ul>
                <div class="code">
                    casjobs execute "select top 10 ra from photoobj"</div>
                <ul>
                    Submits a query to the default target's lowest queue. Returns results to stdout.</ul>
                <div class="code">
                    casjobs submit -t dr2/60 -n "my query" -f "myquery.sql"</div>
                <ul>
                    Submits query in myquery.sql to the dr2/60 queue with "my query" as the taskname.
                    Returns a jobid.</ul>
                <div class="code" >
                    casjobs extract -d -a dataset -b "some_table"</div>
                <ul>
                    Extracts a dataset from "some_table", waits for it to complete, then downloads the
                    results.</ul>
		If you have problems running the CL tool, pl. see the <a href="faq.aspx#CL">FAQ entry for the command-line tool</a>.
            </p>
            <p>
                <h4>
                    Scripting Examples</h4>
                <p>
                    This section assumes you have some basic scripting knowledge in whatever platform
                    you're on. It should give you an idea of how the tool might be scripted, but of
                    course these are not 100% platform-independent examples. You'll probably have to
                    modify them for your situation.
                    <h5>
                        Example 1</h5>
                    <div class="code">
                        casjobs run -t "dr2/1" -n "test query" "select top 10 ra into mydb.test0 from photoobj"<br>
                        casjobs extract -b test0 -F -type fits -d<br>
                        casjobs execute -t "dr2/1" -n "drop query" "drop table test0"
                        <br>
                    </div>
                    <div>
                        <p>
                            This example will:</p>
                        <li>run a query, then wait for it to finish</li>
                        <li>extract and download output from that query</li>
                        <li>drop the table the query created</li>
                    </div>
                </p>
                </h4>
                <br>
                <uc1:Trailer ID="Trailer1" runat="server" cvsTag="$Name$" cvsRev="$Revision: 121916 $">
                </uc1:Trailer>
    </div>
    </body>
</html>
