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 an option to accept the Adobe license agreement ba providing a System Property.
Date Sat, 06 Jun 2015 16:20:03 GMT
Repository: flex-utilities
Updated Branches:
  refs/heads/develop 9d7c7e98c -> 34afaa7b1


Implemented an option to accept the Adobe license agreement ba providing a System Property.


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

Branch: refs/heads/develop
Commit: 34afaa7b1446ebe31642396938a7ccdba9fbe212
Parents: 9d7c7e9
Author: Christofer Dutz <christofer.dutz@codecentric.de>
Authored: Sat Jun 6 18:19:54 2015 +0200
Committer: Christofer Dutz <christofer.dutz@codecentric.de>
Committed: Sat Jun 6 18:19:54 2015 +0200

----------------------------------------------------------------------
 .../retrievers/download/DownloadRetriever.java  | 21 ++++++++++++
 .../retrievers/download/SystemIdHelper.java     | 35 ++++++++++++++++++++
 .../src/main/resources/message.properties       |  5 ++-
 3 files changed, 60 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/34afaa7b/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 45c9570..a6b0a1a 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
@@ -45,6 +45,7 @@ import java.io.*;
 import java.net.*;
 import java.nio.channels.Channels;
 import java.nio.channels.ReadableByteChannel;
+import java.text.MessageFormat;
 import java.util.*;
 
 /**
@@ -353,6 +354,22 @@ public class DownloadRetriever extends BaseRetriever {
             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");
@@ -366,7 +383,11 @@ public class DownloadRetriever extends BaseRetriever {
         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)) {

http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/34afaa7b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/SystemIdHelper.java
----------------------------------------------------------------------
diff --git a/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/SystemIdHelper.java
b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/SystemIdHelper.java
new file mode 100644
index 0000000..76d239e
--- /dev/null
+++ b/mavenizer/retrievers/download/src/main/java/org/apache/flex/utilities/converter/retrievers/download/SystemIdHelper.java
@@ -0,0 +1,35 @@
+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) {
+                    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/34afaa7b/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 9552436..d0b04cb 100644
--- a/mavenizer/retrievers/download/src/main/resources/message.properties
+++ b/mavenizer/retrievers/download/src/main/resources/message.properties
@@ -16,7 +16,10 @@
 ##  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
+DO_YOU_ACCEPT_QUESTION=Do you accept (Yes/No) ?
\ No newline at end of file


Mime
View raw message