├── .gitignore
├── LICENSE
├── README.md
├── athena-doc
├── Restful服务框架(Athena) - CI集成 - 一键打包配置向导.docx
├── Restful服务框架(Athena) - 介绍 - 李艳鹏.pptx
├── Restful服务框架(Athena) - 开发计划.xlsx
├── Restful服务框架(Athena) - 性能压测报告.docx
├── Restful服务框架(Athena) - 构建新服务用户向导.docx
├── Restful服务框架(Athena) - 架构设计.docx
└── Restful服务框架(Athena) - 移植老服务用户向导.docx
├── athena-example
├── .gitignore
├── athena-example-data
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── robert
│ │ │ └── athena
│ │ │ └── example
│ │ │ └── data
│ │ │ └── App.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── robert
│ │ └── athena
│ │ └── example
│ │ └── data
│ │ └── AppTest.java
├── athena-example-rest
│ ├── .gitignore
│ ├── assembly.xml
│ ├── pom.xml
│ ├── src
│ │ ├── main
│ │ │ ├── filters
│ │ │ │ ├── filter-dev.properties
│ │ │ │ ├── filter-integrate.properties
│ │ │ │ ├── filter-release.properties
│ │ │ │ └── filter-test.properties
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── robert
│ │ │ │ │ └── athena
│ │ │ │ │ └── example
│ │ │ │ │ └── rest
│ │ │ │ │ └── ExampleServiceController.java
│ │ │ └── resources
│ │ │ │ └── spring
│ │ │ │ ├── athena-rest-context.properties
│ │ │ │ └── athena-rest-context.xml
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── robert
│ │ │ └── athena
│ │ │ └── example
│ │ │ └── rest
│ │ │ └── AppTest.java
│ └── webapp
│ │ └── WEB-INF
│ │ └── web.xml
├── athena-example-service
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── robert
│ │ │ │ └── athena
│ │ │ │ └── example
│ │ │ │ └── service
│ │ │ │ ├── ExampleService.java
│ │ │ │ └── ExampleServiceImpl.java
│ │ └── resources
│ │ │ └── spring
│ │ │ └── athena-rest-service.xml
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── robert
│ │ └── athena
│ │ └── example
│ │ └── service
│ │ └── AppTest.java
└── pom.xml
├── athena-rest-build
├── .gitignore
├── assembly.xml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── robert
│ │ │ └── athena
│ │ │ └── rest
│ │ │ └── build
│ │ │ └── App.java
│ ├── jenkins-bin
│ │ ├── athena-example
│ │ │ ├── build-athena-example-integrate.sh
│ │ │ └── build-athena-example-test.sh
│ │ ├── comm
│ │ │ └── build.sh
│ │ ├── logistics-platform
│ │ │ └── build-athena-example-test.sh
│ │ └── readme.txt
│ └── release-bin
│ │ ├── bin
│ │ └── deploy.sh
│ │ ├── conf
│ │ └── deploy.properties
│ │ ├── dcmd-bin
│ │ ├── dcmd_check.sh
│ │ ├── dcmd_start.sh
│ │ ├── dcmd_stop.sh
│ │ └── server.sh
│ │ └── properties
│ │ ├── athena-example
│ │ ├── filter
│ │ │ ├── filter-integrate.properties
│ │ │ ├── filter-release.properties
│ │ │ └── filter-test.properties
│ │ └── server.properties
│ │ └── logistics-platform
│ │ ├── filter
│ │ ├── filter-release.properties
│ │ └── filter-test.properties
│ │ └── server.properties
│ └── test
│ └── java
│ └── com
│ └── robert
│ └── athena
│ └── rest
│ └── build
│ └── AppTest.java
├── athena-rest-framework
├── .gitignore
├── athena-rest-comm
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── robert
│ │ │ └── athena
│ │ │ └── rest
│ │ │ └── util
│ │ │ ├── FileUtils.java
│ │ │ ├── StringUtils.java
│ │ │ └── Utils.java
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── robert
│ │ └── athena
│ │ └── rest
│ │ └── util
│ │ └── AppTest.java
├── athena-rest-container
│ ├── .gitignore
│ ├── pom.xml
│ ├── src
│ │ ├── main
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── robert
│ │ │ │ │ └── athena
│ │ │ │ │ └── rest
│ │ │ │ │ └── container
│ │ │ │ │ ├── AbstractContainerServer.java
│ │ │ │ │ ├── AthenaRestMainServer.java
│ │ │ │ │ ├── ContainerServer.java
│ │ │ │ │ ├── JettyServer.java
│ │ │ │ │ ├── TomcatServer.java
│ │ │ │ │ └── WebappGen.java
│ │ │ └── resources
│ │ │ │ └── tomcat.properties
│ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── robert
│ │ │ └── athena
│ │ │ └── rest
│ │ │ └── container
│ │ │ └── AppTest.java
│ └── webapp
│ │ └── WEB-INF
│ │ └── web.xml
├── athena-rest-webapp
│ ├── .gitignore
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── robert
│ │ │ │ └── athena
│ │ │ │ └── rest
│ │ │ │ └── container
│ │ │ │ └── admin
│ │ │ │ ├── AdminController.java
│ │ │ │ └── bean
│ │ │ │ ├── BaseResult.java
│ │ │ │ └── ReturnStatus.java
│ │ └── resources
│ │ │ ├── spring
│ │ │ └── athena-rest-container.xml
│ │ │ └── webapp
│ │ │ ├── WEB-INF
│ │ │ └── web.xml
│ │ │ └── index.jsp
│ │ └── test
│ │ └── java
│ │ └── org
│ │ └── athena
│ │ └── rest
│ │ └── webapp
│ │ └── AppTest.java
└── pom.xml
├── athena-rest-wizard
├── .gitignore
├── README.txt
├── assembly.xml
├── pom.xml
└── src
│ ├── main
│ ├── java
│ │ └── com
│ │ │ └── robert
│ │ │ └── athena
│ │ │ └── restwizard
│ │ │ └── AthenaRestWizard.java
│ ├── resources
│ │ └── athena-example.zip
│ └── scripts
│ │ ├── start.bat
│ │ └── start.sh
│ └── test
│ └── java
│ └── com
│ └── robert
│ └── athena
│ └── athena_rest_wizard
│ └── AppTest.java
├── deploy-maven.sh
├── make-release.sh
├── pom.xml
└── todo-list
├── 20150529_100800.jpg
├── 20150529_100809.jpg
├── 20150529_100813.jpg
├── 20150529_100824.jpg
├── 20150529_100831.jpg
└── todo.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /releases
3 | /distribution
4 | /.settings
5 | .project
6 | .classpath
7 | *.class
8 | *.tmp
9 | /tomcat.10025
10 |
11 | # Package Files #
12 | *.jar
13 | *.war
14 | *.ear
15 |
16 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
17 | hs_err_pid*
18 |
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Athena
2 |
3 | **Athena**是一款简单易用,面向架构和发布流程优化,并且具有丰富使用文档的Restful服务框架。架构上,它与Spring Web MVC无缝集成,使业务项目没有任何框架代码的侵入,并且能够与CI一键发布流程完美结合。它提供了新项目生成工具,可以一键生成新业务项目的骨架,生成后可以立即进行业务开发。对于老的业务项目,通过仅仅的几个步骤即可完成老业务项目的移植。它提供了内嵌的Web容器,可在本地开发环境直接调试代码,大大的方便开发者的开发调试工作。通过抽象了容器层,Webapp层和发布层,方便在通用层进行GC优化,线程池优化,NIO优化,服务和服务器状态管理,以及在通用层实现Restful定义的各种规范,例如:异常代码的转换,Bean部分属性的请求,子Bean的请求,分页的参数解析等。它合理的分离了业务开发人员,框架开发人员,运维人员以及配置管理人员的职责,使开发上线流程清晰合理。
4 |
5 | ##主页
6 |
7 | >**[http://athena.cloudate.net/](http://athena.cloudate.net/)**
8 |
9 | ##版本
10 |
11 | >当前版本: **[0.0.1](http://athena.cloudate.net/)**
12 |
13 | ##下载
14 |
15 | - **[*框架容器层*](http://athena.cloudate.net/athena/athena-rest-container-0.0.1.jar)**
16 | - **[*框架App层*](http://athena.cloudate.net/athena/athena-rest-webapp-0.0.1.jar)**
17 | - **[*框架通用层*](http://athena.cloudate.net/athena/athena-rest-comm-0.0.1.jar)**
18 | - **[*发布集成模块*](http://athena.cloudate.net/athena/athena-rest-build-0.0.1-bin.tar.gz)**
19 | - **[*应用生成向导*](http://athena.cloudate.net/athena/athena-rest-wizard-0.0.1-bin.zip)**
20 | - **[*应用示例下载*](http://athena.cloudate.net/athena/athena-example-rest-0.0.1.tar.gz)**
21 |
22 |
23 | ##Github源码
24 |
25 | - **[*https://github.com/robertleepeak/athena-rest.git*](https://github.com/robertleepeak/athena-rest.git)**
26 |
27 | 从下面Git地址克隆后,对于源码包里面的顶层项目执行: **mvn deploy**, 来安装发布包到你的私服。
28 |
29 | ##文档
30 |
31 | - ***架构设计***
32 | - ***开发计划***
33 | - ***性能压测报告.docx***
34 | - ***构建新服务用户向导***
35 | - ***移植老服务用户向导***
36 | - ***CI集成 - 一键打包配置向导***
37 |
38 | ## PPT
39 | - ***PPT介绍***
40 |
41 |
42 | ## QQ群/微信公众号
43 | -
44 |
45 | -
46 |
47 | ## 关于作者
48 | - 罗伯特出品 微信: 13436881186
--------------------------------------------------------------------------------
/athena-doc/Restful服务框架(Athena) - CI集成 - 一键打包配置向导.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/athena-doc/Restful服务框架(Athena) - CI集成 - 一键打包配置向导.docx
--------------------------------------------------------------------------------
/athena-doc/Restful服务框架(Athena) - 介绍 - 李艳鹏.pptx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/athena-doc/Restful服务框架(Athena) - 介绍 - 李艳鹏.pptx
--------------------------------------------------------------------------------
/athena-doc/Restful服务框架(Athena) - 开发计划.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/athena-doc/Restful服务框架(Athena) - 开发计划.xlsx
--------------------------------------------------------------------------------
/athena-doc/Restful服务框架(Athena) - 性能压测报告.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/athena-doc/Restful服务框架(Athena) - 性能压测报告.docx
--------------------------------------------------------------------------------
/athena-doc/Restful服务框架(Athena) - 构建新服务用户向导.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/athena-doc/Restful服务框架(Athena) - 构建新服务用户向导.docx
--------------------------------------------------------------------------------
/athena-doc/Restful服务框架(Athena) - 架构设计.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/athena-doc/Restful服务框架(Athena) - 架构设计.docx
--------------------------------------------------------------------------------
/athena-doc/Restful服务框架(Athena) - 移植老服务用户向导.docx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/athena-doc/Restful服务框架(Athena) - 移植老服务用户向导.docx
--------------------------------------------------------------------------------
/athena-example/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /releases
3 | /distribution
4 | /.settings
5 | .project
6 | .classpath
7 | *.class
8 | *.tmp
9 | /tomcat.10025
10 |
11 | # Package Files #
12 | *.jar
13 | *.war
14 | *.ear
15 |
16 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
17 | hs_err_pid*
18 |
19 |
--------------------------------------------------------------------------------
/athena-example/athena-example-data/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /distribution
3 | /.settings
4 | .project
5 | .classpath
6 | *.class
7 | *.tmp
8 | /tomcat.10025
9 | /target
10 |
--------------------------------------------------------------------------------
/athena-example/athena-example-data/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | com.robert.athena
9 | athena-example
10 | 0.0.1
11 |
12 |
13 | com.robert.athena
14 | athena-example-data
15 | 0.0.1
16 | athena-example-data
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | junit
25 | junit
26 | 3.8.1
27 | test
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/athena-example/athena-example-data/src/main/java/com/robert/athena/example/data/App.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.example.data;
2 |
3 | /**
4 | * Hello world!
5 | *
6 | */
7 | public class App
8 | {
9 | public static void main( String[] args )
10 | {
11 | System.out.println( "Hello World!" );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/athena-example/athena-example-data/src/test/java/com/robert/athena/example/data/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.example.data;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /distribution
3 | /.settings
4 | .project
5 | .classpath
6 | *.class
7 | *.tmp
8 | /tomcat.10025
9 | /target
10 |
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/assembly.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | package
5 |
6 |
7 | tar.gz
8 |
9 | false
10 |
11 |
12 |
13 | lib
14 | true
15 | runtime
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | com.robert.athena
9 | athena-example
10 | 0.0.1
11 |
12 |
13 | com.robert.athena
14 | athena-example-rest
15 | 0.0.1
16 | athena-example-rest
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | junit
25 | junit
26 | 3.8.1
27 | test
28 |
29 |
30 |
31 | com.robert.athena
32 | athena-rest-webapp
33 | 0.0.1
34 |
35 |
36 |
37 | com.robert.athena
38 | athena-example-service
39 | 0.0.1
40 |
41 |
42 |
43 |
44 |
45 | dev
46 |
47 | dev
48 |
49 |
50 | true
51 |
52 |
53 |
54 | test
55 |
56 | test
57 |
58 |
59 |
60 | integrate
61 |
62 | integrate
63 |
64 |
65 |
66 | release
67 |
68 | release
69 |
70 |
71 |
72 |
73 |
74 |
75 | src/main/filters/filter-${env}.properties
76 |
77 |
78 |
79 |
80 | src/main/resources
81 | true
82 |
83 |
84 |
85 |
86 |
87 | org.apache.maven.plugins
88 | maven-jar-plugin
89 |
90 |
91 |
92 | true
93 | com.robert.athena.rest.container.AthenaRestMainServer
94 |
95 |
96 |
97 |
98 |
99 |
100 | maven-assembly-plugin
101 |
102 | false
103 | utf-8
104 |
105 | ${basedir}/assembly.xml
106 |
107 | ${basedir}/../target/
108 |
109 |
110 |
111 | make-assembly
112 | package
113 |
114 | single
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/src/main/filters/filter-dev.properties:
--------------------------------------------------------------------------------
1 | test.property = This is dev env.
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/src/main/filters/filter-integrate.properties:
--------------------------------------------------------------------------------
1 | test.property = This is integrate env.
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/src/main/filters/filter-release.properties:
--------------------------------------------------------------------------------
1 | test.property = This is release env.
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/src/main/filters/filter-test.properties:
--------------------------------------------------------------------------------
1 | test.property = this is test env.
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/src/main/java/com/robert/athena/example/rest/ExampleServiceController.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.example.rest;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.web.bind.annotation.PathVariable;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.RequestMethod;
11 | import org.springframework.web.bind.annotation.ResponseBody;
12 |
13 | import com.robert.athena.example.service.ExampleService;
14 |
15 | @Controller
16 | public class ExampleServiceController {
17 | @Autowired
18 | private ExampleService exampleService;
19 |
20 | @RequestMapping(value = "/1/test", method = RequestMethod.GET)
21 | @ResponseBody
22 | public String serverStatus() {
23 | return exampleService.helloworld();
24 | }
25 |
26 | @RequestMapping(value = "/1/test/{person}:({fields})", method = RequestMethod.GET)
27 | @ResponseBody
28 | public String testGetSubFields(@PathVariable String person,
29 | @PathVariable String fields) {
30 | return person + "@" + fields;
31 | }
32 |
33 | @RequestMapping(value = "/1/test/{person}:[{beans}]", method = RequestMethod.GET)
34 | @ResponseBody
35 | public String testGetChildBean(@PathVariable String person,
36 | @PathVariable String beans) {
37 | return person + "@" + beans;
38 | }
39 |
40 | @RequestMapping(value = "/1/test/dogs", method = RequestMethod.GET)
41 | @ResponseBody
42 | public String testPaging(String limit, String offset) {
43 | return limit + "@" + offset;
44 | }
45 |
46 | @RequestMapping(value = "/1/pets/{petId}.json", method = RequestMethod.GET, produces = "application/json")
47 | @ResponseBody
48 | public Map getGetPetJson(@PathVariable String petId) {
49 | Map map = new HashMap();
50 | map.put("key", "value");
51 | map.put("key1", "value1");
52 |
53 | return map;
54 | }
55 |
56 | @RequestMapping(value = "/1/pets/{petId}.xml", method = RequestMethod.GET, produces = "application/xml")
57 | @ResponseBody
58 | public Map getGetPetXml(@PathVariable String petId) {
59 | Map map = new HashMap();
60 | map.put("key", "value");
61 | map.put("key1", "value1");
62 |
63 | return map;
64 | }
65 |
66 | @RequestMapping(value = "/exception", method = RequestMethod.GET)
67 | @ResponseBody
68 | public String exception() throws Exception {
69 | throw new Exception();
70 | }
71 |
72 | @RequestMapping(value = "/runtime-exception", method = RequestMethod.GET)
73 | @ResponseBody
74 | public String runtimeException() {
75 | throw new RuntimeException();
76 | }
77 |
78 | @RequestMapping(value = "/throwable", method = RequestMethod.GET)
79 | @ResponseBody
80 | public String throwable() throws Throwable {
81 | throw new Throwable();
82 | }
83 |
84 | @RequestMapping(value = "/io-exception", method = RequestMethod.GET)
85 | @ResponseBody
86 | public String ioException() throws Throwable {
87 | throw new Throwable();
88 | }
89 |
90 | public void setExampleService(ExampleService exampleService) {
91 | this.exampleService = exampleService;
92 | }
93 |
94 | }
95 |
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/src/main/resources/spring/athena-rest-context.properties:
--------------------------------------------------------------------------------
1 | test.property = ${test.property}
2 |
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/src/main/resources/spring/athena-rest-context.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
11 |
12 |
13 | classpath:spring/athena-rest-context.properties
14 |
15 |
16 |
17 | UTF-8
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/src/test/java/com/robert/athena/example/rest/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.example.rest;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest extends TestCase {
11 | /**
12 | * Create the test case
13 | *
14 | * @param testName
15 | * name of the test case
16 | */
17 | public AppTest(String testName) {
18 | super(testName);
19 | }
20 |
21 | /**
22 | * @return the suite of tests being tested
23 | */
24 | public static Test suite() {
25 | return new TestSuite(AppTest.class);
26 | }
27 |
28 | /**
29 | * Rigourous Test :-)
30 | */
31 | public void testApp() {
32 | assertTrue(true);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/athena-example/athena-example-rest/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | robert Athena Rest Framework
7 |
8 |
9 | HttpMethodFilter
10 | org.springframework.web.filter.HttpPutFormContentFilter
11 |
12 |
13 |
14 | HttpMethodFilter
15 | /*
16 |
17 |
18 |
19 | spring-dispatcher-servlet
20 | org.springframework.web.servlet.DispatcherServlet
21 |
22 | contextConfigLocation
23 | classpath:spring/athena-rest-container.xml
24 |
25 | 1
26 |
27 |
28 |
29 | spring-dispatcher-servlet
30 | /*
31 |
32 |
33 |
34 | /error-default
35 |
36 |
--------------------------------------------------------------------------------
/athena-example/athena-example-service/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /distribution
3 | /.settings
4 | .project
5 | .classpath
6 | *.class
7 | *.tmp
8 | /tomcat.10025
9 | /target
10 |
--------------------------------------------------------------------------------
/athena-example/athena-example-service/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | com.robert.athena
9 | athena-example
10 | 0.0.1
11 |
12 |
13 | com.robert.athena
14 | athena-example-service
15 | 0.0.1
16 | athena-example-service
17 |
18 |
19 |
20 | UTF-8
21 |
22 |
23 |
--------------------------------------------------------------------------------
/athena-example/athena-example-service/src/main/java/com/robert/athena/example/service/ExampleService.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.example.service;
2 |
3 | public interface ExampleService {
4 | public String helloworld();
5 | }
6 |
--------------------------------------------------------------------------------
/athena-example/athena-example-service/src/main/java/com/robert/athena/example/service/ExampleServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.example.service;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.stereotype.Service;
5 |
6 | @Service
7 | public class ExampleServiceImpl implements ExampleService{
8 | @Value("${test.property}")
9 | private String word;
10 |
11 | public String helloworld() {
12 | return word;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/athena-example/athena-example-service/src/main/resources/spring/athena-rest-service.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/athena-example/athena-example-service/src/test/java/com/robert/athena/example/service/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.example.service;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/athena-example/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.robert.athena
7 | athena-example
8 | 0.0.1
9 | pom
10 | athena-example
11 | Athena Example
12 |
13 |
14 | athena-example-rest
15 | athena-example-service
16 | athena-example-data
17 |
18 |
19 |
20 | com.robert.athena
21 | athena-rest-framework
22 | 0.0.1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/athena-rest-build/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /releases
3 | /distribution
4 | /.settings
5 | .project
6 | .classpath
7 | *.class
8 | *.tmp
9 | /tomcat.10025
10 |
11 | # Package Files #
12 | *.jar
13 | *.war
14 | *.ear
15 |
16 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
17 | hs_err_pid*
18 |
19 |
--------------------------------------------------------------------------------
/athena-rest-build/assembly.xml:
--------------------------------------------------------------------------------
1 |
2 | bin
3 |
4 | tar.gz
5 |
6 |
7 | false
8 |
9 |
10 |
11 |
12 | ${basedir}/src/main/release-bin
13 |
14 |
15 |
16 | /
17 |
18 | ${basedir}/README.txt
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/athena-rest-build/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.robert.athena
8 | athena-rest-framework
9 | 0.0.1
10 |
11 | com.robert.athena
12 | athena-rest-build
13 | 0.0.1
14 | athena-rest-build
15 | http://maven.apache.org
16 |
17 | UTF-8
18 |
19 |
20 |
21 |
22 | junit
23 | junit
24 | 3.8.1
25 | test
26 |
27 |
28 |
29 |
30 |
31 |
32 | org.apache.maven.plugins
33 | maven-assembly-plugin
34 | 2.2.1
35 |
36 |
37 | assembly.xml
38 |
39 |
40 |
41 |
42 | make-assembly
43 | package
44 |
45 | single
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/java/com/robert/athena/rest/build/App.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.build;
2 |
3 | /**
4 | * Hello world!
5 | *
6 | */
7 | public class App
8 | {
9 | public static void main( String[] args )
10 | {
11 | System.out.println( "Hello World!" );
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/jenkins-bin/athena-example/build-athena-example-integrate.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source ../comm/build.sh
4 |
5 | ./bin/deploy.sh -pd -s athena-example -e integrate
6 |
7 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/jenkins-bin/athena-example/build-athena-example-test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source ../comm/build.sh
4 |
5 | ./bin/deploy.sh -pd -s athena-example -e test
6 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/jenkins-bin/comm/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | rm -fr athena-rest-build-0.0.1-bin*
4 | wget http://10.77.144.192:11081/nexus/content/repositories/releases/com/robert/athena/athena-rest-build/0.0.1/athena-rest-build-0.0.1-bin.tar.gz
5 |
6 | mkdir athena-rest-build-0.0.1-bin
7 | tar xzvf athena-rest-build-0.0.1-bin.tar.gz -C athena-rest-build-0.0.1-bin
8 |
9 | cd athena-rest-build-0.0.1-bin
10 |
11 | find . -type f -name "*" -exec dos2unix {} \;
12 |
13 | chmod -R 755 .
14 |
15 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/jenkins-bin/logistics-platform/build-athena-example-test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | source ../comm/build.sh
4 |
5 | ./bin/deploy.sh -pd -s logistics-platform -e test
6 |
7 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/jenkins-bin/readme.txt:
--------------------------------------------------------------------------------
1 | This folder is deprecated. These scripts are moved to jenkins-resources repo.
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/bin/deploy.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # Author:Li Yanpeng
4 |
5 | package()
6 | {
7 | echo "----> start packaging $SERVICE-$PKG_ENV..."
8 |
9 | PKG_SERVICE=$1
10 | PKG_ENV=$2
11 |
12 | if [ ! -d "$GID_HOME" ]; then
13 | mkdir -p $GIT_HOME
14 | fi
15 | cd $GIT_HOME
16 | rm -fr $PKG_SERVICE
17 | git clone $GIT_URL$PKG_SERVICE.git
18 | cd $GIT_HOME/$PKG_SERVICE
19 |
20 |
21 | #echo "$PKG_SERVICE" | tr "-" "\n" > tmpPrefix
22 |
23 | #while read word; do
24 | # prefix=$prefix${word:0:1}
25 | #done < tmpPrefix
26 |
27 | #rm -fr tmpPrefix
28 |
29 | #echo "use branch ${prefix}_develop..."
30 | #git checkout ${prefix}_develop
31 |
32 | git checkout develop
33 |
34 |
35 | ls $GIT_HOME/$PKG_SERVICE/ | while read file_name; do
36 | if [ -d $file_name ]
37 | then
38 | if [ -d $GIT_HOME/$PKG_SERVICE/$file_name/src/main/filters/ ]
39 | then
40 | echo "copy filters to $GIT_HOME/$PKG_SERVICE/$file_name/src/main/filters/"
41 | cp $APP_PATH/properties/$PKG_SERVICE/filter/filter-*.properties $GIT_HOME/$PKG_SERVICE/$file_name/src/main/filters/
42 | fi
43 | fi
44 | done
45 |
46 |
47 | cd $GIT_HOME/$PKG_SERVICE/
48 | mvn clean package -Dmaven.test.skip=true -DskipTests=true -P$PKG_ENV
49 |
50 | mkdir -p $GIT_HOME/$PKG_SERVICE/distribution/$name-$version
51 | tar -xzvf $GIT_HOME/$PKG_SERVICE/distribution/$package-$version.tar.gz -C $GIT_HOME/$PKG_SERVICE/distribution/$name-$version
52 |
53 | cp -r $APP_PATH/dcmd-bin $GIT_HOME/$PKG_SERVICE/distribution/$name-$version/bin
54 |
55 | mkdir $GIT_HOME/$PKG_SERVICE/distribution/$name-$version/conf
56 | cp $APP_PATH/properties/$PKG_SERVICE/server.properties $GIT_HOME/$PKG_SERVICE/distribution/$name-$version/conf/server.properties
57 |
58 | timestamp=`date +%Y%m%d%H%M%S`
59 | export pkgDcmdName=$name'_'$timestamp
60 |
61 | cd $GIT_HOME/$PKG_SERVICE/distribution/$name-$version
62 | tar -czvf "$GIT_HOME/$PKG_SERVICE/distribution/$pkgDcmdName.tar.gz" .
63 |
64 | export pkgDcmdPath=$GIT_HOME/$PKG_SERVICE/distribution/$pkgDcmdName.tar.gz
65 |
66 | echo "----> end packaging $SERVICE-$PKG_ENV..."
67 | }
68 |
69 |
70 | deploy()
71 | {
72 | echo "----> start sending $pkgDcmdPath to dcmd..."
73 |
74 | rsync -avr $pkgDcmdPath root@10.77.130.21::release/$pkgDcmdName.tar.gz
75 | echo "----> done!"
76 | }
77 |
78 | PrintUsage()
79 | {
80 | cat << EndOfUsageMessage
81 |
82 | Usage: $0 -pd -s SERVICE -e ENV
83 |
84 | Descriptions:
85 | -p : package the service.
86 | -d : deploy binary jar to DCMD.
87 | -s SERVICE : specify which service to build.
88 | -e ENV : specify which env to build.
89 |
90 | Example: $0 -pd -s athena-example -e test
91 |
92 | EndOfUsageMessage
93 | }
94 |
95 | InvalidCommandSyntaxExit()
96 | {
97 | echo "Invalid command\n`PrintUsage`"
98 | exit;
99 | }
100 |
101 | if [ $# -eq 0 ]
102 | then
103 | echo "`PrintUsage`"
104 | exit 1
105 | fi
106 |
107 |
108 |
109 | BASE_PATH=`cd "$(dirname "$0")"; pwd`
110 | APP_PATH=`cd "$(dirname "$BASE_PATH")"; pwd`
111 | ENV="test"
112 | SERVICE="athena-example"
113 | ENV=
114 | SERVICE=
115 |
116 | while getopts "pde:s:" arg
117 | do
118 | case $arg in
119 | p)
120 | ISPACKAGE='ON'
121 | ;;
122 | d)
123 | ISDEPLOY='ON'
124 | ;;
125 | e)
126 | ENV=$OPTARG
127 | ;;
128 | s)
129 | SERVICE=$OPTARG
130 | ;;
131 | ?)
132 | echo "`InvalidCommandSyntaxExit`"
133 | exit 1
134 | ;;
135 | esac
136 | done
137 |
138 | source $APP_PATH/conf/deploy.properties
139 | source $APP_PATH/properties/$SERVICE/server.properties
140 |
141 | if [[ $ISPACKAGE = 'ON' ]]; then
142 | package $SERVICE $ENV
143 | fi
144 |
145 | if [[ $ISDEPLOY = 'ON' ]]; then
146 | deploy
147 | fi
148 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/conf/deploy.properties:
--------------------------------------------------------------------------------
1 | GIT_HOME=/tmp/robert
2 | GIT_URL=http://10.77.144.192:11824/athena/
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/dcmd-bin/dcmd_check.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #java设置
4 | export JAVA_HOME=/usr/local/jdk1.6.0_45
5 | export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
6 | export PATH=$JAVA_HOME/bin:$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
7 |
8 | BASE_PATH=`cd "$(dirname "$0")"; pwd`
9 | APP_PATH=`cd "$(dirname "$BASE_PATH")"; pwd`
10 | export APP_PATH
11 |
12 | sleep 2
13 |
14 | sh $BASE_PATH/server.sh check
15 |
16 | if [ $? -eq 0 ];then
17 | exit 0
18 | else
19 | exit -1
20 | fi
21 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/dcmd-bin/dcmd_start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #java设置
4 | export JAVA_HOME=/usr/local/jdk1.6.0_45
5 | export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
6 | export PATH=$JAVA_HOME/bin:$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
7 |
8 | BASE_PATH=`cd "$(dirname "$0")"; pwd`
9 | APP_PATH=`cd "$(dirname "$BASE_PATH")"; pwd`
10 | export APP_PATH
11 |
12 | sh $BASE_PATH/server.sh start
13 |
14 | if [ $? -eq 0 ];then
15 | exit 0
16 | else
17 | exit -1
18 | fi
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/dcmd-bin/dcmd_stop.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #java设置
4 | export JAVA_HOME=/usr/local/jdk1.6.0_45
5 | export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
6 | export PATH=$JAVA_HOME/bin:$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
7 |
8 | BASE_PATH=`cd "$(dirname "$0")"; pwd`
9 | APP_PATH=`cd "$(dirname "$BASE_PATH")"; pwd`
10 | export APP_PATH
11 |
12 | sh $BASE_PATH/server.sh stop
13 |
14 | if [ $? -eq 0 ];then
15 | exit 0
16 | else
17 | exit -1
18 | fi
19 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/dcmd-bin/server.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #全局变量
4 | BASE_PATH=${BASE_PATH:-`cd "$(dirname "$0")"; pwd`}
5 | APP_PATH=${APP_PATH:-`dirname "$BASE_PATH"`}
6 |
7 | #设置java运行参数
8 | #DEFAULT_JAVA_OPTS=" -server -Xmx1g -Xms256m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=11088,server=y,suspend=n"
9 | GC_OPTS=" -server -Xms512m -Xmx1g -Xmn128m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=60"
10 | GC_LOG_OPTS=" -verbose:gc -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -Xloggc:./logs/gc.log"
11 |
12 | #应用客户化变量
13 | source $APP_PATH/conf/server.properties
14 |
15 | DEFAULT_JAVA_OPTS="$GC_OPTS $GC_LOG_OPTS $CUST_OPT"
16 |
17 |
18 | #Java变量
19 | CLASS_PATH=${CLASS_PATH:-$APP_PATH/extlib}
20 | JAVA_OPTS=${JAVA_OPTS:-$DEFAULT_JAVA_OPTS}
21 | MAIN_CLASS=${MAIN_CLASS:-"./lib/$package-$version.jar $port $contextPath $serverType $minThreads $maxThreads"}
22 |
23 |
24 | exist(){
25 | if test $( pgrep -f "$MAIN_CLASS" | wc -l ) -eq 0
26 | then
27 | return 1
28 | else
29 | return 0
30 | fi
31 | }
32 |
33 | start(){
34 |
35 | echo "apppath: $APP_PATH"
36 | if exist; then
37 | echo "$name is already running."
38 | exit 1
39 | else
40 | cd $APP_PATH
41 | nohup java $JAVA_OPTS -cp $CLASS_PATH -jar $MAIN_CLASS 2> /dev/null &
42 | echo "$name is started."
43 | fi
44 | }
45 |
46 | stop(){
47 | runningPID=`pgrep -f "$MAIN_CLASS"`
48 | if [ "$runningPID" ]; then
49 | echo "$name pid: $runningPID"
50 | count=0
51 | kwait=5
52 | echo "$name is stopping, please wait..."
53 | kill -15 $runningPID
54 | until [ `ps --pid $runningPID 2> /dev/null | grep -c $runningPID 2> /dev/null` -eq '0' ] || [ $count -gt $kwait ]
55 | do
56 | sleep 1
57 | let count=$count+1;
58 | done
59 |
60 | if [ $count -gt $kwait ]; then
61 | kill -9 $runningPID
62 | fi
63 | clear
64 | echo "$name is stopped."
65 | else
66 | echo "$name has not been started."
67 | fi
68 | }
69 |
70 | check(){
71 | if exist; then
72 | echo "$name is alive."
73 | exit 0
74 | else
75 | echo "$name is dead."
76 | exit -1
77 | fi
78 | }
79 |
80 | restart(){
81 | stop
82 | start
83 | }
84 |
85 | case "$1" in
86 |
87 | start)
88 | start
89 | ;;
90 | stop)
91 | stop
92 | ;;
93 | restart)
94 | restart
95 | ;;
96 | check)
97 | check
98 | ;;
99 | *)
100 | echo "available operations: [start|stop|restart|check]"
101 | exit 1
102 | ;;
103 | esac
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/properties/athena-example/filter/filter-integrate.properties:
--------------------------------------------------------------------------------
1 | test.property = This is integrate env.
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/properties/athena-example/filter/filter-release.properties:
--------------------------------------------------------------------------------
1 | test.property = This is release env.
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/properties/athena-example/filter/filter-test.properties:
--------------------------------------------------------------------------------
1 | test.property = This is test env.
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/properties/athena-example/server.properties:
--------------------------------------------------------------------------------
1 | #required
2 | name=athena-example-rest
3 | package=athena-example-rest
4 | version=0.0.1
5 | port=10026
6 | contextPath=/example
7 | serverType=JETTY
8 |
9 | #optional
10 | #used to override the default settings
11 | #minThreads=1
12 | #maxThreads=100
13 | #GC_OPTS=" -server -Xms512m -Xmx1g -Xmn128m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
14 | #GC_LOG_OPTS=" -verbose:gc -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -XX:+PrintGCDetails -Xloggc:./logs/gc1.log"
15 | #CUST_OPT=" -XX:LargePageSizeInBytes=128m"
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/properties/logistics-platform/filter/filter-release.properties:
--------------------------------------------------------------------------------
1 | info_log=logs/logistics.log
2 | error_log=logs/error_logistics.log
3 | scribe=scribe
4 |
5 | logistics_jdbc_driverClassName=com.mysql.jdbc.Driver
6 | logistics_jdbc_url=jdbc:mysql://m3317.mysql.wanhui.cn:3317/bp_goods
7 | logistics_jdbc_username=user_bpgoods
8 | logistics_jdbc_password=thZ4RXquhMkS
9 | logistics_ds_minPoolSize=3
10 | logistics_ds_maxPoolSize=20
11 | logistics_ds_initialPoolSize=5
12 |
13 | log_out_dir=logistics-timer.log
14 | log_error_dir=logistics-timer-error.log
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/properties/logistics-platform/filter/filter-test.properties:
--------------------------------------------------------------------------------
1 | info_log=logs/logistics.log
2 | error_log=logs/error_logistics.log
3 | scribe=errorLog
4 |
5 | logistics_jdbc_driverClassName=com.mysql.jdbc.Driver
6 | logistics_jdbc_url=jdbc:mysql://10.77.140.43:10043/logistics
7 | logistics_jdbc_username=logistics
8 | logistics_jdbc_password=p234;34vf
9 | logistics_ds_minPoolSize=3
10 | logistics_ds_maxPoolSize=20
11 | logistics_ds_initialPoolSize=5
12 |
13 | log_out_dir=logistics-timer.log
14 | log_error_dir=logistics-timer-error.log
15 |
--------------------------------------------------------------------------------
/athena-rest-build/src/main/release-bin/properties/logistics-platform/server.properties:
--------------------------------------------------------------------------------
1 | name=logistics_web
2 | package=logistics-api
3 | version=0.0.1
4 | port=10028
5 | contextPath=/logistics
6 | serverType=JETTY
--------------------------------------------------------------------------------
/athena-rest-build/src/test/java/com/robert/athena/rest/build/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.build;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/athena-rest-framework/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /releases
3 | /distribution
4 | /.settings
5 | .project
6 | .classpath
7 | *.class
8 | *.tmp
9 | /tomcat.10025
10 |
11 | # Package Files #
12 | *.jar
13 | *.war
14 | *.ear
15 |
16 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
17 | hs_err_pid*
18 |
19 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-comm/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /distribution
3 | /.settings
4 | .project
5 | .classpath
6 | *.class
7 | *.tmp
8 | /tomcat.10025
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-comm/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | com.robert.athena
9 | athena-rest-framework
10 | 0.0.1
11 |
12 |
13 | com.robert.athena
14 | athena-rest-comm
15 | 0.0.1
16 | athena-rest-util
17 |
18 |
19 | UTF-8
20 |
21 |
22 |
23 |
24 | junit
25 | junit
26 | 3.8.1
27 | test
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-comm/src/main/java/com/robert/athena/rest/util/FileUtils.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.util;
2 |
3 | import java.io.BufferedInputStream;
4 | import java.io.BufferedOutputStream;
5 | import java.io.File;
6 | import java.io.FileInputStream;
7 | import java.io.FileOutputStream;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 |
11 | public abstract class FileUtils {
12 | public static String getTmpPath() {
13 | String tmpPath = System.getProperty("java.io.tmpdir");
14 |
15 | return tmpPath;
16 | }
17 |
18 | // TODO refactor
19 | public static void copyFile(File sourceFile, File targetFile)
20 | throws IOException {
21 |
22 | // 新建文件输入流并对它进行缓冲
23 | FileInputStream input = new FileInputStream(sourceFile);
24 | BufferedInputStream inbuff = new BufferedInputStream(input);
25 |
26 | // 新建文件输出流并对它进行缓冲
27 | FileOutputStream out = new FileOutputStream(targetFile);
28 | BufferedOutputStream outbuff = new BufferedOutputStream(out);
29 |
30 | // 缓冲数组
31 | byte[] b = new byte[1024 * 5];
32 | int len = 0;
33 | while ((len = inbuff.read(b)) != -1) {
34 | outbuff.write(b, 0, len);
35 | }
36 |
37 | // 刷新此缓冲的输出流
38 | outbuff.flush();
39 |
40 | // 关闭流
41 | inbuff.close();
42 | outbuff.close();
43 | out.close();
44 | input.close();
45 |
46 | }
47 |
48 | public static void copyDir(String sourceDir, String targetDir)
49 | throws IOException {
50 |
51 | // 新建目标目录
52 |
53 | (new File(targetDir)).mkdirs();
54 |
55 | // 获取源文件夹当下的文件或目录
56 | File[] file = (new File(sourceDir)).listFiles();
57 |
58 | for (int i = 0; i < file.length; i++) {
59 | if (file[i].isFile()) {
60 | // 源文件
61 | File sourceFile = file[i];
62 | // 目标文件
63 | File targetFile = new File(
64 | new File(targetDir).getAbsolutePath() + File.separator
65 | + file[i].getName());
66 |
67 | copyFile(sourceFile, targetFile);
68 |
69 | }
70 |
71 | if (file[i].isDirectory()) {
72 | // 准备复制的源文件夹
73 | String dir1 = sourceDir + file[i].getName();
74 | // 准备复制的目标文件夹
75 | String dir2 = targetDir + "/" + file[i].getName();
76 |
77 | copyDir(dir1, dir2);
78 | }
79 | }
80 |
81 | }
82 |
83 | public static void saveStream(InputStream input, String targetFile)
84 | throws IOException {
85 |
86 | // 新建文件输入流并对它进行缓冲
87 | BufferedInputStream inbuff = new BufferedInputStream(input);
88 |
89 | // 新建文件输出流并对它进行缓冲
90 | FileOutputStream out = new FileOutputStream(targetFile);
91 | BufferedOutputStream outbuff = new BufferedOutputStream(out);
92 |
93 | // 缓冲数组
94 | byte[] b = new byte[1024 * 5];
95 | int len = 0;
96 | while ((len = inbuff.read(b)) != -1) {
97 | outbuff.write(b, 0, len);
98 | }
99 |
100 | // 刷新此缓冲的输出流
101 | outbuff.flush();
102 |
103 | // 关闭流
104 | outbuff.close();
105 | out.close();
106 |
107 | }
108 |
109 | public static void saveStream(InputStream webFileStream, File file)
110 | throws IOException {
111 | saveStream(webFileStream, file.getAbsolutePath());
112 | }
113 |
114 | public static void esurePathExist (String filePath) {
115 | File file = new File(filePath);
116 | File folder = file.getParentFile();
117 | folder.delete();
118 | folder.mkdirs();
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-comm/src/main/java/com/robert/athena/rest/util/StringUtils.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.util;
2 |
3 | public class StringUtils {
4 | public static boolean isBlank(String value) {
5 | return (value == null) || ("".equals(value))
6 | || ("".equals(value.trim()));
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-comm/src/main/java/com/robert/athena/rest/util/Utils.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.util;
2 |
3 | import java.util.Properties;
4 |
5 | public class Utils {
6 | public static String getStringProperty(Properties properties, String key) {
7 | String value = System.getProperty(key);
8 | if (StringUtils.isBlank(value)) {
9 | value = properties.getProperty(key);
10 | }
11 |
12 | if (value != null) {
13 | value = value.trim();
14 | }
15 | return value;
16 | }
17 |
18 | public static int getIntegerValue(Properties properties, String key,
19 | int defaultValue) {
20 | String value = getStringProperty(properties, key);
21 |
22 | Integer result = null;
23 | try {
24 | result = Integer.valueOf(value);
25 | } catch (Exception e) {
26 | result = defaultValue;
27 | }
28 | return result;
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-comm/src/test/java/com/robert/athena/rest/util/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.util;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /distribution
3 | /.settings
4 | .project
5 | .classpath
6 | *.class
7 | *.tmp
8 | /tomcat.10025
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 |
8 | com.robert.athena
9 | athena-rest-framework
10 | 0.0.1
11 |
12 |
13 | com.robert.athena
14 | athena-rest-container
15 | 0.0.1
16 | athena-rest-container
17 | http://maven.apache.org
18 |
19 | UTF-8
20 | 7.0.56
21 |
22 |
23 |
24 |
25 | com.robert.athena
26 | athena-rest-comm
27 | 0.0.1
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/src/main/java/com/robert/athena/rest/container/AbstractContainerServer.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container;
2 |
3 | import java.util.concurrent.CountDownLatch;
4 |
5 | import org.apache.log4j.Logger;
6 |
7 | public abstract class AbstractContainerServer implements ContainerServer {
8 | protected final Logger log = Logger.getLogger(this.getClass());
9 |
10 | protected int port;
11 | protected String contextPath;
12 | protected String webappPath;
13 |
14 | protected int minThreads = -1;
15 | protected int maxThreads = -1;
16 |
17 | protected CountDownLatch latch = new CountDownLatch(1);
18 |
19 | protected ServerStatus serverStatus = ServerStatus.NONE;
20 |
21 | public AbstractContainerServer() {
22 | super();
23 | }
24 |
25 | public void start() {
26 | serverStatus = ServerStatus.STARTING;
27 |
28 | try {
29 | log.info("Starting container server.");
30 |
31 | doStart();
32 | serverStatus = ServerStatus.RUNNING;
33 |
34 | log.info("Started container server.");
35 | } catch (Exception e) {
36 | log.error("Failed to start container server.", e);
37 |
38 | exit();
39 | }
40 |
41 | doWait();
42 | }
43 |
44 | private void doWait() {
45 | while (serverStatus != ServerStatus.STOPPING) {
46 | try {
47 | latch.await();
48 | } catch (InterruptedException e) {
49 | log.error(
50 | "Container thread is interupted. Back to wait. This may be suspecious wakeup.",
51 | e);
52 | }
53 | }
54 | }
55 |
56 | protected abstract void doStart() throws Exception;
57 |
58 | public void stop() {
59 | serverStatus = ServerStatus.STOPPING;
60 |
61 | try {
62 | log.info("Stoping container server.");
63 |
64 | doStop();
65 |
66 | latch.countDown();
67 | serverStatus = ServerStatus.DIED;
68 |
69 | log.info("Stopped container server.");
70 | } catch (Exception e) {
71 | log.error("Failed to stop container server", e);
72 |
73 | exit();
74 | }
75 | }
76 |
77 | protected abstract void doStop() throws Exception;
78 |
79 | protected void exit() {
80 | // Print console to prompt the admin
81 | System.err.println("Something wrong. Please check logs.");
82 | System.exit(1);
83 | }
84 |
85 | public ServerStatus status() {
86 | return serverStatus;
87 | }
88 |
89 | }
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/src/main/java/com/robert/athena/rest/container/AthenaRestMainServer.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container;
2 |
3 | import java.io.File;
4 | import java.util.Arrays;
5 |
6 | import org.apache.log4j.Logger;
7 |
8 | public class AthenaRestMainServer {
9 |
10 | private final static Logger log = Logger
11 | .getLogger(AthenaRestMainServer.class);
12 |
13 | private static final int DEF_PORT = 10025;
14 |
15 | private static final String DEF_CONTEXT_PATH = "/athena";
16 |
17 | private static final ServerType DEF_SERVER_TYPE = ServerType.JETTY;
18 |
19 | /* Make it public so that some admin service to access the server status. */
20 | public static ContainerServer containerServer;
21 |
22 | enum ServerType {
23 | JETTY("JETTY"), TOMCAT("TOMCAT");
24 |
25 | private String name;
26 |
27 | private ServerType(String name) {
28 | this.name = name;
29 | }
30 |
31 | @Override
32 | public String toString() {
33 | return this.name;
34 | }
35 |
36 | public static ServerType parse(String name) {
37 | if ("TOMCAT".equals(name))
38 | return TOMCAT;
39 |
40 | return JETTY;
41 | }
42 | };
43 |
44 | public static void main(String[] args) throws Exception {
45 |
46 | log.info("args: " + Arrays.toString(args));
47 |
48 | int port = DEF_PORT;
49 | if (args.length > 0) {
50 | try {
51 | port = Integer.parseInt(args[0]);
52 | } catch (NumberFormatException e) {
53 | log.error("Not valid port format!");
54 | }
55 | }
56 |
57 | String contextPath = DEF_CONTEXT_PATH;
58 | if (args.length > 1) {
59 | contextPath = args[1];
60 | }
61 |
62 | ServerType serverType = DEF_SERVER_TYPE;
63 |
64 | if (args.length > 2) {
65 | serverType = ServerType.parse(args[2]);
66 | }
67 |
68 | int minThreads = -1;
69 | if (args.length > 4) {
70 | // both the minThreads and maxThreads should be required if we set either
71 | try {
72 | minThreads = Integer.parseInt(args[3]);
73 | } catch (NumberFormatException e) {
74 | log.error("Not valid minThreads format!");
75 | }
76 | }
77 |
78 | int maxThreads = -1;
79 | if (args.length > 4) {
80 | try {
81 | maxThreads = Integer.parseInt(args[4]);
82 | } catch (NumberFormatException e) {
83 | log.error("Not valid maxThreads format!");
84 | }
85 | }
86 |
87 |
88 | log.info("parsed args " + "port:" + port + " contextPath: "
89 | + contextPath + " serverType: " + serverType);
90 |
91 | String webappPath = WebappGen.getInstance().extractWebapp();
92 |
93 | log.info("webappPath: " + new File(webappPath).getAbsolutePath());
94 |
95 | if (ServerType.TOMCAT.equals(serverType))
96 | containerServer = new TomcatServer(port, contextPath, webappPath, minThreads, maxThreads);
97 | else
98 | containerServer = new JettyServer(port, contextPath, webappPath, minThreads, maxThreads);
99 |
100 | log.info("AthenaRestServer is starting.");
101 |
102 | containerServer.start();
103 |
104 | log.info("AthenaRestServer started.");
105 |
106 | Runtime.getRuntime().addShutdownHook(new Thread() {
107 | @Override
108 | public void run() {
109 | log.info("Receive stop signal and stopping container server.");
110 | containerServer.stop();
111 | log.info("Stopped container server.");
112 | }
113 | });
114 | }
115 |
116 | }
117 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/src/main/java/com/robert/athena/rest/container/ContainerServer.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container;
2 |
3 | public interface ContainerServer {
4 | enum ServerStatus {
5 | NONE, STARTING, RUNNING, STOPPING, DIED
6 | };
7 |
8 | public void start();
9 |
10 | public void stop();
11 |
12 | public ServerStatus status();
13 | }
14 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/src/main/java/com/robert/athena/rest/container/JettyServer.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container;
2 |
3 | import org.mortbay.jetty.Connector;
4 | import org.mortbay.jetty.Server;
5 | import org.mortbay.jetty.nio.SelectChannelConnector;
6 | import org.mortbay.jetty.webapp.WebAppContext;
7 | import org.mortbay.thread.BoundedThreadPool;
8 |
9 | public class JettyServer extends AbstractContainerServer implements
10 | ContainerServer {
11 |
12 | private Server server;
13 |
14 | public JettyServer(int port, String contextPath, String webappPath) {
15 | this.port = port;
16 | this.contextPath = contextPath;
17 | this.webappPath = webappPath;
18 | }
19 |
20 | public JettyServer(int port, String contextPath, String webappPath,
21 | int minThreads, int maxThreads) {
22 | this(port, contextPath, webappPath);
23 | this.minThreads = minThreads;
24 | this.maxThreads = maxThreads;
25 | }
26 |
27 | protected void doStart() throws Exception {
28 |
29 | server = new Server();
30 |
31 | if (this.minThreads != -1 && this.maxThreads != -1) {
32 | BoundedThreadPool btp = new BoundedThreadPool();
33 | server.setThreadPool(btp);
34 | }
35 |
36 | SelectChannelConnector connector = new SelectChannelConnector();
37 |
38 | // Set some timeout options to make debugging easier.
39 | connector.setSoLingerTime(-1);
40 | connector.setPort(port);
41 |
42 | server.setConnectors(new Connector[] { connector });
43 |
44 | WebAppContext wac = new WebAppContext();
45 |
46 | wac.setServer(server);
47 | wac.setContextPath(contextPath);
48 | wac.setWar(webappPath);
49 |
50 | server.setHandler(wac);
51 |
52 | log.info("Starting jetty server actually.");
53 | server.start();
54 | }
55 |
56 | protected void doStop() throws Exception {
57 | try {
58 | log.info("Stopping jetty server actually.");
59 | server.stop();
60 |
61 | log.info("Waiting jetty server to exit.");
62 | server.join();
63 | } catch (InterruptedException e) {
64 | log.error("Interruped when stopping jetty server. Please wait until it stops or kill it.");
65 | throw e;
66 | }
67 |
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/src/main/java/com/robert/athena/rest/container/TomcatServer.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 | import java.util.Properties;
7 |
8 | import javax.servlet.ServletException;
9 |
10 | import org.apache.catalina.Context;
11 | import org.apache.catalina.LifecycleException;
12 | import org.apache.catalina.Service;
13 | import org.apache.catalina.connector.Connector;
14 | import org.apache.catalina.core.AprLifecycleListener;
15 | import org.apache.catalina.core.StandardServer;
16 | import org.apache.catalina.loader.WebappLoader;
17 | import org.apache.catalina.startup.Tomcat;
18 | import org.apache.naming.resources.VirtualDirContext;
19 | import org.mortbay.thread.BoundedThreadPool;
20 |
21 | import com.robert.athena.rest.util.StringUtils;
22 | import com.robert.athena.rest.util.Utils;
23 |
24 | public class TomcatServer extends AbstractContainerServer implements
25 | ContainerServer {
26 | private static final String WEB_EXTRA_RESOURCE_PATHS = "web.extraResourcePaths";
27 | private static final String WEB_ASYNC_TIMEOUT = "web.asyncTimeout";
28 | private static final String WEB_MIN_PROCESSORS = "web.minProcessors";
29 | private static final String WEB_MAX_PROCESSORS = "web.maxProcessors";
30 | private static final String WEB_ACCEPT_COUNT = "web.acceptCount";
31 | private static final String WEB_MAX_THREADS = "web.maxThreads";
32 | private static final String WEB_MIN_SPARE_THREADS = "web.minSpareThreads";
33 | private static final String WEB_REDIRECT_PORT = "web.redirectPort";
34 |
35 | private static final Integer DEFAULT_WEB_REDIRECT_PORT = Integer
36 | .valueOf(8443);
37 | private static final Integer DEFAULT_ASYNC_TIMEOUT = Integer.valueOf(10000);
38 | private static final Integer DEFAULT_MIN_PROCESSORS = Integer.valueOf(50);
39 | private static final Integer DEFAULT_MAX_PROCESSORS = Integer.valueOf(500);
40 | private static final Integer DEFAULT_ACCEPT_COUNT = Integer.valueOf(1024);
41 | private static final Integer DEFAULT_MIN_SPARE_THREADS = Integer
42 | .valueOf(50);
43 | private static final Integer DEFAULT_MAX_THREADS = Integer.valueOf(500);
44 | private static final String DEFAULT_CONNECTOR_PROTOCAL = "org.apache.coyote.http11.Http11NioProtocol";
45 |
46 | private final Properties properties = new Properties();
47 |
48 | private Tomcat tomcat;
49 |
50 | public TomcatServer(int port, String contextPath, String webappPath) {
51 | init();
52 |
53 | this.port = port;
54 | this.contextPath = contextPath;
55 | this.webappPath = webappPath;
56 | }
57 |
58 | public TomcatServer(int port, String contextPath, String webappPath, int minThreads, int maxThreads) {
59 | this(port, contextPath, webappPath);
60 |
61 | this.minThreads = minThreads;
62 | this.maxThreads = maxThreads;
63 | }
64 |
65 | private void init() {
66 | try {
67 | InputStream propertiesInputStream = TomcatServer.class
68 | .getResourceAsStream("/tomcat.properties");
69 |
70 | if (propertiesInputStream == null) {
71 | log.error("Embedded Tomcat Server can't access properties file. Exit...");
72 |
73 | exit();
74 | }
75 | properties.load(propertiesInputStream);
76 |
77 | } catch (IOException e) {
78 | log.error(
79 | "Embedded Tomcat Server can't access properties file. Exit...",
80 | e);
81 |
82 | exit();
83 | }
84 | }
85 |
86 | private void initTomcat() {
87 | serverStatus = ServerStatus.STARTING;
88 |
89 | tomcat = new Tomcat();
90 | tomcat.setPort(port);
91 |
92 | // Changed it to use NIO due to poor performance in burdon test
93 | Connector connector = new Connector(Utils.getStringProperty(properties, "web.connectorProtocol"));
94 |
95 |
96 | connector.setURIEncoding("UTF-8");
97 | connector.setPort(port);
98 | connector.setUseBodyEncodingForURI(true);
99 | connector.setAsyncTimeout(Utils.getIntegerValue(properties,
100 | WEB_ASYNC_TIMEOUT, DEFAULT_ASYNC_TIMEOUT));
101 | connector.setAttribute("minProcessors", Utils.getIntegerValue(
102 | properties, WEB_MIN_PROCESSORS, DEFAULT_MIN_PROCESSORS));
103 | connector.setAttribute("maxProcessors", Utils.getIntegerValue(
104 | properties, WEB_MAX_PROCESSORS, DEFAULT_MAX_PROCESSORS));
105 | connector.setAttribute("acceptCount", Utils.getIntegerValue(properties,
106 | WEB_ACCEPT_COUNT, DEFAULT_ACCEPT_COUNT));
107 | connector.setAttribute("minSpareThreads", Utils.getIntegerValue(
108 | properties, WEB_MIN_SPARE_THREADS, DEFAULT_MIN_SPARE_THREADS));
109 | connector.setAttribute("maxThreads", Utils.getIntegerValue(properties,
110 | WEB_MAX_THREADS, DEFAULT_MAX_THREADS));
111 | connector.setRedirectPort(Utils.getIntegerValue(properties,
112 | WEB_REDIRECT_PORT, DEFAULT_WEB_REDIRECT_PORT));
113 |
114 | if (this.minThreads != -1 && this.maxThreads != -1) {
115 | connector.setAttribute("minThreads", minThreads);
116 | connector.setAttribute("maxThreads", maxThreads);
117 | }
118 |
119 | Service tomcatService = tomcat.getService();
120 | tomcatService.addConnector(connector);
121 | tomcat.setConnector(connector);
122 |
123 | Context context = null;
124 | try {
125 | context = tomcat.addWebapp(contextPath,
126 | new File(webappPath).getAbsolutePath());
127 | } catch (ServletException e) {
128 | log.error("Failed to add webapp + " + webappPath, e);
129 |
130 | exit();
131 | }
132 | context.setLoader(new WebappLoader(Thread.currentThread()
133 | .getContextClassLoader()));
134 |
135 | String extraResourcePaths = properties
136 | .getProperty(WEB_EXTRA_RESOURCE_PATHS);
137 | if (!StringUtils.isBlank(extraResourcePaths)) {
138 | VirtualDirContext virtualDirContext = new VirtualDirContext();
139 | virtualDirContext.setExtraResourcePaths(extraResourcePaths);
140 | context.setResources(virtualDirContext);
141 | }
142 |
143 | StandardServer server = (StandardServer) tomcat.getServer();
144 | AprLifecycleListener listener = new AprLifecycleListener();
145 | server.addLifecycleListener(listener);
146 | }
147 |
148 | protected void doStart() throws Exception {
149 | log.info("Initializing tomcat server actually.");
150 |
151 | initTomcat();
152 |
153 | log.info("Starting tomcat server actually.");
154 | tomcat.start();
155 |
156 | log.info("Started tomcat server now.");
157 |
158 | }
159 |
160 | public void doStop() throws LifecycleException {
161 | log.info("Stoping tomcat server actually.");
162 | tomcat.stop();
163 |
164 | log.info("Waiting tomcat server to exit.");
165 | tomcat.getServer().await();
166 |
167 | log.info("Stopped tomcat server now.");
168 | }
169 |
170 | public ServerStatus status() {
171 | return serverStatus;
172 | }
173 |
174 | }
175 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/src/main/java/com/robert/athena/rest/container/WebappGen.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container;
2 |
3 | import java.io.File;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 |
7 | import com.robert.athena.rest.util.FileUtils;
8 |
9 | public class WebappGen {
10 | private static final String DEF_WEB_XML_CLASSPATH = "/webapp/WEB-INF/web.xml";
11 |
12 | private static final String WEB_XML_CLASSPATH = "/webapp/WEB-INF/web-cust.xml";
13 |
14 | private static final String WEB_XML_ROOT_PATH = "webapp/";
15 |
16 | private static final String WEB_XML_PATH = WEB_XML_ROOT_PATH
17 | + "WEB-INF/web.xml";
18 |
19 | private static WebappGen webappGen = new WebappGen();
20 |
21 | private WebappGen() {
22 | };
23 |
24 | public String extractWebapp() throws IOException {
25 | String webXmlClasspath = DEF_WEB_XML_CLASSPATH;
26 |
27 | if (isClasspathResource(WEB_XML_CLASSPATH))
28 | webXmlClasspath = WEB_XML_CLASSPATH;
29 |
30 | extractClasspathResource(webXmlClasspath,
31 | new File(WEB_XML_PATH).getAbsolutePath());
32 |
33 | return WEB_XML_ROOT_PATH;
34 | }
35 |
36 | private void extractClasspathResource(String classpathPath, String filePath)
37 | throws IOException {
38 | InputStream fileSteam = WebappGen.class
39 | .getResourceAsStream(classpathPath);
40 |
41 | FileUtils.esurePathExist(filePath);
42 | try {
43 | FileUtils.saveStream(fileSteam, new File(filePath));
44 | } finally {
45 | fileSteam.close();
46 | }
47 | }
48 |
49 | private boolean isClasspathResource(String classpathPath)
50 | throws IOException {
51 | InputStream fileStream = null;
52 | try {
53 | fileStream = WebappGen.class.getResourceAsStream(classpathPath);
54 |
55 | return fileStream != null;
56 | } finally {
57 | if (fileStream != null)
58 | fileStream.close();
59 | }
60 | }
61 |
62 | public static WebappGen getInstance() {
63 | return webappGen;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/src/main/resources/tomcat.properties:
--------------------------------------------------------------------------------
1 | #DEVELOPMENT USE ONLY, PRODUCTION ENV PLEASE CHAGE /base_dir/conf/tomcat.properties
2 |
3 | web.maxProcessors = 2000
4 | web.maxThreads = 3000
5 | web.acceptCount = 1024
6 |
7 | web.connectorProtocol = org.apache.coyote.http11.Http11NioProtocol
8 |
9 | #web.connectorProtocol = org.apache.coyote.http11.Http11AprProtocol
10 | #web.connectorProtocol = org.apache.coyote.http11.Http11Protocol
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/src/test/java/com/robert/athena/rest/container/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest extends TestCase {
11 | /**
12 | * Create the test case
13 | *
14 | * @param testName
15 | * name of the test case
16 | */
17 | public AppTest(String testName) {
18 | super(testName);
19 | }
20 |
21 | /**
22 | * @return the suite of tests being tested
23 | */
24 | public static Test suite() {
25 | return new TestSuite(AppTest.class);
26 | }
27 |
28 | /**
29 | * Rigourous Test :-)
30 | */
31 | public void testApp() {
32 | assertTrue(true);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-container/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | robert Athena Rest Framework
7 |
8 |
9 | HttpMethodFilter
10 | org.springframework.web.filter.HttpPutFormContentFilter
11 |
12 |
13 |
14 | HttpMethodFilter
15 | /*
16 |
17 |
18 |
19 | spring-dispatcher-servlet
20 | org.springframework.web.servlet.DispatcherServlet
21 |
22 | contextConfigLocation
23 | classpath:spring/athena-rest-container.xml
24 |
25 | 1
26 |
27 |
28 |
29 | spring-dispatcher-servlet
30 | /*
31 |
32 |
33 |
34 | /error-default
35 |
36 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /distribution
3 | /.settings
4 | .project
5 | .classpath
6 | *.class
7 | *.tmp
8 | /tomcat.10025
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | com.robert.athena
8 | athena-rest-framework
9 | 0.0.1
10 |
11 |
12 | com.robert.athena
13 | athena-rest-webapp
14 | 0.0.1
15 | athena-rest-webapp
16 |
17 |
18 | UTF-8
19 |
20 |
21 |
22 |
23 | junit
24 | junit
25 | 3.8.1
26 | test
27 |
28 |
29 | com.robert.athena
30 | athena-rest-container
31 | 0.0.1
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/src/main/java/com/robert/athena/rest/container/admin/AdminController.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container.admin;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 | import javax.servlet.http.HttpServletResponse;
5 |
6 | import net.sf.json.JSONObject;
7 |
8 | import org.apache.commons.logging.Log;
9 | import org.apache.commons.logging.LogFactory;
10 | import org.springframework.http.HttpStatus;
11 | import org.springframework.stereotype.Controller;
12 | import org.springframework.web.bind.annotation.RequestMapping;
13 | import org.springframework.web.bind.annotation.RequestMethod;
14 | import org.springframework.web.bind.annotation.ResponseBody;
15 | import org.springframework.web.portlet.handler.SimpleMappingExceptionResolver;
16 |
17 | import com.robert.athena.rest.container.AthenaRestMainServer;
18 | import com.robert.athena.rest.container.admin.bean.BaseResult;
19 | import com.robert.athena.rest.container.admin.bean.ReturnStatus;
20 |
21 | @Controller
22 | public class AdminController {
23 |
24 | private static final Log log = LogFactory.getLog(AdminController.class);
25 |
26 | private boolean serviceAvailable = true;
27 |
28 | @RequestMapping(value = "/admin/server-status", method = RequestMethod.GET)
29 | @ResponseBody
30 | public String serverStatus() {
31 | return AthenaRestMainServer.containerServer.status().toString();
32 | }
33 |
34 | @RequestMapping(value = "/admin/service-status", method = RequestMethod.GET)
35 | @ResponseBody
36 | public String checkService(HttpServletResponse response) {
37 | if (serviceAvailable)
38 | response.setStatus(200);
39 | else
40 | response.setStatus(503);
41 |
42 | return "Current Service Status: " + (serviceAvailable ? "on" : "off");
43 | }
44 |
45 | @RequestMapping(value = "/admin/switch200", method = RequestMethod.GET)
46 | @ResponseBody
47 | public String turnOn(HttpServletResponse response) {
48 | serviceAvailable = true;
49 |
50 | return "Service Status: on";
51 | }
52 |
53 | @RequestMapping(value = "/admin/switch503", method = RequestMethod.GET)
54 | @ResponseBody
55 | public String turnOff(HttpServletResponse response) {
56 | serviceAvailable = false;
57 |
58 | return "Service Status: off";
59 | }
60 |
61 | @RequestMapping(value = "/admin/error-spring-exception")
62 | @ResponseBody
63 | public String errorSpringException(HttpServletRequest request,
64 | HttpServletResponse response) {
65 | Exception e = (Exception) request
66 | .getAttribute(SimpleMappingExceptionResolver.DEFAULT_EXCEPTION_ATTRIBUTE);
67 |
68 | log.error("AthenaRestFramework throws Exception: ", e);
69 |
70 | response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
71 |
72 | BaseResult br = new BaseResult();
73 | br.setStatus(ReturnStatus.SERVER_ERROR.getValue());
74 | br.setMessage(e.getClass().getName() + ": " + e.getMessage());
75 |
76 | return JSONObject.fromObject(br).toString();
77 | }
78 |
79 | @RequestMapping(value = "/admin/error-spring-runtime-exception")
80 | @ResponseBody
81 | public String errorSpringRuntimeException(HttpServletRequest request,
82 | HttpServletResponse response) {
83 | Exception e = (Exception) request
84 | .getAttribute(SimpleMappingExceptionResolver.DEFAULT_EXCEPTION_ATTRIBUTE);
85 |
86 | log.error("AthenaRestFramework throws RuntimeException: ", e);
87 |
88 | response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
89 |
90 | BaseResult br = new BaseResult();
91 | br.setStatus(ReturnStatus.SERVER_ERROR.getValue());
92 | br.setMessage(e.getClass().getName() + ": " + e.getMessage());
93 |
94 | return JSONObject.fromObject(br).toString();
95 | }
96 |
97 | @RequestMapping(value = "/admin/error-spring-default")
98 | @ResponseBody
99 | public String errorSpringDefault(HttpServletRequest request,
100 | HttpServletResponse response) {
101 | Exception e = (Exception) request
102 | .getAttribute(SimpleMappingExceptionResolver.DEFAULT_EXCEPTION_ATTRIBUTE);
103 |
104 | log.error("AthenaRestFramework throws Unknown Exception: ", e);
105 |
106 | response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
107 |
108 | BaseResult br = new BaseResult();
109 | br.setStatus(ReturnStatus.SERVER_ERROR.getValue());
110 | br.setMessage(e.getClass().getName() + ": " + e.getMessage());
111 |
112 | return JSONObject.fromObject(br).toString();
113 | }
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/src/main/java/com/robert/athena/rest/container/admin/bean/BaseResult.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.rest.container.admin.bean;
2 |
3 | public class BaseResult {
4 | private int status = ReturnStatus.SUCCESS.getValue();
5 | private String message = ReturnStatus.SUCCESS.getDesc();
6 |
7 | @Override
8 | public String toString() {
9 | return "Result [status=" + status + ", message=" + message + "]";
10 | }
11 |
12 | public int getStatus() {
13 | return status;
14 | }
15 |
16 | public void setStatus(int status) {
17 | this.status = status;
18 | }
19 |
20 | public String getMessage() {
21 | return message;
22 | }
23 |
24 | public void setMessage(String message) {
25 | this.message = message;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/src/main/java/com/robert/athena/rest/container/admin/bean/ReturnStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012-2014 robert.cn All right reserved. This software is the
3 | * confidential and proprietary information of robert.cn ("Confidential
4 | * Information"). You shall not disclose such Confidential Information and shall
5 | * use it only in accordance with the terms of the license agreement you entered
6 | * into with robert.cn.
7 | */
8 | package com.robert.athena.rest.container.admin.bean;
9 |
10 | import java.util.HashSet;
11 |
12 | /**
13 | * The Enum ReturnStatusEnum.
14 | */
15 | public enum ReturnStatus {
16 |
17 | SUCCESS(200, "成功"),
18 |
19 | SERVER_ERROR(500, "服务器错误,%s"),
20 |
21 | PARAMETER_ERROR(400, "参数错误,%s"),
22 | /** The database error. */
23 | DATABASE_ERROR(501, "数据库操作失败,%s"),
24 |
25 | // 业务异常错误码4位,同一模块的前两位一样,按code号的顺序排列
26 | BIZ_ERROR(4001, "业务异常"),
27 |
28 | ;
29 |
30 | /** call rpcserver error. */
31 | /** The value. */
32 | private final int value;
33 |
34 | /** The desc. */
35 | private final String desc;
36 |
37 | /**
38 | * Instantiates a new return status enum.
39 | *
40 | * @param value
41 | * the value
42 | * @param desc
43 | * the desc
44 | */
45 | private ReturnStatus(int value, String desc) {
46 | this.value = value;
47 | this.desc = desc;
48 | }
49 |
50 | /**
51 | * Gets the value.
52 | *
53 | * @return the value
54 | */
55 | public int getValue() {
56 | return value;
57 | }
58 |
59 | /**
60 | * Gets the desc.
61 | *
62 | * @return the desc
63 | */
64 | public String getDesc() {
65 | return desc;
66 | }
67 |
68 | public String getDesc4Log() {
69 | return "ERROR_CODE:" + value + "\t" + desc + "\t";
70 | }
71 |
72 | private static HashSet hashSet;
73 |
74 | static {
75 | hashSet = new HashSet();
76 | hashSet.clear();
77 | for (ReturnStatus returnStatus : ReturnStatus.values()) {
78 | hashSet.add(returnStatus.getValue());
79 | }
80 | }
81 |
82 | public static boolean isDefined(int value) {
83 | if (hashSet.contains(value)) {
84 | return true;
85 | }
86 | return false;
87 | }
88 |
89 | public static ReturnStatus get(int value) {
90 | for (ReturnStatus o : ReturnStatus.values()) {
91 | if (value == o.getValue()) {
92 | return o;
93 | }
94 | }
95 | return null;
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/src/main/resources/spring/athena-rest-container.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
23 |
24 | error-spring-default
25 |
26 |
27 |
28 | error-spring-runtime-exception
29 | error-spring-exception
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/src/main/resources/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 | robert Athena Rest Framework
7 |
8 |
9 | HttpMethodFilter
10 | org.springframework.web.filter.HttpPutFormContentFilter
11 |
12 |
13 |
14 | HttpMethodFilter
15 | /*
16 |
17 |
18 |
19 | spring-dispatcher-servlet
20 | org.springframework.web.servlet.DispatcherServlet
21 |
22 | contextConfigLocation
23 | classpath:spring/athena-rest-container.xml
24 |
25 | 1
26 |
27 |
28 |
29 | spring-dispatcher-servlet
30 | /*
31 |
32 |
33 |
34 | /error-default
35 |
36 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/src/main/resources/webapp/index.jsp:
--------------------------------------------------------------------------------
1 | <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2 | pageEncoding="ISO-8859-1"%>
3 |
4 |
5 |
6 |
7 | Test
8 |
9 |
10 | indes.jsp
11 |
12 |
--------------------------------------------------------------------------------
/athena-rest-framework/athena-rest-webapp/src/test/java/org/athena/rest/webapp/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.athena.rest.webapp;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest extends TestCase {
11 | /**
12 | * Create the test case
13 | *
14 | * @param testName
15 | * name of the test case
16 | */
17 | public AppTest(String testName) {
18 | super(testName);
19 | }
20 |
21 | /**
22 | * @return the suite of tests being tested
23 | */
24 | public static Test suite() {
25 | return new TestSuite(AppTest.class);
26 | }
27 |
28 | /**
29 | * Rigourous Test :-)
30 | */
31 | public void testApp() {
32 | assertTrue(true);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/athena-rest-framework/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 | com.robert.athena
6 | athena-rest-framework
7 | 0.0.1
8 | pom
9 | athena-rest-framework
10 | Athena Rest Framework
11 |
12 |
13 | UTF-8
14 | 7.0.56
15 |
16 |
17 |
18 | athena-rest-container
19 | athena-rest-comm
20 | athena-rest-webapp
21 |
22 |
23 |
24 |
25 | junit
26 | junit
27 | 3.8.1
28 | test
29 |
30 |
31 |
32 |
33 |
34 | log4j
35 | log4j
36 | 1.2.17
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | org.mortbay.jetty
45 | jetty
46 | 6.1.4
47 |
48 |
49 |
50 | servlet-api-2.5
51 | org.mortbay.jetty
52 |
53 |
54 |
55 |
56 |
57 | org.mortbay.jetty
58 | jsp-2.1-glassfish
59 | 2.1.v20100127
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | org.springframework
68 | spring-web
69 | 4.1.6.RELEASE
70 |
71 |
72 | org.springframework
73 | spring-webmvc
74 | 4.1.6.RELEASE
75 |
76 |
77 | org.springframework
78 | spring-webmvc-portlet
79 | 4.1.6.RELEASE
80 |
81 |
82 |
83 | org.springframework
84 | spring-context
85 | 4.1.6.RELEASE
86 |
87 |
88 |
89 | aspectj
90 | aspectjrt
91 | 1.5.4
92 |
93 |
94 | org.apache.geronimo.bundles
95 | aspectjweaver
96 | 1.6.8_2
97 |
98 |
99 | cglib
100 | cglib-nodep
101 | 3.1
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 | org.apache.tomcat.embed
111 | tomcat-embed-core
112 | ${tomcat.version}
113 |
114 |
115 |
116 | org.apache.tomcat
117 | tomcat-dbcp
118 | ${tomcat.version}
119 |
120 |
121 |
122 | org.apache.tomcat
123 | tomcat-jdbc
124 | ${tomcat.version}
125 |
126 |
127 |
128 | org.apache.tomcat.embed
129 | tomcat-embed-websocket
130 | ${tomcat.version}
131 |
132 |
133 |
134 | org.apache.tomcat.embed
135 | tomcat-embed-logging-juli
136 | ${tomcat.version}
137 |
138 |
139 |
140 | org.apache.tomcat.embed
141 | tomcat-embed-logging-log4j
142 | ${tomcat.version}
143 |
144 |
145 |
146 | org.apache.tomcat.embed
147 | tomcat-embed-jasper
148 | ${tomcat.version}
149 |
150 |
151 |
152 | org.apache.tomcat
153 | tomcat-jasper
154 | ${tomcat.version}
155 |
156 |
157 | org.apache.tomcat
158 | tomcat-jasper-el
159 | ${tomcat.version}
160 |
161 |
162 |
163 | org.apache.tomcat
164 | tomcat-jsp-api
165 | ${tomcat.version}
166 |
167 |
168 |
169 | org.apache.tomcat
170 | tomcat-coyote
171 | ${tomcat.version}
172 |
173 |
174 |
175 | org.apache.tomcat
176 | tomcat-catalina-ha
177 | ${tomcat.version}
178 |
179 |
180 |
181 | org.apache.tomcat
182 | tomcat-tribes
183 | ${tomcat.version}
184 |
185 |
186 |
187 |
188 |
189 | net.sf.json-lib
190 | json-lib
191 | 2.4
192 | jdk15
193 |
194 |
195 |
196 |
197 |
198 | snapshots
199 | Nexus Snapshot Repository
200 | http://10.77.144.192:11081/nexus/content/repositories/snapshots/
201 |
202 |
203 | releases
204 | Nexus Release Repository
205 | http://10.77.144.192:11081/nexus/content/repositories/releases/
206 |
207 |
208 |
209 |
210 |
--------------------------------------------------------------------------------
/athena-rest-wizard/.gitignore:
--------------------------------------------------------------------------------
1 | /target
2 | /releases
3 | /distribution
4 | /.settings
5 | .project
6 | .classpath
7 | *.class
8 | *.tmp
9 | /tomcat.10025
10 |
11 | # Package Files #
12 | *.jar
13 | *.war
14 | *.ear
15 |
16 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
17 | hs_err_pid*
18 |
19 |
--------------------------------------------------------------------------------
/athena-rest-wizard/README.txt:
--------------------------------------------------------------------------------
1 | Please go to bin folder and click start.bat or start.sh. It depends what OS you are using.
2 |
--------------------------------------------------------------------------------
/athena-rest-wizard/assembly.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | bin
5 |
6 |
7 | zip
8 |
9 | false
10 |
11 |
12 |
13 | lib
14 | true
15 | runtime
16 |
17 |
18 |
19 |
20 |
21 | bin
22 | ${basedir}/src/main/scripts
23 |
24 |
25 |
26 | /
27 |
28 | ${basedir}/README.txt
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/athena-rest-wizard/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.robert.athena
6 | athena-rest-wizard
7 | 0.0.1
8 | jar
9 |
10 | athena-rest-wizard
11 | http://maven.apache.org
12 |
13 |
14 | UTF-8
15 |
16 |
17 |
18 |
19 | junit
20 | junit
21 | 3.8.1
22 | test
23 |
24 |
25 | com.robert.athena
26 | athena-rest-comm
27 | 0.0.1
28 | compile
29 |
30 |
31 |
32 | javafx
33 | jfxrt
34 | 1.0
35 |
36 |
37 |
38 |
39 |
40 |
41 | org.apache.maven.plugins
42 | maven-jar-plugin
43 |
44 |
45 |
46 | true
47 | com.robert.athena.restwizard.AthenaRestWizard
48 |
49 |
50 |
51 |
52 |
53 |
54 | maven-assembly-plugin
55 |
56 | true
57 | utf-8
58 |
59 | ${basedir}/assembly.xml
60 |
61 | ${basedir}/target/
62 |
63 |
64 |
65 | make-assembly
66 | package
67 |
68 | single
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | snapshots
79 | Nexus Snapshot Repository
80 | http://10.77.144.192:11081/nexus/content/repositories/snapshots/
81 |
82 |
83 | releases
84 | Nexus Release Repository
85 | http://10.77.144.192:11081/nexus/content/repositories/releases/
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/athena-rest-wizard/src/main/java/com/robert/athena/restwizard/AthenaRestWizard.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.restwizard;
2 |
3 | import java.io.BufferedInputStream;
4 | import java.io.BufferedOutputStream;
5 | import java.io.BufferedReader;
6 | import java.io.BufferedWriter;
7 | import java.io.File;
8 | import java.io.FileInputStream;
9 | import java.io.FileOutputStream;
10 | import java.io.IOException;
11 | import java.io.InputStream;
12 | import java.io.InputStreamReader;
13 | import java.io.OutputStreamWriter;
14 | import java.util.zip.ZipEntry;
15 | import java.util.zip.ZipInputStream;
16 |
17 | import javafx.application.Application;
18 | import javafx.event.ActionEvent;
19 | import javafx.event.EventHandler;
20 | import javafx.geometry.Insets;
21 | import javafx.geometry.Pos;
22 | import javafx.scene.Scene;
23 | import javafx.scene.control.Button;
24 | import javafx.scene.control.Label;
25 | import javafx.scene.control.TextField;
26 | import javafx.scene.layout.GridPane;
27 | import javafx.scene.layout.HBox;
28 | import javafx.scene.paint.Color;
29 | import javafx.scene.text.Font;
30 | import javafx.scene.text.FontWeight;
31 | import javafx.scene.text.Text;
32 | import javafx.stage.Stage;
33 |
34 | import javax.swing.JOptionPane;
35 |
36 | import com.robert.athena.rest.util.FileUtils;
37 | import com.robert.athena.rest.util.StringUtils;
38 |
39 | public class AthenaRestWizard extends Application {
40 |
41 | public static void main(String[] args) {
42 | launch(args);
43 | }
44 |
45 | @Override
46 | public void start(Stage primaryStage) {
47 | primaryStage.setTitle("Athena Rest Wizard");
48 |
49 | GridPane grid = new GridPane();
50 | grid.setAlignment(Pos.CENTER);
51 | grid.setHgap(10);
52 | grid.setVgap(10);
53 | grid.setPadding(new Insets(25, 25, 25, 25));
54 |
55 | Scene scene = new Scene(grid, 500, 200);
56 | primaryStage.setScene(scene);
57 |
58 | Text scenetitle = new Text("Welcome, roberter!");
59 | scenetitle.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20));
60 | grid.add(scenetitle, 0, 0, 2, 1);
61 |
62 | Label projectNameLabel = new Label("Project Name:");
63 | grid.add(projectNameLabel, 0, 1);
64 |
65 | final TextField projectName = new TextField();
66 | grid.add(projectName, 1, 1);
67 |
68 | Label projectDescLabel = new Label("Project Description:");
69 | grid.add(projectDescLabel, 0, 2);
70 |
71 | final TextField projectDesc = new TextField();
72 | grid.add(projectDesc, 1, 2);
73 |
74 | Button btn = new Button("Generate Service Project Now");
75 | HBox hbBtn = new HBox(10);
76 | hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
77 | hbBtn.getChildren().add(btn);
78 | grid.add(hbBtn, 1, 4);
79 |
80 | final Text actiontarget = new Text();
81 | grid.add(actiontarget, 1, 6);
82 |
83 | btn.setOnAction(new EventHandler() {
84 | public void handle(ActionEvent arg0) {
85 | try {
86 | doWizard(projectName.getText(), projectDesc.getText(),
87 | actiontarget);
88 | } catch (IOException e) {
89 | e.printStackTrace();
90 | }
91 |
92 | }
93 | });
94 |
95 | primaryStage.show();
96 | }
97 |
98 | private void doWizard(String name, String desc, Text actiontarget)
99 | throws IOException {
100 | // validate
101 | if (StringUtils.isBlank(name) || StringUtils.isBlank(desc)) {
102 | JOptionPane.showMessageDialog(null,
103 | "The name or description is empty. Please check",
104 | "Warning...", JOptionPane.ERROR_MESSAGE);
105 | return;
106 | }
107 |
108 | // unzip file
109 | File root = new File("tmp");
110 | deleteDir(root);
111 |
112 | File fileZip = new File(root, "athena-example.zip");
113 |
114 | extractClasspathResource("/athena-example.zip",
115 | fileZip.getAbsolutePath());
116 |
117 | unZipIt(fileZip.getAbsolutePath(), root.getAbsolutePath());
118 |
119 | // replace names in poms
120 | File rootPro = new File(root, "athena-example");
121 |
122 | replace(new File(rootPro, "pom.xml"), "athena-example", name);
123 | replace(new File(rootPro, "pom.xml"), "Athena Example", desc);
124 |
125 | replace(new File(rootPro, "athena-example-data/pom.xml"),
126 | "athena-example", name);
127 | replace(new File(rootPro, "athena-example-data/pom.xml"),
128 | "Athena Example", desc);
129 |
130 | replace(new File(rootPro, "athena-example-rest/pom.xml"),
131 | "athena-example", name);
132 | replace(new File(rootPro, "athena-example-rest/pom.xml"),
133 | "Athena Example", desc);
134 |
135 | replace(new File(rootPro, "athena-example-service/pom.xml"),
136 | "athena-example", name);
137 | replace(new File(rootPro, "athena-example-service/pom.xml"),
138 | "Athena Example", desc);
139 |
140 | // rename folders
141 | new File(rootPro, "athena-example-data").renameTo(new File(rootPro,
142 | name + "-data"));
143 | new File(rootPro, "athena-example-rest").renameTo(new File(rootPro,
144 | name + "-rest"));
145 | new File(rootPro, "athena-example-service").renameTo(new File(rootPro,
146 | name + "-service"));
147 |
148 | // copy to desktop
149 | javax.swing.filechooser.FileSystemView fsv = javax.swing.filechooser.FileSystemView
150 | .getFileSystemView();
151 | copyDirectiory(rootPro.getAbsolutePath(), new File(fsv
152 | .getHomeDirectory().getAbsoluteFile(), name).getAbsolutePath());
153 |
154 | // rename project root folder
155 | rootPro.renameTo(new File(rootPro.getParentFile(), name));
156 |
157 | // show result
158 | actiontarget.setFill(Color.FIREBRICK);
159 | actiontarget.setText("Please find your project {" + name
160 | + "} on your desktop.");
161 | }
162 |
163 | public void replace(File file, String src, String dest) throws IOException {
164 | File bakFile = new File(file.getPath() + ".bak");
165 | file.renameTo(bakFile);
166 | BufferedReader br = new BufferedReader(new InputStreamReader(
167 | new FileInputStream(bakFile)));
168 |
169 | BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
170 | new FileOutputStream(file)));
171 | try {
172 | String sLine = null;
173 | while ((sLine = br.readLine()) != null) {
174 | sLine = sLine.replaceAll(src, dest);
175 |
176 | bw.write(sLine);
177 | bw.newLine();
178 | }
179 | } finally {
180 | br.close();
181 | bw.close();
182 | }
183 |
184 | bakFile.delete();
185 | }
186 |
187 | public void unZipIt(String zipFile, String outputFolder) {
188 |
189 | byte[] buffer = new byte[1024];
190 |
191 | try {
192 |
193 | // create output directory is not exists
194 | File folder = new File(outputFolder);
195 | if (!folder.exists()) {
196 | folder.mkdir();
197 | }
198 |
199 | // get the zip file content
200 | ZipInputStream zis = new ZipInputStream(
201 | new FileInputStream(zipFile));
202 | // get the zipped file list entry
203 | ZipEntry ze = zis.getNextEntry();
204 |
205 | while (ze != null) {
206 |
207 | String fileName = ze.getName();
208 | if (!ze.isDirectory()) {
209 |
210 | File newFile = new File(outputFolder + File.separator
211 | + fileName);
212 |
213 | System.out.println("file unzip : "
214 | + newFile.getAbsoluteFile());
215 |
216 | // create all non exists folders
217 | // else you will hit FileNotFoundException for compressed
218 | // folder
219 | new File(newFile.getParent()).mkdirs();
220 |
221 | FileOutputStream fos = new FileOutputStream(newFile);
222 |
223 | int len;
224 | while ((len = zis.read(buffer)) > 0) {
225 | fos.write(buffer, 0, len);
226 | }
227 |
228 | fos.close();
229 | }
230 | ze = zis.getNextEntry();
231 | }
232 |
233 | zis.closeEntry();
234 | zis.close();
235 |
236 | System.out.println("Done");
237 |
238 | } catch (IOException ex) {
239 | ex.printStackTrace();
240 | }
241 | }
242 |
243 | private void extractClasspathResource(String classpathPath, String filePath)
244 | throws IOException {
245 | InputStream fileSteam = AthenaRestWizard.class
246 | .getResourceAsStream(classpathPath);
247 |
248 | FileUtils.esurePathExist(filePath);
249 | try {
250 | FileUtils.saveStream(fileSteam, new File(filePath));
251 | } finally {
252 | fileSteam.close();
253 | }
254 | }
255 |
256 | private boolean isClasspathResource(String classpathPath)
257 | throws IOException {
258 | InputStream fileStream = null;
259 | try {
260 | fileStream = AthenaRestWizard.class
261 | .getResourceAsStream(classpathPath);
262 |
263 | return fileStream != null;
264 | } finally {
265 | if (fileStream != null)
266 | fileStream.close();
267 | }
268 | }
269 |
270 | private static boolean deleteDir(File dir) {
271 | if (dir.isDirectory()) {
272 | String[] children = dir.list();
273 |
274 | for (int i = 0; i < children.length; i++) {
275 | boolean success = deleteDir(new File(dir, children[i]));
276 | if (!success) {
277 | return false;
278 | }
279 | }
280 | }
281 |
282 | return dir.delete();
283 | }
284 |
285 | public static void copyFile(File sourceFile, File targetFile)
286 | throws IOException {
287 | // 新建文件输入流并对它进行缓冲
288 | FileInputStream input = new FileInputStream(sourceFile);
289 | BufferedInputStream inBuff = new BufferedInputStream(input);
290 |
291 | // 新建文件输出流并对它进行缓冲
292 | FileOutputStream output = new FileOutputStream(targetFile);
293 | BufferedOutputStream outBuff = new BufferedOutputStream(output);
294 |
295 | // 缓冲数组
296 | byte[] b = new byte[1024 * 5];
297 | int len;
298 | while ((len = inBuff.read(b)) != -1) {
299 | outBuff.write(b, 0, len);
300 | }
301 | // 刷新此缓冲的输出流
302 | outBuff.flush();
303 |
304 | // 关闭流
305 | inBuff.close();
306 | outBuff.close();
307 | output.close();
308 | input.close();
309 | }
310 |
311 | // 复制文件夹
312 | public static void copyDirectiory(String sourceDir, String targetDir)
313 | throws IOException {
314 | // 新建目标目录
315 | (new File(targetDir)).mkdirs();
316 | // 获取源文件夹当前下的文件或目录
317 | File[] file = (new File(sourceDir)).listFiles();
318 | for (int i = 0; i < file.length; i++) {
319 | if (file[i].isFile()) {
320 | // 源文件
321 | File sourceFile = file[i];
322 | // 目标文件
323 | File targetFile = new File(
324 | new File(targetDir).getAbsolutePath() + File.separator
325 | + file[i].getName());
326 | copyFile(sourceFile, targetFile);
327 | }
328 | if (file[i].isDirectory()) {
329 | // 准备复制的源文件夹
330 | String dir1 = sourceDir + "/" + file[i].getName();
331 | // 准备复制的目标文件夹
332 | String dir2 = targetDir + "/" + file[i].getName();
333 | copyDirectiory(dir1, dir2);
334 | }
335 | }
336 | }
337 | }
--------------------------------------------------------------------------------
/athena-rest-wizard/src/main/resources/athena-example.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/athena-rest-wizard/src/main/resources/athena-example.zip
--------------------------------------------------------------------------------
/athena-rest-wizard/src/main/scripts/start.bat:
--------------------------------------------------------------------------------
1 | start javaw -jar ../lib/athena-rest-wizard-0.0.1.jar
--------------------------------------------------------------------------------
/athena-rest-wizard/src/main/scripts/start.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | java -jar ../lib/athena-rest-wizard-0.0.1.jar
--------------------------------------------------------------------------------
/athena-rest-wizard/src/test/java/com/robert/athena/athena_rest_wizard/AppTest.java:
--------------------------------------------------------------------------------
1 | package com.robert.athena.athena_rest_wizard;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/deploy-maven.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mvn clean deploy -DskipTests -Dmaven.test.skip=true
4 |
--------------------------------------------------------------------------------
/make-release.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | rm -fr ./releases
4 |
5 | mkdir -p ./releases/athena-rest-0.0.1-release/md/
6 | cp ./README.md ./releases/athena-rest-0.0.1-release/md/index.md
7 | generate-md --layout ./mixu-gray --input ./releases/athena-rest-0.0.1-release/md/ --output ./releases/athena-rest-0.0.1-release/
8 | rm -fr ./releases/athena-rest-0.0.1-release/md/
9 |
10 | cp ./athena-doc/* ./releases/athena-rest-0.0.1-release/
11 |
12 | mvn clean package -DskipTests -Dmaven.test.skip=true
13 |
14 | cp ./athena-rest-framework/athena-rest-comm/target/athena-rest-comm-0.0.1.jar ./releases/athena-rest-0.0.1-release/
15 | cp ./athena-rest-framework/athena-rest-container/target/athena-rest-container-0.0.1.jar ./releases/athena-rest-0.0.1-release/
16 | cp ./athena-rest-framework/athena-rest-webapp/target/athena-rest-webapp-0.0.1.jar ./releases/athena-rest-0.0.1-release/
17 |
18 | cp ./athena-rest-build/target/athena-rest-build-0.0.1-bin.tar.gz ./releases/athena-rest-0.0.1-release/
19 | cp ./athena-rest-wizard/target/athena-rest-wizard-0.0.1-bin.zip ./releases/athena-rest-0.0.1-release/
20 | cp ./athena-example/target/athena-example-rest-0.0.1.tar.gz ./releases/athena-rest-0.0.1-release/
21 |
22 |
23 | tar zcvf ./releases/athena-rest-0.0.1-release.tar.gz -C ./releases/ athena-rest-0.0.1-release
24 | rm -fr ./releases/athena-rest-0.0.1-release
25 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.robert.athena
7 | athena-rest
8 | 0.0.1
9 | pom
10 |
11 | athena-rest
12 |
13 |
14 | athena-rest-framework
15 | athena-rest-build
16 | athena-example
17 | athena-rest-wizard
18 |
19 |
20 |
21 |
22 | snapshots
23 | Nexus Snapshot Repository
24 | http://10.77.144.192:11081/nexus/content/repositories/snapshots/
25 |
26 |
27 | releases
28 | Nexus Release Repository
29 | http://10.77.144.192:11081/nexus/content/repositories/releases/
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/todo-list/20150529_100800.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/todo-list/20150529_100800.jpg
--------------------------------------------------------------------------------
/todo-list/20150529_100809.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/todo-list/20150529_100809.jpg
--------------------------------------------------------------------------------
/todo-list/20150529_100813.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/todo-list/20150529_100813.jpg
--------------------------------------------------------------------------------
/todo-list/20150529_100824.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/todo-list/20150529_100824.jpg
--------------------------------------------------------------------------------
/todo-list/20150529_100831.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sayi21cn/athena-rest/0646f2f02abe13f9879baa93eef7d818ffc54190/todo-list/20150529_100831.jpg
--------------------------------------------------------------------------------
/todo-list/todo.txt:
--------------------------------------------------------------------------------
1 | 1. Separate the conf repo and the scripts.
2 |
--------------------------------------------------------------------------------