repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/listeners/CuesManagerListener.java
// Path: src/main/java/net/eliosoft/elios/server/events/CueAddedEvent.java // public class CueAddedEvent { // private final String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the new cue in the cuesList // */ // public CueAddedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the new cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueRemovedEvent.java // public class CueRemovedEvent { // private String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the removed cue in the cuesList // */ // public CueRemovedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the removed cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // }
import net.eliosoft.elios.server.events.CueAddedEvent; import net.eliosoft.elios.server.events.CueRemovedEvent;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.server.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the Cues manager. * * @author Jeremie GASTON-RAOUL */ public interface CuesManagerListener { /** * This method is called when a cue has been added to the cuesList. * * @param event * the event corresponding to the add of a cue */ void cueAdded(CueAddedEvent event); /** * This method is called when a cue has been removed from the list. * * @param event * the event corresponding to the remove of a cue */
// Path: src/main/java/net/eliosoft/elios/server/events/CueAddedEvent.java // public class CueAddedEvent { // private final String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the new cue in the cuesList // */ // public CueAddedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the new cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueRemovedEvent.java // public class CueRemovedEvent { // private String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the removed cue in the cuesList // */ // public CueRemovedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the removed cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // Path: src/main/java/net/eliosoft/elios/server/listeners/CuesManagerListener.java import net.eliosoft.elios.server.events.CueAddedEvent; import net.eliosoft.elios.server.events.CueRemovedEvent; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.server.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the Cues manager. * * @author Jeremie GASTON-RAOUL */ public interface CuesManagerListener { /** * This method is called when a cue has been added to the cuesList. * * @param event * the event corresponding to the add of a cue */ void cueAdded(CueAddedEvent event); /** * This method is called when a cue has been removed from the list. * * @param event * the event corresponding to the remove of a cue */
void cueRemoved(CueRemovedEvent event);
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/CuesManager.java
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueAddedEvent.java // public class CueAddedEvent { // private final String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the new cue in the cuesList // */ // public CueAddedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the new cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueRemovedEvent.java // public class CueRemovedEvent { // private String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the removed cue in the cuesList // */ // public CueRemovedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the removed cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/CuesManagerListener.java // public interface CuesManagerListener { // /** // * This method is called when a cue has been added to the cuesList. // * // * @param event // * the event corresponding to the add of a cue // */ // void cueAdded(CueAddedEvent event); // // /** // * This method is called when a cue has been removed from the list. // * // * @param event // * the event corresponding to the remove of a cue // */ // void cueRemoved(CueRemovedEvent event); // }
import java.util.logging.Logger; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.CueAddedEvent; import net.eliosoft.elios.server.events.CueRemovedEvent; import net.eliosoft.elios.server.listeners.CuesManagerListener; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.server; /** * A manager for the cues. * * @author Jeremie GASTON-RAOUL */ public class CuesManager { private final Logger logger = LoggersManager.getInstance().getLogger( CuesManager.class.getCanonicalName()); private Map<String, Cue> cuesMap = new HashMap<String, Cue>(); private static CuesManager instance;
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueAddedEvent.java // public class CueAddedEvent { // private final String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the new cue in the cuesList // */ // public CueAddedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the new cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueRemovedEvent.java // public class CueRemovedEvent { // private String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the removed cue in the cuesList // */ // public CueRemovedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the removed cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/CuesManagerListener.java // public interface CuesManagerListener { // /** // * This method is called when a cue has been added to the cuesList. // * // * @param event // * the event corresponding to the add of a cue // */ // void cueAdded(CueAddedEvent event); // // /** // * This method is called when a cue has been removed from the list. // * // * @param event // * the event corresponding to the remove of a cue // */ // void cueRemoved(CueRemovedEvent event); // } // Path: src/main/java/net/eliosoft/elios/server/CuesManager.java import java.util.logging.Logger; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.CueAddedEvent; import net.eliosoft.elios.server.events.CueRemovedEvent; import net.eliosoft.elios.server.listeners.CuesManagerListener; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.server; /** * A manager for the cues. * * @author Jeremie GASTON-RAOUL */ public class CuesManager { private final Logger logger = LoggersManager.getInstance().getLogger( CuesManager.class.getCanonicalName()); private Map<String, Cue> cuesMap = new HashMap<String, Cue>(); private static CuesManager instance;
private List<CuesManagerListener> cuesManagerChangedListeners = new ArrayList<CuesManagerListener>();
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/CuesManager.java
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueAddedEvent.java // public class CueAddedEvent { // private final String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the new cue in the cuesList // */ // public CueAddedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the new cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueRemovedEvent.java // public class CueRemovedEvent { // private String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the removed cue in the cuesList // */ // public CueRemovedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the removed cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/CuesManagerListener.java // public interface CuesManagerListener { // /** // * This method is called when a cue has been added to the cuesList. // * // * @param event // * the event corresponding to the add of a cue // */ // void cueAdded(CueAddedEvent event); // // /** // * This method is called when a cue has been removed from the list. // * // * @param event // * the event corresponding to the remove of a cue // */ // void cueRemoved(CueRemovedEvent event); // }
import java.util.logging.Logger; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.CueAddedEvent; import net.eliosoft.elios.server.events.CueRemovedEvent; import net.eliosoft.elios.server.listeners.CuesManagerListener; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map;
do { cueName = "Cue#" + decimalFormat.format(cueNumber); cueNumber++; } while (cuesMap.containsKey(cueName)); return cueName; } /** * Adds an element to the list of listener of the cues manager. * * @param listener * the listener to add */ public void addCuesManagerChangedListener(final CuesManagerListener listener) { this.cuesManagerChangedListeners.add(listener); } /** * Removes an element to the list of listener of the cues manager. * * @param listener * the listener to remove */ public void removeCuesManagerChangedListener( final CuesManagerListener listener) { this.cuesManagerChangedListeners.remove(listener); } private void fireCueAdded(final String name) { for (CuesManagerListener listener : this.cuesManagerChangedListeners) {
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueAddedEvent.java // public class CueAddedEvent { // private final String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the new cue in the cuesList // */ // public CueAddedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the new cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueRemovedEvent.java // public class CueRemovedEvent { // private String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the removed cue in the cuesList // */ // public CueRemovedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the removed cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/CuesManagerListener.java // public interface CuesManagerListener { // /** // * This method is called when a cue has been added to the cuesList. // * // * @param event // * the event corresponding to the add of a cue // */ // void cueAdded(CueAddedEvent event); // // /** // * This method is called when a cue has been removed from the list. // * // * @param event // * the event corresponding to the remove of a cue // */ // void cueRemoved(CueRemovedEvent event); // } // Path: src/main/java/net/eliosoft/elios/server/CuesManager.java import java.util.logging.Logger; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.CueAddedEvent; import net.eliosoft.elios.server.events.CueRemovedEvent; import net.eliosoft.elios.server.listeners.CuesManagerListener; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; do { cueName = "Cue#" + decimalFormat.format(cueNumber); cueNumber++; } while (cuesMap.containsKey(cueName)); return cueName; } /** * Adds an element to the list of listener of the cues manager. * * @param listener * the listener to add */ public void addCuesManagerChangedListener(final CuesManagerListener listener) { this.cuesManagerChangedListeners.add(listener); } /** * Removes an element to the list of listener of the cues manager. * * @param listener * the listener to remove */ public void removeCuesManagerChangedListener( final CuesManagerListener listener) { this.cuesManagerChangedListeners.remove(listener); } private void fireCueAdded(final String name) { for (CuesManagerListener listener : this.cuesManagerChangedListeners) {
CueAddedEvent e = new CueAddedEvent(name);
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/CuesManager.java
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueAddedEvent.java // public class CueAddedEvent { // private final String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the new cue in the cuesList // */ // public CueAddedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the new cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueRemovedEvent.java // public class CueRemovedEvent { // private String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the removed cue in the cuesList // */ // public CueRemovedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the removed cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/CuesManagerListener.java // public interface CuesManagerListener { // /** // * This method is called when a cue has been added to the cuesList. // * // * @param event // * the event corresponding to the add of a cue // */ // void cueAdded(CueAddedEvent event); // // /** // * This method is called when a cue has been removed from the list. // * // * @param event // * the event corresponding to the remove of a cue // */ // void cueRemoved(CueRemovedEvent event); // }
import java.util.logging.Logger; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.CueAddedEvent; import net.eliosoft.elios.server.events.CueRemovedEvent; import net.eliosoft.elios.server.listeners.CuesManagerListener; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map;
/** * Adds an element to the list of listener of the cues manager. * * @param listener * the listener to add */ public void addCuesManagerChangedListener(final CuesManagerListener listener) { this.cuesManagerChangedListeners.add(listener); } /** * Removes an element to the list of listener of the cues manager. * * @param listener * the listener to remove */ public void removeCuesManagerChangedListener( final CuesManagerListener listener) { this.cuesManagerChangedListeners.remove(listener); } private void fireCueAdded(final String name) { for (CuesManagerListener listener : this.cuesManagerChangedListeners) { CueAddedEvent e = new CueAddedEvent(name); listener.cueAdded(e); } } private void fireCueRemoved(final String name) { for (CuesManagerListener listener : this.cuesManagerChangedListeners) {
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueAddedEvent.java // public class CueAddedEvent { // private final String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the new cue in the cuesList // */ // public CueAddedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the new cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/events/CueRemovedEvent.java // public class CueRemovedEvent { // private String cueName; // // /** // * Constructor method to instantiate a new event. // * // * @param cueName // * the name of the removed cue in the cuesList // */ // public CueRemovedEvent(final String cueName) { // this.cueName = cueName; // } // // /** // * Returns the name of the removed cue. // * // * @return the cue name // */ // public String getCueName() { // return cueName; // } // // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/CuesManagerListener.java // public interface CuesManagerListener { // /** // * This method is called when a cue has been added to the cuesList. // * // * @param event // * the event corresponding to the add of a cue // */ // void cueAdded(CueAddedEvent event); // // /** // * This method is called when a cue has been removed from the list. // * // * @param event // * the event corresponding to the remove of a cue // */ // void cueRemoved(CueRemovedEvent event); // } // Path: src/main/java/net/eliosoft/elios/server/CuesManager.java import java.util.logging.Logger; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.CueAddedEvent; import net.eliosoft.elios.server.events.CueRemovedEvent; import net.eliosoft.elios.server.listeners.CuesManagerListener; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; /** * Adds an element to the list of listener of the cues manager. * * @param listener * the listener to add */ public void addCuesManagerChangedListener(final CuesManagerListener listener) { this.cuesManagerChangedListeners.add(listener); } /** * Removes an element to the list of listener of the cues manager. * * @param listener * the listener to remove */ public void removeCuesManagerChangedListener( final CuesManagerListener listener) { this.cuesManagerChangedListeners.remove(listener); } private void fireCueAdded(final String name) { for (CuesManagerListener listener : this.cuesManagerChangedListeners) { CueAddedEvent e = new CueAddedEvent(name); listener.cueAdded(e); } } private void fireCueRemoved(final String name) { for (CuesManagerListener listener : this.cuesManagerChangedListeners) {
CueRemovedEvent e = new CueRemovedEvent(name);
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java
// Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // }
import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.server.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the ArtNet server manager. * * @author Jeremie GASTON-RAOUL */ public interface ArtNetServerManagerListener { /** * This method is called when the value of the subnet has changed. * * @param event * the event corresponding to the change of the subnet */ void subnetValueChanged(SubnetValueChangedEvent event); /** * This method is called when the value of the universe has changed. * * @param event * the event corresponding to the change of the universe */
// Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // } // Path: src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.server.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the ArtNet server manager. * * @author Jeremie GASTON-RAOUL */ public interface ArtNetServerManagerListener { /** * This method is called when the value of the subnet has changed. * * @param event * the event corresponding to the change of the subnet */ void subnetValueChanged(SubnetValueChangedEvent event); /** * This method is called when the value of the universe has changed. * * @param event * the event corresponding to the change of the universe */
void universeValueChanged(UniverseValueChangedEvent event);
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java
// Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // }
import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.server.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the ArtNet server manager. * * @author Jeremie GASTON-RAOUL */ public interface ArtNetServerManagerListener { /** * This method is called when the value of the subnet has changed. * * @param event * the event corresponding to the change of the subnet */ void subnetValueChanged(SubnetValueChangedEvent event); /** * This method is called when the value of the universe has changed. * * @param event * the event corresponding to the change of the universe */ void universeValueChanged(UniverseValueChangedEvent event); /** * This method is called when the value of the additive mode has changed. * * @param event * the event corresponding to the change of the additive mode */
// Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // } // Path: src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.server.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the ArtNet server manager. * * @author Jeremie GASTON-RAOUL */ public interface ArtNetServerManagerListener { /** * This method is called when the value of the subnet has changed. * * @param event * the event corresponding to the change of the subnet */ void subnetValueChanged(SubnetValueChangedEvent event); /** * This method is called when the value of the universe has changed. * * @param event * the event corresponding to the change of the universe */ void universeValueChanged(UniverseValueChangedEvent event); /** * This method is called when the value of the additive mode has changed. * * @param event * the event corresponding to the change of the additive mode */
void additiveModeValueChanged(AdditiveModeValueChangedEvent event);
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/ArtNetServerManager.java
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java // public interface ArtNetServerManagerListener { // /** // * This method is called when the value of the subnet has changed. // * // * @param event // * the event corresponding to the change of the subnet // */ // void subnetValueChanged(SubnetValueChangedEvent event); // // /** // * This method is called when the value of the universe has changed. // * // * @param event // * the event corresponding to the change of the universe // */ // void universeValueChanged(UniverseValueChangedEvent event); // // /** // * This method is called when the value of the additive mode has changed. // * // * @param event // * the event corresponding to the change of the additive mode // */ // void additiveModeValueChanged(AdditiveModeValueChangedEvent event); // }
import java.net.SocketException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent; import net.eliosoft.elios.server.listeners.ArtNetServerManagerListener; import artnet4j.ArtNetException; import artnet4j.ArtNetServer; import artnet4j.events.ArtNetServerListener; import artnet4j.packets.ArtDmxPacket; import artnet4j.packets.ArtNetPacket;
* @return the status of additive mode */ public boolean isAdditiveModeEnabled() { return this.additiveModeEnabled; } /** * Adds an element to the list of listener of the artnet server manager. * * @param listener * the listener to add */ public void addArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.add(listener); } /** * Removes an element to the list of listener of the artnet server manager. * * @param listener * the listener to remove */ public void removeArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.remove(listener); } private void fireSubnetValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) {
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java // public interface ArtNetServerManagerListener { // /** // * This method is called when the value of the subnet has changed. // * // * @param event // * the event corresponding to the change of the subnet // */ // void subnetValueChanged(SubnetValueChangedEvent event); // // /** // * This method is called when the value of the universe has changed. // * // * @param event // * the event corresponding to the change of the universe // */ // void universeValueChanged(UniverseValueChangedEvent event); // // /** // * This method is called when the value of the additive mode has changed. // * // * @param event // * the event corresponding to the change of the additive mode // */ // void additiveModeValueChanged(AdditiveModeValueChangedEvent event); // } // Path: src/main/java/net/eliosoft/elios/server/ArtNetServerManager.java import java.net.SocketException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent; import net.eliosoft.elios.server.listeners.ArtNetServerManagerListener; import artnet4j.ArtNetException; import artnet4j.ArtNetServer; import artnet4j.events.ArtNetServerListener; import artnet4j.packets.ArtDmxPacket; import artnet4j.packets.ArtNetPacket; * @return the status of additive mode */ public boolean isAdditiveModeEnabled() { return this.additiveModeEnabled; } /** * Adds an element to the list of listener of the artnet server manager. * * @param listener * the listener to add */ public void addArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.add(listener); } /** * Removes an element to the list of listener of the artnet server manager. * * @param listener * the listener to remove */ public void removeArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.remove(listener); } private void fireSubnetValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) {
SubnetValueChangedEvent e = new SubnetValueChangedEvent(
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/ArtNetServerManager.java
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java // public interface ArtNetServerManagerListener { // /** // * This method is called when the value of the subnet has changed. // * // * @param event // * the event corresponding to the change of the subnet // */ // void subnetValueChanged(SubnetValueChangedEvent event); // // /** // * This method is called when the value of the universe has changed. // * // * @param event // * the event corresponding to the change of the universe // */ // void universeValueChanged(UniverseValueChangedEvent event); // // /** // * This method is called when the value of the additive mode has changed. // * // * @param event // * the event corresponding to the change of the additive mode // */ // void additiveModeValueChanged(AdditiveModeValueChangedEvent event); // }
import java.net.SocketException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent; import net.eliosoft.elios.server.listeners.ArtNetServerManagerListener; import artnet4j.ArtNetException; import artnet4j.ArtNetServer; import artnet4j.events.ArtNetServerListener; import artnet4j.packets.ArtDmxPacket; import artnet4j.packets.ArtNetPacket;
* * @param listener * the listener to add */ public void addArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.add(listener); } /** * Removes an element to the list of listener of the artnet server manager. * * @param listener * the listener to remove */ public void removeArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.remove(listener); } private void fireSubnetValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) { SubnetValueChangedEvent e = new SubnetValueChangedEvent( this.serverSubnet); listener.subnetValueChanged(e); } } private void fireUniverseValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) {
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java // public interface ArtNetServerManagerListener { // /** // * This method is called when the value of the subnet has changed. // * // * @param event // * the event corresponding to the change of the subnet // */ // void subnetValueChanged(SubnetValueChangedEvent event); // // /** // * This method is called when the value of the universe has changed. // * // * @param event // * the event corresponding to the change of the universe // */ // void universeValueChanged(UniverseValueChangedEvent event); // // /** // * This method is called when the value of the additive mode has changed. // * // * @param event // * the event corresponding to the change of the additive mode // */ // void additiveModeValueChanged(AdditiveModeValueChangedEvent event); // } // Path: src/main/java/net/eliosoft/elios/server/ArtNetServerManager.java import java.net.SocketException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent; import net.eliosoft.elios.server.listeners.ArtNetServerManagerListener; import artnet4j.ArtNetException; import artnet4j.ArtNetServer; import artnet4j.events.ArtNetServerListener; import artnet4j.packets.ArtDmxPacket; import artnet4j.packets.ArtNetPacket; * * @param listener * the listener to add */ public void addArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.add(listener); } /** * Removes an element to the list of listener of the artnet server manager. * * @param listener * the listener to remove */ public void removeArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.remove(listener); } private void fireSubnetValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) { SubnetValueChangedEvent e = new SubnetValueChangedEvent( this.serverSubnet); listener.subnetValueChanged(e); } } private void fireUniverseValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) {
UniverseValueChangedEvent e = new UniverseValueChangedEvent(
Eliosoft/elios
src/main/java/net/eliosoft/elios/server/ArtNetServerManager.java
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java // public interface ArtNetServerManagerListener { // /** // * This method is called when the value of the subnet has changed. // * // * @param event // * the event corresponding to the change of the subnet // */ // void subnetValueChanged(SubnetValueChangedEvent event); // // /** // * This method is called when the value of the universe has changed. // * // * @param event // * the event corresponding to the change of the universe // */ // void universeValueChanged(UniverseValueChangedEvent event); // // /** // * This method is called when the value of the additive mode has changed. // * // * @param event // * the event corresponding to the change of the additive mode // */ // void additiveModeValueChanged(AdditiveModeValueChangedEvent event); // }
import java.net.SocketException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent; import net.eliosoft.elios.server.listeners.ArtNetServerManagerListener; import artnet4j.ArtNetException; import artnet4j.ArtNetServer; import artnet4j.events.ArtNetServerListener; import artnet4j.packets.ArtDmxPacket; import artnet4j.packets.ArtNetPacket;
/** * Removes an element to the list of listener of the artnet server manager. * * @param listener * the listener to remove */ public void removeArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.remove(listener); } private void fireSubnetValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) { SubnetValueChangedEvent e = new SubnetValueChangedEvent( this.serverSubnet); listener.subnetValueChanged(e); } } private void fireUniverseValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) { UniverseValueChangedEvent e = new UniverseValueChangedEvent( this.serverUniverse); listener.universeValueChanged(e); } } private void fireAdditiveModeValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) {
// Path: src/main/java/net/eliosoft/elios/main/LoggersManager.java // public class LoggersManager { // private static LoggersManager instance; // // private HashMap<String, Logger> loggersMap = new HashMap<String, Logger>(); // // private LoggersManager() { // } // // /** // * get the singleton instance of the LoggersManager. // * // * @return the instance // */ // public static LoggersManager getInstance() { // if (LoggersManager.instance == null) { // LoggersManager.instance = new LoggersManager(); // } // return LoggersManager.instance; // } // // /** // * gets the logger with the given name. // * // * @param loggerName // * the name of the logger to get // * @return the logger with the corresponding name // */ // public Logger getLogger(final String loggerName) { // if (!loggersMap.containsKey(loggerName)) { // this.loggersMap.put(loggerName, Logger.getLogger(loggerName)); // } // return this.loggersMap.get(loggerName); // } // // /** // * get all the loggers of the application. // * // * @return a list containing all the loggers // */ // public List<Logger> getLoggersList() { // return new ArrayList<Logger>(this.loggersMap.values()); // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/SubnetValueChangedEvent.java // public class SubnetValueChangedEvent { // private int subnet; // // /** // * Constructor method to instantiate a new event. // * // * @param subnet // * the new subnet value // */ // public SubnetValueChangedEvent(final int subnet) { // this.subnet = subnet; // } // // /** // * Returns the subnet value of the event. // * // * @return the new subnet value // */ // public int getSubnet() { // return subnet; // } // } // // Path: src/main/java/net/eliosoft/elios/server/events/UniverseValueChangedEvent.java // public class UniverseValueChangedEvent { // private int universe; // // /** // * Constructor method to instantiate a new event. // * // * @param universe // * the new universe value // */ // public UniverseValueChangedEvent(final int universe) { // this.universe = universe; // } // // /** // * Returns the universe value of the event. // * // * @return the new universe value // */ // public int getUniverse() { // return universe; // } // } // // Path: src/main/java/net/eliosoft/elios/server/listeners/ArtNetServerManagerListener.java // public interface ArtNetServerManagerListener { // /** // * This method is called when the value of the subnet has changed. // * // * @param event // * the event corresponding to the change of the subnet // */ // void subnetValueChanged(SubnetValueChangedEvent event); // // /** // * This method is called when the value of the universe has changed. // * // * @param event // * the event corresponding to the change of the universe // */ // void universeValueChanged(UniverseValueChangedEvent event); // // /** // * This method is called when the value of the additive mode has changed. // * // * @param event // * the event corresponding to the change of the additive mode // */ // void additiveModeValueChanged(AdditiveModeValueChangedEvent event); // } // Path: src/main/java/net/eliosoft/elios/server/ArtNetServerManager.java import java.net.SocketException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map.Entry; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.eliosoft.elios.main.LoggersManager; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; import net.eliosoft.elios.server.events.SubnetValueChangedEvent; import net.eliosoft.elios.server.events.UniverseValueChangedEvent; import net.eliosoft.elios.server.listeners.ArtNetServerManagerListener; import artnet4j.ArtNetException; import artnet4j.ArtNetServer; import artnet4j.events.ArtNetServerListener; import artnet4j.packets.ArtDmxPacket; import artnet4j.packets.ArtNetPacket; /** * Removes an element to the list of listener of the artnet server manager. * * @param listener * the listener to remove */ public void removeArtNetServerManagerChangedListener( final ArtNetServerManagerListener listener) { this.artnetServerManagerChangedListeners.remove(listener); } private void fireSubnetValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) { SubnetValueChangedEvent e = new SubnetValueChangedEvent( this.serverSubnet); listener.subnetValueChanged(e); } } private void fireUniverseValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) { UniverseValueChangedEvent e = new UniverseValueChangedEvent( this.serverUniverse); listener.universeValueChanged(e); } } private void fireAdditiveModeValueChanged() { for (ArtNetServerManagerListener listener : this.artnetServerManagerChangedListeners) {
AdditiveModeValueChangedEvent e = new AdditiveModeValueChangedEvent(
Eliosoft/elios
src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // }
import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // Path: src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */
void artNetStarted(ArtNetStartedEvent event);
Eliosoft/elios
src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // }
import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */ void artNetStarted(ArtNetStartedEvent event); /** * This method is called when the ArtNet Server is stopped. * * @param event * the event corresponding to the stop of the server */
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // Path: src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */ void artNetStarted(ArtNetStartedEvent event); /** * This method is called when the ArtNet Server is stopped. * * @param event * the event corresponding to the stop of the server */
void artNetStopped(ArtNetStoppedEvent event);
Eliosoft/elios
src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // }
import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */ void artNetStarted(ArtNetStartedEvent event); /** * This method is called when the ArtNet Server is stopped. * * @param event * the event corresponding to the stop of the server */ void artNetStopped(ArtNetStoppedEvent event); /** * This method is called when the Http Server is started. * * @param event * the event corresponding to the start of the server */
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // Path: src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */ void artNetStarted(ArtNetStartedEvent event); /** * This method is called when the ArtNet Server is stopped. * * @param event * the event corresponding to the stop of the server */ void artNetStopped(ArtNetStoppedEvent event); /** * This method is called when the Http Server is started. * * @param event * the event corresponding to the start of the server */
void httpStarted(HttpStartedEvent event);
Eliosoft/elios
src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // }
import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */ void artNetStarted(ArtNetStartedEvent event); /** * This method is called when the ArtNet Server is stopped. * * @param event * the event corresponding to the stop of the server */ void artNetStopped(ArtNetStoppedEvent event); /** * This method is called when the Http Server is started. * * @param event * the event corresponding to the start of the server */ void httpStarted(HttpStartedEvent event); /** * This method is called when the Http Server is stopped. * * @param event * the event corresponding to the stop of the server */
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // Path: src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */ void artNetStarted(ArtNetStartedEvent event); /** * This method is called when the ArtNet Server is stopped. * * @param event * the event corresponding to the stop of the server */ void artNetStopped(ArtNetStoppedEvent event); /** * This method is called when the Http Server is started. * * @param event * the event corresponding to the start of the server */ void httpStarted(HttpStartedEvent event); /** * This method is called when the Http Server is stopped. * * @param event * the event corresponding to the stop of the server */
void httpStopped(HttpStoppedEvent event);
Eliosoft/elios
src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // }
import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent;
/* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */ void artNetStarted(ArtNetStartedEvent event); /** * This method is called when the ArtNet Server is stopped. * * @param event * the event corresponding to the stop of the server */ void artNetStopped(ArtNetStoppedEvent event); /** * This method is called when the Http Server is started. * * @param event * the event corresponding to the start of the server */ void httpStarted(HttpStartedEvent event); /** * This method is called when the Http Server is stopped. * * @param event * the event corresponding to the stop of the server */ void httpStopped(HttpStoppedEvent event); /** * This method is called when the value of the additive mode has changed. * * @param event * the event corresponding to the change of the additive mode */
// Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStartedEvent.java // public class ArtNetStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/ArtNetStoppedEvent.java // public class ArtNetStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/CommandLineValueChangedEvent.java // public class CommandLineValueChangedEvent { // // private String command; // // /** // * Constructor method to instantiate a new event. // * // * @param command // * the new command line value // */ // public CommandLineValueChangedEvent(final String command) { // this.command = command; // } // // /** // * Returns the Command Line value of the event. // * // * @return the new CommandLine value // */ // public String getCommand() { // return command; // } // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStartedEvent.java // public class HttpStartedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/gui/events/HttpStoppedEvent.java // public class HttpStoppedEvent { // // } // // Path: src/main/java/net/eliosoft/elios/server/events/AdditiveModeValueChangedEvent.java // public class AdditiveModeValueChangedEvent { // private boolean additiveModeEnabled; // // /** // * Constructor method to instantiate a new event. // * // * @param additiveModeEnabled // * the new additive mode status value // */ // public AdditiveModeValueChangedEvent(final boolean additiveModeEnabled) { // this.additiveModeEnabled = additiveModeEnabled; // } // // /** // * Returns the additive mode status value of the event. // * // * @return the new additive mode status value // */ // public boolean isAdditiveModeEnabled() { // return additiveModeEnabled; // } // } // Path: src/main/java/net/eliosoft/elios/gui/listeners/RemoteModelListener.java import net.eliosoft.elios.gui.events.ArtNetStartedEvent; import net.eliosoft.elios.gui.events.ArtNetStoppedEvent; import net.eliosoft.elios.gui.events.CommandLineValueChangedEvent; import net.eliosoft.elios.gui.events.HttpStartedEvent; import net.eliosoft.elios.gui.events.HttpStoppedEvent; import net.eliosoft.elios.server.events.AdditiveModeValueChangedEvent; /* * This file is part of Elios. * * Copyright 2010 Jeremie GASTON-RAOUL & Alexandre COLLIGNON * * Elios 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 3 of the License, or * (at your option) any later version. * * Elios 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 Elios. If not, see <http://www.gnu.org/licenses/>. */ package net.eliosoft.elios.gui.listeners; /** * This interface describes the methods that must be implemented by classes * which want to be a listener of the remote model. * * @author Jeremie GASTON-RAOUL */ public interface RemoteModelListener { /** * This method is called when the value of the command line has changed. * * @param event * the event corresponding to the change of the command line */ void commandLineValueChanged(CommandLineValueChangedEvent event); /** * This method is called when the ArtNet Server is started. * * @param event * the event corresponding to the start of the server */ void artNetStarted(ArtNetStartedEvent event); /** * This method is called when the ArtNet Server is stopped. * * @param event * the event corresponding to the stop of the server */ void artNetStopped(ArtNetStoppedEvent event); /** * This method is called when the Http Server is started. * * @param event * the event corresponding to the start of the server */ void httpStarted(HttpStartedEvent event); /** * This method is called when the Http Server is stopped. * * @param event * the event corresponding to the stop of the server */ void httpStopped(HttpStoppedEvent event); /** * This method is called when the value of the additive mode has changed. * * @param event * the event corresponding to the change of the additive mode */
void additiveModeValueChanged(AdditiveModeValueChangedEvent event);
mikeyy109/polyphasicsleep
app/src/main/java/com/liquications/polyphasicsleep/Alarm.java
// Path: app/src/main/java/com/liquications/polyphasicsleep/alert/AlarmAlertBroadcastReciever.java // public class AlarmAlertBroadcastReciever extends BroadcastReceiver { // // @Override // public void onReceive(Context context, Intent intent) { // Intent mathAlarmServiceIntent = new Intent( // context, // AlarmServiceBroadcastReciever.class); // context.sendBroadcast(mathAlarmServiceIntent, null); // // StaticWakeLock.lockOn(context); // Bundle bundle = intent.getExtras(); // final Alarm alarm = (Alarm) bundle.getSerializable("alarm"); // // Intent mathAlarmAlertActivityIntent; // // mathAlarmAlertActivityIntent = new Intent(context, AlarmAlertActivity.class); // // mathAlarmAlertActivityIntent.putExtra("alarm", alarm); // // mathAlarmAlertActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // // context.startActivity(mathAlarmAlertActivityIntent); // } // // }
import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; import com.liquications.polyphasicsleep.alert.AlarmAlertBroadcastReciever; import java.io.Serializable; import java.util.Arrays; import java.util.Calendar; import java.util.Comparator; import java.util.LinkedList; import java.util.List;
daysStringBuilder.append("Every Day"); }else{ Arrays.sort(getDays(), new Comparator<Day>() { @Override public int compare(Day lhs, Day rhs) { return lhs.ordinal() - rhs.ordinal(); } }); for(Day d : getDays()){ switch(d){ case TUESDAY: case THURSDAY: // daysStringBuilder.append(d.toString().substring(0, 4)); // break; default: daysStringBuilder.append(d.toString().substring(0, 3)); break; } daysStringBuilder.append(','); } daysStringBuilder.setLength(daysStringBuilder.length()-1); } return daysStringBuilder.toString(); } public void schedule(Context context) { setAlarmActive(true);
// Path: app/src/main/java/com/liquications/polyphasicsleep/alert/AlarmAlertBroadcastReciever.java // public class AlarmAlertBroadcastReciever extends BroadcastReceiver { // // @Override // public void onReceive(Context context, Intent intent) { // Intent mathAlarmServiceIntent = new Intent( // context, // AlarmServiceBroadcastReciever.class); // context.sendBroadcast(mathAlarmServiceIntent, null); // // StaticWakeLock.lockOn(context); // Bundle bundle = intent.getExtras(); // final Alarm alarm = (Alarm) bundle.getSerializable("alarm"); // // Intent mathAlarmAlertActivityIntent; // // mathAlarmAlertActivityIntent = new Intent(context, AlarmAlertActivity.class); // // mathAlarmAlertActivityIntent.putExtra("alarm", alarm); // // mathAlarmAlertActivityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // // context.startActivity(mathAlarmAlertActivityIntent); // } // // } // Path: app/src/main/java/com/liquications/polyphasicsleep/Alarm.java import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.media.RingtoneManager; import com.liquications.polyphasicsleep.alert.AlarmAlertBroadcastReciever; import java.io.Serializable; import java.util.Arrays; import java.util.Calendar; import java.util.Comparator; import java.util.LinkedList; import java.util.List; daysStringBuilder.append("Every Day"); }else{ Arrays.sort(getDays(), new Comparator<Day>() { @Override public int compare(Day lhs, Day rhs) { return lhs.ordinal() - rhs.ordinal(); } }); for(Day d : getDays()){ switch(d){ case TUESDAY: case THURSDAY: // daysStringBuilder.append(d.toString().substring(0, 4)); // break; default: daysStringBuilder.append(d.toString().substring(0, 3)); break; } daysStringBuilder.append(','); } daysStringBuilder.setLength(daysStringBuilder.length()-1); } return daysStringBuilder.toString(); } public void schedule(Context context) { setAlarmActive(true);
Intent myIntent = new Intent(context, AlarmAlertBroadcastReciever.class);
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/PageUtils.java
// Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // }
import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.log4j.Logger; import com.syndicapp.scraper.aib.model.Account;
package com.syndicapp.scraper.aib; public class PageUtils { private static Logger log = Logger.getLogger(PageUtils.class); private static String[] months = new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; /** * The referer URL is the first line of the page blob (must be manually added in each page implementation) * * @param page * @return The Referer URL */ static public String getReferer(String page) { return (page.split("\n"))[0]; } static public int getMonthFromMonthName(String name) { for (int i=0; i<12; i++) { if (months[i].equalsIgnoreCase(name)) { return i; } } return -1; }
// Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // Path: src/main/java/com/syndicapp/scraper/aib/PageUtils.java import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.log4j.Logger; import com.syndicapp.scraper.aib.model.Account; package com.syndicapp.scraper.aib; public class PageUtils { private static Logger log = Logger.getLogger(PageUtils.class); private static String[] months = new String[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; /** * The referer URL is the first line of the page blob (must be manually added in each page implementation) * * @param page * @return The Referer URL */ static public String getReferer(String page) { return (page.split("\n"))[0]; } static public int getMonthFromMonthName(String name) { for (int i=0; i<12; i++) { if (months[i].equalsIgnoreCase(name)) { return i; } } return -1; }
static public ArrayList<Account> parseBalances(String page) {
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/TransferBetweenMyOwnAccountsConfirmationPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: TransferBetweenMyOwnAccountsConfirmationPage.java package com.syndicapp.scraper.aib; public class TransferBetweenMyOwnAccountsConfirmationPage extends FSSUserAgent { public TransferBetweenMyOwnAccountsConfirmationPage() { } public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { HashMap<String, Object> outputParams = new HashMap<String, Object>(); String transactionToken = null; Pattern p = Pattern .compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_finish"); for (Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost( "https://aibinternetbanking.aib.ie/inet/roi/fundstransferownaccounts.htm"); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("confirmPac.pacDigit", (String) inputParams.get("digit"))); nvps.add(new BasicNameValuePair("_finish", "true")); nvps.add(new BasicNameValuePair("_finish.x", "49")); nvps.add(new BasicNameValuePair("_finish.y", "8")); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.fatal((new StringBuilder()) .append("Clicking 'Transfers between my own accounts confirmation' with ") .append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if (!page.contains("Your funds have been transferred.")) {
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/TransferBetweenMyOwnAccountsConfirmationPage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: TransferBetweenMyOwnAccountsConfirmationPage.java package com.syndicapp.scraper.aib; public class TransferBetweenMyOwnAccountsConfirmationPage extends FSSUserAgent { public TransferBetweenMyOwnAccountsConfirmationPage() { } public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { HashMap<String, Object> outputParams = new HashMap<String, Object>(); String transactionToken = null; Pattern p = Pattern .compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_finish"); for (Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost( "https://aibinternetbanking.aib.ie/inet/roi/fundstransferownaccounts.htm"); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("confirmPac.pacDigit", (String) inputParams.get("digit"))); nvps.add(new BasicNameValuePair("_finish", "true")); nvps.add(new BasicNameValuePair("_finish.x", "49")); nvps.add(new BasicNameValuePair("_finish.y", "8")); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.fatal((new StringBuilder()) .append("Clicking 'Transfers between my own accounts confirmation' with ") .append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if (!page.contains("Your funds have been transferred.")) {
throw new UnexpectedPageContentsException(
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/TransfersAndPaymentsPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: TransfersAndPaymentsPage.java package com.syndicapp.scraper.aib; public class TransfersAndPaymentsPage extends FSSUserAgent { public TransfersAndPaymentsPage() { } public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { HashMap<String, Object> outputParams = new HashMap<String, Object>(); String transactionToken = null; Pattern p = Pattern .compile("action=\"transfersandpaymentslanding.htm\" method=\"post\"><input type=\"hidden\" name=\"isFormButtonClicked\" value=\"false\" /><input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for (Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost( "https://aibinternetbanking.aib.ie/inet/roi/transfersandpaymentslanding.htm"); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.fatal((new StringBuilder()).append("Clicking 'Transfers and Payments' with ") .append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if (!page.contains("What sort of transfer or payment do you want to make?")) {
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/TransfersAndPaymentsPage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: TransfersAndPaymentsPage.java package com.syndicapp.scraper.aib; public class TransfersAndPaymentsPage extends FSSUserAgent { public TransfersAndPaymentsPage() { } public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { HashMap<String, Object> outputParams = new HashMap<String, Object>(); String transactionToken = null; Pattern p = Pattern .compile("action=\"transfersandpaymentslanding.htm\" method=\"post\"><input type=\"hidden\" name=\"isFormButtonClicked\" value=\"false\" /><input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for (Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost( "https://aibinternetbanking.aib.ie/inet/roi/transfersandpaymentslanding.htm"); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.fatal((new StringBuilder()).append("Clicking 'Transfers and Payments' with ") .append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if (!page.contains("What sort of transfer or payment do you want to make?")) {
throw new UnexpectedPageContentsException(
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/AddNewPayeePage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AddNewPayeePage.java package com.syndicapp.scraper.aib; public class AddNewPayeePage extends FSSUserAgent { public AddNewPayeePage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("addpayee.htm\" method=\"post\">\\s*<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/addpayee.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.debug((new StringBuilder()).append("Clicking 'Transfers and Payments' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("A new payee")) {
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/AddNewPayeePage.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AddNewPayeePage.java package com.syndicapp.scraper.aib; public class AddNewPayeePage extends FSSUserAgent { public AddNewPayeePage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("addpayee.htm\" method=\"post\">\\s*<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/addpayee.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.debug((new StringBuilder()).append("Clicking 'Transfers and Payments' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("A new payee")) {
throw new UnexpectedPageContentsException("Didn't get to the Add New Payees Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/TransferBetweenMyOwnAccountsPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/AccountDropdownItem.java // public class AccountDropdownItem // { // // public AccountDropdownItem(String accountId, String accountName, String accountBalance) // { // this.accountId = accountId; // this.accountName = accountName; // this.accountBalance = accountBalance; // } // // public String getAccountName() // { // return accountName; // } // // public String getAccountId() // { // return accountId; // } // // public String getAccountBalance() // { // return accountBalance; // } // // public void setAccountBalance(String accountBalance) // { // this.accountBalance = accountBalance; // } // // public void setAccountId(String accountId) // { // this.accountId = accountId; // } // // public void setAccountName(String accountName) // { // this.accountName = accountName; // } // // private String accountId; // private String accountName; // private String accountBalance; // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/AccountDropdownList.java // public class AccountDropdownList { // private Vector<AccountDropdownItem> accountDropdownItems; // // public AccountDropdownList() { // accountDropdownItems = new Vector<AccountDropdownItem>(); // } // // public void addAccountDropdownItem(AccountDropdownItem a) { // accountDropdownItems.add(a); // } // // public AccountDropdownItem getAccountByName(String name) { // for (Iterator<AccountDropdownItem> itr = accountDropdownItems.iterator(); itr.hasNext();) { // AccountDropdownItem a = (AccountDropdownItem) itr.next(); // if (a.getAccountName().equalsIgnoreCase(name)) // return a; // } // // return null; // } // // public AccountDropdownItem getAccountById(String index) { // if (index == null) { // return accountDropdownItems.get(0); // } else { // int i = Integer.parseInt(index); // return accountDropdownItems.get(i); // } // } // // public Vector<AccountDropdownItem> getAccountDropdownItems() { // return accountDropdownItems; // } // // public void setAccountDropdownItems(Vector<AccountDropdownItem> accountDropdownItems) { // this.accountDropdownItems = accountDropdownItems; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.AccountDropdownItem; import com.syndicapp.scraper.aib.model.AccountDropdownList; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
HttpPost httppost = new HttpPost( "https://aibinternetbanking.aib.ie/inet/roi/transfersandpaymentslanding.htm"); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("selectedPaymentType", "1")); log.fatal((new StringBuilder()) .append("Clicking 'Transfers between my own accounts' with ") .append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if (!page.contains("Transfer between my own AIB Accounts")) { throw new UnexpectedPageContentsException( "Didn't get to the Transfers between my own accounts Page!"); } AccountDropdownList addlFrom = new AccountDropdownList(); p = Pattern .compile("selectedFromAccountIndex\" class=\"jsIntroText0 aibInputStyle04\" onchange=\"return setDrNarrative\\(\\)\">\\s*<option value=\"-1\" selected=\"selected\">Please select:</option>\\s*(.*?)\\s*</select>"); m = p.matcher(page); if (m.find()) { p = Pattern .compile("<option value=\"(\\d+)\">(.*?) \\(([\\s\\d\\.,DCR]*?)\\)</option>"); m = p.matcher(m.group(1)); while (m.find()) { addlFrom.addAccountDropdownItem(
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/AccountDropdownItem.java // public class AccountDropdownItem // { // // public AccountDropdownItem(String accountId, String accountName, String accountBalance) // { // this.accountId = accountId; // this.accountName = accountName; // this.accountBalance = accountBalance; // } // // public String getAccountName() // { // return accountName; // } // // public String getAccountId() // { // return accountId; // } // // public String getAccountBalance() // { // return accountBalance; // } // // public void setAccountBalance(String accountBalance) // { // this.accountBalance = accountBalance; // } // // public void setAccountId(String accountId) // { // this.accountId = accountId; // } // // public void setAccountName(String accountName) // { // this.accountName = accountName; // } // // private String accountId; // private String accountName; // private String accountBalance; // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/AccountDropdownList.java // public class AccountDropdownList { // private Vector<AccountDropdownItem> accountDropdownItems; // // public AccountDropdownList() { // accountDropdownItems = new Vector<AccountDropdownItem>(); // } // // public void addAccountDropdownItem(AccountDropdownItem a) { // accountDropdownItems.add(a); // } // // public AccountDropdownItem getAccountByName(String name) { // for (Iterator<AccountDropdownItem> itr = accountDropdownItems.iterator(); itr.hasNext();) { // AccountDropdownItem a = (AccountDropdownItem) itr.next(); // if (a.getAccountName().equalsIgnoreCase(name)) // return a; // } // // return null; // } // // public AccountDropdownItem getAccountById(String index) { // if (index == null) { // return accountDropdownItems.get(0); // } else { // int i = Integer.parseInt(index); // return accountDropdownItems.get(i); // } // } // // public Vector<AccountDropdownItem> getAccountDropdownItems() { // return accountDropdownItems; // } // // public void setAccountDropdownItems(Vector<AccountDropdownItem> accountDropdownItems) { // this.accountDropdownItems = accountDropdownItems; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/TransferBetweenMyOwnAccountsPage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.AccountDropdownItem; import com.syndicapp.scraper.aib.model.AccountDropdownList; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; HttpPost httppost = new HttpPost( "https://aibinternetbanking.aib.ie/inet/roi/transfersandpaymentslanding.htm"); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("selectedPaymentType", "1")); log.fatal((new StringBuilder()) .append("Clicking 'Transfers between my own accounts' with ") .append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if (!page.contains("Transfer between my own AIB Accounts")) { throw new UnexpectedPageContentsException( "Didn't get to the Transfers between my own accounts Page!"); } AccountDropdownList addlFrom = new AccountDropdownList(); p = Pattern .compile("selectedFromAccountIndex\" class=\"jsIntroText0 aibInputStyle04\" onchange=\"return setDrNarrative\\(\\)\">\\s*<option value=\"-1\" selected=\"selected\">Please select:</option>\\s*(.*?)\\s*</select>"); m = p.matcher(page); if (m.find()) { p = Pattern .compile("<option value=\"(\\d+)\">(.*?) \\(([\\s\\d\\.,DCR]*?)\\)</option>"); m = p.matcher(m.group(1)); while (m.find()) { addlFrom.addAccountDropdownItem(
new AccountDropdownItem(m.group(1), m.group(2), ""));
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/PACAndChallengePage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
nvps.add(new BasicNameValuePair("jsEnabled", "TRUE")); nvps.add(new BasicNameValuePair("pacDetails.pacDigit1", (String)inputParams.get("pacDetails.pacDigit1"))); nvps.add(new BasicNameValuePair("pacDetails.pacDigit2", (String)inputParams.get("pacDetails.pacDigit2"))); nvps.add(new BasicNameValuePair("pacDetails.pacDigit3", (String)inputParams.get("pacDetails.pacDigit3"))); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); httppost.setHeader("Referer", PageUtils.getReferer(page)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); log.trace(page); if(!page.contains("QuickPay Start")) { // check for action="accountoverview.htm" - we are probably on an info page that AIB display now and again. p = Pattern.compile("action=\"accountoverview.htm\""); m = p.matcher(page); if (m.find()) { // looks like we're on an info page outputParams.put("page", thisPage + "\n" + page); outputParams.put("infoPage", true); return outputParams; } else { // dunno what happened.
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/PACAndChallengePage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; nvps.add(new BasicNameValuePair("jsEnabled", "TRUE")); nvps.add(new BasicNameValuePair("pacDetails.pacDigit1", (String)inputParams.get("pacDetails.pacDigit1"))); nvps.add(new BasicNameValuePair("pacDetails.pacDigit2", (String)inputParams.get("pacDetails.pacDigit2"))); nvps.add(new BasicNameValuePair("pacDetails.pacDigit3", (String)inputParams.get("pacDetails.pacDigit3"))); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); httppost.setHeader("Referer", PageUtils.getReferer(page)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); log.trace(page); if(!page.contains("QuickPay Start")) { // check for action="accountoverview.htm" - we are probably on an info page that AIB display now and again. p = Pattern.compile("action=\"accountoverview.htm\""); m = p.matcher(page); if (m.find()) { // looks like we're on an info page outputParams.put("page", thisPage + "\n" + page); outputParams.put("infoPage", true); return outputParams; } else { // dunno what happened.
throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/PACAndChallengePage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); log.trace(page); if(!page.contains("QuickPay Start")) { // check for action="accountoverview.htm" - we are probably on an info page that AIB display now and again. p = Pattern.compile("action=\"accountoverview.htm\""); m = p.matcher(page); if (m.find()) { // looks like we're on an info page outputParams.put("page", thisPage + "\n" + page); outputParams.put("infoPage", true); return outputParams; } else { // dunno what happened. throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!"); } } else { outputParams.put("page", thisPage + "\n" + page); //outputParams.put("infoPage", false);
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/PACAndChallengePage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); log.trace(page); if(!page.contains("QuickPay Start")) { // check for action="accountoverview.htm" - we are probably on an info page that AIB display now and again. p = Pattern.compile("action=\"accountoverview.htm\""); m = p.matcher(page); if (m.find()) { // looks like we're on an info page outputParams.put("page", thisPage + "\n" + page); outputParams.put("infoPage", true); return outputParams; } else { // dunno what happened. throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!"); } } else { outputParams.put("page", thisPage + "\n" + page); //outputParams.put("infoPage", false);
ArrayList<Account> accounts = PageUtils.parseBalances(page);
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/AccountOverviewPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AccountOverviewPage.java package com.syndicapp.scraper.aib; public class AccountOverviewPage extends FSSUserAgent { public AccountOverviewPage() { } public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { String thisPage = "https://onlinebanking.aib.ie/inet/roi/accountoverview.htm"; HashMap<String, Object> outputParams = new HashMap<String, Object>(); String transactionToken = null; Pattern p = Pattern.compile("accountoverview.htm\" method=\"post\" onsubmit=\"return isFormClickEnabled\\(this\\)\">\\s*<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\""); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost(thisPage); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); log.info((new StringBuilder()).append("Clicking 'Account Overview' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); httppost.setHeader("Referer", PageUtils.getReferer(page)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("QuickPay Start")) {
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/AccountOverviewPage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AccountOverviewPage.java package com.syndicapp.scraper.aib; public class AccountOverviewPage extends FSSUserAgent { public AccountOverviewPage() { } public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { String thisPage = "https://onlinebanking.aib.ie/inet/roi/accountoverview.htm"; HashMap<String, Object> outputParams = new HashMap<String, Object>(); String transactionToken = null; Pattern p = Pattern.compile("accountoverview.htm\" method=\"post\" onsubmit=\"return isFormClickEnabled\\(this\\)\">\\s*<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\""); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost(thisPage); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); log.info((new StringBuilder()).append("Clicking 'Account Overview' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); httppost.setHeader("Referer", PageUtils.getReferer(page)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("QuickPay Start")) {
throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/AccountOverviewPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AccountOverviewPage.java package com.syndicapp.scraper.aib; public class AccountOverviewPage extends FSSUserAgent { public AccountOverviewPage() { } public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { String thisPage = "https://onlinebanking.aib.ie/inet/roi/accountoverview.htm"; HashMap<String, Object> outputParams = new HashMap<String, Object>(); String transactionToken = null; Pattern p = Pattern.compile("accountoverview.htm\" method=\"post\" onsubmit=\"return isFormClickEnabled\\(this\\)\">\\s*<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\""); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost(thisPage); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); log.info((new StringBuilder()).append("Clicking 'Account Overview' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); httppost.setHeader("Referer", PageUtils.getReferer(page)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("QuickPay Start")) { throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!"); } else { outputParams.put("page", thisPage + "\n" + page);
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/AccountOverviewPage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AccountOverviewPage.java package com.syndicapp.scraper.aib; public class AccountOverviewPage extends FSSUserAgent { public AccountOverviewPage() { } public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { String thisPage = "https://onlinebanking.aib.ie/inet/roi/accountoverview.htm"; HashMap<String, Object> outputParams = new HashMap<String, Object>(); String transactionToken = null; Pattern p = Pattern.compile("accountoverview.htm\" method=\"post\" onsubmit=\"return isFormClickEnabled\\(this\\)\">\\s*<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\""); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost(thisPage); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); log.info((new StringBuilder()).append("Clicking 'Account Overview' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); httppost.setHeader("Referer", PageUtils.getReferer(page)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("QuickPay Start")) { throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!"); } else { outputParams.put("page", thisPage + "\n" + page);
ArrayList<Account> accounts = PageUtils.parseBalances(page);
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/TransferToAnotherROIAccountConfirmationPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: TransferToAnotherROIAccountConfirmationPage.java package com.syndicapp.scraper.aib; public class TransferToAnotherROIAccountConfirmationPage extends FSSUserAgent { public TransferToAnotherROIAccountConfirmationPage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_finish"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/fundstransferroi.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("confirmPac.pacDigit", (String)inputParams.get("digit"))); nvps.add(new BasicNameValuePair("_finish", "true")); nvps.add(new BasicNameValuePair("_finish.x", "49")); nvps.add(new BasicNameValuePair("_finish.y", "8")); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.debug((new StringBuilder()).append("Clicking 'Transfer to Another ROI Account confirmation' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Your funds have been transferred.")) {
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/TransferToAnotherROIAccountConfirmationPage.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: TransferToAnotherROIAccountConfirmationPage.java package com.syndicapp.scraper.aib; public class TransferToAnotherROIAccountConfirmationPage extends FSSUserAgent { public TransferToAnotherROIAccountConfirmationPage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_finish"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/fundstransferroi.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("confirmPac.pacDigit", (String)inputParams.get("digit"))); nvps.add(new BasicNameValuePair("_finish", "true")); nvps.add(new BasicNameValuePair("_finish.x", "49")); nvps.add(new BasicNameValuePair("_finish.y", "8")); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.debug((new StringBuilder()).append("Clicking 'Transfer to Another ROI Account confirmation' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Your funds have been transferred.")) {
throw new UnexpectedPageContentsException("Didn't get to the Transfer to Another ROI Account confirmation Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/AddNewPayeeStep1Page.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
public AddNewPayeeStep1Page() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input id=\"nextButton"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/addpayee.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("sFormButtonClicked", "false")); nvps.add(new BasicNameValuePair("paymentType", "1")); nvps.add(new BasicNameValuePair("personalPayeeName", (String)inputParams.get("payeename"))); nvps.add(new BasicNameValuePair("payeeNSC", (String)inputParams.get("payeensc"))); nvps.add(new BasicNameValuePair("payeeAccountNumber", (String)inputParams.get("payeeaccountnum"))); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("_target1.x", "43")); nvps.add(new BasicNameValuePair("_target1.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Add new Payee Step 1' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("You have requested to add the following payee"))
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/AddNewPayeeStep1Page.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; public AddNewPayeeStep1Page() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input id=\"nextButton"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/addpayee.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("sFormButtonClicked", "false")); nvps.add(new BasicNameValuePair("paymentType", "1")); nvps.add(new BasicNameValuePair("personalPayeeName", (String)inputParams.get("payeename"))); nvps.add(new BasicNameValuePair("payeeNSC", (String)inputParams.get("payeensc"))); nvps.add(new BasicNameValuePair("payeeAccountNumber", (String)inputParams.get("payeeaccountnum"))); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("_target1.x", "43")); nvps.add(new BasicNameValuePair("_target1.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Add new Payee Step 1' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("You have requested to add the following payee"))
throw new UnexpectedPageContentsException("Didn't get to the Add New Payees Confirm Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/PostLoginInformationPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
package com.syndicapp.scraper.aib; public class PostLoginInformationPage extends FSSUserAgent { public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { HashMap<String, Object> outputParams = new HashMap<String, Object>(); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/accountoverview.htm"); String transactionToken = null; // attempt to find the transactionToken - might move around each time they create an info page.. Pattern p = Pattern.compile("action=\"accountoverview.htm\".*?<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d*)\"/>"); Matcher m = p.matcher(page); while (m.find()) { transactionToken = m.group(1); } List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("iBankFormSubmission", "false")); nvps.add(new BasicNameValuePair("x", "189")); nvps.add(new BasicNameValuePair("y", "3")); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("You are securely logged in.")) {
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/PostLoginInformationPage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; package com.syndicapp.scraper.aib; public class PostLoginInformationPage extends FSSUserAgent { public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { HashMap<String, Object> outputParams = new HashMap<String, Object>(); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/accountoverview.htm"); String transactionToken = null; // attempt to find the transactionToken - might move around each time they create an info page.. Pattern p = Pattern.compile("action=\"accountoverview.htm\".*?<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d*)\"/>"); Matcher m = p.matcher(page); while (m.find()) { transactionToken = m.group(1); } List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("iBankFormSubmission", "false")); nvps.add(new BasicNameValuePair("x", "189")); nvps.add(new BasicNameValuePair("y", "3")); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("You are securely logged in.")) {
throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/PostLoginInformationPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
package com.syndicapp.scraper.aib; public class PostLoginInformationPage extends FSSUserAgent { public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { HashMap<String, Object> outputParams = new HashMap<String, Object>(); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/accountoverview.htm"); String transactionToken = null; // attempt to find the transactionToken - might move around each time they create an info page.. Pattern p = Pattern.compile("action=\"accountoverview.htm\".*?<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d*)\"/>"); Matcher m = p.matcher(page); while (m.find()) { transactionToken = m.group(1); } List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("iBankFormSubmission", "false")); nvps.add(new BasicNameValuePair("x", "189")); nvps.add(new BasicNameValuePair("y", "3")); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("You are securely logged in.")) { throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!"); } else { outputParams.put("page", page);
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Account.java // public class Account { // // static Logger Log = Logger.getLogger(Account.class); // private int id; // private String name; // private BigDecimal balance; // private String drcr; // private ArrayList<Transaction> transactions; // private boolean pending; // // public Account(int id, String name, String balance, String drcr, boolean pending) { // Log.debug((new StringBuilder()).append("New Account - ").append(name).append(" - ") // .append(balance).append(drcr).toString()); // this.id = id; // this.name = name; // this.balance = new BigDecimal(balance.replace(",", "")); // this.drcr = (null == drcr ? "" : drcr); // this.pending = pending; // } // // public String getDrcr() { // return drcr; // } // // public void setDrcr(String drcr) { // this.drcr = drcr; // } // // public void setName(String name) { // this.name = name; // } // // public void setBalance(String balance) { // this.balance = new BigDecimal(balance.replace(",", "")); // } // // public String getName() { // return name; // } // // public BigDecimal getBalance() { // return balance; // } // // public boolean isDR() { // return drcr.equalsIgnoreCase("DR"); // } // // // public boolean isPending() { // return pending; // } // // public void setTransactions(ArrayList<Transaction> t) { // transactions = t; // } // // public ArrayList<Transaction> getTransactions() { // return transactions; // } // // public int getId() { // return id; // } // // public void setId(int id) { // this.id = id; // } // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/PostLoginInformationPage.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.Consts; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Account; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; package com.syndicapp.scraper.aib; public class PostLoginInformationPage extends FSSUserAgent { public static HashMap<String, Object> click(String page, HashMap<String, Object> inputParams) throws Exception { HashMap<String, Object> outputParams = new HashMap<String, Object>(); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/accountoverview.htm"); String transactionToken = null; // attempt to find the transactionToken - might move around each time they create an info page.. Pattern p = Pattern.compile("action=\"accountoverview.htm\".*?<input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d*)\"/>"); Matcher m = p.matcher(page); while (m.find()) { transactionToken = m.group(1); } List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("iBankFormSubmission", "false")); nvps.add(new BasicNameValuePair("x", "189")); nvps.add(new BasicNameValuePair("y", "3")); httppost.setEntity(new UrlEncodedFormEntity(nvps, Consts.UTF_8)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("You are securely logged in.")) { throw new UnexpectedPageContentsException("Didn't get to the Account Overview Page!"); } else { outputParams.put("page", page);
ArrayList<Account> accounts = PageUtils.parseBalances(page);
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/TransferBetweenMyOwnAccountsStep1Page.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException;
HttpPost httppost = new HttpPost( "https://aibinternetbanking.aib.ie/inet/roi/fundstransferownaccounts.htm"); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("ccAccounts", "[{" + ccAccounts + "}]")); nvps.add(new BasicNameValuePair("selectedFromAccountIndex", (String) inputParams .get("fromAccount"))); nvps.add(new BasicNameValuePair("senderReference", (String) inputParams .get("senderReference"))); nvps.add(new BasicNameValuePair("selectedToAccountIndex", (String) inputParams .get("toAccount"))); nvps.add(new BasicNameValuePair("receiverReference", (String) inputParams .get("receiverReference"))); nvps.add(new BasicNameValuePair("transferAmount.euro", (String) inputParams .get("amounteuro"))); nvps.add(new BasicNameValuePair("transferAmount.cent", (String) inputParams .get("amountcent"))); nvps.add(new BasicNameValuePair("_target1.x", "49")); nvps.add(new BasicNameValuePair("_target1.y", "8")); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.fatal((new StringBuilder()) .append("Clicking 'Transfers between my own accounts' with ") .append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if (!page.contains("You have requested to make the following transfer:")) { log.fatal(page);
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/TransferBetweenMyOwnAccountsStep1Page.java import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; HttpPost httppost = new HttpPost( "https://aibinternetbanking.aib.ie/inet/roi/fundstransferownaccounts.htm"); List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>(); nvps.add(new BasicNameValuePair("ccAccounts", "[{" + ccAccounts + "}]")); nvps.add(new BasicNameValuePair("selectedFromAccountIndex", (String) inputParams .get("fromAccount"))); nvps.add(new BasicNameValuePair("senderReference", (String) inputParams .get("senderReference"))); nvps.add(new BasicNameValuePair("selectedToAccountIndex", (String) inputParams .get("toAccount"))); nvps.add(new BasicNameValuePair("receiverReference", (String) inputParams .get("receiverReference"))); nvps.add(new BasicNameValuePair("transferAmount.euro", (String) inputParams .get("amounteuro"))); nvps.add(new BasicNameValuePair("transferAmount.cent", (String) inputParams .get("amountcent"))); nvps.add(new BasicNameValuePair("_target1.x", "49")); nvps.add(new BasicNameValuePair("_target1.y", "8")); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); log.fatal((new StringBuilder()) .append("Clicking 'Transfers between my own accounts' with ") .append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if (!page.contains("You have requested to make the following transfer:")) { log.fatal(page);
throw new UnexpectedPageContentsException(
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/TransferToAnotherROIAccountStep3.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
{ } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<div>\\s*<input type=\"image\" class=\"aibRowRight\" name=\"_target6"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/fundstransferroi.htm"); List nvps = new ArrayList(); p = Pattern.compile("<input type=\"hidden\" name=\"accountRefList\" value=\"\"/>"); for(Matcher m = p.matcher(page); m.find(); nvps.add(new BasicNameValuePair("accountRefList", ""))); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("receiverAccountIndex", (String)inputParams.get("toAccountId"))); nvps.add(new BasicNameValuePair("receiverReference", (String)inputParams.get("receiverReference"))); nvps.add(new BasicNameValuePair("paymentAmount.euro", (String)inputParams.get("amounteuro"))); nvps.add(new BasicNameValuePair("paymentAmount.cent", (String)inputParams.get("amountcent"))); nvps.add(new BasicNameValuePair("_target6.x", "21")); nvps.add(new BasicNameValuePair("_target6.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Transfer to Another ROI Account Step 3' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("You have requested to make the following transfer:"))
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/TransferToAnotherROIAccountStep3.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<div>\\s*<input type=\"image\" class=\"aibRowRight\" name=\"_target6"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/fundstransferroi.htm"); List nvps = new ArrayList(); p = Pattern.compile("<input type=\"hidden\" name=\"accountRefList\" value=\"\"/>"); for(Matcher m = p.matcher(page); m.find(); nvps.add(new BasicNameValuePair("accountRefList", ""))); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("receiverAccountIndex", (String)inputParams.get("toAccountId"))); nvps.add(new BasicNameValuePair("receiverReference", (String)inputParams.get("receiverReference"))); nvps.add(new BasicNameValuePair("paymentAmount.euro", (String)inputParams.get("amounteuro"))); nvps.add(new BasicNameValuePair("paymentAmount.cent", (String)inputParams.get("amountcent"))); nvps.add(new BasicNameValuePair("_target6.x", "21")); nvps.add(new BasicNameValuePair("_target6.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Transfer to Another ROI Account Step 3' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("You have requested to make the following transfer:"))
throw new UnexpectedPageContentsException("Didn't get to the Transfer to Another ROI Account Step 3 Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/AddNewPayeeConfirm2Page.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AddNewPayeeConfirm2Page.java package com.syndicapp.scraper.aib; public class AddNewPayeeConfirm2Page extends FSSUserAgent { public AddNewPayeeConfirm2Page() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_finish"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/addpayee.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("confirmCodeCard.code", (String)inputParams.get("code"))); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("_finish", "true")); nvps.add(new BasicNameValuePair("_finish.x", "43")); nvps.add(new BasicNameValuePair("_finish.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Add new Payee Confirm 2' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Your new payee has been added successfully")) {
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/AddNewPayeeConfirm2Page.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AddNewPayeeConfirm2Page.java package com.syndicapp.scraper.aib; public class AddNewPayeeConfirm2Page extends FSSUserAgent { public AddNewPayeeConfirm2Page() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_finish"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/addpayee.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("confirmCodeCard.code", (String)inputParams.get("code"))); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("_finish", "true")); nvps.add(new BasicNameValuePair("_finish.x", "43")); nvps.add(new BasicNameValuePair("_finish.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Add new Payee Confirm 2' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Your new payee has been added successfully")) {
throw new UnexpectedPageContentsException("Didn't get to the Add New Payees Success Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/AddNewPayeeConfirm1Page.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AddNewPayeeConfirm1Page.java package com.syndicapp.scraper.aib; public class AddNewPayeeConfirm1Page extends FSSUserAgent { public AddNewPayeeConfirm1Page() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_target2"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/addpayee.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("confirmCodeCard.code", (String)inputParams.get("code"))); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("_target2", "true")); nvps.add(new BasicNameValuePair("_target2.x", "43")); nvps.add(new BasicNameValuePair("_target2.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Add new Payee Confirm 1' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("For enhanced security, please enter"))
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/AddNewPayeeConfirm1Page.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:34 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: AddNewPayeeConfirm1Page.java package com.syndicapp.scraper.aib; public class AddNewPayeeConfirm1Page extends FSSUserAgent { public AddNewPayeeConfirm1Page() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_target2"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/addpayee.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("confirmCodeCard.code", (String)inputParams.get("code"))); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("_target2", "true")); nvps.add(new BasicNameValuePair("_target2.x", "43")); nvps.add(new BasicNameValuePair("_target2.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Add new Payee Confirm 1' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("For enhanced security, please enter"))
throw new UnexpectedPageContentsException("Didn't get to the Add New Payees Confirm 2 Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/ManageMyPayeesPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Payee.java // public class Payee // { // // public Payee(String name, String accountNumber, String sortCode) // { // this.name = name; // this.accountNumber = accountNumber; // this.sortCode = sortCode; // } // // public String getName() // { // return name; // } // // public String getBankDetails() // { // return (new StringBuilder()).append(sortCode).append(accountNumber).toString(); // } // // private String name; // private String accountNumber; // private String sortCode; // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/PayeeList.java // public class PayeeList // { // // public PayeeList() // { // payees = new Vector<Payee>(); // } // // public void addPayee(Payee a) // { // payees.add(a); // } // // public Payee getPayeeByName(String name) // { // for(Iterator<Payee> itr = payees.iterator(); itr.hasNext();) // { // Payee p = (Payee)itr.next(); // if(p.getName().equalsIgnoreCase(name)) // return p; // } // // return null; // } // // private Vector<Payee> payees; // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Payee; import com.syndicapp.scraper.aib.model.PayeeList; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: ManageMyPayeesPage.java package com.syndicapp.scraper.aib; public class ManageMyPayeesPage extends FSSUserAgent { public ManageMyPayeesPage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("managemypayees.htm\" method=\"post\" ><input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/managemypayees.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("tabName", "Manage My Payees")); log.debug((new StringBuilder()).append("Clicking 'Transfers and Payments' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Add new payee"))
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Payee.java // public class Payee // { // // public Payee(String name, String accountNumber, String sortCode) // { // this.name = name; // this.accountNumber = accountNumber; // this.sortCode = sortCode; // } // // public String getName() // { // return name; // } // // public String getBankDetails() // { // return (new StringBuilder()).append(sortCode).append(accountNumber).toString(); // } // // private String name; // private String accountNumber; // private String sortCode; // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/PayeeList.java // public class PayeeList // { // // public PayeeList() // { // payees = new Vector<Payee>(); // } // // public void addPayee(Payee a) // { // payees.add(a); // } // // public Payee getPayeeByName(String name) // { // for(Iterator<Payee> itr = payees.iterator(); itr.hasNext();) // { // Payee p = (Payee)itr.next(); // if(p.getName().equalsIgnoreCase(name)) // return p; // } // // return null; // } // // private Vector<Payee> payees; // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/ManageMyPayeesPage.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Payee; import com.syndicapp.scraper.aib.model.PayeeList; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: ManageMyPayeesPage.java package com.syndicapp.scraper.aib; public class ManageMyPayeesPage extends FSSUserAgent { public ManageMyPayeesPage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("managemypayees.htm\" method=\"post\" ><input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/managemypayees.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("tabName", "Manage My Payees")); log.debug((new StringBuilder()).append("Clicking 'Transfers and Payments' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Add new payee"))
throw new UnexpectedPageContentsException("Didn't get to the Manage My Payees Page!");
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/ManageMyPayeesPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Payee.java // public class Payee // { // // public Payee(String name, String accountNumber, String sortCode) // { // this.name = name; // this.accountNumber = accountNumber; // this.sortCode = sortCode; // } // // public String getName() // { // return name; // } // // public String getBankDetails() // { // return (new StringBuilder()).append(sortCode).append(accountNumber).toString(); // } // // private String name; // private String accountNumber; // private String sortCode; // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/PayeeList.java // public class PayeeList // { // // public PayeeList() // { // payees = new Vector<Payee>(); // } // // public void addPayee(Payee a) // { // payees.add(a); // } // // public Payee getPayeeByName(String name) // { // for(Iterator<Payee> itr = payees.iterator(); itr.hasNext();) // { // Payee p = (Payee)itr.next(); // if(p.getName().equalsIgnoreCase(name)) // return p; // } // // return null; // } // // private Vector<Payee> payees; // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Payee; import com.syndicapp.scraper.aib.model.PayeeList; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: ManageMyPayeesPage.java package com.syndicapp.scraper.aib; public class ManageMyPayeesPage extends FSSUserAgent { public ManageMyPayeesPage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("managemypayees.htm\" method=\"post\" ><input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/managemypayees.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("tabName", "Manage My Payees")); log.debug((new StringBuilder()).append("Clicking 'Transfers and Payments' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Add new payee")) throw new UnexpectedPageContentsException("Didn't get to the Manage My Payees Page!"); p = Pattern.compile("<td>(.*?)</td>\\s*<td>Personal payment</td>\\s*<td></td>\\s*<td>(.*?)</td>\\s*<td>(.*?)</td>");
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Payee.java // public class Payee // { // // public Payee(String name, String accountNumber, String sortCode) // { // this.name = name; // this.accountNumber = accountNumber; // this.sortCode = sortCode; // } // // public String getName() // { // return name; // } // // public String getBankDetails() // { // return (new StringBuilder()).append(sortCode).append(accountNumber).toString(); // } // // private String name; // private String accountNumber; // private String sortCode; // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/PayeeList.java // public class PayeeList // { // // public PayeeList() // { // payees = new Vector<Payee>(); // } // // public void addPayee(Payee a) // { // payees.add(a); // } // // public Payee getPayeeByName(String name) // { // for(Iterator<Payee> itr = payees.iterator(); itr.hasNext();) // { // Payee p = (Payee)itr.next(); // if(p.getName().equalsIgnoreCase(name)) // return p; // } // // return null; // } // // private Vector<Payee> payees; // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/ManageMyPayeesPage.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Payee; import com.syndicapp.scraper.aib.model.PayeeList; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: ManageMyPayeesPage.java package com.syndicapp.scraper.aib; public class ManageMyPayeesPage extends FSSUserAgent { public ManageMyPayeesPage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("managemypayees.htm\" method=\"post\" ><input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/managemypayees.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("tabName", "Manage My Payees")); log.debug((new StringBuilder()).append("Clicking 'Transfers and Payments' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Add new payee")) throw new UnexpectedPageContentsException("Didn't get to the Manage My Payees Page!"); p = Pattern.compile("<td>(.*?)</td>\\s*<td>Personal payment</td>\\s*<td></td>\\s*<td>(.*?)</td>\\s*<td>(.*?)</td>");
PayeeList pl = new PayeeList();
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/ManageMyPayeesPage.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Payee.java // public class Payee // { // // public Payee(String name, String accountNumber, String sortCode) // { // this.name = name; // this.accountNumber = accountNumber; // this.sortCode = sortCode; // } // // public String getName() // { // return name; // } // // public String getBankDetails() // { // return (new StringBuilder()).append(sortCode).append(accountNumber).toString(); // } // // private String name; // private String accountNumber; // private String sortCode; // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/PayeeList.java // public class PayeeList // { // // public PayeeList() // { // payees = new Vector<Payee>(); // } // // public void addPayee(Payee a) // { // payees.add(a); // } // // public Payee getPayeeByName(String name) // { // for(Iterator<Payee> itr = payees.iterator(); itr.hasNext();) // { // Payee p = (Payee)itr.next(); // if(p.getName().equalsIgnoreCase(name)) // return p; // } // // return null; // } // // private Vector<Payee> payees; // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Payee; import com.syndicapp.scraper.aib.model.PayeeList; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: ManageMyPayeesPage.java package com.syndicapp.scraper.aib; public class ManageMyPayeesPage extends FSSUserAgent { public ManageMyPayeesPage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("managemypayees.htm\" method=\"post\" ><input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/managemypayees.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("tabName", "Manage My Payees")); log.debug((new StringBuilder()).append("Clicking 'Transfers and Payments' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Add new payee")) throw new UnexpectedPageContentsException("Didn't get to the Manage My Payees Page!"); p = Pattern.compile("<td>(.*?)</td>\\s*<td>Personal payment</td>\\s*<td></td>\\s*<td>(.*?)</td>\\s*<td>(.*?)</td>"); PayeeList pl = new PayeeList();
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/Payee.java // public class Payee // { // // public Payee(String name, String accountNumber, String sortCode) // { // this.name = name; // this.accountNumber = accountNumber; // this.sortCode = sortCode; // } // // public String getName() // { // return name; // } // // public String getBankDetails() // { // return (new StringBuilder()).append(sortCode).append(accountNumber).toString(); // } // // private String name; // private String accountNumber; // private String sortCode; // } // // Path: src/main/java/com/syndicapp/scraper/aib/model/PayeeList.java // public class PayeeList // { // // public PayeeList() // { // payees = new Vector<Payee>(); // } // // public void addPayee(Payee a) // { // payees.add(a); // } // // public Payee getPayeeByName(String name) // { // for(Iterator<Payee> itr = payees.iterator(); itr.hasNext();) // { // Payee p = (Payee)itr.next(); // if(p.getName().equalsIgnoreCase(name)) // return p; // } // // return null; // } // // private Vector<Payee> payees; // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/ManageMyPayeesPage.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.aib.model.Payee; import com.syndicapp.scraper.aib.model.PayeeList; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; // Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov Date: 17/03/2013 01:04:35 // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version! // Decompiler options: packimports(3) // Source File Name: ManageMyPayeesPage.java package com.syndicapp.scraper.aib; public class ManageMyPayeesPage extends FSSUserAgent { public ManageMyPayeesPage() { } public static HashMap click(String page, HashMap inputParams) throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("managemypayees.htm\" method=\"post\" ><input type=\"hidden\" name=\"transactionToken\" id=\"transactionToken\" value=\"(\\d+)\"/>"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/managemypayees.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("isFormButtonClicked", "true")); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("tabName", "Manage My Payees")); log.debug((new StringBuilder()).append("Clicking 'Transfers and Payments' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Add new payee")) throw new UnexpectedPageContentsException("Didn't get to the Manage My Payees Page!"); p = Pattern.compile("<td>(.*?)</td>\\s*<td>Personal payment</td>\\s*<td></td>\\s*<td>(.*?)</td>\\s*<td>(.*?)</td>"); PayeeList pl = new PayeeList();
for(Matcher m = p.matcher(page); m.find(); pl.addPayee(new Payee(m.group(1), m.group(3), m.group(2))));
owenobyrne/aib-internet-banking-api
src/main/java/com/syndicapp/scraper/aib/TransferToAnotherROIAccountStep1.java
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // }
import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger;
throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_target1\" value=\"true\"/>\\s*<input id=\"nextButton"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); String ccAccounts = null; p = Pattern.compile("<input type=\"hidden\" name=\"ccAccounts\" value=\"(.*?)\"/>"); for(Matcher m = p.matcher(page); m.find();) ccAccounts = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/fundstransferroi.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("ccAccounts", ccAccounts)); nvps.add(new BasicNameValuePair("senderAccountIndex", (String)inputParams.get("fromAccountId"))); nvps.add(new BasicNameValuePair("senderReference", (String)inputParams.get("senderReference"))); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("_target1:", "true")); nvps.add(new BasicNameValuePair("_target1.x", "21")); nvps.add(new BasicNameValuePair("_target1.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Transfer to Another ROI Account Step 1' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Do you wish to use previously saved details or make a new payment?")) {
// Path: src/main/java/com/syndicapp/scraper/FSSUserAgent.java // public class FSSUserAgent { // public static HttpClient httpclient = HttpClientBuilder.create().build(); // public static Logger log = Logger.getLogger(FSSUserAgent.class); // public static BasicHttpContext context = new BasicHttpContext(); // // public FSSUserAgent() { // } // // // } // // Path: src/main/java/com/syndicapp/scraper/exception/UnexpectedPageContentsException.java // public class UnexpectedPageContentsException extends Exception // { // // public UnexpectedPageContentsException(String s) // { // super(s); // } // // private static final long serialVersionUID = 0xf57ed4fa93f8378aL; // } // Path: src/main/java/com/syndicapp/scraper/aib/TransferToAnotherROIAccountStep1.java import com.syndicapp.scraper.FSSUserAgent; import com.syndicapp.scraper.exception.UnexpectedPageContentsException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.apache.log4j.Logger; throws Exception { HashMap outputParams = new HashMap(); String transactionToken = null; Pattern p = Pattern.compile("transactionToken\" value=\"(\\d+)\"/>\\s*<input type=\"hidden\" name=\"iBankFormSubmission\" value=\"true\" />\\s*<input type=\"hidden\" name=\"_target1\" value=\"true\"/>\\s*<input id=\"nextButton"); for(Matcher m = p.matcher(page); m.find();) transactionToken = m.group(1); String ccAccounts = null; p = Pattern.compile("<input type=\"hidden\" name=\"ccAccounts\" value=\"(.*?)\"/>"); for(Matcher m = p.matcher(page); m.find();) ccAccounts = m.group(1); HttpPost httppost = new HttpPost("https://aibinternetbanking.aib.ie/inet/roi/fundstransferroi.htm"); List nvps = new ArrayList(); nvps.add(new BasicNameValuePair("transactionToken", transactionToken)); nvps.add(new BasicNameValuePair("ccAccounts", ccAccounts)); nvps.add(new BasicNameValuePair("senderAccountIndex", (String)inputParams.get("fromAccountId"))); nvps.add(new BasicNameValuePair("senderReference", (String)inputParams.get("senderReference"))); nvps.add(new BasicNameValuePair("iBankFormSubmission", "true")); nvps.add(new BasicNameValuePair("_target1:", "true")); nvps.add(new BasicNameValuePair("_target1.x", "21")); nvps.add(new BasicNameValuePair("_target1.y", "15")); log.debug((new StringBuilder()).append("Clicking 'Transfer to Another ROI Account Step 1' with ").append(nvps.toString()).toString()); httppost.setEntity(new UrlEncodedFormEntity(nvps, "ISO-8859-1")); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); page = EntityUtils.toString(entity); if(!page.contains("Do you wish to use previously saved details or make a new payment?")) {
throw new UnexpectedPageContentsException("Didn't get to the Transfer to Another ROI Account Step 1 Page!");
wangchongjie/multi-task
src/test/java/com/baidu/unbiz/multitask/service/ExplicitDefTask.java
// Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // }
import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Service; import com.baidu.unbiz.multitask.task.Taskable; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem;
package com.baidu.unbiz.multitask.service; /** * Created by wangchongjie on 15/12/21. */ @Service public class ExplicitDefTask implements Taskable<List<DeviceViewItem>> { public <E> List<DeviceViewItem> work(E request) {
// Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // } // Path: src/test/java/com/baidu/unbiz/multitask/service/ExplicitDefTask.java import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Service; import com.baidu.unbiz.multitask.task.Taskable; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem; package com.baidu.unbiz.multitask.service; /** * Created by wangchongjie on 15/12/21. */ @Service public class ExplicitDefTask implements Taskable<List<DeviceViewItem>> { public <E> List<DeviceViewItem> work(E request) {
if (request instanceof DeviceRequest) {
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/spring/integration/TaskBeanContainer.java
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // }
import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.support.AbstractBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.PriorityOrdered; import org.springframework.stereotype.Component; import org.springframework.util.ReflectionUtils; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.TaskBizException; import com.baidu.unbiz.multitask.task.Taskable;
package com.baidu.unbiz.multitask.spring.integration; /** * Fetcher Bean容器,与spring集成 * * @author wangchongjie * @since 2015-8-9 下午2:18:00 */ @Component public class TaskBeanContainer implements ApplicationContextAware, PriorityOrdered { private static final Log LOG = LogFactory.getLog(TaskBeanContainer.class); // Spring应用上下文环境 private static ApplicationContext applicationContext;
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // } // Path: src/main/java/com/baidu/unbiz/multitask/spring/integration/TaskBeanContainer.java import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.support.AbstractBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.PriorityOrdered; import org.springframework.stereotype.Component; import org.springframework.util.ReflectionUtils; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.TaskBizException; import com.baidu.unbiz.multitask.task.Taskable; package com.baidu.unbiz.multitask.spring.integration; /** * Fetcher Bean容器,与spring集成 * * @author wangchongjie * @since 2015-8-9 下午2:18:00 */ @Component public class TaskBeanContainer implements ApplicationContextAware, PriorityOrdered { private static final Log LOG = LogFactory.getLog(TaskBeanContainer.class); // Spring应用上下文环境 private static ApplicationContext applicationContext;
private static Map<String, Taskable<?>> container = new ConcurrentHashMap<String, Taskable<?>>();
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/spring/integration/TaskBeanContainer.java
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // }
import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.support.AbstractBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.PriorityOrdered; import org.springframework.stereotype.Component; import org.springframework.util.ReflectionUtils; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.TaskBizException; import com.baidu.unbiz.multitask.task.Taskable;
/** * 优先使用@Resource方式注入,此处为预留接口,也可获取Fetcher Bean * * @param beanName * * @return bean */ @SuppressWarnings("unchecked") public <T> T bean(String beanName) { T bean = (T) container.get(beanName); if (bean != null) { return bean; } else { return (T) TaskBeanContainer.getBean(beanName); } } public Taskable<?> task(String beanName) { return bean(beanName); } /** * 注册一个Fetcher * * @param service * @param method * @param beanName */ private static void registerFetcher(final Object service, final Method method, final String beanName) { if (TaskBeanContainer.containsBean(beanName)) {
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // } // Path: src/main/java/com/baidu/unbiz/multitask/spring/integration/TaskBeanContainer.java import java.lang.reflect.Method; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.ListableBeanFactory; import org.springframework.beans.factory.support.AbstractBeanFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.PriorityOrdered; import org.springframework.stereotype.Component; import org.springframework.util.ReflectionUtils; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.TaskBizException; import com.baidu.unbiz.multitask.task.Taskable; /** * 优先使用@Resource方式注入,此处为预留接口,也可获取Fetcher Bean * * @param beanName * * @return bean */ @SuppressWarnings("unchecked") public <T> T bean(String beanName) { T bean = (T) container.get(beanName); if (bean != null) { return bean; } else { return (T) TaskBeanContainer.getBean(beanName); } } public Taskable<?> task(String beanName) { return bean(beanName); } /** * 注册一个Fetcher * * @param service * @param method * @param beanName */ private static void registerFetcher(final Object service, final Method method, final String beanName) { if (TaskBeanContainer.containsBean(beanName)) {
throw new TaskBizException("Fetcher bean duplicate for Spring:" + beanName);
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/thread/TaskManager.java
// Path: src/main/java/com/baidu/unbiz/multitask/constants/DefaultThreadPoolConfig.java // public class DefaultThreadPoolConfig implements ThreadPoolConfig { // // public int coreTaskNum() { // return CORE_TASK_NUM; // } // // public int maxTaskNum() { // return MAX_TASK_NUM; // } // // public int maxCacheTaskNum() { // return MAX_CACHE_TASK_NUM; // } // // public int queueFullSleepTime() { // return QUEUE_FULL_SLEEP_TIME; // } // // public long taskTimeoutMillSeconds() { // return TASK_TIMEOUT_MILL_SECONDS; // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/constants/ThreadPoolConfig.java // public interface ThreadPoolConfig extends TaskConfig { // // long taskTimeoutMillSeconds(); // int queueFullSleepTime(); // int maxCacheTaskNum(); // int coreTaskNum(); // int maxTaskNum(); // }
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.scheduling.concurrent.CustomizableThreadFactory; import com.baidu.unbiz.multitask.constants.DefaultThreadPoolConfig; import com.baidu.unbiz.multitask.constants.ThreadPoolConfig;
package com.baidu.unbiz.multitask.task.thread; /** * 报表可并行处理的任务管理器 * * @author wangchongjie * @since 2015-11-21 下午7:57:37 */ public class TaskManager { private static final Log LOG = LogFactory.getLog(TaskManager.class);
// Path: src/main/java/com/baidu/unbiz/multitask/constants/DefaultThreadPoolConfig.java // public class DefaultThreadPoolConfig implements ThreadPoolConfig { // // public int coreTaskNum() { // return CORE_TASK_NUM; // } // // public int maxTaskNum() { // return MAX_TASK_NUM; // } // // public int maxCacheTaskNum() { // return MAX_CACHE_TASK_NUM; // } // // public int queueFullSleepTime() { // return QUEUE_FULL_SLEEP_TIME; // } // // public long taskTimeoutMillSeconds() { // return TASK_TIMEOUT_MILL_SECONDS; // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/constants/ThreadPoolConfig.java // public interface ThreadPoolConfig extends TaskConfig { // // long taskTimeoutMillSeconds(); // int queueFullSleepTime(); // int maxCacheTaskNum(); // int coreTaskNum(); // int maxTaskNum(); // } // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/TaskManager.java import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.scheduling.concurrent.CustomizableThreadFactory; import com.baidu.unbiz.multitask.constants.DefaultThreadPoolConfig; import com.baidu.unbiz.multitask.constants.ThreadPoolConfig; package com.baidu.unbiz.multitask.task.thread; /** * 报表可并行处理的任务管理器 * * @author wangchongjie * @since 2015-11-21 下午7:57:37 */ public class TaskManager { private static final Log LOG = LogFactory.getLog(TaskManager.class);
private static volatile ThreadPoolConfig config = new DefaultThreadPoolConfig();
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/thread/TaskManager.java
// Path: src/main/java/com/baidu/unbiz/multitask/constants/DefaultThreadPoolConfig.java // public class DefaultThreadPoolConfig implements ThreadPoolConfig { // // public int coreTaskNum() { // return CORE_TASK_NUM; // } // // public int maxTaskNum() { // return MAX_TASK_NUM; // } // // public int maxCacheTaskNum() { // return MAX_CACHE_TASK_NUM; // } // // public int queueFullSleepTime() { // return QUEUE_FULL_SLEEP_TIME; // } // // public long taskTimeoutMillSeconds() { // return TASK_TIMEOUT_MILL_SECONDS; // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/constants/ThreadPoolConfig.java // public interface ThreadPoolConfig extends TaskConfig { // // long taskTimeoutMillSeconds(); // int queueFullSleepTime(); // int maxCacheTaskNum(); // int coreTaskNum(); // int maxTaskNum(); // }
import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.scheduling.concurrent.CustomizableThreadFactory; import com.baidu.unbiz.multitask.constants.DefaultThreadPoolConfig; import com.baidu.unbiz.multitask.constants.ThreadPoolConfig;
package com.baidu.unbiz.multitask.task.thread; /** * 报表可并行处理的任务管理器 * * @author wangchongjie * @since 2015-11-21 下午7:57:37 */ public class TaskManager { private static final Log LOG = LogFactory.getLog(TaskManager.class);
// Path: src/main/java/com/baidu/unbiz/multitask/constants/DefaultThreadPoolConfig.java // public class DefaultThreadPoolConfig implements ThreadPoolConfig { // // public int coreTaskNum() { // return CORE_TASK_NUM; // } // // public int maxTaskNum() { // return MAX_TASK_NUM; // } // // public int maxCacheTaskNum() { // return MAX_CACHE_TASK_NUM; // } // // public int queueFullSleepTime() { // return QUEUE_FULL_SLEEP_TIME; // } // // public long taskTimeoutMillSeconds() { // return TASK_TIMEOUT_MILL_SECONDS; // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/constants/ThreadPoolConfig.java // public interface ThreadPoolConfig extends TaskConfig { // // long taskTimeoutMillSeconds(); // int queueFullSleepTime(); // int maxCacheTaskNum(); // int coreTaskNum(); // int maxTaskNum(); // } // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/TaskManager.java import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.Executor; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.scheduling.concurrent.CustomizableThreadFactory; import com.baidu.unbiz.multitask.constants.DefaultThreadPoolConfig; import com.baidu.unbiz.multitask.constants.ThreadPoolConfig; package com.baidu.unbiz.multitask.task.thread; /** * 报表可并行处理的任务管理器 * * @author wangchongjie * @since 2015-11-21 下午7:57:37 */ public class TaskManager { private static final Log LOG = LogFactory.getLog(TaskManager.class);
private static volatile ThreadPoolConfig config = new DefaultThreadPoolConfig();
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/utils/AssistUtils.java
// Path: src/main/java/com/baidu/unbiz/multitask/constants/TaskConfig.java // public interface TaskConfig { // // long TASK_TIMEOUT_MILL_SECONDS = 15 * 1000L; // int QUEUE_FULL_SLEEP_TIME = 20; // int MAX_CACHE_TASK_NUM = 2; // int CORE_TASK_NUM = Math.min(15, Runtime.getRuntime().availableProcessors()); // int MAX_TASK_NUM = Math.max(20, Runtime.getRuntime().availableProcessors()); // // char TASKNAME_SEPARATOR = '#'; // long NOT_LIMIT = -1; // }
import com.baidu.unbiz.multitask.constants.TaskConfig;
package com.baidu.unbiz.multitask.utils; /** * Created by wangchongjie on 15/12/21. */ public class AssistUtils { /** * 去除taskBean中的版本标识 * * @param taskBean * @return */ public static String removeTaskVersion(String taskBean) {
// Path: src/main/java/com/baidu/unbiz/multitask/constants/TaskConfig.java // public interface TaskConfig { // // long TASK_TIMEOUT_MILL_SECONDS = 15 * 1000L; // int QUEUE_FULL_SLEEP_TIME = 20; // int MAX_CACHE_TASK_NUM = 2; // int CORE_TASK_NUM = Math.min(15, Runtime.getRuntime().availableProcessors()); // int MAX_TASK_NUM = Math.max(20, Runtime.getRuntime().availableProcessors()); // // char TASKNAME_SEPARATOR = '#'; // long NOT_LIMIT = -1; // } // Path: src/main/java/com/baidu/unbiz/multitask/utils/AssistUtils.java import com.baidu.unbiz.multitask.constants.TaskConfig; package com.baidu.unbiz.multitask.utils; /** * Created by wangchongjie on 15/12/21. */ public class AssistUtils { /** * 去除taskBean中的版本标识 * * @param taskBean * @return */ public static String removeTaskVersion(String taskBean) {
return taskBean.replaceAll(TaskConfig.TASKNAME_SEPARATOR + ".*", "");
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/ParallelExePool.java
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/forkjoin/ForkJoin.java // public interface ForkJoin<PARAM, RESULT> { // // List<PARAM> fork(PARAM param); // RESULT join(List<RESULT> results); // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // }
import java.util.List; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.forkjoin.ForkJoin; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult;
package com.baidu.unbiz.multitask.task; /** * 任务并行执行资源池,提供资源和计算模型的封装等 */ public interface ParallelExePool { String TASK_PAIRS = "taskPairs";
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/forkjoin/ForkJoin.java // public interface ForkJoin<PARAM, RESULT> { // // List<PARAM> fork(PARAM param); // RESULT join(List<RESULT> results); // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // } // Path: src/main/java/com/baidu/unbiz/multitask/task/ParallelExePool.java import java.util.List; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.forkjoin.ForkJoin; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult; package com.baidu.unbiz.multitask.task; /** * 任务并行执行资源池,提供资源和计算模型的封装等 */ public interface ParallelExePool { String TASK_PAIRS = "taskPairs";
MultiResult submit(List<TaskPair> taskPairs);
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/ParallelExePool.java
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/forkjoin/ForkJoin.java // public interface ForkJoin<PARAM, RESULT> { // // List<PARAM> fork(PARAM param); // RESULT join(List<RESULT> results); // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // }
import java.util.List; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.forkjoin.ForkJoin; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult;
package com.baidu.unbiz.multitask.task; /** * 任务并行执行资源池,提供资源和计算模型的封装等 */ public interface ParallelExePool { String TASK_PAIRS = "taskPairs";
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/forkjoin/ForkJoin.java // public interface ForkJoin<PARAM, RESULT> { // // List<PARAM> fork(PARAM param); // RESULT join(List<RESULT> results); // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // } // Path: src/main/java/com/baidu/unbiz/multitask/task/ParallelExePool.java import java.util.List; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.forkjoin.ForkJoin; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult; package com.baidu.unbiz.multitask.task; /** * 任务并行执行资源池,提供资源和计算模型的封装等 */ public interface ParallelExePool { String TASK_PAIRS = "taskPairs";
MultiResult submit(List<TaskPair> taskPairs);
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/ParallelExePool.java
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/forkjoin/ForkJoin.java // public interface ForkJoin<PARAM, RESULT> { // // List<PARAM> fork(PARAM param); // RESULT join(List<RESULT> results); // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // }
import java.util.List; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.forkjoin.ForkJoin; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult;
package com.baidu.unbiz.multitask.task; /** * 任务并行执行资源池,提供资源和计算模型的封装等 */ public interface ParallelExePool { String TASK_PAIRS = "taskPairs"; MultiResult submit(List<TaskPair> taskPairs); MultiResult submit(TaskPair... taskPairs);
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/forkjoin/ForkJoin.java // public interface ForkJoin<PARAM, RESULT> { // // List<PARAM> fork(PARAM param); // RESULT join(List<RESULT> results); // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // } // Path: src/main/java/com/baidu/unbiz/multitask/task/ParallelExePool.java import java.util.List; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.forkjoin.ForkJoin; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult; package com.baidu.unbiz.multitask.task; /** * 任务并行执行资源池,提供资源和计算模型的封装等 */ public interface ParallelExePool { String TASK_PAIRS = "taskPairs"; MultiResult submit(List<TaskPair> taskPairs); MultiResult submit(TaskPair... taskPairs);
MultiResult submit(ExecutePolicy policy, TaskPair... taskPairs);
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/ParallelExePool.java
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/forkjoin/ForkJoin.java // public interface ForkJoin<PARAM, RESULT> { // // List<PARAM> fork(PARAM param); // RESULT join(List<RESULT> results); // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // }
import java.util.List; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.forkjoin.ForkJoin; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult;
package com.baidu.unbiz.multitask.task; /** * 任务并行执行资源池,提供资源和计算模型的封装等 */ public interface ParallelExePool { String TASK_PAIRS = "taskPairs"; MultiResult submit(List<TaskPair> taskPairs); MultiResult submit(TaskPair... taskPairs); MultiResult submit(ExecutePolicy policy, TaskPair... taskPairs);
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/forkjoin/ForkJoin.java // public interface ForkJoin<PARAM, RESULT> { // // List<PARAM> fork(PARAM param); // RESULT join(List<RESULT> results); // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // } // Path: src/main/java/com/baidu/unbiz/multitask/task/ParallelExePool.java import java.util.List; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.forkjoin.ForkJoin; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult; package com.baidu.unbiz.multitask.task; /** * 任务并行执行资源池,提供资源和计算模型的封装等 */ public interface ParallelExePool { String TASK_PAIRS = "taskPairs"; MultiResult submit(List<TaskPair> taskPairs); MultiResult submit(TaskPair... taskPairs); MultiResult submit(ExecutePolicy policy, TaskPair... taskPairs);
<PARAM, RESULT> RESULT submit(TaskPair taskPair, ForkJoin<PARAM, RESULT> forkJoin);
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/spring/integration/TaskBeanHelper.java
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // }
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.baidu.unbiz.multitask.exception.TaskBizException; import com.baidu.unbiz.multitask.task.Taskable;
package com.baidu.unbiz.multitask.spring.integration; /** * Created by wangchongjie on 15/12/25. */ public class TaskBeanHelper { private static final Log LOG = LogFactory.getLog(TaskBeanHelper.class); private static final int NORMAL_PARAM_LENTH = 1; /** * 经带多个参数的方法,包装成Fetcher * * @param service * @param method * @param beanName * @param paramLen * * @return Fetcher */
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // } // Path: src/main/java/com/baidu/unbiz/multitask/spring/integration/TaskBeanHelper.java import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.baidu.unbiz.multitask.exception.TaskBizException; import com.baidu.unbiz.multitask.task.Taskable; package com.baidu.unbiz.multitask.spring.integration; /** * Created by wangchongjie on 15/12/25. */ public class TaskBeanHelper { private static final Log LOG = LogFactory.getLog(TaskBeanHelper.class); private static final int NORMAL_PARAM_LENTH = 1; /** * 经带多个参数的方法,包装成Fetcher * * @param service * @param method * @param beanName * @param paramLen * * @return Fetcher */
public static Taskable<?> newFetcher(final Object service, final Method method, final String beanName,
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/spring/integration/TaskBeanHelper.java
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // }
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.baidu.unbiz.multitask.exception.TaskBizException; import com.baidu.unbiz.multitask.task.Taskable;
public <E> Object work(E request) { return invokeMethod(service, method, beanName, NORMAL_PARAM_LENTH, request); } }; } private static <E> Object invokeMethod(final Object service, final Method method, final String beanName, final int paramLen, E request) { String logFormat = "Fail to run task bean: %s"; Exception ex = null; try { return TaskBeanHelper.invokeMethod(service, method, request, paramLen); } catch (IllegalArgumentException e) { ex = e; } catch (IllegalAccessException e) { ex = e; } catch (InvocationTargetException e) { LOG.error(String.format(logFormat, beanName), e); // 该类异常通常为业务异常导致,需获取原始原因并上抛 Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { ex = e; } } catch (Exception e) { ex = e; } // 执行到此处,则说明发生异常 LOG.error(String.format(logFormat, beanName), ex);
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/Taskable.java // public interface Taskable<T> { // // /** // * 执行数据获取 // * // * @param request // * @return 返回结果 // * @since 2015-7-3 by wangchongjie // */ // <E> T work(E request); // // } // Path: src/main/java/com/baidu/unbiz/multitask/spring/integration/TaskBeanHelper.java import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.baidu.unbiz.multitask.exception.TaskBizException; import com.baidu.unbiz.multitask.task.Taskable; public <E> Object work(E request) { return invokeMethod(service, method, beanName, NORMAL_PARAM_LENTH, request); } }; } private static <E> Object invokeMethod(final Object service, final Method method, final String beanName, final int paramLen, E request) { String logFormat = "Fail to run task bean: %s"; Exception ex = null; try { return TaskBeanHelper.invokeMethod(service, method, request, paramLen); } catch (IllegalArgumentException e) { ex = e; } catch (IllegalAccessException e) { ex = e; } catch (InvocationTargetException e) { LOG.error(String.format(logFormat, beanName), e); // 该类异常通常为业务异常导致,需获取原始原因并上抛 Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { ex = e; } } catch (Exception e) { ex = e; } // 执行到此处,则说明发生异常 LOG.error(String.format(logFormat, beanName), ex);
throw new TaskBizException(String.format(logFormat, beanName), ex);
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/CustomizedParallelExePool.java
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // }
import java.util.concurrent.Executor; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult;
package com.baidu.unbiz.multitask.task; public interface CustomizedParallelExePool extends ParallelExePool { MultiResult submit(Executor executor, TaskPair... taskPairs);
// Path: src/main/java/com/baidu/unbiz/multitask/common/TaskPair.java // public class TaskPair extends Pair<String, Object> { // // public TaskPair() { // } // // public TaskPair(String taskName, Object param) { // this.field1 = taskName; // this.field2 = param; // } // // public TaskPair wrap(String taskName, Object param) { // return new TaskPair(taskName, param); // } // } // // Path: src/main/java/com/baidu/unbiz/multitask/policy/ExecutePolicy.java // public interface ExecutePolicy { // /** // * @return 任务超时时间,单位毫秒 // */ // long taskTimeout(); // } // // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/MultiResult.java // public interface MultiResult { // // /** // * 结果数据存储 // * // * @param key // * @param value // */ // <E> void putResult(String key, E value); // // /** // * 获取并行执行的数据结果 // * // * @param taskName // * // * @return fetcher对应的数据结果 // */ // <E> E getResult(String taskName); // // /** // * 获取所有结果 // * // * @return 所有并行结果 // */ // Map<String, Object> getResult(); // // /** // * 资源清理,尽早释放,非必须 // */ // void clean(); // // } // Path: src/main/java/com/baidu/unbiz/multitask/task/CustomizedParallelExePool.java import java.util.concurrent.Executor; import com.baidu.unbiz.multitask.common.TaskPair; import com.baidu.unbiz.multitask.policy.ExecutePolicy; import com.baidu.unbiz.multitask.task.thread.MultiResult; package com.baidu.unbiz.multitask.task; public interface CustomizedParallelExePool extends ParallelExePool { MultiResult submit(Executor executor, TaskPair... taskPairs);
MultiResult submit(Executor executor, ExecutePolicy policy, TaskPair... taskPairs);
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/thread/TaskContext.java
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // }
import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.baidu.unbiz.multitask.exception.TaskBizException;
package com.baidu.unbiz.multitask.task.thread; /** * 并行抓取上线文环境 * * @author wangchongjie * @since 2015-11-21 下午7:58:49 */ public class TaskContext implements MultiResult { private static final Log LOG = LogFactory.getLog(TaskContext.class); /** * 启用的ThreadLocal * 将在task执行时生效 */ private static Set<ThreadLocal> threadLocalSet = new HashSet<ThreadLocal>(); /** * 一组结果数据仓库 */ private Map<String, Object> result = new ConcurrentHashMap<String, Object>(); /** * 一组结果Exception仓库 */ private Map<String, Exception> exception = new ConcurrentHashMap<String, Exception>(); /** * 启用ThreadLocal后,一组任务Task执行前的镜像值 */ private Map<ThreadLocal, Object> threadLocalValues = new HashMap<ThreadLocal, Object>(); /** * 执行环境上下文属性 */ private Map<String, Object> attribute = new ConcurrentHashMap<String, Object>(); /** * 结果数据存储 * * @param key * @param value */ public <E> void putResult(String key, E value) { if (value != null) { result.put(key, value); } } /** * 并行执行时上抛Exception * * @param key * @param value */ public void throwException(String key, Exception value) { exception.put(key, value); } /** * 获取并行执行的数据结果 * * @param taskName * * @return fetcher对应的数据结果 */ @SuppressWarnings("unchecked") public <E> E getResult(String taskName) { Exception ex = exception.get(taskName); if (ex != null) { LOG.error("Execute fail:", ex); if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } else {
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/TaskContext.java import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.baidu.unbiz.multitask.exception.TaskBizException; package com.baidu.unbiz.multitask.task.thread; /** * 并行抓取上线文环境 * * @author wangchongjie * @since 2015-11-21 下午7:58:49 */ public class TaskContext implements MultiResult { private static final Log LOG = LogFactory.getLog(TaskContext.class); /** * 启用的ThreadLocal * 将在task执行时生效 */ private static Set<ThreadLocal> threadLocalSet = new HashSet<ThreadLocal>(); /** * 一组结果数据仓库 */ private Map<String, Object> result = new ConcurrentHashMap<String, Object>(); /** * 一组结果Exception仓库 */ private Map<String, Exception> exception = new ConcurrentHashMap<String, Exception>(); /** * 启用ThreadLocal后,一组任务Task执行前的镜像值 */ private Map<ThreadLocal, Object> threadLocalValues = new HashMap<ThreadLocal, Object>(); /** * 执行环境上下文属性 */ private Map<String, Object> attribute = new ConcurrentHashMap<String, Object>(); /** * 结果数据存储 * * @param key * @param value */ public <E> void putResult(String key, E value) { if (value != null) { result.put(key, value); } } /** * 并行执行时上抛Exception * * @param key * @param value */ public void throwException(String key, Exception value) { exception.put(key, value); } /** * 获取并行执行的数据结果 * * @param taskName * * @return fetcher对应的数据结果 */ @SuppressWarnings("unchecked") public <E> E getResult(String taskName) { Exception ex = exception.get(taskName); if (ex != null) { LOG.error("Execute fail:", ex); if (ex instanceof RuntimeException) { throw (RuntimeException) ex; } else {
throw new TaskBizException(ex);
wangchongjie/multi-task
src/test/java/com/baidu/unbiz/multitask/service/DevicePlanStatServiceImpl.java
// Path: src/test/java/com/baidu/unbiz/multitask/exception/BusinessException.java // public class BusinessException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public BusinessException(String msg) { // super(msg); // } // // public BusinessException(Throwable cause) { // super(cause); // } // // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // }
import java.util.ArrayList; import java.util.List; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.BusinessException; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem;
package com.baidu.unbiz.multitask.service; /** * 该类会被并行组件监测到,并将其方法包装成可并行执行的Fetcher * */ @TaskService public class DevicePlanStatServiceImpl implements DevicePlanStatService { /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("deviceStatFetcher")
// Path: src/test/java/com/baidu/unbiz/multitask/exception/BusinessException.java // public class BusinessException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public BusinessException(String msg) { // super(msg); // } // // public BusinessException(Throwable cause) { // super(cause); // } // // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // } // Path: src/test/java/com/baidu/unbiz/multitask/service/DevicePlanStatServiceImpl.java import java.util.ArrayList; import java.util.List; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.BusinessException; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem; package com.baidu.unbiz.multitask.service; /** * 该类会被并行组件监测到,并将其方法包装成可并行执行的Fetcher * */ @TaskService public class DevicePlanStatServiceImpl implements DevicePlanStatService { /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("deviceStatFetcher")
public List<DeviceViewItem> queryPlanDeviceData(DeviceRequest req) {
wangchongjie/multi-task
src/test/java/com/baidu/unbiz/multitask/service/DevicePlanStatServiceImpl.java
// Path: src/test/java/com/baidu/unbiz/multitask/exception/BusinessException.java // public class BusinessException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public BusinessException(String msg) { // super(msg); // } // // public BusinessException(Throwable cause) { // super(cause); // } // // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // }
import java.util.ArrayList; import java.util.List; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.BusinessException; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem;
package com.baidu.unbiz.multitask.service; /** * 该类会被并行组件监测到,并将其方法包装成可并行执行的Fetcher * */ @TaskService public class DevicePlanStatServiceImpl implements DevicePlanStatService { /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("deviceStatFetcher")
// Path: src/test/java/com/baidu/unbiz/multitask/exception/BusinessException.java // public class BusinessException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public BusinessException(String msg) { // super(msg); // } // // public BusinessException(Throwable cause) { // super(cause); // } // // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // } // Path: src/test/java/com/baidu/unbiz/multitask/service/DevicePlanStatServiceImpl.java import java.util.ArrayList; import java.util.List; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.BusinessException; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem; package com.baidu.unbiz.multitask.service; /** * 该类会被并行组件监测到,并将其方法包装成可并行执行的Fetcher * */ @TaskService public class DevicePlanStatServiceImpl implements DevicePlanStatService { /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("deviceStatFetcher")
public List<DeviceViewItem> queryPlanDeviceData(DeviceRequest req) {
wangchongjie/multi-task
src/test/java/com/baidu/unbiz/multitask/service/DevicePlanStatServiceImpl.java
// Path: src/test/java/com/baidu/unbiz/multitask/exception/BusinessException.java // public class BusinessException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public BusinessException(String msg) { // super(msg); // } // // public BusinessException(Throwable cause) { // super(cause); // } // // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // }
import java.util.ArrayList; import java.util.List; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.BusinessException; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem;
package com.baidu.unbiz.multitask.service; /** * 该类会被并行组件监测到,并将其方法包装成可并行执行的Fetcher * */ @TaskService public class DevicePlanStatServiceImpl implements DevicePlanStatService { /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("deviceStatFetcher") public List<DeviceViewItem> queryPlanDeviceData(DeviceRequest req) { this.checkParam(req); // Test ThreadLocal System.out.println("MyThreadLocal:" + MyThreadLocal.get()); return this.mockList1(); } /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("deviceUvFetcher") public List<DeviceViewItem> queryPlanDeviceUvData(DeviceRequest req) { this.checkParam(req); return this.mockList2(); } /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("doSthVerySlowFetcher") public List<DeviceViewItem> queryPlanDeviceDataWithBadNetwork(DeviceRequest req) { try { Thread.sleep(900000L); } catch (InterruptedException e) { // do nothing, just for test } return this.mockList1(); } /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("doSthFailWithExceptionFetcher") public List<DeviceViewItem> queryPlanDeviceDataWithBusinessException(DeviceRequest req) {
// Path: src/test/java/com/baidu/unbiz/multitask/exception/BusinessException.java // public class BusinessException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public BusinessException(String msg) { // super(msg); // } // // public BusinessException(Throwable cause) { // super(cause); // } // // public BusinessException(String message, Throwable cause) { // super(message, cause); // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // } // Path: src/test/java/com/baidu/unbiz/multitask/service/DevicePlanStatServiceImpl.java import java.util.ArrayList; import java.util.List; import com.baidu.unbiz.multitask.annotation.TaskBean; import com.baidu.unbiz.multitask.annotation.TaskService; import com.baidu.unbiz.multitask.exception.BusinessException; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem; package com.baidu.unbiz.multitask.service; /** * 该类会被并行组件监测到,并将其方法包装成可并行执行的Fetcher * */ @TaskService public class DevicePlanStatServiceImpl implements DevicePlanStatService { /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("deviceStatFetcher") public List<DeviceViewItem> queryPlanDeviceData(DeviceRequest req) { this.checkParam(req); // Test ThreadLocal System.out.println("MyThreadLocal:" + MyThreadLocal.get()); return this.mockList1(); } /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("deviceUvFetcher") public List<DeviceViewItem> queryPlanDeviceUvData(DeviceRequest req) { this.checkParam(req); return this.mockList2(); } /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("doSthVerySlowFetcher") public List<DeviceViewItem> queryPlanDeviceDataWithBadNetwork(DeviceRequest req) { try { Thread.sleep(900000L); } catch (InterruptedException e) { // do nothing, just for test } return this.mockList1(); } /** * 并行组件会将该方法包装成一个可并行执行的Fetcher */ @TaskBean("doSthFailWithExceptionFetcher") public List<DeviceViewItem> queryPlanDeviceDataWithBusinessException(DeviceRequest req) {
throw new BusinessException("Some business com.baidu.unbiz.multitask.vo.exception, just for test!");
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/thread/WorkUnit.java
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskTimeoutException.java // public class TaskTimeoutException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskTimeoutException(String msg) { // super(msg); // } // // public TaskTimeoutException(Throwable cause) { // super(cause); // } // // public TaskTimeoutException(String message, Throwable cause) { // super(message, cause); // } // }
import java.util.Map; import java.util.concurrent.CompletionService; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.baidu.unbiz.multitask.exception.TaskTimeoutException;
package com.baidu.unbiz.multitask.task.thread; /** * 一组工作单元,可视为一组原子操作 * * @author wangchongjie * @since 2015-12-3 下午3:56:36 */ public class WorkUnit { private static final Log LOG = LogFactory.getLog(TaskManager.class); private CompletionService<Void> completion; private Map<Future<?>, Runnable> futureMap = new ConcurrentHashMap<Future<?>, Runnable>(); private int taskCount; private Thread parentThread; /** * 构造函数,线程池委托给调用方 * * @param pool */ public WorkUnit(Executor pool) { parentThread = Thread.currentThread(); completion = new ExecutorCompletionService<Void>(pool); } /** * 提交可并行的任务 * * @param runnable */ public void submit(Runnable runnable) { futureMap.put(completion.submit(runnable, null), runnable); taskCount++; } /** * 等待结果返回,带默认超时时间 */ public void waitForCompletion() { this.waitForCompletion(TaskManager.config().taskTimeoutMillSeconds()); } /** * 等待结果返回,显示指定超时时间,若超时则取消任务并释放资源 */ public void waitForCompletion(long timeoutMillSeconds) { for (int i = 0; i < taskCount; i++) { Future<Void> future; try { long timeout = timeoutMillSeconds > 0 ? timeoutMillSeconds : TaskManager.config().taskTimeoutMillSeconds(); future = completion.poll(timeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOG.error("wait for execute completion failed,e=" + e, e);
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskTimeoutException.java // public class TaskTimeoutException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskTimeoutException(String msg) { // super(msg); // } // // public TaskTimeoutException(Throwable cause) { // super(cause); // } // // public TaskTimeoutException(String message, Throwable cause) { // super(message, cause); // } // } // Path: src/main/java/com/baidu/unbiz/multitask/task/thread/WorkUnit.java import java.util.Map; import java.util.concurrent.CompletionService; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import com.baidu.unbiz.multitask.exception.TaskTimeoutException; package com.baidu.unbiz.multitask.task.thread; /** * 一组工作单元,可视为一组原子操作 * * @author wangchongjie * @since 2015-12-3 下午3:56:36 */ public class WorkUnit { private static final Log LOG = LogFactory.getLog(TaskManager.class); private CompletionService<Void> completion; private Map<Future<?>, Runnable> futureMap = new ConcurrentHashMap<Future<?>, Runnable>(); private int taskCount; private Thread parentThread; /** * 构造函数,线程池委托给调用方 * * @param pool */ public WorkUnit(Executor pool) { parentThread = Thread.currentThread(); completion = new ExecutorCompletionService<Void>(pool); } /** * 提交可并行的任务 * * @param runnable */ public void submit(Runnable runnable) { futureMap.put(completion.submit(runnable, null), runnable); taskCount++; } /** * 等待结果返回,带默认超时时间 */ public void waitForCompletion() { this.waitForCompletion(TaskManager.config().taskTimeoutMillSeconds()); } /** * 等待结果返回,显示指定超时时间,若超时则取消任务并释放资源 */ public void waitForCompletion(long timeoutMillSeconds) { for (int i = 0; i < taskCount; i++) { Future<Void> future; try { long timeout = timeoutMillSeconds > 0 ? timeoutMillSeconds : TaskManager.config().taskTimeoutMillSeconds(); future = completion.poll(timeout, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOG.error("wait for execute completion failed,e=" + e, e);
throw new TaskTimeoutException(e);
wangchongjie/multi-task
src/main/java/com/baidu/unbiz/multitask/task/Params.java
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // }
import com.baidu.unbiz.multitask.exception.TaskBizException;
package com.baidu.unbiz.multitask.task; /** * TaskBean执行参数辅助类 * * Created by baidu on 15/12/24. */ public class Params { private Object[] params; private int cursor = 0; private Params(int paramLength) { if (paramLength < 2) {
// Path: src/main/java/com/baidu/unbiz/multitask/exception/TaskBizException.java // public class TaskBizException extends RuntimeException { // // private static final long serialVersionUID = -7375423850222016116L; // // public TaskBizException(String msg) { // super(msg); // } // // public TaskBizException(Throwable cause) { // super(cause); // } // // public TaskBizException(String message, Throwable cause) { // super(message, cause); // } // } // Path: src/main/java/com/baidu/unbiz/multitask/task/Params.java import com.baidu.unbiz.multitask.exception.TaskBizException; package com.baidu.unbiz.multitask.task; /** * TaskBean执行参数辅助类 * * Created by baidu on 15/12/24. */ public class Params { private Object[] params; private int cursor = 0; private Params(int paramLength) { if (paramLength < 2) {
throw new TaskBizException(String.format("worng params length:%s", paramLength));
wangchongjie/multi-task
src/test/java/com/baidu/unbiz/multitask/service/SitePlanStatServiceImpl.java
// Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // }
import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Service; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem;
package com.baidu.unbiz.multitask.service; /** * Created by wangchongjie on 16/4/29. */ @Service public class SitePlanStatServiceImpl implements SitePlanStatService {
// Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // } // Path: src/test/java/com/baidu/unbiz/multitask/service/SitePlanStatServiceImpl.java import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Service; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem; package com.baidu.unbiz.multitask.service; /** * Created by wangchongjie on 16/4/29. */ @Service public class SitePlanStatServiceImpl implements SitePlanStatService {
public List<DeviceViewItem> queryPlanSiteData(DeviceRequest req) {
wangchongjie/multi-task
src/test/java/com/baidu/unbiz/multitask/service/SitePlanStatServiceImpl.java
// Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // }
import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Service; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem;
package com.baidu.unbiz.multitask.service; /** * Created by wangchongjie on 16/4/29. */ @Service public class SitePlanStatServiceImpl implements SitePlanStatService {
// Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceRequest.java // public class DeviceRequest { // // private List<Integer> deviceIds; // // public List<Integer> getDeviceIds() { // return deviceIds; // } // // public void setDeviceIds(List<Integer> deviceIds) { // this.deviceIds = deviceIds; // } // // public static DeviceRequest build(QueryParam target) { // DeviceRequest req = new DeviceRequest(); // // req.copyProperties(target); // return req; // } // } // // Path: src/test/java/com/baidu/unbiz/multitask/vo/DeviceViewItem.java // public class DeviceViewItem { // // private static final long serialVersionUID = 6132709579470894604L; // // private int planId; // // private String planName; // // private Integer deviceId; // // private String deviceName ; // // // getter and setter // public int getPlanId() { // return planId; // } // // public void setPlanId(int planId) { // this.planId = planId; // } // // public Integer getDeviceId() { // return deviceId; // } // // public void setDeviceId(Integer deviceId) { // this.deviceId = deviceId; // } // // public String getPlanName() { // return planName; // } // // public void setPlanName(String planName) { // this.planName = planName; // } // // public String getDeviceName() { // return deviceName; // } // // public void setDeviceName(String deviceName) { // this.deviceName = deviceName; // } // // public String toString() { // return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE); // } // // } // Path: src/test/java/com/baidu/unbiz/multitask/service/SitePlanStatServiceImpl.java import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Service; import com.baidu.unbiz.multitask.vo.DeviceRequest; import com.baidu.unbiz.multitask.vo.DeviceViewItem; package com.baidu.unbiz.multitask.service; /** * Created by wangchongjie on 16/4/29. */ @Service public class SitePlanStatServiceImpl implements SitePlanStatService {
public List<DeviceViewItem> queryPlanSiteData(DeviceRequest req) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAMES.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorAuthor.java // public class DisambiguationExtractorAuthor extends DisambiguationExtractor { // // public DisambiguationExtractorAuthor() {} // public DisambiguationExtractorAuthor( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, int authorIndex, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o, int authorIndex ) { // return extract( o, authorIndex, null ); // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorAuthor; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAMES extends DisambiguationExtractorAuthor { public EX_AUTH_FNAMES() { super(); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorAuthor.java // public class DisambiguationExtractorAuthor extends DisambiguationExtractor { // // public DisambiguationExtractorAuthor() {} // public DisambiguationExtractorAuthor( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, int authorIndex, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o, int authorIndex ) { // return extract( o, authorIndex, null ); // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAMES.java import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorAuthor; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAMES extends DisambiguationExtractorAuthor { public EX_AUTH_FNAMES() { super(); }
public EX_AUTH_FNAMES(PigNormalizer[] new_normalizers) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractor.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // }
import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractor { private final PigNormalizer normalizers[]; public DisambiguationExtractor(){ normalizers = new PigNormalizer[] {
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractor.java import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractor { private final PigNormalizer normalizers[]; public DisambiguationExtractor(){ normalizers = new PigNormalizer[] {
new DiacriticsRemover(),
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractor.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // }
import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractor { private final PigNormalizer normalizers[]; public DisambiguationExtractor(){ normalizers = new PigNormalizer[] { new DiacriticsRemover(),
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractor.java import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractor { private final PigNormalizer normalizers[]; public DisambiguationExtractor(){ normalizers = new PigNormalizer[] { new DiacriticsRemover(),
new ToLowerCase()
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractor.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // }
import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractor { private final PigNormalizer normalizers[]; public DisambiguationExtractor(){ normalizers = new PigNormalizer[] { new DiacriticsRemover(), new ToLowerCase() }; }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractor.java import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractor { private final PigNormalizer normalizers[]; public DisambiguationExtractor(){ normalizers = new PigNormalizer[] { new DiacriticsRemover(), new ToLowerCase() }; }
final ToHashCode tohashCode=new ToHashCode();
CeON/CoAnSys
deduplication-document/deduplication-document-impl/src/main/java/pl/edu/icm/coansys/deduplication/document/DuplicateWorkDetectMapService.java
// Path: deduplication-document/deduplication-document-impl/src/main/java/pl/edu/icm/coansys/deduplication/document/keygenerator/WorkKeyGenerator.java // public interface WorkKeyGenerator { // public String generateKey(DocumentProtos.DocumentMetadata doc); // }
import pl.edu.icm.coansys.deduplication.document.keygenerator.WorkKeyGenerator; import pl.edu.icm.coansys.models.DocumentProtos; import pl.edu.icm.coansys.models.DocumentProtos.DocumentWrapper; import java.io.IOException; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Writable; import org.apache.hadoop.mapreduce.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import pl.edu.icm.coansys.commons.java.DocumentWrapperUtils; import pl.edu.icm.coansys.commons.spring.DiMapService;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.deduplication.document; /** * * @author Łukasz Dumiszewski * */ @Service("duplicateWorkDetectMapService") public class DuplicateWorkDetectMapService implements DiMapService<Writable, BytesWritable, Text, BytesWritable> { @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(DuplicateWorkDetectMapService.class); @Autowired
// Path: deduplication-document/deduplication-document-impl/src/main/java/pl/edu/icm/coansys/deduplication/document/keygenerator/WorkKeyGenerator.java // public interface WorkKeyGenerator { // public String generateKey(DocumentProtos.DocumentMetadata doc); // } // Path: deduplication-document/deduplication-document-impl/src/main/java/pl/edu/icm/coansys/deduplication/document/DuplicateWorkDetectMapService.java import pl.edu.icm.coansys.deduplication.document.keygenerator.WorkKeyGenerator; import pl.edu.icm.coansys.models.DocumentProtos; import pl.edu.icm.coansys.models.DocumentProtos.DocumentWrapper; import java.io.IOException; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Writable; import org.apache.hadoop.mapreduce.Mapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import pl.edu.icm.coansys.commons.java.DocumentWrapperUtils; import pl.edu.icm.coansys.commons.spring.DiMapService; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.deduplication.document; /** * * @author Łukasz Dumiszewski * */ @Service("duplicateWorkDetectMapService") public class DuplicateWorkDetectMapService implements DiMapService<Writable, BytesWritable, Text, BytesWritable> { @SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(DuplicateWorkDetectMapService.class); @Autowired
private WorkKeyGenerator keyGen;
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/disambiguators/CosineSimilarity.java
// Path: commons/src/main/java/pl/edu/icm/coansys/commons/java/Pair.java // public class Pair<K,V> { // public Pair(K x, V y) { // this.x = x; // this.y = y; // } // // private K x; // private V y; // // public K getX() { // return x; // } // public void setX(K x) { // this.x = x; // } // public V getY() { // return y; // } // public void setY(V y) { // this.y = y; // } // // @Override // public int hashCode() { // int hash = 5; // hash = 23 * hash + Objects.hashCode(this.x); // hash = 23 * hash + Objects.hashCode(this.y); // return hash; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) { // return true; // } // if (obj == null) { // return false; // } // if (!( obj instanceof Pair )) { // return false; // } // final Pair<?, ?> other = (Pair<?, ?>) obj; // if (!Objects.equals(this.x, other.x)) { // return false; // } // if (!Objects.equals(this.y, other.y)) { // return false; // } // return true; // } // // // // // }
import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import pl.edu.icm.coansys.commons.java.Pair;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.disambiguators; /** * @author dtkaczyk, pdendek */ @SuppressWarnings("boxing") public class CosineSimilarity extends Disambiguator { public static class CosineSimilarityList {
// Path: commons/src/main/java/pl/edu/icm/coansys/commons/java/Pair.java // public class Pair<K,V> { // public Pair(K x, V y) { // this.x = x; // this.y = y; // } // // private K x; // private V y; // // public K getX() { // return x; // } // public void setX(K x) { // this.x = x; // } // public V getY() { // return y; // } // public void setY(V y) { // this.y = y; // } // // @Override // public int hashCode() { // int hash = 5; // hash = 23 * hash + Objects.hashCode(this.x); // hash = 23 * hash + Objects.hashCode(this.y); // return hash; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) { // return true; // } // if (obj == null) { // return false; // } // if (!( obj instanceof Pair )) { // return false; // } // final Pair<?, ?> other = (Pair<?, ?>) obj; // if (!Objects.equals(this.x, other.x)) { // return false; // } // if (!Objects.equals(this.y, other.y)) { // return false; // } // return true; // } // // // // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/disambiguators/CosineSimilarity.java import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import pl.edu.icm.coansys.commons.java.Pair; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.disambiguators; /** * @author dtkaczyk, pdendek */ @SuppressWarnings("boxing") public class CosineSimilarity extends Disambiguator { public static class CosineSimilarityList {
List<Pair<Integer, Integer>> counts;
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/pig/GenUUID.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/model/ContributorWithExtractedFeatures.java // public class ContributorWithExtractedFeatures implements Serializable{ // String docKey; // String contributorId; // Map<String,Collection<Integer>> metadata; // Integer surnameInt; // String surnameString; // boolean surnameNotNull; // // public ContributorWithExtractedFeatures(String docKey, String contributorId, Map<String, Collection<Integer>> metadata, Integer surnameInt, String surnameString, boolean surnameNotNull) { // this.docKey = docKey; // this.contributorId = contributorId; // this.metadata = metadata; // this.surnameInt = surnameInt; // this.surnameString = surnameString; // this.surnameNotNull = surnameNotNull; // } // // public String getDocKey() { // return docKey; // } // // public String getContributorId() { // return contributorId; // } // // public Map<String, Collection<Integer>> getMetadata() { // return metadata; // } // // public Integer getSurnameInt() { // return surnameInt; // } // // public String getSurnameString() { // return surnameString; // } // // public boolean isSurnameNotNull() { // return surnameNotNull; // } // // public Tuple asTuple(){ // Object[] to = new Object[] { docKey, contributorId, surnameInt, // hashMapToDataBag(), surnameString, isSurnameNotNull() }; // return TupleFactory.getInstance() // .newTuple(Arrays.asList(to)); // } // // private HashMap<Object,DataBag> hashMapToDataBag(){ // TupleFactory tf=TupleFactory.getInstance(); // HashMap<Object,DataBag> ret=new HashMap<>(); // for (Map.Entry<String,Collection<Integer>> entry:metadata.entrySet()){ // DataBag db = new DefaultDataBag(); // for (Integer i:entry.getValue()) { // db.add(tf.newTuple((Object) i)); // } // ret.put(entry.getKey(), db); // } // return ret; // // } // // // }
import pl.edu.icm.coansys.disambiguation.model.ContributorWithExtractedFeatures; import java.io.IOException; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.apache.pig.EvalFunc; import org.apache.pig.data.DataBag; import org.apache.pig.data.Tuple; import pl.edu.icm.coansys.disambiguation.idgenerators.IdGenerator; import pl.edu.icm.coansys.disambiguation.idgenerators.UuIdGenerator;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.pig; /** * @author pdendek * @author mwos */ public class GenUUID extends EvalFunc< String> { private IdGenerator idgenerator = new UuIdGenerator();
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/model/ContributorWithExtractedFeatures.java // public class ContributorWithExtractedFeatures implements Serializable{ // String docKey; // String contributorId; // Map<String,Collection<Integer>> metadata; // Integer surnameInt; // String surnameString; // boolean surnameNotNull; // // public ContributorWithExtractedFeatures(String docKey, String contributorId, Map<String, Collection<Integer>> metadata, Integer surnameInt, String surnameString, boolean surnameNotNull) { // this.docKey = docKey; // this.contributorId = contributorId; // this.metadata = metadata; // this.surnameInt = surnameInt; // this.surnameString = surnameString; // this.surnameNotNull = surnameNotNull; // } // // public String getDocKey() { // return docKey; // } // // public String getContributorId() { // return contributorId; // } // // public Map<String, Collection<Integer>> getMetadata() { // return metadata; // } // // public Integer getSurnameInt() { // return surnameInt; // } // // public String getSurnameString() { // return surnameString; // } // // public boolean isSurnameNotNull() { // return surnameNotNull; // } // // public Tuple asTuple(){ // Object[] to = new Object[] { docKey, contributorId, surnameInt, // hashMapToDataBag(), surnameString, isSurnameNotNull() }; // return TupleFactory.getInstance() // .newTuple(Arrays.asList(to)); // } // // private HashMap<Object,DataBag> hashMapToDataBag(){ // TupleFactory tf=TupleFactory.getInstance(); // HashMap<Object,DataBag> ret=new HashMap<>(); // for (Map.Entry<String,Collection<Integer>> entry:metadata.entrySet()){ // DataBag db = new DefaultDataBag(); // for (Integer i:entry.getValue()) { // db.add(tf.newTuple((Object) i)); // } // ret.put(entry.getKey(), db); // } // return ret; // // } // // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/pig/GenUUID.java import pl.edu.icm.coansys.disambiguation.model.ContributorWithExtractedFeatures; import java.io.IOException; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.apache.pig.EvalFunc; import org.apache.pig.data.DataBag; import org.apache.pig.data.Tuple; import pl.edu.icm.coansys.disambiguation.idgenerators.IdGenerator; import pl.edu.icm.coansys.disambiguation.idgenerators.UuIdGenerator; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.pig; /** * @author pdendek * @author mwos */ public class GenUUID extends EvalFunc< String> { private IdGenerator idgenerator = new UuIdGenerator();
public String exec(Collection<ContributorWithExtractedFeatures> cwe) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.Collection; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractorDocument extends DisambiguationExtractor { public DisambiguationExtractorDocument() {}
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java import java.util.Collection; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractorDocument extends DisambiguationExtractor { public DisambiguationExtractorDocument() {}
public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_TITLE.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; import pl.edu.icm.coansys.models.DocumentProtos.TextWithLanguage;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_TITLE extends DisambiguationExtractorDocument { public EX_TITLE() { super(); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_TITLE.java import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; import pl.edu.icm.coansys.models.DocumentProtos.TextWithLanguage; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_TITLE extends DisambiguationExtractorDocument { public EX_TITLE() { super(); }
public EX_TITLE(PigNormalizer[] new_normalizers) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_PERSON_ID_NOT_STATED.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorAuthor.java // public class DisambiguationExtractorAuthor extends DisambiguationExtractor { // // public DisambiguationExtractorAuthor() {} // public DisambiguationExtractorAuthor( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, int authorIndex, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o, int authorIndex ) { // return extract( o, authorIndex, null ); // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; import pl.edu.icm.coansys.models.DocumentProtos.KeyValue; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorAuthor; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_PERSON_ID_NOT_STATED extends DisambiguationExtractorAuthor { // put here id names which should not be extracted to disambiguation // e.g. "pbnPersonId" public static String SKIPPED_PERSON_ID_KIND[] = { "pbnPersonId", "orcidId" }; private Set<String> skip_id_set = new HashSet<String>( Arrays.asList(SKIPPED_PERSON_ID_KIND)); public EX_PERSON_ID_NOT_STATED() { super(); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorAuthor.java // public class DisambiguationExtractorAuthor extends DisambiguationExtractor { // // public DisambiguationExtractorAuthor() {} // public DisambiguationExtractorAuthor( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, int authorIndex, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o, int authorIndex ) { // return extract( o, authorIndex, null ); // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_PERSON_ID_NOT_STATED.java import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; import pl.edu.icm.coansys.models.DocumentProtos.KeyValue; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorAuthor; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_PERSON_ID_NOT_STATED extends DisambiguationExtractorAuthor { // put here id names which should not be extracted to disambiguation // e.g. "pbnPersonId" public static String SKIPPED_PERSON_ID_KIND[] = { "pbnPersonId", "orcidId" }; private Set<String> skip_id_set = new HashSet<String>( Arrays.asList(SKIPPED_PERSON_ID_KIND)); public EX_PERSON_ID_NOT_STATED() { super(); }
public EX_PERSON_ID_NOT_STATED(PigNormalizer[] new_normalizers) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAME_FST_LETTER.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // }
import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.FirstLetter; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAME_FST_LETTER extends EX_AUTH_FNAME { private static PigNormalizer[] new_normalizers = new PigNormalizer[] { new FirstLetter(),
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAME_FST_LETTER.java import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.FirstLetter; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAME_FST_LETTER extends EX_AUTH_FNAME { private static PigNormalizer[] new_normalizers = new PigNormalizer[] { new FirstLetter(),
new DiacriticsRemover(),
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAME_FST_LETTER.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // }
import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.FirstLetter; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAME_FST_LETTER extends EX_AUTH_FNAME { private static PigNormalizer[] new_normalizers = new PigNormalizer[] { new FirstLetter(), new DiacriticsRemover(),
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToHashCode.java // public class ToHashCode { // // public Integer normalize(String text) { // // if (text == null) { // return null; // } // // Integer tmp=null ; // boolean parsed=false; // try { // tmp=Integer.parseInt(text); // parsed=true; // } catch (Exception e){ // // } // // if (! parsed) { // tmp = text.hashCode(); // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAME_FST_LETTER.java import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.FirstLetter; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToHashCode; import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAME_FST_LETTER extends EX_AUTH_FNAME { private static PigNormalizer[] new_normalizers = new PigNormalizer[] { new FirstLetter(), new DiacriticsRemover(),
new ToLowerCase(),
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAMES_FST_LETTER.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // }
import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.FirstLetter; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAMES_FST_LETTER extends EX_AUTH_FNAMES { private static PigNormalizer[] new_normalizers = new PigNormalizer[] { new FirstLetter(),
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAMES_FST_LETTER.java import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.FirstLetter; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAMES_FST_LETTER extends EX_AUTH_FNAMES { private static PigNormalizer[] new_normalizers = new PigNormalizer[] { new FirstLetter(),
new DiacriticsRemover(),
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAMES_FST_LETTER.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // }
import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.FirstLetter; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAMES_FST_LETTER extends EX_AUTH_FNAMES { private static PigNormalizer[] new_normalizers = new PigNormalizer[] { new FirstLetter(), new DiacriticsRemover(),
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/ToLowerCase.java // public class ToLowerCase implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // if (tmp.isEmpty()) { // return null; // } // // tmp = tmp.toLowerCase(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAMES_FST_LETTER.java import pl.edu.icm.coansys.disambiguation.author.normalizers.ToLowerCase; import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.FirstLetter; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAMES_FST_LETTER extends EX_AUTH_FNAMES { private static PigNormalizer[] new_normalizers = new PigNormalizer[] { new FirstLetter(), new DiacriticsRemover(),
new ToLowerCase(),
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_YEAR.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.ArrayList; import java.util.Collection; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; // Do not use normalizers for this one! Look at the YearDisambiguator. public class EX_YEAR extends DisambiguationExtractorDocument { public EX_YEAR() { super(); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_YEAR.java import java.util.ArrayList; import java.util.Collection; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; // Do not use normalizers for this one! Look at the YearDisambiguator. public class EX_YEAR extends DisambiguationExtractorDocument { public EX_YEAR() { super(); }
public EX_YEAR(PigNormalizer[] new_normalizers) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_CLASSIFICATION_CODES.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.ClassifCode; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; import pl.edu.icm.coansys.models.DocumentProtos.KeywordsList;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_CLASSIFICATION_CODES extends DisambiguationExtractorDocument { public EX_CLASSIFICATION_CODES() { super(); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_CLASSIFICATION_CODES.java import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.ClassifCode; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; import pl.edu.icm.coansys.models.DocumentProtos.KeywordsList; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_CLASSIFICATION_CODES extends DisambiguationExtractorDocument { public EX_CLASSIFICATION_CODES() { super(); }
public EX_CLASSIFICATION_CODES(PigNormalizer[] new_normalizers) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_DOC_AUTHS_FNAME_FST_LETTER.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_DOC_AUTHS_FNAME_FST_LETTER extends DisambiguationExtractorDocument { public EX_DOC_AUTHS_FNAME_FST_LETTER() { super(); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_DOC_AUTHS_FNAME_FST_LETTER.java import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_DOC_AUTHS_FNAME_FST_LETTER extends DisambiguationExtractorDocument { public EX_DOC_AUTHS_FNAME_FST_LETTER() { super(); }
public EX_DOC_AUTHS_FNAME_FST_LETTER(PigNormalizer[] new_normalizers) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_DOC_AUTHS_FNAME_FST_LETTER.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_DOC_AUTHS_FNAME_FST_LETTER extends DisambiguationExtractorDocument { public EX_DOC_AUTHS_FNAME_FST_LETTER() { super(); } public EX_DOC_AUTHS_FNAME_FST_LETTER(PigNormalizer[] new_normalizers) { super(new_normalizers); } @Override public Collection<Integer> extract(Object o, String lang) { TupleFactory tf = TupleFactory.getInstance(); DocumentMetadata dm = (DocumentMetadata) o; ArrayList<Integer> ret=new ArrayList<Integer>(); for (Author a : dm.getBasicMetadata().getAuthorList()) { if (a == null) { continue; } String fname = a.getForenames(); if (fname == null || fname.isEmpty()) { continue; }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/DiacriticsRemover.java // public class DiacriticsRemover implements PigNormalizer { // // @Override // public String normalize(String text) { // // if (text == null) { // return null; // } // String tmp; // // if (text instanceof String) { // tmp = (String) text; // } else { // tmp = text.toString(); // } // // //alternative function: org.apache.commons.lang3.StringUtils.stripAccents(tmp); // tmp = pl.edu.icm.coansys.commons.java.DiacriticsRemover.removeDiacritics(tmp); // tmp = tmp.trim(); // // if (tmp.isEmpty()) { // return null; // } // // return tmp; // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_DOC_AUTHS_FNAME_FST_LETTER.java import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.DiacriticsRemover; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_DOC_AUTHS_FNAME_FST_LETTER extends DisambiguationExtractorDocument { public EX_DOC_AUTHS_FNAME_FST_LETTER() { super(); } public EX_DOC_AUTHS_FNAME_FST_LETTER(PigNormalizer[] new_normalizers) { super(new_normalizers); } @Override public Collection<Integer> extract(Object o, String lang) { TupleFactory tf = TupleFactory.getInstance(); DocumentMetadata dm = (DocumentMetadata) o; ArrayList<Integer> ret=new ArrayList<Integer>(); for (Author a : dm.getBasicMetadata().getAuthorList()) { if (a == null) { continue; } String fname = a.getForenames(); if (fname == null || fname.isEmpty()) { continue; }
Object normalized_fname = (new DiacriticsRemover())
CeON/CoAnSys
deduplication-document/deduplication-document-impl/src/test/java/pl/edu/icm/coansys/deduplication/document/DuplicatesDetectorBigTest.java
// Path: commons/src/main/java/pl/edu/icm/coansys/commons/java/Pair.java // public class Pair<K,V> { // public Pair(K x, V y) { // this.x = x; // this.y = y; // } // // private K x; // private V y; // // public K getX() { // return x; // } // public void setX(K x) { // this.x = x; // } // public V getY() { // return y; // } // public void setY(V y) { // this.y = y; // } // // @Override // public int hashCode() { // int hash = 5; // hash = 23 * hash + Objects.hashCode(this.x); // hash = 23 * hash + Objects.hashCode(this.y); // return hash; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) { // return true; // } // if (obj == null) { // return false; // } // if (!( obj instanceof Pair )) { // return false; // } // final Pair<?, ?> other = (Pair<?, ?>) obj; // if (!Objects.equals(this.x, other.x)) { // return false; // } // if (!Objects.equals(this.y, other.y)) { // return false; // } // return true; // } // // // // // }
import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.FalseFileFilter; import org.apache.commons.io.filefilter.RegexFileFilter; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.ToolRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import pl.edu.icm.coansys.commons.hadoop.SequenceFileUtils; import pl.edu.icm.coansys.commons.java.Pair; import pl.edu.icm.coansys.deduplication.document.tool.DuplicateGenerator;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.deduplication.document; public class DuplicatesDetectorBigTest { private static Logger log = LoggerFactory.getLogger(DuplicatesDetectorBigTest.class); private URL baseOutputUrl = this.getClass().getResource("/"); private String outputDir = baseOutputUrl.getPath() + "/bigTestOut"; @BeforeTest public void before() throws Exception{ URL inputSeqFileUrl = this.getClass().getResource("/test_input_yadda_2000.seq"); ToolRunner.run(new Configuration(), new DuplicateGenerator(), new String[]{inputSeqFileUrl.getFile(), this.getClass().getResource("/").getFile()}); FileUtils.deleteDirectory(new File(outputDir)); URL inputFileUrl = this.getClass().getResource("/generated/ambiguous-publications.seq"); ToolRunner.run(new Configuration(), new DuplicateWorkDetector(), new String[]{inputFileUrl.getPath(), outputDir}); } @AfterTest public void after() throws Exception{ FileUtils.deleteDirectory(new File(outputDir)); }
// Path: commons/src/main/java/pl/edu/icm/coansys/commons/java/Pair.java // public class Pair<K,V> { // public Pair(K x, V y) { // this.x = x; // this.y = y; // } // // private K x; // private V y; // // public K getX() { // return x; // } // public void setX(K x) { // this.x = x; // } // public V getY() { // return y; // } // public void setY(V y) { // this.y = y; // } // // @Override // public int hashCode() { // int hash = 5; // hash = 23 * hash + Objects.hashCode(this.x); // hash = 23 * hash + Objects.hashCode(this.y); // return hash; // } // // @Override // public boolean equals(Object obj) { // if (this == obj) { // return true; // } // if (obj == null) { // return false; // } // if (!( obj instanceof Pair )) { // return false; // } // final Pair<?, ?> other = (Pair<?, ?>) obj; // if (!Objects.equals(this.x, other.x)) { // return false; // } // if (!Objects.equals(this.y, other.y)) { // return false; // } // return true; // } // // // // // } // Path: deduplication-document/deduplication-document-impl/src/test/java/pl/edu/icm/coansys/deduplication/document/DuplicatesDetectorBigTest.java import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.commons.io.FileUtils; import org.apache.commons.io.filefilter.FalseFileFilter; import org.apache.commons.io.filefilter.RegexFileFilter; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.ToolRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; import pl.edu.icm.coansys.commons.hadoop.SequenceFileUtils; import pl.edu.icm.coansys.commons.java.Pair; import pl.edu.icm.coansys.deduplication.document.tool.DuplicateGenerator; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.deduplication.document; public class DuplicatesDetectorBigTest { private static Logger log = LoggerFactory.getLogger(DuplicatesDetectorBigTest.class); private URL baseOutputUrl = this.getClass().getResource("/"); private String outputDir = baseOutputUrl.getPath() + "/bigTestOut"; @BeforeTest public void before() throws Exception{ URL inputSeqFileUrl = this.getClass().getResource("/test_input_yadda_2000.seq"); ToolRunner.run(new Configuration(), new DuplicateGenerator(), new String[]{inputSeqFileUrl.getFile(), this.getClass().getResource("/").getFile()}); FileUtils.deleteDirectory(new File(outputDir)); URL inputFileUrl = this.getClass().getResource("/generated/ambiguous-publications.seq"); ToolRunner.run(new Configuration(), new DuplicateWorkDetector(), new String[]{inputFileUrl.getPath(), outputDir}); } @AfterTest public void after() throws Exception{ FileUtils.deleteDirectory(new File(outputDir)); }
public void addPairToHashMap(HashMap<String,Set<String>> map, Pair<String,String> p) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorAuthor.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.Collection; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractorAuthor extends DisambiguationExtractor { public DisambiguationExtractorAuthor() {}
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorAuthor.java import java.util.Collection; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators; public class DisambiguationExtractorAuthor extends DisambiguationExtractor { public DisambiguationExtractorAuthor() {}
public DisambiguationExtractorAuthor( PigNormalizer[] new_normalizers ) {
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAME.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorAuthor.java // public class DisambiguationExtractorAuthor extends DisambiguationExtractor { // // public DisambiguationExtractorAuthor() {} // public DisambiguationExtractorAuthor( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, int authorIndex, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o, int authorIndex ) { // return extract( o, authorIndex, null ); // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorAuthor; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAME extends DisambiguationExtractorAuthor { public EX_AUTH_FNAME() { super(); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorAuthor.java // public class DisambiguationExtractorAuthor extends DisambiguationExtractor { // // public DisambiguationExtractorAuthor() {} // public DisambiguationExtractorAuthor( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, int authorIndex, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o, int authorIndex ) { // return extract( o, authorIndex, null ); // } // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_AUTH_FNAME.java import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorAuthor; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_AUTH_FNAME extends DisambiguationExtractorAuthor { public EX_AUTH_FNAME() { super(); }
public EX_AUTH_FNAME(PigNormalizer[] new_normalizers) {
CeON/CoAnSys
deduplication-document/deduplication-document-impl/src/main/java/pl/edu/icm/coansys/deduplication/document/DuplicateWorkDetectReduceService.java
// Path: deduplication-document/deduplication-document-impl/src/main/java/pl/edu/icm/coansys/deduplication/document/keygenerator/WorkKeyGenerator.java // public interface WorkKeyGenerator { // public String generateKey(DocumentProtos.DocumentMetadata doc); // }
import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import pl.edu.icm.coansys.commons.spring.DiReduceService; import pl.edu.icm.coansys.deduplication.document.keygenerator.WorkKeyGenerator; import pl.edu.icm.coansys.models.DocumentProtos;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.deduplication.document; /** * * @author Łukasz Dumiszewski * */ @Service("duplicateWorkDetectReduceService") public class DuplicateWorkDetectReduceService implements DiReduceService<Text, BytesWritable, Text, Text> { //@SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(DuplicateWorkDetectReduceService.class); @Autowired private DuplicateWorkService duplicateWorkService; @Autowired
// Path: deduplication-document/deduplication-document-impl/src/main/java/pl/edu/icm/coansys/deduplication/document/keygenerator/WorkKeyGenerator.java // public interface WorkKeyGenerator { // public String generateKey(DocumentProtos.DocumentMetadata doc); // } // Path: deduplication-document/deduplication-document-impl/src/main/java/pl/edu/icm/coansys/deduplication/document/DuplicateWorkDetectReduceService.java import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.BytesWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import pl.edu.icm.coansys.commons.spring.DiReduceService; import pl.edu.icm.coansys.deduplication.document.keygenerator.WorkKeyGenerator; import pl.edu.icm.coansys.models.DocumentProtos; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.deduplication.document; /** * * @author Łukasz Dumiszewski * */ @Service("duplicateWorkDetectReduceService") public class DuplicateWorkDetectReduceService implements DiReduceService<Text, BytesWritable, Text, Text> { //@SuppressWarnings("unused") private static Logger log = LoggerFactory.getLogger(DuplicateWorkDetectReduceService.class); @Autowired private DuplicateWorkService duplicateWorkService; @Autowired
private WorkKeyGenerator keyGen;
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/pig/FeaturesCheck.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/model/ContributorWithExtractedFeatures.java // public class ContributorWithExtractedFeatures implements Serializable{ // String docKey; // String contributorId; // Map<String,Collection<Integer>> metadata; // Integer surnameInt; // String surnameString; // boolean surnameNotNull; // // public ContributorWithExtractedFeatures(String docKey, String contributorId, Map<String, Collection<Integer>> metadata, Integer surnameInt, String surnameString, boolean surnameNotNull) { // this.docKey = docKey; // this.contributorId = contributorId; // this.metadata = metadata; // this.surnameInt = surnameInt; // this.surnameString = surnameString; // this.surnameNotNull = surnameNotNull; // } // // public String getDocKey() { // return docKey; // } // // public String getContributorId() { // return contributorId; // } // // public Map<String, Collection<Integer>> getMetadata() { // return metadata; // } // // public Integer getSurnameInt() { // return surnameInt; // } // // public String getSurnameString() { // return surnameString; // } // // public boolean isSurnameNotNull() { // return surnameNotNull; // } // // public Tuple asTuple(){ // Object[] to = new Object[] { docKey, contributorId, surnameInt, // hashMapToDataBag(), surnameString, isSurnameNotNull() }; // return TupleFactory.getInstance() // .newTuple(Arrays.asList(to)); // } // // private HashMap<Object,DataBag> hashMapToDataBag(){ // TupleFactory tf=TupleFactory.getInstance(); // HashMap<Object,DataBag> ret=new HashMap<>(); // for (Map.Entry<String,Collection<Integer>> entry:metadata.entrySet()){ // DataBag db = new DefaultDataBag(); // for (Integer i:entry.getValue()) { // db.add(tf.newTuple((Object) i)); // } // ret.put(entry.getKey(), db); // } // return ret; // // } // // // }
import java.util.Collection; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.hadoop.mapreduce.Counter; import org.apache.pig.backend.executionengine.ExecException; import org.apache.pig.data.Tuple; import org.apache.pig.tools.pigstats.PigStatusReporter; import org.slf4j.LoggerFactory; import pl.edu.icm.coansys.commons.java.StackTraceExtractor; import pl.edu.icm.coansys.disambiguation.model.ContributorWithExtractedFeatures;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.pig; /** * Verify that the author may be similar (comparable) to someone by checking * whether there is a minimum number of features. * * @author mwos */ @SuppressWarnings({ "unchecked" }) public class FeaturesCheck extends AND<Boolean> { private static final org.slf4j.Logger logger = LoggerFactory .getLogger(FeaturesCheck.class); // benchmark private boolean isStatistics = false; private static int skipedContribCounter = 0, allContribCounter = 0; /** * @param Tuple * input with cid, sname, map with features * @throws IllegalAccessException * @throws InstantiationException * @throws ClassNotFoundException * @throws Exception * @throws ExecException * @returns String UUID */ public FeaturesCheck(String threshold, String featureDescription, String useIdsForExtractors, String printStatistics) throws ClassNotFoundException, InstantiationException, IllegalAccessException { super(logger, threshold, featureDescription, useIdsForExtractors); this.isStatistics = Boolean.parseBoolean(printStatistics); } static ConcurrentHashMap<String,FeaturesCheck> extractors=new ConcurrentHashMap<>(); public static synchronized FeaturesCheck getFeaturesCheck(String threshold, String featureDescription, String useIdsForExtractors, String printStatistics) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String key=threshold+featureDescription+useIdsForExtractors+printStatistics; if (!extractors.containsKey(key)) { extractors.put(key, new FeaturesCheck(threshold, featureDescription, useIdsForExtractors, printStatistics)); } return extractors.get(key); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/model/ContributorWithExtractedFeatures.java // public class ContributorWithExtractedFeatures implements Serializable{ // String docKey; // String contributorId; // Map<String,Collection<Integer>> metadata; // Integer surnameInt; // String surnameString; // boolean surnameNotNull; // // public ContributorWithExtractedFeatures(String docKey, String contributorId, Map<String, Collection<Integer>> metadata, Integer surnameInt, String surnameString, boolean surnameNotNull) { // this.docKey = docKey; // this.contributorId = contributorId; // this.metadata = metadata; // this.surnameInt = surnameInt; // this.surnameString = surnameString; // this.surnameNotNull = surnameNotNull; // } // // public String getDocKey() { // return docKey; // } // // public String getContributorId() { // return contributorId; // } // // public Map<String, Collection<Integer>> getMetadata() { // return metadata; // } // // public Integer getSurnameInt() { // return surnameInt; // } // // public String getSurnameString() { // return surnameString; // } // // public boolean isSurnameNotNull() { // return surnameNotNull; // } // // public Tuple asTuple(){ // Object[] to = new Object[] { docKey, contributorId, surnameInt, // hashMapToDataBag(), surnameString, isSurnameNotNull() }; // return TupleFactory.getInstance() // .newTuple(Arrays.asList(to)); // } // // private HashMap<Object,DataBag> hashMapToDataBag(){ // TupleFactory tf=TupleFactory.getInstance(); // HashMap<Object,DataBag> ret=new HashMap<>(); // for (Map.Entry<String,Collection<Integer>> entry:metadata.entrySet()){ // DataBag db = new DefaultDataBag(); // for (Integer i:entry.getValue()) { // db.add(tf.newTuple((Object) i)); // } // ret.put(entry.getKey(), db); // } // return ret; // // } // // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/pig/FeaturesCheck.java import java.util.Collection; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.hadoop.mapreduce.Counter; import org.apache.pig.backend.executionengine.ExecException; import org.apache.pig.data.Tuple; import org.apache.pig.tools.pigstats.PigStatusReporter; import org.slf4j.LoggerFactory; import pl.edu.icm.coansys.commons.java.StackTraceExtractor; import pl.edu.icm.coansys.disambiguation.model.ContributorWithExtractedFeatures; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.pig; /** * Verify that the author may be similar (comparable) to someone by checking * whether there is a minimum number of features. * * @author mwos */ @SuppressWarnings({ "unchecked" }) public class FeaturesCheck extends AND<Boolean> { private static final org.slf4j.Logger logger = LoggerFactory .getLogger(FeaturesCheck.class); // benchmark private boolean isStatistics = false; private static int skipedContribCounter = 0, allContribCounter = 0; /** * @param Tuple * input with cid, sname, map with features * @throws IllegalAccessException * @throws InstantiationException * @throws ClassNotFoundException * @throws Exception * @throws ExecException * @returns String UUID */ public FeaturesCheck(String threshold, String featureDescription, String useIdsForExtractors, String printStatistics) throws ClassNotFoundException, InstantiationException, IllegalAccessException { super(logger, threshold, featureDescription, useIdsForExtractors); this.isStatistics = Boolean.parseBoolean(printStatistics); } static ConcurrentHashMap<String,FeaturesCheck> extractors=new ConcurrentHashMap<>(); public static synchronized FeaturesCheck getFeaturesCheck(String threshold, String featureDescription, String useIdsForExtractors, String printStatistics) throws InstantiationException, IllegalAccessException, ClassNotFoundException { String key=threshold+featureDescription+useIdsForExtractors+printStatistics; if (!extractors.containsKey(key)) { extractors.put(key, new FeaturesCheck(threshold, featureDescription, useIdsForExtractors, printStatistics)); } return extractors.get(key); }
public Boolean exec(ContributorWithExtractedFeatures cont){
CeON/CoAnSys
disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_DOC_AUTHS_SNAMES.java
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // }
import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata;
/* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_DOC_AUTHS_SNAMES extends DisambiguationExtractorDocument { public EX_DOC_AUTHS_SNAMES() { super(); }
// Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/indicators/DisambiguationExtractorDocument.java // public class DisambiguationExtractorDocument extends DisambiguationExtractor { // // public DisambiguationExtractorDocument() {} // // public DisambiguationExtractorDocument( PigNormalizer[] new_normalizers ) { // super( new_normalizers ); // } // // public Collection<Integer> extract( Object o, String lang ) { // return null; // } // // public Collection<Integer> extract( Object o ) { // return extract( o, null ); // } // // // } // // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/normalizers/PigNormalizer.java // public interface PigNormalizer { // // String normalize( String text ); // // } // Path: disambiguation-author/disambiguation-author-logic/src/main/java/pl/edu/icm/coansys/disambiguation/author/features/extractors/EX_DOC_AUTHS_SNAMES.java import java.util.ArrayList; import java.util.Collection; import org.apache.pig.data.DataBag; import org.apache.pig.data.DefaultDataBag; import org.apache.pig.data.Tuple; import org.apache.pig.data.TupleFactory; import pl.edu.icm.coansys.disambiguation.author.features.extractors.indicators.DisambiguationExtractorDocument; import pl.edu.icm.coansys.disambiguation.author.normalizers.PigNormalizer; import pl.edu.icm.coansys.models.DocumentProtos.Author; import pl.edu.icm.coansys.models.DocumentProtos.DocumentMetadata; /* * This file is part of CoAnSys project. * Copyright (c) 2012-2015 ICM-UW * * CoAnSys is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * CoAnSys 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with CoAnSys. If not, see <http://www.gnu.org/licenses/>. */ package pl.edu.icm.coansys.disambiguation.author.features.extractors; public class EX_DOC_AUTHS_SNAMES extends DisambiguationExtractorDocument { public EX_DOC_AUTHS_SNAMES() { super(); }
public EX_DOC_AUTHS_SNAMES(PigNormalizer[] new_normalizers) {
felixb/callmeter
CallMeter3G/src/main/java/de/ub0r/android/callmeter/data/NameLoader.java
// Path: CallMeter3G/src/main/java/de/ub0r/android/callmeter/CallMeter.java // public final class CallMeter extends Application { // // private static final String TAG = "CallMeter"; // // /** // * Minimum date. // */ // public static final long MIN_DATE = 10000000000L; // // /** // * Milliseconds per seconds. // */ // public static final long MILLIS = 1000L; // // /** // * 80. // */ // public static final int EIGHTY = 80; // // /** // * 100. // */ // public static final int HUNDRED = 100; // // /** // * Seconds of a minute. // */ // public static final int SECONDS_MINUTE = 60; // // /** // * Seconds of a hour. // */ // public static final int SECONDS_HOUR = 60 * SECONDS_MINUTE; // // /** // * Seconds of a day. // */ // public static final int SECONDS_DAY = 24 * SECONDS_HOUR; // // /** // * 10. // */ // public static final int TEN = 10; // // /** // * Bytes: kB. // */ // public static final long BYTE_KB = 1024L; // // /** // * Bytes: MB. // */ // public static final long BYTE_MB = BYTE_KB * BYTE_KB; // // /** // * Bytes: GB. // */ // public static final long BYTE_GB = BYTE_MB * BYTE_KB; // // /** // * Bytes: TB. // */ // public static final long BYTE_TB = BYTE_GB * BYTE_KB; // // @Override // public void onCreate() { // if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { // // fix AsyncTask for some old devices + broken gms // // http://stackoverflow.com/a/27239869/2331953 // try { // Class.forName("android.os.AsyncTask"); // } catch (Throwable ignore) { // } // } // // super.onCreate(); // Utils.setLocale(this); // } // // @TargetApi(Build.VERSION_CODES.HONEYCOMB) // public static void setActivitySubtitle(final Activity a, final String t) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // a.getActionBar().setSubtitle(t); // } // } // // public static boolean hasPermission(final Context context, final String permission) { // return // Build.VERSION.SDK_INT < Build.VERSION_CODES.M // || ContextCompat.checkSelfPermission(context, permission) // == PackageManager.PERMISSION_GRANTED; // } // // public static boolean hasPermissions(final Context context, final String... permissions) { // for (String p : permissions) { // if (!hasPermission(context, p)) { // return false; // } // } // return true; // } // // public static boolean requestPermission(final Activity activity, final String permission, // final int requestCode, final int message, // final DialogInterface.OnClickListener onCancelListener) { // Log.i(TAG, "requesting permission: " + permission); // if (!hasPermission(activity, permission)) { // if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // new AlertDialog.Builder(activity) // .setTitle(R.string.permissions_) // .setMessage(message) // .setCancelable(false) // .setNegativeButton(android.R.string.cancel, onCancelListener) // .setPositiveButton(android.R.string.ok, // new DialogInterface.OnClickListener() { // @Override // public void onClick(final DialogInterface dialogInterface, // final int i) { // ActivityCompat.requestPermissions(activity, // new String[]{permission}, requestCode); // } // }) // .show(); // } else { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // } // return false; // } else { // return true; // } // } // }
import android.Manifest; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; import android.provider.ContactsContract.PhoneLookup; import android.widget.TextView; import de.ub0r.android.callmeter.CallMeter; import de.ub0r.android.logg0r.Log;
if (result == null) { return null; } else if (format == null) { NameCache.getInstance().put(number, result); return result; } else { NameCache.getInstance().put(number, result); return String.format(format, result); } } /** * Default constructor. * * @param context {@link Context} * @param number phone number * @param format format to format the {@link String} with * @param view {@link TextView} to set the result on */ public NameLoader(final Context context, final String number, final String format, final TextView view) { ctx = context; num = number; f = format; tv = view; } @Override protected String doInBackground(final Void... params) { String ret = null;
// Path: CallMeter3G/src/main/java/de/ub0r/android/callmeter/CallMeter.java // public final class CallMeter extends Application { // // private static final String TAG = "CallMeter"; // // /** // * Minimum date. // */ // public static final long MIN_DATE = 10000000000L; // // /** // * Milliseconds per seconds. // */ // public static final long MILLIS = 1000L; // // /** // * 80. // */ // public static final int EIGHTY = 80; // // /** // * 100. // */ // public static final int HUNDRED = 100; // // /** // * Seconds of a minute. // */ // public static final int SECONDS_MINUTE = 60; // // /** // * Seconds of a hour. // */ // public static final int SECONDS_HOUR = 60 * SECONDS_MINUTE; // // /** // * Seconds of a day. // */ // public static final int SECONDS_DAY = 24 * SECONDS_HOUR; // // /** // * 10. // */ // public static final int TEN = 10; // // /** // * Bytes: kB. // */ // public static final long BYTE_KB = 1024L; // // /** // * Bytes: MB. // */ // public static final long BYTE_MB = BYTE_KB * BYTE_KB; // // /** // * Bytes: GB. // */ // public static final long BYTE_GB = BYTE_MB * BYTE_KB; // // /** // * Bytes: TB. // */ // public static final long BYTE_TB = BYTE_GB * BYTE_KB; // // @Override // public void onCreate() { // if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { // // fix AsyncTask for some old devices + broken gms // // http://stackoverflow.com/a/27239869/2331953 // try { // Class.forName("android.os.AsyncTask"); // } catch (Throwable ignore) { // } // } // // super.onCreate(); // Utils.setLocale(this); // } // // @TargetApi(Build.VERSION_CODES.HONEYCOMB) // public static void setActivitySubtitle(final Activity a, final String t) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // a.getActionBar().setSubtitle(t); // } // } // // public static boolean hasPermission(final Context context, final String permission) { // return // Build.VERSION.SDK_INT < Build.VERSION_CODES.M // || ContextCompat.checkSelfPermission(context, permission) // == PackageManager.PERMISSION_GRANTED; // } // // public static boolean hasPermissions(final Context context, final String... permissions) { // for (String p : permissions) { // if (!hasPermission(context, p)) { // return false; // } // } // return true; // } // // public static boolean requestPermission(final Activity activity, final String permission, // final int requestCode, final int message, // final DialogInterface.OnClickListener onCancelListener) { // Log.i(TAG, "requesting permission: " + permission); // if (!hasPermission(activity, permission)) { // if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // new AlertDialog.Builder(activity) // .setTitle(R.string.permissions_) // .setMessage(message) // .setCancelable(false) // .setNegativeButton(android.R.string.cancel, onCancelListener) // .setPositiveButton(android.R.string.ok, // new DialogInterface.OnClickListener() { // @Override // public void onClick(final DialogInterface dialogInterface, // final int i) { // ActivityCompat.requestPermissions(activity, // new String[]{permission}, requestCode); // } // }) // .show(); // } else { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // } // return false; // } else { // return true; // } // } // } // Path: CallMeter3G/src/main/java/de/ub0r/android/callmeter/data/NameLoader.java import android.Manifest; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.os.AsyncTask; import android.provider.ContactsContract.PhoneLookup; import android.widget.TextView; import de.ub0r.android.callmeter.CallMeter; import de.ub0r.android.logg0r.Log; if (result == null) { return null; } else if (format == null) { NameCache.getInstance().put(number, result); return result; } else { NameCache.getInstance().put(number, result); return String.format(format, result); } } /** * Default constructor. * * @param context {@link Context} * @param number phone number * @param format format to format the {@link String} with * @param view {@link TextView} to set the result on */ public NameLoader(final Context context, final String number, final String format, final TextView view) { ctx = context; num = number; f = format; tv = view; } @Override protected String doInBackground(final Void... params) { String ret = null;
if (CallMeter.hasPermission(ctx, Manifest.permission.READ_CONTACTS)) {
felixb/callmeter
CallMeter3G/src/main/java/de/ub0r/android/callmeter/ui/prefs/PreferencesImport.java
// Path: CallMeter3G/src/main/java/de/ub0r/android/callmeter/CallMeter.java // public final class CallMeter extends Application { // // private static final String TAG = "CallMeter"; // // /** // * Minimum date. // */ // public static final long MIN_DATE = 10000000000L; // // /** // * Milliseconds per seconds. // */ // public static final long MILLIS = 1000L; // // /** // * 80. // */ // public static final int EIGHTY = 80; // // /** // * 100. // */ // public static final int HUNDRED = 100; // // /** // * Seconds of a minute. // */ // public static final int SECONDS_MINUTE = 60; // // /** // * Seconds of a hour. // */ // public static final int SECONDS_HOUR = 60 * SECONDS_MINUTE; // // /** // * Seconds of a day. // */ // public static final int SECONDS_DAY = 24 * SECONDS_HOUR; // // /** // * 10. // */ // public static final int TEN = 10; // // /** // * Bytes: kB. // */ // public static final long BYTE_KB = 1024L; // // /** // * Bytes: MB. // */ // public static final long BYTE_MB = BYTE_KB * BYTE_KB; // // /** // * Bytes: GB. // */ // public static final long BYTE_GB = BYTE_MB * BYTE_KB; // // /** // * Bytes: TB. // */ // public static final long BYTE_TB = BYTE_GB * BYTE_KB; // // @Override // public void onCreate() { // if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { // // fix AsyncTask for some old devices + broken gms // // http://stackoverflow.com/a/27239869/2331953 // try { // Class.forName("android.os.AsyncTask"); // } catch (Throwable ignore) { // } // } // // super.onCreate(); // Utils.setLocale(this); // } // // @TargetApi(Build.VERSION_CODES.HONEYCOMB) // public static void setActivitySubtitle(final Activity a, final String t) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // a.getActionBar().setSubtitle(t); // } // } // // public static boolean hasPermission(final Context context, final String permission) { // return // Build.VERSION.SDK_INT < Build.VERSION_CODES.M // || ContextCompat.checkSelfPermission(context, permission) // == PackageManager.PERMISSION_GRANTED; // } // // public static boolean hasPermissions(final Context context, final String... permissions) { // for (String p : permissions) { // if (!hasPermission(context, p)) { // return false; // } // } // return true; // } // // public static boolean requestPermission(final Activity activity, final String permission, // final int requestCode, final int message, // final DialogInterface.OnClickListener onCancelListener) { // Log.i(TAG, "requesting permission: " + permission); // if (!hasPermission(activity, permission)) { // if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // new AlertDialog.Builder(activity) // .setTitle(R.string.permissions_) // .setMessage(message) // .setCancelable(false) // .setNegativeButton(android.R.string.cancel, onCancelListener) // .setPositiveButton(android.R.string.ok, // new DialogInterface.OnClickListener() { // @Override // public void onClick(final DialogInterface dialogInterface, // final int i) { // ActivityCompat.requestPermissions(activity, // new String[]{permission}, requestCode); // } // }) // .show(); // } else { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // } // return false; // } else { // return true; // } // } // }
import android.Manifest; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.support.annotation.NonNull; import android.view.Window; import android.widget.Toast; import java.io.File; import de.ub0r.android.callmeter.CallMeter; import de.ub0r.android.callmeter.R; import de.ub0r.android.lib.Utils; import de.ub0r.android.logg0r.Log;
@SuppressWarnings("deprecation") @Override public void onCreate(final Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); Utils.setLocale(this); addPreferencesFromResource(R.xml.import_from_sd); updateFiles(); } @Override public void onRequestPermissionsResult( final int requestCode, @NonNull final String permissions[], @NonNull final int[] grantResults) { switch (requestCode) { case PERMISSION_REQUEST_READ_EXTERNAL_STORAGE: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // just try again. updateFiles(); } else { Log.e(TAG, "permission denied: READ_EXTERNAL_STORAGE, finish"); finish(); } } } private void updateFiles() {
// Path: CallMeter3G/src/main/java/de/ub0r/android/callmeter/CallMeter.java // public final class CallMeter extends Application { // // private static final String TAG = "CallMeter"; // // /** // * Minimum date. // */ // public static final long MIN_DATE = 10000000000L; // // /** // * Milliseconds per seconds. // */ // public static final long MILLIS = 1000L; // // /** // * 80. // */ // public static final int EIGHTY = 80; // // /** // * 100. // */ // public static final int HUNDRED = 100; // // /** // * Seconds of a minute. // */ // public static final int SECONDS_MINUTE = 60; // // /** // * Seconds of a hour. // */ // public static final int SECONDS_HOUR = 60 * SECONDS_MINUTE; // // /** // * Seconds of a day. // */ // public static final int SECONDS_DAY = 24 * SECONDS_HOUR; // // /** // * 10. // */ // public static final int TEN = 10; // // /** // * Bytes: kB. // */ // public static final long BYTE_KB = 1024L; // // /** // * Bytes: MB. // */ // public static final long BYTE_MB = BYTE_KB * BYTE_KB; // // /** // * Bytes: GB. // */ // public static final long BYTE_GB = BYTE_MB * BYTE_KB; // // /** // * Bytes: TB. // */ // public static final long BYTE_TB = BYTE_GB * BYTE_KB; // // @Override // public void onCreate() { // if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) { // // fix AsyncTask for some old devices + broken gms // // http://stackoverflow.com/a/27239869/2331953 // try { // Class.forName("android.os.AsyncTask"); // } catch (Throwable ignore) { // } // } // // super.onCreate(); // Utils.setLocale(this); // } // // @TargetApi(Build.VERSION_CODES.HONEYCOMB) // public static void setActivitySubtitle(final Activity a, final String t) { // if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // a.getActionBar().setSubtitle(t); // } // } // // public static boolean hasPermission(final Context context, final String permission) { // return // Build.VERSION.SDK_INT < Build.VERSION_CODES.M // || ContextCompat.checkSelfPermission(context, permission) // == PackageManager.PERMISSION_GRANTED; // } // // public static boolean hasPermissions(final Context context, final String... permissions) { // for (String p : permissions) { // if (!hasPermission(context, p)) { // return false; // } // } // return true; // } // // public static boolean requestPermission(final Activity activity, final String permission, // final int requestCode, final int message, // final DialogInterface.OnClickListener onCancelListener) { // Log.i(TAG, "requesting permission: " + permission); // if (!hasPermission(activity, permission)) { // if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // new AlertDialog.Builder(activity) // .setTitle(R.string.permissions_) // .setMessage(message) // .setCancelable(false) // .setNegativeButton(android.R.string.cancel, onCancelListener) // .setPositiveButton(android.R.string.ok, // new DialogInterface.OnClickListener() { // @Override // public void onClick(final DialogInterface dialogInterface, // final int i) { // ActivityCompat.requestPermissions(activity, // new String[]{permission}, requestCode); // } // }) // .show(); // } else { // ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); // } // return false; // } else { // return true; // } // } // } // Path: CallMeter3G/src/main/java/de/ub0r/android/callmeter/ui/prefs/PreferencesImport.java import android.Manifest; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceGroup; import android.support.annotation.NonNull; import android.view.Window; import android.widget.Toast; import java.io.File; import de.ub0r.android.callmeter.CallMeter; import de.ub0r.android.callmeter.R; import de.ub0r.android.lib.Utils; import de.ub0r.android.logg0r.Log; @SuppressWarnings("deprecation") @Override public void onCreate(final Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); Utils.setLocale(this); addPreferencesFromResource(R.xml.import_from_sd); updateFiles(); } @Override public void onRequestPermissionsResult( final int requestCode, @NonNull final String permissions[], @NonNull final int[] grantResults) { switch (requestCode) { case PERMISSION_REQUEST_READ_EXTERNAL_STORAGE: if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // just try again. updateFiles(); } else { Log.e(TAG, "permission denied: READ_EXTERNAL_STORAGE, finish"); finish(); } } } private void updateFiles() {
if (!CallMeter.requestPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE,
idega/com.idega.block.mailinglist
src/java/com/idega/block/mailinglist/presentation/MailinglistSettingsTable.java
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // // Path: src/java/com/idega/block/mailinglist/data/Mailinglist.java // public interface Mailinglist extends com.idega.block.mailinglist.data.Account // { // public java.lang.String getMailinglistName(); // public java.lang.String getName(); // public void setMailinglistName(java.lang.String p0); // }
import com.idega.block.mailinglist.data.Account; import com.idega.block.mailinglist.data.Mailinglist; import com.idega.presentation.IWContext;
package com.idega.block.mailinglist.presentation; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class MailinglistSettingsTable extends AccountSettingsTable { public MailinglistSettingsTable() { super(); this.setHeaderString("Edit Current Mailinglist"); }
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // // Path: src/java/com/idega/block/mailinglist/data/Mailinglist.java // public interface Mailinglist extends com.idega.block.mailinglist.data.Account // { // public java.lang.String getMailinglistName(); // public java.lang.String getName(); // public void setMailinglistName(java.lang.String p0); // } // Path: src/java/com/idega/block/mailinglist/presentation/MailinglistSettingsTable.java import com.idega.block.mailinglist.data.Account; import com.idega.block.mailinglist.data.Mailinglist; import com.idega.presentation.IWContext; package com.idega.block.mailinglist.presentation; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class MailinglistSettingsTable extends AccountSettingsTable { public MailinglistSettingsTable() { super(); this.setHeaderString("Edit Current Mailinglist"); }
public void setMailingListSettings(Mailinglist mailinglist){
idega/com.idega.block.mailinglist
src/java/com/idega/block/mailinglist/presentation/MailinglistSettingsTable.java
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // // Path: src/java/com/idega/block/mailinglist/data/Mailinglist.java // public interface Mailinglist extends com.idega.block.mailinglist.data.Account // { // public java.lang.String getMailinglistName(); // public java.lang.String getName(); // public void setMailinglistName(java.lang.String p0); // }
import com.idega.block.mailinglist.data.Account; import com.idega.block.mailinglist.data.Mailinglist; import com.idega.presentation.IWContext;
package com.idega.block.mailinglist.presentation; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class MailinglistSettingsTable extends AccountSettingsTable { public MailinglistSettingsTable() { super(); this.setHeaderString("Edit Current Mailinglist"); } public void setMailingListSettings(Mailinglist mailinglist){
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // // Path: src/java/com/idega/block/mailinglist/data/Mailinglist.java // public interface Mailinglist extends com.idega.block.mailinglist.data.Account // { // public java.lang.String getMailinglistName(); // public java.lang.String getName(); // public void setMailinglistName(java.lang.String p0); // } // Path: src/java/com/idega/block/mailinglist/presentation/MailinglistSettingsTable.java import com.idega.block.mailinglist.data.Account; import com.idega.block.mailinglist.data.Mailinglist; import com.idega.presentation.IWContext; package com.idega.block.mailinglist.presentation; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class MailinglistSettingsTable extends AccountSettingsTable { public MailinglistSettingsTable() { super(); this.setHeaderString("Edit Current Mailinglist"); } public void setMailingListSettings(Mailinglist mailinglist){
super.setAccount((Account) mailinglist);
idega/com.idega.block.mailinglist
src/java/com/idega/block/mailinglist/presentation/UserSettingsTable.java
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // // Path: src/java/com/idega/block/mailinglist/data/MailAccount.java // public interface MailAccount extends com.idega.block.mailinglist.data.Account // { // public java.lang.String getName(); // public int getUserID(); // public java.lang.String getUserName(); // public void setUserID(int p0); // public void setUserName(java.lang.String p0); // }
import com.idega.block.mailinglist.data.Account; import com.idega.block.mailinglist.data.MailAccount; import com.idega.presentation.IWContext;
package com.idega.block.mailinglist.presentation; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class UserSettingsTable extends AccountSettingsTable { public UserSettingsTable(){ super(); this.setHeaderString("Edit Current User Settings"); } public void setUser(IWContext iwc){ /** @todo IMPLIMENT THIS GET USERS CURRENT SETTINGS THROUG FOR EXAMPLE iwc.getUser * MailAccount userAccount * setInputs(userAccount); */ }
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // // Path: src/java/com/idega/block/mailinglist/data/MailAccount.java // public interface MailAccount extends com.idega.block.mailinglist.data.Account // { // public java.lang.String getName(); // public int getUserID(); // public java.lang.String getUserName(); // public void setUserID(int p0); // public void setUserName(java.lang.String p0); // } // Path: src/java/com/idega/block/mailinglist/presentation/UserSettingsTable.java import com.idega.block.mailinglist.data.Account; import com.idega.block.mailinglist.data.MailAccount; import com.idega.presentation.IWContext; package com.idega.block.mailinglist.presentation; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class UserSettingsTable extends AccountSettingsTable { public UserSettingsTable(){ super(); this.setHeaderString("Edit Current User Settings"); } public void setUser(IWContext iwc){ /** @todo IMPLIMENT THIS GET USERS CURRENT SETTINGS THROUG FOR EXAMPLE iwc.getUser * MailAccount userAccount * setInputs(userAccount); */ }
public void setInputs(MailAccount mailAccount){
idega/com.idega.block.mailinglist
src/java/com/idega/block/mailinglist/presentation/UserSettingsTable.java
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // // Path: src/java/com/idega/block/mailinglist/data/MailAccount.java // public interface MailAccount extends com.idega.block.mailinglist.data.Account // { // public java.lang.String getName(); // public int getUserID(); // public java.lang.String getUserName(); // public void setUserID(int p0); // public void setUserName(java.lang.String p0); // }
import com.idega.block.mailinglist.data.Account; import com.idega.block.mailinglist.data.MailAccount; import com.idega.presentation.IWContext;
package com.idega.block.mailinglist.presentation; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class UserSettingsTable extends AccountSettingsTable { public UserSettingsTable(){ super(); this.setHeaderString("Edit Current User Settings"); } public void setUser(IWContext iwc){ /** @todo IMPLIMENT THIS GET USERS CURRENT SETTINGS THROUG FOR EXAMPLE iwc.getUser * MailAccount userAccount * setInputs(userAccount); */ } public void setInputs(MailAccount mailAccount){
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // // Path: src/java/com/idega/block/mailinglist/data/MailAccount.java // public interface MailAccount extends com.idega.block.mailinglist.data.Account // { // public java.lang.String getName(); // public int getUserID(); // public java.lang.String getUserName(); // public void setUserID(int p0); // public void setUserName(java.lang.String p0); // } // Path: src/java/com/idega/block/mailinglist/presentation/UserSettingsTable.java import com.idega.block.mailinglist.data.Account; import com.idega.block.mailinglist.data.MailAccount; import com.idega.presentation.IWContext; package com.idega.block.mailinglist.presentation; /** * Title: * Description: * Copyright: Copyright (c) 2001 * Company: * @author * @version 1.0 */ public class UserSettingsTable extends AccountSettingsTable { public UserSettingsTable(){ super(); this.setHeaderString("Edit Current User Settings"); } public void setUser(IWContext iwc){ /** @todo IMPLIMENT THIS GET USERS CURRENT SETTINGS THROUG FOR EXAMPLE iwc.getUser * MailAccount userAccount * setInputs(userAccount); */ } public void setInputs(MailAccount mailAccount){
super.setAccount((Account) mailAccount);
idega/com.idega.block.mailinglist
src/java/com/idega/block/mailinglist/presentation/AccountSettingsTable.java
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // }
import com.idega.presentation.Block; import com.idega.presentation.IWContext; import com.idega.presentation.Table; import com.idega.presentation.ui.TextInput; import com.idega.presentation.ui.PasswordInput; import com.idega.presentation.ui.SubmitButton; import com.idega.block.mailinglist.data.Account;
pop3HostInput = new TextInput(pop3HostInputName); pop3PortInput = new TextInput(pop3PortInputName); pop3LoginInput = new TextInput(pop3LoginInputName); pop3PasswordInput = new PasswordInput(pop3PasswordInputName); pop3ConfirmPasswordInput = new PasswordInput(pop3ConfirmPasswordInputName); settingsTable.mergeCells(2,2,4,2); settingsTable.mergeCells(2,3,4,3); settingsTable.mergeCells(2,4,4,4); settingsTable.mergeCells(2,10,4,10); settingsTable.add(nameInput,2,2); settingsTable.add(emailInput,2,3); settingsTable.add(replyEmailInput,2,4); SubmitButton OKButton = new SubmitButton(OKButtonName, "OK"); settingsTable.add(smtpHostInput,2,5); settingsTable.add(smtpPortInput,2,6); settingsTable.add(smtpLoginInput,2,7); settingsTable.add(smtpPasswordInput,2,8); settingsTable.add(smtpConfirmPasswordInput,2,9); settingsTable.add(pop3HostInput,4,5); settingsTable.add(pop3PortInput,4,6); settingsTable.add(pop3LoginInput,4,7); settingsTable.add(pop3PasswordInput,4,8); settingsTable.add(pop3ConfirmPasswordInput,4,9); settingsTable.add(OKButton,2,10); }
// Path: src/java/com/idega/block/mailinglist/data/Account.java // public interface Account extends com.idega.data.IDOLegacyEntity // { // public java.lang.String getCreationDate(); // public java.lang.String getEmail(); // public java.lang.String getPOP3Host(); // public java.lang.String getPOP3LoginName(); // public java.lang.String getPOP3Password(); // public int getPOP3Port(); // public java.lang.String getReplyEmail(); // public java.lang.String getSMTPHost(); // public java.lang.String getSMTPLoginName(); // public java.lang.String getSMTPPassword(); // public int getSMTPPort(); // public void setCreationDate(java.sql.Timestamp p0); // public void setEmail(java.lang.String p0); // public void setPOP3Host(java.lang.String p0); // public void setPOP3LoginName(java.lang.String p0); // public void setPOP3Password(java.lang.String p0); // public void setPOP3Port(int p0); // public void setReplyEmail(java.lang.String p0); // public void setSMTPHost(java.lang.String p0); // public void setSMTPLoginName(java.lang.String p0); // public void setSMTPPassword(java.lang.String p0); // public void setSMTPPort(int p0); // } // Path: src/java/com/idega/block/mailinglist/presentation/AccountSettingsTable.java import com.idega.presentation.Block; import com.idega.presentation.IWContext; import com.idega.presentation.Table; import com.idega.presentation.ui.TextInput; import com.idega.presentation.ui.PasswordInput; import com.idega.presentation.ui.SubmitButton; import com.idega.block.mailinglist.data.Account; pop3HostInput = new TextInput(pop3HostInputName); pop3PortInput = new TextInput(pop3PortInputName); pop3LoginInput = new TextInput(pop3LoginInputName); pop3PasswordInput = new PasswordInput(pop3PasswordInputName); pop3ConfirmPasswordInput = new PasswordInput(pop3ConfirmPasswordInputName); settingsTable.mergeCells(2,2,4,2); settingsTable.mergeCells(2,3,4,3); settingsTable.mergeCells(2,4,4,4); settingsTable.mergeCells(2,10,4,10); settingsTable.add(nameInput,2,2); settingsTable.add(emailInput,2,3); settingsTable.add(replyEmailInput,2,4); SubmitButton OKButton = new SubmitButton(OKButtonName, "OK"); settingsTable.add(smtpHostInput,2,5); settingsTable.add(smtpPortInput,2,6); settingsTable.add(smtpLoginInput,2,7); settingsTable.add(smtpPasswordInput,2,8); settingsTable.add(smtpConfirmPasswordInput,2,9); settingsTable.add(pop3HostInput,4,5); settingsTable.add(pop3PortInput,4,6); settingsTable.add(pop3LoginInput,4,7); settingsTable.add(pop3PasswordInput,4,8); settingsTable.add(pop3ConfirmPasswordInput,4,9); settingsTable.add(OKButton,2,10); }
protected void setAccount(Account account){
idega/com.idega.block.mailinglist
src/java/com/idega/block/mailinglist/business/EmailServices.java
// Path: src/java/com/idega/block/mailinglist/data/EmailLetterData.java // public interface EmailLetterData extends com.idega.data.IDOLegacyEntity // { // public com.idega.core.file.data.ICFile getAttachments(); // public java.lang.String getBCCEmail(); // public java.lang.String getBody(); // public java.lang.String getCCEmail(); // public java.lang.String getDate(); // public java.lang.String getFromEmail(); // public boolean getHasSent(); // public java.lang.String getSubject(); // public java.lang.String getToEmail(); // public void setAttachments(com.idega.core.file.data.ICFile p0); // public void setBCCEmail(java.lang.String p0); // public void setBody(java.lang.String p0); // public void setCCEmail(java.lang.String p0); // public void setDate(java.sql.Timestamp p0); // public void setFromEmail(java.lang.String p0); // public void setHasSent(java.lang.Boolean p0); // public void setSubject(java.lang.String p0); // public void setToEmail(java.lang.String p0); // }
import com.idega.util.SendMail; import com.idega.block.mailinglist.data.EmailLetterData; import java.sql.SQLException; import javax.mail.MessagingException;
package com.idega.block.mailinglist.business; /** * Title: idegaWeb Classes * Description: * Copyright: Copyright (c) 2001 * Company: idega * @author <a href="[email protected]">Bjarni Viljhalmsson</a> * @version 1.0 */ public class EmailServices { public EmailServices() { }
// Path: src/java/com/idega/block/mailinglist/data/EmailLetterData.java // public interface EmailLetterData extends com.idega.data.IDOLegacyEntity // { // public com.idega.core.file.data.ICFile getAttachments(); // public java.lang.String getBCCEmail(); // public java.lang.String getBody(); // public java.lang.String getCCEmail(); // public java.lang.String getDate(); // public java.lang.String getFromEmail(); // public boolean getHasSent(); // public java.lang.String getSubject(); // public java.lang.String getToEmail(); // public void setAttachments(com.idega.core.file.data.ICFile p0); // public void setBCCEmail(java.lang.String p0); // public void setBody(java.lang.String p0); // public void setCCEmail(java.lang.String p0); // public void setDate(java.sql.Timestamp p0); // public void setFromEmail(java.lang.String p0); // public void setHasSent(java.lang.Boolean p0); // public void setSubject(java.lang.String p0); // public void setToEmail(java.lang.String p0); // } // Path: src/java/com/idega/block/mailinglist/business/EmailServices.java import com.idega.util.SendMail; import com.idega.block.mailinglist.data.EmailLetterData; import java.sql.SQLException; import javax.mail.MessagingException; package com.idega.block.mailinglist.business; /** * Title: idegaWeb Classes * Description: * Copyright: Copyright (c) 2001 * Company: idega * @author <a href="[email protected]">Bjarni Viljhalmsson</a> * @version 1.0 */ public class EmailServices { public EmailServices() { }
public static void sendServices(EmailLetterData letter) throws SQLException, MessagingException{
wang153723482/testing_platform
src/main/java/com/wangc/StaticResourceConfiguration.java
// Path: src/main/java/com/wangc/comm/Param.java // public class Param { // // // TODO: wangc@2017/3/14 读取配置 tp.jmeter.jtl.path // public static String JTL_PATH = File.separator + "jmeter" + File.separator + "jtl"; // public static String LOG_PATH = File.separator + "jmeter" + File.separator + "log"; // public static String HTML_PATH = File.separator + "jmeter" + File.separator + "html"; // public static String JMX_PATH = File.separator + "jmeter" + File.separator + "jmx"; // public static String DATA_PATH = File.separator + "jmeter" + File.separator + "data"; // public static String JTL_SUFFIX = ".jtl"; // public static String LOG_SUFFIX = ".log"; // public static String SEPARATOR_MY = "_"; // public static String USER_DIR = System.getProperty("user.dir"); // public static String UPLOAD_DIR= "upload"; // // public static String UPLOAD_JMX_PATH = File.separator+UPLOAD_DIR+File.separator+"jmx"; // // // // // }
import com.wangc.comm.Param; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import java.io.File;
package com.wangc; /** * Created by wangchao on 2017/3/15. */ @Configuration public class StaticResourceConfiguration extends WebMvcConfigurerAdapter { private final String FILE_PREX = "file://"; private static String os = System.getProperty("os.name"); private static final Logger logger = LoggerFactory.getLogger(StaticResourceConfiguration.class); @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // TODO: wangc@2017/3/15 这里可能需要根据OS不同配置不同的路径,win:file后有3个/,linux:file后有2个/,因为linux的目录本身就是/开头 String separator = "/"; if( os.contains("Linux") ){//如果是linux // TODO: wangc@2017/3/15 app_init 中判断OS separator = ""; } //win: file:///c:dir_name //linux: file:///home/wangc/dir_name // String reportResLocations = FILE_PREX+separator+ Param.USER_DIR+Param.HTML_PATH; //将所有的/report/请求至html报告的本地路径 // registry.addResourceHandler("/report/**").addResourceLocations(reportResLocations);
// Path: src/main/java/com/wangc/comm/Param.java // public class Param { // // // TODO: wangc@2017/3/14 读取配置 tp.jmeter.jtl.path // public static String JTL_PATH = File.separator + "jmeter" + File.separator + "jtl"; // public static String LOG_PATH = File.separator + "jmeter" + File.separator + "log"; // public static String HTML_PATH = File.separator + "jmeter" + File.separator + "html"; // public static String JMX_PATH = File.separator + "jmeter" + File.separator + "jmx"; // public static String DATA_PATH = File.separator + "jmeter" + File.separator + "data"; // public static String JTL_SUFFIX = ".jtl"; // public static String LOG_SUFFIX = ".log"; // public static String SEPARATOR_MY = "_"; // public static String USER_DIR = System.getProperty("user.dir"); // public static String UPLOAD_DIR= "upload"; // // public static String UPLOAD_JMX_PATH = File.separator+UPLOAD_DIR+File.separator+"jmx"; // // // // // } // Path: src/main/java/com/wangc/StaticResourceConfiguration.java import com.wangc.comm.Param; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import java.io.File; package com.wangc; /** * Created by wangchao on 2017/3/15. */ @Configuration public class StaticResourceConfiguration extends WebMvcConfigurerAdapter { private final String FILE_PREX = "file://"; private static String os = System.getProperty("os.name"); private static final Logger logger = LoggerFactory.getLogger(StaticResourceConfiguration.class); @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { // TODO: wangc@2017/3/15 这里可能需要根据OS不同配置不同的路径,win:file后有3个/,linux:file后有2个/,因为linux的目录本身就是/开头 String separator = "/"; if( os.contains("Linux") ){//如果是linux // TODO: wangc@2017/3/15 app_init 中判断OS separator = ""; } //win: file:///c:dir_name //linux: file:///home/wangc/dir_name // String reportResLocations = FILE_PREX+separator+ Param.USER_DIR+Param.HTML_PATH; //将所有的/report/请求至html报告的本地路径 // registry.addResourceHandler("/report/**").addResourceLocations(reportResLocations);
String reportResLocations = FILE_PREX+separator+ Param.USER_DIR+Param.HTML_PATH+File.separator;
wang153723482/testing_platform
src/main/java/com/wangc/test_plan/controler/TPController.java
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/main/java/com/wangc/test_plan/service/TPService.java // @Service // public class TPService { // // @Autowired // TPMapper tpMapper; // // // @Autowired // // TestPlanBean tp; // // public void insert(TestPlanBean tp) { // tpMapper.insert(tp); // } // // public List<TestPlanBean> select(TestPlanBean tp) { // return tpMapper.select(tp); // } // // public List<TestPlanBean> selectAll() { // TestPlanBean tp = new TestPlanBean(); // return tpMapper.select(tp); // } // // public TestPlanBean selectById(String id) { // TestPlanBean tp = new TestPlanBean(); // tp.setId(id); // List<TestPlanBean> list = tpMapper.select(tp); // if (null != list && !list.isEmpty()) { // return list.get(0); // } else { // return null; // } // } // // public void update(TestPlanBean tp) { // tpMapper.update(tp); // } // // }
import com.wangc.test_plan.bean.TestPlanBean; import com.wangc.test_plan.service.TPService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.List;
package com.wangc.test_plan.controler; /** * Created by wangchao on 2017/2/10. */ @Controller @RequestMapping(value = "/tp") public class TPController { @Autowired
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/main/java/com/wangc/test_plan/service/TPService.java // @Service // public class TPService { // // @Autowired // TPMapper tpMapper; // // // @Autowired // // TestPlanBean tp; // // public void insert(TestPlanBean tp) { // tpMapper.insert(tp); // } // // public List<TestPlanBean> select(TestPlanBean tp) { // return tpMapper.select(tp); // } // // public List<TestPlanBean> selectAll() { // TestPlanBean tp = new TestPlanBean(); // return tpMapper.select(tp); // } // // public TestPlanBean selectById(String id) { // TestPlanBean tp = new TestPlanBean(); // tp.setId(id); // List<TestPlanBean> list = tpMapper.select(tp); // if (null != list && !list.isEmpty()) { // return list.get(0); // } else { // return null; // } // } // // public void update(TestPlanBean tp) { // tpMapper.update(tp); // } // // } // Path: src/main/java/com/wangc/test_plan/controler/TPController.java import com.wangc.test_plan.bean.TestPlanBean; import com.wangc.test_plan.service.TPService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.List; package com.wangc.test_plan.controler; /** * Created by wangchao on 2017/2/10. */ @Controller @RequestMapping(value = "/tp") public class TPController { @Autowired
TPService tpService;
wang153723482/testing_platform
src/main/java/com/wangc/test_plan/controler/TPController.java
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/main/java/com/wangc/test_plan/service/TPService.java // @Service // public class TPService { // // @Autowired // TPMapper tpMapper; // // // @Autowired // // TestPlanBean tp; // // public void insert(TestPlanBean tp) { // tpMapper.insert(tp); // } // // public List<TestPlanBean> select(TestPlanBean tp) { // return tpMapper.select(tp); // } // // public List<TestPlanBean> selectAll() { // TestPlanBean tp = new TestPlanBean(); // return tpMapper.select(tp); // } // // public TestPlanBean selectById(String id) { // TestPlanBean tp = new TestPlanBean(); // tp.setId(id); // List<TestPlanBean> list = tpMapper.select(tp); // if (null != list && !list.isEmpty()) { // return list.get(0); // } else { // return null; // } // } // // public void update(TestPlanBean tp) { // tpMapper.update(tp); // } // // }
import com.wangc.test_plan.bean.TestPlanBean; import com.wangc.test_plan.service.TPService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.List;
package com.wangc.test_plan.controler; /** * Created by wangchao on 2017/2/10. */ @Controller @RequestMapping(value = "/tp") public class TPController { @Autowired TPService tpService; @RequestMapping(value = "/list",method = RequestMethod.GET)
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/main/java/com/wangc/test_plan/service/TPService.java // @Service // public class TPService { // // @Autowired // TPMapper tpMapper; // // // @Autowired // // TestPlanBean tp; // // public void insert(TestPlanBean tp) { // tpMapper.insert(tp); // } // // public List<TestPlanBean> select(TestPlanBean tp) { // return tpMapper.select(tp); // } // // public List<TestPlanBean> selectAll() { // TestPlanBean tp = new TestPlanBean(); // return tpMapper.select(tp); // } // // public TestPlanBean selectById(String id) { // TestPlanBean tp = new TestPlanBean(); // tp.setId(id); // List<TestPlanBean> list = tpMapper.select(tp); // if (null != list && !list.isEmpty()) { // return list.get(0); // } else { // return null; // } // } // // public void update(TestPlanBean tp) { // tpMapper.update(tp); // } // // } // Path: src/main/java/com/wangc/test_plan/controler/TPController.java import com.wangc.test_plan.bean.TestPlanBean; import com.wangc.test_plan.service.TPService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.util.List; package com.wangc.test_plan.controler; /** * Created by wangchao on 2017/2/10. */ @Controller @RequestMapping(value = "/tp") public class TPController { @Autowired TPService tpService; @RequestMapping(value = "/list",method = RequestMethod.GET)
public String list(Model model,@ModelAttribute TestPlanBean tp){
wang153723482/testing_platform
src/main/java/com/wangc/test_plan/mapper/RPMapper.java
// Path: src/main/java/com/wangc/test_plan/bean/RunPlanBean.java // public class RunPlanBean { // private String id; // private String duration; // private String usersNum; // private String rampUp; // private String tpId; // private TestPlanBean testPlanBean; // private String jmxPath; // private String jtlPath; // private String logPath; // private String htmlPath; // private String createTime; // private String dataPath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getDuration() { // return duration; // } // // public void setDuration(String duration) { // this.duration = duration; // } // // public String getUsersNum() { // return usersNum; // } // // public void setUsersNum(String usersNum) { // this.usersNum = usersNum; // } // // public String getRampUp() { // return rampUp; // } // // public void setRampUp(String rampUp) { // this.rampUp = rampUp; // } // // public String getTpId() { // return tpId; // } // // public void setTpId(String tpId) { // this.tpId = tpId; // } // // public TestPlanBean getTestPlanBean() { // return testPlanBean; // } // // public void setTestPlanBean(TestPlanBean testPlanBean) { // if (null == testPlanBean) { // this.testPlanBean = new TestPlanBean(); // } else { // this.testPlanBean = testPlanBean; // } // } // // public String getJmxPath() { // return jmxPath; // } // // public void setJmxPath(String jmxPath) { // this.jmxPath = jmxPath; // } // // //设置默认的启动频率,默认是每秒启动100个用户 // // TODO: wangc@2017/3/13 参数化 // public void setDefaultRampUp() { // int d = Integer.valueOf(this.usersNum) / 100; // this.rampUp = String.valueOf(0 == d ? 1 : d); // } // // public String getJtlPath() { // return jtlPath; // } // // public void setJtlPath(String jtlPath) { // this.jtlPath = jtlPath; // } // // public String getLogPath() { // return logPath; // } // // public void setLogPath(String logPath) { // this.logPath = logPath; // } // // public String getHtmlPath() { // return htmlPath; // } // // public void setHtmlPath(String htmlPath) { // this.htmlPath = htmlPath; // } // // public String getCreateTime() { // return createTime; // } // // public void setCreateTime(String createTime) { // this.createTime = createTime; // } // // public String getDataPath() { // return dataPath; // } // // public void setDataPath(String dataPath) { // this.dataPath = dataPath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("RunPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", duration='").append(duration).append('\''); // sb.append(", usersNum='").append(usersNum).append('\''); // sb.append(", rampUp='").append(rampUp).append('\''); // sb.append(", tpId='").append(tpId).append('\''); // sb.append(", testPlanBean=").append(testPlanBean); // sb.append(", jmxPath='").append(jmxPath).append('\''); // sb.append(", jtlPath='").append(jtlPath).append('\''); // sb.append(", logPath='").append(logPath).append('\''); // sb.append(", htmlPath='").append(htmlPath).append('\''); // sb.append(", createTime='").append(createTime).append('\''); // sb.append(", dataPath='").append(dataPath).append('\''); // sb.append('}'); // return sb.toString(); // } // }
import com.wangc.test_plan.bean.RunPlanBean; import org.apache.ibatis.annotations.Mapper; import java.util.List;
package com.wangc.test_plan.mapper; /** * Created by wangchao on 2017/3/10. */ @Mapper public interface RPMapper {
// Path: src/main/java/com/wangc/test_plan/bean/RunPlanBean.java // public class RunPlanBean { // private String id; // private String duration; // private String usersNum; // private String rampUp; // private String tpId; // private TestPlanBean testPlanBean; // private String jmxPath; // private String jtlPath; // private String logPath; // private String htmlPath; // private String createTime; // private String dataPath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getDuration() { // return duration; // } // // public void setDuration(String duration) { // this.duration = duration; // } // // public String getUsersNum() { // return usersNum; // } // // public void setUsersNum(String usersNum) { // this.usersNum = usersNum; // } // // public String getRampUp() { // return rampUp; // } // // public void setRampUp(String rampUp) { // this.rampUp = rampUp; // } // // public String getTpId() { // return tpId; // } // // public void setTpId(String tpId) { // this.tpId = tpId; // } // // public TestPlanBean getTestPlanBean() { // return testPlanBean; // } // // public void setTestPlanBean(TestPlanBean testPlanBean) { // if (null == testPlanBean) { // this.testPlanBean = new TestPlanBean(); // } else { // this.testPlanBean = testPlanBean; // } // } // // public String getJmxPath() { // return jmxPath; // } // // public void setJmxPath(String jmxPath) { // this.jmxPath = jmxPath; // } // // //设置默认的启动频率,默认是每秒启动100个用户 // // TODO: wangc@2017/3/13 参数化 // public void setDefaultRampUp() { // int d = Integer.valueOf(this.usersNum) / 100; // this.rampUp = String.valueOf(0 == d ? 1 : d); // } // // public String getJtlPath() { // return jtlPath; // } // // public void setJtlPath(String jtlPath) { // this.jtlPath = jtlPath; // } // // public String getLogPath() { // return logPath; // } // // public void setLogPath(String logPath) { // this.logPath = logPath; // } // // public String getHtmlPath() { // return htmlPath; // } // // public void setHtmlPath(String htmlPath) { // this.htmlPath = htmlPath; // } // // public String getCreateTime() { // return createTime; // } // // public void setCreateTime(String createTime) { // this.createTime = createTime; // } // // public String getDataPath() { // return dataPath; // } // // public void setDataPath(String dataPath) { // this.dataPath = dataPath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("RunPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", duration='").append(duration).append('\''); // sb.append(", usersNum='").append(usersNum).append('\''); // sb.append(", rampUp='").append(rampUp).append('\''); // sb.append(", tpId='").append(tpId).append('\''); // sb.append(", testPlanBean=").append(testPlanBean); // sb.append(", jmxPath='").append(jmxPath).append('\''); // sb.append(", jtlPath='").append(jtlPath).append('\''); // sb.append(", logPath='").append(logPath).append('\''); // sb.append(", htmlPath='").append(htmlPath).append('\''); // sb.append(", createTime='").append(createTime).append('\''); // sb.append(", dataPath='").append(dataPath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // Path: src/main/java/com/wangc/test_plan/mapper/RPMapper.java import com.wangc.test_plan.bean.RunPlanBean; import org.apache.ibatis.annotations.Mapper; import java.util.List; package com.wangc.test_plan.mapper; /** * Created by wangchao on 2017/3/10. */ @Mapper public interface RPMapper {
List<RunPlanBean> select(RunPlanBean rpb);
wang153723482/testing_platform
src/main/java/com/wangc/test_plan/mapper/TPMapper.java
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // }
import com.wangc.test_plan.bean.TestPlanBean; import org.apache.ibatis.annotations.Mapper; import java.util.List;
package com.wangc.test_plan.mapper; /** * Created by wangchao on 2017/2/10. */ @Mapper public interface TPMapper {
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // Path: src/main/java/com/wangc/test_plan/mapper/TPMapper.java import com.wangc.test_plan.bean.TestPlanBean; import org.apache.ibatis.annotations.Mapper; import java.util.List; package com.wangc.test_plan.mapper; /** * Created by wangchao on 2017/2/10. */ @Mapper public interface TPMapper {
Integer insert(TestPlanBean testPlanBean);
wang153723482/testing_platform
src/main/java/com/wangc/AppInitialization.java
// Path: src/main/java/com/wangc/test_plan/bean/GlobalConfig.java // public class GlobalConfig { // private static GlobalConfig GLOBAL_CONFIG = new GlobalConfig(); // // private String jmeterHome;//jmeter的安装目录 // private boolean osFlag;//os类型 true:win false:linux // private String userDir;//当前程序所在的目录 // // private final String jmeterHomeConfigFilePath = "JMETER_HOME.config"; // // //在初始化的时候做这些,这样程序中可以直接使用上面的变量了。 // GlobalConfig(){ // setUserDir(); // setOsIsWin(); // setJmeterHome(); // } // // public static GlobalConfig getInstance() { // return GLOBAL_CONFIG; // } // // private void setUserDir(){ // this.userDir = System.getProperty("user.dir"); // } // // public String getUserDir(){ // return this.userDir; // } // // private void setOsIsWin(){ // String os = System.getProperty("os.name"); // if( os.contains("Linux") ){ // this.osFlag = false; // }else if(os.contains("Windows")){ // this.osFlag = true; // }else{ // throw new RuntimeException("获取操作系统类型异常。"); // } // } // // public boolean getOsFlag(){ // return this.osFlag; // } // // // //读取配置文件 JMETER_HOME.config 配置文件中只有一行数据,即jmeter的安装目录。 // //因为安装目录可能包含空格,所以无法放到启动命令参数中。 // private void setJmeterHome(){ // File file = new File(userDir+File.separator+jmeterHomeConfigFilePath); // BufferedReader reader = null; // try { // System.out.println("以行为单位读取文件内容,一次读一整行:"); // reader = new BufferedReader(new FileReader(file)); // this.jmeterHome = reader.readLine(); // reader.close(); // } catch (IOException e) { // e.printStackTrace(); // } finally { // if (reader != null) { // try { // reader.close(); // } catch (IOException e1) { // } // } // } // } // public String getJmeterHome(){ // return this.jmeterHome; // } // // // // }
import com.wangc.test_plan.bean.GlobalConfig; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; import java.io.File; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement;
package com.wangc; /** * Created by wangchao on 2017/7/26. */ @Component public class AppInitialization implements ApplicationRunner { private final String SQL_CREATE_TEST_PLAN = "CREATE TABLE `test_plan` (\n" + " `id` INTEGER PRIMARY KEY ,\n" + " `tp_name` text ,\n" + " `url` text ,\n" + " `description` text ,\n" + " `generater` text ,\n" + " `protocol` text ,\n" + " `server_name_ip` text ,\n" + " `port_num` text ,\n" + " `path` text ,\n" + " `default_vu` INTEGER ,\n" + " `default_duration` INTEGER ,\n" + " `jmx_save_path` text ,\n" + " `create_time` text ,\n"+ " `csv_data_xpath` text \n" + ") "; private final String SQL_CREATE_RUN_PLAN = "CREATE TABLE `run_plan` (\n" + " `id` INTEGER PRIMARY KEY ,\n" + " `tp_id` INTEGER ,\n" + " `duration` INTEGER ,\n" + " `users_num` INTEGER ,\n" + " `ramp_up` INTEGER ,\n" + " `jmx_path` TEXT ,\n" + " `jtl_path` TEXT ,\n" + " `log_path` TEXT ,\n" + " `html_path` TEXT ,\n" + " `create_time` TEXT \n" + ")"; private Connection conn = null; Statement stmt = null; private final String dbName = "testing_platform.db";
// Path: src/main/java/com/wangc/test_plan/bean/GlobalConfig.java // public class GlobalConfig { // private static GlobalConfig GLOBAL_CONFIG = new GlobalConfig(); // // private String jmeterHome;//jmeter的安装目录 // private boolean osFlag;//os类型 true:win false:linux // private String userDir;//当前程序所在的目录 // // private final String jmeterHomeConfigFilePath = "JMETER_HOME.config"; // // //在初始化的时候做这些,这样程序中可以直接使用上面的变量了。 // GlobalConfig(){ // setUserDir(); // setOsIsWin(); // setJmeterHome(); // } // // public static GlobalConfig getInstance() { // return GLOBAL_CONFIG; // } // // private void setUserDir(){ // this.userDir = System.getProperty("user.dir"); // } // // public String getUserDir(){ // return this.userDir; // } // // private void setOsIsWin(){ // String os = System.getProperty("os.name"); // if( os.contains("Linux") ){ // this.osFlag = false; // }else if(os.contains("Windows")){ // this.osFlag = true; // }else{ // throw new RuntimeException("获取操作系统类型异常。"); // } // } // // public boolean getOsFlag(){ // return this.osFlag; // } // // // //读取配置文件 JMETER_HOME.config 配置文件中只有一行数据,即jmeter的安装目录。 // //因为安装目录可能包含空格,所以无法放到启动命令参数中。 // private void setJmeterHome(){ // File file = new File(userDir+File.separator+jmeterHomeConfigFilePath); // BufferedReader reader = null; // try { // System.out.println("以行为单位读取文件内容,一次读一整行:"); // reader = new BufferedReader(new FileReader(file)); // this.jmeterHome = reader.readLine(); // reader.close(); // } catch (IOException e) { // e.printStackTrace(); // } finally { // if (reader != null) { // try { // reader.close(); // } catch (IOException e1) { // } // } // } // } // public String getJmeterHome(){ // return this.jmeterHome; // } // // // // } // Path: src/main/java/com/wangc/AppInitialization.java import com.wangc.test_plan.bean.GlobalConfig; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; import java.io.File; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; package com.wangc; /** * Created by wangchao on 2017/7/26. */ @Component public class AppInitialization implements ApplicationRunner { private final String SQL_CREATE_TEST_PLAN = "CREATE TABLE `test_plan` (\n" + " `id` INTEGER PRIMARY KEY ,\n" + " `tp_name` text ,\n" + " `url` text ,\n" + " `description` text ,\n" + " `generater` text ,\n" + " `protocol` text ,\n" + " `server_name_ip` text ,\n" + " `port_num` text ,\n" + " `path` text ,\n" + " `default_vu` INTEGER ,\n" + " `default_duration` INTEGER ,\n" + " `jmx_save_path` text ,\n" + " `create_time` text ,\n"+ " `csv_data_xpath` text \n" + ") "; private final String SQL_CREATE_RUN_PLAN = "CREATE TABLE `run_plan` (\n" + " `id` INTEGER PRIMARY KEY ,\n" + " `tp_id` INTEGER ,\n" + " `duration` INTEGER ,\n" + " `users_num` INTEGER ,\n" + " `ramp_up` INTEGER ,\n" + " `jmx_path` TEXT ,\n" + " `jtl_path` TEXT ,\n" + " `log_path` TEXT ,\n" + " `html_path` TEXT ,\n" + " `create_time` TEXT \n" + ")"; private Connection conn = null; Statement stmt = null; private final String dbName = "testing_platform.db";
private GlobalConfig globalConfig = GlobalConfig.getInstance();
wang153723482/testing_platform
src/main/java/com/wangc/test_plan/service/TPService.java
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/main/java/com/wangc/test_plan/mapper/TPMapper.java // @Mapper // public interface TPMapper { // // Integer insert(TestPlanBean testPlanBean); // // List<TestPlanBean> select(TestPlanBean testPlanBean); // // Integer update(TestPlanBean testPlanBean); // // }
import com.wangc.test_plan.bean.TestPlanBean; import com.wangc.test_plan.mapper.TPMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List;
package com.wangc.test_plan.service; /** * Created by wangchao on 2017/2/10. */ @Service public class TPService { @Autowired
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/main/java/com/wangc/test_plan/mapper/TPMapper.java // @Mapper // public interface TPMapper { // // Integer insert(TestPlanBean testPlanBean); // // List<TestPlanBean> select(TestPlanBean testPlanBean); // // Integer update(TestPlanBean testPlanBean); // // } // Path: src/main/java/com/wangc/test_plan/service/TPService.java import com.wangc.test_plan.bean.TestPlanBean; import com.wangc.test_plan.mapper.TPMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; package com.wangc.test_plan.service; /** * Created by wangchao on 2017/2/10. */ @Service public class TPService { @Autowired
TPMapper tpMapper;
wang153723482/testing_platform
src/main/java/com/wangc/test_plan/service/TPService.java
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/main/java/com/wangc/test_plan/mapper/TPMapper.java // @Mapper // public interface TPMapper { // // Integer insert(TestPlanBean testPlanBean); // // List<TestPlanBean> select(TestPlanBean testPlanBean); // // Integer update(TestPlanBean testPlanBean); // // }
import com.wangc.test_plan.bean.TestPlanBean; import com.wangc.test_plan.mapper.TPMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List;
package com.wangc.test_plan.service; /** * Created by wangchao on 2017/2/10. */ @Service public class TPService { @Autowired TPMapper tpMapper; // @Autowired // TestPlanBean tp;
// Path: src/main/java/com/wangc/test_plan/bean/TestPlanBean.java // @Component // public class TestPlanBean { // private String id; // private String tpName; // private String url; // private String description; // private String generater; // @Value("${tp.protocol}") // String protocol; // private String serverNameIp; // @Value("${tp.portNum}") // private String portNum; // // private String path; // private String jmxSavePath; // private String csvDataXpath; // // // public String getId() { // return id; // } // // public void setId(String id) { // this.id = id; // } // // public String getTpName() { // return tpName; // } // // public void setTpName(String tpName) { // this.tpName = tpName; // } // // public String getUrl() { // return url; // } // // public void setUrl(String url) { // this.url = url; // } // // public String getDescription() { // return description; // } // // public void setDescription(String description) { // this.description = description; // } // // public String getGenerater() { // return generater; // } // // public void setGenerater(String generater) { // this.generater = generater; // } // // public String getProtocol() { // return protocol; // } // // public void setProtocol(String protocol) { // this.protocol = protocol; // } // // public String getServerNameIp() { // return serverNameIp; // } // // public void setServerNameIp(String serverNameIp) { // this.serverNameIp = serverNameIp; // } // // public String getPortNum() { // return portNum; // } // // public void setPortNum(String portNum) { // this.portNum = portNum; // } // // public String getPath() { // return path; // } // // public void setPath(String path) { // this.path = path; // } // // public String getJmxSavePath() { // return jmxSavePath; // } // // public void setJmxSavePath(String jmxSavePath) { // this.jmxSavePath = jmxSavePath; // } // // public String getCsvDataXpath() { // return csvDataXpath; // } // // public void setCsvDataXpath(String csvDataXpath) { // this.csvDataXpath = csvDataXpath; // } // // @Override // public String toString() { // final StringBuilder sb = new StringBuilder("TestPlanBean{"); // sb.append("id='").append(id).append('\''); // sb.append(", tpName='").append(tpName).append('\''); // sb.append(", url='").append(url).append('\''); // sb.append(", description='").append(description).append('\''); // sb.append(", generater='").append(generater).append('\''); // sb.append(", protocol='").append(protocol).append('\''); // sb.append(", serverNameIp='").append(serverNameIp).append('\''); // sb.append(", portNum='").append(portNum).append('\''); // sb.append(", path='").append(path).append('\''); // sb.append(", jmxSavePath='").append(jmxSavePath).append('\''); // sb.append(", csvDataXpath='").append(csvDataXpath).append('\''); // sb.append('}'); // return sb.toString(); // } // } // // Path: src/main/java/com/wangc/test_plan/mapper/TPMapper.java // @Mapper // public interface TPMapper { // // Integer insert(TestPlanBean testPlanBean); // // List<TestPlanBean> select(TestPlanBean testPlanBean); // // Integer update(TestPlanBean testPlanBean); // // } // Path: src/main/java/com/wangc/test_plan/service/TPService.java import com.wangc.test_plan.bean.TestPlanBean; import com.wangc.test_plan.mapper.TPMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; package com.wangc.test_plan.service; /** * Created by wangchao on 2017/2/10. */ @Service public class TPService { @Autowired TPMapper tpMapper; // @Autowired // TestPlanBean tp;
public void insert(TestPlanBean tp) {
chipKIT32/chipKIT-importer
src/com/microchip/mplab/nbide/embedded/serialmonitor/DefaultSerialMonitorConfigModel.java
// Path: src/com/microchip/mplab/nbide/embedded/serialmonitor/SerialPortCommunicator.java // public static final String PORT_OWNER_NAME = "SerialPortCommunicator";
import static com.microchip.mplab.nbide.embedded.serialmonitor.SerialPortCommunicator.PORT_OWNER_NAME; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; import org.openide.util.Utilities; import purejavacomm.CommPortIdentifier; import purejavacomm.PortInUseException; import purejavacomm.PureJavaIllegalStateException; import purejavacomm.SerialPort;
} @Override public void setCurrentParity(String value) { parity = value; } @Override public String getCurrentParity() { return parity != null ? parity : getDefaultParity(); } @Override public SerialPortConfig getCurrentConfig() { return new SerialPortConfig.Builder() .portName( getCurrentPortName() ) .baudRate( Integer.parseInt( getCurrentBaudRate() ) ) .flowControl( parseFlowControl( getCurrentFlowControl() ) ) .dataBits( Integer.parseInt( getCurrentDataBits() ) ) .stopBits( parseStopBits( getCurrentStopBits() ) ) .parity( parseParity( getCurrentParity() ) ) .build(); } private boolean isPortAvailable( CommPortIdentifier p ) { if ( Utilities.isUnix() && p.getName().startsWith("ttyS") ) { SerialPort port = null; try { if ( !p.isCurrentlyOwned() ) {
// Path: src/com/microchip/mplab/nbide/embedded/serialmonitor/SerialPortCommunicator.java // public static final String PORT_OWNER_NAME = "SerialPortCommunicator"; // Path: src/com/microchip/mplab/nbide/embedded/serialmonitor/DefaultSerialMonitorConfigModel.java import static com.microchip.mplab.nbide.embedded.serialmonitor.SerialPortCommunicator.PORT_OWNER_NAME; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; import org.openide.util.Utilities; import purejavacomm.CommPortIdentifier; import purejavacomm.PortInUseException; import purejavacomm.PureJavaIllegalStateException; import purejavacomm.SerialPort; } @Override public void setCurrentParity(String value) { parity = value; } @Override public String getCurrentParity() { return parity != null ? parity : getDefaultParity(); } @Override public SerialPortConfig getCurrentConfig() { return new SerialPortConfig.Builder() .portName( getCurrentPortName() ) .baudRate( Integer.parseInt( getCurrentBaudRate() ) ) .flowControl( parseFlowControl( getCurrentFlowControl() ) ) .dataBits( Integer.parseInt( getCurrentDataBits() ) ) .stopBits( parseStopBits( getCurrentStopBits() ) ) .parity( parseParity( getCurrentParity() ) ) .build(); } private boolean isPortAvailable( CommPortIdentifier p ) { if ( Utilities.isUnix() && p.getName().startsWith("ttyS") ) { SerialPort port = null; try { if ( !p.isCurrentlyOwned() ) {
port = (SerialPort) p.open( PORT_OWNER_NAME, 200 );
chipKIT32/chipKIT-importer
src/com/microchip/mplab/nbide/embedded/arduino/importer/PlatformFactory.java
// Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/ArduinoConfig.java // public static final String ROOT_PLATFORM_ARCH = "avr"; // // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/ArduinoConfig.java // public static final String ROOT_PLATFORM_VENDOR = "arduino"; // // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/pic32/PIC32Platform.java // public class PIC32Platform extends Platform { // // public PIC32Platform(Platform parent, String vendor, Path rootPath) throws IOException { // super(parent, vendor, "pic32", rootPath ); // putValue("compiler.c.cmd", "xc32-gcc"); // putValue("compiler.c.elf.cmd", "xc32-g++"); // putValue("compiler.cpp.cmd", "xc32-g++"); // putValue("compiler.ar.cmd", "xc32-ar"); // putValue("compiler.objcopy.cmd", "xc32-objcopy"); // putValue("compiler.elf2hex.cmd", "xc32-bin2hex"); // putValue("compiler.size.cmd", "xc32-size"); // data.entrySet().forEach( e -> e.setValue( e.getValue().replaceAll(" -O2 ", " -O1 ") ) ); // } // // }
import static com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig.ROOT_PLATFORM_ARCH; import static com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig.ROOT_PLATFORM_VENDOR; import com.microchip.mplab.nbide.embedded.arduino.importer.pic32.PIC32Platform; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger;
package com.microchip.mplab.nbide.embedded.arduino.importer; public final class PlatformFactory { public static final String BOARDS_FILENAME = "boards.txt"; public static final String PLATFORM_FILENAME = "platform.txt"; private static final Logger LOGGER = Logger.getLogger(PlatformFactory.class.getName()); private final List<Platform> allPlatforms = new ArrayList<>(); public List<Platform> getAllPlatforms(Path arduinoSettingsPath) throws IOException { if (allPlatforms.isEmpty()) { Path settingsPath = validateArduinoSettingsPath(arduinoSettingsPath); // Find all paths containing a "platform.txt" file LOGGER.log(Level.INFO, "Searching for platform files in {0}", settingsPath); FileFinder finder = new FileFinder(PLATFORM_FILENAME); Files.walkFileTree(settingsPath, finder); List<Path> platformPaths = finder.getMatchingPaths(); Platform rootPlatform = createRootPlatform(); if ( rootPlatform == null ) { throw new RuntimeException("Failed to load the root platform!"); } platformPaths.stream().map(path -> createPlatformFromFile(rootPlatform, path)).forEach(allPlatforms::add); // Add the root platform but only if there is no platform in the user directory with the same vendor/arch: if ( !allPlatforms.stream().anyMatch(
// Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/ArduinoConfig.java // public static final String ROOT_PLATFORM_ARCH = "avr"; // // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/ArduinoConfig.java // public static final String ROOT_PLATFORM_VENDOR = "arduino"; // // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/pic32/PIC32Platform.java // public class PIC32Platform extends Platform { // // public PIC32Platform(Platform parent, String vendor, Path rootPath) throws IOException { // super(parent, vendor, "pic32", rootPath ); // putValue("compiler.c.cmd", "xc32-gcc"); // putValue("compiler.c.elf.cmd", "xc32-g++"); // putValue("compiler.cpp.cmd", "xc32-g++"); // putValue("compiler.ar.cmd", "xc32-ar"); // putValue("compiler.objcopy.cmd", "xc32-objcopy"); // putValue("compiler.elf2hex.cmd", "xc32-bin2hex"); // putValue("compiler.size.cmd", "xc32-size"); // data.entrySet().forEach( e -> e.setValue( e.getValue().replaceAll(" -O2 ", " -O1 ") ) ); // } // // } // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/PlatformFactory.java import static com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig.ROOT_PLATFORM_ARCH; import static com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig.ROOT_PLATFORM_VENDOR; import com.microchip.mplab.nbide.embedded.arduino.importer.pic32.PIC32Platform; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; package com.microchip.mplab.nbide.embedded.arduino.importer; public final class PlatformFactory { public static final String BOARDS_FILENAME = "boards.txt"; public static final String PLATFORM_FILENAME = "platform.txt"; private static final Logger LOGGER = Logger.getLogger(PlatformFactory.class.getName()); private final List<Platform> allPlatforms = new ArrayList<>(); public List<Platform> getAllPlatforms(Path arduinoSettingsPath) throws IOException { if (allPlatforms.isEmpty()) { Path settingsPath = validateArduinoSettingsPath(arduinoSettingsPath); // Find all paths containing a "platform.txt" file LOGGER.log(Level.INFO, "Searching for platform files in {0}", settingsPath); FileFinder finder = new FileFinder(PLATFORM_FILENAME); Files.walkFileTree(settingsPath, finder); List<Path> platformPaths = finder.getMatchingPaths(); Platform rootPlatform = createRootPlatform(); if ( rootPlatform == null ) { throw new RuntimeException("Failed to load the root platform!"); } platformPaths.stream().map(path -> createPlatformFromFile(rootPlatform, path)).forEach(allPlatforms::add); // Add the root platform but only if there is no platform in the user directory with the same vendor/arch: if ( !allPlatforms.stream().anyMatch(
platform -> ROOT_PLATFORM_VENDOR.equalsIgnoreCase(platform.getVendor()) && ROOT_PLATFORM_ARCH.equalsIgnoreCase(platform.getArchitecture())
chipKIT32/chipKIT-importer
src/com/microchip/mplab/nbide/embedded/arduino/importer/PlatformFactory.java
// Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/ArduinoConfig.java // public static final String ROOT_PLATFORM_ARCH = "avr"; // // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/ArduinoConfig.java // public static final String ROOT_PLATFORM_VENDOR = "arduino"; // // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/pic32/PIC32Platform.java // public class PIC32Platform extends Platform { // // public PIC32Platform(Platform parent, String vendor, Path rootPath) throws IOException { // super(parent, vendor, "pic32", rootPath ); // putValue("compiler.c.cmd", "xc32-gcc"); // putValue("compiler.c.elf.cmd", "xc32-g++"); // putValue("compiler.cpp.cmd", "xc32-g++"); // putValue("compiler.ar.cmd", "xc32-ar"); // putValue("compiler.objcopy.cmd", "xc32-objcopy"); // putValue("compiler.elf2hex.cmd", "xc32-bin2hex"); // putValue("compiler.size.cmd", "xc32-size"); // data.entrySet().forEach( e -> e.setValue( e.getValue().replaceAll(" -O2 ", " -O1 ") ) ); // } // // }
import static com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig.ROOT_PLATFORM_ARCH; import static com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig.ROOT_PLATFORM_VENDOR; import com.microchip.mplab.nbide.embedded.arduino.importer.pic32.PIC32Platform; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger;
package com.microchip.mplab.nbide.embedded.arduino.importer; public final class PlatformFactory { public static final String BOARDS_FILENAME = "boards.txt"; public static final String PLATFORM_FILENAME = "platform.txt"; private static final Logger LOGGER = Logger.getLogger(PlatformFactory.class.getName()); private final List<Platform> allPlatforms = new ArrayList<>(); public List<Platform> getAllPlatforms(Path arduinoSettingsPath) throws IOException { if (allPlatforms.isEmpty()) { Path settingsPath = validateArduinoSettingsPath(arduinoSettingsPath); // Find all paths containing a "platform.txt" file LOGGER.log(Level.INFO, "Searching for platform files in {0}", settingsPath); FileFinder finder = new FileFinder(PLATFORM_FILENAME); Files.walkFileTree(settingsPath, finder); List<Path> platformPaths = finder.getMatchingPaths(); Platform rootPlatform = createRootPlatform(); if ( rootPlatform == null ) { throw new RuntimeException("Failed to load the root platform!"); } platformPaths.stream().map(path -> createPlatformFromFile(rootPlatform, path)).forEach(allPlatforms::add); // Add the root platform but only if there is no platform in the user directory with the same vendor/arch: if ( !allPlatforms.stream().anyMatch(
// Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/ArduinoConfig.java // public static final String ROOT_PLATFORM_ARCH = "avr"; // // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/ArduinoConfig.java // public static final String ROOT_PLATFORM_VENDOR = "arduino"; // // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/pic32/PIC32Platform.java // public class PIC32Platform extends Platform { // // public PIC32Platform(Platform parent, String vendor, Path rootPath) throws IOException { // super(parent, vendor, "pic32", rootPath ); // putValue("compiler.c.cmd", "xc32-gcc"); // putValue("compiler.c.elf.cmd", "xc32-g++"); // putValue("compiler.cpp.cmd", "xc32-g++"); // putValue("compiler.ar.cmd", "xc32-ar"); // putValue("compiler.objcopy.cmd", "xc32-objcopy"); // putValue("compiler.elf2hex.cmd", "xc32-bin2hex"); // putValue("compiler.size.cmd", "xc32-size"); // data.entrySet().forEach( e -> e.setValue( e.getValue().replaceAll(" -O2 ", " -O1 ") ) ); // } // // } // Path: src/com/microchip/mplab/nbide/embedded/arduino/importer/PlatformFactory.java import static com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig.ROOT_PLATFORM_ARCH; import static com.microchip.mplab.nbide.embedded.arduino.importer.ArduinoConfig.ROOT_PLATFORM_VENDOR; import com.microchip.mplab.nbide.embedded.arduino.importer.pic32.PIC32Platform; import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; package com.microchip.mplab.nbide.embedded.arduino.importer; public final class PlatformFactory { public static final String BOARDS_FILENAME = "boards.txt"; public static final String PLATFORM_FILENAME = "platform.txt"; private static final Logger LOGGER = Logger.getLogger(PlatformFactory.class.getName()); private final List<Platform> allPlatforms = new ArrayList<>(); public List<Platform> getAllPlatforms(Path arduinoSettingsPath) throws IOException { if (allPlatforms.isEmpty()) { Path settingsPath = validateArduinoSettingsPath(arduinoSettingsPath); // Find all paths containing a "platform.txt" file LOGGER.log(Level.INFO, "Searching for platform files in {0}", settingsPath); FileFinder finder = new FileFinder(PLATFORM_FILENAME); Files.walkFileTree(settingsPath, finder); List<Path> platformPaths = finder.getMatchingPaths(); Platform rootPlatform = createRootPlatform(); if ( rootPlatform == null ) { throw new RuntimeException("Failed to load the root platform!"); } platformPaths.stream().map(path -> createPlatformFromFile(rootPlatform, path)).forEach(allPlatforms::add); // Add the root platform but only if there is no platform in the user directory with the same vendor/arch: if ( !allPlatforms.stream().anyMatch(
platform -> ROOT_PLATFORM_VENDOR.equalsIgnoreCase(platform.getVendor()) && ROOT_PLATFORM_ARCH.equalsIgnoreCase(platform.getArchitecture())