You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by cd...@apache.org on 2014/10/31 14:41:36 UTC

[1/2] - Moved the ISWFWriterFactory from swc.io to swf.io. - Renamed SWFWriterAndSizeReporter to SizeReportWritingSWFWriter. - Added support for the advanced-telemetry commandline option. - Added a flexmojos testcase for the advanced-telemetry option.

Repository: flex-falcon
Updated Branches:
  refs/heads/feature/flexmojos-tests 142af1891 -> 2c4f63117


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/flexmojos-tests/advanced-telemetry-not-supported/pom.xml
----------------------------------------------------------------------
diff --git a/flexmojos-tests/advanced-telemetry-not-supported/pom.xml b/flexmojos-tests/advanced-telemetry-not-supported/pom.xml
new file mode 100644
index 0000000..fa179d1
--- /dev/null
+++ b/flexmojos-tests/advanced-telemetry-not-supported/pom.xml
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+  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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.flex.compiler.falcon.tests</groupId>
+    <artifactId>advanced-telemetry-not-supported</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <packaging>swf</packaging>
+
+    <build>
+        <sourceDirectory>src/main/flex</sourceDirectory>
+        <plugins>
+            <plugin>
+                <groupId>net.flexmojos.oss</groupId>
+                <artifactId>flexmojos-maven-plugin</artifactId>
+                <version>7.1.0-SNAPSHOT</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <advancedTelemetry>true</advancedTelemetry>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.apache.flex.compiler</groupId>
+                        <artifactId>falcon-compiler</artifactId>
+                        <version>0.0.3-SNAPSHOT</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.flex</groupId>
+            <artifactId>framework</artifactId>
+            <version>4.13.0.20140701</version>
+            <type>pom</type>
+        </dependency>
+        <dependency>
+            <groupId>com.adobe.flash.framework</groupId>
+            <artifactId>playerglobal</artifactId>
+            <version>13.0</version>
+            <type>swc</type>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/flexmojos-tests/advanced-telemetry-not-supported/src/main/flex/TestApplication.mxml
----------------------------------------------------------------------
diff --git a/flexmojos-tests/advanced-telemetry-not-supported/src/main/flex/TestApplication.mxml b/flexmojos-tests/advanced-telemetry-not-supported/src/main/flex/TestApplication.mxml
new file mode 100644
index 0000000..8d6968f
--- /dev/null
+++ b/flexmojos-tests/advanced-telemetry-not-supported/src/main/flex/TestApplication.mxml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+
+  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.
+
+-->
+<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
+               xmlns:s="library://ns.adobe.com/flex/spark">
+
+    <s:Label text="Application with advanced telemetry"/>
+
+</s:Application>

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/flexmojos-tests/pom.xml
----------------------------------------------------------------------
diff --git a/flexmojos-tests/pom.xml b/flexmojos-tests/pom.xml
index f47cd4a..e341e0d 100644
--- a/flexmojos-tests/pom.xml
+++ b/flexmojos-tests/pom.xml
@@ -101,6 +101,11 @@
             Problem area: When including an mx:Repeater, Falcon produces operand stack underflow exceptions.
         -->
         <module>mx-repeater</module>
+
+        <!--
+            Problem area: the advancedTelemetry option doesn't seem to be supported.
+        -->
+        <module>advanced-telemetry-not-supported</module>
     </modules>
 
 </project>
\ No newline at end of file


[2/2] git commit: [flex-falcon] [refs/heads/feature/flexmojos-tests] - - Moved the ISWFWriterFactory from swc.io to swf.io. - Renamed SWFWriterAndSizeReporter to SizeReportWritingSWFWriter. - Added support for the advanced-telemetry commandline option. -

Posted by cd...@apache.org.
- Moved the ISWFWriterFactory from swc.io to swf.io.
- Renamed SWFWriterAndSizeReporter to SizeReportWritingSWFWriter.
- Added support for the advanced-telemetry commandline option.
- Added a flexmojos testcase for the advanced-telemetry option.


Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/2c4f6311
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/2c4f6311
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/2c4f6311

Branch: refs/heads/feature/flexmojos-tests
Commit: 2c4f631174ce2e5661e95651042e7ba14cb49f82
Parents: 142af18
Author: Christofer Dutz <ch...@codecentric.de>
Authored: Fri Oct 31 14:41:27 2014 +0100
Committer: Christofer Dutz <ch...@codecentric.de>
Committed: Fri Oct 31 14:41:27 2014 +0100

----------------------------------------------------------------------
 .../org/apache/flex/compiler/clients/ASC.java   |   7 +-
 .../org/apache/flex/compiler/clients/COMPC.java |  10 +-
 .../org/apache/flex/compiler/clients/MXMLC.java |  14 +-
 .../apache/flex/compiler/clients/Optimizer.java |   9 +-
 .../flex/compiler/config/Configuration.java     |  37 +-
 .../internal/config/TargetSettings.java         |   5 +
 .../flex/compiler/targets/ITargetSettings.java  |  10 +-
 .../apache/flex/swc/io/ISWFWriterFactory.java   |  33 --
 .../apache/flex/swc/io/SWCDirectoryWriter.java  |  24 +-
 .../src/org/apache/flex/swc/io/SWCWriter.java   |  17 +-
 .../org/apache/flex/swc/io/SWCWriterBase.java   |  25 +-
 compiler/src/org/apache/flex/swf/ISWF.java      |  17 +
 compiler/src/org/apache/flex/swf/SWF.java       |  18 +-
 compiler/src/org/apache/flex/swf/TagType.java   |   1 +
 .../src/org/apache/flex/swf/io/ISWFWriter.java  |   8 +-
 .../apache/flex/swf/io/ISWFWriterFactory.java   |  34 ++
 .../src/org/apache/flex/swf/io/SWFDump.java     |  69 +--
 .../src/org/apache/flex/swf/io/SWFReader.java   |  74 +--
 .../src/org/apache/flex/swf/io/SWFWriter.java   | 117 ++---
 .../flex/swf/io/SWFWriterAndSizeReporter.java   | 478 -------------------
 .../flex/swf/io/SizeReportWritingSWFWriter.java | 477 ++++++++++++++++++
 .../flex/swf/tags/EnableTelemetryTag.java       |  40 ++
 .../advanced-telemetry-not-supported/pom.xml    |  68 +++
 .../src/main/flex/TestApplication.mxml          |  25 +
 flexmojos-tests/pom.xml                         |   5 +
 25 files changed, 868 insertions(+), 754 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/compiler/clients/ASC.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/clients/ASC.java b/compiler/src/org/apache/flex/compiler/clients/ASC.java
index fbb0f7d..a2028c5 100644
--- a/compiler/src/org/apache/flex/compiler/clients/ASC.java
+++ b/compiler/src/org/apache/flex/compiler/clients/ASC.java
@@ -145,6 +145,11 @@ public class ASC
         }
 
         @Override
+        public boolean isTelemetryEnabled() {
+            return false;
+        }
+
+        @Override
         public boolean isOptimized()
         {
             return getOptimize();
@@ -704,7 +709,7 @@ public class ASC
      * Compile one source file. Each source file has its own symbol table.
      * 
      * @param workspace workspace
-     * @param sourceFilename source filename
+     * @param sourceFilenames source filename
      * @throws InterruptedException compiler thread error
      * @return true compiled without problem
      */

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/compiler/clients/COMPC.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/clients/COMPC.java b/compiler/src/org/apache/flex/compiler/clients/COMPC.java
index 988e8d8..6216855 100644
--- a/compiler/src/org/apache/flex/compiler/clients/COMPC.java
+++ b/compiler/src/org/apache/flex/compiler/clients/COMPC.java
@@ -42,7 +42,7 @@ import org.apache.flex.swc.ISWC;
 import org.apache.flex.swc.io.ISWCWriter;
 import org.apache.flex.swc.io.SWCDirectoryWriter;
 import org.apache.flex.swc.io.SWCWriter;
-import org.apache.flex.swf.io.SWFWriterAndSizeReporter;
+import org.apache.flex.swf.io.SizeReportWritingSWFWriter;
 import org.apache.flex.utils.FilenameNormalization;
 
 /**
@@ -155,8 +155,8 @@ public class COMPC extends MXMLC
         {
             final String path = FilenameNormalization.normalize(outputOptionValue);
             final ISWCWriter swcWriter = new SWCDirectoryWriter(path, useCompression,
-                    targetSettings.isDebugEnabled(), 
-                    SWFWriterAndSizeReporter.getSWFWriterFactory(targetSettings.getSizeReport()));
+                    targetSettings.isDebugEnabled(), targetSettings.isTelemetryEnabled(),
+                    SizeReportWritingSWFWriter.getSWFWriterFactory(targetSettings.getSizeReport()));
             swcWriter.write(swc);
             long endTime = System.nanoTime();
             String seconds = String.format("%5.3f", (endTime - startTime) / 1e9);
@@ -170,8 +170,8 @@ public class COMPC extends MXMLC
         else
         {
             final ISWCWriter swcWriter = new SWCWriter(outputOptionValue, useCompression,
-                    targetSettings.isDebugEnabled(), 
-                    SWFWriterAndSizeReporter.getSWFWriterFactory(targetSettings.getSizeReport()));
+                    targetSettings.isDebugEnabled(), targetSettings.isTelemetryEnabled(),
+                    SizeReportWritingSWFWriter.getSWFWriterFactory(targetSettings.getSizeReport()));
             swcWriter.write(swc);
             final File outputFile = new File(outputOptionValue);
             long endTime = System.nanoTime();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/compiler/clients/MXMLC.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/clients/MXMLC.java b/compiler/src/org/apache/flex/compiler/clients/MXMLC.java
index 9181c82..c10d826 100644
--- a/compiler/src/org/apache/flex/compiler/clients/MXMLC.java
+++ b/compiler/src/org/apache/flex/compiler/clients/MXMLC.java
@@ -84,11 +84,11 @@ import org.apache.flex.compiler.tree.as.IASNode;
 import org.apache.flex.compiler.tree.as.IFileNode;
 import org.apache.flex.compiler.units.ICompilationUnit;
 import org.apache.flex.compiler.units.ICompilationUnit.UnitType;
-import org.apache.flex.swc.io.ISWFWriterFactory;
+import org.apache.flex.swf.io.ISWFWriterFactory;
 import org.apache.flex.swf.Header;
 import org.apache.flex.swf.ISWF;
 import org.apache.flex.swf.io.ISWFWriter;
-import org.apache.flex.swf.io.SWFWriterAndSizeReporter;
+import org.apache.flex.swf.io.SizeReportWritingSWFWriter;
 import org.apache.flex.utils.FilenameNormalization;
 
 import com.google.common.base.Function;
@@ -850,9 +850,10 @@ public class MXMLC
                 targetSettings.useCompression(), 
                 targetSettings.getSWFVersion(),
                 targetSettings.isDebugEnabled());
-        final ISWFWriterFactory writerFactory = SWFWriterAndSizeReporter.getSWFWriterFactory(
+        final ISWFWriterFactory writerFactory = SizeReportWritingSWFWriter.getSWFWriterFactory(
                 targetSettings.getSizeReport()); 
-        final ISWFWriter writer = writerFactory.createSWFWriter(swf, compression, targetSettings.isDebugEnabled());
+        final ISWFWriter writer = writerFactory.createSWFWriter(swf, compression,
+                targetSettings.isDebugEnabled(), targetSettings.isTelemetryEnabled());
         
         return writer.writeTo(outputFile);
     }
@@ -1141,9 +1142,10 @@ public class MXMLC
                 targetSettings.useCompression(), 
                 targetSettings.getSWFVersion(),
                 targetSettings.isDebugEnabled());
-        final ISWFWriterFactory writerFactory = SWFWriterAndSizeReporter.getSWFWriterFactory(
+        final ISWFWriterFactory writerFactory = SizeReportWritingSWFWriter.getSWFWriterFactory(
                 targetSettings.getSizeReport()); 
-        final ISWFWriter writer = writerFactory.createSWFWriter(swfTarget, compression, targetSettings.isDebugEnabled());
+        final ISWFWriter writer = writerFactory.createSWFWriter(swfTarget, compression,
+                targetSettings.isDebugEnabled(), targetSettings.isTelemetryEnabled());
         
         // Write out the SWF, counting how many bytes were written.
         final CountingOutputStream output =

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/compiler/clients/Optimizer.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/clients/Optimizer.java b/compiler/src/org/apache/flex/compiler/clients/Optimizer.java
index eaa442a..9fadf6d 100644
--- a/compiler/src/org/apache/flex/compiler/clients/Optimizer.java
+++ b/compiler/src/org/apache/flex/compiler/clients/Optimizer.java
@@ -46,12 +46,12 @@ import org.apache.flex.compiler.problems.FileNotFoundProblem;
 import org.apache.flex.compiler.problems.ICompilerProblem;
 import org.apache.flex.compiler.targets.ITargetProgressMonitor;
 import org.apache.flex.compiler.targets.ITargetSettings;
-import org.apache.flex.swc.io.ISWFWriterFactory;
+import org.apache.flex.swf.io.ISWFWriterFactory;
 import org.apache.flex.swf.Header;
 import org.apache.flex.swf.ISWF;
 import org.apache.flex.swf.io.ISWFWriter;
 import org.apache.flex.swf.io.SWFReader;
-import org.apache.flex.swf.io.SWFWriterAndSizeReporter;
+import org.apache.flex.swf.io.SizeReportWritingSWFWriter;
 import com.google.common.collect.ImmutableSet;
 
 import java.io.BufferedInputStream;
@@ -138,9 +138,10 @@ public class Optimizer
                         {
                             Header.Compression compression = Header.decideCompression(true, swf.getVersion(), false);
     
-                            final ISWFWriterFactory writerFactory = SWFWriterAndSizeReporter.getSWFWriterFactory(
+                            final ISWFWriterFactory writerFactory = SizeReportWritingSWFWriter.getSWFWriterFactory(
                                     targetSettings.getSizeReport());
-                            final ISWFWriter writer = writerFactory.createSWFWriter(optimizedSWF, compression, targetSettings.isDebugEnabled());
+                            final ISWFWriter writer = writerFactory.createSWFWriter(optimizedSWF, compression,
+                                    targetSettings.isDebugEnabled(), targetSettings.isTelemetryEnabled());
                             int swfSize = writer.writeTo(outputFile);
             
                             long endTime = System.nanoTime();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/compiler/config/Configuration.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/config/Configuration.java b/compiler/src/org/apache/flex/compiler/config/Configuration.java
index 893dead..1dc5417 100644
--- a/compiler/src/org/apache/flex/compiler/config/Configuration.java
+++ b/compiler/src/org/apache/flex/compiler/config/Configuration.java
@@ -5755,7 +5755,42 @@ public class Configuration
     {
         this.warnOnFlexOnlyOptionUsage = value;
     }
-    
+
+    private boolean enableTelemetry = false;
+
+    /**
+     *
+     * @return True if telemetry is enabled, false otherwise.
+     */
+    public boolean isEnableTelemetry() {
+        return enableTelemetry;
+    }
+
+    /**
+     * Controls if the flash runtime should allow providing advanced telemetry options
+     * to external tools.
+     *
+     * @param enableTelemetry True to enable telemetry, false to disable. The default ist to disable.
+     */
+    public void setEnableTelemetry(boolean enableTelemetry) {
+        this.enableTelemetry = enableTelemetry;
+    }
+
+    /**
+     * Turns on the advanced telemetry options of the flash runtime to allow clients like scout to
+     * connect.
+     *
+     * Remark: Internally and in the spec this option is called "enable telemetry" but by tools
+     * and the commandline it's referenced by advanced-telemetry.
+     */
+    @Config(advanced = true)
+    @Mapping({"compiler", "advanced-telemetry"})
+    @FlexOnly
+    public void setEnableTelemetry(ConfigurationValue cv, boolean enableTelemetry) throws CannotOpen
+    {
+        this.enableTelemetry = enableTelemetry;
+    }
+
     private void processDeprecatedAndRemovedOptions(ConfigurationBuffer configurationBuffer)
     {
         for (final String var : configurationBuffer.getVars())

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java b/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java
index aef9e94..0d84e88 100644
--- a/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java
+++ b/compiler/src/org/apache/flex/compiler/internal/config/TargetSettings.java
@@ -83,6 +83,11 @@ public class TargetSettings implements ITargetSettings
         return configuration.isDebuggingEnabled();
     }
 
+    @Override
+    public boolean isTelemetryEnabled() {
+        return configuration.isEnableTelemetry();
+    }
+
     /**
      * @return the optimized
      */

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java b/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java
index a33c0b7..7300b02 100644
--- a/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java
+++ b/compiler/src/org/apache/flex/compiler/targets/ITargetSettings.java
@@ -46,7 +46,15 @@ public interface ITargetSettings
      * included, false otherwise.
      */
     boolean isDebugEnabled();
-    
+
+    /**
+     * Returns true if the target file has advanced telemetry
+     * enabled.
+     * @return true if the target file has advanced telemetry
+     * enabled, false otherwise.
+     */
+    boolean isTelemetryEnabled();
+
     /**
      * Returns true if the target should be optimized.
      * 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swc/io/ISWFWriterFactory.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swc/io/ISWFWriterFactory.java b/compiler/src/org/apache/flex/swc/io/ISWFWriterFactory.java
deleted file mode 100644
index 6e8be9d..0000000
--- a/compiler/src/org/apache/flex/swc/io/ISWFWriterFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- *  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 org.apache.flex.swc.io;
-
-import org.apache.flex.swf.Header;
-import org.apache.flex.swf.ISWF;
-import org.apache.flex.swf.io.ISWFWriter;
-
-/**
- * A factory interface for creating {@link ISWFWriter}.
- */
-public interface ISWFWriterFactory
-{
-
-    ISWFWriter createSWFWriter(ISWF swf, Header.Compression useCompression, boolean enableDebug);
-}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swc/io/SWCDirectoryWriter.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swc/io/SWCDirectoryWriter.java b/compiler/src/org/apache/flex/swc/io/SWCDirectoryWriter.java
index 8d415dc..26f8029 100644
--- a/compiler/src/org/apache/flex/swc/io/SWCDirectoryWriter.java
+++ b/compiler/src/org/apache/flex/swc/io/SWCDirectoryWriter.java
@@ -38,7 +38,8 @@ import org.apache.flex.swc.ISWCFileEntry;
 import org.apache.flex.swc.ISWCLibrary;
 import org.apache.flex.swf.ISWF;
 import org.apache.flex.swf.io.ISWFWriter;
-import org.apache.flex.swf.io.SWFWriterAndSizeReporter;
+import org.apache.flex.swf.io.ISWFWriterFactory;
+import org.apache.flex.swf.io.SizeReportWritingSWFWriter;
 
 /**
  * Write a SWC model to an open directory. {@code compc} can be configured to
@@ -59,7 +60,7 @@ public class SWCDirectoryWriter extends SWCWriterBase
      */
     public SWCDirectoryWriter(String path)
     {
-        this(path, true, true, SWFWriterAndSizeReporter.getSWFWriterFactory(null));
+        this(path, true, true, false, SizeReportWritingSWFWriter.getSWFWriterFactory(null));
     }
 
     /**
@@ -75,9 +76,10 @@ public class SWCDirectoryWriter extends SWCWriterBase
     public SWCDirectoryWriter(String path,
             boolean compressLibrarySWF,
             boolean enableDebug,
+            boolean enableTelemetry,
             ISWFWriterFactory swfWriterFactory)
     {
-        super(compressLibrarySWF, enableDebug, swfWriterFactory);
+        super(compressLibrarySWF, enableDebug, enableTelemetry, swfWriterFactory);
         this.directory = new File(path);
     }
 
@@ -104,16 +106,18 @@ public class SWCDirectoryWriter extends SWCWriterBase
         assert path != null : "Expect SWF path";
 
         final OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(new File(directory, path)));
-        ISWFWriter swfWriter = swfWriterFactory.createSWFWriter(swf, 
-                getLibrarySWFCompression(), enableDebug);
+
         final DigestOutputStream digestStream = getDigestOutputStream(library, outputStream);
-        
+
+        ISWFWriter swfWriter = swfWriterFactory.createSWFWriter(swf,
+                getLibrarySWFCompression(), enableDebug, enableTelemetry);
         swfWriter.writeTo(digestStream != null ? digestStream : outputStream);
         swfWriter.close();
         outputStream.close();
 
-        if (digestStream != null)
+        if (digestStream != null) {
             addDigestToLibrary(digestStream, library);
+        }
     }
 
     @Override
@@ -121,8 +125,9 @@ public class SWCDirectoryWriter extends SWCWriterBase
     {
         final File file = new File(directory, fileEntry.getPath()).getAbsoluteFile();
         final File parentFolder = file.getParentFile();
-        if (!parentFolder.isDirectory())
+        if (!parentFolder.isDirectory()) {
             parentFolder.mkdirs();
+        }
         file.createNewFile();
         final OutputStream outputStream = new FileOutputStream(file);
         final InputStream fileInputStream = fileEntry.createInputStream();
@@ -136,8 +141,9 @@ public class SWCDirectoryWriter extends SWCWriterBase
     {
         if (!directory.exists())
         {
-            if (!directory.mkdir())
+            if (!directory.mkdir()) {
                 throw new FileNotFoundException(directory.getAbsolutePath());
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swc/io/SWCWriter.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swc/io/SWCWriter.java b/compiler/src/org/apache/flex/swc/io/SWCWriter.java
index 4781155..8af8c41 100644
--- a/compiler/src/org/apache/flex/swc/io/SWCWriter.java
+++ b/compiler/src/org/apache/flex/swc/io/SWCWriter.java
@@ -39,7 +39,8 @@ import org.apache.flex.swc.ISWCFileEntry;
 import org.apache.flex.swc.ISWCLibrary;
 import org.apache.flex.swf.ISWF;
 import org.apache.flex.swf.io.ISWFWriter;
-import org.apache.flex.swf.io.SWFWriterAndSizeReporter;
+import org.apache.flex.swf.io.ISWFWriterFactory;
+import org.apache.flex.swf.io.SizeReportWritingSWFWriter;
 
 /**
  * Implementation for serializing a SWC model to a *.swc library file.
@@ -55,7 +56,7 @@ public class SWCWriter extends SWCWriterBase
      */
     public SWCWriter(final String filename) throws FileNotFoundException
     {
-        this(filename, true, true, SWFWriterAndSizeReporter.getSWFWriterFactory(null));
+        this(filename, true, true, false, SizeReportWritingSWFWriter.getSWFWriterFactory(null));
     }
     
     /**
@@ -69,9 +70,10 @@ public class SWCWriter extends SWCWriterBase
     public SWCWriter(final String filename, 
             boolean compressLibrarySWF,
             boolean enableDebug,
+            boolean enableTelemetry,
             ISWFWriterFactory swfWriterFactory) throws FileNotFoundException
     {
-        super(compressLibrarySWF, enableDebug, swfWriterFactory);
+        super(compressLibrarySWF, enableDebug, enableTelemetry, swfWriterFactory);
         
         // Ensure that the directory for the SWC exists.
         File outputFile = new File(filename);
@@ -106,15 +108,18 @@ public class SWCWriter extends SWCWriterBase
         assert path != null : "Expect SWF path";
 
         zipOutputStream.putNextEntry(new ZipEntry(path));
-        ISWFWriter swfWriter = swfWriterFactory.createSWFWriter(swf, 
-                getLibrarySWFCompression(), enableDebug);
+
         final DigestOutputStream digestStream = getDigestOutputStream(library, zipOutputStream);
+
+        ISWFWriter swfWriter = swfWriterFactory.createSWFWriter(swf,
+                getLibrarySWFCompression(), enableDebug, enableTelemetry);
         swfWriter.writeTo(digestStream != null ? digestStream : zipOutputStream);
         swfWriter.close();
         zipOutputStream.closeEntry();
         
-        if (digestStream != null)
+        if (digestStream != null) {
             addDigestToLibrary(digestStream, library);
+        }
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swc/io/SWCWriterBase.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swc/io/SWCWriterBase.java b/compiler/src/org/apache/flex/swc/io/SWCWriterBase.java
index b05559c..4e4e7a6 100644
--- a/compiler/src/org/apache/flex/swc/io/SWCWriterBase.java
+++ b/compiler/src/org/apache/flex/swc/io/SWCWriterBase.java
@@ -38,6 +38,7 @@ import org.apache.flex.swc.SWCDigest;
 import org.apache.flex.swc.catalog.StAXCatalogWriter;
 import org.apache.flex.swf.Header;
 import org.apache.flex.swf.Header.Compression;
+import org.apache.flex.swf.io.ISWFWriterFactory;
 
 /**
  * Base class for serializing a SWC model.
@@ -57,20 +58,24 @@ abstract class SWCWriterBase implements ISWCWriter
      * false otherwise.
      * @param enableDebug - true if the library should be build with debug
      * enabled, false otherwise.
+     * @param enableTelemetry - true if the library should be build with telemetry
+     * enabled, false otherwise.
      * @param swfWriterFactory - factory for creating swf writers.
      */
     protected SWCWriterBase(boolean compressLibrarySWF,
-            boolean enableDebug,
+            boolean enableDebug, boolean enableTelemetry,
             ISWFWriterFactory swfWriterFactory)
     {
         assert swfWriterFactory != null;
         this.compressLibrarySWF = compressLibrarySWF;
         this.enableDebug = enableDebug;
+        this.enableTelemetry = enableTelemetry;
         this.swfWriterFactory = swfWriterFactory;
     }
     
     private final boolean compressLibrarySWF;   // true if the library is built compressed
     protected final boolean enableDebug;
+    protected final boolean enableTelemetry;
     protected final ISWFWriterFactory swfWriterFactory;
     
     /**
@@ -132,14 +137,14 @@ abstract class SWCWriterBase implements ISWCWriter
     /**
      * Add a library to the target SWC.
      * 
-     * @param library SWC library.
+     * @param swc SWC library.
      */
     abstract void writeLibrary(ISWCLibrary swc) throws IOException;
 
     /**
      * Add a file entry to the target SWC.
      * 
-     * @param library SWC library.
+     * @param swc SWC library.
      */
     abstract void writeFile(ISWCFileEntry swc) throws IOException;
 
@@ -183,14 +188,12 @@ abstract class SWCWriterBase implements ISWCWriter
      */
     protected DigestOutputStream getDigestOutputStream(ISWCLibrary library, OutputStream outputStream)
     {
-        DigestOutputStream digestStream = null;
-        MessageDigest messageDigest = null;
         if (!hasUnsignedDigest(library))
         {
             try
             {
-                messageDigest = MessageDigest.getInstance(SWCDigest.SHA_256);
-                digestStream = new DigestOutputStream(outputStream, messageDigest);
+                MessageDigest messageDigest = MessageDigest.getInstance(SWCDigest.SHA_256);
+                return new DigestOutputStream(outputStream, messageDigest);
             }
             catch (NoSuchAlgorithmException e)
             {
@@ -199,7 +202,7 @@ abstract class SWCWriterBase implements ISWCWriter
             }  
         }
             
-        return digestStream;
+        return null;
     }
     
     /**
@@ -212,8 +215,9 @@ abstract class SWCWriterBase implements ISWCWriter
     protected void addDigestToLibrary(DigestOutputStream digestStream, 
             ISWCLibrary library)
     {
-        if (library == null)
+        if (library == null) {
             throw new NullPointerException("library may not be null");
+        }
         
         if (digestStream != null)
         {
@@ -237,8 +241,9 @@ abstract class SWCWriterBase implements ISWCWriter
         
         for (ISWCDigest digest : digests)
         {
-            if (!digest.isSigned())
+            if (!digest.isSigned()) {
                 return true;
+            }
         }
         return false;
     }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/ISWF.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/ISWF.java b/compiler/src/org/apache/flex/swf/ISWF.java
index 5e84d33..a431d23 100644
--- a/compiler/src/org/apache/flex/swf/ISWF.java
+++ b/compiler/src/org/apache/flex/swf/ISWF.java
@@ -20,6 +20,7 @@
 package org.apache.flex.swf;
 
 import org.apache.flex.swf.tags.EnableDebugger2Tag;
+import org.apache.flex.swf.tags.EnableTelemetryTag;
 import org.apache.flex.swf.tags.ProductInfoTag;
 import org.apache.flex.swf.tags.ScriptLimitsTag;
 import org.apache.flex.swf.types.RGB;
@@ -261,4 +262,20 @@ public interface ISWF
      * @param tag the ProductInfoTag, may be null.
      */
     void setProductInfo(ProductInfoTag tag);
+
+    /**
+     * Get the {@code EnableTelemetryTag} tag.
+     *
+     * @return {@code EnableTelemetryTag} or null if there is no enable telemetry
+     * information associated with the SWF.
+     */
+    EnableTelemetryTag getEnableTelemetry();
+
+    /**
+     * Set the enable telemetry tag associated with the SWF.
+     *
+     * @param tag the EnableTelemetryTag, may be null.
+     */
+    void setEnableTelemetry(EnableTelemetryTag tag);
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/SWF.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/SWF.java b/compiler/src/org/apache/flex/swf/SWF.java
index f1a4f38..71ca868 100644
--- a/compiler/src/org/apache/flex/swf/SWF.java
+++ b/compiler/src/org/apache/flex/swf/SWF.java
@@ -23,11 +23,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.flex.swf.io.SWFWriter;
-import org.apache.flex.swf.tags.EnableDebugger2Tag;
-import org.apache.flex.swf.tags.FileAttributesTag;
-import org.apache.flex.swf.tags.MetadataTag;
-import org.apache.flex.swf.tags.ProductInfoTag;
-import org.apache.flex.swf.tags.ScriptLimitsTag;
+import org.apache.flex.swf.tags.*;
 import org.apache.flex.swf.types.RGB;
 import org.apache.flex.swf.types.Rect;
 
@@ -82,6 +78,7 @@ public class SWF implements ISWF
     private EnableDebugger2Tag enableDebugger2;
     private ScriptLimitsTag scriptLimits;
     private ProductInfoTag productInfoTag;
+    private EnableTelemetryTag enableTelemetry;
 
     @Override
     public void addFrame(SWFFrame frame)
@@ -323,4 +320,15 @@ public class SWF implements ISWF
     {
         this.productInfoTag = tag;
     }
+
+    @Override
+    public EnableTelemetryTag getEnableTelemetry() {
+        return enableTelemetry;
+    }
+
+    @Override
+    public void setEnableTelemetry(EnableTelemetryTag tag) {
+        this.enableTelemetry = tag;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/TagType.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/TagType.java b/compiler/src/org/apache/flex/swf/TagType.java
index 22e347f..ce9f486 100644
--- a/compiler/src/org/apache/flex/swf/TagType.java
+++ b/compiler/src/org/apache/flex/swf/TagType.java
@@ -93,6 +93,7 @@ public enum TagType
     StartSound2(89),
     DefineBitsJPEG4(90),
     DefineFont4(91),
+    EnableTelemetry(93),
     Undefined(-1);
 
     private final int value;

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/io/ISWFWriter.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/io/ISWFWriter.java b/compiler/src/org/apache/flex/swf/io/ISWFWriter.java
index 93c61a7..e1d4062 100644
--- a/compiler/src/org/apache/flex/swf/io/ISWFWriter.java
+++ b/compiler/src/org/apache/flex/swf/io/ISWFWriter.java
@@ -19,14 +19,13 @@
 
 package org.apache.flex.swf.io;
 
+import org.apache.flex.swf.ISWF;
+
 import java.io.Closeable;
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.OutputStream;
 
-import org.apache.flex.swf.ISWF;
-
 /**
  * Serialize an {@link ISWF} object to bytes.
  */
@@ -45,5 +44,6 @@ public interface ISWFWriter extends Closeable
      * @param out The output {@link File}.
      * @return The number of bytes written.
      */
-    int writeTo(File out) throws FileNotFoundException, IOException;
+    int writeTo(File out) throws IOException;
+
 }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/io/ISWFWriterFactory.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/io/ISWFWriterFactory.java b/compiler/src/org/apache/flex/swf/io/ISWFWriterFactory.java
new file mode 100644
index 0000000..c9f06c3
--- /dev/null
+++ b/compiler/src/org/apache/flex/swf/io/ISWFWriterFactory.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 org.apache.flex.swf.io;
+
+import org.apache.flex.swf.Header;
+import org.apache.flex.swf.ISWF;
+import org.apache.flex.swf.io.ISWFWriter;
+
+/**
+ * A factory interface for creating {@link ISWFWriter}.
+ */
+public interface ISWFWriterFactory
+{
+
+    ISWFWriter createSWFWriter(ISWF swf, Header.Compression useCompression, boolean enableDebug, boolean enableTelemetry);
+
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/io/SWFDump.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/io/SWFDump.java b/compiler/src/org/apache/flex/swf/io/SWFDump.java
index df25eec..298948d 100644
--- a/compiler/src/org/apache/flex/swf/io/SWFDump.java
+++ b/compiler/src/org/apache/flex/swf/io/SWFDump.java
@@ -53,59 +53,7 @@ import org.apache.flex.swf.Header;
 import org.apache.flex.swf.SWF;
 import org.apache.flex.swf.SWFFrame;
 import org.apache.flex.swf.TagType;
-import org.apache.flex.swf.tags.CSMTextSettingsTag;
-import org.apache.flex.swf.tags.DefineBinaryDataTag;
-import org.apache.flex.swf.tags.DefineBitsJPEG3Tag;
-import org.apache.flex.swf.tags.DefineBitsLossless2Tag;
-import org.apache.flex.swf.tags.DefineBitsLosslessTag;
-import org.apache.flex.swf.tags.DefineBitsTag;
-import org.apache.flex.swf.tags.DefineButton2Tag;
-import org.apache.flex.swf.tags.DefineButtonCxformTag;
-import org.apache.flex.swf.tags.DefineButtonSoundTag;
-import org.apache.flex.swf.tags.DefineButtonTag;
-import org.apache.flex.swf.tags.DefineEditTextTag;
-import org.apache.flex.swf.tags.DefineFont2Tag;
-import org.apache.flex.swf.tags.DefineFont3Tag;
-import org.apache.flex.swf.tags.DefineFont4Tag;
-import org.apache.flex.swf.tags.DefineFontAlignZonesTag;
-import org.apache.flex.swf.tags.DefineFontInfoTag;
-import org.apache.flex.swf.tags.DefineFontNameTag;
-import org.apache.flex.swf.tags.DefineFontTag;
-import org.apache.flex.swf.tags.DefineMorphShape2Tag;
-import org.apache.flex.swf.tags.DefineMorphShapeTag;
-import org.apache.flex.swf.tags.DefineScalingGridTag;
-import org.apache.flex.swf.tags.DefineShape3Tag;
-import org.apache.flex.swf.tags.DefineShape4Tag;
-import org.apache.flex.swf.tags.DefineShapeTag;
-import org.apache.flex.swf.tags.DefineSoundTag;
-import org.apache.flex.swf.tags.DefineSpriteTag;
-import org.apache.flex.swf.tags.DefineTextTag;
-import org.apache.flex.swf.tags.DefineVideoStreamTag;
-import org.apache.flex.swf.tags.DoABCTag;
-import org.apache.flex.swf.tags.EnableDebugger2Tag;
-import org.apache.flex.swf.tags.ExportAssetsTag;
-import org.apache.flex.swf.tags.FileAttributesTag;
-import org.apache.flex.swf.tags.FrameLabelTag;
-import org.apache.flex.swf.tags.ICharacterTag;
-import org.apache.flex.swf.tags.ITag;
-import org.apache.flex.swf.tags.MetadataTag;
-import org.apache.flex.swf.tags.PlaceObject2Tag;
-import org.apache.flex.swf.tags.PlaceObject3Tag;
-import org.apache.flex.swf.tags.PlaceObjectTag;
-import org.apache.flex.swf.tags.ProductInfoTag;
-import org.apache.flex.swf.tags.RawTag;
-import org.apache.flex.swf.tags.RemoveObject2Tag;
-import org.apache.flex.swf.tags.RemoveObjectTag;
-import org.apache.flex.swf.tags.ScriptLimitsTag;
-import org.apache.flex.swf.tags.SetBackgroundColorTag;
-import org.apache.flex.swf.tags.SetTabIndexTag;
-import org.apache.flex.swf.tags.ShowFrameTag;
-import org.apache.flex.swf.tags.SoundStreamBlockTag;
-import org.apache.flex.swf.tags.SoundStreamHeadTag;
-import org.apache.flex.swf.tags.StartSoundTag;
-import org.apache.flex.swf.tags.SymbolClassTag;
-import org.apache.flex.swf.tags.Tag;
-import org.apache.flex.swf.tags.VideoFrameTag;
+import org.apache.flex.swf.tags.*;
 import org.apache.flex.swf.types.ButtonRecord;
 import org.apache.flex.swf.types.CurvedEdgeRecord;
 import org.apache.flex.swf.types.EdgeRecord;
@@ -390,10 +338,14 @@ public final class SWFDump
             case SymbolClass:
                 dumpSymbolClass((SymbolClassTag)tag);
                 break;
+            case EnableTelemetry:
+                dumpEnableTelemetry((EnableTelemetryTag) tag);
+                break;
             default:
                 assert (tag instanceof RawTag);
-                if (tag instanceof RawTag)
-                    dumpRawTag((RawTag)tag);
+                if (tag instanceof RawTag) {
+                    dumpRawTag((RawTag) tag);
+                }
                 break;
         }
 
@@ -2205,6 +2157,13 @@ public final class SWFDump
     //        close(tag);
     //    }
 
+    public void dumpEnableTelemetry(EnableTelemetryTag tag)
+    {
+        open(tag);
+        out.print(" password=\"" + tag.getPassword() + "\"");
+        close();
+    }
+
     private String idRef(ICharacterTag tag)
     {
         if (tag == null)

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/io/SWFReader.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/io/SWFReader.java b/compiler/src/org/apache/flex/swf/io/SWFReader.java
index b381d41..2ce3c04 100644
--- a/compiler/src/org/apache/flex/swf/io/SWFReader.java
+++ b/compiler/src/org/apache/flex/swf/io/SWFReader.java
@@ -46,68 +46,7 @@ import org.apache.flex.swf.ITagContainer;
 import org.apache.flex.swf.SWF;
 import org.apache.flex.swf.SWFFrame;
 import org.apache.flex.swf.TagType;
-import org.apache.flex.swf.tags.CSMTextSettingsTag;
-import org.apache.flex.swf.tags.CharacterTag;
-import org.apache.flex.swf.tags.DefineBinaryDataTag;
-import org.apache.flex.swf.tags.DefineBitsJPEG2Tag;
-import org.apache.flex.swf.tags.DefineBitsJPEG3Tag;
-import org.apache.flex.swf.tags.DefineBitsLossless2Tag;
-import org.apache.flex.swf.tags.DefineBitsLosslessTag;
-import org.apache.flex.swf.tags.DefineBitsTag;
-import org.apache.flex.swf.tags.DefineButton2Tag;
-import org.apache.flex.swf.tags.DefineButtonSoundTag;
-import org.apache.flex.swf.tags.DefineButtonTag;
-import org.apache.flex.swf.tags.DefineEditTextTag;
-import org.apache.flex.swf.tags.DefineFont2Tag;
-import org.apache.flex.swf.tags.DefineFont3Tag;
-import org.apache.flex.swf.tags.DefineFont4Tag;
-import org.apache.flex.swf.tags.DefineFontAlignZonesTag;
-import org.apache.flex.swf.tags.DefineFontInfo2Tag;
-import org.apache.flex.swf.tags.DefineFontInfoTag;
-import org.apache.flex.swf.tags.DefineFontNameTag;
-import org.apache.flex.swf.tags.DefineFontTag;
-import org.apache.flex.swf.tags.DefineMorphShape2Tag;
-import org.apache.flex.swf.tags.DefineMorphShapeTag;
-import org.apache.flex.swf.tags.DefineScalingGridTag;
-import org.apache.flex.swf.tags.DefineSceneAndFrameLabelDataTag;
-import org.apache.flex.swf.tags.DefineShape2Tag;
-import org.apache.flex.swf.tags.DefineShape3Tag;
-import org.apache.flex.swf.tags.DefineShape4Tag;
-import org.apache.flex.swf.tags.DefineShapeTag;
-import org.apache.flex.swf.tags.DefineSoundTag;
-import org.apache.flex.swf.tags.DefineSpriteTag;
-import org.apache.flex.swf.tags.DefineTextTag;
-import org.apache.flex.swf.tags.DefineVideoStreamTag;
-import org.apache.flex.swf.tags.DoABCTag;
-import org.apache.flex.swf.tags.EnableDebugger2Tag;
-import org.apache.flex.swf.tags.EndTag;
-import org.apache.flex.swf.tags.ExportAssetsTag;
-import org.apache.flex.swf.tags.FileAttributesTag;
-import org.apache.flex.swf.tags.FrameLabelTag;
-import org.apache.flex.swf.tags.ICharacterTag;
-import org.apache.flex.swf.tags.IDefineFontTag;
-import org.apache.flex.swf.tags.IManagedTag;
-import org.apache.flex.swf.tags.ITag;
-import org.apache.flex.swf.tags.JPEGTablesTag;
-import org.apache.flex.swf.tags.MetadataTag;
-import org.apache.flex.swf.tags.PlaceObject2Tag;
-import org.apache.flex.swf.tags.PlaceObject3Tag;
-import org.apache.flex.swf.tags.PlaceObjectTag;
-import org.apache.flex.swf.tags.ProductInfoTag;
-import org.apache.flex.swf.tags.RawTag;
-import org.apache.flex.swf.tags.RemoveObject2Tag;
-import org.apache.flex.swf.tags.RemoveObjectTag;
-import org.apache.flex.swf.tags.ScriptLimitsTag;
-import org.apache.flex.swf.tags.SetBackgroundColorTag;
-import org.apache.flex.swf.tags.SetTabIndexTag;
-import org.apache.flex.swf.tags.ShowFrameTag;
-import org.apache.flex.swf.tags.SoundStreamBlockTag;
-import org.apache.flex.swf.tags.SoundStreamHead2Tag;
-import org.apache.flex.swf.tags.SoundStreamHeadTag;
-import org.apache.flex.swf.tags.StartSound2Tag;
-import org.apache.flex.swf.tags.StartSoundTag;
-import org.apache.flex.swf.tags.SymbolClassTag;
-import org.apache.flex.swf.tags.VideoFrameTag;
+import org.apache.flex.swf.tags.*;
 import org.apache.flex.swf.types.BevelFilter;
 import org.apache.flex.swf.types.BlurFilter;
 import org.apache.flex.swf.types.ButtonRecord;
@@ -813,6 +752,14 @@ public class SWFReader implements ISWFReader, ITagContainer
         return new EnableDebugger2Tag(bitStream.readString());
     }
 
+    private EnableTelemetryTag readEnableTelemetry()
+    {
+        // Read the reserved 2 bytes
+        bitStream.readUI16();
+        String password = bitStream.readString();
+        return new EnableTelemetryTag(password);
+    }
+
     private EndTag readEnd()
     {
         return new EndTag();
@@ -983,7 +930,6 @@ public class SWFReader implements ISWFReader, ITagContainer
     /**
      * @param tagType
      * @return A gradient record.
-     * @throws RuntimeExpection if the record is invalid.
      */
     private GradRecord readGradRecord(TagType tagType)
     {
@@ -1886,6 +1832,8 @@ public class SWFReader implements ISWFReader, ITagContainer
                 return readShowFrame();
             case SymbolClass:
                 return readSymbolClass();
+            case EnableTelemetry:
+                return readEnableTelemetry();
             default:
                 return readRawTag(type);
         }

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/io/SWFWriter.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/io/SWFWriter.java b/compiler/src/org/apache/flex/swf/io/SWFWriter.java
index 0ecceac..197c0f3 100644
--- a/compiler/src/org/apache/flex/swf/io/SWFWriter.java
+++ b/compiler/src/org/apache/flex/swf/io/SWFWriter.java
@@ -36,7 +36,6 @@ import java.util.zip.DeflaterOutputStream;
 
 import org.apache.commons.io.output.CountingOutputStream;
 
-import org.apache.flex.swc.io.ISWFWriterFactory;
 import org.apache.flex.swf.Header;
 import org.apache.flex.swf.Header.Compression;
 import org.apache.flex.swf.ISWF;
@@ -44,66 +43,7 @@ import org.apache.flex.swf.SWF;
 import org.apache.flex.swf.SWFFrame;
 import org.apache.flex.swf.TagType;
 import org.apache.flex.swf.io.SWFReader.CurrentStyles;
-import org.apache.flex.swf.tags.CSMTextSettingsTag;
-import org.apache.flex.swf.tags.CharacterTag;
-import org.apache.flex.swf.tags.DefineBinaryDataTag;
-import org.apache.flex.swf.tags.DefineBitsJPEG2Tag;
-import org.apache.flex.swf.tags.DefineBitsJPEG3Tag;
-import org.apache.flex.swf.tags.DefineBitsLossless2Tag;
-import org.apache.flex.swf.tags.DefineBitsLosslessTag;
-import org.apache.flex.swf.tags.DefineBitsTag;
-import org.apache.flex.swf.tags.DefineButton2Tag;
-import org.apache.flex.swf.tags.DefineButtonSoundTag;
-import org.apache.flex.swf.tags.DefineButtonTag;
-import org.apache.flex.swf.tags.DefineEditTextTag;
-import org.apache.flex.swf.tags.DefineFont2Tag;
-import org.apache.flex.swf.tags.DefineFont3Tag;
-import org.apache.flex.swf.tags.DefineFont4Tag;
-import org.apache.flex.swf.tags.DefineFontAlignZonesTag;
-import org.apache.flex.swf.tags.DefineFontInfo2Tag;
-import org.apache.flex.swf.tags.DefineFontNameTag;
-import org.apache.flex.swf.tags.DefineFontTag;
-import org.apache.flex.swf.tags.DefineMorphShape2Tag;
-import org.apache.flex.swf.tags.DefineMorphShapeTag;
-import org.apache.flex.swf.tags.DefineScalingGridTag;
-import org.apache.flex.swf.tags.DefineShape2Tag;
-import org.apache.flex.swf.tags.DefineShape3Tag;
-import org.apache.flex.swf.tags.DefineShape4Tag;
-import org.apache.flex.swf.tags.DefineShapeTag;
-import org.apache.flex.swf.tags.DefineSoundTag;
-import org.apache.flex.swf.tags.DefineSpriteTag;
-import org.apache.flex.swf.tags.DefineText2Tag;
-import org.apache.flex.swf.tags.DefineTextTag;
-import org.apache.flex.swf.tags.DefineVideoStreamTag;
-import org.apache.flex.swf.tags.DoABCTag;
-import org.apache.flex.swf.tags.EnableDebugger2Tag;
-import org.apache.flex.swf.tags.EndTag;
-import org.apache.flex.swf.tags.ExportAssetsTag;
-import org.apache.flex.swf.tags.FileAttributesTag;
-import org.apache.flex.swf.tags.FrameLabelTag;
-import org.apache.flex.swf.tags.IAlwaysLongTag;
-import org.apache.flex.swf.tags.ICharacterTag;
-import org.apache.flex.swf.tags.IFontInfo;
-import org.apache.flex.swf.tags.ITag;
-import org.apache.flex.swf.tags.JPEGTablesTag;
-import org.apache.flex.swf.tags.MetadataTag;
-import org.apache.flex.swf.tags.PlaceObject2Tag;
-import org.apache.flex.swf.tags.PlaceObject3Tag;
-import org.apache.flex.swf.tags.PlaceObjectTag;
-import org.apache.flex.swf.tags.ProductInfoTag;
-import org.apache.flex.swf.tags.RawTag;
-import org.apache.flex.swf.tags.RemoveObject2Tag;
-import org.apache.flex.swf.tags.RemoveObjectTag;
-import org.apache.flex.swf.tags.ScriptLimitsTag;
-import org.apache.flex.swf.tags.SetBackgroundColorTag;
-import org.apache.flex.swf.tags.SetTabIndexTag;
-import org.apache.flex.swf.tags.SoundStreamBlockTag;
-import org.apache.flex.swf.tags.SoundStreamHead2Tag;
-import org.apache.flex.swf.tags.SoundStreamHeadTag;
-import org.apache.flex.swf.tags.StartSound2Tag;
-import org.apache.flex.swf.tags.StartSoundTag;
-import org.apache.flex.swf.tags.SymbolClassTag;
-import org.apache.flex.swf.tags.VideoFrameTag;
+import org.apache.flex.swf.tags.*;
 import org.apache.flex.swf.types.ARGB;
 import org.apache.flex.swf.types.BevelFilter;
 import org.apache.flex.swf.types.BlurFilter;
@@ -167,9 +107,9 @@ public class SWFWriter implements ISWFWriter
 
         @Override
         public ISWFWriter createSWFWriter(ISWF swf, Compression useCompression,
-                boolean enableDebug)
+                boolean enableDebug, boolean enableTelemetry)
         {
-            return new SWFWriter(swf, useCompression, enableDebug);
+            return new SWFWriter(swf, useCompression, enableDebug, enableTelemetry);
         }
 
     }
@@ -319,7 +259,11 @@ public class SWFWriter implements ISWFWriter
     // True if the encoded SWF file is compressed.
     private final Header.Compression useCompression;
 
-    private final boolean enableDebug; // if true enable debugging of the SWF.
+    // True if debugging of the SWF is enabled.
+    private final boolean enableDebug;
+
+    // True if telemetry features of the SWF are enabled.
+    private final boolean enableTelemetry;
 
     // Current frame index. Updated in writeFrames().
     private int currentFrameIndex;
@@ -335,7 +279,7 @@ public class SWFWriter implements ISWFWriter
      */
     public SWFWriter(ISWF swf, Header.Compression useCompression)
     {
-        this(swf, useCompression, false);
+        this(swf, useCompression, false, false);
     }
 
     /**
@@ -344,12 +288,14 @@ public class SWFWriter implements ISWFWriter
      * @param swf the SWF model to be encoded
      * @param useCompression use ZLIB compression if true
      * @param enableDebug enable debugging of the SWF if true
+     * @param enableTelemetry enable telemetry
      */
-    public SWFWriter(ISWF swf, Header.Compression useCompression, boolean enableDebug)
+    public SWFWriter(ISWF swf, Header.Compression useCompression, boolean enableDebug, boolean enableTelemetry)
     {
         this.swf = swf;
         this.useCompression = useCompression;
         this.enableDebug = enableDebug;
+        this.enableTelemetry = enableTelemetry;
         this.outputBuffer = new OutputBitStream(false);
         this.tagBuffer = new OutputBitStream(false);
 
@@ -744,6 +690,18 @@ public class SWFWriter implements ISWFWriter
         tagBuffer.writeString(tag.getPassword());
     }
 
+    private void writeEnableTelemetry(EnableTelemetryTag tag)
+    {
+        // Tag Code (Upper 10 bits = tag type, lower 16 bit = tag length)
+        tagBuffer.writeUI16(0); // reserved always zero
+        // PasswordHash: Optional SHA-256 hash of the UTF-8 representation of the password.
+        // If not present telemetry clients can connect without using a password, if set they
+        // have to authenticate.
+        if(tag.getPassword() != null) {
+            tagBuffer.writeString(tag.getPassword());
+        }
+    }
+
     private void writeEnd()
     {
         // End tag has no tag body.
@@ -982,7 +940,7 @@ public class SWFWriter implements ISWFWriter
     }
 
     /**
-     * @param gradientMatrix
+     * @param matrix
      */
     private void writeMatrix(Matrix matrix)
     {
@@ -1338,6 +1296,9 @@ public class SWFWriter implements ISWFWriter
                 case EnableDebugger2:
                     writeEnableDebugger2((EnableDebugger2Tag)tag);
                     break;
+                case EnableTelemetry:
+                    writeEnableTelemetry((EnableTelemetryTag) tag);
+                    break;
                 case ScriptLimits:
                     writeScriptLimits((ScriptLimitsTag)tag);
                     break;
@@ -2591,27 +2552,37 @@ public class SWFWriter implements ISWFWriter
         // Raw Metadata
         String metadata = swf.getMetadata();
 
-        if (metadata != null)
-            writeTag(new MetadataTag(metadata));
+        if (metadata != null) {
+           writeTag(new MetadataTag(metadata));
+        }
 
         // SetBackgroundColor tag
         final RGB backgroundColor = swf.getBackgroundColor();
-        if (backgroundColor != null)
+        if (backgroundColor != null) {
             writeTag(new SetBackgroundColorTag(backgroundColor));
+        }
 
         // EnableDebugger2 tag        
-        if (enableDebug)
+        if (enableDebug) {
             writeTag(new EnableDebugger2Tag("NO-PASSWORD"));
+        }
+
+        // EnableTelemetry tag
+        if (enableTelemetry) {
+           writeTag(new EnableTelemetryTag());
+        }
 
         // ProductInfo tag for Flex compatibility
         ProductInfoTag productInfo = swf.getProductInfo();
-        if (productInfo != null)
+        if (productInfo != null) {
             writeTag(productInfo);
+        }
 
         // ScriptLimits tag
         final ScriptLimitsTag scriptLimitsTag = swf.getScriptLimits();
-        if (scriptLimitsTag != null)
+        if (scriptLimitsTag != null) {
             writeTag(scriptLimitsTag);
+        }
 
         // Frames and enclosed tags.
         writeFrames();

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/io/SWFWriterAndSizeReporter.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/io/SWFWriterAndSizeReporter.java b/compiler/src/org/apache/flex/swf/io/SWFWriterAndSizeReporter.java
deleted file mode 100644
index 0bae89f..0000000
--- a/compiler/src/org/apache/flex/swf/io/SWFWriterAndSizeReporter.java
+++ /dev/null
@@ -1,478 +0,0 @@
-/*
- *
- *  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 org.apache.flex.swf.io;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-import org.apache.commons.io.output.CountingOutputStream;
-
-import org.apache.flex.swc.io.ISWFWriterFactory;
-import org.apache.flex.swf.Header.Compression;
-import org.apache.flex.swf.ISWF;
-import org.apache.flex.swf.tags.CharacterTag;
-import org.apache.flex.swf.tags.DefineBinaryDataTag;
-import org.apache.flex.swf.tags.DefineFont2Tag;
-import org.apache.flex.swf.tags.DefineFont4Tag;
-import org.apache.flex.swf.tags.DefineFontNameTag;
-import org.apache.flex.swf.tags.DefineFontTag;
-import org.apache.flex.swf.tags.DefineShapeTag;
-import org.apache.flex.swf.tags.DefineSoundTag;
-import org.apache.flex.swf.tags.DefineSpriteTag;
-import org.apache.flex.swf.tags.DefineVideoStreamTag;
-import org.apache.flex.swf.tags.DoABCTag;
-import org.apache.flex.swf.tags.FileAttributesTag;
-import org.apache.flex.swf.tags.FrameLabelTag;
-import org.apache.flex.swf.tags.ITag;
-import org.apache.flex.swf.tags.SymbolClassTag;
-
-/**
- * A class that writes a SWF and a size report. The path of the size report is
- * passed to the constructor. When the SWF is written to disk, the size report
- * is also written.
- */
-public class SWFWriterAndSizeReporter extends SWFWriter
-{
-    /**
-     * SWF writer factory for SWF writers that also create size reports.
-     */
-    private static class SWFWriterFactory implements ISWFWriterFactory
-    {
-
-        SWFWriterFactory(File sizeReport)
-        {
-            this.sizeReport = sizeReport;
-        }
-
-        private final File sizeReport;
-
-        @Override
-        public ISWFWriter createSWFWriter(ISWF swf, Compression useCompression,
-                boolean enableDebug)
-        {
-            return new SWFWriterAndSizeReporter(swf, useCompression, enableDebug,
-                    sizeReport);
-        }
-
-    }
-
-    /**
-     * Get a SWF Writer factory that can create an instance of a class that can
-     * write a SWF with the optional capability of creating a size report.
-     * 
-     * @param sizeReport if non-null, return a factory for an object that can
-     * create a size report in addition to a writing a SWF. Otherwise the
-     * factory is for an object that just writes a SWF.
-     * @return a SWF writer factory.
-     */
-    public static ISWFWriterFactory getSWFWriterFactory(File sizeReport)
-    {
-        if (sizeReport != null)
-            return new SWFWriterFactory(sizeReport);
-
-        return SWFWriter.DEFAULT_SWF_WRITER_FACTORY;
-    }
-
-    /**
-     * Create a SWF writer with a size reporter.
-     * 
-     * @param swf the SWF model to be encoded
-     * @param useCompression use ZLIB compression if true
-     * @param enableDebug enable debugging of the SWF if true
-     * @param sizeReport the file the size report is written to.
-     */
-    public SWFWriterAndSizeReporter(ISWF swf, Compression useCompression,
-                                    boolean enableDebug, File sizeReport)
-    {
-        super(swf, useCompression, enableDebug);
-
-        assert sizeReport != null;
-
-        this.sizeReportFile = sizeReport;
-        this.report = new SizeReport();
-    }
-
-    private final File sizeReportFile;
-    private final SizeReport report;
-    private boolean definingSprite = false;
-
-    @Override
-    public int writeTo(File outputFile) throws FileNotFoundException, IOException
-    {
-        final int bytes = super.writeTo(outputFile);
-        report.setCompressedSize(bytes);
-
-        return bytes;
-    }
-
-    @Override
-    public void writeTo(OutputStream output)
-    {
-        CountingOutputStream countingOutput = new CountingOutputStream(output);
-        super.writeTo(countingOutput);
-
-        report.setCompressedSize(countingOutput.getCount());
-
-        writeSizeReport();
-    }
-
-    @Override
-    protected void finishTag(ITag tag, IOutputBitStream tagData, IOutputBitStream out)
-    {
-        int startPos = out.size();
-        super.finishTag(tag, tagData, out);
-
-        int recordLength = out.size() - startPos;
-
-        switch (tag.getTagType())
-        {
-            case DoABC:
-                reportDoABC((DoABCTag)tag, recordLength);
-                break;
-            case FileAttributes:
-                reportFileAttributes((FileAttributesTag)tag, recordLength);
-                break;
-            case SymbolClass:
-                reportSymbolClass((SymbolClassTag)tag, recordLength);
-                break;
-            case ShowFrame:
-                reportShowFrame(recordLength);
-                break;
-            case SetBackgroundColor:
-                reportSetBackgroundColor(recordLength);
-                break;
-            case EnableDebugger2:
-                reportEnableDebugger2(recordLength);
-                break;
-            case ScriptLimits:
-                reportScriptLimits(recordLength);
-                break;
-            //            case ProductInfo:
-            //                reportProductInfo((ProductInfoTag)tag, recordLength);
-            //                break;
-            case Metadata:
-                reportMetadata(recordLength);
-                break;
-            case DefineBits:
-            case DefineBitsJPEG2:
-            case DefineBitsJPEG3:
-            case DefineBitsLossless2:
-                reportBitmap((CharacterTag)tag, recordLength);
-                break;
-            case DefineBinaryData:
-                reportDefineBinaryData((DefineBinaryDataTag)tag, recordLength);
-                break;
-            case DefineShape:
-            case DefineShape2:
-            case DefineShape3:
-            case DefineShape4:
-                reportDefineShape((DefineShapeTag)tag, recordLength);
-                break;
-            case DefineSprite:
-                reportDefineSprite((DefineSpriteTag)tag, recordLength);
-                break;
-            case ExportAssets:
-                reportExportAssets(recordLength);
-                break;
-            //            case DefineScalingGrid:
-            //                reportDefineScalingGrid((DefineScalingGridTag)tag, recordLength);
-            //                break;
-            case DefineFont:
-                reportDefineFont((DefineFontTag)tag, recordLength);
-                break;
-            case DefineFont2:
-            case DefineFont3:
-                reportDefineFont2or3((DefineFont2Tag)tag, recordLength);
-                break;
-            case DefineFont4:
-                reportDefineFont4((DefineFont4Tag)tag, recordLength);
-                break;
-            //            case DefineFontInfo:
-            //                reportDefineFontInfo((IFontInfo)tag, recordLength);
-            //                break;
-            //            case DefineFontInfo2:
-            //                reportDefineFontInfo2((DefineFontInfo2Tag)tag, recordLength);
-            //                break;
-            //            case DefineFontAlignZones:
-            //                reportDefineFontAlignZones((DefineFontAlignZonesTag)tag);
-            //                break;
-            //            case DefineFontName:
-            //                reportDefineFontName((DefineFontNameTag)tag);
-            //                break;
-            //            case DefineText:
-            //                reportDefineText((DefineTextTag)tag, extraTags);
-            //                break;
-            //            case DefineText2:
-            //                reportDefineText2((DefineText2Tag)tag, extraTags);
-            //                break;
-            //            case DefineEditText:
-            //                reportDefineEditText((DefineEditTextTag)tag, extraTags);
-            //                break;
-            case DefineSound:
-                reportDefineSound((DefineSoundTag)tag, recordLength);
-                break;
-            case DefineVideoStream:
-                reportDefineVideoStream((DefineVideoStreamTag)tag, recordLength);
-                break;
-            //            case VideoFrame:
-            //                reportVideoFrame((VideoFrameTag)tag);
-            //                break;
-            //            case StartSound:
-            //                reportStartSound((StartSoundTag)tag);
-            //                break;
-            //            case StartSound2:
-            //                reportStartSound2((StartSound2Tag)tag);
-            //                break;
-            //            case SoundStreamHead:
-            //                reportSoundStreamHead((SoundStreamHeadTag)tag);
-            //                break;
-            //            case SoundStreamHead2:
-            //                reportSoundStreamHead((SoundStreamHead2Tag)tag);
-            //                break;
-            //            case SoundStreamBlock:
-            //                reportSoundStreamBlock((SoundStreamBlockTag)tag);
-            //                break;
-            //            case DefineButton:
-            //                reportDefineButton((DefineButtonTag)tag);
-            //                break;
-            //            case DefineButton2:
-            //                reportDefineButton2((DefineButton2Tag)tag);
-            //                break;
-            //            case DefineButtonSound:
-            //                reportDefineButtonSound((DefineButtonSoundTag)tag);
-            //                break;
-            //            case CSMTextSettings:
-            //                reportCSMTextSettings((CSMTextSettingsTag)tag);
-            //                break;
-            case End:
-                reportEnd();
-                break;
-            //            case JPEGTables:
-            //                reportJPEGTables(((JPEGTablesTag)tag));
-            //                break;
-            //            case DefineMorphShape:
-            //                reportDefineMorphShape((DefineMorphShapeTag)tag);
-            //                break;
-            //            case DefineMorphShape2:
-            //                reportDefineMorphShape2((DefineMorphShape2Tag)tag);
-            //                break;
-            //            case PlaceObject:
-            //                reportPlaceObject((PlaceObjectTag)tag);
-            //                break;
-            //            case PlaceObject2:
-            //                reportPlaceObject2((PlaceObject2Tag)tag);
-            //                break;
-            //            case PlaceObject3:
-            //                reportPlaceObject3((PlaceObject3Tag)tag);
-            //                break;
-            //            case RemoveObject:
-            //                reportRemoveObject((RemoveObjectTag)tag);
-            //                break;
-            //            case RemoveObject2:
-            //                reportRemoveObject2((RemoveObject2Tag)tag);
-            //                break;
-            //            case SetTabIndex:
-            //                reportSetTabIndex((SetTabIndexTag)tag);
-            //                break;
-            case FrameLabel:
-                reportFrameLabel((FrameLabelTag)tag, recordLength);
-                break;
-        }
-
-    }
-
-    @Override
-    protected void writeCompressibleHeader()
-    {
-        super.writeCompressibleHeader();
-
-        tagBuffer.flush();
-        report.startEntry(SizeReport.HEADER_DATA, 0, -1, "swfHeader");
-
-        // Here we are recording the size of the full header, not just
-        // the compressible part. The full header is 12 bytes plus the 
-        // size needed to encode a RECT record. The 'tagBuffer' contains
-        // the size of the RECT so we just add 12 to it to get the full size.
-        report.endEntry(SizeReport.HEADER_DATA, tagBuffer.size() + 12);
-    }
-
-    @Override
-    protected void writeDefineSprite(DefineSpriteTag tag)
-    {
-        definingSprite = true;
-        super.writeDefineSprite(tag);
-        definingSprite = false;
-    }
-
-    private void reportShowFrame(int recordLength)
-    {
-        if (!definingSprite)
-        {
-            report.addEntry(SizeReport.FRAME_DATA, -1, 2, "showFrame");
-            report.endEntry(SizeReport.FRAME, 0);
-        }
-    }
-
-    private void reportDefineBinaryData(DefineBinaryDataTag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.BINARY, tag.getCharacterID(), recordLength);
-    }
-
-    private void reportDefineShape(DefineShapeTag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.SHAPE, tag.getCharacterID(), recordLength);
-    }
-
-    public void reportDoABC(DoABCTag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.SCRIPT, -1, recordLength, tag.getName());
-    }
-
-    private void reportEnableDebugger2(int recordLength)
-    {
-        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "enableDebugger");
-    }
-
-    public void reportFileAttributes(FileAttributesTag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "fileAttributes");
-    }
-
-    private void reportMetadata(int recordLength)
-    {
-        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "metaData");
-    }
-
-    private void reportScriptLimits(int recordLength)
-    {
-        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "scriptLimits");
-    }
-
-    private void reportSetBackgroundColor(int recordLength)
-    {
-        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "backgroundColor");
-    }
-
-    private void reportEnd()
-    {
-        report.addEntry(SizeReport.HEADER_DATA, -1, 2, "endMarker");
-        report.setSize(outputBuffer.size());
-    }
-
-    private void reportSymbolClass(SymbolClassTag tag, int recordLength)
-    {
-        for (String symbol : tag.getSymbolNames())
-            report.addSymbol(symbol, tag.getSymbol(symbol).getCharacterID());
-
-        report.addEntry(SizeReport.FRAME_DATA, -1, recordLength, "symbolClass");
-    }
-
-    private void reportDefineVideoStream(DefineVideoStreamTag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.VIDEO, tag.getCharacterID(), recordLength);
-    }
-
-    private void reportDefineSound(DefineSoundTag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.SOUND, tag.getCharacterID(), recordLength);
-    }
-
-    private void reportDefineFont(DefineFontTag tag, int recordLength)
-    {
-        String fontName = null;
-        DefineFontNameTag license = tag.getLicense();
-        if (license != null)
-            fontName = license.getFontName();
-
-        report.addEntry(SizeReport.FONT, tag.getCharacterID(), recordLength,
-                fontName);
-    }
-
-    private void reportDefineFont2or3(DefineFont2Tag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.FONT, tag.getCharacterID(), recordLength,
-                tag.getFontName());
-    }
-
-    private void reportDefineFont4(DefineFont4Tag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.FONT, tag.getCharacterID(), recordLength,
-                tag.getFontName());
-    }
-
-    private void reportBitmap(CharacterTag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.BITMAP, tag.getCharacterID(), recordLength);
-    }
-
-    private void reportExportAssets(int recordLength)
-    {
-        report.addEntry(SizeReport.FRAME_DATA, -1, recordLength, "exportAssets");
-    }
-
-    private void reportDefineSprite(DefineSpriteTag tag, int recordLength)
-    {
-        report.addEntry(SizeReport.SPRITE, tag.getCharacterID(), recordLength);
-    }
-
-    private void reportFrameLabel(FrameLabelTag tag, int recordLength)
-    {
-        report.startEntry(SizeReport.FRAME, 0, -1, tag.getName());
-        report.addEntry(SizeReport.FRAME_DATA, -1, recordLength, "frameLabel");
-    }
-
-    /**
-     * Write the size report to the specified file.
-     */
-    private void writeSizeReport()
-    {
-        Writer reportOut = null;
-        try
-        {
-            reportOut = new BufferedWriter(new OutputStreamWriter(
-                    new FileOutputStream(sizeReportFile), "UTF8"));
-            reportOut.write(report.generate());
-            reportOut.flush();
-        }
-        catch (Exception e)
-        {
-            // TODO: report a problem
-            throw new RuntimeException(e);
-        }
-        finally
-        {
-            if (reportOut != null)
-                try
-                {
-                    reportOut.close();
-                }
-                catch (IOException e)
-                {
-                    // ignore
-                }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/io/SizeReportWritingSWFWriter.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/io/SizeReportWritingSWFWriter.java b/compiler/src/org/apache/flex/swf/io/SizeReportWritingSWFWriter.java
new file mode 100644
index 0000000..9cf1899
--- /dev/null
+++ b/compiler/src/org/apache/flex/swf/io/SizeReportWritingSWFWriter.java
@@ -0,0 +1,477 @@
+/*
+ *
+ *  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 org.apache.flex.swf.io;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import org.apache.commons.io.output.CountingOutputStream;
+
+import org.apache.flex.swf.Header.Compression;
+import org.apache.flex.swf.ISWF;
+import org.apache.flex.swf.tags.CharacterTag;
+import org.apache.flex.swf.tags.DefineBinaryDataTag;
+import org.apache.flex.swf.tags.DefineFont2Tag;
+import org.apache.flex.swf.tags.DefineFont4Tag;
+import org.apache.flex.swf.tags.DefineFontNameTag;
+import org.apache.flex.swf.tags.DefineFontTag;
+import org.apache.flex.swf.tags.DefineShapeTag;
+import org.apache.flex.swf.tags.DefineSoundTag;
+import org.apache.flex.swf.tags.DefineSpriteTag;
+import org.apache.flex.swf.tags.DefineVideoStreamTag;
+import org.apache.flex.swf.tags.DoABCTag;
+import org.apache.flex.swf.tags.FileAttributesTag;
+import org.apache.flex.swf.tags.FrameLabelTag;
+import org.apache.flex.swf.tags.ITag;
+import org.apache.flex.swf.tags.SymbolClassTag;
+
+/**
+ * A class that writes a SWF and a size report. The path of the size report is
+ * passed to the constructor. When the SWF is written to disk, the size report
+ * is also written.
+ */
+public class SizeReportWritingSWFWriter extends SWFWriter
+{
+    /**
+     * SWF writer factory for SWF writers that also create size reports.
+     */
+    private static class SWFWriterFactory implements ISWFWriterFactory
+    {
+
+        SWFWriterFactory(File sizeReport)
+        {
+            this.sizeReport = sizeReport;
+        }
+
+        private final File sizeReport;
+
+        @Override
+        public ISWFWriter createSWFWriter(ISWF swf, Compression useCompression,
+                boolean enableDebug, boolean enableTelemetry)
+        {
+            return new SizeReportWritingSWFWriter(swf, useCompression, enableDebug, enableTelemetry,
+                    sizeReport);
+        }
+
+    }
+
+    /**
+     * Get a SWF Writer factory that can create an instance of a class that can
+     * write a SWF with the optional capability of creating a size report.
+     * 
+     * @param sizeReport if non-null, return a factory for an object that can
+     * create a size report in addition to a writing a SWF. Otherwise the
+     * factory is for an object that just writes a SWF.
+     * @return a SWF writer factory.
+     */
+    public static ISWFWriterFactory getSWFWriterFactory(File sizeReport)
+    {
+        if (sizeReport != null)
+            return new SWFWriterFactory(sizeReport);
+
+        return SWFWriter.DEFAULT_SWF_WRITER_FACTORY;
+    }
+
+    /**
+     * Create a SWF writer with a size reporter.
+     * 
+     * @param swf the SWF model to be encoded
+     * @param useCompression use ZLIB compression if true
+     * @param enableDebug enable debugging of the SWF if true
+     * @param sizeReport the file the size report is written to.
+     */
+    public SizeReportWritingSWFWriter(ISWF swf, Compression useCompression,
+                                      boolean enableDebug, boolean enableTelemetry, File sizeReport)
+    {
+        super(swf, useCompression, enableDebug, enableTelemetry);
+
+        assert sizeReport != null;
+
+        this.sizeReportFile = sizeReport;
+        this.report = new SizeReport();
+    }
+
+    private final File sizeReportFile;
+    private final SizeReport report;
+    private boolean definingSprite = false;
+
+    @Override
+    public int writeTo(File outputFile) throws FileNotFoundException, IOException
+    {
+        final int bytes = super.writeTo(outputFile);
+        report.setCompressedSize(bytes);
+
+        return bytes;
+    }
+
+    @Override
+    public void writeTo(OutputStream output)
+    {
+        CountingOutputStream countingOutput = new CountingOutputStream(output);
+        super.writeTo(countingOutput);
+
+        report.setCompressedSize(countingOutput.getCount());
+
+        writeSizeReport();
+    }
+
+    @Override
+    protected void finishTag(ITag tag, IOutputBitStream tagData, IOutputBitStream out)
+    {
+        int startPos = out.size();
+        super.finishTag(tag, tagData, out);
+
+        int recordLength = out.size() - startPos;
+
+        switch (tag.getTagType())
+        {
+            case DoABC:
+                reportDoABC((DoABCTag)tag, recordLength);
+                break;
+            case FileAttributes:
+                reportFileAttributes((FileAttributesTag)tag, recordLength);
+                break;
+            case SymbolClass:
+                reportSymbolClass((SymbolClassTag)tag, recordLength);
+                break;
+            case ShowFrame:
+                reportShowFrame(recordLength);
+                break;
+            case SetBackgroundColor:
+                reportSetBackgroundColor(recordLength);
+                break;
+            case EnableDebugger2:
+                reportEnableDebugger2(recordLength);
+                break;
+            case ScriptLimits:
+                reportScriptLimits(recordLength);
+                break;
+            //            case ProductInfo:
+            //                reportProductInfo((ProductInfoTag)tag, recordLength);
+            //                break;
+            case Metadata:
+                reportMetadata(recordLength);
+                break;
+            case DefineBits:
+            case DefineBitsJPEG2:
+            case DefineBitsJPEG3:
+            case DefineBitsLossless2:
+                reportBitmap((CharacterTag)tag, recordLength);
+                break;
+            case DefineBinaryData:
+                reportDefineBinaryData((DefineBinaryDataTag)tag, recordLength);
+                break;
+            case DefineShape:
+            case DefineShape2:
+            case DefineShape3:
+            case DefineShape4:
+                reportDefineShape((DefineShapeTag)tag, recordLength);
+                break;
+            case DefineSprite:
+                reportDefineSprite((DefineSpriteTag)tag, recordLength);
+                break;
+            case ExportAssets:
+                reportExportAssets(recordLength);
+                break;
+            //            case DefineScalingGrid:
+            //                reportDefineScalingGrid((DefineScalingGridTag)tag, recordLength);
+            //                break;
+            case DefineFont:
+                reportDefineFont((DefineFontTag)tag, recordLength);
+                break;
+            case DefineFont2:
+            case DefineFont3:
+                reportDefineFont2or3((DefineFont2Tag)tag, recordLength);
+                break;
+            case DefineFont4:
+                reportDefineFont4((DefineFont4Tag)tag, recordLength);
+                break;
+            //            case DefineFontInfo:
+            //                reportDefineFontInfo((IFontInfo)tag, recordLength);
+            //                break;
+            //            case DefineFontInfo2:
+            //                reportDefineFontInfo2((DefineFontInfo2Tag)tag, recordLength);
+            //                break;
+            //            case DefineFontAlignZones:
+            //                reportDefineFontAlignZones((DefineFontAlignZonesTag)tag);
+            //                break;
+            //            case DefineFontName:
+            //                reportDefineFontName((DefineFontNameTag)tag);
+            //                break;
+            //            case DefineText:
+            //                reportDefineText((DefineTextTag)tag, extraTags);
+            //                break;
+            //            case DefineText2:
+            //                reportDefineText2((DefineText2Tag)tag, extraTags);
+            //                break;
+            //            case DefineEditText:
+            //                reportDefineEditText((DefineEditTextTag)tag, extraTags);
+            //                break;
+            case DefineSound:
+                reportDefineSound((DefineSoundTag)tag, recordLength);
+                break;
+            case DefineVideoStream:
+                reportDefineVideoStream((DefineVideoStreamTag)tag, recordLength);
+                break;
+            //            case VideoFrame:
+            //                reportVideoFrame((VideoFrameTag)tag);
+            //                break;
+            //            case StartSound:
+            //                reportStartSound((StartSoundTag)tag);
+            //                break;
+            //            case StartSound2:
+            //                reportStartSound2((StartSound2Tag)tag);
+            //                break;
+            //            case SoundStreamHead:
+            //                reportSoundStreamHead((SoundStreamHeadTag)tag);
+            //                break;
+            //            case SoundStreamHead2:
+            //                reportSoundStreamHead((SoundStreamHead2Tag)tag);
+            //                break;
+            //            case SoundStreamBlock:
+            //                reportSoundStreamBlock((SoundStreamBlockTag)tag);
+            //                break;
+            //            case DefineButton:
+            //                reportDefineButton((DefineButtonTag)tag);
+            //                break;
+            //            case DefineButton2:
+            //                reportDefineButton2((DefineButton2Tag)tag);
+            //                break;
+            //            case DefineButtonSound:
+            //                reportDefineButtonSound((DefineButtonSoundTag)tag);
+            //                break;
+            //            case CSMTextSettings:
+            //                reportCSMTextSettings((CSMTextSettingsTag)tag);
+            //                break;
+            case End:
+                reportEnd();
+                break;
+            //            case JPEGTables:
+            //                reportJPEGTables(((JPEGTablesTag)tag));
+            //                break;
+            //            case DefineMorphShape:
+            //                reportDefineMorphShape((DefineMorphShapeTag)tag);
+            //                break;
+            //            case DefineMorphShape2:
+            //                reportDefineMorphShape2((DefineMorphShape2Tag)tag);
+            //                break;
+            //            case PlaceObject:
+            //                reportPlaceObject((PlaceObjectTag)tag);
+            //                break;
+            //            case PlaceObject2:
+            //                reportPlaceObject2((PlaceObject2Tag)tag);
+            //                break;
+            //            case PlaceObject3:
+            //                reportPlaceObject3((PlaceObject3Tag)tag);
+            //                break;
+            //            case RemoveObject:
+            //                reportRemoveObject((RemoveObjectTag)tag);
+            //                break;
+            //            case RemoveObject2:
+            //                reportRemoveObject2((RemoveObject2Tag)tag);
+            //                break;
+            //            case SetTabIndex:
+            //                reportSetTabIndex((SetTabIndexTag)tag);
+            //                break;
+            case FrameLabel:
+                reportFrameLabel((FrameLabelTag)tag, recordLength);
+                break;
+        }
+
+    }
+
+    @Override
+    protected void writeCompressibleHeader()
+    {
+        super.writeCompressibleHeader();
+
+        tagBuffer.flush();
+        report.startEntry(SizeReport.HEADER_DATA, 0, -1, "swfHeader");
+
+        // Here we are recording the size of the full header, not just
+        // the compressible part. The full header is 12 bytes plus the 
+        // size needed to encode a RECT record. The 'tagBuffer' contains
+        // the size of the RECT so we just add 12 to it to get the full size.
+        report.endEntry(SizeReport.HEADER_DATA, tagBuffer.size() + 12);
+    }
+
+    @Override
+    protected void writeDefineSprite(DefineSpriteTag tag)
+    {
+        definingSprite = true;
+        super.writeDefineSprite(tag);
+        definingSprite = false;
+    }
+
+    private void reportShowFrame(int recordLength)
+    {
+        if (!definingSprite)
+        {
+            report.addEntry(SizeReport.FRAME_DATA, -1, 2, "showFrame");
+            report.endEntry(SizeReport.FRAME, 0);
+        }
+    }
+
+    private void reportDefineBinaryData(DefineBinaryDataTag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.BINARY, tag.getCharacterID(), recordLength);
+    }
+
+    private void reportDefineShape(DefineShapeTag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.SHAPE, tag.getCharacterID(), recordLength);
+    }
+
+    public void reportDoABC(DoABCTag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.SCRIPT, -1, recordLength, tag.getName());
+    }
+
+    private void reportEnableDebugger2(int recordLength)
+    {
+        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "enableDebugger");
+    }
+
+    public void reportFileAttributes(FileAttributesTag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "fileAttributes");
+    }
+
+    private void reportMetadata(int recordLength)
+    {
+        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "metaData");
+    }
+
+    private void reportScriptLimits(int recordLength)
+    {
+        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "scriptLimits");
+    }
+
+    private void reportSetBackgroundColor(int recordLength)
+    {
+        report.addEntry(SizeReport.HEADER_DATA, -1, recordLength, "backgroundColor");
+    }
+
+    private void reportEnd()
+    {
+        report.addEntry(SizeReport.HEADER_DATA, -1, 2, "endMarker");
+        report.setSize(outputBuffer.size());
+    }
+
+    private void reportSymbolClass(SymbolClassTag tag, int recordLength)
+    {
+        for (String symbol : tag.getSymbolNames())
+            report.addSymbol(symbol, tag.getSymbol(symbol).getCharacterID());
+
+        report.addEntry(SizeReport.FRAME_DATA, -1, recordLength, "symbolClass");
+    }
+
+    private void reportDefineVideoStream(DefineVideoStreamTag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.VIDEO, tag.getCharacterID(), recordLength);
+    }
+
+    private void reportDefineSound(DefineSoundTag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.SOUND, tag.getCharacterID(), recordLength);
+    }
+
+    private void reportDefineFont(DefineFontTag tag, int recordLength)
+    {
+        String fontName = null;
+        DefineFontNameTag license = tag.getLicense();
+        if (license != null)
+            fontName = license.getFontName();
+
+        report.addEntry(SizeReport.FONT, tag.getCharacterID(), recordLength,
+                fontName);
+    }
+
+    private void reportDefineFont2or3(DefineFont2Tag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.FONT, tag.getCharacterID(), recordLength,
+                tag.getFontName());
+    }
+
+    private void reportDefineFont4(DefineFont4Tag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.FONT, tag.getCharacterID(), recordLength,
+                tag.getFontName());
+    }
+
+    private void reportBitmap(CharacterTag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.BITMAP, tag.getCharacterID(), recordLength);
+    }
+
+    private void reportExportAssets(int recordLength)
+    {
+        report.addEntry(SizeReport.FRAME_DATA, -1, recordLength, "exportAssets");
+    }
+
+    private void reportDefineSprite(DefineSpriteTag tag, int recordLength)
+    {
+        report.addEntry(SizeReport.SPRITE, tag.getCharacterID(), recordLength);
+    }
+
+    private void reportFrameLabel(FrameLabelTag tag, int recordLength)
+    {
+        report.startEntry(SizeReport.FRAME, 0, -1, tag.getName());
+        report.addEntry(SizeReport.FRAME_DATA, -1, recordLength, "frameLabel");
+    }
+
+    /**
+     * Write the size report to the specified file.
+     */
+    private void writeSizeReport()
+    {
+        Writer reportOut = null;
+        try
+        {
+            reportOut = new BufferedWriter(new OutputStreamWriter(
+                    new FileOutputStream(sizeReportFile), "UTF8"));
+            reportOut.write(report.generate());
+            reportOut.flush();
+        }
+        catch (Exception e)
+        {
+            // TODO: report a problem
+            throw new RuntimeException(e);
+        }
+        finally
+        {
+            if (reportOut != null)
+                try
+                {
+                    reportOut.close();
+                }
+                catch (IOException e)
+                {
+                    // ignore
+                }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/2c4f6311/compiler/src/org/apache/flex/swf/tags/EnableTelemetryTag.java
----------------------------------------------------------------------
diff --git a/compiler/src/org/apache/flex/swf/tags/EnableTelemetryTag.java b/compiler/src/org/apache/flex/swf/tags/EnableTelemetryTag.java
new file mode 100644
index 0000000..9f68e30
--- /dev/null
+++ b/compiler/src/org/apache/flex/swf/tags/EnableTelemetryTag.java
@@ -0,0 +1,40 @@
+package org.apache.flex.swf.tags;
+
+import org.apache.flex.swf.TagType;
+
+/**
+ * Represents a <code>EnableTelemetry</code> tag in a SWF file.
+ * <p>
+ * The EnableTelemetry tag instructs the flash runtime to provide advanced telemetry options.
+ */
+public class EnableTelemetryTag extends Tag {
+
+    /**
+     * Constructor.
+     */
+    public EnableTelemetryTag() {
+        super(TagType.EnableTelemetry);
+    }
+
+    /**
+     * Constructor with initialization.
+     */
+    public EnableTelemetryTag(String password) {
+        this();
+        this.password = password;
+    }
+
+
+    private String password;
+
+    public String getPassword()
+    {
+        return password;
+    }
+
+    public void setPassword(String password)
+    {
+        this.password = password;
+    }
+
+}