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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 25 11:01:21 EDT 2006


Author: fnasser at redhat.com
Date: 2006-10-25 11:01:20 -0400 (Wed, 25 Oct 2006)
New Revision: 57825

Modified:
   branches/JBoss_4_0_3_SP1_CP/console/src/main/org/jboss/console/twiddle/command/SetAttrsCommand.java
   branches/JBoss_4_0_3_SP1_CP/console/src/main/org/jboss/console/twiddle/command/SetCommand.java
Log:
ASPATCH-103: JBAS-3719: Unable to set valid negative values for MBean attributes using Twiddle

Modified: branches/JBoss_4_0_3_SP1_CP/console/src/main/org/jboss/console/twiddle/command/SetAttrsCommand.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/console/src/main/org/jboss/console/twiddle/command/SetAttrsCommand.java	2006-10-25 13:40:26 UTC (rev 57824)
+++ branches/JBoss_4_0_3_SP1_CP/console/src/main/org/jboss/console/twiddle/command/SetAttrsCommand.java	2006-10-25 15:01:20 UTC (rev 57825)
@@ -1,11 +1,24 @@
-/***************************************
- *                                     *
- *  JBoss: The OpenSource J2EE WebOS   *
- *                                     *
- *  Distributable under LGPL license.  *
- *  See terms of license at gnu.org.   *
- *                                     *
- ***************************************/
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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;
 
@@ -40,6 +53,7 @@
 
    /** List<String>. Contains names and values */
    private List attributeNames = new ArrayList(5);
+   private boolean prefix = true;
 
 
    public SetAttrsCommand()
@@ -91,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;
    }
 
@@ -189,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;
+	   
+   }
 }
+
+

Modified: branches/JBoss_4_0_3_SP1_CP/console/src/main/org/jboss/console/twiddle/command/SetCommand.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/console/src/main/org/jboss/console/twiddle/command/SetCommand.java	2006-10-25 13:40:26 UTC (rev 57824)
+++ branches/JBoss_4_0_3_SP1_CP/console/src/main/org/jboss/console/twiddle/command/SetCommand.java	2006-10-25 15:01:20 UTC (rev 57825)
@@ -1,11 +1,24 @@
-/***************************************
- *                                     *
- *  JBoss: The OpenSource J2EE WebOS   *
- *                                     *
- *  Distributable under LGPL license.  *
- *  See terms of license at gnu.org.   *
- *                                     *
- ***************************************/
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * 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 gnu.getopt.Getopt;
@@ -92,9 +105,16 @@
 						("Option requires an argument: " + args[getopt.getOptind() - 1]);
 
 				case '?':
-					throw new CommandException
-						("Invalid (or ambiguous) option: " + args[getopt.getOptind() - 1]);
+            	{
+					String arg = args[getopt.getOptind() - 1];
 
+					argidx=setArgValues(argidx,arg);
+
+					break;
+
+					
+            	}
+
 				case 0x1000:
 					prefix = false;
 					break;
@@ -103,26 +123,20 @@
 				case 1:
 					{
 						String arg = getopt.getOptarg();
+						
+						argidx=setArgValues(argidx,arg);
 
-						switch (argidx++)
-						{
-							case 0:
-								objectName = createObjectName(arg);
-								log.debug("mbean name: " + objectName);
-								break;
-
-							default:
-								log.debug("adding attribute name: " + arg);
-								attributeNames.add(arg);
-								break;
-						}
 						break;
 					}
 			}
+			
+			
 		}
 
 		return true;
 	}
+	
+	
    
 
    public void execute(String[] args) throws Exception
@@ -148,6 +162,8 @@
 		MBeanAttributeInfo[] attrs = info.getAttributes();
 		
 		MBeanAttributeInfo attr=null;
+		
+//		System.out.println("I am here shak's msg");
 
 		boolean found = false;
 		for (int i=0;i < attrs.length ; i++ ) 
@@ -188,7 +204,28 @@
 		
 
    }
+   
+   //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;
+	   
+   }
+
 	/**
 	 * Convert val into an Object of type type
 	 * @param val The given value




More information about the jboss-cvs-commits mailing list