Added: oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/PCSLongLister.html URL: http://svn.apache.org/viewvc/oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/PCSLongLister.html?rev=1079660&view=auto ============================================================================== --- oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/PCSLongLister.html (added) +++ oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/PCSLongLister.html Wed Mar 9 04:02:09 2011 @@ -0,0 +1,215 @@ +<?xml version='1.0' encoding='utf-8'?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xml:lang="en"><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>PCSLongLister xref</title><link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" /></head><body> +<div id="overview"><a href="../../../../../../apidocs/org/apache/oodt/pcs/tools/PCSLongLister.html">View Javadoc</a></div><pre> + +<a name="1" href="#1" id="1">1</a> <em class="jxr_javadoccomment">/**</em> +<a name="2" href="#2" id="2">2</a> <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one or more</em> +<a name="3" href="#3" id="3">3</a> <em class="jxr_javadoccomment"> * contributor license agreements. See the NOTICE file distributed with</em> +<a name="4" href="#4" id="4">4</a> <em class="jxr_javadoccomment"> * this work for additional information regarding copyright ownership.</em> +<a name="5" href="#5" id="5">5</a> <em class="jxr_javadoccomment"> * The ASF licenses this file to You under the Apache License, Version 2.0</em> +<a name="6" href="#6" id="6">6</a> <em class="jxr_javadoccomment"> * (the "License"); you may not use this file except in compliance with</em> +<a name="7" href="#7" id="7">7</a> <em class="jxr_javadoccomment"> * the License. You may obtain a copy of the License at</em> +<a name="8" href="#8" id="8">8</a> <em class="jxr_javadoccomment"> *</em> +<a name="9" href="#9" id="9">9</a> <em class="jxr_javadoccomment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em> +<a name="10" href="#10" id="10">10</a> <em class="jxr_javadoccomment"> *</em> +<a name="11" href="#11" id="11">11</a> <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing, software</em> +<a name="12" href="#12" id="12">12</a> <em class="jxr_javadoccomment"> * distributed under the License is distributed on an "AS IS" BASIS,</em> +<a name="13" href="#13" id="13">13</a> <em class="jxr_javadoccomment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em> +<a name="14" href="#14" id="14">14</a> <em class="jxr_javadoccomment"> * See the License for the specific language governing permissions and</em> +<a name="15" href="#15" id="15">15</a> <em class="jxr_javadoccomment"> * limitations under the License.</em> +<a name="16" href="#16" id="16">16</a> <em class="jxr_javadoccomment"> */</em> +<a name="17" href="#17" id="17">17</a> +<a name="18" href="#18" id="18">18</a> <strong class="jxr_keyword">package</strong> org.apache.oodt.pcs.tools; +<a name="19" href="#19" id="19">19</a> +<a name="20" href="#20" id="20">20</a> <em class="jxr_comment">//OODT imports</em> +<a name="21" href="#21" id="21">21</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.listing.ListingConf; +<a name="22" href="#22" id="22">22</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.metadata.PCSMetadata; +<a name="23" href="#23" id="23">23</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.query.InputFilesQuery; +<a name="24" href="#24" id="24">24</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.util.FileManagerUtils; +<a name="25" href="#25" id="25">25</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.metadata.CoreMetKeys; +<a name="26" href="#26" id="26">26</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.structs.Product; +<a name="27" href="#27" id="27">27</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.metadata.Metadata; +<a name="28" href="#28" id="28">28</a> +<a name="29" href="#29" id="29">29</a> <em class="jxr_comment">//JDK imports</em> +<a name="30" href="#30" id="30">30</a> <strong class="jxr_keyword">import</strong> java.io.File; +<a name="31" href="#31" id="31">31</a> <strong class="jxr_keyword">import</strong> java.util.Arrays; +<a name="32" href="#32" id="32">32</a> <strong class="jxr_keyword">import</strong> java.util.Iterator; +<a name="33" href="#33" id="33">33</a> <strong class="jxr_keyword">import</strong> java.util.List; +<a name="34" href="#34" id="34">34</a> <strong class="jxr_keyword">import</strong> java.util.Stack; +<a name="35" href="#35" id="35">35</a> <strong class="jxr_keyword">import</strong> java.util.Vector; +<a name="36" href="#36" id="36">36</a> +<a name="37" href="#37" id="37">37</a> <em class="jxr_javadoccomment">/**</em> +<a name="38" href="#38" id="38">38</a> <em class="jxr_javadoccomment"> * </em> +<a name="39" href="#39" id="39">39</a> <em class="jxr_javadoccomment"> * The PCS Long Lister tool: mimics UNIX-ls and looks up descendant metadata for</em> +<a name="40" href="#40" id="40">40</a> <em class="jxr_javadoccomment"> * fields like TestTag, SubTestTag, TestCounter. Also displays Filename,</em> +<a name="41" href="#41" id="41">41</a> <em class="jxr_javadoccomment"> * StartDateTime, and EndDateTime for each listed file, and any of its met keys</em> +<a name="42" href="#42" id="42">42</a> <em class="jxr_javadoccomment"> * configured in the <code>pcs-ll-conf.xml</code> file.</em> +<a name="43" href="#43" id="43">43</a> <em class="jxr_javadoccomment"> * </em> +<a name="44" href="#44" id="44">44</a> <em class="jxr_javadoccomment"> * @author mattmann</em> +<a name="45" href="#45" id="45">45</a> <em class="jxr_javadoccomment"> * @version $Revision$</em> +<a name="46" href="#46" id="46">46</a> <em class="jxr_javadoccomment"> * </em> +<a name="47" href="#47" id="47">47</a> <em class="jxr_javadoccomment"> */</em> +<a name="48" href="#48" id="48">48</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/oodt/pcs/tools/PCSLongLister.html">PCSLongLister</a> implements PCSMetadata, <a href="../../../../../org/apache/oodt/cas/filemgr/metadata/CoreMetKeys.html">CoreMetKeys</a> { +<a name="49" href="#49" id="49">49</a> +<a name="50" href="#50" id="50">50</a> <strong class="jxr_keyword">private</strong> <a href="../../../../../org/apache/oodt/pcs/util/FileManagerUtils.html">FileManagerUtils</a> fm; +<a name="51" href="#51" id="51">51</a> +<a name="52" href="#52" id="52">52</a> <strong class="jxr_keyword">private</strong> <a href="../../../../../org/apache/oodt/pcs/listing/ListingConf.html">ListingConf</a> conf; +<a name="53" href="#53" id="53">53</a> +<a name="54" href="#54" id="54">54</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/oodt/pcs/tools/PCSLongLister.html">PCSLongLister</a>(String fmUrlStr, String confFile) +<a name="55" href="#55" id="55">55</a> <strong class="jxr_keyword">throws</strong> InstantiationException { +<a name="56" href="#56" id="56">56</a> fm = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/oodt/pcs/util/FileManagerUtils.html">FileManagerUtils</a>(fmUrlStr); +<a name="57" href="#57" id="57">57</a> <strong class="jxr_keyword">try</strong> { +<a name="58" href="#58" id="58">58</a> <strong class="jxr_keyword">this</strong>.conf = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/oodt/pcs/listing/ListingConf.html">ListingConf</a>(<strong class="jxr_keyword">new</strong> File(confFile)); +<a name="59" href="#59" id="59">59</a> } <strong class="jxr_keyword">catch</strong> (Exception e) { +<a name="60" href="#60" id="60">60</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> InstantiationException(e.getMessage()); +<a name="61" href="#61" id="61">61</a> } +<a name="62" href="#62" id="62">62</a> } +<a name="63" href="#63" id="63">63</a> +<a name="64" href="#64" id="64">64</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> doList(List prodNames) { +<a name="65" href="#65" id="65">65</a> <strong class="jxr_keyword">if</strong> (prodNames != <strong class="jxr_keyword">null</strong> && prodNames.size() > 0) { +<a name="66" href="#66" id="66">66</a> System.out.println(getToolHeader()); +<a name="67" href="#67" id="67">67</a> <strong class="jxr_keyword">for</strong> (Iterator i = prodNames.iterator(); i.hasNext();) { +<a name="68" href="#68" id="68">68</a> String prodName = (String) i.next(); +<a name="69" href="#69" id="69">69</a> <em class="jxr_comment">// check to see if the product name has a "/" in it</em> +<a name="70" href="#70" id="70">70</a> <em class="jxr_comment">// (this is true in the case of someone using *</em><em class="jxr_comment">/*<em class="jxr_comment"> from</em></em> +<a name="71" href="#71" id="71">71</a> <em class="jxr_comment"> // a shell): if it does, we'll consider the prodName a</em> +<a name="72" href="#72" id="72">72</a> <em class="jxr_comment"> // path, and we'll clean it using new File(prodName).getName()</em> +<a name="73" href="#73" id="73">73</a> <em class="jxr_comment"> if (prodName.indexOf("/") != -1) {</em> +<a name="74" href="#74" id="74">74</a> <em class="jxr_comment"> // clean the prodName</em> +<a name="75" href="#75" id="75">75</a> <em class="jxr_comment"> prodName = new File(prodName).getName();</em> +<a name="76" href="#76" id="76">76</a> <em class="jxr_comment"> }</em> +<a name="77" href="#77" id="77">77</a> +<a name="78" href="#78" id="78">78</a> <em class="jxr_comment"> Product prod = fm.safeGetProductByName(prodName);</em> +<a name="79" href="#79" id="79">79</a> <em class="jxr_comment"> if (prod == null) {</em> +<a name="80" href="#80" id="80">80</a> <em class="jxr_comment"> // product not cataloged</em> +<a name="81" href="#81" id="81">81</a> <em class="jxr_comment"> System.out.println(prodName + "\tNot Cataloged!");</em> +<a name="82" href="#82" id="82">82</a> <em class="jxr_comment"> continue;</em> +<a name="83" href="#83" id="83">83</a> <em class="jxr_comment"> }</em> +<a name="84" href="#84" id="84">84</a> <em class="jxr_comment"> Metadata met = fm.safeGetMetadata(prod);</em> +<a name="85" href="#85" id="85">85</a> <em class="jxr_comment"> outputListingLine(met, prodName);</em> +<a name="86" href="#86" id="86">86</a> <em class="jxr_comment"> }</em> +<a name="87" href="#87" id="87">87</a> <em class="jxr_comment"> }</em> +<a name="88" href="#88" id="88">88</a> +<a name="89" href="#89" id="89">89</a> <em class="jxr_comment"> }</em> +<a name="90" href="#90" id="90">90</a> +<a name="91" href="#91" id="91">91</a> <em class="jxr_comment"> public static void main(String[] args) throws Exception {</em> +<a name="92" href="#92" id="92">92</a> <em class="jxr_comment"> String usage = "PCSLongLister <conf file> <fmurl> [files]";</em> +<a name="93" href="#93" id="93">93</a> <em class="jxr_comment"> List fileList;</em> +<a name="94" href="#94" id="94">94</a> +<a name="95" href="#95" id="95">95</a> <em class="jxr_comment"> if (args.length < 2) {</em> +<a name="96" href="#96" id="96">96</a> <em class="jxr_comment"> System.err.println(usage);</em> +<a name="97" href="#97" id="97">97</a> <em class="jxr_comment"> System.exit(1);</em> +<a name="98" href="#98" id="98">98</a> <em class="jxr_comment"> }</em> +<a name="99" href="#99" id="99">99</a> +<a name="100" href="#100" id="100">100</a> <em class="jxr_comment"> if (args.length == 2) {</em> +<a name="101" href="#101" id="101">101</a> <em class="jxr_comment"> // assume they gave us the current dir "."</em> +<a name="102" href="#102" id="102">102</a> <em class="jxr_comment"> // get a list of files from there</em> +<a name="103" href="#103" id="103">103</a> <em class="jxr_comment"> fileList = Arrays.asList(new File(".").list());</em> +<a name="104" href="#104" id="104">104</a> <em class="jxr_comment"> } else if (args.length == 3 && new File(args[2]).isDirectory()) {</em> +<a name="105" href="#105" id="105">105</a> <em class="jxr_comment"> fileList = Arrays.asList(new File(args[2]).list());</em> +<a name="106" href="#106" id="106">106</a> <em class="jxr_comment"> } else {</em> +<a name="107" href="#107" id="107">107</a> <em class="jxr_comment"> // it's going to be a list of files anyways</em> +<a name="108" href="#108" id="108">108</a> <em class="jxr_comment"> // so just treat the whole argList as a list of file names</em> +<a name="109" href="#109" id="109">109</a> <em class="jxr_comment"> List argList = Arrays.asList(args);</em> +<a name="110" href="#110" id="110">110</a> <em class="jxr_comment"> fileList = argList.subList(2, argList.size());</em> +<a name="111" href="#111" id="111">111</a> <em class="jxr_comment"> }</em> +<a name="112" href="#112" id="112">112</a> +<a name="113" href="#113" id="113">113</a> <em class="jxr_comment"> PCSLongLister lister = new PCSLongLister(args[0], args[1]);</em> +<a name="114" href="#114" id="114">114</a> <em class="jxr_comment"> lister.doList(fileList);</em> +<a name="115" href="#115" id="115">115</a> +<a name="116" href="#116" id="116">116</a> <em class="jxr_comment"> }</em> +<a name="117" href="#117" id="117">117</a> +<a name="118" href="#118" id="118">118</a> <em class="jxr_comment"> private String getToolHeader() {</em> +<a name="119" href="#119" id="119">119</a> <em class="jxr_comment"> StringBuffer header = new StringBuffer();</em> +<a name="120" href="#120" id="120">120</a> <em class="jxr_comment"> for (String colName : this.conf.getHeaderColKeys()) {</em> +<a name="121" href="#121" id="121">121</a> <em class="jxr_comment"> header.append(this.conf.getHeaderColDisplayName(colName));</em> +<a name="122" href="#122" id="122">122</a> <em class="jxr_comment"> header.append("\t");</em> +<a name="123" href="#123" id="123">123</a> <em class="jxr_comment"> }</em> +<a name="124" href="#124" id="124">124</a> <em class="jxr_comment"> return header.toString();</em> +<a name="125" href="#125" id="125">125</a> <em class="jxr_comment"> }</em> +<a name="126" href="#126" id="126">126</a> +<a name="127" href="#127" id="127">127</a> <em class="jxr_comment"> private void outputListingLine(Metadata met, String prodName) {</em> +<a name="128" href="#128" id="128">128</a> <em class="jxr_comment"> StringBuffer output = new StringBuffer();</em> +<a name="129" href="#129" id="129">129</a> <em class="jxr_comment"> for (String colNameKey : this.conf.getHeaderColKeys()) {</em> +<a name="130" href="#130" id="130">130</a> <em class="jxr_comment"> if (!this.conf.isCollectionField(colNameKey)) {</em> +<a name="131" href="#131" id="131">131</a> <em class="jxr_comment"> output.append(met.getMetadata(colNameKey));</em> +<a name="132" href="#132" id="132">132</a> <em class="jxr_comment"> output.append("\t");</em> +<a name="133" href="#133" id="133">133</a> <em class="jxr_comment"> } else {</em> +<a name="134" href="#134" id="134">134</a> <em class="jxr_comment"> output.append(outputOrBlank(getAllProductsByTag(met, prodName,</em> +<a name="135" href="#135" id="135">135</a> <em class="jxr_comment"> colNameKey)));</em> +<a name="136" href="#136" id="136">136</a> <em class="jxr_comment"> output.append("\t");</em> +<a name="137" href="#137" id="137">137</a> <em class="jxr_comment"> }</em> +<a name="138" href="#138" id="138">138</a> <em class="jxr_comment"> }</em> +<a name="139" href="#139" id="139">139</a> <em class="jxr_comment"> System.out.println(output.toString());</em> +<a name="140" href="#140" id="140">140</a> <em class="jxr_comment"> }</em> +<a name="141" href="#141" id="141">141</a> +<a name="142" href="#142" id="142">142</a> <em class="jxr_comment"> private static String outputOrBlank(List items) {</em> +<a name="143" href="#143" id="143">143</a> <em class="jxr_comment"> if (items == null || (items != null && items.size() == 0)) {</em> +<a name="144" href="#144" id="144">144</a> <em class="jxr_comment"> return "N/A";</em> +<a name="145" href="#145" id="145">145</a> <em class="jxr_comment"> }</em> +<a name="146" href="#146" id="146">146</a> +<a name="147" href="#147" id="147">147</a> <em class="jxr_comment"> StringBuffer buf = new StringBuffer();</em> +<a name="148" href="#148" id="148">148</a> <em class="jxr_comment"> for (Iterator i = items.iterator(); i.hasNext();) {</em> +<a name="149" href="#149" id="149">149</a> <em class="jxr_comment"> String item = (String) i.next();</em> +<a name="150" href="#150" id="150">150</a> <em class="jxr_comment"> buf.append(item);</em> +<a name="151" href="#151" id="151">151</a> <em class="jxr_comment"> buf.append(",");</em> +<a name="152" href="#152" id="152">152</a> <em class="jxr_comment"> }</em> +<a name="153" href="#153" id="153">153</a> +<a name="154" href="#154" id="154">154</a> <em class="jxr_comment"> buf.deleteCharAt(buf.length() - 1);</em> +<a name="155" href="#155" id="155">155</a> <em class="jxr_comment"> return buf.toString();</em> +<a name="156" href="#156" id="156">156</a> <em class="jxr_comment"> }</em> +<a name="157" href="#157" id="157">157</a> +<a name="158" href="#158" id="158">158</a> <em class="jxr_comment"> private List getAllProductsByTag(Metadata met, String productName,</em> +<a name="159" href="#159" id="159">159</a> <em class="jxr_comment"> String tagType) {</em> +<a name="160" href="#160" id="160">160</a> <em class="jxr_comment"> if (met.containsKey(tagType)) {</em> +<a name="161" href="#161" id="161">161</a> <em class="jxr_comment"> return met.getAllMetadata(tagType);</em> +<a name="162" href="#162" id="162">162</a> <em class="jxr_comment"> }</em> +<a name="163" href="#163" id="163">163</a> +<a name="164" href="#164" id="164">164</a> <em class="jxr_comment"> // assume now that there are no test tags</em> +<a name="165" href="#165" id="165">165</a> <em class="jxr_comment"> // so what we want to do is to query the file catalog</em> +<a name="166" href="#166" id="166">166</a> <em class="jxr_comment"> // for InputFiles:productName and then keep doing this until</em> +<a name="167" href="#167" id="167">167</a> <em class="jxr_comment"> // we get an answer that has test tags: for each test tag (once</em> +<a name="168" href="#168" id="168">168</a> <em class="jxr_comment"> // they are found), we'll collect them in a list</em> +<a name="169" href="#169" id="169">169</a> <em class="jxr_comment"> List tags = new Vector();</em> +<a name="170" href="#170" id="170">170</a> <em class="jxr_comment"> boolean foundTag = false;</em> +<a name="171" href="#171" id="171">171</a> <em class="jxr_comment"> Stack descendants = new Stack();</em> +<a name="172" href="#172" id="172">172</a> <em class="jxr_comment"> descendants.push(productName);</em> +<a name="173" href="#173" id="173">173</a> +<a name="174" href="#174" id="174">174</a> <em class="jxr_comment"> while (!descendants.empty() && !foundTag) {</em> +<a name="175" href="#175" id="175">175</a> <em class="jxr_comment"> String prodName = (String) descendants.pop();</em> +<a name="176" href="#176" id="176">176</a> <em class="jxr_comment"> List products = fm.queryAllTypes(new InputFilesQuery(prodName, fm)</em> +<a name="177" href="#177" id="177">177</a> <em class="jxr_comment"> .buildQuery(), this.conf.getExcludedTypes());</em> +<a name="178" href="#178" id="178">178</a> +<a name="179" href="#179" id="179">179</a> <em class="jxr_comment"> // iterate over all the products</em> +<a name="180" href="#180" id="180">180</a> <em class="jxr_comment"> // get each set of metadata</em> +<a name="181" href="#181" id="181">181</a> <em class="jxr_comment"> // if you find one tag, then set foundTag = true, and we</em> +<a name="182" href="#182" id="182">182</a> <em class="jxr_comment"> // break</em> +<a name="183" href="#183" id="183">183</a> <em class="jxr_comment"> if (products != null && products.size() > 0) {</em> +<a name="184" href="#184" id="184">184</a> <em class="jxr_comment"> for (Iterator i = products.iterator(); i.hasNext();) {</em> +<a name="185" href="#185" id="185">185</a> <em class="jxr_comment"> Product prod = (Product) i.next();</em> +<a name="186" href="#186" id="186">186</a> <em class="jxr_comment"> Metadata prodMet = fm.safeGetMetadata(prod);</em> +<a name="187" href="#187" id="187">187</a> +<a name="188" href="#188" id="188">188</a> <em class="jxr_comment"> if (prodMet.containsKey(tagType)) {</em> +<a name="189" href="#189" id="189">189</a> <em class="jxr_comment"> // got one, done</em> +<a name="190" href="#190" id="190">190</a> <em class="jxr_comment"> if (!foundTag)</em> +<a name="191" href="#191" id="191">191</a> <em class="jxr_comment"> foundTag = true;</em> +<a name="192" href="#192" id="192">192</a> <em class="jxr_comment"> if (!tags.contains(prodMet.getMetadata(tagType))) {</em> +<a name="193" href="#193" id="193">193</a> <em class="jxr_comment"> tags.add(prodMet.getMetadata(tagType));</em> +<a name="194" href="#194" id="194">194</a> <em class="jxr_comment"> }</em> +<a name="195" href="#195" id="195">195</a> <em class="jxr_comment"> }</em> +<a name="196" href="#196" id="196">196</a> <em class="jxr_comment"> }</em> +<a name="197" href="#197" id="197">197</a> +<a name="198" href="#198" id="198">198</a> <em class="jxr_comment"> if (!foundTag) {</em> +<a name="199" href="#199" id="199">199</a> <em class="jxr_comment"> // continue the search</em> +<a name="200" href="#200" id="200">200</a> <em class="jxr_comment"> descendants.addAll(FileManagerUtils.toProductNameList(products));</em> +<a name="201" href="#201" id="201">201</a> <em class="jxr_comment"> }</em> +<a name="202" href="#202" id="202">202</a> <em class="jxr_comment"> }</em> +<a name="203" href="#203" id="203">203</a> <em class="jxr_comment"> }</em> +<a name="204" href="#204" id="204">204</a> +<a name="205" href="#205" id="205">205</a> <em class="jxr_comment"> return tags;</em> +<a name="206" href="#206" id="206">206</a> <em class="jxr_comment"> }</em> +<a name="207" href="#207" id="207">207</a> +<a name="208" href="#208" id="208">208</a> <em class="jxr_comment">}</em> +</pre> +<hr /><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body></html> \ No newline at end of file
Added: oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/PCSTrace.html URL: http://svn.apache.org/viewvc/oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/PCSTrace.html?rev=1079660&view=auto ============================================================================== --- oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/PCSTrace.html (added) +++ oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/PCSTrace.html Wed Mar 9 04:02:09 2011 @@ -0,0 +1,258 @@ +<?xml version='1.0' encoding='utf-8'?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xml:lang="en"><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>PCSTrace xref</title><link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" /></head><body> +<div id="overview"><a href="../../../../../../apidocs/org/apache/oodt/pcs/tools/PCSTrace.html">View Javadoc</a></div><pre> + +<a name="1" href="#1" id="1">1</a> <em class="jxr_javadoccomment">/**</em> +<a name="2" href="#2" id="2">2</a> <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one or more</em> +<a name="3" href="#3" id="3">3</a> <em class="jxr_javadoccomment"> * contributor license agreements. See the NOTICE file distributed with</em> +<a name="4" href="#4" id="4">4</a> <em class="jxr_javadoccomment"> * this work for additional information regarding copyright ownership.</em> +<a name="5" href="#5" id="5">5</a> <em class="jxr_javadoccomment"> * The ASF licenses this file to You under the Apache License, Version 2.0</em> +<a name="6" href="#6" id="6">6</a> <em class="jxr_javadoccomment"> * (the "License"); you may not use this file except in compliance with</em> +<a name="7" href="#7" id="7">7</a> <em class="jxr_javadoccomment"> * the License. You may obtain a copy of the License at</em> +<a name="8" href="#8" id="8">8</a> <em class="jxr_javadoccomment"> *</em> +<a name="9" href="#9" id="9">9</a> <em class="jxr_javadoccomment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em> +<a name="10" href="#10" id="10">10</a> <em class="jxr_javadoccomment"> *</em> +<a name="11" href="#11" id="11">11</a> <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing, software</em> +<a name="12" href="#12" id="12">12</a> <em class="jxr_javadoccomment"> * distributed under the License is distributed on an "AS IS" BASIS,</em> +<a name="13" href="#13" id="13">13</a> <em class="jxr_javadoccomment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em> +<a name="14" href="#14" id="14">14</a> <em class="jxr_javadoccomment"> * See the License for the specific language governing permissions and</em> +<a name="15" href="#15" id="15">15</a> <em class="jxr_javadoccomment"> * limitations under the License.</em> +<a name="16" href="#16" id="16">16</a> <em class="jxr_javadoccomment"> */</em> +<a name="17" href="#17" id="17">17</a> +<a name="18" href="#18" id="18">18</a> <strong class="jxr_keyword">package</strong> org.apache.oodt.pcs.tools; +<a name="19" href="#19" id="19">19</a> +<a name="20" href="#20" id="20">20</a> <em class="jxr_comment">//JDK imports</em> +<a name="21" href="#21" id="21">21</a> <strong class="jxr_keyword">import</strong> java.net.URL; +<a name="22" href="#22" id="22">22</a> <strong class="jxr_keyword">import</strong> java.util.Arrays; +<a name="23" href="#23" id="23">23</a> <strong class="jxr_keyword">import</strong> java.util.Iterator; +<a name="24" href="#24" id="24">24</a> <strong class="jxr_keyword">import</strong> java.util.List; +<a name="25" href="#25" id="25">25</a> +<a name="26" href="#26" id="26">26</a> <em class="jxr_comment">//OODT imports</em> +<a name="27" href="#27" id="27">27</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.metadata.PCSConfigMetadata; +<a name="28" href="#28" id="28">28</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.metadata.PCSMetadata; +<a name="29" href="#29" id="29">29</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.pedigree.Pedigree; +<a name="30" href="#30" id="30">30</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.pedigree.PedigreeTree; +<a name="31" href="#31" id="31">31</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.util.FileManagerUtils; +<a name="32" href="#32" id="32">32</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.pcs.util.WorkflowManagerUtils; +<a name="33" href="#33" id="33">33</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.structs.Product; +<a name="34" href="#34" id="34">34</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.metadata.Metadata; +<a name="35" href="#35" id="35">35</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.workflow.structs.WorkflowInstance; +<a name="36" href="#36" id="36">36</a> +<a name="37" href="#37" id="37">37</a> <em class="jxr_javadoccomment">/**</em> +<a name="38" href="#38" id="38">38</a> <em class="jxr_javadoccomment"> * </em> +<a name="39" href="#39" id="39">39</a> <em class="jxr_javadoccomment"> * A program to trace the history of a particular PCS product.</em> +<a name="40" href="#40" id="40">40</a> <em class="jxr_javadoccomment"> * </em> +<a name="41" href="#41" id="41">41</a> <em class="jxr_javadoccomment"> * @author mattmann</em> +<a name="42" href="#42" id="42">42</a> <em class="jxr_javadoccomment"> * @version $Revision$</em> +<a name="43" href="#43" id="43">43</a> <em class="jxr_javadoccomment"> * </em> +<a name="44" href="#44" id="44">44</a> <em class="jxr_javadoccomment"> */</em> +<a name="45" href="#45" id="45">45</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../org/apache/oodt/pcs/tools/PCSTrace.html">PCSTrace</a> implements PCSMetadata, <a href="../../../../../org/apache/oodt/pcs/metadata/PCSConfigMetadata.html">PCSConfigMetadata</a> { +<a name="46" href="#46" id="46">46</a> +<a name="47" href="#47" id="47">47</a> <em class="jxr_comment">/*<em class="jxr_comment"> our interface to the file manager */</em></em> +<a name="48" href="#48" id="48">48</a> <strong class="jxr_keyword">private</strong> <a href="../../../../../org/apache/oodt/pcs/util/FileManagerUtils.html">FileManagerUtils</a> fm; +<a name="49" href="#49" id="49">49</a> +<a name="50" href="#50" id="50">50</a> <em class="jxr_comment">/*<em class="jxr_comment"> our interface to the workflow manager */</em></em> +<a name="51" href="#51" id="51">51</a> <strong class="jxr_keyword">private</strong> <a href="../../../../../org/apache/oodt/pcs/util/WorkflowManagerUtils.html">WorkflowManagerUtils</a> wm; +<a name="52" href="#52" id="52">52</a> +<a name="53" href="#53" id="53">53</a> <em class="jxr_comment">/*<em class="jxr_comment"> whether or not we should list non-cataloged products in pedigree */</em></em> +<a name="54" href="#54" id="54">54</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> listNotCataloged = false; +<a name="55" href="#55" id="55">55</a> +<a name="56" href="#56" id="56">56</a> <em class="jxr_comment">/*<em class="jxr_comment"> exclude list */</em></em> +<a name="57" href="#57" id="57">57</a> <strong class="jxr_keyword">private</strong> List excludeTypeList; +<a name="58" href="#58" id="58">58</a> +<a name="59" href="#59" id="59">59</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String REPORT_LINE_SEPARATOR = <span class="jxr_string">"-------------------------------------------------- "</span>; +<a name="60" href="#60" id="60">60</a> +<a name="61" href="#61" id="61">61</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/oodt/pcs/tools/PCSTrace.html">PCSTrace</a>(URL wmgrUrl, URL fmUrl) { +<a name="62" href="#62" id="62">62</a> fm = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/oodt/pcs/util/FileManagerUtils.html">FileManagerUtils</a>(fmUrl); +<a name="63" href="#63" id="63">63</a> wm = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/oodt/pcs/util/WorkflowManagerUtils.html">WorkflowManagerUtils</a>(wmgrUrl); +<a name="64" href="#64" id="64">64</a> } +<a name="65" href="#65" id="65">65</a> +<a name="66" href="#66" id="66">66</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/oodt/pcs/tools/PCSTrace.html">PCSTrace</a>(String wmgrUrlStr, String fmUrlStr) { +<a name="67" href="#67" id="67">67</a> <strong class="jxr_keyword">this</strong>(FileManagerUtils.safeGetUrlFromString(wmgrUrlStr), <a href="../../../../../org/apache/oodt/pcs/util/FileManagerUtils.html">FileManagerUtils</a> +<a name="68" href="#68" id="68">68</a> .safeGetUrlFromString(fmUrlStr)); +<a name="69" href="#69" id="69">69</a> } +<a name="70" href="#70" id="70">70</a> +<a name="71" href="#71" id="71">71</a> <em class="jxr_javadoccomment">/**</em> +<a name="72" href="#72" id="72">72</a> <em class="jxr_javadoccomment"> * @param excludeTypeList</em> +<a name="73" href="#73" id="73">73</a> <em class="jxr_javadoccomment"> * the excludeTypeList to set</em> +<a name="74" href="#74" id="74">74</a> <em class="jxr_javadoccomment"> */</em> +<a name="75" href="#75" id="75">75</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setExcludeTypeList(List excludeTypeList) { +<a name="76" href="#76" id="76">76</a> <strong class="jxr_keyword">this</strong>.excludeTypeList = excludeTypeList; +<a name="77" href="#77" id="77">77</a> } +<a name="78" href="#78" id="78">78</a> +<a name="79" href="#79" id="79">79</a> <em class="jxr_javadoccomment">/**</em> +<a name="80" href="#80" id="80">80</a> <em class="jxr_javadoccomment"> * @return the excludeTypeList</em> +<a name="81" href="#81" id="81">81</a> <em class="jxr_javadoccomment"> */</em> +<a name="82" href="#82" id="82">82</a> <strong class="jxr_keyword">public</strong> List getExcludeTypeList() { +<a name="83" href="#83" id="83">83</a> <strong class="jxr_keyword">return</strong> excludeTypeList; +<a name="84" href="#84" id="84">84</a> } +<a name="85" href="#85" id="85">85</a> +<a name="86" href="#86" id="86">86</a> <em class="jxr_javadoccomment">/**</em> +<a name="87" href="#87" id="87">87</a> <em class="jxr_javadoccomment"> * Outputs a trace report in the following format:</em> +<a name="88" href="#88" id="88">88</a> <em class="jxr_javadoccomment"> * </em> +<a name="89" href="#89" id="89">89</a> <em class="jxr_javadoccomment"> * Product Name: <i>oco_L1aRad09088_0939838838.hdf</i></em> +<a name="90" href="#90" id="90">90</a> <em class="jxr_javadoccomment"> * -------------------------------------------------- Location:</em> +<a name="91" href="#91" id="91">91</a> <em class="jxr_javadoccomment"> * /preflt/jpl/Rad/9088/l1a/oco_L1aRad09088_0939838838.hdf</em> +<a name="92" href="#92" id="92">92</a> <em class="jxr_javadoccomment"> * </em> +<a name="93" href="#93" id="93">93</a> <em class="jxr_javadoccomment"> * Metadata:</em> +<a name="94" href="#94" id="94">94</a> <em class="jxr_javadoccomment"> * </em> +<a name="95" href="#95" id="95">95</a> <em class="jxr_javadoccomment"> * &lt;Met Field Name&gt; =&gt; &lt;Met Field Value&gt; &lt;Met Field</em> +<a name="96" href="#96" id="96">96</a> <em class="jxr_javadoccomment"> * Name2&gt; =&gt; &lt;Met Field Value2&gt;</em> +<a name="97" href="#97" id="97">97</a> <em class="jxr_javadoccomment"> * </em> +<a name="98" href="#98" id="98">98</a> <em class="jxr_javadoccomment"> * --------------------------------------------------- Generated from</em> +<a name="99" href="#99" id="99">99</a> <em class="jxr_javadoccomment"> * workflows:</em> +<a name="100" href="#100" id="100">100</a> <em class="jxr_javadoccomment"> * </em> +<a name="101" href="#101" id="101">101</a> <em class="jxr_javadoccomment"> * CPT Pipeline: ID: [99299-add99-92983-9d9d9-0099d] State: FINISHED</em> +<a name="102" href="#102" id="102">102</a> <em class="jxr_javadoccomment"> * Associated products:</em> +<a name="103" href="#103" id="103">103</a> <em class="jxr_javadoccomment"> * </em> +<a name="104" href="#104" id="104">104</a> <em class="jxr_javadoccomment"> * oco_RawL017_93983993938.pkt oco_RawL032_93939388383.pkt</em> +<a name="105" href="#105" id="105">105</a> <em class="jxr_javadoccomment"> * oco_RawL033_93838383838.pkt oco_RawL034_93938378585.pkt</em> +<a name="106" href="#106" id="106">106</a> <em class="jxr_javadoccomment"> * </em> +<a name="107" href="#107" id="107">107</a> <em class="jxr_javadoccomment"> * --------------------------------------------------- Full lineage:</em> +<a name="108" href="#108" id="108">108</a> <em class="jxr_javadoccomment"> * </em> +<a name="109" href="#109" id="109">109</a> <em class="jxr_javadoccomment"> * Upstream: CPTOverview_98383388d.txt=&gt;oco_RawL017_93983993938.pkt=&gt;</em> +<a name="110" href="#110" id="110">110</a> <em class="jxr_javadoccomment"> * oco_RawL032_93939388383</em> +<a name="111" href="#111" id="111">111</a> <em class="jxr_javadoccomment"> * .pkt=&gt;oco_RawL033_93838383838.pkt=&gt;oco_RawL034_93938378585.pkt</em> +<a name="112" href="#112" id="112">112</a> <em class="jxr_javadoccomment"> * </em> +<a name="113" href="#113" id="113">113</a> <em class="jxr_javadoccomment"> * Downstream: oco_L1BRad_19889_983838383.hdf</em> +<a name="114" href="#114" id="114">114</a> <em class="jxr_javadoccomment"> * ---------------------------------------------------</em> +<a name="115" href="#115" id="115">115</a> <em class="jxr_javadoccomment"> * </em> +<a name="116" href="#116" id="116">116</a> <em class="jxr_javadoccomment"> * </em> +<a name="117" href="#117" id="117">117</a> <em class="jxr_javadoccomment"> * @param productName</em> +<a name="118" href="#118" id="118">118</a> <em class="jxr_javadoccomment"> * The name of the product to trace lineage for.</em> +<a name="119" href="#119" id="119">119</a> <em class="jxr_javadoccomment"> */</em> +<a name="120" href="#120" id="120">120</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> doTrace(String productName) { +<a name="121" href="#121" id="121">121</a> +<a name="122" href="#122" id="122">122</a> <a href="../../../../../org/apache/oodt/cas/filemgr/structs/Product.html">Product</a> prod = fm.safeGetProductByName(productName); +<a name="123" href="#123" id="123">123</a> +<a name="124" href="#124" id="124">124</a> <a href="../../../../../org/apache/oodt/pcs/pedigree/Pedigree.html">Pedigree</a> pedigree = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/oodt/pcs/pedigree/Pedigree.html">Pedigree</a>(fm, <strong class="jxr_keyword">this</strong>.listNotCataloged, +<a name="125" href="#125" id="125">125</a> <strong class="jxr_keyword">this</strong>.excludeTypeList); +<a name="126" href="#126" id="126">126</a> +<a name="127" href="#127" id="127">127</a> System.out.println(<span class="jxr_string">""</span>); +<a name="128" href="#128" id="128">128</a> System.out.println(REPORT_LINE_SEPARATOR); +<a name="129" href="#129" id="129">129</a> System.out.println(<span class="jxr_string">"Product: "</span> + prod.getProductName()); +<a name="130" href="#130" id="130">130</a> System.out.println(REPORT_LINE_SEPARATOR); +<a name="131" href="#131" id="131">131</a> +<a name="132" href="#132" id="132">132</a> prod.setProductReferences(fm.safeGetProductReferences(prod)); +<a name="133" href="#133" id="133">133</a> System.out.println(<span class="jxr_string">"Location: "</span> + fm.getFilePath(prod)); +<a name="134" href="#134" id="134">134</a> System.out.println(REPORT_LINE_SEPARATOR); +<a name="135" href="#135" id="135">135</a> System.out.println(<span class="jxr_string">"Metadata: "</span>); +<a name="136" href="#136" id="136">136</a> <a href="../../../../../org/apache/oodt/cas/metadata/Metadata.html">Metadata</a> met = fm.safeGetMetadata(prod); +<a name="137" href="#137" id="137">137</a> <strong class="jxr_keyword">if</strong> (met != <strong class="jxr_keyword">null</strong> && met.getHashtable() != <strong class="jxr_keyword">null</strong> +<a name="138" href="#138" id="138">138</a> && met.getHashtable().keySet().size() > 0) { +<a name="139" href="#139" id="139">139</a> <strong class="jxr_keyword">for</strong> (Iterator i = met.getHashtable().keySet().iterator(); i.hasNext();) { +<a name="140" href="#140" id="140">140</a> String key = (String) i.next(); +<a name="141" href="#141" id="141">141</a> List vals = met.getAllMetadata(key); +<a name="142" href="#142" id="142">142</a> System.out.println(key + <span class="jxr_string">"=>"</span> + vals); +<a name="143" href="#143" id="143">143</a> } +<a name="144" href="#144" id="144">144</a> } +<a name="145" href="#145" id="145">145</a> +<a name="146" href="#146" id="146">146</a> System.out.println(REPORT_LINE_SEPARATOR); +<a name="147" href="#147" id="147">147</a> System.out.println(<span class="jxr_string">"Generated from workflow:"</span>); +<a name="148" href="#148" id="148">148</a> System.out.println(<span class="jxr_string">""</span>); +<a name="149" href="#149" id="149">149</a> <a href="../../../../../org/apache/oodt/cas/workflow/structs/WorkflowInstance.html">WorkflowInstance</a> inst = <strong class="jxr_keyword">null</strong>; +<a name="150" href="#150" id="150">150</a> +<a name="151" href="#151" id="151">151</a> <strong class="jxr_keyword">try</strong> { +<a name="152" href="#152" id="152">152</a> inst = getWorkflowInstanceById(wm.safeGetWorkflowInstances(), met +<a name="153" href="#153" id="153">153</a> .getMetadata(JOB_ID)); +<a name="154" href="#154" id="154">154</a> +<a name="155" href="#155" id="155">155</a> System.out.println(inst.getWorkflow().getName() + <span class="jxr_string">": ID: ["</span> +<a name="156" href="#156" id="156">156</a> + inst.getId() + <span class="jxr_string">"]"</span>); +<a name="157" href="#157" id="157">157</a> System.out.println(<span class="jxr_string">"Status: "</span> + inst.getStatus()); +<a name="158" href="#158" id="158">158</a> List wInstProds = pedigree.getWorkflowInstProds(inst.getId()); +<a name="159" href="#159" id="159">159</a> <strong class="jxr_keyword">if</strong> (wInstProds != <strong class="jxr_keyword">null</strong> && wInstProds.size() > 0) { +<a name="160" href="#160" id="160">160</a> System.out.println(<span class="jxr_string">"Associated products:"</span>); +<a name="161" href="#161" id="161">161</a> System.out.println(<span class="jxr_string">""</span>); +<a name="162" href="#162" id="162">162</a> <strong class="jxr_keyword">for</strong> (Iterator i = wInstProds.iterator(); i.hasNext();) { +<a name="163" href="#163" id="163">163</a> <a href="../../../../../org/apache/oodt/cas/filemgr/structs/Product.html">Product</a> wInstProd = (Product) i.next(); +<a name="164" href="#164" id="164">164</a> System.out.println(wInstProd.getProductName()); +<a name="165" href="#165" id="165">165</a> } +<a name="166" href="#166" id="166">166</a> } +<a name="167" href="#167" id="167">167</a> } <strong class="jxr_keyword">catch</strong> (Exception e) { +<a name="168" href="#168" id="168">168</a> System.out.println(<span class="jxr_string">"Unable to obtain workflow instance for product!"</span>); +<a name="169" href="#169" id="169">169</a> } +<a name="170" href="#170" id="170">170</a> +<a name="171" href="#171" id="171">171</a> System.out.println(REPORT_LINE_SEPARATOR); +<a name="172" href="#172" id="172">172</a> System.out.println(<span class="jxr_string">"Full lineage:"</span>); +<a name="173" href="#173" id="173">173</a> System.out.println(<span class="jxr_string">""</span>); +<a name="174" href="#174" id="174">174</a> System.out.println(<span class="jxr_string">"Downstream:"</span>); +<a name="175" href="#175" id="175">175</a> +<a name="176" href="#176" id="176">176</a> <a href="../../../../../org/apache/oodt/pcs/pedigree/PedigreeTree.html">PedigreeTree</a> downstreamLineageTree = pedigree.doPedigree(prod, false); +<a name="177" href="#177" id="177">177</a> downstreamLineageTree.printPedigreeTree(); +<a name="178" href="#178" id="178">178</a> +<a name="179" href="#179" id="179">179</a> System.out.println(<span class="jxr_string">""</span>); +<a name="180" href="#180" id="180">180</a> System.out.println(<span class="jxr_string">"Upstream:"</span>); +<a name="181" href="#181" id="181">181</a> <a href="../../../../../org/apache/oodt/pcs/pedigree/PedigreeTree.html">PedigreeTree</a> upstreamLineageTree = pedigree.doPedigree(prod, <strong class="jxr_keyword">true</strong>); +<a name="182" href="#182" id="182">182</a> upstreamLineageTree.printPedigreeTree(); +<a name="183" href="#183" id="183">183</a> +<a name="184" href="#184" id="184">184</a> } +<a name="185" href="#185" id="185">185</a> +<a name="186" href="#186" id="186">186</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> enableNonCatalogProductsInPed() { +<a name="187" href="#187" id="187">187</a> <strong class="jxr_keyword">this</strong>.listNotCataloged = <strong class="jxr_keyword">true</strong>; +<a name="188" href="#188" id="188">188</a> } +<a name="189" href="#189" id="189">189</a> +<a name="190" href="#190" id="190">190</a> <em class="jxr_javadoccomment">/**</em> +<a name="191" href="#191" id="191">191</a> <em class="jxr_javadoccomment"> * </em> +<a name="192" href="#192" id="192">192</a> <em class="jxr_javadoccomment"> * @param args</em> +<a name="193" href="#193" id="193">193</a> <em class="jxr_javadoccomment"> * @throws Exception</em> +<a name="194" href="#194" id="194">194</a> <em class="jxr_javadoccomment"> */</em> +<a name="195" href="#195" id="195">195</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> main(String[] args) <strong class="jxr_keyword">throws</strong> Exception { +<a name="196" href="#196" id="196">196</a> String productName = <strong class="jxr_keyword">null</strong>; +<a name="197" href="#197" id="197">197</a> String workflowUrlStr = <strong class="jxr_keyword">null</strong>, filemgrUrlStr = <strong class="jxr_keyword">null</strong>; +<a name="198" href="#198" id="198">198</a> <strong class="jxr_keyword">boolean</strong> enableNotCat = false; +<a name="199" href="#199" id="199">199</a> List exList = <strong class="jxr_keyword">null</strong>; +<a name="200" href="#200" id="200">200</a> +<a name="201" href="#201" id="201">201</a> String usage = <span class="jxr_string">"PCSTrace --fm <url> --wm <url> --product <name> "</span> +<a name="202" href="#202" id="202">202</a> + <span class="jxr_string">" [--enableNonCat] [--exclude <type name 1>,<type name 2>...,<type name n>]\n"</span>; +<a name="203" href="#203" id="203">203</a> +<a name="204" href="#204" id="204">204</a> <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i < args.length; i++) { +<a name="205" href="#205" id="205">205</a> <strong class="jxr_keyword">if</strong> (args[i].equals(<span class="jxr_string">"--fm"</span>)) { +<a name="206" href="#206" id="206">206</a> filemgrUrlStr = args[++i]; +<a name="207" href="#207" id="207">207</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (args[i].equals(<span class="jxr_string">"--wm"</span>)) { +<a name="208" href="#208" id="208">208</a> workflowUrlStr = args[++i]; +<a name="209" href="#209" id="209">209</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (args[i].equals(<span class="jxr_string">"--product"</span>)) { +<a name="210" href="#210" id="210">210</a> productName = args[++i]; +<a name="211" href="#211" id="211">211</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (args[i].equals(<span class="jxr_string">"--enableNonCat"</span>)) { +<a name="212" href="#212" id="212">212</a> enableNotCat = <strong class="jxr_keyword">true</strong>; +<a name="213" href="#213" id="213">213</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (args[i].equals(<span class="jxr_string">"--exclude"</span>)) { +<a name="214" href="#214" id="214">214</a> String[] excludeTypes = args[++i].split(<span class="jxr_string">","</span>); +<a name="215" href="#215" id="215">215</a> exList = Arrays.asList(excludeTypes); +<a name="216" href="#216" id="216">216</a> } +<a name="217" href="#217" id="217">217</a> +<a name="218" href="#218" id="218">218</a> } +<a name="219" href="#219" id="219">219</a> +<a name="220" href="#220" id="220">220</a> <strong class="jxr_keyword">if</strong> (productName == <strong class="jxr_keyword">null</strong> || workflowUrlStr == <strong class="jxr_keyword">null</strong> || filemgrUrlStr == <strong class="jxr_keyword">null</strong>) { +<a name="221" href="#221" id="221">221</a> System.err.println(usage); +<a name="222" href="#222" id="222">222</a> System.exit(1); +<a name="223" href="#223" id="223">223</a> } +<a name="224" href="#224" id="224">224</a> +<a name="225" href="#225" id="225">225</a> <a href="../../../../../org/apache/oodt/pcs/tools/PCSTrace.html">PCSTrace</a> tracer = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/oodt/pcs/tools/PCSTrace.html">PCSTrace</a>(workflowUrlStr, filemgrUrlStr); +<a name="226" href="#226" id="226">226</a> <strong class="jxr_keyword">if</strong> (enableNotCat) { +<a name="227" href="#227" id="227">227</a> tracer.enableNonCatalogProductsInPed(); +<a name="228" href="#228" id="228">228</a> } +<a name="229" href="#229" id="229">229</a> <strong class="jxr_keyword">if</strong> (exList != <strong class="jxr_keyword">null</strong>) { +<a name="230" href="#230" id="230">230</a> tracer.setExcludeTypeList(exList); +<a name="231" href="#231" id="231">231</a> } +<a name="232" href="#232" id="232">232</a> tracer.doTrace(productName); +<a name="233" href="#233" id="233">233</a> +<a name="234" href="#234" id="234">234</a> } +<a name="235" href="#235" id="235">235</a> +<a name="236" href="#236" id="236">236</a> <strong class="jxr_keyword">private</strong> <a href="../../../../../org/apache/oodt/cas/workflow/structs/WorkflowInstance.html">WorkflowInstance</a> getWorkflowInstanceById(List insts, String id) { +<a name="237" href="#237" id="237">237</a> <strong class="jxr_keyword">if</strong> (insts == <strong class="jxr_keyword">null</strong>) { +<a name="238" href="#238" id="238">238</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>; +<a name="239" href="#239" id="239">239</a> } +<a name="240" href="#240" id="240">240</a> +<a name="241" href="#241" id="241">241</a> <strong class="jxr_keyword">for</strong> (Iterator i = insts.iterator(); i.hasNext();) { +<a name="242" href="#242" id="242">242</a> <a href="../../../../../org/apache/oodt/cas/workflow/structs/WorkflowInstance.html">WorkflowInstance</a> inst = (WorkflowInstance) i.next(); +<a name="243" href="#243" id="243">243</a> <strong class="jxr_keyword">if</strong> (inst.getId().equals(id)) { +<a name="244" href="#244" id="244">244</a> <strong class="jxr_keyword">return</strong> inst; +<a name="245" href="#245" id="245">245</a> } +<a name="246" href="#246" id="246">246</a> } +<a name="247" href="#247" id="247">247</a> +<a name="248" href="#248" id="248">248</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>; +<a name="249" href="#249" id="249">249</a> } +<a name="250" href="#250" id="250">250</a> +<a name="251" href="#251" id="251">251</a> } +</pre> +<hr /><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body></html> \ No newline at end of file Added: oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/package-frame.html URL: http://svn.apache.org/viewvc/oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/package-frame.html?rev=1079660&view=auto ============================================================================== --- oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/package-frame.html (added) +++ oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/package-frame.html Wed Mar 9 04:02:09 2011 @@ -0,0 +1,20 @@ +<?xml version='1.0' encoding='utf-8'?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xml:lang="en"><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>Apache OODT 0.3-SNAPSHOT Reference Package org.apache.oodt.pcs.tools</title><link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" /></head><body> + + <h3> + <a href="package-summary.html" target="classFrame">org.apache.oodt.pcs.tools</a> + </h3> + + <h3>Classes</h3> + + <ul><li> + <a href="PCSHealthMonitor.html" target="classFrame">PCSHealthMonitor</a> + </li> + <li> + <a href="PCSLongLister.html" target="classFrame">PCSLongLister</a> + </li> + <li> + <a href="PCSTrace.html" target="classFrame">PCSTrace</a> + </li> + </ul></body></html> \ No newline at end of file Added: oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/package-summary.html URL: http://svn.apache.org/viewvc/oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/package-summary.html?rev=1079660&view=auto ============================================================================== --- oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/package-summary.html (added) +++ oodt/site/components/maven/xref/org/apache/oodt/pcs/tools/package-summary.html Wed Mar 9 04:02:09 2011 @@ -0,0 +1,47 @@ +<?xml version='1.0' encoding='utf-8'?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xml:lang="en"><head><meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /><title>Apache OODT 0.3-SNAPSHOT Reference Package org.apache.oodt.pcs.tools</title><link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="style" /></head><body> + <div class="overview"> + <ul><li> + <a href="../../../../../overview-summary.html">Overview</a> + </li> + <li class="selected">Package</li> + </ul></div> + <div class="framenoframe"> + <ul><li> + <a href="../../../../../index.html" target="_top">FRAMES</a> + </li> + <li> + <a href="package-summary.html" target="_top">NO FRAMES</a> + </li> + </ul></div> + + <h2>Package org.apache.oodt.pcs.tools</h2> + + <table class="summary"><thead><tr><th>Class Summary</th> + </tr></thead><tbody><tr><td> + <a href="PCSHealthMonitor.html" target="classFrame">PCSHealthMonitor</a> + </td> + </tr><tr><td> + <a href="PCSLongLister.html" target="classFrame">PCSLongLister</a> + </td> + </tr><tr><td> + <a href="PCSTrace.html" target="classFrame">PCSTrace</a> + </td> + </tr></tbody></table><div class="overview"> + <ul><li> + <a href="../../../../../overview-summary.html">Overview</a> + </li> + <li class="selected">Package</li> + </ul></div> + <div class="framenoframe"> + <ul><li> + <a href="../../../../../index.html" target="_top">FRAMES</a> + </li> + <li> + <a href="package-summary.html" target="_top">NO FRAMES</a> + </li> + </ul></div> + <hr /> + Copyright © 1999-2011 Apache OODT. All Rights Reserved. + </body></html> \ No newline at end of file
