deps: update maven

This commit is contained in:
Ilkka Seppälä
2024-03-27 20:09:01 +02:00
parent 2061fe8c59
commit 7d0874d88a
10 changed files with 409 additions and 136 deletions
-125
View File
@@ -1,125 +0,0 @@
/*
* The MIT License
* Copyright © 2014-2021 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;
public class MavenWrapperDownloader {
private static final String WRAPPER_VERSION = "0.5.6";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";
/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";
/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);
File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}
private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}
}
+5 -5
View File
@@ -5,14 +5,14 @@
# 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
#
#
# https://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.
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
+2
View File
@@ -0,0 +1,2 @@
@startuml
@enduml
+124
View File
@@ -0,0 +1,124 @@
@startuml
package com.iluwatar.health.check {
class App {
+ App()
+ main(args : String[]) {static}
}
class AsynchronousHealthChecker {
- HEALTH_CHECK_FAILED_MESSAGE : String {static}
- HEALTH_CHECK_TIMEOUT_MESSAGE : String {static}
- LOGGER : Logger {static}
- healthCheckExecutor : ScheduledExecutorService
+ AsynchronousHealthChecker()
- awaitTerminationWithTimeout() : boolean
+ performCheck(healthCheck : Supplier<Health>, timeoutInSeconds : long) : CompletableFuture<Health>
+ shutdown()
}
class CpuHealthIndicator {
- ERROR_MESSAGE : String {static}
- HIGH_LOAD_AVERAGE_MESSAGE : String {static}
- HIGH_LOAD_AVERAGE_MESSAGE_WITHOUT_PARAM : String {static}
- HIGH_PROCESS_CPU_LOAD_MESSAGE : String {static}
- HIGH_PROCESS_CPU_LOAD_MESSAGE_WITHOUT_PARAM : String {static}
- HIGH_SYSTEM_CPU_LOAD_MESSAGE : String {static}
- HIGH_SYSTEM_CPU_LOAD_MESSAGE_WITHOUT_PARAM : String {static}
- LOGGER : Logger {static}
- defaultWarningMessage : String
- loadAverageThreshold : double
- osBean : OperatingSystemMXBean
- processCpuLoadThreshold : double
- systemCpuLoadThreshold : double
+ CpuHealthIndicator()
+ getDefaultWarningMessage() : String
+ getLoadAverageThreshold() : double
+ getOsBean() : OperatingSystemMXBean
+ getProcessCpuLoadThreshold() : double
+ getSystemCpuLoadThreshold() : double
+ health() : Health
+ init()
+ setDefaultWarningMessage(defaultWarningMessage : String)
+ setLoadAverageThreshold(loadAverageThreshold : double)
+ setOsBean(osBean : OperatingSystemMXBean)
+ setProcessCpuLoadThreshold(processCpuLoadThreshold : double)
+ setSystemCpuLoadThreshold(systemCpuLoadThreshold : double)
}
class CustomHealthIndicator {
- LOGGER : Logger {static}
- cacheManager : CacheManager
- healthCheckRepository : HealthCheckRepository
- healthChecker : AsynchronousHealthChecker
- timeoutInSeconds : long
+ CustomHealthIndicator(healthChecker : AsynchronousHealthChecker, cacheManager : CacheManager, healthCheckRepository : HealthCheckRepository)
- check() : Health
+ evictHealthCache()
+ health() : Health
}
class DatabaseTransactionHealthIndicator {
- LOGGER : Logger {static}
- asynchronousHealthChecker : AsynchronousHealthChecker
- healthCheckRepository : HealthCheckRepository
- retryTemplate : RetryTemplate
- timeoutInSeconds : long
+ DatabaseTransactionHealthIndicator(healthCheckRepository : HealthCheckRepository, asynchronousHealthChecker : AsynchronousHealthChecker, retryTemplate : RetryTemplate)
+ getAsynchronousHealthChecker() : AsynchronousHealthChecker
+ getHealthCheckRepository() : HealthCheckRepository
+ getRetryTemplate() : RetryTemplate
+ getTimeoutInSeconds() : long
+ health() : Health
+ setTimeoutInSeconds(timeoutInSeconds : long)
}
class GarbageCollectionHealthIndicator {
- LOGGER : Logger {static}
- memoryUsageThreshold : double
+ GarbageCollectionHealthIndicator()
- addMemoryPoolDetails(collectorDetails : Map<String, String>, memoryPoolMxBeans : List<MemoryPoolMXBean>, memoryPoolNamesList : List<String>)
- createCollectorDetails(gcBean : GarbageCollectorMXBean, memoryPoolMxBeans : List<MemoryPoolMXBean>) : Map<String, String>
# getGarbageCollectorMxBeans() : List<GarbageCollectorMXBean>
# getMemoryPoolMxBeans() : List<MemoryPoolMXBean>
+ getMemoryUsageThreshold() : double
+ health() : Health
+ setMemoryUsageThreshold(memoryUsageThreshold : double)
}
class HealthCheck {
- id : Integer
- status : String
+ HealthCheck()
# canEqual(other : Object) : boolean
+ equals(o : Object) : boolean
+ getId() : Integer
+ getStatus() : String
+ hashCode() : int
+ setId(id : Integer)
+ setStatus(status : String)
+ toString() : String
}
class HealthCheckRepository {
- HEALTH_CHECK_OK : String {static}
- LOGGER : Logger {static}
- entityManager : EntityManager
+ HealthCheckRepository()
+ checkHealth() : Integer
+ performTestTransaction()
}
class MemoryHealthIndicator {
- LOGGER : Logger {static}
- asynchronousHealthChecker : AsynchronousHealthChecker
- memoryThreshold : double
- timeoutInSeconds : long
+ MemoryHealthIndicator(asynchronousHealthChecker : AsynchronousHealthChecker)
+ checkMemory() : Health
+ health() : Health
}
class RetryConfig {
- backOffPeriod : long
- maxAttempts : int
+ RetryConfig()
+ retryTemplate() : RetryTemplate
}
}
DatabaseTransactionHealthIndicator --> "-asynchronousHealthChecker" AsynchronousHealthChecker
DatabaseTransactionHealthIndicator --> "-healthCheckRepository" HealthCheckRepository
CustomHealthIndicator --> "-healthCheckRepository" HealthCheckRepository
CustomHealthIndicator --> "-healthChecker" AsynchronousHealthChecker
MemoryHealthIndicator --> "-asynchronousHealthChecker" AsynchronousHealthChecker
@enduml
@@ -0,0 +1,68 @@
@startuml
package com.iluwatar.logaggregation {
class App {
+ App()
+ main(args : String[]) {static}
}
class CentralLogStore {
- LOGGER : Logger {static}
- logs : ConcurrentLinkedQueue<LogEntry>
+ CentralLogStore()
+ displayLogs()
+ storeLog(logEntry : LogEntry)
}
class LogAggregator {
- BUFFER_THRESHOLD : int {static}
- LOGGER : Logger {static}
- buffer : ConcurrentLinkedQueue<LogEntry>
- centralLogStore : CentralLogStore
- executorService : ExecutorService
- logCount : AtomicInteger
- minLogLevel : LogLevel
+ LogAggregator(centralLogStore : CentralLogStore, minLogLevel : LogLevel)
+ collectLog(logEntry : LogEntry)
- flushBuffer()
- startBufferFlusher()
+ stop()
}
class LogEntry {
- level : LogLevel
- message : String
- serviceName : String
- timestamp : LocalDateTime
+ LogEntry(serviceName : String, level : LogLevel, message : String, timestamp : LocalDateTime)
# canEqual(other : Object) : boolean
+ equals(o : Object) : boolean
+ getLevel() : LogLevel
+ getMessage() : String
+ getServiceName() : String
+ getTimestamp() : LocalDateTime
+ hashCode() : int
+ setLevel(level : LogLevel)
+ setMessage(message : String)
+ setServiceName(serviceName : String)
+ setTimestamp(timestamp : LocalDateTime)
+ toString() : String
}
enum LogLevel {
+ DEBUG {static}
+ ERROR {static}
+ INFO {static}
+ valueOf(name : String) : LogLevel {static}
+ values() : LogLevel[] {static}
}
class LogProducer {
- LOGGER : Logger {static}
- aggregator : LogAggregator
- serviceName : String
+ LogProducer(serviceName : String, aggregator : LogAggregator)
+ generateLog(level : LogLevel, message : String)
}
}
LogAggregator --> "-centralLogStore" CentralLogStore
LogEntry --> "-level" LogLevel
CentralLogStore --> "-logs" LogEntry
LogAggregator --> "-buffer" LogEntry
LogAggregator --> "-minLogLevel" LogLevel
LogProducer --> "-aggregator" LogAggregator
@enduml
-1
View File
@@ -32,7 +32,6 @@
<groupId>com.iluwatar</groupId>
<version>1.26.0-SNAPSHOT</version>
</parent>
<groupId>com.iluwatar</groupId>
<artifactId>model-view-viewmodel</artifactId>
<version>1.26.0-SNAPSHOT</version>
<properties>
@@ -0,0 +1,59 @@
@startuml
package com.iluwatar.repository {
interface JpaRepository<T> {
+ findById(long) : T {abstract}
+ getEntityVersionById(long) : int {abstract}
+ update(T) : int {abstract}
}
}
package com.iluwatar.api {
interface UpdateService<T> {
+ doUpdate(T, long) : T {abstract}
}
}
package com.iluwatar.service {
class CardUpdateService {
- cardJpaRepository : JpaRepository<Card>
+ CardUpdateService(cardJpaRepository : JpaRepository<Card>)
+ doUpdate(obj : Card, id : long) : Card
}
}
package com.iluwatar.model {
class Card {
- id : long
- personId : long
- sum : float
- version : int
+ Card()
+ Card(id : long, personId : long, sum : float, version : int)
+ builder() : CardBuilder {static}
# canEqual(other : Object) : boolean
+ equals(o : Object) : boolean
+ getId() : long
+ getPersonId() : long
+ getSum() : float
+ getVersion() : int
+ hashCode() : int
+ setId(id : long)
+ setPersonId(personId : long)
+ setSum(sum : float)
+ setVersion(version : int)
+ toString() : String
}
class CardBuilder {
- id : long
- personId : long
- sum : float
- version : int
~ CardBuilder()
+ build() : Card
+ id(id : long) : CardBuilder
+ personId(personId : long) : CardBuilder
+ sum(sum : float) : CardBuilder
+ toString() : String
+ version(version : int) : CardBuilder
}
}
CardUpdateService --> "-cardJpaRepository" JpaRepository
CardUpdateService ..|> UpdateService
@enduml
+122
View File
@@ -0,0 +1,122 @@
@startuml
package com.iluwatar.slob.lob {
class Animal {
- animalsEaten : Set<Animal>
- name : String
- plantsEaten : Set<Plant>
+ Animal()
+ Animal(name : String, plantsEaten : Set<Plant>, animalsEaten : Set<Animal>)
# canEqual(other : Object) : boolean
+ createObjectFromXml(node : Node)
+ equals(o : Object) : boolean
+ getAnimalsEaten() : Set<Animal>
+ getName() : String
+ getPlantsEaten() : Set<Plant>
+ hashCode() : int
# iterateXmlForAnimalAndPlants(childNodes : NodeList, animalsEaten : Set<Animal>, plantsEaten : Set<Plant>) {static}
+ setAnimalsEaten(animalsEaten : Set<Animal>)
+ setName(name : String)
+ setPlantsEaten(plantsEaten : Set<Plant>)
+ toString() : String
+ toXmlElement(xmlDoc : Document) : Element
}
class Forest {
- animals : Set<Animal>
- name : String
- plants : Set<Plant>
+ Forest()
+ Forest(name : String, animals : Set<Animal>, plants : Set<Plant>)
# canEqual(other : Object) : boolean
+ createObjectFromXml(document : Document)
+ equals(o : Object) : boolean
+ getAnimals() : Set<Animal>
+ getName() : String
+ getPlants() : Set<Plant>
- getXmlDoc() : Document
+ hashCode() : int
+ setAnimals(animals : Set<Animal>)
+ setName(name : String)
+ setPlants(plants : Set<Plant>)
+ toString() : String
+ toXmlElement() : Element
}
class Plant {
- name : String
- type : String
+ Plant()
+ Plant(name : String, type : String)
# canEqual(other : Object) : boolean
+ createObjectFromXml(node : Node)
+ equals(o : Object) : boolean
+ getName() : String
+ getType() : String
+ hashCode() : int
+ setName(name : String)
+ setType(type : String)
+ toString() : String
+ toXmlElement(xmlDoc : Document) : Element
}
}
package com.iluwatar.slob.serializers {
class BlobSerializer {
+ TYPE_OF_DATA_FOR_DB : String {static}
+ BlobSerializer()
+ deSerialize(toDeserialize : Object) : Forest
+ serialize(toSerialize : Forest) : Object
}
class ClobSerializer {
+ TYPE_OF_DATA_FOR_DB : String {static}
+ ClobSerializer()
+ deSerialize(toDeserialize : Object) : Forest
- elementToXmlString(node : Element) : String {static}
+ serialize(forest : Forest) : Object
}
abstract class LobSerializer {
- databaseService : DatabaseService
# LobSerializer(dataTypeDb : String)
+ close()
+ deSerialize(Object) : Forest {abstract}
+ loadFromDb(id : int, columnName : String) : Object
+ persistToDb(id : int, name : String, object : Object) : int
+ serialize(Forest) : Object {abstract}
}
}
package com.iluwatar.slob.dbservice {
class DatabaseService {
+ BINARY_DATA : String {static}
+ CREATE_BINARY_SCHEMA_DDL : String {static}
+ CREATE_TEXT_SCHEMA_DDL : String {static}
- DB_URL : String {static}
+ DELETE_SCHEMA_SQL : String {static}
- INSERT : String {static}
- LOGGER : Logger {static}
- SELECT : String {static}
- dataSource : DataSource {static}
+ dataTypeDb : String
+ DatabaseService(dataTypeDb : String)
- createDataSource() : DataSource {static}
+ insert(id : int, name : String, data : Object)
+ select(id : long, columnsName : String) : Object
+ shutDownService()
+ startupService()
}
}
package com.iluwatar.slob {
class App {
+ CLOB : String {static}
- LOGGER : Logger {static}
+ App()
- createForest() : Forest {static}
- createLobSerializer(args : String[]) : LobSerializer {static}
- executeSerializer(forest : Forest, lobSerializer : LobSerializer) {static}
+ main(args : String[]) {static}
}
}
Animal --> "-plantsEaten" Plant
LobSerializer --> "-databaseService" DatabaseService
Forest --> "-animals" Animal
Forest --> "-plants" Plant
Animal --> "-animalsEaten" Animal
BlobSerializer --|> LobSerializer
ClobSerializer --|> LobSerializer
@enduml
-5
View File
@@ -68,11 +68,6 @@
<groupId>com.h2database</groupId>
<version>2.2.220</version>
</dependency>
<dependency>
<artifactId>lombok</artifactId>
<groupId>org.projectlombok</groupId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,29 @@
@startuml
package com.iluwatar {
abstract class AbstractThreadLocalExample {
- RANDOM_THREAD_PARK_END : Integer {static}
- RANDOM_THREAD_PARK_START : Integer {static}
- RND : SecureRandom {static}
+ AbstractThreadLocalExample()
- getThreadName() : String
# getter() : Supplier<Integer> {abstract}
+ run()
# setter() : Consumer<Integer> {abstract}
}
class WithThreadLocal {
- value : ThreadLocal<Integer>
+ WithThreadLocal(value : ThreadLocal<Integer>)
# getter() : Supplier<Integer>
+ remove()
# setter() : Consumer<Integer>
}
class WithoutThreadLocal {
- value : Integer
+ WithoutThreadLocal(value : Integer)
# getter() : Supplier<Integer>
# setter() : Consumer<Integer>
}
}
WithThreadLocal --|> AbstractThreadLocalExample
WithoutThreadLocal --|> AbstractThreadLocalExample
@enduml