You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2007/03/05 22:11:00 UTC
svn commit: r514867 -
/geronimo/server/branches/1.2/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
Author: djencks
Date: Mon Mar 5 13:10:58 2007
New Revision: 514867
URL: http://svn.apache.org/viewvc?view=rev&rev=514867
Log:
GERONIMO-1418 specify deployment targets by nickname
Modified:
geronimo/server/branches/1.2/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
Modified: geronimo/server/branches/1.2/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.2/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java?view=diff&rev=514867&r1=514866&r2=514867
==============================================================================
--- geronimo/server/branches/1.2/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java (original)
+++ geronimo/server/branches/1.2/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java Mon Mar 5 13:10:58 2007
@@ -122,23 +122,29 @@
}
protected static Target[] identifyTargets(List targetNames, final DeploymentManager mgr) throws DeploymentException {
+ //TODO consider if nicknames that match multiple servers should be allowed. Also if regexps should be used in matching
Target[] tlist = new Target[targetNames.size()];
Target[] all = mgr.getTargets();
Set found = new HashSet();
for (int i = 0; i < tlist.length; i++) {
- if(found.contains(targetNames.get(i))) {
- throw new DeploymentException("Target list should not contain duplicates ("+targetNames.get(i)+")");
- }
for (int j = 0; j < all.length; j++) {
Target server = all[j];
- if(server.getName().equals(targetNames.get(i))) {
+ // check for exact target name match
+ if(server.getName().equals(targetNames.get(i))
+ // check for "target-nickname" match (they match if
+ // the full target name contains the user-provided
+ // nickname)
+ || server.getName().indexOf(targetNames.get(i).toString()) > -1) {
tlist[i] = server;
+ if(found.contains(server.getName())) {
+ throw new DeploymentException("Target list should not contain duplicates or nicknames that match duplicates ("+targetNames.get(i)+")");
+ }
found.add(server.getName());
break;
}
}
if(tlist[i] == null) {
- throw new DeploymentException("No target named '"+targetNames.get(i)+"' was found");
+ throw new DeploymentException("No target named or matching '"+targetNames.get(i)+"' was found");
}
}
return tlist;