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

Robert Stryker rob.stryker at jboss.com
Thu Mar 8 20:52:28 EST 2007


  User: rawb    
  Date: 07/03/08 20:52:28

  Modified:    as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util  
                        FileUtil.java ArgsUtil.java
  Log:
  Large cleaning up of the code to get rid of things that were useless...  
  - unused variables
  - minimally used classes
  - path factories (which will be reverted to some other API)
  - Created extension managers to manage extensions
  
  Revision  Changes    Path
  1.5       +0 -75     jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FileUtil.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/FileUtil.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -b -r1.4 -r1.5
  --- FileUtil.java	8 Mar 2007 22:32:51 -0000	1.4
  +++ FileUtil.java	9 Mar 2007 01:52:28 -0000	1.5
  @@ -31,81 +31,6 @@
   
   public class FileUtil {
   	
  -	// size of the buffer
  -	private static final int BUFFER = 10240;
  -
  -	// the buffer
  -	private static byte[] buf = new byte[BUFFER];
  -
  -
  -
  -	public static IStatus copyFile(String from, String to) {
  -		try {
  -			return copyFile(new FileInputStream(from), to);
  -		} catch (Exception e) {
  -			e.printStackTrace();
  -			return null;
  -		}
  -	}
  -	
  -	public static IStatus copyFile(File from, File to) {
  -		try {
  -			return copyFile(new FileInputStream(from), to);
  -		} catch (Exception e) {
  -			e.printStackTrace();
  -			return null;
  -		}		
  -	}
  -
  -	public static IStatus copyFile(FileInputStream in, File to) {
  -		try {
  -			return copyFile(in, new FileOutputStream(to));
  -		} catch( Exception e ) {
  -			e.printStackTrace();
  -			return null;
  -		}
  -	}
  -	
  -	public static IStatus copyFile(FileInputStream in, String to) {
  -		FileOutputStream out = null;
  -	
  -		try {
  -			out = new FileOutputStream(to);
  -			return copyFile(in, out);
  -		} catch( Exception e ) {
  -			e.printStackTrace();
  -			return null;
  -		}
  -	}
  -
  -	public static IStatus copyFile(FileInputStream in, FileOutputStream out ) {
  -		try {
  -			int avail = in.read(buf);
  -			while (avail > 0) {
  -				out.write(buf, 0, avail);
  -				avail = in.read(buf);
  -			}
  -			return Status.OK_STATUS;
  -		} catch (Exception e) {
  -			return new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID, 0, e.getLocalizedMessage(), e);
  -		} finally {
  -			try {
  -				if (in != null)
  -					in.close();
  -			} catch (Exception ex) {
  -				// ignore
  -			}
  -			try {
  -				if (out != null)
  -					out.close();
  -			} catch (Exception ex) {
  -				// ignore
  -			}
  -		}
  -
  -	}
  -
  -	
   	// Delete the file. If it's a folder, delete all children.
   	// Also, if parent is now empty, delete that as well. 
   	public static boolean safeDelete(File file) {
  
  
  
  1.2       +0 -83     jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ArgsUtil.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ArgsUtil.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosside/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ArgsUtil.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- ArgsUtil.java	10 Nov 2006 00:26:26 -0000	1.1
  +++ ArgsUtil.java	9 Mar 2007 01:52:28 -0000	1.2
  @@ -29,78 +29,6 @@
   
   	public static final Integer NO_VALUE = new Integer(-1); 
   
  -//	public static String getCommandArgument(String args, 
  -//			String primaryPrefix, String secondaryPrefix) {
  -//	
  -//		String[] argArray = parse(args);
  -//		
  -//		// system property is different. Do them first.
  -//		if( primaryPrefix.startsWith("-D")) {
  -//			for( int i = 0; i < argArray.length; i++ ) {
  -//				if( argArray[i].startsWith(primaryPrefix)) {
  -//					int eqIndex = argArray[i].indexOf('=');
  -//					if( eqIndex != -1 ) {
  -//						return argArray[i].substring(eqIndex+1);
  -//					} else if( argArray[i].equals(primaryPrefix)){
  -//						// no value
  -//						return "";
  -//					}
  -//				}
  -//			}
  -//		}
  -//		
  -//		for( int i = 0; i < argArray.length; i++ ) {
  -//
  -//			// -c config
  -//			if( argArray[i].equals(primaryPrefix)) {
  -//				if( i+1 < argArray.length) {
  -//					return argArray[i+1];
  -//				} else {
  -//					return "";
  -//				}
  -//			}
  -//			
  -//			if( argArray[i].startsWith(secondaryPrefix )) {
  -//				int eqIndex = argArray[i].indexOf('=');
  -//				if( eqIndex != -1 ) {
  -//					return argArray[i].substring(eqIndex+1);
  -//				} 
  -//				return "";
  -//			}
  -//		}
  -//		return null;
  -//	}
  -//	
  -//	public static String createCommandArguments(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();
  @@ -126,24 +54,14 @@
   			ArrayList l = new ArrayList();
   			int length = s.length();
   			
  -			int start = 0;
   			int current = 0;
  -			
   			boolean inQuotes = false;
  -			boolean escaped = false;
  -			
   			boolean done = false;
   			String tmp = "";
   			StringBuffer buf = new StringBuffer();
   	
   			while( !done ) {
   				switch(s.charAt(current)) {
  -//				case '\\':
  -//					if( inQuotes ) {
  -//						current++;
  -//						buf.append(s.charAt(current));
  -//						break;
  -//					}
   				case '"':
   					inQuotes = !inQuotes;
   					break;
  @@ -152,7 +70,6 @@
   					if( !inQuotes ) {
   						tmp = buf.toString();
   						l.add(tmp);
  -						start = current+1;
   						buf = new StringBuffer();
   					} else {
   						buf.append(' ');
  
  
  



More information about the jboss-cvs-commits mailing list