|
From: <ha...@us...> - 2008-04-08 11:20:48
|
Revision: 1962
http://cogkit.svn.sourceforge.net/cogkit/?rev=1962&view=rev
Author: hategan
Date: 2008-04-08 04:20:44 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
fixed issues introduced by previous commit
Modified Paths:
--------------
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/ServiceContactImpl.java
trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/ServiceImpl.java
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/ServiceContactImpl.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/ServiceContactImpl.java 2008-04-07 08:02:56 UTC (rev 1961)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/ServiceContactImpl.java 2008-04-08 11:20:44 UTC (rev 1962)
@@ -16,25 +16,29 @@
public static final ServiceContact LOCALHOST = new ServiceContactImpl(
"localhost");
- private String host, path;
+ private String host, path, contact;
private int port;
public ServiceContactImpl() {
}
public ServiceContactImpl(String contact) {
+ this.contact = contact;
parse(contact);
}
public ServiceContactImpl(String host, int port) {
this.host = host;
this.port = port;
+ buildContact();
}
public void setHost(String host) {
this.host = host;
port = -1;
+ buildContact();
}
+
public String getHost() {
return host;
@@ -42,6 +46,7 @@
public void setPort(int port) {
this.port = port;
+ buildContact();
}
public int getPort() {
@@ -49,11 +54,12 @@
}
public void setContact(String contact) {
+ this.contact = contact;
parse(contact);
}
public String getContact() {
- return host + (port == -1 ? "" : ":" + port) + (path == null ? "" : path);
+ return contact;
}
public boolean equals(Object o) {
@@ -69,10 +75,17 @@
}
private void parse(String contact) {
- int portsep = contact.indexOf(':');
- int pathsep = contact.indexOf('/');
+ int schemesep = contact.indexOf("://");
+ if (schemesep == -1) {
+ schemesep = 0;
+ }
+ else {
+ schemesep += 3;
+ }
+ int portsep = contact.indexOf(':', schemesep);
+ int pathsep = contact.indexOf('/', schemesep);
if (portsep != -1 && (pathsep == -1 || portsep < pathsep)) {
- host = contact.substring(0, portsep);
+ host = contact.substring(schemesep, portsep);
if (pathsep == -1) {
port = Integer.parseInt(contact.substring(portsep + 1));
path = null;
@@ -83,16 +96,20 @@
}
}
else if (pathsep != -1) {
- host = contact.substring(0, pathsep);
+ host = contact.substring(schemesep, pathsep);
port = -1;
path = contact.substring(pathsep);
}
else {
- host = contact;
+ host = contact.substring(schemesep);
port = -1;
path = null;
}
}
+
+ private void buildContact() {
+ this.contact = host + (port == -1 ? "" : (":" + port));
+ }
public String toString() {
return getContact();
Modified: trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/ServiceImpl.java
===================================================================
--- trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/ServiceImpl.java 2008-04-07 08:02:56 UTC (rev 1961)
+++ trunk/current/src/cog/modules/abstraction-common/src/org/globus/cog/abstraction/impl/common/task/ServiceImpl.java 2008-04-08 11:20:44 UTC (rev 1962)
@@ -21,7 +21,7 @@
public class ServiceImpl implements Service {
private Identity identity = null;
private String name = "";
- private ServiceContact serviceContact = null;
+ private ServiceContact serviceContact;
private SecurityContext securityContext = null;
private Map attributes;
private String provider = null;
@@ -88,7 +88,7 @@
}
public ServiceContact getServiceContact() {
- return this.serviceContact;
+ return serviceContact;
}
public void setSecurityContext(SecurityContext securityContext) {
@@ -153,7 +153,7 @@
}
public String toString() {
- return this.serviceContact.toString() + "(" + this.provider + ")";
+ return serviceContact.toString() + "(" + this.provider + ")";
}
public int hashCode() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|