Package org.infinispan.loader.s3.jclouds

Examples of org.infinispan.loader.s3.jclouds.JCloudsConnection


                properties.put("jclouds.aws.accesskeyid", config.getAwsAccessKey());
            if (!properties.containsKey("jclouds.aws.secretaccesskey"))
                properties.put("jclouds.aws.secretaccesskey", config.getAwsSecretKey());
            this.s3Service = S3ConnectionFactory.getConnection(properties, new S3HttpNioConnectionPoolClientModule());
            if (this.s3Service == null) {
                throw new S3ConnectionException("Could not connect");
            }

        } catch (Exception ex) {
            throw convertToS3ConnectionException("Exception connecting to s3", ex);
        }
View Full Code Here


        }
    }

    S3ConnectionException convertToS3ConnectionException(String message, Exception caught) {
        return (caught instanceof S3ConnectionException) ? (S3ConnectionException) caught :
                new S3ConnectionException(message, caught);
    }
View Full Code Here

            for (String key : keySet()) {
                deletes.add(connection.getConnection().deleteObject(rootS3Bucket, key));
            }
            for (Future<Boolean> delete : deletes) {
                if (!delete.get())
                    throw new S3ConnectionException("could not delete entry");
            }
        } catch (Exception ex) {
            throw connection.convertToS3ConnectionException("Exception clearing store", ex);
        }
    }
View Full Code Here

     */
    public void insert(Bucket b) throws S3ConnectionException {
        try {
            if (b.getEntries().isEmpty()) {
                if (!connection.getConnection().deleteObject(rootS3Bucket, b.getBucketName()).get())
                    throw new S3ConnectionException(String.format("Could not delete object [%2s] in s3bucket [%1s] ", rootS3Bucket.getName(), b.getBucketName()));
            } else {
                S3Object s3Object = new S3Object();
                s3Object.setKey(b.getBucketName());
                s3Object.setContent(connection.marshaller.objectToByteBuffer(b));
                s3Object.setContentType("application/octet-string");
View Full Code Here

    protected final void safeClose(InputStream stream) throws S3ConnectionException {
        if (stream == null) return;
        try {
            stream.close();
        } catch (Exception e) {
            throw new S3ConnectionException("Problems closing input stream", e);
        }
    }
View Full Code Here

   public void init(CacheLoaderConfig cfg, Cache cache, Marshaller m) throws CacheLoaderException {
      this.config = (S3CacheStoreConfig) cfg;
      S3Bucket cloudsBucket;
      S3Connection cloudsConnection;
      try {
         cloudsConnection = config.getConnectionClass() != null ? (S3Connection) Util.getInstance(config.getConnectionClass()) : new JCloudsConnection();
         cloudsBucket = config.getBucketClass()!=null ? (S3Bucket) Util.getInstance(config.getBucketClass()) : new JCloudsBucket();
      } catch (Exception e) {
         throw new CacheLoaderException(e);
      }
      init(cfg, cache, m, cloudsConnection, cloudsBucket);
View Full Code Here

   /**
    * {@inheritDoc} This initializes the internal <tt>s3Connection</tt> to a default implementation
    */
   public void init(CacheLoaderConfig config, Cache cache, Marshaller m) {
      init(config, cache, m, new JCloudsConnection(), new JCloudsBucket());
   }
View Full Code Here

TOP

Related Classes of org.infinispan.loader.s3.jclouds.JCloudsConnection

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.