public SwiftAttributesFinderFeature(SwiftSession session) { this(session, new SwiftRegionService(session)); }
log.debug(String.format("Write metadata %s for file %s", metadata, file)); session.getClient().updateContainerMetadata(regionService.lookup(file), containerService.getContainer(file).getName(), metadata); log.debug(String.format("Write metadata %s for file %s", metadata, file)); session.getClient().updateObjectMetadata(regionService.lookup(file), containerService.getContainer(file).getName(), containerService.getKey(file), metadata);
public Region lookup(final Path file) throws BackgroundException { final Path container = containerService.getContainer(file); if(Location.unknown.equals(new SwiftLocationFeature.SwiftRegion(container.attributes().getRegion()))) { return this.lookup(location.getLocation(container)); } return this.lookup(new SwiftLocationFeature.SwiftRegion(container.attributes().getRegion())); }
try { if(StringUtils.isNotBlank(configuration.getIndexDocument())) { session.getClient().updateContainerMetadata(regionService.lookup(container), container.getName(), Collections.singletonMap("X-Container-Meta-Web-Index", configuration.getIndexDocument())); = session.getClient().getCDNContainerInfo(regionService.lookup(container), container.getName()); if(log.isDebugEnabled()) { log.debug(String.format("Found existing CDN configuration %s", info)); log.debug(String.format("Enable CDN configuration for %s", container)); session.getClient().cdnEnableContainer(regionService.lookup(container), container.getName()); log.debug(String.format("Update CDN configuration for %s", container)); session.getClient().cdnUpdateContainer(regionService.lookup(container), container.getName(), -1, configuration.isEnabled(), configuration.isLogging());
public SwiftSegmentService(final SwiftSession session, final String prefix) { this(session, new SwiftRegionService(session), prefix); }
log.debug(String.format("Creating SLO manifest %s for %s", manifest, file)); session.getClient().createSLOManifestObject(regionService.lookup( containerService.getContainer(file)), containerService.getContainer(file).getName(),
public SwiftObjectListService(final SwiftSession session) { this(session, new SwiftRegionService(session)); }
final Region region = regionService.lookup(container.getKey()); final List<String> keys = container.getValue(); for(List<String> partition : new Partition<String>(keys, PreferencesFactory.get().getInteger("openstack.delete.multiple.partition"))) { session.getClient().deleteContainer(regionService.lookup(file), containerService.getContainer(file).getName());
public SwiftSegmentService(final SwiftSession session) { this(session, new SwiftRegionService(session)); }
@Override protected Long operate(final PasswordCallback callback, final Path container) throws BackgroundException { try { return session.getClient().getContainerInfo(regionService.lookup(container), container.getName()).getTotalSize(); } catch(GenericException e) { throw new SwiftExceptionMappingService().map(e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map(e); } } }
public SwiftUrlProvider(final SwiftSession session, final Map<Region, AccountInfo> accounts) { this(session, accounts, new SwiftRegionService(session)); }
final String checksum = session.getClient().createSLOManifestObject(regionService.lookup( containerService.getContainer(file)), containerService.getContainer(file).getName(),
public SwiftMetadataFeature(final SwiftSession session) { this(session, new SwiftRegionService(session)); }
/** * @return The ETag returned by the server for the uploaded object */ @Override public StorageObject call(final AbstractHttpEntity entity) throws BackgroundException { try { // Previous final HashMap<String, String> headers = new HashMap<>(status.getMetadata()); final String checksum = session.getClient().storeObject( regionService.lookup(file), containerService.getContainer(file).getName(), containerService.getKey(file), entity, headers, null); if(log.isDebugEnabled()) { log.debug(String.format("Saved object %s with checksum %s", file, checksum)); } final StorageObject stored = new StorageObject(containerService.getKey(file)); stored.setMd5sum(checksum); stored.setSize(status.getLength()); return stored; } catch(GenericException e) { throw new SwiftExceptionMappingService().map("Upload {0} failed", e, file); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Upload {0} failed", e, file); } }
public SwiftCopyFeature(final SwiftSession session) { this(session, new SwiftRegionService(session)); }
try { try { final CDNContainer info = session.getClient().getCDNContainerInfo(regionService.lookup(container), container.getName()); final Distribution distribution = new Distribution(regionService.lookup(container).getStorageUrl(container.getName()), method, info.isEnabled()); distribution.setId(info.getName()); final ContainerMetadata metadata = session.getClient().getContainerMetaData(regionService.lookup(container), container.getName()); if(metadata.getMetaData().containsKey("X-Container-Meta-Web-Index")) { log.debug(String.format("No CDN configuration for %s", container)); final Distribution distribution = new Distribution(regionService.lookup(container).getStorageUrl(container.getName()), method, false); distribution.setStatus(LocaleFactory.localizedString("CDN Disabled", "Mosso")); return distribution;
public SwiftMoveFeature(final SwiftSession session) { this(session, new SwiftRegionService(session)); }
final Path container = containerService.getContainer(file); final Map<String, List<StorageObject>> segments = session.getClient().listObjectSegments(regionService.lookup(container), container.getName(), containerService.getKey(file)); if(null == segments) {
public SwiftDistributionPurgeFeature(final SwiftSession session) { this(session, new SwiftRegionService(session)); }
@Override public void invalidate(final Path container, final Distribution.Method method, final List<Path> files, final LoginCallback prompt) throws BackgroundException { try { for(Path file : files) { if(containerService.isContainer(file)) { session.getClient().purgeCDNContainer(regionService.lookup(containerService.getContainer(file)), container.getName(), null); } else { session.getClient().purgeCDNObject(regionService.lookup(containerService.getContainer(file)), container.getName(), containerService.getKey(file), null); } } } catch(GenericException e) { throw new SwiftExceptionMappingService().map("Cannot write CDN configuration", e); } catch(IOException e) { throw new DefaultIOExceptionMappingService().map("Cannot write CDN configuration", e); } } }