use of ch.cyberduck.core.UrlProvider in project cyberduck by iterate-ch.
the class OpenURLMenuDelegate method getURLs.
@Override
protected List<DescriptiveUrl> getURLs(final Path selected) {
final ArrayList<DescriptiveUrl> list = new ArrayList<DescriptiveUrl>();
final SessionPool pool = this.getSession();
final UrlProvider provider = pool.getFeature(UrlProvider.class);
if (provider != null) {
list.addAll(provider.toUrl(selected).filter(DescriptiveUrl.Type.http, DescriptiveUrl.Type.cname, DescriptiveUrl.Type.cdn, DescriptiveUrl.Type.signed, DescriptiveUrl.Type.authenticated));
}
return list;
}
use of ch.cyberduck.core.UrlProvider in project cyberduck by iterate-ch.
the class CopyURLMenuDelegate method getURLs.
@Override
protected List<DescriptiveUrl> getURLs(final Path selected) {
final ArrayList<DescriptiveUrl> list = new ArrayList<DescriptiveUrl>();
final SessionPool pool = this.getSession();
final UrlProvider provider = pool.getFeature(UrlProvider.class);
if (provider != null) {
list.addAll(provider.toUrl(selected));
}
return list;
}
use of ch.cyberduck.core.UrlProvider in project cyberduck by iterate-ch.
the class SwiftUrlProviderTest method testSigned.
@Test
public void testSigned() throws Exception {
final Map<Region, AccountInfo> accounts = new SwiftAccountLoader(session).operate(new DisabledPasswordCallback(), new Path(String.valueOf(Path.DELIMITER), EnumSet.of(Path.Type.volume, Path.Type.directory)));
final UrlProvider provider = new SwiftUrlProvider(session, accounts);
final Path container = new Path("test.cyberduck.ch", EnumSet.of(Path.Type.directory, Path.Type.volume));
container.attributes().setRegion("IAD");
final Path file = new Path(container, UUID.randomUUID().toString(), EnumSet.of(Path.Type.file));
container.attributes().setRegion("IAD");
new SwiftTouchFeature(session, new SwiftRegionService(session)).touch(file, new TransferStatus());
final DescriptiveUrlBag list = provider.toUrl(file);
final DescriptiveUrl signed = list.find(DescriptiveUrl.Type.signed);
assertNotNull(signed);
assertNotEquals(DescriptiveUrl.EMPTY, signed);
assertFalse(list.filter(DescriptiveUrl.Type.signed).isEmpty());
for (DescriptiveUrl s : list.filter(DescriptiveUrl.Type.signed)) {
assertNotNull(s);
assertNotEquals(DescriptiveUrl.EMPTY, s);
}
new SwiftDeleteFeature(session).delete(Collections.singletonList(file), new DisabledLoginCallback(), new Delete.DisabledCallback());
}
Aggregations