protected void exportWiki()

in src/main/java/com/atlassian/uwc/ui/listeners/ExportWikiListener.java [155:240]


	protected void exportWiki() {
		//setup feedback window - we're going to use max = 100 for the progress bar
		State state = getState();
		
		//validate wiki type
		state.updateNote("Validating Wiki Type.");
		state.updateProgress(10);
		String wikitype = this.getCurrentWikitype();
		String exporterPropPath = getExporterPropsPath(wikitype);
		File exporterConfFile = new File(exporterPropPath);
		if (!exporterConfFile.exists()) {
			String message = "Could not find export properties file: " + exporterPropPath;
			handleLastError(message, Feedback.NO_EXPORTER_FILE);
			return;
		}
		
		//load export properties
		state.updateNote("Loading Export Properties");
		state.updateProgress(10);
		Map exporterProperties = null;
		try {
			exporterProperties = PropertyFileManager.loadPropertiesFile(exporterConfFile.getPath());
		} catch (IOException e) {
			String message = "Could not load exporter properties file: " + exporterPropPath;
			handleLastError(message, Feedback.BAD_SETTINGS_FILE);
			e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
			return;
		}
		assert exporterProperties != null;
		
		//load export class
		state.updateNote("Loading Export Class");
		state.updateProgress(10);
		String exporterClassName = (String) exporterProperties.get("exporter.class");
		Class exporterClass = null;
		try {
			exporterClass = Class.forName(exporterClassName);
		} catch (ClassNotFoundException e) {
			String message = "The exporter class was not found: "+exporterClassName;
			handleLastError(message, Feedback.BAD_EXPORTER_CLASS);
			return;
		}
		
		//exporter
		state.updateNote("Exporting... ");
		state.updateProgress(10);
		feedback = Feedback.OK;
		try {
			this.exporter = (Exporter) exporterClass.newInstance();

			this.exporter.export(exporterProperties);
		} catch (InstantiationException e) {
			feedback = Feedback.BAD_EXPORTER_CLASS;
			handleLastError("", feedback);
			e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
			exportcleanup();
			return;
		} catch (IllegalAccessException e) {
			feedback = Feedback.BAD_EXPORTER_CLASS;
			handleLastError("", feedback);
			e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
			exportcleanup();
			return;
		} catch (ClassNotFoundException e) {
			feedback = Feedback.DB_DRIVER_FAILURE;
			handleLastError("", feedback);
			e.printStackTrace();
			exportcleanup();
			return;
		} catch (SQLException e) {
			feedback = Feedback.DB_FAILURE;
			handleLastError("", feedback);
			e.printStackTrace();
			exportcleanup();
			return;
		} catch (Exception e) {
			feedback = Feedback.BAD_SETTING;
			handleLastError("", feedback);
			e.printStackTrace();
			exportcleanup();
			return;
		}
		state.updateProgress(state.getMax());
		
		exportcleanup();
	}