Java 类org.apache.hadoop.fs.swift.http.RestClientBindings 实例源码
项目:hadoop
文件:SwiftObjectPath.java
/**
* Create a path tuple of (container, path), where the container is
* chosen from the host of the URI.
* A trailing slash can be added to the path. This is the point where
* these /-es need to be appended, because when you construct a {@link Path}
* instance, {@link Path#normalizePath(String, String)} is called
* -which strips off any trailing slash.
*
* @param uri uri to start from
* @param path path underneath
* @param addTrailingSlash should a trailing slash be added if there isn't one.
* @return a new instance.
* @throws SwiftConfigurationException if the URI host doesn't parse into
* container.service
*/
public static SwiftObjectPath fromPath(URI uri,
Path path,
boolean addTrailingSlash)
throws SwiftConfigurationException {
String url =
path.toUri().getPath().replaceAll(PATH_PART_PATTERN.pattern(), "");
//add a trailing slash if needed
if (addTrailingSlash && !url.endsWith("/")) {
url += "/";
}
String container = uri.getHost();
if (container == null) {
//no container, not good: replace with ""
container = "";
} else if (container.contains(".")) {
//its a container.service URI. Strip the container
container = RestClientBindings.extractContainerName(container);
}
return new SwiftObjectPath(container, url);
}
项目:aliyun-oss-hadoop-fs
文件:SwiftObjectPath.java
/**
* Create a path tuple of (container, path), where the container is
* chosen from the host of the URI.
* A trailing slash can be added to the path. This is the point where
* these /-es need to be appended, because when you construct a {@link Path}
* instance, {@link Path#normalizePath(String, String)} is called
* -which strips off any trailing slash.
*
* @param uri uri to start from
* @param path path underneath
* @param addTrailingSlash should a trailing slash be added if there isn't one.
* @return a new instance.
* @throws SwiftConfigurationException if the URI host doesn't parse into
* container.service
*/
public static SwiftObjectPath fromPath(URI uri,
Path path,
boolean addTrailingSlash)
throws SwiftConfigurationException {
String url =
path.toUri().getPath().replaceAll(PATH_PART_PATTERN.pattern(), "");
//add a trailing slash if needed
if (addTrailingSlash && !url.endsWith("/")) {
url += "/";
}
String container = uri.getHost();
if (container == null) {
//no container, not good: replace with ""
container = "";
} else if (container.contains(".")) {
//its a container.service URI. Strip the container
container = RestClientBindings.extractContainerName(container);
}
return new SwiftObjectPath(container, url);
}
项目:big-c
文件:SwiftObjectPath.java
/**
* Create a path tuple of (container, path), where the container is
* chosen from the host of the URI.
* A trailing slash can be added to the path. This is the point where
* these /-es need to be appended, because when you construct a {@link Path}
* instance, {@link Path#normalizePath(String, String)} is called
* -which strips off any trailing slash.
*
* @param uri uri to start from
* @param path path underneath
* @param addTrailingSlash should a trailing slash be added if there isn't one.
* @return a new instance.
* @throws SwiftConfigurationException if the URI host doesn't parse into
* container.service
*/
public static SwiftObjectPath fromPath(URI uri,
Path path,
boolean addTrailingSlash)
throws SwiftConfigurationException {
String url =
path.toUri().getPath().replaceAll(PATH_PART_PATTERN.pattern(), "");
//add a trailing slash if needed
if (addTrailingSlash && !url.endsWith("/")) {
url += "/";
}
String container = uri.getHost();
if (container == null) {
//no container, not good: replace with ""
container = "";
} else if (container.contains(".")) {
//its a container.service URI. Strip the container
container = RestClientBindings.extractContainerName(container);
}
return new SwiftObjectPath(container, url);
}
项目:hadoop-2.6.0-cdh5.4.3
文件:SwiftObjectPath.java
/**
* Create a path tuple of (container, path), where the container is
* chosen from the host of the URI.
* A trailing slash can be added to the path. This is the point where
* these /-es need to be appended, because when you construct a {@link Path}
* instance, {@link Path#normalizePath(String, String)} is called
* -which strips off any trailing slash.
*
* @param uri uri to start from
* @param path path underneath
* @param addTrailingSlash should a trailing slash be added if there isn't one.
* @return a new instance.
* @throws SwiftConfigurationException if the URI host doesn't parse into
* container.service
*/
public static SwiftObjectPath fromPath(URI uri,
Path path,
boolean addTrailingSlash)
throws SwiftConfigurationException {
String url =
path.toUri().getPath().replaceAll(PATH_PART_PATTERN.pattern(), "");
//add a trailing slash if needed
if (addTrailingSlash && !url.endsWith("/")) {
url += "/";
}
String container = uri.getHost();
if (container == null) {
//no container, not good: replace with ""
container = "";
} else if (container.contains(".")) {
//its a container.service URI. Strip the container
container = RestClientBindings.extractContainerName(container);
}
return new SwiftObjectPath(container, url);
}
项目:hops
文件:SwiftObjectPath.java
/**
* Create a path tuple of (container, path), where the container is
* chosen from the host of the URI.
* A trailing slash can be added to the path. This is the point where
* these /-es need to be appended, because when you construct a {@link Path}
* instance, {@link Path#normalizePath(String, String)} is called
* -which strips off any trailing slash.
*
* @param uri uri to start from
* @param path path underneath
* @param addTrailingSlash should a trailing slash be added if there isn't one.
* @return a new instance.
* @throws SwiftConfigurationException if the URI host doesn't parse into
* container.service
*/
public static SwiftObjectPath fromPath(URI uri,
Path path,
boolean addTrailingSlash)
throws SwiftConfigurationException {
String url =
path.toUri().getPath().replaceAll(PATH_PART_PATTERN.pattern(), "");
//add a trailing slash if needed
if (addTrailingSlash && !url.endsWith("/")) {
url += "/";
}
String container = uri.getHost();
if (container == null) {
//no container, not good: replace with ""
container = "";
} else if (container.contains(".")) {
//its a container.service URI. Strip the container
container = RestClientBindings.extractContainerName(container);
}
return new SwiftObjectPath(container, url);
}
项目:hadoop-on-lustre2
文件:SwiftObjectPath.java
/**
* Create a path tuple of (container, path), where the container is
* chosen from the host of the URI.
* A trailing slash can be added to the path. This is the point where
* these /-es need to be appended, because when you construct a {@link Path}
* instance, {@link Path#normalizePath(String, String)} is called
* -which strips off any trailing slash.
*
* @param uri uri to start from
* @param path path underneath
* @param addTrailingSlash should a trailing slash be added if there isn't one.
* @return a new instance.
* @throws SwiftConfigurationException if the URI host doesn't parse into
* container.service
*/
public static SwiftObjectPath fromPath(URI uri,
Path path,
boolean addTrailingSlash)
throws SwiftConfigurationException {
String url =
path.toUri().getPath().replaceAll(PATH_PART_PATTERN.pattern(), "");
//add a trailing slash if needed
if (addTrailingSlash && !url.endsWith("/")) {
url += "/";
}
String container = uri.getHost();
if (container == null) {
//no container, not good: replace with ""
container = "";
} else if (container.contains(".")) {
//its a container.service URI. Strip the container
container = RestClientBindings.extractContainerName(container);
}
return new SwiftObjectPath(container, url);
}
项目:sahara-extra
文件:SwiftObjectPath.java
/**
* Create a path tuple of (container, path), where the container is
* chosen from the host of the URI.
* A trailing slash can be added to the path. This is the point where
* these /-es need to be appended, because when you construct a {@link Path}
* instance, {@link Path#normalizePath(String, String)} is called
* -which strips off any trailing slash.
*
* @param uri uri to start from
* @param path path underneath
* @param addTrailingSlash should a trailing slash be added if there isn't one.
* @return a new instance.
* @throws SwiftConfigurationException if the URI host doesn't parse into
* container.service
*/
public static SwiftObjectPath fromPath(URI uri,
Path path,
boolean addTrailingSlash)
throws SwiftConfigurationException {
String url =
path.toUri().getPath().replaceAll(PATH_PART_PATTERN.pattern(), "");
//add a trailing slash if needed
if (addTrailingSlash && !url.endsWith("/")) {
url += "/";
}
String container = uri.getHost();
if (container == null) {
//no container, not good: replace with ""
container = "";
} else if (container.contains(".")) {
//its a container.service URI. Strip the container
container = RestClientBindings.extractContainerName(container);
}
return new SwiftObjectPath(container, url);
}
项目:hadoop
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParsePath() throws Exception {
final String pathString = "/home/user/files/file1";
final Path path = new Path(pathString);
final URI uri = new URI("http://container.localhost");
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
pathString);
assertEquals(expected, actual);
}
项目:hadoop
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseUrlPath() throws Exception {
final String pathString = "swift://container.service1/home/user/files/file1";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/user/files/file1");
assertEquals(expected, actual);
}
项目:hadoop
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseAuthenticatedUrl() throws Exception {
final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/tom/documents/finance.docx");
assertEquals(expected, actual);
}
项目:aliyun-oss-hadoop-fs
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParsePath() throws Exception {
final String pathString = "/home/user/files/file1";
final Path path = new Path(pathString);
final URI uri = new URI("http://container.localhost");
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
pathString);
assertEquals(expected, actual);
}
项目:aliyun-oss-hadoop-fs
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseUrlPath() throws Exception {
final String pathString = "swift://container.service1/home/user/files/file1";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/user/files/file1");
assertEquals(expected, actual);
}
项目:aliyun-oss-hadoop-fs
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseAuthenticatedUrl() throws Exception {
final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/tom/documents/finance.docx");
assertEquals(expected, actual);
}
项目:big-c
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParsePath() throws Exception {
final String pathString = "/home/user/files/file1";
final Path path = new Path(pathString);
final URI uri = new URI("http://container.localhost");
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
pathString);
assertEquals(expected, actual);
}
项目:big-c
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseUrlPath() throws Exception {
final String pathString = "swift://container.service1/home/user/files/file1";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/user/files/file1");
assertEquals(expected, actual);
}
项目:big-c
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseAuthenticatedUrl() throws Exception {
final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/tom/documents/finance.docx");
assertEquals(expected, actual);
}
项目:hadoop-2.6.0-cdh5.4.3
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParsePath() throws Exception {
final String pathString = "/home/user/files/file1";
final Path path = new Path(pathString);
final URI uri = new URI("http://container.localhost");
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
pathString);
assertEquals(expected, actual);
}
项目:hadoop-2.6.0-cdh5.4.3
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseUrlPath() throws Exception {
final String pathString = "swift://container.service1/home/user/files/file1";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/user/files/file1");
assertEquals(expected, actual);
}
项目:hadoop-2.6.0-cdh5.4.3
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseAuthenticatedUrl() throws Exception {
final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/tom/documents/finance.docx");
assertEquals(expected, actual);
}
项目:hops
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParsePath() throws Exception {
final String pathString = "/home/user/files/file1";
final Path path = new Path(pathString);
final URI uri = new URI("http://container.localhost");
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
pathString);
assertEquals(expected, actual);
}
项目:hops
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseUrlPath() throws Exception {
final String pathString = "swift://container.service1/home/user/files/file1";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/user/files/file1");
assertEquals(expected, actual);
}
项目:hops
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseAuthenticatedUrl() throws Exception {
final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/tom/documents/finance.docx");
assertEquals(expected, actual);
}
项目:hadoop-on-lustre2
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParsePath() throws Exception {
final String pathString = "/home/user/files/file1";
final Path path = new Path(pathString);
final URI uri = new URI("http://container.localhost");
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
pathString);
assertEquals(expected, actual);
}
项目:hadoop-on-lustre2
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseUrlPath() throws Exception {
final String pathString = "swift://container.service1/home/user/files/file1";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/user/files/file1");
assertEquals(expected, actual);
}
项目:hadoop-on-lustre2
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseAuthenticatedUrl() throws Exception {
final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/tom/documents/finance.docx");
assertEquals(expected, actual);
}
项目:sahara-extra
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParsePath() throws Exception {
final String pathString = "/home/user/files/file1";
final Path path = new Path(pathString);
final URI uri = new URI("http://container.localhost");
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
pathString);
assertEquals(expected, actual);
}
项目:sahara-extra
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseUrlPath() throws Exception {
final String pathString = "swift://container.service1/home/user/files/file1";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/user/files/file1");
assertEquals(expected, actual);
}
项目:sahara-extra
文件:TestSwiftObjectPath.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testParseAuthenticatedUrl() throws Exception {
final String pathString = "swift://container.service1/v2/AUTH_00345h34l93459y4/home/tom/documents/finance.docx";
final URI uri = new URI(pathString);
final Path path = new Path(pathString);
final SwiftObjectPath expected = SwiftObjectPath.fromPath(uri, path);
final SwiftObjectPath actual = new SwiftObjectPath(
RestClientBindings.extractContainerName(uri),
"/home/tom/documents/finance.docx");
assertEquals(expected, actual);
}
项目:hadoop
文件:TestSwiftFileSystemExtendedContract.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testConfIsValid() throws Throwable {
Configuration conf = new Configuration();
URI fsURI = SwiftTestUtils.getServiceURI(conf);
RestClientBindings.bind(fsURI, conf);
}
项目:aliyun-oss-hadoop-fs
文件:TestSwiftFileSystemExtendedContract.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testConfIsValid() throws Throwable {
Configuration conf = new Configuration();
URI fsURI = SwiftTestUtils.getServiceURI(conf);
RestClientBindings.bind(fsURI, conf);
}
项目:big-c
文件:TestSwiftFileSystemExtendedContract.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testConfIsValid() throws Throwable {
Configuration conf = new Configuration();
URI fsURI = SwiftTestUtils.getServiceURI(conf);
RestClientBindings.bind(fsURI, conf);
}
项目:hadoop-2.6.0-cdh5.4.3
文件:TestSwiftFileSystemExtendedContract.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testConfIsValid() throws Throwable {
Configuration conf = new Configuration();
URI fsURI = SwiftTestUtils.getServiceURI(conf);
RestClientBindings.bind(fsURI, conf);
}
项目:hops
文件:TestSwiftFileSystemExtendedContract.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testConfIsValid() throws Throwable {
Configuration conf = new Configuration();
URI fsURI = SwiftTestUtils.getServiceURI(conf);
RestClientBindings.bind(fsURI, conf);
}
项目:hadoop-on-lustre2
文件:TestSwiftFileSystemExtendedContract.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testConfIsValid() throws Throwable {
Configuration conf = new Configuration();
URI fsURI = SwiftTestUtils.getServiceURI(conf);
RestClientBindings.bind(fsURI, conf);
}
项目:sahara-extra
文件:TestSwiftFileSystemExtendedContract.java
@Test(timeout = SWIFT_TEST_TIMEOUT)
public void testConfIsValid() throws Throwable {
Configuration conf = new Configuration();
URI fsURI = SwiftTestUtils.getServiceURI(conf);
RestClientBindings.bind(fsURI, conf);
}