Author: nzamosenchuk
Date: 2011-08-23 04:16:31 -0400 (Tue, 23 Aug 2011)
New Revision: 4789
Modified:
jcr/trunk/exo.jcr.component.core/pom.xml
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
jcr/trunk/exo.jcr.framework.command/pom.xml
jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/web/fckeditor/UploadFileCommand.java
Log:
EXOJCR-1470 : getting rid of commons-io
Modified: jcr/trunk/exo.jcr.component.core/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-22 14:38:50 UTC (rev 4788)
+++ jcr/trunk/exo.jcr.component.core/pom.xml 2011-08-23 08:16:31 UTC (rev 4789)
@@ -168,10 +168,6 @@
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
<groupId>org.jgroups</groupId>
<artifactId>jgroups</artifactId>
<version>2.6.20.Final</version>
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java 2011-08-22
14:38:50 UTC (rev 4788)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/infinispan/ISPNCacheFactory.java 2011-08-23
08:16:31 UTC (rev 4789)
@@ -18,7 +18,6 @@
*/
package org.exoplatform.services.jcr.infinispan;
-import org.apache.commons.io.IOUtils;
import org.exoplatform.commons.utils.SecurityHelper;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
@@ -37,6 +36,8 @@
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
import java.net.URL;
import java.security.PrivilegedAction;
import java.security.PrivilegedExceptionAction;
@@ -62,6 +63,7 @@
public static final String INFINISPAN_CONFIG = "infinispan-configuration";
private final ConfigurationManager configurationManager;
+
private final TemplateConfigurationHelper configurationHelper;
private static final Log log =
ExoLogger.getLogger("exo.jcr.component.core.InfinispanCacheFactory");
@@ -78,9 +80,9 @@
public MBeanServer getMBeanServer(Properties properties)
{
return ExoContainerContext.getTopContainer().getMBeanServer();
- }
+ }
};
-
+
/**
* Creates InfinispanCacheFactory with provided configuration transaction managers.
* Transaction manager will later be injected to cache instance.
@@ -189,7 +191,19 @@
try
{
log.info("Custom JGroups configuration set: " +
jgroupsConfigURL);
- p.setProperty("configurationXml",
IOUtils.toString(jgroupsConfigInputStream));
+
+ // Read stream content into StringWriter
+ StringWriter sw = new StringWriter();
+ InputStreamReader in = new InputStreamReader(jgroupsConfigInputStream);
+
+ char[] buffer = new char[1024];
+ int n = 0;
+ while (-1 != (n = in.read(buffer)))
+ {
+ sw.write(buffer, 0, n);
+ }
+
+ p.setProperty("configurationXml", sw.toString());
p.remove("configurationFile");
}
finally
@@ -217,8 +231,8 @@
// Ensure that the cluster name won't be used between 2 ExoContainers
gc.fluent().transport().clusterName(gc.getClusterName() + "_" +
container.getContext().getName())
.globalJmxStatistics().cacheManagerName(gc.getCacheManagerName() + "_"
+ container.getContext().getName()).
- // Configure the MBeanServerLookup
- mBeanServerLookup(MBEAN_SERVER_LOOKUP);
+ // Configure the MBeanServerLookup
+ mBeanServerLookup(MBEAN_SERVER_LOOKUP);
Configuration conf = manager.getDefaultConfiguration();
if (CACHE_MANAGERS.containsKey(gc))
{
Modified: jcr/trunk/exo.jcr.framework.command/pom.xml
===================================================================
--- jcr/trunk/exo.jcr.framework.command/pom.xml 2011-08-22 14:38:50 UTC (rev 4788)
+++ jcr/trunk/exo.jcr.framework.command/pom.xml 2011-08-23 08:16:31 UTC (rev 4789)
@@ -52,10 +52,6 @@
<artifactId>commons-fileupload</artifactId>
</dependency>
<dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
Modified:
jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/web/fckeditor/UploadFileCommand.java
===================================================================
---
jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/web/fckeditor/UploadFileCommand.java 2011-08-22
14:38:50 UTC (rev 4788)
+++
jcr/trunk/exo.jcr.framework.command/src/main/java/org/exoplatform/frameworks/jcr/command/web/fckeditor/UploadFileCommand.java 2011-08-23
08:16:31 UTC (rev 4789)
@@ -25,12 +25,10 @@
import org.exoplatform.frameworks.jcr.command.JCRCommandHelper;
import org.exoplatform.frameworks.jcr.command.web.GenericWebAppContext;
-import java.io.File;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import javax.jcr.Node;
@@ -60,7 +58,9 @@
String type = (String)context.get("Type");
if (type == null)
+ {
type = "";
+ }
// // To limit browsing set Servlet init param "digitalAssetsPath"
// // with desired JCR path
@@ -88,7 +88,9 @@
String workspace = (String)webCtx.get(AppConstants.DIGITAL_ASSETS_PROP);
if (workspace == null)
+ {
workspace = AppConstants.DEFAULT_DIGITAL_ASSETS_WS;
+ }
String currentFolderStr = getCurrentFolderPath(webCtx);
@@ -106,14 +108,25 @@
{
FileItem item = (FileItem)iter.next();
if (item.isFormField())
+ {
fields.put(item.getFieldName(), item.getString());
+ }
else
+ {
fields.put(item.getFieldName(), item);
+ }
}
FileItem uplFile = (FileItem)fields.get("NewFile");
// On IE, the file name is specified as an absolute path.
- String fileName = org.apache.commons.io.FilenameUtils.getName(uplFile.getName());
+ String fileName = uplFile.getName();
+ if (fileName != null)
+ {
+ int lastUnixPos = fileName.lastIndexOf("/");
+ int lastWindowsPos = fileName.lastIndexOf("\\");
+ int index = Math.max(lastUnixPos, lastWindowsPos);
+ fileName = fileName.substring(index + 1);
+ }
Node file =
JCRCommandHelper
Show replies by date