Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log for javapos-config-loader

## 5.0.0

- replaced legacy logging implementation by the logging facade SLF4J version 1, see https://www.slf4j.org/ for details on how to integrate

## 4.0.2

- fixed resource loading from JAR file on the class-path (contributed by @art-and-co through [PR #13](https://github.com/JavaPOSWorkingGroup/javapos-config-loader/issues/13))
Expand Down
17 changes: 11 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ plugins {
id 'signing'
id 'eclipse'
id 'maven-publish'
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
id 'project-report'
}


wrapper {
gradleVersion = '8.12.1'
gradleVersion = '8.14.3'
}


Expand All @@ -26,8 +26,8 @@ wrapper {
///////////////////////////////////////////////////////////////////////////////

def artifactName = 'javapos-config-loader'
group='org.javapos'
version='4.0.2' // if version is going to be changed, first add "-SNAPSHOT" to test publishing to MavenCentral's Snapshot repo
group = 'org.javapos'
version = '5.0.0-SNAPSHOT' // if version is going to be changed, first add "-SNAPSHOT" to test publishing to MavenCentral's Snapshot repo


///////////////////////////////////////////////////////////////////////////////
Expand All @@ -42,7 +42,7 @@ repositories {
{
logger.warn("WARN: Seems not to be a release, so Maven Central SNAPSHOT repository is fetched!");
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
url = 'https://oss.sonatype.org/content/repositories/snapshots'
}
}

Expand All @@ -65,9 +65,11 @@ def testResourceDir = file("${System.properties['java.io.tmpdir']}/javapos-confi

dependencies {
api 'org.javapos:javapos-contracts:1.6.0'
implementation 'org.slf4j:slf4j-api:1.7.36'

testImplementation("junit:junit:4.13.2")

testRuntimeOnly 'org.slf4j:slf4j-simple:1.7.36'
testRuntimeOnly files(testResourceDir)
}

Expand Down Expand Up @@ -140,7 +142,10 @@ test.dependsOn prepareTestConfiguration

nexusPublishing {
repositories {
sonatype()
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
6 changes: 4 additions & 2 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 12 additions & 10 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// for enabling Gradle scan at GitHub Actions
plugins {
id("com.gradle.enterprise") version("3.15")
id("com.gradle.develocity") version "4.3"
}

rootProject.name = 'javapos-config-loader'
Expand All @@ -25,13 +25,11 @@ def includeBuildProject(projectName) {
}

// enabling Gradle scan by agreeing to term of service
gradleEnterprise {
if (System.getenv("CI") != null) {
buildScan {
publishAlways()
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}

develocity {
buildScan {
publishing.onlyIf { System.getenv("CI") != null }
termsOfUseUrl = "https://gradle.com/terms-of-service"
termsOfUseAgree = "yes"
}
}

50 changes: 19 additions & 31 deletions src/main/java/jpos/config/DefaultCompositeRegPopulator.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import jpos.loader.*;
import jpos.util.*;
import jpos.util.tracing.Tracer;
import jpos.util.tracing.TracerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Default implementation of the CompositeRegPopulator interface
Expand All @@ -34,6 +34,8 @@
*/
public class DefaultCompositeRegPopulator implements CompositeRegPopulator
{
private static final Logger log = LoggerFactory.getLogger(DefaultCompositeRegPopulator.class);

//-------------------------------------------------------------------------
// Ctor(s)
//
Expand Down Expand Up @@ -91,27 +93,23 @@ private JposRegPopulator createPopulator( String popName, String className )
}
catch( ClassNotFoundException cnfe )
{
tracer.println( "Could not find populator class with name: " +
className + " exception message = " +
cnfe.getMessage() );
log.error( "Could not find populator class with name: {} exception message = {}",
className, cnfe.getMessage() );
}
catch( NoSuchMethodException nsme )
{
tracer.println( "Populator by class name: " +
className +
" must define a no-arg ctor or a 1-arg ctor with String param as the unique ID" );
log.error( "Populator by class name: {} must define a no-arg ctor or a 1-arg ctor with String param as the unique ID",
className );
}
catch( InstantiationException ie )
{
tracer.println( "Could not instantiate populator class with name: " +
className + " exception message = " +
ie.getMessage() );
log.error( "Could not instantiate populator class with name: {} exception message = {}",
className, ie.getMessage() );
}
catch( Exception e )
{
tracer.println( "Could not instantiate populator class with name: " +
className + " exception message = " +
e.getMessage() );
log.error( "Could not instantiate populator class with name: {} exception message = {}",
className, e.getMessage() );
}

return populator;
Expand Down Expand Up @@ -187,9 +185,7 @@ public void save( @SuppressWarnings("rawtypes") Enumeration entries ) throws Exc
List<JposEntry> entryList = popEntriesMap.get( populator.getUniqueId() );

if( entryList == null )
tracer.println( "Trying to save entry with logicalName = " +
entry.getLogicalName() +
" and populator with" );
log.debug( "Trying to save entry with logicalName = {} and populator with entry list null", entry.getLogicalName() );
else
entryList.add( entry );
}
Expand All @@ -214,8 +210,7 @@ public void save( @SuppressWarnings("rawtypes") Enumeration entries ) throws Exc
catch( Exception e )
{
exception = e;
tracer.println( "Error while saving to populator with unique ID:" +
populator.getUniqueId() );
log.error( "Error while saving to populator with unique ID: {}", populator.getUniqueId() );
}
}

Expand Down Expand Up @@ -254,7 +249,7 @@ public void load()

if( populatorClassMultiProp == null || populatorClassMultiProp.getNumberOfProperties() == 0 )
{
tracer.println( "CompositeRegPopulator.load() w/o any defined multi-property" );
log.error( "CompositeRegPopulator.load() w/o any defined multi-property" );
throw new IllegalArgumentException( "CompositeRegPopulator.load() w/o any defined multi-property" );
}

Expand All @@ -281,8 +276,7 @@ public void load()
}
else
{
tracer.println( "Created default populator with name = " + defaultPopName +
" OK but populator file is null" );
log.debug( "Created default populator with name = {} OK but populator file is null", defaultPopName );
defaultPopulator.load();
lastLoadException = defaultPopulator.getLastLoadException();
}
Expand All @@ -296,8 +290,7 @@ public void load()
setDefaultPopulator( defaultPopulator );
}
else
tracer.println( "Did not add default populator by <name, className>: " +
"<" + defaultPopName + ", " + defaultPopClass + ">" );
log.debug( "Did not add default populator by <name, className>: <{}, {}>", defaultPopName, defaultPopClass);
while( popClasses.hasNext() )
{
String popName = popClasses.next();
Expand All @@ -316,17 +309,15 @@ public void load()
}
else
{
tracer.println( "Created populator with name = " + popName +
" OK but populator file is null" );
log.debug( "Created populator with name = {} OK but populator file is null", popName );
populator.load();
lastLoadException = populator.getLastLoadException();
}

add( populator );
}
else
tracer.println( "Did not add populator by <name, className>: " +
"<" + popName + ", " + popClass + ">" );
log.debug( "Did not add populator by <name, className>: <{}, {}>", popName, popClass );
}
}

Expand Down Expand Up @@ -432,7 +423,4 @@ public JposRegPopulator getPopulator( String uniqueId )
private HashMap<String, String> popFileMap = new HashMap<>();
private JposRegPopulator defaultPop = null;
private Exception lastLoadException = null;

private Tracer tracer = TracerFactory.getInstance().
createTracer( "DefaultCompositeRegPopulator" );
}
Loading
Loading