Package com.amazonaws.services.s3.model

Examples of com.amazonaws.services.s3.model.S3ObjectSummary


                String qName,
                Attributes attrs) {

            if (in("ListBucketResult")) {
                if (name.equals("Contents")) {
                    currentObject = new S3ObjectSummary();
                    currentObject.setBucketName(objectListing.getBucketName());
                }
            }

            else if (in("ListBucketResult", "Contents")) {
View Full Code Here


        }

        @Override
        public void startElement(String uri, String name, String qName, Attributes attrs) {
            if (name.equals("Contents")) {
                currentObject = new S3ObjectSummary();
                currentObject.setBucketName(bucketName);
            } else if (name.equals("Owner")) {
                currentOwner = new Owner();
                currentObject.setOwner(currentOwner);
            } else if (name.equals("CommonPrefixes")) {
View Full Code Here

                String qName,
                Attributes attrs) {

            if (in("ListBucketResult")) {
                if (name.equals("Contents")) {
                    currentObject = new S3ObjectSummary();
                    currentObject.setBucketName(objectListing.getBucketName());
                }
            }

            else if (in("ListBucketResult", "Contents")) {
View Full Code Here

        public void endDocument() {
        }

        public void startElement(String uri, String name, String qName, Attributes attrs) {
            if (name.equals("Contents")) {
                currentObject = new S3ObjectSummary();
                currentObject.setBucketName(bucketName);
            } else if (name.equals("Owner")) {
                currentOwner = new Owner();
                currentObject.setOwner(currentOwner);
            } else if (name.equals("CommonPrefixes")) {
View Full Code Here

       
        ObjectListing objectListing = new ObjectListing();
        int capacity = listObjectsRequest.getMaxKeys();
       
        for (int index = 0; index < objects.size() && index < capacity; index++) {
            S3ObjectSummary s3ObjectSummary = new S3ObjectSummary();
            s3ObjectSummary.setBucketName(objects.get(index).getBucketName());
            s3ObjectSummary.setKey(objects.get(index).getKey());
           
            objectListing.getObjectSummaries().add(s3ObjectSummary);
        }

        return objectListing;
View Full Code Here

    @Override
    public QSTaskModel getAvailableTask() {
        if (!iterator.hasNext()) {
            pageForward();
        }
        S3ObjectSummary obj = iterator.next();
        assert obj != null;
        return new QSTaskModel(listingBatchId, IdSupplier.newId(), taskHandlerIdentifier, ImmutableMap.<String, Object>of(PARAM_OBJECT, obj));
    }
View Full Code Here

    }

    public static List<S3ObjectSummary> getObjectSummary()
    {
        List<S3ObjectSummary> list = new ArrayList<S3ObjectSummary>();
        S3ObjectSummary summary = new S3ObjectSummary();
        summary.setKey("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108110030/SNAP/ks1/cf1/f1.db");
        list.add(summary);
        summary = new S3ObjectSummary();
        summary.setKey("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108110430/SST/ks1/cf1/f2.db");
        list.add(summary);
        summary = new S3ObjectSummary();
        summary.setKey("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108110600/SST/ks1/cf1/f3.db");
        list.add(summary);
        summary = new S3ObjectSummary();
        summary.setKey("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108110030/META/meta.json");
        list.add(summary);
        return list;
    }
View Full Code Here

    }

    public static List<S3ObjectSummary> getNextObjectSummary()
    {
        List<S3ObjectSummary> list = new ArrayList<S3ObjectSummary>();
        S3ObjectSummary summary = new S3ObjectSummary();
        summary.setKey("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108110030/SNAP/ks2/cf1/f1.db");
        list.add(summary);
        summary = new S3ObjectSummary();
        summary.setKey("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108110430/SST/ks2/cf1/f2.db");
        list.add(summary);
        summary = new S3ObjectSummary();
        summary.setKey("test_backup/"+FakeConfiguration.FAKE_REGION+"/fakecluster/123456/201108110600/SST/ks2/cf1/f3.db");
        list.add(summary);
        return list;
    }
View Full Code Here

        public void endDocument() {
        }

        public void startElement(String uri, String name, String qName, Attributes attrs) {
            if (name.equals("Contents")) {
                currentObject = new S3ObjectSummary();
                currentObject.setBucketName(bucketName);
            } else if (name.equals("Owner")) {
                currentOwner = new Owner();
                currentObject.setOwner(currentOwner);
            } else if (name.equals("CommonPrefixes")) {
View Full Code Here

    if (useMappers) {
      // not implemented
      throw new IOException("Defining S3InputFormat with number of mappers is not implemented");
    } else {
      S3ObjectSummary startKey = null;
      S3ObjectSummary endKey = null;

      int batchSize = 0;
     
      int numOfSplits = 0;
      int numOfCalls = 0;

      int maxKeyIDX = 0;
      int currentKeyIDX = 0;
      int nextKeyIDX = 0;

      ObjectListing listing = null;
      boolean isLastCall = true;

      // split all keys starting with "keyPrefix" into splits of
      // "numOfKeysPerMapper" keys
      do {
        // for first time we have to build request after that use
        // previous listing to get next batch
        if (listing == null) {
          listing = s3Reader.listObjects(bucketName, keyPrefix, maxKeys);
        } else {
          listing = s3Reader.listObjects(listing);
        }

        // Is this last call to WS (last batch of objects)
        isLastCall = !listing.isTruncated();

        // Size of the batch from last WS call
        batchSize = listing.getObjectSummaries().size();

        // Absolute index of last key from batch
        maxKeyIDX = numOfCalls * maxKeys + batchSize;

        // Absolute indexes of current and next keys
        currentKeyIDX = numOfSplits * numOfKeysPerMapper;
        // if there are no more keys to process, index of last key is selected
        nextKeyIDX = (numOfSplits + 1) * numOfKeysPerMapper > maxKeyIDX && isLastCall ? maxKeyIDX : (numOfSplits + 1) * numOfKeysPerMapper;

        // create one input split for each key which is in current range
        while (nextKeyIDX <= maxKeyIDX) {

          startKey = endKey;
          endKey = listing.getObjectSummaries().get((nextKeyIDX - 1) % maxKeys);

          // Create new input split
          S3InputSplit split = new S3InputSplit();
          split.setBucketName(bucketName);
          split.setKeyPrefix(keyPrefix);
          split.setMarker(startKey != null ? startKey.getKey() : null);
          split.setLastKey(endKey.getKey());
          split.setSize(nextKeyIDX - currentKeyIDX);

          splits.add(split);
          numOfSplits++;

View Full Code Here

TOP

Related Classes of com.amazonaws.services.s3.model.S3ObjectSummary

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.