http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/core-bootstrap-assembly.html ---------------------------------------------------------------------- diff --git a/content/java/develop/core-bootstrap-assembly.html b/content/java/develop/core-bootstrap-assembly.html new file mode 100644 index 0000000..5cb31e7 --- /dev/null +++ b/content/java/develop/core-bootstrap-assembly.html @@ -0,0 +1,405 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Core Bootstrap</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="core.html" title="Core" /><link rel="prev" href="core-api.html" title="Core API" /><link rel="next" href="core-testsupport.html" title="Core Test Support" /> + + +<!-- favicon --> + +<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" /> +<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" /> + +<!-- style --> + +<link href="css/shCore.css" rel="stylesheet" type="text/css" /> +<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/polygene.css" rel="stylesheet" type="text/css" /> + +<!-- Syntax Highlighter --> + +<script type="text/javascript" src="js/shCore.js"></script> +<script type="text/javascript" src="js/shBrushJava.js"></script> +<script type="text/javascript" src="js/shBrushScala.js"></script> +<script type="text/javascript" src="js/shBrushJScript.js"></script> +<script type="text/javascript" src="js/shBrushBash.js"></script> +<script type="text/javascript" src="js/shBrushPlain.js"></script> +<script type="text/javascript" src="js/shBrushXml.js"></script> +<script type="text/javascript" src="js/shBrushGroovy.js"></script> +<script type="text/javascript" src="js/shBrushPython.js"></script> +<script type="text/javascript" src="js/shBrushRuby.js"></script> +<script type="text/javascript" src="js/shBrushCSharp.js"></script> + +<script type="text/javascript"> + SyntaxHighlighter.defaults['tab-size'] = 4; + SyntaxHighlighter.defaults['gutter'] = false; + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all() +</script> + +<!-- JQuery --> + +<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> + +<!-- Image Scaler --> + +<script type="text/javascript" src="js/imagescaler.js"></script> + +<!-- Table Styler --> + +<script type="text/javascript" src="js/tablestyler.js"></script> + +<!-- Apache Polygene WebSite Progressive Enhancement --> + +<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script> +<script type="text/javascript" src="js/progressive-enhancement.js"></script> + +<!-- Analytics --> + <script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-62007352-1']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + </script> + + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><a href="tutorials.html">Tutorials</a></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><span xmlns="" href="core.html">Core</span></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="core.html#_overview_3">Overview</a></span></dt><dt><span class="section"><a href="core-api.html">Core API</a></span></dt><dt><span class="section"><span xmlns="" href="core-bootstrap-assembly.html">Core Bootstrap</span></span></dt><dt><span class="section"><a href="core-testsupport.html">Core Test Support</a></span></dt><dt><span class="section"><a href="core-spi.html">Core Extension SPI</a></span></dt><dt><span class="section"><a href="core-runtime.html">Core Runtime</a></span></dt></dl></div></div><div class="section" title="Core Bootstrap"><div class="titlepage"><div><div><h3 class="title"><a id="core-bootstrap-assembly"></a>Core Bootstrap</h3></div></div></div><p class="remark"><em><span class="comment"></span></em></p><p class="devstatus-code-stable">code</p><p class="devsta tus-docs-brief">docs</p><p class="devstatus-tests-good">tests</p><p>Polygene⢠has a distinct bootstrap phase, also known as the <span class="emphasis"><em>Assembly</em></span> of an application, where the applications structure +is defined programmatically. Once all the layers, modules and all the composite types in each module have been defined +the model is instantiated into an application. This enables the entire <span class="emphasis"><em>structure</em></span> system in Polygene, where types "belongs" +to a module and visibility rules define default behaviors, enforcement of architectural integrity and much more.</p><p>The <span class="emphasis"><em>assembly</em></span> is preceeded by the creation of the <span class="emphasis"><em>Polygene Runtime</em></span>. The <span class="emphasis"><em>assembly</em></span> can be declared fully by defining +all modules and layers, and how the layers are sitting on top of each other, OR one can utilize one of the two +convenience assemblies, one for a <span class="emphasis"><em>pancake</em></span> pattern, where all layers are top on each other, or one with a single module +in a single layer, useful for small applications, spikes and tests. The <code class="literal">bootstrap</code> system has several ways to acheive +this, and they are listed below in <a class="xref" href="core-bootstrap-assembly.html#core-bootstrap-assembly-layered" title="Layered Application Assembler (RECOMMENDED!)">Layered Application Assembler</a>.</p><p>During <span class="emphasis"><em>assembly</em></span>, the application (JVM level) architecture and the application model is defined. You define which +layers exist and how they relate to each other. For each layer, you define which modules it contains. And for each +module, you define which composites are in it, and what are the visibility rules for each of these composites.</p><p>You can also;</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"> +Define default values for properties. +</li><li class="listitem"> +Add additional interfaces to composites dynamically. +</li><li class="listitem"> +Add concerns, mixins, constraints and side effects dynamically. +</li><li class="listitem"> +Set <span class="emphasis"><em>meta information</em></span> on defined types. +</li><li class="listitem"> +Import external services to be available as Polygene⢠services. +</li><li class="listitem"> +Tag services with markers +</li></ul></div><div class="section" title="Defining Objects"><div class="titlepage"><div><div><h4 class="title"><a id="_defining_objects"></a>Defining Objects</h4></div></div></div><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.objects( MyObject.class ).visibleIn( Visibility.layer ); +} +</pre></div><div class="section" title="Defining Transients"><div class="titlepage"><div><div><h4 class="title"><a id="_defining_transients"></a>Defining Transients</h4></div></div></div><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.transients( MyTransient.class ).visibleIn( Visibility.layer ); +} +</pre></div><div class="section" title="Defining Values"><div class="titlepage"><div><div><h4 class="title"><a id="_defining_values"></a>Defining Values</h4></div></div></div><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.values( MyValue.class ).visibleIn( Visibility.layer ); +} +</pre></div><div class="section" title="Defining Entities"><div class="titlepage"><div><div><h4 class="title"><a id="_defining_entities"></a>Defining Entities</h4></div></div></div><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.entities( MyEntity.class ).visibleIn( Visibility.layer ); +} +</pre></div><div class="section" title="Defining Services"><div class="titlepage"><div><div><h4 class="title"><a id="_defining_services"></a>Defining Services</h4></div></div></div><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.services( MyService.class ).visibleIn( Visibility.layer ); +} +</pre><div class="section" title="Tagging Services"><div class="titlepage"><div><div><h5 class="title"><a id="_tagging_services"></a>Tagging Services</h5></div></div></div><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.services( MyService.class ).taggedWith( "foo", "bar" ); +} +</pre></div><div class="section" title="Importing external Services"><div class="titlepage"><div><div><h5 class="title"><a id="_importing_external_services"></a>Importing external Services</h5></div></div></div><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.importedServices( MyService.class ). + importedBy( InstanceImporter.class ). + setMetaInfo( new MyService() ); + + // OR + + module.objects( MyService.class ); + module.importedServices( MyService.class ). + importedBy( NewObjectImporter.class ); +} +</pre></div></div><div class="section" title="Defining default values for Properties"><div class="titlepage"><div><div><h4 class="title"><a id="_defining_default_values_for_properties"></a>Defining default values for Properties</h4></div></div></div><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.values( MyValue.class ); + MyValue myValueDefaults = module.forMixin( MyValue.class ).declareDefaults(); + myValueDefaults.foo().set( "bar" ); + + module.entities( MyEntity.class ); + MyEntity myEntityDefaults = module.forMixin( MyEntity.class ).declareDefaults(); + myEntityDefaults.cathedral().set( "bazar" ); +} +</pre></div><div class="section" title="Adding additional interfaces to composites"><div class="titlepage"><div><div><h4 class="title"><a id="_adding_additional_interfaces_to_composites"></a>Adding additional interfaces to composites</h4></div></div></div></div><div class="section" title="Adding concerns, mixins, constraints and side effects"><div class="titlepage"><div><div><h4 class="title"><a id="_adding_concerns_mixins_constraints_and_side_effects"></a>Adding concerns, mixins, constraints and side effects</h4></div></div></div></div><div class="section" title="Setting meta information on assembled types"><div class="titlepage"><div><div><h4 class="title"><a id="_setting_meta_information_on_assembled_types"></a>Setting meta information on assembled types</h4></div></div></div></div><div class="section" title="Using Assemblers"><div class="titlepage"><div><div><h4 class="title"><a id="_using_assemblers"></a>Using Assemblers</h4></div></div></div><p>Many <a class="link" href="libra ries.html" title="Libraries">libraries</a> and <a class="link" href="extensions.html" title="Extensions">extensions</a> provides a cookie-cutter <span class="emphasis"><em>Assembler</em></span>, to simplify the set up +of such component. Often these are suitable, but sometimes they wonât fit the application in hand, in which case the +source code at least provides information of what is needed for the component to be used.</p><p>Assemblers are typically just instantiated and then call the assemble() method with the ModuleAssembly instance, +such as;</p><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + RestServerAssembler assembler = new RestServerAssembler(); + assembler.assemble( module ); +} +</pre></div><div class="section" title="Defining an Entity Store"><div class="titlepage"><div><div><h4 class="title"><a id="_defining_an_entity_store"></a>Defining an Entity Store</h4></div></div></div><p>Defining an <span class="emphasis"><em>Entity Store</em></span> is in principle as simple as defining a ServiceComposite implementing the EntityStore +interface. The problem is that most Entity Stores require <a class="xref" href="core-api.html#core-api-service-configuration" title="Service Configuration">Service Configuration</a>, and configuration requires an +Entity Store. This chicken-and-egg problem is resolved by having an entity store available that does not require any +<a class="xref" href="core-api.html#core-api-service-configuration" title="Service Configuration">Service Configuration</a>. Many <span class="emphasis"><em>Assemblers</em></span> for entity store implementations uses the MemoryEntityStore, and +effectively leaves the configuration in the properties file where <a class="xref" href="core-api.html#core-api-service-configuration" title="Service Configuration">Service Configuration</a> bootstraps from. It is +possible to chain this, so that for instance the Neo4J Entity Store uses the Preferences Entity Store for its +configuration, and the Preferences Entity Store uses the Memory Entity Store (i.e. the properties file).</p><p>The point is that the entity store used for the configuration of the primary entity store used in the application is +that it must not be visible to the application itself. Sometimes it is easier to put a Memory Entity Store in the +same module, with Visibility set to <span class="emphasis"><em>module</em></span>. Sometimes it makes sense to have an additional Configuration layer below +the infrastructure layer, which has this setup.</p><p>As mentioned above, most entity stores defines a reasonable default <span class="emphasis"><em>Assembler</em></span>, possibly with some constructor +arguments or methods to define certain aspects. An example is the popular JdbmEntityStore, which <span class="emphasis"><em>Assembler</em></span> can be +used like;</p><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + new JdbmEntityStoreAssembler().assemble( module ); +} +</pre></div><div class="section" title="Layered Application Assembler (RECOMMENDED!)"><div class="titlepage"><div><div><h4 class="title"><a id="core-bootstrap-assembly-layered"></a>Layered Application Assembler (RECOMMENDED!)</h4></div></div></div><p>In 2.1, a new way to instantiate Polygene⢠applications was introduced. It starts with subclassing the +<code class="literal">LayeredApplicationAssembler</code>, and implementing the <code class="literal">assembleLayers()</code> method.</p><p>In the <code class="literal">assembleLayers()</code> method, one is epected to either call the <code class="literal">createLayer()</code> method in the super class +with the Class of the LayerAssembler,</p><pre class="programlisting brush: java"> LayerAssembly domainLayer = createLayer( DomainLayer.class );</pre><p>OR manually instantiate and call the LayerAssembler.</p><pre class="programlisting brush: java"> LayerAssembly infraLayer = new InfrastructureLayer( configModule ).assemble( assembly.layer( InfrastructureLayer.NAME ));</pre><p>This is to make the normal case as simple as possible, yet allow the special needs that occssionally surfaces.</p><p>Each LayerAssembler implementation may optionally extend the <code class="literal">LayeredLayerAssembler</code>, to get access to the +<code class="literal">createModule()</code> method, which again simplifies the creation of modules in the <code class="literal">assemble()</code> method.</p><pre class="programlisting brush: java"> createModule( layer, InvoicingModule.class );</pre><p><code class="literal">ModuleAssembler</code> implementations typically use <code class="literal">Assembler</code> classes to put together, or call the <code class="literal">entities()</code>, +<code class="literal">values()</code> methods described elsewhere on this page. There is no superclass to use.</p><p><code class="literal">ModuleAssembler</code> implementations should have a name ending with "Module" and the naming will insert a human-readable +space within the module name, e.g. <code class="literal">InvoicingModule</code> will be named "Invoicing Module".</p><p>For example code, see the tutorial <a class="xref" href="howto-assemble-application.html" title="Assemble an Application">Assemble an Application</a>.</p></div><div class="section" title="Singleton Assembler"><div class="titlepage"><div><div><h4 class="title"><a id="_singleton_assembler"></a>Singleton Assembler</h4></div></div></div><p>Every Polygene⢠runtime instance consist of One Application, with one or more Layers and one or more Modules in each Layer. +So the minimal application is still one layer with one module. This is not recommended other than for testing purposes +and really trivial applications.</p><p>Letâs take a closer look at how it is put together.</p><pre class="programlisting brush: java">SingletonAssembler assembler = new SingletonAssembler() +{ + + @Override + public void assemble( ModuleAssembly module ) + throws AssemblyException + { + module.services( MyService.class ).identifiedBy( "Foo" ); + module.services( MyService.class ).identifiedBy( "Bar" ); + module.objects( Stuff.class ); + } + +}; +Module module = assembler.module(); +Stuff stuff = module.newObject( Stuff.class ); +</pre><p>Once the SingletonAssembler constructor returns, the Polygene⢠application is up and running.</p><p>The SingletonAssembler also makes common system resources available from the bootstrap code, such as +Module, UnitOfWorkFactory and others. This is possible since there is only one Module.</p></div><div class="section" title="Application Builder"><div class="titlepage"><div><div><h4 class="title"><a id="_application_builder"></a>Application Builder</h4></div></div></div><p>Some applications has no need for runtime determination of the exact application structure, and no need for +advanced alterations to a staright-forward layered application structure. By using the <code class="literal">ApplicationBuilder</code> +it is possible to define the application structure from a JSON document, AND call the provided <code class="literal">main()</code> class, +taking the JSON document as input on <code class="literal">System.in</code>.</p><p>The format of the JSON document, directly reflects the application structure, such as</p><pre class="programlisting brush: json">{ + "name": "Build from JSON test.", + "layers": [ + { "name": "service", "uses": [ "domain", "config"] }, + { "name": "donfig" }, + { + "name": "domain", + "modules" : [ + { + "name" : "Invoicing", + "assemblers" : [ + "org.hedhman.niclas.bootstrap.InvoicingAssembler" + ] + } + ] + } + ] +}</pre><p>At the moment, the JSON format only support <code class="literal">Assembler</code> classes to do the work.</p><p>Another way to use the <code class="literal">ApplicationBuilder</code> is to subclass it, optionally use the <code class="literal">configureFromJSON()</code> method, +and then programmatically enhance the structure before calling <code class="literal">newApplication()</code>.</p></div><div class="section" title="Pancake Assembly"><div class="titlepage"><div><div><h4 class="title"><a id="_pancake_assembly"></a>Pancake Assembly</h4></div></div></div><p>There is one case that stands out as a common case, and forms a reasonable middle-ground. It is where each layer sits +exactly on top of each other layer, like pancakes. Each layer will only use the layer directly below and only that +layer. For this case we have a convenience setup. You create an Assembler[][][], where the outer-most array is each +layer, the middle array is the modules in each layer, and the last array is a set of assemblers needed to put the +things togather.</p><p>Letâs look at an example;</p><pre class="programlisting brush: java">public static void main( String[] args ) + throws Exception +{ + polygene = new Energy4Java(); + Assembler[][][] assemblers = new Assembler[][][]{ + { // View Layer + { // Login Module + new LoginAssembler() + // : + }, + { // Main Workbench Module + new MenuAssembler(), + new PerspectivesAssembler(), + new ViewsAssembler() + // : + }, + { // Printing Module + new ReportingAssembler(), + new PdfAssembler() + // : + } + }, + { // Application Layer + { // Accounting Module + new BookkeepingAssembler(), + new CashFlowAssembler(), + new BalanceSheetAssembler() + // : + }, + { // Inventory Module + new PricingAssembler(), + new ProductAssembler() + // : + } + }, + { // Domain Layer + // : + }, + { // Infrastructure Layer + // : + } + }; + ApplicationDescriptor model = newApplication( assemblers ); + Application runtime = model.newInstance( polygene.spi() ); + runtime.activate(); +} + +private static ApplicationDescriptor newApplication( final Assembler[][][] assemblers ) + throws AssemblyException +{ + return polygene.newApplicationModel( new ApplicationAssembler() + { + + @Override + public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory ) + throws AssemblyException + { + return appFactory.newApplicationAssembly( assemblers ); + } + + } ); +} +</pre></div><div class="section" title="Full Assembly"><div class="titlepage"><div><div><h4 class="title"><a id="_full_assembly"></a>Full Assembly</h4></div></div></div><p>Full Assembly means that you have the opportunity to create any layer/module hierarchy that are within the rules of the +Polygene⢠runtime. It requires more support in your code to be useful, and the example below is by no means a recommended way +to organize large application assemblies.</p><p>In principle, you first start the Polygene⢠runtime, call newApplication with an ApplicationAssembler instance and call +activate() on the returned application. The ApplicationAssembler instance will be called with an +ApplicationAssemblyFactory, which is used to create an ApplicationAssembly describing the application structure.</p><pre class="programlisting brush: java">private static Energy4Java polygene; + +private static Application application; + +public static void main( String[] args ) + throws Exception +{ + // Create a Polygene Runtime + polygene = new Energy4Java(); + application = polygene.newApplication( new ApplicationAssembler() + { + + @Override + public ApplicationAssembly assemble( ApplicationAssemblyFactory appFactory ) + throws AssemblyException + { + ApplicationAssembly assembly = appFactory.newApplicationAssembly(); + buildAssembly( assembly ); + return assembly; + } + + } ); + // activate the application + application.activate(); +} + +static void buildAssembly( ApplicationAssembly app ) throws AssemblyException +{ + LayerAssembly webLayer = createWebLayer( app ); + LayerAssembly domainLayer = createDomainLayer( app ); + LayerAssembly persistenceLayer = createInfrastructureLayer( app ); + LayerAssembly authLayer = createAuth2Layer( app ); + LayerAssembly messagingLayer = createMessagingLayer( app ); + + webLayer.uses( domainLayer ); + domainLayer.uses( authLayer ); + domainLayer.uses( persistenceLayer ); + domainLayer.uses( messagingLayer ); +} + +static LayerAssembly createWebLayer( ApplicationAssembly app ) throws AssemblyException +{ + LayerAssembly layer = app.layer( "web-layer" ); + createCustomerWebModule( layer ); + return layer; +} + +static LayerAssembly createDomainLayer( ApplicationAssembly app ) throws AssemblyException +{ + LayerAssembly layer = app.layer( "domain-layer" ); + createCustomerDomainModule( layer ); + // : + // : + return layer; +} + +static LayerAssembly createInfrastructureLayer( ApplicationAssembly app ) throws AssemblyException +{ + LayerAssembly layer = app.layer( "infrastructure-layer" ); + createPersistenceModule( layer ); + return layer; +} + +static LayerAssembly createMessagingLayer( ApplicationAssembly app ) throws AssemblyException +{ + LayerAssembly layer = app.layer( "messaging-layer" ); + createWebServiceModule( layer ); + createMessagingPersistenceModule( layer ); + return layer; +} + +static LayerAssembly createAuth2Layer( ApplicationAssembly application ) throws AssemblyException +{ + LayerAssembly layer = application.layer( "auth2-layer" ); + createAuthModule( layer ); + return layer; +} + +static void createCustomerWebModule( LayerAssembly layer ) throws AssemblyException +{ + ModuleAssembly assembly = layer.module( "customer-web-module" ); + assembly.transients( CustomerViewComposite.class, CustomerEditComposite.class, + CustomerListViewComposite.class, CustomerSearchComposite.class ); +} + +static void createCustomerDomainModule( LayerAssembly layer ) throws AssemblyException +{ + ModuleAssembly assembly = layer.module( "customer-domain-module" ); + assembly.entities( CustomerEntity.class, CountryEntity.class ); + assembly.values( AddressValue.class ); +} + +static void createAuthModule( LayerAssembly layer ) throws AssemblyException +{ + ModuleAssembly assembly = layer.module( "auth-module" ); + new LdapAuthenticationAssembler().assemble( assembly ); + new ThrinkAuthorizationAssembler().assemble( assembly ); + new UserTrackingAuditAssembler().assemble( assembly ); +} + +static void createPersistenceModule( LayerAssembly layer ) throws AssemblyException +{ + ModuleAssembly assembly = layer.module( "persistence-module" ); + // Someone has created an assembler for the Neo EntityStore + new NeoAssembler( "./neostore" ).assemble( assembly ); +} + +</pre></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><p> + Copyright © 2015 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + <br /><small> + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are trademarks of The Apache Software Foundation.<br /> + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </small></p></div></body></html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/core-runtime.html ---------------------------------------------------------------------- diff --git a/content/java/develop/core-runtime.html b/content/java/develop/core-runtime.html new file mode 100644 index 0000000..cb84d18 --- /dev/null +++ b/content/java/develop/core-runtime.html @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Core Runtime</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="core.html" title="Core" /><link rel="prev" href="core-spi.html" title="Core Extension SPI" /><link rel="next" href="libraries.html" title="Libraries" /> + + +<!-- favicon --> + +<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" /> +<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" /> + +<!-- style --> + +<link href="css/shCore.css" rel="stylesheet" type="text/css" /> +<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/polygene.css" rel="stylesheet" type="text/css" /> + +<!-- Syntax Highlighter --> + +<script type="text/javascript" src="js/shCore.js"></script> +<script type="text/javascript" src="js/shBrushJava.js"></script> +<script type="text/javascript" src="js/shBrushScala.js"></script> +<script type="text/javascript" src="js/shBrushJScript.js"></script> +<script type="text/javascript" src="js/shBrushBash.js"></script> +<script type="text/javascript" src="js/shBrushPlain.js"></script> +<script type="text/javascript" src="js/shBrushXml.js"></script> +<script type="text/javascript" src="js/shBrushGroovy.js"></script> +<script type="text/javascript" src="js/shBrushPython.js"></script> +<script type="text/javascript" src="js/shBrushRuby.js"></script> +<script type="text/javascript" src="js/shBrushCSharp.js"></script> + +<script type="text/javascript"> + SyntaxHighlighter.defaults['tab-size'] = 4; + SyntaxHighlighter.defaults['gutter'] = false; + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all() +</script> + +<!-- JQuery --> + +<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> + +<!-- Image Scaler --> + +<script type="text/javascript" src="js/imagescaler.js"></script> + +<!-- Table Styler --> + +<script type="text/javascript" src="js/tablestyler.js"></script> + +<!-- Apache Polygene WebSite Progressive Enhancement --> + +<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script> +<script type="text/javascript" src="js/progressive-enhancement.js"></script> + +<!-- Analytics --> + <script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-62007352-1']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + </script> + + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><a href="tutorials.html">Tutorials</a></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><span xmlns="" href="core.html">Core</span></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="core.html#_overview_3">Overview</a></span></dt><dt><span class="section"><a href="core-api.html">Core API</a></span></dt><dt><span class="section"><a href="core-bootstrap-assembly.html">Core Bootstrap</a></span></dt><dt><span class="section"><a href="core-testsupport.html">Core Test Support</a></span></dt><dt><span class="section"><a href="core-spi.html">Core Extension SPI</a></span></dt><dt><span class="section"><span xmlns="" href="core-runtime.html">Core Runtime</span></span></dt></dl></div></div><div class="section" title="Core Runtime"><div class="titlepage"><div><div><h3 class="title"><a id="core-runtime"></a>Core Runtime</h3></div></div></div><p class="remark"><em><span class="comment"></span></em></p><p class="devstatus-code-stable">code</p><p class="devstatus-docs-brief" >docs</p><p class="devstatus-tests-good">tests</p><p>First of all, your code >should never, ever, have a dependency on Core Runtime. If you think you need >this, you should +probably contact <a class="ulink" href="mailto:[email protected]" target="_top">[email protected]</a> mailing list and see if your usecase can either be solved in a existing way or +perhaps that a new Core SPI Extension is needed.</p><p>Letâs repeat that; <span class="strong"><strong>Never, never, ever depend on Core Runtime</strong></span>. Make sure that the compile dependency does NOT include +the <code class="literal">org.apache.polygene.core.runtime</code> jar.</p><div class="section" title="Custom AssemblyHelper"><div class="titlepage"><div><div><h4 class="title"><a id="_custom_assemblyhelper"></a>Custom AssemblyHelper</h4></div></div></div><p>BUT, there are super-rare cases, where a custom AssemblyHelper might be needed. One known use-case is tp introduce +an alternative bytecode generation algorithm, either better than the one we have, or for a different system, such +as Dalvik.</p><p>To do this, add the <code class="literal">AssemblyHelper</code> implementation instance as <code class="literal">metaInfo</code> to the <code class="literal">ApplicationAssembly</code></p><p>We think this is so rare, that the <code class="literal">AssemblyHelper</code> class will remain in the <code class="literal">core/runtime</code> module and has not +been promoted to the <code class="literal">core/bootstrap</code> module. If you plan to use this feature, please contact the Polygene development +team at <code class="literal">[email protected]</code> to ensure we can make this a better supported, backed by real usecases.</p><p>Fictitious example of using a hypothetical Dalvik capable classloader;</p><pre class="programlisting brush: java">source=core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java +tag=customAssemblyHelper</pre></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><p> + Copyright © 2015 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + <br /><small> + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are trademarks of The Apache Software Foundation.<br /> + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </small></p></div></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/core-spi.html ---------------------------------------------------------------------- diff --git a/content/java/develop/core-spi.html b/content/java/develop/core-spi.html new file mode 100644 index 0000000..e7bb9e6 --- /dev/null +++ b/content/java/develop/core-spi.html @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Core Extension SPI</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="core.html" title="Core" /><link rel="prev" href="core-testsupport.html" title="Core Test Support" /><link rel="next" href="core-runtime.html" title="Core Runtime" /> + + +<!-- favicon --> + +<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" /> +<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" /> + +<!-- style --> + +<link href="css/shCore.css" rel="stylesheet" type="text/css" /> +<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/polygene.css" rel="stylesheet" type="text/css" /> + +<!-- Syntax Highlighter --> + +<script type="text/javascript" src="js/shCore.js"></script> +<script type="text/javascript" src="js/shBrushJava.js"></script> +<script type="text/javascript" src="js/shBrushScala.js"></script> +<script type="text/javascript" src="js/shBrushJScript.js"></script> +<script type="text/javascript" src="js/shBrushBash.js"></script> +<script type="text/javascript" src="js/shBrushPlain.js"></script> +<script type="text/javascript" src="js/shBrushXml.js"></script> +<script type="text/javascript" src="js/shBrushGroovy.js"></script> +<script type="text/javascript" src="js/shBrushPython.js"></script> +<script type="text/javascript" src="js/shBrushRuby.js"></script> +<script type="text/javascript" src="js/shBrushCSharp.js"></script> + +<script type="text/javascript"> + SyntaxHighlighter.defaults['tab-size'] = 4; + SyntaxHighlighter.defaults['gutter'] = false; + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all() +</script> + +<!-- JQuery --> + +<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> + +<!-- Image Scaler --> + +<script type="text/javascript" src="js/imagescaler.js"></script> + +<!-- Table Styler --> + +<script type="text/javascript" src="js/tablestyler.js"></script> + +<!-- Apache Polygene WebSite Progressive Enhancement --> + +<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script> +<script type="text/javascript" src="js/progressive-enhancement.js"></script> + +<!-- Analytics --> + <script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-62007352-1']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + </script> + + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><a href="tutorials.html">Tutorials</a></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><span xmlns="" href="core.html">Core</span></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="core.html#_overview_3">Overview</a></span></dt><dt><span class="section"><a href="core-api.html">Core API</a></span></dt><dt><span class="section"><a href="core-bootstrap-assembly.html">Core Bootstrap</a></span></dt><dt><span class="section"><a href="core-testsupport.html">Core Test Support</a></span></dt><dt><span class="section"><span xmlns="" href="core-spi.html">Core Extension SPI</span></span></dt><dt><span class="section"><a href="core-runtime.html">Core Runtime</a></span></dt></dl></div></div><div class="section" title="Core Extension SPI"><div class="titlepage"><div><div><h3 class="title"><a id="core-spi"></a>Core Extension SPI</h3></div></div></div><p class="remark"><em><span class="comment"></span></em></p><p class="devstatus-code-stable">code</p><p class="devstatus-doc s-brief">docs</p><p class="devstatus-tests-good">tests</p><p>The Polygene⢠Core Runtime has a number of extension points, which we call the <span class="emphasis"><em>Polygene Core Extension SPI</em></span>. These are defined +interfaces used <span class="strong"><strong>only</strong></span> by the Core Runtime and <span class="strong"><strong>never</strong></span> directly by application code. <a class="xref" href="extensions.html" title="Extensions">Extensions</a> are assembled in +applications during the bootstrap phase.</p><p>There are currently 5 Core SPI extensions;</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"> +<a class="xref" href="core-spi.html#core-spi-valueserialization" title="ValueSerialization SPI">ValueSerialization SPI</a> +</li><li class="listitem"> +<a class="xref" href="core-spi.html#core-spi-entitystore" title="EntityStore SPI">EntityStore SPI</a> +</li><li class="listitem"> +<a class="xref" href="core-spi.html#core-spi-cache" title="Cache SPI">Cache SPI</a> +</li><li class="listitem"> +<a class="xref" href="core-spi.html#core-spi-indexing" title="Indexing/Query SPI">Indexing/Query SPI</a> +</li><li class="listitem"> +<a class="xref" href="core-spi.html#core-spi-metrics" title="Metrics SPI">Metrics SPI</a> +</li></ul></div><p>Polygene⢠Runtime Extensions implementations may depend on Polygene⢠Libraries, but Libraries are NOT ALLOWED to depend on +Extensions. Applications code is NOT ALLOWED to depend on extensions. And application code SHOULD NOT depend on the +Core Extension SPI. If you think that is needed, please contact <a class="ulink" href="mailto:[email protected]" target="_top">[email protected]</a> mailing list, to see if your usecase +can be solved in a support manner, or that we need to extend the Core API to support it.</p><div class="section" title="ValueSerialization SPI"><div class="titlepage"><div><div><h4 class="title"><a id="core-spi-valueserialization"></a>ValueSerialization SPI</h4></div></div></div><div class="section" title="Overview"><div class="titlepage"><div><div><h5 class="title"><a id="_overview_4"></a>Overview</h5></div></div></div><p>The Polygene⢠Core Runtime use ValueSerialization to provide string representation of ValueComposites via their <code class="literal">toString()</code> +method, and, their instanciation from the very same representation via the <code class="literal">newValueFromSerializedState(..)</code> method of +the ValueBuilderFactory API.</p><p>If no ValueSerialization service is visible, a default implementation supporting the JSON format used but note that it +wonât be available as a Service. So, in order to use the full ValueSerialization API a ValueSerialization service must +be explicitely assembled in the Application. See the <a class="xref" href="extensions.html" title="Extensions">Extensions</a> documentation for details.</p></div><div class="section" title="Implementation notes"><div class="titlepage"><div><div><h5 class="title"><a id="_implementation_notes"></a>Implementation notes</h5></div></div></div><p>Simply implement ValueSerialization to create an extension for the ValueSerialization SPI. +The Core SPI module provides adapters to create pull-parsing capable ValueSerializers and pull-parsing and tree-parsing +capable ValueDeserializers.</p><p>The behaviour described here apply to all ValueSerialization services implemented using the Core SPI adapters. Note that +nothing stops you from implementing an extension for the ValueSerialization SPI without relying on theses adapters.</p><p>Theses adapters are tailored for serialization mechanisms that support the following two structures that can be nested:</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"> +a collection of name/value pairs. In various languages, this is realized as an object, record, struct, + dictionary, hash table, keyed list, or associative array, +</li><li class="listitem"> +an ordered list of values. In most languages, this is realized as an array, vector, list, or sequence ; +</li></ul></div><p>in other words, a JSON-like structure.</p><p>Special attention is taken when dealing with Maps. They are serialized as an ordered list of collections of +name/value pairs to keep the Map order for least surprise. That way, even when the underlying serialization mechanism +do not keep the collection of name/value pairs order we can rely on it being kept.</p><p>Here is a sample Map with two entries in JSON notation to make things clear:</p><pre class="programlisting brush: javascript">[ + { "key": "foo", "value": "bar" }, + { "key": "cathedral", "value": "bazar" } +]</pre><p>Among Plain Values (see the <a class="link" href="core-api.html#core-api-value" title="ValueComposite">ValueSerialization API</a> section) some are considered primitives to +underlying serialization mechanisms and by so handed/come without conversion to/from implementations.</p><p>Primitive values can be one of:</p><div class="itemizedlist"><ul class="itemizedlist"><li class="listitem"> +String, +</li><li class="listitem"> +Boolean or boolean, +</li><li class="listitem"> +Integer or int, +</li><li class="listitem"> +Long or long, +</li><li class="listitem"> +Short or short, +</li><li class="listitem"> +Byte or byte, +</li><li class="listitem"> +Float or float, +</li><li class="listitem"> +Double or double. +</li></ul></div><p>Serialization is always done in a streaming manner using a pull-parsing based approach.</p><p>Deserialization is done in a streaming manner using a pull-parsing based approach except when encountering a +ValueComposite. ValueComposite types are deserialized using a tree-parsing based approach.</p><p>All this means that you can serialize and deserialize large collections of values without filling the heap.</p></div></div><div class="section" title="EntityStore SPI"><div class="titlepage"><div><div><h4 class="title"><a id="core-spi-entitystore"></a>EntityStore SPI</h4></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This SPI has no documentation yet. Learn how to contribute in <a class="xref" href="community-docs.html" title="Polygene⢠Documentation">Writing Documentation</a>.</p></div></div><div class="section" title="Cache SPI"><div class="titlepage"><div><div><h4 class="title"><a id="core-spi-cache"></a>Cache SPI</h4></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This SPI has no documentation yet. Learn how to contribute i n <a class="xref" href="community-docs.html" title="Polygene⢠Documentation">Writing Documentation</a>.</p></div></div><div class="section" title="Indexing/Query SPI"><div class="titlepage"><div><div><h4 class="title"><a id="core-spi-indexing"></a>Indexing/Query SPI</h4></div></div></div><div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This SPI has no documentation yet. Learn how to contribute in <a class="xref" href="community-docs.html" title="Polygene⢠Documentation">Writing Documentation</a>.</p></div></div><div class="section" title="Metrics SPI"><div class="titlepage"><div><div><h4 class="title"><a id="core-spi-metrics"></a>Metrics SPI</h4></div></div></div><p>It is very easy to create an extension for the Metrics SPI, simply by implementing the MetricsProvider. If only a +subset of the factories/types are supported, there is a convenience adapter call MetricsProviderAdapter in the Metrics +SPI package.</p></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><p> + Copyright © 2015 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + <br /><small> + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are trademarks of The Apache Software Foundation.<br /> + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </small></p></div></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/core-testsupport.html ---------------------------------------------------------------------- diff --git a/content/java/develop/core-testsupport.html b/content/java/develop/core-testsupport.html new file mode 100644 index 0000000..f85b059 --- /dev/null +++ b/content/java/develop/core-testsupport.html @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Core Test Support</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="core.html" title="Core" /><link rel="prev" href="core-bootstrap-assembly.html" title="Core Bootstrap" /><link rel="next" href="core-spi.html" title="Core Extension SPI" /> + + +<!-- favicon --> + +<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" /> +<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" /> + +<!-- style --> + +<link href="css/shCore.css" rel="stylesheet" type="text/css" /> +<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/polygene.css" rel="stylesheet" type="text/css" /> + +<!-- Syntax Highlighter --> + +<script type="text/javascript" src="js/shCore.js"></script> +<script type="text/javascript" src="js/shBrushJava.js"></script> +<script type="text/javascript" src="js/shBrushScala.js"></script> +<script type="text/javascript" src="js/shBrushJScript.js"></script> +<script type="text/javascript" src="js/shBrushBash.js"></script> +<script type="text/javascript" src="js/shBrushPlain.js"></script> +<script type="text/javascript" src="js/shBrushXml.js"></script> +<script type="text/javascript" src="js/shBrushGroovy.js"></script> +<script type="text/javascript" src="js/shBrushPython.js"></script> +<script type="text/javascript" src="js/shBrushRuby.js"></script> +<script type="text/javascript" src="js/shBrushCSharp.js"></script> + +<script type="text/javascript"> + SyntaxHighlighter.defaults['tab-size'] = 4; + SyntaxHighlighter.defaults['gutter'] = false; + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all() +</script> + +<!-- JQuery --> + +<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> + +<!-- Image Scaler --> + +<script type="text/javascript" src="js/imagescaler.js"></script> + +<!-- Table Styler --> + +<script type="text/javascript" src="js/tablestyler.js"></script> + +<!-- Apache Polygene WebSite Progressive Enhancement --> + +<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script> +<script type="text/javascript" src="js/progressive-enhancement.js"></script> + +<!-- Analytics --> + <script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-62007352-1']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + </script> + + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><a href="tutorials.html">Tutorials</a></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><span xmlns="" href="core.html">Core</span></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="core.html#_overview_3">Overview</a></span></dt><dt><span class="section"><a href="core-api.html">Core API</a></span></dt><dt><span class="section"><a href="core-bootstrap-assembly.html">Core Bootstrap</a></span></dt><dt><span class="section"><span xmlns="" href="core-testsupport.html">Core Test Support</span></span></dt><dt><span class="section"><a href="core-spi.html">Core Extension SPI</a></span></dt><dt><span class="section"><a href="core-runtime.html">Core Runtime</a></span></dt></dl></div></div><div class="section" title="Core Test Support"><div class="titlepage"><div><div><h3 class="title"><a id="core-testsupport"></a>Core Test Support</h3></div></div></div><p class="remark"><em><span class="comment"></span></em></p><p class="devstatus-code-stable">code</p><p class="devstat us-docs-brief">docs</p><p class="devstatus-tests-none">tests</p><p>Polygene⢠comes with classes to help with testing. For general development, only a couple of classes are of interest as the +others are mostly for EntityStore and Index/Query SPI implementations. There is also some mocking support, to allow +some of Polygeneâs unique aspects to be mocked, but since Polygene⢠is so flexible at a fine-granular level, we have found that +mocking is seldom, if ever, needed.</p><div class="section" title="Your First Testcase"><div class="titlepage"><div><div><h4 class="title"><a id="_your_first_testcase"></a>Your First Testcase</h4></div></div></div><p>In most cases, you will probably use the AbstractPolygeneTest class to simplify starting a Polygene⢠test instance.</p><pre class="programlisting brush: java">public class HelloTest extends AbstractPolygeneTest +{ + [...snip...] + +} +</pre><p>This will do all the initialization of a Polygene⢠runtime instance and create a single layer with a single module in it. +What goes into that module is declared in the assembly() method;</p><pre class="programlisting brush: java">@Override +public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.values( Hello.class ); +} +</pre><p>In this case we declare that we have a ValueComposite of type org.apache.polygene.tutorials.hello.Hello which looks like</p><pre class="programlisting brush: java"> +/** + * This Composite interface declares a simple "Hello World" interface with a single say() method. What is being + * said is defined in the HelloWorldState interface, which is a private mixin. + */ +@Mixins( { Hello.HelloWorldMixin.class } ) +public interface Hello +{ + String say(); + + /** + * This is the implementation of the say() method. + */ + public abstract class HelloWorldMixin + implements Hello + { + // @This reference the composite itself, and since HelloWorldState is not part of the public interface, + // it is a private mixin. + @This + private State state; + + @Override + public String say() + { + return state.phrase().get() + " " + state.name().get(); + } + } + + /** + * This interface contains only the state of the HelloWorld object. + */ + public interface State + { + @NotEmpty + @UseDefaults + Property<String> phrase(); + + @NotEmpty + @UseDefaults + Property<String> name(); + } +} +</pre><p>The say() method will get the <span class="emphasis"><em>phrase</em></span> and <span class="emphasis"><em>name</em></span> from its internal state (the State interface is not magical, it could +be named anything).</p><p>And then we create the actual test;</p><pre class="programlisting brush: java">@Test +public void givenHelloValueInitializedToHelloWorldWhenCallingSayExpectHelloWorld() +{ + ValueBuilder<Hello> builder = valueBuilderFactory.newValueBuilder( Hello.class ); + builder.prototypeFor( Hello.State.class ).phrase().set( "Hello" ); + builder.prototypeFor( Hello.State.class ).name().set( "World" ); + Hello underTest = builder.newInstance(); + String result = underTest.say(); + assertThat( result, equalTo( "Hello World" ) ); +} +</pre><p>By using the prototypeFor() we can access the hidden, internal and very private state of the ValueComposite. Once the +value is created we can reach this directly.</p></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><p> + Copyright © 2015 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + <br /><small> + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are trademarks of The Apache Software Foundation.<br /> + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </small></p></div></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/core.html ---------------------------------------------------------------------- diff --git a/content/java/develop/core.html b/content/java/develop/core.html new file mode 100644 index 0000000..207cb6b --- /dev/null +++ b/content/java/develop/core.html @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Core</title><link rel="stylesheet" type="text/css" href="css/style.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="index.html" title="" /><link rel="prev" href="sample-swing.html" title="Swing Bindings Sample" /><link rel="next" href="core-api.html" title="Core API" /> + + +<!-- favicon --> + +<link rel="shortcut icon" href="http://polygene.apache.org/favicon.ico" type="image/vnd.microsoft.icon" /> +<link rel="icon" href="http://polygene.apache.org/favicon.ico" type="image/x-icon" /> + +<!-- style --> + +<link href="css/shCore.css" rel="stylesheet" type="text/css" /> +<link href="css/shCoreEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/shThemeEclipse.css" rel="stylesheet" type="text/css" /> +<link href="css/polygene.css" rel="stylesheet" type="text/css" /> + +<!-- Syntax Highlighter --> + +<script type="text/javascript" src="js/shCore.js"></script> +<script type="text/javascript" src="js/shBrushJava.js"></script> +<script type="text/javascript" src="js/shBrushScala.js"></script> +<script type="text/javascript" src="js/shBrushJScript.js"></script> +<script type="text/javascript" src="js/shBrushBash.js"></script> +<script type="text/javascript" src="js/shBrushPlain.js"></script> +<script type="text/javascript" src="js/shBrushXml.js"></script> +<script type="text/javascript" src="js/shBrushGroovy.js"></script> +<script type="text/javascript" src="js/shBrushPython.js"></script> +<script type="text/javascript" src="js/shBrushRuby.js"></script> +<script type="text/javascript" src="js/shBrushCSharp.js"></script> + +<script type="text/javascript"> + SyntaxHighlighter.defaults['tab-size'] = 4; + SyntaxHighlighter.defaults['gutter'] = false; + SyntaxHighlighter.defaults['toolbar'] = false; + SyntaxHighlighter.all() +</script> + +<!-- JQuery --> + +<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script> + +<!-- Image Scaler --> + +<script type="text/javascript" src="js/imagescaler.js"></script> + +<!-- Table Styler --> + +<script type="text/javascript" src="js/tablestyler.js"></script> + +<!-- Apache Polygene WebSite Progressive Enhancement --> + +<link href="css/progressive-enhancement.css" rel="stylesheet" type="text/css" /> +<script type="text/javascript" src="js/jquery.scrollTo-1.4.2.js"></script> +<script type="text/javascript" src="js/progressive-enhancement.js"></script> + +<!-- Analytics --> + <script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-62007352-1']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + </script> + + </head><body><div xmlns="" xmlns:exsl="http://exslt.org/common" class="logo"><a href="index.html"><img src="images/logo-standard.png" /></a></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="top-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><a href="index.html#home">Polygeneâ¢</a></span></dt><dt><span class="section"><a href="intro.html">Introduction</a></span></dt><dt><span class="section"><a href="tutorials.html">Tutorials</a></span></dt><dt><span class="section"><a href="javadocs.html">Javadoc</a></span></dt><dt><span class="section"><a href="samples.html">Samples</a></span></dt><dt><span class="section"><span xmlns="" href="core.html">Core</span></span></dt><dt><span class="section"><a href="libraries.html">Libraries</a></span></dt><dt><span class="section"><a href="extensions.html">Extensions</a></span></dt><dt><span class="section"><a href="tools.html">Tools</a></span></dt><dt><span class="section"><a href="glossary.ht ml">Glossary </a></span></dt></dl></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="sub-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl><dt><span class="section"><span xmlns="" href="core.html#_overview_3">Overview</span></span></dt><dt><span class="section"><a href="core-api.html">Core API</a></span></dt><dt><span class="section"><a href="core-bootstrap-assembly.html">Core Bootstrap</a></span></dt><dt><span class="section"><a href="core-testsupport.html">Core Test Support</a></span></dt><dt><span class="section"><a href="core-spi.html">Core Extension SPI</a></span></dt><dt><span class="section"><a href="core-runtime.html">Core Runtime</a></span></dt></dl></div></div><div class="section" title="Core"><div class="titlepage"><div><div><h2 class="title"><a id="core"></a>Core</h2></div></div></div><div class="section" title="Overview"><div class="titlepage"><div><div><h3 class="title"><a id="_overview_3"></a>Overview</h3></div></div></div><p>The Polyg ene⢠Core is composed of several artifacts described in this section.</p><p>The following figure show the Core artifacts alongside <a class="link" href="libraries.html" title="Libraries">libraries</a> and <a class="link" href="extensions.html" title="Extensions">extensions</a>, and, in green, +typical applications artifacts. This is not a full code dependency graph but should give you a good overview of how the +pieces fit together. Find out more about each of the Polygene⢠Core artifacts below.</p><div class="figure"><a id="idm430668521456"></a><p class="title"><strong>Figure 1. Polygene⢠Core Overview</strong></p><div class="figure-contents"><a class="ulink" href="images/core-overview.png" target="_top"> +<span class="inlinemediaobject"><img src="images/core-overview.png" alt="core-overview.png" /></span> +</a></div></div><br class="figure-break" /><div class="section" title="Core API"><div class="titlepage"><div><div><h4 class="title"><a id="_core_api"></a>Core API</h4></div></div></div><p>The Polygene⢠Core API is the primary interface for client application code during the main execution phase, i.e. after the +application has been activated.</p><p><a class="link" href="core-api.html" title="Core API">Learn more</a></p></div><div class="section" title="Core Bootstrap"><div class="titlepage"><div><div><h4 class="title"><a id="_core_bootstrap"></a>Core Bootstrap</h4></div></div></div><p>Polygene⢠has a distinct bootstrap phase, also known as the <span class="emphasis"><em>Assembly</em></span> of an application, where the applications structure +is defined programmatically. Once all the layers, modules and all the composite types in each module have been defined +the model is instantiated into an application. This enables the entire <span class="emphasis"><em>structure</em></span> system in Polygene, where types "belongs" +to a module and visibility rules define default behaviors, enforcement of architectural integrity and much more.</p><p><a class="link" href="core-bootstrap-assembly.html" title="Core Bootstrap">Learn more</a></p></div><div class="section" title="Core Test Support"><div class="titlepage"><div><div><h4 class="title"><a id="_core_test_support"></a>Core Test Support</h4></div></div></div><p>Polygene⢠comes with classes to help with testing. There is also some mocking support, to allow some of Polygeneâs unique +aspects to be mocked, but since Polygene⢠is so flexible at a fine-granular level, we have found that mocking is seldom, +if ever, needed.</p><p><a class="link" href="core-testsupport.html" title="Core Test Support">Learn more</a></p></div><div class="section" title="Core Extension SPI"><div class="titlepage"><div><div><h4 class="title"><a id="_core_extension_spi"></a>Core Extension SPI</h4></div></div></div><p>The Polygene⢠Core Runtime has a number of extension points, which we call the <span class="emphasis"><em>Polygene⢠Core Extension SPI</em></span>. These are defined +interfaces used <span class="strong"><strong>only</strong></span> by the Core Runtime and <span class="strong"><strong>never</strong></span> directly by application code. <a class="xref" href="extensions.html" title="Extensions">Extensions</a> are assembled in +applications during the bootstrap phase.</p><p><a class="link" href="core-spi.html" title="Core Extension SPI">Learn more</a></p></div><div class="section" title="Core Runtime"><div class="titlepage"><div><div><h4 class="title"><a id="_core_runtime"></a>Core Runtime</h4></div></div></div><p>Your code should <span class="strong"><strong>never</strong></span>, <span class="strong"><strong>ever</strong></span>, have a dependency on Polygene⢠Core Runtime. If you think you need this, you should +probably contact <a class="ulink" href="mailto:[email protected]" target="_top">[email protected]</a> and see if your usecase can either be solved in a existing way or +perhaps that a new Core Extension SPI is needed.</p><p><a class="link" href="core-runtime.html" title="Core Runtime">Learn more</a></p></div></div></div><div xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><p> + Copyright © 2015 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + <br /><small> + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are trademarks of The Apache Software Foundation.<br /> + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </small></p></div></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/bg.jpg ---------------------------------------------------------------------- diff --git a/content/java/develop/css/bg.jpg b/content/java/develop/css/bg.jpg new file mode 100644 index 0000000..ce22d49 Binary files /dev/null and b/content/java/develop/css/bg.jpg differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/bg.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/bg.png b/content/java/develop/css/bg.png new file mode 100644 index 0000000..11a97f9 Binary files /dev/null and b/content/java/develop/css/bg.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/caution.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/caution.png b/content/java/develop/css/caution.png new file mode 100644 index 0000000..20c263d Binary files /dev/null and b/content/java/develop/css/caution.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/content-bg.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/content-bg.png b/content/java/develop/css/content-bg.png new file mode 100644 index 0000000..2dc3e0c Binary files /dev/null and b/content/java/develop/css/content-bg.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/copyright_bg.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/copyright_bg.png b/content/java/develop/css/copyright_bg.png new file mode 100644 index 0000000..feb482a Binary files /dev/null and b/content/java/develop/css/copyright_bg.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/header-base.jpg ---------------------------------------------------------------------- diff --git a/content/java/develop/css/header-base.jpg b/content/java/develop/css/header-base.jpg new file mode 100644 index 0000000..b24bca5 Binary files /dev/null and b/content/java/develop/css/header-base.jpg differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/header-bg.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/header-bg.png b/content/java/develop/css/header-bg.png new file mode 100644 index 0000000..5ea7248 Binary files /dev/null and b/content/java/develop/css/header-bg.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/important.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/important.png b/content/java/develop/css/important.png new file mode 100644 index 0000000..192b83c Binary files /dev/null and b/content/java/develop/css/important.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/navHead_bg.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/navHead_bg.png b/content/java/develop/css/navHead_bg.png new file mode 100644 index 0000000..d0f1f2e Binary files /dev/null and b/content/java/develop/css/navHead_bg.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/nav_footer_next.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/nav_footer_next.png b/content/java/develop/css/nav_footer_next.png new file mode 100644 index 0000000..69cd847 Binary files /dev/null and b/content/java/develop/css/nav_footer_next.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/nav_footer_prev.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/nav_footer_prev.png b/content/java/develop/css/nav_footer_prev.png new file mode 100644 index 0000000..4774514 Binary files /dev/null and b/content/java/develop/css/nav_footer_prev.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/nav_next.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/nav_next.png b/content/java/develop/css/nav_next.png new file mode 100644 index 0000000..9d8b63d Binary files /dev/null and b/content/java/develop/css/nav_next.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/nav_prev.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/nav_prev.png b/content/java/develop/css/nav_prev.png new file mode 100644 index 0000000..28dbe0c Binary files /dev/null and b/content/java/develop/css/nav_prev.png differ http://git-wip-us.apache.org/repos/asf/polygene-website/blob/ba3a0fac/content/java/develop/css/note.png ---------------------------------------------------------------------- diff --git a/content/java/develop/css/note.png b/content/java/develop/css/note.png new file mode 100644 index 0000000..1d0b98e Binary files /dev/null and b/content/java/develop/css/note.png differ
