Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Blob


  public FooClassLoader loadPlugin(final String pluginName) {
    // TODO do this only for the given plugin

    for (final Entity pluginBytecode : db.prepare(new Query(PluginClassBytecode.class.getSimpleName())).asIterable()) {
      final String className = String.valueOf(pluginBytecode.getProperty("className"));
      final Blob bytecode = (Blob) pluginBytecode.getProperty("bytecode");

      if (className.contains(".class") || className.contains("/")) {
        continue; // invalid class name
      }
     
      try {
        loader.defineClass(className, bytecode.getBytes());
      } catch (ClassFormatError e) {
        log.warning("Could not load class " + className + ". A ClassFormatError occured.");
      } catch (LinkageError e) {
        log.warning("LinkageError asdasd while trying to load " + className);
      }
View Full Code Here


    for (final Map.Entry<String, byte[]> entry : getBytecodeMapFromJarInputStream(is).entrySet()) {
      final Entity pluginBytecode = new Entity(PluginClassBytecode.class.getSimpleName());

      pluginBytecode.setProperty("className", entry.getKey());
      pluginBytecode.setProperty("bytecode", new Blob(entry.getValue()));

      entities.add(pluginBytecode);

      System.out.println("class name = " + entry.getKey());
    }
View Full Code Here

        smallImageURL, imageURLBackup, smallImageURLBackup, category);
    imageContentService.addNewImageContent(imageContent);
  }

  public String getURLBackup(String imageURL) throws IOException {
    Blob blob = getBlobFromURL(imageURL);
    return toBlobstore(blob).getKeyString();
  }
View Full Code Here

    while ((nRead = stream.read(data, 0, data.length)) != -1) {
      buffer.write(data, 0, nRead);
    }
    buffer.flush();
    stream.close();
    return new Blob(buffer.toByteArray());
  }
View Full Code Here

    this.payload = payload;
  }

  public FanoutTaskRecord(Entity entity) {
    super(entity);
    Blob payloadBlob = (Blob) entity.getProperty(PAYLOAD_PROPERTY);
    payload = payloadBlob.getBytes();
  }
View Full Code Here

  }

  @Override
  public Entity toEntity() {
    Entity entity = toProtoEntity();
    entity.setUnindexedProperty(PAYLOAD_PROPERTY, new Blob(payload));
    return entity;
  }
View Full Code Here

  @Override
  public Object serializeValue(PipelineModelObject model, Object value) throws IOException {
    byte[] bytes = SerializationUtils.serialize(value);
    if (bytes.length < MAX_BLOB_BYTE_SIZE) {
      return new Blob(bytes);
    }
    int shardId = 0;
    int offset = 0;
    final List<Entity> shardedValues = new ArrayList<>(bytes.length / MAX_BLOB_BYTE_SIZE + 1);
    while (offset < bytes.length) {
View Full Code Here

    this.exception = exception;
  }

  public ExceptionRecord(Entity entity) {
    super(entity);
    Blob serializedExceptionBlob = (Blob) entity.getProperty(EXCEPTION_PROPERTY);
    byte[] serializedException = serializedExceptionBlob.getBytes();
    try {
      exception = (Throwable) SerializationUtils.deserialize(serializedException);
    } catch (IOException e) {
      throw new RuntimeException("Failed to deserialize exception for " + getKey(), e);
    }
View Full Code Here

  @Override
  public Entity toEntity() {
    try {
      Entity entity = toProtoEntity();
      byte[] serializedException = SerializationUtils.serialize(exception);
      entity.setUnindexedProperty(EXCEPTION_PROPERTY, new Blob(serializedException));
      return entity;
    } catch (IOException e) {
      throw new RuntimeException("Failed to serialize exception for " + getKey(), e);
    }
  }
View Full Code Here

  @Override
  public Entity toEntity() {
    Entity entity = toProtoEntity();
    entity.setUnindexedProperty(SHARD_ID_PROPERTY, shardId);
    entity.setUnindexedProperty(VALUE_PROPERTY, new Blob(value));
    return entity;
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.Blob

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.