automatic project update
This commit is contained in:
parent
40e38a8eed
commit
457d43111f
@ -4,7 +4,7 @@ services:
|
||||
- docker
|
||||
language: java
|
||||
node_js:
|
||||
- "4.5.0"
|
||||
- "6.9.1"
|
||||
jdk:
|
||||
- oraclejdk8
|
||||
sudo: false
|
||||
@ -14,7 +14,7 @@ cache:
|
||||
- node_modules
|
||||
- $HOME/.m2
|
||||
env:
|
||||
- NODE_VERSION=4.5.0
|
||||
- NODE_VERSION=6.9.1
|
||||
before_install:
|
||||
- nvm install $NODE_VERSION
|
||||
- npm install -g npm
|
||||
|
@ -24,7 +24,7 @@
|
||||
"en"
|
||||
],
|
||||
"serverPort": 8080,
|
||||
"jhipsterVersion": "3.11.0",
|
||||
"jhipsterVersion": "3.12.0",
|
||||
"enableSocialSignIn": false,
|
||||
"useSass": false,
|
||||
"jhiPrefix": "jhi",
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated on 2016-11-19 using generator-jhipster 3.11.0
|
||||
// Generated on 2016-11-30 using generator-jhipster 3.12.0
|
||||
'use strict';
|
||||
|
||||
var gulp = require('gulp'),
|
||||
|
@ -14,7 +14,7 @@
|
||||
"eslint-config-angular": "0.5.0",
|
||||
"eslint-plugin-angular": "1.3.1",
|
||||
"event-stream": "3.3.4",
|
||||
"generator-jhipster": "3.11.0",
|
||||
"generator-jhipster": "3.12.0",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-angular-filesort": "1.1.1",
|
||||
"gulp-angular-templatecache": "2.0.0",
|
||||
@ -61,6 +61,7 @@
|
||||
"proxy-middleware": "0.15.0",
|
||||
"run-sequence": "1.2.2",
|
||||
"xml2js": "0.4.17",
|
||||
|
||||
"yargs": "5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
|
74
pom.xml
74
pom.xml
@ -25,25 +25,27 @@
|
||||
<awaitility.version>1.7.0</awaitility.version>
|
||||
<commons-io.version>2.5</commons-io.version>
|
||||
<commons-lang.version>3.4</commons-lang.version>
|
||||
<frontend-maven-plugin.version>1.0</frontend-maven-plugin.version>
|
||||
<frontend-maven-plugin.version>1.2</frontend-maven-plugin.version>
|
||||
<gatling.version>2.2.0</gatling.version>
|
||||
<gatling-maven-plugin.version>2.2.0</gatling-maven-plugin.version>
|
||||
<hibernate.version>4.3.11.Final</hibernate.version>
|
||||
<hibernate.version>5.2.4.Final</hibernate.version>
|
||||
<hikaricp.version>2.4.6</hikaricp.version>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<jcache.version>1.0.0</jcache.version>
|
||||
<javax.inject.version>1</javax.inject.version>
|
||||
<liquibase.version>3.4.2</liquibase.version>
|
||||
<liquibase.version>3.5.3</liquibase.version>
|
||||
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
|
||||
<liquibase-hibernate4.version>3.5</liquibase-hibernate4.version>
|
||||
<mapstruct.version>1.1.0.CR2</mapstruct.version>
|
||||
<liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
|
||||
<mapstruct.version>1.1.0.Final</mapstruct.version>
|
||||
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
|
||||
<maven.build.timestamp.format>yyyyMMddHHmmss</maven.build.timestamp.format>
|
||||
<maven-enforcer-plugin.version>1.4.1</maven-enforcer-plugin.version>
|
||||
<maven-resources-plugin.version>3.0.1</maven-resources-plugin.version>
|
||||
<sortpom-maven-plugin.version>2.5.0</sortpom-maven-plugin.version>
|
||||
<metrics-spring.version>3.1.3</metrics-spring.version>
|
||||
<prometheus-simpleclient.version>0.0.18</prometheus-simpleclient.version>
|
||||
<logstash-logback-encoder.version>4.7</logstash-logback-encoder.version>
|
||||
<run.addResources>false</run.addResources>
|
||||
<spring-security.version>4.1.3.RELEASE</spring-security.version>
|
||||
@ -68,7 +70,6 @@
|
||||
<profile.swagger></profile.swagger>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.dropwizard.metrics</groupId>
|
||||
@ -79,11 +80,6 @@
|
||||
<artifactId>metrics-annotation</artifactId>
|
||||
<version>${dropwizard-metrics.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.dropwizard.metrics</groupId>
|
||||
<artifactId>metrics-ehcache</artifactId>
|
||||
<version>${dropwizard-metrics.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.dropwizard.metrics</groupId>
|
||||
<artifactId>metrics-graphite</artifactId>
|
||||
@ -118,9 +114,24 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.prometheus</groupId>
|
||||
<artifactId>simpleclient</artifactId>
|
||||
<version>${prometheus-simpleclient.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.prometheus</groupId>
|
||||
<artifactId>simpleclient_servlet</artifactId>
|
||||
<version>${prometheus-simpleclient.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.prometheus</groupId>
|
||||
<artifactId>simpleclient_dropwizard</artifactId>
|
||||
<version>${prometheus-simpleclient.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-hibernate4</artifactId>
|
||||
<artifactId>jackson-datatype-hibernate5</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
@ -224,6 +235,11 @@
|
||||
<artifactId>jzlib</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.cache</groupId>
|
||||
<artifactId>cache-api</artifactId>
|
||||
<version>${jcache.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.inject</groupId>
|
||||
<artifactId>javax.inject</artifactId>
|
||||
@ -239,16 +255,14 @@
|
||||
<version>${assertj-core.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-ehcache</artifactId>
|
||||
<artifactId>hibernate-jcache</artifactId>
|
||||
<version>${hibernate.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
@ -257,6 +271,7 @@
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>5.3.3.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
@ -556,7 +571,7 @@
|
||||
<defaultSchemaName></defaultSchemaName>
|
||||
<username>jhipsterSampleApplication</username>
|
||||
<password></password>
|
||||
<referenceUrl>hibernate:spring:io.github.jhipster.sample.domain?dialect=&hibernate.ejb.naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy</referenceUrl>
|
||||
<referenceUrl>hibernate:spring:io.github.jhipster.sample.domain?dialect=&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
|
||||
<verbose>true</verbose>
|
||||
<logging>debug</logging>
|
||||
</configuration>
|
||||
@ -568,14 +583,19 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.liquibase.ext</groupId>
|
||||
<artifactId>liquibase-hibernate4</artifactId>
|
||||
<version>${liquibase-hibernate4.version}</version>
|
||||
<artifactId>liquibase-hibernate5</artifactId>
|
||||
<version>${liquibase-hibernate5.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>1.1.0.Final</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@ -642,12 +662,8 @@
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>
|
||||
frontend-maven-plugin
|
||||
</artifactId>
|
||||
<versionRange>
|
||||
${frontend-maven-plugin.version}
|
||||
</versionRange>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<versionRange>${frontend-maven-plugin.version}</versionRange>
|
||||
<goals>
|
||||
<goal>install-node-and-npm</goal>
|
||||
<goal>npm</goal>
|
||||
@ -735,7 +751,7 @@
|
||||
<plugin>
|
||||
<groupId>com.github.eirslett</groupId>
|
||||
<artifactId>frontend-maven-plugin</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>${frontend-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install node and npm</id>
|
||||
|
@ -1,59 +1,32 @@
|
||||
package io.github.jhipster.sample.config;
|
||||
|
||||
import com.codahale.metrics.MetricRegistry;
|
||||
import com.codahale.metrics.ehcache.InstrumentedEhcache;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.context.annotation.*;
|
||||
import org.springframework.cache.ehcache.EhCacheCacheManager;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.cache.CacheManager;
|
||||
import javax.inject.Inject;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import java.util.SortedSet;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
@AutoConfigureAfter(value = { MetricsConfiguration.class, DatabaseConfiguration.class })
|
||||
@AutoConfigureAfter(value = { MetricsConfiguration.class })
|
||||
@AutoConfigureBefore(value = { WebConfigurer.class, DatabaseConfiguration.class })
|
||||
public class CacheConfiguration {
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(CacheConfiguration.class);
|
||||
|
||||
@PersistenceContext
|
||||
private EntityManager entityManager;
|
||||
|
||||
@Inject
|
||||
private MetricRegistry metricRegistry;
|
||||
|
||||
private net.sf.ehcache.CacheManager cacheManager;
|
||||
private CacheManager cacheManager;
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
log.info("Remove Cache Manager metrics");
|
||||
SortedSet<String> names = metricRegistry.getNames();
|
||||
names.forEach(metricRegistry::remove);
|
||||
log.info("Closing Cache Manager");
|
||||
cacheManager.shutdown();
|
||||
cacheManager.close();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CacheManager cacheManager(JHipsterProperties jHipsterProperties) {
|
||||
log.debug("Starting Ehcache");
|
||||
cacheManager = net.sf.ehcache.CacheManager.create();
|
||||
cacheManager.getConfiguration().setMaxBytesLocalHeap(jHipsterProperties.getCache().getEhcache().getMaxBytesLocalHeap());
|
||||
log.debug("Registering Ehcache Metrics gauges");
|
||||
Stream.of(cacheManager.getCacheNames()).forEach(name -> {
|
||||
net.sf.ehcache.Cache cache = cacheManager.getCache(name);
|
||||
cacheManager.replaceCacheWithDecoratedCache(cache, InstrumentedEhcache.instrument(metricRegistry, cache));
|
||||
});
|
||||
EhCacheCacheManager ehCacheManager = new EhCacheCacheManager();
|
||||
ehCacheManager.setCacheManager(cacheManager);
|
||||
return ehCacheManager;
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,9 @@ public final class Constants {
|
||||
|
||||
//Regex for acceptable logins
|
||||
public static final String LOGIN_REGEX = "^[_'.@A-Za-z0-9-]*$";
|
||||
// Spring profile for development and production, see http://jhipster.github.io/profiles/
|
||||
// Spring profiles for development, test and production, see http://jhipster.github.io/profiles/
|
||||
public static final String SPRING_PROFILE_DEVELOPMENT = "dev";
|
||||
public static final String SPRING_PROFILE_TEST = "test";
|
||||
public static final String SPRING_PROFILE_PRODUCTION = "prod";
|
||||
// Spring profile used when deploying with Spring Cloud (used when deploying to CloudFoundry)
|
||||
public static final String SPRING_PROFILE_CLOUD = "cloud";
|
||||
|
@ -2,7 +2,7 @@ package io.github.jhipster.sample.config;
|
||||
|
||||
import io.github.jhipster.sample.config.liquibase.AsyncSpringLiquibase;
|
||||
|
||||
import com.fasterxml.jackson.datatype.hibernate4.Hibernate4Module;
|
||||
import com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module;
|
||||
import liquibase.integration.spring.SpringLiquibase;
|
||||
import org.h2.tools.Server;
|
||||
import org.slf4j.Logger;
|
||||
@ -63,7 +63,7 @@ public class DatabaseConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Hibernate4Module hibernate4Module() {
|
||||
return new Hibernate4Module();
|
||||
public Hibernate5Module hibernate5Module() {
|
||||
return new Hibernate5Module();
|
||||
}
|
||||
}
|
||||
|
@ -289,6 +289,8 @@ public class JHipsterProperties {
|
||||
|
||||
private final Graphite graphite = new Graphite();
|
||||
|
||||
private final Prometheus prometheus = new Prometheus();
|
||||
|
||||
private final Logs logs = new Logs();
|
||||
|
||||
public Jmx getJmx() {
|
||||
@ -299,6 +301,10 @@ public class JHipsterProperties {
|
||||
return graphite;
|
||||
}
|
||||
|
||||
public Prometheus getPrometheus() {
|
||||
return prometheus;
|
||||
}
|
||||
|
||||
public Logs getLogs() {
|
||||
return logs;
|
||||
}
|
||||
@ -359,7 +365,30 @@ public class JHipsterProperties {
|
||||
}
|
||||
}
|
||||
|
||||
public static class Logs {
|
||||
public static class Prometheus {
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
private String endpoint = "/prometheusMetrics";
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public String getEndpoint() {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
public void setEndpoint(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Logs {
|
||||
|
||||
private boolean enabled = false;
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.github.jhipster.sample.config;
|
||||
|
||||
import io.github.jhipster.sample.config.jcache.JCacheGaugeSet;
|
||||
|
||||
import com.codahale.metrics.JmxReporter;
|
||||
import com.codahale.metrics.MetricRegistry;
|
||||
@ -11,15 +12,20 @@ import com.codahale.metrics.jvm.*;
|
||||
import com.ryantenney.metrics.spring.config.annotation.EnableMetrics;
|
||||
import com.ryantenney.metrics.spring.config.annotation.MetricsConfigurerAdapter;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
|
||||
import io.prometheus.client.CollectorRegistry;
|
||||
import io.prometheus.client.dropwizard.DropwizardExports;
|
||||
import io.prometheus.client.exporter.MetricsServlet;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
import org.springframework.context.annotation.*;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletException;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -34,6 +40,7 @@ public class MetricsConfiguration extends MetricsConfigurerAdapter {
|
||||
private static final String PROP_METRIC_REG_JVM_FILES = "jvm.files";
|
||||
private static final String PROP_METRIC_REG_JVM_BUFFERS = "jvm.buffers";
|
||||
|
||||
private static final String PROP_METRIC_REG_JCACHE_STATISTICS = "jcache.statistics";
|
||||
private final Logger log = LoggerFactory.getLogger(MetricsConfiguration.class);
|
||||
|
||||
private MetricRegistry metricRegistry = new MetricRegistry();
|
||||
@ -66,6 +73,8 @@ public class MetricsConfiguration extends MetricsConfigurerAdapter {
|
||||
metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
|
||||
metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
|
||||
metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
|
||||
|
||||
metricRegistry.register(PROP_METRIC_REG_JCACHE_STATISTICS, new JCacheGaugeSet());
|
||||
if (hikariDataSource != null) {
|
||||
log.debug("Monitoring the datasource");
|
||||
hikariDataSource.setMetricRegistry(metricRegistry);
|
||||
@ -117,4 +126,30 @@ public class MetricsConfiguration extends MetricsConfigurerAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnClass(CollectorRegistry.class)
|
||||
public static class PrometheusRegistry implements ServletContextInitializer{
|
||||
|
||||
private final Logger log = LoggerFactory.getLogger(PrometheusRegistry.class);
|
||||
|
||||
@Inject
|
||||
private MetricRegistry metricRegistry;
|
||||
|
||||
@Inject
|
||||
private JHipsterProperties jHipsterProperties;
|
||||
|
||||
@Override
|
||||
public void onStartup(ServletContext servletContext) throws ServletException {
|
||||
if(jHipsterProperties.getMetrics().getPrometheus().isEnabled()) {
|
||||
String endpoint = jHipsterProperties.getMetrics().getPrometheus().getEndpoint();
|
||||
log.info("Initializing Metrics Prometheus endpoint at {}", endpoint);
|
||||
CollectorRegistry collectorRegistry = new CollectorRegistry();
|
||||
collectorRegistry.register(new DropwizardExports(metricRegistry));
|
||||
servletContext
|
||||
.addServlet("prometheusMetrics", new MetricsServlet(collectorRegistry))
|
||||
.addMapping(endpoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,70 @@
|
||||
package io.github.jhipster.sample.config.jcache;
|
||||
|
||||
import com.codahale.metrics.JmxAttributeGauge;
|
||||
import com.codahale.metrics.Metric;
|
||||
import com.codahale.metrics.MetricSet;
|
||||
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.cache.management.CacheStatisticsMXBean;
|
||||
import javax.management.MalformedObjectNameException;
|
||||
import javax.management.ObjectInstance;
|
||||
import javax.management.ObjectName;
|
||||
|
||||
import static com.codahale.metrics.MetricRegistry.name;
|
||||
|
||||
/**
|
||||
* MetricSet retrieving JCache specific JMX metrics for every configured caches.
|
||||
*/
|
||||
public class JCacheGaugeSet implements MetricSet {
|
||||
|
||||
private static final String M_BEAN_COORDINATES = "javax.cache:type=CacheStatistics,CacheManager=*,Cache=*";
|
||||
|
||||
@Override
|
||||
public Map<String, Metric> getMetrics() {
|
||||
Set<ObjectInstance> objectInstances = getCacheMBeans();
|
||||
|
||||
Map<String, Metric> gauges = new HashMap<String, Metric>();
|
||||
|
||||
List<String> availableStatsNames = retrieveStatsNames();
|
||||
|
||||
for (ObjectInstance objectInstance : objectInstances) {
|
||||
ObjectName objectName = objectInstance.getObjectName();
|
||||
String cacheName = objectName.getKeyProperty("Cache");
|
||||
|
||||
for (String statsName : availableStatsNames) {
|
||||
JmxAttributeGauge jmxAttributeGauge = new JmxAttributeGauge(objectName, statsName);
|
||||
gauges.put(name(cacheName, toDashCase(statsName)), jmxAttributeGauge);
|
||||
}
|
||||
}
|
||||
|
||||
return Collections.unmodifiableMap(gauges);
|
||||
}
|
||||
|
||||
private Set<ObjectInstance> getCacheMBeans() {
|
||||
try {
|
||||
return ManagementFactory.getPlatformMBeanServer().queryMBeans(ObjectName.getInstance(M_BEAN_COORDINATES), null);
|
||||
} catch (MalformedObjectNameException e) {
|
||||
throw new InternalError("Shouldn't happen since the query is hardcoded", e);
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> retrieveStatsNames() {
|
||||
Class<?> c = CacheStatisticsMXBean.class;
|
||||
return Arrays.stream(c.getMethods())
|
||||
.filter(method -> method.getName().startsWith("get"))
|
||||
.map(method -> method.getName().substring(3))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static String toDashCase(String camelCase) {
|
||||
return camelCase.replaceAll("(.)(\\p{Upper})", "$1-$2").toLowerCase();
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package io.github.jhipster.sample.config.jcache;
|
||||
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.cache.jcache.JCacheRegionFactory;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Special Hibernate region factory that will convert a Spring URI (e.g. classpath:ehcache.xml) to a real URI (e.g. file://ehcache.xml).
|
||||
*/
|
||||
public class SpringCacheRegionFactory extends JCacheRegionFactory {
|
||||
|
||||
@Override
|
||||
public void start(SessionFactoryOptions options, Properties properties) throws CacheException {
|
||||
// Translate the Spring URI to a real URI
|
||||
String uri = properties.getProperty(CONFIG_URI);
|
||||
Resource resource = new DefaultResourceLoader().getResource(uri);
|
||||
try {
|
||||
properties.setProperty(CONFIG_URI, resource.getURI().toString());
|
||||
}
|
||||
catch(IOException e) {
|
||||
throw new CacheException(e);
|
||||
}
|
||||
super.start(options, properties);
|
||||
}
|
||||
}
|
@ -67,7 +67,7 @@ public class AngularCookieLocaleResolver extends CookieLocaleResolver {
|
||||
localePart = value.substring(0, spaceIndex);
|
||||
timeZonePart = value.substring(spaceIndex + 1);
|
||||
}
|
||||
locale = (!"-".equals(localePart) ? StringUtils.parseLocaleString(localePart.replace('-', '_')) : null);
|
||||
locale = !"-".equals(localePart) ? StringUtils.parseLocaleString(localePart.replace('-', '_')) : null;
|
||||
if (timeZonePart != null) {
|
||||
timeZone = StringUtils.parseTimeZoneString(timeZonePart);
|
||||
}
|
||||
@ -77,10 +77,10 @@ public class AngularCookieLocaleResolver extends CookieLocaleResolver {
|
||||
}
|
||||
}
|
||||
request.setAttribute(LOCALE_REQUEST_ATTRIBUTE_NAME,
|
||||
(locale != null ? locale: determineDefaultLocale(request)));
|
||||
locale != null ? locale: determineDefaultLocale(request));
|
||||
|
||||
request.setAttribute(TIME_ZONE_REQUEST_ATTRIBUTE_NAME,
|
||||
(timeZone != null ? timeZone : determineDefaultTimeZone(request)));
|
||||
timeZone != null ? timeZone : determineDefaultTimeZone(request));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class BankAccount implements Serializable {
|
||||
return false;
|
||||
}
|
||||
BankAccount bankAccount = (BankAccount) o;
|
||||
if(bankAccount.id == null || id == null) {
|
||||
if (bankAccount.id == null || id == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(id, bankAccount.id);
|
||||
|
@ -68,7 +68,7 @@ public class Label implements Serializable {
|
||||
return false;
|
||||
}
|
||||
Label label = (Label) o;
|
||||
if(label.id == null || id == null) {
|
||||
if (label.id == null || id == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(id, label.id);
|
||||
|
@ -104,7 +104,7 @@ public class Operation implements Serializable {
|
||||
return false;
|
||||
}
|
||||
Operation operation = (Operation) o;
|
||||
if(operation.id == null || id == null) {
|
||||
if (operation.id == null || id == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(id, operation.id);
|
||||
|
@ -1,56 +0,0 @@
|
||||
package io.github.jhipster.sample.domain.util;
|
||||
|
||||
import io.github.jhipster.sample.domain.util.JSR310DateConverters.*;
|
||||
|
||||
import java.time.*;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.Converter;
|
||||
|
||||
public final class JSR310PersistenceConverters {
|
||||
|
||||
private JSR310PersistenceConverters() {}
|
||||
|
||||
@Converter(autoApply = true)
|
||||
public static class LocalDateConverter implements AttributeConverter<LocalDate, java.sql.Date> {
|
||||
|
||||
@Override
|
||||
public java.sql.Date convertToDatabaseColumn(LocalDate date) {
|
||||
return date == null ? null : java.sql.Date.valueOf(date);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDate convertToEntityAttribute(java.sql.Date date) {
|
||||
return date == null ? null : date.toLocalDate();
|
||||
}
|
||||
}
|
||||
|
||||
@Converter(autoApply = true)
|
||||
public static class ZonedDateTimeConverter implements AttributeConverter<ZonedDateTime, Date> {
|
||||
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(ZonedDateTime zonedDateTime) {
|
||||
return ZonedDateTimeToDateConverter.INSTANCE.convert(zonedDateTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZonedDateTime convertToEntityAttribute(Date date) {
|
||||
return DateToZonedDateTimeConverter.INSTANCE.convert(date);
|
||||
}
|
||||
}
|
||||
|
||||
@Converter(autoApply = true)
|
||||
public static class LocalDateTimeConverter implements AttributeConverter<LocalDateTime, Date> {
|
||||
|
||||
@Override
|
||||
public Date convertToDatabaseColumn(LocalDateTime localDateTime) {
|
||||
return LocalDateTimeToDateConverter.INSTANCE.convert(localDateTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalDateTime convertToEntityAttribute(Date date) {
|
||||
return DateToLocalDateTimeConverter.INSTANCE.convert(date);
|
||||
}
|
||||
}
|
||||
}
|
@ -29,8 +29,4 @@ public interface UserRepository extends JpaRepository<User, Long> {
|
||||
@Query(value = "select distinct user from User user left join fetch user.authorities",
|
||||
countQuery = "select count(user) from User user")
|
||||
Page<User> findAllWithAuthorities(Pageable pageable);
|
||||
|
||||
@Override
|
||||
void delete(User t);
|
||||
|
||||
}
|
||||
|
@ -46,15 +46,8 @@ public final class SecurityUtils {
|
||||
SecurityContext securityContext = SecurityContextHolder.getContext();
|
||||
Authentication authentication = securityContext.getAuthentication();
|
||||
if (authentication != null) {
|
||||
Collection<? extends GrantedAuthority> authorities = authentication.getAuthorities();
|
||||
if (authorities != null) {
|
||||
for (GrantedAuthority authority : authorities) {
|
||||
if (authority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return authentication.getAuthorities().stream()
|
||||
.noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -71,10 +64,8 @@ public final class SecurityUtils {
|
||||
SecurityContext securityContext = SecurityContextHolder.getContext();
|
||||
Authentication authentication = securityContext.getAuthentication();
|
||||
if (authentication != null) {
|
||||
if (authentication.getPrincipal() instanceof UserDetails) {
|
||||
UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal();
|
||||
return springSecurityUser.getAuthorities().contains(new SimpleGrantedAuthority(authority));
|
||||
}
|
||||
return authentication.getAuthorities().stream()
|
||||
.anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -14,6 +14,6 @@ public class SpringSecurityAuditorAware implements AuditorAware<String> {
|
||||
@Override
|
||||
public String getCurrentAuditor() {
|
||||
String userName = SecurityUtils.getCurrentUserLogin();
|
||||
return (userName != null ? userName : Constants.SYSTEM_ACCOUNT);
|
||||
return userName != null ? userName : Constants.SYSTEM_ACCOUNT;
|
||||
}
|
||||
}
|
||||
|
@ -37,12 +37,12 @@ public class AuditEventService {
|
||||
|
||||
public Page<AuditEvent> findAll(Pageable pageable) {
|
||||
return persistenceAuditEventRepository.findAll(pageable)
|
||||
.map(persistentAuditEvents -> auditEventConverter.convertToAuditEvent(persistentAuditEvents));
|
||||
.map(auditEventConverter::convertToAuditEvent);
|
||||
}
|
||||
|
||||
public Page<AuditEvent> findByDates(LocalDateTime fromDate, LocalDateTime toDate, Pageable pageable) {
|
||||
return persistenceAuditEventRepository.findAllByAuditEventDateBetween(fromDate, toDate, pageable)
|
||||
.map(persistentAuditEvents -> auditEventConverter.convertToAuditEvent(persistentAuditEvents));
|
||||
.map(auditEventConverter::convertToAuditEvent);
|
||||
}
|
||||
|
||||
public Optional<AuditEvent> find(Long id) {
|
||||
|
@ -49,7 +49,6 @@ public class UserService {
|
||||
// activate given user for the registration key.
|
||||
user.setActivated(true);
|
||||
user.setActivationKey(null);
|
||||
userRepository.save(user);
|
||||
log.debug("Activated user: {}", user);
|
||||
return user;
|
||||
});
|
||||
@ -67,7 +66,6 @@ public class UserService {
|
||||
user.setPassword(passwordEncoder.encode(newPassword));
|
||||
user.setResetKey(null);
|
||||
user.setResetDate(null);
|
||||
userRepository.save(user);
|
||||
return user;
|
||||
});
|
||||
}
|
||||
@ -78,7 +76,6 @@ public class UserService {
|
||||
.map(user -> {
|
||||
user.setResetKey(RandomUtil.generateResetKey());
|
||||
user.setResetDate(ZonedDateTime.now());
|
||||
userRepository.save(user);
|
||||
return user;
|
||||
});
|
||||
}
|
||||
@ -121,7 +118,7 @@ public class UserService {
|
||||
}
|
||||
if (managedUserVM.getAuthorities() != null) {
|
||||
Set<Authority> authorities = new HashSet<>();
|
||||
managedUserVM.getAuthorities().stream().forEach(
|
||||
managedUserVM.getAuthorities().forEach(
|
||||
authority -> authorities.add(authorityRepository.findOne(authority))
|
||||
);
|
||||
user.setAuthorities(authorities);
|
||||
@ -137,13 +134,12 @@ public class UserService {
|
||||
}
|
||||
|
||||
public void updateUser(String firstName, String lastName, String email, String langKey) {
|
||||
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(u -> {
|
||||
u.setFirstName(firstName);
|
||||
u.setLastName(lastName);
|
||||
u.setEmail(email);
|
||||
u.setLangKey(langKey);
|
||||
userRepository.save(u);
|
||||
log.debug("Changed Information for User: {}", u);
|
||||
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(user -> {
|
||||
user.setFirstName(firstName);
|
||||
user.setLastName(lastName);
|
||||
user.setEmail(email);
|
||||
user.setLangKey(langKey);
|
||||
log.debug("Changed Information for User: {}", user);
|
||||
});
|
||||
}
|
||||
|
||||
@ -152,43 +148,42 @@ public class UserService {
|
||||
|
||||
Optional.of(userRepository
|
||||
.findOne(id))
|
||||
.ifPresent(u -> {
|
||||
u.setLogin(login);
|
||||
u.setFirstName(firstName);
|
||||
u.setLastName(lastName);
|
||||
u.setEmail(email);
|
||||
u.setActivated(activated);
|
||||
u.setLangKey(langKey);
|
||||
Set<Authority> managedAuthorities = u.getAuthorities();
|
||||
.ifPresent(user -> {
|
||||
user.setLogin(login);
|
||||
user.setFirstName(firstName);
|
||||
user.setLastName(lastName);
|
||||
user.setEmail(email);
|
||||
user.setActivated(activated);
|
||||
user.setLangKey(langKey);
|
||||
Set<Authority> managedAuthorities = user.getAuthorities();
|
||||
managedAuthorities.clear();
|
||||
authorities.stream().forEach(
|
||||
authorities.forEach(
|
||||
authority -> managedAuthorities.add(authorityRepository.findOne(authority))
|
||||
);
|
||||
log.debug("Changed Information for User: {}", u);
|
||||
log.debug("Changed Information for User: {}", user);
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteUser(String login) {
|
||||
userRepository.findOneByLogin(login).ifPresent(u -> {
|
||||
userRepository.delete(u);
|
||||
log.debug("Deleted User: {}", u);
|
||||
userRepository.findOneByLogin(login).ifPresent(user -> {
|
||||
userRepository.delete(user);
|
||||
log.debug("Deleted User: {}", user);
|
||||
});
|
||||
}
|
||||
|
||||
public void changePassword(String password) {
|
||||
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(u -> {
|
||||
userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).ifPresent(user -> {
|
||||
String encryptedPassword = passwordEncoder.encode(password);
|
||||
u.setPassword(encryptedPassword);
|
||||
userRepository.save(u);
|
||||
log.debug("Changed password for User: {}", u);
|
||||
user.setPassword(encryptedPassword);
|
||||
log.debug("Changed password for User: {}", user);
|
||||
});
|
||||
}
|
||||
|
||||
@Transactional(readOnly = true)
|
||||
public Optional<User> getUserWithAuthoritiesByLogin(String login) {
|
||||
return userRepository.findOneByLogin(login).map(u -> {
|
||||
u.getAuthorities().size();
|
||||
return u;
|
||||
return userRepository.findOneByLogin(login).map(user -> {
|
||||
user.getAuthorities().size();
|
||||
return user;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,12 @@ spring:
|
||||
hibernate.cache.use_second_level_cache: true
|
||||
hibernate.cache.use_query_cache: false
|
||||
hibernate.generate_statistics: true
|
||||
hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
|
||||
hibernate.javax.cache.provider: org.ehcache.jsr107.EhcacheCachingProvider
|
||||
hibernate.javax.cache.uri: ${spring.cache.jcache.config}
|
||||
hibernate.cache.region.factory_class: io.github.jhipster.sample.config.jcache.SpringCacheRegionFactory
|
||||
cache:
|
||||
jcache:
|
||||
config: ehcache.xml
|
||||
mail:
|
||||
host: localhost
|
||||
port: 25
|
||||
@ -78,6 +83,9 @@ jhipster:
|
||||
host: localhost
|
||||
port: 2003
|
||||
prefix: jhipsterSampleApplication
|
||||
prometheus:
|
||||
enabled: false
|
||||
endpoint: /prometheusMetrics
|
||||
logs: # Reports Dropwizard metrics in the logs
|
||||
enabled: false
|
||||
reportFrequency: 60 # in seconds
|
||||
|
@ -37,7 +37,12 @@ spring:
|
||||
hibernate.cache.use_second_level_cache: true
|
||||
hibernate.cache.use_query_cache: false
|
||||
hibernate.generate_statistics: false
|
||||
hibernate.cache.region.factory_class: org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
|
||||
hibernate.javax.cache.provider: org.ehcache.jsr107.EhcacheCachingProvider
|
||||
hibernate.javax.cache.uri: ${spring.cache.jcache.config}
|
||||
hibernate.cache.region.factory_class: io.github.jhipster.sample.config.jcache.SpringCacheRegionFactory
|
||||
cache:
|
||||
jcache:
|
||||
config: ehcache.xml
|
||||
mail:
|
||||
host: localhost
|
||||
port: 25
|
||||
@ -81,6 +86,9 @@ jhipster:
|
||||
host: localhost
|
||||
port: 2003
|
||||
prefix: jhipsterSampleApplication
|
||||
prometheus:
|
||||
enabled: false
|
||||
endpoint: /prometheusMetrics
|
||||
logs: # Reports Dropwizard metrics in the logs
|
||||
enabled: false
|
||||
reportFrequency: 60 # in seconds
|
||||
|
@ -31,7 +31,8 @@ spring:
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
naming:
|
||||
strategy: org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy
|
||||
physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
|
||||
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
|
||||
messages:
|
||||
basename: i18n/messages
|
||||
mvc:
|
||||
|
@ -33,7 +33,7 @@
|
||||
<constraints nullable="true" />
|
||||
</column>
|
||||
|
||||
<!-- jhipster-needle-liquibase-add-column - Jhipster will add columns here, do not remove-->
|
||||
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
|
||||
</createTable>
|
||||
|
||||
</changeSet>
|
||||
|
@ -25,7 +25,7 @@
|
||||
<constraints nullable="false" />
|
||||
</column>
|
||||
|
||||
<!-- jhipster-needle-liquibase-add-column - Jhipster will add columns here, do not remove-->
|
||||
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
|
||||
</createTable>
|
||||
|
||||
</changeSet>
|
||||
|
@ -37,7 +37,7 @@
|
||||
<constraints nullable="true" />
|
||||
</column>
|
||||
|
||||
<!-- jhipster-needle-liquibase-add-column - Jhipster will add columns here, do not remove-->
|
||||
<!-- jhipster-needle-liquibase-add-column - JHipster will add columns here, do not remove-->
|
||||
</createTable>
|
||||
<dropDefaultValue tableName="operation" columnName="date" columnDataType="datetime"/>
|
||||
|
||||
|
@ -1,65 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
|
||||
name="CM1"
|
||||
updateCheck="false"
|
||||
maxBytesLocalHeap="16M">
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns='http://www.ehcache.org/v3'
|
||||
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd">
|
||||
|
||||
<!--
|
||||
This is a default configuration, it is re-configured by the CacheConfiguration Spring Bean, using the
|
||||
properties from the resources/config/*.yml files.
|
||||
-->
|
||||
<cache-template name="simple">
|
||||
<expiry>
|
||||
<ttl unit="seconds">3600</ttl>
|
||||
</expiry>
|
||||
<heap>100</heap>
|
||||
</cache-template>
|
||||
|
||||
<diskStore path="java.io.tmpdir"/>
|
||||
<cache alias="io.github.jhipster.sample.domain.User" uses-template="simple"/>
|
||||
|
||||
<defaultCache
|
||||
eternal="false"
|
||||
overflowToDisk="false"
|
||||
/>
|
||||
<cache alias="io.github.jhipster.sample.domain.Authority" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.User"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.User.authorities" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.Authority"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.PersistentToken" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.User.authorities"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.User.persistentTokens" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.PersistentToken"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.BankAccount" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.User.persistentTokens"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.BankAccount.operations" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.BankAccount"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.Label" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.BankAccount.operations"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.Label.operations" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.Label"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.Operation" uses-template="simple"/>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.Label.operations"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.Operation"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
|
||||
<cache name="io.github.jhipster.sample.domain.Operation.labels"
|
||||
timeToLiveSeconds="3600">
|
||||
</cache>
|
||||
<cache alias="io.github.jhipster.sample.domain.Operation.labels" uses-template="simple"/>
|
||||
|
||||
<!-- jhipster-needle-ehcache-add-entry -->
|
||||
</ehcache>
|
||||
</config>
|
||||
|
@ -33,7 +33,7 @@
|
||||
<logger name="com.sun" level="WARN"/>
|
||||
<logger name="com.zaxxer" level="WARN"/>
|
||||
<logger name="io.undertow" level="WARN"/>
|
||||
<logger name="net.sf.ehcache" level="WARN"/>
|
||||
<logger name="org.ehcache" level="WARN"/>
|
||||
<logger name="org.apache" level="WARN"/>
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
|
||||
<logger name="org.bson" level="WARN"/>
|
||||
@ -49,6 +49,7 @@
|
||||
<logger name="springfox" level="WARN"/>
|
||||
<logger name="sun.rmi" level="WARN"/>
|
||||
<logger name="liquibase" level="WARN"/>
|
||||
<logger name="LiquibaseSchemaResolver" level="INFO"/>
|
||||
<logger name="sun.rmi.transport" level="WARN"/>
|
||||
|
||||
<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
|
||||
|
@ -21,19 +21,22 @@
|
||||
|
||||
$scope.$watch('vm.metrics', function (newValue) {
|
||||
vm.servicesStats = {};
|
||||
vm.cachesStats = {};
|
||||
angular.forEach(newValue.timers, function (value, key) {
|
||||
if (key.indexOf('web.rest') !== -1 || key.indexOf('service') !== -1) {
|
||||
vm.servicesStats[key] = value;
|
||||
}
|
||||
if (key.indexOf('net.sf.ehcache.Cache') !== -1) {
|
||||
});
|
||||
|
||||
vm.cachesStats = {};
|
||||
angular.forEach(newValue.gauges, function (value, key) {
|
||||
if (key.indexOf('jcache.statistics') !== -1) {
|
||||
// remove gets or puts
|
||||
var index = key.lastIndexOf('.');
|
||||
var newKey = key.substr(0, index);
|
||||
|
||||
// Keep the name of the domain
|
||||
vm.cachesStats[newKey] = {
|
||||
'name': newKey,
|
||||
'name': newKey.substr(18),
|
||||
'value': value
|
||||
};
|
||||
}
|
||||
|
@ -170,25 +170,39 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<h3 data-translate="metrics.ehcache.title">Ehcache statistics</h3>
|
||||
<h3 data-translate="metrics.cache.title">Cache statistics</h3>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th data-translate="metrics.ehcache.cachename">Cache name</th>
|
||||
<th class="text-right" data-translate="metrics.ehcache.objects">Objects</th>
|
||||
<th class="text-right" data-translate="metrics.ehcache.hits">Hits</th>
|
||||
<th class="text-right" data-translate="metrics.ehcache.misses">Misses</th>
|
||||
<th class="text-right" data-translate="metrics.ehcache.evictioncount">Eviction count</th>
|
||||
<th data-translate="metrics.cache.cachename">Cache name</th>
|
||||
<th class="text-right" data-translate="metrics.cache.hits">Cache Hits</th>
|
||||
<th class="text-right" data-translate="metrics.cache.misses">Cache Misses</th>
|
||||
<th class="text-right" data-translate="metrics.cache.gets">Cache Gets</th>
|
||||
<th class="text-right" data-translate="metrics.cache.puts">Cache Puts</th>
|
||||
<th class="text-right" data-translate="metrics.cache.removals">Cache Removals</th>
|
||||
<th class="text-right" data-translate="metrics.cache.evictions">Cache Evictions</th>
|
||||
<th class="text-right" data-translate="metrics.cache.hitPercent">Cache Hit %</th>
|
||||
<th class="text-right" data-translate="metrics.cache.missPercent">Cache Miss %</th>
|
||||
<th class="text-right" data-translate="metrics.cache.averageGetTime">Average get time (µs)</th>
|
||||
<th class="text-right" data-translate="metrics.cache.averagePutTime">Average put time (µs)</th>
|
||||
<th class="text-right" data-translate="metrics.cache.averageRemoveTime">Average remove time (µs)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="(k, v) in vm.cachesStats" ng-once>
|
||||
<td>{{v.name}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.objects'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.hits'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.misses'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.eviction-count'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.cache-hits'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.cache-misses'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.cache-gets'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.cache-puts'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.cache-removals'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.cache-evictions'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.cache-hit-percentage'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.cache-miss-percentage'].value}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.average-get-time'].value | number:2}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.average-put-time'].value | number:2}}</td>
|
||||
<td class="text-right">{{vm.metrics.gauges[k + '.average-remove-time'].value | number:2}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -32,6 +32,7 @@
|
||||
'ro': 'Română',
|
||||
'ru': 'Русский',
|
||||
'sk': 'Slovenský',
|
||||
'sr': 'Srpski',
|
||||
'sv': 'Svenska',
|
||||
'ta': 'தமிழ்',
|
||||
'tr': 'Türkçe',
|
||||
|
@ -17,6 +17,7 @@
|
||||
function loadAll() {
|
||||
BankAccount.query(function(result) {
|
||||
vm.bankAccounts = result;
|
||||
vm.searchQuery = null;
|
||||