Package com.google.appengine.api.blobstore

Examples of com.google.appengine.api.blobstore.BlobKey


        throw new UnsupportedOperationException(
            String.format("File %s does not have a finalized name", file.getFullPath()));
      }

      if (file.getFileSystem().equals((AppEngineFile.FileSystem.BLOBSTORE))) {
        BlobKey blobKey = getBlobKey(file);
        if (blobKey != null) {
          blobKeys.add(blobKey);
        }
      } else if (file.getFileSystem().equals((AppEngineFile.FileSystem.GS))) {
        blobKeys.add(blobstoreService.createGsBlobKey(file.getFullPath()));
View Full Code Here


      throw new NullPointerException("file is null");
    }
    if (file.getFileSystem() != AppEngineFile.FileSystem.BLOBSTORE) {
      throw new IllegalArgumentException("file is not of type BLOBSTORE");
    }
    BlobKey cached = file.getCachedBlobKey();
    if (null != cached) {
      return cached;
    }
    String namePart = file.getNamePart();
    String creationHandle = (namePart.startsWith(CREATION_HANDLE_PREFIX) ? namePart : null);

    if (null == creationHandle) {
      return new BlobKey(namePart);
    }

    String origNamespace = NamespaceManager.get();
    Query query;
    Entity blobInfoEntity = null;
View Full Code Here

      return ((BlobKey) value).getKeyString();
    }

    @Override
    protected BlobKey fromDatastoreValue(String datastoreString) {
      return new BlobKey(datastoreString);
    }
View Full Code Here

   
    @Override
    public BlobKey decode(JsonReader reader, BlobKey defaultValue) {
        String text = reader.read();
        if(text != null){
            return new BlobKey(text);
        }
        return defaultValue;
    }
View Full Code Here

      return ((BlobKey) value).getKeyString();
    }

    @Override
    protected BlobKey fromDatastoreString(String datastoreString) {
      return new BlobKey(datastoreString);
    }
View Full Code Here

        PreparedQuery pq = ds.prepare(q);
        Iterable<Entity> results = pq.asIterable();
        for (Entity result : results) {
            Map<String, Object> upload = new HashMap<String, Object>();
            upload.put("description", (String) result.getProperty("description"));
            BlobKey blobKey = (BlobKey) result.getProperty("upload");
            upload.put("blob", blobInfoFactory.loadBlobInfo(blobKey));
            upload.put("uploadKey", KeyFactory.keyToString(result.getKey()));
            uploads.add(upload);
        }
               
View Full Code Here

        if (uploadKeyStrings != null) {
          for (String uploadKeyStr : uploadKeyStrings) {
                try {
                    Entity userUpload = ds.get(KeyFactory.stringToKey(uploadKeyStr));
                    if (((User)userUpload.getProperty("user")).equals(user)) {
                        BlobKey blobKey = (BlobKey)userUpload.getProperty("upload");
                        Key blobInfoKey = KeyFactory.createKey(
                                BlobInfoFactory.KIND, blobKey.getKeyString());
                        keysToDelete.add(blobInfoKey);
                        keysToDelete.add(userUpload.getKey());
                    }
                } catch (EntityNotFoundException e) {
                    // Do nothing.
View Full Code Here

        BlobstoreService bs =
                BlobstoreServiceFactory.getBlobstoreService();

        String uploadKeyStr = req.getParameter("key");
        Entity userUpload = null;
        BlobKey blobKey = null;
        if (uploadKeyStr != null) {
            try {
                userUpload = ds.get(KeyFactory.stringToKey(uploadKeyStr));
                if (((User)userUpload.getProperty("user")).equals(user)) {
                    blobKey = (BlobKey)userUpload.getProperty("upload");
View Full Code Here

  private BlobstoreService blobstoreService = BlobstoreServiceFactory
      .getBlobstoreService();

  public void doGet(HttpServletRequest req, HttpServletResponse res)
      throws IOException {
    BlobKey blobKey = new BlobKey(req.getParameter("key"));
    blobstoreService.serve(blobKey, res);
  }
View Full Code Here

    // Different standard Java ways of writing to the channel
    // are possible. Here we use a PrintWriter:
    writeChannel.write(ByteBuffer.wrap(content));
    // Now finalize
    writeChannel.closeFinally();
    BlobKey key = fileService.getBlobKey(file);
    return key.getKeyString();
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.blobstore.BlobKey

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.