geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r515007 - /geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
Date Tue, 06 Mar 2007 07:26:42 GMT
Author: djencks
Date: Mon Mar  5 23:26:41 2007
New Revision: 515007

URL: http://svn.apache.org/viewvc?view=rev&rev=515007
Log:
GERONIMO-1418 allow nicknames for deployment targets

Modified:
    geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java

Modified: geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java?view=diff&rev=515007&r1=515006&r2=515007
==============================================================================
--- geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
(original)
+++ geronimo/server/trunk/modules/geronimo-deploy-tool/src/main/java/org/apache/geronimo/deployment/cli/AbstractCommand.java
Mon Mar  5 23:26:41 2007
@@ -121,23 +121,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;



Mime
View raw message