FileDocCategorySizeDatePackage
Processor.javaAPI DocAndroid 1.5 API3416Wed May 06 22:41:16 BST 2009com.vladium.emma

Processor

public abstract class Processor extends Object
author
Vlad Roubtsov, (C) 2004

Fields Summary
protected String
m_appName
protected com.vladium.util.IProperties
m_propertyOverrides
protected com.vladium.logging.Logger
m_log
Constructors Summary
protected Processor()

        // not publicly instantiable
    
Methods Summary
protected abstract void_run(com.vladium.util.IProperties toolProperties)

public synchronized voidrun()

        validateState ();
        
        // load tool properties:
        final IProperties toolProperties;
        {
            final IProperties appProperties = EMMAProperties.getAppProperties ();
            
            toolProperties = IProperties.Factory.combine (m_propertyOverrides, appProperties);
        }
        if ($assert.ENABLED) $assert.ASSERT (toolProperties != null, "toolProperties is null"); // can be empty, though

        final Logger current = Logger.getLogger ();
        final Logger log = AppLoggers.create (m_appName, toolProperties, current);
        
        if (log.atTRACE1 ())
        {
            log.trace1 ("run", "complete tool properties:");
            toolProperties.list (log.getWriter ());
        }
        
        try
        {
            Logger.push (log);
            m_log = log;
        
            _run (toolProperties);
        }
        finally
        {
            if (m_log != null)
            {
                Logger.pop (m_log);
                m_log = null;
            }
        }
    
public final synchronized voidsetAppName(java.lang.String appName)

        m_appName = appName;
    
public final synchronized voidsetPropertyOverrides(java.util.Properties overrides)

param
overrides [may be null (unsets the previous overrides)]

        m_propertyOverrides = EMMAProperties.wrap (overrides);
    
public final synchronized voidsetPropertyOverrides(com.vladium.util.IProperties overrides)

param
overrides [may be null (unsets the previous overrides)]

        m_propertyOverrides = overrides;
    
protected voidvalidateState()

        // no Processor state needs validation
        
        // [m_appName allowed to be null]
        // [m_propertyOverrides allowed to be null]