2424
2525import jpos .loader .*;
2626import jpos .util .*;
27- import jpos . util . tracing . Tracer ;
28- import jpos . util . tracing . TracerFactory ;
27+ import org . slf4j . Logger ;
28+ import org . slf4j . LoggerFactory ;
2929
3030/**
3131 * Default implementation of the CompositeRegPopulator interface
3434 */
3535public class DefaultCompositeRegPopulator implements CompositeRegPopulator
3636{
37+ private static final Logger log = LoggerFactory .getLogger (DefaultCompositeRegPopulator .class );
38+
3739 //-------------------------------------------------------------------------
3840 // Ctor(s)
3941 //
@@ -91,27 +93,23 @@ private JposRegPopulator createPopulator( String popName, String className )
9193 }
9294 catch ( ClassNotFoundException cnfe )
9395 {
94- tracer .println ( "Could not find populator class with name: " +
95- className + " exception message = " +
96- cnfe .getMessage () );
96+ log .error ( "Could not find populator class with name: {} exception message = {}" ,
97+ className , cnfe .getMessage () );
9798 }
9899 catch ( NoSuchMethodException nsme )
99100 {
100- tracer .println ( "Populator by class name: " +
101- className +
102- " must define a no-arg ctor or a 1-arg ctor with String param as the unique ID" );
101+ log .error ( "Populator by class name: {} must define a no-arg ctor or a 1-arg ctor with String param as the unique ID" ,
102+ className );
103103 }
104104 catch ( InstantiationException ie )
105105 {
106- tracer .println ( "Could not instantiate populator class with name: " +
107- className + " exception message = " +
108- ie .getMessage () );
106+ log .error ( "Could not instantiate populator class with name: {} exception message = {}" ,
107+ className , ie .getMessage () );
109108 }
110109 catch ( Exception e )
111110 {
112- tracer .println ( "Could not instantiate populator class with name: " +
113- className + " exception message = " +
114- e .getMessage () );
111+ log .error ( "Could not instantiate populator class with name: {} exception message = {}" ,
112+ className , e .getMessage () );
115113 }
116114
117115 return populator ;
@@ -187,9 +185,7 @@ public void save( @SuppressWarnings("rawtypes") Enumeration entries ) throws Exc
187185 List <JposEntry > entryList = popEntriesMap .get ( populator .getUniqueId () );
188186
189187 if ( entryList == null )
190- tracer .println ( "Trying to save entry with logicalName = " +
191- entry .getLogicalName () +
192- " and populator with" );
188+ log .debug ( "Trying to save entry with logicalName = {} and populator with entry list null" , entry .getLogicalName () );
193189 else
194190 entryList .add ( entry );
195191 }
@@ -214,8 +210,7 @@ public void save( @SuppressWarnings("rawtypes") Enumeration entries ) throws Exc
214210 catch ( Exception e )
215211 {
216212 exception = e ;
217- tracer .println ( "Error while saving to populator with unique ID:" +
218- populator .getUniqueId () );
213+ log .error ( "Error while saving to populator with unique ID: {}" , populator .getUniqueId () );
219214 }
220215 }
221216
@@ -254,7 +249,7 @@ public void load()
254249
255250 if ( populatorClassMultiProp == null || populatorClassMultiProp .getNumberOfProperties () == 0 )
256251 {
257- tracer . println ( "CompositeRegPopulator.load() w/o any defined multi-property" );
252+ log . error ( "CompositeRegPopulator.load() w/o any defined multi-property" );
258253 throw new IllegalArgumentException ( "CompositeRegPopulator.load() w/o any defined multi-property" );
259254 }
260255
@@ -281,8 +276,7 @@ public void load()
281276 }
282277 else
283278 {
284- tracer .println ( "Created default populator with name = " + defaultPopName +
285- " OK but populator file is null" );
279+ log .debug ( "Created default populator with name = {} OK but populator file is null" , defaultPopName );
286280 defaultPopulator .load ();
287281 lastLoadException = defaultPopulator .getLastLoadException ();
288282 }
@@ -296,8 +290,7 @@ public void load()
296290 setDefaultPopulator ( defaultPopulator );
297291 }
298292 else
299- tracer .println ( "Did not add default populator by <name, className>: " +
300- "<" + defaultPopName + ", " + defaultPopClass + ">" );
293+ log .debug ( "Did not add default populator by <name, className>: <{}, {}>" , defaultPopName , defaultPopClass );
301294 while ( popClasses .hasNext () )
302295 {
303296 String popName = popClasses .next ();
@@ -316,17 +309,15 @@ public void load()
316309 }
317310 else
318311 {
319- tracer .println ( "Created populator with name = " + popName +
320- " OK but populator file is null" );
312+ log .debug ( "Created populator with name = {} OK but populator file is null" , popName );
321313 populator .load ();
322314 lastLoadException = populator .getLastLoadException ();
323315 }
324316
325317 add ( populator );
326318 }
327319 else
328- tracer .println ( "Did not add populator by <name, className>: " +
329- "<" + popName + ", " + popClass + ">" );
320+ log .debug ( "Did not add populator by <name, className>: <{}, {}>" , popName , popClass );
330321 }
331322 }
332323
@@ -432,7 +423,4 @@ public JposRegPopulator getPopulator( String uniqueId )
432423 private HashMap <String , String > popFileMap = new HashMap <>();
433424 private JposRegPopulator defaultPop = null ;
434425 private Exception lastLoadException = null ;
435-
436- private Tracer tracer = TracerFactory .getInstance ().
437- createTracer ( "DefaultCompositeRegPopulator" );
438426}
0 commit comments