/*
 * Copyright (c) 2015 Stephan D. Cote' - All rights reserved.
 * 
 * This program and the accompanying materials are made available under the 
 * terms of the MIT License which accompanies this distribution, and is 
 * available at http://creativecommons.org/licenses/MIT/
 *
 * Contributors:
 *   Stephan D. Cote 
 *      - Initial concept and initial implementation
 */
package coyote.loader;

import coyote.loader.log.Log;


/**
 * 
 */
public class DefaultLoader extends AbstractLoader implements Loader {

  /** Tag used in various class identifying locations. */
  public static final String CLASS = "Loader";

  public static final String DEFAULT_DESCRIPTION = "Default component loader";




  public DefaultLoader() {

  }




  /**
   * Start the components running.
   */
  public void start() {
    // only run once, this is not foolproof as the active flag is set only when 
    // the watchdog loop is entered
    if ( isActive() ) {
      return;
    }

    // Save the name of the thread that is running this class
    final String oldName = Thread.currentThread().getName();

    // Rename this thread to the name of this class
    Thread.currentThread().setName( CLASS );

    // very important to get park(millis) to operate
    current_thread = Thread.currentThread();

    // Parse through the configuration and start setting up the component(s)
    initComponents();

    Log.info( "Components initialized" );

    // By this time all loggers (including the catch-all logger) should be open
    final StringBuffer b = new StringBuffer( CLASS );
    b.append( " initialized - Runtime: " );
    b.append( System.getProperty( "java.version" ) );
    b.append( " (" );
    b.append( System.getProperty( "java.vendor" ) );
    b.append( ")" );
    b.append( " - Platform: " );
    b.append( System.getProperty( "os.arch" ) );
    b.append( " OS: " );
    b.append( System.getProperty( "os.name" ) );
    b.append( " (" );
    b.append( System.getProperty( "os.version" ) );
    b.append( ")" );
    Log.info( b );

    // enter a loop performing watchdog and maintenance functions
    watchdog();

    // The watchdog loop has exited, so we are done processing
    Log.info( "Loader terminating" );

    // Rename the thread back to what it was called before we were being run
    Thread.currentThread().setName( oldName );

  }

}

@@ -422,16 +422,49 @@
 og.Log;%0A
+import coyote.loader.log.LogMsg;%0A
 %0A%0A/**%0A *
@@ -640,89 +640,16 @@
  = %22
-Loader%22;%0A%0A  public static final String DEFAULT_DESCRIPTION = %22Default component l
+DefaultL
 oade
@@ -775,19 +775,21 @@
 // only 
-run
+start
  once, t
@@ -1295,24 +1295,22 @@
 and 
-start setting up
+initialize all
  the
@@ -1323,11 +1323,9 @@
 nent
-(s)
+s
 %0A   
@@ -1362,10 +1362,35 @@
 fo( 
-%22C
+LogMsg.createMsg( %22Loader.c
 ompo
@@ -1394,17 +1394,17 @@
 mponents
- 
+_
 initiali
@@ -1407,16 +1407,18 @@
 ialized%22
+ )
  );%0A%0A   
@@ -2163,24 +2163,70 @@
 ing%0A    
-Log.info
+terminateComponents();%0A%0A    Log.info( LogMsg.createMsg
 ( %22Loade
@@ -2226,25 +2226,25 @@
  %22Loader
- 
+.
 terminat
 ing%22 );%0A
@@ -2239,12 +2239,13 @@
 inat
-ing%22
+ed%22 )
  );%0A

Use LogMsg for i18n in default loader