/** * Externalizes a {@link CouchDbDatastore} to a XML element * * @param datastore * @return */ public Element toElement(final CouchDbDatastore datastore) { final Element ds = getDocument().createElement("couchdb-datastore"); ds.setAttribute("name", datastore.getName()); if (!Strings.isNullOrEmpty(datastore.getDescription())) { ds.setAttribute("description", datastore.getDescription()); } appendElement(ds, "hostname", datastore.getHostname()); appendElement(ds, "port", datastore.getPort()); appendElement(ds, "username", datastore.getUsername()); appendElement(ds, "password", encodePassword(datastore.getPassword())); appendElement(ds, "ssl", datastore.isSslEnabled()); return ds; }
} else if (datastore instanceof CouchDbDatastore) { final CouchDbDatastore couchDbDatastore = (CouchDbDatastore) datastore; return (couchDbDatastore.isSslEnabled() ? "https://" : "http://") + couchDbDatastore.getHostname() + ":" + couchDbDatastore.getPort(); } else if (datastore instanceof PojoDatastore) {
_hostnameTextField.setText(originalDatastore.getHostname()); _portTextField.setText(originalDatastore.getPort() + ""); _sslCheckBox.setSelected(originalDatastore.isSslEnabled()); _usernameTextField.setText(originalDatastore.getUsername()); _passwordField.setText(new String(originalDatastore.getPassword()));