// Path: src/main/java/org/openstreetmap/osmaxil/flow/__AbstractImportFlow.java
// public abstract class __AbstractImportFlow<ELEMENT extends AbstractElement, IMPORT extends AbstractImport> {
// 
// 	// =========================================================================
// 	// Instance variables
// 	// =========================================================================
// 
// 	protected List<IMPORT> loadedImports = new ArrayList<>();
// 
// 	private Geometry includingArea;
// 
// 	private Geometry excludingArea;
// 
// 	protected GeometryFactory geometryFactory;
// 
// 	@Value("${osmaxil.syncMode}")
// 	protected String synchronizationMode;
// 
// 	@Value("${osmaxil.minMatchingScore}")
// 	protected float minMatchingScore;
// 	
// 	@Value("${osmaxil.refCodeSuffix}")
// 	protected String refCodeSuffix;
// 	
// 	@Value("${osmaxil.useRefCode}")
// 	protected boolean useReferenceCode;
// 	
// 	@Value("${osmaxil.filteringArea.srid}")
// 	protected int filteringAreaSrid;
// 
// 	@Value("${osmaxil.filteringArea.including}")
// 	protected String includingAreaString;
// 
// 	@Value("${osmaxil.filteringArea.excluding}")
// 	protected String excludingAreaString;
// 
// 	@Autowired
// 	protected ApplicationContext appContext;
// 
// 	@Autowired
// 	protected OsmPostgisDB osmPostgis;
// 
// 	@Autowired
// 	protected OsmStandardApi osmStandardApi;
// 
// 	@Autowired
// 	protected OsmXmlFile osmXmlFile;
// 
// 	// =========================================================================
// 	// Static variables
// 	// =========================================================================
// 
// 	static protected final Logger LOGGER = Logger.getLogger(Application.class);
// 
// 	static protected final Logger LOGGER_FOR_STATS = Logger.getLogger("LoggerForStats");
// 
// 	static protected final String LOG_SEPARATOR = "==========================================================";
// 
// 	// =========================================================================
// 	// Abstract methods
// 	// =========================================================================
// 
// 	abstract public void load() throws Exception;
// 
// 	abstract public void process();
// 
// 	abstract public void synchronize();
// 
// 	abstract public void displayLoadingStatistics();
// 
// 	abstract public void displayProcessingStatistics();
// 
// 	abstract public void displaySynchronizingStatistics();
// 
// 	// =========================================================================
// 	// Public and protected methods
// 	// =========================================================================
// 
// 	protected boolean checkCoordinatesWithFilteringArea(double x, double y) {
// 		Geometry geom = this.geometryFactory.createPoint(new Coordinate(x, y));
// 		IntersectionMatrix includingMatrix = geom.relate(this.includingArea);
// 		if (!includingMatrix.isWithin()) {
// 			LOGGER.info("Coordinates (" + x + ", " + y + ") are outside the including area " + this.includingAreaString);
// 			return false;
// 		}
// 		IntersectionMatrix excludingMatrix = geom.relate(this.excludingArea);
// 		if (excludingMatrix.isWithin()) {
// 			LOGGER.info("Coordinates (" + x + ", " + y + ") are inside the excluding area " + this.excludingAreaString);
// 			return false;
// 		}
// 		return true;
// 	}
// 
// 	// =========================================================================
// 	// Private methods
// 	// =========================================================================
// 
// 	@PostConstruct
// 	private void init() throws ParseException {
// 		this.geometryFactory = new GeometryFactory();
// 		WKTReader wktReader = new WKTReader();
// 		// Build the including and excluding area
// 		this.includingArea = wktReader.read(this.includingAreaString);
// 		this.excludingArea = wktReader.read(this.excludingAreaString);
// 	}
// 
// }


import org.apache.log4j.Logger;
import org.openstreetmap.osmaxil.flow.__AbstractImportFlow;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;
package org.openstreetmap.osmaxil;


@Component("OsmaxilApp")
public class Application {

	@Value("${osmaxil.flow}")
	public String flow;
	
	public static final String NAME = "Osmaxil";

	private static ClassPathXmlApplicationContext applicationContext;

	static private final Logger LOGGER = Logger.getLogger(Application.class);

	static protected final Logger LOGGER_FOR_STATS = Logger.getLogger("LoggerForStats");

	public static void main(String[] args) {
		applicationContext = new ClassPathXmlApplicationContext("spring.xml");
		Application app = (Application) applicationContext.getBean("OsmaxilApp");
		LOGGER.info("=== Starting Osmaxil ===");
		long startTime = System.currentTimeMillis();
		try {
			app.run();
		} catch (Exception e) {
			LOGGER.error(e);
		}
		LOGGER_FOR_STATS.info("Job has been executed in " + (System.currentTimeMillis() - startTime) / 1000 + " seconds");
		LOGGER.info("=== Osmaxil has finished its job ===");
		applicationContext.close();
	}
	
	public void run() throws Exception {
// Path: src/main/java/org/openstreetmap/osmaxil/flow/__AbstractImportFlow.java
// public abstract class __AbstractImportFlow<ELEMENT extends AbstractElement, IMPORT extends AbstractImport> {
// 
// 	// =========================================================================
// 	// Instance variables
// 	// =========================================================================
// 
// 	protected List<IMPORT> loadedImports = new ArrayList<>();
// 
// 	private Geometry includingArea;
// 
// 	private Geometry excludingArea;
// 
// 	protected GeometryFactory geometryFactory;
// 
// 	@Value("${osmaxil.syncMode}")
// 	protected String synchronizationMode;
// 
// 	@Value("${osmaxil.minMatchingScore}")
// 	protected float minMatchingScore;
// 	
// 	@Value("${osmaxil.refCodeSuffix}")
// 	protected String refCodeSuffix;
// 	
// 	@Value("${osmaxil.useRefCode}")
// 	protected boolean useReferenceCode;
// 	
// 	@Value("${osmaxil.filteringArea.srid}")
// 	protected int filteringAreaSrid;
// 
// 	@Value("${osmaxil.filteringArea.including}")
// 	protected String includingAreaString;
// 
// 	@Value("${osmaxil.filteringArea.excluding}")
// 	protected String excludingAreaString;
// 
// 	@Autowired
// 	protected ApplicationContext appContext;
// 
// 	@Autowired
// 	protected OsmPostgisDB osmPostgis;
// 
// 	@Autowired
// 	protected OsmStandardApi osmStandardApi;
// 
// 	@Autowired
// 	protected OsmXmlFile osmXmlFile;
// 
// 	// =========================================================================
// 	// Static variables
// 	// =========================================================================
// 
// 	static protected final Logger LOGGER = Logger.getLogger(Application.class);
// 
// 	static protected final Logger LOGGER_FOR_STATS = Logger.getLogger("LoggerForStats");
// 
// 	static protected final String LOG_SEPARATOR = "==========================================================";
// 
// 	// =========================================================================
// 	// Abstract methods
// 	// =========================================================================
// 
// 	abstract public void load() throws Exception;
// 
// 	abstract public void process();
// 
// 	abstract public void synchronize();
// 
// 	abstract public void displayLoadingStatistics();
// 
// 	abstract public void displayProcessingStatistics();
// 
// 	abstract public void displaySynchronizingStatistics();
// 
// 	// =========================================================================
// 	// Public and protected methods
// 	// =========================================================================
// 
// 	protected boolean checkCoordinatesWithFilteringArea(double x, double y) {
// 		Geometry geom = this.geometryFactory.createPoint(new Coordinate(x, y));
// 		IntersectionMatrix includingMatrix = geom.relate(this.includingArea);
// 		if (!includingMatrix.isWithin()) {
// 			LOGGER.info("Coordinates (" + x + ", " + y + ") are outside the including area " + this.includingAreaString);
// 			return false;
// 		}
// 		IntersectionMatrix excludingMatrix = geom.relate(this.excludingArea);
// 		if (excludingMatrix.isWithin()) {
// 			LOGGER.info("Coordinates (" + x + ", " + y + ") are inside the excluding area " + this.excludingAreaString);
// 			return false;
// 		}
// 		return true;
// 	}
// 
// 	// =========================================================================
// 	// Private methods
// 	// =========================================================================
// 
// 	@PostConstruct
// 	private void init() throws ParseException {
// 		this.geometryFactory = new GeometryFactory();
// 		WKTReader wktReader = new WKTReader();
// 		// Build the including and excluding area
// 		this.includingArea = wktReader.read(this.includingAreaString);
// 		this.excludingArea = wktReader.read(this.excludingAreaString);
// 	}
// 
// }


// Path: src/main/java/org/openstreetmap/osmaxil/Application.java
import org.apache.log4j.Logger;
import org.openstreetmap.osmaxil.flow.__AbstractImportFlow;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Component;

package org.openstreetmap.osmaxil;


@Component("OsmaxilApp")
public class Application {

	@Value("${osmaxil.flow}")
	public String flow;
	
	public static final String NAME = "Osmaxil";

	private static ClassPathXmlApplicationContext applicationContext;

	static private final Logger LOGGER = Logger.getLogger(Application.class);

	static protected final Logger LOGGER_FOR_STATS = Logger.getLogger("LoggerForStats");

	public static void main(String[] args) {
		applicationContext = new ClassPathXmlApplicationContext("spring.xml");
		Application app = (Application) applicationContext.getBean("OsmaxilApp");
		LOGGER.info("=== Starting Osmaxil ===");
		long startTime = System.currentTimeMillis();
		try {
			app.run();
		} catch (Exception e) {
			LOGGER.error(e);
		}
		LOGGER_FOR_STATS.info("Job has been executed in " + (System.currentTimeMillis() - startTime) / 1000 + " seconds");
		LOGGER.info("=== Osmaxil has finished its job ===");
		applicationContext.close();
	}
	
	public void run() throws Exception {
		__AbstractImportFlow<?, ?> flow = (__AbstractImportFlow<?, ?>) applicationContext.getBean(this.flow);