use of com.revolsys.webservice.WebServiceConnectionRegistry in project com.revolsys.open by revolsys.
the class WebServiceConnectionTrees method editConnection.
@SuppressWarnings("deprecation")
private static void editConnection(final WebServiceConnection connection) {
final WebServiceConnectionRegistry registry = connection.getRegistry();
final ValueField panel = new ValueField();
panel.setTitle("Edit Web Service Connection");
Borders.titled(panel, "Web Service Connection");
SwingUtil.addLabel(panel, "Name");
final MapEx config = connection.getConfig();
final String oldName = connection.getName();
final TextField nameField = new TextField("name", oldName, 20);
panel.add(nameField);
SwingUtil.addLabel(panel, "Service URL");
String serviceUrl = config.getString("serviceUrl");
final TextField urlField = new TextField("serviceUrl", serviceUrl, 50);
panel.add(urlField);
SwingUtil.addLabel(panel, "Username");
String username = config.getString("username");
final TextField usernameField = new TextField("username", username, 30);
panel.add(usernameField);
SwingUtil.addLabel(panel, "Password");
String password = PasswordUtil.decrypt(config.getString("password"));
final PasswordField passwordField = new PasswordField("password", password, 30);
panel.add(passwordField);
GroupLayouts.makeColumns(panel, 2, true);
panel.showDialog();
if (panel.isSaved()) {
serviceUrl = urlField.getText();
if (serviceUrl != null) {
final String name = nameField.getText();
username = usernameField.getText();
password = passwordField.getText();
config.put("name", name);
config.put("serviceUrl", serviceUrl);
config.put("username", username);
config.put("password", PasswordUtil.encrypt(password));
if (Strings.equals(oldName, name)) {
connection.setProperties(config);
} else {
registry.removeConnection(connection);
registry.newConnection(config);
}
}
}
}
use of com.revolsys.webservice.WebServiceConnectionRegistry in project com.revolsys.open by revolsys.
the class ProjectFrame method setConnectionRegistries.
private void setConnectionRegistries() {
final String connectionRegistryName = this.project.getConnectionRegistryName();
final RecordStoreConnectionManager recordStoreConnectionManager = RecordStoreConnectionManager.get();
recordStoreConnectionManager.removeConnectionRegistry(connectionRegistryName);
final RecordStoreConnectionRegistry recordStores = this.project.getRecordStores();
recordStoreConnectionManager.addConnectionRegistry(recordStores);
final FileConnectionManager fileConnectionManager = FileConnectionManager.get();
fileConnectionManager.removeConnectionRegistry(connectionRegistryName);
final FolderConnectionRegistry folderConnections = this.project.getFolderConnections();
fileConnectionManager.addConnectionRegistry(folderConnections);
final WebServiceConnectionManager webServiceConnectionManager = WebServiceConnectionManager.get();
webServiceConnectionManager.removeConnectionRegistry(connectionRegistryName);
final WebServiceConnectionRegistry webServices = this.project.getWebServices();
webServiceConnectionManager.addConnectionRegistry(webServices);
}
use of com.revolsys.webservice.WebServiceConnectionRegistry in project com.revolsys.open by revolsys.
the class Project method readProject.
public void readProject(final Project rootProject, final Resource resource) {
this.resource = resource;
if (this.resource.exists()) {
String name;
try (final BaseCloseable booleanValueCloseable = eventsDisabled()) {
final RecordStoreConnectionRegistry oldRecordStoreConnections = RecordStoreConnectionRegistry.getForThread();
try {
final boolean readOnly = isReadOnly();
final Resource folderConnectionsDirectory = this.resource.newChildResource("Folder Connections");
this.folderConnections.clear(folderConnectionsDirectory, readOnly);
final Resource recordStoresDirectory = this.resource.newChildResource("Record Stores");
this.recordStores.clear(recordStoresDirectory, readOnly);
final Resource webServicesDirectory = this.resource.newChildResource("Web Services");
this.webServices.clear(webServicesDirectory, readOnly);
if (rootProject == null) {
RecordStoreConnectionRegistry.setForThread(this.recordStores);
} else {
final WebServiceConnectionRegistry rootWebServices = rootProject.getWebServices();
importConnections("Web Service", this, this.webServices, rootWebServices);
final RecordStoreConnectionRegistry rootRecordStores = rootProject.getRecordStores();
rootProject.importConnections("Record Store", this, this.recordStores, rootRecordStores);
final FolderConnectionRegistry rootFolderConnections = rootProject.getFolderConnections();
rootProject.importConnections("Folder Connection", this, this.folderConnections, rootFolderConnections);
}
final Resource layersDir = this.resource.newChildResource("Layers");
final boolean hasLayers = layersDir.exists();
if (hasLayers) {
readProperties(layersDir);
}
if (hasLayers) {
readLayers(rootProject, layersDir);
}
readBaseMapsLayers(rootProject, this.resource);
} finally {
RecordStoreConnectionRegistry.setForThread(oldRecordStoreConnections);
}
name = getName();
setName(null);
}
setName(name);
}
}
Aggregations