You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2018/03/14 14:51:55 UTC
[49/49] logging-log4j-audit git commit: Rename war project to editor
Rename war project to editor
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/b75cbcd1
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/b75cbcd1
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/b75cbcd1
Branch: refs/heads/master
Commit: b75cbcd1636d1844c429ec2b0dd1aaf6916014f1
Parents: a57e2f2
Author: Ralph Goers <rg...@apache.org>
Authored: Wed Mar 14 07:50:57 2018 -0700
Committer: Ralph Goers <rg...@apache.org>
Committed: Wed Mar 14 07:50:57 2018 -0700
----------------------------------------------------------------------
log4j-catalog/log4j-catalog-editor/pom.xml | 248 +
.../log4j/catalog/AuditCatalogEditor.java | 86 +
.../catalog/config/ConfigurationService.java | 31 +
.../catalog/config/JsonObjectMapperFactory.java | 162 +
.../log4j/catalog/config/SwaggerConfig.java | 63 +
.../log4j/catalog/config/WebAppInitializer.java | 60 +
.../log4j/catalog/config/WebMvcAppContext.java | 331 +
.../catalog/controller/AttributeController.java | 199 +
.../catalog/controller/CatalogController.java | 148 +
.../catalog/controller/CategoryController.java | 146 +
.../controller/ConstraintController.java | 102 +
.../catalog/controller/EventController.java | 176 +
.../catalog/controller/ProductController.java | 146 +
.../RestResponseEntityExceptionHandler.java | 55 +
.../RequestContextHeaderInterceptor.java | 41 +
.../security/LocalAuthorizationInterceptor.java | 54 +
.../catalog/service/CatalogInitializer.java | 114 +
.../src/main/resources/log4j2.xml | 43 +
.../src/main/resources/sql/hsql/schema.sql | 121 +
.../webapp/WEB-INF/templates/attributes.html | 44 +
.../webapp/WEB-INF/templates/categories.html | 43 +
.../main/webapp/WEB-INF/templates/events.html | 44 +
.../main/webapp/WEB-INF/templates/products.html | 43 +
.../main/webapp/WEB-INF/templates/template.html | 42 +
.../src/main/webapp/css/app.css | 205 +
.../src/main/webapp/images/ajax-loader.gif | Bin 0 -> 3208 bytes
.../src/main/webapp/images/attributes.png | Bin 0 -> 1981 bytes
.../src/main/webapp/images/constraint.png | Bin 0 -> 2586 bytes
.../src/main/webapp/js/app.js | 81 +
.../src/main/webapp/js/attributes.js | 364 +
.../src/main/webapp/js/categories.js | 257 +
.../src/main/webapp/js/events.js | 291 +
.../src/main/webapp/js/jquery-1.12.4.min.js | 5 +
.../src/main/webapp/js/jquery-2.2.4.min.js | 4 +
.../src/main/webapp/js/jquery-3.2.1.min.js | 4 +
.../main/webapp/js/jquery-ui-1.12.1/AUTHORS.txt | 333 +
.../main/webapp/js/jquery-ui-1.12.1/LICENSE.txt | 43 +
.../jquery-ui-1.12.1/external/jquery/jquery.js | 11008 ++++++++++
.../images/ui-icons_444444_256x240.png | Bin 0 -> 7006 bytes
.../images/ui-icons_555555_256x240.png | Bin 0 -> 7074 bytes
.../images/ui-icons_777620_256x240.png | Bin 0 -> 4676 bytes
.../images/ui-icons_777777_256x240.png | Bin 0 -> 7013 bytes
.../images/ui-icons_cc0000_256x240.png | Bin 0 -> 4632 bytes
.../images/ui-icons_ffffff_256x240.png | Bin 0 -> 6313 bytes
.../main/webapp/js/jquery-ui-1.12.1/index.html | 559 +
.../webapp/js/jquery-ui-1.12.1/jquery-ui.css | 1312 ++
.../webapp/js/jquery-ui-1.12.1/jquery-ui.js | 18706 +++++++++++++++++
.../js/jquery-ui-1.12.1/jquery-ui.min.css | 7 +
.../webapp/js/jquery-ui-1.12.1/jquery-ui.min.js | 13 +
.../js/jquery-ui-1.12.1/jquery-ui.structure.css | 886 +
.../jquery-ui.structure.min.css | 5 +
.../js/jquery-ui-1.12.1/jquery-ui.theme.css | 443 +
.../js/jquery-ui-1.12.1/jquery-ui.theme.min.css | 5 +
.../webapp/js/jquery-ui-1.12.1/package.json | 74 +
.../jquery.jtable.aspnetpagemethods.js | 150 +
.../jquery.jtable.aspnetpagemethods.min.js | 27 +
.../webapp/js/jtable.2.4.0/external/json2.js | 486 +
.../js/jtable.2.4.0/external/json2.min.js | 8 +
.../webapp/js/jtable.2.4.0/jquery.jtable.js | 5021 +++++
.../webapp/js/jtable.2.4.0/jquery.jtable.min.js | 157 +
.../localization/jquery.jtable.bd.js | 30 +
.../localization/jquery.jtable.ca.js | 30 +
.../localization/jquery.jtable.cz.js | 30 +
.../localization/jquery.jtable.de.js | 30 +
.../localization/jquery.jtable.es.js | 30 +
.../localization/jquery.jtable.fa.js | 30 +
.../localization/jquery.jtable.fr.js | 30 +
.../localization/jquery.jtable.hr.js | 30 +
.../localization/jquery.jtable.hu.js | 30 +
.../localization/jquery.jtable.id.js | 31 +
.../localization/jquery.jtable.it.js | 30 +
.../localization/jquery.jtable.lt.js | 30 +
.../localization/jquery.jtable.nl-NL.js | 30 +
.../localization/jquery.jtable.no.js | 30 +
.../localization/jquery.jtable.pl.js | 30 +
.../localization/jquery.jtable.pt-BR.js | 30 +
.../localization/jquery.jtable.pt-PT.js | 29 +
.../localization/jquery.jtable.ro.js | 30 +
.../localization/jquery.jtable.ru.js | 31 +
.../localization/jquery.jtable.se.js | 30 +
.../localization/jquery.jtable.tr.js | 30 +
.../localization/jquery.jtable.vi.js | 28 +
.../localization/jquery.jtable.zh-CN.js | 30 +
.../js/jtable.2.4.0/themes/basic/close.png | Bin 0 -> 3350 bytes
.../js/jtable.2.4.0/themes/basic/column-asc.png | Bin 0 -> 362 bytes
.../jtable.2.4.0/themes/basic/column-desc.png | Bin 0 -> 349 bytes
.../themes/basic/column-sortable.png | Bin 0 -> 347 bytes
.../js/jtable.2.4.0/themes/basic/delete.png | Bin 0 -> 150 bytes
.../js/jtable.2.4.0/themes/basic/edit.png | Bin 0 -> 590 bytes
.../jtable.2.4.0/themes/basic/jtable_basic.css | 282 +
.../jtable.2.4.0/themes/basic/jtable_basic.less | 83 +
.../themes/basic/jtable_basic.min.css | 1 +
.../js/jtable.2.4.0/themes/jqueryui/add.png | Bin 0 -> 482 bytes
.../jtable.2.4.0/themes/jqueryui/bg-thead.png | Bin 0 -> 2811 bytes
.../js/jtable.2.4.0/themes/jqueryui/close.png | Bin 0 -> 1217 bytes
.../jtable.2.4.0/themes/jqueryui/column-asc.png | Bin 0 -> 362 bytes
.../themes/jqueryui/column-desc.png | Bin 0 -> 349 bytes
.../themes/jqueryui/column-sortable.png | Bin 0 -> 347 bytes
.../js/jtable.2.4.0/themes/jqueryui/delete.png | Bin 0 -> 150 bytes
.../js/jtable.2.4.0/themes/jqueryui/edit.png | Bin 0 -> 590 bytes
.../themes/jqueryui/jtable_jqueryui.css | 398 +
.../themes/jqueryui/jtable_jqueryui.less | 296 +
.../themes/jqueryui/jtable_jqueryui.min.css | 1 +
.../js/jtable.2.4.0/themes/jqueryui/loading.gif | Bin 0 -> 723 bytes
.../jtable.2.4.0/themes/jtable_theme_base.less | 524 +
.../js/jtable.2.4.0/themes/lightcolor/add.png | Bin 0 -> 482 bytes
.../jtable.2.4.0/themes/lightcolor/bg-thead.png | Bin 0 -> 2811 bytes
.../themes/lightcolor/blue/jtable.css | 521 +
.../themes/lightcolor/blue/jtable.less | 90 +
.../themes/lightcolor/blue/jtable.min.css | 1 +
.../themes/lightcolor/blue/loading.gif | Bin 0 -> 723 bytes
.../js/jtable.2.4.0/themes/lightcolor/close.png | Bin 0 -> 1217 bytes
.../themes/lightcolor/column-asc.png | Bin 0 -> 362 bytes
.../themes/lightcolor/column-desc.png | Bin 0 -> 349 bytes
.../themes/lightcolor/column-sortable.png | Bin 0 -> 347 bytes
.../jtable.2.4.0/themes/lightcolor/delete.png | Bin 0 -> 150 bytes
.../js/jtable.2.4.0/themes/lightcolor/edit.png | Bin 0 -> 590 bytes
.../themes/lightcolor/gray/jtable.css | 521 +
.../themes/lightcolor/gray/jtable.less | 90 +
.../themes/lightcolor/gray/jtable.min.css | 1 +
.../themes/lightcolor/gray/loading.gif | Bin 0 -> 723 bytes
.../themes/lightcolor/green/jtable.css | 521 +
.../themes/lightcolor/green/jtable.less | 90 +
.../themes/lightcolor/green/jtable.min.css | 1 +
.../themes/lightcolor/green/loading.gif | Bin 0 -> 723 bytes
.../lightcolor/jtable_lightcolor_base.less | 329 +
.../themes/lightcolor/orange/jtable.css | 521 +
.../themes/lightcolor/orange/jtable.less | 90 +
.../themes/lightcolor/orange/jtable.min.css | 1 +
.../themes/lightcolor/orange/loading.gif | Bin 0 -> 723 bytes
.../themes/lightcolor/red/jtable.css | 521 +
.../themes/lightcolor/red/jtable.less | 90 +
.../themes/lightcolor/red/jtable.min.css | 1 +
.../themes/lightcolor/red/loading.gif | Bin 0 -> 723 bytes
.../webapp/js/jtable.2.4.0/themes/metro/add.png | Bin 0 -> 482 bytes
.../jtable.2.4.0/themes/metro/blue/jtable.css | 495 +
.../jtable.2.4.0/themes/metro/blue/jtable.less | 11 +
.../themes/metro/blue/jtable.min.css | 1 +
.../jtable.2.4.0/themes/metro/blue/loading.gif | Bin 0 -> 404 bytes
.../jtable.2.4.0/themes/metro/brown/jtable.css | 495 +
.../jtable.2.4.0/themes/metro/brown/jtable.less | 11 +
.../themes/metro/brown/jtable.min.css | 1 +
.../jtable.2.4.0/themes/metro/brown/loading.gif | Bin 0 -> 404 bytes
.../js/jtable.2.4.0/themes/metro/close.png | Bin 0 -> 3350 bytes
.../js/jtable.2.4.0/themes/metro/column-asc.png | Bin 0 -> 320 bytes
.../jtable.2.4.0/themes/metro/column-desc.png | Bin 0 -> 311 bytes
.../themes/metro/column-sortable.png | Bin 0 -> 314 bytes
.../themes/metro/crimson/jtable.css | 495 +
.../themes/metro/crimson/jtable.less | 11 +
.../themes/metro/crimson/jtable.min.css | 1 +
.../themes/metro/crimson/loading.gif | Bin 0 -> 404 bytes
.../themes/metro/darkgray/jtable.css | 495 +
.../themes/metro/darkgray/jtable.less | 11 +
.../themes/metro/darkgray/jtable.min.css | 1 +
.../themes/metro/darkgray/loading.gif | Bin 0 -> 404 bytes
.../themes/metro/darkorange/jtable.css | 495 +
.../themes/metro/darkorange/jtable.less | 11 +
.../themes/metro/darkorange/jtable.min.css | 1 +
.../themes/metro/darkorange/loading.gif | Bin 0 -> 404 bytes
.../js/jtable.2.4.0/themes/metro/delete.png | Bin 0 -> 3167 bytes
.../js/jtable.2.4.0/themes/metro/edit.png | Bin 0 -> 3359 bytes
.../jtable.2.4.0/themes/metro/green/jtable.css | 495 +
.../jtable.2.4.0/themes/metro/green/jtable.less | 11 +
.../themes/metro/green/jtable.min.css | 1 +
.../jtable.2.4.0/themes/metro/green/loading.gif | Bin 0 -> 404 bytes
.../themes/metro/jtable_metro_base.css | 48 +
.../themes/metro/jtable_metro_base.less | 439 +
.../themes/metro/jtable_metro_base.min.css | 1 +
.../themes/metro/lightgray/jtable.css | 495 +
.../themes/metro/lightgray/jtable.less | 11 +
.../themes/metro/lightgray/jtable.min.css | 1 +
.../themes/metro/lightgray/loading.gif | Bin 0 -> 404 bytes
.../jtable.2.4.0/themes/metro/pink/jtable.css | 495 +
.../jtable.2.4.0/themes/metro/pink/jtable.less | 11 +
.../themes/metro/pink/jtable.min.css | 1 +
.../jtable.2.4.0/themes/metro/pink/loading.gif | Bin 0 -> 404 bytes
.../jtable.2.4.0/themes/metro/purple/jtable.css | 495 +
.../themes/metro/purple/jtable.less | 11 +
.../themes/metro/purple/jtable.min.css | 1 +
.../themes/metro/purple/loading.gif | Bin 0 -> 404 bytes
.../js/jtable.2.4.0/themes/metro/red/jtable.css | 495 +
.../jtable.2.4.0/themes/metro/red/jtable.less | 11 +
.../themes/metro/red/jtable.min.css | 1 +
.../jtable.2.4.0/themes/metro/red/loading.gif | Bin 0 -> 404 bytes
.../src/main/webapp/js/products.js | 257 +
.../src/site/markdown/index.md | 25 +
.../log4j-catalog-editor/src/site/site.xml | 53 +
log4j-catalog/log4j-catalog-war/pom.xml | 248 -
.../log4j/catalog/AuditCatalogEditor.java | 86 -
.../catalog/config/ConfigurationService.java | 31 -
.../catalog/config/JsonObjectMapperFactory.java | 162 -
.../log4j/catalog/config/SwaggerConfig.java | 63 -
.../log4j/catalog/config/WebAppInitializer.java | 60 -
.../log4j/catalog/config/WebMvcAppContext.java | 331 -
.../catalog/controller/AttributeController.java | 199 -
.../catalog/controller/CatalogController.java | 148 -
.../catalog/controller/CategoryController.java | 146 -
.../controller/ConstraintController.java | 102 -
.../catalog/controller/EventController.java | 176 -
.../catalog/controller/ProductController.java | 146 -
.../RestResponseEntityExceptionHandler.java | 55 -
.../RequestContextHeaderInterceptor.java | 41 -
.../security/LocalAuthorizationInterceptor.java | 54 -
.../catalog/service/CatalogInitializer.java | 114 -
.../src/main/resources/log4j2.xml | 43 -
.../src/main/resources/sql/hsql/schema.sql | 121 -
.../webapp/WEB-INF/templates/attributes.html | 44 -
.../webapp/WEB-INF/templates/categories.html | 43 -
.../main/webapp/WEB-INF/templates/events.html | 44 -
.../main/webapp/WEB-INF/templates/products.html | 43 -
.../main/webapp/WEB-INF/templates/template.html | 42 -
.../src/main/webapp/css/app.css | 205 -
.../src/main/webapp/images/ajax-loader.gif | Bin 3208 -> 0 bytes
.../src/main/webapp/images/attributes.png | Bin 1981 -> 0 bytes
.../src/main/webapp/images/constraint.png | Bin 2586 -> 0 bytes
.../log4j-catalog-war/src/main/webapp/js/app.js | 81 -
.../src/main/webapp/js/attributes.js | 364 -
.../src/main/webapp/js/categories.js | 257 -
.../src/main/webapp/js/events.js | 291 -
.../src/main/webapp/js/jquery-1.12.4.min.js | 5 -
.../src/main/webapp/js/jquery-2.2.4.min.js | 4 -
.../src/main/webapp/js/jquery-3.2.1.min.js | 4 -
.../main/webapp/js/jquery-ui-1.12.1/AUTHORS.txt | 333 -
.../main/webapp/js/jquery-ui-1.12.1/LICENSE.txt | 43 -
.../jquery-ui-1.12.1/external/jquery/jquery.js | 11008 ----------
.../images/ui-icons_444444_256x240.png | Bin 7006 -> 0 bytes
.../images/ui-icons_555555_256x240.png | Bin 7074 -> 0 bytes
.../images/ui-icons_777620_256x240.png | Bin 4676 -> 0 bytes
.../images/ui-icons_777777_256x240.png | Bin 7013 -> 0 bytes
.../images/ui-icons_cc0000_256x240.png | Bin 4632 -> 0 bytes
.../images/ui-icons_ffffff_256x240.png | Bin 6313 -> 0 bytes
.../main/webapp/js/jquery-ui-1.12.1/index.html | 559 -
.../webapp/js/jquery-ui-1.12.1/jquery-ui.css | 1312 --
.../webapp/js/jquery-ui-1.12.1/jquery-ui.js | 18706 -----------------
.../js/jquery-ui-1.12.1/jquery-ui.min.css | 7 -
.../webapp/js/jquery-ui-1.12.1/jquery-ui.min.js | 13 -
.../js/jquery-ui-1.12.1/jquery-ui.structure.css | 886 -
.../jquery-ui.structure.min.css | 5 -
.../js/jquery-ui-1.12.1/jquery-ui.theme.css | 443 -
.../js/jquery-ui-1.12.1/jquery-ui.theme.min.css | 5 -
.../webapp/js/jquery-ui-1.12.1/package.json | 74 -
.../jquery.jtable.aspnetpagemethods.js | 150 -
.../jquery.jtable.aspnetpagemethods.min.js | 27 -
.../webapp/js/jtable.2.4.0/external/json2.js | 486 -
.../js/jtable.2.4.0/external/json2.min.js | 8 -
.../webapp/js/jtable.2.4.0/jquery.jtable.js | 5021 -----
.../webapp/js/jtable.2.4.0/jquery.jtable.min.js | 157 -
.../localization/jquery.jtable.bd.js | 30 -
.../localization/jquery.jtable.ca.js | 30 -
.../localization/jquery.jtable.cz.js | 30 -
.../localization/jquery.jtable.de.js | 30 -
.../localization/jquery.jtable.es.js | 30 -
.../localization/jquery.jtable.fa.js | 30 -
.../localization/jquery.jtable.fr.js | 30 -
.../localization/jquery.jtable.hr.js | 30 -
.../localization/jquery.jtable.hu.js | 30 -
.../localization/jquery.jtable.id.js | 31 -
.../localization/jquery.jtable.it.js | 30 -
.../localization/jquery.jtable.lt.js | 30 -
.../localization/jquery.jtable.nl-NL.js | 30 -
.../localization/jquery.jtable.no.js | 30 -
.../localization/jquery.jtable.pl.js | 30 -
.../localization/jquery.jtable.pt-BR.js | 30 -
.../localization/jquery.jtable.pt-PT.js | 29 -
.../localization/jquery.jtable.ro.js | 30 -
.../localization/jquery.jtable.ru.js | 31 -
.../localization/jquery.jtable.se.js | 30 -
.../localization/jquery.jtable.tr.js | 30 -
.../localization/jquery.jtable.vi.js | 28 -
.../localization/jquery.jtable.zh-CN.js | 30 -
.../js/jtable.2.4.0/themes/basic/close.png | Bin 3350 -> 0 bytes
.../js/jtable.2.4.0/themes/basic/column-asc.png | Bin 362 -> 0 bytes
.../jtable.2.4.0/themes/basic/column-desc.png | Bin 349 -> 0 bytes
.../themes/basic/column-sortable.png | Bin 347 -> 0 bytes
.../js/jtable.2.4.0/themes/basic/delete.png | Bin 150 -> 0 bytes
.../js/jtable.2.4.0/themes/basic/edit.png | Bin 590 -> 0 bytes
.../jtable.2.4.0/themes/basic/jtable_basic.css | 282 -
.../jtable.2.4.0/themes/basic/jtable_basic.less | 83 -
.../themes/basic/jtable_basic.min.css | 1 -
.../js/jtable.2.4.0/themes/jqueryui/add.png | Bin 482 -> 0 bytes
.../jtable.2.4.0/themes/jqueryui/bg-thead.png | Bin 2811 -> 0 bytes
.../js/jtable.2.4.0/themes/jqueryui/close.png | Bin 1217 -> 0 bytes
.../jtable.2.4.0/themes/jqueryui/column-asc.png | Bin 362 -> 0 bytes
.../themes/jqueryui/column-desc.png | Bin 349 -> 0 bytes
.../themes/jqueryui/column-sortable.png | Bin 347 -> 0 bytes
.../js/jtable.2.4.0/themes/jqueryui/delete.png | Bin 150 -> 0 bytes
.../js/jtable.2.4.0/themes/jqueryui/edit.png | Bin 590 -> 0 bytes
.../themes/jqueryui/jtable_jqueryui.css | 398 -
.../themes/jqueryui/jtable_jqueryui.less | 296 -
.../themes/jqueryui/jtable_jqueryui.min.css | 1 -
.../js/jtable.2.4.0/themes/jqueryui/loading.gif | Bin 723 -> 0 bytes
.../jtable.2.4.0/themes/jtable_theme_base.less | 524 -
.../js/jtable.2.4.0/themes/lightcolor/add.png | Bin 482 -> 0 bytes
.../jtable.2.4.0/themes/lightcolor/bg-thead.png | Bin 2811 -> 0 bytes
.../themes/lightcolor/blue/jtable.css | 521 -
.../themes/lightcolor/blue/jtable.less | 90 -
.../themes/lightcolor/blue/jtable.min.css | 1 -
.../themes/lightcolor/blue/loading.gif | Bin 723 -> 0 bytes
.../js/jtable.2.4.0/themes/lightcolor/close.png | Bin 1217 -> 0 bytes
.../themes/lightcolor/column-asc.png | Bin 362 -> 0 bytes
.../themes/lightcolor/column-desc.png | Bin 349 -> 0 bytes
.../themes/lightcolor/column-sortable.png | Bin 347 -> 0 bytes
.../jtable.2.4.0/themes/lightcolor/delete.png | Bin 150 -> 0 bytes
.../js/jtable.2.4.0/themes/lightcolor/edit.png | Bin 590 -> 0 bytes
.../themes/lightcolor/gray/jtable.css | 521 -
.../themes/lightcolor/gray/jtable.less | 90 -
.../themes/lightcolor/gray/jtable.min.css | 1 -
.../themes/lightcolor/gray/loading.gif | Bin 723 -> 0 bytes
.../themes/lightcolor/green/jtable.css | 521 -
.../themes/lightcolor/green/jtable.less | 90 -
.../themes/lightcolor/green/jtable.min.css | 1 -
.../themes/lightcolor/green/loading.gif | Bin 723 -> 0 bytes
.../lightcolor/jtable_lightcolor_base.less | 329 -
.../themes/lightcolor/orange/jtable.css | 521 -
.../themes/lightcolor/orange/jtable.less | 90 -
.../themes/lightcolor/orange/jtable.min.css | 1 -
.../themes/lightcolor/orange/loading.gif | Bin 723 -> 0 bytes
.../themes/lightcolor/red/jtable.css | 521 -
.../themes/lightcolor/red/jtable.less | 90 -
.../themes/lightcolor/red/jtable.min.css | 1 -
.../themes/lightcolor/red/loading.gif | Bin 723 -> 0 bytes
.../webapp/js/jtable.2.4.0/themes/metro/add.png | Bin 482 -> 0 bytes
.../jtable.2.4.0/themes/metro/blue/jtable.css | 495 -
.../jtable.2.4.0/themes/metro/blue/jtable.less | 11 -
.../themes/metro/blue/jtable.min.css | 1 -
.../jtable.2.4.0/themes/metro/blue/loading.gif | Bin 404 -> 0 bytes
.../jtable.2.4.0/themes/metro/brown/jtable.css | 495 -
.../jtable.2.4.0/themes/metro/brown/jtable.less | 11 -
.../themes/metro/brown/jtable.min.css | 1 -
.../jtable.2.4.0/themes/metro/brown/loading.gif | Bin 404 -> 0 bytes
.../js/jtable.2.4.0/themes/metro/close.png | Bin 3350 -> 0 bytes
.../js/jtable.2.4.0/themes/metro/column-asc.png | Bin 320 -> 0 bytes
.../jtable.2.4.0/themes/metro/column-desc.png | Bin 311 -> 0 bytes
.../themes/metro/column-sortable.png | Bin 314 -> 0 bytes
.../themes/metro/crimson/jtable.css | 495 -
.../themes/metro/crimson/jtable.less | 11 -
.../themes/metro/crimson/jtable.min.css | 1 -
.../themes/metro/crimson/loading.gif | Bin 404 -> 0 bytes
.../themes/metro/darkgray/jtable.css | 495 -
.../themes/metro/darkgray/jtable.less | 11 -
.../themes/metro/darkgray/jtable.min.css | 1 -
.../themes/metro/darkgray/loading.gif | Bin 404 -> 0 bytes
.../themes/metro/darkorange/jtable.css | 495 -
.../themes/metro/darkorange/jtable.less | 11 -
.../themes/metro/darkorange/jtable.min.css | 1 -
.../themes/metro/darkorange/loading.gif | Bin 404 -> 0 bytes
.../js/jtable.2.4.0/themes/metro/delete.png | Bin 3167 -> 0 bytes
.../js/jtable.2.4.0/themes/metro/edit.png | Bin 3359 -> 0 bytes
.../jtable.2.4.0/themes/metro/green/jtable.css | 495 -
.../jtable.2.4.0/themes/metro/green/jtable.less | 11 -
.../themes/metro/green/jtable.min.css | 1 -
.../jtable.2.4.0/themes/metro/green/loading.gif | Bin 404 -> 0 bytes
.../themes/metro/jtable_metro_base.css | 48 -
.../themes/metro/jtable_metro_base.less | 439 -
.../themes/metro/jtable_metro_base.min.css | 1 -
.../themes/metro/lightgray/jtable.css | 495 -
.../themes/metro/lightgray/jtable.less | 11 -
.../themes/metro/lightgray/jtable.min.css | 1 -
.../themes/metro/lightgray/loading.gif | Bin 404 -> 0 bytes
.../jtable.2.4.0/themes/metro/pink/jtable.css | 495 -
.../jtable.2.4.0/themes/metro/pink/jtable.less | 11 -
.../themes/metro/pink/jtable.min.css | 1 -
.../jtable.2.4.0/themes/metro/pink/loading.gif | Bin 404 -> 0 bytes
.../jtable.2.4.0/themes/metro/purple/jtable.css | 495 -
.../themes/metro/purple/jtable.less | 11 -
.../themes/metro/purple/jtable.min.css | 1 -
.../themes/metro/purple/loading.gif | Bin 404 -> 0 bytes
.../js/jtable.2.4.0/themes/metro/red/jtable.css | 495 -
.../jtable.2.4.0/themes/metro/red/jtable.less | 11 -
.../themes/metro/red/jtable.min.css | 1 -
.../jtable.2.4.0/themes/metro/red/loading.gif | Bin 404 -> 0 bytes
.../src/main/webapp/js/products.js | 257 -
.../src/site/markdown/index.md | 25 -
.../log4j-catalog-war/src/site/site.xml | 53 -
log4j-catalog/pom.xml | 2 +-
375 files changed, 54553 insertions(+), 54553 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/pom.xml
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/pom.xml b/log4j-catalog/log4j-catalog-editor/pom.xml
new file mode 100644
index 0000000..fa8fe36
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/pom.xml
@@ -0,0 +1,248 @@
+<?xml version="1.0"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache license, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the license for the specific language governing permissions and
+ ~ limitations under the license.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-catalog</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>log4j-catalog-editor</artifactId>
+ <packaging>jar</packaging>
+
+ <name>Log4j Catalog Editor</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <log4jParentDir>${basedir}/../..</log4jParentDir>
+ <java.version>1.8</java.version>
+ </properties>
+ <distributionManagement>
+ <site>
+ <id>apache.website</id>
+ <url>scp://people.apache.org/www/logging.apache.org/log4j-audit/log4j-catalog/log4j-catalog-war</url>
+ </site>
+ </distributionManagement>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${spring.boot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-devtools</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-log4j2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-actuator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-tomcat</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-thymeleaf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.thymeleaf.extras</groupId>
+ <artifactId>thymeleaf-extras-java8time</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jstl</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger2</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>io.springfox</groupId>
+ <artifactId>springfox-swagger-ui</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-catalog-git</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-catalog-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-catalog-api</artifactId>
+ </dependency>
+ <!-- <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ </dependency> -->
+ <dependency>
+ <groupId>org.springframework.data</groupId>
+ <artifactId>spring-data-rest-webmvc</artifactId>
+ </dependency>
+ <!-- <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.datatype</groupId>
+ <artifactId>jackson-datatype-jsr310</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency> -->
+ <dependency>
+ <groupId>org.springframework.data</groupId>
+ <artifactId>spring-data-jpa</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.modelmapper</groupId>
+ <artifactId>modelmapper</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.modelmapper.extensions</groupId>
+ <artifactId>modelmapper-spring</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.modelmapper.extensions</groupId>
+ <artifactId>modelmapper-jackson</artifactId>
+ </dependency>
+ <!-- <dependency>
+ <groupId>org.thymeleaf</groupId>
+ <artifactId>thymeleaf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.thymeleaf</groupId>
+ <artifactId>thymeleaf-spring4</artifactId>
+ </dependency>-->
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${spring.boot.version}</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java
new file mode 100644
index 0000000..8a37bec
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/AuditCatalogEditor.java
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.catalog;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.catalog.api.util.ProfileUtil;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ *
+ */
+@SpringBootApplication
+public class AuditCatalogEditor extends SpringBootServletInitializer {
+ private static final String SPRING_PROFILE = "spring.profiles.active";
+
+ public static void main(String[] args) {
+ SpringApplicationBuilder builder = new SpringApplicationBuilder().profiles(getActiveProfile())
+ .sources(AuditCatalogEditor.class);
+ System.setProperty("isEmbedded", "true");
+ builder.run(args);
+ }
+
+ /**
+ * Get the active profile if none has been specified.
+ */
+ public static String getActiveProfile() {
+ String springProfile = System.getProperty(SPRING_PROFILE);
+ if (springProfile == null) {
+ springProfile = System.getenv(SPRING_PROFILE);
+ }
+ if (springProfile == null) {
+ Properties props = loadProperties();
+ springProfile = props.getProperty(SPRING_PROFILE);
+ if (springProfile == null) {
+ springProfile = "eclipseLink";
+ }
+ }
+ return springProfile;
+ }
+
+ private static Properties loadProperties() {
+ Properties props = new Properties();
+ String env = System.getProperty("env");
+ if (env == null) {
+ env = System.getenv("env");
+ }
+ StringBuilder sb = new StringBuilder("catalog-");
+ if (env != null) {
+ sb.append(env);
+ }
+ sb.append("config.properties");
+ InputStream is = ProfileUtil.class.getClassLoader().getResourceAsStream(sb.toString());
+ if (is != null) {
+ try {
+ props.load(is);
+ } catch (IOException ioe) {
+ //Ignore the error.
+ }
+ }
+ return props;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/ConfigurationService.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/ConfigurationService.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/ConfigurationService.java
new file mode 100644
index 0000000..73bb1dc
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/ConfigurationService.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.catalog.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ConfigurationService {
+
+ @Value("${catalogServiceAuthToken:cbade18f-437a-412c-b0c5-9e246ee23ca6}")
+ private String catalogServiceAuthToken;
+
+ public String getCatalogServiceAuthToken() {
+ return catalogServiceAuthToken;
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/JsonObjectMapperFactory.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/JsonObjectMapperFactory.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/JsonObjectMapperFactory.java
new file mode 100644
index 0000000..cb77f3c
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/JsonObjectMapperFactory.java
@@ -0,0 +1,162 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.catalog.config;
+
+import java.io.IOException;
+import java.time.DateTimeException;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.JsonDeserializer;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
+
+/**
+ * Extends Jackson ObjectMapper to support Java LocalDateTime.
+ */
+public final class JsonObjectMapperFactory {
+ /**
+ * Date/Time format.
+ */
+ private static final String LOCAL_DATE_TIME_FORMAT = "yyyyMMddHHmmss.SSS";
+
+ /**
+ * LocalDateTime formatter that converts to and from a format usable in REST requests.
+ */
+ private static final DateTimeFormatter LOCAL_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(LOCAL_DATE_TIME_FORMAT);
+
+ /**
+ * Date/Time format.
+ */
+ private static final String LOCAL_DATE_FORMAT = "yyyyMMdd";
+
+ /**
+ * LocalDateTime formatter that converts to and from a format usable in REST requests.
+ */
+ private static final DateTimeFormatter LOCAL_DATE_FORMATTER = DateTimeFormatter.ofPattern(LOCAL_DATE_FORMAT);
+
+ /**
+ * Date/Time format.
+ */
+ private static final String ZONED_DATE_TIME_FORMAT = "yyyyMMddHHmmss.SSSZ";
+
+ /**
+ * LocalDateTime formatter that converts to and from a format usable in REST requests.
+ */
+ public static final DateTimeFormatter ZONED_DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern(ZONED_DATE_TIME_FORMAT);
+
+ private JsonObjectMapperFactory() {
+ }
+
+ /**
+ * Create an ObjectMapper using the standard LocalDateTime format.
+ * @return The ObjectMapper.
+ */
+ public static ObjectMapper createMapper() {
+ ObjectMapper mapper = Jackson2ObjectMapperBuilder.json().build();
+ DateTimeFormatter dateTimeFormatter = LOCAL_DATE_TIME_FORMATTER;
+ DateTimeFormatter dateFormatter = LOCAL_DATE_FORMATTER;
+ DateTimeFormatter zonedTimeFormatter = ZONED_DATE_TIME_FORMATTER;
+ SimpleModule module = new SimpleModule();
+ module.addSerializer(LocalDateTime.class, new JsonSerializer<LocalDateTime>() {
+ @Override
+ public void serialize(LocalDateTime localDateTime, JsonGenerator jsonGenerator,
+ SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
+ jsonGenerator.writeString(dateTimeFormatter.format(localDateTime));
+ }
+ });
+ module.addDeserializer(LocalDateTime.class, new JsonDeserializer<LocalDateTime>() {
+ @Override
+ public LocalDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException {
+ String string = parser.getText().trim();
+ if (string.length() == 0) {
+ return null;
+ }
+ try {
+ return LocalDateTime.parse(string, dateTimeFormatter);
+ } catch (DateTimeException e) {
+ throw JsonMappingException.from(parser,
+ String.format("Failed to deserialize %s: (%s) %s",
+ handledType().getName(), e.getClass().getName(), e.getMessage()), e);
+ }
+ }
+ });
+ module.addSerializer(ZonedDateTime.class, new JsonSerializer<ZonedDateTime>() {
+ @Override
+ public void serialize(ZonedDateTime zonedDateTime, JsonGenerator jsonGenerator,
+ SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
+ jsonGenerator.writeString(zonedTimeFormatter.format(zonedDateTime));
+ }
+ });
+ module.addDeserializer(ZonedDateTime.class, new JsonDeserializer<ZonedDateTime>() {
+ @Override
+ public ZonedDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException {
+ String string = parser.getText().trim();
+ if (string.length() == 0) {
+ return null;
+ }
+ try {
+ return ZonedDateTime.parse(string, zonedTimeFormatter);
+ } catch (DateTimeException e) {
+ throw JsonMappingException.from(parser,
+ String.format("Failed to deserialize %s: (%s) %s",
+ handledType().getName(), e.getClass().getName(), e.getMessage()), e);
+ }
+ }
+ });
+ module.addSerializer(LocalDate.class, new JsonSerializer<LocalDate>() {
+ @Override
+ public void serialize(LocalDate localDate, JsonGenerator jsonGenerator,
+ SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
+ jsonGenerator.writeString(dateFormatter.format(localDate));
+ }
+ });
+ module.addDeserializer(LocalDate.class, new JsonDeserializer<LocalDate>() {
+ @Override
+ public LocalDate deserialize(JsonParser parser, DeserializationContext context) throws IOException {
+ String string = parser.getText().trim();
+ if (string.length() == 0) {
+ return null;
+ }
+ try {
+ return LocalDate.parse(string, dateFormatter);
+ } catch (DateTimeException e) {
+ throw JsonMappingException.from(parser,
+ String.format("Failed to deserialize %s: (%s) %s",
+ handledType().getName(), e.getClass().getName(), e.getMessage()), e);
+ }
+ }
+ });
+ mapper.registerModule(module);
+ mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
+ return mapper;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/SwaggerConfig.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/SwaggerConfig.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/SwaggerConfig.java
new file mode 100644
index 0000000..0b0f9c6
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/SwaggerConfig.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.catalog.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * This will configure Swagger to produce an API for all of our REST endpoints.
+ */
+@Configuration
+@EnableSwagger2
+@EnableWebMvc
+public class SwaggerConfig {
+ @Bean
+ public Docket api() {
+ return new Docket(DocumentationType.SWAGGER_2)
+ .apiInfo(apiInfo())
+ .select()
+ .apis(RequestHandlerSelectors.any())
+ .paths(PathSelectors.any())
+ .build()
+ .directModelSubstitute(LocalDate.class, java.sql.Date.class)
+ .directModelSubstitute(LocalDateTime.class, java.util.Date.class);
+ }
+
+ private ApiInfo apiInfo() {
+ return new ApiInfoBuilder()
+ .title("Catalog Service")
+ .description("Maintains the audit event catalog")
+ .termsOfServiceUrl("http://logging.apache.org")
+ .contact("Apache Logging")
+ .license("1.0")
+ .licenseUrl("http://www.apache.org/licenses/")
+ .version("1.0")
+ .build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java
new file mode 100644
index 0000000..1e6f884
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/WebAppInitializer.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.catalog.config;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.catalog.api.util.ProfileUtil;
+import org.springframework.boot.web.servlet.ServletContextInitializer;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.WebApplicationInitializer;
+import org.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
+import org.springframework.web.servlet.DispatcherServlet;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+
+public class WebAppInitializer {
+ private static final String APPLICATION_NAME = "AuditCatalog";
+ private static Logger LOGGER = LogManager.getLogger(WebAppInitializer.class);
+
+ @Bean
+ public ServletContextInitializer initializer() {
+ return new ServletContextInitializer() {
+
+ @Override
+ public void onStartup(ServletContext servletContext) throws ServletException {
+ LOGGER.info("Starting Audit Catalog Editor");
+ servletContext.setInitParameter("applicationName", APPLICATION_NAME);
+ ProfileUtil.setActiveProfile(servletContext);
+ servletContext.setInitParameter("isEmbedded", "true");
+ System.setProperty("applicationName", APPLICATION_NAME);
+ //AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
+ //rootContext.setDisplayName(APPLICATION_NAME);
+ //rootContext.register(WebMvcAppContext.class);
+ //servletContext.addListener(new ContextLoaderListener(rootContext));
+
+ //ServletRegistration.Dynamic restServlet = servletContext.addServlet("dispatcherServlet", new DispatcherServlet(rootContext));
+ //restServlet.setLoadOnStartup(1);
+ //restServlet.addMapping("/*");
+ }
+ };
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
new file mode 100644
index 0000000..181024d
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
@@ -0,0 +1,331 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.catalog.config;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Collections;
+import java.util.List;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.UserInfo;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.catalog.api.dao.CatalogDao;
+import org.apache.logging.log4j.catalog.api.util.CatalogEventFilter;
+import org.apache.logging.log4j.catalog.git.dao.GitCatalogDao;
+import org.apache.logging.log4j.catalog.security.LocalAuthorizationInterceptor;
+import org.eclipse.jgit.api.TransportConfigCallback;
+import org.eclipse.jgit.transport.JschConfigSessionFactory;
+import org.eclipse.jgit.transport.OpenSshConfig;
+import org.eclipse.jgit.transport.SshSessionFactory;
+import org.eclipse.jgit.transport.SshTransport;
+import org.eclipse.jgit.transport.Transport;
+import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
+import org.eclipse.jgit.util.FS;
+import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.context.MessageSource;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.annotation.Scope;
+import org.springframework.context.support.ResourceBundleMessageSource;
+import org.springframework.core.annotation.Order;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.web.servlet.ViewResolver;
+import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.thymeleaf.spring4.SpringTemplateEngine;
+import org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver;
+import org.thymeleaf.spring4.view.ThymeleafView;
+import org.thymeleaf.spring4.view.ThymeleafViewResolver;
+import org.thymeleaf.templatemode.TemplateMode;
+
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+
+@Configuration
+@ComponentScan(basePackages = {"org.apache.logging.log4j.catalog"})
+//@PropertySource(value = "classpath:catalog-${env:}config.properties", ignoreResourceNotFound = true)
+public class WebMvcAppContext extends WebMvcConfigurerAdapter implements ApplicationContextAware {
+
+ private static final Logger LOGGER = LogManager.getLogger(WebMvcAppContext.class);
+
+ @Autowired
+ ConfigurationService configurationService;
+
+ private ApplicationContext applicationContext;
+
+ @Override
+ public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+ this.applicationContext = applicationContext;
+ }
+
+ @Override
+ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
+ configurer.enable();
+ }
+
+ @Override
+ public void addResourceHandlers(final ResourceHandlerRegistry registry) {
+ super.addResourceHandlers(registry);
+ registry.addResourceHandler("/images/**").addResourceLocations("/images/");
+ registry.addResourceHandler("/css/**").addResourceLocations("/css/");
+ registry.addResourceHandler("/js/**").addResourceLocations("/js/");
+ registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
+ registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
+ }
+
+ @Override
+ public void addViewControllers(ViewControllerRegistry registry) {
+ registry.addViewController("products").setViewName("products");
+ registry.addViewController("categories").setViewName("categories");
+ registry.addViewController("events").setViewName("events");
+ registry.addViewController("attributes").setViewName("attributes");
+ }
+
+ @Override
+ public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+ converters.add(jsonMessageConverter());
+ }
+
+
+ /*
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ registry.addInterceptor(localAuthorizationInterceptor())
+ .addPathPatterns("/**")
+ .excludePathPatterns("/swagger**")
+ .excludePathPatterns("/v2/api-docs**")
+ .excludePathPatterns("/configuration/security**")
+ .excludePathPatterns("/configuration/ui**")
+ .excludePathPatterns("/webjars/**");
+ }
+ */
+
+ @Bean
+ public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator() {
+ DefaultAdvisorAutoProxyCreator proxyCreator = new DefaultAdvisorAutoProxyCreator();
+ proxyCreator.setProxyTargetClass(true);
+ return proxyCreator;
+ }
+
+ /*
+ @Bean
+ public ViewResolver internalResourceViewResolver() {
+ InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
+ viewResolver.setViewClass(JstlView.class);
+ viewResolver.setPrefix("/WEB-INF/views/");
+ viewResolver.setSuffix(".jsp");
+ viewResolver.setOrder(10);
+ return viewResolver;
+ } */
+
+ @Bean
+ public MessageSource messageSource() {
+ ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
+ messageSource.setBasename("messages");
+ return messageSource;
+ }
+
+ @Bean
+ public LocalAuthorizationInterceptor localAuthorizationInterceptor() {
+
+ return new LocalAuthorizationInterceptor(configurationService.getCatalogServiceAuthToken());
+ }
+
+ public ObjectMapper objectMapper() {
+ LOGGER.debug("Creating custom ObjectMapper");
+ ObjectMapper mapper = JsonObjectMapperFactory.createMapper();
+ SimpleFilterProvider filterProvider = new SimpleFilterProvider();
+ filterProvider.addFilter("catalogEvent", new CatalogEventFilter());
+ mapper.setFilterProvider(filterProvider);
+ return mapper;
+ }
+
+ public MappingJackson2HttpMessageConverter jsonMessageConverter() {
+ return new MappingJackson2HttpMessageConverter(objectMapper());
+ }
+
+ @Value("${gitUserName")
+ private String gitUserName;
+
+ @Value("${gitPassword:#{null}}")
+ private String gitPassword;
+
+ @Value("${gitPassPhrase:#{null}}")
+ private String gitPassPhrase;
+
+ @Value("${localRepoUrl:#{null}}")
+ private String localRepoUrl;
+
+ @Value("${privateKeyPath:#{null}}")
+ private String privateKeyPath;
+
+ @Value("${remoteRepoUrl}")
+ private String remoteRepoUrl;
+
+ @Value("${remoteRepoCatalogPath:#{null}}")
+ private String remoteRepoCatalogPath;
+
+ @Bean
+ public CatalogDao catalogDao() {
+ GitCatalogDao dataSource = new GitCatalogDao();
+ if (isNotBlank(gitUserName) && isNotBlank(gitPassword)) {
+ dataSource.setCredentialsProvider(new UsernamePasswordCredentialsProvider(gitUserName, gitPassword));
+ }
+ if (isNotBlank(remoteRepoUrl)) {
+ try {
+ URI uri = new URI(remoteRepoUrl);
+ if (uri.getScheme().equalsIgnoreCase("SSH")) {
+ TransportConfigCallback transportConfigCallback = new TransportConfigCallback() {
+ final SshSessionFactory sshSessionFactory = new JschConfigSessionFactory() {
+ @Override
+ protected JSch createDefaultJSch( FS fs ) throws JSchException {
+ JSch defaultJSch = super.createDefaultJSch( fs );
+ if (isNotBlank(privateKeyPath)) {
+ defaultJSch.addIdentity(privateKeyPath);
+ }
+ return defaultJSch;
+ }
+
+ @Override
+ protected void configure(OpenSshConfig.Host host, Session session) {
+ session.setConfig("StrictHostKeyChecking", "no");
+ if (isNotBlank(gitPassPhrase)) {
+ session.setUserInfo(new UserInfo() {
+ @Override
+ public String getPassphrase() {
+ return gitPassPhrase;
+ }
+
+ @Override
+ public String getPassword() {return null;}
+
+ @Override
+ public boolean promptPassword(String message) {return false;}
+
+ @Override
+ public boolean promptPassphrase(String message) {return true;}
+
+ @Override
+ public boolean promptYesNo(String message) {return false;}
+
+ @Override
+ public void showMessage(String message) {}
+ });
+
+ }
+ }
+ };
+ @Override
+ public void configure(Transport transport) {
+ SshTransport sshTransport = ( SshTransport )transport;
+ sshTransport.setSshSessionFactory( sshSessionFactory );
+
+ }
+ };
+ dataSource.setTransportConfigCallback(transportConfigCallback);
+ }
+ } catch (URISyntaxException ex) {
+ LOGGER.error("Invalid URI {}:", remoteRepoUrl, ex);
+ }
+ } else {
+ LOGGER.error("No remote repo URL provided.");
+ }
+
+ if (isNotBlank(localRepoUrl)) {
+ dataSource.setLocalRepoPath(localRepoUrl);
+ } else {
+ String localRepoPath = System.getProperty("java.io.tmpdir") + "/audit/catalog";
+ File file = new File(localRepoPath);
+ File parent = file.getParentFile();
+ parent.mkdirs();
+ dataSource.setLocalRepoPath(localRepoPath);
+ }
+
+ dataSource.setRemoteRepoUri(remoteRepoUrl);
+ if (isNotBlank(remoteRepoCatalogPath)) {
+ dataSource.setCatalogPath(remoteRepoCatalogPath);
+ }
+ return dataSource;
+ }
+
+ public SpringResourceTemplateResolver templateResolver(){
+ // SpringResourceTemplateResolver automatically integrates with Spring's own
+ // resource resolution infrastructure, which is highly recommended.
+ SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
+ templateResolver.setApplicationContext(this.applicationContext);
+ templateResolver.setPrefix("/WEB-INF/templates/");
+ templateResolver.setSuffix(".html");
+ // HTML is the default value, added here for the sake of clarity.
+ templateResolver.setTemplateMode(TemplateMode.HTML);
+ // Template cache is true by default. Set to false if you want
+ // templates to be automatically updated when modified.
+ templateResolver.setCacheable(true);
+ return templateResolver;
+ }
+
+ public SpringTemplateEngine templateEngine(){
+ // SpringTemplateEngine automatically applies SpringStandardDialect and
+ // enables Spring's own MessageSource message resolution mechanisms.
+ SpringTemplateEngine templateEngine = new SpringTemplateEngine();
+ templateEngine.setTemplateResolver(templateResolver());
+ // Enabling the SpringEL compiler with Spring 4.2.4 or newer can
+ // speed up execution in most scenarios, but might be incompatible
+ // with specific cases when expressions in one template are reused
+ // across different data types, so this flag is "false" by default
+ // for safer backwards compatibility.
+ templateEngine.setEnableSpringELCompiler(true);
+ return templateEngine;
+ }
+
+ @Bean
+ public ViewResolver thymeleafViewResolver(){
+ ThymeleafViewResolver viewResolver = new ThymeleafViewResolver();
+ viewResolver.setTemplateEngine(templateEngine());
+ // NOTE 'order' and 'viewNames' are optional
+ viewResolver.setOrder(1);
+ viewResolver.setViewNames(new String[] {"products", "categories", "events", "attributes"});
+ return viewResolver;
+ }
+
+ @Bean
+ @Scope("prototype")
+ public ThymeleafView mainView() {
+ ThymeleafView view = new ThymeleafView("index"); // templateName = 'main'
+ view.setStaticVariables(
+ Collections.singletonMap("footer", "The Apache Software Foundation"));
+ return view;
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/AttributeController.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/AttributeController.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/AttributeController.java
new file mode 100644
index 0000000..ec12244
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/AttributeController.java
@@ -0,0 +1,199 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.catalog.controller;
+
+import javax.annotation.PostConstruct;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.catalog.api.Attribute;
+import org.apache.logging.log4j.catalog.api.Constraint;
+import org.apache.logging.log4j.catalog.api.ListResponse;
+import org.apache.logging.log4j.catalog.api.plugins.ConstraintPlugins;
+import org.apache.logging.log4j.catalog.jpa.converter.AttributeConverter;
+import org.apache.logging.log4j.catalog.jpa.converter.AttributeModelConverter;
+import org.apache.logging.log4j.catalog.jpa.model.AttributeModel;
+import org.apache.logging.log4j.catalog.jpa.model.ConstraintModel;
+import org.apache.logging.log4j.catalog.jpa.service.AttributeService;
+import org.modelmapper.ModelMapper;
+import org.modelmapper.TypeToken;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * Catalog Product controller
+ */
+
+@RequestMapping(value = "/api/attributes")
+@RestController
+public class AttributeController {
+ private static final Logger LOGGER = LogManager.getLogger();
+ private static ConstraintPlugins constraintPlugins = ConstraintPlugins.getInstance();
+
+ private ModelMapper modelMapper = new ModelMapper();
+
+ @Autowired
+ private AttributeService attributeService;
+
+ @Autowired
+ private AttributeModelConverter attributeModelConverter;
+
+ @Autowired
+ private AttributeConverter attributeConverter;
+
+ @PostConstruct
+ public void init() {
+ modelMapper.addConverter(attributeModelConverter);
+ }
+
+ @PostMapping(value = "/list")
+ public ResponseEntity<Map<String, Object>> attributeList(@RequestParam(value="jtStartIndex", required=false) Integer startIndex,
+ @RequestParam(value="jtPageSize", required=false) Integer pageSize,
+ @RequestParam(value="jtSorting", required=false) String sorting) {
+ Type listType = new TypeToken<List<Attribute>>() {}.getType();
+ Map<String, Object> response = new HashMap<>();
+ try {
+ List<Attribute> attributes = null;
+ if (startIndex == null || pageSize == null) {
+ attributes = modelMapper.map(attributeService.getAttributes(), listType);
+ } else {
+ int startPage = 0;
+ if (startIndex > 0) {
+ startPage = startIndex / pageSize;
+ }
+ String sortColumn = "name";
+ String sortDirection = "ASC";
+ if (sorting != null) {
+ String[] sortInfo = sorting.split(" ");
+ sortColumn = sortInfo[0];
+ if (sortInfo.length > 0) {
+ sortDirection = sortInfo[1];
+ }
+ }
+ attributes = modelMapper.map(attributeService.getAttributes(startPage, pageSize, sortColumn, sortDirection), listType);
+ }
+ if (attributes == null) {
+ attributes = new ArrayList<>();
+ }
+ response.put("Result", "OK");
+ response.put("Records", attributes);
+ } catch (Exception ex) {
+ response.put("Result", "FAILURE");
+ }
+ return new ResponseEntity<>(response, HttpStatus.OK);
+ }
+
+ @PostMapping(value = "/create")
+ public ResponseEntity<Map<String, Object>> createAttribute(@RequestBody Attribute attribute) {
+ Map<String, Object> response = new HashMap<>();
+ try {
+ AttributeModel model = attributeConverter.convert(attribute);
+ model = attributeService.saveAttribute(model);
+ Attribute result = attributeModelConverter.convert(model);
+ response.put("Result", "OK");
+ response.put("Records", result);
+ } catch (Exception ex) {
+ response.put("Result", "FAILURE");
+ }
+ return new ResponseEntity<>(response, HttpStatus.OK);
+ }
+
+ @PostMapping(value = "/update")
+ public ResponseEntity<Map<String, Object>> updateAttribute(@RequestBody Attribute attribute) {
+ Map<String, Object> response = new HashMap<>();
+ try {
+ AttributeModel model = attributeConverter.convert(attribute);
+ model = attributeService.saveAttribute(model);
+ Attribute result = attributeModelConverter.convert(model);
+ response.put("Result", "OK");
+ response.put("Records", result);
+ } catch (Exception ex) {
+ response.put("Result", "FAILURE");
+ }
+ return new ResponseEntity<>(response, HttpStatus.OK);
+ }
+
+ @PostMapping(value = "/delete")
+ public ResponseEntity<Map<String, Object>> deleteAttribute(@RequestBody Attribute attribute) {
+ Map<String, Object> response = new HashMap<>();
+ try {
+ attributeService.deleteAttribute(attribute.getId());
+ response.put("Result", "OK");
+ } catch (Exception ex) {
+ response.put("Result", "FAILURE");
+ }
+ return new ResponseEntity<>(response, HttpStatus.OK);
+ }
+
+ @GetMapping
+ public ResponseEntity<ListResponse<String>> getAttributeNames() {
+ List<AttributeModel> attributes = attributeService.getAttributes();
+ List<String> attributeNames;
+ if (attributes != null) {
+ attributeNames = new ArrayList<>(attributes.size());
+ for (AttributeModel model : attributes) {
+ attributeNames.add(model.getName());
+ }
+ } else {
+ attributeNames = new ArrayList<>();
+ }
+ ListResponse<String> response = new ListResponse<>();
+ response.setResult("OK");
+ response.setData(attributeNames);
+ return new ResponseEntity<>(response, HttpStatus.OK);
+ }
+
+ @PostMapping(value = "/constraints")
+ public ResponseEntity<Map<String, Object>> constraintList(@RequestParam("attributeId") Long attributeId) {
+ Type listType = new TypeToken<List<Constraint>>() {}.getType();
+ Map<String, Object> response = new HashMap<>();
+ try {
+ Optional<AttributeModel> optional = attributeService.getAttribute(attributeId);
+ List<Constraint> constraints = new ArrayList<>();
+ if (optional.isPresent()) {
+ Set<ConstraintModel> constraintModels = optional.get().getConstraints();
+ if (constraintModels != null) {
+ for (ConstraintModel constraintModel : constraintModels) {
+ Constraint constraint = new Constraint();
+ constraint.setConstraintType(constraintPlugins.findByName(constraintModel.getConstraintType()));
+ constraint.setValue(constraintModel.getValue());
+ constraints.add(constraint);
+ }
+ }
+ response.put("Result", "OK");
+ response.put("Records", constraints);
+ }
+ } catch (Exception ex) {
+ response.put("Result", "FAILURE");
+ }
+ return new ResponseEntity<>(response, HttpStatus.OK);
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java
new file mode 100644
index 0000000..3c97177
--- /dev/null
+++ b/log4j-catalog/log4j-catalog-editor/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.catalog.controller;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.catalog.api.dao.CatalogDao;
+import org.apache.logging.log4j.catalog.api.Attribute;
+import org.apache.logging.log4j.catalog.api.Category;
+import org.apache.logging.log4j.catalog.api.Event;
+import org.apache.logging.log4j.catalog.api.Product;
+import org.apache.logging.log4j.catalog.jpa.converter.AttributeModelConverter;
+import org.apache.logging.log4j.catalog.jpa.converter.CategoryModelConverter;
+import org.apache.logging.log4j.catalog.jpa.converter.EventModelConverter;
+import org.apache.logging.log4j.catalog.jpa.converter.ProductModelConverter;
+import org.apache.logging.log4j.catalog.jpa.model.AttributeModel;
+import org.apache.logging.log4j.catalog.jpa.model.CategoryModel;
+import org.apache.logging.log4j.catalog.jpa.model.EventModel;
+import org.apache.logging.log4j.catalog.jpa.model.ProductModel;
+import org.apache.logging.log4j.catalog.jpa.service.AttributeService;
+import org.apache.logging.log4j.catalog.jpa.service.CategoryService;
+import org.apache.logging.log4j.catalog.jpa.service.EventService;
+import org.apache.logging.log4j.catalog.jpa.service.ProductService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import org.apache.logging.log4j.catalog.api.CatalogData;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * The Class CatalogController.
+ */
+@RestController
+public class CatalogController {
+
+ /** The logger. */
+ private static Logger logger = LogManager.getLogger(CatalogController.class);
+
+ @Autowired
+ private EventService eventService;
+
+ @Autowired
+ private AttributeService attributeService;
+
+ @Autowired
+ private ProductService productService;
+
+ @Autowired
+ private CategoryService categoryService;
+
+ @Autowired
+ private AttributeModelConverter attributeModelConverter;
+
+ @Autowired
+ private EventModelConverter eventModelConverter;
+
+ @Autowired
+ private ProductModelConverter productModelConverter;
+
+ @Autowired
+ private CategoryModelConverter categoryModelConverter;
+
+ @Autowired
+ private CatalogDao catalogDao;
+
+
+ @PostMapping(value = "catalog")
+ public ResponseEntity<?> saveCatalog() {
+ CatalogData catalogData = new CatalogData();
+ List<Attribute> attributes = new ArrayList<>();
+ for (AttributeModel attributeModel : attributeService.getAttributes()) {
+ attributes.add(attributeModelConverter.convert(attributeModel));
+ }
+ catalogData.setAttributes(attributes);
+ List<Event> events = new ArrayList<>();
+ for (EventModel eventModel : eventService.getEvents()) {
+ events.add(eventModelConverter.convert(eventModel));
+ }
+ catalogData.setEvents(events);
+ List<Category> categories = new ArrayList<>();
+ for (CategoryModel categoryModel : categoryService.getCategories()) {
+ categories.add(categoryModelConverter.convert(categoryModel));
+ }
+ catalogData.setCategories(categories);
+ List<Product> products = new ArrayList<>();
+ for (ProductModel productModel : productService.getProducts()) {
+ products.add(productModelConverter.convert(productModel));
+ }
+ catalogData.setProducts(products);
+ catalogDao.write(catalogData);
+ return new ResponseEntity<>(HttpStatus.NO_CONTENT);
+ }
+/*
+ @RequestMapping(value = "/catalog", method = RequestMethod.GET)
+ public ResponseEntity<Object> handleGetCatalog(
+ @RequestParam(required = false) boolean attributeDetails,
+ HttpServletRequest servletRequest) {
+ CatalogData catalogData = null;
+ try {
+ //catalogData = globalLoggingCatalog.getCatalog();
+ if (attributeDetails) {
+ getAttributeDetailsForEvents(catalogData);
+ }
+ return new ResponseEntity<Object>(catalogData, HttpStatus.OK);
+
+ } catch (Exception e) {
+ logger.error("Error While Retrieving Data", e);
+
+ Status status = new Status();
+ ErrorInfo errorInfo = new ErrorInfo();
+ errorInfo.setErrorCode("00000");
+ errorInfo.setErrorMessage(e.getMessage());
+ status.getErrorInfo().add(errorInfo);
+ status.setStatusMessage(e.getMessage());
+ return new ResponseEntity<Object>(status,
+ HttpStatus.INTERNAL_SERVER_ERROR);
+ }
+
+
+ } */
+
+}