optionPass,
properties.getProperty("password",""),
	public static void process(String args[]) {		// read properties		Properties properties = new Properties();		try {			File propFile = Configuration.lookup("backup.properties");			InputStream pin;			if (propFile.canRead())				pin = new FileInputStream(propFile);			else				pin = Main.class.getResourceAsStream("backup.properties");			if (pin != null)				properties.load(pin);		} catch (IOException ioe) {		}		// parse command-line options		final CLArgsParser optParser = new CLArgsParser(args, OPTIONS);		if (optParser.getErrorString() != null) {			System.err.println("ERROR: " + optParser.getErrorString());			return;		}		final List opt = optParser.getArguments();		final int size = opt.size();		CLOption option;		String optionBackup = null;		String optionRestore = null;		String optionPass = null;		String optionDbaPass = null;		boolean doBackup = false;		boolean doRestore = false;		boolean guiMode = false;		for (int i = 0; i < size; i++) {			option = (CLOption) opt.get(i);			switch (option.getId()) {				case HELP_OPT :					printUsage();					return;				case GUI_OPT :					guiMode = true;					break;				case OPTION_OPT :					properties.setProperty(option.getArgument(0), option.getArgument(1));					break;				case USER_OPT :					properties.setProperty("user", option.getArgument());					break;				case PASS_OPT :					optionPass = option.getArgument();					break;				case DBA_PASS_OPT :					optionDbaPass = option.getArgument();					break;				case BACKUP_OPT :					if (option.getArgumentCount() == 1)						optionBackup = option.getArgument();					else						optionBackup = null;					doBackup = true;					break;				case RESTORE_OPT :					if(option.getArgumentCount() == 1)						optionRestore = option.getArgument();					doRestore = true;					break;				case BACKUP_DIR_OPT :					properties.setProperty("backup-dir", option.getArgument());					break;			}		}		// initialize driver		Database database;		try {			Class cl =				Class.forName(properties.getProperty("driver", "org.exist.xmldb.DatabaseImpl"));			database = (Database) cl.newInstance();			database.setProperty("create-database", "true");			if (properties.containsKey("configuration"))				database.setProperty("configuration", properties.getProperty("configuration"));			DatabaseManager.registerDatabase(database);		} catch (ClassNotFoundException e) {			reportError(e);			return;		} catch (InstantiationException e) {			reportError(e);			return;		} catch (IllegalAccessException e) {			reportError(e);			return;		} catch (XMLDBException e) {			reportError(e);			return;		}		// process		if (doBackup) {			if (optionBackup == null) {				if (guiMode) {					CreateBackupDialog dialog =						new CreateBackupDialog(							properties.getProperty("uri", "xmldb:exist://"),							properties.getProperty("user", "admin"),							optionPass,							properties.getProperty("backup-dir", System.getProperty("user.home") +									File.separatorChar + "backup"));					if (JOptionPane						.showOptionDialog(							null,							dialog,							"Create Backup",							JOptionPane.OK_CANCEL_OPTION,							JOptionPane.QUESTION_MESSAGE,							null,							null,							null)						== JOptionPane.YES_OPTION) {						optionBackup = dialog.getCollection();						properties.setProperty("backup-dir", dialog.getBackupDir());					}				} else					optionBackup = DBBroker.ROOT_COLLECTION;			}			if (optionBackup != null) {				try {					Backup backup =					new Backup(						properties.getProperty("user", "admin"),						optionPass,						properties.getProperty("backup-dir", "backup"),						XmldbURI.xmldbUriFor(properties.getProperty("uri", "xmldb:exist://") + optionBackup));					backup.backup(guiMode, null);				} catch (XMLDBException e) {					reportError(e);				} catch (IOException e) {					reportError(e);				} catch (SAXException e) {					System.err.println("ERROR: " + e.getMessage());					System.err.println("caused by ");					e.getException().printStackTrace();				} catch (URISyntaxException e) {					reportError(e);				}			}		}		if (doRestore) {			if (optionRestore == null && guiMode) {				JFileChooser chooser = new JFileChooser();				chooser.setMultiSelectionEnabled(false);				chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);				if (chooser.showDialog(null, "Select backup file for restore")					== JFileChooser.APPROVE_OPTION) {					File f = chooser.getSelectedFile();					optionRestore = f.getAbsolutePath();				}			}			if (optionRestore != null) {				try {					Restore restore =						new Restore(							properties.getProperty("user", "admin"),							optionPass,							optionDbaPass,							new File(optionRestore),							properties.getProperty("uri", "xmldb:exist://"));					restore.restore(guiMode, null);				} catch (FileNotFoundException e) {					reportError(e);				} catch (ParserConfigurationException e) {					reportError(e);				} catch (SAXException e) {					reportError(e);				} catch (XMLDBException e) {					reportError(e);				} catch (IOException e) {					reportError(e);				}			}		}		try {			Collection root =				DatabaseManager.getCollection(					properties.getProperty("uri", "xmldb:exist://") + DBBroker.ROOT_COLLECTION,					properties.getProperty("user", "admin"),					optionDbaPass == null ? optionPass : optionDbaPass);			shutdown(root);		} catch (XMLDBException e1) {			e1.printStackTrace();		}		System.exit(0);	}