Refine search
new NettyPayloadModule()); BlobStoreContext context = ContextBuilder.newBuilder("s3") .credentials(accessId, secretKey) .modules(MODULES) .overrides(overrides)
new NettyPayloadModule()); BlobStoreContext context = ContextBuilder.newBuilder("s3") .credentials(accessId, secretKey) .modules(MODULES) .overrides(overrides)
new NettyPayloadModule() ); BlobStoreContext context = ContextBuilder.newBuilder( "s3" ) .credentials(accessId, secretKey) .modules(MODULES) .overrides(overrides)
@Provides @LazySingleton public CloudFilesApi getCloudFilesApi(final CloudFilesAccountConfig config) { log.info("Building Cloud Files Api..."); Iterable<com.google.inject.Module> modules; if (config.getUseServiceNet()) { log.info("Configuring Cloud Files Api to use the internal service network..."); modules = ImmutableSet.of(new SLF4JLoggingModule(), new InternalUrlModule()); } else { log.info("Configuring Cloud Files Api to use the public network..."); modules = ImmutableSet.of(new SLF4JLoggingModule()); } ProviderRegistry.registerProvider(CloudFilesUSProviderMetadata.builder().build()); ProviderRegistry.registerProvider(CloudFilesUKProviderMetadata.builder().build()); ContextBuilder cb = ContextBuilder.newBuilder(config.getProvider()) .credentials(config.getUserName(), config.getApiKey()).modules(modules); CloudFilesApi cfa = cb.buildApi(CloudFilesApi.class); log.info("Cloud Files Api built."); return cfa; }
public void deleteBucket() { String accessId = System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR ); String secretKey = System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR ); Properties overrides = new Properties(); overrides.setProperty( "s3" + ".identity", accessId ); overrides.setProperty( "s3" + ".credential", secretKey ); Blob bo = null; BlobStore blobStore = null; final Iterable<? extends Module> MODULES = ImmutableSet .of(new JavaUrlHttpCommandExecutorServiceModule(), new Log4JLoggingModule(), new NettyPayloadModule()); BlobStoreContext context = ContextBuilder.newBuilder("s3").credentials( accessId, secretKey ).modules( MODULES ) .overrides( overrides ).buildView( BlobStoreContext.class ); blobStore = context.getBlobStore(); blobStore.deleteContainer( bucketName ); }
ContextBuilder ctxBuilder = ContextBuilder.newBuilder(provider); ctxBuilder.credentials(identity, credential);
/** * Delete the configured s3 bucket. */ public void deleteBucket() { logger.debug("\n\nDelete bucket\n"); String accessId = System.getProperty(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR); String secretKey = System.getProperty(SDKGlobalConfiguration.SECRET_KEY_ENV_VAR); Properties overrides = new Properties(); overrides.setProperty("s3" + ".identity", accessId); overrides.setProperty("s3" + ".credential", secretKey); final Iterable<? extends Module> MODULES = ImmutableSet .of(new JavaUrlHttpCommandExecutorServiceModule(), new Log4JLoggingModule(), new NettyPayloadModule()); BlobStoreContext context = ContextBuilder.newBuilder("s3").credentials(accessId, secretKey).modules(MODULES) .overrides(overrides).buildView(BlobStoreContext.class); BlobStore blobStore = context.getBlobStore(); blobStore.deleteContainer( bucketName ); }
ContextBuilder.newBuilder("s3").credentials(accessId, secretKey).modules(MODULES) .overrides(overrides).buildView(BlobStoreContext.class);
new NettyPayloadModule() ); BlobStoreContext context = ContextBuilder.newBuilder( "s3" ) .credentials( accessKey, secretKey ) .modules( MODULES ) .overrides( overrides )
new NettyPayloadModule()); BlobStoreContext context = ContextBuilder.newBuilder("s3") .credentials(accessId, secretKey) .modules(MODULES) .overrides(overrides)
new Log4JLoggingModule(), new NettyPayloadModule() ); BlobStoreContext context = ContextBuilder.newBuilder( "s3" ) .credentials( accessId, secretKey ) .modules( MODULES ) .overrides( overrides )
new NettyPayloadModule() ); BlobStoreContext context = ContextBuilder.newBuilder( "s3" ) .credentials(accessId, secretKey ) .modules(MODULES ) .overrides(overrides )
public CloudFilesPublisher() { Properties overrides = new Properties(); overrides.setProperty(LocationConstants.PROPERTY_ZONE, ZONE); BlobStoreContext context = ContextBuilder.newBuilder(PROVIDER) .credentials(USERNAME, API_KEY) .overrides(overrides) .buildView(BlobStoreContext.class); blobStore = context.getBlobStore(); }
.newBuilder(provider) .credentials(identity, credential) .modules(ImmutableList.<Module>of( new SLF4JLoggingModule(),
public synchronized void downloadNewFiles(File downloadDir) { log.info("Downloading new files since {}", lastMarker); BlobStoreContext ctx = ContextBuilder.newBuilder(provider) .credentials(user, key) .overrides(new Properties() {{ setProperty(LocationConstants.PROPERTY_ZONE, zone); }}) .buildView(BlobStoreContext.class); // threadsafe according to https://jclouds.apache.org/documentation/userguide/blobstore-guide/ BlobStore store = ctx.getBlobStore(); ListContainerOptions options = new ListContainerOptions().maxResults(batchSize).afterMarker(lastMarker); PageSet<? extends StorageMetadata> pages = store.list(container, options); //Gets key within the time range specified NavigableMap<Long, String> mapWithinRange = getBlobsWithinRange(pages); //Download only for keys within that range for(Map.Entry<Long, String> blobMeta : mapWithinRange.entrySet()) { log.info("Downloading file: " + blobMeta.getValue()); downloadWorkers.submit(new BlobDownload(downloadDir, store, container, blobMeta.getValue())); lastMarker = blobMeta.getValue(); synchronized (CloudFilesManager.this) { // this is where we resume from. MarkerUtils.writeLastMarker(blobMeta.getValue()); } } log.info("Updated the last marker value as " + lastMarker); }
blobStoreContext = ContextBuilder.newBuilder( builder.blobStoreProvider) .credentials(accessKey, secretKey) .overrides(properties).build(BlobStoreContext.class);
public synchronized boolean hasNewFiles() { // see if there are any files since lastMarker. BlobStoreContext ctx = ContextBuilder.newBuilder(provider) .credentials(user, key) .overrides(new Properties() {{ setProperty(LocationConstants.PROPERTY_ZONE, zone); }}) .buildView(BlobStoreContext.class); BlobStore store = ctx.getBlobStore(); ListContainerOptions options = new ListContainerOptions().maxResults(batchSize).afterMarker(lastMarker); PageSet<? extends StorageMetadata> pages = store.list(container, options); log.debug("Saw {} new files since {}", pages.size() == batchSize ? "many" : Integer.toString(pages.size()), lastMarker); boolean emptiness = getBlobsWithinRange(pages).isEmpty(); if(emptiness) { log.warn("No file found within range {}", new Range(START_TIME, STOP_TIME)); } else { log.debug("New files found within range {}", new Range(START_TIME, STOP_TIME)); } return !emptiness; }
public CloudSigmaConnector(String provider,String login,String secretKey){ journal.log(Level.INFO, ">> Connecting to "+provider+" ..."); Iterable<Module> modules = ImmutableSet.<Module> of( new SshjSshClientModule(), new NullLoggingModule()); ContextBuilder builder = ContextBuilder.newBuilder(provider) .credentials(login, secretKey) .modules(modules); journal.log(Level.INFO, ">> Authenticating ..."); this.provider = provider; cloudSigmaApi=builder.buildApi(CloudSigma2Api.class); }
@Override public BlobStore create() throws Exception { BlobStoreContext context = ContextBuilder.newBuilder("b2").credentials(this.accessKey, this.secretKey) .overrides(overrides).buildView(BlobStoreContext.class); return context.getBlobStore(); }
private RegionScopedBlobStoreContext createRegionContext() { return ContextBuilder .newBuilder(getProvider()) .credentials(getIdentity(), getCredential()) .buildView(RegionScopedBlobStoreContext.class); }