Search in sources :

Example 1 with UrlProvider

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;
}
Also used : UrlProvider(ch.cyberduck.core.UrlProvider) SessionPool(ch.cyberduck.core.pool.SessionPool) DescriptiveUrl(ch.cyberduck.core.DescriptiveUrl) ArrayList(java.util.ArrayList)

Example 2 with UrlProvider

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;
}
Also used : UrlProvider(ch.cyberduck.core.UrlProvider) SessionPool(ch.cyberduck.core.pool.SessionPool) DescriptiveUrl(ch.cyberduck.core.DescriptiveUrl) ArrayList(java.util.ArrayList)

Example 3 with UrlProvider

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());
}
Also used : Path(ch.cyberduck.core.Path) UrlProvider(ch.cyberduck.core.UrlProvider) Delete(ch.cyberduck.core.features.Delete) DescriptiveUrlBag(ch.cyberduck.core.DescriptiveUrlBag) DescriptiveUrl(ch.cyberduck.core.DescriptiveUrl) DisabledLoginCallback(ch.cyberduck.core.DisabledLoginCallback) TransferStatus(ch.cyberduck.core.transfer.TransferStatus) Region(ch.iterate.openstack.swift.model.Region) DisabledPasswordCallback(ch.cyberduck.core.DisabledPasswordCallback) AccountInfo(ch.iterate.openstack.swift.model.AccountInfo) Test(org.junit.Test) IntegrationTest(ch.cyberduck.test.IntegrationTest)

Aggregations

DescriptiveUrl (ch.cyberduck.core.DescriptiveUrl)3 UrlProvider (ch.cyberduck.core.UrlProvider)3 SessionPool (ch.cyberduck.core.pool.SessionPool)2 ArrayList (java.util.ArrayList)2 DescriptiveUrlBag (ch.cyberduck.core.DescriptiveUrlBag)1 DisabledLoginCallback (ch.cyberduck.core.DisabledLoginCallback)1 DisabledPasswordCallback (ch.cyberduck.core.DisabledPasswordCallback)1 Path (ch.cyberduck.core.Path)1 Delete (ch.cyberduck.core.features.Delete)1 TransferStatus (ch.cyberduck.core.transfer.TransferStatus)1 IntegrationTest (ch.cyberduck.test.IntegrationTest)1 AccountInfo (ch.iterate.openstack.swift.model.AccountInfo)1 Region (ch.iterate.openstack.swift.model.Region)1 Test (org.junit.Test)1