Author: jgao
Date: 2010-10-20 15:05:57 -0700 (Wed, 20 Oct 2010)
New Revision: 22320
Modified:
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientManager.java
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
Log:
Cythesaurus: option to connect to an idmapper right after registration
Modified:
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientManager.java
===================================================================
---
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientManager.java
2010-10-20 21:18:06 UTC (rev 22319)
+++
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/IDMapperClientManager.java
2010-10-20 22:05:57 UTC (rev 22320)
@@ -406,16 +406,20 @@
}
}
- public static void registerClient(final IDMapperClient client) {
- registerClient(client, true);
+ public static boolean registerClient(final IDMapperClient client) {
+ return registerClient(client, true);
}
+ public static boolean registerClient(final IDMapperClient client, boolean
selected) {
+ return registerClient(client, selected, false);
+ }
+
/**
* Register a client. If there exists a client in the manager with the same
* connection string, that client will be replaced with the new client.
* @param client
*/
- public static void registerClient(final IDMapperClient client, boolean
selected) {
+ public static boolean registerClient(final IDMapperClient client, boolean
selected, boolean connectImmediately) {
if (client == null) {
throw new IllegalArgumentException();
}
@@ -425,7 +429,10 @@
removeClient(oldClient);
}
- //preprocess(client); // set fullname if null
+ if (connectImmediately) {
+ if (null == client.getIDMapper())
+ return false;
+ }
clientConnectionStringMap.put(client.getConnectionString(), client);
@@ -434,6 +441,7 @@
}
fireIDMapperChange();
+ return true;
}
public static void setClientSelection(IDMapperClient client, boolean
select) {
Modified:
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
===================================================================
---
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
2010-10-20 21:18:06 UTC (rev 22319)
+++
csplugins/trunk/soc/jgao/IDMapping/src/csplugins/id/mapping/service/CyThesaurusNamespace.java
2010-10-20 22:05:57 UTC (rev 22320)
@@ -295,11 +295,14 @@
.Builder(connString, classPath)
.displayName(displayName)
.build();
- IDMapperClientManager.registerClient(client);
- result.addMessage("Successfully registered");
+ boolean succ = IDMapperClientManager.registerClient(client, true,
true);
+ if (succ)
+ result.addMessage("Successfully registered");
+ else
+ result.addError("Failed to register the resource\n");
} catch (Exception e) {
- // throw new CyCommandException(e);
- result.addError("Failed to register the
resource\n"+e.getMessage());
+ throw new CyCommandException(e);
+// result.addError("Failed to register the
resource\n"+e.getMessage());
}
return result;
}
@@ -320,8 +323,8 @@
}
} catch (Exception e) {
- // throw new CyCommandException(e);
- result.addError("Failed to remove the resource\n"+e.getMessage());
+ throw new CyCommandException(e);
+// result.addError("Failed to remove the
resource\n"+e.getMessage());
}
return result;
}
@@ -343,8 +346,8 @@
result.addMessage("Selected.");
}
} catch (Exception e) {
- // throw new CyCommandException(e);
- result.addError("Failed to remove the resource\n"+e.getMessage());
+ throw new CyCommandException(e);
+// result.addError("Failed to remove the
resource\n"+e.getMessage());
}
return result;
}
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.