Package co.cask.cdap.api.dataset

Examples of co.cask.cdap.api.dataset.DatasetSpecification


  @Override
  public synchronized <T extends DatasetAdmin> T getAdmin(String datasetInstanceName,
                                                          @Nullable ClassLoader classLoader)
    throws IOException {

    DatasetSpecification spec = instances.get(datasetInstanceName);
    if (spec == null) {
      return null;
    }
    DatasetDefinition impl = createRegistry(classLoader).get(spec.getType());
    return (T) impl.getAdmin(spec, classLoader);
  }
View Full Code Here


      LOG.warn(message);
      responder.sendError(HttpResponseStatus.NOT_FOUND, message);
      return false;
    }
    // Note how we execute configure() via opExecutorClient (outside of ds service) to isolate running user code
    DatasetSpecification spec;
    try {
      spec = opExecutorClient.create(name, typeMeta,
                                     DatasetProperties.builder().addAll(creationProperties.getProperties()).build());
    } catch (Exception e) {
      String msg = String.format("Cannot %s dataset %s of type %s: executing create() failed, reason: %s",
View Full Code Here

  public synchronized <T extends Dataset> T getDataset(String datasetInstanceName,
                                                       Map<String, String> arguments,
                                                       @Nullable ClassLoader classLoader)
    throws IOException {

    DatasetSpecification spec = instances.get(datasetInstanceName);
    if (spec == null) {
      return null;
    }
    DatasetDefinition def = createRegistry(classLoader).get(spec.getType());
    return (T) (def.getDataset(spec, arguments, classLoader));
  }
View Full Code Here

  @Path("/data/datasets/{name}")
  public void drop(HttpRequest request, final HttpResponder responder,
                   @PathParam("name") String name) {
    LOG.info("Deleting dataset {}", name);

    DatasetSpecification spec = instanceManager.get(name);
    if (spec == null) {
      responder.sendStatus(HttpResponseStatus.NOT_FOUND);
      return;
    }
View Full Code Here

  public Collection<DatasetSpecification> getInstances() throws DatasetManagementException {
    Collection<DatasetSpecification> specs = delegate.getInstances();
    // client may pass the name back e.g. do delete instance, so we need to un-namespace it
    ImmutableList.Builder<DatasetSpecification> builder = ImmutableList.builder();
    for (DatasetSpecification spec : specs) {
      DatasetSpecification s = fromNamespaced(spec);
      if (s != null) {
        builder.add(s);
      }
    }
    return builder.build();
View Full Code Here

      LOG.error(msg);
      responder.sendError(HttpResponseStatus.BAD_REQUEST, msg);
      return;
    }

    DatasetSpecification spec = type.configure(name, props);
    DatasetAdmin admin = type.getAdmin(spec);
    admin.create();
    responder.sendJson(HttpResponseStatus.OK, spec);
  }
View Full Code Here

    String typeMetaHeader = request.getHeader("type-meta");
    Preconditions.checkArgument(specHeader != null, "Missing required 'type-meta' header.");

    LOG.info("Dropping dataset with spec: {}, type meta: {}", specHeader, typeMetaHeader);

    DatasetSpecification spec = GSON.fromJson(specHeader, DatasetSpecification.class);
    DatasetTypeMeta typeMeta = GSON.fromJson(typeMetaHeader, DatasetTypeMeta.class);

    DatasetType type = dsFramework.getDatasetType(typeMeta, null);

    if (type == null) {
View Full Code Here

    if (type == null) {
      throw new IllegalArgumentException("Dataset type cannot be instantiated for provided type meta: " + typeMeta);
    }

    DatasetSpecification spec = type.configure(instanceName, props);
    DatasetAdmin admin = type.getAdmin(spec);
    admin.create();

    return spec;
  }
View Full Code Here

  }

  @Override
  public ACLTable getDataset(DatasetSpecification spec, Map<String, String> arguments,
                             ClassLoader classLoader) throws IOException {
    DatasetSpecification tableSpec = spec.getSpecification("data");
    IndexedObjectStore<ACL> data = tableDefinition.getDataset(tableSpec, arguments, classLoader);
    return new ACLTableDataset(spec, data);
  }
View Full Code Here

  private String getDataEntity(Id.Program programId, Data type, String name) throws Exception {
    try {
      Id.Account account = new Id.Account(programId.getAccountId());
      if (type == Data.DATASET) {
        DatasetSpecification dsSpec = getDatasetSpec(name);
        String typeName = null;
        if (dsSpec != null) {
          typeName = dsSpec.getType();
        }
        return GSON.toJson(makeDataSetRecord(name, typeName));
      } else if (type == Data.STREAM) {
        StreamSpecification spec = store.getStream(account, name);
        return spec == null ? "" : GSON.toJson(makeStreamRecord(spec.getName(), spec));
View Full Code Here

TOP

Related Classes of co.cask.cdap.api.dataset.DatasetSpecification

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.