You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2010/09/24 07:09:57 UTC
svn commit: r1000710 [37/44] - in /incubator/oodt/site/components/maven:
apidocs/org/apache/oodt/grid/ apidocs/org/apache/oodt/grid/class-use/
apidocs/org/apache/oodt/profile/handlers/cas/
apidocs/org/apache/oodt/profile/handlers/cas/class-use/ apidocs...
Added: incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProductQueryServlet.html
URL: http://svn.apache.org/viewvc/incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProductQueryServlet.html?rev=1000710&view=auto
==============================================================================
--- incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProductQueryServlet.html (added)
+++ incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProductQueryServlet.html Fri Sep 24 05:09:48 2010
@@ -0,0 +1,191 @@
+<?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>ProductQueryServlet xref</title><link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" /></head><body>
+<div id="overview"><a href="../../../../../apidocs/org/apache/oodt/grid/ProductQueryServlet.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.grid;
+<a name="19" href="#19" id="19">19</a>
+<a name="20" href="#20" id="20">20</a> <strong class="jxr_keyword">import</strong> java.io.BufferedInputStream;
+<a name="21" href="#21" id="21">21</a> <strong class="jxr_keyword">import</strong> java.io.IOException;
+<a name="22" href="#22" id="22">22</a> <strong class="jxr_keyword">import</strong> java.util.Iterator;
+<a name="23" href="#23" id="23">23</a> <strong class="jxr_keyword">import</strong> java.util.List;
+<a name="24" href="#24" id="24">24</a> <strong class="jxr_keyword">import</strong> javax.servlet.ServletException;
+<a name="25" href="#25" id="25">25</a> <strong class="jxr_keyword">import</strong> javax.servlet.http.HttpServletRequest;
+<a name="26" href="#26" id="26">26</a> <strong class="jxr_keyword">import</strong> javax.servlet.http.HttpServletResponse;
+<a name="27" href="#27" id="27">27</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.product.LargeProductQueryHandler;
+<a name="28" href="#28" id="28">28</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.product.ProductException;
+<a name="29" href="#29" id="29">29</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.product.QueryHandler;
+<a name="30" href="#30" id="30">30</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.product.Retriever;
+<a name="31" href="#31" id="31">31</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.xmlquery.LargeResult;
+<a name="32" href="#32" id="32">32</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.xmlquery.Result;
+<a name="33" href="#33" id="33">33</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.xmlquery.XMLQuery;
+<a name="34" href="#34" id="34">34</a>
+<a name="35" href="#35" id="35">35</a>
+<a name="36" href="#36" id="36">36</a> <em class="jxr_javadoccomment">/**</em>
+<a name="37" href="#37" id="37">37</a> <em class="jxr_javadoccomment"> * Product query servlet handles product queries. It always returns the first matching</em>
+<a name="38" href="#38" id="38">38</a> <em class="jxr_javadoccomment"> * product, if any. If no handler can provide a product, it returns 404 Not Found. If</em>
+<a name="39" href="#39" id="39">39</a> <em class="jxr_javadoccomment"> * there are no query handlers, it returns 404 Not Found.</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"> */</em>
+<a name="42" href="#42" id="42">42</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/oodt/grid/ProductQueryServlet.html">ProductQueryServlet</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/oodt/grid/QueryServlet.html">QueryServlet</a> {
+<a name="43" href="#43" id="43">43</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> {@inheritDoc} */</em>
+<a name="44" href="#44" id="44">44</a> <strong class="jxr_keyword">protected</strong> List getServers(<a href="../../../../org/apache/oodt/grid/Configuration.html">Configuration</a> config) {
+<a name="45" href="#45" id="45">45</a> <strong class="jxr_keyword">return</strong> config.getProductServers();
+<a name="46" href="#46" id="46">46</a> }
+<a name="47" href="#47" id="47">47</a>
+<a name="48" href="#48" id="48">48</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> {@inheritDoc} */</em>
+<a name="49" href="#49" id="49">49</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> handleQuery(<a href="../../../../org/apache/oodt/xmlquery/XMLQuery.html">XMLQuery</a> query, List handlers, HttpServletRequest req, HttpServletResponse res)
+<a name="50" href="#50" id="50">50</a> <strong class="jxr_keyword">throws</strong> IOException, ServletException {
+<a name="51" href="#51" id="51">51</a> <strong class="jxr_keyword">if</strong> (handlers.isEmpty()) {
+<a name="52" href="#52" id="52">52</a> res.sendError(HttpServletResponse.SC_NOT_FOUND, <span class="jxr_string">"no query handlers available to handle query"</span>);
+<a name="53" href="#53" id="53">53</a> <strong class="jxr_keyword">return</strong>;
+<a name="54" href="#54" id="54">54</a> }
+<a name="55" href="#55" id="55">55</a>
+<a name="56" href="#56" id="56">56</a> <strong class="jxr_keyword">try</strong> { <em class="jxr_comment">// OK, let's try</em>
+<a name="57" href="#57" id="57">57</a> <strong class="jxr_keyword">for</strong> (Iterator i = handlers.iterator(); i.hasNext();) { <em class="jxr_comment">// Try each query handler</em>
+<a name="58" href="#58" id="58">58</a> QueryHandler handler = (QueryHandler) i.next(); <em class="jxr_comment">// Get the query handler</em>
+<a name="59" href="#59" id="59">59</a> query = handler.query(query); <em class="jxr_comment">// Give it the query</em>
+<a name="60" href="#60" id="60">60</a> <strong class="jxr_keyword">if</strong> (!query.getResults().isEmpty()) { <em class="jxr_comment">// Did it give any result?</em>
+<a name="61" href="#61" id="61">61</a> Result result = (Result) query.getResults().get(0); <em class="jxr_comment">// Yes, get the result</em>
+<a name="62" href="#62" id="62">62</a> deliverResult(handler, result, res); <em class="jxr_comment">// And deliver it</em>
+<a name="63" href="#63" id="63">63</a> <strong class="jxr_keyword">return</strong>; <em class="jxr_comment">// Done!</em>
+<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">catch</strong> (ProductException ex) {
+<a name="67" href="#67" id="67">67</a> res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, ex.getMessage());
+<a name="68" href="#68" id="68">68</a> <strong class="jxr_keyword">return</strong>;
+<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> res.sendError(HttpServletResponse.SC_NOT_FOUND, <span class="jxr_string">"no matching products from any query handler"</span>);
+<a name="72" href="#72" id="72">72</a> }
+<a name="73" href="#73" id="73">73</a>
+<a name="74" href="#74" id="74">74</a> <em class="jxr_javadoccomment">/**</em>
+<a name="75" href="#75" id="75">75</a> <em class="jxr_javadoccomment"> * Deliver a result. This streams the product data.</em>
+<a name="76" href="#76" id="76">76</a> <em class="jxr_javadoccomment"> *</em>
+<a name="77" href="#77" id="77">77</a> <em class="jxr_javadoccomment"> * @param handler Which handler produced the result.</em>
+<a name="78" href="#78" id="78">78</a> <em class="jxr_javadoccomment"> * @param result The result.</em>
+<a name="79" href="#79" id="79">79</a> <em class="jxr_javadoccomment"> * @param res The HTTP response to which to send the result data.</em>
+<a name="80" href="#80" id="80">80</a> <em class="jxr_javadoccomment"> * @throws IOException if an error occurs.</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">private</strong> <strong class="jxr_keyword">void</strong> deliverResult(<a href="../../../../org/apache/oodt/product/QueryHandler.html">QueryHandler</a> handler, <a href="../../../../org/apache/oodt/xmlquery/Result.html">Result</a> result, HttpServletResponse res) <strong class="jxr_keyword">throws</strong> IOException {
+<a name="83" href="#83" id="83">83</a> characterize(result, res); <em class="jxr_comment">// First, describe it using HTTP headers</em>
+<a name="84" href="#84" id="84">84</a> <strong class="jxr_keyword">if</strong> (result instanceof LargeResult) { <em class="jxr_comment">// Is it a large result?</em>
+<a name="85" href="#85" id="85">85</a> LargeResult lr = (LargeResult) result; <em class="jxr_comment">// Yes, this is gonna take some special work</em>
+<a name="86" href="#86" id="86">86</a> LargeProductQueryHandler lpqh = (LargeProductQueryHandler) handler; <em class="jxr_comment">// First treat 'em as large</em>
+<a name="87" href="#87" id="87">87</a> ProductRetriever retriever = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/oodt/grid/ProductQueryServlet.html">ProductRetriever</a>(lpqh); <em class="jxr_comment">// Large ones need a retriever</em>
+<a name="88" href="#88" id="88">88</a> lr.setRetriever(retriever); <em class="jxr_comment">// Set the retriever</em>
+<a name="89" href="#89" id="89">89</a> }
+<a name="90" href="#90" id="90">90</a> BufferedInputStream in = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// Start with no input stream</em>
+<a name="91" href="#91" id="91">91</a> <strong class="jxr_keyword">try</strong> { <em class="jxr_comment">// Then try ...</em>
+<a name="92" href="#92" id="92">92</a> in = <strong class="jxr_keyword">new</strong> BufferedInputStream(result.getInputStream()); <em class="jxr_comment">// To open the input stream</em>
+<a name="93" href="#93" id="93">93</a> byte[] buf = <strong class="jxr_keyword">new</strong> byte[512]; <em class="jxr_comment">// And a byte buffer for data</em>
+<a name="94" href="#94" id="94">94</a> <strong class="jxr_keyword">int</strong> num; <em class="jxr_comment">// And a place to count data</em>
+<a name="95" href="#95" id="95">95</a> <strong class="jxr_keyword">while</strong> ((num = in.read(buf)) != -1) <em class="jxr_comment">// While we read</em>
+<a name="96" href="#96" id="96">96</a> res.getOutputStream().write(buf, 0, num); <em class="jxr_comment">// We write</em>
+<a name="97" href="#97" id="97">97</a> } <strong class="jxr_keyword">finally</strong> { <em class="jxr_comment">// And finally</em>
+<a name="98" href="#98" id="98">98</a> <strong class="jxr_keyword">if</strong> (in != <strong class="jxr_keyword">null</strong>) <strong class="jxr_keyword">try</strong> { <em class="jxr_comment">// If we opened it</em>
+<a name="99" href="#99" id="99">99</a> in.close(); <em class="jxr_comment">// Close it</em>
+<a name="100" href="#100" id="100">100</a> } <strong class="jxr_keyword">catch</strong> (IOException ignore) {} <em class="jxr_comment">// Ignoring any error during closing</em>
+<a name="101" href="#101" id="101">101</a> } <em class="jxr_comment">// Because come on, it's just closing!</em>
+<a name="102" href="#102" id="102">102</a> } <em class="jxr_comment">// For fsck's sake!</em>
+<a name="103" href="#103" id="103">103</a>
+<a name="104" href="#104" id="104">104</a> <em class="jxr_javadoccomment">/**</em>
+<a name="105" href="#105" id="105">105</a> <em class="jxr_javadoccomment"> * Characterize a result by using HTTP headers.</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"> * @param result Result to characterize.</em>
+<a name="108" href="#108" id="108">108</a> <em class="jxr_javadoccomment"> * @param res HTTP response to set headers in.</em>
+<a name="109" href="#109" id="109">109</a> <em class="jxr_javadoccomment"> */</em>
+<a name="110" href="#110" id="110">110</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> characterize(<a href="../../../../org/apache/oodt/xmlquery/Result.html">Result</a> result, HttpServletResponse res) {
+<a name="111" href="#111" id="111">111</a> String contentType = result.getMimeType(); <em class="jxr_comment">// Grab the content type</em>
+<a name="112" href="#112" id="112">112</a> res.setContentType(contentType); <em class="jxr_comment">// Set it</em>
+<a name="113" href="#113" id="113">113</a> <strong class="jxr_keyword">long</strong> size = result.getSize(); <em class="jxr_comment">// Grab the size</em>
+<a name="114" href="#114" id="114">114</a> res.addHeader(<span class="jxr_string">"Content-Length"</span>, String.valueOf(size)); <em class="jxr_comment">// Don't use setContentLength(int)</em>
+<a name="115" href="#115" id="115">115</a> <strong class="jxr_keyword">if</strong> (!displayable(contentType)) <em class="jxr_comment">// Finally, if a browser can't show it</em>
+<a name="116" href="#116" id="116">116</a> suggestFilename(result.getResourceID(), res); <em class="jxr_comment">// Then suggest a save-as filename</em>
+<a name="117" href="#117" id="117">117</a> }
+<a name="118" href="#118" id="118">118</a>
+<a name="119" href="#119" id="119">119</a> <em class="jxr_javadoccomment">/**</em>
+<a name="120" href="#120" id="120">120</a> <em class="jxr_javadoccomment"> * Tell if a result is displayable. This compares its MIME type to a list of MIME</em>
+<a name="121" href="#121" id="121">121</a> <em class="jxr_javadoccomment"> * types commonly displayble by browsers.</em>
+<a name="122" href="#122" id="122">122</a> <em class="jxr_javadoccomment"> *</em>
+<a name="123" href="#123" id="123">123</a> <em class="jxr_javadoccomment"> * @param contentType MIME type.</em>
+<a name="124" href="#124" id="124">124</a> <em class="jxr_javadoccomment"> * @return a <code>boolean</code> value.</em>
+<a name="125" href="#125" id="125">125</a> <em class="jxr_javadoccomment"> */</em>
+<a name="126" href="#126" id="126">126</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">boolean</strong> displayable(String contentType) {
+<a name="127" href="#127" id="127">127</a> <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i < DISPLAYABLE_TYPES.length; ++i) <em class="jxr_comment">// For each displayable type</em>
+<a name="128" href="#128" id="128">128</a> <strong class="jxr_keyword">if</strong> (DISPLAYABLE_TYPES[i].equals(contentType)) <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>; <em class="jxr_comment">// Does it match?</em>
+<a name="129" href="#129" id="129">129</a> <strong class="jxr_keyword">return</strong> false; <em class="jxr_comment">// None of 'em do, it's not displayable</em>
+<a name="130" href="#130" id="130">130</a> }
+<a name="131" href="#131" id="131">131</a>
+<a name="132" href="#132" id="132">132</a> <em class="jxr_javadoccomment">/**</em>
+<a name="133" href="#133" id="133">133</a> <em class="jxr_javadoccomment"> * We can suggest a filename (if the client happens to be a browser) using a</em>
+<a name="134" href="#134" id="134">134</a> <em class="jxr_javadoccomment"> * content-disposition header.</em>
+<a name="135" href="#135" id="135">135</a> <em class="jxr_javadoccomment"> *</em>
+<a name="136" href="#136" id="136">136</a> <em class="jxr_javadoccomment"> * @param resource Resource name</em>
+<a name="137" href="#137" id="137">137</a> <em class="jxr_javadoccomment"> * @param res a <code>HttpServletResponse</code> value.</em>
+<a name="138" href="#138" id="138">138</a> <em class="jxr_javadoccomment"> */</em>
+<a name="139" href="#139" id="139">139</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> suggestFilename(String resource, HttpServletResponse res) {
+<a name="140" href="#140" id="140">140</a> <strong class="jxr_keyword">if</strong> (resource == <strong class="jxr_keyword">null</strong> || resource.length() == 0)
+<a name="141" href="#141" id="141">141</a> resource = <span class="jxr_string">"product.dat"</span>;
+<a name="142" href="#142" id="142">142</a> res.addHeader(<span class="jxr_string">"Content-disposition"</span>, <span class="jxr_string">"attachment; filename=\""</span> + resource + <span class="jxr_string">"\""</span>);
+<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> <em class="jxr_javadoccomment">/**</em>
+<a name="146" href="#146" id="146">146</a> <em class="jxr_javadoccomment"> * MIME types commonly displayable by browsers.</em>
+<a name="147" href="#147" id="147">147</a> <em class="jxr_javadoccomment"> */</em>
+<a name="148" href="#148" id="148">148</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String[] DISPLAYABLE_TYPES = {
+<a name="149" href="#149" id="149">149</a> <span class="jxr_string">"text/plain"</span>, <span class="jxr_string">"text/richtext"</span>, <span class="jxr_string">"text/enriched"</span>, <span class="jxr_string">"text/tab-separated-values"</span>, <span class="jxr_string">"text/html"</span>, <span class="jxr_string">"text/xml"</span>, <span class="jxr_string">"text/rtf"</span>,
+<a name="150" href="#150" id="150">150</a> <span class="jxr_string">"message/rfc822"</span>, <span class="jxr_string">"message/partial"</span>, <span class="jxr_string">"message/external-body"</span>, <span class="jxr_string">"message/news"</span>, <span class="jxr_string">"message/http"</span>,
+<a name="151" href="#151" id="151">151</a> <span class="jxr_string">"message/delivery-status"</span>, <span class="jxr_string">"message/disposition-notification"</span>, <span class="jxr_string">"message/s-http"</span>, <span class="jxr_string">"application/rtf"</span>,
+<a name="152" href="#152" id="152">152</a> <span class="jxr_string">"application/pdf"</span>, <span class="jxr_string">"image/jpeg"</span>, <span class="jxr_string">"image/gif"</span>, <span class="jxr_string">"image/tiff"</span>, <span class="jxr_string">"image/png"</span>, <span class="jxr_string">"audio/basic"</span>, <span class="jxr_string">"audio/32kadpcm"</span>,
+<a name="153" href="#153" id="153">153</a> <span class="jxr_string">"audio/mpeg"</span>, <span class="jxr_string">"video/mpeg"</span>, <span class="jxr_string">"video/quicktime"</span>
+<a name="154" href="#154" id="154">154</a> };
+<a name="155" href="#155" id="155">155</a>
+<a name="156" href="#156" id="156">156</a> <em class="jxr_javadoccomment">/**</em>
+<a name="157" href="#157" id="157">157</a> <em class="jxr_javadoccomment"> * Retriever that retrieves product data over a method call boundary to a large</em>
+<a name="158" href="#158" id="158">158</a> <em class="jxr_javadoccomment"> * product query handler.</em>
+<a name="159" href="#159" id="159">159</a> <em class="jxr_javadoccomment"> */</em>
+<a name="160" href="#160" id="160">160</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/oodt/grid/ProductQueryServlet.html">ProductRetriever</a> implements <a href="../../../../org/apache/oodt/product/Retriever.html">Retriever</a> {
+<a name="161" href="#161" id="161">161</a> <em class="jxr_javadoccomment">/**</em>
+<a name="162" href="#162" id="162">162</a> <em class="jxr_javadoccomment"> * Creates a new <code>ProductRetriever</code> instance.</em>
+<a name="163" href="#163" id="163">163</a> <em class="jxr_javadoccomment"> *</em>
+<a name="164" href="#164" id="164">164</a> <em class="jxr_javadoccomment"> * @param handler a <code>LargeProductQueryHandler</code> value.</em>
+<a name="165" href="#165" id="165">165</a> <em class="jxr_javadoccomment"> */</em>
+<a name="166" href="#166" id="166">166</a> <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/oodt/grid/ProductQueryServlet.html">ProductRetriever</a>(<a href="../../../../org/apache/oodt/product/LargeProductQueryHandler.html">LargeProductQueryHandler</a> handler) {
+<a name="167" href="#167" id="167">167</a> <strong class="jxr_keyword">this</strong>.handler = handler;
+<a name="168" href="#168" id="168">168</a> }
+<a name="169" href="#169" id="169">169</a>
+<a name="170" href="#170" id="170">170</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> {@inheritDoc} */</em>
+<a name="171" href="#171" id="171">171</a> <strong class="jxr_keyword">public</strong> byte[] retrieveChunk(String id, <strong class="jxr_keyword">long</strong> offset, <strong class="jxr_keyword">int</strong> len) <strong class="jxr_keyword">throws</strong> ProductException {
+<a name="172" href="#172" id="172">172</a> <strong class="jxr_keyword">return</strong> handler.retrieveChunk(id, offset, len);
+<a name="173" href="#173" id="173">173</a> }
+<a name="174" href="#174" id="174">174</a>
+<a name="175" href="#175" id="175">175</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> {@inheritDoc} */</em>
+<a name="176" href="#176" id="176">176</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> close(String id) <strong class="jxr_keyword">throws</strong> ProductException {
+<a name="177" href="#177" id="177">177</a> handler.close(id);
+<a name="178" href="#178" id="178">178</a> }
+<a name="179" href="#179" id="179">179</a>
+<a name="180" href="#180" id="180">180</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Handler to use. */</em>
+<a name="181" href="#181" id="181">181</a> <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/oodt/product/LargeProductQueryHandler.html">LargeProductQueryHandler</a> handler;
+<a name="182" href="#182" id="182">182</a> }
+<a name="183" href="#183" id="183">183</a> }
+<a name="184" href="#184" id="184">184</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: incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProductServer.html
URL: http://svn.apache.org/viewvc/incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProductServer.html?rev=1000710&view=auto
==============================================================================
--- incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProductServer.html (added)
+++ incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProductServer.html Fri Sep 24 05:09:48 2010
@@ -0,0 +1,72 @@
+<?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>ProductServer xref</title><link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" /></head><body>
+<div id="overview"><a href="../../../../../apidocs/org/apache/oodt/grid/ProductServer.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.grid;
+<a name="19" href="#19" id="19">19</a>
+<a name="20" href="#20" id="20">20</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.product.QueryHandler;
+<a name="21" href="#21" id="21">21</a>
+<a name="22" href="#22" id="22">22</a> <em class="jxr_javadoccomment">/**</em>
+<a name="23" href="#23" id="23">23</a> <em class="jxr_javadoccomment"> * A product server.</em>
+<a name="24" href="#24" id="24">24</a> <em class="jxr_javadoccomment"> *</em>
+<a name="25" href="#25" id="25">25</a> <em class="jxr_javadoccomment"> */</em>
+<a name="26" href="#26" id="26">26</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/oodt/grid/ProductServer.html">ProductServer</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/oodt/grid/Server.html">Server</a> {
+<a name="27" href="#27" id="27">27</a> <em class="jxr_javadoccomment">/**</em>
+<a name="28" href="#28" id="28">28</a> <em class="jxr_javadoccomment"> * Creates a new <code>ProductServer</code> instance.</em>
+<a name="29" href="#29" id="29">29</a> <em class="jxr_javadoccomment"> *</em>
+<a name="30" href="#30" id="30">30</a> <em class="jxr_javadoccomment"> * @param configuration System configuration.</em>
+<a name="31" href="#31" id="31">31</a> <em class="jxr_javadoccomment"> * @param className Class name of query handler.</em>
+<a name="32" href="#32" id="32">32</a> <em class="jxr_javadoccomment"> */</em>
+<a name="33" href="#33" id="33">33</a> <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/oodt/grid/ProductServer.html">ProductServer</a>(<a href="../../../../org/apache/oodt/grid/Configuration.html">Configuration</a> configuration, String className) {
+<a name="34" href="#34" id="34">34</a> <strong class="jxr_keyword">super</strong> (configuration, className);
+<a name="35" href="#35" id="35">35</a> }
+<a name="36" href="#36" id="36">36</a>
+<a name="37" href="#37" id="37">37</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> {@inheritDoc} */</em>
+<a name="38" href="#38" id="38">38</a> <strong class="jxr_keyword">protected</strong> String getType() {
+<a name="39" href="#39" id="39">39</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"product"</span>;
+<a name="40" href="#40" id="40">40</a> }
+<a name="41" href="#41" id="41">41</a>
+<a name="42" href="#42" id="42">42</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> hashCode() {
+<a name="43" href="#43" id="43">43</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">super</strong>.hashCode() ^ 0xaaaaaaaa;
+<a name="44" href="#44" id="44">44</a> }
+<a name="45" href="#45" id="45">45</a>
+<a name="46" href="#46" id="46">46</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> equals(Object obj) {
+<a name="47" href="#47" id="47">47</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">super</strong>.equals(obj) && obj instanceof ProductServer;
+<a name="48" href="#48" id="48">48</a> }
+<a name="49" href="#49" id="49">49</a>
+<a name="50" href="#50" id="50">50</a> <strong class="jxr_keyword">public</strong> String toString() {
+<a name="51" href="#51" id="51">51</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"ProductServer["</span> + <strong class="jxr_keyword">super</strong>.toString() + <span class="jxr_string">"]"</span>;
+<a name="52" href="#52" id="52">52</a> }
+<a name="53" href="#53" id="53">53</a>
+<a name="54" href="#54" id="54">54</a> <em class="jxr_javadoccomment">/**</em>
+<a name="55" href="#55" id="55">55</a> <em class="jxr_javadoccomment"> * Create a query handler from this server.</em>
+<a name="56" href="#56" id="56">56</a> <em class="jxr_javadoccomment"> *</em>
+<a name="57" href="#57" id="57">57</a> <em class="jxr_javadoccomment"> * @return a <code>QueryHandler</code> value.</em>
+<a name="58" href="#58" id="58">58</a> <em class="jxr_javadoccomment"> * @throws ClassNotFoundException if the class can't be found.</em>
+<a name="59" href="#59" id="59">59</a> <em class="jxr_javadoccomment"> * @throws InstantiationException if the handler can't be instantiated.</em>
+<a name="60" href="#60" id="60">60</a> <em class="jxr_javadoccomment"> * @throws IllegalAccessException if the handler has no public constructor.</em>
+<a name="61" href="#61" id="61">61</a> <em class="jxr_javadoccomment"> */</em>
+<a name="62" href="#62" id="62">62</a> <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/oodt/product/QueryHandler.html">QueryHandler</a> createQueryHandler() <strong class="jxr_keyword">throws</strong> ClassNotFoundException, InstantiationException, IllegalAccessException {
+<a name="63" href="#63" id="63">63</a> <strong class="jxr_keyword">return</strong> (QueryHandler) createHandler();
+<a name="64" href="#64" id="64">64</a> }
+<a name="65" href="#65" id="65">65</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: incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProfileQueryServlet.html
URL: http://svn.apache.org/viewvc/incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProfileQueryServlet.html?rev=1000710&view=auto
==============================================================================
--- incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProfileQueryServlet.html (added)
+++ incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProfileQueryServlet.html Fri Sep 24 05:09:48 2010
@@ -0,0 +1,145 @@
+<?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>ProfileQueryServlet xref</title><link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" /></head><body>
+<div id="overview"><a href="../../../../../apidocs/org/apache/oodt/grid/ProfileQueryServlet.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.grid;
+<a name="19" href="#19" id="19">19</a>
+<a name="20" href="#20" id="20">20</a> <strong class="jxr_keyword">import</strong> java.io.IOException;
+<a name="21" href="#21" id="21">21</a> <strong class="jxr_keyword">import</strong> java.util.Collections;
+<a name="22" href="#22" id="22">22</a> <strong class="jxr_keyword">import</strong> java.util.Iterator;
+<a name="23" href="#23" id="23">23</a> <strong class="jxr_keyword">import</strong> java.util.List;
+<a name="24" href="#24" id="24">24</a> <strong class="jxr_keyword">import</strong> java.util.Set;
+<a name="25" href="#25" id="25">25</a> <strong class="jxr_keyword">import</strong> java.util.HashSet;
+<a name="26" href="#26" id="26">26</a> <strong class="jxr_keyword">import</strong> javax.servlet.ServletException;
+<a name="27" href="#27" id="27">27</a> <strong class="jxr_keyword">import</strong> javax.servlet.http.HttpServletRequest;
+<a name="28" href="#28" id="28">28</a> <strong class="jxr_keyword">import</strong> javax.servlet.http.HttpServletResponse;
+<a name="29" href="#29" id="29">29</a> <strong class="jxr_keyword">import</strong> javax.xml.transform.OutputKeys;
+<a name="30" href="#30" id="30">30</a> <strong class="jxr_keyword">import</strong> javax.xml.transform.Transformer;
+<a name="31" href="#31" id="31">31</a> <strong class="jxr_keyword">import</strong> javax.xml.transform.TransformerException;
+<a name="32" href="#32" id="32">32</a> <strong class="jxr_keyword">import</strong> javax.xml.transform.TransformerFactory;
+<a name="33" href="#33" id="33">33</a> <strong class="jxr_keyword">import</strong> javax.xml.transform.dom.DOMSource;
+<a name="34" href="#34" id="34">34</a> <strong class="jxr_keyword">import</strong> javax.xml.transform.stream.StreamResult;
+<a name="35" href="#35" id="35">35</a> <strong class="jxr_keyword">import</strong> org.w3c.dom.Document;
+<a name="36" href="#36" id="36">36</a> <strong class="jxr_keyword">import</strong> org.w3c.dom.Node;
+<a name="37" href="#37" id="37">37</a> <strong class="jxr_keyword">import</strong> org.xml.sax.SAXException;
+<a name="38" href="#38" id="38">38</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.profile.Profile;
+<a name="39" href="#39" id="39">39</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.profile.handlers.ProfileHandler;
+<a name="40" href="#40" id="40">40</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.xmlquery.QueryElement;
+<a name="41" href="#41" id="41">41</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.xmlquery.XMLQuery;
+<a name="42" href="#42" id="42">42</a>
+<a name="43" href="#43" id="43">43</a>
+<a name="44" href="#44" id="44">44</a> <em class="jxr_javadoccomment">/**</em>
+<a name="45" href="#45" id="45">45</a> <em class="jxr_javadoccomment"> * Profile query servlet handles profile queries. It returns every matching profile from</em>
+<a name="46" href="#46" id="46">46</a> <em class="jxr_javadoccomment"> * every query handler that provides matching profiles. If no handlers are installed,</em>
+<a name="47" href="#47" id="47">47</a> <em class="jxr_javadoccomment"> * then it returns an empty &lt;profiles&gt; document.</em>
+<a name="48" href="#48" id="48">48</a> <em class="jxr_javadoccomment"> * </em>
+<a name="49" href="#49" id="49">49</a> <em class="jxr_javadoccomment"> */</em>
+<a name="50" href="#50" id="50">50</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/oodt/grid/ProfileQueryServlet.html">ProfileQueryServlet</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/oodt/grid/QueryServlet.html">QueryServlet</a> {
+<a name="51" href="#51" id="51">51</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> {@inheritDoc} */</em>
+<a name="52" href="#52" id="52">52</a> <strong class="jxr_keyword">protected</strong> List getServers(<a href="../../../../org/apache/oodt/grid/Configuration.html">Configuration</a> config) {
+<a name="53" href="#53" id="53">53</a> <strong class="jxr_keyword">return</strong> config.getProfileServers();
+<a name="54" href="#54" id="54">54</a> }
+<a name="55" href="#55" id="55">55</a>
+<a name="56" href="#56" id="56">56</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> {@inheritDoc} */</em>
+<a name="57" href="#57" id="57">57</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> handleQuery(<a href="../../../../org/apache/oodt/xmlquery/XMLQuery.html">XMLQuery</a> query, List handlers, HttpServletRequest req, HttpServletResponse res)
+<a name="58" href="#58" id="58">58</a> <strong class="jxr_keyword">throws</strong> IOException, ServletException {
+<a name="59" href="#59" id="59">59</a> <em class="jxr_comment">// Find if the query should be targeted to specific handlers.</em>
+<a name="60" href="#60" id="60">60</a> Set ids = <strong class="jxr_keyword">new</strong> HashSet();
+<a name="61" href="#61" id="61">61</a> <strong class="jxr_keyword">if</strong> (query.getFromElementSet() != <strong class="jxr_keyword">null</strong>) {
+<a name="62" href="#62" id="62">62</a> <strong class="jxr_keyword">for</strong> (Iterator i = query.getFromElementSet().iterator(); i.hasNext();) {
+<a name="63" href="#63" id="63">63</a> QueryElement qe = (QueryElement) i.next();
+<a name="64" href="#64" id="64">64</a> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"handler"</span>.equals(qe.getRole()) && qe.getValue() != <strong class="jxr_keyword">null</strong>)
+<a name="65" href="#65" id="65">65</a> ids.add(qe.getValue());
+<a name="66" href="#66" id="66">66</a> }
+<a name="67" href="#67" id="67">67</a> }
+<a name="68" href="#68" id="68">68</a>
+<a name="69" href="#69" id="69">69</a> res.setContentType(<span class="jxr_string">"text/xml"</span>); <em class="jxr_comment">// XML, comin' at ya</em>
+<a name="70" href="#70" id="70">70</a> res.getWriter().println(<span class="jxr_string">"<?xml version='1.0' encoding='UTF-8'?>"</span>); <em class="jxr_comment">// UTF-8 no less. Boo-ya.</em>
+<a name="71" href="#71" id="71">71</a> res.getWriter().println(<span class="jxr_string">"<!DOCTYPE profiles PUBLIC '"</span> <em class="jxr_comment">// Get a doctype in there for the highly ...</em>
+<a name="72" href="#72" id="72">72</a> + Profile.PROFILES_DTD_FPI + <span class="jxr_string">"' '"</span> <em class="jxr_comment">// ... anal ...</em>
+<a name="73" href="#73" id="73">73</a> + Profile.PROFILES_DTD_URL + <span class="jxr_string">"'>"</span>); <em class="jxr_comment">// ... retentive.</em>
+<a name="74" href="#74" id="74">74</a> res.getWriter().println(<span class="jxr_string">"<profiles>"</span>); <em class="jxr_comment">// Start tag for the whole /sbin/fsck mess</em>
+<a name="75" href="#75" id="75">75</a> Transformer transformer = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// Start out w/no transformer and no doc</em>
+<a name="76" href="#76" id="76">76</a> Document doc = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// Don't make 'em if we don't need 'em</em>
+<a name="77" href="#77" id="77">77</a> <strong class="jxr_keyword">boolean</strong> sentAtLeastOne = false; <em class="jxr_comment">// Track if we send any profiles at all</em>
+<a name="78" href="#78" id="78">78</a> Exception exception = <strong class="jxr_keyword">null</strong>; <em class="jxr_comment">// And save any exception</em>
+<a name="79" href="#79" id="79">79</a> <strong class="jxr_keyword">for</strong> (Iterator i = handlers.iterator(); i.hasNext();) <strong class="jxr_keyword">try</strong> { <em class="jxr_comment">// To iterate over each handler</em>
+<a name="80" href="#80" id="80">80</a> ProfileHandler handler = (ProfileHandler) i.next(); <em class="jxr_comment">// Get the handler</em>
+<a name="81" href="#81" id="81">81</a> String id = handler.getID(); <em class="jxr_comment">// Get the ID, and if targeting to IDs</em>
+<a name="82" href="#82" id="82">82</a> <strong class="jxr_keyword">if</strong> (!ids.isEmpty() && !ids.contains(id)) <strong class="jxr_keyword">continue</strong>; <em class="jxr_comment">// ... and it's not one we want, skip it.</em>
+<a name="83" href="#83" id="83">83</a> List results = handler.findProfiles(query); <em class="jxr_comment">// Have it find profiles</em>
+<a name="84" href="#84" id="84">84</a> <strong class="jxr_keyword">if</strong> (results == <strong class="jxr_keyword">null</strong>) results = Collections.EMPTY_LIST; <em class="jxr_comment">// Assume nothing</em>
+<a name="85" href="#85" id="85">85</a> <strong class="jxr_keyword">for</strong> (Iterator j = results.iterator(); j.hasNext();) { <em class="jxr_comment">// For each matching profile</em>
+<a name="86" href="#86" id="86">86</a> Profile profile = (Profile) j.next(); <em class="jxr_comment">// Get the profile</em>
+<a name="87" href="#87" id="87">87</a> <strong class="jxr_keyword">if</strong> (transformer == <strong class="jxr_keyword">null</strong>) { <em class="jxr_comment">// No transformer/doc yet?</em>
+<a name="88" href="#88" id="88">88</a> transformer = createTransformer(); <em class="jxr_comment">// Then make the transformer</em>
+<a name="89" href="#89" id="89">89</a> doc = Profile.createProfileDocument(); <em class="jxr_comment">// And the doc</em>
+<a name="90" href="#90" id="90">90</a> } <em class="jxr_comment">// And use the doc ...</em>
+<a name="91" href="#91" id="91">91</a> Node profileNode = profile.toXML(doc); <em class="jxr_comment">// To render the profile into XML</em>
+<a name="92" href="#92" id="92">92</a> DOMSource source = <strong class="jxr_keyword">new</strong> DOMSource(profileNode); <em class="jxr_comment">// And the XML becomes is source</em>
+<a name="93" href="#93" id="93">93</a> StreamResult result = <strong class="jxr_keyword">new</strong> StreamResult(res.getWriter()); <em class="jxr_comment">// And the response is a result</em>
+<a name="94" href="#94" id="94">94</a> transformer.transform(source, result); <em class="jxr_comment">// And serialize into glorious text</em>
+<a name="95" href="#95" id="95">95</a> sentAtLeastOne = <strong class="jxr_keyword">true</strong>; <em class="jxr_comment">// OK, we got at least one out the doo</em>
+<a name="96" href="#96" id="96">96</a> }
+<a name="97" href="#97" id="97">97</a> } <strong class="jxr_keyword">catch</strong> (Exception ex) { <em class="jxr_comment">// Uh oh</em>
+<a name="98" href="#98" id="98">98</a> exception = ex; <em class="jxr_comment">// OK, just hold onto it for now</em>
+<a name="99" href="#99" id="99">99</a> }
+<a name="100" href="#100" id="100">100</a> <strong class="jxr_keyword">if</strong> (!sentAtLeastOne && exception != <strong class="jxr_keyword">null</strong>) { <em class="jxr_comment">// Got none out the door and had an error?</em>
+<a name="101" href="#101" id="101">101</a> res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, <em class="jxr_comment">// Then we can report it.</em>
+<a name="102" href="#102" id="102">102</a> exception.getMessage());
+<a name="103" href="#103" id="103">103</a> <strong class="jxr_keyword">return</strong>;
+<a name="104" href="#104" id="104">104</a> }
+<a name="105" href="#105" id="105">105</a>
+<a name="106" href="#106" id="106">106</a> <em class="jxr_comment">// However, if we get here, we got at least one profile out the door. In</em>
+<a name="107" href="#107" id="107">107</a> <em class="jxr_comment">// that case, hide any error that might've occurred from subsequent</em>
+<a name="108" href="#108" id="108">108</a> <em class="jxr_comment">// handlers. (Or, if we get here, there were no errors. Yay.)</em>
+<a name="109" href="#109" id="109">109</a> res.getWriter().println(<span class="jxr_string">"</profiles>"</span>); <em class="jxr_comment">// End tag for the whole fsck'n mess</em>
+<a name="110" href="#110" id="110">110</a> }
+<a name="111" href="#111" id="111">111</a>
+<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"> * Create a transformer, properly configured for XML text serialization.</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"> * @return a <code>Transformer</code> value.</em>
+<a name="116" href="#116" id="116">116</a> <em class="jxr_javadoccomment"> * @throws TransformerException if an error occurs.</em>
+<a name="117" href="#117" id="117">117</a> <em class="jxr_javadoccomment"> */</em>
+<a name="118" href="#118" id="118">118</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> Transformer createTransformer() <strong class="jxr_keyword">throws</strong> TransformerException {
+<a name="119" href="#119" id="119">119</a> Transformer transformer;
+<a name="120" href="#120" id="120">120</a> <strong class="jxr_keyword">synchronized</strong> (TRANSFORMER_FACTORY) {
+<a name="121" href="#121" id="121">121</a> transformer = TRANSFORMER_FACTORY.newTransformer();
+<a name="122" href="#122" id="122">122</a> }
+<a name="123" href="#123" id="123">123</a> transformer.setOutputProperty(OutputKeys.METHOD, <span class="jxr_string">"xml"</span>);
+<a name="124" href="#124" id="124">124</a> transformer.setOutputProperty(OutputKeys.VERSION, <span class="jxr_string">"1.0"</span>);
+<a name="125" href="#125" id="125">125</a> transformer.setOutputProperty(OutputKeys.ENCODING, <span class="jxr_string">"UTF-8"</span>);
+<a name="126" href="#126" id="126">126</a> transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, <span class="jxr_string">"yes"</span>);
+<a name="127" href="#127" id="127">127</a> transformer.setOutputProperty(OutputKeys.STANDALONE, <span class="jxr_string">"no"</span>);
+<a name="128" href="#128" id="128">128</a> transformer.setOutputProperty(OutputKeys.INDENT, <span class="jxr_string">"yes"</span>);
+<a name="129" href="#129" id="129">129</a> transformer.setOutputProperty(OutputKeys.MEDIA_TYPE, <span class="jxr_string">"text/xml"</span>);
+<a name="130" href="#130" id="130">130</a> transformer.setOutputProperty(<span class="jxr_string">"{http://xml.apache.org/xslt}indent-amount"</span>, <span class="jxr_string">"4"</span>);
+<a name="131" href="#131" id="131">131</a>
+<a name="132" href="#132" id="132">132</a> <strong class="jxr_keyword">return</strong> transformer;
+<a name="133" href="#133" id="133">133</a> }
+<a name="134" href="#134" id="134">134</a>
+<a name="135" href="#135" id="135">135</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Sole transformer factory this class will ever need. */</em>
+<a name="136" href="#136" id="136">136</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> TransformerFactory TRANSFORMER_FACTORY = TransformerFactory.newInstance();
+<a name="137" href="#137" id="137">137</a> }
+<a name="138" href="#138" id="138">138</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: incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProfileServer.html
URL: http://svn.apache.org/viewvc/incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProfileServer.html?rev=1000710&view=auto
==============================================================================
--- incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProfileServer.html (added)
+++ incubator/oodt/site/components/maven/xref/org/apache/oodt/grid/ProfileServer.html Fri Sep 24 05:09:48 2010
@@ -0,0 +1,78 @@
+<?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>ProfileServer xref</title><link type="text/css" rel="stylesheet" href="../../../../stylesheet.css" /></head><body>
+<div id="overview"><a href="../../../../../apidocs/org/apache/oodt/grid/ProfileServer.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.grid;
+<a name="19" href="#19" id="19">19</a>
+<a name="20" href="#20" id="20">20</a> <strong class="jxr_keyword">import</strong> org.apache.oodt.profile.handlers.ProfileHandler;
+<a name="21" href="#21" id="21">21</a>
+<a name="22" href="#22" id="22">22</a> <em class="jxr_javadoccomment">/**</em>
+<a name="23" href="#23" id="23">23</a> <em class="jxr_javadoccomment"> * A profile server.</em>
+<a name="24" href="#24" id="24">24</a> <em class="jxr_javadoccomment"> * </em>
+<a name="25" href="#25" id="25">25</a> <em class="jxr_javadoccomment"> */</em>
+<a name="26" href="#26" id="26">26</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/oodt/grid/ProfileServer.html">ProfileServer</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/oodt/grid/Server.html">Server</a> {
+<a name="27" href="#27" id="27">27</a> <em class="jxr_javadoccomment">/**</em>
+<a name="28" href="#28" id="28">28</a> <em class="jxr_javadoccomment"> * Creates a new <code>ProfileServer</code> instance.</em>
+<a name="29" href="#29" id="29">29</a> <em class="jxr_javadoccomment"> * </em>
+<a name="30" href="#30" id="30">30</a> <em class="jxr_javadoccomment"> * @param configuration</em>
+<a name="31" href="#31" id="31">31</a> <em class="jxr_javadoccomment"> * System configuration.</em>
+<a name="32" href="#32" id="32">32</a> <em class="jxr_javadoccomment"> * @param className</em>
+<a name="33" href="#33" id="33">33</a> <em class="jxr_javadoccomment"> * Class name of profile handler.</em>
+<a name="34" href="#34" id="34">34</a> <em class="jxr_javadoccomment"> */</em>
+<a name="35" href="#35" id="35">35</a> <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/oodt/grid/ProfileServer.html">ProfileServer</a>(<a href="../../../../org/apache/oodt/grid/Configuration.html">Configuration</a> configuration, String className) {
+<a name="36" href="#36" id="36">36</a> <strong class="jxr_keyword">super</strong>(configuration, className);
+<a name="37" href="#37" id="37">37</a> }
+<a name="38" href="#38" id="38">38</a>
+<a name="39" href="#39" id="39">39</a> <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> {@inheritDoc} */</em>
+<a name="40" href="#40" id="40">40</a> <strong class="jxr_keyword">protected</strong> String getType() {
+<a name="41" href="#41" id="41">41</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"profile"</span>;
+<a name="42" href="#42" id="42">42</a> }
+<a name="43" href="#43" id="43">43</a>
+<a name="44" href="#44" id="44">44</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> hashCode() {
+<a name="45" href="#45" id="45">45</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">super</strong>.hashCode() ^ 0x55555555;
+<a name="46" href="#46" id="46">46</a> }
+<a name="47" href="#47" id="47">47</a>
+<a name="48" href="#48" id="48">48</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> equals(Object obj) {
+<a name="49" href="#49" id="49">49</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">super</strong>.equals(obj) && obj instanceof ProfileServer;
+<a name="50" href="#50" id="50">50</a> }
+<a name="51" href="#51" id="51">51</a>
+<a name="52" href="#52" id="52">52</a> <strong class="jxr_keyword">public</strong> String toString() {
+<a name="53" href="#53" id="53">53</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"ProfileServer["</span> + <strong class="jxr_keyword">super</strong>.toString() + <span class="jxr_string">"]"</span>;
+<a name="54" href="#54" id="54">54</a> }
+<a name="55" href="#55" id="55">55</a>
+<a name="56" href="#56" id="56">56</a> <em class="jxr_javadoccomment">/**</em>
+<a name="57" href="#57" id="57">57</a> <em class="jxr_javadoccomment"> * Create a query handler from this server.</em>
+<a name="58" href="#58" id="58">58</a> <em class="jxr_javadoccomment"> * </em>
+<a name="59" href="#59" id="59">59</a> <em class="jxr_javadoccomment"> * @return a <code>ProfileHandler</code> value.</em>
+<a name="60" href="#60" id="60">60</a> <em class="jxr_javadoccomment"> * @throws ClassNotFoundException</em>
+<a name="61" href="#61" id="61">61</a> <em class="jxr_javadoccomment"> * if the class can't be found.</em>
+<a name="62" href="#62" id="62">62</a> <em class="jxr_javadoccomment"> * @throws InstantiationException</em>
+<a name="63" href="#63" id="63">63</a> <em class="jxr_javadoccomment"> * if the handler can't be instantiated.</em>
+<a name="64" href="#64" id="64">64</a> <em class="jxr_javadoccomment"> * @throws IllegalAccessException</em>
+<a name="65" href="#65" id="65">65</a> <em class="jxr_javadoccomment"> * if the handler has no public constructor.</em>
+<a name="66" href="#66" id="66">66</a> <em class="jxr_javadoccomment"> */</em>
+<a name="67" href="#67" id="67">67</a> <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/oodt/profile/handlers/ProfileHandler.html">ProfileHandler</a> createProfileHandler() <strong class="jxr_keyword">throws</strong> ClassNotFoundException,
+<a name="68" href="#68" id="68">68</a> InstantiationException, IllegalAccessException {
+<a name="69" href="#69" id="69">69</a> <strong class="jxr_keyword">return</strong> (ProfileHandler) createHandler();
+<a name="70" href="#70" id="70">70</a> }
+<a name="71" href="#71" id="71">71</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