flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject git commit: [flex-utilities] [refs/heads/develop] - - Implemented a "fontkit" converter - Excluded the "optional" lib-dir from the flex-converter - Extended the DownloadRetriever to download the fontkit dependencies
Date Tue, 07 Apr 2015 11:15:58 GMT
Repository: flex-utilities
Updated Branches:
  refs/heads/develop 251b8ec12 -> 88930af0b


- Implemented a "fontkit" converter
- Excluded the "optional" lib-dir from the flex-converter
- Extended the DownloadRetriever to download the fontkit dependencies


Project: http://git-wip-us.apache.org/repos/asf/flex-utilities/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-utilities/commit/88930af0
Tree: http://git-wip-us.apache.org/repos/asf/flex-utilities/tree/88930af0
Diff: http://git-wip-us.apache.org/repos/asf/flex-utilities/diff/88930af0

Branch: refs/heads/develop
Commit: 88930af0bd4cd4a5853caead261c1dbbe1a6e24a
Parents: 251b8ec
Author: Christofer Dutz <christofer.dutz@codecentric.de>
Authored: Tue Apr 7 13:15:46 2015 +0200
Committer: Christofer Dutz <christofer.dutz@codecentric.de>
Committed: Tue Apr 7 13:15:46 2015 +0200

----------------------------------------------------------------------
 .../flex/utilities/converter/BaseConverter.java |   1 -
 .../flex/utilities/converter/Converter.java     |   2 -
 mavenizer/converters/flex/pom.xml               |   5 +
 .../utilities/converter/flex/FlexConverter.java |   8 -
 .../converter/fontkit/FontkitConverter.java     |  81 +++++
 mavenizer/converters/pom.xml                    |   1 +
 .../utilities/converter/core/SdkConverter.java  |  13 +-
 .../converter/retrievers/types/SdkType.java     |   3 +-
 mavenizer/retrievers/download/pom.xml           |   6 +
 .../retrievers/download/DownloadRetriever.java  | 315 +++++++++++++------
 .../src/main/resources/message.properties       |   1 +
 11 files changed, 320 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/BaseConverter.java
----------------------------------------------------------------------
diff --git a/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/BaseConverter.java
b/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/BaseConverter.java
index 9747209..3e1dbf7 100644
--- a/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/BaseConverter.java
+++ b/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/BaseConverter.java
@@ -19,7 +19,6 @@ package org.apache.flex.utilities.converter;
 import com.sun.jersey.api.client.Client;
 import com.sun.jersey.api.client.ClientResponse;
 import com.sun.jersey.api.client.WebResource;
-
 import org.apache.flex.utilities.converter.exceptions.ConverterException;
 import org.apache.flex.utilities.converter.model.MavenArtifact;
 import org.apache.velocity.VelocityContext;

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/Converter.java
----------------------------------------------------------------------
diff --git a/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/Converter.java
b/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/Converter.java
index 5883270..54f4e18 100644
--- a/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/Converter.java
+++ b/mavenizer/converters/base/src/main/java/org/apache/flex/utilities/converter/Converter.java
@@ -18,8 +18,6 @@ package org.apache.flex.utilities.converter;
 
 import org.apache.flex.utilities.converter.exceptions.ConverterException;
 
-import java.io.File;
-
 /**
  * Created by cdutz on 18.04.2014.
  */

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/converters/flex/pom.xml
----------------------------------------------------------------------
diff --git a/mavenizer/converters/flex/pom.xml b/mavenizer/converters/flex/pom.xml
index e0a4d1c..4134ea0 100644
--- a/mavenizer/converters/flex/pom.xml
+++ b/mavenizer/converters/flex/pom.xml
@@ -49,6 +49,11 @@
             <artifactId>flash-converter</artifactId>
             <version>1.1.0-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.flex.utilities.converter</groupId>
+            <artifactId>fontkit-converter</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
----------------------------------------------------------------------
diff --git a/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
b/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
index 4aa9ba8..d6d3495 100644
--- a/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
+++ b/mavenizer/converters/flex/src/main/java/org/apache/flex/utilities/converter/flex/FlexConverter.java
@@ -94,12 +94,6 @@ public class FlexConverter extends BaseConverter implements Converter {
         final File externalDirectory = new File(directory, "external");
         if(externalDirectory.exists() && externalDirectory.isDirectory()) {
             files.addAll(Arrays.asList(externalDirectory.listFiles(new FlexCompilerFilter())));
-
-            // Add all jars in the "external/optional" directory.
-            final File optionalDirectory = new File(externalDirectory, "optional");
-            if(optionalDirectory.exists() && optionalDirectory.isDirectory()) {
-                files.addAll(Arrays.asList(optionalDirectory.listFiles(new FlexCompilerFilter())));
-            }
         }
 
         // Generate artifacts for every jar in the input directories.
@@ -172,7 +166,6 @@ public class FlexConverter extends BaseConverter implements Converter
{
         // After processing the current directory, process any eventually existing child
directories.
         final List<File> children = new ArrayList<File>();
         children.addAll(Arrays.asList(directory.listFiles(new FileFilter() {
-            @Override
             public boolean accept(File pathname) {
                 return pathname.isDirectory() && !"player".equals(pathname.getName())
&&
                         !"mx".equals(pathname.getName());
@@ -441,7 +434,6 @@ public class FlexConverter extends BaseConverter implements Converter
{
                 if (themeDirectory.isDirectory()) {
                     // Add all the content files.
                     final File contents[] = themeDirectory.listFiles(new FileFilter() {
-                        @Override
                         public boolean accept(File pathname) {
                             return !(pathname.isDirectory() && "src".equals(pathname.getName()))
&&
                                     !"preview.jpg".equals(pathname.getName()) &&
!pathname.getName().endsWith(".fla");

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java
----------------------------------------------------------------------
diff --git a/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java
b/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java
new file mode 100644
index 0000000..bfe27b5
--- /dev/null
+++ b/mavenizer/converters/fontkit/src/main/java/org/apache/flex/utilities/converter/fontkit/FontkitConverter.java
@@ -0,0 +1,81 @@
+package org.apache.flex.utilities.converter.fontkit;
+
+import org.apache.flex.utilities.converter.BaseConverter;
+import org.apache.flex.utilities.converter.Converter;
+import org.apache.flex.utilities.converter.exceptions.ConverterException;
+import org.apache.flex.utilities.converter.model.MavenArtifact;
+
+import java.io.File;
+
+/**
+ * Created by christoferdutz on 06.04.15.
+ */
+public class FontkitConverter extends BaseConverter implements Converter {
+
+    public FontkitConverter(File rootSourceDirectory, File rootTargetDirectory) throws ConverterException
{
+        super(rootSourceDirectory, rootTargetDirectory);
+    }
+
+    @Override
+    protected void processDirectory() throws ConverterException {
+        File fontkitRootDir = new File(rootSourceDirectory, "lib/external/optional");
+        if(!fontkitRootDir.exists() || !fontkitRootDir.isDirectory()) {
+            throw new ConverterException("Fontkit directory '" + fontkitRootDir.getPath()
+ "' is invalid.");
+        }
+
+        File afeJar = new File(fontkitRootDir, "afe.jar");
+        File aglj40Jar = new File(fontkitRootDir, "aglj40.jar");
+        File rideauJar = new File(fontkitRootDir, "rideau.jar");
+        File flexFontkitJar = new File(fontkitRootDir, "flex-fontkit.jar");
+
+        if(!afeJar.exists() || !aglj40Jar.exists() || !rideauJar.exists() || !flexFontkitJar.exists())
{
+            throw new ConverterException("Fontkit directory '" + fontkitRootDir.getPath()
+ "' must contain the jar " +
+                    "files afe.jar, aglj40.jar, rideau.jar and flex-fontkit.jar.");
+        }
+
+        final MavenArtifact fontkit = new MavenArtifact();
+        fontkit.setGroupId("com.adobe");
+        fontkit.setArtifactId("fontkit");
+        fontkit.setVersion("1.0");
+        fontkit.setPackaging("pom");
+
+        final MavenArtifact afe = new MavenArtifact();
+        afe.setGroupId("com.adobe.fontkit");
+        afe.setArtifactId("afe");
+        afe.setVersion("1.0");
+        afe.setPackaging("jar");
+        afe.addDefaultBinaryArtifact(afeJar);
+        fontkit.addDependency(afe);
+
+        final MavenArtifact aglj40 = new MavenArtifact();
+        aglj40.setGroupId("com.adobe.fontkit");
+        aglj40.setArtifactId("aglj40");
+        aglj40.setVersion("1.0");
+        aglj40.setPackaging("jar");
+        aglj40.addDefaultBinaryArtifact(aglj40Jar);
+        fontkit.addDependency(aglj40);
+
+        final MavenArtifact rideau = new MavenArtifact();
+        rideau.setGroupId("com.adobe.fontkit");
+        rideau.setArtifactId("rideau");
+        rideau.setVersion("1.0");
+        rideau.setPackaging("jar");
+        rideau.addDefaultBinaryArtifact(rideauJar);
+        fontkit.addDependency(rideau);
+
+        final MavenArtifact flexFontkit = new MavenArtifact();
+        flexFontkit.setGroupId("com.adobe.fontkit");
+        flexFontkit.setArtifactId("flex-fontkit");
+        flexFontkit.setVersion("1.0");
+        flexFontkit.setPackaging("jar");
+        flexFontkit.addDefaultBinaryArtifact(flexFontkitJar);
+        fontkit.addDependency(flexFontkit);
+
+        writeArtifact(afe);
+        writeArtifact(aglj40);
+        writeArtifact(rideau);
+        writeArtifact(flexFontkit);
+        writeArtifact(fontkit);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/converters/pom.xml
----------------------------------------------------------------------
diff --git a/mavenizer/converters/pom.xml b/mavenizer/converters/pom.xml
index aae0080..40db6e5 100644
--- a/mavenizer/converters/pom.xml
+++ b/mavenizer/converters/pom.xml
@@ -38,6 +38,7 @@
         <module>air</module>
         <module>flash</module>
         <module>flex</module>
+        <module>fontkit</module>
     </modules>
 
 </project>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkConverter.java
----------------------------------------------------------------------
diff --git a/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkConverter.java
b/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkConverter.java
index e98cf5f..ca8e0df 100644
--- a/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkConverter.java
+++ b/mavenizer/core/src/main/java/org/apache/flex/utilities/converter/core/SdkConverter.java
@@ -20,6 +20,7 @@ import org.apache.flex.utilities.converter.air.AirConverter;
 import org.apache.flex.utilities.converter.exceptions.ConverterException;
 import org.apache.flex.utilities.converter.flash.FlashConverter;
 import org.apache.flex.utilities.converter.flex.FlexConverter;
+import org.apache.flex.utilities.converter.fontkit.FontkitConverter;
 
 import java.io.File;
 
@@ -51,19 +52,25 @@ public class SdkConverter {
             final FlexConverter flexConverter = new FlexConverter(sourceDirectory, targetDirectory);
             flexConverter.convert();
         } catch(ConverterException e) {
-            System.out.println("Skipping generation of FLEX SDK");
+            System.out.println("Error during FLEX SDK generation: " + e.getMessage());
         }
         try {
             final AirConverter airConverter = new AirConverter(sourceDirectory, targetDirectory);
             airConverter.convert();
         } catch(ConverterException e) {
-            System.out.println("Skipping generation of AIR SDK");
+            System.out.println("Error during AIR SDK generation: " + e.getMessage());
         }
         try {
             final FlashConverter flashConverter = new FlashConverter(sourceDirectory, targetDirectory);
             flashConverter.convert();
         } catch(ConverterException e) {
-            System.out.println("Skipping generation of Flash SDK");
+            System.out.println("Error during Flash SDK generation: " + e.getMessage());
+        }
+        try {
+            final FontkitConverter fontkitConverter = new FontkitConverter(sourceDirectory,
targetDirectory);
+            fontkitConverter.convert();
+        } catch(ConverterException e) {
+            System.out.println("Error during Fontkit artifacts generation: " + e.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
----------------------------------------------------------------------
diff --git a/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
b/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
index da0b527..c6c1986 100644
--- a/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
+++ b/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
@@ -23,6 +23,7 @@ public enum SdkType {
 
     FLASH,
     AIR,
-    FLEX
+    FLEX,
+    FONTKIT
 
 }

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/retrievers/download/pom.xml
----------------------------------------------------------------------
diff --git a/mavenizer/retrievers/download/pom.xml b/mavenizer/retrievers/download/pom.xml
index 219cbfd..dbaf098 100644
--- a/mavenizer/retrievers/download/pom.xml
+++ b/mavenizer/retrievers/download/pom.xml
@@ -36,6 +36,12 @@
             <artifactId>base-retriever</artifactId>
             <version>1.1.0-SNAPSHOT</version>
         </dependency>
+
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.2.3</version>
+        </dependency>
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
----------------------------------------------------------------------
diff --git a/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
index ff0a05e..3eb3bbe 100644
--- a/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
+++ b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
@@ -16,11 +16,17 @@
  */
 package org.apache.flex.utilities.converter.retrievers.download;
 
+import org.apache.commons.io.IOUtils;
 import org.apache.flex.utilities.converter.retrievers.BaseRetriever;
 import org.apache.flex.utilities.converter.retrievers.exceptions.RetrieverException;
 import org.apache.flex.utilities.converter.retrievers.types.PlatformType;
 import org.apache.flex.utilities.converter.retrievers.types.SdkType;
 import org.apache.flex.utilities.converter.retrievers.utils.ProgressBar;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.DefaultHttpClient;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -33,14 +39,12 @@ import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathConstants;
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
-
 import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
+import java.net.*;
 import java.nio.channels.Channels;
 import java.nio.channels.ReadableByteChannel;
 import java.util.Properties;
+import java.util.UUID;
 
 /**
  * Created by cdutz on 18.05.2014.
@@ -50,40 +54,154 @@ public class DownloadRetriever extends BaseRetriever {
     public static final String FLEX_INSTALLER_CONFIG_URL =
             "http://flex.apache.org/installer/sdk-installer-config-4.0.xml";
 
+    public File retrieve(SdkType type) throws RetrieverException {
+        return retrieve(type, null, null);
+    }
+
     public File retrieve(SdkType type, String version) throws RetrieverException {
         return retrieve(type, version, null);
     }
 
     public File retrieve(SdkType type, String version, PlatformType platformType) throws
RetrieverException {
         try {
-            if (type.equals(SdkType.FLASH) || type.equals(SdkType.AIR)) {
+            if (type.equals(SdkType.FLASH) || type.equals(SdkType.AIR) || type.equals(SdkType.FONTKIT))
{
                 confirmLicenseAcceptance(type);
             }
 
-            // Define the source.
-            final URL sourceUrl = new URL(getBinaryUrl(type, version, platformType));
-            final URLConnection connection = sourceUrl.openConnection();
-            final ReadableByteChannel rbc = Channels.newChannel(connection.getInputStream());
+            if(type.equals(SdkType.FONTKIT)) {
+                File tmpTargetFile = File.createTempFile(UUID.randomUUID().toString(), "tmp");
+                if(!(tmpTargetFile.delete()))
+                {
+                    throw new IOException("Could not delete temp file: " + tmpTargetFile.getAbsolutePath());
+                }
+
+                File targetRootDir = new File(tmpTargetFile.getParentFile(), type.toString());
+                File targetDir = new File(targetRootDir, "/lib/external/optional");
+                if(!(targetDir.mkdirs()))
+                {
+                    throw new IOException("Could not create temp directory: " + targetDir.getAbsolutePath());
+                }
+
+                final URI afeUri = new URI("http://sourceforge.net/adobe/flexsdk/code/HEAD/tree/trunk/lib/afe.jar?format=raw");
+                final File afeFile = new File(targetDir, "afe.jar");
+                performSafeDownload(afeUri, afeFile);
+
+                final URI aglj40Uri = new URI("http://sourceforge.net/adobe/flexsdk/code/HEAD/tree/trunk/lib/aglj40.jar?format=raw");
+                final File aglj40File = new File(targetDir, "aglj40.jar");
+                performSafeDownload(aglj40Uri, aglj40File);
+
+                final URI rideauUri = new URI("http://sourceforge.net/adobe/flexsdk/code/HEAD/tree/trunk/lib/rideau.jar?format=raw");
+                final File rideauFile = new File(targetDir, "rideau.jar");
+                performSafeDownload(rideauUri, rideauFile);
+
+                final URI flexFontkitUri = new URI("http://sourceforge.net/adobe/flexsdk/code/HEAD/tree/trunk/lib/flex-fontkit.jar?format=raw");
+                final File flexFontkitFile = new File(targetDir, "flex-fontkit.jar");
+                performSafeDownload(flexFontkitUri, flexFontkitFile);
+
+                return targetRootDir;
+            } else {
+                final URL sourceUrl = new URL(getBinaryUrl(type, version, platformType));
+                final File targetFile = File.createTempFile(type.toString() + "-" + version
+
+                                ((platformType != null) ? "-" + platformType : "") + "-",
+                        sourceUrl.getFile().substring(sourceUrl.getFile().lastIndexOf(".")));
+                performFastDownload(sourceUrl, targetFile);
+
+                ////////////////////////////////////////////////////////////////////////////////
+                // Do the extracting.
+                ////////////////////////////////////////////////////////////////////////////////
+
+                if (type.equals(SdkType.FLASH)) {
+                    return targetFile;
+                } else {
+                    System.out.println("Extracting archive to temp directory.");
+                    final File targetDirectory = new File(targetFile.getParent(),
+                            targetFile.getName().substring(0, targetFile.getName().lastIndexOf(".")
- 1));
+                    unpack(targetFile, targetDirectory);
+                    System.out.println();
+                    System.out.println("Finished extracting.");
+                    System.out.println("===========================================================");
+
+                    return targetDirectory;
+                }
+            }
+        } catch (MalformedURLException e) {
+            throw new RetrieverException("Error downloading archive.", e);
+        } catch (FileNotFoundException e) {
+            throw new RetrieverException("Error downloading archive.", e);
+        } catch (IOException e) {
+            throw new RetrieverException("Error downloading archive.", e);
+        } catch (URISyntaxException e) {
+            throw new RetrieverException("Error downloading archive.", e);
+        }
+    }
 
-            // Create a temp target file.
-            final File targetFile = File.createTempFile(type.toString() + "-" + version +
-                    ((platformType != null) ? "-" + platformType : "") + "-",
-                    sourceUrl.getFile().substring(sourceUrl.getFile().lastIndexOf(".")));
-            final FileOutputStream fos = new FileOutputStream(targetFile);
+    protected void performFastDownload(URL sourceUrl, File targetFile) throws IOException
{
+        final URLConnection connection = sourceUrl.openConnection();
+        final ReadableByteChannel rbc = Channels.newChannel(connection.getInputStream());
+        final FileOutputStream fos = new FileOutputStream(targetFile);
 
-            ////////////////////////////////////////////////////////////////////////////////
-            // Do the downloading.
-            ////////////////////////////////////////////////////////////////////////////////
+        ////////////////////////////////////////////////////////////////////////////////
+        // Do the downloading.
+        ////////////////////////////////////////////////////////////////////////////////
 
-            final long expectedSize = connection.getContentLength();
+        final long expectedSize = connection.getContentLength();
+        long transferedSize = 0L;
+
+        System.out.println("===========================================================");
+        System.out.println("Downloading " + sourceUrl.toString());
+        if(expectedSize > 1014 * 1024) {
+            System.out.println("Expected size: " + (expectedSize / 1024 / 1024) + "MB");
+        } else {
+            System.out.println("Expected size: " + (expectedSize / 1024 ) + "KB");
+        }
+        final ProgressBar progressBar = new ProgressBar(expectedSize);
+        while (transferedSize < expectedSize) {
+            transferedSize += fos.getChannel().transferFrom(rbc, transferedSize, 1 <<
20);
+            progressBar.updateProgress(transferedSize);
+        }
+        fos.close();
+        System.out.println();
+        System.out.println("Finished downloading.");
+        System.out.println("===========================================================");
+    }
+
+    protected void performSafeDownload(URI sourceUri, File targetFile) throws IOException
{
+        HttpGet httpget = new HttpGet(sourceUri);
+        HttpClient httpclient = new DefaultHttpClient();
+        HttpResponse response = httpclient.execute(httpget);
+
+        String reasonPhrase = response.getStatusLine().getReasonPhrase();
+        int statusCode = response.getStatusLine().getStatusCode();
+        System.out.println(String.format("statusCode: %d", statusCode));
+        System.out.println(String.format("reasonPhrase: %s", reasonPhrase));
+
+        HttpEntity entity = response.getEntity();
+        InputStream content = entity.getContent();
+
+        final ReadableByteChannel rbc = Channels.newChannel(content);
+        final FileOutputStream fos = new FileOutputStream(targetFile);
+
+        ////////////////////////////////////////////////////////////////////////////////
+        // Do the downloading.
+        ////////////////////////////////////////////////////////////////////////////////
+
+        final long expectedSize = entity.getContentLength();
+        System.out.println("===========================================================");
+        System.out.println("Downloading " + sourceUri.toString());
+        if(expectedSize < 0) {
+            try {
+                System.out.println("Unknown size.");
+                IOUtils.copy(content, fos);
+            } finally {
+                // close http network connection
+                content.close();
+            }
+        } else {
             long transferedSize = 0L;
-            System.out.println("===========================================================");
-            System.out.println("Downloading " + type + " version " + version +
-                    ((platformType != null) ? " for platform " + platformType : ""));
-            if(expectedSize > 1014 * 1024) {
+            if (expectedSize > 1014 * 1024) {
                 System.out.println("Expected size: " + (expectedSize / 1024 / 1024) + "MB");
             } else {
-                System.out.println("Expected size: " + (expectedSize / 1024 ) + "KB");
+                System.out.println("Expected size: " + (expectedSize / 1024) + "KB");
             }
             final ProgressBar progressBar = new ProgressBar(expectedSize);
             while (transferedSize < expectedSize) {
@@ -92,33 +210,9 @@ public class DownloadRetriever extends BaseRetriever {
             }
             fos.close();
             System.out.println();
-            System.out.println("Finished downloading.");
-            System.out.println("===========================================================");
-
-            ////////////////////////////////////////////////////////////////////////////////
-            // Do the extracting.
-            ////////////////////////////////////////////////////////////////////////////////
-
-            if(type.equals(SdkType.FLASH)) {
-                return targetFile;
-            } else {
-                System.out.println("Extracting archive to temp directory.");
-                final File targetDirectory = new File(targetFile.getParent(),
-                        targetFile.getName().substring(0, targetFile.getName().lastIndexOf(".")
- 1));
-                unpack(targetFile, targetDirectory);
-                System.out.println();
-                System.out.println("Finished extracting.");
-                System.out.println("===========================================================");
-
-                return targetDirectory;
-            }
-        } catch (MalformedURLException e) {
-            throw new RetrieverException("Error downloading archive.", e);
-        } catch (FileNotFoundException e) {
-            throw new RetrieverException("Error downloading archive.", e);
-        } catch (IOException e) {
-            throw new RetrieverException("Error downloading archive.", e);
         }
+        System.out.println("Finished downloading.");
+        System.out.println("===========================================================");
     }
 
     protected String getBinaryUrl(SdkType sdkType, String version, PlatformType platformType)
@@ -204,6 +298,9 @@ public class DownloadRetriever extends BaseRetriever {
             case FLASH:
                 stringBuilder.append("//*[@id='flash.sdk.version.").append(version).append("']");
                 break;
+            case FONTKIT:
+                stringBuilder.append("//fontswf");
+
         }
         return stringBuilder.toString();
     }
@@ -221,8 +318,10 @@ public class DownloadRetriever extends BaseRetriever {
             question = questionProps.getProperty("ASK_ADOBE_FLASH_PLAYER_GLOBAL_SWC");
         } else if(type.equals(SdkType.AIR)) {
             question = questionProps.getProperty("ASK_ADOBE_AIR_SDK");
+        } else if(type.equals(SdkType.FONTKIT)) {
+            question = questionProps.getProperty("ASK_ADOBE_FONTKIT");
         } else {
-            throw new RetrieverException("Unknown SDKType");
+            throw new RetrieverException("Unknown SdkType");
         }
         System.out.println(question);
         System.out.print(questionProps.getProperty("DO_YOU_ACCEPT_QUESTION") + " ");
@@ -244,62 +343,76 @@ public class DownloadRetriever extends BaseRetriever {
         final DownloadRetriever retriever = new DownloadRetriever();
 
         // Test the retrieval of Flex SDKs
-        /*retriever.retrieve(SDKType.FLEX, "4.9.1");
-        retriever.retrieve(SDKType.FLEX, "4.10.0");
-        retriever.retrieve(SDKType.FLEX, "4.11.0");
-        retriever.retrieve(SDKType.FLEX, "4.12.0");
-        retriever.retrieve(SDKType.FLEX, "4.12.1");
-        retriever.retrieve(SDKType.FLEX, "Nightly");*/
+        /*retriever.retrieve(SdkType.FLEX, "4.9.1");
+        retriever.retrieve(SdkType.FLEX, "4.10.0");
+        retriever.retrieve(SdkType.FLEX, "4.11.0");
+        retriever.retrieve(SdkType.FLEX, "4.12.0");
+        retriever.retrieve(SdkType.FLEX, "4.12.1");
+        retriever.retrieve(SdkType.FLEX, "4.13.0");*/
+        retriever.retrieve(SdkType.FLEX, "4.14.1");
+        //retriever.retrieve(SdkType.FLEX, "Nightly");
+
+        // Test the retrieval of Fontkit libraries
+        retriever.retrieve(SdkType.FONTKIT);
 
         // Test the retrieval of AIR SDKs
-        /*retriever.retrieve(SDKType.AIR, "2.6", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "2.6", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "2.6", PlatformType.LINUX);
-        retriever.retrieve(SDKType.AIR, "2.7", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "2.7", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.0", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.0", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.1", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.1", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.2", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.2", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.3", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.3", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.4", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.4", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.5", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.5", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.6", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.6", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.7", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.7", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.8", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.8", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "3.9", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "3.9", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "4.0", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "4.0", PlatformType.MAC);
-        retriever.retrieve(SDKType.AIR, "13.0", PlatformType.WINDOWS);
-        retriever.retrieve(SDKType.AIR, "13.0", PlatformType.MAC);*/
-        //retriever.retrieve(SDKType.AIR, "14.0", PlatformType.WINDOWS);
+        /*retriever.retrieve(SdkType.AIR, "2.6", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "2.6", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "2.6", PlatformType.LINUX);
+        retriever.retrieve(SdkType.AIR, "2.7", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "2.7", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.0", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.0", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.1", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.1", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.2", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.2", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.3", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.3", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.4", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.4", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.5", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.5", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.6", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.6", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.7", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.7", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.8", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.8", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "3.9", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "3.9", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "4.0", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "4.0", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "13.0", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "13.0", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "14.0", PlatformType.WINDOWS);
         retriever.retrieve(SdkType.AIR, "14.0", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "15.0", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "15.0", PlatformType.MAC);
+        retriever.retrieve(SdkType.AIR, "16.0", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "16.0", PlatformType.MAC);*/
+        retriever.retrieve(SdkType.AIR, "17.0", PlatformType.WINDOWS);
+        retriever.retrieve(SdkType.AIR, "17.0", PlatformType.MAC);
 
         // Test the retrieval of Flash SDKs
-        /*retriever.retrieve(SDKType.FLASH, "10.2");
-        retriever.retrieve(SDKType.FLASH, "10.3");
-        retriever.retrieve(SDKType.FLASH, "11.0");
-        retriever.retrieve(SDKType.FLASH, "11.1");
-        retriever.retrieve(SDKType.FLASH, "11.2");
-        retriever.retrieve(SDKType.FLASH, "11.3");
-        retriever.retrieve(SDKType.FLASH, "11.4");
-        retriever.retrieve(SDKType.FLASH, "11.5");
-        retriever.retrieve(SDKType.FLASH, "11.6");
-        retriever.retrieve(SDKType.FLASH, "11.7");
-        retriever.retrieve(SDKType.FLASH, "11.8");
-        retriever.retrieve(SDKType.FLASH, "11.9");
-        retriever.retrieve(SDKType.FLASH, "12.0");
-        retriever.retrieve(SDKType.FLASH, "13.0");
-        retriever.retrieve(SDKType.FLASH, "14.0");*/
+        /*retriever.retrieve(SdkType.FLASH, "10.2");
+        retriever.retrieve(SdkType.FLASH, "10.3");
+        retriever.retrieve(SdkType.FLASH, "11.0");
+        retriever.retrieve(SdkType.FLASH, "11.1");
+        retriever.retrieve(SdkType.FLASH, "11.2");
+        retriever.retrieve(SdkType.FLASH, "11.3");
+        retriever.retrieve(SdkType.FLASH, "11.4");
+        retriever.retrieve(SdkType.FLASH, "11.5");
+        retriever.retrieve(SdkType.FLASH, "11.6");
+        retriever.retrieve(SdkType.FLASH, "11.7");
+        retriever.retrieve(SdkType.FLASH, "11.8");
+        retriever.retrieve(SdkType.FLASH, "11.9");
+        retriever.retrieve(SdkType.FLASH, "12.0");
+        retriever.retrieve(SdkType.FLASH, "13.0");
+        retriever.retrieve(SdkType.FLASH, "14.0");
+        retriever.retrieve(SdkType.FLASH, "15.0");
+        retriever.retrieve(SdkType.FLASH, "16.0");*/
+        retriever.retrieve(SdkType.FLASH, "17.0");
 
     }
 

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/88930af0/mavenizer/retrievers/download/src/main/resources/message.properties
----------------------------------------------------------------------
diff --git a/mavenizer/retrievers/download/src/main/resources/message.properties b/mavenizer/retrievers/download/src/main/resources/message.properties
index b799623..9552436 100644
--- a/mavenizer/retrievers/download/src/main/resources/message.properties
+++ b/mavenizer/retrievers/download/src/main/resources/message.properties
@@ -18,4 +18,5 @@
 ################################################################################
 ASK_ADOBE_AIR_SDK=The Adobe SDK license agreement applies to the Adobe AIR SDK. Do you want
to install the Adobe AIR SDK? Adobe AIR SDK License: http://www.adobe.com/products/air/sdk-eula.html
 ASK_ADOBE_FLASH_PLAYER_GLOBAL_SWC=The Adobe SDK license agreement applies to the Adobe Flash
Player playerglobal.swc. Do you want to install the Adobe Flash Player playerglobal.swc?
+ASK_ADOBE_FONTKIT=Apache Flex can optionally integrate with Adobe's embedded font support.
This feature requires a few font jars from the Adobe Flex SDK. The Adobe SDK license agreement
for Adobe Flex 4.6 applies to these jars. This license is not compatible with the Apache V2
license. Do you want to install these jars from the Adobe Flex SDK?
 DO_YOU_ACCEPT_QUESTION=Do you accept (Yes/No)?
\ No newline at end of file


Mime
View raw message