@@ -0,0 +1,2138 @@
+/*%0A *  Copyright (C) 2015 Stichting Akvo (Akvo Foundation)%0A *%0A *  This file is part of Akvo FLOW.%0A *%0A *  Akvo FLOW is free software: you can redistribute it and modify it under the terms of%0A *  the GNU Affero General Public License (AGPL) as published by the Free Software Foundation,%0A *  either version 3 of the License or any later version.%0A *%0A *  Akvo FLOW is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;%0A *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.%0A *  See the GNU Affero General Public License included below for more details.%0A *%0A *  The full license text can also be seen at %3Chttp://www.gnu.org/licenses/agpl.html%3E.%0A */%0A%0Apackage com.gallatinsystems.events;%0A%0Aimport java.io.IOException;%0Aimport java.io.OutputStreamWriter;%0Aimport java.net.HttpURLConnection;%0Aimport java.net.MalformedURLException;%0Aimport java.net.URL;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;%0A%0Apublic class UnifiedLog %7B%0A    public enum EventTopic %7B%0A        DATA%0A    %7D;%0A%0A    private static final Logger log = Logger%0A            .getLogger(UnifiedLog.class.getName());%0A%0A    public static void dispatch(EventTopic topic, String message) %7B%0A        try %7B%0A            URL url = new URL(%22http://flowdev1.akvo.org:3030/event%22);%0A            HttpURLConnection connection = (HttpURLConnection) url.openConnection();%0A            connection.setDoOutput(true);%0A            connection.setRequestMethod(%22POST%22);%0A            connection.setRequestProperty(%22Content-Type%22, %22application/json%22);%0A%0A            OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());%0A            writer.write(message);%0A            writer.close();%0A%0A            if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) %7B%0A                log.log(Level.SEVERE, %22Unified log message failed%22);%0A            %7D%0A        %7D catch (MalformedURLException e) %7B%0A            log.log(Level.SEVERE, %22Unified log message failed with malformed URL exception%22);%0A        %7D catch (IOException e) %7B%0A            log.log(Level.SEVERE, %22Unified log message failed with IO exception%22);%0A        %7D%0A    %7D%0A%7D

Send events to flow services event endpoint