Author: amarkhel
Date: 2009-03-27 08:13:55 -0400 (Fri, 27 Mar 2009)
New Revision: 13252
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
Log:
Modified:
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java
===================================================================
---
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-03-27
11:54:51 UTC (rev 13251)
+++
trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/FileManager.java 2009-03-27
12:13:55 UTC (rev 13252)
@@ -59,7 +59,6 @@
private static final String _SMALL80 = "_small80";
private static final String _SMALL200 = "_small200";
private static final String _MEDIUM = "_medium";
- private static final String _MINI = "_mini";
private static final String UPLOAD_ROOT_COMPONENT_NAME = "uploadRoot";
private static final String UPLOAD_ROOT_PATH_COMPONENT_NAME =
"uploadRootPath";
@@ -69,12 +68,7 @@
private File uploadRoot;
private String uploadRootPath;
- //TODO nick - i suggest to hide this from external services at all
- public File getUploadRoot() {
- return uploadRoot;
- }
-
- @Create
+ /* @Create
public void create() {
uploadRoot = (File) Component.getInstance(UPLOAD_ROOT_COMPONENT_NAME,
ScopeType.APPLICATION);
if (!uploadRoot.exists() && !uploadRoot.mkdir()) {
@@ -93,7 +87,30 @@
}
extract(jarFile);
- }
+ }*/
+
+ @Create
+ public void create() {
+ uploadRoot = (File)Component.getInstance(UPLOAD_ROOT_COMPONENT_NAME,
ScopeType.APPLICATION);
+ uploadRootPath = (String)Component.getInstance(UPLOAD_ROOT_PATH_COMPONENT_NAME,
ScopeType.APPLICATION);
+ }
+
+ public void setUploadRoot(String uploadRootPath) throws IOException {
+ if (uploadRootPath != null) {
+ this.uploadRoot = new File(uploadRootPath);
+ for (String f : uploadRoot.list()) {
+ File temp = new File(uploadRoot, f);
+ temp.delete();
+ }
+ uploadRoot.delete();
+ uploadRoot.mkdirs();
+ this.uploadRootPath = this.uploadRoot.getCanonicalPath()
+ + File.separator;
+ } else {
+ this.uploadRoot = null;
+ this.uploadRootPath = null;
+ }
+ }
private String joinFiles(String... files) {
final StringBuilder res = new StringBuilder();
@@ -151,7 +168,7 @@
}
}
- public void setUploadRoot(String uploadRootPath) throws IOException {
+/* public void setUploadRoot(String uploadRootPath) throws IOException {
if (uploadRootPath != null) {
this.uploadRoot = new File(uploadRootPath);
for (String f : uploadRoot.list()) {
@@ -165,7 +182,7 @@
this.uploadRoot = null;
this.uploadRootPath = null;
}
- }
+ }*/
private File getFileByPath(String path) {
Show replies by date