Blob Blame History Raw
From bf282d52f5944838e4d1830efa51be075042c9a2 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lkundrak@v3.sk>
Date: Thu, 11 Jul 2013 18:20:31 +0200
Subject: [PATCH] Drop GA connector

---
 .../main/java/com/gooddata/processor/GdcDI.java    |   1 -
 connector/pom.xml                                  |  15 -
 .../java/com/gooddata/connector/GaConnector.java   | 349 ---------------------
 .../com/gooddata/google/analytics/FeedDumper.java  | 130 --------
 .../com/gooddata/google/analytics/GaQuery.java     |  51 ---
 pom.xml                                            |  15 -
 .../main/java/com/gooddata/web/WebInterface.java   |   7 +-
 7 files changed, 3 insertions(+), 565 deletions(-)
 delete mode 100644 connector/src/main/java/com/gooddata/connector/GaConnector.java
 delete mode 100644 connector/src/main/java/com/gooddata/google/analytics/FeedDumper.java
 delete mode 100644 connector/src/main/java/com/gooddata/google/analytics/GaQuery.java

diff --git a/cli/src/main/java/com/gooddata/processor/GdcDI.java b/cli/src/main/java/com/gooddata/processor/GdcDI.java
index d4f6633..17ddcd7 100644
--- a/cli/src/main/java/com/gooddata/processor/GdcDI.java
+++ b/cli/src/main/java/com/gooddata/processor/GdcDI.java
@@ -1456,7 +1456,6 @@ public class GdcDI implements Executor {
     private Connector[] instantiateConnectors() throws IOException {
         return new Connector[]{
                 CsvConnector.createConnector(),
-                GaConnector.createConnector(),
                 SfdcConnector.createConnector(),
                 JdbcConnector.createConnector(),
                 PtConnector.createConnector(),
diff --git a/connector/pom.xml b/connector/pom.xml
index ec37afb..40db2cc 100644
--- a/connector/pom.xml
+++ b/connector/pom.xml
@@ -56,21 +56,6 @@
         </dependency>
         <!-- 3rd party dependencies -->
         <dependency>
-            <groupId>com.google.gdata</groupId>
-            <artifactId>gdata-java-client</artifactId>
-            <version>1.40.0</version>
-        </dependency>
-        <dependency>
-            <groupId>com.google.gdata</groupId>
-            <artifactId>gdata-java-core</artifactId>
-            <version>1.40.0</version>
-        </dependency>
-        <dependency>
-            <groupId>com.google.gdata</groupId>
-            <artifactId>gdata-java-analytics</artifactId>
-            <version>1.40.0</version>
-        </dependency>
-        <dependency>
             <groupId>net.sf.opencsv</groupId>
             <artifactId>opencsv</artifactId>
         </dependency>
diff --git a/connector/src/main/java/com/gooddata/connector/GaConnector.java b/connector/src/main/java/com/gooddata/connector/GaConnector.java
deleted file mode 100644
index 43c9102..0000000
--- a/connector/src/main/java/com/gooddata/connector/GaConnector.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright (c) 2009, GoodData Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided
- * that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright notice, this list of conditions and
- *        the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- *        and the following disclaimer in the documentation and/or other materials provided with the distribution.
- *     * Neither the name of the GoodData Corporation nor the names of its contributors may be used to endorse
- *        or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.gooddata.connector;
-
-import com.gooddata.exception.InternalErrorException;
-import com.gooddata.exception.InvalidArgumentException;
-import com.gooddata.exception.InvalidCommandException;
-import com.gooddata.exception.ProcessingException;
-import com.gooddata.google.analytics.FeedDumper;
-import com.gooddata.google.analytics.GaQuery;
-import com.gooddata.modeling.model.SourceColumn;
-import com.gooddata.modeling.model.SourceSchema;
-import com.gooddata.processor.CliParams;
-import com.gooddata.processor.Command;
-import com.gooddata.processor.ProcessingContext;
-import com.gooddata.transform.Transformer;
-import com.gooddata.util.CSVWriter;
-import com.gooddata.util.FileUtil;
-import com.google.gdata.client.ClientLoginAccountType;
-import com.google.gdata.client.analytics.AnalyticsService;
-import com.google.gdata.data.analytics.DataFeed;
-import com.google.gdata.util.AuthenticationException;
-import com.google.gdata.util.ServiceException;
-import org.apache.log4j.Logger;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-
-/**
- * GoodData Google Analytics Connector
- *
- * @author zd <zd@gooddata.com>
- * @version 1.0
- */
-public class GaConnector extends AbstractConnector implements Connector {
-
-    public static final String GA_DATE = "ga:date";
-
-    private static Logger l = Logger.getLogger(GaConnector.class);
-
-    private static final String APP_NAME = "gdc-ga-client";
-
-    private static final int GOOGLE_ANALYTICS_CHUNK = 9900;
-    private String googleAnalyticsUsername;
-    private String googleAnalyticsPassword;
-    private String googleAnalyticsToken;
-    private GaQuery googleAnalyticsQuery;
-
-    /**
-     * Creates a new Google Analytics Connector
-     */
-    protected GaConnector() {
-    }
-
-    /**
-     * Creates a new Google Analytics Connector
-     *
-     * @return a new instance of the GA connector
-     */
-    public static GaConnector createConnector() {
-        return new GaConnector();
-    }
-
-    /**
-     * Saves a template of the config file
-     *
-     * @param name           the new config file name
-     * @param configFileName the new config file name
-     * @param gQuery         the Google Analytics query
-     * @throws com.gooddata.exception.InvalidArgumentException
-     *                     if there is a problem with arguments
-     * @throws IOException if there is a problem with writing the config file
-     */
-    public static void saveConfigTemplate(String name, String configFileName, GaQuery gQuery)
-            throws IOException {
-        l.debug("Saving GA config template.");
-        String dims = gQuery.getDimensions();
-        String mtrs = gQuery.getMetrics();
-        SourceSchema s = SourceSchema.createSchema(name);
-        SourceColumn cp = new SourceColumn("id", SourceColumn.LDM_TYPE_CONNECTION_POINT, "id");
-        s.addColumn(cp);
-        cp = new SourceColumn("profileId", SourceColumn.LDM_TYPE_ATTRIBUTE, "profileId");
-        s.addColumn(cp);
-        if (dims != null && dims.length() > 0) {
-            String[] dimensions = dims.split("\\|");
-            for (String dim : dimensions) {
-                // remove the "ga:"
-                if (dim != null && dim.length() > 3) {
-                    String d = dim.substring(3);
-                    if (GA_DATE.equals(dim)) {
-                        SourceColumn sc = new SourceColumn(d, SourceColumn.LDM_TYPE_DATE, d);
-                        sc.setFormat("yyyy-MM-dd");
-                        s.addColumn(sc);
-                    } else {
-                        SourceColumn sc = new SourceColumn(d, SourceColumn.LDM_TYPE_ATTRIBUTE, d);
-                        s.addColumn(sc);
-                    }
-                } else {
-                    l.debug("Invalid dimension name '" + dim + "'");
-                    throw new InvalidArgumentException("Invalid dimension name '" + dim + "'");
-                }
-            }
-        } else {
-            l.debug("Please specify Google Analytics dimensions separated by comma.");
-            throw new InvalidArgumentException("Please specify Google Analytics dimensions separated by comma.");
-        }
-        if (mtrs != null && mtrs.length() > 0) {
-            String[] metrics = mtrs.split("\\|");
-            for (String mtr : metrics) {
-                // remove the "ga:"
-                if (mtr != null && mtr.length() > 3) {
-                    String m = mtr.substring(3);
-                    SourceColumn sc = new SourceColumn(m, SourceColumn.LDM_TYPE_FACT, m);
-                    s.addColumn(sc);
-                } else {
-                    l.debug("Invalid dimension name '" + mtr + "'");
-                    throw new InvalidArgumentException("Invalid metric name '" + mtr + "'");
-                }
-            }
-        } else {
-            l.debug("Please specify Google Analytics metrics separated by comma.");
-            throw new InvalidArgumentException("Please specify Google Analytics metrics separated by comma.");
-        }
-        s.writeConfig(new File(configFileName));
-        l.debug("Saved GA config template.");
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void extract(String file, final boolean transform) throws IOException {
-        try {
-            AnalyticsService as = new AnalyticsService(APP_NAME);
-            if (googleAnalyticsToken != null && googleAnalyticsToken.length() > 0) {
-                as.setAuthSubToken(googleAnalyticsToken);
-            } else if (googleAnalyticsUsername != null && googleAnalyticsUsername.length() > 0 &&
-                    googleAnalyticsPassword != null && googleAnalyticsPassword.length() > 0) {
-                as.setUserCredentials(googleAnalyticsUsername, googleAnalyticsPassword, ClientLoginAccountType.GOOGLE);
-            } else {
-                throw new InvalidCommandException("The UseGoogleAnalytics command requires either GA token or " +
-                        "username and password!");
-            }
-            File dataFile = new File(file);
-            GaQuery gaq = getGoogleAnalyticsQuery();
-            gaq.setMaxResults(GOOGLE_ANALYTICS_CHUNK);
-            int cnt = 1;
-
-            CSVWriter cw = FileUtil.createUtf8CsvWriter(dataFile);
-            Transformer t = Transformer.create(schema);
-
-            String[] header = t.getHeader(transform);
-            cw.writeNext(header);
-
-            for (int startIndex = 1; cnt > 0; startIndex += cnt + 1) {
-                gaq.setStartIndex(startIndex);
-                DataFeed feed = as.getFeed(gaq.getUrl(), DataFeed.class);
-                l.debug("Retrieving GA data from index=" + startIndex);
-                cnt = FeedDumper.dump(cw, feed, gaq, t, transform);
-                l.debug("Retrieved " + cnt + " entries.");
-            }
-            cw.close();
-        } catch (AuthenticationException e) {
-            throw new InternalErrorException(e);
-        } catch (ServiceException e) {
-            throw new InternalErrorException(e);
-        }
-    }
-
-
-    /**
-     * Google Analytics username getter
-     *
-     * @return Google Analytics username
-     */
-    public String getGoogleAnalyticsUsername() {
-        return googleAnalyticsUsername;
-    }
-
-    /**
-     * Google Analytics username setter
-     *
-     * @param googleAnalyticsUsername Google Analytics username
-     */
-    public void setGoogleAnalyticsUsername(String googleAnalyticsUsername) {
-        this.googleAnalyticsUsername = googleAnalyticsUsername;
-    }
-
-    /**
-     * Google Analytics password getter
-     *
-     * @return Google Analytics password
-     */
-    public String getGoogleAnalyticsPassword() {
-        return googleAnalyticsPassword;
-    }
-
-    /**
-     * Google Analytics password setter
-     *
-     * @param googleAnalyticsPassword Google Analytics password
-     */
-    public void setGoogleAnalyticsPassword(String googleAnalyticsPassword) {
-        this.googleAnalyticsPassword = googleAnalyticsPassword;
-    }
-
-    /**
-     * Google Analytics query getter
-     *
-     * @return Google Analytics query
-     */
-    public GaQuery getGoogleAnalyticsQuery() {
-        return googleAnalyticsQuery;
-    }
-
-    /**
-     * Google Analytics query setter
-     *
-     * @param googleAnalyticsQuery Google Analytics query
-     */
-    public void setGoogleAnalyticsQuery(GaQuery googleAnalyticsQuery) {
-        this.googleAnalyticsQuery = googleAnalyticsQuery;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean processCommand(Command c, CliParams cli, ProcessingContext ctx) throws ProcessingException {
-        l.debug("Processing command " + c.getCommand());
-        try {
-            if (c.match("GenerateGoogleAnalyticsConfig")) {
-                generateGAConfig(c, cli, ctx);
-            } else if (c.match("UseGoogleAnalytics")) {
-                loadGA(c, cli, ctx);
-            } else {
-                l.debug("No match passing the command " + c.getCommand() + " further.");
-                return super.processCommand(c, cli, ctx);
-            }
-        } catch (IOException e) {
-            throw new ProcessingException(e);
-        }
-        l.debug("Processed command " + c.getCommand());
-        return true;
-    }
-
-    /**
-     * Loads new GA data command processor
-     *
-     * @param c   command
-     * @param p   command line arguments
-     * @param ctx current processing context
-     * @throws IOException in case of IO issues
-     */
-    private void loadGA(Command c, CliParams p, ProcessingContext ctx) throws IOException {
-        GaQuery gq;
-        try {
-            gq = new GaQuery();
-        } catch (MalformedURLException e) {
-            throw new IllegalArgumentException(e.getMessage());
-        }
-        String configFile = c.getParamMandatory("configFile");
-        String usr = c.getParam("username");
-        String psw = c.getParam("password");
-        String token = c.getParam("token");
-        String id = c.getParamMandatory("profileId");
-        File conf = FileUtil.getFile(configFile);
-        initSchema(conf.getAbsolutePath());
-        gq.setIds(id);
-        if (token != null && token.length() > 0) {
-            setGoogleAnalyticsToken(token);
-        } else if (usr != null && usr.length() > 0 &&
-                psw != null && psw.length() > 0) {
-            setGoogleAnalyticsUsername(usr);
-            setGoogleAnalyticsPassword(psw);
-        } else {
-            throw new InvalidCommandException("The UseGoogleAnalytics command requires either GA token or " +
-                    "username and password!");
-        }
-        setGoogleAnalyticsQuery(gq);
-        gq.setDimensions(c.getParamMandatory("dimensions").replace("|", ","));
-        gq.setMetrics(c.getParamMandatory("metrics").replace("|", ","));
-        gq.setStartDate(c.getParamMandatory("startDate"));
-        gq.setEndDate(c.getParamMandatory("endDate"));
-        if (c.checkParam("filters"))
-            gq.setFilters(c.getParam("filters"));
-        c.paramsProcessed();
-
-        // sets the current connector
-        ctx.setConnector(this);
-        setProjectId(ctx);
-        l.info("Google Analytics Connector successfully loaded (id: " + id + ").");
-    }
-
-    /**
-     * Generate GA config command processor
-     *
-     * @param c   command
-     * @param p   command line arguments
-     * @param ctx current processing context
-     * @throws IOException in case of IO issues
-     */
-    private void generateGAConfig(Command c, CliParams p, ProcessingContext ctx) throws IOException {
-        String configFile = c.getParamMandatory("configFile");
-        String name = c.getParamMandatory("name");
-        String dimensions = c.getParamMandatory("dimensions");
-        String metrics = c.getParamMandatory("metrics");
-        c.paramsProcessed();
-
-        GaQuery gq;
-        try {
-            gq = new GaQuery();
-        } catch (MalformedURLException e) {
-            throw new IllegalArgumentException(e.getMessage());
-        }
-        gq.setDimensions(dimensions);
-        gq.setMetrics(metrics);
-        GaConnector.saveConfigTemplate(name, configFile, gq);
-        l.info("Google Analytics Connector configuration successfully generated. See config file: " + configFile);
-    }
-
-    public String getGoogleAnalyticsToken() {
-        return googleAnalyticsToken;
-    }
-
-    public void setGoogleAnalyticsToken(String googleAnalyticsToken) {
-        this.googleAnalyticsToken = googleAnalyticsToken;
-    }
-}
diff --git a/connector/src/main/java/com/gooddata/google/analytics/FeedDumper.java b/connector/src/main/java/com/gooddata/google/analytics/FeedDumper.java
deleted file mode 100644
index 2cc1618..0000000
--- a/connector/src/main/java/com/gooddata/google/analytics/FeedDumper.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2009, GoodData Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided
- * that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright notice, this list of conditions and
- *        the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- *        and the following disclaimer in the documentation and/or other materials provided with the distribution.
- *     * Neither the name of the GoodData Corporation nor the names of its contributors may be used to endorse
- *        or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.gooddata.google.analytics;
-
-import com.gooddata.connector.AbstractConnector;
-import com.gooddata.connector.GaConnector;
-import com.gooddata.exception.InvalidParameterException;
-import com.gooddata.transform.Transformer;
-import com.gooddata.util.CSVWriter;
-import com.gooddata.util.DateUtil;
-import com.google.gdata.data.analytics.DataEntry;
-import com.google.gdata.data.analytics.DataFeed;
-import com.google.gdata.data.analytics.Dimension;
-import com.google.gdata.data.analytics.Metric;
-import org.apache.log4j.Logger;
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormatter;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Google feed dumper dumps the Google result data to CSV
- *
- * @author ZD <zd@gooddata.com>
- * @version 1.0
- */
-public class FeedDumper {
-
-    private static final String UNKNOWN_DATE = "(other)";
-
-    private static final String IN_FMT = "yyyyMMdd";
-    private static final String OUT_FMT = "yyyy-MM-dd";
-
-    private static Logger l = Logger.getLogger(FeedDumper.class);
-
-    /**
-     * Dupmps the gdata feed to CSV
-     *
-     * @param cw        CSVWriter
-     * @param feed      Google feed
-     * @param gaq       Google Analytics Query
-     * @param t         Transformer
-     * @param transform perform transformations?
-     * @throws IOException in case of an IO problem
-     */
-    public static int dump(CSVWriter cw, DataFeed feed, GaQuery gaq, Transformer t, boolean transform) throws IOException {
-        l.debug("Dumping GA feed.");
-        String profileId = gaq.getIds();
-        if (profileId == null || profileId.length() <= 0)
-            throw new InvalidParameterException("Empty Google Analytics profile ID in query.");
-        List<DataEntry> entries = feed.getEntries();
-        List<Dimension> dimensions = null;
-        List<String> dimensionNames = new ArrayList<String>();
-        List<Metric> metrics = null;
-
-        if (!entries.isEmpty()) {
-            DataEntry singleEntry = entries.get(0);
-            dimensions = singleEntry.getDimensions();
-            metrics = singleEntry.getMetrics();
-        } else
-            return 0;
-
-        final List<String> headers = new ArrayList<String>();
-        for (Dimension dimension : dimensions) {
-            headers.add(dimension.getName());
-            dimensionNames.add(dimension.getName());
-        }
-        for (Metric metric : metrics) {
-            headers.add(metric.getName());
-        }
-
-        final DateTimeFormatter inFmt = DateUtil.getDateFormatter(IN_FMT, false);
-        final DateTimeFormatter outFmt = DateUtil.getDateFormatter(OUT_FMT, false);
-        for (DataEntry entry : entries) {
-            final List<String> row = new ArrayList<String>();
-            for (String dataName : headers) {
-                final String valueIn = entry.stringValueOf(dataName);
-                String valueOut;
-                if (GaConnector.GA_DATE.equalsIgnoreCase(dataName)) {
-                    if (valueIn == null || valueIn.length() != 8 || UNKNOWN_DATE.equals(valueIn)) {
-                        valueOut = "";
-                        l.debug("Invalid date value '" + valueIn + "'");
-                    } else {
-                        try {
-                            DateTime dt = inFmt.parseDateTime(valueIn);
-                            valueOut = outFmt.print(dt);
-                        } catch (IllegalArgumentException e) {
-                            valueOut = "";
-                            l.debug("Invalid date value '" + valueIn + "'");
-                        }
-                    }
-                } else {
-                    valueOut = valueIn;
-                }
-                row.add(valueOut);
-            }
-            row.add(0, profileId);
-            String[] r = row.toArray(new String[]{});
-            if (transform)
-                r = t.transformRow(r, AbstractConnector.DATE_LENGTH_UNRESTRICTED);
-            cw.writeNext(r);
-        }
-        l.debug("Dumped " + entries.size() + " rows from GA feed.");
-        return entries.size();
-    }
-
-}
\ No newline at end of file
diff --git a/connector/src/main/java/com/gooddata/google/analytics/GaQuery.java b/connector/src/main/java/com/gooddata/google/analytics/GaQuery.java
deleted file mode 100644
index ac735ec..0000000
--- a/connector/src/main/java/com/gooddata/google/analytics/GaQuery.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2009, GoodData Corporation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are permitted provided
- * that the following conditions are met:
- *
- *     * Redistributions of source code must retain the above copyright notice, this list of conditions and
- *        the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
- *        and the following disclaimer in the documentation and/or other materials provided with the distribution.
- *     * Neither the name of the GoodData Corporation nor the names of its contributors may be used to endorse
- *        or promote products derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package com.gooddata.google.analytics;
-
-import com.google.gdata.client.analytics.DataQuery;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * Google analytics query
- *
- * @author zd <zd@gooddata.com>
- * @version 1.0
- */
-public class GaQuery extends DataQuery {
-
-    // GA API URL
-    private static final String DATA_QUERY_URL = "https://www.google.com/analytics/feeds/data";
-
-    /**
-     * Constructor
-     *
-     * @throws MalformedURLException internal error
-     */
-    public GaQuery() throws MalformedURLException {
-        super(new URL(DATA_QUERY_URL));
-    }
-
-}
diff --git a/pom.xml b/pom.xml
index f377184..605934c 100755
--- a/pom.xml
+++ b/pom.xml
@@ -218,21 +218,6 @@
                 </exclusions>
             </dependency>
             <dependency>
-                <groupId>com.google.gdata</groupId>
-                <artifactId>gdata-java-client</artifactId>
-                <version>1.40.0</version>
-            </dependency>
-            <dependency>
-                <groupId>com.google.gdata</groupId>
-                <artifactId>gdata-java-core</artifactId>
-                <version>1.40.0</version>
-            </dependency>
-            <dependency>
-                <groupId>com.google.gdata</groupId>
-                <artifactId>gdata-java-analytics</artifactId>
-                <version>1.40.0</version>
-            </dependency>
-            <dependency>
                 <groupId>net.sf.opencsv</groupId>
                 <artifactId>opencsv</artifactId>
                 <version>2.1</version>
diff --git a/web/src/main/java/com/gooddata/web/WebInterface.java b/web/src/main/java/com/gooddata/web/WebInterface.java
index e378293..467efa8 100644
--- a/web/src/main/java/com/gooddata/web/WebInterface.java
+++ b/web/src/main/java/com/gooddata/web/WebInterface.java
@@ -25,10 +25,9 @@ package com.gooddata.web;
 
 import com.gooddata.Constants;
 import com.gooddata.util.FileUtil;
-import com.google.gdata.util.common.util.Base64;
-import com.google.gdata.util.common.util.Base64DecoderException;
 import net.sf.json.JSONObject;
 import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.commons.codec.binary.Base64;
 import org.joda.time.DateTime;
 import org.joda.time.format.DateTimeFormat;
 import org.joda.time.format.DateTimeFormatter;
@@ -242,12 +241,12 @@ public class WebInterface extends HttpServlet {
         if (base64 != null) {
             String content = base64.split("\\.")[1];
             try {
-                String decodedContent = new String(Base64.decodeWebSafe(content));
+                String decodedContent = new String(new Base64(true).decodeBase64(content));
                 JSONObject json = JSONObject.fromObject(decodedContent);
                 if (json.containsKey("oauth_token"))
                     token = json.getString("oauth_token");
                 debug("Extracting token: token=" + token);
-            } catch (Base64DecoderException e) {
+            } catch (IllegalArgumentException e) {
                 throw new IOException(e.getMessage());
             }
         }
-- 
1.8.3.1