mirror of https://github.com/apache/jclouds.git
JCLOUDS-732: Filesystem portable object ACLs
This commit is contained in:
parent
eda06d0454
commit
e25a44eab9
|
@ -45,6 +45,7 @@ import javax.inject.Provider;
|
|||
|
||||
import org.jclouds.blobstore.LocalStorageStrategy;
|
||||
import org.jclouds.blobstore.domain.Blob;
|
||||
import org.jclouds.blobstore.domain.BlobAccess;
|
||||
import org.jclouds.blobstore.domain.BlobBuilder;
|
||||
import org.jclouds.blobstore.domain.ContainerAccess;
|
||||
import org.jclouds.blobstore.domain.MutableStorageMetadata;
|
||||
|
@ -431,6 +432,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
|||
logger.debug("xattrs not supported on %s", outputPath);
|
||||
}
|
||||
}
|
||||
setBlobAccess(containerName, blobKey, BlobAccess.PRIVATE);
|
||||
return base16().lowerCase().encode(actualHashCode.asBytes());
|
||||
} catch (IOException ex) {
|
||||
if (outputFile != null) {
|
||||
|
@ -476,6 +478,36 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
|||
removeDirectoriesTreeOfBlobKey(container, blobKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlobAccess getBlobAccess(String containerName, String blobName) {
|
||||
Path path = new File(buildPathStartingFromBaseDir(containerName, blobName)).toPath();
|
||||
Set<PosixFilePermission> permissions;
|
||||
try {
|
||||
permissions = getPosixFilePermissions(path);
|
||||
} catch (IOException ioe) {
|
||||
throw Throwables.propagate(ioe);
|
||||
}
|
||||
return permissions.contains(PosixFilePermission.OTHERS_READ)
|
||||
? BlobAccess.PUBLIC_READ : BlobAccess.PRIVATE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlobAccess(String container, String name, BlobAccess access) {
|
||||
Path path = new File(buildPathStartingFromBaseDir(container, name)).toPath();
|
||||
Set<PosixFilePermission> permissions;
|
||||
try {
|
||||
permissions = getPosixFilePermissions(path);
|
||||
if (access == BlobAccess.PRIVATE) {
|
||||
permissions.remove(PosixFilePermission.OTHERS_READ);
|
||||
} else if (access == BlobAccess.PUBLIC_READ) {
|
||||
permissions.add(PosixFilePermission.OTHERS_READ);
|
||||
}
|
||||
setPosixFilePermissions(path, permissions);
|
||||
} catch (IOException ioe) {
|
||||
throw Throwables.propagate(ioe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getLocation(final String containerName) {
|
||||
return null;
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.jclouds.blobstore.integration.internal.BaseBlobStoreIntegrationTest;
|
|||
import org.jclouds.filesystem.reference.FilesystemConstants;
|
||||
import org.jclouds.filesystem.utils.TestUtils;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.SkipException;
|
||||
|
||||
@Test(groups = { "integration" }, singleThreaded = true, testName = "blobstore.FilesystemBlobIntegrationTest")
|
||||
public class FilesystemBlobIntegrationTest extends BaseBlobIntegrationTest {
|
||||
|
@ -86,9 +85,4 @@ public class FilesystemBlobIntegrationTest extends BaseBlobIntegrationTest {
|
|||
super.checkUserMetadata(userMetadata1, userMetadata2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testSetBlobAccess() throws Exception {
|
||||
throw new SkipException("Intentionally not implemented for the transient provider");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue