|
From: <ha...@us...> - 2007-10-01 19:15:50
|
Revision: 1769
http://cogkit.svn.sourceforge.net/cogkit/?rev=1769&view=rev
Author: hategan
Date: 2007-10-01 12:15:49 -0700 (Mon, 01 Oct 2007)
Log Message:
-----------
added file info
Modified Paths:
--------------
trunk/current/src/cog/modules/provider-webdav/src/org/globus/cog/abstraction/impl/file/http/FileResourceImpl.java
trunk/current/src/cog/modules/provider-webdav/src/org/globus/cog/abstraction/impl/file/webdav/FileResourceImpl.java
Modified: trunk/current/src/cog/modules/provider-webdav/src/org/globus/cog/abstraction/impl/file/http/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-webdav/src/org/globus/cog/abstraction/impl/file/http/FileResourceImpl.java 2007-10-01 19:14:56 UTC (rev 1768)
+++ trunk/current/src/cog/modules/provider-webdav/src/org/globus/cog/abstraction/impl/file/http/FileResourceImpl.java 2007-10-01 19:15:49 UTC (rev 1769)
@@ -24,6 +24,7 @@
import org.globus.cog.abstraction.impl.common.task.TaskSubmissionException;
import org.globus.cog.abstraction.impl.file.AbstractFileResource;
import org.globus.cog.abstraction.impl.file.FileResourceException;
+import org.globus.cog.abstraction.impl.file.GridFileImpl;
import org.globus.cog.abstraction.impl.file.IllegalHostException;
import org.globus.cog.abstraction.interfaces.ExecutableObject;
import org.globus.cog.abstraction.interfaces.FileResource;
@@ -177,8 +178,32 @@
}
public GridFile getGridFile(String fileName) throws FileResourceException {
- throw new UnsupportedOperationException("getGridFile");
- // return createGridFile(fileName);
+ HeadMethod m = new HeadMethod(contact + '/' + fileName);
+ try {
+ int code = client.executeMethod(m);
+ try {
+ if (code != HttpStatus.SC_OK) {
+ throw new FileResourceException("Failed to get file information about "
+ + fileName + " from " + contact
+ + ". Server returned " + code + " ("
+ + HttpStatus.getStatusText(code) + ").");
+ }
+ GridFile gf = new GridFileImpl();
+ gf.setName(fileName);
+ Header clh = m.getResponseHeader("Content-Length");
+ gf.setSize(Long.parseLong(clh.getValue()));
+ return gf;
+ }
+ finally {
+ m.releaseConnection();
+ }
+ }
+ catch (FileResourceException e) {
+ throw e;
+ }
+ catch (Exception e) {
+ throw new FileResourceException(e);
+ }
}
public boolean exists(String filename) throws FileResourceException {
Modified: trunk/current/src/cog/modules/provider-webdav/src/org/globus/cog/abstraction/impl/file/webdav/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-webdav/src/org/globus/cog/abstraction/impl/file/webdav/FileResourceImpl.java 2007-10-01 19:14:56 UTC (rev 1768)
+++ trunk/current/src/cog/modules/provider-webdav/src/org/globus/cog/abstraction/impl/file/webdav/FileResourceImpl.java 2007-10-01 19:15:49 UTC (rev 1769)
@@ -69,9 +69,11 @@
HttpURL hrl = new HttpURL(contact);
PasswordAuthentication credentials = (PasswordAuthentication) getSecurityContext()
.getCredentials();
+
String username = credentials.getUserName();
String password = String.valueOf(credentials.getPassword());
hrl.setUserinfo(username, password);
+
davClient = new WebdavResource(hrl);
setStarted(true);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|