You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2012/07/02 07:10:11 UTC

svn commit: r1356068 [1/3] - in /incubator/openmeetings/trunk/singlewebapp: WebContent/src/base/hibernate/ src/org/openmeetings/app/ src/org/openmeetings/app/data/file/ src/org/openmeetings/app/data/flvrecord/converter/ src/org/openmeetings/app/data/fl...

Author: solomax
Date: Mon Jul  2 05:10:03 2012
New Revision: 1356068

URL: http://svn.apache.org/viewvc?rev=1356068&view=rev
Log:
OPENMEETINGS-339:
	Debug of error occured while converting is improved
	New OmFileHelper class is created and used to get well known OM files/folders, OM classes are updated to use new helper

Added:
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/StreamPublishingService.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/utils/OmFileHelper.java
Modified:
    incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/hibernate/hibRtmpConnection.lzx
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/OpenmeetingsVariables.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileProcessor.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileUtils.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/BaseConverter.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvExplorerConverter.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvInterviewConverter.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvRecorderConverter.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/listener/async/BaseStreamWriter.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/record/WhiteboardMapToSVG.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/CreateLibraryPresentation.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateImage.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GeneratePDF.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateSWF.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateThumbs.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/InstallationDocumentHandler.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/LibraryChartLoader.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/LibraryDocumentConverter.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/LibraryWmlLoader.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/LoadLibraryPresentation.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/installation/ImportInitvalues.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/LdapLoginManagement.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/ldap/config/ConfigReader.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/persistence/beans/lang/FieldLanguage.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/quartz/scheduler/TestSetupCleanupJob.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/ChatService.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/ConferenceLibrary.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/FLVRecorderService.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/WhiteBoardService.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/red5/EmoticonsManager.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/remote/red5/ScopeApplicationAdapter.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/templates/VelocityLoader.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/axis/services/FileWebService.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupExport.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/BackupImportController.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/DownloadHandler.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/ExportToImage.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/Install.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/NetworkTestingController.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/ScreenRequestHandler.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/servlet/outputhandler/UploadController.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/AbstractOpenmeetingsSpringTest.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/asf/AsfCopyRightReplace.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/test/library/TestFileParser.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/utils/ProcessHelper.java
    incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/utils/stringhandlers/ChatString.java

Modified: incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/hibernate/hibRtmpConnection.lzx
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/hibernate/hibRtmpConnection.lzx?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/hibernate/hibRtmpConnection.lzx (original)
+++ incubator/openmeetings/trunk/singlewebapp/WebContent/src/base/hibernate/hibRtmpConnection.lzx Mon Jul  2 05:10:03 2012
@@ -1709,9 +1709,9 @@
                         
                         var error = false;
                         for (var eg in value.error){
-                            //Debug.write("eg ",eg," value ",value.error[eg]);
-                            //Debug.write("eg ",eg," value ",value.error[eg].exitValue);
                             if (value.error[eg].exitValue!=0){
+	                            if ($debug) Debug.write("eg ",eg," value ",value.error[eg]);
+	                            if ($debug) Debug.write("eg ",eg," value ",value.error[eg].exitValue);
                                 error = true;
                             }
                         }

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/OpenmeetingsVariables.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/OpenmeetingsVariables.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/OpenmeetingsVariables.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/OpenmeetingsVariables.java Mon Jul  2 05:10:03 2012
@@ -19,10 +19,6 @@
 package org.openmeetings.app;
 
 public class OpenmeetingsVariables {
-	public static final String UPLOAD_DIR = "upload";
-	public static final String UPLOAD_TEMP_DIR = "uploadtemp";
-	public static final String STREAMS_DIR = "streams";
-	
 	public static String webAppRootKey = null;
 	public static String webAppRootPath = null;
 }

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileProcessor.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileProcessor.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileProcessor.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileProcessor.java Mon Jul  2 05:10:03 2012
@@ -19,13 +19,13 @@
 package org.openmeetings.app.data.file;
 
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.transaction.util.FileHelper;
 import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.app.data.file.dao.FileExplorerItemDaoImpl;
 import org.openmeetings.app.data.flvrecord.converter.FlvExplorerConverter;
@@ -33,6 +33,7 @@ import org.openmeetings.app.documents.Ge
 import org.openmeetings.app.documents.GeneratePDF;
 import org.openmeetings.app.documents.GenerateThumbs;
 import org.openmeetings.app.persistence.beans.files.FileExplorerItem;
+import org.openmeetings.utils.OmFileHelper;
 import org.openmeetings.utils.StoredFile;
 import org.openmeetings.utils.crypt.MD5;
 import org.red5.logging.Red5LoggerFactory;
@@ -55,37 +56,9 @@ public class FileProcessor {
 	@Autowired
 	private GeneratePDF generatePDF;
 
-	private String workingDir = "";
-	private String working_dirppt = "";
-
-	private void prepareFolderStructure(String current_dir) throws Exception {
-		
-		this.workingDir = current_dir + OpenmeetingsVariables.UPLOAD_DIR + File.separatorChar
-        						+ "files" + File.separatorChar;
-
-		// System.out.println("IS SYSTEM PROFILE");
-		// Add the Folder for the Room if it does not exist yet
-		File localFolder = new File(workingDir);
-		if (!localFolder.exists()) {
-		    localFolder.mkdir();
-		}
-		
-		this.working_dirppt = current_dir + OpenmeetingsVariables.UPLOAD_TEMP_DIR + File.separatorChar
-		        + "files" + File.separatorChar;
-		
-		// add Temp Folder Structure
-		File localFolderppt = new File(working_dirppt);
-		if (!localFolderppt.exists()) {
-		    localFolderppt.mkdir();
-		}
-		
-		log.debug("this.workingDir: " + this.workingDir);
-		
-	}
-	
 	public HashMap<String, HashMap<String, String>> processFile(Long userId, Long room_id, 
 			boolean isOwner, InputStream is, Long parentFolderId, String fileSystemName, 
-			String current_dir, Map<String, Object> hs, Long externalFileId, 
+			Map<String, Object> hs, Long externalFileId, 
 			String externalType) throws Exception {
 		
 		HashMap<String, HashMap<String, String>> returnError = new HashMap<String, HashMap<String, String>>();
@@ -96,9 +69,6 @@ public class FileProcessor {
         returnAttributes.put("exitValue", "0");
         returnAttributes.put("error","");
 		
-		//prepare the necessary folders
-		this.prepareFolderStructure(current_dir);
-		
 		int dotidx = fileSystemName.lastIndexOf('.');
 
         // Generate a random string to prevent any problems with
@@ -121,7 +91,6 @@ public class FileProcessor {
         boolean isAsIs = storedFile.isAsIs();
         boolean isVideo = storedFile.isVideo();
 
-        String completeName = "";
         log.debug("isAsIs: " + isAsIs);
 
         // add outputfolders for profiles
@@ -132,27 +101,13 @@ public class FileProcessor {
             return returnError;
         }
 
-        if (isAsIs) {
-            // check if this is a room file or UserProfile
-            completeName = workingDir + newFileSystemName;
-        } else {
-            completeName = working_dirppt + newFileSystemName;
-        }
-        log.debug("writing file to: " + completeName + newFileExtDot);
+        File completeName = new File(
+        	isAsIs ? OmFileHelper.getUploadFilesDir() : OmFileHelper.getUploadTempFilesDir()
+        	, newFileSystemName + newFileExtDot);
+        log.debug("writing file to: " + completeName);
         
-        returnAttributes.put("completeName", completeName);
-
-        FileOutputStream fos = new FileOutputStream(completeName + newFileExtDot);
-        byte[] buffer = new byte[1024];
-        int len = 0;
-
-        while (len != (-1)) {
-            len = is.read(buffer, 0, 1024);
-            if (len != (-1))
-                fos.write(buffer, 0, len);
-        }
-
-        fos.close();
+        returnAttributes.put("completeName", completeName.getName());
+        FileHelper.copy(is, completeName);
         is.close();
 
         Long ownerId = null;
@@ -200,27 +155,22 @@ public class FileProcessor {
         log.debug("canBeConverted: " + canBeConverted);
         if (canBeConverted) {
             // convert to pdf, thumbs, swf and xml-description
-            returnError = generatePDF.convertPDF(current_dir,
-                    newFileSystemName, newFileExtDot, "files", true,
-                    completeName);
+            returnError = generatePDF.convertPDF(newFileSystemName, "files", true, completeName);
         } else if (isPdf) {
             // convert to thumbs, swf and xml-description
-            returnError = generatePDF.convertPDF(current_dir,
-                    newFileSystemName, newFileExtDot, "files", false,
-                    completeName);
+            returnError = generatePDF.convertPDF(newFileSystemName, "files", false, completeName);
         } else if (isChart) {
             log.debug("uploaded chart file");
         } else if (isImage && !isAsIs) {
             // convert it to JPG
             log.debug("##### convert it to JPG: ");
-            returnError = generateImage.convertImage(current_dir,
-                    newFileSystemName, newFileExtDot, "files",
+            returnError = generateImage.convertImage(newFileSystemName, newFileExtDot, "files",
                     newFileSystemName, false);
         } else if (isAsIs) {
-            HashMap<String, String> processThumb = generateThumbs.generateThumb("_thumb_", current_dir, completeName, 50);
+            HashMap<String, String> processThumb = generateThumbs.generateThumb("_thumb_", completeName, 50);
             returnError.put("processThumb", processThumb);
         } else if (isVideo) {
-        	List<HashMap<String, String>> returnList = flvExplorerConverter.startConversion(fileExplorerItemId, completeName + newFileExtDot);
+        	List<HashMap<String, String>> returnList = flvExplorerConverter.startConversion(fileExplorerItemId, completeName.getCanonicalPath());
         	
         	int i=0;
         	for (HashMap<String, String> returnMap : returnList) {

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileUtils.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileUtils.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileUtils.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/file/FileUtils.java Mon Jul  2 05:10:03 2012
@@ -19,11 +19,6 @@
 package org.openmeetings.app.data.file;
 
 import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Locale;
@@ -31,13 +26,12 @@ import java.util.Locale;
 import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.app.data.file.dao.FileExplorerItemDaoImpl;
 import org.openmeetings.app.persistence.beans.files.FileExplorerItem;
-import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.openmeetings.utils.OmFileHelper;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 
 public class FileUtils {
-
 	private static final Logger log = Red5LoggerFactory.getLogger(
 			FileProcessor.class, OpenmeetingsVariables.webAppRootKey);
 
@@ -49,7 +43,7 @@ public class FileUtils {
 
 			long fileSize = 0;
 
-			File base = new File(new File(ScopeApplicationAdapter.webAppPath, OpenmeetingsVariables.UPLOAD_DIR), "files");
+			File base = OmFileHelper.getUploadFilesDir();
 			if (fileExplorerItem.getIsImage()) {
 
 				File tFile = new File(base, fileExplorerItem.getFileHash());
@@ -70,7 +64,7 @@ public class FileUtils {
 				File tFolder = new File(base, fileExplorerItem.getFileHash());
 
 				if (tFolder.exists()) {
-					fileSize += getSize(tFolder);
+					fileSize += OmFileHelper.getSize(tFolder);
 				}
 
 			}
@@ -96,34 +90,6 @@ public class FileUtils {
 		return 0;
 	}
 
-	public static String getHumanSize(File dir) {
-		long size = getSize(dir);
-
-		if(size <= 0) return "0";
-		final String[] units = new String[] { "B", "KB", "MB", "GB", "TB" };
-		int digitGroups = (int) (Math.log10(size)/Math.log10(1024));
-		return new DecimalFormat("#,##0.#").format(size/Math.pow(1024, digitGroups)) + " " + units[digitGroups];
-	}
-
-	public static long getSize(File dir) {
-		long size = 0;
-		if (dir.isFile()) {
-			size = dir.length();
-		} else {
-			File[] subFiles = dir.listFiles();
-
-			for (File file : subFiles) {
-				if (file.isFile()) {
-					size += file.length();
-				} else {
-					size += getSize(file);
-				}
-
-			}
-		}
-		return size;
-	}
-
 	public void setFileToOwnerOrRoomByParent(FileExplorerItem fileExplorerItem,
 			Long users_id, Long room_id) {
 		try {
@@ -157,26 +123,4 @@ public class FileUtils {
 		formatter = new SimpleDateFormat(pattern, locale);
 		return formatter.format(date);
 	}
-
-	public void copyFile(String sourceFile, String targetFile) {
-		try {
-			File f1 = new File(sourceFile);
-			File f2 = new File(targetFile);
-			InputStream in = new FileInputStream(f1);
-
-			// For Overwrite the file.
-			OutputStream out = new FileOutputStream(f2);
-
-			byte[] buf = new byte[1024];
-			int len;
-			while ((len = in.read(buf)) > 0) {
-				out.write(buf, 0, len);
-			}
-			in.close();
-			out.close();
-			System.out.println("File copied.");
-		} catch (Exception e) {
-			log.error("[copyfile]", e);
-		}
-	}
 }

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/BaseConverter.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/BaseConverter.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/BaseConverter.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/BaseConverter.java Mon Jul  2 05:10:03 2012
@@ -30,7 +30,7 @@ import org.openmeetings.app.documents.Ge
 import org.openmeetings.app.persistence.beans.flvrecord.FlvRecording;
 import org.openmeetings.app.persistence.beans.flvrecord.FlvRecordingMetaData;
 import org.openmeetings.app.persistence.beans.flvrecord.FlvRecordingMetaDelta;
-import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.openmeetings.utils.OmFileHelper;
 import org.openmeetings.utils.ProcessHelper;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -83,30 +83,12 @@ public abstract class BaseConverter {
 				"use.old.style.ffmpeg.map.option", String.class, "0"));
 	}
 	
-	protected String getStreamFolderName() {
-		return getStreamFolderName("hibernate");
+	protected File getStreamFolder() {
+		return OmFileHelper.getStreamsHibernateDir();
 	}
 
-	protected String getStreamFolderName(FlvRecording flvRecording) {
-		return getStreamFolderName("" + flvRecording.getRoom_id());
-	}
-	
-	protected String getStreamFolderName(String name) {
-		String streamFolderName = ScopeApplicationAdapter.webAppPath
-				+ File.separatorChar + OpenmeetingsVariables.STREAMS_DIR + File.separatorChar
-				+ name + File.separatorChar;
-
-		log.debug("###################################################");
-		log.debug("### streamFolderName - " + streamFolderName);
-		
-		File sf = new File(streamFolderName);
-		if (!sf.exists()) {
-			log.debug("### streamFolderName is NOT exists");
-			if (!sf.mkdir()) {
-				log.error("### streamFolderName: Failed to create folder");
-			}
-		}
-		return streamFolderName;
+	protected File getStreamFolder(FlvRecording flvRecording) {
+		return OmFileHelper.getStreamsSubDir(flvRecording.getRoom_id());
 	}
 	
 	protected void deleteFileIfExists(String name) {
@@ -139,16 +121,16 @@ public abstract class BaseConverter {
 	
 	protected void stripAudioFirstPass(FlvRecording flvRecording,
 			List<HashMap<String, String>> returnLog,
-			List<String> listOfFullWaveFiles, String streamFolderName) throws Exception {
+			List<String> listOfFullWaveFiles, File streamFolder) throws Exception {
 		List<FlvRecordingMetaData> metaDataList = flvRecordingMetaDataDaoImpl
 				.getFlvRecordingMetaDataAudioFlvsByRecording(flvRecording
 						.getFlvRecordingId());
-		stripAudioFirstPass(flvRecording, returnLog, listOfFullWaveFiles, streamFolderName, metaDataList);
+		stripAudioFirstPass(flvRecording, returnLog, listOfFullWaveFiles, streamFolder, metaDataList);
 	}
 	
 	protected void stripAudioFirstPass(FlvRecording flvRecording,
 			List<HashMap<String, String>> returnLog,
-			List<String> listOfFullWaveFiles, String streamFolderName,
+			List<String> listOfFullWaveFiles, File streamFolder,
 			List<FlvRecordingMetaData> metaDataList) {
 		try {
 			// Init variables
@@ -180,23 +162,21 @@ public abstract class BaseConverter {
 					}
 				}
 	
-				String inputFlv = streamFolderName
-						+ flvRecordingMetaData.getStreamName() + ".flv";
+				File inputFlvFile = new File(streamFolder, flvRecordingMetaData.getStreamName() + ".flv");
 	
 				String hashFileName = flvRecordingMetaData.getStreamName()
 						+ "_WAVE.wav";
-				String outputWav = streamFolderName + hashFileName;
+				String outputWav = new File(streamFolder, hashFileName).getCanonicalPath(); //FIXME
 	
 				flvRecordingMetaData.setWavAudioData(hashFileName);
 	
-				File inputFlvFile = new File(inputFlv);
 				
-				log.debug("FLV File Name: {} Length: {} ",inputFlvFile.getName(), inputFlvFile.length());
+				log.debug("FLV File Name: {} Length: {} ", inputFlvFile.getName(), inputFlvFile.length());
 	
 				if (inputFlvFile.exists()) {
 	
 					String[] argv = new String[] { this.getPathToFFMPEG(),
-							"-async", "1", "-i", inputFlv, outputWav };
+							"-async", "1", "-i", inputFlvFile.getCanonicalPath(), outputWav };
 	
 					log.debug("START stripAudioFromFLVs ################# ");
 					for (int i = 0; i < argv.length; i++) {
@@ -246,8 +226,7 @@ public abstract class BaseConverter {
 								+ "_GAP_FULL_WAVE_"
 								+ counter
 								+ ".wav";
-						outputGapFullWav = streamFolderName
-								+ hashFileGapsFullName;
+						outputGapFullWav = new File(streamFolder, hashFileGapsFullName).getCanonicalPath();
 	
 						flvRecordingMetaDelta
 								.setWaveOutPutName(hashFileGapsFullName);
@@ -316,7 +295,7 @@ public abstract class BaseConverter {
 					// Strip Wave to Full Length
 					String hashFileFullName = flvRecordingMetaData
 							.getStreamName() + "_FULL_WAVE.wav";
-					String outputFullWav = streamFolderName + hashFileFullName;
+					String outputFullWav = new File(streamFolder, hashFileFullName).getCanonicalPath();
 	
 					// Calculate delta at beginning
 					Long deltaTimeStartMilliSeconds = flvRecordingMetaData

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvExplorerConverter.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvExplorerConverter.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvExplorerConverter.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvExplorerConverter.java Mon Jul  2 05:10:03 2012
@@ -18,6 +18,7 @@
  */
 package org.openmeetings.app.data.flvrecord.converter;
 
+import java.io.File;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
@@ -86,11 +87,8 @@ public class FlvExplorerConverter extend
 			String moviePath) {
 		List<HashMap<String, String>> returnLog = new LinkedList<HashMap<String, String>>();
 		try {
-
-			String streamFolderName = getStreamFolderName("hibernate");
-
-			String outputFullFlv = streamFolderName + "UPLOADFLV_"
-					+ fileExplorerItem.getFileExplorerItemId() + ".flv";
+			String name = "UPLOADFLV_" + fileExplorerItem.getFileExplorerItemId();
+			File outputFullFlv = new File(getStreamFolder(), name + ".flv");
 
 			fileExplorerItem.setIsVideo(true);
 
@@ -99,7 +97,7 @@ public class FlvExplorerConverter extend
 			argv_fullFLV = new String[] { getPathToFFMPEG(), "-i", moviePath,
 					"-ar", "22050", "-acodec", "libmp3lame", "-ab", "32k",
 					"-vcodec", "flv",
-					outputFullFlv };
+					outputFullFlv.getCanonicalPath() };
 			// "-s", flvWidth + "x" + flvHeight, 
 
 			log.debug("START generateFullFLV ################# ");
@@ -127,14 +125,14 @@ public class FlvExplorerConverter extend
 
 			String hashFileFullNameJPEG = "UPLOADFLV_"
 					+ fileExplorerItem.getFileExplorerItemId() + ".jpg";
-			String outPutJpeg = streamFolderName + hashFileFullNameJPEG;
+			File outPutJpeg = new File(getStreamFolder(), name + ".jpg");
 
 			fileExplorerItem.setPreviewImage(hashFileFullNameJPEG);
 
 			String[] argv_previewFLV = new String[] { getPathToFFMPEG(), "-i",
-					outputFullFlv, "-vcodec", "mjpeg", "-vframes", "1", "-an",
+					outputFullFlv.getCanonicalPath(), "-vcodec", "mjpeg", "-vframes", "1", "-an",
 					"-f", "rawvideo", "-s", flvWidth + "x" + flvHeight,
-					outPutJpeg };
+					outPutJpeg.getCanonicalPath() };
 
 			log.debug("START previewFullFLV ################# ");
 			log.debug(argv_previewFLV.toString());

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvInterviewConverter.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvInterviewConverter.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvInterviewConverter.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvInterviewConverter.java Mon Jul  2 05:10:03 2012
@@ -18,16 +18,12 @@
  */
 package org.openmeetings.app.data.flvrecord.converter;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.commons.transaction.util.FileHelper;
 import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.app.data.flvrecord.FlvRecordingDaoImpl;
 import org.openmeetings.app.data.flvrecord.FlvRecordingLogDaoImpl;
@@ -35,7 +31,6 @@ import org.openmeetings.app.data.flvreco
 import org.openmeetings.app.documents.GenerateThumbs;
 import org.openmeetings.app.persistence.beans.flvrecord.FlvRecording;
 import org.openmeetings.app.persistence.beans.flvrecord.FlvRecordingMetaData;
-import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
 import org.openmeetings.utils.ProcessHelper;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -140,20 +135,20 @@ public class FlvInterviewConverter exten
 	public void stripAudioFromFLVs(FlvRecording flvRecording, boolean reconversion) {
 		List<HashMap<String, String>> returnLog = new LinkedList<HashMap<String, String>>();
 		List<String> listOfFullWaveFiles = new LinkedList<String>();
-		String streamFolderName = getStreamFolderName(flvRecording);
+		File streamFolder = getStreamFolder(flvRecording);
 		List<FlvRecordingMetaData> metaDataList = flvRecordingMetaDataDaoImpl
 				.getFlvRecordingMetaDataAudioFlvsByRecording(flvRecording
 						.getFlvRecordingId());
 
 		stripAudioFirstPass(flvRecording, returnLog, listOfFullWaveFiles,
-				streamFolderName, metaDataList);
+				streamFolder, metaDataList);
 		try {
 			// Merge Wave to Full Length
-			String streamFolderGeneralName = getStreamFolderName();
+			File streamFolderGeneral = getStreamFolder();
 
 			String hashFileFullName = "INTERVIEW_"
 					+ flvRecording.getFlvRecordingId() + "_FINAL_WAVE.wav";
-			String outputFullWav = streamFolderName + hashFileFullName;
+			String outputFullWav = streamFolder + hashFileFullName;
 			deleteFileIfExists(outputFullWav);
 
 			if (listOfFullWaveFiles.size() == 1) {
@@ -183,7 +178,7 @@ public class FlvInterviewConverter exten
 
 				// create default Audio to merge it.
 				// strip to content length
-				String outputWav = streamFolderGeneralName + "one_second.wav";
+				String outputWav = streamFolderGeneral + "one_second.wav";
 
 				// Calculate delta at beginning
 				Long deltaTimeMilliSeconds = flvRecording.getRecordEnd()
@@ -216,22 +211,19 @@ public class FlvInterviewConverter exten
 			for (FlvRecordingMetaData flvRecordingMetaData : metaDataList) {
 
 				// FLV to 24 FPS Sequence AVI
-				String inputFlv = streamFolderName + flvRecordingMetaData.getStreamName() + ".flv";
+				String inputFlv = new File(streamFolder, flvRecordingMetaData.getStreamName() + ".flv").getCanonicalPath();
 
 				File inputFlvFile = new File(inputFlv);
 
 				if (inputFlvFile.exists()) {
 					// TO Image Sequence
 
-					String outputMetaImageData = streamFolderName
-							+ flvRecordingMetaData.getFlvRecordingMetaDataId()
-							+ File.separatorChar;
-
 					// Image Folder
-					File imageSequenceFolder = new File(outputMetaImageData);
+					File imageSequenceFolder = new File(streamFolder
+						, "" + flvRecordingMetaData.getFlvRecordingMetaDataId());
 					imageSequenceFolder.mkdir();
-
-					String outputImages = outputMetaImageData + "image%d.png";
+					
+					String outputImages = new File(imageSequenceFolder, "image%d.png").getCanonicalPath();
 
 					String[] argv_imageSeq = new String[] {
 							this.getPathToFFMPEG(), "-i", inputFlv, "-r",
@@ -253,7 +245,7 @@ public class FlvInterviewConverter exten
 			}
 
 			// Default Image for empty interview video pods
-			String defaultInterviewImage = streamFolderGeneralName
+			String defaultInterviewImage = streamFolderGeneral
 					+ "default_interview_image.png";
 			File defaultInterviewImageFile = new File(defaultInterviewImage);
 
@@ -262,7 +254,7 @@ public class FlvInterviewConverter exten
 			}
 
 			// Create Folder for the output Image Sequence
-			String outputImageMergedData = streamFolderName + "INTERVIEW_"
+			String outputImageMergedData = streamFolder + "INTERVIEW_"
 					+ flvRecording.getFlvRecordingId() + File.separatorChar;
 
 			// Merged Image Folder
@@ -343,17 +335,13 @@ public class FlvInterviewConverter exten
 							String imageName = "image" + currentImageNumber
 									+ ".png";
 
-							String outputMetaImageFullData = streamFolderName
-									+ flvRecordingMetaData
-											.getFlvRecordingMetaDataId()
-									+ File.separatorChar + imageName;
-
-							File outputMetaImageFullDataFile = new File(
-									outputMetaImageFullData);
-
-							if (!outputMetaImageFullDataFile.exists()) {
-								outputMetaImageFullData = defaultInterviewImage;
-							}
+							File outputMetaImageFullDataFile = new File(streamFolder
+								, flvRecordingMetaData.getFlvRecordingMetaDataId()
+									+ File.separatorChar + imageName);
+							
+							String outputMetaImageFullData = 
+								!outputMetaImageFullDataFile.exists() ? defaultInterviewImage
+								: outputMetaImageFullDataFile.getCanonicalPath();
 
 							if (flvRecordingMetaData.getInteriewPodId() == 1) {
 								interviewPod1Images[i] = outputMetaImageFullData;
@@ -432,7 +420,7 @@ public class FlvInterviewConverter exten
 
 			String[] argv_generatedMoview = null;
 
-			String inputScreenFullFlv = streamFolderName
+			String inputScreenFullFlv = streamFolder
 					+ "COMPLETE_INTERVIEW_" + flvRecording.getFlvRecordingId()
 					+ ".flv";
 			deleteFileIfExists(inputScreenFullFlv);
@@ -454,7 +442,7 @@ public class FlvInterviewConverter exten
 
 			String hashFileFullNameFlv = "flvRecording_"
 					+ flvRecording.getFlvRecordingId() + ".flv";
-			String outputFullFlv = streamFolderGeneralName
+			String outputFullFlv = streamFolderGeneral
 					+ hashFileFullNameFlv;
 			deleteFileIfExists(outputFullFlv);
 
@@ -504,7 +492,7 @@ public class FlvInterviewConverter exten
 
 			String hashFileFullNameJPEG = "flvRecording_"
 					+ flvRecording.getFlvRecordingId() + ".jpg";
-			String outPutJpeg = streamFolderGeneralName + hashFileFullNameJPEG;
+			String outPutJpeg = streamFolderGeneral + hashFileFullNameJPEG;
 			deleteFileIfExists(outPutJpeg);
 
 			flvRecording.setPreviewImage(hashFileFullNameJPEG);
@@ -532,7 +520,7 @@ public class FlvInterviewConverter exten
 
 			String alternateDownloadName = "flvRecording_"
 					+ flvRecording.getFlvRecordingId() + ".avi";
-			String alternateDownloadFullName = streamFolderGeneralName
+			String alternateDownloadFullName = streamFolderGeneral
 					+ alternateDownloadName;
 			deleteFileIfExists(alternateDownloadFullName);
 
@@ -575,34 +563,16 @@ public class FlvInterviewConverter exten
 
 			// Delete all Image temp dirs
 			for (FlvRecordingMetaData flvRecordingMetaData : metaDataList) {
-				String outputMetaImageFullData = streamFolderName
-						+ flvRecordingMetaData.getFlvRecordingMetaDataId()
-						+ File.separatorChar;
-
-				this.deleteDirectory(new File(outputMetaImageFullData));
+				FileHelper.removeRec(new File(streamFolder, "" + flvRecordingMetaData.getFlvRecordingMetaDataId()));
 			}
 
-			this.deleteDirectory(new File(outputImageMergedData));
+			FileHelper.removeRec(new File(outputImageMergedData));
 
 		} catch (Exception err) {
 			log.error("[stripAudioFromFLVs]", err);
 		}
 	}
 
-	public boolean deleteDirectory(File path) throws Exception {
-		if (path.exists()) {
-			File[] files = path.listFiles();
-			for (int i = 0; i < files.length; i++) {
-				if (files[i].isDirectory()) {
-					deleteDirectory(files[i]);
-				} else {
-					files[i].delete();
-				}
-			}
-		}
-		return (path.delete());
-	}
-
 	public HashMap<String, String> thumbProcessImageWindows(String file1,
 			String file2, String file3) {
 
@@ -611,76 +581,11 @@ public class FlvInterviewConverter exten
 				file3 };
 
 		return generateThumbs.processImageWindows(cmd);
-
-		// GenerateSWF.executeScript("mergeWave",cmd);
-
 	}
 
 	public HashMap<String, String> processImageWindows(String file1,
 			String file2, String file3) {
-		HashMap<String, String> returnMap = new HashMap<String, String>();
-		returnMap.put("process", "processImageWindows");
-		try {
-
-			// Init variables
-			String[] cmd;
-			String executable_fileName = "";
-			String pathToIMagick = this.getPathToImageMagick();
-
-			Date tnow = new Date();
-			String runtimeFile = "interviewMerge" + tnow.getTime() + ".bat";
-
-			// String runtimeFile = "interviewMerge.bat";
-			executable_fileName = ScopeApplicationAdapter.batchFileDir
-					+ runtimeFile;
-
-			cmd = new String[1];
-			cmd[0] = executable_fileName;
-
-			// Create the Content of the Converter Script (.bat or .sh File)
-			String fileContent = pathToIMagick + " " + file1 + " " + file2
-					+ " " + "+append" + " " + file3
-					+ ScopeApplicationAdapter.lineSeperator + "";
-
-			File previous = new File(executable_fileName);
-			if (previous.exists()) {
-				previous.delete();
-			}
-
-			// execute the Script
-			FileOutputStream fos = new FileOutputStream(executable_fileName);
-			fos.write(fileContent.getBytes());
-			fos.close();
-
-			File now = new File(executable_fileName);
-			now.setExecutable(true);
-
-			Runtime rt = Runtime.getRuntime();
-			returnMap.put("command", cmd.toString());
-			Process proc = rt.exec(cmd);
-
-			InputStream stderr = proc.getErrorStream();
-			BufferedReader br = new BufferedReader(new InputStreamReader(stderr));
-			String line = null;
-			String error = "";
-			while ((line = br.readLine()) != null) {
-				error += line;
-			}
-			br.close();
-			returnMap.put("error", error);
-			int exitVal = proc.waitFor();
-			returnMap.put("exitValue", "" + exitVal);
-
-			if (now.exists()) {
-				now.delete();
-			}
-
-			return returnMap;
-		} catch (Throwable t) {
-			t.printStackTrace();
-			returnMap.put("error", t.getMessage());
-			returnMap.put("exitValue", "-1");
-			return returnMap;
-		}
+		return ProcessHelper.executeScriptWindows("processImageWindows"
+			, new String[]{getPathToImageMagick(), file1, file2, "+append", file3});
 	}
 }

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvRecorderConverter.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvRecorderConverter.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvRecorderConverter.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/converter/FlvRecorderConverter.java Mon Jul  2 05:10:03 2012
@@ -72,12 +72,12 @@ public class FlvRecorderConverter extend
 	public void stripAudioFromFLVs(FlvRecording flvRecording) {
 		List<HashMap<String, String>> returnLog = new LinkedList<HashMap<String, String>>();
 		List<String> listOfFullWaveFiles = new LinkedList<String>();
-		String streamFolderName = getStreamFolderName(flvRecording);
+		File streamFolder = getStreamFolder(flvRecording);
 		try {
-			stripAudioFirstPass(flvRecording, returnLog, listOfFullWaveFiles, streamFolderName);
+			stripAudioFirstPass(flvRecording, returnLog, listOfFullWaveFiles, streamFolder);
 
 			// Merge Wave to Full Length
-			String streamFolderGeneralName = getStreamFolderName();
+			String streamFolderGeneralName = getStreamFolder().getCanonicalPath() + File.separator; //FIXME
 
 			FlvRecordingMetaData flvRecordingMetaDataOfScreen = this.flvRecordingMetaDataDaoImpl
 					.getFlvRecordingMetaDataScreenFlvByRecording(flvRecording
@@ -114,7 +114,7 @@ public class FlvRecorderConverter extend
 			
 			String hashFileFullName = flvRecordingMetaDataOfScreen
 					.getStreamName() + "_FINAL_WAVE.wav";
-			String outputFullWav = streamFolderName + hashFileFullName;
+			String outputFullWav = new File(streamFolder, hashFileFullName).getCanonicalPath();
 
 			if (listOfFullWaveFiles.size() == 1) {
 
@@ -181,8 +181,7 @@ public class FlvRecorderConverter extend
 
 			// Merge Audio with Video / Calculate resulting FLV
 
-			String inputScreenFullFlv = streamFolderName
-					+ flvRecordingMetaDataOfScreen.getStreamName() + ".flv";
+			String inputScreenFullFlv = new File(streamFolder, flvRecordingMetaDataOfScreen.getStreamName() + ".flv").getCanonicalPath();
 
 			String hashFileFullNameFlv = "flvRecording_"
 					+ flvRecording.getFlvRecordingId() + ".flv";

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/listener/async/BaseStreamWriter.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/listener/async/BaseStreamWriter.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/listener/async/BaseStreamWriter.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/flvrecord/listener/async/BaseStreamWriter.java Mon Jul  2 05:10:03 2012
@@ -26,7 +26,7 @@ import java.util.concurrent.LinkedBlocki
 import java.util.concurrent.TimeUnit;
 
 import org.openmeetings.app.OpenmeetingsVariables;
-import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.openmeetings.utils.OmFileHelper;
 import org.red5.io.IStreamableFile;
 import org.red5.io.IStreamableFileFactory;
 import org.red5.io.IStreamableFileService;
@@ -88,36 +88,13 @@ public abstract class BaseStreamWriter i
 	 *             I/O exception
 	 */
 	private void init() throws IOException {
-
-		File folder = new File(ScopeApplicationAdapter.webAppPath
-				+ File.separatorChar + OpenmeetingsVariables.STREAMS_DIR + File.separatorChar
-				+ this.scope.getName());
-
-		if (!folder.exists()) {
-			folder.mkdir();
-		}
-
-		String flvName = ScopeApplicationAdapter.webAppPath
-				+ File.separatorChar + OpenmeetingsVariables.STREAMS_DIR + File.separatorChar
-				+ this.scope.getName() + File.separatorChar + this.streamName
-				+ ".flv";
-
-		file = new File(flvName);
+		file = new File(OmFileHelper.getStreamsSubDir(this.scope.getName()), this.streamName + ".flv");
 
 		IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils
 				.getScopeService(this.scope, IStreamableFileFactory.class,
 						StreamableFileFactory.class);
 
-		// File folder = file.getParentFile();
-
-		if (!folder.exists()) {
-			if (!folder.mkdirs()) {
-				throw new IOException("Could not create parent folder");
-			}
-		}
-
 		if (!this.file.isFile()) {
-
 			// Maybe the (previously existing) file has been deleted
 			this.file.createNewFile();
 

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/record/WhiteboardMapToSVG.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/record/WhiteboardMapToSVG.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/record/WhiteboardMapToSVG.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/data/record/WhiteboardMapToSVG.java Mon Jul  2 05:10:03 2012
@@ -29,7 +29,7 @@ import javax.imageio.ImageIO;
 
 import org.apache.batik.svggen.SVGGraphics2D;
 import org.openmeetings.app.OpenmeetingsVariables;
-import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.openmeetings.utils.OmFileHelper;
 import org.openmeetings.utils.geom.GeomPoint;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -230,17 +230,15 @@ public class WhiteboardMapToSVG extends 
         		String parentPath = graphObject.get(5).toString();
         		String fileItemName = graphObject.get(3).toString();
         		
-        		String imageFilePath = ScopeApplicationAdapter.webAppPath + File.separatorChar +
-        				OpenmeetingsVariables.UPLOAD_DIR + File.separatorChar + room + File.separatorChar;
+        		File imageFile = new File(OmFileHelper.getUploadDir(), room);
         		
         		if (parentPath.length() > 1) {
-        			imageFilePath += parentPath + File.separatorChar;
+        			imageFile = new File(imageFile, parentPath);
         		}
         		
         		//log.debug("fileItemName: "+fileItemName);
         		
-        		String full_path = imageFilePath + fileItemName;
-        		File myFile = new File(full_path);
+        		File myFile = new File(imageFile, fileItemName);
         		
         		if (myFile.exists() && myFile.canRead()) {
         			
@@ -255,7 +253,7 @@ public class WhiteboardMapToSVG extends 
 	        		svgGenerator_temp.drawImage(myImage, x, y, width, height, null);
         			
         		} else {
-        			log.error("tried to inculde a non existing File into SVG/Image Export Path: "+full_path);
+        			log.error("tried to inculde a non existing File into SVG/Image Export Path: " + myFile);
         		}
         		
         	} else if(graphType.equals("line") || graphType.equals("uline")) {

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/CreateLibraryPresentation.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/CreateLibraryPresentation.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/CreateLibraryPresentation.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/CreateLibraryPresentation.java Mon Jul  2 05:10:03 2012
@@ -27,25 +27,12 @@ import org.dom4j.Document;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.dom4j.io.XMLWriter;
+import org.openmeetings.utils.OmFileHelper;
+
 import java.util.Arrays;
 
 public class CreateLibraryPresentation {
-	
-	public static final String libraryFileName = "library.xml";
-	
-	private static CreateLibraryPresentation instance;
-
-	private CreateLibraryPresentation() {}
-
-	public static synchronized CreateLibraryPresentation getInstance() {
-		if (instance == null) {
-			instance = new CreateLibraryPresentation();
-		}
-		return instance;
-	}
-	
-	
-	public HashMap<String,String> generateXMLDocument(String targetDirectory, String originalDocument, 
+	public static HashMap<String,String> generateXMLDocument(File targetDirectory, String originalDocument, 
 			String pdfDocument, String swfDocument){
 		HashMap<String,String> returnMap = new HashMap<String,String>();
 		returnMap.put("process", "generateXMLDocument");		
@@ -54,14 +41,14 @@ public class CreateLibraryPresentation {
 	        Document document = DocumentHelper.createDocument();
 	        Element root = document.addElement( "presentation" );
 
-	        File file = new File(targetDirectory+originalDocument);
+	        File file = new File(targetDirectory, originalDocument);
 	        root.addElement( "originalDocument" )
 				.addAttribute("lastmod", (new Long(file.lastModified())).toString())
 				.addAttribute("size", (new Long(file.length())).toString())	        
 	            .addText( originalDocument );
 	        
 	        if (pdfDocument!=null){
-	        	File pdfDocumentFile = new File(targetDirectory+pdfDocument);
+	        	File pdfDocumentFile = new File(targetDirectory, pdfDocument);
 		        root.addElement( "pdfDocument" )
 					.addAttribute("lastmod", (new Long(pdfDocumentFile.lastModified())).toString())
 					.addAttribute("size", (new Long(pdfDocumentFile.length())).toString())	   		        
@@ -69,7 +56,7 @@ public class CreateLibraryPresentation {
 	        }
 	        
 	        if (swfDocument!=null){
-	        	File swfDocumentFile = new File(targetDirectory+originalDocument);
+	        	File swfDocumentFile = new File(targetDirectory, originalDocument);
 		        root.addElement( "swfDocument" )
 					.addAttribute("lastmod", (new Long(swfDocumentFile.lastModified())).toString())
 					.addAttribute("size", (new Long(swfDocumentFile.length())).toString())	  		        
@@ -78,22 +65,19 @@ public class CreateLibraryPresentation {
 	        
 	        Element thumbs = root.addElement( "thumbs" );
 	        
-	        File dir = new File(targetDirectory);
-	        
 			//Secoond get all Files of this Folder
 			FilenameFilter ff = new FilenameFilter() {
 			     public boolean accept(File b, String name) {
-			    	  String absPath = b.getAbsolutePath()+File.separatorChar+name;
-			    	  File f = new File (absPath);
+			    	  File f = new File(b, name);
 			          return f.isFile();
 			     }
 			};	
 			
-			String[] allfiles = dir.list(ff);			
+			String[] allfiles = targetDirectory.list(ff);			
 			if(allfiles!=null){
 				Arrays.sort(allfiles);
 				for(int i=0; i<allfiles.length; i++){
-					File thumbfile = new File(targetDirectory+allfiles[i]);
+					File thumbfile = new File(targetDirectory, allfiles[i]);
 					if (allfiles[i].startsWith("_thumb_")){
 						thumbs.addElement( "thumb" )
 							.addAttribute("lastmod", (new Long(thumbfile.lastModified())).toString())
@@ -105,7 +89,7 @@ public class CreateLibraryPresentation {
 	        
 	        // lets write to a file
 	        XMLWriter writer = new XMLWriter(
-	            new FileOutputStream( targetDirectory+CreateLibraryPresentation.libraryFileName )
+	            new FileOutputStream(new File(targetDirectory, OmFileHelper.libraryFileName))
 	        );
 	        writer.write( document );
 	        writer.close();

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateImage.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateImage.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateImage.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateImage.java Mon Jul  2 05:10:03 2012
@@ -19,13 +19,14 @@
 package org.openmeetings.app.documents;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.HashMap;
 
 import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.app.data.basic.Configurationmanagement;
 import org.openmeetings.app.data.user.dao.UsersDaoImpl;
 import org.openmeetings.app.persistence.beans.user.Users;
-import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.openmeetings.utils.OmFileHelper;
 import org.openmeetings.utils.ProcessHelper;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -54,90 +55,51 @@ public class GenerateImage {
 		return pathToImageMagic;
 	}
 
-	public HashMap<String, HashMap<String, String>> convertImage(
-			String current_dir, String fileName, String fileExt,
+	public HashMap<String, HashMap<String, String>> convertImage(String fileName, String fileExt,
 			String roomName, String fileNameShort, boolean fullProcessing)
 			throws Exception {
 
 		HashMap<String, HashMap<String, String>> returnMap = new HashMap<String, HashMap<String, String>>();
 
-		String working_imgdir = current_dir + OpenmeetingsVariables.UPLOAD_DIR + File.separatorChar
-				+ roomName + File.separatorChar;
-		String working_pptdir = current_dir + OpenmeetingsVariables.UPLOAD_TEMP_DIR + File.separatorChar
-				+ roomName + File.separatorChar;
-
-		String fileFullPath = working_pptdir + fileName + fileExt;
-
-		File f = new File(working_imgdir + fileName + fileExt);
-		if (f.exists()) {
-			int recursiveNumber = 0;
-			String tempd = fileName + "_" + recursiveNumber;
-			while (f.exists()) {
-				recursiveNumber++;
-				tempd = fileName + "_" + recursiveNumber;
-				f = new File(working_imgdir + tempd + fileExt);
-			}
-			fileName = tempd;
-		}
+		File fileFullPath = new File(OmFileHelper.getUploadTempRoomDir(roomName), fileName + fileExt);
 
-		String destinationFile = working_imgdir + fileName;
+		File destinationFile = OmFileHelper.getNewFile(OmFileHelper.getUploadRoomDir(roomName), fileName, ".jpg");
 
 		log.debug("##### convertImage destinationFile: " + destinationFile);
 
 		HashMap<String, String> processJPG = this.convertSingleJpg(
-				fileFullPath, destinationFile);
+				fileFullPath.getCanonicalPath(), destinationFile);
 		HashMap<String, String> processThumb = generateThumbs.generateThumb(
-				"_thumb_", current_dir, destinationFile, 50);
+				"_thumb_", destinationFile, 50);
 
 		returnMap.put("processJPG", processJPG);
 		returnMap.put("processThumb", processThumb);
 
 		// Delete old one
-		File fToDelete = new File(fileFullPath);
-		fToDelete.delete();
+		fileFullPath.delete();
 
 		return returnMap;
 	}
 
-	public HashMap<String, HashMap<String, String>> convertImageUserProfile(
-			String current_dir, String fileName, String fileExt, Long users_id,
+	public HashMap<String, HashMap<String, String>> convertImageUserProfile(String fileName, String fileExt, Long users_id,
 			String fileNameShort, boolean fullProcessing) throws Exception {
 
 		HashMap<String, HashMap<String, String>> returnMap = new HashMap<String, HashMap<String, String>>();
 
-		String working_imgdir = current_dir + OpenmeetingsVariables.UPLOAD_DIR + File.separatorChar
-				+ "profiles" + File.separatorChar
-				+ ScopeApplicationAdapter.profilesPrefix + users_id
-				+ File.separatorChar;
-		String working_pptdir = current_dir + OpenmeetingsVariables.UPLOAD_TEMP_DIR + File.separatorChar
-				+ "profiles" + File.separatorChar
-				+ ScopeApplicationAdapter.profilesPrefix + users_id
-				+ File.separatorChar;
-
-		String fileFullPath = working_pptdir + fileName + fileExt;
-
-		File f = new File(working_imgdir + fileName + fileExt);
-		if (f.exists()) {
-			int recursiveNumber = 0;
-			String tempd = fileName + "_" + recursiveNumber;
-			while (f.exists()) {
-				recursiveNumber++;
-				tempd = fileName + "_" + recursiveNumber;
-				f = new File(working_imgdir + tempd + fileExt);
-			}
-			fileName = tempd;
-		}
+		File working_pptdir = OmFileHelper.getUploadTempProfilesUserDir(users_id);
+
+		String fileFullPath = new File(working_pptdir, fileName + fileExt).getCanonicalPath();
 
-		String destinationFile = working_imgdir + fileName;
+		File destinationFile = OmFileHelper.getNewFile(OmFileHelper.getUploadProfilesUserDir(users_id), fileName, ".jpg");
 		HashMap<String, String> processJPG = this.convertSingleJpg(
 				fileFullPath, destinationFile);
 
 		HashMap<String, String> processThumb1 = generateThumbs.generateThumb(
-				"_chat_", current_dir, destinationFile, 40);
+				"_chat_", destinationFile, 40);
 		HashMap<String, String> processThumb2 = generateThumbs.generateThumb(
-				"_profile_", current_dir, destinationFile, 126);
+				"_profile_", destinationFile, 126);
 		HashMap<String, String> processThumb3 = generateThumbs.generateThumb(
-				"_big_", current_dir, destinationFile, 240);
+				"_big_", destinationFile, 240);
 
 		returnMap.put("processJPG", processJPG);
 		returnMap.put("processThumb1", processThumb1);
@@ -148,8 +110,7 @@ public class GenerateImage {
 		File fToDelete = new File(fileFullPath);
 		fToDelete.delete();
 
-		File fileNameToStore = new File(destinationFile + ".jpg");
-		String pictureuri = fileNameToStore.getName();
+		String pictureuri = destinationFile.getName();
 		Users us = usersDao.getUser(users_id);
 		us.setUpdatetime(new java.util.Date());
 		us.setPictureuri(pictureuri);
@@ -163,12 +124,11 @@ public class GenerateImage {
 
 	/**
 	 * -density 150 -resize 800
+	 * @throws IOException 
 	 * 
 	 */
-	private HashMap<String, String> convertSingleJpg(String inputFile,
-			String outputfile) {
-		String[] argv = new String[] { getPathToImageMagic(), inputFile,
-				outputfile + ".jpg" };
+	private HashMap<String, String> convertSingleJpg(String inputFile, File outputfile) throws IOException {
+		String[] argv = new String[] { getPathToImageMagic(), inputFile, outputfile.getCanonicalPath() };
 
 		// return GenerateSWF.executeScript("convertSingleJpg", argv);
 

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GeneratePDF.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GeneratePDF.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GeneratePDF.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GeneratePDF.java Mon Jul  2 05:10:03 2012
@@ -26,6 +26,7 @@ import java.util.HashMap;
 import org.apache.commons.transaction.util.FileHelper;
 import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.app.data.basic.Configurationmanagement;
+import org.openmeetings.utils.OmFileHelper;
 import org.openmeetings.utils.ProcessHelper;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -43,97 +44,55 @@ public class GeneratePDF {
 	@Autowired
 	private Configurationmanagement cfgManagement;
 
-	public HashMap<String, HashMap<String, String>> convertPDF(
-			String current_dir, String fileName, String fileExt,
-			String roomName, boolean fullProcessing, String completeName)
+	public HashMap<String, HashMap<String, String>> convertPDF(String fileName,
+			String roomName, boolean fullProcessing, File inFile)
 			throws Exception {
 
+		String inFileName = inFile.getName();
 		HashMap<String, HashMap<String, String>> returnError = new HashMap<String, HashMap<String, String>>();
 
-		HashMap<String, String> processPDF = new HashMap<String, String>();
-		processPDF.put("process", "processPDF");
-
-		String working_imgdir = current_dir + OpenmeetingsVariables.UPLOAD_DIR + File.separatorChar
-				+ roomName + File.separatorChar;
-		String working_pptdir = current_dir + OpenmeetingsVariables.UPLOAD_TEMP_DIR + File.separatorChar
-				+ roomName + File.separatorChar;
-
-		String fileFullPath = working_pptdir + fileName + fileExt;
-		String destinationFolder = working_imgdir + fileName;
-
-		File f = new File(destinationFolder + File.separatorChar);
-		if (f.exists()) {
-			int recursiveNumber = 0;
-			String tempd = destinationFolder + "_" + recursiveNumber;
-			while (f.exists()) {
-				recursiveNumber++;
-				tempd = destinationFolder + "_" + recursiveNumber;
-				f = new File(tempd);
-
-			}
-			destinationFolder = tempd;
-		}
-
-		boolean b = f.mkdir();
-		if (!b) {
-			processPDF.put(
-					"error",
-					"convertPDF + ERROR: Folder could not create "
-							+ f.getAbsolutePath());
-			processPDF.put("exitValue", "-1");
-		} else {
-			processPDF.put("exitValue", "0");
-		}
-		returnError.put("processPDF", processPDF);
-
-		String outputfolder = destinationFolder + File.separatorChar;
-		destinationFolder = destinationFolder + File.separatorChar;
+		File fileFullPath = new File(OmFileHelper.getUploadTempRoomDir(roomName), inFileName);
+		File destinationFolder = OmFileHelper.getNewDir(OmFileHelper.getUploadRoomDir(roomName), fileName);
 
 		log.debug("fullProcessing: " + fullProcessing);
 		if (fullProcessing) {
 			HashMap<String, String> processOpenOffice = doJodConvert(
-					current_dir, fileFullPath, destinationFolder, fileName);
+					fileFullPath, destinationFolder, fileName);
 			returnError.put("processOpenOffice", processOpenOffice);
 			HashMap<String, String> processThumb = generateThumbs
-					.generateBatchThumb(current_dir, destinationFolder
-							+ fileName + ".pdf", destinationFolder, 80, "thumb");
+					.generateBatchThumb(new File(destinationFolder, fileName + ".pdf"), destinationFolder, 80, "thumb");
 			returnError.put("processThumb", processThumb);
 			HashMap<String, String> processSWF = generateSWF
-					.generateSwf(current_dir, destinationFolder,
-							destinationFolder, fileName);
+					.generateSwf(destinationFolder, destinationFolder, fileName);
 			returnError.put("processSWF", processSWF);
 		} else {
 
 			log.debug("-- generateBatchThumb --");
 
 			HashMap<String, String> processThumb = generateThumbs
-					.generateBatchThumb(current_dir, fileFullPath,
-							destinationFolder, 80, "thumb");
+					.generateBatchThumb(fileFullPath, destinationFolder, 80, "thumb");
 			returnError.put("processThumb", processThumb);
 
 			HashMap<String, String> processSWF = generateSWF.generateSwf(
-					current_dir, (new File(fileFullPath)).getParentFile()
-							.getAbsolutePath() + File.separatorChar,
-					destinationFolder, fileName);
+					fileFullPath.getParentFile(), destinationFolder, fileName);
 			returnError.put("processSWF", processSWF);
 		}
 
 		// now it should be completed so copy that file to the expected location
-		File fileToBeMoved = new File(completeName + fileExt);
-		File fileWhereToMove = new File(outputfolder + fileName + fileExt);
+		File fileWhereToMove = new File(destinationFolder, inFileName);
 		fileWhereToMove.createNewFile();
-		FileHelper.moveRec(fileToBeMoved, fileWhereToMove);
+		FileHelper.moveRec(inFile, fileWhereToMove);
 
 		if (fullProcessing) {
 			HashMap<String, String> processXML = CreateLibraryPresentation
-					.getInstance().generateXMLDocument(outputfolder,
-							fileName + fileExt, fileName + ".pdf",
+					.generateXMLDocument(destinationFolder,
+							inFileName, fileName + ".pdf",
 							fileName + ".swf");
 			returnError.put("processXML", processXML);
 		} else {
 			HashMap<String, String> processXML = CreateLibraryPresentation
-					.getInstance().generateXMLDocument(outputfolder,
-							fileName + fileExt, null, fileName + ".swf");
+					.generateXMLDocument(destinationFolder,
+							inFileName, null, fileName + ".swf");
 			returnError.put("processXML", processXML);
 		}
 
@@ -143,8 +102,7 @@ public class GeneratePDF {
 	/**
 	 * Generates PDF using JOD Library (external library)
 	 */
-	public HashMap<String, String> doJodConvert(String current_dir,
-			String fileFullPath, String destinationFolder, String outputfile) {
+	public HashMap<String, String> doJodConvert(File fileFullPath, File destinationFolder, String outputfile) {
 		try {
 
 			String jodPath = cfgManagement.getConfValue("jod.path", String.class, "./jod");
@@ -163,17 +121,16 @@ public class GeneratePDF {
 			}
 			String jodConverterJar = "";
 
-			for (String jarFiles : jodFolder.list(new FilenameFilter() {
+			for (String jar : jodFolder.list(new FilenameFilter() {
 				public boolean accept(File file1, String name) {
 					return name.endsWith(".jar");
 				}
 			})) {
 				argv.add("-cp");
-				if (jarFiles.startsWith("jodconverter")) {
-					jodConverterJar = jarFiles;
+				if (jar.startsWith("jodconverter")) {
+					jodConverterJar = jar;
 				}
-				argv.add(jodFolder.getAbsolutePath() + File.separatorChar
-						+ jarFiles);
+				argv.add(new File(jodFolder, jar).getCanonicalPath());
 			}
 			if (jodConverterJar.length() == 0) {
 				throw new Exception(
@@ -181,10 +138,9 @@ public class GeneratePDF {
 			}
 
 			argv.add("-jar");
-			argv.add(jodFolder.getAbsolutePath() + File.separatorChar
-					+ jodConverterJar);
-			argv.add(fileFullPath);
-			argv.add(destinationFolder + outputfile + ".pdf");
+			argv.add(new File(jodFolder, jodConverterJar).getCanonicalPath());
+			argv.add(fileFullPath.getCanonicalPath());
+			argv.add(new File(destinationFolder, outputfile + ".pdf").getCanonicalPath());
 
 			return ProcessHelper.executeScript("doJodConvert",
 					argv.toArray(new String[argv.size()]));

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateSWF.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateSWF.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateSWF.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateSWF.java Mon Jul  2 05:10:03 2012
@@ -19,10 +19,12 @@
 package org.openmeetings.app.documents;
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 
+import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.app.data.basic.Configurationmanagement;
 import org.openmeetings.utils.ProcessHelper;
 import org.red5.logging.Red5LoggerFactory;
@@ -32,7 +34,7 @@ import org.springframework.beans.factory
 public class GenerateSWF {
 
 	public static final Logger log = Red5LoggerFactory
-			.getLogger(GenerateSWF.class);
+			.getLogger(GenerateSWF.class, OpenmeetingsVariables.webAppRootKey);
 
 	@Autowired
 	private Configurationmanagement cfgManagement;
@@ -71,8 +73,7 @@ public class GenerateSWF {
 		return valueForSwfJpegQuality;
 	}
 
-	public HashMap<String, String> generateSwf(String current_dir,
-			String originalFolder, String destinationFolder, String fileNamePure) {
+	public HashMap<String, String> generateSwf(File originalFolder, File destinationFolder, String fileNamePure) throws IOException {
 		
 		// Create the Content of the Converter Script (.bat or .sh File)
 		String[] argv = new String[] {
@@ -82,8 +83,8 @@ public class GenerateSWF {
 				"-i", // change draw order to reduce pdf complexity
 				"-j", "" + getSwfJpegQuality(), // JPEG Quality 
 				"-s", "zoom=" + getSwfZoom(), // set zoom dpi 
-				originalFolder + fileNamePure + ".pdf",
-				destinationFolder + fileNamePure + ".swf" };
+				new File(originalFolder, fileNamePure + ".pdf").getCanonicalPath(),
+				new File(destinationFolder, fileNamePure + ".swf").getCanonicalPath() };
 
 		return ProcessHelper.executeScript("generateSwf", argv);
 	}

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateThumbs.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateThumbs.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateThumbs.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/GenerateThumbs.java Mon Jul  2 05:10:03 2012
@@ -18,14 +18,11 @@
  */
 package org.openmeetings.app.documents;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.io.IOException;
 import java.util.HashMap;
 
-import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
+import org.openmeetings.app.OpenmeetingsVariables;
 import org.openmeetings.utils.ProcessHelper;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
@@ -34,24 +31,23 @@ import org.springframework.beans.factory
 public class GenerateThumbs {
 
 	private static final Logger log = Red5LoggerFactory
-			.getLogger(GenerateThumbs.class);
+			.getLogger(GenerateThumbs.class, OpenmeetingsVariables.webAppRootKey);
 
 	@Autowired
 	private GenerateImage generateImage;
 
-	public HashMap<String, String> generateThumb(String pre,
-			String current_dir, String filepath, Integer thumbSize) {
+	public HashMap<String, String> generateThumb(String pre, File f, Integer thumbSize) throws IOException {
 		// Init variables
-		File f = new File(filepath);
 		String name = f.getName();
-		String folder = f.getParentFile().getAbsolutePath()
-				+ File.separatorChar;
+		File parent = f.getParentFile();
 
 		String[] argv = new String[] {
-				generateImage.getPathToImageMagic(),
-				"-thumbnail",
-				Integer.toString(thumbSize) + "x" + Integer.toString(thumbSize),
-				filepath + ".jpg", folder + pre + name + ".jpg" };
+			generateImage.getPathToImageMagic()
+			, "-thumbnail"
+			, Integer.toString(thumbSize) + "x" + Integer.toString(thumbSize)
+			, f.getCanonicalPath()
+			, new File(parent, pre + name).getCanonicalPath()
+			};
 
 		log.debug("START generateThumb ################# ");
 		for (int i = 0; i < argv.length; i++) {
@@ -79,24 +75,27 @@ public class GenerateThumbs {
 
 	}
 
-	public HashMap<String, String> generateBatchThumb(String current_dir,
-			String inputfile, String outputpath, Integer thumbSize, String pre) {
+	public HashMap<String, String> generateBatchThumb(File inputfile, File outputpath, Integer thumbSize, String pre) throws IOException {
 
 		if (System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") == -1) {
 			String[] argv = new String[] {
-					generateImage.getPathToImageMagic(),
-					"-thumbnail", // FIXME
-					Integer.toString(thumbSize), inputfile,
-					outputpath + "_" + pre + "_page-%04d.jpg" };
+				generateImage.getPathToImageMagic()
+				, "-thumbnail" // FIXME
+				, Integer.toString(thumbSize)
+				, inputfile.getCanonicalPath()
+				, new File(outputpath, "_" + pre + "_page-%04d.jpg").getCanonicalPath()
+				};
 
 			return ProcessHelper.executeScript("generateBatchThumbByWidth", argv);
 		} else {
 
 			String[] argv = new String[] {
-					generateImage.getPathToImageMagic(),
-					"-thumbnail", // FIXME
-					Integer.toString(thumbSize), inputfile,
-					outputpath + "_" + pre + "_page-%%04d.jpg" };
+				generateImage.getPathToImageMagic()
+				, "-thumbnail" // FIXME
+				, Integer.toString(thumbSize)
+				, inputfile.getCanonicalPath()
+				, new File(outputpath, "_" + pre + "_page-%04d.jpg").getCanonicalPath()
+				};
 
 			// return GenerateSWF.executeScript("generateBatchThumbByWidth",
 			// argv);
@@ -120,72 +119,6 @@ public class GenerateThumbs {
 	}
 
 	public HashMap<String, String> processImageWindows(String[] args) {
-		HashMap<String, String> returnMap = new HashMap<String, String>();
-		returnMap.put("process", "processImageWindows");
-		try {
-
-			// Init variables
-			String[] cmd;
-			String executable_fileName = "";
-
-			String runtimeFile = "interviewMerge.bat";
-			executable_fileName = ScopeApplicationAdapter.batchFileDir
-					+ runtimeFile;
-
-			cmd = new String[4];
-			cmd[0] = "cmd.exe";
-			cmd[1] = "/C";
-			cmd[2] = "start";
-			cmd[3] = executable_fileName;
-
-			// log.debug("executable_fileName: "+executable_fileName);
-
-			// Create the Content of the Converter Script (.bat or .sh File)
-
-			String fileContent = "";
-
-			for (int k = 0; k < args.length; k++) {
-				if (k != 0) {
-					fileContent += " ";
-				}
-				fileContent += args[k];
-			}
-
-			fileContent += ScopeApplicationAdapter.lineSeperator + "exit";
-
-			File previous = new File(executable_fileName);
-			if (previous.exists()) {
-				previous.delete();
-			}
-
-			// execute the Script
-			FileOutputStream fos = new FileOutputStream(executable_fileName);
-			fos.write(fileContent.getBytes());
-			fos.close();
-
-			Runtime rt = Runtime.getRuntime();
-			returnMap.put("command", cmd.toString());
-
-			Process proc = rt.exec(cmd);
-
-			InputStream stderr = proc.getErrorStream();
-			BufferedReader br = new BufferedReader(new InputStreamReader(stderr));
-			String line = null;
-			String error = "";
-			while ((line = br.readLine()) != null) {
-				error += line;
-				// log.debug("line: "+line);
-			}
-			br.close();
-			returnMap.put("error", error);
-			int exitVal = proc.waitFor();
-			returnMap.put("exitValue", "" + exitVal);
-			return returnMap;
-		} catch (Throwable t) {
-			t.printStackTrace();
-			returnMap.put("error", t.getMessage());
-			returnMap.put("exitValue", "-1");
-			return returnMap;
-		}
+		return ProcessHelper.executeScriptWindows("processImageWindows", args);
 	}
 }

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/InstallationDocumentHandler.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/InstallationDocumentHandler.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/InstallationDocumentHandler.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/InstallationDocumentHandler.java Mon Jul  2 05:10:03 2012
@@ -18,32 +18,18 @@
  */
 package org.openmeetings.app.documents;
 
-import java.io.File;
 import java.io.FileWriter;
 
 import org.dom4j.Document;
-import org.dom4j.io.XMLWriter;
 import org.dom4j.DocumentHelper;
 import org.dom4j.Element;
 import org.dom4j.Node;
 import org.dom4j.io.SAXReader;
+import org.dom4j.io.XMLWriter;
+import org.openmeetings.utils.OmFileHelper;
 
 public class InstallationDocumentHandler {
-	
-	public static final String installFileName = "install.xml";
-	
-	private static InstallationDocumentHandler instance;
-
-	private InstallationDocumentHandler() {}
-
-	public static synchronized InstallationDocumentHandler getInstance() {
-		if (instance == null) {
-			instance = new InstallationDocumentHandler();
-		}
-		return instance;
-	}
-	
-	public void createDocument(String filePath, Integer stepNo) throws Exception {
+	public static void createDocument(Integer stepNo) throws Exception {
 		
 		Document document = DocumentHelper.createDocument();
 		
@@ -53,16 +39,16 @@ public class InstallationDocumentHandler
 		step.addElement("stepnumber").addText(stepNo.toString());
 		step.addElement("stepname").addText("Step "+stepNo);
 		
-		XMLWriter writer = new XMLWriter( new FileWriter( filePath ) );
+		XMLWriter writer = new XMLWriter(new FileWriter(OmFileHelper.getInstallFile()));
         writer.write( document );
         writer.close();
 		
 	}
 	
-	public int getCurrentStepNumber(String filePath) throws Exception{
+	public static int getCurrentStepNumber() throws Exception{
 		
 	    SAXReader reader = new SAXReader();
-        Document document = reader.read(new File(filePath, InstallationDocumentHandler.installFileName));
+        Document document = reader.read(OmFileHelper.getInstallFile());
         
         Node node = document.selectSingleNode( "//install/step/stepnumber" );
         

Modified: incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/LibraryChartLoader.java
URL: http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/LibraryChartLoader.java?rev=1356068&r1=1356067&r2=1356068&view=diff
==============================================================================
--- incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/LibraryChartLoader.java (original)
+++ incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/app/documents/LibraryChartLoader.java Mon Jul  2 05:10:03 2012
@@ -19,6 +19,7 @@
 package org.openmeetings.app.documents;
 
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.FileReader;
 import java.util.ArrayList;
 
@@ -46,17 +47,16 @@ public class LibraryChartLoader {
     }
 
     @SuppressWarnings("rawtypes")
-	public ArrayList loadChart(String filePath, String fileName) {
+	public ArrayList loadChart(File dir, String fileName) {
         try {
-            String filepathComplete = filePath + fileName + fileExt;
+            File file = new File(dir, fileName + fileExt);
 
-            log.error("filepathComplete: " + filepathComplete);
+            log.error("filepathComplete: " + file);
 
             XStream xStream = new XStream(new XppDriver());
             xStream.setMode(XStream.NO_REFERENCES);
 
-            BufferedReader reader = new BufferedReader(new FileReader(
-                    filepathComplete));
+            BufferedReader reader = new BufferedReader(new FileReader(file));
             String xmlString = "";
             while (reader.ready()) {
                 xmlString += reader.readLine();