You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/04/06 07:39:34 UTC

[12/26] fork a bunch of files from SDK's FB compiler integration. Several files are intact, but many have been gutted to reduce the number of files required. It appears that the Report isn't used for basic compilation, so removing all of the compilatio

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/util/NameFormatter.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/util/NameFormatter.java b/flex-compiler-oem/src/flex2/compiler/util/NameFormatter.java
new file mode 100644
index 0000000..b03cf51
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/util/NameFormatter.java
@@ -0,0 +1,171 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.compiler.util;
+
+import flex2.compiler.Source;
+import flex2.compiler.SymbolTable;
+import flex2.compiler.mxml.lang.StandardDefs;
+//import flex2.compiler.swc.SwcScript;
+
+/**
+ * AS3 definition name conversion utilities.
+ */
+/*
+ * TODO need to migrate away from having both colon- and dot-delimited classnames encoded in Strings. It's
+ * impossible to tell except from (sometimes nonlocal) context whether 'String className' means dot-format or
+ * colon-format, and since source code requires one and the reflection system needs the other, this is an ongoing
+ * source of bugs, confusion etc. Eventually, all colon-delimited classnames should be stored as QNames -
+ * qname.toString() is (now) a reasonably cheap way to recover the colon-delimited format. The goal is to get the
+ * code to the point that 'String className' can be assumed to be a classname in dot format. The sign that we've
+ * succeeded will be the successful removal of NameFormatter.toColon(String, String).
+ *
+ * TODO remove inline ':' -> '.' type code from the codebase, call these methods instead.
+ * TODO once the abstraction is clear, "toColon"/"toDot" should be renamed to reflect the semantics of the names rather
+ * than the actual characters involved: "toInternal", "toExternal" or whatever. But for now I can never remember which
+ * is which.
+ */
+public class NameFormatter
+{
+	/**
+	 * convert pair of strings to single string delimited by '.'
+	 */
+	public static String toDot(String ns, String n)
+	{
+		return ns.length() > 0 ? ns + '.' + n : n;
+	}
+
+	/**
+	 * convert pair of strings to single string delimited by ':'
+	 */
+	public static String toColon(String ns, String n)
+	{
+		return ns.length() > 0 ? (ns + ':' + n).intern() : n;
+	}
+
+	/**
+	 * convert p.q:C to p.q.C
+	 * NOTE: idempotent
+	 */
+	public static String toDot(String n)
+	{
+		assert n.indexOf('/') == -1;
+		return toDot(n, ':');
+	}
+
+	/**
+	 *
+	 */
+	public static String toDot(QName qname)
+	{
+		return toDot(qname.getNamespace(), qname.getLocalPart());
+	}
+
+	/**
+	 * convert <strong>all instances</strong> of <code>delimiter</code> with '.'.
+	 */
+	public static String toDot(String n, char delimiter)
+	{
+		return n.replace(delimiter, '.');
+	}
+
+	/**
+	 * convert p.q.C to p.q:C
+	 * NOTE: idempotent
+	 */
+	public static String toColon(String n)
+	{
+        String result;
+
+        if (n.startsWith(StandardDefs.CLASS_VECTOR))
+        {
+            result = SymbolTable.VECTOR + n.substring(StandardDefs.CLASS_VECTOR.length());
+        }
+        else if (n.startsWith(SymbolTable.VECTOR))
+        {
+            result = n;
+        }
+        else
+        {
+            int i = toDot(n).lastIndexOf('.');
+            result = i > 0 ? (n.substring(0, i) + ':' + n.substring(i + 1)).intern() : n;
+        }
+
+        return result;
+	}
+
+	/**
+	 *
+	 */
+	public static String toDotStar(String pkg)
+	{
+		return pkg + ".*";
+	}
+
+	/**
+	 * retrieve package name from qualified name (dot or slash format ok)
+	 */
+	public static String retrievePackageName(String n)
+	{
+		int i = toDot(n).lastIndexOf('.');
+		return i == -1 ? "" : n.substring(0, i);
+	}
+
+    /**
+     * just removes $internal from package name.   
+     */
+	public static String normalizePackageName(String n)
+	{
+        return n.endsWith("$internal") ? n.substring(0, n.length() - "$internal".length()) : n;
+    }
+
+	/**
+	 * retrieve class name from qualified name (dot or slash format ok)
+	 */
+	public static String retrieveClassName(String n)
+	{
+        String result;
+        String toDot = toDot(n);
+
+        if (toDot.startsWith(StandardDefs.CLASS_VECTOR + ".<"))
+        {
+            result = "Vector" + n.substring(StandardDefs.CLASS_VECTOR.length() + 1);
+        }
+        else
+        {
+            int i = toDot.lastIndexOf('.');
+            result = i == -1 ? n : n.substring(i + 1);
+        }
+
+        return result;
+	}
+
+	/**
+	 * convert name (dot or slash format ok) to QName
+	 */
+	public static QName toQName(String n)
+	{
+		int i = toDot(n).lastIndexOf('.');
+		return i >= 0 ?
+				new QName(n.substring(0, i), n.substring(i + 1)) :
+				new QName("", n);
+	}
+
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/util/PerformanceData.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/util/PerformanceData.java b/flex-compiler-oem/src/flex2/compiler/util/PerformanceData.java
new file mode 100644
index 0000000..d948d25
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/util/PerformanceData.java
@@ -0,0 +1,47 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.compiler.util;
+
+/**
+ * Data to describe the performance of a class method.
+ * 
+ * Contains the number of times the method was called and the total
+ * amount of time in the method.
+ * 
+ * @author dloverin
+ */
+public class PerformanceData
+{
+    /**
+     * Number of time a method was invoked.
+     */
+    public long invocationCount;
+
+    /**
+     * Total amount of time (ms) in a method.
+     */
+    public long totalTime;
+    
+    
+    public PerformanceData()
+    {
+        
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/util/QName.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/util/QName.java b/flex-compiler-oem/src/flex2/compiler/util/QName.java
new file mode 100644
index 0000000..2ee0016
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/util/QName.java
@@ -0,0 +1,160 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.compiler.util;
+
+import flex2.compiler.SymbolTable;
+
+/**
+ * This class represents a namespace URI and local part.
+ *
+ * @author Clement Wong
+ */
+public final class QName extends Name
+{
+	public static final String DEFAULT_NAMESPACE = SymbolTable.publicNamespace;
+
+	QName()
+	{
+		this(DEFAULT_NAMESPACE, "");
+	}
+
+	public QName(String qname)
+	{
+		int index = qname.indexOf(":");
+		if (index == -1)
+		{
+			namespaceURI = DEFAULT_NAMESPACE;
+			localPart = qname;
+		}
+		else
+		{
+			namespaceURI = qname.substring(0, index);
+			localPart = qname.substring(index + 1);
+		}
+		fullName = qname;
+	}
+
+	public QName(final String namespaceURI, final String localPart)
+	{
+		assert namespaceURI != null : "Null namespace";
+		this.namespaceURI = namespaceURI;
+		this.localPart = localPart;
+	}
+
+    public QName(final String namespaceURI, final String localPart, final String preferredPrefix)
+	{
+        this(namespaceURI, localPart);
+        this.preferredPrefix = preferredPrefix; 
+	}
+
+	public QName(QName qName)
+	{
+		assert qName.namespaceURI != null : "Null namespace";
+		namespaceURI = qName.namespaceURI;
+		localPart = qName.localPart;
+		fullName = qName.fullName;
+		preferredPrefix = qName.preferredPrefix;
+	}
+
+	private String namespaceURI;
+	private String fullName;
+	private String preferredPrefix;
+
+	public String getNamespace()
+	{
+		return namespaceURI;
+	}
+
+	public void setNamespace(String namespaceURI)
+	{
+		assert namespaceURI != null : "Null namespace";
+		this.namespaceURI = namespaceURI;
+	}
+
+    public String getPreferredPrefix()
+	{
+	    return preferredPrefix;
+	}
+
+	public boolean equals(String namespaceURI, String localPart)
+	{
+		assert namespaceURI != null : "Null namespace";
+
+		boolean result = this.namespaceURI.equals(namespaceURI) && this.localPart.equals(localPart);
+
+		return result;
+	}
+
+	public boolean equals(Object obj)
+	{
+		if (obj instanceof QName)
+		{
+			QName qName = (QName) obj;
+			return equals(qName.namespaceURI, qName.localPart);
+		}
+		/*
+		else if (obj instanceof MultiName)
+		{
+			MultiName mName = (MultiName) obj;
+			String[] ns = mName.getNamespace();
+			return (ns.length == 1 && ns[0].equals(namespaceURI) && mName.getLocalPart().equals(localPart));
+		}
+		*/
+		else
+		{
+			return false;
+		}
+	}
+
+	public int hashCode()
+	{
+		int result;
+
+		if (namespaceURI.length() != 0)
+		{
+			result = namespaceURI.hashCode() ^ super.hashCode();
+		}
+		else
+		{
+			result = super.hashCode();
+		}
+
+		return result;
+	}
+
+	public String toString()
+	{
+		if (namespaceURI.length() == 0)
+		{
+			return localPart;
+		}
+		else if (fullName != null)
+		{
+			return fullName;
+		}
+		else
+		{
+			StringBuilder b = new StringBuilder(namespaceURI.length() + localPart.length() + 1);
+			b.append(namespaceURI).append(':').append(localPart);
+			fullName = b.toString();
+			return fullName;
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/util/ThreadLocalToolkit.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/util/ThreadLocalToolkit.java b/flex-compiler-oem/src/flex2/compiler/util/ThreadLocalToolkit.java
new file mode 100644
index 0000000..e50bb77
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/util/ThreadLocalToolkit.java
@@ -0,0 +1,625 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.compiler.util;
+
+//import flash.localization.LocalizationManager;
+import flex2.compiler.ILocalizableMessage;
+import flex2.compiler.Logger;
+import flex2.compiler.Source;
+import flex2.compiler.common.PathResolver;
+import flex2.compiler.io.VirtualFile;
+import flex2.compiler.mxml.lang.StandardDefs;
+import flex2.tools.oem.ProgressMeter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A utility class that contains all the thread local variables used
+ * by the compiler.  These are mostly conveniences so that the
+ * variables don't have to be passed around to all the corners of the
+ * compiler via method parameters.  These represent potential memory
+ * leaks, though.  All the variables should be cleared at the end of a
+ * compilation.  Otherwise, if the thread used for compilation
+ * changes, lots of memory will be leaked with the old thread.
+ *
+ * @author Clement Wong
+ */
+public final class ThreadLocalToolkit
+{
+    private static ThreadLocal<Logger> logger = new ThreadLocal<Logger>();
+    private static ThreadLocal<PathResolver> resolver = new ThreadLocal<PathResolver>();
+    private static ThreadLocal<Map<String, VirtualFile>> resolved = new ThreadLocal<Map<String, VirtualFile>>();
+    private static ThreadLocal<Benchmark> stopWatch = new ThreadLocal<Benchmark>();
+    //private static ThreadLocal<LocalizationManager> localization = new ThreadLocal<LocalizationManager>();
+    private static ThreadLocal<MimeMappings> mimeMappings = new ThreadLocal<MimeMappings>();
+    private static ThreadLocal<ProgressMeter> progressMeter = new ThreadLocal<ProgressMeter>();
+    private static ThreadLocal<CompilerControl> compilerControl = new ThreadLocal<CompilerControl>();
+    private static ThreadLocal<StandardDefs> standardDefs = new ThreadLocal<StandardDefs>();
+    private static ThreadLocal<Integer> compatibilityVersion = new ThreadLocal<Integer>();
+
+    /*
+    //----------------------
+    // LocalizationManager
+    //----------------------
+
+    public static LocalizationManager getLocalizationManager()
+    {
+        return localization.get();
+    }
+
+    public static void setLocalizationManager(LocalizationManager mgr)
+    {
+        localization.set( mgr );
+    }
+    */
+    
+    //---------------
+    // PathResolver
+    //---------------
+
+    public static void setPathResolver(PathResolver r)
+    {
+        resolver.set(r);
+    }
+
+    public static void resetResolvedPaths()
+    {
+        resolved.set(null);
+    }
+
+    public static PathResolver getPathResolver()
+    {
+        return resolver.get();
+    }
+
+    public static void addResolvedPath(String path, VirtualFile virtualFile)
+    {
+        Map<String, VirtualFile> resolvedMap = resolved.get();
+        if (resolvedMap == null)
+        {
+            resolvedMap = new HashMap<String, VirtualFile>();
+            resolved.set(resolvedMap);
+        }
+
+        resolvedMap.put(path, virtualFile);
+    }
+
+    public static VirtualFile getResolvedPath(String path)
+    {
+        Map<String, VirtualFile> resolvedMap = resolved.get();
+        assert resolvedMap != null;
+        return (VirtualFile) resolvedMap.get(path);
+    }
+
+    //---------------
+    // Benchmarking
+    //---------------
+
+    public static void setBenchmark(Benchmark b)
+    {
+        stopWatch.set(b);
+    }
+
+    public static Benchmark getBenchmark()
+    {
+        return stopWatch.get();
+    }
+
+    public static void resetBenchmark()
+    {
+        Benchmark b = stopWatch.get();
+        if (b != null)
+        {
+            //b.start();
+        }
+    }
+
+    //---------------
+    // MimeMappings
+    //---------------
+
+    public static void setMimeMappings(MimeMappings mappings)
+    {
+        mimeMappings.set(mappings);
+    }
+    
+    static MimeMappings getMimeMappings()
+    {
+        return mimeMappings.get();
+    }
+    
+    //----------------
+    // ProgressMeter
+    //----------------
+
+    public static void setProgressMeter(ProgressMeter meter)
+    {
+        progressMeter.set(meter);
+    }
+    
+    public static ProgressMeter getProgressMeter()
+    {
+        return progressMeter.get();
+    }
+
+    //-------------------
+    // Compiler Control
+    //-------------------
+    
+    public static void setCompilerControl(CompilerControl cc)
+    {
+        compilerControl.set(cc);
+    }
+    
+    public static CompilerControl getCompilerControl()
+    {
+        return compilerControl.get();
+    }
+
+    //----------------
+    // Standard Defs
+    //----------------
+    public static void setStandardDefs(StandardDefs defs)
+    {
+        standardDefs.set(defs);
+    }
+
+    public static StandardDefs getStandardDefs()
+    {
+        StandardDefs defs = standardDefs.get();
+        if (defs == null)
+        {
+            defs = StandardDefs.getStandardDefs("halo");
+            setStandardDefs(defs);
+        }
+
+        return defs;
+    }
+
+    //---------
+    // Logger
+    //---------
+
+    public static void setLogger(Logger logger)
+    {
+        ThreadLocalToolkit.logger.set(logger);
+        if (logger != null)
+        {
+            //logger.setLocalizationManager( getLocalizationManager() );
+        }
+    }
+
+    public static Logger getLogger()
+    {
+        return logger.get();
+    }
+
+    //---------
+    // CompatibilityVersion
+    //---------
+
+    public static void setCompatibilityVersion(Integer compatibilityVersion)
+    {
+        ThreadLocalToolkit.compatibilityVersion.set(compatibilityVersion);
+    }
+
+    public static Integer getCompatibilityVersion()
+    {
+        assert compatibilityVersion.get() != null : "Entry point missing setCompatibilityVersion()";
+        return compatibilityVersion.get();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Logging Methods
+    //
+    //--------------------------------------------------------------------------
+    
+    public static int errorCount()
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            return l.errorCount();
+        }
+        else
+        {
+            return 0;
+        }
+    }
+
+    public static int warningCount()
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            return l.warningCount();
+        }
+        else
+        {
+            return 0;
+        }
+    }
+
+    public static void logInfo(String info)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logInfo(info);
+        }
+        else
+        {
+            System.out.println(info);
+        }
+    }
+
+    public static void logDebug(String debug)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logDebug(debug);
+        }
+        else
+        {
+            System.err.println(debug);
+        }
+    }
+
+    public static void logWarning(String warning)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logWarning(warning);
+        }
+        else
+        {
+            System.err.println(warning);
+        }
+    }
+
+    public static void logError(String error)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logError(error);
+        }
+        else
+        {
+            System.err.println(error);
+        }
+    }
+
+    public static void logInfo(String path, String info)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logInfo(path, info);
+        }
+        else
+        {
+            System.out.println(path + ":" + info);
+        }
+    }
+
+    public static void logDebug(String path, String debug)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logDebug(path, debug);
+        }
+        else
+        {
+            System.err.println(path + ":" + debug);
+        }
+    }
+
+    public static void logWarning(String path, String warning)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logWarning(path, warning);
+        }
+        else
+        {
+            System.err.println(path + ":" + warning);
+        }
+    }
+
+    public static void logWarning(String path, String warning, int errorCode)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logWarning(path, warning, errorCode);
+        }
+        else
+        {
+            System.err.println(path + ":" + warning);
+        }
+    }
+
+    public static void logError(String path, String error)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logError(path, error);
+        }
+        else
+        {
+            System.err.println(path + ":" + error);
+        }
+    }
+
+    public static void logError(String path, String error, int errorCode)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logError(path, error, errorCode);
+        }
+        else
+        {
+            System.err.println(path + ":" + error);
+        }
+    }
+
+    public static void logInfo(String path, int line, String info)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logInfo(path, line, info);
+        }
+        else
+        {
+            System.out.println(path + ": line " + line + " - " + info);
+        }
+    }
+
+    public static void logDebug(String path, int line, String debug)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logDebug(path, line, debug);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + " - " + debug);
+        }
+    }
+
+    public static void logWarning(String path, int line, String warning)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logWarning(path, line, warning);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + " - " + warning);
+        }
+    }
+
+    public static void logError(String path, int line, String error)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logError(path, line, error);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + " - " + error);
+        }
+    }
+
+    public static void logInfo(String path, int line, int col, String info)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logInfo(path, line, col, info);
+        }
+        else
+        {
+            System.out.println(path + ": line " + line + ", col " + col + " - " + info);
+        }
+    }
+
+    public static void logDebug(String path, int line, int col, String debug)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logDebug(path, line, col, debug);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + ", col " + col + " - " + debug);
+        }
+    }
+
+    public static void logWarning(String path, int line, int col, String warning)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logWarning(path, line, col, warning);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + ", col " + col + " - " + warning);
+        }
+    }
+
+    public static void logError(String path, int line, int col, String error)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logError(path, line, col, error);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + ", col " + col + " - " + error);
+        }
+    }
+
+    public static void logWarning(String path, int line, int col, String warning, String source)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logWarning(path, line, col, warning, source);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + ", col " + col + " - " + warning);
+            System.err.println(source);
+        }
+    }
+
+    public static void logWarning(String path, int line, int col, String warning, String source, int errorCode)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logWarning(path, line, col, warning, source, errorCode);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + ", col " + col + " - " + warning);
+            System.err.println(source);
+        }
+    }
+
+    public static void logError(String path, int line, int col, String error, String source)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logError(path, line, col, error, source);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + ", col " + col + " - " + error);
+            System.err.println(source);
+        }
+    }
+
+    public static void logError(String path, int line, int col, String error, String source, int errorCode)
+    {
+        Logger l = logger.get();
+        if (l != null)
+        {
+            l.logError(path, line, col, error, source, errorCode);
+        }
+        else
+        {
+            System.err.println(path + ": line " + line + ", col " + col + " - " + error);
+            System.err.println(source);
+        }
+    }
+
+    /**
+     * avoid passthrough ctors in CompilerMessages
+     */
+    public static void log(CompilerMessage m, String path, int line, int column)
+    {
+        m.path = path;
+        m.line = line;
+        m.column = column;
+        log(m);
+    }
+
+    public static void log(CompilerMessage m, String path, int line, int column, String source)
+    {
+        m.path = path;
+        m.line = line;
+        m.column = column;
+        log((ILocalizableMessage) m, source);
+    }
+
+    /**
+     *
+     */
+    public static void log(CompilerMessage m, String path, int line)
+    {
+        log(m, path, line, -1);
+    }
+
+    public static void log(CompilerMessage m, String path)
+    {
+        log(m, path, -1, -1);
+    }
+
+    public static void log(CompilerMessage m, Source s, int line)
+    {
+        m.path = s.getNameForReporting();
+        m.line = line;
+        log(m);
+    }
+
+    public static void log(CompilerMessage m, Source s, int line, int column)
+    {
+        m.path = s.getNameForReporting();
+        m.line = line;
+        m.column = column;
+        log(m);
+    }
+
+    public static void log(CompilerMessage m, Source s)
+    {
+        m.path = s.getNameForReporting();
+        log(m);
+    }
+
+    public static void log( ILocalizableMessage m )
+    {
+        Logger logger = getLogger();
+
+        if (logger != null)
+        {
+            logger.log( m );
+        }
+    }
+
+    public static void log( ILocalizableMessage m, String source)
+    {
+        Logger logger = getLogger();
+
+        if (logger != null)
+        {
+            logger.log( m, source );
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/linker/LinkerConfiguration.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/linker/LinkerConfiguration.java b/flex-compiler-oem/src/flex2/linker/LinkerConfiguration.java
new file mode 100644
index 0000000..97bbefe
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/linker/LinkerConfiguration.java
@@ -0,0 +1,207 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.linker;
+
+import java.util.List;
+import java.util.Set;
+import java.util.SortedSet;
+
+import flex2.compiler.common.FramesConfiguration.FrameInfo;
+
+/**
+ * This interface is used to restrict consumers of
+ * flex2.compiler.common.Configuration to linker specific options.
+ *
+ * @author Clement Wong
+ */
+public interface LinkerConfiguration
+{
+	// C: If you add a method here, please add it to
+	// flex2.tools.oem.internal.LinkerConfiguration as well.
+	
+    int backgroundColor();
+
+	/**
+	 * Generate SWFs for debugging.
+	 */
+	boolean debug();
+
+    boolean verboseStacktraces();
+
+	boolean optimize();
+
+	boolean useNetwork();
+
+	boolean lazyInit();
+
+    boolean scriptLimitsSet();
+
+    int getScriptTimeLimit();
+
+    int getScriptRecursionLimit();
+
+    int getFrameRate();
+
+    String getMetadata();
+
+    /**
+	 * The password to include in debuggable swfs.
+	 */
+	String debugPassword();
+
+    /**
+	 * SWF width
+	 */
+	String width();
+
+	int defaultWidth();
+
+	/**
+	 * SWF height
+	 */
+	String height();
+
+	int defaultHeight();
+	
+	/**
+	 * SWF height percentage
+	 */
+	String heightPercent();
+
+	/**
+	 * SWF width percentage
+	 */
+	String widthPercent();
+
+	/**
+	 * browser page title
+	 */
+	String pageTitle();
+
+    /**
+     * @param mainDefinition the name of the app class to instantiate
+     */
+    void setMainDefinition( String mainDefinition );
+    String getMainDefinition();
+
+    /**
+     * @return the name of the root SWF class
+     */
+    String getRootClassName();
+
+    /**
+     * @param rootClassName the name of the root SWF class
+     */
+    void setRootClassName( String rootClassName );
+
+    /**
+     * @return list of frame classes
+     */
+    List<FrameInfo> getFrameList();
+
+    /**
+     * @return set of configured external symbols
+     */
+    Set<String> getExterns();
+
+	/**
+	 * @return set of symbols to always include
+	 */
+	Set<String> getIncludes();
+
+    /**
+     * @return set of symbols that were not resolved (includes any referenced externs)
+     */
+    Set<String> getUnresolved();
+
+    /**
+     * @return name of compile report file, null if none
+     */
+    String getLinkReportFileName();
+    boolean generateLinkReport();
+    
+    /**
+     * @return name of size report file, null if none
+     */
+    String getSizeReportFileName();
+    boolean generateSizeReport();
+
+	/**
+	 * @return name of resource bundle list file, null if none
+	 */
+	String getRBListFileName();
+    boolean generateRBList();
+
+	/**
+	 * @return set of resource bundles for resource bundle list
+	 */
+	SortedSet<String> getResourceBundles();
+	
+	/**
+	 * @return the as3 metadata to keep
+	 */
+	String[] getMetadataToKeep();
+	
+	/**
+	 * @return true if the digest should be computed, false otherwise.
+	 */
+	 boolean getComputeDigest();
+     
+     String getCompatibilityVersionString();
+	 int getCompatibilityVersion();
+	 
+	 String getMinimumSupportedVersionString();
+	 int getMinimumSupportedVersion();
+
+	/**
+	 * @return The major version of the player targeted by this application.
+	 * 		   The returned value will be greater to or equal to 9.  
+	 */
+	 int getTargetPlayerMajorVersion();
+
+	/**
+	 * @return The minor version of the player targeted by this application.
+	 * 		   The returned value will be greater to or equal to 0.  
+	 */
+	 int getTargetPlayerMinorVersion();
+	
+	/**
+	 * @return The revision of the player targeted by this application.
+	 * 		   The returned value will be greater to or equal to 0.  
+	 */
+	 int getTargetPlayerRevision();
+	 
+	 /**
+	  * @return The version of the generated SWF file.
+	  */
+	 int getSwfVersion();
+	 
+	 boolean getUseGpu();
+	 
+	 boolean getUseDirectBlit();
+	
+	 /**
+	  * 
+	  * @return true if only inheritance 
+	  */
+	 boolean getIncludeInheritanceDependenciesOnly();
+	 
+	 boolean getAdvancedTelemetry();
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/linker/SimpleMovie.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/linker/SimpleMovie.java b/flex-compiler-oem/src/flex2/linker/SimpleMovie.java
new file mode 100644
index 0000000..7c6ce78
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/linker/SimpleMovie.java
@@ -0,0 +1,194 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.linker;
+
+import flash.swf.Movie;
+ 
+/**
+ * Represents a simple single frame Movie.  It's currently not
+ * instantiated directly.  Instead, it's subclasses for special
+ * purposes like an application SWF or a library SWF.
+ *
+ * @author Clement Wong
+ */
+public class SimpleMovie extends Movie
+{
+	/**
+	 * MD5 password is no longer needed for Flash Player. 
+	 * Use this dummy password instead of generating one.
+	 * @see http://bugs.adobe.com/jira/browse/SDK-27210
+	 */
+	private static final String NO_PASSWORD = "NO-PASSWORD";
+	
+	public SimpleMovie(LinkerConfiguration configuration)
+    {
+	    /*
+        if (configuration.width() != null)
+	    {
+		    try
+		    {
+			    width = Integer.parseInt(configuration.width());
+		    }
+		    catch(NumberFormatException nfe)
+		    {
+			    ThreadLocalToolkit.log(new PreLink.CouldNotParseNumber(configuration.width(), "width"));
+		    }
+	        userSpecifiedWidth = true;
+	    }
+	    else if (configuration.widthPercent() != null)
+	    {
+		    width = configuration.defaultWidth();
+	        widthPercent = configuration.widthPercent();
+	    }
+		else
+	    {
+		    width = configuration.defaultWidth();
+	    }
+
+	    if (configuration.height() != null)
+	    {
+		    try
+		    {
+			    height = Integer.parseInt(configuration.height());
+		    }
+		    catch(NumberFormatException nfe)
+		    {
+			    ThreadLocalToolkit.log(new PreLink.CouldNotParseNumber(configuration.height(), "height"));
+		    }
+	        userSpecifiedHeight = true;
+	    }
+	    else if (configuration.heightPercent() != null)
+	    {
+		    height = configuration.defaultHeight();
+	        heightPercent = configuration.heightPercent();
+	    }
+		else
+	    {
+		    height = configuration.defaultHeight();
+	    }
+
+		size = new Rect(width * 20, height * 20);
+
+        if ((configuration.scriptLimitsSet()))
+        {
+            scriptLimits = new ScriptLimits( configuration.getScriptRecursionLimit(),
+                                             configuration.getScriptTimeLimit() );
+        }
+
+        framerate = configuration.getFrameRate();
+		version = configuration.getSwfVersion();
+		bgcolor = new SetBackgroundColor(configuration.backgroundColor());
+		if (configuration.debug())
+		{
+			enableDebugger = new EnableDebugger(NO_PASSWORD);
+			uuid = new FlashUUID();
+		}
+
+        // SWF 8 File Attributes Support
+        if (version >= 8)
+        {
+            fileAttributes = new FileAttributes();
+            enableTelemetry = new EnableTelemetry();
+            fileAttributes.actionScript3 = (version >= 9);    
+
+            if (configuration.useNetwork())
+            {
+                fileAttributes.useNetwork = true;
+	            fileAttributes.actionScript3 = (version >= 9);
+            }
+            
+            if (configuration.getAdvancedTelemetry()) {
+            	enableTelemetry.enabled = true;
+            }
+            
+            fileAttributes.useDirectBlit = configuration.getUseDirectBlit();
+            fileAttributes.useGPU = configuration.getUseGpu();
+            
+	        String metadataStr = configuration.getMetadata();
+            if (metadataStr != null)
+            {
+                metadata = new Metadata();
+                metadata.xml = metadataStr;
+                fileAttributes.hasMetadata = true;
+            }
+        }
+
+        long build = 0;
+        byte majorVersion = 0;
+        byte minorVersion = 0;
+        
+        try
+        {
+            majorVersion = (byte)Integer.parseInt(VersionInfo.FLEX_MAJOR_VERSION);
+            minorVersion = (byte)Integer.parseInt(VersionInfo.FLEX_MINOR_VERSION);
+            build = Long.parseLong( VersionInfo.getBuild() );
+        }
+        catch (NumberFormatException numberFormatException)
+        {
+            // preilly: for now just ignore empty or bogus build numbers.
+        }
+
+        
+        productInfo = new ProductInfo(ProductInfo.ABOBE_FLEX_PRODUCT, 6,
+                                        majorVersion, minorVersion, build, 
+                                        System.currentTimeMillis());
+		pageTitle = configuration.pageTitle();
+
+		lazyInit = configuration.lazyInit();
+        rootClassName = formatSymbolClassName( configuration.getRootClassName() );
+
+        if (rootClassName == null)
+            rootClassName = formatSymbolClassName( configuration.getMainDefinition() );
+        
+        exportedUnits = new LinkedHashMap<CompilationUnit, Frame>();
+        
+        includeInheritanceDependenciesOnly = configuration.getIncludeInheritanceDependenciesOnly();
+        */
+	}
+	
+    protected String linkReport, sizeReport;
+
+    public String getLinkReport()
+    {
+    	return linkReport;
+    }
+    
+    public String getSizeReport()
+    {
+    	return sizeReport;
+    }
+    
+    public void setSizeReport(String report)
+    {
+    	sizeReport = report;
+    }
+    
+    /*
+    public String getRBList()
+    {
+    	return rbList;
+    }
+    
+    public boolean getInheritanceDependenciesOnly()
+    {
+        return includeInheritanceDependenciesOnly;
+    }
+    */
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/tools/CommandLineConfiguration.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/tools/CommandLineConfiguration.java b/flex-compiler-oem/src/flex2/tools/CommandLineConfiguration.java
new file mode 100644
index 0000000..2673be5
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/tools/CommandLineConfiguration.java
@@ -0,0 +1,299 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.tools;
+
+import flex2.compiler.CompilerAPI;
+import flex2.compiler.common.Configuration;
+import flex2.compiler.common.ConfigurationPathResolver;
+import flex2.compiler.config.ConfigurationBuffer;
+import flex2.compiler.config.ConfigurationException;
+import flex2.compiler.config.ConfigurationInfo;
+import flex2.compiler.config.ConfigurationValue;
+import flex2.compiler.io.VirtualFile;
+import flex2.compiler.util.ThreadLocalToolkit;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Support for command line specific configuration options, like
+ * -file-specs, -help, -include-resource-bundles, -load-config,
+ * -output, -projector, and -version.
+ *
+ * @author Roger Gonzalez
+ * @author Clement Wong
+ */
+public class CommandLineConfiguration extends ToolsConfiguration
+{
+	private String resourceModulePath;
+
+	public String getTargetFile()
+	{
+        if (compilingResourceModule())
+		{
+			return resourceModulePath;
+		}
+		
+		return (fileSpecs.size() > 0) ? fileSpecs.get( fileSpecs.size() - 1 ) : null;
+	}
+
+	public List<String> getFileList()
+	{
+        if (compilingResourceModule())
+		{
+			List<String> fileList = new ArrayList<String>();
+			fileList.add(resourceModulePath);
+			return fileList;
+		}
+
+		return fileSpecs;
+	}
+
+	public boolean compilingResourceModule()
+	{
+		boolean b = fileSpecs.size() == 0 && getIncludeResourceBundles().size() > 0;
+		if (b && resourceModulePath == null)
+		{
+			//resourceModulePath = I18nUtils.getGeneratedResourceModule(this).getPath();
+		}
+		return b;
+	}
+
+	public void validate(ConfigurationBuffer cfgbuf) throws ConfigurationException
+	{
+        super.validate( cfgbuf );
+
+        String targetFile = getTargetFile();
+		if (targetFile == null)
+		{
+    	    throw new ConfigurationException.MustSpecifyTarget( null, null, -1);
+		}
+
+        VirtualFile virt = getVirtualFile(targetFile);
+        if (virt == null && checkTargetFileInFileSystem())
+        {
+            throw new ConfigurationException.IOError(targetFile);
+        }
+	}
+
+	/**
+	 * Subclass could override this method.
+	 */
+	protected VirtualFile getVirtualFile(String targetFile) throws ConfigurationException
+	{
+		return CompilerAPI.getVirtualFile(targetFile);
+	}
+	
+	/**
+	 * Subclass could override this method.
+	 */
+	protected boolean checkTargetFileInFileSystem()
+	{
+		return true;
+	}
+	
+    private VirtualFile getVirtualFile(String file, ConfigurationValue cfgval)
+    {
+    	try
+    	{
+    		return ConfigurationPathResolver.getVirtualFile( file, configResolver, cfgval );
+    	}
+    	catch (ConfigurationException ex)
+    	{
+    		return null;
+    	}
+    }
+
+    //
+	// 'file-specs' option
+	//
+	
+	// list of filespecs, default var for command line
+	private List<String> fileSpecs = new ArrayList<String>();
+
+	public List<String> getFileSpecs()
+	{
+		return fileSpecs;
+	}
+
+	public void cfgFileSpecs(ConfigurationValue cv, List<String> args) throws ConfigurationException
+	{
+		this.fileSpecs.addAll( args );
+	}
+
+    public static ConfigurationInfo getFileSpecsInfo()
+    {
+        return new ConfigurationInfo( -1, new String[] { "path-element" } )
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+
+            public boolean isHidden()
+            {
+            	return true;
+            }
+        };
+    }
+
+	//
+	// 'help' option
+	//
+	
+    // dummy, just a trigger for help text
+	public void cfgHelp(ConfigurationValue cv, String[] keywords)
+	{
+
+    }
+    public static ConfigurationInfo getHelpInfo()
+    {
+        return new ConfigurationInfo( -1, "keyword" )
+        {
+            public boolean isGreedy()
+			{
+				return true;
+			}
+
+            public boolean isDisplayed()
+			{
+				return false;
+			}
+        };
+    }
+
+    //
+    // 'include-resource-bundles' option
+    //
+    
+	private List<String> resourceBundles = new LinkedList<String>();
+
+    public List<String> getIncludeResourceBundles()
+	{
+		return resourceBundles;
+	}
+
+	public void cfgIncludeResourceBundles(ConfigurationValue val, List<String> includeResourceBundles)
+	{
+		resourceBundles.addAll(toQNameString(includeResourceBundles));
+	}
+
+	public static ConfigurationInfo getIncludeResourceBundlesInfo()
+	{
+		return new ConfigurationInfo( -1, new String[] { "bundle" } )
+		{
+			public boolean allowMultiple()
+			{
+				return true;
+			}
+		};
+	}
+	
+	//
+	// 'load-config' option
+	//
+	
+	private VirtualFile configFile;
+
+	public VirtualFile getLoadConfig()
+	{
+		return configFile;
+	}
+
+	// dummy, ignored - pulled out of the buffer
+	public void cfgLoadConfig(ConfigurationValue cv, String filename) throws ConfigurationException
+	{
+		// C: resolve the flex-config.xml path to a VirtualFile so incremental compilation can detect timestamp change.
+		configFile = ConfigurationPathResolver.getVirtualFile(filename,
+		                                                      configResolver,
+		                                                      cv);
+	}
+
+	public static ConfigurationInfo getLoadConfigInfo()
+    {
+        return new ConfigurationInfo( 1, "filename" )
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+        };
+    }
+
+	//
+	// 'output' option
+	//
+	
+	public void cfgOutput(ConfigurationValue val, String output) throws ConfigurationException
+	{
+        this.output = Configuration.getOutputPath(val, output);
+	}
+
+	public static ConfigurationInfo getOutputInfo()
+	{
+	    return new ConfigurationInfo(1, "filename")
+	    {
+	        public boolean isRequired()
+	        {
+	            return false;
+	        }
+	    };
+	}
+
+	//
+	// 'projector' option (hidden)
+	//
+	
+    private VirtualFile projector;
+
+    public VirtualFile getProjector()
+    {
+        return projector;
+    }
+
+	public void cfgProjector( ConfigurationValue cfgval, String path )
+	{
+		projector = getVirtualFile(path, cfgval);
+	}
+
+    public static ConfigurationInfo getProjectorInfo()
+    {
+        return new ConfigurationInfo()
+        {
+            public boolean isHidden()
+            {
+                return true;
+            }
+        };
+    }
+
+	//
+	// 'version' option
+	//
+	
+    // dummy, just a trigger for version info
+    public void cfgVersion(ConfigurationValue cv, boolean dummy)
+    {
+        // intercepted upstream in order to allow version into to be printed even when required args are missing
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/tools/CompcConfiguration.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/tools/CompcConfiguration.java b/flex-compiler-oem/src/flex2/tools/CompcConfiguration.java
new file mode 100644
index 0000000..2738d54
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/tools/CompcConfiguration.java
@@ -0,0 +1,536 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.tools;
+
+import flex2.compiler.common.CompilerConfiguration;
+import flex2.compiler.common.Configuration;
+import flex2.compiler.common.ConfigurationPathResolver;
+import flex2.compiler.config.ConfigurationBuffer;
+import flex2.compiler.config.ConfigurationException;
+import flex2.compiler.config.ConfigurationInfo;
+import flex2.compiler.config.ConfigurationValue;
+import flex2.compiler.config.FileConfigurator;
+import flex2.compiler.io.VirtualFile;
+import flex2.compiler.util.ThreadLocalToolkit;
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.BufferedOutputStream;
+import java.io.FileOutputStream;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * compc specific configuration.
+ *
+ * @author Brian Deitte
+ */
+public class CompcConfiguration extends ToolsConfiguration
+{
+    // Hack to get around not being able to override the static method
+    // getOutputInfo() in subclasses.
+    protected static boolean outputRequired = true;
+
+	public static Map<String, String> getAliases()
+    {
+        // FIXME: would make more sense to have these as part of ConfigurationInfo
+        Map<String, String> map = new HashMap<String, String>();
+        map.put( "o", "output" );
+        map.put( "ic", "include-classes" );
+        map.put( "in", "include-namespaces" );
+        map.put( "is", "include-sources" );
+        map.put( "if", "include-file" );
+		map.put( "ir", "include-resource-bundles" );
+	    map.putAll(Configuration.getAliases());
+		return map;
+    }
+
+    public void validate( ConfigurationBuffer cfgbuf ) throws ConfigurationException
+    {
+    	super.validate( cfgbuf );
+    	
+        validateSwcInputs();
+        
+        // verify that if -include-inheritance-dependencies is set that
+        // -include-classes is not null
+        if (getIncludeInheritanceDependenciesOnly() && getClasses().size() == 0)
+            throw new ConfigurationException.MissingIncludeClasses();
+    }
+
+    protected void validateSwcInputs() throws ConfigurationException
+    {
+        if (getIncludeSources().isEmpty() && 
+            getClasses().isEmpty() &&
+            getNamespaces().isEmpty() &&
+            ((getCompilerConfiguration().getIncludeLibraries() == null) || 
+             (getCompilerConfiguration().getIncludeLibraries().length == 0)) &&
+            getFiles().isEmpty() && 
+            getIncludeResourceBundles().isEmpty())
+        {
+            throw new ConfigurationException.NoSwcInputs( null, null, -1 );
+        }
+    }
+
+    //
+    // 'directory' option
+    //
+    
+    private boolean isDirectory;
+
+    public boolean isDirectory()
+    {
+        return isDirectory;
+    }
+
+    public void cfgDirectory(ConfigurationValue val, boolean directory)
+    {
+        this.isDirectory = directory;
+    }
+
+	//
+	// 'help' option
+	//
+	
+    // dummy, just a trigger for help text
+    public void cfgHelp(ConfigurationValue cv, String[] keywords)
+    {
+        // intercepted upstream in order to allow help text to be printed even when args are otherwise bad
+    }
+    
+    public static ConfigurationInfo getHelpInfo()
+    {
+        return new ConfigurationInfo( -1, "keyword" )
+        {
+            public boolean isGreedy()
+			{
+				return true;
+			}
+
+            public boolean isDisplayed()
+			{
+				return false;
+			}
+        };
+    }
+
+    //
+	// 'include-classes' option
+	//
+	
+    private List<String> classes = new LinkedList<String>();
+
+    public List<String> getClasses()
+    {
+        return classes;
+    }
+
+    public void cfgIncludeClasses(ConfigurationValue cv, List<String> args) throws ConfigurationException
+    {
+        classes.addAll( toQNameString(args) );
+    }
+
+    public static ConfigurationInfo getIncludeClassesInfo()
+    {
+        return new ConfigurationInfo( -1, new String[] { "class" } )
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+        };
+    }
+
+	//
+	// 'include-file' option
+	//
+	
+    private Map<String, VirtualFile> files = new HashMap<String, VirtualFile>();
+
+    // This method is for ConfigurationBuffer so include files can be included 
+    // in the checksum. This is considered a getter method (using reflection) 
+    // for the -include-file option so the method name must be singular even 
+    // though a list is returned.
+    public VirtualFile[] getIncludeFile()
+    {
+        VirtualFile[] retFiles = new VirtualFile[files.size()];
+        int i = 0;
+        
+        for (Map.Entry<String, VirtualFile>entry : files.entrySet())
+        {
+            retFiles[i++] = entry.getValue();
+        }
+        
+        return retFiles;
+    }
+
+    public Map<String, VirtualFile> getFiles()
+    {
+        return files;
+    }
+
+    public void addFiles(Map<String, VirtualFile> f)
+    {
+        files.putAll(f);
+    }
+
+    public void cfgIncludeFile( ConfigurationValue cfgval, String name, String path)
+            throws ConfigurationException
+    {
+        if (files.containsKey(name))
+        {
+            throw new ConfigurationException.RedundantFile(name, cfgval.getVar(), cfgval.getSource(), cfgval.getLine() );
+        }
+        VirtualFile f = ConfigurationPathResolver.getVirtualFile( path, configResolver, cfgval );
+        files.put(name, f);
+    }
+
+    public static ConfigurationInfo getIncludeFileInfo()
+    {
+        return new ConfigurationInfo( new String[] {"name", "path"} )
+        {
+            public boolean isPath()
+            {
+                return true;
+            }
+
+            public boolean allowMultiple()
+			{
+				return true;
+			}
+        };
+    }
+
+	//
+	// 'include-stylesheet' option
+	//
+	
+    private Map<String, VirtualFile> stylesheets = new HashMap<String, VirtualFile>();
+
+    public Map<String, VirtualFile> getStylesheets()
+    {
+        return stylesheets;
+    }
+
+    public void addStylesheets(Map<String, VirtualFile> f)
+    {
+        stylesheets.putAll(f);
+    }
+
+    public void cfgIncludeStylesheet( ConfigurationValue cfgval, String name, String path)
+            throws ConfigurationException
+    {
+        if (stylesheets.containsKey(name))
+        {
+            throw new ConfigurationException.RedundantFile(name, cfgval.getVar(), cfgval.getSource(), cfgval.getLine() );
+        }
+        VirtualFile f = ConfigurationPathResolver.getVirtualFile( path, configResolver, cfgval );
+        stylesheets.put(name, f);
+    }
+
+    public static ConfigurationInfo getIncludeStylesheetInfo()
+    {
+        return new ConfigurationInfo( new String[] {"name", "path"} )
+        {
+            public boolean isPath()
+            {
+                return true;
+            }
+
+            public boolean allowMultiple()
+			{
+				return true;
+			}
+        };
+    }
+
+	//
+	// 'include-lookup-only' option
+	//
+	
+	private boolean includeLookupOnly = false;
+
+	public boolean getIncludeLookupOnly()
+	{
+		return includeLookupOnly;
+	}
+
+	/**
+	 * include-lookup-only (hidden)
+	 * if true, manifest entries with lookupOnly=true are included in SWC catalog. default is false.
+	 * This exists only so that manifests can mention classes that come in from filespec rather than classpath,
+	 * e.g. in playerglobal.swc.
+	 * TODO could make this a per-namespace setting. Or, if we modify catalog-builder to handle defs from filespecs,
+	 * could remove it entirely.
+	 */
+	public void cfgIncludeLookupOnly(ConfigurationValue val, boolean includeLookupOnly)
+	{
+		this.includeLookupOnly = includeLookupOnly;
+	}
+
+	public static ConfigurationInfo getIncludeLookupOnlyInfo()
+	{
+		return new ConfigurationInfo()
+		{
+			public boolean isAdvanced()
+			{
+				return true;
+			}
+		};
+	}
+
+	//
+    // 'include-namespaces' option
+    //
+    
+    private List<String> namespaces = new LinkedList<String>();
+
+    public List<String> getNamespaces()
+    {
+        return namespaces;
+    }
+
+    public void cfgIncludeNamespaces(ConfigurationValue val, List<String> includeNamespaces)
+    {
+        namespaces.addAll(includeNamespaces);
+    }
+
+    public static ConfigurationInfo getIncludeNamespacesInfo()
+    {
+        return new ConfigurationInfo( -1, new String[] { "uri" } )
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+        };
+    }
+
+    //
+    // 'include-resource-bundles' option
+    //
+    
+	private List<String> resourceBundles = new LinkedList<String>();
+
+    public List<String> getIncludeResourceBundles()
+	{
+		return resourceBundles;
+	}
+
+	public void cfgIncludeResourceBundles(ConfigurationValue val, List<String> includeResourceBundles)
+	{
+		resourceBundles.addAll(toQNameString(includeResourceBundles));
+	}
+
+	public static ConfigurationInfo getIncludeResourceBundlesInfo()
+	{
+		return new ConfigurationInfo( -1, new String[] { "bundle" } )
+		{
+			public boolean allowMultiple()
+			{
+				return true;
+			}
+		};
+	}
+	
+    //
+	// 'include-sources' option
+	//
+	
+    private List<String> sources = new LinkedList<String>();
+    
+    public void setIncludeSources(List<String> sources) 
+    {    	
+        this.sources = sources;
+    }
+ 
+    public List<String> getIncludeSources()
+    {
+        return sources;
+    }
+
+    public void cfgIncludeSources(ConfigurationValue cv, List<String> args) throws ConfigurationException
+    {
+    	CompilerConfiguration compilerConfiguration = getCompilerConfiguration();
+    	String[] paths = new String[args.size()];
+    	args.toArray(paths);
+    	VirtualFile[] newPathElements = compilerConfiguration.expandTokens(paths, compilerConfiguration.getLocales(), cv);
+
+        for (VirtualFile v  : newPathElements)
+           sources.add(v.getName());
+    }
+
+    public static ConfigurationInfo getIncludeSourcesInfo()
+    {
+        return new ConfigurationInfo( -1, new String[] { "path-element" } )
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+
+            public boolean isPath()
+            {
+                return true;
+            }
+        };
+    }
+
+	//
+	// 'load-config' option
+	//
+	
+    // dummy, ignored - pulled out of the buffer
+    public void cfgLoadConfig(ConfigurationValue cv, String filename) throws ConfigurationException
+    {
+    }
+
+    public static ConfigurationInfo getLoadConfigInfo()
+    {
+        return new ConfigurationInfo( 1, "filename" )
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+        };
+    }
+
+    //
+	// 'output' option
+	//
+	
+    public void cfgOutput(ConfigurationValue val, String output) throws ConfigurationException
+    {
+		if (output != null && (output.startsWith(File.separator) || output.startsWith("/") || (new File(output)).isAbsolute()))
+		{
+			this.output = output;
+		}
+		else if (val.getContext() != null)
+        {
+            this.output = val.getContext() + File.separatorChar + output;
+        }
+        else
+        {
+            this.output = output;
+        }
+
+        if (isDirectory)
+        {
+            File d = new File( this.output );
+
+            if (d.exists())
+            {
+                if (!d.isDirectory())
+                    throw new ConfigurationException.NotADirectory( this.output, val.getVar(), val.getSource(), val.getLine() );
+                else
+                {
+                    File[] fl = d.listFiles();
+                    if ((fl != null) && (fl.length > 0))
+                    {
+                        throw new ConfigurationException.DirectoryNotEmpty(this.output, val.getVar(), val.getSource(), val.getLine() );
+                    }
+                }
+            }
+        }
+    }
+
+    public static ConfigurationInfo getOutputInfo()
+    {
+        return new ConfigurationInfo(1, "filename")
+        {
+            public String[] getPrerequisites()
+            {
+                return new String[] {"directory"} ;
+            }
+
+            public boolean isRequired()
+            {
+                return outputRequired;
+            }
+        };
+    }
+
+    public String getTargetFile()
+    {
+        return null;
+    }
+
+    //
+    // 'root' option
+    //
+     
+	public void cfgRoot(ConfigurationValue val, String rootStr)
+            throws ConfigurationException
+    {
+        throw new ConfigurationException.ObsoleteVariable( "source-path", val.getVar(),
+                                                            val.getSource(), val.getLine() );
+    }
+
+    public static ConfigurationInfo getRootInfo()
+    {
+        return new ConfigurationInfo()
+        {
+            public boolean isAdvanced()
+            {
+                return true;
+            }
+
+            public boolean isHidden()
+            {
+                return true;
+            }
+        };
+    }
+
+	//
+	// 'version' option
+	//
+	
+    // dummy, just a trigger for version info
+    public void cfgVersion(ConfigurationValue cv, boolean dummy)
+    {
+        // intercepted upstream in order to allow version into to be printed even when required args are missing
+    }
+
+    
+	//
+	// compute-digest option
+	//
+	
+	private boolean computeDigest = true;
+	
+	public boolean getComputeDigest()
+	{
+		return computeDigest;
+	}
+	
+	/**
+	 * compute-digest option
+	 * 
+	 * @param cv
+	 * @param b
+	 */
+	public void cfgComputeDigest(ConfigurationValue cv, boolean b)
+	{
+		computeDigest = b;
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/tools/LicensesConfiguration.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/tools/LicensesConfiguration.java b/flex-compiler-oem/src/flex2/tools/LicensesConfiguration.java
new file mode 100644
index 0000000..22971ff
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/tools/LicensesConfiguration.java
@@ -0,0 +1,78 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.tools;
+
+import flex2.compiler.config.ConfigurationException;
+import flex2.compiler.config.ConfigurationValue;
+import flex2.compiler.config.ConfigurationInfo;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A sub-configuration of ToolsConfiguration.
+ *
+ * @see flex2.tools.ToolsConfiguration
+ * @author Paul Reilly
+ */
+public class LicensesConfiguration
+{
+    //
+	//  'license' option
+	//
+	
+	private Map<String, String> licenseMap;
+
+    public Map<String, String> getLicenseMap()
+    {
+        return licenseMap;
+    }
+    
+   public void setLicenseMap(Map<String, String> m)
+    {
+    	licenseMap = m;
+    }
+    
+    public void cfgLicense( ConfigurationValue cfgval, String product, String serialNumber)
+        throws ConfigurationException
+    {
+        if (licenseMap == null)
+        {
+            licenseMap = new HashMap<String, String>();
+        }
+
+        licenseMap.put(product, serialNumber);
+    }
+
+    public static ConfigurationInfo getLicenseInfo()
+    {
+        return new ConfigurationInfo( new String[] {"product", "serial-number"} )
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+            
+            public boolean isDisplayed()
+            {
+            	return false;
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/tools/PreLink.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/tools/PreLink.java b/flex-compiler-oem/src/flex2/tools/PreLink.java
new file mode 100644
index 0000000..e8c792d
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/tools/PreLink.java
@@ -0,0 +1,178 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.tools;
+
+import flex2.compiler.util.CompilerMessage;
+
+/**
+ * A flex2.compiler.PreLink implementation, which creates the FlexInit
+ * and SystemManager subclass.
+ *
+ * @author Clement Wong
+ * @author Roger Gonzalez (mixin, flexinit, bootstrap)
+ * @author Basil Hosmer (service config)
+ * @author Brian Deitte (font)
+ * @author Cathy Murphy (accessibility)
+ * @author Gordon Smith (i18n)
+ */
+public class PreLink// implements flex2.compiler.PreLink
+{
+    private final static String DEFAULTS_CSS = "defaults.css";
+    private final static String DEFAULTS_DASH = "defaults-";
+    private final static String DOT_CSS = ".css";
+
+
+    public static class CouldNotParseNumber extends CompilerMessage.CompilerError
+    {
+        private static final long serialVersionUID = 2186380089141871093L;
+
+        public CouldNotParseNumber(String num, String attribute)
+        {
+            this.num = num;
+            this.attribute = attribute;
+        }
+
+        public String num;
+        public String attribute;
+    }
+
+    public static class MissingSignedLibraryDigest extends CompilerMessage.CompilerError
+    {
+        private static final long serialVersionUID = -1865860949469218550L;
+
+        public MissingSignedLibraryDigest(String libraryPath)
+        {
+            this.libraryPath = libraryPath;
+        }
+
+        public String libraryPath;
+    }
+
+    public static class MissingUnsignedLibraryDigest extends CompilerMessage.CompilerError
+    {
+        private static final long serialVersionUID = 8092666584208136222L;
+
+        public MissingUnsignedLibraryDigest(String libraryPath)
+        {
+            this.libraryPath = libraryPath;
+        }
+
+        public String libraryPath;
+    }
+
+	/**
+	 *  Warn users with [RemoteClass] metadata that ends up mapping more than one class to the same alias. 
+	 */
+    public static class ClassesMappedToSameRemoteAlias extends CompilerMessage.CompilerWarning
+    {
+        private static final long serialVersionUID = 4365280637418299961L;
+        
+        public ClassesMappedToSameRemoteAlias(String className, String existingClassName, String alias)
+        {
+            this.className = className;
+            this.existingClassName = existingClassName;
+            this.alias = alias;
+        }
+
+        public String className;
+        public String existingClassName;
+        public String alias;
+    }
+
+    /**
+     *  Tell the user they are making a mistake by compiling a module or application as a component. 
+     */
+    public static class CompiledAsAComponent extends CompilerMessage.CompilerWarning
+    {
+        private static final long serialVersionUID = -2874508107726441350L;
+
+        public CompiledAsAComponent(String className, String mainDefinition)
+        {
+            this.className = className;
+            this.mainDefinition = mainDefinition;
+        }
+        
+        public String className;
+        public String mainDefinition;
+
+    }    
+  
+    /**
+     *  "Required RSLs:" message. 
+     */
+    public static class RequiredRsls extends CompilerMessage.CompilerInfo
+    {
+        private static final long serialVersionUID = 2303666861783668660L;
+
+        public RequiredRsls()
+        {
+        }
+
+    }
+    
+    /**
+     *  Display RSL URL with no failovers. 
+     */
+    public static class RequiredRslUrl extends CompilerMessage.CompilerInfo
+    {
+        private static final long serialVersionUID = 2303666861783668660L;
+
+        public RequiredRslUrl(String rslUrl)
+        {
+            this.rslUrl = rslUrl;
+        }
+
+        public String rslUrl;
+    }
+
+    /**
+     *  Display RSL URL with one failover. 
+     */
+    public static class RequiredRslUrlWithFailover extends CompilerMessage.CompilerInfo
+    {
+        private static final long serialVersionUID = 2303666861783668660L;
+
+        public RequiredRslUrlWithFailover(String rslUrl)
+        {
+            this.rslUrl = rslUrl;
+        }
+
+        public String rslUrl;
+    }
+
+    /**
+     *  Display RSL URL with more than one failovers. 
+     */
+    public static class RequiredRslUrlWithMultipleFailovers extends CompilerMessage.CompilerInfo
+    {
+        private static final long serialVersionUID = 2303666861783668660L;
+
+        public RequiredRslUrlWithMultipleFailovers(String rslUrl, int failoverCount)
+        {
+            this.rslUrl = rslUrl;
+            this.failoverCount = failoverCount;
+        }
+        
+        public String rslUrl;
+        public int failoverCount;
+
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/tools/ToolsConfiguration.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/tools/ToolsConfiguration.java b/flex-compiler-oem/src/flex2/tools/ToolsConfiguration.java
new file mode 100644
index 0000000..4929925
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/tools/ToolsConfiguration.java
@@ -0,0 +1,361 @@
+/*
+ *
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+package flex2.tools;
+
+//import flex2.compiler.as3.SignatureExtension;
+import flex2.compiler.common.Configuration;
+import flex2.compiler.common.CompilerConfiguration;
+//import flex2.compiler.config.FileConfigurator;
+import flex2.compiler.config.ConfigurationBuffer;
+import flex2.compiler.config.ConfigurationException;
+import flex2.compiler.config.ConfigurationInfo;
+import flex2.compiler.config.ConfigurationValue;
+import flex2.compiler.io.VirtualFile;
+import flex2.compiler.util.CompilerMessage;
+//import flex2.compiler.util.ThreadLocalToolkit;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
+/**
+ * Common base class for most tool specific configurations.
+ */
+public abstract class ToolsConfiguration extends Configuration
+{
+    public ToolsConfiguration()
+    {
+    }
+
+    private VirtualFile licenseFile;
+
+    public VirtualFile getLicenseFile()
+    {
+        return licenseFile;
+    }
+
+    private void processDeprecatedOptions(ConfigurationBuffer configurationBuffer)
+    {
+		for (Iterator i = configurationBuffer.getVarIterator(); i.hasNext(); )
+		{
+			String var = (String) i.next();
+			ConfigurationInfo info = configurationBuffer.getInfo(var);
+			if (info.isDeprecated() && configurationBuffer.getVar(var) != null)
+			{
+				CompilerMessage.CompilerWarning warning = info.getDeprecatedMessage();
+				String replacement = info.getDeprecatedReplacement();
+				String since = info.getDeprecatedSince();
+				
+				if (warning != null)
+				{
+					//ThreadLocalToolkit.log(warning);
+				}
+				else
+				{
+					//ThreadLocalToolkit.log(new DeprecatedConfigurationOption(var, replacement, since));
+				}
+			}
+		}		
+    }
+    
+    public static class DeprecatedConfigurationOption extends CompilerMessage.CompilerWarning
+    {
+    	private static final long serialVersionUID = 5523004100027677184L;
+
+        public DeprecatedConfigurationOption(String var, String replacement, String since)
+    	{
+    		this.var = var;
+    		this.replacement = replacement;
+    		this.since = since;
+    	}
+    	
+    	public final String var, replacement, since;
+    }
+
+	protected String output;
+
+	public String getOutput()
+    {
+        return output;
+    }
+
+    abstract protected String getTargetFile();
+
+    private String createOutputDirectory(ConfigurationBuffer configurationBuffer,
+                                         String directory)
+    {
+        String result = directory;
+        String parent =
+            configurationBuffer.getToken(flex2.tools.oem.Configuration.DEFAULT_OUTPUT_DIRECTORY_TOKEN);
+        
+        if (parent == null)
+        {
+            String output = getOutput();
+
+            if (output != null)
+            {
+                parent = (new File(output)).getParent();
+            }
+            else
+            {
+                // Fall back on the target file as a last resort.
+                String targetFile = getTargetFile();
+
+                if (targetFile != null)
+                {
+                    parent = (new File(targetFile)).getParent();
+                }
+            }
+        }
+
+        if (parent != null)
+        {
+            result = parent + File.separatorChar + directory;
+        }
+
+        return result;
+    }
+
+	public void validate(ConfigurationBuffer configurationBuffer) throws ConfigurationException
+    {
+		// process the merged configuration buffer. right, can't just process the args.
+		processDeprecatedOptions(configurationBuffer);
+
+		// For Apache Flex there is no license check.
+		
+		// If license.jar is present, call flex.license.OEMLicenseService.getLicenseFilename().
+//		try
+//		{
+//			Class oemLicenseServiceClass = Class.forName("flex.license.OEMLicenseService");
+//			Method method = oemLicenseServiceClass.getMethod("getLicenseFilename", (Class[])null);
+//			String licenseFileName = (String)method.invoke(null, (Object[])null);
+//			licenseFile = configResolver.resolve(licenseFileName);
+//		}
+//		catch (Exception e)
+//		{
+//		}
+//
+//        if (Trace.license)
+//        {
+//            final String file = (licenseFile != null) ? licenseFile.getName() : "";
+//            Trace.trace("ToolsConfiguration.validate: licenseFile = '" + file + "'");
+//        }
+        
+	    // validate the -AS3, -ES and -strict settings
+	    boolean strict = "true".equalsIgnoreCase(configurationBuffer.peekSimpleConfigurationVar(CompilerConfiguration.STRICT));
+	    boolean as3 = "true".equalsIgnoreCase(configurationBuffer.peekSimpleConfigurationVar(CompilerConfiguration.AS3));
+	    boolean es = "true".equalsIgnoreCase(configurationBuffer.peekSimpleConfigurationVar(CompilerConfiguration.ES));
+
+	    if ((as3 && es) || (!as3 && !es))
+	    {
+		    throw new BadAS3ESCombination(as3, es);
+	    }
+	    else if (strict && es)
+	    {
+		    //ThreadLocalToolkit.log(new BadESStrictCombination(es, strict));
+	    }
+        
+        // if we're saving signatures to files and the directory is unset, use the default.
+        final CompilerConfiguration compilerConfiguration = getCompilerConfiguration();
+
+        validateKeepGeneratedSignatures(configurationBuffer, compilerConfiguration);
+        validateKeepGeneratedActionScript(configurationBuffer, compilerConfiguration);
+        validateDumpConfig(configurationBuffer);
+    }
+
+    private void validateDumpConfig(ConfigurationBuffer configurationBuffer)
+        throws ConfigurationException
+    {
+        /*
+        if (dumpConfigFile != null)
+        {
+            ThreadLocalToolkit.log(new Mxmlc.DumpConfig(dumpConfigFile));
+            File f = new File(dumpConfigFile);
+            // fixme - nuke the private string for the localization prefix...
+            String text = FileConfigurator.formatBuffer(configurationBuffer, "flex-config",
+                                                        ThreadLocalToolkit.getLocalizationManager(),
+                                                        "flex2.configuration");
+            try
+            {
+                PrintWriter out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(f)));
+                out.write(text);
+                out.close();
+            }
+            catch (Exception e)
+            {
+                throw new ConfigurationException.IOError(dumpConfigFile);
+            }
+        }
+        */
+    }
+
+    private void validateKeepGeneratedSignatures(ConfigurationBuffer configurationBuffer,
+                                                 CompilerConfiguration compilerConfiguration)
+        throws ConfigurationException
+    {
+        /*
+        if (compilerConfiguration.getKeepGeneratedSignatures())
+        {
+            String dir = compilerConfiguration.getSignatureDirectory();
+
+            if (dir == null)
+            {
+                dir = createOutputDirectory(configurationBuffer, SignatureExtension.DEFAULT_SIG_DIR);
+            }
+            else if (!FileUtils.isAbsolute(new File(dir)))
+            {
+                dir = createOutputDirectory(configurationBuffer, dir);
+            }
+
+            assert dir != null;
+
+            if (dir != null)
+            {
+                File file = new File(dir);
+                file.mkdirs();
+                compilerConfiguration.setSignatureDirectory(FileUtils.canonicalPath(file));
+            }
+        }
+        */
+    }
+
+    private void validateKeepGeneratedActionScript(ConfigurationBuffer configurationBuffer,
+                                                 CompilerConfiguration compilerConfiguration)
+    {
+        if (compilerConfiguration.keepGeneratedActionScript())
+        {
+            String dir = compilerConfiguration.getGeneratedDirectory();
+
+            if (dir == null)
+            {
+                dir = createOutputDirectory(configurationBuffer, "generated");
+            }
+            else if (!(new File(dir)).isAbsolute())
+            {
+                dir = createOutputDirectory(configurationBuffer, dir);
+            }
+
+            assert dir != null;
+
+            if (dir != null)
+            {
+                File file = new File(dir);
+                file.mkdirs();
+                try {
+                compilerConfiguration.setGeneratedDirectory(file.getCanonicalPath());
+                } catch (IOException e)
+                {
+                }
+            }
+        }
+    }
+
+	public static class BadAS3ESCombination extends ConfigurationException
+	{
+	    private static final long serialVersionUID = 4418178171352281793L;
+
+        public BadAS3ESCombination(boolean as3, boolean es)
+	    {
+	        super("");
+		    this.as3 = as3;
+		    this.es = es;
+	    }
+
+		public final boolean as3, es;
+	}
+
+	public static class BadESStrictCombination extends ConfigurationException
+	{
+	    private static final long serialVersionUID = 384624904213418743L;
+
+        public BadESStrictCombination(boolean es, boolean strict)
+	    {
+	        super("");
+		    this.es = es;
+		    this.strict = strict;
+	    }
+
+		public final boolean es, strict;
+
+		public String getLevel()
+		{
+		    return WARNING;
+		}
+	}
+    
+    //
+    // 'warnings' option
+    //
+    
+    private boolean warnings = true;
+    
+    public boolean getWarnings()
+    {
+        return warnings;
+    }
+
+    public void cfgWarnings(ConfigurationValue cv, boolean b)
+    {
+        warnings = b;
+    }
+
+    public static ConfigurationInfo getWarningsInfo()
+    {
+        return new ConfigurationInfo();
+    }
+    
+    //
+    // 'dump-config-file' option
+    //
+
+    private String dumpConfigFile = null;
+
+    public String getDumpConfig()
+    {
+        return dumpConfigFile;
+    }
+
+    public void cfgDumpConfig(ConfigurationValue cv, String filename)
+    {
+        dumpConfigFile = Configuration.getOutputPath(cv, filename);
+        // can't print here, we want to aggregate all the settings found and then print.
+    }
+
+    public static ConfigurationInfo getDumpConfigInfo()
+    {
+        return new ConfigurationInfo( 1, "filename" )
+        {
+            public boolean isAdvanced()
+            {
+                return true;
+            }
+
+            public boolean isDisplayed()
+            {
+                return false;
+            }
+        };
+    }
+}
+