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 2011/03/09 04:57:17 UTC

svn commit: r1079659 [11/11] - in /oodt/site/components/maven: apidocs/org/apache/oodt/pcs/health/ apidocs/org/apache/oodt/pcs/health/class-use/ apidocs/org/apache/oodt/pcs/metadata/ apidocs/org/apache/oodt/pcs/metadata/class-use/ apidocs/org/apache/oo...

Added: oodt/site/components/maven/product/tutorials/qh/index.html
URL: http://svn.apache.org/viewvc/oodt/site/components/maven/product/tutorials/qh/index.html?rev=1079659&view=auto
==============================================================================
--- oodt/site/components/maven/product/tutorials/qh/index.html (added)
+++ oodt/site/components/maven/product/tutorials/qh/index.html Wed Mar  9 03:57:15 2011
@@ -0,0 +1,638 @@
+<?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" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Apache™ OODT</title><link rel="stylesheet" href="http://oodt.apache.org/oodt.css" type="text/css" /><link rel="stylesheet" href="../../css/print.css" type="text/css" media="print" /><meta name="author" content="Sean Kelly" /></head><body><div id="outerWrapper"><div id="innerWrapper"><div class="visualHeaderWrapper"><div class="header"><div class="apacheOODTLogo"><a href="http://oodt.apache.org/"><img src="http://oodt.apache.org/images/apacheOODT.png" alt="Apache™ OODT" /></a></div><div class="fright"><ul class="globalnav"><!-- One of these li's must be given the currentNavTab class --><li><a id="tab-contact" href="http://oodt.apache.org/contact">Contact</a></li><li><a id="tab-development" href="http://oodt.apache.org/development">Development</a></li><li><a id="tab-downloads" href="http://oodt.apache.org/downloads">Down
 loads</a></li><li><a id="tab-components" href="http://oodt.apache.org/components" class="currentNavTab">Components</a></li><li><a id="tab-about" href="http://oodt.apache.org/about">About</a></li><li><a id="tab-home" href="http://oodt.apache.org/">Home</a></li></ul></div><div class="visualClear"></div></div></div><div class="subProductWrapper"><div class="subProductHeader"><h1 id="productNameSlot"><span id="bannerLeft">&#13;
+    &#13;
+            Product Service&#13;
+    &#13;
+            </span></h1><h2 id="productSubheadSlot"><h2><a name="Developing_a_Query_Handler" id="Developing_a_Query_Handler"></a>Developing a Query Handler</h2><h2><a name="Serving_Up_Constants" id="Serving_Up_Constants"></a>Serving Up Constants</h2><h2><a name="Writing_the_Code" id="Writing_the_Code"></a>Writing the Code</h2><h2><a name="Compiling_the_Code" id="Compiling_the_Code"></a>Compiling the Code</h2><h2><a name="Specfying_the_Query_Handler" id="Specfying_the_Query_Handler"></a>Specfying the Query Handler</h2><h2><a name="Querying_for_Constants" id="Querying_for_Constants"></a>Querying for Constants</h2><h2><a name="Conclusion" id="Conclusion"></a>Conclusion</h2></h2></div></div><div class="visualContentWrapper"><div class="contentGradient"></div><div id="content"><div class="diptych triptychSpace"><div class="visualPadding" id="leftPlate"><p>In the <a href="../ps/">last tutorial</a>, we started a
+	product server.  But this wasn't a very useful product server;
+	it could answer queries but always respond with no results.
+	That's because it had no query handlers.  Query handlers have
+	the responsibility of actually handling product queries.  In
+	this tutorial, we'll develop a query handler, install it into
+	our product server, and query it to see if it works.
+      </p><p>To do this tutorial, you'll need mastery of two things:</p><ul><li>Using the <code>XMLQuery</code> class.  Follow the <a href="http://oodt.apache.org/edm-query/tutorial/">query expression tutorail</a>
+	    now if you're not familiar with it.
+	</li>
+<li>Running and querying a product server.  Follow the <a href="../ps/">Your First Product Server</a> tutorial to
+	    get your product server up and running.  In this tutorial,
+	    we'll build on that product server, so it's especially
+	    important to have it in good shape.
+	</li>
+</ul><div class="section"><h2><a name="Serving_Up_Constants" id="Serving_Up_Constants"></a>Serving Up Constants</h2>
+<p>Product servers delegate to query handlers.  It's the job of
+	query handlers to interpret incoming queries (expressed as
+	<code>XMLQuery</code> objects), search for, retrieve, convert,
+	or synthesize matching product results, adorn the
+	<code>XMLQuery</code> object with <code>Result</code> objects,
+	and return the modified query.  At that point the OODT
+	framework takes over again and tries other installed query
+	handlers, eventually returning the completed
+	<code>XMLQuery</code> back to the product client that made the
+	query in the first place.
+      </p>
+<p>We'll make a query handler that serves mathematical
+	constants.  Have you ever been in a position where you needed,
+	say, the value of the third Flajolet number or perhaps
+	Zeta(9)?  No?  Well, just pretend for now you did.  What we'll
+	do is develop a query handler for a product server that will
+	serve values of various mathematical constants.
+      </p>
+<p>The approach we'll take has three simple steps:</p>
+<ol type="1"><li>Get some handy constants.</li>
+<li>Define the query expression.</li>
+<li>Write a query handler.  The query handler will:
+	  <ol type="1"><li>Examine the query expression to see if it's a request
+	      for a constant, and if so, what constant is
+	      requested.
+	    </li>
+<li>Examine the query's list of acceptable MIME types.</li>
+<li>If both check out, look up the desired constant's value.</li>
+<li>If found, add it as a <code>Result</code> in the <code>XMLQuery</code>.</li>
+</ol></li>
+</ol></div><div class="section"><h2><a name="Writing_the_Code" id="Writing_the_Code"></a>Writing the Code</h2>
+<p>In this section, we'll build up the query handler source code
+	in pieces, examining each piece thoroughly.  We'll then
+	present the entire source file.
+      </p>
+<div class="section"><h3><a name="Gathering_Handy_Constants" id="Gathering_Handy_Constants"></a>Gathering Handy Constants</h3>
+<p>The wonderful world of science and mathematics is replete
+	  with useful constant values.  For this example, let's just pick three:
+	</p>
+<ul><li><var>pi</var> = 3.14159265...</li>
+<li><var>e</var> = 2.7182818285...</li>
+<li><var>gamma</var> = 0.577215664...</li>
+</ul><p>In Java code, we can set up those values as a
+	  <code>Map</code> in a static field.  Thus we start forming our
+	  source file, <code>ConstantHandler.java</code>:
+	</p>
+<div class="source"><pre>import java.util.HashMap;
+import java.util.Map;
+import jpl.eda.product.QueryHandler;
+public class ConstantHandler
+  implements QueryHandler {
+  private static final Map CONSTANTS = new HashMap();
+  static {
+    CONSTANTS.put("pi",    "3.14159265...");
+    CONSTANTS.put("e",     "2.7182818285...");
+    CONSTANTS.put("gamma", "0.577215664...");
+  }
+}</pre>
+</div>
+<p>As you can see, we're storing both the constant name and its
+	  value as <code>java.lang.String</code> objects.
+	</p>
+</div>
+<div class="section"><h3><a name="Defining_the_Query_Expression" id="Defining_the_Query_Expression"></a>Defining the Query Expression</h3>
+<p>Recall that the <code>XMLQuery</code> class can use parsed
+	  queries (where it generates postfix boolean stacks) or
+	  unparsed ones.  While unparsed ones are easier, we'll go with
+	  parsed ones to demonstrate how on the server-side you deal
+	  with those postfix stacks.
+	</p>
+<p>Using the XMLQuery's expression language, we'll look for
+	  queries of the form:</p>
+<p><code>constant = <var>name</var></code></p>
+<p>where <var>name</var> is the name of a constant.  That will
+	  form a postfix "where" stack with exactly three
+	  <code>QueryElement</code> objects on it:
+	</p>
+<ol type="1"><li>The first (top) <code>QueryElement</code> will have role =
+	    <code>elemName</code> and value = <code>constant</code>.
+	  </li>
+<li>The second (middle) <code>QueryElement</code> will have
+	    role = <code>LITERAL</code> and a value equal to the
+	    constant <var>name</var>.
+	  </li>
+<li>The third (bottom) <code>QueryElement</code> will have
+	    role = <code>RELOP</code> and value = <code>EQ</code>.
+	  </li>
+</ol><p>If we get any other kind of stack, we'll reject it and return
+	  no matching results.  That's reasonable behavior; after all, a
+	  query for <code>donutsEaten &gt; 5 AND RETURN =
+	    episodeNumber</code> may be handled by a
+	  <code>SimpsonsEpisodeQueryHandler</code> that's <em>also</em>
+	  installed in the same product server.
+	</p>
+<p>We'll define a utility method, <code>getConstantName</code>,
+	  that will take the <code>XMLQuery</code>, check for the
+	  postfix "where" stack as described, and return the matching
+	  constant <var>name</var>.  If it gets a stack whose structure
+	  doesn't match, it will return <code>null</code>.  We'll add
+	  this method to our <code>ConstantHandler.java</code> file:
+	</p>
+<div class="source"><pre>import java.util.List;
+import jpl.eda.xmlquery.XMLQuery;
+import jpl.eda.xmlquery.QueryElement;
+...
+public class ConstantHandler
+  implements QueryHandler {
+  ...
+  private static String getConstantName(XMLQuery q) {
+    List stack = q.getWhereElementSet();
+    if (stack.size() != 3) return null;
+    QueryElement e = (QueryElement) stack.get(0);
+    if (!"elemName".equals(e.getRole())
+      || !"constant".equals(e.getValue()))
+      return null;
+    e = (QueryElement) stack.get(2);
+    if (!"RELOP".equals(e.getRole())
+      || !"EQ".equals(e.getValue()))
+      return null;
+    e = (QueryElement) stack.get(1);
+    if (!"LITERAL".equals(e.getRole()))
+	return null;
+    return e.getValue();
+  }
+}</pre>
+</div>
+<p>Here, we first check to make sure there's exactly three
+	  elements, returning null if not.  There's no need to go further.
+	</p>
+<p>Assuming there's three elements, the code then checks the
+	  topmost element.  For an expression <code>constant =
+	    <var>name</var></code>, the topmost element will have role
+	  <code>elemName</code> and value <code>constant</code>.  If
+	  neither condition is true, we return null right away.  No need
+	  to check further.
+	</p>
+<p>If the topmost element checks out, we then check the
+	  bottommost element.  For <code>constant =
+	    <var>name</var></code>, the bottom element is generated from
+	  the equals sign.  It will have role <code>RELOP</code>
+	  (relational operator) and value <code>EQ</code>, meaning
+	  "equals".
+	</p>
+<p>If it checks out, all we have to do is check the middle
+	  element.  The infix expression <code>constant =
+	    <var>name</var></code> generates a postfix middle element of
+	  <var>name</var> as the value, with a role of
+	  <code>LITERAL</code>.  We make sure it's <code>LITERAL</code>.
+	  If not, we're done; it's not a valid expression for our query
+	  handler.
+	</p>
+<p>But if so, then the value of that query element is the name
+	  of the desired constant.  So we return it, regardless of what
+	  it is.
+	</p>
+</div>
+<div class="section"><h3><a name="Checking_for_Acceptable_MIME_Types" id="Checking_for_Acceptable_MIME_Types"></a>Checking for Acceptable MIME Types</h3>
+<p>Since all of our mathematical constants are strings, we'll
+	  say that the result MIME type of our products is
+	  <code>text/plain</code>.  That means that any incoming
+	  <code>XMLQuery</code> must include any of the following MIME types:
+	</p>
+<ol type="1"><li><code>text/plain</code></li>
+<li><code>text/*</code></li>
+<li><code>*/*</code></li>
+</ol><p>All of these match <code>text/plain</code>, which is the only
+	  product type we're capable of serving.  (In your own product
+	  servers, you might have more complex logic; for example, you
+	  could write code to draw the numbers into an image file if the
+	  requested type is <code>image/jpeg</code> ... but I wouldn't
+	  want to.)
+	</p>
+<p>To support this in our query handler, we'll write another
+	  utility method.  It'll be called
+	  <code>isAcceptableType</code>, and it will take the
+	  <code>XMLQuery</code> and examine it to see what MIME types
+	  are acceptable to the caller.  If it finds any of the ones in
+	  the above list, it will return <code>true</code>, and the
+	  caller can continue to process the query.  If not, it will
+	  return <code>false</code>, and the query handler will stop
+	  processing and return the <code>XMLQuery</code> unadorned with
+	  any results.
+	</p>
+<p>Here's the code:</p>
+<div class="source"><pre>import java.util.Iterator;
+...
+public class ConstantHandler
+  implements QueryHandler {
+  ...
+  private static boolean isAcceptableType(XMLQuery q) {
+    List mimes = q.getMimeAccept();
+    if (mimes.isEmpty()) return true;
+    for (Iterator i = mimes.iterator(); i.hasNext();) {
+      String type = (String) i.next();
+      if ("text/plain".equals(type)
+        || "text/*".equals(type)
+        || "*/*".equals(type)) return true;
+    }
+    return false;
+  }
+}</pre>
+</div>
+<p>Here, we check if the list of acceptable MIME types is empty.
+	  An empty list is the same as saying <code>*/*</code>, so that
+	  automatically says we've got an acceptable type.  For a
+	  non-empty list, we go through each type one-by-one.  If it's
+	  any of the strings <code>text/plain</code>,
+	  <code>text/*</code>, or <code>*/*</code>, then that's an
+	  acceptable type.
+	</p>
+<p>However, if we get through the entire list and we don't find
+	  any type that the user wants that we can provide, we return
+	  <code>false</code>.  The query handler will check for a
+	  <code>false</code> value and return early from handling the
+	  query, leaving the <code>XMLQuery</code> untouched.
+	</p>
+</div>
+<div class="section"><h3><a name="Inserting_the_Result" id="Inserting_the_Result"></a>Inserting the Result</h3>
+<p>Assuming the query handler has found an acceptable MIME type,
+	  and has found a valid query and the name of the desired
+	  constant, it can lookup the constant in the
+	  <code>CONSTANTS</code> map.  And assuming it finds a matching
+	  constant in that map, it can insert the value as a
+	  <code>Result</code> object.
+	</p>
+<p>To insert the constant's value, we'll develop yet another
+	  utility method, this time called <code>insert</code>.  This
+	  method will take the name of the constant, its value, and the
+	  <code>XMLQuery</code>.  It will add a <code>Result</code>
+	  object to the <code>XMLQuery</code>.  When the query handler
+	  returns this modified <code>XMLQuery</code> object, the
+	  framework will return it to the product client, which can then
+	  display the matching result.
+	</p>
+<p><code>Result</code> objects can also have optional
+	  <code>Header</code> objects that serve as "column headings"
+	  for tabular like results.  Our result isn't tabular, it's just
+	  a single value, but we'll add a heading anyway just to
+	  demonstrate how it's done.  (You could argue that it's a
+	  one-by-one table, too!)  The header's name will be the same as
+	  the constant's name; the data type will be <code>real</code>
+	  and the units will be <code>none</code>.
+	</p>
+<p>Here's the code:</p>
+<div class="source"><pre>import java.util.Collections;
+import jpl.eda.xmlquery.Header;
+import jpl.eda.xmlquery.Result;
+...
+public class ConstantHandler
+  implements QueryHandler {
+  ...
+  private static void insert(String name,
+    String value, XMLQuery q) {
+    Header h = new Header(name, "real", "none");
+    Result r = new Result(name, "text/plain",
+      /*profileID*/null, /*resourceID*/null,
+      Collections.singletonList(h),
+      value, /*classified*/false, Result.INFINITE);
+    q.getResults().add(r);
+  }
+}</pre>
+</div>
+<p>In this method, we first create the header.  Then we create
+	  the result; the result's ID (which differentiates it from
+	  other results in the same <code>XMLQuery</code> is just the
+	  name of the constant.  Its MIME type is
+	  <code>text/plain</code>.  We set the profile ID and resource
+	  ID fields to <code>null</code>, as recommended back in the <a href="http://oodt.apache.org/edm-query/tutorial/">XMLQuery Tutorial</a>.  Then we
+	  add our sole header.  Then we add the mathematical constant's
+	  value.  Finally, this constant isn't classified, so we set the
+	  classified flag to <code>false</code>.  Also, these
+	  mathematical constants should be valid forever, so we set the
+	  validity period to <code>Result.INFINITE</code>, a special
+	  value that means a never-ending validity period.
+	</p>
+</div>
+<div class="section"><h3><a name="Handling_the_Query" id="Handling_the_Query"></a>Handling the Query</h3>
+<p>With all of these utility methods in hand, it's easy to
+	  handle the query now.  The
+	  <code>jpl.eda.product.QueryHandler</code> interface
+	  specifies a single method that we must implement,
+	  <code>query</code>.  This method accepts an
+	  <code>XMLQuery</code> object and returns an
+	  <code>XMLQuery</code> object.  The returned one may or may
+	  not be adorned with matching results.
+	</p>
+<p>Here's what we have to do:</p>
+<ol type="1"><li>Get the constant name with <code>getConstantName</code>.
+	    If we get <code>null</code>, it means the query's not of
+	    the form <code>constant = <var>name</var></code>, so we
+	    ignore it.
+	  </li>
+<li>See if the user's willing to accept a
+	    <code>text/plain</code> MIME type.  If not, we ignore this query.
+	  </li>
+<li>Find the constant in our <code>CONSTANTS</code> map.  If
+	    it's not there, we ignore this query.
+	  </li>
+<li>Insert the constant's value into the <code>XMLQuery</code>.</li>
+<li>Returned the modified <code>XMLQuery</code>.</li>
+</ol><p>The source:</p>
+<div class="source"><pre>public class ConstantHandler
+  implements QueryHandler {
+  ...
+  public XMLQuery query(XMLQuery q) {
+    String name = getConstantName(q);
+    if (name == null) return q;
+    if (!isAcceptableType(q)) return q;
+    String value = (String) CONSTANTS.get(name);
+    if (value == null) return q;
+    insert(name, value, q);
+    return q;
+  }
+}</pre>
+</div>
+</div>
+<div class="section"><h3><a name="Complete_Source_Code" id="Complete_Source_Code"></a>Complete Source Code</h3>
+<p>Here is the complete source file,
+	<code>ConstantHandler.java</code>:</p>
+<div class="source"><pre>import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import jpl.eda.product.QueryHandler;
+import jpl.eda.xmlquery.Header;
+import jpl.eda.xmlquery.Result;
+import jpl.eda.xmlquery.QueryElement;
+import jpl.eda.xmlquery.XMLQuery;
+
+public class ConstantHandler
+  implements QueryHandler {
+  private static final Map CONSTANTS = new HashMap();
+  static {
+    CONSTANTS.put("pi",    "3.14159265...");
+    CONSTANTS.put("e",     "2.7182818285...");
+    CONSTANTS.put("gamma", "0.577215664...");
+  }
+  private static String getConstantName(XMLQuery q) {
+    List stack = q.getWhereElementSet();
+    if (stack.size() != 3) return null;
+    QueryElement e = (QueryElement) stack.get(0);
+    if (!"elemName".equals(e.getRole())
+      || !"constant".equals(e.getValue()))
+      return null;
+    e = (QueryElement) stack.get(2);
+    if (!"RELOP".equals(e.getRole())
+      || !"EQ".equals(e.getValue()))
+      return null;
+    e = (QueryElement) stack.get(1);
+    if (!"LITERAL".equals(e.getRole()))
+	return null;
+    return e.getValue();
+  }
+  private static boolean isAcceptableType(XMLQuery q) {
+    List mimes = q.getMimeAccept();
+    if (mimes.isEmpty()) return true;
+    for (Iterator i = mimes.iterator(); i.hasNext();) {
+      String type = (String) i.next();
+      if ("text/plain".equals(type)
+        || "text/*".equals(type)
+        || "*/*".equals(type)) return true;
+    }
+    return false;
+  }
+  private static void insert(String name,
+    String value, XMLQuery q) {
+    Header h = new Header(name, "real", "none");
+    Result r = new Result(name, "text/plain",
+      /*profileID*/null, /*resourceID*/null,
+      Collections.singletonList(h),
+      value, /*classified*/false, Result.INFINITE);
+    q.getResults().add(r);
+  }
+  public XMLQuery query(XMLQuery q) {
+    String name = getConstantName(q);
+    if (name == null) return q;
+    if (!isAcceptableType(q)) return q;
+    String value = (String) CONSTANTS.get(name);
+    if (value == null) return q;
+    insert(name, value, q);
+    return q;
+  }
+}</pre>
+</div>
+<p>How should you go about compiling this and installing it in
+	  a product server?  Read on!
+	</p>
+</div>
+</div><div class="section"><h2><a name="Compiling_the_Code" id="Compiling_the_Code"></a>Compiling the Code</h2>
+<p>We'll compile this code using the J2SDK command-line tools,
+	but if you're more comfortable with some kind of Integrated
+	Development Environment (IDE), adjust as necessary.
+      </p>
+<p>First, let's go back to the <code>$PS_HOME</code> directory
+	we made earlier and make directories to hold both the source
+	code and classes that we'll compile from it:
+      </p>
+<div class="source"><pre>% <b>cd $PS_HOME</b>
+% <b>mkdir classes src</b></pre>
+</div>
+<p>Then, create <code>$PS_HOME/src/ConstantHandler.java</code> using
+	your favorite text editor (or by cutting and pasting the source
+	from this page, or whatever).  Finally, compile the file as follows:
+      </p>
+<div class="source"><pre>% <b>javac -extdirs lib \
+  -d classes src/ConstantHandler.java</b>
+% ls -l classes
+total 4
+-rw-r--r--  1 kelly  kelly  2524 25 Feb 15:46 ConstantHandler.class</pre>
+</div>
+<p>The <code>javac</code> command is the Java compiler.  The
+	<code>-extdirs lib</code> arguments tell the compiler where to
+	find extension jars.  In this case, the code references things
+	defined in edm-query-2.0.2.jar and grid-product-3.0.3.jar.
+	The <code>-d classes</code> tells where compiled classes
+	should go.
+      </p>
+<p>Next, make a jar file that contains your compiled class:</p>
+<div class="source"><pre>% <b>jar -cf lib/my-handlers.jar \
+  -C classes ConstantHandler.class</b>
+% <b>jar -tf lib/my-handlers.jar</b>
+META-INF/
+META-INF/MANIFEST.MF
+ConstantHandler.class</pre>
+</div>
+<p>We now have a new jar file of our own creation in the
+	<code>$PS_HOME/lib</code> directory; this means that the
+	product server will be able to find out new query handler.
+	All we have to do now is tell our product server about it.
+      </p>
+</div><div class="section"><h2><a name="Specfying_the_Query_Handler" id="Specfying_the_Query_Handler"></a>Specfying the Query Handler</h2>
+<p>Query handlers aren't really <em>installed</em> into product
+	servers.  What you do is tell the product server what query
+	handlers you want it to use by naming their classes.  The
+	product server will instantiate an object of each class and,
+	as queries come in, it will delegate queries to each
+	instantiated query handler.
+      </p>
+<p>To tell a product server what query handlers to instantiate,
+	you specify a system property called <code>handlers</code>.
+	You set this property to a comma-separated list of class
+	names.  These should be fully-qualified class names (with
+	package prefixes, if you used packages when making your query
+	handlers), separated by commas.  In this tutorial, we made
+	just one query handler, and we didn't put it into a package,
+	so we'll just use <code>ConstantHandler</code>.
+      </p>
+<p>First, stop any product server you have running now by
+	pressing CTRL+C (or whatever your interrupt key is) in the
+	window that was running the product server.  Next, modify the
+	<code>$PS_HOME/bin/ps</code> file so it reads as follows:
+      </p>
+<div class="source"><pre>#!/bin/sh
+exec java -Djava.ext.dirs=$PS_HOME/lib \
+    -Dhandlers=ConstantHandler \
+    jpl.eda.ExecServer \
+    jpl.eda.product.rmi.ProductServiceImpl \
+    urn:eda:rmi:MyProductService</pre>
+</div>
+<p>We specified a system property on the command line using
+	Java's <code>-D</code> option.  This defines the system
+	property <code>handlers</code> as having the value
+	<code>ConstantHandler</code>.  Finally, start the product
+	server again by running <code>$PS_HOME/bin/ps</code>.
+      </p>
+</div><div class="section"><h2><a name="Querying_for_Constants" id="Querying_for_Constants"></a>Querying for Constants</h2>
+<p>Once again, edit the <code>$PS_HOME/bin/pc</code> script and
+	change <code>-xml</code> back to <code>-out</code> so that
+	instead of the XML output we'll see the raw product data.
+	Then run it and see what happens:
+      </p>
+<div class="source"><pre>% <b>$PS_HOME/bin/pc 'constant = pi'</b>
+3.14159265...% </pre>
+</div>
+<p>Because the raw product data was the string
+	<code>3.14159265...</code> without any trailing newline, the
+	shell's prompt appeared right at the end of the product
+	result.  You might try piping the output of the above command
+	through a pager like <code>more</code> or <code>less</code> to
+	avoid this.
+      </p>
+<p>Here's what happened when we ran this command:</p>
+<ol type="1"><li>The product client created an <code>XMLQuery</code> object
+	  out of the string query <code>constant = pi</code>.
+	</li>
+<li>It asked the RMI Registry to tell it where (network
+	  address) it could find the product service named
+	  <code>MyProductService</code>.
+	</li>
+<li>After getting the response back from the RMI Registry, it
+	  then contacted the product service over a network connection
+	  (even if to the same local system) and asked it to handle
+	  the query, passing the query object.
+	</li>
+<li>The product service had only one query handler, the
+	  <code>ConstantHandler</code>, to which to delegate, so it
+	  passed the XMLQuery to it.
+	</li>
+<li>The <code>ConstantHandler</code>'s <code>query</code>
+	  method was called.  It checked if the query was the kind it
+	  wanted, extracted the desired mathematical constant's name,
+	  checked for an acceptable requested MIME type, looked up the
+	  constant's value, inserted it as a <code>Result</code> into
+	  the <code>XMLQuery</code>, and returned the modified query.
+	</li>
+<li>The product service, seeing it had no other handlers to
+	  try, returned the modified <code>XMLQuery</code> to the
+	  product client over the network connection.
+	</li>
+<li>The product client took the first <code>Result</code> out
+	  of the <code>XMLQuery</code>, called
+	  <code>Result.getInputStream</code>, and copied each byte of
+	  the result to the standard output.  This wrote
+	  <code>3.14159265...</code> to your window.
+	</li>
+</ol><p>If you change the <code>$PS_HOME/bin/pc</code> script again
+	so that instead of <code>-out</code> it's <code>-xml</code>,
+	you'll again see the XMLQuery as an XML document.  The interesting part is the <code>&lt;queryResultSet&gt;</code>:
+      </p>
+<div class="source"><pre>&lt;queryResultSet&gt;
+  &lt;resultElement classified="false" validity="-1"&gt;
+    &lt;resultId&gt;pi&lt;/resultId&gt;
+    &lt;resultMimeType&gt;text/plain&lt;/resultMimeType&gt;
+    &lt;profId/&gt;
+    &lt;identifier/&gt;
+    &lt;resultHeader&gt;
+      &lt;headerElement&gt;
+	&lt;elemName&gt;pi&lt;/elemName&gt;
+	&lt;elemType&gt;real&lt;/elemType&gt;
+	&lt;elemUnit&gt;none&lt;/elemUnit&gt;
+      &lt;/headerElement&gt;
+    &lt;/resultHeader&gt;
+    &lt;resultValue xml:space="preserve"&gt;3.14159265...&lt;/resultValue&gt;
+  &lt;/resultElement&gt;
+&lt;/queryResultSet&gt;</pre>
+</div>
+<p>I'll let you figure out how this maps to the
+	<code>Result</code> object we created in the code.  OK, so is
+	this really interesting?  Not really, except to note that the
+	actual result data, <code>3.1415265...</code>, appears in the
+	XML document.  In the OODT framework, we call this a "small"
+	result, because the product data was embedded in the XMLQuery
+	object.  Text data like <code>text/plain</code> products
+	appear just as text.  Binary data like <code>image/jpeg</code>
+	and <code>application/octet-stream</code> get base-64 encoded
+	into text.
+      </p>
+<p>As you can guess, there's a point at which encoded data goes
+	from being nice and small and tidy to just too large to
+	contain in a single object.  In the OODT framework, we can use
+	a special query handler for such large products, but that's
+	another tutorial.
+      </p>
+</div><div class="section"><h2><a name="Conclusion" id="Conclusion"></a>Conclusion</h2>
+<p>In this tutorial, we learned how to write a complete query
+	handler for a product server, including handling of postfix
+	boolean "where" stacks, lists of acceptable MIME types, and
+	result headers.  We compiled the query handler, put it into a
+	jar file, and specified it to our product server.  And we
+	could even query it and get data back.
+      </p>
+<p>Don't toss out this product server yet, though.  Another
+	tutorial will use it and cover the infamous
+	<code>LargeProductQueryHandler</code>.
+      </p>
+</div></div><div class="visualClear"></div></div><div class="triptychRight"><div class="columnBorder"><div class="visualPadding" id="rightPlate"><div id="navcolumn">&#13;
+           &#13;
+  &#13;
+&#13;
+  &#13;
+    &#13;
+  &#13;
+  &#13;
+    &#13;
+                   <h5>Project Documentation</h5>&#13;
+            <ul><li class="collapsed">&#13;
+                    <a href="../../project-info.html">Project Information</a>&#13;
+                </li>&#13;
+              &#13;
+                &#13;
+              &#13;
+      &#13;
+            &#13;
+      &#13;
+            &#13;
+      &#13;
+            &#13;
+      &#13;
+              &#13;
+        <li class="collapsed">&#13;
+                    <a href="../../project-reports.html">Project Reports</a>&#13;
+                </li>&#13;
+          </ul><h5>User's Guide</h5>&#13;
+            <ul><li class="none">&#13;
+                    <a href="../../tutorials/">Tutorials</a>&#13;
+          </li>&#13;
+              &#13;
+    <li class="none">&#13;
+                    <a href="../../servlet/">Product Servlet</a>&#13;
+          </li>&#13;
+          </ul>&#13;
+                       &#13;
+  &#13;
+&#13;
+  &#13;
+    &#13;
+  &#13;
+  &#13;
+    &#13;
+        </div></div></div></div></div></div><div style="clear: both;"> </div></div><div id="push"></div></div><div id="footerWrapper"><div id="footerGradient"></div><div id="footer"><a id="footerLogo" href="http://oodt.apache.org/" name="footerLogo"></a><p>
+                    Apache™ OODT is © 2010 by the Apache Software Foundation (ASF). Apache and the Apache
+                    feather logo are trademarks of the ASF.
+                </p><p>
+                    Apache™ OODT OODT is a Top Level Project and endorsed by the ASF. You are full of win.
+                </p><div id="sitemap"><dl><dt><a href="http://oodt.apache.org/about">About OODT</a></dt><dd><a href="http://oodt.apache.org/about/history">History</a></dd><dd><a href="http://oodt.apache.org/about/users">Users</a></dd><dd><a href="http://oodt.apache.org/about/incubation">Incubation</a></dd></dl><dl><dt><a href="http://www.apache.org/">Apache</a></dt><dd><a href="http://incubator.apache.org/">Incubator</a></dd><dd><a href="http://www.apache.org/licenses">License</a></dd><dd><a href="http://www.apache.org/foundation/sponsorship.html">Donate</a></dd><dd><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></dd><dd><a href="http://www.apache.org/security/">Security</a></dd></dl><dl><dt><a href="http://oodt.apache.org/components">Components</a></dt><dd><a href="http://oodt.apache.org/components/agility">Agility</a></dd><dd><a href="http://oodt.apache.org/components/cas">Catalog &amp; Archive</a></dd><dd><a href="http://oodt.apache.org/components/maven/
 xmlquery">Query</a></dd><dd><a href="http://oodt.apache.org/components/grid">Grid</a></dd><dd><a href="http://oodt.apache.org/components/common">Common</a></dd></dl><dl><dt><a href="http://oodt.apache.org/development">Development</a></dt><dd><a href="http://oodt.apache.org/development/roadmap">Roadmap</a></dd><dd><a href="http://oodt.apache.org/development/bugs">Report Bugs</a></dd><dd><a href="http://oodt.apache.org/development/source">Source Code</a></dd><dd><a href="http://oodt.apache.org/contact">Mailing Lists</a></dd></dl><dl><dt><a href="http://oodt.apache.org/contact">Social</a></dt><dd><a href="http://www.facebook.com/group.php?gid=322088549131">Facebook</a></dd><dd><a href="http://twitter.com/apache_oodt/">Twitter</a></dd><dd><a href="irc://irc.freenode.net/#oodt">Chat Room</a></dd></dl></div></div></div></body></html>
\ No newline at end of file

Added: oodt/site/components/maven/xref-test/org/apache/oodt/cas/filemgr/system/TestXmlRpcFileManager.html
URL: http://svn.apache.org/viewvc/oodt/site/components/maven/xref-test/org/apache/oodt/cas/filemgr/system/TestXmlRpcFileManager.html?rev=1079659&view=auto
==============================================================================
--- oodt/site/components/maven/xref-test/org/apache/oodt/cas/filemgr/system/TestXmlRpcFileManager.html (added)
+++ oodt/site/components/maven/xref-test/org/apache/oodt/cas/filemgr/system/TestXmlRpcFileManager.html Wed Mar  9 03:57:15 2011
@@ -0,0 +1,284 @@
+<?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>TestXmlRpcFileManager xref</title><link type="text/css" rel="stylesheet" href="../../../../../../stylesheet.css" /></head><body>
+<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.cas.filemgr.system;
+<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.io.File;
+<a name="22" href="#22" id="22">22</a>  <strong class="jxr_keyword">import</strong> java.io.FileInputStream;
+<a name="23" href="#23" id="23">23</a>  <strong class="jxr_keyword">import</strong> java.io.IOException;
+<a name="24" href="#24" id="24">24</a>  <strong class="jxr_keyword">import</strong> java.net.URL;
+<a name="25" href="#25" id="25">25</a>  <strong class="jxr_keyword">import</strong> java.util.Collections;
+<a name="26" href="#26" id="26">26</a>  
+<a name="27" href="#27" id="27">27</a>  <em class="jxr_comment">//OODT imports</em>
+<a name="28" href="#28" id="28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.ingest.StdIngester;
+<a name="29" href="#29" id="29">29</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.metadata.CoreMetKeys;
+<a name="30" href="#30" id="30">30</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.metadata.ProductMetKeys;
+<a name="31" href="#31" id="31">31</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.structs.Product;
+<a name="32" href="#32" id="32">32</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.structs.exceptions.CatalogException;
+<a name="33" href="#33" id="33">33</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.metadata.Metadata;
+<a name="34" href="#34" id="34">34</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.metadata.SerializableMetadata;
+<a name="35" href="#35" id="35">35</a>  
+<a name="36" href="#36" id="36">36</a>  <em class="jxr_comment">//Junit imports</em>
+<a name="37" href="#37" id="37">37</a>  <strong class="jxr_keyword">import</strong> junit.framework.TestCase;
+<a name="38" href="#38" id="38">38</a>  
+<a name="39" href="#39" id="39">39</a>  <em class="jxr_javadoccomment">/**</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"> * Test harness for the XmlRpcFileManager.</em>
+<a name="42" href="#42" id="42">42</a>  <em class="jxr_javadoccomment"> * </em>
+<a name="43" href="#43" id="43">43</a>  <em class="jxr_javadoccomment"> * @since OODT-72</em>
+<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"> */</em>
+<a name="46" href="#46" id="46">46</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/oodt/cas/filemgr/system/TestXmlRpcFileManager.html">TestXmlRpcFileManager</a> <strong class="jxr_keyword">extends</strong> TestCase {
+<a name="47" href="#47" id="47">47</a>  
+<a name="48" href="#48" id="48">48</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> FM_PORT = 50001;
+<a name="49" href="#49" id="49">49</a>  
+<a name="50" href="#50" id="50">50</a>    <strong class="jxr_keyword">private</strong> XmlRpcFileManager 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> String luceneCatLoc;
+<a name="53" href="#53" id="53">53</a>  
+<a name="54" href="#54" id="54">54</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String transferServiceFacClass = <span class="jxr_string">"org.apache.oodt.cas."</span>
+<a name="55" href="#55" id="55">55</a>        + <span class="jxr_string">"filemgr.datatransfer.LocalDataTransferFactory"</span>;
+<a name="56" href="#56" id="56">56</a>  
+<a name="57" href="#57" id="57">57</a>    <em class="jxr_javadoccomment">/**</em>
+<a name="58" href="#58" id="58">58</a>  <em class="jxr_javadoccomment">   * @since OODT-72</em>
+<a name="59" href="#59" id="59">59</a>  <em class="jxr_javadoccomment">   */</em>
+<a name="60" href="#60" id="60">60</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testExpandProductMet() {
+<a name="61" href="#61" id="61">61</a>      XmlRpcFileManagerClient fmc = <strong class="jxr_keyword">null</strong>;
+<a name="62" href="#62" id="62">62</a>      <strong class="jxr_keyword">try</strong> {
+<a name="63" href="#63" id="63">63</a>        fmc = <strong class="jxr_keyword">new</strong> XmlRpcFileManagerClient(<strong class="jxr_keyword">new</strong> URL(<span class="jxr_string">"http://localhost:"</span> + FM_PORT));
+<a name="64" href="#64" id="64">64</a>      } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="65" href="#65" id="65">65</a>        fail(e.getMessage());
+<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>      Metadata met = <strong class="jxr_keyword">null</strong>;
+<a name="69" href="#69" id="69">69</a>      <strong class="jxr_keyword">try</strong> {
+<a name="70" href="#70" id="70">70</a>        met = fmc.getMetadata(fmc.getProductByName(<span class="jxr_string">"test.txt"</span>));
+<a name="71" href="#71" id="71">71</a>      } <strong class="jxr_keyword">catch</strong> (CatalogException e) {
+<a name="72" href="#72" id="72">72</a>        e.printStackTrace();
+<a name="73" href="#73" id="73">73</a>        fail(e.getMessage());
+<a name="74" href="#74" id="74">74</a>      }
+<a name="75" href="#75" id="75">75</a>  
+<a name="76" href="#76" id="76">76</a>      assertNotNull(met);
+<a name="77" href="#77" id="77">77</a>      assertTrue(met.containsKey(ProductMetKeys.PRODUCT_ID));
+<a name="78" href="#78" id="78">78</a>      assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_ID));
+<a name="79" href="#79" id="79">79</a>      assertTrue(met.containsKey(ProductMetKeys.PRODUCT_NAME));
+<a name="80" href="#80" id="80">80</a>      assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_NAME));
+<a name="81" href="#81" id="81">81</a>      assertTrue(met.containsKey(ProductMetKeys.PRODUCT_STRUCTURE));
+<a name="82" href="#82" id="82">82</a>      assertEquals(<span class="jxr_string">"Flat"</span>, met.getMetadata(ProductMetKeys.PRODUCT_STRUCTURE));
+<a name="83" href="#83" id="83">83</a>      assertTrue(met.containsKey(ProductMetKeys.PRODUCT_TRANSFER_STATUS));
+<a name="84" href="#84" id="84">84</a>      assertEquals(Product.STATUS_RECEIVED, met
+<a name="85" href="#85" id="85">85</a>          .getMetadata(ProductMetKeys.PRODUCT_TRANSFER_STATUS));
+<a name="86" href="#86" id="86">86</a>  
+<a name="87" href="#87" id="87">87</a>      assertTrue(met.containsKey(ProductMetKeys.PRODUCT_ORIG_REFS));
+<a name="88" href="#88" id="88">88</a>      assertTrue(met.containsKey(ProductMetKeys.PRODUCT_DATASTORE_REFS));
+<a name="89" href="#89" id="89">89</a>      assertTrue(met.containsKey(ProductMetKeys.PRODUCT_FILE_SIZES));
+<a name="90" href="#90" id="90">90</a>      assertTrue(met.containsKey(ProductMetKeys.PRODUCT_MIME_TYPES));
+<a name="91" href="#91" id="91">91</a>  
+<a name="92" href="#92" id="92">92</a>      assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_ORIG_REFS).size());
+<a name="93" href="#93" id="93">93</a>      assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_DATASTORE_REFS)
+<a name="94" href="#94" id="94">94</a>          .size());
+<a name="95" href="#95" id="95">95</a>      assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_FILE_SIZES)
+<a name="96" href="#96" id="96">96</a>          .size());
+<a name="97" href="#97" id="97">97</a>      assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_MIME_TYPES)
+<a name="98" href="#98" id="98">98</a>          .size());
+<a name="99" href="#99" id="99">99</a>  
+<a name="100" href="#100" id="100">100</a>     String origPath = <strong class="jxr_keyword">null</strong>;
+<a name="101" href="#101" id="101">101</a>     <strong class="jxr_keyword">try</strong> {
+<a name="102" href="#102" id="102">102</a>       origPath = <strong class="jxr_keyword">new</strong> File(<span class="jxr_string">"./src/testdata/ingest/test.txt"</span>).getCanonicalPath();
+<a name="103" href="#103" id="103">103</a>     } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="104" href="#104" id="104">104</a>       fail(e.getMessage());
+<a name="105" href="#105" id="105">105</a>     }
+<a name="106" href="#106" id="106">106</a>     assertEquals(origPath, met.getMetadata(ProductMetKeys.PRODUCT_ORIG_REFS));
+<a name="107" href="#107" id="107">107</a>     assertEquals(<span class="jxr_string">"/tmp/test.txt/test.txt"</span>, met
+<a name="108" href="#108" id="108">108</a>         .getMetadata(ProductMetKeys.PRODUCT_DATASTORE_REFS));
+<a name="109" href="#109" id="109">109</a> 
+<a name="110" href="#110" id="110">110</a>     assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_FILE_SIZES));
+<a name="111" href="#111" id="111">111</a>     assertEquals(<span class="jxr_string">"text/plain"</span>, met
+<a name="112" href="#112" id="112">112</a>         .getMetadata(ProductMetKeys.PRODUCT_MIME_TYPES));
+<a name="113" href="#113" id="113">113</a> 
+<a name="114" href="#114" id="114">114</a>     <strong class="jxr_keyword">try</strong> {
+<a name="115" href="#115" id="115">115</a>       met = fmc.getReducedMetadata(fmc.getProductByName(<span class="jxr_string">"test.txt"</span>),
+<a name="116" href="#116" id="116">116</a>           Collections.EMPTY_LIST);
+<a name="117" href="#117" id="117">117</a>     } <strong class="jxr_keyword">catch</strong> (CatalogException e) {
+<a name="118" href="#118" id="118">118</a>       e.printStackTrace();
+<a name="119" href="#119" id="119">119</a>       fail(e.getMessage());
+<a name="120" href="#120" id="120">120</a>     }
+<a name="121" href="#121" id="121">121</a> 
+<a name="122" href="#122" id="122">122</a>     assertNotNull(met);
+<a name="123" href="#123" id="123">123</a>     assertTrue(met.containsKey(ProductMetKeys.PRODUCT_ID));
+<a name="124" href="#124" id="124">124</a>     assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_ID));
+<a name="125" href="#125" id="125">125</a>     assertTrue(met.containsKey(ProductMetKeys.PRODUCT_NAME));
+<a name="126" href="#126" id="126">126</a>     assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_NAME));
+<a name="127" href="#127" id="127">127</a>     assertTrue(met.containsKey(ProductMetKeys.PRODUCT_STRUCTURE));
+<a name="128" href="#128" id="128">128</a>     assertEquals(<span class="jxr_string">"Flat"</span>, met.getMetadata(ProductMetKeys.PRODUCT_STRUCTURE));
+<a name="129" href="#129" id="129">129</a>     assertTrue(met.containsKey(ProductMetKeys.PRODUCT_TRANSFER_STATUS));
+<a name="130" href="#130" id="130">130</a>     assertEquals(Product.STATUS_RECEIVED, met
+<a name="131" href="#131" id="131">131</a>         .getMetadata(ProductMetKeys.PRODUCT_TRANSFER_STATUS));
+<a name="132" href="#132" id="132">132</a> 
+<a name="133" href="#133" id="133">133</a>     assertTrue(met.containsKey(ProductMetKeys.PRODUCT_ORIG_REFS));
+<a name="134" href="#134" id="134">134</a>     assertTrue(met.containsKey(ProductMetKeys.PRODUCT_DATASTORE_REFS));
+<a name="135" href="#135" id="135">135</a>     assertTrue(met.containsKey(ProductMetKeys.PRODUCT_FILE_SIZES));
+<a name="136" href="#136" id="136">136</a>     assertTrue(met.containsKey(ProductMetKeys.PRODUCT_MIME_TYPES));
+<a name="137" href="#137" id="137">137</a> 
+<a name="138" href="#138" id="138">138</a>     assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_ORIG_REFS).size());
+<a name="139" href="#139" id="139">139</a>     assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_DATASTORE_REFS)
+<a name="140" href="#140" id="140">140</a>         .size());
+<a name="141" href="#141" id="141">141</a>     assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_FILE_SIZES)
+<a name="142" href="#142" id="142">142</a>         .size());
+<a name="143" href="#143" id="143">143</a>     assertEquals(1, met.getAllMetadata(ProductMetKeys.PRODUCT_MIME_TYPES)
+<a name="144" href="#144" id="144">144</a>         .size());
+<a name="145" href="#145" id="145">145</a> 
+<a name="146" href="#146" id="146">146</a>     origPath = <strong class="jxr_keyword">null</strong>;
+<a name="147" href="#147" id="147">147</a>     <strong class="jxr_keyword">try</strong> {
+<a name="148" href="#148" id="148">148</a>       origPath = <strong class="jxr_keyword">new</strong> File(<span class="jxr_string">"./src/testdata/ingest/test.txt"</span>).getCanonicalPath();
+<a name="149" href="#149" id="149">149</a>     } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="150" href="#150" id="150">150</a>       fail(e.getMessage());
+<a name="151" href="#151" id="151">151</a>     }
+<a name="152" href="#152" id="152">152</a>     assertEquals(origPath, met.getMetadata(ProductMetKeys.PRODUCT_ORIG_REFS));
+<a name="153" href="#153" id="153">153</a>     assertEquals(<span class="jxr_string">"/tmp/test.txt/test.txt"</span>, met
+<a name="154" href="#154" id="154">154</a>         .getMetadata(ProductMetKeys.PRODUCT_DATASTORE_REFS));
+<a name="155" href="#155" id="155">155</a> 
+<a name="156" href="#156" id="156">156</a>     assertNotNull(met.getMetadata(ProductMetKeys.PRODUCT_FILE_SIZES));
+<a name="157" href="#157" id="157">157</a>     assertEquals(<span class="jxr_string">"text/plain"</span>, met
+<a name="158" href="#158" id="158">158</a>         .getMetadata(ProductMetKeys.PRODUCT_MIME_TYPES));
+<a name="159" href="#159" id="159">159</a> 
+<a name="160" href="#160" id="160">160</a>   }
+<a name="161" href="#161" id="161">161</a> 
+<a name="162" href="#162" id="162">162</a>   <em class="jxr_comment">/*</em>
+<a name="163" href="#163" id="163">163</a> <em class="jxr_comment">   * (non-Javadoc)</em>
+<a name="164" href="#164" id="164">164</a> <em class="jxr_comment">   * </em>
+<a name="165" href="#165" id="165">165</a> <em class="jxr_comment">   * @see junit.framework.TestCase#setUp()</em>
+<a name="166" href="#166" id="166">166</a> <em class="jxr_comment">   */</em>
+<a name="167" href="#167" id="167">167</a>   <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> setUp() <strong class="jxr_keyword">throws</strong> Exception {
+<a name="168" href="#168" id="168">168</a>     startXmlRpcFileManager();
+<a name="169" href="#169" id="169">169</a>     ingestTestFile();
+<a name="170" href="#170" id="170">170</a>   }
+<a name="171" href="#171" id="171">171</a> 
+<a name="172" href="#172" id="172">172</a>   <em class="jxr_comment">/*</em>
+<a name="173" href="#173" id="173">173</a> <em class="jxr_comment">   * (non-Javadoc)</em>
+<a name="174" href="#174" id="174">174</a> <em class="jxr_comment">   * </em>
+<a name="175" href="#175" id="175">175</a> <em class="jxr_comment">   * @see junit.framework.TestCase#tearDown()</em>
+<a name="176" href="#176" id="176">176</a> <em class="jxr_comment">   */</em>
+<a name="177" href="#177" id="177">177</a>   <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> tearDown() <strong class="jxr_keyword">throws</strong> Exception {
+<a name="178" href="#178" id="178">178</a>     fm.shutdown();
+<a name="179" href="#179" id="179">179</a>     fm = <strong class="jxr_keyword">null</strong>;
+<a name="180" href="#180" id="180">180</a> 
+<a name="181" href="#181" id="181">181</a>     <em class="jxr_comment">// blow away lucene cat</em>
+<a name="182" href="#182" id="182">182</a>     deleteAllFiles(luceneCatLoc);
+<a name="183" href="#183" id="183">183</a> 
+<a name="184" href="#184" id="184">184</a>     <em class="jxr_comment">// blow away test file</em>
+<a name="185" href="#185" id="185">185</a>     deleteAllFiles(<span class="jxr_string">"/tmp/test.txt"</span>);
+<a name="186" href="#186" id="186">186</a>   }
+<a name="187" href="#187" id="187">187</a> 
+<a name="188" href="#188" id="188">188</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> deleteAllFiles(String startDir) {
+<a name="189" href="#189" id="189">189</a>     File startDirFile = <strong class="jxr_keyword">new</strong> File(startDir);
+<a name="190" href="#190" id="190">190</a>     File[] delFiles = startDirFile.listFiles();
+<a name="191" href="#191" id="191">191</a> 
+<a name="192" href="#192" id="192">192</a>     <strong class="jxr_keyword">if</strong> (delFiles != <strong class="jxr_keyword">null</strong> &amp;&amp; delFiles.length &gt; 0) {
+<a name="193" href="#193" id="193">193</a>       <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; delFiles.length; i++) {
+<a name="194" href="#194" id="194">194</a>         delFiles[i].delete();
+<a name="195" href="#195" id="195">195</a>       }
+<a name="196" href="#196" id="196">196</a>     }
+<a name="197" href="#197" id="197">197</a> 
+<a name="198" href="#198" id="198">198</a>     startDirFile.delete();
+<a name="199" href="#199" id="199">199</a> 
+<a name="200" href="#200" id="200">200</a>   }
+<a name="201" href="#201" id="201">201</a> 
+<a name="202" href="#202" id="202">202</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> ingestTestFile() {
+<a name="203" href="#203" id="203">203</a>     Metadata prodMet = <strong class="jxr_keyword">null</strong>;
+<a name="204" href="#204" id="204">204</a>     StdIngester ingester = <strong class="jxr_keyword">new</strong> StdIngester(transferServiceFacClass);
+<a name="205" href="#205" id="205">205</a> 
+<a name="206" href="#206" id="206">206</a>     <strong class="jxr_keyword">try</strong> {
+<a name="207" href="#207" id="207">207</a>       prodMet = <strong class="jxr_keyword">new</strong> SerializableMetadata(<strong class="jxr_keyword">new</strong> FileInputStream(
+<a name="208" href="#208" id="208">208</a>           <span class="jxr_string">"./src/testdata/ingest/test.txt.met"</span>));
+<a name="209" href="#209" id="209">209</a> 
+<a name="210" href="#210" id="210">210</a>       <em class="jxr_comment">// now add the right file location</em>
+<a name="211" href="#211" id="211">211</a>       prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, <strong class="jxr_keyword">new</strong> File(
+<a name="212" href="#212" id="212">212</a>           <span class="jxr_string">"./src/testdata/ingest"</span>).getCanonicalPath());
+<a name="213" href="#213" id="213">213</a>       prodMet.addMetadata(CoreMetKeys.FILENAME, <span class="jxr_string">"test.txt"</span>);
+<a name="214" href="#214" id="214">214</a>       prodMet.addMetadata(CoreMetKeys.PRODUCT_TYPE, <span class="jxr_string">"GenericFile"</span>);
+<a name="215" href="#215" id="215">215</a>       ingester.ingest(<strong class="jxr_keyword">new</strong> URL(<span class="jxr_string">"http://localhost:"</span> + FM_PORT), <strong class="jxr_keyword">new</strong> File(
+<a name="216" href="#216" id="216">216</a>           <span class="jxr_string">"./src/testdata/ingest/test.txt"</span>), prodMet);
+<a name="217" href="#217" id="217">217</a>     } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="218" href="#218" id="218">218</a>       fail(e.getMessage());
+<a name="219" href="#219" id="219">219</a>     }
+<a name="220" href="#220" id="220">220</a>   }
+<a name="221" href="#221" id="221">221</a> 
+<a name="222" href="#222" id="222">222</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> startXmlRpcFileManager() {
+<a name="223" href="#223" id="223">223</a>     <em class="jxr_comment">// first make sure to load properties for the file manager</em>
+<a name="224" href="#224" id="224">224</a>     <em class="jxr_comment">// and make sure to load logging properties as well</em>
+<a name="225" href="#225" id="225">225</a> 
+<a name="226" href="#226" id="226">226</a>     <em class="jxr_comment">// set the log levels</em>
+<a name="227" href="#227" id="227">227</a>     System.setProperty(<span class="jxr_string">"java.util.logging.config.file"</span>, <strong class="jxr_keyword">new</strong> File(
+<a name="228" href="#228" id="228">228</a>         <span class="jxr_string">"./src/main/resources/logging.properties"</span>).getAbsolutePath());
+<a name="229" href="#229" id="229">229</a> 
+<a name="230" href="#230" id="230">230</a>     <em class="jxr_comment">// first load the example configuration</em>
+<a name="231" href="#231" id="231">231</a>     <strong class="jxr_keyword">try</strong> {
+<a name="232" href="#232" id="232">232</a>       System.getProperties().load(
+<a name="233" href="#233" id="233">233</a>           <strong class="jxr_keyword">new</strong> FileInputStream(<span class="jxr_string">"./src/main/resources/filemgr.properties"</span>));
+<a name="234" href="#234" id="234">234</a>     } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="235" href="#235" id="235">235</a>       fail(e.getMessage());
+<a name="236" href="#236" id="236">236</a>     }
+<a name="237" href="#237" id="237">237</a> 
+<a name="238" href="#238" id="238">238</a>     <em class="jxr_comment">// override the catalog to use: we'll use lucene</em>
+<a name="239" href="#239" id="239">239</a>     <strong class="jxr_keyword">try</strong> {
+<a name="240" href="#240" id="240">240</a>       luceneCatLoc = <strong class="jxr_keyword">new</strong> File(<span class="jxr_string">"./src/testdata/ingest/cat"</span>).getCanonicalPath();
+<a name="241" href="#241" id="241">241</a>     } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="242" href="#242" id="242">242</a>       fail(e.getMessage());
+<a name="243" href="#243" id="243">243</a>     }
+<a name="244" href="#244" id="244">244</a> 
+<a name="245" href="#245" id="245">245</a>     System.setProperty(<span class="jxr_string">"filemgr.catalog.factory"</span>,
+<a name="246" href="#246" id="246">246</a>         <span class="jxr_string">"org.apache.oodt.cas.filemgr.catalog.LuceneCatalogFactory"</span>);
+<a name="247" href="#247" id="247">247</a>     System.setProperty(<span class="jxr_string">"org.apache.oodt.cas.filemgr.catalog.lucene.idxPath"</span>,
+<a name="248" href="#248" id="248">248</a>         luceneCatLoc);
+<a name="249" href="#249" id="249">249</a> 
+<a name="250" href="#250" id="250">250</a>     <em class="jxr_comment">// now override the repo mgr policy</em>
+<a name="251" href="#251" id="251">251</a>     <strong class="jxr_keyword">try</strong> {
+<a name="252" href="#252" id="252">252</a>       System.setProperty(<span class="jxr_string">"org.apache.oodt.cas.filemgr.repositorymgr.dirs"</span>,
+<a name="253" href="#253" id="253">253</a>           <span class="jxr_string">"file://"</span>
+<a name="254" href="#254" id="254">254</a>               + <strong class="jxr_keyword">new</strong> File(<span class="jxr_string">"./src/testdata/ingest/fmpolicy"</span>).getCanonicalPath());
+<a name="255" href="#255" id="255">255</a>     } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="256" href="#256" id="256">256</a>       fail(e.getMessage());
+<a name="257" href="#257" id="257">257</a>     }
+<a name="258" href="#258" id="258">258</a> 
+<a name="259" href="#259" id="259">259</a>     <em class="jxr_comment">// now override the val layer ones</em>
+<a name="260" href="#260" id="260">260</a>     System.setProperty(<span class="jxr_string">"org.apache.oodt.cas.filemgr.validation.dirs"</span>, <span class="jxr_string">"file://"</span>
+<a name="261" href="#261" id="261">261</a>         + <strong class="jxr_keyword">new</strong> File(<span class="jxr_string">"./src/testdata/ingest/fmpolicy"</span>).getAbsolutePath());
+<a name="262" href="#262" id="262">262</a> 
+<a name="263" href="#263" id="263">263</a>     <em class="jxr_comment">// set up mime repo path</em>
+<a name="264" href="#264" id="264">264</a>     System.setProperty(<span class="jxr_string">"org.apache.oodt.cas.filemgr.mime.type.repository"</span>,
+<a name="265" href="#265" id="265">265</a>         <strong class="jxr_keyword">new</strong> File(<span class="jxr_string">"./src/main/resources/mime-types.xml"</span>).getAbsolutePath());
+<a name="266" href="#266" id="266">266</a> 
+<a name="267" href="#267" id="267">267</a>     <em class="jxr_comment">// override expand product met</em>
+<a name="268" href="#268" id="268">268</a>     System.setProperty(<span class="jxr_string">"org.apache.oodt.cas.filemgr.metadata.expandProduct"</span>,
+<a name="269" href="#269" id="269">269</a>         <span class="jxr_string">"true"</span>);
+<a name="270" href="#270" id="270">270</a> 
+<a name="271" href="#271" id="271">271</a>     <strong class="jxr_keyword">try</strong> {
+<a name="272" href="#272" id="272">272</a>       fm = <strong class="jxr_keyword">new</strong> XmlRpcFileManager(FM_PORT);
+<a name="273" href="#273" id="273">273</a>     } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="274" href="#274" id="274">274</a>       fail(e.getMessage());
+<a name="275" href="#275" id="275">275</a>     }
+<a name="276" href="#276" id="276">276</a>   }
+<a name="277" href="#277" id="277">277</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-test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.html
URL: http://svn.apache.org/viewvc/oodt/site/components/maven/xref-test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.html?rev=1079659&view=auto
==============================================================================
--- oodt/site/components/maven/xref-test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.html (added)
+++ oodt/site/components/maven/xref-test/org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.html Wed Mar  9 03:57:15 2011
@@ -0,0 +1,86 @@
+<?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>TestInPlaceVersioner xref</title><link type="text/css" rel="stylesheet" href="../../../../../../stylesheet.css" /></head><body>
+<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.cas.filemgr.versioning;
+<a name="19" href="#19" id="19">19</a>  
+<a name="20" href="#20" id="20">20</a>  <em class="jxr_comment">//Junit imports</em>
+<a name="21" href="#21" id="21">21</a>  <strong class="jxr_keyword">import</strong> junit.framework.TestCase;
+<a name="22" href="#22" id="22">22</a>  
+<a name="23" href="#23" id="23">23</a>  <em class="jxr_comment">//OODT imports</em>
+<a name="24" href="#24" id="24">24</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.structs.Product;
+<a name="25" href="#25" id="25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.filemgr.structs.Reference;
+<a name="26" href="#26" id="26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.oodt.cas.metadata.Metadata;
+<a name="27" href="#27" id="27">27</a>  
+<a name="28" href="#28" id="28">28</a>  <em class="jxr_javadoccomment">/**</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"> * Test suite for the {@link InPlaceVersioner}.</em>
+<a name="31" href="#31" id="31">31</a>  <em class="jxr_javadoccomment"> * </em>
+<a name="32" href="#32" id="32">32</a>  <em class="jxr_javadoccomment"> * @author davoodi</em>
+<a name="33" href="#33" id="33">33</a>  <em class="jxr_javadoccomment"> * @author mattmann</em>
+<a name="34" href="#34" id="34">34</a>  <em class="jxr_javadoccomment"> * </em>
+<a name="35" href="#35" id="35">35</a>  <em class="jxr_javadoccomment"> */</em>
+<a name="36" href="#36" id="36">36</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/oodt/cas/filemgr/versioning/TestInPlaceVersioner.html">TestInPlaceVersioner</a> <strong class="jxr_keyword">extends</strong> TestCase {
+<a name="37" href="#37" id="37">37</a>  
+<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">   * @since OODT-108</em>
+<a name="40" href="#40" id="40">40</a>  <em class="jxr_javadoccomment">   */</em>
+<a name="41" href="#41" id="41">41</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testVersionerFlat() {
+<a name="42" href="#42" id="42">42</a>      Product p = Product.getDefaultFlatProduct(<span class="jxr_string">"test"</span>, <span class="jxr_string">"urn:oodt:GenericFile"</span>);
+<a name="43" href="#43" id="43">43</a>      Reference r = <strong class="jxr_keyword">new</strong> Reference(<span class="jxr_string">"file:///tmp/test.txt"</span>, <strong class="jxr_keyword">null</strong>, 0L);
+<a name="44" href="#44" id="44">44</a>      p.getProductReferences().add(r);
+<a name="45" href="#45" id="45">45</a>      InPlaceVersioner versioner = <strong class="jxr_keyword">new</strong> InPlaceVersioner();
+<a name="46" href="#46" id="46">46</a>      Metadata met = <strong class="jxr_keyword">new</strong> Metadata();
+<a name="47" href="#47" id="47">47</a>      <strong class="jxr_keyword">try</strong> {
+<a name="48" href="#48" id="48">48</a>        versioner.createDataStoreReferences(p, met);
+<a name="49" href="#49" id="49">49</a>      } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="50" href="#50" id="50">50</a>        fail(e.getMessage());
+<a name="51" href="#51" id="51">51</a>      }
+<a name="52" href="#52" id="52">52</a>      assertTrue(r.getDataStoreReference().equals(r.getOrigReference()));
+<a name="53" href="#53" id="53">53</a>    }
+<a name="54" href="#54" id="54">54</a>  
+<a name="55" href="#55" id="55">55</a>    <em class="jxr_javadoccomment">/**</em>
+<a name="56" href="#56" id="56">56</a>  <em class="jxr_javadoccomment">   * @since OODT-108</em>
+<a name="57" href="#57" id="57">57</a>  <em class="jxr_javadoccomment">   */</em>
+<a name="58" href="#58" id="58">58</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testVersionerHierarchical() {
+<a name="59" href="#59" id="59">59</a>      Product p = Product.getDefaultFlatProduct(<span class="jxr_string">"test"</span>, <span class="jxr_string">"urn:oodt:GenericFile"</span>);
+<a name="60" href="#60" id="60">60</a>      p.setProductStructure(Product.STRUCTURE_HIERARCHICAL);
+<a name="61" href="#61" id="61">61</a>      Reference r = <strong class="jxr_keyword">new</strong> Reference(<span class="jxr_string">"file:///tmp"</span>, <strong class="jxr_keyword">null</strong>, 0L);
+<a name="62" href="#62" id="62">62</a>      Reference r2 = <strong class="jxr_keyword">new</strong> Reference(<span class="jxr_string">"file:///tmp/file1.txt"</span>, <strong class="jxr_keyword">null</strong>, 4096L);
+<a name="63" href="#63" id="63">63</a>      Reference r3 = <strong class="jxr_keyword">new</strong> Reference(<span class="jxr_string">"file:///tmp/file2.txt"</span>, <strong class="jxr_keyword">null</strong>, 4096L);
+<a name="64" href="#64" id="64">64</a>      p.getProductReferences().add(r);
+<a name="65" href="#65" id="65">65</a>      p.getProductReferences().add(r2);
+<a name="66" href="#66" id="66">66</a>      p.getProductReferences().add(r3);
+<a name="67" href="#67" id="67">67</a>      InPlaceVersioner versioner = <strong class="jxr_keyword">new</strong> InPlaceVersioner();
+<a name="68" href="#68" id="68">68</a>      Metadata met = <strong class="jxr_keyword">new</strong> Metadata();
+<a name="69" href="#69" id="69">69</a>      <strong class="jxr_keyword">try</strong> {
+<a name="70" href="#70" id="70">70</a>        versioner.createDataStoreReferences(p, met);
+<a name="71" href="#71" id="71">71</a>      } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="72" href="#72" id="72">72</a>        fail(e.getMessage());
+<a name="73" href="#73" id="73">73</a>      }
+<a name="74" href="#74" id="74">74</a>  
+<a name="75" href="#75" id="75">75</a>      <strong class="jxr_keyword">for</strong> (Reference ref : p.getProductReferences()) {
+<a name="76" href="#76" id="76">76</a>        assertEquals(ref.getDataStoreReference(), ref.getOrigReference());
+<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>  }
+</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