use of org.jboss.tools.openshift.common.core.connection.ConnectionsFactoryTracker in project jbosstools-openshift by jbosstools.
the class CDKOpenshiftUtility method createOpenshiftConnection.
public IConnection createOpenshiftConnection(ServiceManagerEnvironment env, ConnectionsRegistry registry) {
// Create the connection
String soughtHost = env.openshiftHost + ":" + env.openshiftPort;
ConnectionsFactoryTracker connectionsFactory = new ConnectionsFactoryTracker();
connectionsFactory.open();
IConnectionFactory factory = connectionsFactory.getById(IConnectionsFactory.CONNECTIONFACTORY_OPENSHIFT_ID);
IConnection con = factory.create(soughtHost);
// Set some defaults
String authScheme = env.getAuthorizationScheme();
String username = env.getUsername();
String password = env.getPassword();
if (authScheme != null && !authScheme.isEmpty()) {
authScheme = new String("" + authScheme.charAt(0)).toUpperCase() + authScheme.substring(1);
}
((Connection) con).setAuthScheme(authScheme);
((Connection) con).setUsername(username);
if (password != null) {
((Connection) con).setPassword(password);
}
((Connection) con).setRememberPassword(true);
String ocLoc = env.get(ServiceManagerEnvironmentLoader.OC_LOCATION_KEY);
if (ocLoc != null) {
((Connection) con).setExtendedProperty(ICommonAttributes.OC_LOCATION_KEY, ocLoc);
((Connection) con).setExtendedProperty(ICommonAttributes.OC_OVERRIDE_KEY, true);
}
updateOpenshiftConnection(env, con, false);
if (registry != null)
registry.add(con);
return con;
}
use of org.jboss.tools.openshift.common.core.connection.ConnectionsFactoryTracker in project jbosstools-openshift by jbosstools.
the class ConnectionWizardPageModel method createConnectionsFactory.
protected ConnectionsFactoryTracker createConnectionsFactory() {
ConnectionsFactoryTracker connectionsFactory = new ConnectionsFactoryTracker();
connectionsFactory.open();
return connectionsFactory;
}
Aggregations