You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/04/15 23:39:46 UTC

svn commit: r1673966 [22/31] - in /isis/site/trunk/content/docs: ./ css/asciidoctor/ css/font-awesome/4.3.0/css/ css/font-awesome/4.3.0/fonts/ css/font-awesome/4.3.0/less/ css/font-awesome/4.3.0/scss/ css/foundation/ css/foundation/5.5.1/ getting-start...

Added: isis/site/trunk/content/docs/user-guide/user-guide-core-concepts.html
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/docs/user-guide/user-guide-core-concepts.html?rev=1673966&view=auto
==============================================================================
--- isis/site/trunk/content/docs/user-guide/user-guide-core-concepts.html (added)
+++ isis/site/trunk/content/docs/user-guide/user-guide-core-concepts.html Wed Apr 15 21:39:44 2015
@@ -0,0 +1,1520 @@
+<!doctype html>
+
+<html class="no-js" lang="en">
+
+<head>
+
+    <meta charset="utf-8"/>
+
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+
+
+
+    <title>User Guide: Core Concepts</title>
+
+
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one
+
+        or more contributor license agreements.  See the NOTICE file
+
+        distributed with this work for additional information
+
+        regarding copyright ownership.  The ASF licenses this file
+
+        to you under the Apache License, Version 2.0 (the
+
+        "License"); you may not use this file except in compliance
+
+        with the License.  You may obtain a copy of the License at
+
+
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+
+
+        Unless required by applicable law or agreed to in writing,
+
+        software distributed under the License is distributed on an
+
+        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+
+        KIND, either express or implied.  See the License for the
+
+        specific language governing permissions and limitations
+
+        under the License.
+
+    -->
+
+
+
+    <!-- No caching headers -->
+
+    <meta http-equiv="cache-control" content="no-cache" />
+
+    <meta http-equiv="pragma" content="no-cache" />
+
+    <meta http-equiv="expires" content="-1" />
+
+
+
+
+
+    <link rel="stylesheet" href="../css/foundation/5.5.1/foundation.css"/>
+
+    <script src="../js/foundation/5.5.1/vendor/modernizr.js"></script>
+
+
+
+    <link href="../css/asciidoctor/stylesheets/foundation-potion.css" rel="stylesheet">
+
+
+
+    <link href="../css/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
+
+
+
+    <style type="text/css">
+
+        #forkongithub a{
+
+            display: none;
+
+            background:#090;
+
+            color:#fff;
+
+            text-decoration:none;
+
+            font-family:arial, sans-serif;
+
+            text-align:center;
+
+            font-weight:bold;
+
+            padding:5px 40px;
+
+            font-size:1rem;
+
+            line-height:2rem;
+
+            position:relative;
+
+            transition:0.5s;
+
+        }
+
+        #forkongithub a:hover{
+
+            background:#0D0;
+
+            color:#fff;
+
+        }
+
+        #forkongithub a::before,
+
+        #forkongithub a::after{
+
+            content:"";width:100%;
+
+            display:block;
+
+            position:fixed;
+
+            top:1px;
+
+            left:0;
+
+            height:1px;
+
+            background:#fff;
+
+            z-index: 9999;
+
+        }
+
+        #forkongithub a::after{
+
+            bottom:1px;
+
+            top:auto;
+
+        }
+
+        @media screen and (min-width:768px){
+
+            #forkongithub{
+
+                position:fixed;
+
+                display:block;
+
+                top:0;
+
+                right:0;
+
+                width:250px;
+
+                overflow:hidden;
+
+                height:250px;
+
+                z-index: 9999;
+
+            }
+
+            #forkongithub a{
+
+                display:inherit;
+
+                width:250px;
+
+                position:fixed;
+
+                font-size:small;
+
+                top:40px;
+
+                right:-60px;
+
+                transform:rotate(45deg);
+
+                -webkit-transform:rotate(45deg);
+
+                -ms-transform:rotate(45deg);
+
+                box-shadow:4px 4px 10px rgba(0,0,0,0.8);
+
+            }
+
+        }
+
+    </style>
+
+
+
+    <style>
+
+        body {
+
+          position: relative;
+
+        }
+
+
+
+        body div#toc li,
+
+        body div#toc2 li {
+
+            list-style-type: none;
+
+        }
+
+
+
+        div#doc-content {
+
+            margin-top: 30px;
+
+        }
+
+
+
+        body div#toc li.active-region:before,
+
+        body div#toc2 li.active-region:before {
+
+            content: "\00BB \0020";
+
+            margin-left: -12px;
+
+        }
+
+
+
+        body div#toc li a.active,
+
+        body div#toc2 li a.active {
+
+            color: red;
+
+        }
+
+
+
+        body div#toc.toc,
+
+        body div#toc.toc2 {
+
+            position: fixed;
+
+            left: auto;
+
+            padding-top: 120px;
+
+            z-index: auto;
+
+            background-color: white;
+
+            border-left-color: #eee;
+
+            border-left-style: solid;
+
+            border-right: none;
+
+        }
+
+    </style>
+
+
+
+</head>
+
+<body>
+
+
+
+    <span id="forkongithub">
+
+        <a href="https://github.com/apache/isis">Fork me on GitHub</a>
+
+    </span>
+
+
+
+<div class="row">
+
+
+
+    <div class="fixed contain-to-grid">
+
+        <nav class="top-bar" data-topbar role="navigation">
+
+            <ul class="title-area">
+
+                <li class="name">
+
+                    <h1>
+
+                        <a href="/index.html">Apache Isis&trade;</a>
+
+                    </h1>
+
+                </li>
+
+                <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
+
+                <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
+
+            </ul>
+
+
+
+            <section class="top-bar-section">
+
+                <ul class="right">
+
+
+
+                    <li class="has-form">
+
+                       <FORM class="searchbox navbar-form navbar-right" id="searchbox_012614087480249044419:dn-q5gtwxya" action="http://www.google.com/cse">
+
+                        <div class="row collapse">
+
+                            <input type="hidden" name="cx" value="012614087480249044419:dn-q5gtwxya">
+
+                            <INPUT type="hidden" name="cof" value="FORID:0">
+
+                            <INPUT class="form-control" name="q" type="text" placeholder="Search">
+
+                        </div>
+
+                    </FORM>
+
+                     </li>
+
+
+
+                </ul>
+
+
+
+                <!-- Left Nav Section -->
+
+                <ul class="left">
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#" >Demos</b></a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/intro/elevator-pitch/isis-in-pictures.html">Screenshots</a></li>
+
+                        <li><a href="/intro/tutorials/screencasts.html">Screencasts&nbsp;<img src="/images/tv_show-25.png"></a></li>
+
+                        <li><a href="/intro/powered-by/powered-by.html">Powered by</a></li>
+
+                        <li><a href="http://isisdemo.mmyco.co.uk/" target="_blank">Online Demo</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li><a href="/documentation">Documentation</a></li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#">Downloads</a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/intro/getting-started/simpleapp-archetype.html">Isis (Maven archetype)</a></li>
+
+                        <li><a href="/download.html">Isis (downloads)</a></li>
+
+                        <li><a href="http://www.isisaddons.org" target="_blank">Isis Add-ons (not ASF)</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#">Help</a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/support.html">Mailing Lists</a></li>
+
+                        <li><a href="http://isis.markmail.org/search/?q=" target="_blank">Mailing List Archives</a></li>
+
+                        <li><a href="https://issues.apache.org/jira/browse/ISIS" target="_blank">JIRA</a></li>
+
+                        <li><a href="http://github.com/apache/isis" target="_blank">Github mirror</a></li>
+
+                        <li><a href="http://stackoverflow.com/questions/tagged/isis" target="_blank">Stack Overflow</a></li>
+
+                        <li><a href="/contributors/contributing.html">How to contribute</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#" >@ASF</a>
+
+                      <ul class="dropdown">
+
+                        <li>
+
+                          <a href="http://www.apache.org/" target="_blank">Apache Homepage <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/licenses/" target="_blank">Licenses <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/security/" target="_blank">Security <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Sponsorship <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/foundation/thanks.html">Thanks <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="{{base}}more-thanks.html">More thanks <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                </ul>
+
+
+
+            </section>
+
+        </nav>
+
+    </div>
+
+</div>
+
+
+
+<div class="row">
+
+    <div class="large-8 medium-8 columns">
+
+
+
+        <div id="doc-content">
+
+          <div id="preamble">
+<div class="sectionbody">
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_principles">Principles</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_user_guide_core_concepts_principles">User Guide: Core Concepts: Principles</h2>
+<div class="sectionbody">
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_domain_driven_design">Domain-Driven Design</h3>
+<div class="sect3">
+<h4 id="_ubiquitous_language">Ubiquitous Language</h4>
+
+</div>
+</div>
+<div class="sect2">
+<h3 id="_naked_objects_pattern">Naked Objects Pattern</h3>
+<div class="exampleblock">
+<div class="title">Example 1. Object Interface Mapping</div>
+<div class="content">
+<div class="paragraph">
+<p>Just as an ORM (such as <a href="http://datanucleus.org">DataNucleus</a> or <a href="http:hibernate.org">Hibernate</a>) maps domain entities to a database, you can think of Naked Objects as an OIM - mapping domain objects to a user interface.</p>
+</div>
+</div>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p>multiple UIs.</p>
+</li>
+</ul>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_hexagonal_architecture">Hexagonal Architecture</h3>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+<div class="paragraph">
+<p>The hexagonal architecture is also known as the ports-and-adapters architecture.  another name used (less frequently) is the onion architecture.</p>
+</div>
+</td>
+</tr>
+</table>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_decoupled_modules">Decoupled Modules</h3>
+<div class="paragraph">
+<p>Using:</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p>dependency injection of services</p>
+</li>
+<li>
+<p>OO design techniques, eg dependency inversion principle</p>
+</li>
+<li>
+<p>an in-memory event bus</p>
+</li>
+<li>
+<p>applib</p>
+</li>
+</ul>
+</div>
+<div class="sidebarblock">
+<div class="content">
+<div class="title">Aspect Oriented</div>
+<div class="paragraph">
+<p>Although not implemented using an aspect-oriented language such as AspectJ, Isis takes considerable inspiration from AOP concepts.</p>
+</div>
+<div class="paragraph">
+<p>For example, the UI visualization automatically provided by Isis can be thought of (and is!) treating the UI as a cross-cutting concern.</p>
+</div>
+<div class="paragraph">
+<p>Isis' also has support for traits/mixins through its <a href="#_contributions">Contributions</a>.  This allows functionality from one class (a domain service) to be rendered as if it belongs to another (a domain object).</p>
+</div>
+<div class="ulist">
+<ul>
+<li>
+<p>aspect-oriented design, such as traits/mix-ins (see <a href="#_contributions">Contributions</a>) and interceptors and UI visualization as a cross-cutting concern</p>
+</li>
+</ul>
+</div>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_focuses_on_its_key_responsibilities">Focuses on its Key Responsibilities</h3>
+<div class="ulist">
+<ul>
+<li>
+<p>Isis is at heart a metamodel with runtime, and coordinates interations using an AOP set of principles</p>
+</li>
+<li>
+<p>Apache Isis vs Isis Addons</p>
+</li>
+<li>
+<p>Apache Isis vs Shiro vs DataNucleus</p>
+</li>
+</ul>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_testable_applications">Testable Applications</h3>
+<div class="paragraph">
+<p>While Apache Isis can be used (very effectively) for simple CRUD-style applications, it is also intended to be used for complex business domains.  Ensuring that the business logic in such applications is correct means that the framework must (and does) provide robust testing support, both for developer-level unit testing and business-level (end-to-end) integration testing.</p>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_apache_isis_vs">Apache Isis vs&#8230;&#8203;</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_user_guide_core_concepts_apache_isis_vs">User Guide: Core Concepts: Apache Isis vs &#8230;&#8203;</h2>
+<div class="sectionbody">
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_vs_spring">vs Spring</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_vs_jee">vs JEE</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_vs_grails">vs Grails</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_vs_angular">vs Angular</h3>
+
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_building_blocks">Building Blocks</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_user_guide_core_concepts_building_blocks">User Guide: Core Concepts: Building Blocks</h2>
+<div class="sectionbody">
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_a_metamodel_with_explicit_and_inferred_semantics">A MetaModel with Explicit and Inferred Semantics</h3>
+<div class="ulist">
+<ul>
+<li>
+<p>use of annotations</p>
+<div class="ulist">
+<ul>
+<li>
+<p>reuse JEE annotations where possible</p>
+</li>
+</ul>
+</div>
+</li>
+<li>
+<p>layout hints are overridable, to avoid restarting the app/speed up feedback</p>
+</li>
+</ul>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_domain_objects_and_domain_services">Domain Objects and Domain Services</h3>
+<div class="ulist">
+<ul>
+<li>
+<p>domain model</p>
+<div class="ulist">
+<ul>
+<li>
+<p>domain objects</p>
+<div class="ulist">
+<ul>
+<li>
+<p>domain entity</p>
+</li>
+<li>
+<p>view model</p>
+</li>
+</ul>
+</div>
+</li>
+<li>
+<p>domain service</p>
+</li>
+<li>
+<p>value type</p>
+</li>
+</ul>
+</div>
+</li>
+</ul>
+</div>
+<div class="paragraph">
+<p>Anything else can be (should be) ignored by annotating with <code>@Programmatic</code>.</p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_properties_collections_and_actions">Properties, Collections and Actions</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_domain_entities_vs_view_models">Domain Entities vs View Models</h3>
+<div class="paragraph">
+<p><code>@DomainObject(nature=&#8230;&#8203;)</code></p>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_domain_services">Domain Services</h3>
+<div class="paragraph">
+<p>Domain services consist of a set of logically grouped actions, and as such follow the same conventions as for entities. However, a service cannot have (persisted) properties, nor can it have (persisted) collections.</p>
+</div>
+<div class="paragraph">
+<p>Domain services are instantiated once and once only by the framework, and are used to centralize any domain logic that does not logically belong in a domain entity or value. Isis will automatically inject services into every domain entity that requests them, and into each other.</p>
+</div>
+<div class="paragraph">
+<p>For convenience you can inherit from AbstractService or one of its subclasses, but this is not mandatory.</p>
+</div>
+<div class="sect3">
+<h4 id="_domain_services_vs_view_services">Domain Services vs View Services</h4>
+<div class="paragraph">
+<p><code>@DomainService(nature=&#8230;&#8203;)</code></p>
+</div>
+<div class="sidebarblock">
+<div class="content">
+<div class="title">Factories, Repositories and Services</div>
+<div class="paragraph">
+<p>A distinction is sometimes made between a factory (that creates object) and a repository (that is used to find existing objects).  You will find them discussed separately in Evans' link:Domain Driven Design[<a href="http://books.google.com/books/about/Domain_Driven_Design.html?id=hHBf4YxMnWMC" class="bare">http://books.google.com/books/about/Domain_Driven_Design.html?id=hHBf4YxMnWMC</a>], for example.</p>
+</div>
+<div class="paragraph">
+<p>In Apache Isis these are all implemented as domain services.  Indeed, it is quite common to have a domain service that acts as both a factory and a repository.</p>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_value_objects_primitives">Value Objects (Primitives)</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_contributions">Contributions</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_event_bus">Event Bus</h3>
+<div class="sect3">
+<h4 id="_registering_domain_services">Registering domain services</h4>
+<div class="paragraph">
+<p>As noted <a href="../../how-tos/how-to-09-010-How-to-register-domain-services,-repositories-and-factories.html">elsewhere</a>, domain services (which includes repositories and factories) should be registered in the <code>isis.properties</code> configuration file, under <code>isis.services</code> key (a comma-separated list):</p>
+</div>
+<div class="paragraph">
+<p>For example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>isis.services = com.mycompany.myapp.employee.Employees\,
+                com.mycompany.myapp.claim.Claims\,
+                ...</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>This will then result in the framework instantiating a single instance of each of the services listed.</p>
+</div>
+<div class="paragraph">
+<p>If all services reside under a common package, then the <code>isis.services.prefix</code> can specify this prefix:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>isis.services.prefix = com.mycompany.myapp
+isis.services = employee.Employees,\
+                claim.Claims,\
+                ...</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>This is quite rare, however; you will often want to use default implementations of domain services that are provided by the framework and so will not reside under this prefix.</p>
+</div>
+<div class="paragraph">
+<p>Examples of framework-provided services (as defined in the applib) can be found referenced from the main <a href="../../documentation.html">documentation</a> page. They include clock, auditing, publishing, exception handling, view model support, snapshots/mementos, and user/application settings management.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_service_scopes">Service scopes</h4>
+<div class="paragraph">
+<p>By default all domain services are considered to be singletons, and thread-safe.</p>
+</div>
+<div class="paragraph">
+<p>Sometimes though a service&#8217;s lifetime is applicable only to a single request; in other words it is request-scoped.</p>
+</div>
+<div class="paragraph">
+<p>The CDI annotation <code>@javax.enterprise.context.RequestScoped</code> is used to indicate this fact:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code> @javax.enterprise.context.RequestScoped
+ public class MyService extends AbstractService {
+     ...
+ }</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>The framework provides a number of request-scoped services; these can be found referenced from the main <a href="../../documentation.html">documentation</a> page. They include scratchpad service, query results caching, and support for co-ordinating bulk actions.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="__suppressing_contributed_actions">(Suppressing) contributed actions</h4>
+<div class="paragraph">
+<p>Any n-parameter action provided by a service will automatically be contributed to the list of actions for each of its (entity) parameters. From the viewpoint of the entity the action is called a contributed action.</p>
+</div>
+<div class="paragraph">
+<p>For example, given a service:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>public interface Library {
+    public Loan borrow(Loanable l, Borrower b);
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>and the entities:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>public class Book implements Loanable { ... }y</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>and</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>public class LibraryMember implements Borrower { ... }</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>then the <code>borrow(&#8230;&#8203;)</code> action will be contributed to both <code>Book</code> and to <code>LibraryMember</code>.</p>
+</div>
+<div class="paragraph">
+<p>This is an important capability because it helps to decouple the concrete classes from the services.</p>
+</div>
+<div class="paragraph">
+<p>If necessary, though, this behaviour can be suppressed by annotating the service action with <code>@org.apache.isis.applib.annotations.NotContributed</code>.</p>
+</div>
+<div class="paragraph">
+<p>For example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>public interface Library {
+    @NotContributed
+    public Loan borrow(Loanable l, Borrower b);
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>If annotated at the interface level, then the annotation will be inherited by every concrete class. Alternatively the annotation can be applied at the implementation class level and only apply to that particular implementation.</p>
+</div>
+<div class="paragraph">
+<p>Note that an action annotated as being <code>@NotContributed</code> will still appear in the service menu for the service. If an action should neither be contributed nor appear in service menu items, then simply annotate it as <code>@Hidden</code>.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="__suppressing_service_menu_items">(Suppressing) service menu items</h4>
+<div class="paragraph">
+<p>By default every action of a service (by which we also mean repositories and factories) will be rendered in the viewer, eg as a menu item for that service menu. This behaviour can be suppressed by annotating the action using <code>@org.apache.isis.applib.annotations.NotInServiceMenu</code>.</p>
+</div>
+<div class="paragraph">
+<p>For example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>public interface Library {
+    @NotInServiceMenu
+    public Loan borrow(Loanable l, Borrower b);
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Note that an action annotated as being <code>@NotInServiceMenu</code> will still be contributed. If an action should neither be contributed nor appear in service menu items, then simply annotate it as <code>@Hidden</code>.</p>
+</div>
+<div class="paragraph">
+<p>Alternatively, this can be performed using a supporting method:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>public class LibraryImpl implements Library {
+    public Loan borrow(Loanable l, Borrower b) { ... }
+    public boolean notInServiceMenuBorrow() { ... }
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="__suppressing_service_menus">(Suppressing) service menus</h4>
+<div class="paragraph">
+<p>If none of the service menu items should appear, then the service itself should be annotated as <code>@Hidden</code>.</p>
+</div>
+<div class="paragraph">
+<p>For example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>@Hidden
+public interface EmailService {
+    public void sendEmail(String to, String from, String subject, String body);
+    public void forwardEmail(String to, String from, String subject, String body);
+}</code></pre>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_initializing_services">Initializing Services</h4>
+<div class="paragraph">
+<p>Services can optionally declare lifecycle callbacks to initialize them (when the app is deployed) and to shut them down (when the app is undeployed).</p>
+</div>
+<div class="paragraph">
+<p>An Isis session <em>is</em> available when initialization occurs (so services can interact with the object store, for example).</p>
+</div>
+<div class="sect4">
+<h5 id="_initialization">Initialization</h5>
+<div class="paragraph">
+<p>The framework will call any <code>public</code> method annotated with <code>@javax.annotation.PostConstruct</code> and with either no arguments of an argument of type <code>Map&lt;String,String&gt;</code>:</p>
+</div>
+<div class="paragraph">
+<p>or</p>
+</div>
+<div class="paragraph">
+<p>In the latter case, the framework passes in the configuration (<code>isis.properties</code> and any other component-specific configuration files).</p>
+</div>
+</div>
+<div class="sect4">
+<h5 id="_shutdown">Shutdown</h5>
+<div class="paragraph">
+<p>Shutdown is similar; the framework will call any method annotated with <code>@javax.annotation.PreDestroy</code>:</p>
+</div>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_the_getid_method">The getId() method</h4>
+<div class="paragraph">
+<p>Optionally, a service may provide a <code>getId()</code> method:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>public String getId()</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>This method returns a logical identifier for a service, independent of its implementation. Currently it used only by perspectives, providing a label by which to record the services that are available for a current user&#8217;s profile. &lt;!--See ? for more about profiles and perspectives.-&#8594;</p>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_framework_provided_services">Framework-provided Services</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_user_guide_core_concepts_framework_provided_services">User Guide: Core Concepts: Framework-provided Services</h3>
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+<div class="sect3">
+<h4 id="_api_vs_spi">API vs SPI</h4>
+<div class="paragraph">
+<p>Most framework domain services are API: they exist to provide support functionality to the application&#8217;s domain objects and services.  In this case an implementation of the service will be available, either by Apache Isis itself or by Isis Addons (non ASF).</p>
+</div>
+<div class="paragraph">
+<p>Some framework domain services are SPI: they exist primarily so that the application can influence the framework&#8217;s behaviour.  In these cases there is (usually) no default implementation; it is up to the application to provide an implementation.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_autoregistration_of_domain_services">Autoregistration of Domain services</h4>
+<div class="paragraph">
+<p>Where a domain service has an implementation, it is (almost always) automatically registered just by virtue of being on the <code>CLASSPATH</code>.</p>
+</div>
+<div class="paragraph">
+<p>The one exception is <a href="#ExceptionRecognizer">[ExceptionRecognizer]</a>.</p>
+</div>
+<div class="paragraph">
+<p>It is possible to replacing automatically-registered domain services.</p>
+</div>
+</div>
+<div class="sect3">
+<h4 id="_overview_of_domain_services">Overview of Domain Services</h4>
+<div class="paragraph">
+<p>Unless indicated as SPI, each of the following has an implementation in Isis core.</p>
+</div>
+<div class="sect4">
+<h5 id="__code_domainobjectcontainer_code"><code>DomainObjectContainer</code></h5>
+
+</div>
+<div class="sect4">
+<h5 id="__code_clockservice_code"><code>ClockService</code></h5>
+
+</div>
+<div class="sect4">
+<h5 id="__code_isissupportjdo_code"><code>IsisSupportJdo</code></h5>
+
+</div>
+<div class="sect4">
+<h5 id="__code_exceptionrecognizer_code"><code>ExceptionRecognizer</code></h5>
+
+</div>
+<div class="sect4">
+<h5 id="__code_wrapperfactory_code"><code>WrapperFactory</code></h5>
+
+</div>
+<div class="sect4">
+<h5 id="__code_eventbusservice_code"><code>EventBusService</code></h5>
+
+</div>
+<div class="sect4">
+<h5 id="_commands_background">Commands/Background</h5>
+<div class="sect5">
+<h6 id="__code_commandcontext_code"><code>CommandContext</code></h6>
+
+</div>
+<div class="sect5">
+<h6 id="__code_backgroundservice_code"><code>BackgroundService</code></h6>
+
+</div>
+</div>
+<div class="sect4">
+<h5 id="_information_sharing">Information Sharing</h5>
+<div class="sect5">
+<h6 id="__code_scratchpad_code"><code>ScratchPad</code></h6>
+
+</div>
+<div class="sect5">
+<h6 id="__code_actioninvocationcontext_code"><code>ActionInvocationContext</code></h6>
+
+</div>
+<div class="sect5">
+<h6 id="__code_queryresultscache_code"><code>QueryResultsCache</code></h6>
+
+</div>
+</div>
+<div class="sect4">
+<h5 id="__code_emailservice_code"><code>EmailService</code></h5>
+
+</div>
+<div class="sect4">
+<h5 id="_usermanagement">UserManagement</h5>
+<div class="sect5">
+<h6 id="__code_userprofileservice_code_spi"><code>UserProfileService</code> (SPI)</h6>
+
+</div>
+<div class="sect5">
+<h6 id="__code_userregistrationservice_code_spi"><code>UserRegistrationService</code> (SPI)</h6>
+
+</div>
+<div class="sect5">
+<h6 id="__code_emailnotificationservice_code"><code>EmailNotificationService</code></h6>
+
+</div>
+</div>
+<div class="sect4">
+<h5 id="_bookmarks_and_mementos">Bookmarks and Mementos</h5>
+<div class="sect5">
+<h6 id="__code_bookmarkservice_code"><code>BookmarkService</code></h6>
+
+</div>
+<div class="sect5">
+<h6 id="__code_mementoservice_code"><code>MementoService</code></h6>
+
+</div>
+<div class="sect5">
+<h6 id="__code_deeplinkservice_code"><code>DeepLinkService</code></h6>
+
+</div>
+<div class="sect5">
+<h6 id="__code_xmlsnapshotservice_code"><code>XmlSnapshotService</code></h6>
+
+</div>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_honouring_the_single_responsibility_principle">Honouring the Single Responsibility Principle</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_behaviourally_complete_vs_contributions">Behaviourally Complete vs Contributions</h3>
+
+</div>
+</div>
+</div>
+
+        </div>
+
+
+
+        <hr>
+
+        <footer>
+
+          <p class="small">
+
+          Copyright &copy; 2010~2015 The Apache&nbsp;Software&nbsp;Foundation, licensed under the Apache&nbsp;License,&nbsp;v2.0.
+
+          <br/>
+
+          Apache, the Apache feather logo, Apache&nbsp;Isis, and the Apache&nbsp;Isis project logo are all trademarks of The&nbsp;Apache&nbsp;Software&nbsp;Foundation.
+
+          </p>
+
+        </footer>
+
+
+
+    </div>
+
+
+
+    <div class="large-4 medium-4 columns">
+
+        <!-- the 'hide' class is removed by Javascript -->
+
+        <div id="toc" class="toc2 hide">
+
+          <ul class="sectlevel1">
+<li><a href="#_principles">Principles</a></li>
+<li><a href="#_user_guide_core_concepts_principles">User Guide: Core Concepts: Principles</a>
+<ul class="sectlevel2">
+<li><a href="#_domain_driven_design">Domain-Driven Design</a>
+<ul class="sectlevel3">
+<li><a href="#_ubiquitous_language">Ubiquitous Language</a></li>
+</ul>
+</li>
+<li><a href="#_naked_objects_pattern">Naked Objects Pattern</a></li>
+<li><a href="#_hexagonal_architecture">Hexagonal Architecture</a></li>
+<li><a href="#_decoupled_modules">Decoupled Modules</a></li>
+<li><a href="#_focuses_on_its_key_responsibilities">Focuses on its Key Responsibilities</a></li>
+<li><a href="#_testable_applications">Testable Applications</a></li>
+</ul>
+</li>
+<li><a href="#_apache_isis_vs">Apache Isis vs&#8230;&#8203;</a></li>
+<li><a href="#_user_guide_core_concepts_apache_isis_vs">User Guide: Core Concepts: Apache Isis vs &#8230;&#8203;</a>
+<ul class="sectlevel2">
+<li><a href="#_vs_spring">vs Spring</a></li>
+<li><a href="#_vs_jee">vs JEE</a></li>
+<li><a href="#_vs_grails">vs Grails</a></li>
+<li><a href="#_vs_angular">vs Angular</a></li>
+</ul>
+</li>
+<li><a href="#_building_blocks">Building Blocks</a></li>
+<li><a href="#_user_guide_core_concepts_building_blocks">User Guide: Core Concepts: Building Blocks</a>
+<ul class="sectlevel2">
+<li><a href="#_a_metamodel_with_explicit_and_inferred_semantics">A MetaModel with Explicit and Inferred Semantics</a></li>
+<li><a href="#_domain_objects_and_domain_services">Domain Objects and Domain Services</a></li>
+<li><a href="#_properties_collections_and_actions">Properties, Collections and Actions</a></li>
+<li><a href="#_domain_entities_vs_view_models">Domain Entities vs View Models</a></li>
+<li><a href="#_domain_services">Domain Services</a>
+<ul class="sectlevel3">
+<li><a href="#_domain_services_vs_view_services">Domain Services vs View Services</a></li>
+</ul>
+</li>
+<li><a href="#_value_objects_primitives">Value Objects (Primitives)</a></li>
+<li><a href="#_contributions">Contributions</a></li>
+<li><a href="#_event_bus">Event Bus</a>
+<ul class="sectlevel3">
+<li><a href="#_registering_domain_services">Registering domain services</a></li>
+<li><a href="#_service_scopes">Service scopes</a></li>
+<li><a href="#__suppressing_contributed_actions">(Suppressing) contributed actions</a></li>
+<li><a href="#__suppressing_service_menu_items">(Suppressing) service menu items</a></li>
+<li><a href="#__suppressing_service_menus">(Suppressing) service menus</a></li>
+<li><a href="#_initializing_services">Initializing Services</a>
+<ul class="sectlevel4">
+<li><a href="#_initialization">Initialization</a></li>
+<li><a href="#_shutdown">Shutdown</a></li>
+</ul>
+</li>
+<li><a href="#_the_getid_method">The getId() method</a></li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#_framework_provided_services">Framework-provided Services</a>
+<ul class="sectlevel2">
+<li><a href="#_user_guide_core_concepts_framework_provided_services">User Guide: Core Concepts: Framework-provided Services</a>
+<ul class="sectlevel3">
+<li><a href="#_api_vs_spi">API vs SPI</a></li>
+<li><a href="#_autoregistration_of_domain_services">Autoregistration of Domain services</a></li>
+<li><a href="#_overview_of_domain_services">Overview of Domain Services</a>
+<ul class="sectlevel4">
+<li><a href="#__code_domainobjectcontainer_code"><code>DomainObjectContainer</code></a></li>
+<li><a href="#__code_clockservice_code"><code>ClockService</code></a></li>
+<li><a href="#__code_isissupportjdo_code"><code>IsisSupportJdo</code></a></li>
+<li><a href="#__code_exceptionrecognizer_code"><code>ExceptionRecognizer</code></a></li>
+<li><a href="#__code_wrapperfactory_code"><code>WrapperFactory</code></a></li>
+<li><a href="#__code_eventbusservice_code"><code>EventBusService</code></a></li>
+<li><a href="#_commands_background">Commands/Background</a></li>
+<li><a href="#_information_sharing">Information Sharing</a></li>
+<li><a href="#__code_emailservice_code"><code>EmailService</code></a></li>
+<li><a href="#_usermanagement">UserManagement</a></li>
+<li><a href="#_bookmarks_and_mementos">Bookmarks and Mementos</a></li>
+</ul>
+</li>
+</ul>
+</li>
+</ul>
+</li>
+<li><a href="#_honouring_the_single_responsibility_principle">Honouring the Single Responsibility Principle</a>
+<ul class="sectlevel2">
+<li><a href="#_behaviourally_complete_vs_contributions">Behaviourally Complete vs Contributions</a></li>
+</ul>
+</li>
+</ul>
+
+        </div>
+
+    </div>
+
+</div>
+
+
+
+
+
+    <script src="../js/foundation/5.5.1/vendor/jquery.js"></script>
+
+    <script src="../js/foundation/5.5.1/foundation.min.js"></script>
+
+
+
+
+
+<script type="text/javascript">
+
+      $(document).foundation();
+
+
+
+      $(document).ready(function(){
+
+        // Cache selectors
+
+        var lastId,
+
+            topMenu = $("div#toc ul"),
+
+            topMenuHeight = 70,
+
+
+
+            menuItems = topMenu.find("a"),
+
+            menuItemsHrefs = menuItems.map(function(){
+
+              var item = $($(this).attr("href"));
+
+              if (item.length) { return item; }
+
+            });
+
+
+
+        // Bind click handler to menu items to scroll animation
+
+        menuItems.click(function(e){
+
+          var href = $(this).attr("href"),
+
+              offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1;
+
+          $('html, body').stop().animate({
+
+              scrollTop: offsetTop
+
+          }, 300);
+
+
+
+          e.preventDefault();
+
+        });
+
+
+
+        // Bind to scroll of window
+
+        $(  window ).scroll(function(){
+
+
+
+           // Get container scroll position
+
+           var fromTop = $(this).scrollTop()+topMenuHeight;
+
+
+
+           var cur = menuItemsHrefs.map(function(){
+
+             if ($(this).offset().top < fromTop)
+
+               return this;
+
+           });
+
+
+
+           // Get the id of the current element
+
+           cur = cur[cur.length-1];
+
+
+
+           var id = cur && cur.length ? cur[0].id : "";
+
+
+
+           //console.log("id = " + id + ", lastId = "  + lastId);
+
+
+
+           if (lastId !== id && id) {
+
+               scrollTo(id);
+
+           }
+
+        });
+
+
+
+        scrollTo = function(id) {
+
+              lastId = id;
+
+
+
+              menuItems
+
+                .removeClass("active");
+
+
+
+              menuItems
+
+                .parents()
+
+                .removeClass("active-region");
+
+
+
+              menuItems
+
+                .parents("ul").hide();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .addClass("active");
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parents("ul").show();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parent().children("ul").show();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parents("li").addClass("active-region");
+
+
+
+        }
+
+      menuItems
+
+        .removeClass("active");
+
+
+
+      menuItems
+
+        .parents()
+
+        .removeClass("active-region");
+
+
+
+        var syncMenuItem;
+
+        if(window.location.hash!=="") {
+
+            var menuItemFor = $.grep(menuItems, function(e) {
+
+                return e.hash === window.location.hash;
+
+            });
+
+            console.log(menuItemFor);
+
+            if(menuItemFor.length === 1) {
+
+                syncMenuItem = menuItemFor[0];
+
+            }
+
+        }
+
+
+
+        if(!syncMenuItem){
+
+            syncMenuItem = menuItems[0];
+
+        }
+
+
+
+        $("#toc").removeClass("hide");
+
+
+
+        $(syncMenuItem).click();
+
+
+
+      });
+
+
+
+
+
+</script>
+
+
+
+
+
+</body>
+
+</html>
\ No newline at end of file

Added: isis/site/trunk/content/docs/user-guide/user-guide-extending-programming-model.html
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/docs/user-guide/user-guide-extending-programming-model.html?rev=1673966&view=auto
==============================================================================
--- isis/site/trunk/content/docs/user-guide/user-guide-extending-programming-model.html (added)
+++ isis/site/trunk/content/docs/user-guide/user-guide-extending-programming-model.html Wed Apr 15 21:39:44 2015
@@ -0,0 +1,820 @@
+<!doctype html>
+
+<html class="no-js" lang="en">
+
+<head>
+
+    <meta charset="utf-8"/>
+
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+
+
+
+    <title>User Guide: How-tos: Extending: Programming Model</title>
+
+
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one
+
+        or more contributor license agreements.  See the NOTICE file
+
+        distributed with this work for additional information
+
+        regarding copyright ownership.  The ASF licenses this file
+
+        to you under the Apache License, Version 2.0 (the
+
+        "License"); you may not use this file except in compliance
+
+        with the License.  You may obtain a copy of the License at
+
+
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+
+
+        Unless required by applicable law or agreed to in writing,
+
+        software distributed under the License is distributed on an
+
+        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+
+        KIND, either express or implied.  See the License for the
+
+        specific language governing permissions and limitations
+
+        under the License.
+
+    -->
+
+
+
+    <!-- No caching headers -->
+
+    <meta http-equiv="cache-control" content="no-cache" />
+
+    <meta http-equiv="pragma" content="no-cache" />
+
+    <meta http-equiv="expires" content="-1" />
+
+
+
+
+
+    <link rel="stylesheet" href="../css/foundation/5.5.1/foundation.css"/>
+
+    <script src="../js/foundation/5.5.1/vendor/modernizr.js"></script>
+
+
+
+    <link href="../css/asciidoctor/stylesheets/foundation-potion.css" rel="stylesheet">
+
+
+
+    <link href="../css/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
+
+
+
+    <style type="text/css">
+
+        #forkongithub a{
+
+            display: none;
+
+            background:#090;
+
+            color:#fff;
+
+            text-decoration:none;
+
+            font-family:arial, sans-serif;
+
+            text-align:center;
+
+            font-weight:bold;
+
+            padding:5px 40px;
+
+            font-size:1rem;
+
+            line-height:2rem;
+
+            position:relative;
+
+            transition:0.5s;
+
+        }
+
+        #forkongithub a:hover{
+
+            background:#0D0;
+
+            color:#fff;
+
+        }
+
+        #forkongithub a::before,
+
+        #forkongithub a::after{
+
+            content:"";width:100%;
+
+            display:block;
+
+            position:fixed;
+
+            top:1px;
+
+            left:0;
+
+            height:1px;
+
+            background:#fff;
+
+            z-index: 9999;
+
+        }
+
+        #forkongithub a::after{
+
+            bottom:1px;
+
+            top:auto;
+
+        }
+
+        @media screen and (min-width:768px){
+
+            #forkongithub{
+
+                position:fixed;
+
+                display:block;
+
+                top:0;
+
+                right:0;
+
+                width:250px;
+
+                overflow:hidden;
+
+                height:250px;
+
+                z-index: 9999;
+
+            }
+
+            #forkongithub a{
+
+                display:inherit;
+
+                width:250px;
+
+                position:fixed;
+
+                font-size:small;
+
+                top:40px;
+
+                right:-60px;
+
+                transform:rotate(45deg);
+
+                -webkit-transform:rotate(45deg);
+
+                -ms-transform:rotate(45deg);
+
+                box-shadow:4px 4px 10px rgba(0,0,0,0.8);
+
+            }
+
+        }
+
+    </style>
+
+
+
+    <style>
+
+        body {
+
+          position: relative;
+
+        }
+
+
+
+        body div#toc li,
+
+        body div#toc2 li {
+
+            list-style-type: none;
+
+        }
+
+
+
+        div#doc-content {
+
+            margin-top: 30px;
+
+        }
+
+
+
+        body div#toc li.active-region:before,
+
+        body div#toc2 li.active-region:before {
+
+            content: "\00BB \0020";
+
+            margin-left: -12px;
+
+        }
+
+
+
+        body div#toc li a.active,
+
+        body div#toc2 li a.active {
+
+            color: red;
+
+        }
+
+
+
+        body div#toc.toc,
+
+        body div#toc.toc2 {
+
+            position: fixed;
+
+            left: auto;
+
+            padding-top: 120px;
+
+            z-index: auto;
+
+            background-color: white;
+
+            border-left-color: #eee;
+
+            border-left-style: solid;
+
+            border-right: none;
+
+        }
+
+    </style>
+
+
+
+</head>
+
+<body>
+
+
+
+    <span id="forkongithub">
+
+        <a href="https://github.com/apache/isis">Fork me on GitHub</a>
+
+    </span>
+
+
+
+<div class="row">
+
+
+
+    <div class="fixed contain-to-grid">
+
+        <nav class="top-bar" data-topbar role="navigation">
+
+            <ul class="title-area">
+
+                <li class="name">
+
+                    <h1>
+
+                        <a href="/index.html">Apache Isis&trade;</a>
+
+                    </h1>
+
+                </li>
+
+                <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
+
+                <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
+
+            </ul>
+
+
+
+            <section class="top-bar-section">
+
+                <ul class="right">
+
+
+
+                    <li class="has-form">
+
+                       <FORM class="searchbox navbar-form navbar-right" id="searchbox_012614087480249044419:dn-q5gtwxya" action="http://www.google.com/cse">
+
+                        <div class="row collapse">
+
+                            <input type="hidden" name="cx" value="012614087480249044419:dn-q5gtwxya">
+
+                            <INPUT type="hidden" name="cof" value="FORID:0">
+
+                            <INPUT class="form-control" name="q" type="text" placeholder="Search">
+
+                        </div>
+
+                    </FORM>
+
+                     </li>
+
+
+
+                </ul>
+
+
+
+                <!-- Left Nav Section -->
+
+                <ul class="left">
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#" >Demos</b></a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/intro/elevator-pitch/isis-in-pictures.html">Screenshots</a></li>
+
+                        <li><a href="/intro/tutorials/screencasts.html">Screencasts&nbsp;<img src="/images/tv_show-25.png"></a></li>
+
+                        <li><a href="/intro/powered-by/powered-by.html">Powered by</a></li>
+
+                        <li><a href="http://isisdemo.mmyco.co.uk/" target="_blank">Online Demo</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li><a href="/documentation">Documentation</a></li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#">Downloads</a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/intro/getting-started/simpleapp-archetype.html">Isis (Maven archetype)</a></li>
+
+                        <li><a href="/download.html">Isis (downloads)</a></li>
+
+                        <li><a href="http://www.isisaddons.org" target="_blank">Isis Add-ons (not ASF)</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#">Help</a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/support.html">Mailing Lists</a></li>
+
+                        <li><a href="http://isis.markmail.org/search/?q=" target="_blank">Mailing List Archives</a></li>
+
+                        <li><a href="https://issues.apache.org/jira/browse/ISIS" target="_blank">JIRA</a></li>
+
+                        <li><a href="http://github.com/apache/isis" target="_blank">Github mirror</a></li>
+
+                        <li><a href="http://stackoverflow.com/questions/tagged/isis" target="_blank">Stack Overflow</a></li>
+
+                        <li><a href="/contributors/contributing.html">How to contribute</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#" >@ASF</a>
+
+                      <ul class="dropdown">
+
+                        <li>
+
+                          <a href="http://www.apache.org/" target="_blank">Apache Homepage <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/licenses/" target="_blank">Licenses <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/security/" target="_blank">Security <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Sponsorship <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/foundation/thanks.html">Thanks <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="{{base}}more-thanks.html">More thanks <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                </ul>
+
+
+
+            </section>
+
+        </nav>
+
+    </div>
+
+</div>
+
+
+
+<div class="row">
+
+    <div class="large-8 medium-8 columns">
+
+
+
+        <div id="doc-content">
+
+          <div id="preamble">
+<div class="sectionbody">
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_disallowing_deprecated_annotations">Disallowing deprecated annotations</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_custom_validator">Custom validator</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_finetuning_the_programming_model">Finetuning the Programming Model</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_layout_metadata_reader">Layout metadata reader</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_listener_to_create_db_schema_objects">Listener to create DB schema objects</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+
+        </div>
+
+
+
+        <hr>
+
+        <footer>
+
+          <p class="small">
+
+          Copyright &copy; 2010~2015 The Apache&nbsp;Software&nbsp;Foundation, licensed under the Apache&nbsp;License,&nbsp;v2.0.
+
+          <br/>
+
+          Apache, the Apache feather logo, Apache&nbsp;Isis, and the Apache&nbsp;Isis project logo are all trademarks of The&nbsp;Apache&nbsp;Software&nbsp;Foundation.
+
+          </p>
+
+        </footer>
+
+
+
+    </div>
+
+
+
+    <div class="large-4 medium-4 columns">
+
+        <!-- the 'hide' class is removed by Javascript -->
+
+        <div id="toc" class="toc2 hide">
+
+          <ul class="sectlevel1">
+<li><a href="#_disallowing_deprecated_annotations">Disallowing deprecated annotations</a></li>
+<li><a href="#_custom_validator">Custom validator</a></li>
+<li><a href="#_finetuning_the_programming_model">Finetuning the Programming Model</a></li>
+<li><a href="#_layout_metadata_reader">Layout metadata reader</a></li>
+<li><a href="#_listener_to_create_db_schema_objects">Listener to create DB schema objects</a></li>
+</ul>
+
+        </div>
+
+    </div>
+
+</div>
+
+
+
+
+
+    <script src="../js/foundation/5.5.1/vendor/jquery.js"></script>
+
+    <script src="../js/foundation/5.5.1/foundation.min.js"></script>
+
+
+
+
+
+<script type="text/javascript">
+
+      $(document).foundation();
+
+
+
+      $(document).ready(function(){
+
+        // Cache selectors
+
+        var lastId,
+
+            topMenu = $("div#toc ul"),
+
+            topMenuHeight = 70,
+
+
+
+            menuItems = topMenu.find("a"),
+
+            menuItemsHrefs = menuItems.map(function(){
+
+              var item = $($(this).attr("href"));
+
+              if (item.length) { return item; }
+
+            });
+
+
+
+        // Bind click handler to menu items to scroll animation
+
+        menuItems.click(function(e){
+
+          var href = $(this).attr("href"),
+
+              offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1;
+
+          $('html, body').stop().animate({
+
+              scrollTop: offsetTop
+
+          }, 300);
+
+
+
+          e.preventDefault();
+
+        });
+
+
+
+        // Bind to scroll of window
+
+        $(  window ).scroll(function(){
+
+
+
+           // Get container scroll position
+
+           var fromTop = $(this).scrollTop()+topMenuHeight;
+
+
+
+           var cur = menuItemsHrefs.map(function(){
+
+             if ($(this).offset().top < fromTop)
+
+               return this;
+
+           });
+
+
+
+           // Get the id of the current element
+
+           cur = cur[cur.length-1];
+
+
+
+           var id = cur && cur.length ? cur[0].id : "";
+
+
+
+           //console.log("id = " + id + ", lastId = "  + lastId);
+
+
+
+           if (lastId !== id && id) {
+
+               scrollTo(id);
+
+           }
+
+        });
+
+
+
+        scrollTo = function(id) {
+
+              lastId = id;
+
+
+
+              menuItems
+
+                .removeClass("active");
+
+
+
+              menuItems
+
+                .parents()
+
+                .removeClass("active-region");
+
+
+
+              menuItems
+
+                .parents("ul").hide();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .addClass("active");
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parents("ul").show();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parent().children("ul").show();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parents("li").addClass("active-region");
+
+
+
+        }
+
+      menuItems
+
+        .removeClass("active");
+
+
+
+      menuItems
+
+        .parents()
+
+        .removeClass("active-region");
+
+
+
+        var syncMenuItem;
+
+        if(window.location.hash!=="") {
+
+            var menuItemFor = $.grep(menuItems, function(e) {
+
+                return e.hash === window.location.hash;
+
+            });
+
+            console.log(menuItemFor);
+
+            if(menuItemFor.length === 1) {
+
+                syncMenuItem = menuItemFor[0];
+
+            }
+
+        }
+
+
+
+        if(!syncMenuItem){
+
+            syncMenuItem = menuItems[0];
+
+        }
+
+
+
+        $("#toc").removeClass("hide");
+
+
+
+        $(syncMenuItem).click();
+
+
+
+      });
+
+
+
+
+
+</script>
+
+
+
+
+
+</body>
+
+</html>
\ No newline at end of file

Added: isis/site/trunk/content/docs/user-guide/user-guide-extending.html
URL: http://svn.apache.org/viewvc/isis/site/trunk/content/docs/user-guide/user-guide-extending.html?rev=1673966&view=auto
==============================================================================
--- isis/site/trunk/content/docs/user-guide/user-guide-extending.html (added)
+++ isis/site/trunk/content/docs/user-guide/user-guide-extending.html Wed Apr 15 21:39:44 2015
@@ -0,0 +1,876 @@
+<!doctype html>
+
+<html class="no-js" lang="en">
+
+<head>
+
+    <meta charset="utf-8"/>
+
+    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+
+
+
+    <title>User Guide: How-tos: Extending</title>
+
+
+
+    <!--
+
+        Licensed to the Apache Software Foundation (ASF) under one
+
+        or more contributor license agreements.  See the NOTICE file
+
+        distributed with this work for additional information
+
+        regarding copyright ownership.  The ASF licenses this file
+
+        to you under the Apache License, Version 2.0 (the
+
+        "License"); you may not use this file except in compliance
+
+        with the License.  You may obtain a copy of the License at
+
+
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+
+
+        Unless required by applicable law or agreed to in writing,
+
+        software distributed under the License is distributed on an
+
+        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+
+        KIND, either express or implied.  See the License for the
+
+        specific language governing permissions and limitations
+
+        under the License.
+
+    -->
+
+
+
+    <!-- No caching headers -->
+
+    <meta http-equiv="cache-control" content="no-cache" />
+
+    <meta http-equiv="pragma" content="no-cache" />
+
+    <meta http-equiv="expires" content="-1" />
+
+
+
+
+
+    <link rel="stylesheet" href="../css/foundation/5.5.1/foundation.css"/>
+
+    <script src="../js/foundation/5.5.1/vendor/modernizr.js"></script>
+
+
+
+    <link href="../css/asciidoctor/stylesheets/foundation-potion.css" rel="stylesheet">
+
+
+
+    <link href="../css/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
+
+
+
+    <style type="text/css">
+
+        #forkongithub a{
+
+            display: none;
+
+            background:#090;
+
+            color:#fff;
+
+            text-decoration:none;
+
+            font-family:arial, sans-serif;
+
+            text-align:center;
+
+            font-weight:bold;
+
+            padding:5px 40px;
+
+            font-size:1rem;
+
+            line-height:2rem;
+
+            position:relative;
+
+            transition:0.5s;
+
+        }
+
+        #forkongithub a:hover{
+
+            background:#0D0;
+
+            color:#fff;
+
+        }
+
+        #forkongithub a::before,
+
+        #forkongithub a::after{
+
+            content:"";width:100%;
+
+            display:block;
+
+            position:fixed;
+
+            top:1px;
+
+            left:0;
+
+            height:1px;
+
+            background:#fff;
+
+            z-index: 9999;
+
+        }
+
+        #forkongithub a::after{
+
+            bottom:1px;
+
+            top:auto;
+
+        }
+
+        @media screen and (min-width:768px){
+
+            #forkongithub{
+
+                position:fixed;
+
+                display:block;
+
+                top:0;
+
+                right:0;
+
+                width:250px;
+
+                overflow:hidden;
+
+                height:250px;
+
+                z-index: 9999;
+
+            }
+
+            #forkongithub a{
+
+                display:inherit;
+
+                width:250px;
+
+                position:fixed;
+
+                font-size:small;
+
+                top:40px;
+
+                right:-60px;
+
+                transform:rotate(45deg);
+
+                -webkit-transform:rotate(45deg);
+
+                -ms-transform:rotate(45deg);
+
+                box-shadow:4px 4px 10px rgba(0,0,0,0.8);
+
+            }
+
+        }
+
+    </style>
+
+
+
+    <style>
+
+        body {
+
+          position: relative;
+
+        }
+
+
+
+        body div#toc li,
+
+        body div#toc2 li {
+
+            list-style-type: none;
+
+        }
+
+
+
+        div#doc-content {
+
+            margin-top: 30px;
+
+        }
+
+
+
+        body div#toc li.active-region:before,
+
+        body div#toc2 li.active-region:before {
+
+            content: "\00BB \0020";
+
+            margin-left: -12px;
+
+        }
+
+
+
+        body div#toc li a.active,
+
+        body div#toc2 li a.active {
+
+            color: red;
+
+        }
+
+
+
+        body div#toc.toc,
+
+        body div#toc.toc2 {
+
+            position: fixed;
+
+            left: auto;
+
+            padding-top: 120px;
+
+            z-index: auto;
+
+            background-color: white;
+
+            border-left-color: #eee;
+
+            border-left-style: solid;
+
+            border-right: none;
+
+        }
+
+    </style>
+
+
+
+</head>
+
+<body>
+
+
+
+    <span id="forkongithub">
+
+        <a href="https://github.com/apache/isis">Fork me on GitHub</a>
+
+    </span>
+
+
+
+<div class="row">
+
+
+
+    <div class="fixed contain-to-grid">
+
+        <nav class="top-bar" data-topbar role="navigation">
+
+            <ul class="title-area">
+
+                <li class="name">
+
+                    <h1>
+
+                        <a href="/index.html">Apache Isis&trade;</a>
+
+                    </h1>
+
+                </li>
+
+                <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
+
+                <li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
+
+            </ul>
+
+
+
+            <section class="top-bar-section">
+
+                <ul class="right">
+
+
+
+                    <li class="has-form">
+
+                       <FORM class="searchbox navbar-form navbar-right" id="searchbox_012614087480249044419:dn-q5gtwxya" action="http://www.google.com/cse">
+
+                        <div class="row collapse">
+
+                            <input type="hidden" name="cx" value="012614087480249044419:dn-q5gtwxya">
+
+                            <INPUT type="hidden" name="cof" value="FORID:0">
+
+                            <INPUT class="form-control" name="q" type="text" placeholder="Search">
+
+                        </div>
+
+                    </FORM>
+
+                     </li>
+
+
+
+                </ul>
+
+
+
+                <!-- Left Nav Section -->
+
+                <ul class="left">
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#" >Demos</b></a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/intro/elevator-pitch/isis-in-pictures.html">Screenshots</a></li>
+
+                        <li><a href="/intro/tutorials/screencasts.html">Screencasts&nbsp;<img src="/images/tv_show-25.png"></a></li>
+
+                        <li><a href="/intro/powered-by/powered-by.html">Powered by</a></li>
+
+                        <li><a href="http://isisdemo.mmyco.co.uk/" target="_blank">Online Demo</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li><a href="/documentation">Documentation</a></li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#">Downloads</a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/intro/getting-started/simpleapp-archetype.html">Isis (Maven archetype)</a></li>
+
+                        <li><a href="/download.html">Isis (downloads)</a></li>
+
+                        <li><a href="http://www.isisaddons.org" target="_blank">Isis Add-ons (not ASF)</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#">Help</a>
+
+                      <ul class="dropdown">
+
+                        <li><a href="/support.html">Mailing Lists</a></li>
+
+                        <li><a href="http://isis.markmail.org/search/?q=" target="_blank">Mailing List Archives</a></li>
+
+                        <li><a href="https://issues.apache.org/jira/browse/ISIS" target="_blank">JIRA</a></li>
+
+                        <li><a href="http://github.com/apache/isis" target="_blank">Github mirror</a></li>
+
+                        <li><a href="http://stackoverflow.com/questions/tagged/isis" target="_blank">Stack Overflow</a></li>
+
+                        <li><a href="/contributors/contributing.html">How to contribute</a></li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                    <li class="has-dropdown">
+
+                      <a href="#" >@ASF</a>
+
+                      <ul class="dropdown">
+
+                        <li>
+
+                          <a href="http://www.apache.org/" target="_blank">Apache Homepage <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/licenses/" target="_blank">Licenses <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/security/" target="_blank">Security <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/foundation/sponsorship.html" target="_blank">Sponsorship <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="http://www.apache.org/foundation/thanks.html">Thanks <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                        <li>
+
+                          <a href="{{base}}more-thanks.html">More thanks <i class="icon-share-alt"></i></a>
+
+                        </li>
+
+                      </ul>
+
+                    </li>
+
+
+
+                </ul>
+
+
+
+            </section>
+
+        </nav>
+
+    </div>
+
+</div>
+
+
+
+<div class="row">
+
+    <div class="large-8 medium-8 columns">
+
+
+
+        <div id="doc-content">
+
+          <div id="preamble">
+<div class="sectionbody">
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_extending_the_programming_model">Extending the Programming Model</h2>
+<div class="sectionbody">
+
+</div>
+</div>
+<div class="sect1">
+<h2 id="_user_guide_how_tos_extending_programming_model">User Guide: How-tos: Extending: Programming Model</h2>
+<div class="sectionbody">
+<div class="admonitionblock note">
+<table>
+<tr>
+<td class="icon">
+<i class="fa icon-note" title="Note"></i>
+</td>
+<td class="content">
+TODO
+</td>
+</tr>
+</table>
+</div>
+<div class="sect2">
+<h3 id="_disallowing_deprecated_annotations">Disallowing deprecated annotations</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_custom_validator">Custom validator</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_finetuning_the_programming_model">Finetuning the Programming Model</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_layout_metadata_reader">Layout metadata reader</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_listener_to_create_db_schema_objects">Listener to create DB schema objects</h3>
+
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_extending_the_wicket_viewer">Extending the Wicket viewer</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_writing_a_custom_theme">Writing a custom theme</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_replacing_page_elements">Replacing page elements</h3>
+
+</div>
+<div class="sect2">
+<h3 id="_custom_pages">Custom pages</h3>
+
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_extending_the_restful_viewer">Extending the Restful viewer</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_custom_representations">Custom Representations</h3>
+
+</div>
+</div>
+</div>
+
+        </div>
+
+
+
+        <hr>
+
+        <footer>
+
+          <p class="small">
+
+          Copyright &copy; 2010~2015 The Apache&nbsp;Software&nbsp;Foundation, licensed under the Apache&nbsp;License,&nbsp;v2.0.
+
+          <br/>
+
+          Apache, the Apache feather logo, Apache&nbsp;Isis, and the Apache&nbsp;Isis project logo are all trademarks of The&nbsp;Apache&nbsp;Software&nbsp;Foundation.
+
+          </p>
+
+        </footer>
+
+
+
+    </div>
+
+
+
+    <div class="large-4 medium-4 columns">
+
+        <!-- the 'hide' class is removed by Javascript -->
+
+        <div id="toc" class="toc2 hide">
+
+          <ul class="sectlevel1">
+<li><a href="#_extending_the_programming_model">Extending the Programming Model</a></li>
+<li><a href="#_user_guide_how_tos_extending_programming_model">User Guide: How-tos: Extending: Programming Model</a>
+<ul class="sectlevel2">
+<li><a href="#_disallowing_deprecated_annotations">Disallowing deprecated annotations</a></li>
+<li><a href="#_custom_validator">Custom validator</a></li>
+<li><a href="#_finetuning_the_programming_model">Finetuning the Programming Model</a></li>
+<li><a href="#_layout_metadata_reader">Layout metadata reader</a></li>
+<li><a href="#_listener_to_create_db_schema_objects">Listener to create DB schema objects</a></li>
+</ul>
+</li>
+<li><a href="#_extending_the_wicket_viewer">Extending the Wicket viewer</a>
+<ul class="sectlevel2">
+<li><a href="#_writing_a_custom_theme">Writing a custom theme</a></li>
+<li><a href="#_replacing_page_elements">Replacing page elements</a></li>
+<li><a href="#_custom_pages">Custom pages</a></li>
+</ul>
+</li>
+<li><a href="#_extending_the_restful_viewer">Extending the Restful viewer</a>
+<ul class="sectlevel2">
+<li><a href="#_custom_representations">Custom Representations</a></li>
+</ul>
+</li>
+</ul>
+
+        </div>
+
+    </div>
+
+</div>
+
+
+
+
+
+    <script src="../js/foundation/5.5.1/vendor/jquery.js"></script>
+
+    <script src="../js/foundation/5.5.1/foundation.min.js"></script>
+
+
+
+
+
+<script type="text/javascript">
+
+      $(document).foundation();
+
+
+
+      $(document).ready(function(){
+
+        // Cache selectors
+
+        var lastId,
+
+            topMenu = $("div#toc ul"),
+
+            topMenuHeight = 70,
+
+
+
+            menuItems = topMenu.find("a"),
+
+            menuItemsHrefs = menuItems.map(function(){
+
+              var item = $($(this).attr("href"));
+
+              if (item.length) { return item; }
+
+            });
+
+
+
+        // Bind click handler to menu items to scroll animation
+
+        menuItems.click(function(e){
+
+          var href = $(this).attr("href"),
+
+              offsetTop = href === "#" ? 0 : $(href).offset().top-topMenuHeight+1;
+
+          $('html, body').stop().animate({
+
+              scrollTop: offsetTop
+
+          }, 300);
+
+
+
+          e.preventDefault();
+
+        });
+
+
+
+        // Bind to scroll of window
+
+        $(  window ).scroll(function(){
+
+
+
+           // Get container scroll position
+
+           var fromTop = $(this).scrollTop()+topMenuHeight;
+
+
+
+           var cur = menuItemsHrefs.map(function(){
+
+             if ($(this).offset().top < fromTop)
+
+               return this;
+
+           });
+
+
+
+           // Get the id of the current element
+
+           cur = cur[cur.length-1];
+
+
+
+           var id = cur && cur.length ? cur[0].id : "";
+
+
+
+           //console.log("id = " + id + ", lastId = "  + lastId);
+
+
+
+           if (lastId !== id && id) {
+
+               scrollTo(id);
+
+           }
+
+        });
+
+
+
+        scrollTo = function(id) {
+
+              lastId = id;
+
+
+
+              menuItems
+
+                .removeClass("active");
+
+
+
+              menuItems
+
+                .parents()
+
+                .removeClass("active-region");
+
+
+
+              menuItems
+
+                .parents("ul").hide();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .addClass("active");
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parents("ul").show();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parent().children("ul").show();
+
+
+
+              menuItems
+
+                .filter("[href=#"+id+"]")
+
+                .parents("li").addClass("active-region");
+
+
+
+        }
+
+      menuItems
+
+        .removeClass("active");
+
+
+
+      menuItems
+
+        .parents()
+
+        .removeClass("active-region");
+
+
+
+        var syncMenuItem;
+
+        if(window.location.hash!=="") {
+
+            var menuItemFor = $.grep(menuItems, function(e) {
+
+                return e.hash === window.location.hash;
+
+            });
+
+            console.log(menuItemFor);
+
+            if(menuItemFor.length === 1) {
+
+                syncMenuItem = menuItemFor[0];
+
+            }
+
+        }
+
+
+
+        if(!syncMenuItem){
+
+            syncMenuItem = menuItems[0];
+
+        }
+
+
+
+        $("#toc").removeClass("hide");
+
+
+
+        $(syncMenuItem).click();
+
+
+
+      });
+
+
+
+
+
+</script>
+
+
+
+
+
+</body>
+
+</html>
\ No newline at end of file