Ottomata has submitted this change and it was merged.

Change subject: Remove kraken-eventlogging
......................................................................


Remove kraken-eventlogging

The kraken-eventlogging subproject is no longer in use.

Change-Id: Icbc2edff17992fac7908b1efdc3b43f47c37c25f
---
D kraken-eventlogging/pom.xml
D 
kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/Field.java
D 
kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/Parser.java
D 
kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/package-info.java
D 
kraken-eventlogging/src/test/java/org/wikimedia/analytics/kraken/eventlogging/ParserTest.java
M pom.xml
6 files changed, 0 insertions(+), 322 deletions(-)

Approvals:
  Ottomata: Verified; Looks good to me, approved



diff --git a/kraken-eventlogging/pom.xml b/kraken-eventlogging/pom.xml
deleted file mode 100644
index e7312cc..0000000
--- a/kraken-eventlogging/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<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>
-    
-    <name>Kraken EventLogging</name>
-    
-    <groupId>org.wikimedia.analytics.kraken</groupId>
-    <artifactId>kraken-eventlogging</artifactId>
-    <version>0.0.2-SNAPSHOT</version>
-    <packaging>jar</packaging>
-    
-    <parent>
-        <groupId>org.wikimedia.analytics.kraken</groupId>
-        <artifactId>kraken</artifactId>
-        <version>0.0.2-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
-    </parent>
-    
-    <dependencies>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-core</artifactId>
-            <version>2.1.1</version>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-            <version>2.1.1</version>
-        </dependency>
-    </dependencies>
-    
-    
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <skip.tests>false</skip.tests>
-    </properties>
-    
-</project>
diff --git 
a/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/Field.java
 
b/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/Field.java
deleted file mode 100644
index 8b15c32..0000000
--- 
a/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/Field.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- *Copyright (C) 2012-2013  Wikimedia Foundation
- *
- *This program is free software; you can redistribute it and/or
- *modify it under the terms of the GNU General Public License
- *as published by the Free Software Foundation; either version 2
- *of the License, or (at your option) any later version.
- *
- *This program is distributed in the hope that it will be useful,
- *but WITHOUT ANY WARRANTY; without even the implied warranty of
- *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *GNU General Public License for more details.
- *
- *You should have received a copy of the GNU General Public License
- *along with this program; if not, write to the Free Software
- *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
-
- */
-
-package org.wikimedia.analytics.kraken.eventlogging;
-
-
-import java.util.ArrayList;
-
-public class Field {
-    private enum Type {
-        STRING, INTEGER, BOOLEAN, ARRAYLIST
-    }
-
-    private final Type type;
-    private final Object value;
-
-    private Field(Object value, Type type) {
-        this.value = value;
-        this.type = type;
-    }
-
-    public static Field fromString(String s) {
-        return new Field(s, Type.STRING);
-    }
-
-    public static Field fromInteger(Integer i) {
-        return new Field(i, Type.INTEGER);
-    }
-
-    public static Field fromBoolean(Boolean b) {
-        return new Field(b, Type.BOOLEAN);
-    }
-
-    public static Field fromArrayListString(ArrayList<String> a) {
-        return new Field (a, Type.ARRAYLIST);
-    }
-
-    public Type getType() {
-        return this.type;
-    }
-
-    public String getStringValue() {
-        return (String) value;
-    }
-
-    public Integer getIntegerValue() {
-        return (Integer) value;
-    }
-
-    public Boolean getBooleanValue() {
-        return (Boolean) value;
-    }
-
-    public ArrayList<String> getArrayListString() {
-        //Not yet implemented
-        return new ArrayList<String>();
-    }
-    // equals, hashCode
-}
diff --git 
a/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/Parser.java
 
b/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/Parser.java
deleted file mode 100644
index 81b6cc6..0000000
--- 
a/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/Parser.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/**
- *Copyright (C) 2012-2013  Wikimedia Foundation
- *
- *This program is free software; you can redistribute it and/or
- *modify it under the terms of the GNU General Public License
- *as published by the Free Software Foundation; either version 2
- *of the License, or (at your option) any later version.
- *
- *This program is distributed in the hope that it will be useful,
- *but WITHOUT ANY WARRANTY; without even the implied warranty of
- *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *GNU General Public License for more details.
- *
- *You should have received a copy of the GNU General Public License
- *along with this program; if not, write to the Free Software
- *Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA.
-
- */
-package org.wikimedia.analytics.kraken.eventlogging;
-
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.nio.charset.Charset;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-
-/**
- * The Class ParserTest.This class parses JSON Schema URI's from 
- * https://meta.wikimedia.org/wiki/Schema:*
- *
- * The EventLogging extension stores it's metadata on a Wiki as a JSON schema.
- * This class provides methods to download such a metadata schema and retrieve
- * the properties fields and the associated types and stores this in a HashMap.
- */
-public class Parser {
-
-    /** The map. */
-    private final HashMap<String, String> map = new HashMap<String, String>();
-
-    /**
-     * Instantiates a new parser.
-     */
-    public Parser() {
-    }
-
-    /**
-     * The main method.
-     *
-     * @param args the arguments
-     * @throws JsonParseException the json parse exception
-     * @throws MalformedURLException
-     */
-    public static void main(final String args[]) throws JsonParseException, 
MalformedURLException, IOException {
-        // This is an example
-        Parser parser = new Parser();
-        String jsonSchema = 
parser.loadEventLoggingJsonSchema("GettingStarted", "0");
-        System.out.println(jsonSchema);
-        parser.parseEventLoggingJsonSchem(jsonSchema);
-    }
-
-    /**
-     * Insert field.
-     *
-     * @param key the key
-     * @param entry a JsonNode object
-     */
-    private void insertField(String key, Entry<String, JsonNode> entry) {
-        Iterator<Entry<String, JsonNode>> it = entry.getValue().fields();
-        Entry<String, JsonNode> prop;
-        String type;
-        while (it.hasNext()) {
-            prop = it.next();
-            if (prop.getKey().equals("type")) {
-                type = prop.getValue().asText() ;
-                if (type.equals("string")) {
-                    //Figure out whether it's a simple string or an enum
-                    JsonNode result = entry.getValue().path("enum");
-                    if (!result.isMissingNode()) {
-                        this.map.put(key, "arraylist");
-                    } else {
-                        this.map.put(key, type);
-                    }
-                } else {
-                    this.map.put(key, type);
-                }
-            }
-        }
-    }
-
-    /**
-     *
-     * @param schema
-     * @param revisionId
-     * @return
-     * @throws MalformedURLException
-     */
-    public final URL generateSchemaUrl(final String schema, final String 
revisionId) throws MalformedURLException {
-        URL url = new 
URL("http://meta.wikimedia.org/w/index.php?action=raw&title=Schema:"; + schema 
+"&oldid=" + revisionId);
-        return url;
-    }
-
-    /**
-     * Load event logging json schema.
-     *
-     * @param schemaName the schema name
-     * @param revisionId the Mediawiki revisionid of the schema document.
-     * @return a string containing the retrieved json schema.
-     * @throws IOException Signals that an I/O exception has occurred.
-     */
-    public final String loadEventLoggingJsonSchema(final String schemaName, 
final String revisionId)
-            throws IOException {
-        URL url = generateSchemaUrl(schemaName, revisionId);
-        BufferedReader reader = null;
-        StringBuilder buffer = new StringBuilder();
-        try {
-            Charset cs = Charset.forName("utf-8");
-            reader = new BufferedReader(new 
InputStreamReader(url.openStream(), cs));
-            int cp;
-            while ((cp = reader.read()) != -1) {
-                buffer.append((char) cp);
-            }
-        } finally {
-            if (reader != null)
-                reader.close();
-        }
-        return buffer.toString();
-    }
-
-    /**
-     * Parses the event logging json schem.
-     *
-     * @param jsonSchema the json schema
-     * @throws JsonParseException the json parse exception
-     * @throws IOException Signals that an I/O exception has occurred.
-     */
-    public void parseEventLoggingJsonSchem(final String jsonSchema)
-            throws JsonParseException, IOException {
-        ObjectMapper mapper = new ObjectMapper();
-        JsonFactory jf = mapper.getFactory();
-        JsonParser jp = jf.createJsonParser(jsonSchema);
-        JsonNode rootNode = mapper.readTree(jp);
-        Iterator<Entry<String, JsonNode>> it = rootNode.fields();
-        Entry<String, JsonNode> entry;
-        String key;
-        while (it.hasNext()) {
-            entry = it.next();
-            key = entry.getKey();
-            insertField(key, entry);
-        }
-    }
-}
diff --git 
a/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/package-info.java
 
b/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/package-info.java
deleted file mode 100644
index 00da6c4..0000000
--- 
a/kraken-eventlogging/src/main/java/org/wikimedia/analytics/kraken/eventlogging/package-info.java
+++ /dev/null
@@ -1,5 +0,0 @@
-/**
- * @author diederik
- *
- */
-package org.wikimedia.analytics.kraken.eventlogging;
\ No newline at end of file
diff --git 
a/kraken-eventlogging/src/test/java/org/wikimedia/analytics/kraken/eventlogging/ParserTest.java
 
b/kraken-eventlogging/src/test/java/org/wikimedia/analytics/kraken/eventlogging/ParserTest.java
deleted file mode 100644
index 965a077..0000000
--- 
a/kraken-eventlogging/src/test/java/org/wikimedia/analytics/kraken/eventlogging/ParserTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.wikimedia.analytics.kraken.eventlogging;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.nio.MappedByteBuffer;
-import java.nio.channels.FileChannel;
-import java.nio.charset.Charset;
-import java.util.Enumeration;
-
-public class ParserTest {
-
-    @Before
-    public void setUp() throws Exception {
-    }
-
-    @Test
-    public void test() throws IOException {
-        Parser parser = new Parser();
-        Enumeration<URL> urls;
-        urls = 
getClass().getClassLoader().getResources("funnel/src/test/resources/");
-        FileInputStream stream = null;
-        String jsonSchema;
-        URL url;
-        while (urls.hasMoreElements()) {
-            url = urls.nextElement();
-            System.out.println("Reading file: " + url.toString());
-            stream = new FileInputStream(url.getFile());
-            FileChannel fc = stream.getChannel();
-            MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, 
fc.size());
-                       /* Instead of using default, pass in a decoder. */
-            jsonSchema = Charset.defaultCharset().decode(bb).toString();
-            System.out.println(jsonSchema);
-            parser.parseEventLoggingJsonSchem(jsonSchema);
-        }
-        if (stream != null) {
-            stream.close();
-        }
-    }
-}
diff --git a/pom.xml b/pom.xml
index 45b00dc..85d6487 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,6 @@
     <modules>
         <module>kraken-generic</module>
         <module>kraken-dclass</module>
-        <module>kraken-eventlogging</module>
         <module>kraken-pig</module>
         <module>kraken-funnel</module>
     </modules>

-- 
To view, visit https://gerrit.wikimedia.org/r/87719
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icbc2edff17992fac7908b1efdc3b43f47c37c25f
Gerrit-PatchSet: 2
Gerrit-Project: analytics/kraken
Gerrit-Branch: master
Gerrit-Owner: QChris <christ...@quelltextlich.at>
Gerrit-Reviewer: Ottomata <o...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to