Package io.fathom.cloud.openstack.client.storage

Examples of io.fathom.cloud.openstack.client.storage.StoragePath


        return new OpenstackConfigPath(store, bucket, childKey);
    }

    private StoragePath getStoragePath() throws RestClientException {
        StoragePath storagePath = new StoragePath(store.getStorageClient(), bucket, key);
        return storagePath;
    }
View Full Code Here


    @Override
    public Iterable<ConfigEntry> listChildren() throws IOException {
        List<ConfigEntry> children = Lists.newArrayList();

        try {
            StoragePath path = getStoragePath();

            List<StorageObjectInfo> childNodes = path.listChildren(false);
            if (childNodes != null) {
                for (StorageObjectInfo o : childNodes) {
                    String name = path.stripPrefix(o.name);
                    long version = o.getLastModifiedTimestamp();
                    ConfigEntry child = new ConfigEntry(name, version);
                    children.add(child);
                }
            }
View Full Code Here

    // }

    @Override
    public String read() throws IOException {
        try {
            StoragePath path = getStoragePath();

            try (StorageObject storageObject = path.read()) {
                if (storageObject == null) {
                    return null;
                }
                return storageObject.getAsString();
            }
View Full Code Here

    }

    @Override
    public void write(String contents) throws IOException {
        try {
            StoragePath path = getStoragePath();

            path.write(contents);
        } catch (RestClientException e) {
            throw new IOException("Error writing config file", e);
        }
    }
View Full Code Here

    }

    @Override
    public void delete() throws IOException {
        try {
            StoragePath path = getStoragePath();

            path.delete();
        } catch (RestClientException e) {
            throw new IOException("Error deleting config file", e);
        }
    }
View Full Code Here

TOP

Related Classes of io.fathom.cloud.openstack.client.storage.StoragePath

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.