Java Code Examples for org.apache.hadoop.fs.swift.http.SwiftRestClient#getInstance()
The following examples show how to use
org.apache.hadoop.fs.swift.http.SwiftRestClient#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSwiftFileSystemDirectories.java From sahara-extra with Apache License 2.0 | 6 votes |
private String[] getRawObjectNames() throws Exception { SwiftRestClient client; client = SwiftRestClient.getInstance(fs.getUri(), fs.getConf()); SwiftObjectPath path = SwiftObjectPath.fromPath(fs.getUri(), new Path("/")); byte[] bytes = client.listDeepObjectsInDirectory(path, true, true); final CollectionType collectionType = JSONUtil.getJsonMapper(). getTypeFactory().constructCollectionType(List.class, SwiftObjectFileStatus.class); final List<SwiftObjectFileStatus> fileStatusList = JSONUtil.toObject(new String(bytes), collectionType); final ArrayList<String> objects = new ArrayList(); for (SwiftObjectFileStatus status : fileStatusList) { if (status.getName() != null) { objects.add(status.getName()); } else if (status.getSubdir() != null) { objects.add(status.getSubdir()); } } return objects.toArray(new String[objects.size()]); }
Example 2
Source File: SwiftNativeFileSystemStore.java From sahara-extra with Apache License 2.0 | 5 votes |
/** * Initialize the filesystem store -this creates the REST client binding. * * @param fsURI URI of the filesystem, which is used to map to the filesystem-specific * options in the configuration file * @param configuration configuration * @throws IOException on any failure. */ public void initialize(URI fsURI, Configuration configuration) throws IOException { this.uri = fsURI; dnsToSwitchMapping = ReflectionUtils.newInstance( configuration.getClass("topology.node.switch.mapping.impl", ScriptBasedMapping.class, DNSToSwitchMapping.class), configuration); this.swiftRestClient = SwiftRestClient.getInstance(fsURI, configuration); }
Example 3
Source File: TestSwiftFileSystemRename.java From sahara-extra with Apache License 2.0 | 5 votes |
@Test(timeout = SWIFT_TEST_TIMEOUT) public void testRenamePseudoDir() throws Throwable { assumeRenameSupported(); // create file directory (don't create directory file) SwiftRestClient client; client = SwiftRestClient.getInstance(fs.getUri(), fs.getConf()); SwiftObjectPath path = SwiftObjectPath.fromPath(fs.getUri(), new Path("/test/olddir/file")); client.upload(path, new ByteArrayInputStream(new byte[0]), 0); rename(path("/test/olddir"), path("/test/newdir"), true, false, true); SwiftTestUtils.assertIsDirectory(fs, path("/test/newdir")); assertIsFile(path("/test/newdir/file")); }
Example 4
Source File: TestSwiftConfig.java From hadoop with Apache License 2.0 | 4 votes |
private SwiftRestClient mkInstance(Configuration configuration) throws IOException, URISyntaxException { URI uri = new URI("swift://container.openstack/"); return SwiftRestClient.getInstance(uri, configuration); }
Example 5
Source File: TestSwiftConfig.java From big-c with Apache License 2.0 | 4 votes |
private SwiftRestClient mkInstance(Configuration configuration) throws IOException, URISyntaxException { URI uri = new URI("swift://container.openstack/"); return SwiftRestClient.getInstance(uri, configuration); }
Example 6
Source File: TestSwiftConfig.java From sahara-extra with Apache License 2.0 | 4 votes |
private SwiftRestClient mkInstance(Configuration configuration) throws IOException, URISyntaxException { URI uri = new URI("swift://container.openstack/"); return SwiftRestClient.getInstance(uri, configuration); }
Example 7
Source File: SwiftNativeFileSystemStore.java From hadoop with Apache License 2.0 | 2 votes |
/** * Initalize the filesystem store -this creates the REST client binding. * * @param fsURI URI of the filesystem, which is used to map to the filesystem-specific * options in the configuration file * @param configuration configuration * @throws IOException on any failure. */ public void initialize(URI fsURI, Configuration configuration) throws IOException { this.uri = fsURI; this.swiftRestClient = SwiftRestClient.getInstance(fsURI, configuration); }
Example 8
Source File: SwiftNativeFileSystemStore.java From big-c with Apache License 2.0 | 2 votes |
/** * Initalize the filesystem store -this creates the REST client binding. * * @param fsURI URI of the filesystem, which is used to map to the filesystem-specific * options in the configuration file * @param configuration configuration * @throws IOException on any failure. */ public void initialize(URI fsURI, Configuration configuration) throws IOException { this.uri = fsURI; this.swiftRestClient = SwiftRestClient.getInstance(fsURI, configuration); }