[jboss-cvs] jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util ...

Robert Stryker rawblem at gmail.com
Mon Sep 18 13:50:11 EDT 2006


  User: rawb    
  Date: 06/09/18 13:50:11

  Modified:    as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util 
                        RuntimeConfigUtil.java
  Log:
  Changing 'host' in the server editor should now properly update the launch configuration
  
  Revision  Changes    Path
  1.5       +48 -17    jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RuntimeConfigUtil.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RuntimeConfigUtil.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RuntimeConfigUtil.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- RuntimeConfigUtil.java	14 Sep 2006 18:29:52 -0000	1.4
  +++ RuntimeConfigUtil.java	18 Sep 2006 17:50:11 -0000	1.5
  @@ -25,10 +25,7 @@
   import java.util.HashMap;
   import java.util.Map;
   
  -public class RuntimeConfigUtil {
  -
  -	public static final Integer NO_VALUE = new Integer(-1); 
  -	/**
  +/**
   	 * This class will find command line parameters. For example:
   	 * 
   	 *    getCommandArgument("-b localhost --configuration=minimal", "-b", "--host") 
  @@ -45,6 +42,10 @@
   	 * @param secondaryPrefix
   	 * @return
   	 */
  +public class RuntimeConfigUtil {
  +
  +	public static final Integer NO_VALUE = new Integer(-1); 
  +
   	public static String getCommandArgument(String args, 
   			String primaryPrefix, String secondaryPrefix) {
   	
  @@ -89,6 +90,36 @@
   		return null;
   	}
   	
  +	public static String setCommandArguments(String haystack, String primaryPrefix, 
  +										String secondaryPrefix, String newValue) {
  +		
  +		String[] asArray = parse(haystack);
  +		String retval = "";
  +		boolean found = false;
  +		
  +		for( int i = 0; i < asArray.length; i++ ) {
  +			if( primaryPrefix.startsWith("-D") && asArray[i].startsWith(primaryPrefix + "=")) {
  +				retval += primaryPrefix + "=" + newValue + " ";
  +				found = true;
  +			} else if( asArray[i].equals(primaryPrefix)) {
  +				retval += primaryPrefix + " " + newValue + " ";
  +				found = true;
  +				i++; // we're consuming two tokens, or should be
  +			} else if( asArray[i].startsWith(secondaryPrefix + '=')) {
  +				retval += secondaryPrefix + "=" + newValue + " ";
  +				found = true;
  +			} else {
  +				retval += asArray[i] + " ";
  +			}
  +		}
  +		
  +		if( !found ) {
  +			retval += primaryPrefix + " " + newValue + " ";
  +		}
  +		
  +		return retval;
  +	}
  +	
   	public static Map getSystemProperties(String s) {
   		String[] args = parse(s);
   		HashMap map = new HashMap();
  
  
  



More information about the jboss-cvs-commits mailing list