Author: seba.wagner
Date: Tue Jan 6 07:44:39 2009
New Revision: 1754
Modified:
trunk/webapp/filetest.keystore
trunk/webapp/src/app/org/openmeetings/app/documents/GeneratePDF.java
trunk/webapp/src/app/org/openmeetings/app/documents/GenerateThumbs.java
trunk/webapp/src/app/sample_hibernate.cfg.xml
trunk/webapp/webapp/openmeetings/conf/mysql_hibernate.cfg.xml
Log:
Fixes:
Changes to MyISAM in Default MySQL storage engine because of better
Performance
Modified: trunk/webapp/filetest.keystore
==============================================================================
Binary files. No diff available.
Modified:
trunk/webapp/src/app/org/openmeetings/app/documents/GeneratePDF.java
==============================================================================
--- trunk/webapp/src/app/org/openmeetings/app/documents/GeneratePDF.java
(original)
+++ trunk/webapp/src/app/org/openmeetings/app/documents/GeneratePDF.java
Tue Jan 6 07:44:39 2009
@@ -75,13 +75,17 @@
if (fullProcessing) {
HashMap<String,Object> processOpenOffice =
this.doConvertExec(current_dir, fileFullPath, destinationFolder,fileName);
returnError.put("processOpenOffice", processOpenOffice);
- HashMap<String,Object> processThumb =
GenerateThumbs.getInstance().generateBatchThumb(current_dir,
destinationFolder + fileName + ".pdf", destinationFolder, 80);
+ HashMap<String,Object> processThumb =
GenerateThumbs.getInstance().generateBatchThumb(current_dir,
destinationFolder + fileName + ".pdf", destinationFolder, 80, "thumb");
returnError.put("processThumb", processThumb);
+ HashMap<String,Object> processBig =
GenerateThumbs.getInstance().generateImageBatchByWidth(current_dir,
destinationFolder + fileName + ".pdf", destinationFolder, 660, "big");
+ returnError.put("processBig", processBig);
HashMap<String,Object> processSWF =
GenerateSWF.getInstance().generateSWF(current_dir, destinationFolder,
destinationFolder, fileName);
returnError.put("processSWF", processSWF);
} else {
- HashMap<String,Object> processThumb =
GenerateThumbs.getInstance().generateBatchThumb(current_dir, fileFullPath,
destinationFolder, 80);
+ HashMap<String,Object> processThumb =
GenerateThumbs.getInstance().generateBatchThumb(current_dir, fileFullPath,
destinationFolder, 80, "thumb");
returnError.put("processThumb", processThumb);
+ HashMap<String,Object> processBig =
GenerateThumbs.getInstance().generateImageBatchByWidth(current_dir,
fileFullPath, destinationFolder, 660, "big");
+ returnError.put("processBig", processBig);
HashMap<String,Object> processSWF =
GenerateSWF.getInstance().generateSWF(current_dir, (new
File(fileFullPath)).getParentFile().getAbsolutePath()+File.separatorChar ,
destinationFolder, fileName);
returnError.put("processSWF", processSWF);
}
Modified:
trunk/webapp/src/app/org/openmeetings/app/documents/GenerateThumbs.java
==============================================================================
--- trunk/webapp/src/app/org/openmeetings/app/documents/GenerateThumbs.java
(original)
+++ trunk/webapp/src/app/org/openmeetings/app/documents/GenerateThumbs.java
Tue Jan 6 07:44:39 2009
@@ -111,7 +111,7 @@
}
public HashMap<String,Object> generateBatchThumb(String current_dir,
String inputfile,
- String outputpath, Integer thumbSize) {
+ String outputpath, Integer thumbSize, String pre) {
HashMap<String,Object> returnMap = new HashMap<String,Object>();
returnMap.put("process", "generateBatchThumb");
try {
@@ -148,7 +148,88 @@
//Create the Content of the Converter Script (.bat or
.sh File)
String fileContent = pathToIMagick + "convert
-thumbnail " + thumbSize +
" " + "\"" + inputfile +"\"" +
- " " + "\"" + outputpath+
"_thumb_page.jpg\"" +
+ " " + "\"" + outputpath+ "_"+ pre
+"_page.jpg\"" +
+ Application.lineSeperator + "exit";
+
+ //execute the Script
+ FileOutputStream fos = new
FileOutputStream(executable_fileName);
+ fos.write(fileContent.getBytes());
+ fos.close();
+
+ //make new shell script executable
+ //in JAVA6 this can be done directly through the api
+ if
(System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") ==
-1) {
+
MakeExectuable.getInstance().setExecutable(executable_fileName);
+ }
+
+
+ Runtime rt = Runtime.getRuntime();
+
+ for (int i=0;i<cmd.length;i++){
+ log.debug("cmd: "+cmd[i]);
+ }
+
+ returnMap.put("command", cmd.toString());
+ Process proc = rt.exec(cmd);
+
+ InputStream stderr = proc.getErrorStream();
+ InputStreamReader isr = new InputStreamReader(stderr);
+ BufferedReader br = new BufferedReader(isr);
+ String line = null;
+ String error = "";
+ while ((line = br.readLine()) != null)
+ error += line;
+ 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;
+ }
+ }
+
+ public HashMap<String,Object> generateImageBatchByWidth(String
current_dir, String inputfile,
+ String outputpath, Integer thumbWidth, String pre) {
+ HashMap<String,Object> returnMap = new HashMap<String,Object>();
+ returnMap.put("process", "generateBatchThumb");
+ try {
+
+ String[] cmd;
+ String executable_fileName = "";
+ String pathToIMagick =
Configurationmanagement.getInstance().getConfKey(3,"imagemagick_path").getConf_value();
+ if(!pathToIMagick.equals("")
&& !pathToIMagick.endsWith(File.separator)){
+ pathToIMagick = pathToIMagick + File.separator;
+ }
+
+ //If no Windows Platform
+ if
(System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") ==
-1) {
+ String runtimeFile = "thumbnail.sh";
+ executable_fileName =
Application.batchFileFir+"BATCHTHUMB_"
+ +
CalendarPatterns.getTimeForStreamId(new Date()) +"_"+ runtimeFile;
+
+ cmd = new String[1];
+ cmd[0] = executable_fileName;
+ } else {
+ String runtimeFile = "thumbnail.bat";
+ executable_fileName =
Application.batchFileFir+"BATCHTHUMB_"
+ +
CalendarPatterns.getTimeForStreamId(new Date()) +"_"+ 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 = pathToIMagick + "convert -resize "
+ thumbWidth +
+ " " + "\"" + inputfile +"\"" +
+ " " + "\"" + outputpath+ "_"+ pre
+"_page.png\"" +
Application.lineSeperator + "exit";
//execute the Script
Modified: trunk/webapp/src/app/sample_hibernate.cfg.xml
==============================================================================
--- trunk/webapp/src/app/sample_hibernate.cfg.xml (original)
+++ trunk/webapp/src/app/sample_hibernate.cfg.xml Tue Jan 6 07:44:39 2009
@@ -9,7 +9,7 @@
<!-- Database Settings -->
<property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
- <property
name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
+ <property
name="dialect">org.hibernate.dialect.MySQLMyISAMDialect</property>
<property
name="connection.url">jdbc:mysql://localhost/openmeetings_cal?useUnicode=true&createDatabaseIfNotExist=true&characterEncoding=utf-8</property>
<property name="hibernate.connection.CharSet">utf8</property>
Modified: trunk/webapp/webapp/openmeetings/conf/mysql_hibernate.cfg.xml
==============================================================================
--- trunk/webapp/webapp/openmeetings/conf/mysql_hibernate.cfg.xml
(original)
+++ trunk/webapp/webapp/openmeetings/conf/mysql_hibernate.cfg.xml Tue Jan
6 07:44:39 2009
@@ -14,7 +14,8 @@
<!-- Database Settings -->
<property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
- <property
name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
+ <!-- for performance reasons changed to MyISAM from
org.hibernate.dialect.MySQLInnoDBDialect -->
+ <property
name="dialect">org.hibernate.dialect.MySQLMyISAMDialect</property>
<property
name="connection.url">jdbc:mysql://localhost/openmeetings?useUnicode=true&createDatabaseIfNotExist=true&characterEncoding=utf-8</property>
<property name="hibernate.connection.CharSet">utf8</property>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"OpenMeetings developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/openmeetings-dev?hl=en
-~----------~----~----~----~------~----~------~--~---