use of org.eclipse.ecf.filetransfer.IRemoteFileInfo in project ecf by eclipse.
the class AbstractBrowseTestCase method verifyRemoteFiles.
/**
* @param remoteFiles
*/
protected void verifyRemoteFiles(final IRemoteFile[] remoteFiles) {
for (int i = 0; i < remoteFiles.length; i++) {
final IRemoteFile first = remoteFiles[i];
final IRemoteFileInfo firstInfo = first.getInfo();
assertNotNull(firstInfo);
final IFileID firstID = first.getID();
assertNotNull(firstID);
trace("firstID=" + firstID);
// Now check out info
assertNotNull(firstInfo.getName());
assertTrue(firstInfo.getLastModified() > 0);
trace("lastModified=" + new SimpleDateFormat().format(new Date(firstInfo.getLastModified())));
trace("length=" + firstInfo.getLength());
trace("isDirectory=" + firstInfo.isDirectory());
final IRemoteFileAttributes attributes = firstInfo.getAttributes();
assertNotNull(attributes);
final Iterator attrNames = attributes.getAttributeKeys();
for (; attrNames.hasNext(); ) {
final String key = (String) attrNames.next();
String s = "attrname=" + key;
s += " attrvalue=" + attributes.getAttribute(key);
trace(s);
}
}
}
use of org.eclipse.ecf.filetransfer.IRemoteFileInfo in project ecf by eclipse.
the class URLRemoteFile method getInfo.
/* (non-Javadoc)
* @see org.eclipse.ecf.filetransfer.IRemoteFile#getInfo()
*/
public IRemoteFileInfo getInfo() {
return new IRemoteFileInfo() {
public IRemoteFileAttributes getAttributes() {
return remoteFileAttributes;
}
public long getLastModified() {
return lastModified;
}
public long getLength() {
return fileLength;
}
public String getName() {
URL url;
String result = null;
try {
url = fileID.getURL();
String path = url.getPath();
// $NON-NLS-1$
int index = path.lastIndexOf("/");
if (index == -1)
return path;
result = path.substring(index + 1);
return result;
} catch (MalformedURLException e) {
return fileID.getName();
}
}
public boolean isDirectory() {
try {
// $NON-NLS-1$
return fileID.getURL().toString().endsWith("/");
} catch (MalformedURLException e) {
return false;
}
}
public void setAttributes(IRemoteFileAttributes attributes) {
// Not supported
}
public void setLastModified(long time) {
// not supported
}
public void setName(String name) {
// not supported
}
};
}
use of org.eclipse.ecf.filetransfer.IRemoteFileInfo in project ecf by eclipse.
the class URLBrowseTest method verifyRemoteFilesWithoutLastModifiedAndContentLength.
protected void verifyRemoteFilesWithoutLastModifiedAndContentLength(final IRemoteFile[] remoteFiles) {
for (int i = 0; i < remoteFiles.length; i++) {
final IRemoteFile first = remoteFiles[i];
final IRemoteFileInfo firstInfo = first.getInfo();
assertNotNull(firstInfo);
final IFileID firstID = first.getID();
assertNotNull(firstID);
trace("firstID=" + firstID);
// Now check out info
assertNotNull(firstInfo.getName());
// TODO: should this be -1
assertEquals(0, firstInfo.getLastModified());
trace("length=" + firstInfo.getLength());
trace("isDirectory=" + firstInfo.isDirectory());
final IRemoteFileAttributes attributes = firstInfo.getAttributes();
assertNotNull(attributes);
final Iterator attrNames = attributes.getAttributeKeys();
for (; attrNames.hasNext(); ) {
final String key = (String) attrNames.next();
String s = "attrname=" + key;
s += " attrvalue=" + attributes.getAttribute(key);
trace(s);
}
}
}
Aggregations