Author: adietish
Date: 2012-10-18 08:05:28 -0400 (Thu, 18 Oct 2012)
New Revision: 44578
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
Log:
[JBIDE-12855] fixed lookup, replaced URL by URI
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-10-18
10:58:11 UTC (rev 44577)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-10-18
12:05:28 UTC (rev 44578)
@@ -12,6 +12,7 @@
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -129,14 +130,14 @@
*/
public static IApplication getApplication(IServer server) {
final String appName = getExpressApplicationName(server);
- final String userName = getExpressUsername(server);
+ final String connectionUrl = getExpressConnectionUrl(server);
try {
- final Connection ud = ConnectionsModel.getDefault().getConnectionByUrl(userName);
+ final Connection ud =
ConnectionsModel.getDefault().getConnectionByUrl(connectionUrl);
if (ud != null) {
return ud.getApplicationByName(appName); // May be long running
}
} catch (OpenShiftException e) {
- Logger.error(NLS.bind("Failed to retrieve application ''{0}''
from user ''{1}}'", appName, userName), e);
+ Logger.error(NLS.bind("Failed to retrieve application ''{0}'' at
url ''{1}}'", appName, connectionUrl), e);
}
return null;
}
@@ -172,7 +173,7 @@
connectionValue = ConnectionUtils.getUrlForUsername(username);
} catch (UnsupportedEncodingException e) {
OpenShiftUIActivator.log(NLS.bind("Could not get connection url for user
{0}", username), e);
- } catch (MalformedURLException e) {
+ } catch (URISyntaxException e) {
OpenShiftUIActivator.log(NLS.bind("Could not get connection url for user
{0}", username), e);
}
}
@@ -449,8 +450,8 @@
public static IApplication findApplicationForServer(IServerAttributes server) {
try {
- String user = ExpressServerUtils.getExpressUsername(server);
- Connection connection = ConnectionsModel.getDefault().getConnectionByUrl(user);
+ String connectionUrl = ExpressServerUtils.getExpressConnectionUrl(server);
+ Connection connection =
ConnectionsModel.getDefault().getConnectionByUrl(connectionUrl);
String appName = ExpressServerUtils.getExpressApplicationName(server);
IApplication app = connection == null ? null :
connection.getApplicationByName(appName);
return app;
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java 2012-10-18
10:58:11 UTC (rev 44577)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/Connection.java 2012-10-18
12:05:28 UTC (rev 44578)
@@ -15,6 +15,7 @@
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.SocketTimeoutException;
+import java.net.URI;
import java.net.URL;
import java.util.List;
@@ -72,7 +73,7 @@
this.prompter = prompter;
}
- public Connection(URL url, ICredentialsPrompter prompter) throws MalformedURLException,
UnsupportedEncodingException {
+ public Connection(URI url, ICredentialsPrompter prompter) throws
UnsupportedEncodingException {
UrlPortions portions = UrlUtils.toPortions(url);
this.username = portions.getUsername();
this.password = portions.getPassword();
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java 2012-10-18
10:58:11 UTC (rev 44577)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionUtils.java 2012-10-18
12:05:28 UTC (rev 44578)
@@ -11,7 +11,7 @@
package org.jboss.tools.openshift.express.internal.core.connection;
import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
+import java.net.URISyntaxException;
import org.jboss.tools.openshift.express.internal.core.util.UrlUtils;
import org.jboss.tools.openshift.express.internal.core.util.UrlUtils.UrlPortions;
@@ -30,7 +30,7 @@
// inhibit instantiation
}
- public static String getUrlForUsername(String username) throws
UnsupportedEncodingException, MalformedURLException {
+ public static String getUrlForUsername(String username) throws
UnsupportedEncodingException, URISyntaxException {
UrlPortions portions = UrlUtils.toPortions(getDefaultHostUrl());
return UrlUtils.getUrlFor(username, portions.getHost(), portions.getProtocol());
}
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java 2012-10-18
10:58:11 UTC (rev 44577)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/connection/ConnectionsModel.java 2012-10-18
12:05:28 UTC (rev 44578)
@@ -11,8 +11,8 @@
package org.jboss.tools.openshift.express.internal.core.connection;
import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -163,10 +163,10 @@
for (int i = 0; i < connections.length; i++) {
Connection connection = null;
try {
- URL connectionUrl = new URL(connections[i]);
+ URI connectionUrl = new URI(connections[i]);
connection = new Connection(connectionUrl, new CredentialsPrompter());
addConnection(connection);
- } catch (MalformedURLException e) {
+ } catch (URISyntaxException e) {
OpenShiftUIActivator.log(NLS.bind("Could not add connection for {0}.",
connections[i]), e);
} catch (UnsupportedEncodingException e) {
OpenShiftUIActivator.log(NLS.bind("Could not add connection for {0}.",
connections[i]), e);
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java 2012-10-18
10:58:11 UTC (rev 44577)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/util/UrlUtils.java 2012-10-18
12:05:28 UTC (rev 44578)
@@ -11,8 +11,8 @@
package org.jboss.tools.openshift.express.internal.core.util;
import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.net.URLEncoder;
@@ -34,11 +34,11 @@
// inhibit instantiation
}
- public static UrlPortions toPortions(String url) throws UnsupportedEncodingException,
MalformedURLException {
- return new UrlPortions(new URL(url));
+ public static UrlPortions toPortions(String url) throws UnsupportedEncodingException,
URISyntaxException {
+ return new UrlPortions(new URI(url));
}
- public static UrlPortions toPortions(URL url) throws UnsupportedEncodingException {
+ public static UrlPortions toPortions(URI url) throws UnsupportedEncodingException {
return new UrlPortions(url);
}
@@ -49,7 +49,7 @@
private String password;
private String host;
- private UrlPortions(URL url) throws UnsupportedEncodingException {
+ private UrlPortions(URI url) throws UnsupportedEncodingException {
String userInfo = url.getUserInfo();
if (userInfo != null) {
String[] userInfos = url.getUserInfo().split(":");
@@ -61,7 +61,7 @@
}
}
this.host = url.getHost();
- this.protocol = url.getProtocol();
+ this.protocol = url.getScheme();
}
public String getUsername() {
Modified:
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java
===================================================================
---
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-10-18
10:58:11 UTC (rev 44577)
+++
branches/jbosstools-4.0.0.Beta1/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsSection.java 2012-10-18
12:05:28 UTC (rev 44578)
@@ -11,8 +11,8 @@
package org.jboss.tools.openshift.express.internal.ui.behaviour;
import java.io.UnsupportedEncodingException;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.Arrays;
import org.eclipse.core.resources.IFolder;
@@ -137,9 +137,9 @@
String connectionLabel = "";
if (!StringUtils.isEmpty(connectionUrl)) {
try {
- Connection connection = new Connection(new URL(connectionUrl), null);
+ Connection connection = new Connection(new URI(connectionUrl), null);
connectionLabel = connection.getUsername() + " - " + connection.getHost();
- } catch (MalformedURLException e) {
+ } catch (URISyntaxException e) {
OpenShiftUIActivator.log(NLS.bind("Could not get URL for connection {0}",
connectionUrl), e);
} catch (UnsupportedEncodingException e) {
OpenShiftUIActivator.log(NLS.bind("Could not get URL for connection {0}",
connectionUrl), e);