Examples of GcsFilename


Examples of com.google.appengine.tools.cloudstorage.GcsFilename

  public static void main(String[] args) throws IOException, ClassNotFoundException {
    LocalExample example = new LocalExample();
    example.helper.setUp();
    try {
      /** Write and read back a map */
      GcsFilename filename = new GcsFilename("MyBucket", "foo");
      Map<String, String> mapContent = new HashMap<>();
      mapContent.put("foo", "bar");

      example.writeObjectToFile(filename, mapContent);

View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

    em = EMF.get().createEntityManager();
    Long id_max = (Long)em.createQuery("select max(rr.id) from RosieRecords rr where rr.used =0").getSingleResult(); // this will give you the current record's id
    Long id_min = (Long)em.createQuery("select min(rr.id) from RosieRecords rr where rr.used =0").getSingleResult(); // this will give you the current record's id
    em.close();
    RosieRecordsService rrs = new RosieRecordsService();
    GcsFilename filename = new GcsFilename(BUCKETNAME, "RosieConversion_" + (new Date()).toString());
    GcsFileOptions options = new GcsFileOptions.Builder().mimeType("text/html").acl("public-read").build();
        //.addUserMetadata("myfield1", "my field value").build();
    GcsOutputChannel writeChannel;
    try {
      writeChannel = gcsService.createOrReplace(filename, options);
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

      // Uses LevelDbOutputWriter wrapping GoogleCloudStorageFileOutputWriter rather than
      // GoogleCloudStorageLevelDbOutputWriter because the padding at the end of the slice is
      // unneeded as the file is being finalized.
      return new MarshallingOutputWriter<>(
          new LevelDbOutputWriter(new GoogleCloudStorageFileOutputWriter(
              new GcsFilename(bucket, fileName), MapReduceConstants.REDUCE_INPUT_MIME_TYPE)),
          Marshallers.getKeyValuesMarshaller(identity, identity));
    }
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

  public GcsFilename getFile(int i) {
    if (i < 0 || i >= getNumFiles()) {
      throw new IllegalArgumentException("Invalid file number: " + i);
    }
    return new GcsFilename(getBucketName(), getFileNames().get(i));
  }
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

  }

  public List<GcsFilename> getFiles() {
    List<GcsFilename> result = new ArrayList<>(getFileNames().size());
    for (String name : getFileNames()) {
      result.add(new GcsFilename(getBucketName(), name));
    }
    return result;
  }
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

  @Override
  public List<GoogleCloudStorageFileOutputWriter> createWriters(int numShards) {
    ImmutableList.Builder<GoogleCloudStorageFileOutputWriter> out = ImmutableList.builder();
    for (int i = 0; i < numShards; i++) {
      GcsFilename file = new GcsFilename(bucket, String.format(fileNamePattern, i));
      out.add(new GoogleCloudStorageFileOutputWriter(file, mimeType));
    }
    return out.build();
  }
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

      this.valueMarshaller = valueMarshaller;
    }

    @Override
    public OutputWriter<KeyValue<K, V>> createWriter(int sortShard) {
      GcsFilename file = new GcsFilename(bucket, getFileName(sortShard));
      MarshallingOutputWriter<KeyValue<K, V>> output =
          new MarshallingOutputWriter<>(new GoogleCloudStorageLevelDbOutputWriter(
              new GoogleCloudStorageFileOutputWriter(file, MAP_OUTPUT_MIME_TYPE)),
              new KeyValueMarshaller<>(keyMarshaller, valueMarshaller));
      return output;
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

        .retryMinAttempts(2)
        .retryMaxAttempts(3)
        .totalRetryPeriodMillis(20000)
        .requestTimeoutMillis(10000)
        .build());
    GcsFilename filename = new GcsFilename(bucket, UUID.randomUUID() + ".tmp");
    if (gcsService.getMetadata(filename) != null) {
      log.warning("File '" + filename.getObjectName() + "' exists. Skipping bucket write test.");
      return;
    }
    try {
      gcsService.createOrReplace(filename, GcsFileOptions.getDefaultInstance(),
          ByteBuffer.wrap("Delete me!".getBytes(StandardCharsets.UTF_8)));
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

    @Override
    protected OutputWriter<ByteBuffer> createWriter(int fileNum) {
      String fileName = String.format(fileNamePattern, shardNumber, fileNum);
      GoogleCloudStorageFileOutputWriter toReturn =
          new GoogleCloudStorageFileOutputWriter(new GcsFilename(bucket, fileName), mimeType);
      delegatedWriters.add(toReturn);
      return toReturn;
    }
View Full Code Here

Examples of com.google.appengine.tools.cloudstorage.GcsFilename

      Marshaller<ByteBuffer> identity = Marshallers.getByteBufferMarshaller();
      String fileName = String.format(fileNamePattern, sliceNumber);
      fileNames.add(fileName);
      return new MarshallingOutputWriter<>(
          new GoogleCloudStorageLevelDbOutputWriter(new GoogleCloudStorageFileOutputWriter(
              new GcsFilename(bucket, fileName), MapReduceConstants.REDUCE_INPUT_MIME_TYPE)),
          Marshallers.getKeyValuesMarshaller(identity, identity));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.