use of org.eclipse.linuxtools.internal.docker.core.UnixSocketConnectionSettings in project linuxtools by eclipse.
the class DockerConnectionManager method reloadConnections.
public void reloadConnections() {
this.connections = connectionStorageManager.loadConnections();
for (IDockerConnection connection : connections) {
notifyListeners(connection, IDockerConnectionManagerListener.ADD_EVENT);
}
List<IDockerConnectionSettings> settings = connectionSettingsFinder.getKnownConnectionSettings();
for (IDockerConnectionSettings setting : settings) {
if (setting != null) {
IDockerConnection conn;
if (setting.getType().equals(BindingType.UNIX_SOCKET_CONNECTION)) {
UnixSocketConnectionSettings usetting = (UnixSocketConnectionSettings) setting;
conn = new DockerConnection.Builder().name(usetting.getName()).unixSocketConnection(usetting);
} else {
TCPConnectionSettings tsetting = (TCPConnectionSettings) setting;
conn = new DockerConnection.Builder().name(tsetting.getName()).tcpConnection(tsetting);
}
// add the connection but do not notify the listeners to avoid
// flickering on the Docker Explorer view for each entry
addConnection(conn, false);
}
}
}
use of org.eclipse.linuxtools.internal.docker.core.UnixSocketConnectionSettings in project linuxtools by eclipse.
the class NewDockerConnectionPage method retrieveDefaultConnectionSettings.
/**
* Sets the default settings by looking for the:
* <ul>
* <li>a Unix socket at /var/run/docker.sock</li>
* <li>the following environment variables:
* <ul>
* <li>DOCKER_HOST</li>
* <li>DOCKER_CERT_PATH</li>
* <li>DOCKER_TLS_VERIFY</li>
* </ul>
* </li>
* </ul>
* and sets the default connection settings accordingly.
*/
private void retrieveDefaultConnectionSettings() {
// progressbar
try {
getWizard().getContainer().run(true, true, monitor -> {
monitor.beginTask(WizardMessages.getString(// $NON-NLS-1$
"DockerConnectionPage.retrieveTask"), 1);
final DockerConnectionManager dockerConnectionManager = DockerConnectionManager.getInstance();
final IDockerConnectionSettings defaultConnectionSettings = dockerConnectionManager.findDefaultConnectionSettings();
if (defaultConnectionSettings != null) {
model.setCustomSettings(!defaultConnectionSettings.isSettingsResolved());
model.setConnectionName(dockerConnectionManager.resolveConnectionName(defaultConnectionSettings));
switch(defaultConnectionSettings.getType()) {
case TCP_CONNECTION:
final TCPConnectionSettings tcpConnectionSettings = (TCPConnectionSettings) defaultConnectionSettings;
model.setTcpConnectionBindingMode(true);
model.setTcpCertPath(tcpConnectionSettings.getPathToCertificates());
model.setTcpTLSVerify(tcpConnectionSettings.isTlsVerify());
model.setTcpHost(tcpConnectionSettings.getHost());
break;
case UNIX_SOCKET_CONNECTION:
model.setUnixSocketBindingMode(true);
final UnixSocketConnectionSettings unixSocketConnectionSettings = (UnixSocketConnectionSettings) defaultConnectionSettings;
model.setUnixSocketPath(unixSocketConnectionSettings.getPath());
break;
}
} else {
// fall-back to custom settings, suggesting a
// Unix Socket connection to the user.
model.setCustomSettings(true);
model.setUnixSocketBindingMode(true);
}
monitor.done();
});
} catch (InvocationTargetException | InterruptedException e) {
Activator.log(e);
}
}
Aggregations