http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/library-circuitbreaker.html ---------------------------------------------------------------------- diff --git a/content/java/2017/library-circuitbreaker.html b/content/java/2017/library-circuitbreaker.html new file mode 100644 index 0000000..8a2dfb0 --- /dev/null +++ b/content/java/2017/library-circuitbreaker.html @@ -0,0 +1,207 @@ +<?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>Circuit Breaker</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="libraries.html" title="Libraries" /><link rel="prev" href="library-alarm.html" title="Alarms" /><link rel="next" href="library-constraints.html" title="Constraints" /> + + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> + <meta name="description" content=""> + <meta name="author" content=""> + <link rel="icon" href="../../favicon.ico"> + + <title>Starter Template for Bootstrap</title> + + <!-- Bootstrap core CSS --> + <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"> + + <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> + <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet"> + + <!-- Custom styles for this template --> + <link href="css/polygene-ng.css" rel="stylesheet"> + + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> + <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="js/ie-emulation-modes-warning.js"></script> + + <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> + <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> + <![endif]--> + +<!-- 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><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene + </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><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"><a href="core.html">Core</a></span></dt><dt><span class="section"><span xmlns="" href="libraries.html">Libraries</span></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.html">Glossary </a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="libraries.html#_overview_5">Overview</a></span></dt><dt><span class="section"><a href="scripting.html">Scripting</a></span></dt><dt><span class="section"><a href="library-alarm.html">Alarms</a></span></dt><dt><span class="section"><span xmlns="" href="library-circuitbreaker.html">Circuit Breaker</span></span></dt><dt><span class="section"><a href="library-constraints.html">Constraints</a></span></dt><dt><span class="section"><a href="library-fileconfig.html">FileConfig</a></span></dt><dt><span class="section"><a href="library-http.html">HTTP</a></span></dt><dt><span class="section"><a href="library-invocation-cache.html">Invocation Cache</a></span></dt><dt><span class="section"><a href="library-jmx.html">JMX</a></span></dt><dt><span class="section"><a href="library-locking.html">Locking</a></span></dt><dt><span class="section"><a href="library-logging .html">Logging</a></span></dt><dt><span class="section"><a href="library-osgi.html">OSGi</a></span></dt><dt><span class="section"><a href="library-rdf.html">RDF</a></span></dt><dt><span class="section"><a href="library-rest-client.html">ReST Client</a></span></dt><dt><span class="section"><a href="library-rest-client-primer.html">ReST - HATEOAS Primer</a></span></dt><dt><span class="section"><a href="library-rest-common.html">ReST Common</a></span></dt><dt><span class="section"><a href="library-rest-server.html">ReST Server</a></span></dt><dt><span class="section"><a href="library-restlet.html">Restlet Support</a></span></dt><dt><span class="section"><a href="library-servlet.html">Servlet</a></span></dt><dt><span class="section"><a href="library-shiro.html">Shiro Security</a></span></dt><dt><span class="section"><a href="library-shiro-web.html">Shiro Web Security</a></span></dt><dt><span class="section"><a href="library-spring.html">Spring Integration</a></span></dt><dt><span class= "section"><a href="library-sql.html">SQL</a></span></dt><dt><span class="section"><a href="library-uid.html">UID</a></span></dt><dt><span class="section"><a href="library-uowfile.html">UoWFile</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="library-circuitbreaker"></a>Circuit Breaker</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-good">docs</p><p class="devstatus-tests-good">tests</p><p>The Circuit Breaker library provides a way to guard your application +against faulty external systems (e.g. mail servers being down, web +services being down).</p><p>Thereâs a couple of differences between this implementation and others +seen on the net, but weâve also heavily borrowed from others. The +first difference is that weâve not focused on performance at all. For +some reason other implementations make a point about doing "atomic +changes" with various tricks, to ensure good performance. Since this is +used to guard access to external systems, where latencies range in +milliseconds and up, that seems completely useless, so weâve just put +"synchronized" on all methods, which should be safe. "It works" is +better than "itâs fast" for these types of things.</p><p>Second, other implementations have had really crude logic for what types +of exceptions cause the circuit to break. The most crude is "all", more +advanced ones allow exceptions that be excepted to be registered, but in +real cases this is not enough. Case in point is JDBC exceptions where +you want to fail on "connect exception" but not necessarily "invalid SQL +syntax". So instead weâve leveraged <code class="literal">Predicate</code> where +you get to provide your own specification that can use any logic to +determine whether a particular exception is ok or not.</p><p>Third, thereâs a big focus on manageability through JMX. A +circuitbreaker can be easily exposed in JMX as an MBean, where you can +track service levels and see exception messages, and trip/enable circuit +breakers.</p><p>Fourth, if an external system is unavailable due to a circuitbreaker +tripping it should be possible to expose this to other Polygene⢠services. +There is a standard implementation of the Availability interface that +delegates to a circuit breaker and the Enabled configuration flag, which +is what weâd suspect will be used in most cases where external systems +are invoked.</p><div class="table"><a id="idm4406"></a><p class="title"><strong>Table 24. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.libraries</p></td><td align="left" valign="top"><p>org.apache.polygene.library.circuitbreaker</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_direct_usage"></a>Direct usage</h4></div></div></div><p>The CircuitBreaker can be used directly, even without using anything else from the Polygene⢠SDK.</p><p>Here is a code snippet that demonstrate how to create a CircuitBreaker and how it behave:</p><pre class="programlisting brush: java">// Create a CircuitBreaker with a threshold of 3, a 250ms timeout, allowing IllegalArgumentExceptions +CircuitBreaker cb = new CircuitBreaker( 3, 250, CircuitBreakers.in( IllegalArgumentException.class ) ); + + [...snip...] + +// Service levels goes down but does not cause a trip +cb.throwable( new IOException() ); + + [...snip...] + +// Service level goes down and causes a trip +cb.throwable( new IOException() ); +cb.throwable( new IOException() ); + + [...snip...] + +// Turn on the CB again +cb.turnOn(); + + [...snip...] + +// Service levels goes down and causes a trip +cb.throwable( new IOException() ); +cb.throwable( new IOException() ); +cb.throwable( new IOException() ); + + [...snip...] + +// Wait until timeout + + [...snip...] + +// CircuitBreaker is back on + +</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_service_circuit_breaker"></a>Service Circuit Breaker</h4></div></div></div><p>As a facility you can make your Services extends <code class="literal">AbstractBreakOnThrowable</code>, set them a <code class="literal">CircuitBreaker</code> as +<code class="literal">MetaInfo</code> during assembly and annotate methods with <code class="literal">@BreaksCircuitOnThrowable</code>. Doing this will :</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"> +add a circuit breaker accessor to the Service (<code class="literal">CircuitBreaker getCircuitBreaker()</code>) ; +</li><li class="listitem"> +allow exposition of the circuit breaker in JMX ; +</li><li class="listitem"> +update the circuit breaker on annotated methods invocation success and thrown exceptions using the <code class="literal">BreakCircuitConcern</code>. +</li></ul></div><p>Here is how to declare such a Service:</p><pre class="programlisting brush: java">public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + module.services( TestService.class ).setMetaInfo( new CircuitBreaker() ); +} + [...snip...] + +public interface TestService + extends AbstractBreakOnThrowable, ServiceComposite +{ + + @BreaksCircuitOnThrowable + int successfulMethod(); + + @BreaksCircuitOnThrowable + void throwingMethod(); + + [...snip...] + +} +</pre><p>Remember to annotate methods which when they throw throwables should cause circuit breakers to trip and go back on +invocation success with the <code class="literal">@BreaksCircuitOnThrowable</code> annotation.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_exposing_service_circuit_breakers_in_jmx"></a>Exposing Service Circuit Breakers in JMX</h5></div></div></div><p>To expose their circuit breaker in JMX, your Services using one must implement the <code class="literal">ServiceCircuitBreaker</code> interface. +Note that if you already extends <code class="literal">AbstractBreakOnThrowable</code> you donât need to do anything else as it already extends +<code class="literal">ServiceCircuitBreaker</code>.</p><p>Here is how it goes:</p><pre class="programlisting brush: java">public void assemble( ModuleAssembly module ) + throws AssemblyException +{ + [...snip...] + + // JMX Library + module.importedServices( MBeanServer.class ). + importedBy( MBeanServerImporter.class ); + // CircuitBreakers in JMX + module.services( CircuitBreakerManagement.class ). + instantiateOnStartup(); +} +</pre></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_interactive_sample"></a>Interactive sample</h4></div></div></div><p>From the sources you can run the <code class="literal">runCircuitBreakerSample</code> Gradle task to run a +simple interactive example. Youâll need a MBean client to connect to the +sample, VisualVM with its MBean plugin does the job. See <a class="xref" href="build-system.html" title="Polygene⢠Build System">Build System</a> +if you need some guidance.</p></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright © 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are + trademarks of The Apache Software Foundation. + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('<script src="js/jquery-1.6.4.min.js"></script>')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/library-constraints.html ---------------------------------------------------------------------- diff --git a/content/java/2017/library-constraints.html b/content/java/2017/library-constraints.html new file mode 100644 index 0000000..e3659e7 --- /dev/null +++ b/content/java/2017/library-constraints.html @@ -0,0 +1,141 @@ +<?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>Constraints</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="libraries.html" title="Libraries" /><link rel="prev" href="library-circuitbreaker.html" title="Circuit Breaker" /><link rel="next" href="library-fileconfig.html" title="FileConfig" /> + + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> + <meta name="description" content=""> + <meta name="author" content=""> + <link rel="icon" href="../../favicon.ico"> + + <title>Starter Template for Bootstrap</title> + + <!-- Bootstrap core CSS --> + <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"> + + <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> + <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet"> + + <!-- Custom styles for this template --> + <link href="css/polygene-ng.css" rel="stylesheet"> + + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> + <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="js/ie-emulation-modes-warning.js"></script> + + <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> + <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> + <![endif]--> + +<!-- 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><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene + </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><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"><a href="core.html">Core</a></span></dt><dt><span class="section"><span xmlns="" href="libraries.html">Libraries</span></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.html">Glossary </a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="libraries.html#_overview_5">Overview</a></span></dt><dt><span class="section"><a href="scripting.html">Scripting</a></span></dt><dt><span class="section"><a href="library-alarm.html">Alarms</a></span></dt><dt><span class="section"><a href="library-circuitbreaker.html">Circuit Breaker</a></span></dt><dt><span class="section"><span xmlns="" href="library-constraints.html">Constraints</span></span></dt><dt><span class="section"><a href="library-fileconfig.html">FileConfig</a></span></dt><dt><span class="section"><a href="library-http.html">HTTP</a></span></dt><dt><span class="section"><a href="library-invocation-cache.html">Invocation Cache</a></span></dt><dt><span class="section"><a href="library-jmx.html">JMX</a></span></dt><dt><span class="section"><a href="library-locking.html">Locking</a></span></dt><dt><span class="section"><a href="library-logging .html">Logging</a></span></dt><dt><span class="section"><a href="library-osgi.html">OSGi</a></span></dt><dt><span class="section"><a href="library-rdf.html">RDF</a></span></dt><dt><span class="section"><a href="library-rest-client.html">ReST Client</a></span></dt><dt><span class="section"><a href="library-rest-client-primer.html">ReST - HATEOAS Primer</a></span></dt><dt><span class="section"><a href="library-rest-common.html">ReST Common</a></span></dt><dt><span class="section"><a href="library-rest-server.html">ReST Server</a></span></dt><dt><span class="section"><a href="library-restlet.html">Restlet Support</a></span></dt><dt><span class="section"><a href="library-servlet.html">Servlet</a></span></dt><dt><span class="section"><a href="library-shiro.html">Shiro Security</a></span></dt><dt><span class="section"><a href="library-shiro-web.html">Shiro Web Security</a></span></dt><dt><span class="section"><a href="library-spring.html">Spring Integration</a></span></dt><dt><span class= "section"><a href="library-sql.html">SQL</a></span></dt><dt><span class="section"><a href="library-uid.html">UID</a></span></dt><dt><span class="section"><a href="library-uowfile.html">UoWFile</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="library-constraints"></a>Constraints</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-good">docs</p><p class="devstatus-tests-good">tests</p><p>The Constraints library provide a bunch of often used Constraints based on the +Polygene⢠Constraints api described in <a class="xref" href="glossary.html#def-constraint">Constraint</a>.</p><p>Remember that you are not limited to constraints presents in this library, you +are encouraged to write your own constraints. See <a class="xref" href="howto-create-constraint.html" title="Create a Constraint">Create a Constraint</a> +or take a look at this library source code to learn how to write your own.</p><div class="table"><a id="idm4473"></a><p class="title"><strong>Table 25. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.libraries</p></td><td align="left" valign="top"><p>org.apache.polygene.library.constraints</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_usage_3"></a>Usage</h4></div></div></div><p>You can use theses constraints on Properties or on method arguments. +Here are some examples:</p><pre class="programlisting brush: java">import org.apache.polygene.library.constraints.annotation.*; + [...snip...] + +@Contains( "foo" ) Property<String> containsString(); + +@Email Property<String> email(); + +@URL Property<String> url(); + +@URI Property<String> uri(); + +@GreaterThan( 10 ) Property<Integer> greaterThan(); + +@InstanceOf( List.class ) Property<Collection> instanceOf(); + +@LessThan( 10 ) Property<Integer> lessThan(); + +@Matches( "a*b*c*" ) Property<String> matches(); + +@MaxLength( 3 ) Property<String> maxLength(); + +@MinLength( 3 ) Property<String> minLength(); + +@NotEmpty Property<String> notEmptyString(); + +@NotEmpty Property<Collection> notEmptyCollection(); + +@NotEmpty Property<List> notEmptyList(); + +@Range( min = 0, max = 100 ) Property<Integer> range(); + +@OneOf( { "Bar", "Xyzzy" } ) Property<String> oneOf(); + +void testParameters( @GreaterThan( 10 ) Integer greaterThan ); +</pre></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright © 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are + trademarks of The Apache Software Foundation. + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('<script src="js/jquery-1.6.4.min.js"></script>')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/library-fileconfig.html ---------------------------------------------------------------------- diff --git a/content/java/2017/library-fileconfig.html b/content/java/2017/library-fileconfig.html new file mode 100644 index 0000000..b28c239 --- /dev/null +++ b/content/java/2017/library-fileconfig.html @@ -0,0 +1,128 @@ +<?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>FileConfig</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="libraries.html" title="Libraries" /><link rel="prev" href="library-constraints.html" title="Constraints" /><link rel="next" href="library-http.html" title="HTTP" /> + + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> + <meta name="description" content=""> + <meta name="author" content=""> + <link rel="icon" href="../../favicon.ico"> + + <title>Starter Template for Bootstrap</title> + + <!-- Bootstrap core CSS --> + <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"> + + <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> + <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet"> + + <!-- Custom styles for this template --> + <link href="css/polygene-ng.css" rel="stylesheet"> + + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> + <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="js/ie-emulation-modes-warning.js"></script> + + <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> + <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> + <![endif]--> + +<!-- 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><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene + </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><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"><a href="core.html">Core</a></span></dt><dt><span class="section"><span xmlns="" href="libraries.html">Libraries</span></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.html">Glossary </a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="libraries.html#_overview_5">Overview</a></span></dt><dt><span class="section"><a href="scripting.html">Scripting</a></span></dt><dt><span class="section"><a href="library-alarm.html">Alarms</a></span></dt><dt><span class="section"><a href="library-circuitbreaker.html">Circuit Breaker</a></span></dt><dt><span class="section"><a href="library-constraints.html">Constraints</a></span></dt><dt><span class="section"><span xmlns="" href="library-fileconfig.html">FileConfig</span></span></dt><dt><span class="section"><a href="library-http.html">HTTP</a></span></dt><dt><span class="section"><a href="library-invocation-cache.html">Invocation Cache</a></span></dt><dt><span class="section"><a href="library-jmx.html">JMX</a></span></dt><dt><span class="section"><a href="library-locking.html">Locking</a></span></dt><dt><span class="section"><a href="library-logging .html">Logging</a></span></dt><dt><span class="section"><a href="library-osgi.html">OSGi</a></span></dt><dt><span class="section"><a href="library-rdf.html">RDF</a></span></dt><dt><span class="section"><a href="library-rest-client.html">ReST Client</a></span></dt><dt><span class="section"><a href="library-rest-client-primer.html">ReST - HATEOAS Primer</a></span></dt><dt><span class="section"><a href="library-rest-common.html">ReST Common</a></span></dt><dt><span class="section"><a href="library-rest-server.html">ReST Server</a></span></dt><dt><span class="section"><a href="library-restlet.html">Restlet Support</a></span></dt><dt><span class="section"><a href="library-servlet.html">Servlet</a></span></dt><dt><span class="section"><a href="library-shiro.html">Shiro Security</a></span></dt><dt><span class="section"><a href="library-shiro-web.html">Shiro Web Security</a></span></dt><dt><span class="section"><a href="library-spring.html">Spring Integration</a></span></dt><dt><span class= "section"><a href="library-sql.html">SQL</a></span></dt><dt><span class="section"><a href="library-uid.html">UID</a></span></dt><dt><span class="section"><a href="library-uowfile.html">UoWFile</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="library-fileconfig"></a>FileConfig</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-good">docs</p><p class="devstatus-tests-good">tests</p><p>The FileConfig library provide a service for accessing application-specific directories.</p><p>A lot of the Polygene⢠Libraries and Extensions make use of this library to locate files.</p><div class="table"><a id="idm4504"></a><p class="title"><strong>Table 26. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th a lign="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.libraries</p></td><td align="left" valign="top"><p>org.apache.polygene.library.fileconfig</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_usage_4"></a>Usage</h4></div></div></div><pre class="programlisting brush: java">public interface FileConfiguration +{ + [...snip...] + + File configurationDirectory(); + + File dataDirectory(); + + File temporaryDirectory(); + + File cacheDirectory(); + + File logDirectory(); + +} +</pre><p>To use it you simply need to use the FileConfigurationAssembler in your application assembly:</p><pre class="programlisting brush: java">new FileConfigurationAssembler().assemble( module ); +</pre><p>These will default to the platform settings, but can be overridden manually, either one-by-one or as a whole.</p><p>You can override defaults by adding org.apache.polygene.library.fileconfig.FileConfiguration_OS.properties files to your +classpath where OS is one of win, mac or unix.</p><p>You can also override all properties definitions at assembly time by setting a FileConfigurationOverride object +as meta info of this service:</p><pre class="programlisting brush: java">FileConfigurationOverride override = new FileConfigurationOverride() + .withConfiguration( confDir ) + .withData( dataDir ) + .withTemporary( tempDir ) + .withCache( cacheDir ) + .withLog( logDir ); +new FileConfigurationAssembler().withOverride( override ).assemble( module ); +</pre><p>And finally, to get the FileConfiguration Service in your application code, simply use the following:</p><pre class="programlisting brush: java">@Service FileConfiguration fileconfig;</pre></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright © 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are + trademarks of The Apache Software Foundation. + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('<script src="js/jquery-1.6.4.min.js"></script>')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/library-http.html ---------------------------------------------------------------------- diff --git a/content/java/2017/library-http.html b/content/java/2017/library-http.html new file mode 100644 index 0000000..70ccc47 --- /dev/null +++ b/content/java/2017/library-http.html @@ -0,0 +1,169 @@ +<?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>HTTP</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="libraries.html" title="Libraries" /><link rel="prev" href="library-fileconfig.html" title="FileConfig" /><link rel="next" href="library-invocation-cache.html" title="Invocation Cache" /> + + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> + <meta name="description" content=""> + <meta name="author" content=""> + <link rel="icon" href="../../favicon.ico"> + + <title>Starter Template for Bootstrap</title> + + <!-- Bootstrap core CSS --> + <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"> + + <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> + <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet"> + + <!-- Custom styles for this template --> + <link href="css/polygene-ng.css" rel="stylesheet"> + + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> + <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="js/ie-emulation-modes-warning.js"></script> + + <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> + <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> + <![endif]--> + +<!-- 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><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene + </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><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"><a href="core.html">Core</a></span></dt><dt><span class="section"><span xmlns="" href="libraries.html">Libraries</span></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.html">Glossary </a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="libraries.html#_overview_5">Overview</a></span></dt><dt><span class="section"><a href="scripting.html">Scripting</a></span></dt><dt><span class="section"><a href="library-alarm.html">Alarms</a></span></dt><dt><span class="section"><a href="library-circuitbreaker.html">Circuit Breaker</a></span></dt><dt><span class="section"><a href="library-constraints.html">Constraints</a></span></dt><dt><span class="section"><a href="library-fileconfig.html">FileConfig</a></span></dt><dt><span class="section"><span xmlns="" href="library-http.html">HTTP</span></span></dt><dt><span class="section"><a href="library-invocation-cache.html">Invocation Cache</a></span></dt><dt><span class="section"><a href="library-jmx.html">JMX</a></span></dt><dt><span class="section"><a href="library-locking.html">Locking</a></span></dt><dt><span class="section"><a href="library-logging .html">Logging</a></span></dt><dt><span class="section"><a href="library-osgi.html">OSGi</a></span></dt><dt><span class="section"><a href="library-rdf.html">RDF</a></span></dt><dt><span class="section"><a href="library-rest-client.html">ReST Client</a></span></dt><dt><span class="section"><a href="library-rest-client-primer.html">ReST - HATEOAS Primer</a></span></dt><dt><span class="section"><a href="library-rest-common.html">ReST Common</a></span></dt><dt><span class="section"><a href="library-rest-server.html">ReST Server</a></span></dt><dt><span class="section"><a href="library-restlet.html">Restlet Support</a></span></dt><dt><span class="section"><a href="library-servlet.html">Servlet</a></span></dt><dt><span class="section"><a href="library-shiro.html">Shiro Security</a></span></dt><dt><span class="section"><a href="library-shiro-web.html">Shiro Web Security</a></span></dt><dt><span class="section"><a href="library-spring.html">Spring Integration</a></span></dt><dt><span class= "section"><a href="library-sql.html">SQL</a></span></dt><dt><span class="section"><a href="library-uid.html">UID</a></span></dt><dt><span class="section"><a href="library-uowfile.html">UoWFile</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="library-http"></a>HTTP</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-good">docs</p><p class="devstatus-tests-good">tests</p><p>The HTTP library provides a Jetty based embedded HTTP service with support for easy event listeners, servlets and +filters assembly as Services.</p><p>Itâs an easy way to embedd a servlet container and reuse everything that can be run in it (JAX-*, Restlet, Wicket, +Vaadin, GWT etc..). If instead you want to run a Polygene⢠Application in a servlet container, see <a class="xref" href="library-servlet.html" title="Servlet">Servlet Library</a>.</p><div class="table"><a id="idm4543"></a><p class="title"><strong>Table 27. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.libraries</p></td><td align="left" valign="top"><p>org.apache.polygene.library.http</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_create_an_eventlistenerservice"></a>Create an EventListenerService</h4></ div></div></div><p>EventListeners in HttpService are assembled as Services, so one have to declare a ServiceComposite like this:</p><pre class="programlisting brush: java">@Mixins( FooServletContextListener.class ) +public interface FooServletContextListenerService + extends ServletContextListener, ServiceComposite +{ +} +</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_create_a_servletservice"></a>Create a ServletService</h4></div></div></div><p>Servlets in HttpService are assembled as Services, so one have to declare a ServiceComposite like this:</p><pre class="programlisting brush: java">@Mixins( HelloWorldServlet.class ) +public interface HelloWorldServletService + extends Servlet, ServiceComposite +{ +} +</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_create_a_filterservice"></a>Create a FilterService</h4></div></div></div><p>Itâs the same for Filters. As an example here is the bundled UnitOfWorkFilterService declaration:</p><pre class="programlisting brush: java">@Mixins( UnitOfWorkFilter.class ) +public interface UnitOfWorkFilterService extends Filter, ServiceComposite +{ +} +</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_jetty_service"></a>Jetty Service</h4></div></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_assembly_2"></a>Assembly</h5></div></div></div><p>The HTTP library provide a JettyServiceAssembler and a fluent API to easily assemble Servlets and Filters.</p><pre class="programlisting brush: java">// Assemble the JettyService +new JettyServiceAssembler().withConfig( configModule, Visibility.layer ).assemble( module ); + +// Set HTTP port as JettyConfiguration default +JettyConfiguration config = configModule.forMixin( JettyConfiguration.class ).declareDefaults(); +config.hostName().set( "127.0.0.1" ); +config.port().set( httpPort ); + +// Serve /helloWorld with HelloWorldServletService +addServlets( serve( "/helloWorld" ).with( HelloWorldServletService.class ) ).to( module ); + +// Filter requests on /* through provided UnitOfWorkFilterService +addFilters( filter( "/*" ).through( UnitOfWorkFilterService.class ).on( REQUEST ) ).to( module ); +</pre><p>This library can be used alonside the JMX library, described in <a class="xref" href="library-jmx.html" title="JMX"> JMX Library</a>. If it is +visible and that you enable Jetty statistics configuration property they will be +automatically exposed through JMX.</p><p>Here is a simple example from the unit tests showing whatâs necessary but inside a simple +Module for the sake of clarity:</p><pre class="programlisting brush: java">new JettyServiceAssembler().withConfig( configModule, Visibility.layer ).assemble( module ); +new JMXAssembler().assemble( module ); // Assemble both JettyService and JMX + +JettyConfiguration config = configModule.forMixin( JettyConfiguration.class ).declareDefaults(); +config.hostName().set( "127.0.0.1" ); +config.port().set( FreePortFinder.findFreePortOnLoopback() ); +config.statistics().set( Boolean.TRUE ); // Set statistics default to TRUE in configuration + +// Hello world servlet related assembly +addServlets( serve( "/hello" ).with( HelloWorldServletService.class ) ).to( module ); +</pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_configuration"></a>Configuration</h5></div></div></div><p>Underlying Jetty engine configuration is exposed as a Polygene⢠Service Configuration. +The only one that is mandatory is the port.</p><p>See org.apache.polygene.library.http.JettyConfiguration for a reference of all available +configuration properties.</p></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_secure_jetty_service"></a>Secure Jetty Service</h4></div></div></div><p>The HTTP library provides a second HttpService that brings SSL support.</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_assembly_3"></a>Assembly</h5></div></div></div><p>Simply change from JettyServiceAssembler to SecureJettyServiceAssembler:</p><pre class="programlisting brush: java">new SecureJettyServiceAssembler().withConfig( configModule, Visibility.layer ).assemble( module ); + [...snip...] + +addServlets( serve( "/hello" ).with( HelloWorldServletService.class ) ).to( module ); +addFilters( filter( "/*" ).through( UnitOfWorkFilterService.class ).on( REQUEST ) ).to( module ); +</pre></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a id="_configuration_2"></a>Configuration</h5></div></div></div><p>You must at least configure a KeyStore using the three related properties. All the other +ones have sensible defaults.</p><p>If you want, or need, to do client certificate authentication youâll need to configure at +least a "trust store", a KeyStore that contains your trusted trust anchors.</p><p>Here is some code that set HTTP port a well as a KeyStore and a TrustStore as +SecureJettyConfiguration default during assembly:</p><pre class="programlisting brush: java">SecureJettyConfiguration config = configModule.forMixin( SecureJettyConfiguration.class ).declareDefaults(); +config.hostName().set( "127.0.0.1" ); +config.port().set( httpsPort ); + +config.keystorePath().set( getKeyStoreFile( SERVER_KEYSTORE_FILENAME ).getAbsolutePath() ); +config.keystoreType().set( "JCEKS" ); +config.keystorePassword().set( KS_PASSWORD ); + +config.truststorePath().set( getKeyStoreFile( TRUSTSTORE_FILENAME ).getAbsolutePath() ); +config.truststoreType().set( "JCEKS" ); +config.truststorePassword().set( KS_PASSWORD ); + +config.wantClientAuth().set( Boolean.TRUE ); +</pre><p>See org.apache.polygene.library.http.SecureJettyConfiguration for a reference of all available +configuration properties.</p></div></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright © 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are + trademarks of The Apache Software Foundation. + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('<script src="js/jquery-1.6.4.min.js"></script>')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/library-invocation-cache.html ---------------------------------------------------------------------- diff --git a/content/java/2017/library-invocation-cache.html b/content/java/2017/library-invocation-cache.html new file mode 100644 index 0000000..e757cc3 --- /dev/null +++ b/content/java/2017/library-invocation-cache.html @@ -0,0 +1,139 @@ +<?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>Invocation Cache</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="libraries.html" title="Libraries" /><link rel="prev" href="library-http.html" title="HTTP" /><link rel="next" href="library-jmx.html" title="JMX" /> + + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> + <meta name="description" content=""> + <meta name="author" content=""> + <link rel="icon" href="../../favicon.ico"> + + <title>Starter Template for Bootstrap</title> + + <!-- Bootstrap core CSS --> + <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"> + + <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> + <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet"> + + <!-- Custom styles for this template --> + <link href="css/polygene-ng.css" rel="stylesheet"> + + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> + <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="js/ie-emulation-modes-warning.js"></script> + + <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> + <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> + <![endif]--> + +<!-- 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><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene + </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><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"><a href="core.html">Core</a></span></dt><dt><span class="section"><span xmlns="" href="libraries.html">Libraries</span></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.html">Glossary </a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="libraries.html#_overview_5">Overview</a></span></dt><dt><span class="section"><a href="scripting.html">Scripting</a></span></dt><dt><span class="section"><a href="library-alarm.html">Alarms</a></span></dt><dt><span class="section"><a href="library-circuitbreaker.html">Circuit Breaker</a></span></dt><dt><span class="section"><a href="library-constraints.html">Constraints</a></span></dt><dt><span class="section"><a href="library-fileconfig.html">FileConfig</a></span></dt><dt><span class="section"><a href="library-http.html">HTTP</a></span></dt><dt><span class="section"><span xmlns="" href="library-invocation-cache.html">Invocation Cache</span></span></dt><dt><span class="section"><a href="library-jmx.html">JMX</a></span></dt><dt><span class="section"><a href="library-locking.html">Locking</a></span></dt><dt><span class="section"><a href="library-logging .html">Logging</a></span></dt><dt><span class="section"><a href="library-osgi.html">OSGi</a></span></dt><dt><span class="section"><a href="library-rdf.html">RDF</a></span></dt><dt><span class="section"><a href="library-rest-client.html">ReST Client</a></span></dt><dt><span class="section"><a href="library-rest-client-primer.html">ReST - HATEOAS Primer</a></span></dt><dt><span class="section"><a href="library-rest-common.html">ReST Common</a></span></dt><dt><span class="section"><a href="library-rest-server.html">ReST Server</a></span></dt><dt><span class="section"><a href="library-restlet.html">Restlet Support</a></span></dt><dt><span class="section"><a href="library-servlet.html">Servlet</a></span></dt><dt><span class="section"><a href="library-shiro.html">Shiro Security</a></span></dt><dt><span class="section"><a href="library-shiro-web.html">Shiro Web Security</a></span></dt><dt><span class="section"><a href="library-spring.html">Spring Integration</a></span></dt><dt><span class= "section"><a href="library-sql.html">SQL</a></span></dt><dt><span class="section"><a href="library-uid.html">UID</a></span></dt><dt><span class="section"><a href="library-uowfile.html">UoWFile</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="library-invocation-cache"></a>Invocation Cache</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-none">tests</p><p>The Invocation Cache Library provides constructs to easily cache the return value of +method invocations on composites.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>It has nothing to do with the <a class="xref" href="core-spi.html#core-spi-cache" title="Cache SPI">Cache SPI</a>.</p></div><div class="table"><a id="idm4612"></a><p class="title"><strong>Table 28. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.libraries</p></td><td align="left" valign="top"><p>org.apache.polygene.library.invocation-cache</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><p>By applying one of the <a class="link" href="glossary.html#def-co ncern">Concerns</a> it is possible to cache the return values of method +calls. The concern will in turn delegate to the <code class="literal">InvocationCache</code> that is expected to be a +<a class="xref" href="glossary.html#def-private-mixin">Private Mixin</a> in the same composite.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_literal_cached_literal"></a><code class="literal">@Cached</code></h4></div></div></div><p>This annotation is used to mark the methods that should be considered for caching. Only if a +caching concern has been defined and that an <code class="literal">InvocationCache</code> implementation mixin has been provided +will the caching actually take place.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_literal_returncachedvalueconcern_literal"></a><code class="literal">ReturnCachedValueConcern</code></h4></div></div></div><p>This generic mixin implementation will first look in the cache and see if the value is there, if so the value +is unconditionally returned to the caller.</p><p>This concern skip its function if there is no <code class="literal">InvocationCache</code> mixin declared on the composite or if the method +has a <code class="literal">void</code> return type.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_literal_returncachedvalueonexceptionconcern_literal"></a><code class="literal">ReturnCachedValueOnExceptionConcern</code></h4></div></div></div><p>This generic mixin implementation will first call the method, and if it fails with an Exception, it will try to +return a value from the cache. If no value is present in the cache (i.e. null is returned from the cache) then +the exception will be rethrown.</p><p>This concern skip its function if there is no <code class="literal">InvocationCache</code> mixin declared on the composite or if the method +has a <code class="literal">void</code> return type.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_example_4"></a>Example</h4></div></div></div><p>Letâs say that we have some service that is very expensive to call.</p><pre class="programlisting brush: java">public interface ExpensiveOperation +{ + @Cached + double compute( double... arguments ); +} +</pre><p>And we know that the argument combinations into this method are relatively few, we can simply declare the +<code class="literal">SimpleInvocationCache</code> mixin implementation to store the permutations and return them if already been +provided.</p><pre class="programlisting brush: java">public class ExpensiveModuleAssembler + implements ModuleAssembler{ + + @Override + public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) + throws AssemblyException + { + module.services( ExpensiveOperation.class ) + .withMixins( SimpleInvocationCacheMixin.class ) + .withConcerns( ReturnCachedValueConcern.class ); + return module; + } +} +</pre><p>It is important to realize that the <code class="literal">SimpleInvocationCache</code> implementation never drops the cached values, +and it is not possible to instruct it to do so. So, in most cases it is required to implement the <code class="literal">InvocationCache</code> +interface yourself, and choose a caching strategy that works for you.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_custom_literal_invocationcache_literal_implementation"></a>Custom <code class="literal">InvocationCache</code> implementation</h4></div></div></div><p>The interface to implement is very straight forward. It is important to realize that the implementation is a +<a class="xref" href="glossary.html#def-private-mixin">Private Mixin</a> of the composite where the caching is applied, and not a separate service. So, if +the implementation is expecting to be part of an entity, it is possible to have</p><pre class="programlisting brush: java">@This +private Identity myIdentity;</pre><p>to get hold of the current entityâs <code class="literal">Identity</code>. This approach makes the caching a lot simpler than if a separate +service would have been used instead, but still possible to delegate to such.</p></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright © 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are + trademarks of The Apache Software Foundation. + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('<script src="js/jquery-1.6.4.min.js"></script>')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-website/blob/bb9c9971/content/java/2017/library-jmx.html ---------------------------------------------------------------------- diff --git a/content/java/2017/library-jmx.html b/content/java/2017/library-jmx.html new file mode 100644 index 0000000..9b3c19c --- /dev/null +++ b/content/java/2017/library-jmx.html @@ -0,0 +1,111 @@ +<?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>JMX</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="" /><link rel="up" href="libraries.html" title="Libraries" /><link rel="prev" href="library-invocation-cache.html" title="Invocation Cache" /><link rel="next" href="library-locking.html" title="Locking" /> + + + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> + <meta name="description" content=""> + <meta name="author" content=""> + <link rel="icon" href="../../favicon.ico"> + + <title>Starter Template for Bootstrap</title> + + <!-- Bootstrap core CSS --> + <link href="bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"> + + <!-- IE10 viewport hack for Surface/desktop Windows 8 bug --> + <link href="css/ie10-viewport-bug-workaround.css" rel="stylesheet"> + + <!-- Custom styles for this template --> + <link href="css/polygene-ng.css" rel="stylesheet"> + + <!-- Just for debugging purposes. Don't actually copy these 2 lines! --> + <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> + <script src="js/ie-emulation-modes-warning.js"></script> + + <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> + <!--[if lt IE 9]> + <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> + <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> + <![endif]--> + +<!-- 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><nav xmlns="" xmlns:exsl="http://exslt.org/common" class="navbar navbar-inverse navbar-fixed-top"><div class="container"><div class="navbar-header"><a class="navbar-brand" href="#">Apache<br />Polygene + </a></div><div id="navbar" class="collapse navbar-collapse"><span class="nav navbar-nav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><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"><a href="core.html">Core</a></span></dt><dt><span class="section"><span xmlns="" href="libraries.html">Libraries</span></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.html">Glossary </a></span></dt></dl></div></span></div></div></nav><div xmlns="" xmlns:exsl="http://exslt .org/common" class="sidenav"><div xmlns="http://www.w3.org/1999/xhtml" class="toc"><dl class="toc"><dt><span class="section"><a href="libraries.html#_overview_5">Overview</a></span></dt><dt><span class="section"><a href="scripting.html">Scripting</a></span></dt><dt><span class="section"><a href="library-alarm.html">Alarms</a></span></dt><dt><span class="section"><a href="library-circuitbreaker.html">Circuit Breaker</a></span></dt><dt><span class="section"><a href="library-constraints.html">Constraints</a></span></dt><dt><span class="section"><a href="library-fileconfig.html">FileConfig</a></span></dt><dt><span class="section"><a href="library-http.html">HTTP</a></span></dt><dt><span class="section"><a href="library-invocation-cache.html">Invocation Cache</a></span></dt><dt><span class="section"><span xmlns="" href="library-jmx.html">JMX</span></span></dt><dt><span class="section"><a href="library-locking.html">Locking</a></span></dt><dt><span class="section"><a href="library-logging .html">Logging</a></span></dt><dt><span class="section"><a href="library-osgi.html">OSGi</a></span></dt><dt><span class="section"><a href="library-rdf.html">RDF</a></span></dt><dt><span class="section"><a href="library-rest-client.html">ReST Client</a></span></dt><dt><span class="section"><a href="library-rest-client-primer.html">ReST - HATEOAS Primer</a></span></dt><dt><span class="section"><a href="library-rest-common.html">ReST Common</a></span></dt><dt><span class="section"><a href="library-rest-server.html">ReST Server</a></span></dt><dt><span class="section"><a href="library-restlet.html">Restlet Support</a></span></dt><dt><span class="section"><a href="library-servlet.html">Servlet</a></span></dt><dt><span class="section"><a href="library-shiro.html">Shiro Security</a></span></dt><dt><span class="section"><a href="library-shiro-web.html">Shiro Web Security</a></span></dt><dt><span class="section"><a href="library-spring.html">Spring Integration</a></span></dt><dt><span class= "section"><a href="library-sql.html">SQL</a></span></dt><dt><span class="section"><a href="library-uid.html">UID</a></span></dt><dt><span class="section"><a href="library-uowfile.html">UoWFile</a></span></dt></dl></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="library-jmx"></a>JMX</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-some">tests</p><p>The JMX library provides a service that exposes a Polygene⢠application in +<a class="ulink" href="http://www.oracle.com/technetwork/articles/java/docs-jsp-135989.html" target="_top">JMX</a> +automatically, giving you an opportunity to inspect the application much as +you would with the <a class="xref" href="">???</a> tool.</p><div class="table"><a id="idm4681"></a><p class="title"><strong>Table 29. Artifact</strong></p><div class="table-contents"><table summary="Artifact" border="1"><colgroup><col class="col_1" /><col class="col_2" /><col class="col_3" /></colgroup><thead><tr><th align="left" valign="top">Group ID</th><th align="left" valign="top">Artifact ID</th><th align="left" valign="top">Version</th></tr></thead><tbody><tr><td align="left" valign="top"><p>org.apache.polygene.libraries</p></td><td align="left" valign="top"><p>org.apache.polygene.library.jmx</p></td><td align="left" valign="top"><p>0</p></td></tr></tbody></table></div></div><br class="table-break" /><p>Services configuration is editable through their corresponding JMX beans. +You can also restart your services so the new configuration is picked up.</p><p><span class="inlinemediaobject"><img src="images/library-jmx.png" alt="library-jmx.png" /></span></p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a id="_assembly_4"></a>Assembly</h4></div></div></div><p>JMX Support for Polygene⢠applications:</p><pre class="programlisting brush: java">new JMXAssembler().assemble( module ); +</pre><p>Managing the MX Beans Server from your Polygene⢠application using the <code class="literal">JMXConnectorService</code>:</p><pre class="programlisting brush: java">module.services( JMXConnectorService.class ).instantiateOnStartup(); +module.entities( JMXConnectorConfiguration.class ); +module.forMixin( JMXConnectorConfiguration.class ).declareDefaults().port().set( 1099 ); +</pre></div></div><footer xmlns="" xmlns:exsl="http://exslt.org/common" class="footer"><div class="container"><p class="text-muted">Copyright © 2017 The Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/" target="_blank">Apache License, Version 2.0</a>. + Apache Polygene, Polygene, Apache, the Apache feather logo, and the Apache Polygene project logo are + trademarks of The Apache Software Foundation. + All other marks mentioned may be trademarks or registered trademarks of their respective owners. + </p></div></footer><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common">window.jQuery || document.write('<script src="js/jquery-1.6.4.min.js"></script>')</script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="bootstrap-3.3.7/js/bootstrap.min.js"></script><script xmlns="" xmlns:exsl="http://exslt.org/common" src="js/ie10-viewport-bug-workaround.js"></script></body></html> \ No newline at end of file
