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:30 UTC
[24/49] logging-log4j-audit git commit: Rename war project to editor
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
deleted file mode 100644
index 181024d..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/config/WebMvcAppContext.java
+++ /dev/null
@@ -1,331 +0,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.
- */
-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-war/src/main/java/org/apache/logging/log4j/catalog/controller/AttributeController.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/AttributeController.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/AttributeController.java
deleted file mode 100644
index ec12244..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/AttributeController.java
+++ /dev/null
@@ -1,199 +0,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.
- */
-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-war/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java
deleted file mode 100644
index 3c97177..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/CatalogController.java
+++ /dev/null
@@ -1,148 +0,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.
- */
-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);
- }
-
-
- } */
-
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/CategoryController.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/CategoryController.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/CategoryController.java
deleted file mode 100644
index 578b70c..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/CategoryController.java
+++ /dev/null
@@ -1,146 +0,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.
- */
-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 org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.catalog.api.Category;
-import org.apache.logging.log4j.catalog.jpa.model.CategoryModel;
-import org.apache.logging.log4j.catalog.jpa.service.CategoryService;
-import org.apache.logging.log4j.catalog.jpa.converter.CategoryConverter;
-import org.apache.logging.log4j.catalog.jpa.converter.CategoryModelConverter;
-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.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 Category controller
- */
-
-@RequestMapping(value = "/api/categories")
-@RestController
-public class CategoryController {
- private static final Logger LOGGER = LogManager.getLogger();
-
- private ModelMapper modelMapper = new ModelMapper();
-
- @Autowired
- private CategoryService categoryService;
-
-
- @Autowired
- private CategoryModelConverter categoryModelConverter;
-
- @Autowired
- private CategoryConverter categoryConverter;
-
- @PostConstruct
- public void init() {
- modelMapper.addConverter(categoryModelConverter);
- }
-
- @PostMapping(value = "/list")
- public ResponseEntity<Map<String, Object>> categoryList(@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<Category>>() {}.getType();
- Map<String, Object> response = new HashMap<>();
- try {
- List<Category> categories = null;
- if (startIndex == null || pageSize == null) {
- categories = modelMapper.map(categoryService.getCategories(), 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];
- }
- }
- categories = modelMapper.map(categoryService.getCategories(startPage, pageSize, sortColumn, sortDirection), listType);
- }
- if (categories == null) {
- categories = new ArrayList<>();
- }
- response.put("Result", "OK");
- response.put("Records", categories);
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/create")
- public ResponseEntity<Map<String, Object>> createCategory(@RequestBody Category category) {
- Map<String, Object> response = new HashMap<>();
- try {
- CategoryModel model = categoryConverter.convert(category);
- model = categoryService.saveCategory(model);
- response.put("Result", "OK");
- response.put("Records", categoryModelConverter.convert(model));
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/update")
- public ResponseEntity<Map<String, Object>> updateCategory(@RequestBody Category category) {
- Map<String, Object> response = new HashMap<>();
- try {
- CategoryModel model = categoryConverter.convert(category);
- model = categoryService.saveCategory(model);
- response.put("Result", "OK");
- response.put("Records", categoryModelConverter.convert(model));
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/delete")
- public ResponseEntity<Map<String, Object>> deleteCategory(@RequestBody Category category) {
- Map<String, Object> response = new HashMap<>();
- try {
- categoryService.deleteCategory(category.getId());
- response.put("Result", "OK");
- } 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-war/src/main/java/org/apache/logging/log4j/catalog/controller/ConstraintController.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/ConstraintController.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/ConstraintController.java
deleted file mode 100644
index ef8f290..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/ConstraintController.java
+++ /dev/null
@@ -1,102 +0,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.
- */
-package org.apache.logging.log4j.catalog.controller;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-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.jpa.model.ConstraintModel;
-import org.apache.logging.log4j.catalog.jpa.service.ConstraintService;
-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.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-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;
-
-/**
- * Constraint controller
- */
-
-@RequestMapping(value = "/api/constraints")
-@RestController
-public class ConstraintController {
- private static final Logger LOGGER = LogManager.getLogger();
-
- private ModelMapper modelMapper = new ModelMapper();
-
- @Autowired
- private ConstraintService constraintService;
-
- @PostMapping(value = "/list")
- public ResponseEntity<Map<String, Object>> attributeList(@RequestParam("attributeId") Long attributeId) {
- Type listType = new TypeToken<List<Attribute>>() {}.getType();
- Map<String, Object> response = new HashMap<>();
- try {
- List<Attribute> attributes = modelMapper.map(constraintService.getConstraints(), 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);
- }
-
- @GetMapping(value = "/types")
- public ResponseEntity<Set<String>> getConstraintTypes() {
- return new ResponseEntity<>(constraintService.getConstraintTypes(), HttpStatus.OK);
- }
-
- @PostMapping(value = "/constraint")
- public ResponseEntity<Long> addConstraint(@RequestBody Constraint constraint) {
- ConstraintModel model = modelMapper.map(constraint, ConstraintModel.class);
- model = constraintService.saveConstraint(model);
- return new ResponseEntity<>(model.getId(), HttpStatus.CREATED);
- }
-
- @PutMapping(value = "/constraint/{id}")
- public ResponseEntity<Long> updateConstraint(@RequestParam Long id, @RequestBody Constraint constraint) {
- ConstraintModel model = modelMapper.map(constraint, ConstraintModel.class);
- model.setId(id);
- model = constraintService.saveConstraint(model);
- return new ResponseEntity<>(model.getId(), HttpStatus.OK);
- }
-
- @DeleteMapping(value = "/constraint/{id}")
- public ResponseEntity<?> deleteConstraint(@RequestParam Long id) {
- constraintService.deleteConstraint(id);
- return new ResponseEntity<>(HttpStatus.NO_CONTENT);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/EventController.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/EventController.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/EventController.java
deleted file mode 100644
index 0dd8295..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/EventController.java
+++ /dev/null
@@ -1,176 +0,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.
- */
-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 org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.catalog.api.Event;
-import org.apache.logging.log4j.catalog.jpa.model.EventModel;
-import org.apache.logging.log4j.catalog.jpa.service.EventService;
-import org.apache.logging.log4j.catalog.jpa.converter.EventConverter;
-import org.apache.logging.log4j.catalog.jpa.converter.EventModelConverter;
-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.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/events")
-@RestController
-public class EventController {
- private static final Logger LOGGER = LogManager.getLogger();
-
- private ModelMapper modelMapper = new ModelMapper();
-
- @Autowired
- private EventService eventService;
-
- @Autowired
- private EventModelConverter eventModelConverter;
-
- @Autowired
- private EventConverter eventConverter;
-
- @PostConstruct
- public void init() {
- modelMapper.addConverter(eventModelConverter);
- }
-
- @PostMapping(value = "/list")
- public ResponseEntity<Map<String, Object>> eventList(@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<Event>>() {}.getType();
- Map<String, Object> response = new HashMap<>();
- try {
- List<Event> events = null;
- if (startIndex == null || pageSize == null) {
- events = modelMapper.map(eventService.getEvents(), 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];
- }
- }
- events = modelMapper.map(eventService.getEvents(startPage, pageSize, sortColumn, sortDirection), listType);
- }
- if (events == null) {
- events = new ArrayList<>();
- }
- response.put("Result", "OK");
- response.put("Records", events);
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- response.put("Message", ex.getMessage());
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/create")
- public ResponseEntity<Map<String, Object>> createEvent(@RequestBody Event event) {
- Map<String, Object> response = new HashMap<>();
- try {
- EventModel model = eventConverter.convert(event);
- event = eventModelConverter.convert(eventService.saveEvent(model));
- response.put("Result", "OK");
- response.put("Records", event);
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- response.put("Message", ex.getMessage());
- LOGGER.warn("Unable to create event named {}", event.getName(), ex);
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/update")
- public ResponseEntity<Map<String, Object>> updateEvent(@RequestBody Event event) {
- Map<String, Object> response = new HashMap<>();
- try {
- EventModel model = eventConverter.convert(event);
- event = eventModelConverter.convert(eventService.saveEvent(model));
- response.put("Result", "OK");
- response.put("Records", event);
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- response.put("Message", ex.getMessage());
- LOGGER.warn("Unable to update event named {}", event.getName(), ex);
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/delete")
- public ResponseEntity<Map<String, Object>> deleteEvent(@RequestBody Long eventId) {
- Map<String, Object> response = new HashMap<>();
- try {
- eventService.deleteEvent(eventId);
- response.put("Result", "OK");
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- response.put("Message", ex.getMessage());
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/attributes/list")
- public ResponseEntity<Map<String, Object>> attributeList(@RequestParam("eventId") Long eventId) {
- Map<String, Object> response = new HashMap<>();
- try {
- Optional<EventModel> optional = eventService.getEvent(eventId);
- if (optional.isPresent()) {
- Event event = eventModelConverter.convert(optional.get());
- response.put("Result", "OK");
- if (event != null && event.getAttributes() != null) {
- response.put("Records", event.getAttributes());
- } else {
- response.put("Records", new ArrayList<>());
- }
- } else {
- response.put("Result", "OK");
- response.put("Records", new ArrayList<>());
-
- }
- } 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-war/src/main/java/org/apache/logging/log4j/catalog/controller/ProductController.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/ProductController.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/ProductController.java
deleted file mode 100644
index d566519..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/ProductController.java
+++ /dev/null
@@ -1,146 +0,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.
- */
-package org.apache.logging.log4j.catalog.controller;
-
-import javax.annotation.PostConstruct;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.apache.logging.log4j.catalog.api.Product;
-import org.apache.logging.log4j.catalog.jpa.model.ProductModel;
-import org.apache.logging.log4j.catalog.jpa.service.ProductService;
-import org.apache.logging.log4j.catalog.jpa.converter.ProductConverter;
-import org.apache.logging.log4j.catalog.jpa.converter.ProductModelConverter;
-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.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;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Catalog Product controller
- */
-
-@RequestMapping(value = "/api/products")
-@RestController
-public class ProductController {
- private static final Logger LOGGER = LogManager.getLogger();
-
- private ModelMapper modelMapper = new ModelMapper();
-
- @Autowired
- private ProductService productService;
-
- @Autowired
- private ProductModelConverter productModelConverter;
-
- @Autowired
- private ProductConverter productConverter;
-
- @PostConstruct
- public void init() {
- modelMapper.addConverter(productModelConverter);
- }
-
- @PostMapping(value = "/list")
- public ResponseEntity<Map<String, Object>> productList(@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<Product>>() {}.getType();
- Map<String, Object> response = new HashMap<>();
- try {
- List<Product> products = null;
- if (startIndex == null || pageSize == null) {
- products = modelMapper.map(productService.getProducts(), 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];
- }
- }
- products = modelMapper.map(productService.getProducts(startPage, pageSize, sortColumn, sortDirection), listType);
- }
- if (products == null) {
- products = new ArrayList<>();
- }
- response.put("Result", "OK");
- response.put("Records", products);
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/create")
- public ResponseEntity<Map<String, Object>> createProduct(@RequestBody Product product) {
- Map<String, Object> response = new HashMap<>();
- try {
- ProductModel model = productConverter.convert(product);
- model = productService.saveProduct(model);
- response.put("Result", "OK");
- response.put("Records", productModelConverter.convert(model));
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/update")
- public ResponseEntity<Map<String, Object>> updateProduct(@RequestBody Product product) {
- Map<String, Object> response = new HashMap<>();
- try {
- ProductModel model = productConverter.convert(product);
- model = productService.saveProduct(model);
- response.put("Result", "OK");
- response.put("Records", productModelConverter.convert(model));
- } catch (Exception ex) {
- response.put("Result", "FAILURE");
- }
- return new ResponseEntity<>(response, HttpStatus.OK);
- }
-
- @PostMapping(value = "/delete")
- public ResponseEntity<Map<String, Object>> deleteProduct(@RequestBody Product product) {
- Map<String, Object> response = new HashMap<>();
- try {
- productService.deleteProduct(product.getId());
- response.put("Result", "OK");
- } 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-war/src/main/java/org/apache/logging/log4j/catalog/controller/RestResponseEntityExceptionHandler.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/RestResponseEntityExceptionHandler.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/RestResponseEntityExceptionHandler.java
deleted file mode 100644
index b420b16..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/controller/RestResponseEntityExceptionHandler.java
+++ /dev/null
@@ -1,55 +0,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.
- */
-package org.apache.logging.log4j.catalog.controller;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.data.rest.webmvc.support.ExceptionMessage;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
-
-@ControllerAdvice
-public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler {
- private static final Logger LOGGER = LogManager.getLogger();
-
- @ExceptionHandler({ Exception.class })
- @ResponseBody
- public ResponseEntity<?> handleAnyException(Exception e) {
- return errorResponse(e, HttpStatus.INTERNAL_SERVER_ERROR);
- }
-
- protected ResponseEntity<ExceptionMessage> errorResponse(Throwable throwable,
- HttpStatus status) {
- if (null != throwable) {
- LOGGER.error("error caught: " + throwable.getMessage(), throwable);
- return response(new ExceptionMessage(throwable), status);
- } else {
- LOGGER.error("unknown error caught in RESTController, {}", status);
- return response(null, status);
- }
- }
-
- protected <T> ResponseEntity<T> response(T body, HttpStatus status) {
- LOGGER.debug("Responding with a status of {}", status);
- return new ResponseEntity<>(body, new HttpHeaders(), status);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/interceptor/RequestContextHeaderInterceptor.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/interceptor/RequestContextHeaderInterceptor.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/interceptor/RequestContextHeaderInterceptor.java
deleted file mode 100644
index 520fb1a..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/interceptor/RequestContextHeaderInterceptor.java
+++ /dev/null
@@ -1,41 +0,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.
- */
-package org.apache.logging.log4j.catalog.interceptor;
-
-import java.io.IOException;
-
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
-
-/**
- * Creates a List of Headers containing the keys and values in the RequestContext that have a mapping indicating
- * they should be propogated to the service being called.
- *
- * This class is designed to be used by Spring as part of the REST Template configuration.
- *
- */
-public class RequestContextHeaderInterceptor implements ClientHttpRequestInterceptor {
-
- @Override
- public ClientHttpResponse intercept(HttpRequest httpRequest, byte[] body,
- ClientHttpRequestExecution clientHttpRequestExecution) throws IOException {
- return clientHttpRequestExecution.execute(httpRequest, body);
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/security/LocalAuthorizationInterceptor.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/security/LocalAuthorizationInterceptor.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/security/LocalAuthorizationInterceptor.java
deleted file mode 100644
index d3521d5..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/security/LocalAuthorizationInterceptor.java
+++ /dev/null
@@ -1,54 +0,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.
- */
-package org.apache.logging.log4j.catalog.security;
-
-
-import org.apache.http.HttpStatus;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-public class LocalAuthorizationInterceptor extends HandlerInterceptorAdapter {
- private static final Logger LOGGER = LogManager.getLogger();
- private final String token;
-
- public LocalAuthorizationInterceptor(String token) {
- this.token = token;
- }
-
- @Override
- public boolean preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler) throws Exception {
- LOGGER.traceEntry();
- try {
- if (request.getServletPath().startsWith("/swagger")) {
- return true;
- }
-
- String authHeader = request.getHeader("Authorization");
- if (authHeader == null || !authHeader.equals(token)) {
- LOGGER.error("Authorization value of " + authHeader + " does not match expected value of " + token);
- response.sendError(HttpStatus.SC_UNAUTHORIZED);
- return false;
- }
-
- return true;
- } finally {
- LOGGER.traceExit();
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/service/CatalogInitializer.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/service/CatalogInitializer.java b/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/service/CatalogInitializer.java
deleted file mode 100644
index 5e5eb35..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/java/org/apache/logging/log4j/catalog/service/CatalogInitializer.java
+++ /dev/null
@@ -1,114 +0,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.
- */
-package org.apache.logging.log4j.catalog.service;
-
-import javax.annotation.PostConstruct;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-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.CatalogData;
-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.AttributeConverter;
-import org.apache.logging.log4j.catalog.jpa.converter.CategoryConverter;
-import org.apache.logging.log4j.catalog.jpa.converter.EventConverter;
-import org.apache.logging.log4j.catalog.jpa.converter.ProductConverter;
-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.stereotype.Component;
-
-/**
- *
- */
-@Component
-public class CatalogInitializer {
- private static final Logger logger = LogManager.getLogger(CatalogInitializer.class);
-
- @Autowired
- AttributeService attributeService;
-
- @Autowired
- EventService eventService;
-
- @Autowired
- CategoryService categoryService;
-
- @Autowired
- ProductService productService;
-
- @Autowired
- CatalogDao catalogDao;
-
- @Autowired
- AttributeConverter attributeConverter;
-
- @Autowired
- EventConverter eventConverter;
-
- @Autowired
- CategoryConverter categoryConverter;
-
- @Autowired
- ProductConverter productConverter;
-
- @PostConstruct
- private void initialize() {
- logger.debug("Performing initialization");
- CatalogData catalogData = catalogDao.read();
-
- logger.debug("Loading attributes");
- List<AttributeModel> attributeModels = new ArrayList<>();
- for (Attribute attribute : catalogData.getAttributes()) {
- AttributeModel model = attributeConverter.convert(attribute);
- attributeService.saveAttribute(model);
- attributeModels.add(model);
- }
- Map<String, EventModel> eventMap = new HashMap<>();
- logger.debug("Loading events");
- for (Event event : catalogData.getEvents()) {
- logger.debug("Processing Event: {}", event);
- EventModel model = eventConverter.convert(event);
- logger.debug("Created EventModel: {} ", model);
- eventMap.put(event.getName(), model);
- eventService.saveEvent(model);
- }
- logger.debug("Loading categories");
- for (Category category : catalogData.getCategories()) {
- CategoryModel model = categoryConverter.convert(category);
- categoryService.saveCategory(model);
- }
- logger.debug("loading products");
- for (Product product : catalogData.getProducts()) {
- ProductModel model = productConverter.convert(product);
- productService.saveProduct(model);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml b/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml
deleted file mode 100644
index dbc8075..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ 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.
- -->
-<Configuration status="ERROR">
- <properties>
- <property name="LOG_DIR">${sys:catalina.home:-.}/logs/AuditCatalog</property>
- </properties>
- <Appenders>
- <Console name="Console" target="SYSTEM_OUT">
- <PatternLayout pattern="%d{ABSOLUTE} %-5level # %class.%method %m%n" />
- </Console>
-
- <RollingFile name="log4j" fileName="${LOG_DIR}/log4j.txt" filePattern="${LOG_DIR}/archive/log4j.txt.%d{yyyyMMdd_HH}-%i">
- <PatternLayout pattern="%d [%t] %-5p %C{1.}.%M:%L - %m%n"/>
- <Policies>
- <SizeBasedTriggeringPolicy size="30 MB"/>
- </Policies>
- <DefaultRolloverStrategy min="1" max="20"/>
- </RollingFile>
- </Appenders>
- <Loggers>
- <Logger name="org.apache.logging.log4j.catalog" level="WARN" additivity="false">
- <AppenderRef ref="log4j"/>
- </Logger>
- <Root level="DEBUG">
- <AppenderRef ref="log4j" />
- </Root>
- </Loggers>
-</Configuration>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/resources/sql/hsql/schema.sql
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/resources/sql/hsql/schema.sql b/log4j-catalog/log4j-catalog-war/src/main/resources/sql/hsql/schema.sql
deleted file mode 100644
index 772d65b..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/resources/sql/hsql/schema.sql
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-CREATE TABLE EVENT_ATTRIBUTE
-(
- ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
- CATALOG_ID VARCHAR(64) NOT NULL,
- NAME VARCHAR(64) NOT NULL,
- DISPLAY_NAME VARCHAR(64) NOT NULL,
- DESCRIPTION VARCHAR(1024),
- DATATYPE VARCHAR(64),
- INDEXED CHAR,
- SORTABLE CHAR,
- REQUIRED CHAR,
- REQUEST_CONTEXT CHAR
-);
-
-CREATE UNIQUE INDEX ATTRIBUTE_NAME ON EVENT_ATTRIBUTE(NAME);
-
-CREATE TABLE ATTRIBUTE_EXAMPLES
-(
- ATTRIBUTE_ID BIGINT NOT NULL,
- EXAMPLE VARCHAR(64),
- FOREIGN KEY (ATTRIBUTE_ID) REFERENCES EVENT_ATTRIBUTE(ID),
-);
-
-CREATE TABLE ATTRIBUTE_ALIASES
-(
- ATTRIBUTE_ID BIGINT NOT NULL,
- ALIAS VARCHAR(64),
- FOREIGN KEY (ATTRIBUTE_ID) REFERENCES EVENT_ATTRIBUTE(ID),
-);
-
-CREATE TABLE ATTRIBUTE_CONSTRAINT
-(
- ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
- ATTRIBUTE_ID BIGINT NOT NULL,
- CONSTRAINT_TYPE VARCHAR(32) NOT NULL,
- VALUE VARCHAR(256),
- FOREIGN KEY (ATTRIBUTE_ID) REFERENCES EVENT_ATTRIBUTE(ID),
-);
-
-CREATE TABLE CATALOG_EVENT
-(
- ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
- CATALOG_ID VARCHAR(64) NOT NULL,
- NAME VARCHAR(64) NOT NULL,
- DISPLAY_NAME VARCHAR(64) NOT NULL,
- DESCRIPTION VARCHAR(1024)
-);
-
-CREATE UNIQUE INDEX EVENT_NAME ON CATALOG_EVENT(NAME);
-
-CREATE TABLE EVENT_ALIASES
-(
- EVENT_ID BIGINT NOT NULL,
- ALIAS VARCHAR(64) NOT NULL,
- FOREIGN KEY (EVENT_ID) REFERENCES CATALOG_EVENT(ID),
-);
-
-CREATE TABLE EVENT_ATTRIBUTES
-(
- ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
- EVENT_ID BIGINT NOT NULL,
- ATTRIBUTE_ID BIGINT NOT NULL,
- IS_REQUIRED CHAR,
- FOREIGN KEY (EVENT_ID) REFERENCES CATALOG_EVENT(ID),
- FOREIGN KEY (ATTRIBUTE_ID) REFERENCES EVENT_ATTRIBUTE(ID)
-);
-
-CREATE TABLE CATALOG_CATEGORY
-(
- ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
- CATALOG_ID VARCHAR(64) NOT NULL,
- NAME VARCHAR(64) NOT NULL,
- DISPLAY_NAME VARCHAR(64) NOT NULL,
- DESCRIPTION VARCHAR(1024)
-
-);
-
-CREATE UNIQUE INDEX CATEGORY_NAME ON CATALOG_CATEGORY(NAME);
-
-CREATE TABLE CATEGORY_EVENTS
-(
- CATEGORY_ID BIGINT NOT NULL,
- EVENT_ID BIGINT NOT NULL,
- FOREIGN KEY (CATEGORY_ID) REFERENCES CATALOG_CATEGORY(ID),
- FOREIGN KEY (EVENT_ID) REFERENCES CATALOG_EVENT(ID)
-);
-
-CREATE TABLE CATALOG_PRODUCT
-(
- ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY KEY,
- CATALOG_ID VARCHAR(64) NOT NULL,
- NAME VARCHAR(64) NOT NULL,
- DISPLAY_NAME VARCHAR(64) NOT NULL,
- DESCRIPTION VARCHAR(1024)
-
-);
-
-CREATE UNIQUE INDEX PRODUCT_NAME ON CATALOG_PRODUCT(NAME);
-
-CREATE TABLE PRODUCT_EVENTS
-(
- PRODUCT_ID BIGINT NOT NULL,
- EVENT_ID BIGINT NOT NULL,
- FOREIGN KEY (PRODUCT_ID) REFERENCES CATALOG_PRODUCT(ID),
- FOREIGN KEY (EVENT_ID) REFERENCES CATALOG_EVENT(ID)
-);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html
deleted file mode 100644
index af6f007..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html
+++ /dev/null
@@ -1,44 +0,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.
- -->
-<html>
-<head>
- <title>Audit Catalog - Attributes</title>
-
- <!-- Include one of jTable styles. -->
- <link href="js/jtable.2.4.0/themes/metro/blue/jtable.min.css" rel="stylesheet" type="text/css" />
- <!-- Include app styles. -->
- <link href="css/app.css" rel="stylesheet" type="text/css" />
-
- <!-- Include jTable script file. -->
- <script src="js/jquery-3.2.1.min.js" type="text/javascript"></script>
- <script src="js/jquery-ui-1.12.1/jquery-ui.min.js" type="text/javascript"></script>
- <script src="js/jtable.2.4.0/jquery.jtable.js" type="text/javascript"></script>
- <!-- Include app script files. -->
- <script src="js/app.js" type="text/javascript"></script>
- <script src="js/attributes.js" type="text/javascript"></script>
-
-</head>
-<body>
-
- <div th:insert="~{template :: hdr}"></div>
-
- <div id="AttributesTableContainer" class="log4j-table-container"></div>
-
- <div th:insert="~{template :: ftr}"></div>
-
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html
deleted file mode 100644
index 7a6baff..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html
+++ /dev/null
@@ -1,43 +0,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.
- -->
-<html>
-<head>
- <title>Audit Catalog - categories</title>
-
- <!-- Include one of jTable styles. -->
- <link href="js/jtable.2.4.0/themes/metro/blue/jtable.min.css" rel="stylesheet" type="text/css" />
- <!-- Include app styles. -->
- <link href="css/app.css" rel="stylesheet" type="text/css" />
-
- <!-- Include jTable script file. -->
- <script src="js/jquery-3.2.1.min.js" type="text/javascript"></script>
- <script src="js/jquery-ui-1.12.1/jquery-ui.min.js" type="text/javascript"></script>
- <script src="js/jtable.2.4.0/jquery.jtable.js" type="text/javascript"></script>
- <!-- Include app script files. -->
- <script src="js/app.js" type="text/javascript"></script>
- <script src="js/categories.js" type="text/javascript"></script>
-
-</head>
-<body>
-
- <div th:insert="~{template :: hdr}"></div>
-
- <div id="CategoriesTableContainer" class="log4j-table-container"></div>
-
- <div th:insert="~{template :: ftr}"></div>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html
deleted file mode 100644
index c83bf71..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html
+++ /dev/null
@@ -1,44 +0,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.
- -->
-<html>
-<head>
- <title>Audit Catalog - Events</title>
-
- <!-- Include one of jTable styles. -->
- <link href="js/jtable.2.4.0/themes/metro/blue/jtable.min.css" rel="stylesheet" type="text/css" />
- <!-- Include app styles. -->
- <link href="css/app.css" rel="stylesheet" type="text/css" />
-
- <!-- Include jTable script file. -->
- <script src="js/jquery-3.2.1.min.js" type="text/javascript"></script>
- <script src="js/jquery-ui-1.12.1/jquery-ui.min.js" type="text/javascript"></script>
- <script src="js/jtable.2.4.0/jquery.jtable.js" type="text/javascript"></script>
- <!-- Include app script files. -->
- <script src="js/app.js" type="text/javascript"></script>
- <script src="js/events.js" type="text/javascript"></script>
-
-</head>
-<body>
-
- <div th:insert="~{template :: hdr}"></div>
-
- <div id="EventsTableContainer" class="log4j-table-container"></div>
-
- <div th:insert="~{template :: ftr}"></div>
-
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/b75cbcd1/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html
deleted file mode 100644
index e20cf2d..0000000
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html
+++ /dev/null
@@ -1,43 +0,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.
- -->
-<html>
-<head>
- <title>Audit Catalog - Products</title>
-
- <!-- Include one of jTable styles. -->
- <link href="js/jtable.2.4.0/themes/metro/blue/jtable.min.css" rel="stylesheet" type="text/css" />
- <!-- Include app styles. -->
- <link href="css/app.css" rel="stylesheet" type="text/css" />
-
- <!-- Include jTable script file. -->
- <script src="js/jquery-3.2.1.min.js" type="text/javascript"></script>
- <script src="js/jquery-ui-1.12.1/jquery-ui.min.js" type="text/javascript"></script>
- <script src="js/jtable.2.4.0/jquery.jtable.js" type="text/javascript"></script>
- <!-- Include app script files. -->
- <script src="js/app.js" type="text/javascript"></script>
- <script src="js/products.js" type="text/javascript"></script>
-
-</head>
-<body>
-
- <div th:insert="~{template :: hdr}"></div>
-
- <div id="ProductsTableContainer" class="log4j-table-container"></div>
-
- <div th:insert="~{template :: ftr}"></div>
-</body>
-</html>