// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) deadcode 
// Source File Name:   ExecutionContext.java

package com.symantec.itools.lang;

import com.symantec.itools.util.KeyNotFoundException;
import com.symantec.itools.util.Properties;
import java.io.IOException;
import java.io.PrintStream;

// Referenced classes of package com.symantec.itools.lang:
//            AccessiblePlatform, Debug, ExecutionContextParser

public class ExecutionContext
{

    protected ExecutionContext()
    {
    }

    public ExecutionContext(String s, int i)
    {
        try
        {
            parser = (ExecutionContextParser)parserClass.newInstance();
            parser.parse(s, i);
            return;
        }
        catch(InstantiationException instantiationexception)
        {
            instantiationexception.printStackTrace();
            return;
        }
        catch(IllegalAccessException illegalaccessexception)
        {
            illegalaccessexception.printStackTrace();
        }
    }

    private static Class lookupParser()
    {
        return lookupParser(AccessiblePlatform.getJavaVendor(), AccessiblePlatform.getJavaVersion(), AccessiblePlatform.getOSName(), AccessiblePlatform.getOSVersion(), AccessiblePlatform.getOSType(), AccessiblePlatform.getArchitecture());
    }

    private static Class lookupParser(String s, String s1, String s2, String s3, String s4, String s5)
    {
        try
        {
            Properties properties = new Properties("/com/symantec/itools/lang/ExecutionContext.properties");
            if(s == null)
                if(class$com$symantec$itools$lang$DefaultExecutionContextParser != null)
                    return class$com$symantec$itools$lang$DefaultExecutionContextParser;
                else
                    return class$com$symantec$itools$lang$DefaultExecutionContextParser = _mthclass$("com.symantec.itools.lang.DefaultExecutionContextParser");
            properties = properties.getProperties(s);
            if(properties != null)
            {
                Class class1 = lookupParser(properties, s + s1 + s2 + s3 + s5);
                if(class1 == null)
                {
                    class1 = lookupParser(properties, s + s1 + s4 + s5);
                    if(class1 == null)
                    {
                        class1 = lookupParser(properties, s + s1 + s5);
                        if(class1 == null)
                        {
                            class1 = lookupParser(properties, s + s1);
                            if(class1 == null)
                                class1 = lookupParser(properties, s);
                        }
                    }
                }
                if(class1 != null)
                    return class1;
            }
        }
        catch(IOException ioexception)
        {
            ioexception.printStackTrace();
        }
        catch(Throwable throwable)
        {
            throwable.printStackTrace();
        }
        if(class$com$symantec$itools$lang$DefaultExecutionContextParser != null)
            return class$com$symantec$itools$lang$DefaultExecutionContextParser;
        else
            return class$com$symantec$itools$lang$DefaultExecutionContextParser = _mthclass$("com.symantec.itools.lang.DefaultExecutionContextParser");
    }

    private static Class lookupParser(Properties properties, String s)
    {
        try
        {
            return properties.getClass(s);
        }
        catch(ClassNotFoundException _ex) { }
        catch(KeyNotFoundException _ex) { }
        return null;
    }

    public String getFile()
    {
        return parser.getFile();
    }

    public String getClazz()
    {
        return parser.getClazz();
    }

    public String getMethod()
    {
        return parser.getMethod();
    }

    public int getLine()
    {
        return parser.getLine();
    }

    public String toString()
    {
        int i = getLine();
        String s = i != -1 ? Integer.toString(i) : "unknown";
        return getFile() + " " + getClazz() + "." + getMethod() + "(" + s + ")";
    }

    public static void main(String args[])
    {
        System.out.println(Debug.getExecutionContext(0));
    }

    static Class _mthclass$(String s)
    {
        try
        {
            return Class.forName(s);
        }
        catch(ClassNotFoundException classnotfoundexception)
        {
            throw new NoClassDefFoundError(classnotfoundexception.getMessage());
        }
    }

    protected static Class parserClass = lookupParser();
    protected ExecutionContextParser parser;
    static Class class$com$symantec$itools$lang$DefaultExecutionContextParser; /* synthetic field */

}
