flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [16/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
Date Sun, 06 Apr 2014 05:39:38 GMT
http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/common/MxmlConfiguration.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/common/MxmlConfiguration.java b/flex-compiler-oem/src/flex2/compiler/common/MxmlConfiguration.java
new file mode 100644
index 0000000..d496c32
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/common/MxmlConfiguration.java
@@ -0,0 +1,308 @@
+/*
+ *
+ *  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.common;
+
+import flex2.compiler.config.AdvancedConfigurationInfo;
+import flex2.compiler.config.ConfigurationException;
+import flex2.compiler.config.ConfigurationValue;
+import flex2.compiler.config.ConfigurationInfo;
+
+/**
+ * This class handles MXML language specific configuration options.
+ * This includes things like compatibility-version,
+ * minimum-supported-version, and qualified-type-selectors.  This
+ * class should not to be confused with
+ * flex2.compiler.mxml.MxmlConfiguration, which is where MXML
+ * subcompiler configuration options are declared and
+ * flex2.compiler.common.CompilerConfiguration, which is where
+ * flex2.compiler.mxml.MxmlConfiguration is defined.
+ *
+ * @author Clement Wong
+ */
+public class MxmlConfiguration
+{
+	private ConfigurationPathResolver configResolver;
+
+	public void setConfigPathResolver( ConfigurationPathResolver resolver )
+	{
+	    this.configResolver = resolver;
+	}
+
+    //
+    // 'compiler.mxml.compatibility-version' option
+    //
+	public static final int VERSION_4_13 = 0x040d0000;
+	public static final int VERSION_4_12 = 0x040c0000;
+	public static final int VERSION_4_11 = 0x040b0000;
+	public static final int VERSION_4_10 = 0x040a0000;
+	public static final int VERSION_4_9_1 = 0x04090001;
+	public static final int VERSION_4_9 = 0x04090000;
+	public static final int VERSION_4_8 = 0x04080000;
+	public static final int VERSION_4_6 = 0x04060000;
+    public static final int VERSION_4_5 = 0x04050000;
+    public static final int VERSION_4_0 = 0x04000000;
+    public static final int VERSION_3_0 = 0x03000000;
+    public static final int VERSION_2_0_1 = 0x02000001;
+    public static final int VERSION_2_0 = 0x02000000;
+    public static final int CURRENT_VERSION = VERSION_4_13;
+    public static final int EARLIEST_MAJOR_VERSION = 3;
+    public static final int LATEST_MAJOR_VERSION = 4;
+    public static final int LATEST_MINOR_VERSION = 13;
+
+	private int major = LATEST_MAJOR_VERSION;
+	private int minor = LATEST_MINOR_VERSION;
+	private int revision;
+	
+	private int minMajor = EARLIEST_MAJOR_VERSION;
+	private int minMinor;
+	private int minRevision;
+
+	public int getMajorCompatibilityVersion()
+	{
+		return major;
+	}
+
+	public int getMinorCompatibilityVersion()
+	{
+		return minor;
+	}
+
+	public int getRevisionCompatibilityVersion()
+	{
+		return revision;
+	}
+
+	/*
+	 * Unlike the framework's FlexVersion.compatibilityVersionString,
+	 * this returns null rather than a string like "3.0.0" for the current version.
+	 * But if a -compatibility-version was specified, this string will always
+	 * be of the form N.N.N. For example, if -compatibility-version=2,
+	 * this string is "2.0.0", not "2".
+	 */
+	public String getCompatibilityVersionString()
+	{
+		return (major == 0 && minor == 0 && revision == 0) ? null : major + "." + minor + "." + revision;
+	}
+
+	/*
+	 * This returns an int that can be compared with version constants
+	 * such as MxmlConfiguration.VERSION_3_0.
+	 */
+	public int getCompatibilityVersion()
+	{
+		int version = (major << 24) + (minor << 16) + revision;
+		return version != 0 ? version : CURRENT_VERSION;
+	}
+	
+	public void cfgCompatibilityVersion(ConfigurationValue cv, String version) throws ConfigurationException
+	{
+		if (version == null)
+		{
+			return;
+		}
+		
+		String[] results = version.split("\\.");
+		
+		if (results.length == 0)
+		{
+			throw new ConfigurationException.BadVersion(version, "compatibility-version");
+		}
+
+		// Set minor and revision numbers to zero in case only a major number
+		// was specified, etc.
+		this.minor = 0;
+		this.revision = 0;
+
+		for (int i = 0; i < results.length; i++)
+		{
+			int versionNum = 0;
+			
+			try
+			{
+				versionNum = Integer.parseInt(results[i]);
+			}
+			catch (NumberFormatException e)
+			{
+				throw new ConfigurationException.BadVersion(version, "compatibility-version");				
+			}
+			
+			if (i == 0)
+			{
+				if (versionNum >= EARLIEST_MAJOR_VERSION && versionNum <= LATEST_MAJOR_VERSION) 
+				{
+					this.major = versionNum;
+				}
+				else 
+				{
+					throw new ConfigurationException.BadVersion(version, "compatibility-version");
+				}				
+			}
+			else 
+			{
+				if (versionNum >= 0) 
+				{
+					if (i == 1)
+					{
+						this.minor = versionNum;						
+					}
+					else
+					{
+						this.revision = versionNum;
+					}
+				}
+				else 
+				{
+					throw new ConfigurationException.BadVersion(version, "compatibility-version");
+				}				
+			}
+		}
+
+        if (major <= 3)
+        {
+            qualifiedTypeSelectors = false;            
+        }
+	}
+
+	public static ConfigurationInfo getCompatibilityVersionInfo()
+	{
+	    return new ConfigurationInfo( new String[] {"version"} );
+	}
+
+	/*
+	 * Minimum supported SDK version for this library.
+	 * This string will always be of the form N.N.N. For example, if 
+	 * -minimum-supported-version=2, this string is "2.0.0", not "2".
+	 */
+	public String getMinimumSupportedVersionString()
+	{
+		return (minMajor == 0 && minMinor == 0 &&  minRevision == 0) ? 
+				null : minMajor + "." + minMinor + "." + minRevision;
+	}
+
+	/*
+	 * This returns an int that can be compared with version constants
+	 * such as MxmlConfiguration.VERSION_3_0.
+	 */
+	public int getMinimumSupportedVersion()
+	{
+		int version = (minMajor << 24) + (minMinor << 16) + minRevision;
+		return version != 0 ? version : (EARLIEST_MAJOR_VERSION << 24);
+	}
+	
+    public void setMinimumSupportedVersion(int version)
+    {
+        minMajor = version >> 24 & 0xFF;
+        minMinor = version >> 16 & 0xFF;
+        minRevision = version & 0xFF;
+    }    
+
+	public void cfgMinimumSupportedVersion(ConfigurationValue cv, String version) throws ConfigurationException
+	{
+		if (version == null)
+		{
+			return;
+		}
+		
+		String[] results = version.split("\\.");
+		
+		if (results.length == 0)
+		{
+			throw new ConfigurationException.BadVersion(version, "minimum-supported-version");
+
+		}
+		
+		for (int i = 0; i < results.length; i++)
+		{
+			int versionNum = 0;
+			
+			try
+			{
+				versionNum = Integer.parseInt(results[i]);
+			}
+			catch (NumberFormatException e)
+			{
+				throw new ConfigurationException.BadVersion(version, "minimum-supported-version");				
+			}
+			
+			if (i == 0)
+			{
+				if (versionNum >= MxmlConfiguration.EARLIEST_MAJOR_VERSION && versionNum <= MxmlConfiguration.LATEST_MAJOR_VERSION) 
+				{
+					this.minMajor = versionNum;
+				}
+				else 
+				{
+					throw new ConfigurationException.BadVersion(version, "minimum-supported-version");
+				}				
+			}
+			else 
+			{
+				if (versionNum >= 0) 
+				{
+					if (i == 1)
+					{
+						minMinor = versionNum;						
+					}
+					else
+					{
+						minRevision = versionNum;
+					}
+				}
+				else 
+				{
+					throw new ConfigurationException.BadVersion(version, "minimum-supported-version");
+				}				
+			}
+		}
+
+        isMinimumSupportedVersionConfigured = true;
+	}
+	
+    private boolean isMinimumSupportedVersionConfigured = false;
+
+    public boolean isMinimumSupportedVersionConfigured()
+    {
+        return isMinimumSupportedVersionConfigured;
+    }
+
+    //
+    // 'qualified-type-selectors' option
+    //
+
+    private boolean qualifiedTypeSelectors = true;
+
+    public boolean getQualifiedTypeSelectors()
+    {
+        if (getCompatibilityVersion() < MxmlConfiguration.VERSION_4_0)
+            return false;
+
+        return qualifiedTypeSelectors;
+    }
+
+    public void cfgQualifiedTypeSelectors(ConfigurationValue cv, boolean b)
+    {
+        qualifiedTypeSelectors = b;
+    }
+
+    public static ConfigurationInfo getQualifiedTypeSelectorsInfo()
+    {
+        return new AdvancedConfigurationInfo();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/common/NamespacesConfiguration.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/common/NamespacesConfiguration.java b/flex-compiler-oem/src/flex2/compiler/common/NamespacesConfiguration.java
new file mode 100644
index 0000000..df9ebf3
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/common/NamespacesConfiguration.java
@@ -0,0 +1,165 @@
+/*
+ *
+ *  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.common;
+
+import flex2.compiler.config.ConfigurationException;
+import flex2.compiler.config.ConfigurationValue;
+import flex2.compiler.config.ConfigurationInfo;
+import flex2.compiler.io.VirtualFile;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Iterator;
+
+/**
+ * This class handles namespace specific configuration options.
+ *
+ * @author Clement Wong
+ */
+public class NamespacesConfiguration
+{
+    private ConfigurationPathResolver configResolver;
+
+    public void setConfigPathResolver( ConfigurationPathResolver resolver )
+    {
+        this.configResolver = resolver;
+    }
+
+    private Map<String, List<VirtualFile>> manifestMappings;
+
+    public Map<String, List<VirtualFile>> getManifestMappings()
+    {
+        return manifestMappings;
+    }
+
+    public void setManifestMappings(Map<String, List<VirtualFile>> manifestMappings)
+    {
+        this.manifestMappings = manifestMappings;
+    }
+
+    //
+    // 'compiler.namespaces.namespace' option
+    //
+
+    public VirtualFile[] getNamespace()
+    {
+        if (manifestMappings != null)
+        {
+            List<VirtualFile> fileList = new ArrayList<VirtualFile>();
+
+            Iterator<List<VirtualFile>> iterator = manifestMappings.values().iterator();
+            while (iterator.hasNext())
+            {
+                List<VirtualFile> files = iterator.next();
+                if (files != null)
+                {
+                    Iterator<VirtualFile> f = files.iterator();
+                    while ( f.hasNext())
+                    {
+                        fileList.add(f.next());
+                    }
+                }
+            }
+
+            VirtualFile[] fileArray = new VirtualFile[fileList.size()];
+            return fileList.toArray(fileArray);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    /**
+     * Configures a list of many manifests mapped to a single namespace URI.
+     * 
+     * <namespace>
+     *     <uri>library:adobe/flex/something</uri>
+     *     <manifest>something-manifest.xml</manifest>
+     *     <manifest>something-else-manifest.xml</manifest>
+     *     ...
+     * </namespace>
+     *  
+     * @param cfgval The configuration value context.
+     * @param args A List of values for the namespace element, with the first
+     * item expected to be the uri and the remaining are manifest paths.
+     * @throws ConfigurationException
+     */
+    public void cfgNamespace(ConfigurationValue cfgval, List<String> args)
+        throws ConfigurationException
+    {
+        if (args == null)
+        {
+            throw new ConfigurationException.CannotOpen(null, cfgval.getVar(), cfgval.getSource(), cfgval.getLine());
+        }
+
+        if (args.size() < 2)
+        {
+            throw new ConfigurationException.NamespaceMissingManifest("namespace", cfgval.getSource(), cfgval.getLine());
+        }
+
+        PathResolver resolver = new PathResolver();
+        assert resolver != null && configResolver != null: "Path resolvers must be set before calling this method.";
+        if (resolver == null || configResolver == null)
+        {
+            throw new ConfigurationException.CannotOpen(null, cfgval.getVar(), cfgval.getSource(), cfgval.getLine() );
+        }
+
+        String uri = null;
+
+        Iterator<String> iterator = args.iterator();
+        while (iterator.hasNext())
+        {
+            if (uri == null)
+            {
+                uri = iterator.next();
+            }
+            else
+            {
+                String manifest = iterator.next();
+
+                VirtualFile file = ConfigurationPathResolver.getVirtualFile(manifest, configResolver, cfgval);
+
+                if (manifestMappings == null)
+                    manifestMappings = new LinkedHashMap<String, List<VirtualFile>>();
+
+                List<VirtualFile> files = manifestMappings.get(uri);
+                if (files == null)
+                    files = new ArrayList<VirtualFile>();
+                files.add(file);
+
+                manifestMappings.put(uri, files);
+            }
+        }
+    }
+
+    public static ConfigurationInfo getNamespaceInfo()
+    {
+        return new ConfigurationInfo(-1, new String[] {"uri", "manifest"})
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/common/PathResolver.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/common/PathResolver.java b/flex-compiler-oem/src/flex2/compiler/common/PathResolver.java
new file mode 100644
index 0000000..b03ad4f
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/common/PathResolver.java
@@ -0,0 +1,161 @@
+/*
+ *
+ *  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.common;
+
+import flex2.compiler.io.VirtualFile;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * This class acts as a SinglePathResolver, but delegates to a list of
+ * SinglePathResolver bases.  For example, ThreadLocalToolkit's global
+ * PathResolver wraps a collection of SinglePathResolver's like
+ * LocalFilePathResolver, SourcePath, SwcPathResolver, and
+ * URLPathResolver.
+ *
+ * @author Brian Deitte
+ */
+public class PathResolver implements SinglePathResolver
+{
+    private List<SinglePathResolver> bases;
+
+    /**
+     * Resolve the current file used the registered SinglePathResolvers
+     */
+    public VirtualFile resolve( String pathStr )
+    {
+        return resolve((SinglePathResolver)null, pathStr);
+    }
+
+    /**
+     * Resolve the current file, checking the passed in resolver first
+     */
+    public VirtualFile resolve( SinglePathResolver resolver, String pathStr )
+    {
+        if (pathStr == null)
+        {
+            return null;
+        }
+
+        VirtualFile virt = null;
+        if (resolver != null)
+        {
+            virt = resolver.resolve(pathStr);
+        }
+        if (virt == null)
+        {
+            virt = checkSinglePathResolvers(virt, pathStr);
+        }
+
+        return virt;
+    }
+
+    /**
+     * Resolve the current file, checking the passed in resolvers first
+     */
+    public VirtualFile resolve( SinglePathResolver[] resolvers, String pathStr )
+    {
+        if (pathStr == null)
+        {
+            return null;
+        }
+
+        VirtualFile virt = null;
+        if (resolvers != null)
+        {
+            for (int i = 0; i < resolvers.length; i++)
+            {
+                SinglePathResolver resolver = resolvers[i];
+                virt = resolver.resolve(pathStr);
+                if (virt != null)
+                    break;
+            }
+        }
+        if (virt == null)
+        {
+            virt = checkSinglePathResolvers(virt, pathStr);
+        }
+
+        return virt;
+    }
+
+    /**
+     * Add a resolver that will be used in all resolves
+     */
+    public void addSinglePathResolver( SinglePathResolver resolver )
+    {
+        int index = 0;
+
+        if (bases != null)
+        {
+            index = bases.size();
+        }
+
+        addSinglePathResolver(index, resolver);
+    }
+
+    /**
+     * Add a resolver that will be used in all resolves
+     */
+    public void addSinglePathResolver( int index, SinglePathResolver resolver )
+    {
+        assert resolver != null;
+
+        if (bases == null)
+        {
+            bases = new ArrayList<SinglePathResolver>();
+        }
+
+        bases.add(index, resolver);
+    }
+
+    private VirtualFile checkSinglePathResolvers(VirtualFile virt, String pathStr)
+    {
+        if (bases != null)
+        {
+            // fixme: should we just grab the first one or check mod times?
+            for (Iterator<SinglePathResolver> iterator = bases.iterator(); iterator.hasNext();)
+            {
+                SinglePathResolver baseResolver = iterator.next();
+                virt = baseResolver.resolve(pathStr);
+                if (virt != null)
+                {
+                    break;
+                }
+            }
+        }
+        return virt;
+    }
+
+    public void removeSinglePathResolver( SinglePathResolver resolver )
+    {
+        for (Iterator<SinglePathResolver> iterator = bases.iterator(); iterator.hasNext();)
+        {
+            // Intentionally using == here.
+            if (iterator.next() == resolver)
+            {
+                iterator.remove();
+                return;
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/common/RuntimeSharedLibrarySettingsConfiguration.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/common/RuntimeSharedLibrarySettingsConfiguration.java b/flex-compiler-oem/src/flex2/compiler/common/RuntimeSharedLibrarySettingsConfiguration.java
new file mode 100644
index 0000000..5718480
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/common/RuntimeSharedLibrarySettingsConfiguration.java
@@ -0,0 +1,342 @@
+/*
+ *
+ *  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.common;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import flex2.compiler.config.ConfigurationException;
+import flex2.compiler.config.ConfigurationInfo;
+import flex2.compiler.config.ConfigurationValue;
+import flex2.compiler.io.VirtualFile;
+
+/**
+ *  Configuration options association with the 
+ *  runtime-shared-library-path option.
+ *  
+ *  @author dloverin
+ *
+ */
+public class RuntimeSharedLibrarySettingsConfiguration
+{
+    
+    private Configuration configuration;
+    
+    public RuntimeSharedLibrarySettingsConfiguration(Configuration configuration)
+    {
+        this.configuration = configuration;
+    }
+
+    
+    protected ConfigurationPathResolver configResolver;
+
+    public void setConfigPathResolver( ConfigurationPathResolver resolver )
+    {
+        this.configResolver = resolver;
+    }
+
+    // 
+    // 'force-rsl' option
+    //
+    private Set<VirtualFile> forceRsls;
+    
+    /**
+     * Get the array of SWCs that should have their RSLs loaded, even if
+     * the compiler detects no classes being used from the SWC.
+     * @return Array of SWCs that should have their RSLs loaded.
+     */
+    public VirtualFile[] getForceRsls() 
+    {
+        if (forceRsls == null)
+        {
+            return new VirtualFile[0];
+        }
+        
+        return forceRsls.toArray(new VirtualFile[0]);
+    }
+    
+    /**
+     * Get the SWCs that are forced to load RSLs as a set of paths.
+     * 
+     * @return a set of SWC paths.
+     */
+    public Set<String> getForceRslsPaths() 
+    {
+        if (forceRsls == null)
+        {
+            return Collections.emptySet();
+        }
+        
+        Set<String> rslPaths = new HashSet<String>();
+        for (VirtualFile file : forceRsls)
+        {
+            rslPaths.add(file.getName());
+        }
+        
+        return rslPaths;
+    }
+
+    
+    public void cfgForceRsls(ConfigurationValue cfgval, 
+            String[] args)  throws ConfigurationException
+    {
+        // ignore the force option if we are static linking
+        if (configuration.getStaticLinkRsl())
+            return;
+        
+        if (forceRsls == null)
+        {
+            forceRsls = new HashSet<VirtualFile>();
+        }
+ 
+        // Add swc to the forceRsls set.
+        for (String arg : args)
+        {
+            // path-element parameter (swc)
+            // verify path exists and the swc has an
+            // existing -rslp option specified.
+            VirtualFile swcFile = ConfigurationPathResolver.getVirtualFile(arg, configResolver, cfgval);
+            String swcPath = swcFile.getName();
+
+            // verify the swc is used in an the RSL configuration.
+            if (!doesSwcHaveRSLInfo(swcPath))
+            {
+                throw new ConfigurationException.SwcDoesNotHaveRslData(swcPath, 
+                              cfgval.getVar(), cfgval.getSource(), cfgval.getLine());
+            }
+
+            forceRsls.add(swcFile);
+        }
+    }
+    
+    public static ConfigurationInfo getForceRslsInfo()
+    {
+        return new ConfigurationInfo(-1, new String[] {"path-element"})
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+
+            public boolean isAdvanced()
+            {
+                return true;
+            }
+        };
+    }
+
+    // 
+    // 'application-domain' option
+    //
+    
+    /**
+     *  Enum of the supported application domain targets of an RSL. The string
+     *  values represent the valid values that may specified for the 
+     *  application-domain option.
+     */
+    public static enum ApplicationDomainTarget 
+    {
+        DEFAULT("default"),
+        CURRENT("current"),
+        PARENT("parent"),
+        TOP_LEVEL("top-level");
+ 
+        private String applicationDomainValue;
+
+        private ApplicationDomainTarget( String applicationDomainValue )
+        {
+            this.applicationDomainValue = applicationDomainValue;
+        }
+
+        public String getApplicationDomainValue()
+        {
+            return applicationDomainValue;
+        }
+         
+    }
+    
+    /*
+     * Key: swc file path; Value: application domain
+     */
+    private HashMap<VirtualFile,String> applicationDomains;
+
+    /**
+     * Get the application domain an RSL should be loaded into. The default is
+     * the current application domain but the user can override this setting.
+     * @param swcPath The full path of the swc file.
+     * 
+     * @return The application domain the RSL should be loaded into. If the 
+     * swc is not found, then 'default' is returned.
+     */
+    public String getApplicationDomain(String swcPath) 
+    {
+        if (applicationDomains == null || swcPath == null)
+        {
+            return ApplicationDomainTarget.DEFAULT.applicationDomainValue;
+        }
+        
+        for (Map.Entry<VirtualFile, String> entry : applicationDomains.entrySet())
+        {
+            VirtualFile swcFile = entry.getKey();
+            if (swcFile.getName().equals(swcPath))
+            {
+                return entry.getValue();
+            }
+        }
+
+        return ApplicationDomainTarget.DEFAULT.applicationDomainValue;
+    }
+    
+    /**
+     * Get the HashMap of any applicationDomain overrides for RSL loading.  
+     * 
+     * @return Map, key: SWC file path, value: on of application domain strings.
+     */
+    public Map<VirtualFile,String> getApplicationDomains() 
+    {
+        if (applicationDomains == null)
+        {
+            return Collections.emptyMap();
+        }
+        
+        return applicationDomains;
+    }
+
+    
+    public void cfgApplicationDomain(ConfigurationValue cfgval, 
+            String[] args)  throws ConfigurationException
+    {
+        // ignore the force option if we are static linking
+        if (configuration.getStaticLinkRsl())
+            return;
+        
+        if (applicationDomains == null)
+        {
+            applicationDomains = new HashMap<VirtualFile,String>();
+        }
+ 
+        // Add swc and application domain target to the map.
+        // The args are: swc file path, application domain type, ...
+        for (int i = 0; i < args.length; i++)
+        {
+            String arg = args[i++];
+            
+            // path-element parameter (swc)
+            // verify path exists and the swc has an
+            // existing -rslp option specified.
+            VirtualFile swcFile = ConfigurationPathResolver.getVirtualFile(arg, configResolver, cfgval);
+            String swcPath = swcFile.getName();
+
+            // verify the swc is used in an the RSL configuration.
+            if (!doesSwcHaveRSLInfo(swcPath))
+            {
+                throw new ConfigurationException.SwcDoesNotHaveRslData(swcPath, 
+                              cfgval.getVar(), cfgval.getSource(), cfgval.getLine());
+            }
+
+            // Verify the application domain target is valid.
+            arg = args[i];
+            if (!isValidApplicationDomainTarget(arg))
+            {
+                // throw a configuration exception that the application domain 
+                // type is incorrect.
+                throw new ConfigurationException.BadApplicationDomainValue(swcPath, arg, cfgval.getVar(), 
+                        cfgval.getSource(), cfgval.getLine());
+            }
+            
+            applicationDomains.put(swcFile, arg);
+        }
+    }
+    
+    public static ConfigurationInfo getApplicationDomainInfo()
+    {
+        return new ConfigurationInfo(-1, new String[] {"path-element", "application-domain-target"})
+        {
+            public boolean allowMultiple()
+            {
+                return true;
+            }
+
+            public boolean isAdvanced()
+            {
+                return true;
+            }
+            
+            public String getArgName(int argnum)
+            {
+                String argName = null;
+                
+                argnum = argnum % 2;
+                if (argnum == 0)
+                {
+                    argName = "path-element";
+                }
+                else 
+                {
+                    argName = "application-domain-target";
+                }
+                return argName;
+            }
+            
+            
+        };
+    }
+
+    /**
+     * Check if the SWC has any RSL info associated with it.
+     * @param swcPath 
+     * @return true if the swc has RSL info, false otherwise.
+     */
+    private boolean doesSwcHaveRSLInfo(String swcPath)
+    {
+        if (swcPath == null)
+            return false;
+        
+        List<Configuration.RslPathInfo> rslInfoList = configuration.getRslPathInfo();
+        for (Configuration.RslPathInfo rslInfo : rslInfoList)
+        {
+            if (swcPath.equals(rslInfo.getSwcVirtualFile().getName()))
+                return true;
+        }
+        
+        return false;
+    }
+
+    /**
+     * Test if the specified parameter is a valid application domain type.
+     * @param arg
+     * @return true if parameter is a valid application domain type, false otherwise.
+     */
+    private boolean isValidApplicationDomainTarget(String arg) 
+    {
+        for (ApplicationDomainTarget appDomain : ApplicationDomainTarget.values())
+        {
+            if (appDomain.applicationDomainValue.equals(arg))
+                return true;
+        }
+        
+        return false;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/common/SinglePathResolver.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/common/SinglePathResolver.java b/flex-compiler-oem/src/flex2/compiler/common/SinglePathResolver.java
new file mode 100644
index 0000000..da94928
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/common/SinglePathResolver.java
@@ -0,0 +1,38 @@
+/*
+ *
+ *  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.common;
+
+import flex2.compiler.io.VirtualFile;
+
+/**
+ * Defines the API for path resolver implemenations.  Other than
+ * PathResolver, implemenations of this interface resolve paths in a
+ * single way.
+ *
+ * @author Brian Deitte
+ */
+public interface SinglePathResolver
+{
+    /**
+     * If <code>path</code> can be resolved, an instance of
+     * VirtualFile is returned.
+     */
+    VirtualFile resolve(String path);
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/config/AdvancedConfigurationInfo.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/config/AdvancedConfigurationInfo.java b/flex-compiler-oem/src/flex2/compiler/config/AdvancedConfigurationInfo.java
new file mode 100644
index 0000000..3b19e05
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/config/AdvancedConfigurationInfo.java
@@ -0,0 +1,34 @@
+/*
+ *
+ *  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.config;
+
+/**
+ * A convenient ConfigurationInfo extension which returns true from
+ * isAdvanced().
+ *
+ * @author Roger Gonzalez
+ */
+public class AdvancedConfigurationInfo extends ConfigurationInfo
+{
+	public boolean isAdvanced()
+	{
+		return true;
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/dff3a518/flex-compiler-oem/src/flex2/compiler/config/CommandLineConfigurator.java
----------------------------------------------------------------------
diff --git a/flex-compiler-oem/src/flex2/compiler/config/CommandLineConfigurator.java b/flex-compiler-oem/src/flex2/compiler/config/CommandLineConfigurator.java
new file mode 100644
index 0000000..f459a40
--- /dev/null
+++ b/flex-compiler-oem/src/flex2/compiler/config/CommandLineConfigurator.java
@@ -0,0 +1,644 @@
+/*
+ *
+ *  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.config;
+
+//import flash.localization.LocalizationManager;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.LinkedList;
+import java.util.TreeSet;
+import java.util.Set;
+import java.util.Iterator;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+import java.io.File;
+
+/**
+ * A utility class, which is used to parse an array of command line
+ * args and populate a ConfigurationBuffer.  It also contains some
+ * associated methods like brief() and usage().  A counterpart of
+ * FileConfigurator and SystemPropertyConfigurator.
+ *
+ * @author Roger Gonzalez
+ */
+public class CommandLineConfigurator
+{
+	public static final String SOURCE_COMMAND_LINE = "command line";
+	
+    /**
+     * parse - buffer up configuration vals from the command line
+     *
+     * @param buffer        the configuration buffer to hold the results
+     * @param defaultvar    the variable name where the trailing loose args go
+     * @param args          the command line
+     * @throws ConfigurationException
+     */
+    public static void parse( final ConfigurationBuffer buffer,
+                              final String defaultvar,
+                              final String[] args)
+            throws ConfigurationException
+    {
+        assert defaultvar == null || buffer.isValidVar( defaultvar ) : "coding error: config must provide default var " + defaultvar;
+
+        Map<String, String> aliases = getAliases( buffer );
+        final int START = 1;
+        final int ARGS = 2;
+        final int EXEC = 3;
+        final int DONE = 4;
+
+
+        int i = 0, iStart = 0, iEnd = 0;
+        String var = null;
+        int varArgCount = -2;
+        List<String> argList = new LinkedList<String>();
+        Set<String> vars = new HashSet<String>();
+        boolean append = false;
+        boolean dash = true;
+
+        int mode = START;
+
+        while (mode != DONE)
+        {
+            switch (mode)
+            {
+                case START:
+                {
+                	iStart = i;
+                	
+                    if (args.length == i)
+                    {
+                        mode = DONE;
+                        break;
+                    }
+                    // expect -var, --, or the beginning of default args
+
+                    mode = ARGS;
+                    varArgCount = -2;
+
+                    if (args[i].equals("--"))
+                    {
+                        dash = false;
+                        if (defaultvar != null)
+                            var = defaultvar;
+                        else
+                            mode = START;
+                        ++i;
+                    }
+                    else if (dash && args[i].startsWith("+"))
+                    {
+                        String token = null;
+                        int c = (args[i].length() > 1 && args[i].charAt( 1 ) == '+')? 2 : 1;    // gnu-style?
+
+                        int equals = args[i].indexOf( '=' );
+                        String rest = null;
+                        if (equals != -1)
+                        {
+                            rest = args[i].substring( equals + 1 );
+                            token = args[i++].substring( c, equals );
+                        }
+                        else
+                        {
+                            token = args[i++].substring( c );
+                        }
+                        if (equals != -1)
+                        {
+                        	iEnd = i;
+                            buffer.setToken( token, rest );
+                            buffer.addPosition(token, iStart, iEnd);
+                        }
+                        else
+                        {
+                            if (i == args.length)
+                            {
+                                throw new ConfigurationException.Token( ConfigurationException.Token.INSUFFICIENT_ARGS,
+                                                                        token, var, source, -1 );
+                            }
+                            rest = args[i++];
+                            iEnd = i;
+                            buffer.setToken( token, rest );
+                            buffer.addPosition(token, iStart, iEnd);
+                        }
+                        mode = START;
+                        break;
+                    }
+                    else if (dash && isAnArgument(args[i]))
+                    {
+                        int c = (args[i].length() > 1 && args[i].charAt( 1 ) == '-')? 2 : 1;    // gnu-style?
+
+                        int plusequals = args[i].indexOf( "+=" );
+                        int equals = args[i].indexOf( '=' );
+                        String rest = null;
+                        if (plusequals != -1)
+                        {
+                            rest = args[i].substring( plusequals + 2 );
+                            var = args[i++].substring( c, plusequals );
+                            append = true;
+                        }
+                        else if (equals != -1)
+                        {
+                            rest = args[i].substring( equals + 1 );
+                            var = args[i++].substring( c, equals );
+                        }
+                        else
+                        {
+                            var = args[i++].substring( c );
+                        }
+
+                        if (aliases.containsKey( var ))
+                            var = aliases.get( var );
+
+                        if (!buffer.isValidVar( var ))
+                        {
+                            throw new ConfigurationException.UnknownVariable( var, source, -1 );
+                        }
+
+                        if (equals != -1)
+                        {
+                            if ((rest == null) || (rest.length() == 0))
+                            {
+                            	iEnd = i;
+                                buffer.clearVar( var, source, -1 );
+                                buffer.addPosition(var, iStart, iEnd);
+                                mode = START;
+                            }
+                            else
+                            {
+                                String seps = null;
+                                if (buffer.getInfo(var).isPath())
+                                {
+                                    seps = "[," + File.pathSeparatorChar + "]";
+                                }
+                                else {
+                                	seps = ",";
+                                }
+                                
+                                String[] tokens = rest.split(seps);
+                                argList.addAll(Arrays.asList(tokens));
+                                varArgCount = buffer.getVarArgCount( var );
+                                mode = EXEC;
+                            }
+                        }
+
+                    }
+                    else
+                    {
+                        // asdoc sets default var as no-default-arg - it has no default vars
+                        if (defaultvar != null  && !defaultvar.equals("no-default-arg"))
+                        {
+                            // don't increment i, let ARGS pick it up.
+                            var = defaultvar;
+                        }
+                        else
+                        {
+                            throw new ConfigurationException.UnexpectedDefaults( null, null, -1 );
+                        }
+                    }
+                    break;
+                }
+                case ARGS:
+                {
+                    if (varArgCount == -2)
+                    {
+                        if (isBoolean( buffer, var ))
+                        {
+                            varArgCount = 0;
+                            mode = EXEC;
+                            break;
+                        }
+                        else
+                        {
+                            varArgCount = buffer.getVarArgCount( var );
+                        }
+                    }
+                    assert varArgCount >= -1;   // just in case the getVarArgCount author was insane.
+
+                    if (args.length == i)
+                    {
+                        mode = EXEC;
+                        break;
+                    }
+
+                    boolean greedy = buffer.getInfo( var ).isGreedy();
+
+                    // accumulating non-command arguments...
+
+                    
+                    // check for a terminator on our accumulated parameter list
+                    if (!greedy && dash && isAnArgument(args[i]))
+                    {
+                        if (varArgCount == -1)
+                        {
+                            // we were accumulating an unlimited set of args, a new var terminates that.
+                            mode = EXEC;
+                            break;
+                        }
+                        throw new ConfigurationException.IncorrectArgumentCount( varArgCount, argList.size(), var, source, -1 );
+                    }
+
+                    // this test is a little hairy:
+                    //    "The key is that the parameter before the "default" parameter takes an
+                    //     unlimited number of parameters: mxmlc -rsl 1.swf 2.swf test.mxml" -dloverin
+                    if ((varArgCount == -1)
+                            && !greedy
+                            && (defaultvar != null)
+                            && !defaultvar.equals(var)
+                            && !vars.contains( defaultvar )
+                            && ((args.length - i) > 1)
+                            && buffer.getInfo( defaultvar ) != null)
+                    {
+                        // look for a terminating argument, if none,
+                        // then the end of the list cannot be determined (it's ambiguous)
+                        boolean ok = false;
+                        for (int j = i + 1; j < args.length; ++j)
+                        {
+                            if (dash && isAnArgument(args[j]))
+                            {
+                                ok = true;
+                                break;
+                            }
+                        }
+                        if (!ok)
+                        {
+                            throw new ConfigurationException.AmbiguousParse( defaultvar, var, source, -1 );
+                        }
+                    }
+
+                    argList.add( args[i++] );
+                    if (argList.size() == varArgCount)
+                    {
+                        mode = EXEC;
+                    }
+
+                    break;
+                }
+                case EXEC:
+                {
+                    if ((varArgCount != -1) && (argList.size() != varArgCount))
+                    {
+                        throw new ConfigurationException.IncorrectArgumentCount( varArgCount, argList.size(), var, source, -1 );
+                    }
+                    if (varArgCount == 0)       // boolean flag fakery...
+                        argList.add( "true" );
+
+                    if (vars.contains( var ))
+                    {
+                        if ((defaultvar != null) && var.equals( defaultvar ))
+                        {
+                            // we could perhaps accumulate the defaults spread out through
+                            // the rest of the flags, but for now we'll call this illegal.
+                            throw new ConfigurationException.InterspersedDefaults( var, source, -1 );
+                        }
+                    }
+                    iEnd = i;
+                    buffer.setVar( var, new LinkedList<String>( argList ), source, -1, null, append );
+                    buffer.addPosition(var, iStart, iEnd);
+                    append = false;
+                    vars.add( var );
+                    argList.clear();
+                    mode = START;
+                    break;
+                }
+                case DONE:
+                {
+                    assert false;
+                    break;
+                }
+            }
+        }
+    }
+    
+    /**
+     * Given a string like "-foo" or "-5" or "-123.mxml", this determines whether
+     * the string is an argument or... not an argument (e.g. numeral)
+     */
+    private static boolean isAnArgument(final String arg)
+    {
+        return (arg.startsWith("-") &&
+                // if the first character after a dash is numeric, this is not
+                // an argument, it is a parameter (and therefore non-terminating)
+               (arg.length() > 1) && !Character.isDigit(arg.charAt(1)));
+    }
+    
+    private static Map<String, String> getAliases( ConfigurationBuffer buffer )
+    {
+        Map<String, String> aliases = new HashMap<String, String>();
+        aliases.putAll( buffer.getAliases() );
+        for (Iterator it = buffer.getVarIterator(); it.hasNext(); )
+        {
+            String varname = (String) it.next();
+
+            if (varname.indexOf( '.' ) == -1)
+                continue;
+
+            String leafname = varname.substring( varname.lastIndexOf( '.' ) + 1 );
+            if (aliases.containsKey( leafname ))
+                continue;
+            aliases.put( leafname, varname );
+        }
+
+        return aliases;
+    }
+
+    private static boolean isBoolean( ConfigurationBuffer buffer, String var )
+    {
+        ConfigurationInfo info = buffer.getInfo( var );
+
+        if (info.getArgCount() > 1)
+            return false;
+
+        Class c = info.getArgType( 0 );
+
+        return ((c == boolean.class) || (c == Boolean.class));
+    }
+
+    /*
+    public static String brief( String program, String defaultvar, LocalizationManager l10n, String l10nPrefix )
+    {
+        Map<String, String> params = new HashMap<String, String>();
+        params.put( "defaultVar", defaultvar );
+        params.put( "program", program );
+        return l10n.getLocalizedTextString( l10nPrefix + ".Brief", params );
+    }
+
+    static public String usage( String program, String defaultVar, ConfigurationBuffer cfgbuf, Set<String> keywords, LocalizationManager lmgr, String l10nPrefix )
+    {
+        // FIXME (probably a FOL, unfortunately) - this is totally biased to western languages.
+
+        Map<String, String> aliases = getAliases( cfgbuf );
+
+        Map<String, String> sesaila = new HashMap<String, String>();
+        for (Iterator<Map.Entry<String, String>> it = aliases.entrySet().iterator(); it.hasNext();)
+        {
+            Map.Entry<String, String> e = it.next();
+            sesaila.put( e.getValue(), e.getKey() );
+        }
+
+        TreeSet<String> printSet = new TreeSet<String>();
+
+        boolean all = false;
+        boolean advanced = false;
+        boolean details = false;
+        boolean syntax = false;
+        boolean printaliases = false;
+
+        // figure out behavior..
+        Set<String> newSet = new HashSet<String>();
+        for (Iterator<String> kit = keywords.iterator(); kit.hasNext();)
+        {
+            String keyword = kit.next();
+
+            if (keyword.equals( "list" ))
+            {
+                all = true;
+                newSet.add( "*" );
+            }
+            else if (keyword.equals( "advanced" ))
+            {
+                advanced = true;
+                if (keywords.size() == 1)
+                {
+                    all = true;
+                    newSet.add( "*" );
+                }
+            }
+            else if (keyword.equals( "details" ))
+            {
+                details = true;
+            }
+            else if (keyword.equals( "syntax" ))
+            {
+                syntax = true;
+            }
+            else if (keyword.equals( "aliases" ))
+            {
+                printaliases = true;
+            }
+            else
+            {
+                details = true;
+                newSet.add( keyword );
+            }
+        }
+        if (syntax)
+        {
+            List lines = ConfigurationBuffer.formatText( getSyntaxDescription( program, defaultVar, advanced, lmgr,  l10nPrefix ), 78 );
+            StringBuilder text = new StringBuilder( 512 );
+            for (Iterator it = lines.iterator(); it.hasNext();)
+            {
+                text.append( it.next() );
+                text.append( "\n" );
+            }
+            return text.toString();
+        }
+        keywords = newSet;
+
+        // accumulate set to print
+        for (Iterator<String> kit = keywords.iterator(); kit.hasNext();)
+        {
+            String keyword = kit.next().toLowerCase();
+
+            for (Iterator varit = cfgbuf.getVarIterator(); varit.hasNext(); )
+            {
+                String var = (String) varit.next();
+                ConfigurationInfo info = cfgbuf.getInfo( var );
+
+                String description = getDescription( cfgbuf, var, lmgr, l10nPrefix);
+
+                if ((all
+                        || (var.indexOf( keyword ) != -1)
+                        || ((description != null) && (description.toLowerCase().indexOf( keyword ) != -1))
+                        || (keyword.matches( var ) )
+                        || ((sesaila.get( var ) != null) && (sesaila.get( var )).indexOf( keyword ) != -1))
+                     && (!info.isHidden())
+                     && (advanced || !info.isAdvanced()))
+                {
+                    if (printaliases && sesaila.containsKey( var ))
+                        printSet.add( sesaila.get( var ));
+                    else
+                        printSet.add( var );
+                }
+                else
+                {
+                    /*
+                    for (int i = 0; i < info.getAliases().length; ++i)
+                    {
+                        String alias = info.getAliases()[i];
+                        if (alias.indexOf( keyword ) != -1)
+                        {
+                            printSet.add( var );
+                        }
+                    }
+                    *//*
+                }
+            }
+        }
+
+        StringBuilder output = new StringBuilder( 1024 );
+
+        if (printSet.size() == 0)
+        {
+            String nkm = lmgr.getLocalizedTextString( l10nPrefix + ".NoKeywordsMatched" );
+            output.append( nkm );
+            output.append( "\n" );
+        }
+        else for (Iterator<String> it = printSet.iterator(); it.hasNext();)
+        {
+            String avar = it.next();
+            String var = avar;
+            if (aliases.containsKey( avar ))
+                var = aliases.get( avar );
+
+            ConfigurationInfo info = cfgbuf.getInfo( var );
+            assert info != null;
+
+            output.append( "-" );
+            output.append( avar );
+
+            int count = cfgbuf.getVarArgCount( var );
+            if ((count >= 1) && (!isBoolean( cfgbuf, var )))
+            {
+                for (int i = 0; i < count; ++i)
+                {
+                    output.append( " <" );
+                    output.append( cfgbuf.getVarArgName( var, i ) );
+                    output.append( ">" );
+                }
+            }
+            else if (count == -1)
+            {
+                String last = "";
+                for (int i = 0; i < 5; ++i)
+                {
+                    String argname = cfgbuf.getVarArgName( var, i );
+                    if (!argname.equals( last ))
+                    {
+                        output.append( " [" );
+                        output.append( argname );
+                        output.append( "]" );
+                        last = argname;
+                    }
+                    else
+                    {
+                        output.append( " [...]" );
+                        break;
+                    }
+                }
+            }
+
+            output.append( "\n" );
+
+            if (details)
+            {
+                StringBuilder description = new StringBuilder( 160 );
+                if (printaliases)
+                {
+                    if (aliases.containsKey( avar ))
+                    {
+                        String fullname = lmgr.getLocalizedTextString( l10nPrefix + ".FullName" );
+                        description.append( fullname );
+                        description.append( " -" );
+                        description.append( aliases.get( avar ));
+                        description.append( "\n" );
+                    }
+                }
+                else if (sesaila.containsKey( var ))
+                {
+                    String alias = lmgr.getLocalizedTextString( l10nPrefix + ".Alias" );
+                    description.append( alias );
+                    description.append( " -" );
+                    description.append( sesaila.get( var ));
+                    description.append( "\n" );
+                }
+
+                String d = getDescription(cfgbuf, var, lmgr, l10nPrefix);
+                if (var.equals( "help" ) && (printSet.size() > 2))
+                {
+                    String helpKeywords = lmgr.getLocalizedTextString( l10nPrefix + ".HelpKeywords" );
+                    description.append( helpKeywords );
+                }
+                else if (d != null)
+                    description.append( d );
+
+                String flags = "";
+                if (info.isAdvanced())
+                {
+                    String advancedString = lmgr.getLocalizedTextString( l10nPrefix + ".Advanced" );
+                    flags += (((flags.length() == 0)? " (" : ", ") + advancedString );
+                }
+                if (info.allowMultiple())
+                {
+                    String repeatableString = lmgr.getLocalizedTextString( l10nPrefix + ".Repeatable" );
+                    flags += (((flags.length() == 0)? " (" : ", ") + repeatableString );
+                }
+                if ((defaultVar != null) && var.equals( defaultVar ))
+                {
+                    String defaultString = lmgr.getLocalizedTextString( l10nPrefix + ".Default" );
+                    flags += (((flags.length() == 0)? " (" : ", ") + defaultString );
+                }
+                if (flags.length() != 0)
+                {
+                    flags += ")";
+                }
+                description.append( flags );
+
+
+                List descriptionLines = ConfigurationBuffer.formatText( description.toString(), 70 );
+
+                for (Iterator descit = descriptionLines.iterator(); descit.hasNext();)
+                {
+                    output.append( "    " );
+                    output.append( (String) descit.next() );
+                    output.append( "\n" );
+                }
+            }
+        }
+        return output.toString();
+    }
+
+    public static String getDescription( ConfigurationBuffer buffer, String var, LocalizationManager l10n, String l10nPrefix )
+    {
+        String key = (l10nPrefix == null)? var : (l10nPrefix + "." + var);
+        String description = l10n.getLocalizedTextString( key, null );
+
+        return description;
+    }
+
+    public static String getSyntaxDescription( String program, String defaultVar, boolean advanced, LocalizationManager l10n, String l10nPrefix )
+    {
+        Map<String, String> params = new HashMap<String, String>();
+        params.put("defaultVar", defaultVar);
+        params.put("program", program);
+
+        String key = l10nPrefix + "." + (advanced? "AdvancedSyntax" : "Syntax");
+        String text = l10n.getLocalizedTextString( key, params );
+
+        if (text == null)
+        {
+            text = "No syntax help available, try '-help list' to list available configuration variables.";
+            assert false : "Localized text for syntax description not found!";
+        }
+        return text;
+    }
+    */
+    
+    public static final String source = SOURCE_COMMAND_LINE;
+}


Mime
View raw message