//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void execute() throws org.apache.tools.ant.BuildException public virtual void execute() { IList <File> files = new List <File>(); if (file != null) { files.Add(file); } if (fileSets != null) { foreach (FileSet fileSet in fileSets) { DirectoryScanner directoryScanner = fileSet.getDirectoryScanner(Project); File baseDir = directoryScanner.Basedir; string[] includedFiles = directoryScanner.IncludedFiles; string[] excludedFiles = directoryScanner.ExcludedFiles; IList <string> excludedFilesList = Arrays.asList(excludedFiles); foreach (string includedFile in includedFiles) { if (!excludedFilesList.Contains(includedFile)) { files.Add(new File(baseDir, includedFile)); } } } } Thread currentThread = Thread.CurrentThread; ClassLoader originalClassLoader = currentThread.ContextClassLoader; currentThread.ContextClassLoader = typeof(DeployBarTask).ClassLoader; LogUtil.readJavaUtilLoggingConfigFromClasspath(); try { log("Initializing process engine " + processEngineName); ProcessEngines.init(); ProcessEngine processEngine = ProcessEngines.getProcessEngine(processEngineName); if (processEngine == null) { IList <ProcessEngineInfo> processEngineInfos = ProcessEngines.ProcessEngineInfos; if (processEngineInfos != null && processEngineInfos.Count > 0) { // Since no engine with the given name is found, we can't be 100% sure which ProcessEngineInfo // is causing the error. We should show ALL errors and process engine names / resource URL's. string message = getErrorMessage(processEngineInfos, processEngineName); throw new ProcessEngineException(message); } else { throw new ProcessEngineException("Could not find a process engine with name '" + processEngineName + "', no engines found. " + "Make sure an engine configuration is present on the classpath"); } } RepositoryService repositoryService = processEngine.RepositoryService; log("Starting to deploy " + files.Count + " files"); foreach (File file in files) { string path = file.AbsolutePath; log("Handling file " + path); try { FileStream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read); try { log("deploying bar " + path); repositoryService.createDeployment().name(file.Name).addZipInputStream(new ZipInputStream(inputStream)).deploy(); } finally { IoUtil.closeSilently(inputStream); } } catch (Exception e) { throw new BuildException("couldn't deploy bar " + path + ": " + e.Message, e); } } } finally { currentThread.ContextClassLoader = originalClassLoader; } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void setUp() throws Exception protected internal virtual void setUp() { base.setUp(); ProcessEngines.destroy(); ProcessEngines.init(); }