mirror of
https://gitee.com/actframework/actframework.git
synced 2024-12-01 19:37:43 +08:00
resolve conflict; fix testapp issue; ready for 1.4.11 release
This commit is contained in:
commit
25875b0fbb
7
.travis.yml
Normal file
7
.travis.yml
Normal file
@ -0,0 +1,7 @@
|
||||
language: java
|
||||
sudo: false # faster builds
|
||||
|
||||
script: "mvn cobertura:cobertura"
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
13
CHANGELOG.md
13
CHANGELOG.md
@ -3,7 +3,6 @@
|
||||
1.4.11
|
||||
* catch up update to 1.3.14-LTS
|
||||
* Support running CLI Job in background #267
|
||||
* Enhance Job support on logging and process reporting #266
|
||||
* `job.list` CLI command failure #355
|
||||
|
||||
1.4.10
|
||||
@ -59,15 +58,23 @@
|
||||
* upport WebSocket #17 S
|
||||
|
||||
1.3.14
|
||||
* Improve maven build process #372
|
||||
* Improve logging support #370
|
||||
* Simplify start API/implementation #369
|
||||
* Introduce osgl-bootstrap and osgl-ut #368
|
||||
* It shall not try to instantiate commander class for command implemented on static method #367
|
||||
* NPE when building param tree #365
|
||||
* Deadlock on app start #363
|
||||
* Binder annotation on bean field doesn't work #362
|
||||
* Support app defined parameter binder annotation #361
|
||||
* Improve app version reading support #359
|
||||
* Improve app version reading support #359
|
||||
* If no file selected in an upload form, the server side will trigger a 500 server error #357
|
||||
* `ProvidesImplicitTemplateVariable` generates bad rythm template source code #354
|
||||
* The rest parameters is always `null` after `@DbBind` annotated parameter #353
|
||||
* Support API document generation #351
|
||||
* Improve `Catch` interceptor API #350
|
||||
* Fix regression issues: #287 and #297
|
||||
* Get `DbService` list from `DbServiceManager` by plugin class #273
|
||||
* Fix regression issues: #287 and #297
|
||||
|
||||
1.3.13
|
||||
* Add annotation to allow developer specify a handler method's template shall not be cached #347
|
||||
|
209
checkstyle.xml
Normal file
209
checkstyle.xml
Normal file
@ -0,0 +1,209 @@
|
||||
<!DOCTYPE module SYSTEM "http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
|
||||
<!--
|
||||
Checkstyle configuration that checks the Google coding conventions from Google Java Style
|
||||
that can be found at https://google.github.io/styleguide/javaguide.html.
|
||||
|
||||
Checkstyle is very configurable. Be sure to read the documentation at
|
||||
http://checkstyle.sf.net (or in your downloaded distribution).
|
||||
|
||||
To completely disable a check, just comment it out or delete it from the file.
|
||||
|
||||
Authors: Max Vetrenko, Ruslan Diachenko, Roman Ivanov.
|
||||
-->
|
||||
<module name="Checker">
|
||||
<property name="charset" value="UTF-8"/>
|
||||
<property name="severity" value="warning"/>
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
<!-- Checks for whitespace -->
|
||||
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
|
||||
<module name="FileTabCharacter">
|
||||
<property name="eachLine" value="true"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<module name="OuterTypeFilename"/>
|
||||
<module name="IllegalTokenText">
|
||||
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>
|
||||
<property name="format" value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/>
|
||||
<property name="message" value="Consider using special escape sequence instead of octal value or Unicode escaped value."/>
|
||||
</module>
|
||||
<module name="AvoidEscapedUnicodeCharacters">
|
||||
<property name="allowEscapesForControlCharacters" value="true"/>
|
||||
<property name="allowByTailComment" value="true"/>
|
||||
<property name="allowNonPrintableEscapes" value="true"/>
|
||||
</module>
|
||||
<module name="LineLength">
|
||||
<property name="max" value="180"/>
|
||||
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
|
||||
</module>
|
||||
<!--<module name="AvoidStarImport"/>-->
|
||||
<module name="OneTopLevelClass"/>
|
||||
<module name="NoLineWrap"/>
|
||||
<module name="EmptyBlock">
|
||||
<property name="option" value="TEXT"/>
|
||||
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
|
||||
</module>
|
||||
<module name="NeedBraces"/>
|
||||
<module name="LeftCurly"/>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlySame"/>
|
||||
<property name="tokens" value="LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_DO"/>
|
||||
</module>
|
||||
<module name="RightCurly">
|
||||
<property name="id" value="RightCurlyAlone"/>
|
||||
<property name="option" value="alone"/>
|
||||
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, STATIC_INIT, INSTANCE_INIT"/>
|
||||
</module>
|
||||
<module name="WhitespaceAround">
|
||||
<property name="allowEmptyConstructors" value="true"/>
|
||||
<property name="allowEmptyMethods" value="true"/>
|
||||
<property name="allowEmptyTypes" value="true"/>
|
||||
<property name="allowEmptyLoops" value="true"/>
|
||||
<message key="ws.notFollowed" value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
|
||||
<message key="ws.notPreceded" value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="OneStatementPerLine"/>
|
||||
<module name="MultipleVariableDeclarations"/>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="FallThrough"/>
|
||||
<module name="UpperEll"/>
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="EmptyLineSeparator">
|
||||
<property name="allowNoEmptyLineBetweenFields" value="true"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapDot"/>
|
||||
<property name="tokens" value="DOT"/>
|
||||
<property name="option" value="nl"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapComma"/>
|
||||
<property name="tokens" value="COMMA"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<!-- ELLIPSIS is EOL until https://github.com/google/styleguide/issues/258 -->
|
||||
<property name="id" value="SeparatorWrapEllipsis"/>
|
||||
<property name="tokens" value="ELLIPSIS"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<!-- ARRAY_DECLARATOR is EOL until https://github.com/google/styleguide/issues/259 -->
|
||||
<property name="id" value="SeparatorWrapArrayDeclarator"/>
|
||||
<property name="tokens" value="ARRAY_DECLARATOR"/>
|
||||
<property name="option" value="EOL"/>
|
||||
</module>
|
||||
<module name="SeparatorWrap">
|
||||
<property name="id" value="SeparatorWrapMethodRef"/>
|
||||
<property name="tokens" value="METHOD_REF"/>
|
||||
<property name="option" value="nl"/>
|
||||
</module>
|
||||
<module name="PackageName">
|
||||
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
|
||||
<message key="name.invalidPattern" value="Package name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="TypeName">
|
||||
<message key="name.invalidPattern" value="Type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MemberName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
|
||||
<message key="name.invalidPattern" value="Member name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="CatchParameterName">
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern" value="Catch parameter name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="LocalVariableName">
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
|
||||
<message key="name.invalidPattern" value="Local variable name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="ClassTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern" value="Class type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="MethodTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern" value="Method type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="InterfaceTypeParameterName">
|
||||
<property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/>
|
||||
<message key="name.invalidPattern" value="Interface type name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="NoFinalizer"/>
|
||||
<module name="GenericWhitespace">
|
||||
<message key="ws.followed" value="GenericWhitespace ''{0}'' is followed by whitespace."/>
|
||||
<message key="ws.preceded" value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
|
||||
<message key="ws.illegalFollow" value="GenericWhitespace ''{0}'' should followed by whitespace."/>
|
||||
<message key="ws.notPreceded" value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
|
||||
</module>
|
||||
<module name="Indentation">
|
||||
<property name="basicOffset" value="4"/>
|
||||
<property name="braceAdjustment" value="0"/>
|
||||
<property name="caseIndent" value="4"/>
|
||||
<property name="throwsIndent" value="8"/>
|
||||
<property name="lineWrappingIndentation" value="4"/>
|
||||
<property name="arrayInitIndent" value="4"/>
|
||||
</module>
|
||||
<module name="AbbreviationAsWordInName">
|
||||
<property name="ignoreFinal" value="false"/>
|
||||
<property name="allowedAbbreviationLength" value="1"/>
|
||||
</module>
|
||||
<module name="OverloadMethodsDeclarationOrder"/>
|
||||
<module name="VariableDeclarationUsageDistance"/>
|
||||
<!--<module name="CustomImportOrder">-->
|
||||
<!--<property name="sortImportsInGroupAlphabetically" value="true"/>-->
|
||||
<!--<property name="separateLineBetweenGroups" value="true"/>-->
|
||||
<!--<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>-->
|
||||
<!--</module>-->
|
||||
<module name="MethodParamPad"/>
|
||||
<module name="ParenPad"/>
|
||||
<module name="OperatorWrap">
|
||||
<property name="option" value="NL"/>
|
||||
<property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="id" value="AnnotationLocationMostCases"/>
|
||||
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/>
|
||||
</module>
|
||||
<module name="AnnotationLocation">
|
||||
<property name="id" value="AnnotationLocationVariables"/>
|
||||
<property name="tokens" value="VARIABLE_DEF"/>
|
||||
<property name="allowSamelineMultipleAnnotations" value="true"/>
|
||||
</module>
|
||||
<module name="NonEmptyAtclauseDescription"/>
|
||||
<module name="JavadocTagContinuationIndentation"/>
|
||||
<!--<module name="JavadocParagraph"/>-->
|
||||
<module name="SummaryJavadoc">
|
||||
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
|
||||
</module>
|
||||
<module name="AtclauseOrder">
|
||||
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
|
||||
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
|
||||
</module>
|
||||
<module name="JavadocMethod">
|
||||
<property name="scope" value="public"/>
|
||||
<property name="allowMissingParamTags" value="true"/>
|
||||
<property name="allowMissingThrowsTags" value="true"/>
|
||||
<property name="allowMissingReturnTag" value="true"/>
|
||||
<property name="minLineCount" value="2"/>
|
||||
<property name="allowedAnnotations" value="Override, Test"/>
|
||||
<property name="allowThrowsTagsForSubclasses" value="true"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
<message key="name.invalidPattern" value="Method name ''{0}'' must match pattern ''{1}''."/>
|
||||
</module>
|
||||
<module name="SingleLineJavadoc">
|
||||
<property name="ignoreInlineTags" value="false"/>
|
||||
</module>
|
||||
<module name="EmptyCatchBlock">
|
||||
<property name="exceptionVariableName" value="expected"/>
|
||||
</module>
|
||||
<module name="CommentsIndentation"/>
|
||||
</module>
|
||||
</module>
|
@ -1,19 +0,0 @@
|
||||
|
||||
Copyright (C) 2013 The ACT MVC Server project
|
||||
Gelin Luo <greenlaw110(at)gmail.com>
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<additionalHeaders>
|
||||
<javadoc_style>
|
||||
<firstLine>/*</firstLine>
|
||||
<beforeEachLine> * </beforeEachLine>
|
||||
<endLine> */</endLine>
|
||||
<!--<afterEachLine></afterEachLine>-->
|
||||
<!--skipLine></skipLine-->
|
||||
<firstLineDetectionPattern>(\s|\t)*/\*.*$</firstLineDetectionPattern>
|
||||
<lastLineDetectionPattern>.*\*/(\s|\t)*$</lastLineDetectionPattern>
|
||||
<allowBlankLines>false</allowBlankLines>
|
||||
<isMultiline>true</isMultiline>
|
||||
<padLines>false</padLines>
|
||||
</javadoc_style>
|
||||
</additionalHeaders>
|
665
etc/javadoc.css
665
etc/javadoc.css
@ -1,55 +1,622 @@
|
||||
/* comes from http://sensemaya.org/maya/2009/07/10/making-javadoc-more-legible */
|
||||
/* Javadoc style sheet */
|
||||
@import url(highlight.css);
|
||||
|
||||
/* Define colors, fonts and other style attributes here to override the defaults */
|
||||
|
||||
/* Page background color */
|
||||
body { background-color: #FFFFFF; color:#333; font-size: 100%; }
|
||||
|
||||
body { font-size: 0.875em; line-height: 1.286em; font-family: "Helvetica", "Arial", sans-serif; }
|
||||
|
||||
code { color: #777; line-height: 1.286em; font-family: "Consolas", "Lucida Console", "Droid Sans Mono", "Andale Mono", "Monaco", "Lucida Sans Typewriter"; }
|
||||
|
||||
a { text-decoration: none; color: #16569A; /* also try #2E85ED, #0033FF, #6C93C6, #1D7BBE, #1D8DD2 */ }
|
||||
a:hover { color: #EEEEEE; background-color: #16569A; }
|
||||
a:visited { color: #CC3300; }
|
||||
a:visited:hover { color: #fff; background-color: #CC3300; }
|
||||
|
||||
table[border="1"] { border: 1px solid #ddd; }
|
||||
table[border="1"] td, table[border="1"] th { border: 1px solid #ddd; }
|
||||
table[cellpadding="3"] td { padding: 0.5em; }
|
||||
|
||||
font[size="-1"] { font-size: 0.85em; line-height: 1.5em; }
|
||||
font[size="-2"] { font-size: 0.8em; }
|
||||
font[size="+2"] { font-size: 1.4em; line-height: 1.3em; padding: 0.4em 0; }
|
||||
|
||||
/* Headings */
|
||||
h1 { font-size: 1.5em; line-height: 1.286em;}
|
||||
|
||||
/* Table colors */
|
||||
.TableHeadingColor { background: #ccc; color:#444; } /* Dark mauve */
|
||||
.TableSubHeadingColor { background: #ddd; color:#444; } /* Light mauve */
|
||||
.TableRowColor { background: #FFFFFF; color:#666; font-size: 0.95em; } /* White */
|
||||
.TableRowColor code { color:#000; } /* White */
|
||||
|
||||
/* Font used in left-hand frame lists */
|
||||
.FrameTitleFont { font-size: 100%; }
|
||||
.FrameHeadingFont { font-size: 90%; }
|
||||
.FrameItemFont { font-size: 0.9em; line-height: 1.3em;
|
||||
body {
|
||||
background-color:#222222;
|
||||
color:#D2DECA;
|
||||
font-family:'Roboto', 'San Francisco Text', 'Noto Sans', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
|
||||
font-size:16px;
|
||||
margin:0;
|
||||
}
|
||||
/* Java Interfaces */
|
||||
.FrameItemFont a i {
|
||||
font-style: normal; color: #666;
|
||||
a:link, a:visited {
|
||||
text-decoration:none;
|
||||
color:#999;
|
||||
}
|
||||
.FrameItemFont a:hover i {
|
||||
font-style: normal; color: #fff; background-color: #666;
|
||||
a:hover, a:focus {
|
||||
text-decoration:underline;
|
||||
}
|
||||
a:active {
|
||||
text-decoration:none;
|
||||
color:#999;
|
||||
}
|
||||
a[name] {
|
||||
color:#D2DECA;
|
||||
}
|
||||
a[name]:hover {
|
||||
text-decoration:none;
|
||||
color:#D2DECA;
|
||||
}
|
||||
/*[MOD]
|
||||
pre {
|
||||
font-family:'Roboto Mono', 'Envy Code R', Consolas, Menlo, Monaco,monospace;
|
||||
font-size:14px;
|
||||
}*/
|
||||
h1 {
|
||||
font-size:20px;
|
||||
}
|
||||
h2 {
|
||||
font-size:18px;
|
||||
}
|
||||
h3 {
|
||||
font-size:16px;
|
||||
font-style:italic;
|
||||
}
|
||||
h4 {
|
||||
font-size:13px;
|
||||
}
|
||||
h5 {
|
||||
font-size:12px;
|
||||
}
|
||||
h6 {
|
||||
font-size:11px;
|
||||
}
|
||||
ul {
|
||||
list-style-type:disc;
|
||||
}
|
||||
|
||||
/* Navigation bar fonts and colors */
|
||||
.NavBarCell1 { background-color:#E0E6DF; } /* Light mauve */
|
||||
.NavBarCell1Rev { background-color:#16569A; color:#FFFFFF} /* Dark Blue */
|
||||
.NavBarFont1 { }
|
||||
.NavBarFont1Rev { color:#FFFFFF; }
|
||||
code, tt {
|
||||
font-family:'Roboto Mono', 'Envy Code R', Consolas, Menlo, Monaco,monospace;
|
||||
font-size:14px;
|
||||
padding-top:4px;
|
||||
margin-top:8px;
|
||||
line-height:1.4em;
|
||||
}
|
||||
dt code {
|
||||
font-family:'Roboto Mono', 'Envy Code R', Consolas, Menlo, Monaco,monospace;
|
||||
font-size:14px;
|
||||
padding-top:4px;
|
||||
}
|
||||
table tr td dt code {
|
||||
font-family:'Roboto Mono', 'Envy Code R', Consolas, Menlo, Monaco,monospace;
|
||||
font-size:14px;
|
||||
vertical-align:top;
|
||||
padding-top:4px;
|
||||
}
|
||||
sup {
|
||||
font-size:8px;
|
||||
}
|
||||
/*
|
||||
Document title and Copyright styles
|
||||
*/
|
||||
.clear {
|
||||
clear:both;
|
||||
height:0px;
|
||||
overflow:hidden;
|
||||
}
|
||||
.aboutLanguage {
|
||||
float:right;
|
||||
padding:0px 21px;
|
||||
font-size:.8em;
|
||||
z-index:200;
|
||||
margin-top:-7px;
|
||||
}
|
||||
.legalCopy {
|
||||
margin-left:.5em;
|
||||
}
|
||||
.bar a, .bar a:link, .bar a:visited, .bar a:active {
|
||||
color:#222222;
|
||||
text-decoration:none;
|
||||
}
|
||||
.bar a:hover, .bar a:focus {
|
||||
color:#999;
|
||||
}
|
||||
.tab {
|
||||
background-color:#004F66;
|
||||
color:#D0D0D0;
|
||||
padding:8px;
|
||||
width:5em;
|
||||
font-weight:bold;
|
||||
}
|
||||
/*
|
||||
Navigation bar styles
|
||||
*/
|
||||
.bar {
|
||||
background-color:#818487;
|
||||
color:#080707;
|
||||
padding:.8em .5em .4em .8em;
|
||||
height:auto;/*height:1.8em;*/
|
||||
font-size:11px;
|
||||
margin:0;
|
||||
}
|
||||
.topNav {
|
||||
background-color:#818487;
|
||||
color:#222222;
|
||||
float:left;
|
||||
padding:0;
|
||||
width:100%;
|
||||
clear:right;
|
||||
height:2.8em;
|
||||
padding-top:10px;
|
||||
overflow:hidden;
|
||||
font-size:12px;
|
||||
}
|
||||
.bottomNav {
|
||||
margin-top:10px;
|
||||
background-color:#818487;
|
||||
color:#222222;
|
||||
float:left;
|
||||
padding:0;
|
||||
width:100%;
|
||||
clear:right;
|
||||
height:2.8em;
|
||||
padding-top:10px;
|
||||
overflow:hidden;
|
||||
font-size:12px;
|
||||
}
|
||||
.subNav {
|
||||
background-color:#47494C;
|
||||
float:left;
|
||||
width:100%;
|
||||
overflow:hidden;
|
||||
font-size:12px;
|
||||
}
|
||||
.subNav div {
|
||||
clear:left;
|
||||
float:left;
|
||||
padding:0 0 5px 6px;
|
||||
text-transform:uppercase;/*???*/
|
||||
}
|
||||
ul.navList, ul.subNavList {
|
||||
float:left;
|
||||
margin:0 25px 0 0;
|
||||
padding:0;
|
||||
}
|
||||
ul.navList li{
|
||||
list-style:none;
|
||||
float:left;
|
||||
padding: 5px 6px;
|
||||
text-transform:uppercase;/*???*/
|
||||
}
|
||||
ul.subNavList li{
|
||||
list-style:none;
|
||||
float:left;
|
||||
font-size:90%;/*???*/
|
||||
}
|
||||
.topNav a:link, .topNav a:active, .topNav a:visited, .bottomNav a:link, .bottomNav a:active, .bottomNav a:visited {
|
||||
color:#222222;
|
||||
text-decoration:none;
|
||||
text-transform:uppercase;/*???*/
|
||||
}
|
||||
.topNav a:hover, .bottomNav a:hover {
|
||||
text-decoration:none;
|
||||
color:#999;
|
||||
text-transform:uppercase;/*???*/
|
||||
}
|
||||
.navBarCell1Rev {
|
||||
background-color:#C2C2C2;
|
||||
color:#253441;
|
||||
margin: auto 5px;
|
||||
}
|
||||
.skipNav {
|
||||
position:absolute;
|
||||
top:auto;
|
||||
left:-9999px;
|
||||
overflow:hidden;
|
||||
}
|
||||
/*
|
||||
Page header and footer styles
|
||||
*/
|
||||
.header, .footer {
|
||||
clear:both;
|
||||
margin:0 20px;
|
||||
padding:5px 0 0 0;
|
||||
}
|
||||
.indexHeader {
|
||||
margin:10px;
|
||||
position:relative;
|
||||
}
|
||||
.indexHeader span{
|
||||
margin-right:15px;
|
||||
}
|
||||
.indexHeader h1 {
|
||||
font-size:13px;
|
||||
}
|
||||
.title {
|
||||
margin:10px 0;
|
||||
}
|
||||
.subTitle {
|
||||
margin:5px 0 0 0;
|
||||
}
|
||||
.header ul {
|
||||
margin:0 0 15px 0;
|
||||
padding:0;
|
||||
}
|
||||
.footer ul {
|
||||
margin:20px 0 5px 0;
|
||||
}
|
||||
.header ul li, .footer ul li {
|
||||
list-style:none;
|
||||
font-size:13px;
|
||||
}
|
||||
/*
|
||||
Heading styles
|
||||
*/
|
||||
div.details ul.blockList ul.blockList ul.blockList li.blockList h4, div.details ul.blockList ul.blockList ul.blockListLast li.blockList h4 {
|
||||
background-color:#47494C;
|
||||
border:none;
|
||||
margin:0 0 6px -8px;
|
||||
padding:7px 5px;
|
||||
}
|
||||
ul.blockList ul.blockList ul.blockList li.blockList h3 {
|
||||
background-color:#47494C;
|
||||
border:none;
|
||||
margin:0 0 6px -8px;
|
||||
padding:7px 5px;
|
||||
}
|
||||
ul.blockList ul.blockList li.blockList h3 {
|
||||
padding:0;
|
||||
margin:15px 0;
|
||||
}
|
||||
ul.blockList li.blockList h2 {
|
||||
padding:10px 0 10px 0;
|
||||
}
|
||||
/*
|
||||
Page layout container styles
|
||||
*/
|
||||
.contentContainer, .sourceContainer, .classUseContainer, .serializedFormContainer, .constantValuesContainer {
|
||||
clear:both;
|
||||
padding:10px 20px;
|
||||
position:relative;
|
||||
}
|
||||
.indexContainer {
|
||||
margin:10px;
|
||||
position:relative;
|
||||
font-size:14px;
|
||||
}
|
||||
.indexContainer h2 {
|
||||
font-size:15px;
|
||||
padding:0 0 3px 0;
|
||||
}
|
||||
.indexContainer ul {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
.indexContainer ul li {
|
||||
list-style:none;
|
||||
padding-top:2px;
|
||||
}
|
||||
.contentContainer .description dl dt, .contentContainer .details dl dt, .serializedFormContainer dl dt {
|
||||
font-size:14px;
|
||||
font-weight:bold;
|
||||
margin:10px 0 0 0;
|
||||
color:#e4e4e4;
|
||||
}
|
||||
.contentContainer .description dl dd, .contentContainer .details dl dd, .serializedFormContainer dl dd {
|
||||
margin:5px 0 10px 0px;
|
||||
font-size:14px;
|
||||
font-family:'DejaVu Sans Mono',monospace;
|
||||
}
|
||||
.serializedFormContainer dl.nameValue dt {
|
||||
margin-left:1px;
|
||||
font-size:1.1em;
|
||||
display:inline;
|
||||
font-weight:bold;
|
||||
}
|
||||
.serializedFormContainer dl.nameValue dd {
|
||||
margin:0 0 0 1px;
|
||||
font-size:1.1em;
|
||||
display:inline;
|
||||
}
|
||||
/*
|
||||
List styles
|
||||
*/
|
||||
ul.horizontal li {
|
||||
display:inline;
|
||||
font-size:0.9em;
|
||||
}
|
||||
ul.inheritance {
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
ul.inheritance li {
|
||||
display:inline;
|
||||
list-style:none;
|
||||
}
|
||||
ul.inheritance li ul.inheritance {
|
||||
margin-left:15px;
|
||||
padding-left:15px;
|
||||
padding-top:1px;
|
||||
}
|
||||
ul.blockList, ul.blockListLast {
|
||||
margin:10px 0 10px 0;
|
||||
padding:0;
|
||||
}
|
||||
ul.blockList li.blockList, ul.blockListLast li.blockList {
|
||||
list-style:none;
|
||||
margin-bottom:15px;
|
||||
line-height:1.4;
|
||||
}
|
||||
ul.blockList ul.blockList li.blockList, ul.blockList ul.blockListLast li.blockList {
|
||||
padding:0px 20px 5px 10px;
|
||||
border:1px solid #545454;
|
||||
background-color:#282828;
|
||||
}
|
||||
ul.blockList ul.blockList ul.blockList li.blockList, ul.blockList ul.blockList ul.blockListLast li.blockList {
|
||||
padding:0 0 5px 8px;
|
||||
background-color:#222222;
|
||||
border:none;
|
||||
}
|
||||
ul.blockList ul.blockList ul.blockList ul.blockList li.blockList {
|
||||
margin-left:0;
|
||||
padding-left:0;
|
||||
padding-bottom:15px;
|
||||
border:none;
|
||||
}
|
||||
ul.blockList ul.blockList ul.blockList ul.blockList li.blockListLast {
|
||||
list-style:none;
|
||||
border-bottom:none;
|
||||
padding-bottom:0;
|
||||
}
|
||||
table tr td dl, table tr td dl dt, table tr td dl dd {
|
||||
margin-top:0;
|
||||
margin-bottom:1px;
|
||||
}
|
||||
/*
|
||||
Table styles
|
||||
*/
|
||||
.overviewSummary, .memberSummary, .typeSummary, .useSummary, .constantsSummary, .deprecatedSummary {
|
||||
width:100%;
|
||||
border-left:1px solid #333;
|
||||
border-right:1px solid #333;
|
||||
border-bottom:1px solid #333;
|
||||
}
|
||||
.overviewSummary, .memberSummary {
|
||||
padding:0px;
|
||||
}
|
||||
.overviewSummary caption, .memberSummary caption, .typeSummary caption,
|
||||
.useSummary caption, .constantsSummary caption, .deprecatedSummary caption {
|
||||
position:relative;
|
||||
text-align:left;
|
||||
background-repeat:no-repeat;
|
||||
color:#253441;
|
||||
font-weight:bold;
|
||||
clear:none;
|
||||
overflow:hidden;
|
||||
padding:0px;
|
||||
padding-top:10px;
|
||||
padding-left:1px;
|
||||
margin:0px;
|
||||
white-space:pre;
|
||||
}
|
||||
.overviewSummary caption a:link, .memberSummary caption a:link, .typeSummary caption a:link,
|
||||
.useSummary caption a:link, .constantsSummary caption a:link, .deprecatedSummary caption a:link,
|
||||
.overviewSummary caption a:hover, .memberSummary caption a:hover, .typeSummary caption a:hover,
|
||||
.useSummary caption a:hover, .constantsSummary caption a:hover, .deprecatedSummary caption a:hover,
|
||||
.overviewSummary caption a:active, .memberSummary caption a:active, .typeSummary caption a:active,
|
||||
.useSummary caption a:active, .constantsSummary caption a:active, .deprecatedSummary caption a:active,
|
||||
.overviewSummary caption a:visited, .memberSummary caption a:visited, .typeSummary caption a:visited,
|
||||
.useSummary caption a:visited, .constantsSummary caption a:visited, .deprecatedSummary caption a:visited {
|
||||
color:#222222;
|
||||
}
|
||||
.overviewSummary caption span, .memberSummary caption span, .typeSummary caption span,
|
||||
.useSummary caption span, .constantsSummary caption span, .deprecatedSummary caption span {
|
||||
white-space:nowrap;
|
||||
padding-top:5px;
|
||||
padding-left:12px;
|
||||
padding-right:12px;
|
||||
padding-bottom:7px;
|
||||
display:inline-block;
|
||||
float:left;
|
||||
background-color:#C2C2C2;
|
||||
border: none;
|
||||
height:16px;
|
||||
}
|
||||
.memberSummary caption span.activeTableTab span {
|
||||
white-space:nowrap;
|
||||
padding-top:5px;
|
||||
padding-left:12px;
|
||||
padding-right:12px;
|
||||
margin-right:3px;
|
||||
display:inline-block;
|
||||
float:left;
|
||||
background-color:#C2C2C2;
|
||||
height:16px;
|
||||
}
|
||||
.memberSummary caption span.tableTab span {
|
||||
white-space:nowrap;
|
||||
padding-top:5px;
|
||||
padding-left:12px;
|
||||
padding-right:12px;
|
||||
margin-right:3px;
|
||||
display:inline-block;
|
||||
float:left;
|
||||
background-color:#818487;
|
||||
height:16px;
|
||||
}
|
||||
.memberSummary caption span.tableTab, .memberSummary caption span.activeTableTab {
|
||||
padding-top:0px;
|
||||
padding-left:0px;
|
||||
padding-right:0px;
|
||||
background-image:none;
|
||||
float:none;
|
||||
display:inline;
|
||||
}
|
||||
.overviewSummary .tabEnd, .memberSummary .tabEnd, .typeSummary .tabEnd,
|
||||
.useSummary .tabEnd, .constantsSummary .tabEnd, .deprecatedSummary .tabEnd {
|
||||
display:none;
|
||||
width:5px;
|
||||
position:relative;
|
||||
float:left;
|
||||
background-color:#C2C2C2;
|
||||
}
|
||||
.memberSummary .activeTableTab .tabEnd {
|
||||
display:none;
|
||||
width:5px;
|
||||
margin-right:3px;
|
||||
position:relative;
|
||||
float:left;
|
||||
background-color:#C2C2C2;
|
||||
}
|
||||
.memberSummary .tableTab .tabEnd {
|
||||
display:none;
|
||||
width:5px;
|
||||
margin-right:3px;
|
||||
position:relative;
|
||||
background-color:#818487;
|
||||
float:left;
|
||||
|
||||
.NavBarCell2 { background-color:#FFFFFF; color:#000000}
|
||||
.NavBarCell3 { background-color:#FFFFFF; color:#000000}
|
||||
}
|
||||
.overviewSummary td, .memberSummary td, .typeSummary td,
|
||||
.useSummary td, .constantsSummary td, .deprecatedSummary td {
|
||||
text-align:left;
|
||||
padding:0px 0px 12px 10px;
|
||||
width:100%;
|
||||
}
|
||||
th.colOne, th.colFirst, th.colLast, .useSummary th, .constantsSummary th,
|
||||
td.colOne, td.colFirst, td.colLast, .useSummary td, .constantsSummary td{
|
||||
vertical-align:top;
|
||||
padding-right:0px;
|
||||
padding-top:8px;
|
||||
padding-bottom:3px;
|
||||
}
|
||||
th.colFirst, th.colLast, th.colOne, .constantsSummary th {
|
||||
background:#47494C;
|
||||
text-align:left;
|
||||
padding:8px 3px 3px 7px;
|
||||
}
|
||||
td.colFirst, th.colFirst {
|
||||
white-space:nowrap;
|
||||
font-size:13px;
|
||||
}
|
||||
td.colLast, th.colLast {
|
||||
font-size:13px;
|
||||
}
|
||||
td.colOne, th.colOne {
|
||||
font-size:13px;
|
||||
}
|
||||
.overviewSummary td.colFirst, .overviewSummary th.colFirst,
|
||||
.overviewSummary td.colOne, .overviewSummary th.colOne,
|
||||
.memberSummary td.colFirst, .memberSummary th.colFirst,
|
||||
.memberSummary td.colOne, .memberSummary th.colOne,
|
||||
.typeSummary td.colFirst{
|
||||
width:25%;
|
||||
vertical-align:top;
|
||||
}
|
||||
td.colOne a:link, td.colOne a:active, td.colOne a:visited, td.colOne a:hover, td.colFirst a:link, td.colFirst a:active, td.colFirst a:visited, td.colFirst a:hover, td.colLast a:link, td.colLast a:active, td.colLast a:visited, td.colLast a:hover, .constantValuesContainer td a:link, .constantValuesContainer td a:active, .constantValuesContainer td a:visited, .constantValuesContainer td a:hover {
|
||||
font-weight:bold;
|
||||
}
|
||||
.tableSubHeadingColor {
|
||||
background-color:#2F3131;
|
||||
}
|
||||
.altColor {
|
||||
background-color:#222222;
|
||||
}
|
||||
.rowColor {
|
||||
background-color:#2F3131;
|
||||
}
|
||||
/*
|
||||
Content styles
|
||||
*/
|
||||
.description pre {
|
||||
margin-top:0;
|
||||
}
|
||||
.deprecatedContent {
|
||||
margin:0;
|
||||
padding:10px 0;
|
||||
}
|
||||
.docSummary {
|
||||
padding:0;
|
||||
}
|
||||
|
||||
ul.blockList ul.blockList ul.blockList li.blockList h3 {
|
||||
font-style:normal;
|
||||
}
|
||||
|
||||
div.block {
|
||||
font-size:16px;
|
||||
font-family:'Roboto', 'San Francisco Text', 'Noto Sans', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
|
||||
td.colLast div {
|
||||
padding-top:0px;
|
||||
}
|
||||
|
||||
|
||||
td.colLast a {
|
||||
padding-bottom:3px;
|
||||
}
|
||||
/*
|
||||
Formatting effect styles
|
||||
*/
|
||||
.sourceLineNo {
|
||||
color:green;
|
||||
padding:0 30px 0 0;
|
||||
}
|
||||
h1.hidden {
|
||||
visibility:hidden;
|
||||
overflow:hidden;
|
||||
font-size:10px;
|
||||
}
|
||||
.block {
|
||||
display:block;
|
||||
margin:3px 10px 2px 0px;
|
||||
color:#E9E9e9;
|
||||
}
|
||||
.deprecatedLabel, .descfrmTypeLabel, .memberNameLabel, .memberNameLink,
|
||||
.overrideSpecifyLabel, .packageHierarchyLabel, .paramLabel, .returnLabel,
|
||||
.seeLabel, .simpleTagLabel, .throwsLabel, .typeNameLabel, .typeNameLink {
|
||||
font-weight:bold;
|
||||
}
|
||||
.deprecationComment, .emphasizedPhrase, .interfaceName {
|
||||
font-style:italic;
|
||||
}
|
||||
|
||||
div.block div.block span.deprecationComment, div.block div.block span.emphasizedPhrase,
|
||||
div.block div.block span.interfaceName {
|
||||
font-style:normal;
|
||||
}
|
||||
|
||||
/* code block tweaks */
|
||||
code, tt {
|
||||
font-size: 14px;
|
||||
}
|
||||
pre {
|
||||
/* inspired by GitHub */
|
||||
padding: 0 5px;
|
||||
border: solid 1px #888;
|
||||
background: #888;
|
||||
border-radius: none;
|
||||
}
|
||||
pre code {
|
||||
background: none;
|
||||
}
|
||||
li.blockList > pre {
|
||||
font-size: 16px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: 0;
|
||||
border: 0;
|
||||
}
|
||||
div.summary code {
|
||||
background: none;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* @todo tag */
|
||||
div.todo {
|
||||
display: block;
|
||||
margin: 1em;
|
||||
border: solid 1px black;
|
||||
border-radius: 3px;
|
||||
}
|
||||
div.todoTitle {
|
||||
display: block;
|
||||
background: #f6f30d;
|
||||
padding: 5px;
|
||||
border-bottom: solid 1px black;
|
||||
}
|
||||
span.todoTitle {
|
||||
font-weight: bold;
|
||||
}
|
||||
span.todoCounter {
|
||||
float: right;
|
||||
font-size: .8em;
|
||||
}
|
||||
div.todoText {
|
||||
display: block;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
pre .comment, pre .annotation, pre .template_comment, pre .diff .header, pre .chunk, pre .markdown .blockquote {
|
||||
color: #333
|
||||
}
|
207
pom.xml
207
pom.xml
@ -39,15 +39,25 @@
|
||||
<url>http://actframework.org</url>
|
||||
</organization>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:actframework/actframework.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:actframework/actframework.git</developerConnection>
|
||||
<url>git@github.com:actframework/actframework.git</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
<scm.url>git@github.com:actframework/actframework.git</scm.url>
|
||||
|
||||
<maven-checkstyle-plugin.version>2.17</maven-checkstyle-plugin.version>
|
||||
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
|
||||
<maven-source-plugin.version>3.0.1</maven-source-plugin.version>
|
||||
<maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version>
|
||||
|
||||
<buildnumber-maven-plugin.version>1.4</buildnumber-maven-plugin.version>
|
||||
<checkstyle.version>8.1</checkstyle.version>
|
||||
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
|
||||
<errorpone-core.version>2.1.1</errorpone-core.version>
|
||||
<license-maven-plugin.version>1.13</license-maven-plugin.version>
|
||||
<markdown-doclet.version>1.4</markdown-doclet.version>
|
||||
<plexus-compiler-javac-errorprone.version>2.8.2</plexus-compiler-javac-errorprone.version>
|
||||
|
||||
<fest-assert.version>1.4</fest-assert.version>
|
||||
<junit.version>4.11</junit.version>
|
||||
@ -58,7 +68,7 @@
|
||||
<cdi-api.version>1.2</cdi-api.version>
|
||||
<commons-fileupload.version>1.3.2</commons-fileupload.version>
|
||||
<ecj.version>4.6.1</ecj.version>
|
||||
<fastjson.version>1.2.36</fastjson.version>
|
||||
<fastjson.version>1.2.38</fastjson.version>
|
||||
<bval.version>1.1.2</bval.version>
|
||||
<image4j.version>0.7</image4j.version>
|
||||
<jansi.version>1.16</jansi.version>
|
||||
@ -69,19 +79,26 @@
|
||||
<progressbar.version>0.5.5</progressbar.version>
|
||||
<joda-time.version>2.9.9</joda-time.version>
|
||||
<okhttp.version>3.8.1</okhttp.version>
|
||||
<osgl-tool.version>1.4.2-SNAPSHOT</osgl-tool.version>
|
||||
<osgl-genie.version>1.2.0-SNAPSHOT</osgl-genie.version>
|
||||
<osgl-tool.version>1.4.3</osgl-tool.version>
|
||||
<osgl-genie.version>1.2.0-BETA-2</osgl-genie.version>
|
||||
<osgl-mvc.version>1.2.0</osgl-mvc.version>
|
||||
<osgl-storage.version>1.4.1</osgl-storage.version>
|
||||
<osgl-tool-ext.version>1.0.1</osgl-tool-ext.version>
|
||||
<osgl-bootstrap.version>1.0.0-BETA-10</osgl-bootstrap.version>
|
||||
<osgl-ut.version>1.0.0-BETA-5</osgl-ut.version>
|
||||
<reflectasm.version>1.11.3</reflectasm.version>
|
||||
<rythmengine.version>1.2.0</rythmengine.version>
|
||||
<validation-api.version>1.1.0.Final</validation-api.version>
|
||||
<undertow.version>1.4.18.Final</undertow.version>
|
||||
<undertow.version>1.4.20.Final</undertow.version>
|
||||
<zxing.javase.version>3.3.0</zxing.javase.version>
|
||||
|
||||
</properties>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:${scm.url}</connection>
|
||||
<developerConnection>scm:git:${scm.url}</developerConnection>
|
||||
<url>${scm.url}</url>
|
||||
</scm>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
@ -119,10 +136,75 @@
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<compilerId>javac-with-errorprone</compilerId>
|
||||
<forceJavacCompilerUse>true</forceJavacCompilerUse>
|
||||
<source>7</source>
|
||||
<target>7</target>
|
||||
</configuration>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
||||
<version>${plexus-compiler-javac-errorprone.version}</version>
|
||||
</dependency>
|
||||
<!-- override plexus-compiler-javac-errorprone's dependency on
|
||||
Error Prone with the latest version -->
|
||||
<dependency>
|
||||
<groupId>com.google.errorprone</groupId>
|
||||
<artifactId>error_prone_core</artifactId>
|
||||
<version>${errorpone-core.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>${maven-checkstyle-plugin.version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>${checkstyle.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<encoding>UTF-8</encoding>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<failsOnError>true</failsOnError>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>checkstyle</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${cobertura-maven-plugin.version}</version>
|
||||
<configuration>
|
||||
<formats>
|
||||
<format>html</format>
|
||||
<format>xml</format>
|
||||
</formats>
|
||||
<check />
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<version>1.12</version>
|
||||
<version>${license-maven-plugin.version}</version>
|
||||
<configuration>
|
||||
<verbose>false</verbose>
|
||||
</configuration>
|
||||
@ -146,7 +228,7 @@
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<version>${buildnumber-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
@ -161,14 +243,16 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<debug>true</debug>
|
||||
<debuglevel>lines,vars,source</debuglevel>
|
||||
</configuration>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven-source-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
@ -183,12 +267,26 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit.version}</version>
|
||||
<groupId>org.osgl</groupId>
|
||||
<artifactId>osgl-ut</artifactId>
|
||||
<version>${osgl-ut.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- TODO: can't update to mockito 2.x yet. See github issue #371 -->
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>2.0.2-beta</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.osgl</groupId>
|
||||
<artifactId>osgl-bootstrap</artifactId>
|
||||
<version>${osgl-bootstrap.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.carrotsearch</groupId>
|
||||
<artifactId>junit-benchmarks</artifactId>
|
||||
@ -196,26 +294,6 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<version>${mockito-core.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
<version>${javax.inject.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<version>${cdi-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
@ -234,6 +312,12 @@
|
||||
<version>${image4j.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<version>${cdi-api.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>javase</artifactId>
|
||||
@ -376,22 +460,6 @@
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<shortRevisionLength>4</shortRevisionLength>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
@ -417,30 +485,21 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.0.0-M1</version>
|
||||
<version>${maven-javadoc-plugin.version}</version>
|
||||
<configuration>
|
||||
<doclet>ch.raffael.mddoclet.MarkdownDoclet</doclet>
|
||||
<docletArtifact>
|
||||
<groupId>ch.raffael.markdown-doclet</groupId>
|
||||
<artifactId>markdown-doclet</artifactId>
|
||||
<version>1.4</version>
|
||||
<version>${markdown-doclet.version}</version>
|
||||
</docletArtifact>
|
||||
<useStandardDocletOptions>true</useStandardDocletOptions>
|
||||
<links>
|
||||
<link>https://javadoc.io/doc/org.osgl/osgl-bootstrap/</link>
|
||||
</links>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -41,6 +41,7 @@ import act.handler.SimpleRequestHandler;
|
||||
import act.handler.builtin.controller.*;
|
||||
import act.handler.builtin.controller.impl.ReflectedHandlerInvoker;
|
||||
import act.inject.DependencyInjector;
|
||||
import act.internal.util.AppDescriptor;
|
||||
import act.job.AppJobManager;
|
||||
import act.metric.MetricPlugin;
|
||||
import act.metric.SimpleMetricPlugin;
|
||||
@ -56,6 +57,7 @@ import act.xio.Network;
|
||||
import act.xio.NetworkHandler;
|
||||
import act.xio.undertow.UndertowNetwork;
|
||||
import org.osgl.$;
|
||||
import org.osgl.bootstrap.Version;
|
||||
import org.osgl.cache.CacheService;
|
||||
import org.osgl.exception.NotAppliedException;
|
||||
import org.osgl.exception.UnexpectedException;
|
||||
@ -66,10 +68,9 @@ import org.osgl.util.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.ArrayList;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static act.Destroyable.Util.tryDestroy;
|
||||
|
||||
@ -153,35 +154,11 @@ public final class Act {
|
||||
}
|
||||
}
|
||||
|
||||
public static class AppInfo extends $.T2<String, String> {
|
||||
public AppInfo(String appName, String appVersion) {
|
||||
super(ensureAppName(appName), appVersion);
|
||||
}
|
||||
|
||||
public String appName() {
|
||||
return _1;
|
||||
}
|
||||
|
||||
public String appVersion() {
|
||||
return _2;
|
||||
}
|
||||
|
||||
private static String ensureAppName(String name) {
|
||||
return S.blank(name) ? "ActFramework" : name;
|
||||
}
|
||||
}
|
||||
|
||||
public static final String VERSION = Version.fullVersion();
|
||||
public static final org.osgl.bootstrap.Version VERSION = org.osgl.bootstrap.Version.of(Act.class);
|
||||
public static final Logger LOGGER = L.get(Act.class);
|
||||
/**
|
||||
* This field is deprecated. please use {@link #LOGGER} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static final Logger logger = LOGGER;
|
||||
private static ActConfig conf;
|
||||
private static Mode mode = Mode.PROD;
|
||||
private static String nodeGroup = "";
|
||||
private static boolean multiTenant = false;
|
||||
private static AppManager appManager;
|
||||
private static ViewManager viewManager;
|
||||
private static Network network;
|
||||
@ -195,26 +172,6 @@ public final class Act {
|
||||
private static Map<String, Plugin> genericPluginRegistry = C.newMap();
|
||||
private static Map<Class<? extends ActEvent>, List<ActEventListener>> listeners = C.newMap();
|
||||
|
||||
public static List<Class<?>> pluginClasses() {
|
||||
ClassLoader cl = Act.class.getClassLoader();
|
||||
if (cl instanceof PluginClassProvider) {
|
||||
return ((PluginClassProvider) cl).pluginClasses();
|
||||
} else {
|
||||
LOGGER.warn("Class loader [%s] of Act is not a PluginClassProvider", cl);
|
||||
return C.list();
|
||||
}
|
||||
}
|
||||
|
||||
public static ClassInfoRepository classInfoRepository() {
|
||||
ClassLoader cl = Act.class.getClassLoader();
|
||||
if (cl instanceof BootstrapClassLoader) {
|
||||
return ((BootstrapClassLoader) cl).classInfoRepository();
|
||||
} else {
|
||||
LOGGER.warn("Class loader [%s] of Act is not a ActClassLoader", cl);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Mode mode() {
|
||||
return mode;
|
||||
}
|
||||
@ -242,8 +199,32 @@ public final class Act {
|
||||
return conf;
|
||||
}
|
||||
|
||||
public static boolean multiTenant() {
|
||||
return multiTenant;
|
||||
public static ClassInfoRepository classInfoRepository() {
|
||||
ClassLoader cl = Act.class.getClassLoader();
|
||||
if (cl instanceof BootstrapClassLoader) {
|
||||
return ((BootstrapClassLoader) cl).classInfoRepository();
|
||||
} else {
|
||||
LOGGER.warn("Class loader [%s] of Act is not a ActClassLoader", cl);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Class<?>> pluginClasses() {
|
||||
ClassLoader cl = Act.class.getClassLoader();
|
||||
if (cl instanceof PluginClassProvider) {
|
||||
return ((PluginClassProvider) cl).pluginClasses();
|
||||
} else {
|
||||
LOGGER.warn("Class loader [%s] of Act is not a PluginClassProvider", cl);
|
||||
return C.list();
|
||||
}
|
||||
}
|
||||
|
||||
public static AppServicePluginManager appServicePluginManager() {
|
||||
return appPluginManager;
|
||||
}
|
||||
|
||||
public static DbManager dbManager() {
|
||||
return dbManager;
|
||||
}
|
||||
|
||||
public static BytecodeEnhancerManager enhancerManager() {
|
||||
@ -254,32 +235,28 @@ public final class Act {
|
||||
return pluginManager;
|
||||
}
|
||||
|
||||
public static DbManager dbManager() {
|
||||
return dbManager;
|
||||
}
|
||||
|
||||
public static ViewManager viewManager() {
|
||||
return viewManager;
|
||||
}
|
||||
|
||||
public static SessionManager sessionManager() {
|
||||
return sessionManager;
|
||||
public static MetricPlugin metricPlugin() {
|
||||
return metricPlugin;
|
||||
}
|
||||
|
||||
public static AppCodeScannerPluginManager scannerPluginManager() {
|
||||
return scannerPluginManager;
|
||||
}
|
||||
|
||||
public static AppServicePluginManager appServicePluginManager() {
|
||||
return appPluginManager;
|
||||
public static SessionManager sessionManager() {
|
||||
return sessionManager;
|
||||
}
|
||||
|
||||
public static AppManager applicationManager() {
|
||||
return appManager;
|
||||
}
|
||||
|
||||
public static MetricPlugin metricPlugin() {
|
||||
return metricPlugin;
|
||||
public static ViewManager viewManager() {
|
||||
return viewManager;
|
||||
}
|
||||
|
||||
public static Network network() {
|
||||
return network;
|
||||
}
|
||||
|
||||
public static void registerPlugin(Plugin plugin) {
|
||||
@ -291,57 +268,14 @@ public final class Act {
|
||||
return (T) genericPluginRegistry.get(type.getCanonicalName().intern());
|
||||
}
|
||||
|
||||
public static void startServer() {
|
||||
start(false, null, null);
|
||||
}
|
||||
|
||||
public static void startApp(String appName, String appVersion) {
|
||||
String s = System.getProperty("app.mode");
|
||||
if (null != s) {
|
||||
mode = Mode.valueOfIgnoreCase(s);
|
||||
} else {
|
||||
String profile = SysProps.get(AppConfigKey.PROFILE.key());
|
||||
mode = S.neq("prod", profile, S.IGNORECASE) ? Mode.DEV : Mode.PROD;
|
||||
}
|
||||
s = System.getProperty("app.nodeGroup");
|
||||
if (null != s) {
|
||||
nodeGroup = s;
|
||||
}
|
||||
start(true, appName, appVersion);
|
||||
}
|
||||
|
||||
public static void shutdownApp(App app) {
|
||||
if (null == appManager) {
|
||||
return;
|
||||
}
|
||||
if (!appManager.unload(app)) {
|
||||
app.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private static final ThreadLocal<AppInfo> APP_INFO = new ThreadLocal<>();
|
||||
public static AppInfo appInfo() {
|
||||
return APP_INFO.get();
|
||||
}
|
||||
public static String appName() {
|
||||
return appInfo().appName();
|
||||
}
|
||||
public static String appVersion() {
|
||||
return appInfo().appVersion();
|
||||
}
|
||||
public static String actVersion() {
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
private static void start(boolean singleAppServer, String appName, String appVersion) {
|
||||
APP_INFO.set(new AppInfo(appName, appVersion));
|
||||
Banner.print();
|
||||
public static void startup(AppDescriptor descriptor) {
|
||||
processEnvironment();
|
||||
Banner.print(descriptor);
|
||||
loadConfig();
|
||||
initMetricPlugin();
|
||||
initPluginManager();
|
||||
initAppServicePluginManager();
|
||||
initDbManager();
|
||||
//initExecuteService();
|
||||
initEnhancerManager();
|
||||
initViewManager();
|
||||
initSessionManager();
|
||||
@ -350,11 +284,7 @@ public final class Act {
|
||||
initNetworkLayer();
|
||||
initApplicationManager();
|
||||
LOGGER.info("loading application(s) ...");
|
||||
if (singleAppServer) {
|
||||
appManager.loadSingleApp(appName);
|
||||
} else {
|
||||
appManager.scan();
|
||||
}
|
||||
appManager.loadSingleApp(descriptor);
|
||||
startNetworkLayer();
|
||||
Thread.currentThread().setContextClassLoader(Act.class.getClassLoader());
|
||||
App app = app();
|
||||
@ -366,21 +296,14 @@ public final class Act {
|
||||
writePidFile();
|
||||
}
|
||||
|
||||
public static void shutdown() {
|
||||
clearPidFile();
|
||||
shutdownNetworkLayer();
|
||||
destroyApplicationManager();
|
||||
unloadPlugins();
|
||||
destroyAppCodeScannerPluginManager();
|
||||
destroySessionManager();
|
||||
destroyViewManager();
|
||||
destroyEnhancerManager();
|
||||
destroyDbManager();
|
||||
destroyAppServicePluginManager();
|
||||
destroyPluginManager();
|
||||
destroyMetricPlugin();
|
||||
unloadConfig();
|
||||
destroyNetworkLayer();
|
||||
public static void shutdown(App app) {
|
||||
if (null == appManager) {
|
||||
return;
|
||||
}
|
||||
if (!appManager.unload(app)) {
|
||||
app.destroy();
|
||||
}
|
||||
shutdownAct();
|
||||
}
|
||||
|
||||
public static RequestServerRestart requestRestart() {
|
||||
@ -457,6 +380,16 @@ public final class Act {
|
||||
return App.instance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the app version
|
||||
*
|
||||
* @return
|
||||
* the app version
|
||||
*/
|
||||
public static Version appVersion() {
|
||||
return app().version();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the {@link App}'s config
|
||||
*
|
||||
@ -467,12 +400,15 @@ public final class Act {
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility method to retrieve singleton instance via {@link App#singleton(Class)} method
|
||||
* Utility method to retrieve singleton instance via {@link App#singleton(Class)} method.
|
||||
*
|
||||
* This method is deprecated. Please use {@link #getInstance(Class)} instead
|
||||
*
|
||||
* @param singletonClass
|
||||
* @param <T>
|
||||
* @return the singleton instance
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> T singleton(Class<T> singletonClass) {
|
||||
return App.instance().singleton(singletonClass);
|
||||
}
|
||||
@ -542,14 +478,6 @@ public final class Act {
|
||||
return app().classForName(className);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is obsolete. Please use {@link #getInstance(String)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> T newInstance(String className) {
|
||||
return App.instance().getInstance(className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance with give class name
|
||||
*
|
||||
@ -561,14 +489,6 @@ public final class Act {
|
||||
return app().getInstance(className);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is obsolete. Please use {@link #getInstance(Class)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T> T newInstance(Class<T> clz) {
|
||||
return App.instance().getInstance(clz);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an instance with give class
|
||||
*
|
||||
@ -580,10 +500,6 @@ public final class Act {
|
||||
return app().getInstance(clz);
|
||||
}
|
||||
|
||||
public static int classCacheSize() {
|
||||
return ((FullStackAppBootstrapClassLoader) Act.class.getClassLoader()).libBCSize();
|
||||
}
|
||||
|
||||
// --- Spark style API for application to hook action handler to a certain http request endpoint
|
||||
|
||||
public static void get(String url, SimpleRequestHandler handler) {
|
||||
@ -622,97 +538,122 @@ public final class Act {
|
||||
app().router().addMapping(H.Method.DELETE, url, handler, RouteSource.APP_CONFIG);
|
||||
}
|
||||
|
||||
// --- ActFramework entry methods
|
||||
|
||||
/**
|
||||
* Start the application without specifying application name and use the entry class to find the scan package
|
||||
* Start Act application
|
||||
*
|
||||
* The main entry class's {@link Class#getSimpleName()} will be used as the application's name
|
||||
*
|
||||
* @throws Exception any exception raised during app start
|
||||
* @throws Exception
|
||||
* any exception raised during app start
|
||||
*/
|
||||
public static void start() throws Exception {
|
||||
String className = exploreClassName();
|
||||
$.Var<String> appNameHolder = $.var();
|
||||
$.Var<String> pkgNameHolder = $.var();
|
||||
getAppNameAndPackage(className, appNameHolder, pkgNameHolder);
|
||||
RunApp.start(appNameHolder.get(), Version.appVersion(appNameHolder.get()), pkgNameHolder.get());
|
||||
}
|
||||
|
||||
public static Network network() {
|
||||
return network;
|
||||
bootstrap(AppDescriptor.of(getCallerClass()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Act application with specified app name and use the entry class to
|
||||
* find the scan package
|
||||
* Start Act application with specified app name
|
||||
*
|
||||
* @param appName the app name
|
||||
* @throws Exception any exception thrown out
|
||||
* @param appName
|
||||
* the app name, optional
|
||||
* @throws Exception
|
||||
* any exception thrown out
|
||||
*/
|
||||
public static void start(final String appName) throws Exception {
|
||||
String className = exploreClassName();
|
||||
$.Var<String> appNameHolder = $.var(appName);
|
||||
$.Var<String> pkgNameHolder = $.var();
|
||||
if (S.blank(appName)) {
|
||||
getAppNameAndPackage(className, appNameHolder, pkgNameHolder);
|
||||
} else {
|
||||
pkgNameHolder.set(getPackageName(className));
|
||||
}
|
||||
RunApp.start(appNameHolder.get(), Version.appVersion(appNameHolder.get()), pkgNameHolder.get());
|
||||
bootstrap(AppDescriptor.of(appName, getCallerClass()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Act application with specified name and scan package
|
||||
* @param appName the app name
|
||||
* @param scanPackage the scan package, the package could be separated by {@link Constants#LIST_SEPARATOR}
|
||||
* @throws Exception any exception raised during act start up
|
||||
* Start Act application with specified app name and scan package.
|
||||
*
|
||||
* If there are multiple packages, they should be joined in a single string
|
||||
* by comma `,`. And the first package name will be used to explore the
|
||||
* `.version` file in the class path
|
||||
*
|
||||
* @param appName
|
||||
* the app name, optional
|
||||
* @param scanPackage
|
||||
* the scan package
|
||||
* @throws Exception
|
||||
* any exception raised during act start up
|
||||
*/
|
||||
public static void start(String appName, String scanPackage) throws Exception {
|
||||
RunApp.start(appName, Version.appVersion(appName), scanPackage);
|
||||
bootstrap(AppDescriptor.of(appName, scanPackage));
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Act application with specified name and scan package specified by a class
|
||||
* @param appName the app name
|
||||
* @param anyAppClass specifies the scan package
|
||||
* @throws Exception any exception raised during act start up
|
||||
*
|
||||
* @param appName
|
||||
* the app name
|
||||
* @param anyAppClass
|
||||
* specifies the scan package
|
||||
* @throws Exception
|
||||
* any exception raised during act start up
|
||||
*/
|
||||
public static void start(String appName, Class<?> anyAppClass) throws Exception {
|
||||
RunApp.start(appName, Version.appVersion(appName), anyAppClass);
|
||||
bootstrap(AppDescriptor.of(appName, anyAppClass));
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Act application with no app name and scan package specified by a class
|
||||
* @param anyAppClass specifies the scan package
|
||||
* @throws Exception any exception raised during act start up
|
||||
* Start Act application with scan package specified by a class
|
||||
*
|
||||
* @param anyAppClass
|
||||
* specifies the scan package
|
||||
* @throws Exception
|
||||
* any exception raised during act start up
|
||||
*/
|
||||
public static void start(Class<?> anyAppClass) throws Exception {
|
||||
String className = anyAppClass.getName();
|
||||
$.Var<String> appNameHolder = $.var();
|
||||
$.Var<String> pkgNameHolder = $.var();
|
||||
getAppNameAndPackage(className, appNameHolder, pkgNameHolder);
|
||||
RunApp.start(appNameHolder.get(), Version.appVersion(appNameHolder.get()), pkgNameHolder.get());
|
||||
bootstrap(AppDescriptor.of(anyAppClass));
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Act application with specified name and scan package specified by a class
|
||||
* @param appName the app name
|
||||
* @param appVersion the app version tag
|
||||
* @param anyAppClass specifies the scan package
|
||||
* @throws Exception any exception raised during act start up
|
||||
* Start Act application with specified app name, app version and
|
||||
* scan page via an app class
|
||||
*
|
||||
* @param appName
|
||||
* the app name
|
||||
* @param anyAppClass
|
||||
* specifies the scan package
|
||||
* @param appVersion
|
||||
* the app version tag
|
||||
* @throws Exception
|
||||
* any exception raised during act start up
|
||||
*/
|
||||
public static void start(String appName, String appVersion, Class<?> anyAppClass) throws Exception {
|
||||
RunApp.start(appName, appVersion, anyAppClass);
|
||||
public static void start(String appName, Class<?> anyAppClass, Version appVersion) throws Exception {
|
||||
bootstrap(AppDescriptor.of(appName, anyAppClass, appVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Act application with specified name and scan package
|
||||
* @param appName the app name
|
||||
* @param appVersion the app version tag
|
||||
* @param scanPackage the scan package, the package could be separated by {@link Constants#LIST_SEPARATOR}
|
||||
* Start Act application with specified app name, app version and scan package
|
||||
*
|
||||
* @param appName
|
||||
* the app name
|
||||
* @param scanPackage
|
||||
* the scan package, the package could be separated by {@link Constants#LIST_SEPARATOR}
|
||||
* @param appVersion
|
||||
* the app version tag
|
||||
* @throws Exception any exception raised during act start up
|
||||
*/
|
||||
public static void start(String appName, String appVersion, String scanPackage) throws Exception {
|
||||
RunApp.start(appName, appVersion, scanPackage);
|
||||
public static void start(String appName, String scanPackage, Version appVersion) throws Exception {
|
||||
bootstrap(AppDescriptor.of(appName, scanPackage, appVersion));
|
||||
}
|
||||
|
||||
static int classCacheSize() {
|
||||
return ((FullStackAppBootstrapClassLoader) Act.class.getClassLoader()).libBCSize();
|
||||
}
|
||||
|
||||
private static void processEnvironment() {
|
||||
String s = System.getProperty("app.mode");
|
||||
if (null != s) {
|
||||
mode = Mode.valueOfIgnoreCase(s);
|
||||
} else {
|
||||
String profile = SysProps.get(AppConfigKey.PROFILE.key());
|
||||
mode = S.neq("prod", profile, S.IGNORECASE) ? Mode.DEV : Mode.PROD;
|
||||
}
|
||||
s = System.getProperty("app.nodeGroup");
|
||||
if (null != s) {
|
||||
nodeGroup = s;
|
||||
}
|
||||
}
|
||||
|
||||
private static void loadConfig() {
|
||||
@ -868,57 +809,57 @@ public final class Act {
|
||||
appManager = AppManager.create();
|
||||
}
|
||||
|
||||
private static String getPackageName(Class<?> theClass, Package thePackage) {
|
||||
if (null != thePackage) {
|
||||
return thePackage.getName();
|
||||
} else {
|
||||
String className = theClass.getName();
|
||||
E.unexpectedIf(!className.contains("."), "The main class must have package name to use Act");
|
||||
return (S.beforeLast(theClass.getName(), "."));
|
||||
}
|
||||
}
|
||||
|
||||
static String getPackageName(String className) {
|
||||
Class mainClass = $.classForName(className);
|
||||
while (null != mainClass.getEnclosingClass()) {
|
||||
mainClass = mainClass.getEnclosingClass();
|
||||
}
|
||||
Package pkg = mainClass.getPackage();
|
||||
return getPackageName(mainClass, pkg);
|
||||
}
|
||||
|
||||
static String exploreClassName() {
|
||||
private static Class<?> getCallerClass() {
|
||||
StackTraceElement[] sa = new RuntimeException().getStackTrace();
|
||||
E.unexpectedIf(sa.length < 3, "Whoops!");
|
||||
StackTraceElement ste = sa[2];
|
||||
String className = ste.getClassName();
|
||||
E.unexpectedIf(!className.contains("."), "The main class must have package name to use Act");
|
||||
return className;
|
||||
return $.classForName(className);
|
||||
}
|
||||
|
||||
static void getAppNameAndPackage(String className, $.Var<String> appNameHolder, $.Var<String> packageHolder) {
|
||||
C.List<String> nameList = C.newList();
|
||||
Class mainClass = $.classForName(className);
|
||||
nameList.addAll(classNameTokensReversed(mainClass));
|
||||
while (null != mainClass.getEnclosingClass()) {
|
||||
mainClass = mainClass.getEnclosingClass();
|
||||
nameList.addAll(classNameTokensReversed(mainClass));
|
||||
private static void bootstrap(AppDescriptor appDescriptor) throws Exception {
|
||||
long ts = $.ms();
|
||||
String profile = SysProps.get(AppConfigKey.PROFILE.key());
|
||||
if (S.blank(profile)) {
|
||||
profile = "";
|
||||
} else {
|
||||
profile = "using profile[" + profile + "]";
|
||||
}
|
||||
Package pkg = mainClass.getPackage();
|
||||
String pkgName = getPackageName(mainClass, pkg);
|
||||
packageHolder.set(pkgName);
|
||||
nameList = filterNoise(nameList).reverse();
|
||||
if (nameList.isEmpty()) {
|
||||
// app name is all noise, let's fall back to the package names
|
||||
nameList = C.list(Keyword.of(pkgName).tokens());
|
||||
if (nameList.size() > 1) {
|
||||
nameList = nameList.drop(1);
|
||||
}
|
||||
String packageName = appDescriptor.getPackageName();
|
||||
LOGGER.debug("run fullstack application with package[%s] %s", packageName, profile);
|
||||
final String SCAN_PACKAGE = AppConfigKey.SCAN_PACKAGE.key();
|
||||
if (S.notBlank(packageName)) {
|
||||
System.setProperty(SCAN_PACKAGE, packageName);
|
||||
}
|
||||
String appNameChain = S.join(".", nameList);
|
||||
appNameHolder.set(Keyword.of(appNameChain).header());
|
||||
FullStackAppBootstrapClassLoader classLoader = new FullStackAppBootstrapClassLoader(RunApp.class.getClassLoader());
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
Class<?> actClass = classLoader.loadClass("act.Act");
|
||||
Method m = actClass.getDeclaredMethod("startup", byte[].class);
|
||||
m.setAccessible(true);
|
||||
$.invokeStatic(m, appDescriptor.toByteArray());
|
||||
LOGGER.info("it takes %sms to start the app\n", $.ms() - ts);
|
||||
}
|
||||
|
||||
|
||||
private static void shutdownAct() {
|
||||
clearPidFile();
|
||||
shutdownNetworkLayer();
|
||||
destroyApplicationManager();
|
||||
unloadPlugins();
|
||||
destroyAppCodeScannerPluginManager();
|
||||
destroySessionManager();
|
||||
destroyViewManager();
|
||||
destroyEnhancerManager();
|
||||
destroyDbManager();
|
||||
destroyAppServicePluginManager();
|
||||
destroyPluginManager();
|
||||
destroyMetricPlugin();
|
||||
unloadConfig();
|
||||
destroyNetworkLayer();
|
||||
}
|
||||
|
||||
|
||||
private static void destroyApplicationManager() {
|
||||
if (null != appManager) {
|
||||
appManager.destroy();
|
||||
@ -926,10 +867,6 @@ public final class Act {
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> classNameTokensReversed(Class theClass) {
|
||||
return C.list(Keyword.of(theClass.getSimpleName()).tokens()).reverse();
|
||||
}
|
||||
|
||||
private static void writePidFile() {
|
||||
String pidFile = pidFile();
|
||||
OS os = OS.get();
|
||||
@ -985,23 +922,12 @@ public final class Act {
|
||||
return pidFile;
|
||||
}
|
||||
|
||||
private static final Set<String> NOISE_WORDS = C.set(
|
||||
"app", "application", "demo", "entry", "main");
|
||||
|
||||
private static C.List<String> filterNoise(List<String> appNameTokens) {
|
||||
C.List<String> result = C.newList();
|
||||
for (String token : appNameTokens) {
|
||||
if (S.blank(token)) {
|
||||
continue;
|
||||
}
|
||||
token = token.trim().toLowerCase();
|
||||
if (!NOISE_WORDS.contains(token)) {
|
||||
result.add(token);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
private static void startup(byte[] appDescriptor) {
|
||||
AppDescriptor descriptor = AppDescriptor.deserializeFrom(appDescriptor);
|
||||
startup(descriptor);
|
||||
}
|
||||
|
||||
|
||||
public enum F {
|
||||
;
|
||||
public static final $.F0<Mode> MODE_ACCESSOR = new $.F0<Mode>() {
|
||||
|
@ -40,7 +40,7 @@ public class ActAdmin {
|
||||
public void shutdown(CliContext context) {
|
||||
context.println(context._act_i18n("cli.shutdown"));
|
||||
context.flush();
|
||||
Act.shutdownApp(context.app());
|
||||
Act.shutdown(context.app());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ public class Info {
|
||||
@GetAction("info")
|
||||
public static Object show(ActionContext context, App app) {
|
||||
if (context.acceptJson()) {
|
||||
String actVersion = Version.version();
|
||||
String appVersion = Version.appVersion(app.name());
|
||||
String actVersion = Act.VERSION.getVersion();
|
||||
String appVersion = Act.appVersion().getVersion();
|
||||
String appName = app.name();
|
||||
String pid = Env.PID.get();
|
||||
String baseDir = app.base().getAbsolutePath();
|
||||
|
@ -119,7 +119,7 @@ public class SysUtilAdmin {
|
||||
|
||||
@Command(name = "act.version, act.ver", help = "Print actframework version")
|
||||
public String version() {
|
||||
return Version.fullVersion().replace("-S-", "-SNAPSHOT-");
|
||||
return Act.VERSION.toString();
|
||||
}
|
||||
|
||||
@Command(name = "act.pwd", help = "Print name of the current working directory")
|
||||
|
@ -1,108 +0,0 @@
|
||||
package act;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* ACT Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 ActFramework
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.osgl.util.E;
|
||||
import org.osgl.util.IO;
|
||||
import org.osgl.util.Keyword;
|
||||
import org.osgl.util.S;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Stores the act version and build number
|
||||
*/
|
||||
public class Version {
|
||||
private static boolean snapshot;
|
||||
private static String version;
|
||||
private static String buildNumber;
|
||||
private static String appVersion;
|
||||
|
||||
static {
|
||||
Properties p = new Properties();
|
||||
try {
|
||||
p.load(Version.class.getResourceAsStream("/act.version"));
|
||||
version = p.getProperty("version");
|
||||
if (version.endsWith("SNAPSHOT")) {
|
||||
version = "v" + version.replace("-SNAPSHOT", "");
|
||||
snapshot = true;
|
||||
} else {
|
||||
version = "R" + version;
|
||||
}
|
||||
buildNumber = p.getProperty("build");
|
||||
} catch (IOException e) {
|
||||
throw E.ioException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean snapshot() {
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
public static String version() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public static String buildNumber() {
|
||||
return buildNumber;
|
||||
}
|
||||
|
||||
public static String fullVersion() {
|
||||
return S.fmt("%s-%s", version, buildNumber);
|
||||
}
|
||||
|
||||
public synchronized static String appVersion(String appName) {
|
||||
final String UNKNOWN = "unknown";
|
||||
if (null == appVersion) {
|
||||
URL url = appVersionData(appName);
|
||||
if (null != url) {
|
||||
try {
|
||||
Properties p = IO.loadProperties(IO.is(url));
|
||||
String version = p.getProperty("version");
|
||||
String buildNum = p.getProperty("build");
|
||||
if (S.blank(version)) {
|
||||
appVersion = S.blank(buildNum) ? UNKNOWN : buildNum;
|
||||
} else {
|
||||
appVersion = S.blank(buildNum) ? version : version + '-' + buildNum;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null == appVersion) {
|
||||
appVersion = UNKNOWN;
|
||||
}
|
||||
return appVersion;
|
||||
}
|
||||
|
||||
private static URL appVersionData(String appName) {
|
||||
String path = "/" + Keyword.of(appName).dashed() + ".version";
|
||||
URL url = Version.class.getResource(path);
|
||||
if (null == url) {
|
||||
url = Version.class.getResource("/app.version");
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
}
|
@ -356,15 +356,13 @@ public class ActionContext extends ActContext.Base<ActionContext> implements Des
|
||||
return new String[]{val};
|
||||
}
|
||||
String[] sa = request.paramVals(name);
|
||||
if (null == sa) {
|
||||
sa = getBody(name);
|
||||
}
|
||||
return sa;
|
||||
return null == sa ? getBody(name) : sa;
|
||||
}
|
||||
|
||||
private String[] getBody(String name) {
|
||||
Map<String, String[]> body = bodyParams();
|
||||
return body.get(name);
|
||||
String[] sa = body.get(name);
|
||||
return null == sa ? new String[0] : sa;
|
||||
}
|
||||
|
||||
private Map<String, String[]> bodyParams() {
|
||||
|
@ -70,6 +70,7 @@ import act.ws.SecureTicketHandler;
|
||||
import act.ws.WebSocketConnectionManager;
|
||||
import org.osgl.$;
|
||||
import org.osgl.Osgl;
|
||||
import org.osgl.bootstrap.Version;
|
||||
import org.osgl.cache.CacheService;
|
||||
import org.osgl.http.H;
|
||||
import org.osgl.http.HttpConfig;
|
||||
@ -98,11 +99,6 @@ public class App extends DestroyableBase {
|
||||
void preHotReload();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static final Logger logger = Act.LOGGER;
|
||||
|
||||
public static final Logger LOGGER = Act.LOGGER;
|
||||
|
||||
private static App INST;
|
||||
|
||||
public enum F {
|
||||
@ -162,18 +158,16 @@ public class App extends DestroyableBase {
|
||||
blockIssue.apply(context.req(), context.resp());
|
||||
}
|
||||
};
|
||||
private final Version version;
|
||||
private List<HotReloadListener> hotReloadListeners = new ArrayList<>();
|
||||
|
||||
protected App() {
|
||||
INST = this;
|
||||
protected App(File appBase, Version version, ProjectLayout layout) {
|
||||
this("MyApp", version, appBase, layout);
|
||||
}
|
||||
|
||||
protected App(File appBase, ProjectLayout layout) {
|
||||
this("MyApp", appBase, layout);
|
||||
}
|
||||
|
||||
protected App(String name, File appBase, ProjectLayout layout) {
|
||||
protected App(String name, Version version, File appBase, ProjectLayout layout) {
|
||||
this.name(name);
|
||||
this.version = version;
|
||||
this.appBase = appBase;
|
||||
this.layout = layout;
|
||||
this.appHome = RuntimeDirs.home(this);
|
||||
@ -198,6 +192,15 @@ public class App extends DestroyableBase {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the app version
|
||||
* @return
|
||||
* the app version
|
||||
*/
|
||||
public Version version() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns short id which is derived from passed in app name.
|
||||
*
|
||||
@ -437,7 +440,7 @@ public class App extends DestroyableBase {
|
||||
}
|
||||
|
||||
public synchronized void setBlockIssue(Throwable e) {
|
||||
LOGGER.fatal(e, "Block issue encountered");
|
||||
logger.fatal(e, "Block issue encountered");
|
||||
if (null != blockIssue || null != blockIssueCause) {
|
||||
// do not overwrite previous block issue
|
||||
return;
|
||||
@ -478,7 +481,7 @@ public class App extends DestroyableBase {
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
Act.shutdownApp(this);
|
||||
Act.shutdown(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -489,7 +492,7 @@ public class App extends DestroyableBase {
|
||||
if (null == daemonRegistry) {
|
||||
return;
|
||||
}
|
||||
LOGGER.info("App shutting down ....");
|
||||
logger.info("App shutting down ....");
|
||||
for (HotReloadListener listener : hotReloadListeners) {
|
||||
listener.preHotReload();
|
||||
}
|
||||
@ -532,7 +535,7 @@ public class App extends DestroyableBase {
|
||||
public synchronized void refresh() {
|
||||
currentState = null;
|
||||
final long ms = $.ms();
|
||||
LOGGER.info("App starting ....");
|
||||
logger.info("App starting ....");
|
||||
profile = null;
|
||||
blockIssue = null;
|
||||
blockIssueCause = null;
|
||||
@ -648,7 +651,7 @@ public class App extends DestroyableBase {
|
||||
emit(STATELESS_PROVISIONED);
|
||||
emit(START);
|
||||
daemonKeeper();
|
||||
LOGGER.info("App[%s] loaded in %sms", name(), $.ms() - ms);
|
||||
logger.info("App[%s] loaded in %sms", name(), $.ms() - ms);
|
||||
emit(POST_START);
|
||||
}
|
||||
};
|
||||
@ -661,7 +664,6 @@ public class App extends DestroyableBase {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -944,8 +946,8 @@ public class App extends DestroyableBase {
|
||||
}
|
||||
|
||||
public void emit(AppEventId appEvent) {
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace(S.concat("emitting event: ", appEvent.name()));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(S.concat("emitting event: ", appEvent.name()));
|
||||
}
|
||||
currentState = appEvent;
|
||||
eventEmitted().add(appEvent);
|
||||
@ -974,7 +976,7 @@ public class App extends DestroyableBase {
|
||||
private void loadConfig() {
|
||||
JsonUtilConfig.configure(this);
|
||||
File resource = RuntimeDirs.resource(this);
|
||||
LOGGER.debug("loading app configuration: %s ...", appBase.getAbsolutePath());
|
||||
logger.debug("loading app configuration: %s ...", appBase.getAbsolutePath());
|
||||
config = new AppConfLoader().load(resource);
|
||||
config.app(this);
|
||||
configureLoggingLevels();
|
||||
@ -1074,7 +1076,7 @@ public class App extends DestroyableBase {
|
||||
try {
|
||||
daemon.start();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error(e, "Error starting daemon [%s]", daemon.id());
|
||||
logger.error(e, "Error starting daemon [%s]", daemon.id());
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1228,13 +1230,13 @@ public class App extends DestroyableBase {
|
||||
if (null == di) {
|
||||
new GenieInjector(this);
|
||||
} else {
|
||||
LOGGER.warn("Third party injector[%s] loaded. Please consider using Act air injection instead", di.getClass());
|
||||
logger.warn("Third party injector[%s] loaded. Please consider using Act air injection instead", di.getClass());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadRoutes() {
|
||||
loadBuiltInRoutes();
|
||||
LOGGER.debug("loading app routing table: %s ...", appBase.getPath());
|
||||
logger.debug("loading app routing table: %s ...", appBase.getPath());
|
||||
List<File> routes;
|
||||
if (Act.isProd()) {
|
||||
routes = RuntimeDirs.routes(this);
|
||||
@ -1344,8 +1346,8 @@ public class App extends DestroyableBase {
|
||||
classLoader().scan();
|
||||
}
|
||||
|
||||
static App create(File appBase, ProjectLayout layout) {
|
||||
return new App(appBase, layout);
|
||||
static App create(File appBase, Version version, ProjectLayout layout) {
|
||||
return new App(appBase, version, layout);
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,10 +21,9 @@ package act.app;
|
||||
*/
|
||||
|
||||
import act.Act;
|
||||
import act.internal.util.AppDescriptor;
|
||||
import act.util.DestroyableBase;
|
||||
import org.osgl.$;
|
||||
import org.osgl.logging.LogManager;
|
||||
import org.osgl.logging.Logger;
|
||||
import org.osgl.util.C;
|
||||
import org.osgl.util.E;
|
||||
|
||||
@ -36,11 +35,11 @@ import static act.Destroyable.Util.tryDestroyAll;
|
||||
|
||||
/**
|
||||
* Manage applications deployed on Act
|
||||
*
|
||||
* TODO: get rid of multi-tenant support
|
||||
*/
|
||||
public class AppManager extends DestroyableBase {
|
||||
|
||||
private static Logger logger = LogManager.get(AppManager.class);
|
||||
|
||||
private Map<Integer, App> byPort = C.newMap();
|
||||
|
||||
private AppManager() {
|
||||
@ -52,13 +51,8 @@ public class AppManager extends DestroyableBase {
|
||||
byPort = null;
|
||||
}
|
||||
|
||||
public AppManager scan() {
|
||||
Act.mode().appScanner().scan(null, _F.loadApp(this));
|
||||
return this;
|
||||
}
|
||||
|
||||
public AppManager loadSingleApp(String name) {
|
||||
AppScanner.SINGLE_APP_SCANNER.scan(name, _F.loadApp(this));
|
||||
public AppManager loadSingleApp(AppDescriptor descriptor) {
|
||||
AppScanner.SINGLE_APP_SCANNER.scan(descriptor, _F.loadApp(this));
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -88,11 +82,7 @@ public class AppManager extends DestroyableBase {
|
||||
}
|
||||
|
||||
public boolean unload(App app) {
|
||||
boolean b = unloadApp(app, byPort);
|
||||
if (byPort.isEmpty()) {
|
||||
Act.shutdown();
|
||||
}
|
||||
return b;
|
||||
return unloadApp(app, byPort);
|
||||
}
|
||||
|
||||
private boolean unloadApp(App app, Map<?, App> map) {
|
||||
@ -154,7 +144,7 @@ public class AppManager extends DestroyableBase {
|
||||
try {
|
||||
mgr.load(app);
|
||||
} catch (RuntimeException e) {
|
||||
Act.shutdownApp(app);
|
||||
Act.shutdown(app);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package act.app;
|
||||
*/
|
||||
|
||||
import act.Act;
|
||||
import act.internal.util.AppDescriptor;
|
||||
import org.osgl.$;
|
||||
import org.osgl.logging.L;
|
||||
import org.osgl.logging.Logger;
|
||||
@ -66,12 +67,12 @@ public class AppScanner {
|
||||
return buildFileProbeMap.size() + projectLayoutProbes.size();
|
||||
}
|
||||
|
||||
void scan(String appName, $.Func1<App, ?> callback) {
|
||||
void scan(AppDescriptor descriptor, $.Func1<App, ?> callback) {
|
||||
File[] appBases = appBases();
|
||||
int size = appBases.length;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
File appBase = appBases[i];
|
||||
scan(appName, appBase, callback);
|
||||
scan(descriptor, appBase, callback);
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,16 +81,16 @@ public class AppScanner {
|
||||
return appBase.listFiles();
|
||||
}
|
||||
|
||||
private void scan(String appName, File appBase, $.Func1<App, ?> callback) {
|
||||
private void scan(AppDescriptor descriptor, File appBase, $.Func1<App, ?> callback) {
|
||||
App app;
|
||||
ProjectLayout layout = probe(appBase);
|
||||
if (null == layout && !Act.isDev()) {
|
||||
layout = ProjectLayout.PredefinedLayout.PKG;
|
||||
}
|
||||
if (null != layout) {
|
||||
app = App.create(appBase, layout);
|
||||
if (null != appName) {
|
||||
app.name(appName);
|
||||
app = App.create(appBase, descriptor.getVersion(), layout);
|
||||
if (null != descriptor.getAppName()) {
|
||||
app.name(descriptor.getAppName());
|
||||
}
|
||||
callback.apply(app);
|
||||
} else {
|
||||
|
@ -27,8 +27,6 @@ import org.osgl.util.C;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static act.app.App.LOGGER;
|
||||
|
||||
/**
|
||||
* The base implementation of {@link Daemon}
|
||||
*/
|
||||
@ -68,7 +66,7 @@ public abstract class DaemonBase extends SingletonBase implements Daemon {
|
||||
synchronized (this) {
|
||||
setState(State.STARTED);
|
||||
}
|
||||
LOGGER.info("Daemon[%s] started", id());
|
||||
info("Daemon[%s] started", id());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -88,7 +86,7 @@ public abstract class DaemonBase extends SingletonBase implements Daemon {
|
||||
synchronized (this){
|
||||
setState(State.STOPPED);
|
||||
}
|
||||
LOGGER.info("Daemon[%s] stopped", id());
|
||||
info("Daemon[%s] stopped", id());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -172,7 +170,7 @@ public abstract class DaemonBase extends SingletonBase implements Daemon {
|
||||
protected synchronized void onException(Exception e, String message, Object... args) {
|
||||
this.lastError = e;
|
||||
setState(errorState(e));
|
||||
LOGGER.error(e, message, args);
|
||||
error(e, message, args);
|
||||
}
|
||||
|
||||
private State errorState(Exception e) {
|
||||
|
@ -21,13 +21,8 @@ package act.boot.app;
|
||||
*/
|
||||
|
||||
import act.Act;
|
||||
import act.conf.AppConfigKey;
|
||||
import act.util.SysProps;
|
||||
import org.osgl.$;
|
||||
import org.osgl.logging.Logger;
|
||||
import org.osgl.util.S;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import org.osgl.util.E;
|
||||
|
||||
/**
|
||||
* The entry to start an Act full stack app
|
||||
@ -61,25 +56,7 @@ public class RunApp {
|
||||
}
|
||||
|
||||
public static void start(String appName, String appVersion, String packageName) throws Exception {
|
||||
long ts = $.ms();
|
||||
String profile = SysProps.get(AppConfigKey.PROFILE.key());
|
||||
if (S.blank(profile)) {
|
||||
profile = "";
|
||||
} else {
|
||||
profile = "using profile[" + profile + "]";
|
||||
}
|
||||
LOGGER.debug("run fullstack application with package[%s] %s", packageName, profile);
|
||||
//System.setProperty(AppConfigKey.CONTROLLER_PACKAGE.key(), packageName);
|
||||
final String SCAN_PACKAGE = AppConfigKey.SCAN_PACKAGE.key();
|
||||
if (S.notBlank(packageName)) {
|
||||
System.setProperty(SCAN_PACKAGE, packageName);
|
||||
}
|
||||
FullStackAppBootstrapClassLoader classLoader = new FullStackAppBootstrapClassLoader(RunApp.class.getClassLoader());
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
Class<?> actClass = classLoader.loadClass("act.Act");
|
||||
Method m = actClass.getDeclaredMethod("startApp", String.class, String.class);
|
||||
$.invokeStatic(m, appName, appVersion);
|
||||
LOGGER.info("it takes %sms to start the app\n", $.ms() - ts);
|
||||
E.tbd();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
@ -100,6 +100,7 @@ public class CliContext extends ActContext.Base<CliContext> implements IASCIITab
|
||||
return set;
|
||||
}
|
||||
|
||||
@SuppressWarnings("FallThrough")
|
||||
public void raiseExceptionIfThereAreMissingOptions(CliContext context) {
|
||||
Set<String> missings = missingOptions();
|
||||
int missing = missings.size();
|
||||
|
@ -46,8 +46,6 @@ import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.util.Map;
|
||||
|
||||
import static act.app.App.logger;
|
||||
|
||||
public class CliSession extends DestroyableBase implements Runnable {
|
||||
|
||||
private String id;
|
||||
|
@ -56,6 +56,7 @@ public class ReflectedCommandExecutor extends CommandExecutor {
|
||||
private MethodAccess methodAccess;
|
||||
private int commandIndex;
|
||||
private int paramCount;
|
||||
private boolean isStatic;
|
||||
private CliContext.ParsingContext parsingContext;
|
||||
private boolean async;
|
||||
private ReportProgress reportProgress;
|
||||
@ -66,6 +67,7 @@ public class ReflectedCommandExecutor extends CommandExecutor {
|
||||
this.cl = app.classLoader();
|
||||
this.paramTypes = paramTypes();
|
||||
this.paramCount = methodMetaInfo.paramCount();
|
||||
this.isStatic = methodMetaInfo.isStatic();
|
||||
this.commanderClass = $.classForName(methodMetaInfo.classInfo().className(), cl);
|
||||
try {
|
||||
this.method = commanderClass.getMethod(methodMetaInfo.methodName(), paramTypes);
|
||||
@ -86,6 +88,9 @@ public class ReflectedCommandExecutor extends CommandExecutor {
|
||||
|
||||
@Override
|
||||
public Object execute(CliContext context) {
|
||||
if (isStatic) {
|
||||
return null;
|
||||
}
|
||||
context.attribute(CliContext.ATTR_METHOD, method);
|
||||
context.prepare(parsingContext);
|
||||
paramLoaderService.preParseOptions(method, methodMetaInfo, context);
|
||||
|
@ -207,15 +207,12 @@ public abstract class Config<E extends ConfigKey> extends DestroyableBase {
|
||||
Map<String, Object> subset = C.newMap();
|
||||
for (String key : raw.keySet()) {
|
||||
if (key.startsWith(prefix) || key.startsWith(prefix2)) {
|
||||
Object o = data.get(key);
|
||||
Object o = raw.get(key);
|
||||
if (null == o) {
|
||||
o = raw.get(key);
|
||||
if (null == o) {
|
||||
continue;
|
||||
}
|
||||
if (o instanceof String) {
|
||||
o = AppConfigKey.helper.evaluate(o.toString(), raw);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (o instanceof String) {
|
||||
o = AppConfigKey.helper.evaluate(o.toString(), raw);
|
||||
}
|
||||
if (key.startsWith("act.")) {
|
||||
key = key.substring(4);
|
||||
|
@ -41,8 +41,6 @@ import act.ws.WsEndpoint;
|
||||
import org.osgl.$;
|
||||
import org.osgl.Osgl;
|
||||
import org.osgl.http.H;
|
||||
import org.osgl.logging.L;
|
||||
import org.osgl.logging.Logger;
|
||||
import org.osgl.mvc.annotation.With;
|
||||
import org.osgl.mvc.util.Binder;
|
||||
import org.osgl.util.C;
|
||||
@ -58,7 +56,6 @@ import java.util.*;
|
||||
*/
|
||||
public class ControllerByteCodeScanner extends AppByteCodeScannerBase {
|
||||
|
||||
private final static Logger logger = L.get(ControllerByteCodeScanner.class);
|
||||
private Router router;
|
||||
private ControllerClassMetaInfo classInfo;
|
||||
private volatile ControllerClassMetaInfoManager classInfoBase;
|
||||
|
@ -276,6 +276,7 @@ public class HandlerEnhancer extends MethodVisitor implements Opcodes {
|
||||
return segment.meta.appCtxLocalVariableTableIndex();
|
||||
}
|
||||
|
||||
@SuppressWarnings("FallThrough")
|
||||
private void injectRenderArgSetCode(AbstractInsnNode invokeNode) {
|
||||
if (!segment.meta.hasLocalVariableTable()) {
|
||||
logger.warn("local variable table info not found. ActionContext render args might not be automatically populated");
|
||||
@ -478,6 +479,7 @@ public class HandlerEnhancer extends MethodVisitor implements Opcodes {
|
||||
segment.instructions.insertBefore(node, list);
|
||||
}
|
||||
|
||||
@SuppressWarnings("FallThrough")
|
||||
private void injectThrowCode(AbstractInsnNode invokeNode) {
|
||||
if (segment.meta.hasReturn()) {
|
||||
return;
|
||||
|
@ -61,7 +61,7 @@ public class ControllerClassMetaInfoManager extends DestroyableBase {
|
||||
public void registerControllerMetaInfo(ControllerClassMetaInfo metaInfo) {
|
||||
String className = Type.getObjectType(metaInfo.className()).getClassName();
|
||||
controllers.put(className, metaInfo);
|
||||
App.LOGGER.trace("Controller meta info registered for: %s", className);
|
||||
trace("Controller meta info registered for: %s", className);
|
||||
}
|
||||
|
||||
public ControllerClassMetaInfo controllerMetaInfo(String className) {
|
||||
|
@ -27,8 +27,6 @@ import org.osgl.util.S;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import static act.app.App.logger;
|
||||
|
||||
/**
|
||||
* Stores all method level information needed to generate
|
||||
* {@link Handler interceptors}
|
||||
|
@ -605,16 +605,12 @@ public class EventBus extends AppServiceBase<EventBus> {
|
||||
});
|
||||
}
|
||||
|
||||
private static boolean isTraceEnabled() {
|
||||
return LOGGER.isTraceEnabled();
|
||||
}
|
||||
|
||||
private void trace(String msg, Object... args) {
|
||||
protected void trace(String msg, Object... args) {
|
||||
msg = S.fmt(msg, args);
|
||||
if (once) {
|
||||
msg = S.builder("[once]").append(msg).toString();
|
||||
}
|
||||
LOGGER.trace(msg);
|
||||
super.trace(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,12 +25,16 @@ import act.security.CORS;
|
||||
import act.security.CSRF;
|
||||
import org.osgl.$;
|
||||
import org.osgl.exception.NotAppliedException;
|
||||
import org.osgl.logging.LogManager;
|
||||
import org.osgl.logging.Logger;
|
||||
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
public abstract class RequestHandlerBase extends $.F1<ActionContext, Void> implements RequestHandler {
|
||||
|
||||
protected Logger logger = LogManager.get(getClass());
|
||||
|
||||
private boolean destroyed;
|
||||
private boolean sessionFree;
|
||||
private boolean requireContextResolving;
|
||||
|
@ -22,7 +22,6 @@ package act.handler.builtin;
|
||||
|
||||
import act.Act;
|
||||
import act.app.ActionContext;
|
||||
import act.app.App;
|
||||
import act.controller.ParamNames;
|
||||
import act.handler.builtin.controller.FastRequestHandler;
|
||||
import org.osgl.$;
|
||||
@ -190,7 +189,7 @@ public class StaticResourceGetter extends FastRequestHandler {
|
||||
AlwaysForbidden.INSTANCE.handle(context);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
App.LOGGER.warn(e, "Error servicing static resource request");
|
||||
logger.warn(e, "Error servicing static resource request");
|
||||
throw NotFound.get();
|
||||
}
|
||||
}
|
||||
|
@ -363,9 +363,9 @@ public class ReflectedHandlerInvoker<M extends HandlerMethodMetaInfo> extends De
|
||||
context.attribute(JsonDTOClassManager.CTX_ATTR_KEY, dto);
|
||||
} catch (JSONException e) {
|
||||
if (e.getCause() != null) {
|
||||
App.LOGGER.warn(e.getCause(), "error parsing JSON data");
|
||||
warn(e.getCause(), "error parsing JSON data");
|
||||
} else {
|
||||
App.LOGGER.warn(e, "error parsing JSON data");
|
||||
warn(e, "error parsing JSON data");
|
||||
}
|
||||
throw new BadRequest(e.getCause());
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ public class GenieInjector extends DependencyInjectorBase<GenieInjector> {
|
||||
binder.register(injector.genie());
|
||||
}
|
||||
} else {
|
||||
App.LOGGER.warn("Unable to auto bind on %s: implementation not found", autoBinding);
|
||||
Act.LOGGER.warn("Unable to auto bind on %s: implementation not found", autoBinding);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ import org.osgl.util.StringValueResolver;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -60,8 +61,10 @@ public class CliContextParamLoader extends ParamValueLoaderService {
|
||||
CliContext.ParsingContextBuilder.start();
|
||||
ensureOptionLoaders(method, methodMetaInfo);
|
||||
methodMetaInfoHolder.set(methodMetaInfo);
|
||||
ParamValueLoader loader = findBeanLoader(commander);
|
||||
classRegistry.putIfAbsent(commander, loader);
|
||||
if (!Modifier.isStatic(method.getModifiers())) {
|
||||
ParamValueLoader loader = findBeanLoader(commander);
|
||||
classRegistry.putIfAbsent(commander, loader);
|
||||
}
|
||||
$.Var<Boolean> boolBag = $.var();
|
||||
ParamValueLoader[] loaders = findMethodParamLoaders(method, commander, boolBag);
|
||||
methodRegistry.putIfAbsent(method, loaders);
|
||||
|
24
src/main/java/act/internal/package-info.java
Normal file
24
src/main/java/act/internal/package-info.java
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* root package for ActFramework internal used classes
|
||||
*/
|
||||
package act.internal;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* OSGL Genie
|
||||
* %%
|
||||
* Copyright (C) 2017 OSGL (Open Source General Library)
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
280
src/main/java/act/internal/util/AppDescriptor.java
Normal file
280
src/main/java/act/internal/util/AppDescriptor.java
Normal file
@ -0,0 +1,280 @@
|
||||
package act.internal.util;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* ACT Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 ActFramework
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.osgl.$;
|
||||
import org.osgl.bootstrap.Version;
|
||||
import org.osgl.util.E;
|
||||
import org.osgl.util.S;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* Describe an application's name, package and version
|
||||
*/
|
||||
public class AppDescriptor implements Serializable {
|
||||
|
||||
private String appName;
|
||||
private String packageName;
|
||||
private Version version;
|
||||
|
||||
/**
|
||||
* Construct an `AppVersion` with name and version
|
||||
*
|
||||
* @param appName
|
||||
* the app name
|
||||
* @param version
|
||||
* the app version
|
||||
*/
|
||||
private AppDescriptor(String appName, String packageName, Version version) {
|
||||
this.appName = appName;
|
||||
this.packageName = packageName;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the app name
|
||||
* @return
|
||||
* the app name
|
||||
*/
|
||||
public String getAppName() {
|
||||
return appName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the package name
|
||||
* @return
|
||||
* the package name
|
||||
*/
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the app version
|
||||
* @return
|
||||
* the app version
|
||||
*/
|
||||
public Version getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this `AppVersion` data is valid.
|
||||
*
|
||||
* An `AppVersion` is considered to be valid if and only if
|
||||
* the {@link #getVersion()} is **not** {@link Version#isUnknown() unknown}
|
||||
*
|
||||
* @return
|
||||
* `true` if this `AppVersion` is valid or `false` otherwise
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return !version.isUnknown();
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize this `AppDescriptor` and output byte array
|
||||
*
|
||||
* @return
|
||||
* serialize this `AppDescriptor` into byte array
|
||||
*/
|
||||
public byte[] toByteArray() {
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(this);
|
||||
return baos.toByteArray();
|
||||
} catch (IOException e) {
|
||||
throw E.ioException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// - factory methods
|
||||
|
||||
/**
|
||||
* Create an `AppDescriptor` with appName, package name and app version.
|
||||
*
|
||||
* If `appName` is `null` or blank, it will try the following
|
||||
* approach to get app name:
|
||||
*
|
||||
* 1. check the {@link Version#getArtifactId() artifact id} and use it unless
|
||||
* 2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
|
||||
*
|
||||
* @param appName
|
||||
* the app name, optional
|
||||
* @param packageName
|
||||
* the package name
|
||||
* @param appVersion
|
||||
* the app version
|
||||
* @return
|
||||
* an `AppDescriptor`
|
||||
*/
|
||||
public static AppDescriptor of(String appName, String packageName, Version appVersion) {
|
||||
String[] packages = packageName.split(S.COMMON_SEP);
|
||||
String effectPackageName = packageName;
|
||||
if (packages.length > 0) {
|
||||
effectPackageName = packages[0];
|
||||
}
|
||||
E.illegalArgumentIf(!JavaNames.isPackageOrClassName(effectPackageName),
|
||||
"valid package name expected. found: " + effectPackageName);
|
||||
return new AppDescriptor(ensureAppName(appName, effectPackageName, $.notNull(appVersion)),
|
||||
packageName,
|
||||
appVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an `AppDescriptor` with appName, entry class and app version.
|
||||
*
|
||||
* If `appName` is `null` or blank, it will try the following
|
||||
* approach to get app name:
|
||||
*
|
||||
* 1. check the {@link Version#getArtifactId() artifact id} and use it unless
|
||||
* 2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
|
||||
*
|
||||
* @param appName
|
||||
* the app name, optional
|
||||
* @param entryClass
|
||||
* the entry class
|
||||
* @param appVersion
|
||||
* the app version
|
||||
* @return
|
||||
* an `AppDescriptor`
|
||||
*/
|
||||
public static AppDescriptor of(String appName, Class<?> entryClass, Version appVersion) {
|
||||
return new AppDescriptor(ensureAppName(appName, entryClass, $.notNull(appVersion)),
|
||||
JavaNames.packageNameOf(entryClass),
|
||||
appVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an `AppDescriptor` with appName and entry class specified.
|
||||
*
|
||||
* If `appName` is `null` or blank, it will try the following
|
||||
* approach to get app name:
|
||||
*
|
||||
* 1. check the {@link Version#getArtifactId() artifact id} and use it unless
|
||||
* 2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
|
||||
*
|
||||
* @param appName
|
||||
* the app name
|
||||
* @param entryClass
|
||||
* the entry class
|
||||
* @return
|
||||
* an `AppDescriptor` instance
|
||||
*/
|
||||
public static AppDescriptor of(String appName, Class<?> entryClass) {
|
||||
return of(appName, entryClass, Version.of(entryClass));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an `AppDescriptor` with appName and package name specified
|
||||
*
|
||||
* If `appName` is `null` or blank, it will try the following
|
||||
* approach to get app name:
|
||||
*
|
||||
* 1. check the {@link Version#getArtifactId() artifact id} and use it unless
|
||||
* 2. if artifact id is null or empty, then infer app name using {@link AppNameInferer}
|
||||
*
|
||||
* @param appName
|
||||
* the app name
|
||||
* @param packageName
|
||||
* the package name of the app
|
||||
* @return
|
||||
* an `AppDescriptor` instance
|
||||
*/
|
||||
public static AppDescriptor of(String appName, String packageName) {
|
||||
return of(appName, packageName, Version.ofPackage(packageName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an `AppDescriptor` with package name.
|
||||
*
|
||||
* This method relies on {@link Version#ofPackage(String)} to get
|
||||
* the corresponding {@link Version} instance to the package name.
|
||||
*
|
||||
* @param packageName
|
||||
* the package name
|
||||
* @return
|
||||
* an `AppDescriptor` instance
|
||||
*/
|
||||
public static AppDescriptor of(String packageName) {
|
||||
return of(null, packageName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an `AppDescriptor` with entry class (the class with main method)
|
||||
*
|
||||
* This method relies on {@link Version#of(Class)} to get the
|
||||
* corresponding {@link Version} instance to the entry class
|
||||
*
|
||||
* @param entryClass
|
||||
* the entry class
|
||||
* @return
|
||||
* An `AppDescriptor` instance
|
||||
*/
|
||||
public static AppDescriptor of(Class<?> entryClass) {
|
||||
return of(null, entryClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize an `AppDescriptor` from byte array
|
||||
*
|
||||
* @param bytes
|
||||
* the byte array
|
||||
* @return
|
||||
* an `AppDescriptor` instance
|
||||
*/
|
||||
public static AppDescriptor deserializeFrom(byte[] bytes) {
|
||||
try {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
|
||||
ObjectInputStream ois = new ObjectInputStream(bais);
|
||||
return (AppDescriptor) ois.readObject();
|
||||
} catch (IOException e) {
|
||||
throw E.ioException(e);
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw E.unexpected(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static String ensureAppName(String appName, Class<?> entryClass, Version version) {
|
||||
if (S.blank(appName)) {
|
||||
if (!version.isUnknown()) {
|
||||
appName = version.getArtifactId();
|
||||
}
|
||||
if (S.blank(appName)) {
|
||||
appName = AppNameInferer.from(entryClass);
|
||||
}
|
||||
}
|
||||
return appName;
|
||||
}
|
||||
|
||||
private static String ensureAppName(String appName, String packageName, Version version) {
|
||||
if (S.blank(appName)) {
|
||||
if (!version.isUnknown()) {
|
||||
appName = version.getArtifactId();
|
||||
}
|
||||
if (S.blank(appName)) {
|
||||
appName = AppNameInferer.fromPackageName(packageName);
|
||||
}
|
||||
}
|
||||
return appName;
|
||||
}
|
||||
}
|
87
src/main/java/act/internal/util/AppNameInferer.java
Normal file
87
src/main/java/act/internal/util/AppNameInferer.java
Normal file
@ -0,0 +1,87 @@
|
||||
package act.internal.util;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* ACT Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 ActFramework
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.osgl.util.C;
|
||||
import org.osgl.util.Keyword;
|
||||
import org.osgl.util.S;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Infer app name from main class or scan package
|
||||
*/
|
||||
class AppNameInferer {
|
||||
|
||||
/**
|
||||
* Infer app name from entry class
|
||||
*
|
||||
* @param entryClass
|
||||
* the entry class
|
||||
* @return
|
||||
* app name inferred from the entry class
|
||||
*/
|
||||
static String from(Class<?> entryClass) {
|
||||
List<String> tokens = tokenOf(entryClass);
|
||||
return fromTokens(tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* Infer app name from scan package
|
||||
*
|
||||
* @param packageName
|
||||
* the package name
|
||||
* @return
|
||||
* app name inferred from the package name
|
||||
*/
|
||||
static String fromPackageName(String packageName) {
|
||||
List<String> tokens = tokenOf(packageName);
|
||||
return fromTokens(tokens);
|
||||
}
|
||||
|
||||
private static String fromTokens(List<String> tokens) {
|
||||
C.List<String> filtered = NoisyWordsFilter.filter(tokens);
|
||||
String joined = S.join(".", filtered);
|
||||
return Keyword.of(joined).header();
|
||||
}
|
||||
|
||||
private static List<String> tokenOf(Class<?> entryClass) {
|
||||
C.List<String> tokens = C.newList();
|
||||
tokens.addAll(classNameTokensReversed(entryClass));
|
||||
Class<?> enclosingClass = entryClass.getEnclosingClass();
|
||||
while (null != enclosingClass) {
|
||||
tokens.addAll(classNameTokensReversed(enclosingClass));
|
||||
enclosingClass = entryClass.getEnclosingClass();
|
||||
}
|
||||
String pkgName = JavaNames.packageNameOf(entryClass);
|
||||
tokens.append(S.fastSplit(pkgName, ".").reverse());
|
||||
return tokens.reverse();
|
||||
}
|
||||
|
||||
private static List<String> tokenOf(String packageName) {
|
||||
return S.fastSplit(packageName, ".");
|
||||
}
|
||||
|
||||
private static List<String> classNameTokensReversed(Class theClass) {
|
||||
return C.list(Keyword.of(theClass.getSimpleName()).tokens()).reverse();
|
||||
}
|
||||
|
||||
}
|
81
src/main/java/act/internal/util/JavaNames.java
Normal file
81
src/main/java/act/internal/util/JavaNames.java
Normal file
@ -0,0 +1,81 @@
|
||||
package act.internal.util;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* ACT Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 ActFramework
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.osgl.util.E;
|
||||
import org.osgl.util.S;
|
||||
|
||||
/**
|
||||
* Provides utility methods relevant to Java names, e.g. package name validator etc
|
||||
*/
|
||||
public final class JavaNames {
|
||||
|
||||
/**
|
||||
* Check if a given string is a valid java package or class name.
|
||||
*
|
||||
* This method use the technique documented in
|
||||
* [this SO question](https://stackoverflow.com/questions/13557195/how-to-check-if-string-is-a-valid-class-identifier)
|
||||
* with the following extensions:
|
||||
*
|
||||
* * if the string does not contain `.` then assume it is not a valid package or class name
|
||||
*
|
||||
* @param s
|
||||
* the string to be checked
|
||||
* @return
|
||||
* `true` if `s` is a valid java package or class name
|
||||
*/
|
||||
public static boolean isPackageOrClassName(String s) {
|
||||
if (S.blank(s)) {
|
||||
return false;
|
||||
}
|
||||
S.List parts = S.fastSplit(s, ".");
|
||||
if (parts.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
for (String part: parts) {
|
||||
if (!Character.isJavaIdentifierStart(part.charAt(0))) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 1, len = part.length(); i < len; ++i) {
|
||||
if (!Character.isJavaIdentifierPart(part.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns package name of a class
|
||||
*
|
||||
* @param clazz
|
||||
* the class
|
||||
* @return
|
||||
* the package name of the class
|
||||
*/
|
||||
public static String packageNameOf(Class<?> clazz) {
|
||||
String name = clazz.getName();
|
||||
int pos = name.lastIndexOf('.');
|
||||
E.unexpectedIf(pos < 0, "Class does not have package: " + name);
|
||||
return name.substring(0, pos);
|
||||
}
|
||||
|
||||
}
|
88
src/main/java/act/internal/util/NoisyWordsFilter.java
Normal file
88
src/main/java/act/internal/util/NoisyWordsFilter.java
Normal file
@ -0,0 +1,88 @@
|
||||
package act.internal.util;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* ACT Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 ActFramework
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.osgl.util.C;
|
||||
import org.osgl.util.S;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Filter noisy words from a class or package name to get
|
||||
*/
|
||||
class NoisyWordsFilter {
|
||||
|
||||
/**
|
||||
* The key (`act.noise-words`) to fetch user defined noise words
|
||||
* from system property.
|
||||
*
|
||||
* User can define noise words in a string separated by comma, e.g.
|
||||
*
|
||||
* ```
|
||||
* "buzz,it,admin"
|
||||
* ```
|
||||
*/
|
||||
static final String PROP_NOISE_WORDS = "act.noise-words";
|
||||
|
||||
// built-in noise words
|
||||
private static final Set<String> NOISE_WORDS = C.set("app", "application", "demo", "entry", "main");
|
||||
|
||||
private static Set<String> noiseWords() {
|
||||
Set<String> retVal = new HashSet<>(NOISE_WORDS);
|
||||
|
||||
String userDefined = System.getProperty(PROP_NOISE_WORDS);
|
||||
if (null != userDefined) {
|
||||
retVal.addAll(C.listOf(userDefined.split(S.COMMON_SEP)).map(S.F.TO_LOWERCASE));
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter a list of string tokens and get rid of tokens that are
|
||||
* {@link #noiseWords() noise}
|
||||
*
|
||||
* The tokens in the return list is in lower case
|
||||
*
|
||||
* @param tokens
|
||||
* the list of string token
|
||||
* @return
|
||||
* filtered list of lowercase string tokens
|
||||
*/
|
||||
static C.List<String> filter(List<String> tokens) {
|
||||
C.List<String> result = C.newList();
|
||||
Set<String> noise = noiseWords();
|
||||
for (String token : tokens) {
|
||||
if (S.blank(token)) {
|
||||
continue;
|
||||
}
|
||||
token = token.trim().toLowerCase();
|
||||
if (!noise.contains(token)) {
|
||||
result.add(token);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
24
src/main/java/act/internal/util/package-info.java
Normal file
24
src/main/java/act/internal/util/package-info.java
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Utility classes used internally in ActFramework
|
||||
*/
|
||||
package act.internal.util;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* OSGL Genie
|
||||
* %%
|
||||
* Copyright (C) 2017 OSGL (Open Source General Library)
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
@ -264,7 +264,7 @@ public class Job extends DestroyableBase implements Runnable {
|
||||
if (Act.isDev()) {
|
||||
app.setBlockIssue(e);
|
||||
} else {
|
||||
Act.shutdownApp(App.instance());
|
||||
Act.shutdown(App.instance());
|
||||
destroy();
|
||||
if (App.instance().isMainThread()) {
|
||||
if (cause instanceof RuntimeException) {
|
||||
|
@ -20,7 +20,6 @@ package act.job.meta;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.app.App;
|
||||
import act.asm.Type;
|
||||
import act.util.AsmTypes;
|
||||
import act.util.DestroyableBase;
|
||||
@ -72,7 +71,7 @@ public class JobClassMetaInfoManager extends DestroyableBase {
|
||||
if (null != subTypes) {
|
||||
subTypeInfo.remove(metaInfo.type());
|
||||
}
|
||||
App.logger.trace("Job meta info registered for: %s", className);
|
||||
logger.trace("Job meta info registered for: %s", className);
|
||||
}
|
||||
|
||||
public JobClassMetaInfo jobMetaInfo(String className) {
|
||||
|
@ -242,6 +242,7 @@ public class SenderEnhancer extends MethodVisitor implements Opcodes {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("FallThrough")
|
||||
private boolean injectRenderArgSetCode(AbstractInsnNode invokeNode) {
|
||||
if (!segment.meta.hasLocalVariableTable()) {
|
||||
logger.warn("local variable table info not found. AppContext render args will not be automatically populated");
|
||||
|
@ -28,7 +28,6 @@ import javax.enterprise.context.ApplicationScoped;
|
||||
import java.util.Map;
|
||||
|
||||
import static act.Destroyable.Util.destroyAll;
|
||||
import static act.app.App.logger;
|
||||
|
||||
@ApplicationScoped
|
||||
public class MailerClassMetaInfoManager extends DestroyableBase {
|
||||
|
@ -21,6 +21,7 @@ package act.metric;
|
||||
*/
|
||||
|
||||
import act.app.App;
|
||||
import act.util.LogSupport;
|
||||
import org.osgl.$;
|
||||
import org.osgl.logging.LogManager;
|
||||
import org.osgl.logging.Logger;
|
||||
@ -171,7 +172,7 @@ public class SimpleMetricStore implements MetricStore, Serializable {
|
||||
return S.beforeLast(name, ":");
|
||||
}
|
||||
|
||||
private static class FileSynchronizer {
|
||||
private static class FileSynchronizer extends LogSupport {
|
||||
private static final String FILE_NAME = ".act.metric";
|
||||
private boolean ioError = false;
|
||||
|
||||
@ -202,7 +203,7 @@ public class SimpleMetricStore implements MetricStore, Serializable {
|
||||
return store;
|
||||
} catch (IOException e) {
|
||||
ioError = true;
|
||||
App.LOGGER.error(e, "Error reading simple metric store persisted file:%s. Will reset this file", file.getAbsolutePath());
|
||||
error(e, "Error reading simple metric store persisted file:%s. Will reset this file", file.getAbsolutePath());
|
||||
if (!file.delete()) {
|
||||
file.deleteOnExit();
|
||||
}
|
||||
|
@ -291,9 +291,10 @@ public class Router extends AppServiceBase<Router> {
|
||||
addMapping(method, path, handler, RouteSource.ROUTE_TABLE);
|
||||
}
|
||||
|
||||
@SuppressWarnings("FallThrough")
|
||||
public void addMapping(H.Method method, CharSequence path, RequestHandler handler, RouteSource source) {
|
||||
if (LOGGER.isTraceEnabled()) {
|
||||
LOGGER.trace("R+ %s %s | %s (%s)", method, path, handler, source);
|
||||
if (isTraceEnabled()) {
|
||||
trace("R+ %s %s | %s (%s)", method, path, handler, source);
|
||||
}
|
||||
Node node = _locate(method, path, handler.toString());
|
||||
if (null == node.handler) {
|
||||
@ -304,7 +305,7 @@ public class Router extends AppServiceBase<Router> {
|
||||
ConflictResolver resolving = source.onConflict(existing);
|
||||
switch (resolving) {
|
||||
case OVERWRITE_WARN:
|
||||
LOGGER.warn("\n\tOverwrite existing route \n\t\t%s\n\twith new route\n\t\t%s",
|
||||
warn("\n\tOverwrite existing route \n\t\t%s\n\twith new route\n\t\t%s",
|
||||
routeInfo(method, path, node.handler()),
|
||||
routeInfo(method, path, handler)
|
||||
);
|
||||
|
@ -183,7 +183,7 @@ public class CSRF {
|
||||
raiseCsrfNotVerified(context);
|
||||
}
|
||||
} catch (UnexpectedException e) {
|
||||
App.logger.warn(e, "Error checking CSRF token");
|
||||
Act.LOGGER.warn(e, "Error checking CSRF token");
|
||||
raiseCsrfNotVerified(context);
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ public interface ActContext<CTX_TYPE extends ActContext> extends ParamValueProvi
|
||||
try {
|
||||
l.onDestroy(this);
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn(e, "error calling listener onDestroy method");
|
||||
warn(e, "error calling listener onDestroy method");
|
||||
}
|
||||
}
|
||||
Destroyable.Util.destroyAll(destroyableList, RequestScoped.class);
|
||||
|
@ -20,9 +20,6 @@ package act.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.osgl.$;
|
||||
import org.osgl.exception.UnexpectedException;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
public class AnnotationUtil {
|
||||
@ -61,13 +58,7 @@ public class AnnotationUtil {
|
||||
*/
|
||||
@Deprecated
|
||||
public static <T extends Annotation> Class<T> classOf(Annotation annotation) {
|
||||
Class<?>[] ca = annotation.getClass().getInterfaces();
|
||||
for (Class<?> c: ca) {
|
||||
if (Annotation.class.isAssignableFrom(c)) {
|
||||
return $.cast(c);
|
||||
}
|
||||
}
|
||||
throw new UnexpectedException("!!!");
|
||||
return (Class<T>) annotation.annotationType();
|
||||
}
|
||||
|
||||
public static <T extends Annotation> T getAnnotation(Class<?> targetClass, Class<T> annotationClass) {
|
||||
|
@ -24,12 +24,12 @@ import act.Act;
|
||||
import act.Zen;
|
||||
import act.conf.AppConfigKey;
|
||||
import act.conf.ConfLoader;
|
||||
import act.internal.util.AppDescriptor;
|
||||
import act.sys.Env;
|
||||
import ascii.Image2ascii;
|
||||
import com.github.lalyos.jfiglet.FigletFont;
|
||||
import org.fusesource.jansi.Ansi;
|
||||
import org.osgl.$;
|
||||
import org.osgl.util.C;
|
||||
import org.osgl.util.E;
|
||||
import org.osgl.util.IO;
|
||||
import org.osgl.util.S;
|
||||
@ -38,7 +38,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ASCII arts for Act
|
||||
@ -47,8 +46,8 @@ public class Banner {
|
||||
|
||||
private static String cachedBanner;
|
||||
|
||||
public static void print() {
|
||||
String banner = banner();
|
||||
public static void print(AppDescriptor appDescriptor) {
|
||||
String banner = banner(appDescriptor);
|
||||
System.out.println(banner);
|
||||
cachedBanner = banner;
|
||||
}
|
||||
@ -57,7 +56,7 @@ public class Banner {
|
||||
return cachedBanner;
|
||||
}
|
||||
|
||||
public static String banner() {
|
||||
public static String banner(AppDescriptor appDescriptor) {
|
||||
String bannerText = null;
|
||||
|
||||
String udfBanner = udfBanner();
|
||||
@ -65,7 +64,7 @@ public class Banner {
|
||||
bannerText = S.concat(udfBanner, "\n");
|
||||
}
|
||||
if (null == bannerText) {
|
||||
bannerText = asciiArt(Act.appName());
|
||||
bannerText = asciiArt(appDescriptor.getAppName());
|
||||
}
|
||||
int bannerTextWidth = width(bannerText);
|
||||
|
||||
@ -74,8 +73,8 @@ public class Banner {
|
||||
int maxWidth = Math.max(faviconWidth, bannerTextWidth);
|
||||
|
||||
S.Buffer sb = S.buffer();
|
||||
String actVersion = Act.actVersion();
|
||||
if ("ACTFRAMEWORK".equals(Act.appName())) {
|
||||
String actVersion = Act.VERSION.getVersion();
|
||||
if ("ACTFRAMEWORK".equals(appDescriptor.getAppName())) {
|
||||
sb.append(bannerText);
|
||||
if (S.notBlank(favicon)) {
|
||||
sb.append("\n");
|
||||
@ -94,7 +93,7 @@ public class Banner {
|
||||
} else {
|
||||
sb.append(poweredBy(maxWidth, actVersion, false));
|
||||
}
|
||||
sb.append("\n\n version: ").append(Act.appVersion());
|
||||
sb.append("\n\n version: ").append(appDescriptor.getVersion().getVersion());
|
||||
}
|
||||
File aFile = new File("");
|
||||
String group = Act.nodeGroup();
|
||||
@ -107,7 +106,7 @@ public class Banner {
|
||||
sb.append("\n group: ").append(group);
|
||||
}
|
||||
sb.append("\n");
|
||||
sb.append("\n zen: ").append(Ansi.ansi().a(Ansi.Attribute.ITALIC).a(Zen.wordsOfTheDay()).a(Ansi.Attribute.ITALIC_OFF));
|
||||
sb.append("\n zen: ").append(Zen.wordsOfTheDay());
|
||||
sb.append("\n");
|
||||
|
||||
return sb.toString();
|
||||
@ -191,8 +190,7 @@ public class Banner {
|
||||
is = Banner.class.getResourceAsStream("/standard.flf");
|
||||
}
|
||||
try {
|
||||
String bannerText = FigletFont.convertOneLine(is, s.toUpperCase());
|
||||
return S.concat(removeEndingBlankLines(bannerText), "\n");
|
||||
return FigletFont.convertOneLine(is, s.toUpperCase());
|
||||
} catch (IOException e) {
|
||||
throw E.ioException(e);
|
||||
}
|
||||
@ -204,6 +202,7 @@ public class Banner {
|
||||
return lastLineIsBlank ? removeEndingBlankLines(text.substring(0, lastLineBreak)) : text;
|
||||
}
|
||||
|
||||
|
||||
private static int width(String banner) {
|
||||
String[] lines = banner.split("\n");
|
||||
int max = 0;
|
||||
@ -213,6 +212,11 @@ public class Banner {
|
||||
return max;
|
||||
}
|
||||
|
||||
private static String udfBanner() {
|
||||
URL url = Banner.class.getResource("/act_banner.txt");
|
||||
return null == url ? null : IO.readContentAsString(url);
|
||||
}
|
||||
|
||||
private static String poweredBy(int width, String actVersion, boolean center) {
|
||||
String raw = S.concat("powered by @|bold ActFramework|@ ", actVersion);
|
||||
String poweredBy = Ansi.ansi().render(raw).toString();
|
||||
@ -228,39 +232,4 @@ public class Banner {
|
||||
return S.concat(S.times(" ", gap), poweredBy);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<String> fail = C.newList();
|
||||
for (String font : _BANNER_FONTS) {
|
||||
if (!test(font)) {
|
||||
fail.add(font);
|
||||
}
|
||||
}
|
||||
if (!fail.isEmpty()) {
|
||||
System.out.println(">>>>>Failed:");
|
||||
System.out.println(S.join(",", fail));
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean test(String font) {
|
||||
System.setProperty("banner.font", font);
|
||||
try {
|
||||
System.out.println("================= " + font + "==================");
|
||||
printArt("ABCDEFGHIJKLM");
|
||||
printArt("NOPQRSTUVWXYZ");
|
||||
printArt("1234567890");
|
||||
System.out.println("\n\n\n");
|
||||
} catch (RuntimeException e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static String udfBanner() {
|
||||
URL url = Banner.class.getResource("/act_banner.txt");
|
||||
return null == url ? null : IO.readContentAsString(url);
|
||||
}
|
||||
|
||||
private static void printArt(String s) {
|
||||
System.out.println(asciiArt(s));
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ package act.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.Act;
|
||||
import act.app.App;
|
||||
import act.app.event.AppEventId;
|
||||
import act.sys.Env;
|
||||
@ -30,7 +31,7 @@ import org.osgl.util.S;
|
||||
|
||||
public class ClassFinderData {
|
||||
|
||||
private static final Logger logger = App.logger;
|
||||
private static final Logger logger = Act.LOGGER;
|
||||
|
||||
public enum By {
|
||||
ANNOTATION() {
|
||||
|
@ -33,7 +33,7 @@ import javax.enterprise.context.SessionScoped;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class DestroyableBase implements Destroyable {
|
||||
public abstract class DestroyableBase extends LogSupport implements Destroyable {
|
||||
|
||||
protected Logger logger = LogManager.get(getClass());
|
||||
|
||||
|
89
src/main/java/act/util/LogSupport.java
Normal file
89
src/main/java/act/util/LogSupport.java
Normal file
@ -0,0 +1,89 @@
|
||||
package act.util;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* ACT Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 ActFramework
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.osgl.logging.LogManager;
|
||||
import org.osgl.logging.Logger;
|
||||
|
||||
/**
|
||||
* Provides logging support utility methods to extended classes.
|
||||
*/
|
||||
public class LogSupport {
|
||||
|
||||
protected final Logger logger = LogManager.get(getClass());
|
||||
|
||||
protected void trace(String format, Object ... args) {
|
||||
logger.trace(format, args);
|
||||
}
|
||||
|
||||
protected boolean isTraceEnabled() {
|
||||
return logger.isTraceEnabled();
|
||||
}
|
||||
|
||||
protected void trace(Throwable t, String format, Object ... args) {
|
||||
logger.trace(t, format, args);
|
||||
}
|
||||
|
||||
protected boolean isDebugEnabled() {
|
||||
return logger.isDebugEnabled();
|
||||
}
|
||||
|
||||
protected void debug(String format, Object ... args) {
|
||||
logger.debug(format, args);
|
||||
}
|
||||
|
||||
protected void debug(Throwable t, String format, Object ... args) {
|
||||
logger.debug(t, format, args);
|
||||
}
|
||||
|
||||
protected void info(String format, Object ... args) {
|
||||
logger.info(format, args);
|
||||
}
|
||||
|
||||
protected void info(Throwable t, String format, Object ... args) {
|
||||
logger.info(t, format, args);
|
||||
}
|
||||
|
||||
protected void warn(String format, Object ... args) {
|
||||
logger.warn(format, args);
|
||||
}
|
||||
|
||||
protected void warn(Throwable t, String format, Object ... args) {
|
||||
logger.warn(t, format, args);
|
||||
}
|
||||
|
||||
protected void error(String format, Object ... args) {
|
||||
logger.error(format, args);
|
||||
}
|
||||
|
||||
protected void error(Throwable t, String format, Object ... args) {
|
||||
logger.error(t, format, args);
|
||||
}
|
||||
|
||||
protected void fatal(String format, Object ... args) {
|
||||
logger.fatal(format, args);
|
||||
}
|
||||
|
||||
public void fatal(Throwable t, String format, Object ... args) {
|
||||
logger.fatal(t, format, args);
|
||||
}
|
||||
|
||||
}
|
@ -28,16 +28,12 @@ import act.plugin.Plugin;
|
||||
import org.osgl.$;
|
||||
import org.osgl.http.H;
|
||||
import org.osgl.http.H.Session;
|
||||
import org.osgl.logging.L;
|
||||
import org.osgl.logging.Logger;
|
||||
import org.osgl.util.*;
|
||||
|
||||
import javax.enterprise.context.ApplicationScoped;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
import static act.Destroyable.Util.tryDestroyAll;
|
||||
import static org.osgl.http.H.Session.KEY_EXPIRATION;
|
||||
@ -48,10 +44,7 @@ import static org.osgl.http.H.Session.KEY_EXPIRE_INDICATOR;
|
||||
*/
|
||||
public class SessionManager extends DestroyableBase {
|
||||
|
||||
private static Logger logger = L.get(SessionManager.class);
|
||||
|
||||
private C.List<Listener> registry = C.newList();
|
||||
private ConcurrentMap<App, CookieResolver> resolvers = new ConcurrentHashMap<>();
|
||||
private volatile CookieResolver theResolver = null;
|
||||
|
||||
public SessionManager() {
|
||||
@ -62,9 +55,6 @@ public class SessionManager extends DestroyableBase {
|
||||
tryDestroyAll(registry, ApplicationScoped.class);
|
||||
registry = null;
|
||||
|
||||
tryDestroyAll(resolvers.values(), ApplicationScoped.class);
|
||||
resolvers = null;
|
||||
|
||||
theResolver = null;
|
||||
}
|
||||
|
||||
@ -104,26 +94,14 @@ public class SessionManager extends DestroyableBase {
|
||||
}
|
||||
|
||||
public CookieResolver getResolver(App app) {
|
||||
if (Act.multiTenant()) {
|
||||
CookieResolver resolver = resolvers.get(app);
|
||||
if (null == resolver) {
|
||||
CookieResolver newResolver = new CookieResolver(app);
|
||||
resolver = resolvers.putIfAbsent(app, newResolver);
|
||||
if (null == resolver) {
|
||||
resolver = newResolver;
|
||||
if (null == theResolver) {
|
||||
synchronized (this) {
|
||||
if (null == theResolver) {
|
||||
theResolver = new CookieResolver(app);
|
||||
}
|
||||
}
|
||||
return resolver;
|
||||
} else {
|
||||
if (null == theResolver) {
|
||||
synchronized (this) {
|
||||
if (null == theResolver) {
|
||||
theResolver = new CookieResolver(app);
|
||||
}
|
||||
}
|
||||
}
|
||||
return theResolver;
|
||||
}
|
||||
return theResolver;
|
||||
}
|
||||
|
||||
private void sessionResolved(Session session, ActionContext context) {
|
||||
@ -168,7 +146,7 @@ public class SessionManager extends DestroyableBase {
|
||||
public void onSessionDissolve() {}
|
||||
}
|
||||
|
||||
public static class CookieResolver {
|
||||
public static class CookieResolver extends LogSupport {
|
||||
|
||||
private App app;
|
||||
private AppConfig conf;
|
||||
@ -295,7 +273,7 @@ public class SessionManager extends DestroyableBase {
|
||||
if (i > 0) sb.append(":");
|
||||
sb.append(Arrays.toString(kAndV.get(i)));
|
||||
}
|
||||
logger.warn("unexpected KV string: %S", sb.toString());
|
||||
warn("unexpected KV string: %S", sb.toString());
|
||||
} else {
|
||||
kv.put(new String(kAndV.get(0)), new String(kAndV.get(1)));
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ public class RythmView extends View {
|
||||
Properties p = new Properties();
|
||||
|
||||
p.put(ENGINE_MODE.getKey(), Act.mode().isDev() ? Rythm.Mode.dev : Rythm.Mode.prod);
|
||||
p.put(ENGINE_PLUGIN_VERSION.getKey(), Act.VERSION);
|
||||
p.put(ENGINE_PLUGIN_VERSION.getKey(), Act.VERSION.getVersion());
|
||||
p.put(ENGINE_CLASS_LOADER_PARENT_IMPL.getKey(), app.classLoader());
|
||||
p.put(HOME_TMP.getKey(), createTempHome(app));
|
||||
|
||||
|
@ -211,9 +211,9 @@ public abstract class WebSocketConnectionHandler extends RequestHandlerBase {
|
||||
context.attribute(JsonDTO.CTX_ATTR_KEY, dto);
|
||||
} catch (JSONException e) {
|
||||
if (e.getCause() != null) {
|
||||
App.LOGGER.warn(e.getCause(), "error parsing JSON data");
|
||||
logger.warn(e.getCause(), "error parsing JSON data");
|
||||
} else {
|
||||
App.LOGGER.warn(e, "error parsing JSON data");
|
||||
logger.warn(e, "error parsing JSON data");
|
||||
}
|
||||
throw new BadRequest(e.getCause());
|
||||
}
|
||||
|
3
src/main/resources/act/.version
Normal file
3
src/main/resources/act/.version
Normal file
@ -0,0 +1,3 @@
|
||||
artifact=${project.artifactId}
|
||||
version=${project.version}
|
||||
build=${buildNumber}
|
@ -20,29 +20,5 @@ package act;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
import org.osgl.$;
|
||||
import testapp.Main;
|
||||
|
||||
public class ActTest extends TestBase {
|
||||
|
||||
@Test
|
||||
public void testGetAppNameAndPackage() {
|
||||
String className = ActTest.class.getName();
|
||||
$.Var<String> appNameHolder = $.var();
|
||||
$.Var<String> pkgNameHolder = $.var();
|
||||
Act.getAppNameAndPackage(className, appNameHolder, pkgNameHolder);
|
||||
eq("Act Test", appNameHolder.get());
|
||||
eq("act", pkgNameHolder.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAppNameAndPackageWithNestedEntryClass() {
|
||||
String className = Main.Entry.class.getName();
|
||||
$.Var<String> appNameHolder = $.var();
|
||||
$.Var<String> pkgNameHolder = $.var();
|
||||
Act.getAppNameAndPackage(className, appNameHolder, pkgNameHolder);
|
||||
eq("Testapp", appNameHolder.get());
|
||||
eq("testapp", pkgNameHolder.get());
|
||||
}
|
||||
public class ActTest extends ActTestBase {
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ import act.job.AppJobManager;
|
||||
import act.metric.SimpleMetricPlugin;
|
||||
import act.route.Router;
|
||||
import act.util.ClassNames;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.runner.JUnitCore;
|
||||
import org.mockito.Matchers;
|
||||
@ -38,6 +37,7 @@ import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.osgl.$;
|
||||
import org.osgl.http.H;
|
||||
import org.osgl.ut.TestBase;
|
||||
import org.osgl.util.FastStr;
|
||||
import org.osgl.util.IO;
|
||||
import org.osgl.util.S;
|
||||
@ -52,49 +52,13 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@Ignore
|
||||
public class TestBase extends Assert {
|
||||
|
||||
protected void same(Object a, Object b) {
|
||||
assertSame(a, b);
|
||||
}
|
||||
|
||||
protected void eq(Object[] a1, Object[] a2) {
|
||||
assertArrayEquals(a1, a2);
|
||||
}
|
||||
|
||||
protected void eq(Object o1, Object o2) {
|
||||
assertEquals(o1, o2);
|
||||
}
|
||||
|
||||
protected void ne(Object expected, Object actual) {
|
||||
no($.eq(expected, actual));
|
||||
}
|
||||
public class ActTestBase extends TestBase {
|
||||
|
||||
protected void ceq(Object o1, Object o2) {
|
||||
assertEquals(S.string(o1), S.string(o2));
|
||||
}
|
||||
|
||||
protected void yes(Boolean expr, String msg, Object... args) {
|
||||
assertTrue(S.fmt(msg, args), expr);
|
||||
}
|
||||
|
||||
protected void yes(Boolean expr) {
|
||||
assertTrue(expr);
|
||||
}
|
||||
|
||||
protected void no(Boolean expr, String msg, Object... args) {
|
||||
assertFalse(S.fmt(msg, args), expr);
|
||||
}
|
||||
|
||||
protected void no(Boolean expr) {
|
||||
assertFalse(expr);
|
||||
}
|
||||
|
||||
protected void fail(String msg, Object... args) {
|
||||
assertFalse(S.fmt(msg, args), true);
|
||||
}
|
||||
|
||||
protected static void run(Class<? extends TestBase> cls) {
|
||||
protected static void run(Class<? extends ActTestBase> cls) {
|
||||
new JUnitCore().run(cls);
|
||||
}
|
||||
|
||||
@ -107,7 +71,7 @@ public class TestBase extends Assert {
|
||||
}
|
||||
|
||||
public static File root() {
|
||||
FastStr fs = FastStr.of(TestBase.class.getClassLoader().getResource("routes").getPath());
|
||||
FastStr fs = FastStr.of(ActTestBase.class.getClassLoader().getResource("routes").getPath());
|
||||
FastStr classRoot = fs.beforeLast("/");
|
||||
FastStr target = classRoot.beforeLast("/");
|
||||
return new File(target.toString());
|
@ -21,7 +21,6 @@ package act;
|
||||
*/
|
||||
|
||||
import act.app.ActionContext;
|
||||
import act.app.App;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.osgl.http.H;
|
||||
@ -33,7 +32,7 @@ import java.util.Map;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class ActionContextTest extends TestBase {
|
||||
public class ActionContextTest extends ActTestBase {
|
||||
|
||||
protected ActionContext ctx;
|
||||
|
||||
|
@ -26,7 +26,7 @@ import org.junit.Rule;
|
||||
import org.junit.rules.TestRule;
|
||||
|
||||
@Ignore
|
||||
public class BenchmarkBase extends TestBase {
|
||||
public class BenchmarkBase extends ActTestBase {
|
||||
@Rule
|
||||
public TestRule benchmarkRun = new BenchmarkRule();
|
||||
}
|
||||
|
@ -54,11 +54,11 @@ public class BootstrapClassLoaderTestRunner extends BlockJUnit4ClassRunner {
|
||||
|
||||
private static void initClassLoader() {
|
||||
prepareActHome();
|
||||
classLoader = new TestServerBootstrapClassLoader(TestBase.class.getClassLoader());
|
||||
classLoader = new TestServerBootstrapClassLoader(ActTestBase.class.getClassLoader());
|
||||
}
|
||||
|
||||
private static void prepareActHome() {
|
||||
File actHome = TestBase.root();
|
||||
File actHome = ActTestBase.root();
|
||||
File lib = ensureDir(actHome, "lib");
|
||||
File plugin = ensureDir(actHome, "plugin");
|
||||
packageActJarInto(lib);
|
||||
@ -74,17 +74,17 @@ public class BootstrapClassLoaderTestRunner extends BlockJUnit4ClassRunner {
|
||||
}
|
||||
|
||||
private static void packageActJarInto(File lib) {
|
||||
File classes = new File(TestBase.root(), "classes");
|
||||
File classes = new File(ActTestBase.root(), "classes");
|
||||
packageJarInto(classes, new File(lib, "act.jar"), "*");
|
||||
}
|
||||
|
||||
private static void packageTestJarInto(File lib) {
|
||||
File classes = new File(TestBase.root(), "test-classes");
|
||||
File classes = new File(ActTestBase.root(), "test-classes");
|
||||
packageJarInto(classes, new File(lib, "act-test.jar"), "*");
|
||||
}
|
||||
|
||||
private static void packagePluginJarInto(File lib) {
|
||||
File classes = new File(TestBase.root(), "test-classes");
|
||||
File classes = new File(ActTestBase.root(), "test-classes");
|
||||
packageJarInto(classes, new File(lib, "playground.jar"), "playground");
|
||||
}
|
||||
|
||||
|
@ -20,14 +20,14 @@ package act.app.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.App;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
|
||||
public class SimpleTypeInstanceFactoryTest extends TestBase {
|
||||
public class SimpleTypeInstanceFactoryTest extends ActTestBase {
|
||||
@Test
|
||||
public void test() {
|
||||
eq(Boolean.FALSE, get(Boolean.class));
|
||||
|
@ -20,7 +20,7 @@ package act.be;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.ActionContext;
|
||||
import act.asm.Type;
|
||||
import act.util.AsmTypes;
|
||||
@ -28,7 +28,7 @@ import org.junit.Test;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class AsmTypesTest extends TestBase {
|
||||
public class AsmTypesTest extends ActTestBase {
|
||||
|
||||
@Test
|
||||
public void testMethodDescWithoutReturnType() throws Exception {
|
||||
|
@ -20,7 +20,7 @@ package act.cli.bytecode;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.AppByteCodeScanner;
|
||||
import act.app.AppCodeScannerManager;
|
||||
import act.app.TestingAppClassLoader;
|
||||
@ -47,7 +47,7 @@ import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class CommanderByteCodeScannerTest extends TestBase {
|
||||
public class CommanderByteCodeScannerTest extends ActTestBase {
|
||||
|
||||
private CommanderClassMetaInfoManager infoSrc;
|
||||
private TestingAppClassLoader classLoader;
|
||||
|
@ -20,11 +20,11 @@ package act.cli.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import org.junit.Test;
|
||||
import org.osgl.util.C;
|
||||
|
||||
public class CommandLineParserTest extends TestBase {
|
||||
public class CommandLineParserTest extends ActTestBase {
|
||||
|
||||
private CommandLineParser p;
|
||||
|
||||
|
@ -21,7 +21,7 @@ package act.conf;
|
||||
*/
|
||||
|
||||
import act.Act;
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.conf.AutoConfig;
|
||||
import act.app.conf.AutoConfigPlugin;
|
||||
import act.app.data.StringValueResolverManager;
|
||||
@ -43,7 +43,7 @@ import static org.mockito.Matchers.argThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class AutoConfigPluginTest extends TestBase {
|
||||
public class AutoConfigPluginTest extends ActTestBase {
|
||||
|
||||
private String intVal = "37";
|
||||
private String intListVal = "37,23";
|
||||
@ -127,8 +127,9 @@ public class AutoConfigPluginTest extends TestBase {
|
||||
this.substring = substring;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Object actual) {
|
||||
return actual != null && ((String) actual).toUpperCase().contains(substring.toUpperCase());
|
||||
return actual != null && actual.toString().toUpperCase().contains(substring.toUpperCase());
|
||||
}
|
||||
|
||||
public void describeTo(Description description) {
|
||||
|
@ -21,7 +21,7 @@ package act.conf;
|
||||
*/
|
||||
|
||||
import act.Act;
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
@ -33,7 +33,7 @@ import org.osgl.util.S;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ConfigKeyHelperTest extends TestBase {
|
||||
public class ConfigKeyHelperTest extends ActTestBase {
|
||||
|
||||
ConfigKeyHelper helper = new ConfigKeyHelper(new $.F0<Act.Mode>() {
|
||||
@Override
|
||||
|
@ -20,7 +20,7 @@ package act.controller.bytecode;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.AppByteCodeScanner;
|
||||
import act.app.AppCodeScannerManager;
|
||||
import act.app.TestingAppClassLoader;
|
||||
@ -55,7 +55,7 @@ import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.osgl.http.H.Method.*;
|
||||
|
||||
public class ControllerByteCodeScannerTest extends TestBase {
|
||||
public class ControllerByteCodeScannerTest extends ActTestBase {
|
||||
|
||||
private ControllerClassMetaInfoManager infoSrc;
|
||||
private ClassInfoRepository classInfoRepository;
|
||||
@ -144,6 +144,8 @@ public class ControllerByteCodeScannerTest extends TestBase {
|
||||
verify(mockRouter).addMapping(GET, "/foo/bar", "testapp.controller.WithContextPath.bar", RouteSource.ACTION_ANNOTATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void verifyWithAppContextNoReturnNoParam() {
|
||||
String url = "/no_ret_no_param";
|
||||
verifyRouting(url, "WithAppContext", "noReturnNoParam", GET, PUT);
|
||||
@ -169,6 +171,8 @@ public class ControllerByteCodeScannerTest extends TestBase {
|
||||
assertNoParam(ff_f1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void verifyWithAppContextStaticNoReturnNoParam() {
|
||||
String url = "/static_no_ret_no_param";
|
||||
verifyRouting(url, "WithAppContext", "staticReturnStringNoParam", GET);
|
||||
|
@ -20,7 +20,7 @@ package act.controller.bytecode;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.ActionContext;
|
||||
import act.app.AppByteCodeScanner;
|
||||
import act.app.AppCodeScannerManager;
|
||||
@ -60,7 +60,7 @@ import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class ControllerEnhancerTest extends TestBase implements ControllerClassMetaInfoHolder {
|
||||
public class ControllerEnhancerTest extends ActTestBase implements ControllerClassMetaInfoHolder {
|
||||
|
||||
public static final String TMPL_PATH = "/path/to/template";
|
||||
|
||||
|
@ -20,14 +20,14 @@ package act.data;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import testapp.model.Person;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DataPropertyRepositoryTest extends TestBase {
|
||||
public class DataPropertyRepositoryTest extends ActTestBase {
|
||||
private DataPropertyRepository repo;
|
||||
|
||||
@Before
|
||||
|
@ -20,14 +20,14 @@ package act.event;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public class EventBusTest extends TestBase {
|
||||
public class EventBusTest extends ActTestBase {
|
||||
|
||||
private EventBus eventBus;
|
||||
|
||||
|
@ -22,7 +22,7 @@ package act.handler.builtin;
|
||||
|
||||
import act.MockResponse;
|
||||
import act.RequestImplBase;
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.ActionContext;
|
||||
import act.controller.ParamNames;
|
||||
import org.junit.Before;
|
||||
@ -35,11 +35,10 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.doNothing;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class StaticFileGetterTest extends TestBase {
|
||||
public class StaticFileGetterTest extends ActTestBase {
|
||||
ActionContext ctx;
|
||||
MockResponse resp;
|
||||
StaticFileGetter pathHandler;
|
||||
|
53
src/test/java/act/internal/util/JavaNamesTest.java
Normal file
53
src/test/java/act/internal/util/JavaNamesTest.java
Normal file
@ -0,0 +1,53 @@
|
||||
package act.internal.util;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* ACT Framework
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2017 ActFramework
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import org.junit.Test;
|
||||
import org.osgl.ut.TestBase;
|
||||
|
||||
public class JavaNamesTest extends TestBase {
|
||||
|
||||
@Test
|
||||
public void emptyOrNullStringIsNotValidPackageOrClassName() {
|
||||
no(JavaNames.isPackageOrClassName(null));
|
||||
no(JavaNames.isPackageOrClassName(""));
|
||||
no(JavaNames.isPackageOrClassName(" "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringContainsSpaceCharactersIsNotValidPackageOrClassName() {
|
||||
no(JavaNames.isPackageOrClassName("a b"));
|
||||
no(JavaNames.isPackageOrClassName("com.zed d.bb"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringWithoutDotInsideIsNotValidPackageOrClassName() {
|
||||
no(JavaNames.isPackageOrClassName("com"));
|
||||
no(JavaNames.isPackageOrClassName("TheClass"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidPackageOrClassNames() {
|
||||
yes(JavaNames.isPackageOrClassName("org.osgl.ut"));
|
||||
yes(JavaNames.isPackageOrClassName("org.osgl.ut.TestBase"));
|
||||
}
|
||||
|
||||
}
|
@ -20,7 +20,7 @@ package act.mail;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.AppByteCodeScanner;
|
||||
import act.app.AppCodeScannerManager;
|
||||
import act.app.TestingAppClassLoader;
|
||||
@ -52,7 +52,7 @@ import java.util.List;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class MailerEnhancerTest extends TestBase implements MailerClassMetaInfoHolder {
|
||||
public class MailerEnhancerTest extends ActTestBase implements MailerClassMetaInfoHolder {
|
||||
|
||||
public static final String TMPL_PATH = "/path/to/template";
|
||||
|
||||
|
@ -20,11 +20,11 @@ package act.metric;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SimpleMetricStoreTest extends TestBase {
|
||||
public class SimpleMetricStoreTest extends ActTestBase {
|
||||
private SimpleMetricStore store;
|
||||
|
||||
@Before
|
||||
|
@ -22,13 +22,13 @@ package act.plugin;
|
||||
|
||||
import act.Act;
|
||||
import act.BootstrapClassLoaderTestRunner;
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(BootstrapClassLoaderTestRunner.class)
|
||||
public class PluginScannerTest extends TestBase {
|
||||
public class PluginScannerTest extends ActTestBase {
|
||||
|
||||
protected PluginScanner pluginScanner;
|
||||
|
||||
|
@ -20,7 +20,7 @@ package act.route;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.App;
|
||||
import act.handler.RequestHandler;
|
||||
import act.handler.RequestHandlerResolver;
|
||||
@ -95,7 +95,7 @@ public class RouteTableRouterBuilderTest extends RouterTestBase {
|
||||
addRouteMap("GET /public file:/public");
|
||||
RequestHandler h = router.getInvoker(GET, "/public/file1.txt", ctx);
|
||||
yes(h instanceof StaticFileGetter);
|
||||
eq(new File("target/test-classes/public"), TestBase.fieldVal(h, "base"));
|
||||
eq(new File("target/test-classes/public"), ActTestBase.fieldVal(h, "base"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -20,7 +20,7 @@ package act.route;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.ActionContext;
|
||||
import act.app.App;
|
||||
import act.conf.AppConfig;
|
||||
@ -34,7 +34,7 @@ import java.io.File;
|
||||
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
public abstract class RouterTestBase extends TestBase {
|
||||
public abstract class RouterTestBase extends ActTestBase {
|
||||
|
||||
protected Router router;
|
||||
protected RequestHandler controller;
|
||||
|
@ -20,7 +20,7 @@ package act.security;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.util.AppCrypto;
|
||||
import act.conf.AppConfig;
|
||||
import act.ws.StringSecureTicketCodec;
|
||||
@ -28,7 +28,7 @@ import org.junit.Test;
|
||||
import org.osgl.http.H;
|
||||
import org.osgl.util.S;
|
||||
|
||||
public abstract class StringSecureTicketCodecTest extends TestBase {
|
||||
public abstract class StringSecureTicketCodecTest extends ActTestBase {
|
||||
|
||||
protected abstract StringSecureTicketCodec codec();
|
||||
|
||||
|
@ -20,7 +20,7 @@ package act.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import org.junit.Test;
|
||||
import org.osgl.mvc.annotation.GetAction;
|
||||
|
||||
@ -28,7 +28,7 @@ import javax.inject.Singleton;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
public class AnnotationUtilTest extends TestBase {
|
||||
public class AnnotationUtilTest extends ActTestBase {
|
||||
|
||||
@Singleton
|
||||
static class Base {}
|
||||
|
@ -20,7 +20,7 @@ package act.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.asm.ClassReader;
|
||||
import act.asm.ClassVisitor;
|
||||
import act.asm.ClassWriter;
|
||||
@ -31,7 +31,6 @@ import org.osgl.$;
|
||||
import org.osgl.util.E;
|
||||
import org.osgl.util.IO;
|
||||
import org.osgl.util.S;
|
||||
import testapp.model.Person2;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
@ -39,10 +38,7 @@ import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static testapp.model.Person2.Gender.F;
|
||||
import static testapp.model.Person2.Gender.M;
|
||||
|
||||
public class DataObjectEnhancerTest extends TestBase {
|
||||
public class DataObjectEnhancerTest extends ActTestBase {
|
||||
|
||||
public static final String TMPL_PATH = "/path/to/template";
|
||||
|
||||
|
@ -20,7 +20,7 @@ package act.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import com.alibaba.fastjson.parser.ParserConfig;
|
||||
@ -31,7 +31,7 @@ import org.junit.Test;
|
||||
import org.osgl.util.KV;
|
||||
import org.osgl.util.KVStore;
|
||||
|
||||
public class FastJsonKvCodecTest extends TestBase {
|
||||
public class FastJsonKvCodecTest extends ActTestBase {
|
||||
|
||||
private KV kv;
|
||||
|
||||
|
@ -20,7 +20,7 @@ package act.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.data.DataPropertyRepository;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.junit.Before;
|
||||
@ -32,7 +32,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
public class FastJsonPropertyPreFilterTest extends TestBase {
|
||||
public class FastJsonPropertyPreFilterTest extends ActTestBase {
|
||||
private FastJsonPropertyPreFilter filter;
|
||||
private Foo foo;
|
||||
private Foo foo2;
|
||||
|
@ -20,7 +20,7 @@ package act.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.asm.Type;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@ -29,7 +29,7 @@ import org.osgl.mvc.annotation.Action;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public class GeneralAnnoInfoTest extends TestBase {
|
||||
public class GeneralAnnoInfoTest extends ActTestBase {
|
||||
private GeneralAnnoInfo actionInfo;
|
||||
private GeneralAnnoInfo notNullInfo;
|
||||
|
||||
|
@ -20,7 +20,7 @@ package act.util;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import act.app.App;
|
||||
import act.app.util.AppCrypto;
|
||||
import act.conf.AppConfig;
|
||||
@ -33,7 +33,7 @@ import static org.mockito.Mockito.*;
|
||||
/**
|
||||
* Test {@link SessionManager}
|
||||
*/
|
||||
public class SessionManagerTest extends TestBase {
|
||||
public class SessionManagerTest extends ActTestBase {
|
||||
App app;
|
||||
AppConfig config;
|
||||
AppCrypto crypto;
|
||||
|
@ -20,12 +20,12 @@ package act.xio;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.TestBase;
|
||||
import act.ActTestBase;
|
||||
import org.junit.Test;
|
||||
import org.osgl.$;
|
||||
import org.osgl.http.H;
|
||||
|
||||
public class ContentSuffixSensorTest extends TestBase {
|
||||
public class ContentSuffixSensorTest extends ActTestBase {
|
||||
|
||||
private $.Var<H.Format> fmtBag = $.var();
|
||||
|
||||
|
@ -35,12 +35,10 @@ package fc.cron;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import fc.cron.CronExpression.CronFieldType;
|
||||
import fc.cron.CronExpression.DayOfMonthField;
|
||||
import fc.cron.CronExpression.DayOfWeekField;
|
||||
import fc.cron.CronExpression.SimpleField;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.Hours;
|
||||
@ -49,10 +47,11 @@ import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import fc.cron.CronExpression.CronFieldType;
|
||||
import fc.cron.CronExpression.DayOfMonthField;
|
||||
import fc.cron.CronExpression.DayOfWeekField;
|
||||
import fc.cron.CronExpression.SimpleField;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.fest.assertions.Assertions.assertThat;
|
||||
|
||||
public class CronExpressionTest {
|
||||
DateTimeZone original;
|
||||
@ -498,7 +497,7 @@ public class CronExpressionTest {
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void test_two_year_barrier() throws Exception {
|
||||
// The next leap year is 2016, so an IllegalArgumentException is expected.
|
||||
new CronExpression("* * * 29 2 *").nextTimeAfter(new DateTime(2012, 3, 1, 00, 00), 1000 * 60 * 60 * 24 * 356 * 2);
|
||||
new CronExpression("* * * 29 2 *").nextTimeAfter(new DateTime(2012, 3, 1, 00, 00), 1000L * 60 * 60 * 24 * 356 * 2);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
@ -33,6 +33,7 @@ public class NotStartsWith extends ArgumentMatcher<String> implements Serializab
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Object actual) {
|
||||
return actual != null && !((String)actual).startsWith(this.prefix);
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ package testapp.controller;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.Act;
|
||||
import act.app.ActionContext;
|
||||
import act.boot.app.RunApp;
|
||||
import org.osgl.http.H;
|
||||
import org.osgl.mvc.annotation.Before;
|
||||
import org.osgl.mvc.annotation.GetAction;
|
||||
@ -74,7 +74,7 @@ public class HelloWorldApp {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
RunApp.start(HelloWorldApp.class);
|
||||
Act.start(HelloWorldApp.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ package testapp.controller;
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import act.Act;
|
||||
import act.app.ActionContext;
|
||||
import act.boot.app.RunApp;
|
||||
import act.controller.Controller;
|
||||
import org.osgl.http.H;
|
||||
import org.osgl.mvc.annotation.Before;
|
||||
@ -61,6 +61,6 @@ public class VoidResultWithParamCtxFieldEmptyBody {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
RunApp.start(HelloWorldApp.class);
|
||||
Act.start(HelloWorldApp.class);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ package testapp.util;
|
||||
public class InvokeLogFactory {
|
||||
private static InvokeLog log;
|
||||
public static void set(InvokeLog log) {
|
||||
log = log;
|
||||
InvokeLogFactory.log = log;
|
||||
}
|
||||
public static InvokeLog get() {
|
||||
return log;
|
||||
|
@ -47,7 +47,7 @@
|
||||
<groupId>org.actframework</groupId>
|
||||
<artifactId>testapp</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.4.0</version>
|
||||
<version>1.4</version>
|
||||
|
||||
<name>ACT TEST APP</name>
|
||||
<description>Test ActFramework</description>
|
||||
@ -63,7 +63,7 @@
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<act.version>[1.4.0-SNAPSHOT, 1.4.100)</act.version>
|
||||
<act.storage.version>[0.7.0, 2.0.0)</act.storage.version>
|
||||
<act.morphia.version>[1.3.0-SNAPSHOT, 1.3.100)</act.morphia.version>
|
||||
<act.morphia.version>[1.2.0, 1.2.100)</act.morphia.version>
|
||||
<app.entry>testapp.TestApp</app.entry>
|
||||
</properties>
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package testapp;
|
||||
|
||||
import act.app.conf.AppConfigurator;
|
||||
import act.boot.app.RunApp;
|
||||
import act.security.CSRFProtector;
|
||||
|
||||
import static testapp.TestApp.GLOBAL_CORS.*;
|
||||
|
||||
import act.Act;
|
||||
import act.app.conf.AppConfigurator;
|
||||
import act.security.CSRFProtector;
|
||||
|
||||
/**
|
||||
* This class runs an ActFramework application with public endpoints to be
|
||||
* tested
|
||||
@ -32,7 +32,7 @@ public class TestApp extends AppConfigurator<TestApp> {
|
||||
System.setProperty("act.http.port", "6111");
|
||||
System.setProperty("act.cli.port", "6222");
|
||||
System.setProperty("act.i18n", "true");
|
||||
RunApp.start("ACTEST", "0.1", TestApp.class);
|
||||
Act.start("ACTEST");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package testapp.endpoint;
|
||||
|
||||
import act.Act;
|
||||
import act.app.App;
|
||||
import org.osgl.inject.annotation.Provided;
|
||||
import org.osgl.mvc.annotation.GetAction;
|
||||
@ -11,12 +10,7 @@ public class SysController {
|
||||
|
||||
@GetAction("/shutdown")
|
||||
public void shutdown(final @Provided App app) {
|
||||
app.jobManager().now(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Act.shutdownApp(app);
|
||||
}
|
||||
});
|
||||
app.jobManager().now(app::shutdown);
|
||||
}
|
||||
|
||||
@GetAction("/ping")
|
||||
|
@ -46,10 +46,6 @@
|
||||
</triggeringPolicy>
|
||||
</appender>
|
||||
|
||||
<logger name="act.boot.app.RunApp" level="INFO" additivity="false">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</logger>
|
||||
|
||||
<logger name="act" level="INFO" additivity="false">
|
||||
<appender-ref ref="FILE" />
|
||||
<appender-ref ref="STDOUT"/>
|
||||
|
3
testapp/src/main/resources/testapp/.version
Normal file
3
testapp/src/main/resources/testapp/.version
Normal file
@ -0,0 +1,3 @@
|
||||
artifact=${project.artifactId}
|
||||
version=${project.version}
|
||||
build=${buildNumber}
|
Loading…
Reference in New Issue
Block a user