You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/04/17 16:36:11 UTC
svn commit: r529625 -
/lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java
Author: andreas
Date: Tue Apr 17 07:36:11 2007
New Revision: 529625
URL: http://svn.apache.org/viewvc?view=rev&rev=529625
Log:
[minor change] removed dead code, code formatting
Modified:
lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java
Modified: lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java?view=diff&rev=529625&r1=529624&r2=529625
==============================================================================
--- lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java (original)
+++ lenya/trunk/src/modules/opendocument/java/src/org/apache/lenya/cms/site/usecases/UploadOpenDocument.java Tue Apr 17 07:36:11 2007
@@ -23,10 +23,7 @@
import java.io.OutputStream;
import org.apache.cocoon.servlet.multipart.Part;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.lenya.cms.cocoon.source.RepositorySource;
import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.repository.Node;
import org.apache.lenya.cms.usecase.DocumentUsecase;
/**
@@ -61,26 +58,22 @@
if (file.isRejected()) {
String[] params = { Integer.toString(file.getSize()) };
addErrorMessage("upload-size-exceeded", params);
- } else if (ODT_MIME_TYPE.equals(mimeType)){
+ } else if (ODT_MIME_TYPE.equals(mimeType)) {
saveResource(source.getOutputStream(), file);
} else {
- addErrorMessage("The mime type of the document you want to upload does not match the mime type: \""+ODT_MIME_TYPE+"\"");
+ addErrorMessage("The mime type of the document you want to upload does not match the mime type: \""
+ + ODT_MIME_TYPE + "\"");
}
-
}
/**
* Saves the resource to a file.
*
- * @param out
- * The destination to write the file.
- * @param part
- * The part of the multipart request.
- * @throws IOException
- * if an error occurs.
+ * @param out The destination to write the file.
+ * @param part The part of the multipart request.
+ * @throws IOException if an error occurs.
*/
- protected void saveResource(OutputStream out, Part part)
- throws IOException {
+ protected void saveResource(OutputStream out, Part part) throws IOException {
InputStream in = null;
try {
@@ -110,32 +103,6 @@
out.close();
}
}
- }
-
- /**
- * @return The repository node that represents the document identified by the destination string.
- */
- public Node getRepositoryNode(String destination) {
- Node node = null;
- SourceResolver resolver = null;
- RepositorySource documentSource = null;
- try {
- resolver = (SourceResolver) this.manager
- .lookup(SourceResolver.ROLE);
- documentSource = (RepositorySource) resolver
- .resolveURI(destination);
- node = documentSource.getNode();
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- if (resolver != null) {
- if (documentSource != null) {
- resolver.release(documentSource);
- }
- this.manager.release(resolver);
- }
- }
- return node;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org