Update version according to OSCI-883
[packages/precise/mcollective.git] / doc / classes / MCollective / DDL.html
diff --git a/doc/classes/MCollective/DDL.html b/doc/classes/MCollective/DDL.html
deleted file mode 100644 (file)
index b8d36f6..0000000
+++ /dev/null
@@ -1,387 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!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" xml:lang="en" lang="en">
-<head>
-  <title>Module: MCollective::DDL</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-  <meta http-equiv="Content-Script-Type" content="text/javascript" />
-  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
-  <script type="text/javascript">
-  // <![CDATA[
-
-  function popupCode( url ) {
-    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
-  }
-
-  function toggleCode( id ) {
-    if ( document.getElementById )
-      elem = document.getElementById( id );
-    else if ( document.all )
-      elem = eval( "document.all." + id );
-    else
-      return false;
-
-    elemStyle = elem.style;
-    
-    if ( elemStyle.display != "block" ) {
-      elemStyle.display = "block"
-    } else {
-      elemStyle.display = "none"
-    }
-
-    return true;
-  }
-  
-  // Make codeblocks hidden by default
-  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
-  
-  // ]]>
-  </script>
-
-</head>
-<body>
-
-
-
-    <div id="classHeader">
-        <table class="header-table">
-        <tr class="top-aligned-row">
-          <td><strong>Module</strong></td>
-          <td class="class-name-in-header">MCollective::DDL</td>
-        </tr>
-        <tr class="top-aligned-row">
-            <td><strong>In:</strong></td>
-            <td>
-                <a href="../../files/lib/mcollective/ddl/discoveryddl_rb.html">
-                lib/mcollective/ddl/discoveryddl.rb
-                </a>
-        <br />
-                <a href="../../files/lib/mcollective/ddl/agentddl_rb.html">
-                lib/mcollective/ddl/agentddl.rb
-                </a>
-        <br />
-                <a href="../../files/lib/mcollective/ddl/validatorddl_rb.html">
-                lib/mcollective/ddl/validatorddl.rb
-                </a>
-        <br />
-                <a href="../../files/lib/mcollective/ddl/base_rb.html">
-                lib/mcollective/ddl/base.rb
-                </a>
-        <br />
-                <a href="../../files/lib/mcollective/ddl/dataddl_rb.html">
-                lib/mcollective/ddl/dataddl.rb
-                </a>
-        <br />
-                <a href="../../files/lib/mcollective/ddl_rb.html">
-                lib/mcollective/ddl.rb
-                </a>
-        <br />
-            </td>
-        </tr>
-
-        </table>
-    </div>
-  <!-- banner header -->
-
-  <div id="bodyContent">
-
-
-
-  <div id="contextContent">
-
-    <div id="description">
-      <p>
-A set of classes that helps create data description language files for
-plugins. You can define meta data, actions, input and output describing the
-behavior of your agent or other plugins
-</p>
-<p>
-<a href="DDL.html">DDL</a> files are used for input validation,
-constructing outputs, producing online help, informing the various display
-routines and so forth.
-</p>
-<p>
-A sample <a href="DDL.html">DDL</a> for an agent be seen below, you&#8216;d
-put this in your agent dir as &lt;agent name&gt;.ddl
-</p>
-<pre>
-   metadata :name        =&gt; &quot;SimpleRPC Service Agent&quot;,
-            :description =&gt; &quot;Agent to manage services using the Puppet service provider&quot;,
-            :author      =&gt; &quot;R.I.Pienaar&quot;,
-            :license     =&gt; &quot;GPLv2&quot;,
-            :version     =&gt; &quot;1.1&quot;,
-            :url         =&gt; &quot;http://mcollective-plugins.googlecode.com/&quot;,
-            :timeout     =&gt; 60
-
-   action &quot;status&quot;, :description =&gt; &quot;Gets the status of a service&quot; do
-      display :always
-
-      input :service,
-            :prompt      =&gt; &quot;Service Name&quot;,
-            :description =&gt; &quot;The service to get the status for&quot;,
-            :type        =&gt; :string,
-            :validation  =&gt; '^[a-zA-Z\-_\d]+$',
-            :optional    =&gt; true,
-            :maxlength   =&gt; 30
-
-      output :status,
-             :description =&gt; &quot;The status of service&quot;,
-             :display_as  =&gt; &quot;Service Status&quot;
-  end
-</pre>
-<p>
-There are now many types of <a href="DDL.html">DDL</a> and ultimately all
-pugins should have <a href="DDL.html">DDL</a> files. The code is organized
-so that any plugin type will magically just work - they will be an instane
-of <a href="DDL/Base.html">Base</a> which has metadata and a few common
-cases.
-</p>
-<p>
-For plugin types that require more specific behaviors they can just add a
-class here that inherits from <a href="DDL/Base.html">Base</a> and add
-their specific behavior.
-</p>
-<p>
-<a href="DDL/Base.html">Base</a> defines a specific behavior for input,
-output and metadata which we&#8216;d like to keep standard across plugin
-types so do not completely override the behavior of input. The methods are
-written that they will gladly store extra content though so you add, do not
-remove. See the <a href="DDL/AgentDDL.html">AgentDDL</a> class for an
-example where agents want a :required argument to be always set.
-</p>
-
-    </div>
-
-
-   </div>
-
-    <div id="method-list">
-      <h3 class="section-bar">Methods</h3>
-
-      <div class="name-list">
-      <a href="#M000156">load_and_cache</a>&nbsp;&nbsp;
-      <a href="#M000155">new</a>&nbsp;&nbsp;
-      <a href="#M000157">string_to_boolean</a>&nbsp;&nbsp;
-      <a href="#M000158">string_to_number</a>&nbsp;&nbsp;
-      <a href="#M000159">validation_fail!</a>&nbsp;&nbsp;
-      </div>
-    </div>
-
-  </div>
-
-
-    <!-- if includes -->
-
-    <div id="section">
-
-    <div id="class-list">
-      <h3 class="section-bar">Classes and Modules</h3>
-
-      Class <a href="DDL/AgentDDL.html" class="link">MCollective::DDL::AgentDDL</a><br />
-Class <a href="DDL/Base.html" class="link">MCollective::DDL::Base</a><br />
-Class <a href="DDL/DataDDL.html" class="link">MCollective::DDL::DataDDL</a><br />
-Class <a href="DDL/DiscoveryDDL.html" class="link">MCollective::DDL::DiscoveryDDL</a><br />
-Class <a href="DDL/ValidatorDDL.html" class="link">MCollective::DDL::ValidatorDDL</a><br />
-
-    </div>
-
-
-
-
-      
-
-
-    <!-- if method_list -->
-    <div id="methods">
-      <h3 class="section-bar">Public Class methods</h3>
-
-      <div id="method-M000156" class="method-detail">
-        <a name="M000156"></a>
-
-        <div class="method-heading">
-          <a href="#M000156" class="method-signature">
-          <span class="method-name">load_and_cache</span><span class="method-args">(*args)</span>
-          </a>
-        </div>
-      
-        <div class="method-description">
-          <p><a class="source-toggle" href="#"
-            onclick="toggleCode('M000156-source');return false;">[Source]</a></p>
-          <div class="method-source-code" id="M000156-source">
-<pre>
-    <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 71</span>
-71:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">load_and_cache</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
-72:       <span class="ruby-constant">Cache</span>.<span class="ruby-identifier">setup</span>(<span class="ruby-identifier">:ddl</span>, <span class="ruby-value">300</span>)
-73: 
-74:       <span class="ruby-identifier">plugin</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">first</span>
-75:       <span class="ruby-identifier">args</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">1</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">type</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">type</span> = <span class="ruby-value str">&quot;agent&quot;</span>
-76:       <span class="ruby-identifier">path</span> = <span class="ruby-value str">&quot;%s/%s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">type</span>, <span class="ruby-identifier">plugin</span>]
-77: 
-78:       <span class="ruby-keyword kw">begin</span>
-79:         <span class="ruby-identifier">ddl</span> = <span class="ruby-constant">Cache</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">:ddl</span>, <span class="ruby-identifier">path</span>)
-80:       <span class="ruby-keyword kw">rescue</span>
-81:         <span class="ruby-keyword kw">begin</span>
-82:           <span class="ruby-identifier">klass</span> = <span class="ruby-constant">DDL</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-value str">&quot;%sDDL&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">capitalize</span>)
-83:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">NameError</span>
-84:           <span class="ruby-identifier">klass</span> = <span class="ruby-constant">Base</span>
-85:         <span class="ruby-keyword kw">end</span>
-86: 
-87:         <span class="ruby-identifier">ddl</span> = <span class="ruby-constant">Cache</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">:ddl</span>, <span class="ruby-identifier">path</span>, <span class="ruby-identifier">klass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>))
-88:       <span class="ruby-keyword kw">end</span>
-89: 
-90:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ddl</span>
-91:     <span class="ruby-keyword kw">end</span>
-</pre>
-          </div>
-        </div>
-      </div>
-
-      <div id="method-M000155" class="method-detail">
-        <a name="M000155"></a>
-
-        <div class="method-heading">
-          <a href="#M000155" class="method-signature">
-          <span class="method-name">new</span><span class="method-args">(*args, &amp;blk)</span>
-          </a>
-        </div>
-      
-        <div class="method-description">
-          <p>
-There used to be only one big nasty <a href="DDL.html">DDL</a> class with a
-bunch of mashed together behaviors. It&#8216;s been around for ages and we
-would rather not ask all the users to change their <a
-href="DDL.html#M000155">DDL.new</a> calls to some other factory method that
-would have this exact same behavior.
-</p>
-<p>
-So we override the behavior of <a href="DDL.html#M000155">new</a> which is
-a hugely sucky thing to do but ultimately it&#8216;s what would be least
-disrupting to code out there today. We did though change <a
-href="DDL.html">DDL</a> to a module to make it possibly a little less
-suprising, possibly.
-</p>
-          <p><a class="source-toggle" href="#"
-            onclick="toggleCode('M000155-source');return false;">[Source]</a></p>
-          <div class="method-source-code" id="M000155-source">
-<pre>
-    <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 67</span>
-67:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">blk</span>)
-68:       <span class="ruby-identifier">load_and_cache</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
-69:     <span class="ruby-keyword kw">end</span>
-</pre>
-          </div>
-        </div>
-      </div>
-
-      <div id="method-M000157" class="method-detail">
-        <a name="M000157"></a>
-
-        <div class="method-heading">
-          <a href="#M000157" class="method-signature">
-          <span class="method-name">string_to_boolean</span><span class="method-args">(val)</span>
-          </a>
-        </div>
-      
-        <div class="method-description">
-          <p>
-As we&#8216;re taking arguments on the command line we need a way to input
-booleans, true on the cli is a string so this method will take the ddl,
-find all arguments that are supposed to be boolean and if they are the
-strings &quot;true&quot;/&quot;yes&quot; or
-&quot;false&quot;/&quot;no&quot; turn them into the matching boolean
-</p>
-          <p><a class="source-toggle" href="#"
-            onclick="toggleCode('M000157-source');return false;">[Source]</a></p>
-          <div class="method-source-code" id="M000157-source">
-<pre>
-     <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 98</span>
- 98:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">string_to_boolean</span>(<span class="ruby-identifier">val</span>)
- 99:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">&quot;true&quot;</span>, <span class="ruby-value str">&quot;t&quot;</span>, <span class="ruby-value str">&quot;yes&quot;</span>, <span class="ruby-value str">&quot;y&quot;</span>, <span class="ruby-value str">&quot;1&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">val</span>.<span class="ruby-identifier">downcase</span>)
-100:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> [<span class="ruby-value str">&quot;false&quot;</span>, <span class="ruby-value str">&quot;f&quot;</span>, <span class="ruby-value str">&quot;no&quot;</span>, <span class="ruby-value str">&quot;n&quot;</span>, <span class="ruby-value str">&quot;0&quot;</span>].<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">val</span>.<span class="ruby-identifier">downcase</span>)
-101: 
-102:       <span class="ruby-identifier">raise_code</span>(<span class="ruby-identifier">:PLMC17</span>, <span class="ruby-value str">&quot;%{value} does not look like a boolean argument&quot;</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">val</span>)
-103:     <span class="ruby-keyword kw">end</span>
-</pre>
-          </div>
-        </div>
-      </div>
-
-      <div id="method-M000158" class="method-detail">
-        <a name="M000158"></a>
-
-        <div class="method-heading">
-          <a href="#M000158" class="method-signature">
-          <span class="method-name">string_to_number</span><span class="method-args">(val)</span>
-          </a>
-        </div>
-      
-        <div class="method-description">
-          <p>
-a generic string to number function, if a number looks like a float it
-turns it into a float else an int. This is naive but should be sufficient
-for numbers typed on the cli in most cases
-</p>
-          <p><a class="source-toggle" href="#"
-            onclick="toggleCode('M000158-source');return false;">[Source]</a></p>
-          <div class="method-source-code" id="M000158-source">
-<pre>
-     <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 108</span>
-108:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">string_to_number</span>(<span class="ruby-identifier">val</span>)
-109:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\d+\.\d+$/</span>
-110:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\d+$/</span>
-111: 
-112:       <span class="ruby-identifier">raise_code</span>(<span class="ruby-identifier">:PLMC16</span>, <span class="ruby-value str">&quot;%{value} does not look like a numeric value&quot;</span>, <span class="ruby-identifier">:debug</span>, <span class="ruby-identifier">:value</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">val</span>)
-113:     <span class="ruby-keyword kw">end</span>
-</pre>
-          </div>
-        </div>
-      </div>
-
-      <div id="method-M000159" class="method-detail">
-        <a name="M000159"></a>
-
-        <div class="method-heading">
-          <a href="#M000159" class="method-signature">
-          <span class="method-name">validation_fail!</span><span class="method-args">(code, default, level, args={})</span>
-          </a>
-        </div>
-      
-        <div class="method-description">
-          <p>
-Various <a href="DDL.html">DDL</a> implementations will validate and raise
-on error, this is a utility method to correctly setup a <a
-href="DDLValidationError.html">DDLValidationError</a> exceptions and raise
-them
-</p>
-          <p><a class="source-toggle" href="#"
-            onclick="toggleCode('M000159-source');return false;">[Source]</a></p>
-          <div class="method-source-code" id="M000159-source">
-<pre>
-     <span class="ruby-comment cmt"># File lib/mcollective/ddl.rb, line 117</span>
-117:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">validation_fail!</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">default</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">args</span>={})
-118:       <span class="ruby-identifier">exception</span> = <span class="ruby-constant">DDLValidationError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">default</span>, <span class="ruby-identifier">level</span>, <span class="ruby-identifier">args</span>)
-119:       <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">set_backtrace</span> <span class="ruby-identifier">caller</span>
-120: 
-121:       <span class="ruby-identifier">raise</span> <span class="ruby-identifier">exception</span>
-122:     <span class="ruby-keyword kw">end</span>
-</pre>
-          </div>
-        </div>
-      </div>
-
-
-    </div>
-
-
-  </div>
-
-
-<div id="validator-badges">
-  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
-</div>
-
-</body>
-</html>
\ No newline at end of file