flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [01/13] git commit: [flex-utilities] [refs/heads/develop] - - Renamed the root directory - Renamed the artifact of the maven-extension to flex-sdk-converter-maven-extension
Date Thu, 23 Jul 2015 09:30:26 GMT
Repository: flex-utilities
Updated Branches:
  refs/heads/develop 57a412750 -> 8bc0350d2


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
b/flex-maven-tools/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
deleted file mode 100644
index f8b3024..0000000
--- a/flex-maven-tools/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/types/SdkType.java
+++ /dev/null
@@ -1,30 +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.utilities.converter.retrievers.types;
-
-/**
- * Created by cdutz on 18.05.2014.
- */
-public enum SdkType {
-
-    FLEX,
-    FLASH,
-    AIR,
-    FONTKIT,
-    SWFOBJECT
-
-}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/utils/ProgressBar.java
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/utils/ProgressBar.java
b/flex-maven-tools/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/utils/ProgressBar.java
deleted file mode 100644
index c15d26b..0000000
--- a/flex-maven-tools/mavenizer/retrievers/base/src/main/java/org/apache/flex/utilities/converter/retrievers/utils/ProgressBar.java
+++ /dev/null
@@ -1,47 +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.utilities.converter.retrievers.utils;
-
-import org.apache.commons.lang3.StringUtils;
-
-/**
- * Created by cdutz on 24.05.2014.
- */
-public class ProgressBar {
-
-    protected long total;
-
-    public ProgressBar(long total) {
-        this.total = total;
-        drawOutput(0l);
-    }
-
-    public void updateProgress(long current) {
-        drawOutput(current);
-    }
-
-    protected void drawOutput(long current) {
-        final int transferredPercent = (int) Math.round(
-                ((double) current / (double) total) * (double) 100);
-        final int segmentsTransferred = transferredPercent / 2;
-        final int segmentsRest = 50 - segmentsTransferred;
-        System.out.print("\r" + String.format(" %3d", transferredPercent) + "% [" +
-                StringUtils.repeat("=", segmentsTransferred) +
-                ((segmentsRest > 0) ? ">" + StringUtils.repeat(" ", segmentsRest -
1) : "") + "] ");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/base/src/test/java/org/apache/flex/utilities/converter/retrievers/types/PlatformTypeTest.java
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/base/src/test/java/org/apache/flex/utilities/converter/retrievers/types/PlatformTypeTest.java
b/flex-maven-tools/mavenizer/retrievers/base/src/test/java/org/apache/flex/utilities/converter/retrievers/types/PlatformTypeTest.java
deleted file mode 100644
index eeb6a22..0000000
--- a/flex-maven-tools/mavenizer/retrievers/base/src/test/java/org/apache/flex/utilities/converter/retrievers/types/PlatformTypeTest.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.apache.flex.utilities.converter.retrievers.types;
-
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
-import org.apache.commons.lang3.SystemUtils;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.Collection;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @author: Frederic Thomas
- * Date: 12/05/2015
- * Time: 01:34
- */
-@RunWith(JUnitParamsRunner.class)
-public class PlatformTypeTest {
-
-	private Class<SystemUtils> systemUtilsClass;
-
-	public static Collection<Object[]> platformParameters() {
-		return Arrays.asList(new Object[][]{
-				{"IS_OS_WINDOWS", PlatformType.WINDOWS},
-				{"IS_OS_MAC", PlatformType.MAC},
-				{"IS_OS_MAC_OSX", PlatformType.MAC},
-				{"IS_OS_UNIX", PlatformType.LINUX}
-		});
-	}
-
-	@Before
-	public void setUp() throws Exception {
-		systemUtilsClass = SystemUtils.class;
-
-		setFinalStatic(systemUtilsClass.getField("IS_OS_WINDOWS"), false);
-		setFinalStatic(systemUtilsClass.getField("IS_OS_MAC"), false);
-		setFinalStatic(systemUtilsClass.getField("IS_OS_MAC_OSX"), false);
-		setFinalStatic(systemUtilsClass.getField("IS_OS_UNIX"), false);
-	}
-
-	@Test
-	@Parameters(method = "platformParameters")
-	public void it_detects_the_current_platform_type(String fieldName, PlatformType platformType)
throws Exception {
-
-		setFinalStatic(systemUtilsClass.getField(fieldName), true);
-		assertEquals(platformType, PlatformType.getCurrent());
-	}
-
-	@Test(expected = Exception.class)
-	public void it_throws_an_exception_when_it_can_not_detect_the_current_platform_type() throws
Exception {
-		PlatformType.getCurrent();
-	}
-
-	private static void setFinalStatic(Field field, Object newValue) throws Exception {
-		field.setAccessible(true);
-
-		// remove final modifier from field
-		Field modifiersField = Field.class.getDeclaredField("modifiers");
-		modifiersField.setAccessible(true);
-		modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
-
-		field.set(null, newValue);
-	}
-}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/download/pom.xml
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/download/pom.xml b/flex-maven-tools/mavenizer/retrievers/download/pom.xml
deleted file mode 100644
index ffa2665..0000000
--- a/flex-maven-tools/mavenizer/retrievers/download/pom.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?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/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.flex.utilities.converter</groupId>
-        <artifactId>retrievers</artifactId>
-        <version>1.0.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>download-retriever</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
-    <packaging>jar</packaging>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.flex.utilities.converter</groupId>
-            <artifactId>base-retriever</artifactId>
-            <version>1.0.0-SNAPSHOT</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.httpcomponents</groupId>
-            <artifactId>httpclient</artifactId>
-            <version>4.5</version>
-        </dependency>
-
-        <dependency>
-            <groupId>org.mock-server</groupId>
-            <artifactId>mockserver-netty</artifactId>
-            <version>RELEASE</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.testng</groupId>
-            <artifactId>testng</artifactId>
-            <version>6.8.8</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.maven</groupId>
-            <artifactId>maven-artifact</artifactId>
-            <version>3.2.3</version>
-            <scope>provided</scope>
-        </dependency>
-    </dependencies>
-
-</project>

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
b/flex-maven-tools/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
deleted file mode 100644
index 490f8c0..0000000
--- a/flex-maven-tools/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/DownloadRetriever.java
+++ /dev/null
@@ -1,496 +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.utilities.converter.retrievers.download;
-
-import org.apache.commons.io.FileUtils;
-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.model.ProxySettings;
-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.HttpHost;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.HttpClients;
-import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-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.*;
-import java.nio.channels.Channels;
-import java.nio.channels.ReadableByteChannel;
-import java.text.MessageFormat;
-import java.util.*;
-
-/**
- * Created by cdutz on 18.05.2014.
- */
-public class DownloadRetriever extends BaseRetriever {
-
-    public static final String FLEX_INSTALLER_CONFIG_URL =
-            "http://flex.apache.org/installer/sdk-installer-config-4.0.xml";
-
-    /**
-     * Wrapper to allow simple overriding of this property.
-     *
-     * @return URL from which the version information should be loaded.
-     */
-    protected String getFlexInstallerConfigUrl() {
-        return FLEX_INSTALLER_CONFIG_URL;
-    }
-
-    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 {
-        return retrieve(type, version, platformType, null);
-    }
-
-    public File retrieve(SdkType type, String version, PlatformType platformType, ProxySettings
proxySettings)
-            throws RetrieverException {
-        try {
-            if (type.equals(SdkType.FLASH) || type.equals(SdkType.AIR) || type.equals(SdkType.FONTKIT))
{
-                confirmLicenseAcceptance(type);
-            }
-
-            if(type.equals(SdkType.FONTKIT)) {
-                File tmpTargetFile = File.createTempFile(UUID.randomUUID().toString(), "");
-                String tempSuffix = tmpTargetFile.getName().substring(tmpTargetFile.getName().lastIndexOf("-"));
-                if(!(tmpTargetFile.delete()))
-                {
-                    throw new IOException("Could not delete temp file: " + tmpTargetFile.getAbsolutePath());
-                }
-
-                File targetRootDir = new File(tmpTargetFile.getParentFile(), type.toString()
+ tempSuffix);
-                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, proxySettings);
-
-                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, proxySettings);
-
-                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, proxySettings);
-
-                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, proxySettings);
-
-                return targetRootDir;
-            } else {
-                final URL sourceUrl = new URL(getBinaryUrl(type, version, platformType, proxySettings));
-                final File targetFile = File.createTempFile(type.toString() + "-" + version
+
-                                ((platformType != null) ? "-" + platformType : "") + "-",
-                        sourceUrl.getFile().substring(sourceUrl.getFile().lastIndexOf(".")));
-                performFastDownload(sourceUrl, targetFile, proxySettings);
-
-                ////////////////////////////////////////////////////////////////////////////////
-                // Do the extracting.
-                ////////////////////////////////////////////////////////////////////////////////
-
-                if (type.equals(SdkType.FLASH)) {
-                    final File targetDirectory = new File(targetFile.getParent(),
-                            targetFile.getName().substring(0, targetFile.getName().lastIndexOf(".")
- 1));
-                    final File libDestFile = new File(targetDirectory, "frameworks/libs/player/"
+ version +
-                            "/playerglobal.swc");
-                    if (!libDestFile.getParentFile().exists()) {
-                        if(!libDestFile.getParentFile().mkdirs()) {
-                            throw new RetrieverException("Error creating directory " + libDestFile.getParent());
-                        }
-                    }
-                    FileUtils.moveFile(targetFile, libDestFile);
-                    return targetDirectory;
-                } else {
-                    System.out.println("Extracting archive to temp directory.");
-                    File targetDirectory = new File(targetFile.getParent(),
-                            targetFile.getName().substring(0, targetFile.getName().lastIndexOf(".")
- 1));
-                    if(type.equals(SdkType.SWFOBJECT)) {
-                        unpack(targetFile, new File(targetDirectory, "templates"));
-                    } else {
-                        unpack(targetFile, targetDirectory);
-                    }
-                    System.out.println();
-                    System.out.println("Finished extracting.");
-                    System.out.println("===========================================================");
-
-                    // In case of the swfobject, delete some stuff we don't want in there.
-                    if(type.equals(SdkType.SWFOBJECT)) {
-                        File delFile = new File(targetDirectory, "templates/swfobject/index_dynamic.html");
-                        FileUtils.deleteQuietly(delFile);
-                        delFile = new File(targetDirectory, "templates/swfobject/index.html");
-                        FileUtils.deleteQuietly(delFile);
-                        delFile = new File(targetDirectory, "templates/swfobject/test.swf");
-                        FileUtils.deleteQuietly(delFile);
-                        delFile = new File(targetDirectory, "templates/swfobject/src");
-                        FileUtils.deleteDirectory(delFile);
-                    }
-
-                    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);
-        }
-    }
-
-    protected void performFastDownload(URL sourceUrl, File targetFile, ProxySettings proxySettings)
throws IOException {
-        URLConnection connection;
-        if(proxySettings != null) {
-            SocketAddress socketAddress = new InetSocketAddress(proxySettings.getHost(),
proxySettings.getPort());
-            Proxy proxy = new Proxy(Proxy.Type.valueOf(proxySettings.getProtocol().toUpperCase()),
socketAddress);
-            connection = sourceUrl.openConnection(proxy);
-        } else {
-            connection = sourceUrl.openConnection();
-        }
-        final ReadableByteChannel rbc = Channels.newChannel(connection.getInputStream());
-        final FileOutputStream fos = new FileOutputStream(targetFile);
-
-        ////////////////////////////////////////////////////////////////////////////////
-        // Do the downloading.
-        ////////////////////////////////////////////////////////////////////////////////
-
-        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, ProxySettings proxySettings)
throws IOException {
-        RequestConfig config;
-        if(proxySettings != null) {
-            HttpHost proxy = new HttpHost(proxySettings.getHost(), proxySettings.getPort());
-            config = RequestConfig.custom().setProxy(proxy).build();
-        } else {
-            config = RequestConfig.DEFAULT;
-        }
-
-        HttpGet httpget = new HttpGet(sourceUri);
-        httpget.setConfig(config);
-        HttpClient httpclient = HttpClients.createDefault();
-        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;
-            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 String getBinaryUrl(SdkType sdkType, String version, PlatformType platformType,
-                                  ProxySettings proxySettings)
-            throws RetrieverException {
-        try {
-            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            final DocumentBuilder builder = factory.newDocumentBuilder();
-            final URL configUrl = new URL(getFlexInstallerConfigUrl());
-            URLConnection connection;
-            if(proxySettings != null) {
-                SocketAddress socketAddress = new InetSocketAddress(proxySettings.getHost(),
proxySettings.getPort());
-                Proxy proxy = new Proxy(Proxy.Type.valueOf(proxySettings.getProtocol().toUpperCase()),
socketAddress);
-                connection = configUrl.openConnection(proxy);
-            } else {
-                connection = configUrl.openConnection();
-            }
-            final Document doc = builder.parse(connection.getInputStream());
-
-            //Evaluate XPath against Document itself
-            final String expression = getUrlXpath(sdkType, version, platformType);
-            final XPath xPath = XPathFactory.newInstance().newXPath();
-            final Element artifactElement = (Element) xPath.evaluate(
-                    expression, doc.getDocumentElement(), XPathConstants.NODE);
-            if(artifactElement == null) {
-                throw new RetrieverException("Could not find " + sdkType.toString() + " SDK
with version " + version);
-            }
-
-            final StringBuilder stringBuilder = new StringBuilder();
-            if ((sdkType == SdkType.FLEX) || (sdkType == SdkType.SWFOBJECT)) {
-                final String path = artifactElement.getAttribute("path");
-                final String file = artifactElement.getAttribute("file");
-                if (!path.startsWith("http://")) {
-                    stringBuilder.append("http://archive.apache.org/dist/");
-                }
-                stringBuilder.append(path);
-                if(!path.endsWith("/")) {
-                    stringBuilder.append("/");
-                }
-                stringBuilder.append(file);
-                if(sdkType == SdkType.FLEX) {
-                    stringBuilder.append(".zip");
-                }
-            } else {
-                final NodeList pathElements = artifactElement.getElementsByTagName("path");
-                final NodeList fileElements = artifactElement.getElementsByTagName("file");
-                if ((pathElements.getLength() != 1) && (fileElements.getLength()
!= 1)) {
-                    throw new RetrieverException("Invalid document structure.");
-                }
-                final String path = pathElements.item(0).getTextContent();
-                stringBuilder.append(path);
-                if(!path.endsWith("/")) {
-                    stringBuilder.append("/");
-                }
-                stringBuilder.append(fileElements.item(0).getTextContent());
-            }
-
-            return stringBuilder.toString();
-        } catch (ParserConfigurationException e) {
-            throw new RetrieverException("Error parsing 'sdk-installer-config-4.0.xml'",
e);
-        } catch (SAXException e) {
-            throw new RetrieverException("Error parsing 'sdk-installer-config-4.0.xml'",
e);
-        } catch (XPathExpressionException e) {
-            throw new RetrieverException("Error parsing 'sdk-installer-config-4.0.xml'",
e);
-        } catch (IOException e) {
-            throw new RetrieverException("Error parsing 'sdk-installer-config-4.0.xml'",
e);
-        }
-    }
-
-    protected String getUrlXpath(SdkType sdkType, String version, PlatformType platformType)
-            throws RetrieverException {
-        final StringBuilder stringBuilder = new StringBuilder();
-        switch (sdkType) {
-            case FLEX:
-                stringBuilder.append("//*[@id='").append(version).append("']");
-                break;
-            case AIR:
-                stringBuilder.append("//*[@id='air.sdk.version.");
-                if (platformType == null) {
-                    throw new RetrieverException("You need to specify the platformType parameter
for AIR SDKs.");
-                }
-                switch (platformType) {
-                    case WINDOWS:
-                        stringBuilder.append("windows");
-                        break;
-                    case MAC:
-                        stringBuilder.append("mac");
-                        break;
-                    case LINUX:
-                        stringBuilder.append("linux");
-                        break;
-
-                }
-                stringBuilder.append(".").append(version).append("']");
-                break;
-            case FLASH:
-                stringBuilder.append("//*[@id='flash.sdk.version.").append(version).append("']");
-                break;
-            case FONTKIT:
-                stringBuilder.append("//fontswf");
-                break;
-            case SWFOBJECT:
-                stringBuilder.append("//swfobject");
-                break;
-        }
-        return stringBuilder.toString();
-    }
-
-    protected void confirmLicenseAcceptance(SdkType type) throws RetrieverException {
-        final Properties questionProps = new Properties();
-        try {
-            questionProps.load(DownloadRetriever.class.getClassLoader().getResourceAsStream("message.properties"));
-        } catch (IOException e) {
-            throw new RetrieverException("Error reading message.properties file", e);
-        }
-
-        String property = "com.adobe.systemIdsForWhichTheTermsOfTheAdobeLicenseAgreementAreAccepted";
-
-        // Implement the accepting the license by providing a system-id as system-property.
-        String acceptedSystemIds = System.getProperty(property);
-        if(acceptedSystemIds != null) {
-            String systemId = SystemIdHelper.getSystemId();
-            if(systemId != null) {
-                for (String acceptedSystemId : acceptedSystemIds.split(",")) {
-                    if (systemId.equals(acceptedSystemId)) {
-                        System.out.println(questionProps.getProperty("ACCEPTED_USING_SYSTEM_ID"));
-                        return;
-                    }
-                }
-            }
-        }
-
-        final String question;
-        if(type.equals(SdkType.FLASH)) {
-            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");
-        }
-        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
-        try {
-            while (true) {
-                System.out.println(
-                        MessageFormat.format(questionProps.getProperty("SYSTEM_ID"), SystemIdHelper.getSystemId()));
-                System.out.println(question);
-                System.out.println(MessageFormat.format(questionProps.getProperty("ACCEPT_USING_SYSTEM_ID"),
-                        property, SystemIdHelper.getSystemId()));
-                System.out.print(questionProps.getProperty("DO_YOU_ACCEPT_QUESTION") + "
");
-                final String answer = reader.readLine();
-                if ("YES".equalsIgnoreCase(answer) || "Y".equalsIgnoreCase(answer)) {
-                    return;
-                }
-                if ("NO".equalsIgnoreCase(answer) || "N".equalsIgnoreCase(answer)) {
-                    System.out.println("You have to accept the license agreement in order
to proceed.");
-                    throw new RetrieverException("You have to accept the license agreement
in order to proceed.");
-                }
-            }
-        } catch(IOException e) {
-            throw new RetrieverException("Couldn't read from Stdin.");
-        }
-    }
-
-    public Map<DefaultArtifactVersion, Collection<PlatformType>> getAvailableVersions(SdkType
type) {
-        Map<DefaultArtifactVersion, Collection<PlatformType>> result =
-                new HashMap<DefaultArtifactVersion, Collection<PlatformType>>();
-        try {
-            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            final DocumentBuilder builder = factory.newDocumentBuilder();
-            final Document doc = builder.parse(getFlexInstallerConfigUrl());
-            final XPath xPath = XPathFactory.newInstance().newXPath();
-
-            String expression;
-            NodeList nodes = null;
-            switch (type) {
-                case FLEX:
-                    expression = "/config/products/ApacheFlexSDK/versions/*";
-                    nodes = (NodeList) xPath.evaluate(expression, doc.getDocumentElement(),
XPathConstants.NODESET);
-                    break;
-                case FLASH:
-                    expression = "/config/flashsdk/versions/*";
-                    nodes = (NodeList) xPath.evaluate(expression, doc.getDocumentElement(),
XPathConstants.NODESET);
-                    break;
-                case AIR:
-                    expression = "/config/airsdk/*/versions/*";
-                    nodes = (NodeList) xPath.evaluate(expression, doc.getDocumentElement(),
XPathConstants.NODESET);
-                    break;
-            }
-
-            if (nodes != null) {
-                for(int i = 0; i < nodes.getLength(); i++) {
-                    Element element = (Element) nodes.item(i);
-                    DefaultArtifactVersion version = new DefaultArtifactVersion(element.getAttribute("version"));
-                    if(type == SdkType.AIR) {
-                        PlatformType platformType = PlatformType.valueOf(
-                                element.getParentNode().getParentNode().getNodeName().toUpperCase());
-                        if(!result.containsKey(version)) {
-                            result.put(version, new ArrayList<PlatformType>());
-                        }
-                        result.get(version).add(platformType);
-                    } else {
-                        result.put(version, null);
-                    }
-                }
-            }
-        } catch (ParserConfigurationException e) {
-            e.printStackTrace();
-        } catch (SAXException e) {
-            e.printStackTrace();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } catch (XPathExpressionException e) {
-            e.printStackTrace();
-        }
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/SystemIdHelper.java
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/SystemIdHelper.java
b/flex-maven-tools/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/SystemIdHelper.java
deleted file mode 100644
index 837c27f..0000000
--- a/flex-maven-tools/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/SystemIdHelper.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.flex.utilities.converter.retrievers.download;
-
-import java.net.NetworkInterface;
-import java.net.SocketException;
-import java.util.Arrays;
-import java.util.Enumeration;
-
-/**
- * Created by christoferdutz on 05.06.15.
- */
-public abstract class SystemIdHelper {
-
-    public static String getSystemId() {
-        try {
-            Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
-            byte[] macSum = new byte[] { 0,0,0,0,0,0};
-            while (nis.hasMoreElements()) {
-                NetworkInterface ni = nis.nextElement();
-                byte[] mac = ni.getHardwareAddress();
-                if((mac != null) && (mac.length >= 6)) {
-                    macSum[0] = (byte) ((macSum[0] + mac[0]) % 256);
-                    macSum[1] = (byte) ((macSum[1] + mac[1]) % 256);
-                    macSum[2] = (byte) ((macSum[2] + mac[2]) % 256);
-                    macSum[3] = (byte) ((macSum[3] + mac[3]) % 256);
-                    macSum[4] = (byte) ((macSum[4] + mac[4]) % 256);
-                    macSum[5] = (byte) ((macSum[5] + mac[5]) % 256);
-                }
-            }
-            return Integer.toHexString(Arrays.hashCode(macSum));
-        } catch (SocketException e) {
-            return null;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/download/src/main/resources/message.properties
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/download/src/main/resources/message.properties
b/flex-maven-tools/mavenizer/retrievers/download/src/main/resources/message.properties
deleted file mode 100644
index d0b04cb..0000000
--- a/flex-maven-tools/mavenizer/retrievers/download/src/main/resources/message.properties
+++ /dev/null
@@ -1,25 +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.
-##
-################################################################################
-SYSTEM_ID=Your System-Id: {0}
-ACCEPT_USING_SYSTEM_ID=(In a non-interactive build such as a CI server build, alternatively
to typing 'y' or 'yes' you can also set a system property containing your system which is
interpreted as equivalent to accepting by typing 'y' or 'yes': -D{0}={1} )
-ACCEPTED_USING_SYSTEM_ID=The terms of the Adobe licence Agreements were accepted by providing
a system property.
-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

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/download/src/test/java/org/apache/flex/utilities/converter/retrievers/download/ProxyTest.java
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/download/src/test/java/org/apache/flex/utilities/converter/retrievers/download/ProxyTest.java
b/flex-maven-tools/mavenizer/retrievers/download/src/test/java/org/apache/flex/utilities/converter/retrievers/download/ProxyTest.java
deleted file mode 100644
index e186e53..0000000
--- a/flex-maven-tools/mavenizer/retrievers/download/src/test/java/org/apache/flex/utilities/converter/retrievers/download/ProxyTest.java
+++ /dev/null
@@ -1,88 +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.utilities.converter.retrievers.download;
-
-import org.apache.flex.utilities.converter.retrievers.model.ProxySettings;
-import org.apache.flex.utilities.converter.retrievers.types.PlatformType;
-import org.apache.flex.utilities.converter.retrievers.types.SdkType;
-import org.mockserver.integration.ClientAndProxy;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import static org.mockserver.integration.ClientAndProxy.startClientAndProxy;
-
-/**
- * Created by christoferdutz on 02.07.15.
- */
-public class ProxyTest {
-
-    private ClientAndProxy proxy;
-
-    @BeforeMethod
-    public void startProxy() {
-        proxy = startClientAndProxy(3456);
-        // Make the test accept the license agreement.
-        System.setProperty("com.adobe.systemIdsForWhichTheTermsOfTheAdobeLicenseAgreementAreAccepted",
SystemIdHelper.getSystemId());
-    }
-
-    @AfterMethod
-    public void stopProxy() {
-        proxy.stop();
-    }
-
-    /**
-     * Does a download using the URLConnection class
-     */
-    @Test
-    public void simpleFastHttpNoAuthProxy() throws Exception {
-        ProxySettings proxySettings = new ProxySettings("HTTP", "localhost", 3456, null,
null, null);
-        DownloadRetriever downloadRetriever = new DownloadRetriever();
-        downloadRetriever.retrieve(SdkType.FLASH, "17.0", PlatformType.WINDOWS, proxySettings);
-    }
-
-    /**
-     * Does a download using the HttpClient class
-     */
-    @Test
-    public void simpleSafeHttpNoAuthProxy() throws Exception {
-        ProxySettings proxySettings = new ProxySettings("HTTP", "localhost", 3456, null,
null, null);
-        DownloadRetriever downloadRetriever = new DownloadRetriever();
-        downloadRetriever.retrieve(SdkType.FONTKIT, "1.0", PlatformType.WINDOWS, proxySettings);
-    }
-
-    /**
-     * Does a download using the URLConnection class using a proxy that requires authentication.
-     */
-    @Test(enabled = false)
-    public void simpleFastHttpWithAuthProxy() throws Exception {
-        ProxySettings proxySettings = new ProxySettings("HTTP", "localhost", 3456, "testuser",
"testpass", null);
-        DownloadRetriever downloadRetriever = new DownloadRetriever();
-        downloadRetriever.retrieve(SdkType.FLASH, "17.0", PlatformType.WINDOWS, proxySettings);
-    }
-
-    /**
-     * Does a download using the HttpClient class using a proxy that requires authentication.
-     */
-    @Test(enabled = false)
-    public void simpleSafeHttpWithAuthProxy() throws Exception {
-        ProxySettings proxySettings = new ProxySettings("HTTP", "localhost", 3456, "testuser",
"testpass", null);
-        DownloadRetriever downloadRetriever = new DownloadRetriever();
-        downloadRetriever.retrieve(SdkType.FONTKIT, "1.0", PlatformType.WINDOWS, proxySettings);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/8bc0350d/flex-maven-tools/mavenizer/retrievers/pom.xml
----------------------------------------------------------------------
diff --git a/flex-maven-tools/mavenizer/retrievers/pom.xml b/flex-maven-tools/mavenizer/retrievers/pom.xml
deleted file mode 100644
index a95bf41..0000000
--- a/flex-maven-tools/mavenizer/retrievers/pom.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?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/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <parent>
-        <groupId>org.apache.flex.utilities.converter</groupId>
-        <artifactId>apache-flex-sdk-converter</artifactId>
-        <version>1.0.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>retrievers</artifactId>
-    <version>1.0.0-SNAPSHOT</version>
-    <packaging>pom</packaging>
-
-    <modules>
-        <module>base</module>
-        <module>download</module>
-    </modules>
-
-</project>


Mime
View raw message