<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_05) on Thu Jun 05 09:36:27 PDT 2014 --> <title>Initializer (initializer 0.1.2 API)</title> <meta name="date" content="2014-06-05"> <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="Initializer (initializer 0.1.2 API)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":9,"i2":10}; var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Class</li> <li><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.InitializerConfig.html" title="class in com.perforce.workshop.tjuricek.initializer"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/perforce/workshop/tjuricek/initializer/Initializer.html" target="_top">Frames</a></li> <li><a href="Initializer.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li><a href="#nested.class.summary">Nested</a> | </li> <li>Field | </li> <li><a href="#constructor.summary">Constr</a> | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li><a href="#constructor.detail">Constr</a> | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">com.perforce.workshop.tjuricek.initializer</div> <h2 title="Class Initializer" class="title">Class Initializer</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>com.perforce.workshop.tjuricek.initializer.Initializer</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public class <span class="typeNameLabel">Initializer</span> extends java.lang.Object</pre> <div class="block">The Initializer is the entry point for seeding data for Commons installations. <p> It allows you to define data in JSON files (with associated flat files) that can "replay" operations to a Perforce server or Commons server. The same information can also be queried (quickly) for test scripts. <p> There are two major stages to initialization. The first stage is seeding the core perforce system. This is where we'll add some basic system users, for example, that all the other services kind of assume are there. We'll also set up the rights of these users. For test environments, we'll also seed a bunch of revisions as well. <p> The second stage of initialization actually should be run after the Commons webserver is available and initialized (and thus, all the commons metadata exists). Here, we'll run "commons seeding", which will add data from the perspective of commons; new spaces with files added via file valet, etc. <p> <h2> Specifying Seed Data </h2> <p> Data is indicated by creating JSON files and loading them such that a resource loader can find them either under the path <code>initializer/perforce</code> or <code>initializer/commons</code>. <p> <h2> Executing the Initializer </h2> <p> The initializer runs in a single thread, in order. <p> The initializer can be run via the command line. It expects that the p4d instance to seed is already configured. The configuration can be loaded via a single config file or via overrides. <p> Alternatively, the Initializer can be run within your environment. This expects that the p4java_commons connections respect the user switch provided by the InitializerConnections interface.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== NESTED CLASS SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="nested.class.summary"> <!-- --> </a> <h3>Nested Class Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Class and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static class </code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.InitializerConfig.html" title="class in com.perforce.workshop.tjuricek.initializer">Initializer.InitializerConfig</a></span></code> <div class="block">Defines configuration values that are mapped via YAML code into this class.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static interface </code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.InputStreamLoader.html" title="interface in com.perforce.workshop.tjuricek.initializer">Initializer.InputStreamLoader</a></span></code> <div class="block">We push the loading of resources to the application, just because in some cases the application can offer the ability to load from the classpath...</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>static class </code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.PerforceOptions.html" title="class in com.perforce.workshop.tjuricek.initializer">Initializer.PerforceOptions</a></span></code> <div class="block">Options to configure the seedPerforce method.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static class </code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.SeedOptions.html" title="class in com.perforce.workshop.tjuricek.initializer">Initializer.SeedOptions</a></span></code> </td> </tr> </table> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd"> </span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.html#Initializer-java.util.function.Supplier-">Initializer</a></span>(java.util.function.Supplier<com.perforce.p4java.server.IOptionsServer> serverSupplier)</code> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code><a href="../../../../../com/perforce/workshop/tjuricek/initializer/model/PerforceItemSet.html" title="class in com.perforce.workshop.tjuricek.initializer.model">PerforceItemSet</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.html#loadPerforceItems-com.perforce.workshop.tjuricek.initializer.Initializer.PerforceOptions-">loadPerforceItems</a></span>(<a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.PerforceOptions.html" title="class in com.perforce.workshop.tjuricek.initializer">Initializer.PerforceOptions</a> options)</code> <div class="block">Load all json files under initializer/perforce/.json.</div> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>static void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.html#main-java.lang.String:A-">main</a></span>(java.lang.String[] args)</code> <div class="block">Command line, which basically just takes a single configuration file (because this is just that complicated).</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.html#seedPerforce-com.perforce.workshop.tjuricek.initializer.Initializer.PerforceOptions-">seedPerforce</a></span>(<a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.PerforceOptions.html" title="class in com.perforce.workshop.tjuricek.initializer">Initializer.PerforceOptions</a> options)</code> <div class="block">Seeds the perforce data as indicated by the JSON definitions provided by the stream of "definitions" in the options.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="Initializer-java.util.function.Supplier-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>Initializer</h4> <pre>public Initializer(java.util.function.Supplier<com.perforce.p4java.server.IOptionsServer> serverSupplier)</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="seedPerforce-com.perforce.workshop.tjuricek.initializer.Initializer.PerforceOptions-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>seedPerforce</h4> <pre>public void seedPerforce(<a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.PerforceOptions.html" title="class in com.perforce.workshop.tjuricek.initializer">Initializer.PerforceOptions</a> options)</pre> <div class="block">Seeds the perforce data as indicated by the JSON definitions provided by the stream of "definitions" in the options. <p> This will read all definitions, then initialize things in a "rational" order. The actual algorithm is somewhat tricky and dependent upon security settings. <p> In general, you should indicate definitions in the following order: <p> <ol> <li>Users</li> <li>Depots</li> <li>Protections</li> <li>Triggers</li> <li>Changelists</li> </ol> <p> You can also indicate clients, if you want a few that "hang around" after initialization is complete. <p> The first user MUST be a superuser. That's the account we try to do most operations as. You also very likely do not want to perform changelist operations as the superuser, though you can, in case your usage is simple. <p> In changelist definitions, you can just use the client format convention "initializer-USER". We'll create that client for use of seeding data during this function call, and delete it before we're done.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>options</code> - Options used to configure the function. Required if you've got triggers and you want to customize the loaded JSON files.</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code>java.lang.IllegalStateException</code> - if anything bad happens (do not catch, this means you need to reconfigure your system)</dd> </dl> </li> </ul> <a name="loadPerforceItems-com.perforce.workshop.tjuricek.initializer.Initializer.PerforceOptions-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>loadPerforceItems</h4> <pre>public <a href="../../../../../com/perforce/workshop/tjuricek/initializer/model/PerforceItemSet.html" title="class in com.perforce.workshop.tjuricek.initializer.model">PerforceItemSet</a> loadPerforceItems(<a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.PerforceOptions.html" title="class in com.perforce.workshop.tjuricek.initializer">Initializer.PerforceOptions</a> options)</pre> <div class="block">Load all json files under initializer/perforce/.json.</div> <dl> <dt><span class="returnLabel">Returns:</span></dt> <dd>The PerforceItemSet ready for initialization</dd> <dt><span class="throwsLabel">Throws:</span></dt> <dd><code>java.lang.IllegalStateException</code> - When something bad happens; any error resolution is simply going to require system configuration</dd> </dl> </li> </ul> <a name="main-java.lang.String:A-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>main</h4> <pre>public static void main(java.lang.String[] args)</pre> <div class="block">Command line, which basically just takes a single configuration file (because this is just that complicated). We generate a configuration file template just to make things a little easier.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>args</code> - The command line strings, should really either be "-h" or the path of a YAML configuration file.</dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../index-all.html">Index</a></li> <li><a href="../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li>Prev Class</li> <li><a href="../../../../../com/perforce/workshop/tjuricek/initializer/Initializer.InitializerConfig.html" title="class in com.perforce.workshop.tjuricek.initializer"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../index.html?com/perforce/workshop/tjuricek/initializer/Initializer.html" target="_top">Frames</a></li> <li><a href="Initializer.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li><a href="#nested.class.summary">Nested</a> | </li> <li>Field | </li> <li><a href="#constructor.summary">Constr</a> | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li><a href="#constructor.detail">Constr</a> | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 9172 | tjuricek | 0.1.2 Added command line execution options and documentation to run the initializer locally. | ||
#1 | 9165 | tjuricek |
Some documentation framework and a fatjar style distribution for the initializer to run outside of a gradle plugin. Upped the version to 0.1.2, but this may need some testing before it's really guaranteed to work in standalone mode |