| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <title>Microservice (Apache Juneau 9.0.0)</title> |
| <link rel="stylesheet" type="text/css" href="../../../../javadoc.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="Microservice (Apache Juneau 9.0.0)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":9,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":9,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10,"i16":10,"i17":10,"i18":10,"i19":10,"i20":10,"i21":10,"i22":10,"i23":10,"i24":10}; |
| var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/juneau/microservice/LogConfig.html" title="class in org.apache.juneau.microservice"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html" title="class in org.apache.juneau.microservice"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/juneau/microservice/Microservice.html" target="_top">Frames</a></li> |
| <li><a href="Microservice.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">org.apache.juneau.microservice</div> |
| <h2 title="Class Microservice" class="title">Class Microservice</h2> |
| </div> |
| <div class="contentContainer"> |
| <ul class="inheritance"> |
| <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> |
| <li> |
| <ul class="inheritance"> |
| <li>org.apache.juneau.microservice.Microservice</li> |
| </ul> |
| </li> |
| </ul> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Implemented Interfaces:</dt> |
| <dd><a href="../../../../org/apache/juneau/config/event/ConfigEventListener.html" title="interface in org.apache.juneau.config.event">ConfigEventListener</a></dd> |
| </dl> |
| <dl> |
| <dt>Direct Known Subclasses:</dt> |
| <dd><a href="../../../../org/apache/juneau/microservice/jetty/JettyMicroservice.html" title="class in org.apache.juneau.microservice.jetty">JettyMicroservice</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public class <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.98">Microservice</a> |
| extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> |
| implements <a href="../../../../org/apache/juneau/config/event/ConfigEventListener.html" title="interface in org.apache.juneau.config.event">ConfigEventListener</a></pre> |
| <div class="block">Parent class for all microservices. |
| |
| <p> |
| A microservice defines a simple API for starting and stopping simple Java services contained in executable jars. |
| |
| <p> |
| The general command for creating and starting a microservice from a main method is as follows: |
| <p class='bjava'> |
| <jk>public static void</jk> main(String[] <jv>args</jv>) { |
| Microservice.<jsm>create</jsm>().args(<jv>args</jv>).build().start().join(); |
| } |
| </p> |
| |
| <p> |
| Your microservice class must be specified as the <jk>Main-Class</jk> entry in the manifest file of your microservice |
| jar file if it's an executable jar. |
| |
| <h5 class='topic'>Microservice Configuration</h5> |
| |
| This class defines the following method for accessing configuration for your microservice: |
| <ul class='spaced-list'> |
| <li> |
| <a href="../../../../org/apache/juneau/microservice/Microservice.html#getArgs--"><code>getArgs()</code></a> - The command-line arguments passed to the jar file. |
| <li> |
| <a href="../../../../org/apache/juneau/microservice/Microservice.html#getConfig--"><code>getConfig()</code></a> - An external INI-style configuration file. |
| <li> |
| <a href="../../../../org/apache/juneau/microservice/Microservice.html#getManifest--"><code>getManifest()</code></a> - The manifest file for the main jar file. |
| </ul> |
| |
| <h5 class='topic'>Lifecycle Methods</h5> |
| |
| Subclasses must implement the following lifecycle methods: |
| <ul class='spaced-list'> |
| <li> |
| <a href="../../../../org/apache/juneau/microservice/Microservice.html#init--"><code>init()</code></a> - Gets executed immediately following construction. |
| <li> |
| <a href="../../../../org/apache/juneau/microservice/Microservice.html#start--"><code>start()</code></a> - Gets executed during startup. |
| <li> |
| <a href="../../../../org/apache/juneau/microservice/Microservice.html#stop--"><code>stop()</code></a> - Gets executed when 'exit' is typed in the console or an external shutdown signal is received. |
| <li> |
| <a href="../../../../org/apache/juneau/microservice/Microservice.html#kill--"><code>kill()</code></a> - Can be used to forcibly shut down the service. Doesn't get called during normal operation. |
| </ul> |
| |
| <ul class='seealso'> |
| <li class='link'><a class='doclink' href='../../../../overview-summary.html#juneau-microservice-core'>Overview > juneau-microservice-core</a> |
| <li class='extlink'><a class='doclink' target='_blank' href='https://github.com/apache/juneau/blob/master/juneau-microservice/juneau-microservice-core/src/main/java/org/apache/juneau/microservice/Microservice.java'>Source</a> |
| </ul></div> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Class and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static class </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html" title="class in org.apache.juneau.microservice">Microservice.Builder</a></span></code> |
| <div class="block">Builder class.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.summary"> |
| <!-- --> |
| </a> |
| <h3>Constructor Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> |
| <caption><span>Constructors</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier</th> |
| <th class="colLast" scope="col">Constructor and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>protected </code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#Microservice-org.apache.juneau.microservice.Microservice.Builder-">Microservice</a></span>(<a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html" title="class in org.apache.juneau.microservice">Microservice.Builder</a> builder)</code> |
| <div class="block">Constructor.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html" title="class in org.apache.juneau.microservice">Microservice.Builder</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#create--">create</a></span>()</code> |
| <div class="block">Creates a new builder for this object.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#err-org.apache.juneau.cp.Messages-java.lang.String-java.lang.Object...-">err</a></span>(<a href="../../../../org/apache/juneau/cp/Messages.html" title="class in org.apache.juneau.cp">Messages</a> mb, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> messageKey, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... args)</code> |
| <div class="block">Prints a localized message to STDERR.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#executeCommand-org.apache.juneau.collections.Args-java.util.Scanner-java.io.PrintWriter-">executeCommand</a></span>(<a href="../../../../org/apache/juneau/collections/Args.html" title="class in org.apache.juneau.collections">Args</a> args, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html?is-external=true" title="class or interface in java.util">Scanner</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintWriter.html?is-external=true" title="class or interface in java.io">PrintWriter</a> out)</code> |
| <div class="block">Executes a console command.</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#executeCommand-java.lang.String-java.lang.String-java.lang.Object...-">executeCommand</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> input, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... args)</code> |
| <div class="block">Convenience method for executing a console command directly.</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#exit--">exit</a></span>()</code> |
| <div class="block">Stops the console (if it's started) and calls <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/System.html?is-external=true#exit-int-" title="class or interface in java.lang"><code>System.exit(int)</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/collections/Args.html" title="class in org.apache.juneau.collections">Args</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getArgs--">getArgs</a></span>()</code> |
| <div class="block">Returns the command-line arguments passed into the application.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/config/Config.html" title="class in org.apache.juneau.config">Config</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getConfig--">getConfig</a></span>()</code> |
| <div class="block">Returns the external INI-style configuration file that can be used to configure your microservice.</div> |
| </td> |
| </tr> |
| <tr id="i7" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="../../../../org/apache/juneau/microservice/console/ConsoleCommand.html" title="class in org.apache.juneau.microservice.console">ConsoleCommand</a>></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getConsoleCommands--">getConsoleCommands</a></span>()</code> |
| <div class="block">Returns the console commands associated with this microservice.</div> |
| </td> |
| </tr> |
| <tr id="i8" class="altColor"> |
| <td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html?is-external=true" title="class or interface in java.util">Scanner</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getConsoleReader--">getConsoleReader</a></span>()</code> |
| <div class="block">Returns the console reader.</div> |
| </td> |
| </tr> |
| <tr id="i9" class="rowColor"> |
| <td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintWriter.html?is-external=true" title="class or interface in java.io">PrintWriter</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getConsoleWriter--">getConsoleWriter</a></span>()</code> |
| <div class="block">Returns the console writer.</div> |
| </td> |
| </tr> |
| <tr id="i10" class="altColor"> |
| <td class="colFirst"><code>static <a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getInstance--">getInstance</a></span>()</code> |
| <div class="block">Returns the Microservice instance.</div> |
| </td> |
| </tr> |
| <tr id="i11" class="rowColor"> |
| <td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html?is-external=true" title="class or interface in java.util.logging">Logger</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getLogger--">getLogger</a></span>()</code> |
| <div class="block">Returns the logger for this microservice.</div> |
| </td> |
| </tr> |
| <tr id="i12" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/utils/ManifestFile.html" title="class in org.apache.juneau.utils">ManifestFile</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getManifest--">getManifest</a></span>()</code> |
| <div class="block">Returns the main jar manifest file contents as a simple <a href="../../../../org/apache/juneau/collections/JsonMap.html" title="class in org.apache.juneau.collections"><code>JsonMap</code></a>.</div> |
| </td> |
| </tr> |
| <tr id="i13" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/svl/VarResolver.html" title="class in org.apache.juneau.svl">VarResolver</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#getVarResolver--">getVarResolver</a></span>()</code> |
| <div class="block">Returns the variable resolver for resolving variables in strings and files.</div> |
| </td> |
| </tr> |
| <tr id="i14" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#init--">init</a></span>()</code> |
| <div class="block">Initializes this microservice.</div> |
| </td> |
| </tr> |
| <tr id="i15" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#join--">join</a></span>()</code> |
| <div class="block">Joins the application with the current thread.</div> |
| </td> |
| </tr> |
| <tr id="i16" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#kill--">kill</a></span>()</code> |
| <div class="block">Kill the JVM by calling <c>System.exit(2);</c>.</div> |
| </td> |
| </tr> |
| <tr id="i17" class="rowColor"> |
| <td class="colFirst"><code>protected void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#log-java.util.logging.Level-java.lang.String-java.lang.Object...-">log</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html?is-external=true" title="class or interface in java.util.logging">Level</a> level, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... args)</code> |
| <div class="block">Logs a message to the log file.</div> |
| </td> |
| </tr> |
| <tr id="i18" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#onConfigChange-org.apache.juneau.config.event.ConfigEvents-">onConfigChange</a></span>(<a href="../../../../org/apache/juneau/config/event/ConfigEvents.html" title="class in org.apache.juneau.config.event">ConfigEvents</a> events)</code> |
| <div class="block">Gets called immediately after a config file has been loaded.</div> |
| </td> |
| </tr> |
| <tr id="i19" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#out-org.apache.juneau.cp.Messages-java.lang.String-java.lang.Object...-">out</a></span>(<a href="../../../../org/apache/juneau/cp/Messages.html" title="class in org.apache.juneau.cp">Messages</a> mb, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> messageKey, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... args)</code> |
| <div class="block">Prints a localized message to the console writer.</div> |
| </td> |
| </tr> |
| <tr id="i20" class="altColor"> |
| <td class="colFirst"><code>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#resolveFile-java.lang.String-">resolveFile</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path)</code> |
| <div class="block">Resolves the specified path.</div> |
| </td> |
| </tr> |
| <tr id="i21" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#start--">start</a></span>()</code> |
| <div class="block">Start this application.</div> |
| </td> |
| </tr> |
| <tr id="i22" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#startConsole--">startConsole</a></span>()</code> |
| <div class="block">Starts the console thread for this microservice.</div> |
| </td> |
| </tr> |
| <tr id="i23" class="rowColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#stop--">stop</a></span>()</code> |
| <div class="block">Stop this application.</div> |
| </td> |
| </tr> |
| <tr id="i24" class="altColor"> |
| <td class="colFirst"><code><a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/juneau/microservice/Microservice.html#stopConsole--">stopConsole</a></span>()</code> |
| <div class="block">Stops the console thread for this microservice.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> |
| <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="constructor.detail"> |
| <!-- --> |
| </a> |
| <h3>Constructor Detail</h3> |
| <a name="Microservice-org.apache.juneau.microservice.Microservice.Builder-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>Microservice</h4> |
| <pre>protected <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.576">Microservice</a>(<a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html" title="class in org.apache.juneau.microservice">Microservice.Builder</a> builder) |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>, |
| <a href="../../../../org/apache/juneau/parser/ParseException.html" title="class in org.apache.juneau.parser">ParseException</a></pre> |
| <div class="block">Constructor.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>builder</code> - The builder containing the settings for this microservice.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Problem occurred reading file.</dd> |
| <dd><code><a href="../../../../org/apache/juneau/parser/ParseException.html" title="class in org.apache.juneau.parser">ParseException</a></code> - Malformed input encountered.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="getInstance--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getInstance</h4> |
| <pre>public static <a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.121">getInstance</a>()</pre> |
| <div class="block">Returns the Microservice instance. |
| |
| <p> |
| This method only works if there's only one Microservice instance in a JVM. |
| Otherwise, it's just overwritten by the last instantiated microservice.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The Microservice instance, or <jk>null</jk> if there isn't one.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="create--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>create</h4> |
| <pre>public static <a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html" title="class in org.apache.juneau.microservice">Microservice.Builder</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.132">create</a>()</pre> |
| <div class="block">Creates a new builder for this object.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>A new microservice builder.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="resolveFile-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>resolveFile</h4> |
| <pre>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/io/File.html?is-external=true" title="class or interface in java.io">File</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.732">resolveFile</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> path)</pre> |
| <div class="block">Resolves the specified path. |
| |
| <p> |
| If the working directory has been explicitly specified, relative paths are resolved relative to that.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>path</code> - The path to resolve.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The resolved path.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="init--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>init</h4> |
| <pre>public <a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.757">init</a>() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>, |
| <a href="../../../../org/apache/juneau/parser/ParseException.html" title="class in org.apache.juneau.parser">ParseException</a></pre> |
| <div class="block">Initializes this microservice. |
| |
| <p> |
| This method can be called whenever the microservice is not started. |
| |
| <p> |
| It will initialize (or reinitialize) the console commands, system properties, and logger.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="../../../../org/apache/juneau/parser/ParseException.html" title="class in org.apache.juneau.parser">ParseException</a></code> - Malformed input encountered.</dd> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code> - Couldn't read a file.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="start--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>start</h4> |
| <pre>public <a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.826">start</a>() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></pre> |
| <div class="block">Start this application. |
| |
| <p> |
| Overridden methods MUST call this method FIRST so that the <a href="../../../../org/apache/juneau/microservice/MicroserviceListener.html#onStart-org.apache.juneau.microservice.Microservice-"><code>MicroserviceListener.onStart(Microservice)</code></a> method is called.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></code> - Error occurred.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="startConsole--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>startConsole</h4> |
| <pre>public <a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.858">startConsole</a>() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></pre> |
| <div class="block">Starts the console thread for this microservice.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></code> - Error occurred</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="stopConsole--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>stopConsole</h4> |
| <pre>public <a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.870">stopConsole</a>() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></pre> |
| <div class="block">Stops the console thread for this microservice.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></code> - Error occurred</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getArgs--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getArgs</h4> |
| <pre>public <a href="../../../../org/apache/juneau/collections/Args.html" title="class in org.apache.juneau.collections">Args</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.887">getArgs</a>()</pre> |
| <div class="block">Returns the command-line arguments passed into the application. |
| |
| <p> |
| This method can be called from the class constructor. |
| |
| <p> |
| See <a href="../../../../org/apache/juneau/collections/Args.html" title="class in org.apache.juneau.collections"><code>Args</code></a> for details on using this method.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The command-line arguments passed into the application.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getConfig--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getConfig</h4> |
| <pre>public <a href="../../../../org/apache/juneau/config/Config.html" title="class in org.apache.juneau.config">Config</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.988">getConfig</a>()</pre> |
| <div class="block">Returns the external INI-style configuration file that can be used to configure your microservice. |
| |
| <p> |
| The config location is determined in the following order: |
| <ol class='spaced-list'> |
| <li> |
| The first argument passed to the microservice jar. |
| <li> |
| The <c>Main-Config</c> entry in the microservice jar manifest file. |
| <li> |
| The name of the microservice jar with a <js>".cfg"</js> suffix (e.g. |
| <js>"mymicroservice.jar"</js>-><js>"mymicroservice.cfg"</js>). |
| </ol> |
| |
| <p> |
| If all methods for locating the config fail, then this method returns an empty config. |
| |
| <p> |
| Subclasses can set their own config file by using the following methods: |
| <ul class='javatree'> |
| <li class='jm'><a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html#configStore-org.apache.juneau.config.store.ConfigStore-"><code>Microservice.Builder.configStore(ConfigStore)</code></a> |
| <li class='jm'><a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html#configName-java.lang.String-"><code>Microservice.Builder.configName(String)</code></a> |
| </ul> |
| |
| <p> |
| String variables are automatically resolved using the variable resolver returned by <a href="../../../../org/apache/juneau/microservice/Microservice.html#getVarResolver--"><code>getVarResolver()</code></a>. |
| |
| <p> |
| This method can be called from the class constructor. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bini'> |
| <cc>#--------------------------</cc> |
| <cc># My section</cc> |
| <cc>#--------------------------</cc> |
| <cs>[MySection]</cs> |
| |
| <cc># An integer</cc> |
| <ck>anInt</ck> = 1 |
| |
| <cc># A boolean</cc> |
| <ck>aBoolean</ck> = true |
| |
| <cc># An int array</cc> |
| <ck>anIntArray</ck> = 1,2,3 |
| |
| <cc># A POJO that can be converted from a String</cc> |
| <ck>aURL</ck> = http://foo |
| |
| <cc># A POJO that can be converted from JSON</cc> |
| <ck>aBean</ck> = {foo:'bar',baz:123} |
| |
| <cc># A system property</cc> |
| <ck>locale</ck> = $S{java.locale, en_US} |
| |
| <cc># An environment variable</cc> |
| <ck>path</ck> = $E{PATH, unknown} |
| |
| <cc># A manifest file entry</cc> |
| <ck>mainClass</ck> = $MF{Main-Class} |
| |
| <cc># Another value in this config file</cc> |
| <ck>sameAsAnInt</ck> = $C{MySection/anInt} |
| |
| <cc># A command-line argument in the form "myarg=foo"</cc> |
| <ck>myArg</ck> = $A{myarg} |
| |
| <cc># The first command-line argument</cc> |
| <ck>firstArg</ck> = $A{0} |
| |
| <cc># Look for system property, or env var if that doesn't exist, or command-line arg if that doesn't exist.</cc> |
| <ck>nested</ck> = $S{mySystemProperty,$E{MY_ENV_VAR,$A{0}}} |
| |
| <cc># A POJO with embedded variables</cc> |
| <ck>aBean2</ck> = {foo:'$A{0}',baz:$C{MySection/anInt}} |
| </p> |
| |
| <p class='bjava'> |
| <jc>// Java code for accessing config entries above.</jc> |
| Config <jv>config</jv> = getConfig(); |
| |
| <jk>int</jk> <jv>anInt</jv> = <jv>config</jv>.get(<js>"MySection/anInt"</js>).asInteger().orElse(-1); |
| <jk>boolean</jk> <jv>aBoolean</jv> = <jv>config</jv>.get(<js>"MySection/aBoolean"</js>).asBoolean().orElse(<jk>false</jk>); |
| <jk>int</jk>[] <jv>anIntArray</jv> = <jv>config</jv>.get(<js>"MySection/anIntArray"</js>).as(<jk>int</jk>[].<jk>class</jk>).orElse(<jk>null</jk>); |
| URL <jv>aURL</jv> = <jv>config</jv>.get(<js>"MySection/aURL"</js>).as(URL.<jk>class</jk>).orElse(<jk>null</jk>); |
| MyBean <jv>aBean</jv> = <jv>config</jv>.get(<js>"MySection/aBean"</js>).as(MyBean.<jk>class</jk>).orElse(<jk>null</jk>); |
| Locale <jv>locale</jv> = <jv>config</jv>.get(<js>"MySection/locale"</js>).as(Locale.<jk>class</jk>).orElse(<jk>null</jk>); |
| String <jv>path</jv> = <jv>config</jv>.get(<js>"MySection/path"</js>).orElse(<jk>null</jk>); |
| String <jv>mainClass</jv> = <jv>config</jv>.get(<js>"MySection/mainClass"</js>).orElse(<jk>null</jk>); |
| <jk>int</jk> <jv>sameAsAnInt</jv> = <jv>config</jv>.get(<js>"MySection/sameAsAnInt"</js>).asInteger().orElse(<jk>null</jk>); |
| String <jv>myArg</jv> = <jv>config</jv>.getString(<js>"MySection/myArg"</js>); |
| String <jv>firstArg</jv> = <jv>config</jv>.getString(<js>"MySection/firstArg"</js>); |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The config file for this application, or <jk>null</jk> if no config file is configured.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getManifest--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getManifest</h4> |
| <pre>public <a href="../../../../org/apache/juneau/utils/ManifestFile.html" title="class in org.apache.juneau.utils">ManifestFile</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1012">getManifest</a>()</pre> |
| <div class="block">Returns the main jar manifest file contents as a simple <a href="../../../../org/apache/juneau/collections/JsonMap.html" title="class in org.apache.juneau.collections"><code>JsonMap</code></a>. |
| |
| <p> |
| This map consists of the contents of <a href="https://docs.oracle.com/javase/8/docs/api/java/util/jar/Manifest.html?is-external=true#getMainAttributes--" title="class or interface in java.util.jar"><code>Manifest.getMainAttributes()</code></a> with the keys and entries converted to |
| simple strings. |
| <p> |
| This method can be called from the class constructor. |
| |
| <h5 class='section'>Example:</h5> |
| <p class='bjava'> |
| <jc>// Get Main-Class from manifest file.</jc> |
| String <jv>mainClass</jv> = Microservice.<jsm>getManifest</jsm>().getString(<js>"Main-Class"</js>, <js>"unknown"</js>); |
| |
| <jc>// Get Rest-Resources from manifest file.</jc> |
| String[] <jv>restResources</jv> = Microservice.<jsm>getManifest</jsm>().getStringArray(<js>"Rest-Resources"</js>); |
| </p></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The manifest file from the main jar, or <jk>null</jk> if the manifest file could not be retrieved.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getVarResolver--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getVarResolver</h4> |
| <pre>public <a href="../../../../org/apache/juneau/svl/VarResolver.html" title="class in org.apache.juneau.svl">VarResolver</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1028">getVarResolver</a>()</pre> |
| <div class="block">Returns the variable resolver for resolving variables in strings and files. |
| |
| <p> |
| Variables can be controlled by the following methods: |
| <ul class='javatree'> |
| <li class='jm'><a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html#vars-java.lang.Class...-"><code>Microservice.Builder.vars(Class...)</code></a> |
| <li class='jm'><a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html#varBean-java.lang.Class-T-"><code>Microservice.Builder.varBean(Class,Object)</code></a> |
| </ul></div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The VarResolver used by this Microservice, or <jk>null</jk> if it was never created.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getLogger--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getLogger</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Logger.html?is-external=true" title="class or interface in java.util.logging">Logger</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1037">getLogger</a>()</pre> |
| <div class="block">Returns the logger for this microservice.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The logger for this microservice.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="executeCommand-org.apache.juneau.collections.Args-java.util.Scanner-java.io.PrintWriter-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>executeCommand</h4> |
| <pre>public boolean <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1051">executeCommand</a>(<a href="../../../../org/apache/juneau/collections/Args.html" title="class in org.apache.juneau.collections">Args</a> args, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html?is-external=true" title="class or interface in java.util">Scanner</a> in, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintWriter.html?is-external=true" title="class or interface in java.io">PrintWriter</a> out)</pre> |
| <div class="block">Executes a console command.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>args</code> - The command arguments. |
| <br>The first entry in the arguments is always the command name.</dd> |
| <dd><code>in</code> - Console input.</dd> |
| <dd><code>out</code> - Console output.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd><jk>true</jk> if the command returned <jk>true</jk> meaning the console thread should exit.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="executeCommand-java.lang.String-java.lang.String-java.lang.Object...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>executeCommand</h4> |
| <pre>public <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1076">executeCommand</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> command, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> input, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... args)</pre> |
| <div class="block">Convenience method for executing a console command directly. |
| |
| <p> |
| Allows you to execute a console command outside the console by simulating input and output.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>command</code> - The command name to execute.</dd> |
| <dd><code>input</code> - Optional input to the command. Can be <jk>null</jk>.</dd> |
| <dd><code>args</code> - Optional command arguments to pass to the command.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The command output.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="join--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>join</h4> |
| <pre>public <a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1098">join</a>() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></pre> |
| <div class="block">Joins the application with the current thread. |
| |
| <p> |
| Default implementation is a no-op.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></code> - Error occurred</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="stop--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>stop</h4> |
| <pre>public <a href="../../../../org/apache/juneau/microservice/Microservice.html" title="class in org.apache.juneau.microservice">Microservice</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1111">stop</a>() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></pre> |
| <div class="block">Stop this application. |
| |
| <p> |
| Overridden methods MUST call this method LAST so that the <a href="../../../../org/apache/juneau/microservice/MicroserviceListener.html#onStop-org.apache.juneau.microservice.Microservice-"><code>MicroserviceListener.onStop(Microservice)</code></a> method is called.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>This object.</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></code> - Error occurred</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="exit--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>exit</h4> |
| <pre>public void <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1121">exit</a>() |
| throws <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></pre> |
| <div class="block">Stops the console (if it's started) and calls <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/System.html?is-external=true#exit-int-" title="class or interface in java.lang"><code>System.exit(int)</code></a>.</div> |
| <dl> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</a></code> - Error occurred</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="kill--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>kill</h4> |
| <pre>public void <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1133">kill</a>()</pre> |
| <div class="block">Kill the JVM by calling <c>System.exit(2);</c>.</div> |
| </li> |
| </ul> |
| <a name="getConsoleCommands--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getConsoleCommands</h4> |
| <pre>public final <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Map.html?is-external=true" title="class or interface in java.util">Map</a><<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>,<a href="../../../../org/apache/juneau/microservice/console/ConsoleCommand.html" title="class in org.apache.juneau.microservice.console">ConsoleCommand</a>> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1148">getConsoleCommands</a>()</pre> |
| <div class="block">Returns the console commands associated with this microservice.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The console commands associated with this microservice as an unmodifiable map.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getConsoleReader--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getConsoleReader</h4> |
| <pre>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html?is-external=true" title="class or interface in java.util">Scanner</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1160">getConsoleReader</a>()</pre> |
| <div class="block">Returns the console reader. |
| |
| <p> |
| Subclasses can override this method to provide their own console input.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The console reader. Never <jk>null</jk>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="getConsoleWriter--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>getConsoleWriter</h4> |
| <pre>protected <a href="https://docs.oracle.com/javase/8/docs/api/java/io/PrintWriter.html?is-external=true" title="class or interface in java.io">PrintWriter</a> <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1172">getConsoleWriter</a>()</pre> |
| <div class="block">Returns the console writer. |
| |
| <p> |
| Subclasses can override this method to provide their own console output.</div> |
| <dl> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>The console writer. Never <jk>null</jk>.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="out-org.apache.juneau.cp.Messages-java.lang.String-java.lang.Object...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>out</h4> |
| <pre>public void <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1186">out</a>(<a href="../../../../org/apache/juneau/cp/Messages.html" title="class in org.apache.juneau.cp">Messages</a> mb, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> messageKey, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... args)</pre> |
| <div class="block">Prints a localized message to the console writer. |
| |
| <p> |
| Ignored if <js>"Console/enabled"</js> is <jk>false</jk>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mb</code> - The message bundle containing the message.</dd> |
| <dd><code>messageKey</code> - The message key.</dd> |
| <dd><code>args</code> - Optional <a href="https://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html?is-external=true" title="class or interface in java.text"><code>MessageFormat</code></a>-style arguments.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="err-org.apache.juneau.cp.Messages-java.lang.String-java.lang.Object...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>err</h4> |
| <pre>public void <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1203">err</a>(<a href="../../../../org/apache/juneau/cp/Messages.html" title="class in org.apache.juneau.cp">Messages</a> mb, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> messageKey, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... args)</pre> |
| <div class="block">Prints a localized message to STDERR. |
| |
| <p> |
| Ignored if <js>"Console/enabled"</js> is <jk>false</jk>.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>mb</code> - The message bundle containing the message.</dd> |
| <dd><code>messageKey</code> - The message key.</dd> |
| <dd><code>args</code> - Optional <a href="https://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html?is-external=true" title="class or interface in java.text"><code>MessageFormat</code></a>-style arguments.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="log-java.util.logging.Level-java.lang.String-java.lang.Object...-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>log</h4> |
| <pre>protected void <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1217">log</a>(<a href="https://docs.oracle.com/javase/8/docs/api/java/util/logging/Level.html?is-external=true" title="class or interface in java.util.logging">Level</a> level, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> message, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... args)</pre> |
| <div class="block">Logs a message to the log file.</div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>level</code> - The log level.</dd> |
| <dd><code>message</code> - The message text.</dd> |
| <dd><code>args</code> - Optional <a href="https://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html?is-external=true" title="class or interface in java.text"><code>MessageFormat</code></a>-style arguments.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="onConfigChange-org.apache.juneau.config.event.ConfigEvents-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>onConfigChange</h4> |
| <pre>public void <a href="../../../../src-html/org/apache/juneau/microservice/Microservice.html#line.1223">onConfigChange</a>(<a href="../../../../org/apache/juneau/config/event/ConfigEvents.html" title="class in org.apache.juneau.config.event">ConfigEvents</a> events)</pre> |
| <div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../org/apache/juneau/config/event/ConfigEventListener.html#onConfigChange-org.apache.juneau.config.event.ConfigEvents-">ConfigEventListener</a></code></span></div> |
| <div class="block">Gets called immediately after a config file has been loaded.</div> |
| <dl> |
| <dt><span class="overrideSpecifyLabel">Specified by:</span></dt> |
| <dd><code><a href="../../../../org/apache/juneau/config/event/ConfigEventListener.html#onConfigChange-org.apache.juneau.config.event.ConfigEvents-">onConfigChange</a></code> in interface <code><a href="../../../../org/apache/juneau/config/event/ConfigEventListener.html" title="interface in org.apache.juneau.config.event">ConfigEventListener</a></code></dd> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>events</code> - The change events.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../org/apache/juneau/microservice/LogConfig.html" title="class in org.apache.juneau.microservice"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../org/apache/juneau/microservice/Microservice.Builder.html" title="class in org.apache.juneau.microservice"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?org/apache/juneau/microservice/Microservice.html" target="_top">Frames</a></li> |
| <li><a href="Microservice.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li><a href="#constructor.summary">Constr</a> | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#constructor.detail">Constr</a> | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <p class="legalCopy"><small>Copyright © 2016–2022 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </body> |
| </html> |