[jboss-cvs] JBossAS SVN: r57268 - branches/Branch_4_0/console/src/main/org/jboss/console/twiddle/command

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Sep 28 14:00:42 EDT 2006


Author: ssambasivam at jboss.com
Date: 2006-09-28 14:00:42 -0400 (Thu, 28 Sep 2006)
New Revision: 57268

Modified:
   branches/Branch_4_0/console/src/main/org/jboss/console/twiddle/command/SetAttrsCommand.java
Log:
JIRA-JBAS-3454

When we try to set MBean attribute using SetCommand class, the arguments are filtered by the Getopt utility class used in the SetCommand class. But, the validity 
of the arguments should (can) be checked by the corresponding MBeans instead of the GetOpt class. 

Modified: branches/Branch_4_0/console/src/main/org/jboss/console/twiddle/command/SetAttrsCommand.java
===================================================================
--- branches/Branch_4_0/console/src/main/org/jboss/console/twiddle/command/SetAttrsCommand.java	2006-09-28 16:54:39 UTC (rev 57267)
+++ branches/Branch_4_0/console/src/main/org/jboss/console/twiddle/command/SetAttrsCommand.java	2006-09-28 18:00:42 UTC (rev 57268)
@@ -19,6 +19,7 @@
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
+
 package org.jboss.console.twiddle.command;
 
 import java.beans.PropertyEditor;
@@ -52,6 +53,7 @@
 
    /** List<String>. Contains names and values */
    private List attributeNames = new ArrayList(5);
+   private boolean prefix = true;
 
 
    public SetAttrsCommand()
@@ -103,35 +105,36 @@
                throw new CommandException
                   ("Option requires an argument: " + args[getopt.getOptind() - 1]);
 
-            case '?':
-               throw new CommandException
-                  ("Invalid (or ambiguous) option: " + args[getopt.getOptind() - 1]);
+			case '?':
+        	{
+				String arg = args[getopt.getOptind() - 1];
 
-            case 0x1000:
-               break;
-                  
-               // non-option arguments
-            case 1:
-               {
-                  String arg = getopt.getOptarg();
+				argidx=setArgValues(argidx,arg);
 
-                  switch (argidx++)
-                  {
-                     case 0:
-                        objectName = createObjectName(arg);
-                        log.debug("mbean name: " + objectName);
-                        break;
+				break;
 
-                     default:
-                        log.debug("adding attribute name: " + arg);
-                        attributeNames.add(arg);
-                        break;
-                  }
-                  break;
-               }
-         }
-      }
+				
+        	}
 
+			case 0x1000:
+				prefix = false;
+				break;
+              
+				// non-option arguments
+			case 1:
+				{
+					String arg = getopt.getOptarg();
+					
+					argidx=setArgValues(argidx,arg);
+
+					break;
+				}
+		}
+		
+		
+	}
+
+
       return true;
    }
 
@@ -201,4 +204,27 @@
       }
       return null;
    }
+   
+  //Channge is made to set all possible arguments to MBean
+   
+   private int setArgValues(int argdixValue, String argValue) throws CommandException{
+	   
+	   switch (argdixValue++)
+		{
+			case 0:
+				objectName = createObjectName(argValue);
+				log.debug("mbean name: " + objectName);
+				break;
+
+			default:
+				log.debug("adding attribute name: " + argValue);
+				attributeNames.add(argValue);
+				break;
+		}
+	   
+	   return argdixValue;
+	   
+   }
 }
+
+




More information about the jboss-cvs-commits mailing list