You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by ae...@apache.org on 2007/02/18 22:00:44 UTC

svn commit: r508998 - in /webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator: projectizer/ synthesizer/ util/

Author: aeberbac
Date: Sun Feb 18 13:00:43 2007
New Revision: 508998

URL: http://svn.apache.org/viewvc?view=rev&rev=508998
Log:
MUSE-173: There's more fine-grained overwriting now. This needs
some more documentation which will be added to the site. The gist 
is that there is now a .overwrite file created in the root of the generated
directory. This file has a list of all of the files which can be overwritten
when generating into the directory. 

Added:
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/OverwriteHelper.java
Modified:
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java
    webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/ConfigurationData.java

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java?view=diff&rev=508998&r1=508997&r2=508998
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java Sun Feb 18 13:00:43 2007
@@ -25,9 +25,11 @@
 import java.io.InputStreamReader;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 import java.util.logging.Logger;
 
 import org.apache.muse.tools.generator.Wsdl2Java;
+import org.apache.muse.tools.generator.util.OverwriteHelper;
 import org.apache.muse.util.FileUtils;
 import org.apache.muse.util.messages.Messages;
 import org.apache.muse.util.messages.MessagesFactory;
@@ -40,25 +42,51 @@
 import org.w3c.dom.Node;
 
 /**
- * AbstractProjectizer contains methods that are useful to projectizers built so far.
+ * AbstractProjectizer contains methods that are 
+ * useful to projectizers built so far.
  *
  * @author Andrew Eberbach (aeberbac)
  */
 public abstract class AbstractProjectizer implements Projectizer {
 	
+	/**
+	 * Message bundle for localized messages
+	 */
 	private static Messages _MESSAGES = MessagesFactory.get(AbstractProjectizer.class);
 	
+	/**
+	 * A logger to which we will log messages
+	 */
 	private static Logger _logger = Logger.getLogger(Wsdl2Java.class.getPackage().getName()); 
 	
+	/**
+	 * The default extension for WSDL files.
+	 */
 	protected static final String DEFAULT_WSDL_NAME_SUFFIX = ".wsdl";
 
+	/**
+	 * A placeholder in strings that can be replaced with a specific string.
+	 */
 	protected static final String PLACE_HOLDER = "XXX";
-
-	protected boolean _overwrite = false;
 	
+	/**
+	 * A low-tech way of keeping track of the resource instances that the projectizer
+	 * can create.
+	 */
 	private int _resourceCounter = 1; 	
 	
 	/**
+	 * A class that will determine if a given file can be overwritten
+	 * if it already exists.
+	 */
+	private OverwriteHelper _overwriteHelper = null;
+
+	/**
+	 * The target base directory in which the projectizer will projectize.
+	 */
+	protected File _targetDirectory;
+
+	/**
 	 * Serializes an XML node and writes it out to a file provided that
 	 * the file doesn't already exist, and if it does then the _overwrite 
 	 * variable must be set to true.
@@ -72,22 +100,18 @@
 	 * 			If anything goes wrong
 	 */
 	protected void writeToFileCheck(Node node, File destination) throws Exception {
-		if (!destination.exists() || _overwrite) {
-			File parent = destination.getAbsoluteFile().getParentFile();
-			if(!parent.exists()) {
-				if(!parent.mkdirs()) {
-					Object[] filler = { parent } ;
-					throw new Exception(_MESSAGES.get("CouldNotMakeDir",filler));
-				}
-			}
-			
-			FileWriter fileWriter = new FileWriter(destination);
-			fileWriter.write(XmlUtils.toString(node));
-			fileWriter.close();
+		if (canOverwrite(destination)) {
+			checkParentDirectory(destination);			
+			writeStringtoFile(XmlUtils.toString(node), destination);
+			_overwriteHelper.add(destination, _targetDirectory);
 		} else {
 			_logger.info(_MESSAGES.get("NotOverwriting", new String[] {destination.getPath()}));
 		}
 	}
+
+	protected void writeToFileCheck(String string, File destination) throws Exception {
+		writeToFileCheck(string, destination, true);
+	}
 	
 	/**
 	 * Writes a string to a file provided that
@@ -98,28 +122,23 @@
 	 * 			The string to write out
 	 * @param destination 
 	 * 			The file where this should be written
+	 * @param overwritable
+	 * 			Flag to see if this filename should be passed to the OverwriteHelper
 	 * 
 	 * @throws Exception
 	 * 			If anything goes wrong
 	 */
-	protected void writeToFileCheck(String string, File destination) throws Exception {
-		if (!destination.exists() || _overwrite) {
-			File parent = destination.getAbsoluteFile().getParentFile();
-			if(!parent.exists()) {
-				if(!parent.mkdirs()) {
-					Object[] filler = { parent } ;
-					throw new Exception(_MESSAGES.get("CouldNotMakeDir",filler));
-				}
+	protected void writeToFileCheck(String string, File destination, boolean overwritable) throws Exception {
+		if (canOverwrite(destination)) {
+			checkParentDirectory(destination);
+			writeStringtoFile(string, destination);
+			if(overwritable) {
+				_overwriteHelper.add(destination, _targetDirectory);
 			}
-			
-			FileWriter fileWriter = new FileWriter(destination);
-			fileWriter.write(string);
-			fileWriter.close();
 		} else {
 			_logger.info(_MESSAGES.get("NotOverwriting", new String[] {destination.getPath()}));
 		}
 	}
-	
 
 	/**
 	 * Writes an <code>InputStream</code> to a file provided that
@@ -135,16 +154,10 @@
 	 * 			If anything goes wrong
 	 */
 	protected void copyStreamCheck(InputStream inputStream, File destination) throws Exception {
-		if(!destination.exists() || _overwrite) {
-			File parent = destination.getAbsoluteFile().getParentFile();
-			if(!parent.exists()) {
-				if(!parent.mkdirs()) {
-					Object[] filler = { parent } ;
-					throw new Exception(_MESSAGES.get("CouldNotMakeDir",filler));
-				}
-			}
-			
-			FileUtils.copyFile(inputStream,destination);		
+		if(canOverwrite(destination)) {
+			checkParentDirectory(destination);			
+			FileUtils.copyFile(inputStream,destination);	
+			_overwriteHelper.add(destination, _targetDirectory);
 		} else {
 			_logger.warning(_MESSAGES.get("NotOverwriting", new String[] {destination.getPath()}));
 		}
@@ -185,50 +198,62 @@
 	}
 	
 	/**
-	 * Copies a tempalte folder to another folder. The idea here is 
-	 * since we want to copy an entire folder it, it will be created
-	 * <b>under</b> the destination folder. So this method tries to
-	 * copy the folder to the parent and then renames it to the name of the
-	 * destination. 
-	 * 
-	 * For example. Say you have a template folder called "c:\src\foo" and you
-	 * want to copy it to a destination called "c:\dest\bar". You would copy "c:\src\foo"
-	 * to the parent of the destination, ie "c:\dest" creating "c:\dest\foo" and
-	 * then you would rename the folder to "c:\dest\bar".
-	 * 
-	 * If the target folder exists we log a warning and stop because it's
-	 * not entirely obvious what users would expect even if _overwrite is true.
+	 * Copies all of the files (recursively) from the source folder into
+	 * the parent folder.
 	 * 
 	 * @param source
 	 * 			The source folder
 	 * @param destination
 	 * 			The destination, ie what the folder will be called 
 	 * 
-	 * @return
-	 * 			The destination
-	 * 
-	 * @throws IOException
-	 * 			If anything goes wrong
+	 * @throws Exception 
 	 */
-	protected File copyTemplate(File source, File destination) throws IOException {
-		if(destination.exists()) {
-			Object[] filler = { destination.getAbsolutePath() };
-			_logger.warning(_MESSAGES.get("DirectoryExists", filler));
-			return destination;
-		}
+	protected void copyTemplate(File sourceDir, File destinationDir) throws Exception {
+		File[] files = sourceDir.listFiles();
+		File destination = null;
 		
-		File parent = destination.getAbsoluteFile().getParentFile();
-		
-		FileUtils.copyDirectory(source, parent);
-        
-        File templateDir = new File(parent, source.getName());                    
-        
-        templateDir.renameTo(destination);
-        
-        return destination;
+		for(int i=0; i < files.length; i++) {
+			destination = new File(destinationDir, files[i].getName());
+			if(files[i].isDirectory()) {
+				checkDirectory(destination);
+				copyTemplate(files[i], destination);
+			} else {
+				copyFileCheck(files[i], destination);
+
+			}
+		}
 	}
 	
 	/**
+	 * Copy a file from the source file to the destination performing
+	 * an overwrite check.
+	 * 
+	 * @param source
+	 * @param destination
+	 * @throws Exception
+	 */
+	private void copyFileCheck(File source, File destination) throws Exception {
+		if (canOverwrite(destination)) {
+			checkParentDirectory(destination);			
+			FileUtils.copy(source, destination);
+			_overwriteHelper.add(destination, _targetDirectory);
+		} else {
+			_logger.info(_MESSAGES.get("NotOverwriting", new String[] {destination.getPath()}));
+		}
+	}
+
+	/**
+	 * Returns true if the given file can be overwritten if it exists. This
+	 * is delegated to the OverwriteHelper.
+	 * 
+	 * @param file 	The file to check
+	 * @return		True if it can be overwritten
+	 */
+	private boolean canOverwrite(File file) {
+		return _overwriteHelper.canOverwrite(file, _targetDirectory);
+	}
+
+	/**
 	 * Create a router entry for the given service in the given directory. This
 	 * will generate a router entry using a simple integer counter for the file name
 	 * and it will contain an empty ReferenceParameters element.
@@ -273,13 +298,14 @@
 	private String getResourceFileName() {
 		return Axis2ProjectizerConstants.RESOURCE_FILE.replaceFirst(PLACE_HOLDER, String.valueOf(_resourceCounter++));
 	}
-
+	
 	/**
 	 * Given a list of Maps (mapping file names to file contents) write the files
 	 * to the target directory.
 	 * 
 	 * @param javaSourceDir
 	 * 				The target directory
+	 * @param path 
 	 * 
 	 * @param filesMaps
 	 * 				A list of Maps which map file names to file content
@@ -288,6 +314,26 @@
 	 * 				If anything goes wrong
 	 */
 	protected void createJavaSources(File javaSourceDir, Map[] filesMaps) throws Exception {
+		createJavaSources(javaSourceDir, filesMaps, null);
+	}
+	
+	/**
+	 * Given a list of Maps (mapping file names to file contents) write the files
+	 * to the target directory.
+	 * 
+	 * @param javaSourceDir
+	 * 				The target directory
+	 * @param path 
+	 * 
+	 * @param filesMaps
+	 * 				A list of Maps which map file names to file content
+	 * @param sets 
+	 * 				A list of sets of files to not include in the overwrite manifest 
+	 * 			
+	 * @throws Exception
+	 * 				If anything goes wrong
+	 */
+	protected void createJavaSources(File javaSourceDir, Map[] filesMaps, Set[] ignoreSets) throws Exception {
 		for(int i = 0; i < filesMaps.length; i++) {
 			Map files = filesMaps[i];
 			
@@ -296,11 +342,16 @@
 	
 				File javaFile = new File(javaSourceDir, file);			
 	
-				writeToFileCheck((String) files.get(file), javaFile);
+				boolean overwritable = true;
+				if(ignoreSets != null && ignoreSets[i] != null) { 
+					overwritable = !ignoreSets[i].contains(new File(file));
+				}
+				
+				writeToFileCheck((String) files.get(file), javaFile, overwritable);
 			}
 		}
 	}
-	
+
 	/**
 	 * Utility method for copying jars from the Muse distribution. The
 	 * module names serve as names of directories (ie. core, tools, and so on). The
@@ -319,7 +370,7 @@
 	 * @throws IOException
 	 * 			If anything goes wrong
 	 */
-	protected void copyJars(String[] moduleNames, File baseModulesDir, File destDir) throws IOException {
+	protected void copyJars(String[] moduleNames, File baseModulesDir, File destDir) throws Exception {
 		if(!baseModulesDir.exists()) {
 			throw new FileNotFoundException();
 		}
@@ -332,11 +383,12 @@
 	
 		File curDir = null;
 		File curFile = null;
+		File destFile = null;
 		
 		for(int i=0; i < moduleNames.length; i++) {
 			curDir = new File(baseModulesDir, moduleNames[i]);
 			if(!curDir.exists()) {
-				throw new FileNotFoundException();
+				throw new FileNotFoundException(curDir.getAbsolutePath());
 			}
 			
 			String[] files = curDir.list();
@@ -344,9 +396,85 @@
 			for(int j=0; j < files.length; j++) {
 				if(files[j].toLowerCase().endsWith(".jar")) {
 					curFile = new File(curDir, files[j]);
-					FileUtils.copy(curFile, destDir);
+					destFile = new File(destDir, files[j]);
+					copyFileCheck(curFile, destFile);
 				}
 			}
 		}
+	}
+	
+	/**
+	 * Write a string to a file without doing any overwrite checks. 
+	 * 
+	 * @param string		The string to write
+	 * @param destination	The file into which to write the string
+	 * 
+	 * @throws Exception 	
+	 */
+	protected void writeStringtoFile(String string, File destination) throws Exception {
+		FileWriter fileWriter = new FileWriter(destination);
+		fileWriter.write(string);
+		fileWriter.close();
+	}
+
+	/**
+	 * Check to make sure that the parent directory of a given file exists
+	 * or can be created. If it can be created, then try to make the directory.
+	 * 
+	 * @param destination 	Target file to check
+	 * 
+	 * @throws Exception	
+	 */
+	protected void checkParentDirectory(File destination) throws Exception {
+		File parent = destination.getAbsoluteFile().getParentFile();
+		if(!parent.exists()) {
+			if(!parent.mkdirs()) {
+				Object[] filler = { parent } ;
+				throw new Exception(_MESSAGES.get("CouldNotMakeDir",filler));
+			}
+		}
+	}
+	
+	/**
+	 * Check to make sure that the given directory exists
+	 * or can be created. If it can be created, then try to make the directory.
+	 * 
+	 * @param destination 	Target directory to check
+	 * 
+	 * @throws Exception
+	 */
+	protected void checkDirectory(File directory) throws Exception {
+		if(!directory.exists()) {
+			if(!directory.mkdirs()) {
+				Object[] filler = { directory } ;
+				throw new Exception(_MESSAGES.get("CouldNotMakeDir",filler));
+			}
+		}
+	}
+	
+	/**
+	 * Set the target directory for this projectizer. Also 
+	 * load an OverwriteHelper to keep track of which files
+	 * can be overwritten.
+	 * 
+	 * @param targetDirectory 	The target directory for the projectizer
+	 * @param overwrite			Flag to determine if every conflicting file should be overwritten
+	 */
+	protected void setTargetDirectory(File targetDirectory, boolean overwrite) {	
+		_targetDirectory = 
+			targetDirectory == null
+					?FileUtils.CURRENT_DIR
+					:targetDirectory;
+		_overwriteHelper = new OverwriteHelper(_targetDirectory, overwrite);	
+	}
+	
+	/**
+	 * Create the overwrite manifest for this projectizer. Writes out
+	 * the current list of files from the OverwriteHelper.
+	 * 
+	 * @throws Exception
+	 */
+	protected void createOverwriteManifest() throws Exception {
+		_overwriteHelper.writeToDirectory(_targetDirectory);
 	}
 }

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java?view=diff&rev=508998&r1=508997&r2=508998
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java Sun Feb 18 13:00:43 2007
@@ -20,6 +20,7 @@
 import java.io.InputStream;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.muse.tools.generator.util.Capability;
 import org.apache.muse.tools.generator.util.ConfigurationData;
@@ -27,9 +28,9 @@
 import org.apache.muse.tools.generator.util.DeploymentDescriptorHelper;
 import org.apache.muse.tools.generator.util.ServicesDescriptorHelper;
 import org.apache.muse.util.FileUtils;
-import org.apache.muse.ws.wsdl.WsdlUtils;
 import org.apache.muse.ws.notification.WsnConstants;
 import org.apache.muse.ws.resource.sg.WssgConstants;
+import org.apache.muse.ws.wsdl.WsdlUtils;
 import org.w3c.dom.Document;
 
 /**
@@ -62,70 +63,102 @@
 			ConfigurationData.OVERWRITE_CONFIGURATION,
 			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION
 		};
-
-	protected File _targetDirectory = null;
-
+	
 	protected Map[] _capabilitiesList = null;
 
 	protected Map[] _filesMaps = null;
 
 	protected Document _descriptor = null;
 
-	protected Document[] _wsdls = null;	
+	protected Document[] _wsdls = null;
+
+	protected Set[] _ignoreSets;
 	
-	/* (non-Javadoc)
-	 * @see org.apache.muse.tools.generator.projectizer.Projectizer#projectize(org.apache.muse.tools.generator.util.ConfigurationData)
-	 */
 	public void projectize(ConfigurationData configuration) throws Exception {
 		ConfigurationData.checkConfiguration(this, configuration);
 		
 		loadParameters(configuration);
 		
+		File webContentDir = new File(
+				_targetDirectory, 
+				Axis2ProjectizerConstants.WEB_CONTENT_DIR);
+		
+		File javaSourceDir = new File(
+				_targetDirectory, 
+				Axis2ProjectizerConstants.JAVA_SRC_DIR);
+		
+		createDirectoryStructure(webContentDir);			
+		createJavaSources(javaSourceDir, _filesMaps, _ignoreSets);
+		createArtifacts(webContentDir);
+		
+		createOverwriteManifest();
+	}
+
+	private void createDirectoryStructure(File webContentDir) throws Exception {
 		File templateDir = new File(
 				System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY), 
 				Axis2ProjectizerConstants.TEMPLATE_DIR);
 		
-		File destDir = new File(
-				_targetDirectory, 
-				Axis2ProjectizerConstants.WEB_CONTENT_DIR);
+		copyTemplate(templateDir, webContentDir);
+		
+		File libDir = new File(
+				webContentDir, 
+				Axis2ProjectizerConstants.LIB_DIR);
 		
-		File webContentDir = copyTemplate(templateDir, destDir);
+		File modulesDir = new File(
+				System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),
+				Axis2ProjectizerConstants.MODULES_DIR);
 		
-		File libDir = new File(destDir, Axis2ProjectizerConstants.LIB_DIR);
-		File modulesDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),Axis2ProjectizerConstants.MODULES_DIR);
 		copyJars(Axis2ProjectizerConstants.REQUIRED_MODULES, modulesDir, libDir);
-					
+	}
+
+	private void createArtifacts(File webContentDir) throws Exception {
 		File descriptorFile = new File(
 				webContentDir, 
 				Axis2ProjectizerConstants.DESCRIPTOR_FILE);
 		
-		File javaSourceDir = new File(
-				_targetDirectory, 
-				Axis2ProjectizerConstants.JAVA_SRC_DIR);
-		
-		createJavaSources(javaSourceDir, _filesMaps);
-		
-		createBuildFile(_targetDirectory, Axis2ProjectizerConstants.BUILD_FILE_RESOURCE, Axis2ProjectizerConstants.BUILD_FILE);
-		
 		File wsdldir = new File(
-				destDir, 
+				webContentDir, 
 				Axis2ProjectizerConstants.WSDL_DIR);
 
-		File routerEntriesDir = new File(destDir,Axis2ProjectizerConstants.ROUTER_ENTRIES_DIR);
+		File routerEntriesDir = new File(
+				webContentDir,
+				Axis2ProjectizerConstants.ROUTER_ENTRIES_DIR);
+		
+		File servicesFile = new File(
+				webContentDir, 
+				Axis2ProjectizerConstants.SERVICES_FILE);
 		
 		ServicesDescriptorHelper servicesHelper = new ServicesDescriptorHelper();
 		
 		for(int i=0; i < _capabilitiesList.length; i++) {
 			Map capabilities = _capabilitiesList[i];
 			Document wsdl = _wsdls[i];
-			createDescriptor(_descriptor, wsdl, descriptorFile, capabilities, Axis2ProjectizerConstants.WSDL_RELATIVE_PATH, i);						
-			createWSDLFile(wsdl, wsdldir);				
-			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), capabilities);
+			
+			createDescriptor(
+					_descriptor, 
+					wsdl, 
+					descriptorFile, 
+					capabilities, 
+					Axis2ProjectizerConstants.WSDL_RELATIVE_PATH, 
+					i);						
+			
+			createWSDLFile(wsdl, wsdldir);		
+			
+			createRouterEntries(
+					routerEntriesDir, 
+					WsdlUtils.getServiceName(wsdl.getDocumentElement()), 
+					capabilities);
+			
 			updateServicesDescriptor(servicesHelper, wsdl, capabilities);
 		}					
 		
-		File servicesFile = new File(webContentDir, Axis2ProjectizerConstants.SERVICES_FILE);
 		createServicesDescriptor(servicesHelper, servicesFile);
+		
+		createBuildFile(
+				_targetDirectory, 
+				Axis2ProjectizerConstants.BUILD_FILE_RESOURCE, 
+				Axis2ProjectizerConstants.BUILD_FILE);
 	}
 
 	protected void createServicesDescriptor(ServicesDescriptorHelper servicesHelper, File servicesFile) throws Exception {
@@ -134,15 +167,13 @@
 
 	protected void loadParameters(ConfigurationData configuration) {
 		_capabilitiesList = (Map[])configuration.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
-		_filesMaps = (Map[])configuration.getParameter(ConfigurationData.FILES_MAP_LIST);
-		_overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
+		_filesMaps = (Map[])configuration.getParameter(ConfigurationData.FILES_MAP_LIST);				
 		_descriptor = (Document)configuration.getParameter(ConfigurationData.DESCRIPTOR_DOCUMENT);
 		_wsdls = (Document[])configuration.getParameter(ConfigurationData.WSDL_DOCUMENT_LIST);
-		_targetDirectory = (File)configuration.getParameter(ConfigurationData.TARGET_DIRECTORY);
+		_ignoreSets = (Set[])configuration.getParameter(ConfigurationData.IGNORE_SET_LIST);
 		
-		if(_targetDirectory == null) {
-			_targetDirectory = FileUtils.CURRENT_DIR;
-		}		
+		boolean overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
+		setTargetDirectory((File)configuration.getParameter(ConfigurationData.TARGET_DIRECTORY), overwrite);
 	}
 
 	protected void createWSDLFile(Document wsdl, File wsdldir) throws Exception {		
@@ -155,7 +186,6 @@
 		File build = new File(baseTargetDir, buildFile);
 		copyStreamCheck(buildTemplate, build);			
 	}
-
 
 	protected void updateServicesDescriptor(ServicesDescriptorHelper servicesHelper, Document wsdl, Map capabilities) {
 		String serviceName = WsdlUtils.getServiceName(wsdl.getDocumentElement());

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java?view=diff&rev=508998&r1=508997&r2=508998
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java Sun Feb 18 13:00:43 2007
@@ -4,6 +4,7 @@
 import java.io.InputStream;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.muse.tools.generator.util.Capability;
 import org.apache.muse.tools.generator.util.ConfigurationData;
@@ -27,7 +28,6 @@
 			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION
 		};
 
-
 	protected File _targetDirectory = null;
 
 	protected Map[] _capabilitiesList = null;
@@ -36,31 +36,35 @@
 
 	protected Document _descriptor = null;
 
-	protected Document[] _wsdls = null;	
+	protected Document[] _wsdls = null;
+	
+	private Set[] _ignoreSets;
 	
 	public void projectize(ConfigurationData configuration) throws Exception {
 		ConfigurationData.checkConfiguration(this, configuration);
 		
 		loadParameters(configuration);
 		
-		File webContentDir = new File(_targetDirectory,	MiniProjectizerConstants.WEB_CONTENT_DIR);
-        File webInfDir = new File(webContentDir, MiniProjectizerConstants.WEB_INF_DIR);		
-		File webInfLibDir = new File(webContentDir, MiniProjectizerConstants.WEB_INF_LIB_DIR);
-		File museModulesDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),MiniProjectizerConstants.MODULES_DIR);
-        File museLibDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),MiniProjectizerConstants.LIB_DIR);
-		
-        copyJars(MiniProjectizerConstants.REQUIRED_MODULES, museModulesDir, webInfLibDir);
-        copyJars(MiniProjectizerConstants.REQUIRED_LIBRARIES, museLibDir, webInfLibDir);
-					
-		File descriptorFile = new File(
-				webContentDir, 
-				MiniProjectizerConstants.DESCRIPTOR_FILE);
+		File webContentDir = new File(
+				_targetDirectory, 
+				MiniProjectizerConstants.WEB_CONTENT_DIR);
 		
 		File javaSourceDir = new File(
 				_targetDirectory, 
 				MiniProjectizerConstants.JAVA_SRC_DIR);
 		
-		createJavaSources(javaSourceDir, _filesMaps);
+		createDirectoryStructure(webContentDir);			
+		createJavaSources(javaSourceDir, _filesMaps, _ignoreSets);
+		createArtifacts(webContentDir);
+		
+		createOverwriteManifest();		
+	}
+	
+	private void createArtifacts(File webContentDir) throws Exception {
+		File webInfDir = new File(webContentDir, MiniProjectizerConstants.WEB_INF_DIR);
+		File descriptorFile = new File(
+				webContentDir, 
+				MiniProjectizerConstants.DESCRIPTOR_FILE);
 		
         createFileFromResource(_targetDirectory, MiniProjectizerConstants.BUILD_FILE_RESOURCE, MiniProjectizerConstants.BUILD_FILE);
         createFileFromResource(webInfDir, MiniProjectizerConstants.WEB_XML_RESOURCE, MiniProjectizerConstants.WEB_XML_FILE);
@@ -77,20 +81,28 @@
 			createDescriptor(_descriptor, wsdl, descriptorFile, capabilities, MiniProjectizerConstants.WSDL_RELATIVE_PATH, i);						
 			createWSDLFile(wsdl, wsdldir);				
 			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), capabilities);
-		}					
+		}	
 	}
-	
+
+	private void createDirectoryStructure(File webContentDir) throws Exception {		
+		File webInfLibDir = new File(webContentDir, MiniProjectizerConstants.WEB_INF_LIB_DIR);
+		File museModulesDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),MiniProjectizerConstants.MODULES_DIR);
+        File museLibDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),MiniProjectizerConstants.LIB_DIR);
+		
+        copyJars(MiniProjectizerConstants.REQUIRED_MODULES, museModulesDir, webInfLibDir);
+        copyJars(MiniProjectizerConstants.REQUIRED_LIBRARIES, museLibDir, webInfLibDir);
+	}
+
 	protected void loadParameters(ConfigurationData configuration) {
 		_capabilitiesList = (Map[])configuration.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
 		_filesMaps = (Map[])configuration.getParameter(ConfigurationData.FILES_MAP_LIST);
-		_overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
 		_descriptor = (Document)configuration.getParameter(ConfigurationData.DESCRIPTOR_DOCUMENT);
 		_wsdls = (Document[])configuration.getParameter(ConfigurationData.WSDL_DOCUMENT_LIST);
 		_targetDirectory = (File)configuration.getParameter(ConfigurationData.TARGET_DIRECTORY);
+		_ignoreSets = (Set[])configuration.getParameter(ConfigurationData.IGNORE_SET_LIST);
 		
-		if(_targetDirectory == null) {
-			_targetDirectory = FileUtils.CURRENT_DIR;
-		}		
+		boolean overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
+		setTargetDirectory((File)configuration.getParameter(ConfigurationData.TARGET_DIRECTORY), overwrite);	
 	}
 	
 	protected void createWSDLFile(Document wsdl, File wsdldir) throws Exception {		

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java?view=diff&rev=508998&r1=508997&r2=508998
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java Sun Feb 18 13:00:43 2007
@@ -45,25 +45,24 @@
 			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION
 		};
 	
-	public void projectize(ConfigurationData data) throws Exception {
-		ConfigurationData.checkConfiguration(this, data);
+	public void projectize(ConfigurationData configuration) throws Exception {
+		ConfigurationData.checkConfiguration(this, configuration);
 		
-		loadParameters(data);									
-		
-		File templateDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY), OsgiProjectizerConstants.TEMPLATE_DIR);		
-		File destDir = new File(_targetDirectory, OsgiProjectizerConstants.PLUGINS_DIR);		
-		copyTemplate(templateDir, destDir);
-
-		File modulesDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),OsgiProjectizerConstants.MODULES_DIR);
-		copyJars(OsgiProjectizerConstants.REQUIRED_MODULES, modulesDir, destDir);
-		
-		File libDir = new File(_targetDirectory, OsgiProjectizerConstants.LIB_DIR);
-		copyJars(OsgiProjectizerConstants.REQUIRED_LIBS, modulesDir, libDir);
+		loadParameters(configuration);
+				
+		File javaSourceDir = new File(
+				_targetDirectory, 
+				OsgiProjectizerConstants.JAVA_SRC_DIR);
+		
+		createDirectoryStructure();			
+		createJavaSources(javaSourceDir, _filesMaps, _ignoreSets);
+		createArtifacts(javaSourceDir);
 		
+		createOverwriteManifest();
+	}
+	
+	protected void createArtifacts(File javaSourceDir) throws Exception {
 		File descriptorFile = new File(_targetDirectory, OsgiProjectizerConstants.MUSE_DESCRIPTOR_FILE);
-				
-		File javaSourceDir = new File(_targetDirectory, OsgiProjectizerConstants.JAVA_SRC_DIR);
-		createJavaSources(javaSourceDir, _filesMaps);
 		
 		createBuildFile(_targetDirectory, OsgiProjectizerConstants.BUILD_FILE_RESOURCE, OsgiProjectizerConstants.BUILD_FILE);		
 		
@@ -85,7 +84,19 @@
 			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), capabilities);
 		}
 	}
-	
+
+	protected void createDirectoryStructure() throws Exception {
+		File templateDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY), OsgiProjectizerConstants.TEMPLATE_DIR);		
+		File destDir = new File(_targetDirectory, OsgiProjectizerConstants.PLUGINS_DIR);		
+		copyTemplate(templateDir, destDir);
+
+		File modulesDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),OsgiProjectizerConstants.MODULES_DIR);
+		copyJars(OsgiProjectizerConstants.REQUIRED_MODULES, modulesDir, destDir);
+		
+		File libDir = new File(_targetDirectory, OsgiProjectizerConstants.LIB_DIR);
+		copyJars(OsgiProjectizerConstants.REQUIRED_LIBS, modulesDir, libDir);
+	}
+
 	protected void createConfigIni(File destDir, String configFileResource, String configFileName) throws Exception {
 		InputStream configIS = FileUtils.loadFromContext(OsgiProjectizer.class,configFileResource );
 		

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java?view=diff&rev=508998&r1=508997&r2=508998
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java Sun Feb 18 13:00:43 2007
@@ -40,34 +40,41 @@
 	
 	protected Map[] _filesMaps;
 	protected File _targetDirectory;
-	
+
 	public void projectize(ConfigurationData configuration) throws Exception {
 		ConfigurationData.checkConfiguration(this, configuration);
 		
 		loadParameters(configuration);
 		
-		File libDir = new File(_targetDirectory, ProxyProjectizerConstants.LIB_DIR);
-		File modulesDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),Axis2ProjectizerConstants.MODULES_DIR);
-		File museLibDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),Axis2ProjectizerConstants.MUSE_LIB_DIR);
-		copyJars(ProxyProjectizerConstants.REQUIRED_MODULES, modulesDir, libDir);
-		copyJars(ProxyProjectizerConstants.REQUIRED_MUSE_LIBS, museLibDir, libDir);
-		
 		File javaSourceDir = new File(
 				_targetDirectory, 
 				ProxyProjectizerConstants.JAVA_SRC_DIR);
+		
+		createDirectoryStructure();
 		createJavaSources(javaSourceDir, _filesMaps);
+		createArtifacts();	
 		
+		createOverwriteManifest();
+	}
+
+	protected void createArtifacts() throws Exception {
 		createBuildFile(_targetDirectory, ProxyProjectizerConstants.BUILD_FILE_RESOURCE, ProxyProjectizerConstants.BUILD_FILE);
 	}
 
+	protected void createDirectoryStructure() throws Exception {
+		File libDir = new File(_targetDirectory, ProxyProjectizerConstants.LIB_DIR);
+		File modulesDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),Axis2ProjectizerConstants.MODULES_DIR);
+		File museLibDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),Axis2ProjectizerConstants.MUSE_LIB_DIR);
+		copyJars(ProxyProjectizerConstants.REQUIRED_MODULES, modulesDir, libDir);
+		copyJars(ProxyProjectizerConstants.REQUIRED_MUSE_LIBS, museLibDir, libDir);
+	}
+
 	protected void loadParameters(ConfigurationData configuration) {
-		_overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
 		_filesMaps = (Map[])configuration.getParameter(ConfigurationData.FILES_MAP_LIST);
 		_targetDirectory = (File)configuration.getParameter(ConfigurationData.TARGET_DIRECTORY);
 		
-		if(_targetDirectory == null) {
-			_targetDirectory = FileUtils.CURRENT_DIR;
-		}	
+		boolean overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
+		setTargetDirectory((File)configuration.getParameter(ConfigurationData.TARGET_DIRECTORY), overwrite);
 	}
 	
 	protected void createBuildFile(File baseTargetDir, String buildFileResource, String buildFile) throws Exception {

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java?view=diff&rev=508998&r1=508997&r2=508998
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java Sun Feb 18 13:00:43 2007
@@ -16,7 +16,9 @@
 
 package org.apache.muse.tools.generator.synthesizer;
 
+import java.io.File;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
@@ -51,8 +53,6 @@
  */
 public class ServerSynthesizer extends AbstractSynthesizer {
 	
-	protected Map[] _filesMaps = null;
-	
 	static ConfigurationDataDescriptor[] REQUIRED_PARAMETERS = 
 		new ConfigurationDataDescriptor[] {
 			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION,
@@ -62,34 +62,37 @@
 		ConfigurationData.checkConfiguration(this, configuration);
 				
 		Map[] capabilityMaps = (Map[])configuration.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
-		_filesMaps = new HashMap[capabilityMaps.length];				
+		Map[] filesMaps = new HashMap[capabilityMaps.length];
+		Set[] ignoreSets = new HashSet[capabilityMaps.length];
 		
 		for(int i = 0; i < capabilityMaps.length; i++) {
 			
 			Map capabilities = capabilityMaps[i];
-			_filesMaps[i] = new HashMap();
+			filesMaps[i] = new HashMap();
+			ignoreSets[i] = new HashSet();
 			
 			for (Iterator j = capabilities.values().iterator(); j.hasNext();) {
 				Capability capability = (Capability)j.next();
 				if(!capability.isBuiltIn()) {
-					generateCapability(capability, _filesMaps[i]);
+					generateCapability(capability, filesMaps[i], ignoreSets[i]);
 				}
 			}
 		}
 		
 		ConfigurationData resultData = (ConfigurationData) configuration.clone();
-		resultData.addParameter(ConfigurationData.FILES_MAP_LIST, _filesMaps);
+		resultData.addParameter(ConfigurationData.FILES_MAP_LIST, filesMaps);
+		resultData.addParameter(ConfigurationData.IGNORE_SET_LIST, ignoreSets);
 		
 		resultData = SubscriptionManagerHelper.addSubscriptionManager(resultData); 
 		
 		return resultData;
 	}
 	
-	protected void generateCapability(Capability capability, Map files) {
+	protected void generateCapability(Capability capability, Map files, Set ignoreSet) {
 		ClassInfo classInfo = new ClassInfo(capability);
 					
 		makeInterface(classInfo, files);
-		makeAbstractClass(classInfo, files);
+		makeAbstractClass(classInfo, files, ignoreSet);
 	}
 
 	protected void makeInterface(ClassInfo classInfo, Map files) {
@@ -108,12 +111,12 @@
 		
 		generateCloseBlock(code);
 		
-		String className = makeFileName(classInfo, true);
+		String classFileName = makeFileName(classInfo, true);
 		
-		files.put(className, code.toString());
+		files.put(classFileName, code.toString());
 	}
 	
-	private void makeAbstractClass(ClassInfo classInfo, Map files) {		
+	private void makeAbstractClass(ClassInfo classInfo, Map files, Set ignoreSet) {		
 		StringBuffer code = new StringBuffer();
 		
 		generatePackageHeader(classInfo, code);
@@ -133,9 +136,10 @@
 		
 		generateCloseBlock(code);
 		
-		String className = makeFileName(classInfo, false);
+		String classFileName = makeFileName(classInfo, false);
 		
-		files.put(className, code.toString());
+		files.put(classFileName, code.toString());
+		ignoreSet.add(new File(classFileName));
 	}
 
 	private void generateInitialize(ClassInfo classInfo, StringBuffer code) {				

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/ConfigurationData.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/ConfigurationData.java?view=diff&rev=508998&r1=508997&r2=508998
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/ConfigurationData.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/ConfigurationData.java Sun Feb 18 13:00:43 2007
@@ -19,6 +19,7 @@
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.muse.util.messages.Messages;
 import org.apache.muse.util.messages.MessagesFactory;
@@ -94,6 +95,13 @@
 		new ConfigurationDataDescriptor(
 				GENERATE_CUSTOM_HEADERS,
 				Boolean.class);
+
+	public static final String IGNORE_SET_LIST = "ignore_sets";
+	
+	public static final ConfigurationDataDescriptor IGNORE_SET_LIST_CONFIGURATION = 
+		new ConfigurationDataDescriptor(
+				IGNORE_SET_LIST,
+				Set[].class);
 	
 	private static Messages _MESSAGES = MessagesFactory.get(ConfigurationData.class);
 

Added: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/OverwriteHelper.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/OverwriteHelper.java?view=auto&rev=508998
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/OverwriteHelper.java (added)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/OverwriteHelper.java Sun Feb 18 13:00:43 2007
@@ -0,0 +1,140 @@
+/*=============================================================================*
+ *  Copyright 2007 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.tools.generator.util;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+
+public class OverwriteHelper {
+
+	private static final String COMMENT_CHAR = "#";
+
+	private static final String OVERWRITE_MANIFEST_FILE = ".overwrite";
+
+	private static Messages _MESSAGES = MessagesFactory
+			.get(OverwriteHelper.class);
+
+	private Set _overwriteSet = null;
+
+	private boolean _overwriteAll = false;
+
+	private boolean _modifiable;
+
+	public OverwriteHelper(File targetDirectory, boolean overwriteAll) {
+		_overwriteSet = loadOverwriteSet(targetDirectory);
+		_overwriteAll = overwriteAll;
+
+		if (_overwriteSet == null) {
+			_overwriteSet = new HashSet();
+			_modifiable = true;
+		} else {
+			_modifiable = canOverwrite(new File(targetDirectory,
+					OVERWRITE_MANIFEST_FILE), targetDirectory);
+			if (_modifiable) {
+				_overwriteAll = true;
+			}
+		}
+	}
+
+	public boolean canOverwrite(File file, File directory) {
+		return (!file.exists() || _overwriteAll || overwriteSetContains(file,
+				directory));
+	}
+
+	private boolean overwriteSetContains(File file, File directory) {
+		return _overwriteSet.contains(getBaseFile(file, directory));
+	}
+
+	private File getBaseFile(File file, File directory) {
+		try {
+			String basePath = directory.getCanonicalPath();
+			String filePath = file.getCanonicalPath();
+			return new File(filePath.substring(basePath.length() + 1));
+		} catch (Exception e) {
+			throw new RuntimeException();
+		}
+	}
+
+	/**
+	 * Load an overwrite set manifest from a given directory. The
+	 * 
+	 * @param targetDirectory
+	 * @param initialSet
+	 * @return
+	 */
+	private Set loadOverwriteSet(File targetDirectory) {
+		File overwriteManifest = new File(targetDirectory,
+				OVERWRITE_MANIFEST_FILE);
+
+		if (!overwriteManifest.exists()) {
+			return null;
+		}
+
+		Set overwriteSet = new HashSet();
+
+		try {
+			BufferedReader br = new BufferedReader(new FileReader(
+					overwriteManifest));
+
+			String line = null;
+			while ((line = br.readLine()) != null) {
+				if (!line.startsWith(COMMENT_CHAR)) {
+					overwriteSet.add(new File(line));
+				}
+			}
+
+			br.close();
+		} catch (IOException e) {
+			throw new RuntimeException(
+					_MESSAGES.get("FailedOverwriteManifest"), e);
+		}
+
+		return overwriteSet;
+	}
+
+	public void writeToDirectory(File directory) throws Exception {
+		File overwriteManifest = new File(directory, OVERWRITE_MANIFEST_FILE);
+		if (canOverwrite(overwriteManifest, directory)) {
+			BufferedWriter bw = new BufferedWriter(new FileWriter(overwriteManifest));
+			
+			Object[] files = _overwriteSet.toArray();
+			Arrays.sort(files);
+			
+			for (int i=0; i < files.length; i++) {
+				bw.write(files[i].toString() + "\n");
+			}
+			
+			bw.close();
+		}
+	}
+
+	public void add(File file, File directory) {
+		if (_modifiable) {
+			_overwriteSet.add(getBaseFile(file, directory));
+		}
+	}
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org