Author: solomax
Date: Fri Oct 14 13:19:59 2016
New Revision: 1764888

URL: http://svn.apache.org/viewvc?rev=1764888&view=rev
Log:
[OPENMEETINGS-1457] initial work on files import

Modified:
    
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java
    
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
    
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java
    openmeetings/application/branches/3.2.x/openmeetings-util/pom.xml
    
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
    openmeetings/application/branches/3.2.x/pom.xml
    
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java
    
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
    
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java
    openmeetings/application/trunk/openmeetings-util/pom.xml
    
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
    openmeetings/application/trunk/pom.xml

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java
 Fri Oct 14 13:19:59 2016
@@ -29,7 +29,7 @@ import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.db.dao.user.UserDao;
 import org.apache.openmeetings.db.entity.file.FileItem;
 import org.apache.openmeetings.db.entity.user.User;
@@ -75,7 +75,7 @@ public class GenerateImage extends BaseC
                });
                if (files != null) {
                        for (File f : files) {
-                               FileHelper.removeRec(f);
+                               FileUtils.deleteQuietly(f);
                        }
                }
                
@@ -83,7 +83,7 @@ public class GenerateImage extends BaseC
                if (!skipConvertion) {
                        returnMap.addItem("processJPG", convertSingleJpg(file, 
destinationFile));
                } else {
-                       FileHelper.copy(file, destinationFile);
+                       FileUtils.copyFile(file, destinationFile);
                }
                returnMap.addItem("processThumb2", 
generateThumbs.generateThumb(profileImagePrefix, destinationFile, 126));
 

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
 Fri Oct 14 13:19:59 2016
@@ -27,7 +27,7 @@ import java.io.InputStream;
 import java.util.List;
 import java.util.UUID;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.core.converter.FlvExplorerConverter;
 import org.apache.openmeetings.core.converter.GenerateImage;
 import org.apache.openmeetings.core.converter.GenerateThumbs;
@@ -107,7 +107,7 @@ public class FileProcessor {
                        returnError.addItem("No parent", new 
ConverterProcessResult("Unable to create parent for file: " + 
file.getCanonicalPath()));
                        return returnError;
                }
-               FileHelper.copy(is, file);
+               FileUtils.copyInputStreamToFile(is, file);
                is.close();
 
                

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
 Fri Oct 14 13:19:59 2016
@@ -27,7 +27,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.core.data.whiteboard.WhiteboardManager;
 import org.apache.openmeetings.core.documents.LibraryChartLoader;
 import org.apache.openmeetings.core.documents.LibraryDocumentConverter;
@@ -229,7 +229,7 @@ public class ConferenceLibrary implement
 
                                        File target = new File(targetFolder, 
mp4.getName());
                                        if (mp4.exists() && !target.exists()) {
-                                               FileHelper.copy(mp4, target);
+                                               FileUtils.copyFile(mp4, target);
                                        }
                                        return 1L;
                                }

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
 Fri Oct 14 13:19:59 2016
@@ -19,6 +19,9 @@
 package org.apache.openmeetings.backup;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.apache.openmeetings.util.OmFileHelper.BACKUP_DIR;
+import static org.apache.openmeetings.util.OmFileHelper.BCKP_ROOM_FILES;
+import static org.apache.openmeetings.util.OmFileHelper.IMPORT_DIR;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
 
 import java.io.File;
@@ -31,7 +34,7 @@ import java.util.List;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.db.dao.basic.ChatDao;
 import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
 import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
@@ -391,7 +394,7 @@ public class BackupExport {
                        /*
                         * ##################### Backup Room Files
                         */
-                       File targetRootDir = new File(backup_dir, "roomFiles");
+                       File targetRootDir = new File(backup_dir, 
BCKP_ROOM_FILES);
 
                        if (!targetRootDir.exists()) {
                                targetRootDir.mkdir();
@@ -402,10 +405,11 @@ public class BackupExport {
                        File[] files = sourceDir.listFiles();
                        for (File file : files) {
                                if (file.isDirectory()) {
-                                       if (!file.getName().equals("backup") && 
!file.getName().equals("import")) {
+                                       String fName = file.getName();
+                                       if (!IMPORT_DIR.equals(fName) && 
!BACKUP_DIR.equals(fName)) {
                                                log.debug("### " + 
file.getName());
 
-                                               FileHelper.copyRec(file, new 
File(targetRootDir, file.getName()));
+                                               FileUtils.copyDirectory(file, 
new File(targetRootDir, file.getName()));
                                        }
                                }
                        }
@@ -421,7 +425,7 @@ public class BackupExport {
 
                        File sourceDirRec = 
OmFileHelper.getStreamsHibernateDir();
 
-                       FileHelper.copyRec(sourceDirRec, targetDirRec);
+                       FileUtils.copyDirectory(sourceDirRec, targetDirRec);
                        progressHolder.setProgress(90);
                }
 
@@ -493,7 +497,7 @@ public class BackupExport {
                                ZipEntry zipEntry = new ZipEntry(path);
                                zos.putNextEntry(zipEntry);
 
-                               OmFileHelper.copyFile(file, zos);
+                               FileUtils.copyFile(file, zos);
                                zos.closeEntry();
                        }
                }

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 Fri Oct 14 13:19:59 2016
@@ -18,23 +18,27 @@
  */
 package org.apache.openmeetings.backup;
 
-import static org.apache.commons.transaction.util.FileHelper.copyRec;
 import static 
org.apache.openmeetings.db.entity.user.PrivateMessage.INBOX_FOLDER_ID;
 import static 
org.apache.openmeetings.db.entity.user.PrivateMessage.SENT_FOLDER_ID;
 import static 
org.apache.openmeetings.db.entity.user.PrivateMessage.TRASH_FOLDER_ID;
 import static org.apache.openmeetings.db.util.UserHelper.getMinLoginLength;
-import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
+import static org.apache.openmeetings.util.OmFileHelper.BCKP_ROOM_FILES;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_AVI;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_OGG;
+import static org.apache.openmeetings.util.OmFileHelper.FILES_DIR;
+import static org.apache.openmeetings.util.OmFileHelper.PROFILES_DIR;
 import static org.apache.openmeetings.util.OmFileHelper.getFileName;
 import static org.apache.openmeetings.util.OmFileHelper.getStreamsHibernateDir;
 import static org.apache.openmeetings.util.OmFileHelper.getUploadDir;
 import static 
org.apache.openmeetings.util.OmFileHelper.getUploadProfilesUserDir;
 import static org.apache.openmeetings.util.OmFileHelper.getUploadRoomDir;
+import static org.apache.openmeetings.util.OmFileHelper.getUploadFilesDir;
 import static org.apache.openmeetings.util.OmFileHelper.profilesPrefix;
 import static org.apache.openmeetings.util.OmFileHelper.recordingFileName;
+import static org.apache.openmeetings.util.OmFileHelper.thumbImagePrefix;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_CRYPT_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_LDAP_ID;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
@@ -63,7 +67,7 @@ import javax.xml.transform.TransformerFa
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.db.dao.basic.ChatDao;
 import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
 import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
@@ -220,14 +224,14 @@ public class BackupImport {
                                        }
                                }
                                if (!fentry.isDirectory()) {
-                                       FileHelper.copy(zis, fentry);
+                                       FileUtils.copyInputStreamToFile(zis, 
fentry);
                                        zis.closeEntry();
                                }
                        }
                }
                return f;
        }
-       
+
        public void performImport(InputStream is) throws Exception {
                userMap.clear();
                groupMap.clear();
@@ -712,14 +716,14 @@ public class BackupImport {
                importFolders(f);
 
                log.info("File explorer item import complete, clearing temp 
files");
-               
-               FileHelper.removeRec(f);
+
+               FileUtils.deleteDirectory(f);
        }
-       
+
        private static <T> List<T> readList(Serializer ser, File baseDir, 
String fileName, String listNodeName, Class<T> clazz) throws Exception {
                return readList(ser, baseDir, fileName, listNodeName, clazz, 
false);
        }
-       
+
        private static <T> List<T> readList(Serializer ser, File baseDir, 
String fileName, String listNodeName, Class<T> clazz, boolean notThow) throws 
Exception {
                List<T> list = new ArrayList<>();
                File xml = new File(baseDir, fileName);
@@ -744,7 +748,7 @@ public class BackupImport {
                }
                return list;
        }
-       
+
        private static Node getNode(Node doc, String name) {
                if (doc != null) {
                        NodeList nl = doc.getChildNodes();
@@ -757,7 +761,7 @@ public class BackupImport {
                }
                return null;
        }
-       
+
        //FIXME (need to be removed in later versions) HACK to fix old 
properties
        public List<FileExplorerItem> readFileExplorerItemList(File baseDir, 
String fileName, String listNodeName) throws Exception {
                List<FileExplorerItem> list = new ArrayList<>();
@@ -882,7 +886,7 @@ public class BackupImport {
        public List<User> readUserList(InputStream xml, String listNodeName) 
throws Exception {
                return readUserList(new InputSource(xml), listNodeName);
        }
-       
+
        public List<User> readUserList(File baseDir, String fileName, String 
listNodeName) throws Exception {
                File xml = new File(baseDir, fileName);
                if (!xml.exists()) {
@@ -891,7 +895,7 @@ public class BackupImport {
                
                return readUserList(new 
InputSource(xml.toURI().toASCIIString()), listNodeName);
        }
-       
+
        //FIXME (need to be removed in later versions) HACK to add external 
attendees previously stored in MeetingMember structure
        private List<MeetingMember> readMeetingMemberList(File baseDir, String 
filename, String listNodeName) throws Exception {
                Registry registry = new Registry();
@@ -967,7 +971,7 @@ public class BackupImport {
                }
                return list;
        }
-       
+
        //FIXME (need to be removed in later versions) HACK to fix 2 deleted 
nodes in users.xml and inline Address and sipData
        private List<User> readUserList(InputSource xml, String listNodeName) 
throws Exception {
                Registry registry = new Registry();
@@ -1102,7 +1106,7 @@ public class BackupImport {
                }
                return list;
        }
-       
+
        //FIXME (need to be removed in later versions) HACK to fix old 
properties
        private List<Room> readRoomList(File baseDir, String fileName, String 
listNodeName) throws Exception {
                List<Room> list = new ArrayList<>();
@@ -1170,7 +1174,7 @@ public class BackupImport {
                }
                return list;
        }
-       
+
        private static Long getProfileId(File f) {
                String n = f.getName();
                if (n.indexOf(profilesPrefix) > -1) {
@@ -1178,10 +1182,10 @@ public class BackupImport {
                }
                return null;
        }
-       
+
        private void importFolders(File importBaseDir) throws IOException {
                // Now check the room files and import them
-               File roomFilesFolder = new File(importBaseDir, "roomFiles");
+               File roomFilesFolder = new File(importBaseDir, BCKP_ROOM_FILES);
 
                File uploadDir = getUploadDir();
 
@@ -1191,26 +1195,35 @@ public class BackupImport {
                        for (File file : roomFilesFolder.listFiles()) {
                                if (file.isDirectory()) {
                                        String fName = file.getName();
-                                       if ("profiles".equals(fName)) {
+                                       if (PROFILES_DIR.equals(fName)) {
                                                // profile should correspond to 
the new user id
                                                for (File profile : 
file.listFiles()) {
                                                        Long oldId = 
getProfileId(profile);
                                                        Long id = oldId != null 
? getNewId(oldId, Maps.USERS) : null;
                                                        if (id != null) {
-                                                               
copyRec(profile, getUploadProfilesUserDir(id));
+                                                               
FileUtils.copyDirectory(profile, getUploadProfilesUserDir(id));
                                                        }
                                                }
                                                continue;
+                                       } else if (FILES_DIR.equals(fName)) {
+                                               for (File rf : 
file.listFiles()) {
+                                                       // going to fix images
+                                                       if (rf.isFile() && 
rf.getName().endsWith(EXTENSION_JPG)) {
+                                                               
FileUtils.copyFileToDirectory(rf, getImgDir(rf.getName()));
+                                                       } else {
+                                                               
FileUtils.copyDirectory(rf, getUploadFilesDir());
+                                                       }
+                                               }
                                        } else {
                                                // check if folder is room 
folder, store it under new id if necessary
                                                Long oldId = 
importLongType(fName);
                                                Long id = oldId != null ? 
getNewId(oldId, Maps.ROOMS) : null;
                                                if (id != null) {
-                                                       copyRec(file, 
getUploadRoomDir(id.toString()));
+                                                       
FileUtils.copyDirectory(file, getUploadRoomDir(id.toString()));
                                                        continue;
                                                }
                                        }
-                                       copyRec(file, new File(uploadDir, 
fName));
+                                       FileUtils.copyDirectory(file, new 
File(uploadDir, fName));
                                }
                        }
                }
@@ -1221,10 +1234,16 @@ public class BackupImport {
 
                log.debug("sourceDirRec PATH " + 
sourceDirRec.getCanonicalPath());
                if (sourceDirRec.exists()) {
-                       copyRec(sourceDirRec, getStreamsHibernateDir());
+                       FileUtils.copyDirectory(sourceDirRec, 
getStreamsHibernateDir());
                }
        }
 
+       private static File getImgDir(String name) {
+               int start = name.startsWith(thumbImagePrefix) ? 
thumbImagePrefix.length() : 0;
+               String hash = name.substring(start, name.length() - 
EXTENSION_JPG.length() - 1);
+               return new File(getUploadFilesDir(), hash);
+       }
+
        private static Long importLongType(String value) {
                Long val = null;
                try {

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java
 Fri Oct 14 13:19:59 2016
@@ -20,7 +20,7 @@ package org.apache.openmeetings.backup;
 
 import org.simpleframework.xml.transform.Transform;
 
-public class LongTransform implements Transform<Long>{
+public class LongTransform implements Transform<Long> {
        @Override
        public Long read(String value) throws Exception {
                return OmConverter.getLong(value);

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
 Fri Oct 14 13:19:59 2016
@@ -43,7 +43,7 @@ import org.apache.commons.cli.DefaultPar
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
 import org.apache.openjpa.jdbc.schema.SchemaTool;
@@ -299,7 +299,7 @@ public class Admin {
                                        
                                        BackupExport export = 
getApplicationContext().getBean(BackupExport.class);
                                        export.performExport(f, backup_dir, 
includeFiles, new ProgressHolder());
-                                       FileHelper.removeRec(backup_dir);
+                                       FileUtils.deleteDirectory(backup_dir);
                                        backup_dir.delete();
                                } catch (Exception e) {
                                        handleError("Backup failed", e);

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java
 Fri Oct 14 13:19:59 2016
@@ -23,7 +23,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.util.OmFileHelper;
 
 public class CleanupEntityUnit extends CleanupUnit {
@@ -56,10 +56,10 @@ public class CleanupEntityUnit extends C
        @Override
        public void cleanup() throws IOException {
                for (File i : invalid) {
-                       FileHelper.removeRec(i);
+                       FileUtils.deleteQuietly(i);
                }
                for (File i : deleted) {
-                       FileHelper.removeRec(i);
+                       FileUtils.deleteQuietly(i);
                }
        }
        

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java
 Fri Oct 14 13:19:59 2016
@@ -27,7 +27,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
 import org.apache.openmeetings.db.dao.record.RecordingDao;
 import org.apache.openmeetings.db.dao.user.UserDao;
@@ -130,7 +130,7 @@ public class CleanupHelper {
                                String hiberPath = 
hibernateDir.getCanonicalPath();
                                for (File f : list(getParent(), null)) {
                                        if 
(!f.getCanonicalPath().equals(hiberPath)) {
-                                               FileHelper.removeRec(f);
+                                               FileUtils.deleteQuietly(f);
                                        }
                                }
                                super.cleanup();

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java
 Fri Oct 14 13:19:59 2016
@@ -22,7 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.util.OmFileHelper;
 
 public class CleanupUnit implements Serializable {
@@ -45,7 +45,7 @@ public class CleanupUnit implements Seri
        
        public void cleanup() throws IOException {
                for (File f : getParent().listFiles()) {
-                       FileHelper.removeRec(f);
+                       FileUtils.deleteQuietly(f);
                }
        }
        

Modified: openmeetings/application/branches/3.2.x/openmeetings-util/pom.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-util/pom.xml?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-util/pom.xml (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-util/pom.xml Fri Oct 
14 13:19:59 2016
@@ -68,10 +68,6 @@
                        <artifactId>red5-server</artifactId>
                </dependency>
                <dependency>
-                       <groupId>commons-transaction</groupId>
-                       <artifactId>commons-transaction</artifactId>
-               </dependency>
-               <dependency>
                        <groupId>dom4j</groupId>
                        <artifactId>dom4j</artifactId>
                        <version>${dom4j.version}</version>

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
 Fri Oct 14 13:19:59 2016
@@ -18,23 +18,13 @@
  */
 package org.apache.openmeetings.util;
 
-import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
-
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.text.DecimalFormat;
 
-import org.apache.commons.transaction.util.FileHelper;
 import org.apache.openmeetings.util.ConnectionProperties.DbType;
-import org.red5.logging.Red5LoggerFactory;
-import org.slf4j.Logger;
 
 public class OmFileHelper {
-       private static final Logger log = 
Red5LoggerFactory.getLogger(OmFileHelper.class, webAppRootKey);
-
        /**
         * This variable needs to point to the openmeetings webapp directory
         */
@@ -43,22 +33,20 @@ public class OmFileHelper {
        private static final String PUBLIC_DIR = "public";
        private static final String CLIPARTS_DIR = "cliparts";
        private static final String WEB_INF_DIR = "WEB-INF";
-       private static final String PROFILES_DIR = "profiles";
        private static final String GROUP_LOGO_DIR = "grouplogo";
        private static final String STREAMS_DIR = "streams";
        private static final String EMOTIONS_DIR = "emoticons";
        private static final String LANGUAGES_DIR = "languages";
-       private static final String IMPORT_DIR = "import";
        private static final String HIBERNATE_DIR = "hibernate";
        private static final String CONF_DIR = "conf";
-       private static final String BACKUP_DIR = "backup";
        private static final String IMAGES_DIR = "images";
        private static final String WML_DIR = "stored";
-
        private static final String INSTALL_FILE = "install.xml";
 
+       public static final String BACKUP_DIR = "backup";
+       public static final String IMPORT_DIR = "import";
+       public static final String PROFILES_DIR = "profiles";
        public static final String SCREENSHARING_DIR = "screensharing";
-       
        public static final String FILES_DIR = "files";
        public static final String PERSISTENCE_NAME = 
"classes/META-INF/persistence.xml";
        public static final String DB_PERSISTENCE_NAME = 
"classes/META-INF/%s_persistence.xml";
@@ -85,6 +73,7 @@ public class OmFileHelper {
        public static final String MP4_MIME_TYPE = "video/" + EXTENSION_MP4;
        public static final String JPG_MIME_TYPE = "image/jpeg";
        public static final String PNG_MIME_TYPE = "image/png";
+       public static final String BCKP_ROOM_FILES = "roomFiles";
 
        public static void setOmHome(File omHome) {
                OmFileHelper.OM_HOME = omHome;
@@ -304,33 +293,17 @@ public class OmFileHelper {
                if (dir.isFile()) {
                        size = dir.length();
                } else {
-                       File[] subFiles = dir.listFiles();
-
-                       for (File file : subFiles) {
+                       for (File file : dir.listFiles()) {
                                if (file.isFile()) {
                                        size += file.length();
                                } else {
                                        size += getSize(file);
                                }
-
                        }
                }
                return size;
        }
 
-       public static void copyFile(String sourceFile, String targetFile) 
throws IOException {
-               FileHelper.copy(new File(sourceFile), new File(targetFile));
-       }
-
-       public static void copyFile(File f1, OutputStream out) throws 
IOException {
-               try (InputStream in = new FileInputStream(f1)) {
-                       FileHelper.copy(in, out);
-                       log.debug("File copied.");
-               } catch (Exception e) {
-                       log.error("[copyfile(File, File)]", e);
-               }
-       }
-
        public static String getFileName(String name) {
                int dotidx = name.lastIndexOf('.');
                return dotidx < 0 ? "" : name.substring(0, dotidx);

Modified: openmeetings/application/branches/3.2.x/pom.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/pom.xml?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/pom.xml (original)
+++ openmeetings/application/branches/3.2.x/pom.xml Fri Oct 14 13:19:59 2016
@@ -48,7 +48,6 @@
                <spring.version>4.3.3.RELEASE</spring.version>
                <mina.version>2.0.15</mina.version>
                <tomcat.version>8.5.6</tomcat.version>
-               <commons-transaction.version>1.2</commons-transaction.version>
                <ical4j.version>2.0-beta1</ical4j.version>
                <cxf.version>3.1.7</cxf.version>
                <selenium.version>2.53.1</selenium.version>
@@ -520,17 +519,6 @@
                                <exclusions>
                                        <exclusion>
                                                
<groupId>commons-logging</groupId>
-                                               
<artifactId>commons-logging</artifactId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-transaction</groupId>
-                               <artifactId>commons-transaction</artifactId>
-                               
<version>${commons-transaction.version}</version>
-                               <exclusions>
-                                       <exclusion>
-                                               
<groupId>commons-logging</groupId>
                                                
<artifactId>commons-logging</artifactId>
                                        </exclusion>
                                </exclusions>

Modified: 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/GenerateImage.java
 Fri Oct 14 13:19:59 2016
@@ -29,7 +29,7 @@ import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.db.dao.user.UserDao;
 import org.apache.openmeetings.db.entity.file.FileItem;
 import org.apache.openmeetings.db.entity.user.User;
@@ -75,7 +75,7 @@ public class GenerateImage extends BaseC
                });
                if (files != null) {
                        for (File f : files) {
-                               FileHelper.removeRec(f);
+                               FileUtils.deleteQuietly(f);
                        }
                }
                
@@ -83,7 +83,7 @@ public class GenerateImage extends BaseC
                if (!skipConvertion) {
                        returnMap.addItem("processJPG", convertSingleJpg(file, 
destinationFile));
                } else {
-                       FileHelper.copy(file, destinationFile);
+                       FileUtils.copyFile(file, destinationFile);
                }
                returnMap.addItem("processThumb2", 
generateThumbs.generateThumb(profileImagePrefix, destinationFile, 126));
 

Modified: 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
 Fri Oct 14 13:19:59 2016
@@ -27,7 +27,7 @@ import java.io.InputStream;
 import java.util.List;
 import java.util.UUID;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.core.converter.FlvExplorerConverter;
 import org.apache.openmeetings.core.converter.GenerateImage;
 import org.apache.openmeetings.core.converter.GenerateThumbs;
@@ -107,7 +107,7 @@ public class FileProcessor {
                        returnError.addItem("No parent", new 
ConverterProcessResult("Unable to create parent for file: " + 
file.getCanonicalPath()));
                        return returnError;
                }
-               FileHelper.copy(is, file);
+               FileUtils.copyInputStreamToFile(is, file);
                is.close();
 
                

Modified: 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
 Fri Oct 14 13:19:59 2016
@@ -27,7 +27,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.core.data.whiteboard.WhiteboardManager;
 import org.apache.openmeetings.core.documents.LibraryChartLoader;
 import org.apache.openmeetings.core.documents.LibraryDocumentConverter;
@@ -229,7 +229,7 @@ public class ConferenceLibrary implement
 
                                        File target = new File(targetFolder, 
mp4.getName());
                                        if (mp4.exists() && !target.exists()) {
-                                               FileHelper.copy(mp4, target);
+                                               FileUtils.copyFile(mp4, target);
                                        }
                                        return 1L;
                                }

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
 Fri Oct 14 13:19:59 2016
@@ -19,6 +19,9 @@
 package org.apache.openmeetings.backup;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.apache.openmeetings.util.OmFileHelper.BACKUP_DIR;
+import static org.apache.openmeetings.util.OmFileHelper.BCKP_ROOM_FILES;
+import static org.apache.openmeetings.util.OmFileHelper.IMPORT_DIR;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
 
 import java.io.File;
@@ -31,7 +34,7 @@ import java.util.List;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.db.dao.basic.ChatDao;
 import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
 import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
@@ -391,7 +394,7 @@ public class BackupExport {
                        /*
                         * ##################### Backup Room Files
                         */
-                       File targetRootDir = new File(backup_dir, "roomFiles");
+                       File targetRootDir = new File(backup_dir, 
BCKP_ROOM_FILES);
 
                        if (!targetRootDir.exists()) {
                                targetRootDir.mkdir();
@@ -402,10 +405,11 @@ public class BackupExport {
                        File[] files = sourceDir.listFiles();
                        for (File file : files) {
                                if (file.isDirectory()) {
-                                       if (!file.getName().equals("backup") && 
!file.getName().equals("import")) {
+                                       String fName = file.getName();
+                                       if (!IMPORT_DIR.equals(fName) && 
!BACKUP_DIR.equals(fName)) {
                                                log.debug("### " + 
file.getName());
 
-                                               FileHelper.copyRec(file, new 
File(targetRootDir, file.getName()));
+                                               FileUtils.copyDirectory(file, 
new File(targetRootDir, file.getName()));
                                        }
                                }
                        }
@@ -421,7 +425,7 @@ public class BackupExport {
 
                        File sourceDirRec = 
OmFileHelper.getStreamsHibernateDir();
 
-                       FileHelper.copyRec(sourceDirRec, targetDirRec);
+                       FileUtils.copyDirectory(sourceDirRec, targetDirRec);
                        progressHolder.setProgress(90);
                }
 
@@ -493,7 +497,7 @@ public class BackupExport {
                                ZipEntry zipEntry = new ZipEntry(path);
                                zos.putNextEntry(zipEntry);
 
-                               OmFileHelper.copyFile(file, zos);
+                               FileUtils.copyFile(file, zos);
                                zos.closeEntry();
                        }
                }

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 Fri Oct 14 13:19:59 2016
@@ -18,23 +18,27 @@
  */
 package org.apache.openmeetings.backup;
 
-import static org.apache.commons.transaction.util.FileHelper.copyRec;
 import static 
org.apache.openmeetings.db.entity.user.PrivateMessage.INBOX_FOLDER_ID;
 import static 
org.apache.openmeetings.db.entity.user.PrivateMessage.SENT_FOLDER_ID;
 import static 
org.apache.openmeetings.db.entity.user.PrivateMessage.TRASH_FOLDER_ID;
 import static org.apache.openmeetings.db.util.UserHelper.getMinLoginLength;
-import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
+import static org.apache.openmeetings.util.OmFileHelper.BCKP_ROOM_FILES;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_AVI;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
 import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_OGG;
+import static org.apache.openmeetings.util.OmFileHelper.FILES_DIR;
+import static org.apache.openmeetings.util.OmFileHelper.PROFILES_DIR;
 import static org.apache.openmeetings.util.OmFileHelper.getFileName;
 import static org.apache.openmeetings.util.OmFileHelper.getStreamsHibernateDir;
 import static org.apache.openmeetings.util.OmFileHelper.getUploadDir;
 import static 
org.apache.openmeetings.util.OmFileHelper.getUploadProfilesUserDir;
 import static org.apache.openmeetings.util.OmFileHelper.getUploadRoomDir;
+import static org.apache.openmeetings.util.OmFileHelper.getUploadFilesDir;
 import static org.apache.openmeetings.util.OmFileHelper.profilesPrefix;
 import static org.apache.openmeetings.util.OmFileHelper.recordingFileName;
+import static org.apache.openmeetings.util.OmFileHelper.thumbImagePrefix;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_CRYPT_KEY;
 import static 
org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_DEFAULT_LDAP_ID;
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
@@ -63,7 +67,7 @@ import javax.xml.transform.TransformerFa
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.db.dao.basic.ChatDao;
 import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
 import org.apache.openmeetings.db.dao.calendar.AppointmentDao;
@@ -220,14 +224,14 @@ public class BackupImport {
                                        }
                                }
                                if (!fentry.isDirectory()) {
-                                       FileHelper.copy(zis, fentry);
+                                       FileUtils.copyInputStreamToFile(zis, 
fentry);
                                        zis.closeEntry();
                                }
                        }
                }
                return f;
        }
-       
+
        public void performImport(InputStream is) throws Exception {
                userMap.clear();
                groupMap.clear();
@@ -712,14 +716,14 @@ public class BackupImport {
                importFolders(f);
 
                log.info("File explorer item import complete, clearing temp 
files");
-               
-               FileHelper.removeRec(f);
+
+               FileUtils.deleteDirectory(f);
        }
-       
+
        private static <T> List<T> readList(Serializer ser, File baseDir, 
String fileName, String listNodeName, Class<T> clazz) throws Exception {
                return readList(ser, baseDir, fileName, listNodeName, clazz, 
false);
        }
-       
+
        private static <T> List<T> readList(Serializer ser, File baseDir, 
String fileName, String listNodeName, Class<T> clazz, boolean notThow) throws 
Exception {
                List<T> list = new ArrayList<>();
                File xml = new File(baseDir, fileName);
@@ -744,7 +748,7 @@ public class BackupImport {
                }
                return list;
        }
-       
+
        private static Node getNode(Node doc, String name) {
                if (doc != null) {
                        NodeList nl = doc.getChildNodes();
@@ -757,7 +761,7 @@ public class BackupImport {
                }
                return null;
        }
-       
+
        //FIXME (need to be removed in later versions) HACK to fix old 
properties
        public List<FileExplorerItem> readFileExplorerItemList(File baseDir, 
String fileName, String listNodeName) throws Exception {
                List<FileExplorerItem> list = new ArrayList<>();
@@ -882,7 +886,7 @@ public class BackupImport {
        public List<User> readUserList(InputStream xml, String listNodeName) 
throws Exception {
                return readUserList(new InputSource(xml), listNodeName);
        }
-       
+
        public List<User> readUserList(File baseDir, String fileName, String 
listNodeName) throws Exception {
                File xml = new File(baseDir, fileName);
                if (!xml.exists()) {
@@ -891,7 +895,7 @@ public class BackupImport {
                
                return readUserList(new 
InputSource(xml.toURI().toASCIIString()), listNodeName);
        }
-       
+
        //FIXME (need to be removed in later versions) HACK to add external 
attendees previously stored in MeetingMember structure
        private List<MeetingMember> readMeetingMemberList(File baseDir, String 
filename, String listNodeName) throws Exception {
                Registry registry = new Registry();
@@ -967,7 +971,7 @@ public class BackupImport {
                }
                return list;
        }
-       
+
        //FIXME (need to be removed in later versions) HACK to fix 2 deleted 
nodes in users.xml and inline Address and sipData
        private List<User> readUserList(InputSource xml, String listNodeName) 
throws Exception {
                Registry registry = new Registry();
@@ -1102,7 +1106,7 @@ public class BackupImport {
                }
                return list;
        }
-       
+
        //FIXME (need to be removed in later versions) HACK to fix old 
properties
        private List<Room> readRoomList(File baseDir, String fileName, String 
listNodeName) throws Exception {
                List<Room> list = new ArrayList<>();
@@ -1170,7 +1174,7 @@ public class BackupImport {
                }
                return list;
        }
-       
+
        private static Long getProfileId(File f) {
                String n = f.getName();
                if (n.indexOf(profilesPrefix) > -1) {
@@ -1178,10 +1182,10 @@ public class BackupImport {
                }
                return null;
        }
-       
+
        private void importFolders(File importBaseDir) throws IOException {
                // Now check the room files and import them
-               File roomFilesFolder = new File(importBaseDir, "roomFiles");
+               File roomFilesFolder = new File(importBaseDir, BCKP_ROOM_FILES);
 
                File uploadDir = getUploadDir();
 
@@ -1191,26 +1195,35 @@ public class BackupImport {
                        for (File file : roomFilesFolder.listFiles()) {
                                if (file.isDirectory()) {
                                        String fName = file.getName();
-                                       if ("profiles".equals(fName)) {
+                                       if (PROFILES_DIR.equals(fName)) {
                                                // profile should correspond to 
the new user id
                                                for (File profile : 
file.listFiles()) {
                                                        Long oldId = 
getProfileId(profile);
                                                        Long id = oldId != null 
? getNewId(oldId, Maps.USERS) : null;
                                                        if (id != null) {
-                                                               
copyRec(profile, getUploadProfilesUserDir(id));
+                                                               
FileUtils.copyDirectory(profile, getUploadProfilesUserDir(id));
                                                        }
                                                }
                                                continue;
+                                       } else if (FILES_DIR.equals(fName)) {
+                                               for (File rf : 
file.listFiles()) {
+                                                       // going to fix images
+                                                       if (rf.isFile() && 
rf.getName().endsWith(EXTENSION_JPG)) {
+                                                               
FileUtils.copyFileToDirectory(rf, getImgDir(rf.getName()));
+                                                       } else {
+                                                               
FileUtils.copyDirectory(rf, getUploadFilesDir());
+                                                       }
+                                               }
                                        } else {
                                                // check if folder is room 
folder, store it under new id if necessary
                                                Long oldId = 
importLongType(fName);
                                                Long id = oldId != null ? 
getNewId(oldId, Maps.ROOMS) : null;
                                                if (id != null) {
-                                                       copyRec(file, 
getUploadRoomDir(id.toString()));
+                                                       
FileUtils.copyDirectory(file, getUploadRoomDir(id.toString()));
                                                        continue;
                                                }
                                        }
-                                       copyRec(file, new File(uploadDir, 
fName));
+                                       FileUtils.copyDirectory(file, new 
File(uploadDir, fName));
                                }
                        }
                }
@@ -1221,10 +1234,16 @@ public class BackupImport {
 
                log.debug("sourceDirRec PATH " + 
sourceDirRec.getCanonicalPath());
                if (sourceDirRec.exists()) {
-                       copyRec(sourceDirRec, getStreamsHibernateDir());
+                       FileUtils.copyDirectory(sourceDirRec, 
getStreamsHibernateDir());
                }
        }
 
+       private static File getImgDir(String name) {
+               int start = name.startsWith(thumbImagePrefix) ? 
thumbImagePrefix.length() : 0;
+               String hash = name.substring(start, name.length() - 
EXTENSION_JPG.length() - 1);
+               return new File(getUploadFilesDir(), hash);
+       }
+
        private static Long importLongType(String value) {
                Long val = null;
                try {

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java
 Fri Oct 14 13:19:59 2016
@@ -20,7 +20,7 @@ package org.apache.openmeetings.backup;
 
 import org.simpleframework.xml.transform.Transform;
 
-public class LongTransform implements Transform<Long>{
+public class LongTransform implements Transform<Long> {
        @Override
        public Long read(String value) throws Exception {
                return OmConverter.getLong(value);

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java
 Fri Oct 14 13:19:59 2016
@@ -43,7 +43,7 @@ import org.apache.commons.cli.DefaultPar
 import org.apache.commons.cli.OptionGroup;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl;
 import org.apache.openjpa.jdbc.schema.SchemaTool;
@@ -299,7 +299,7 @@ public class Admin {
                                        
                                        BackupExport export = 
getApplicationContext().getBean(BackupExport.class);
                                        export.performExport(f, backup_dir, 
includeFiles, new ProgressHolder());
-                                       FileHelper.removeRec(backup_dir);
+                                       FileUtils.deleteDirectory(backup_dir);
                                        backup_dir.delete();
                                } catch (Exception e) {
                                        handleError("Backup failed", e);

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupEntityUnit.java
 Fri Oct 14 13:19:59 2016
@@ -23,7 +23,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.util.OmFileHelper;
 
 public class CleanupEntityUnit extends CleanupUnit {
@@ -56,10 +56,10 @@ public class CleanupEntityUnit extends C
        @Override
        public void cleanup() throws IOException {
                for (File i : invalid) {
-                       FileHelper.removeRec(i);
+                       FileUtils.deleteQuietly(i);
                }
                for (File i : deleted) {
-                       FileHelper.removeRec(i);
+                       FileUtils.deleteQuietly(i);
                }
        }
        

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupHelper.java
 Fri Oct 14 13:19:59 2016
@@ -27,7 +27,7 @@ import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
 import org.apache.openmeetings.db.dao.record.RecordingDao;
 import org.apache.openmeetings.db.dao.user.UserDao;
@@ -130,7 +130,7 @@ public class CleanupHelper {
                                String hiberPath = 
hibernateDir.getCanonicalPath();
                                for (File f : list(getParent(), null)) {
                                        if 
(!f.getCanonicalPath().equals(hiberPath)) {
-                                               FileHelper.removeRec(f);
+                                               FileUtils.deleteQuietly(f);
                                        }
                                }
                                super.cleanup();

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/cli/CleanupUnit.java
 Fri Oct 14 13:19:59 2016
@@ -22,7 +22,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
 
-import org.apache.commons.transaction.util.FileHelper;
+import org.apache.commons.io.FileUtils;
 import org.apache.openmeetings.util.OmFileHelper;
 
 public class CleanupUnit implements Serializable {
@@ -45,7 +45,7 @@ public class CleanupUnit implements Seri
        
        public void cleanup() throws IOException {
                for (File f : getParent().listFiles()) {
-                       FileHelper.removeRec(f);
+                       FileUtils.deleteQuietly(f);
                }
        }
        

Modified: openmeetings/application/trunk/openmeetings-util/pom.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-util/pom.xml?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-util/pom.xml (original)
+++ openmeetings/application/trunk/openmeetings-util/pom.xml Fri Oct 14 
13:19:59 2016
@@ -68,10 +68,6 @@
                        <artifactId>red5-server</artifactId>
                </dependency>
                <dependency>
-                       <groupId>commons-transaction</groupId>
-                       <artifactId>commons-transaction</artifactId>
-               </dependency>
-               <dependency>
                        <groupId>dom4j</groupId>
                        <artifactId>dom4j</artifactId>
                        <version>${dom4j.version}</version>
@@ -81,6 +77,10 @@
                        <artifactId>ical4j</artifactId>
                </dependency>
                <dependency>
+                       <groupId>org.apache.commons</groupId>
+                       <artifactId>commons-lang3</artifactId>
+               </dependency>
+               <dependency>
                        <groupId>commons-codec</groupId>
                        <artifactId>commons-codec</artifactId>
                        <version>${commons-codec.version}</version>

Modified: 
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
 Fri Oct 14 13:19:59 2016
@@ -18,23 +18,13 @@
  */
 package org.apache.openmeetings.util;
 
-import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
-
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.text.DecimalFormat;
 
-import org.apache.commons.transaction.util.FileHelper;
 import org.apache.openmeetings.util.ConnectionProperties.DbType;
-import org.red5.logging.Red5LoggerFactory;
-import org.slf4j.Logger;
 
 public class OmFileHelper {
-       private static final Logger log = 
Red5LoggerFactory.getLogger(OmFileHelper.class, webAppRootKey);
-
        /**
         * This variable needs to point to the openmeetings webapp directory
         */
@@ -43,22 +33,20 @@ public class OmFileHelper {
        private static final String PUBLIC_DIR = "public";
        private static final String CLIPARTS_DIR = "cliparts";
        private static final String WEB_INF_DIR = "WEB-INF";
-       private static final String PROFILES_DIR = "profiles";
        private static final String GROUP_LOGO_DIR = "grouplogo";
        private static final String STREAMS_DIR = "streams";
        private static final String EMOTIONS_DIR = "emoticons";
        private static final String LANGUAGES_DIR = "languages";
-       private static final String IMPORT_DIR = "import";
        private static final String HIBERNATE_DIR = "hibernate";
        private static final String CONF_DIR = "conf";
-       private static final String BACKUP_DIR = "backup";
        private static final String IMAGES_DIR = "images";
        private static final String WML_DIR = "stored";
-
        private static final String INSTALL_FILE = "install.xml";
 
+       public static final String BACKUP_DIR = "backup";
+       public static final String IMPORT_DIR = "import";
+       public static final String PROFILES_DIR = "profiles";
        public static final String SCREENSHARING_DIR = "screensharing";
-       
        public static final String FILES_DIR = "files";
        public static final String PERSISTENCE_NAME = 
"classes/META-INF/persistence.xml";
        public static final String DB_PERSISTENCE_NAME = 
"classes/META-INF/%s_persistence.xml";
@@ -85,6 +73,7 @@ public class OmFileHelper {
        public static final String MP4_MIME_TYPE = "video/" + EXTENSION_MP4;
        public static final String JPG_MIME_TYPE = "image/jpeg";
        public static final String PNG_MIME_TYPE = "image/png";
+       public static final String BCKP_ROOM_FILES = "roomFiles";
 
        public static void setOmHome(File omHome) {
                OmFileHelper.OM_HOME = omHome;
@@ -304,33 +293,17 @@ public class OmFileHelper {
                if (dir.isFile()) {
                        size = dir.length();
                } else {
-                       File[] subFiles = dir.listFiles();
-
-                       for (File file : subFiles) {
+                       for (File file : dir.listFiles()) {
                                if (file.isFile()) {
                                        size += file.length();
                                } else {
                                        size += getSize(file);
                                }
-
                        }
                }
                return size;
        }
 
-       public static void copyFile(String sourceFile, String targetFile) 
throws IOException {
-               FileHelper.copy(new File(sourceFile), new File(targetFile));
-       }
-
-       public static void copyFile(File f1, OutputStream out) throws 
IOException {
-               try (InputStream in = new FileInputStream(f1)) {
-                       FileHelper.copy(in, out);
-                       log.debug("File copied.");
-               } catch (Exception e) {
-                       log.error("[copyfile(File, File)]", e);
-               }
-       }
-
        public static String getFileName(String name) {
                int dotidx = name.lastIndexOf('.');
                return dotidx < 0 ? "" : name.substring(0, dotidx);

Modified: openmeetings/application/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/pom.xml?rev=1764888&r1=1764887&r2=1764888&view=diff
==============================================================================
--- openmeetings/application/trunk/pom.xml (original)
+++ openmeetings/application/trunk/pom.xml Fri Oct 14 13:19:59 2016
@@ -48,7 +48,6 @@
                <spring.version>4.3.3.RELEASE</spring.version>
                <mina.version>2.0.15</mina.version>
                <tomcat.version>8.5.6</tomcat.version>
-               <commons-transaction.version>1.2</commons-transaction.version>
                <ical4j.version>2.0-beta1</ical4j.version>
                <cxf.version>3.1.7</cxf.version>
                <selenium.version>2.53.1</selenium.version>
@@ -520,17 +519,6 @@
                                <exclusions>
                                        <exclusion>
                                                
<groupId>commons-logging</groupId>
-                                               
<artifactId>commons-logging</artifactId>
-                                       </exclusion>
-                               </exclusions>
-                       </dependency>
-                       <dependency>
-                               <groupId>commons-transaction</groupId>
-                               <artifactId>commons-transaction</artifactId>
-                               
<version>${commons-transaction.version}</version>
-                               <exclusions>
-                                       <exclusion>
-                                               
<groupId>commons-logging</groupId>
                                                
<artifactId>commons-logging</artifactId>
                                        </exclusion>
                                </exclusions>


Reply via email to