[prev in list] [next in list] [prev in thread] [next in thread]
List: slide-dev
Subject: cvs commit: jakarta-slide/src/stores/org/apache/slide/store/txfile AbstractTxFileStoreService.java
From: ozeigermann () apache ! org
Date: 2004-01-29 11:04:30
Message-ID: 20040129110430.47891.qmail () minotaur ! apache ! org
[Download RAW message or body]
ozeigermann 2004/01/29 03:04:30
Modified: src/stores/org/apache/slide/store/txfile/rm/impl Tag:
SLIDE_2_0_RELEASE_BRANCH FileResourceManager.java
src/doc Tag: SLIDE_2_0_RELEASE_BRANCH changelog.xml
src/stores/org/apache/slide/store/txfile Tag:
SLIDE_2_0_RELEASE_BRANCH
AbstractTxFileStoreService.java
Log:
Added flag to configure if tx file store shall use encoded file names or plain \
ones.
Revision Changes Path
No revision
No revision
1.5.2.1 +25 -4 \
jakarta-slide/src/stores/org/apache/slide/store/txfile/rm/impl/FileResourceManager.java
Index: FileResourceManager.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/txfile/rm/impl/FileResourceManager.java,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -u -r1.5 -r1.5.2.1
--- FileResourceManager.java 26 Nov 2003 11:13:59 -0000 1.5
+++ FileResourceManager.java 29 Jan 2004 11:04:30 -0000 1.5.2.1
@@ -74,6 +74,8 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -88,6 +90,7 @@
import org.apache.slide.util.locking.*;
import org.apache.slide.util.locking.impl.*;
import org.apache.slide.util.logger.StoreLogger;
+import org.apache.util.Base64;
/**
* A resource manager for streamable objects stored in a file system.
@@ -247,6 +250,7 @@
protected String workDir;
protected String storeDir;
+ protected boolean urlEncodePath = false;
protected boolean cleanUp = true;
protected boolean dirty = false;
protected int operationMode = OPERATION_MODE_STOPPED;
@@ -270,9 +274,10 @@
* @param storeDir directory where main data should go after commit
* @param workDir directory where transactions store temporary data
*/
- public FileResourceManager(String storeDir, String workDir, StoreLogger \
logger) { + public FileResourceManager(String storeDir, String workDir, boolean \
urlEncodePath, StoreLogger logger) { this.workDir = workDir;
this.storeDir = storeDir;
+ this.urlEncodePath = urlEncodePath;
this.logger = logger;
}
@@ -965,6 +970,22 @@
String path = "";
if (pathObject != null) {
path = pathObject.toString();
+ if (urlEncodePath) {
+ try {
+ // XXX not allowed as for JDK1.4
+ // path = URLEncoder.encode(path, "UTF-8");
+ // XXX weired replacement for the fine method above
+ // using this combination as a simple URLEncoder.encode \
without + // charset may fail depending on local settings
+ // for this reason the string will be encoded into base64 \
consisting + // of ascii characters only
+ // a further URL encoding is need as base64 might contain '/' \
which + // might be a problem for some file systems
+ path = new String(Base64.encode(path.getBytes("UTF-8")), \
"ASCII"); + path = URLEncoder.encode(path);
+ } catch (UnsupportedEncodingException e) {
+ }
+ }
if (path.length() > 0 && path.charAt(0) != '/' && path.charAt(0) != \
'\\') { path = "/" + path;
}
No revision
No revision
1.84.2.4 +1 -0 jakarta-slide/src/doc/changelog.xml
Index: changelog.xml
===================================================================
RCS file: /home/cvs/jakarta-slide/src/doc/changelog.xml,v
retrieving revision 1.84.2.3
retrieving revision 1.84.2.4
diff -u -r1.84.2.3 -r1.84.2.4
--- changelog.xml 26 Jan 2004 17:32:22 -0000 1.84.2.3
+++ changelog.xml 29 Jan 2004 11:04:30 -0000 1.84.2.4
@@ -15,6 +15,7 @@
release.
<changelog>
+ <add date="Januray 29, 2004 author="ozeigermann">Added flag to configure if \
tx file store shall use encoded names or plain ones. Plaines are the default.</add> \
<fix date="January 26, 2004" author="pnever"> Final fixes to get the DeltaV \
testcases error-free. </fix>
No revision
No revision
1.7.2.1 +11 -3 \
jakarta-slide/src/stores/org/apache/slide/store/txfile/AbstractTxFileStoreService.java
Index: AbstractTxFileStoreService.java
===================================================================
RCS file: /home/cvs/jakarta-slide/src/stores/org/apache/slide/store/txfile/AbstractTxFileStoreService.java,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -r1.7 -r1.7.2.1
--- AbstractTxFileStoreService.java 6 Jan 2004 14:56:02 -0000 1.7
+++ AbstractTxFileStoreService.java 29 Jan 2004 11:04:30 -0000 1.7.2.1
@@ -100,6 +100,7 @@
protected static final String STORE_DIR_PARAMETER = "rootpath";
protected static final String WORK_DIR_PARAMETER = "workpath";
protected static final String TIMEOUT_PARAMETER = "timeout";
+ protected static final String URLENCODE_PATH = "url-encode-path";
protected FileResourceManager rm;
protected boolean started = false;
@@ -125,10 +126,17 @@
new File(storeDir).mkdirs();
new File(workDir).mkdirs();
+ boolean urlEncodePath = false;
+ String urlEncodePathString = (String) parameters.get(URLENCODE_PATH);
+ if (urlEncodePathString != null) {
+ urlEncodePath = "true".equals(urlEncodePathString);
+ }
+
rm =
new FileResourceManager(
storeDir,
workDir,
+ urlEncodePath,
new StoreLogger(getLogger(), \
FileResourceManager.class.getName()));
getLogger().log(
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic