Package co.cask.cdap.api.dataset

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


  private Map<String, DatasetDefinition> datasetTypes = Maps.newHashMap();

  @Override
  public <T extends DatasetDefinition> T get(String datasetType) {
    DatasetDefinition def = datasetTypes.get(datasetType);
    if (def == null) {
      String msg = "Requested dataset type does NOT exist: " + datasetType;
      LOG.debug(msg);
      throw new IllegalArgumentException(msg);
    }
View Full Code Here


    if (instances.get(datasetInstanceName) != null) {
      throw new InstanceConflictException("Dataset instance with name already exists: " + datasetInstanceName);
    }

    Preconditions.checkArgument(registry.hasType(datasetType), "Dataset type '%s' is not registered", datasetType);
    DatasetDefinition def = registry.get(datasetType);
    DatasetSpecification spec = def.configure(datasetInstanceName, props);
    instances.put(datasetInstanceName, spec);
    def.getAdmin(spec, null).create();
    instances.put(datasetInstanceName, spec);
    LOG.info("Created dataset {} of type {}", datasetInstanceName, datasetType);
  }
View Full Code Here

    if (oldSpec == null) {
      throw new InstanceConflictException("Dataset instance with name does not exist: " + datasetInstanceName);
    }
    String datasetType = oldSpec.getType();
    Preconditions.checkArgument(registry.hasType(datasetType), "Dataset type '%s' is not registered", datasetType);
    DatasetDefinition def = registry.get(datasetType);
    DatasetSpecification spec = def.configure(datasetInstanceName, props);
    instances.put(datasetInstanceName, spec);
    def.getAdmin(spec, null).upgrade();
  }
View Full Code Here

  }

  @Override
  public synchronized void deleteInstance(String datasetInstanceName) throws InstanceConflictException, IOException {
    DatasetSpecification spec = instances.remove(datasetInstanceName);
    DatasetDefinition def = registry.get(spec.getType());
    def.getAdmin(spec, null).drop();
  }
View Full Code Here

  }

  @Override
  public synchronized void deleteAllInstances() throws DatasetManagementException, IOException {
    for (DatasetSpecification spec : instances.values()) {
      DatasetDefinition def = registry.get(spec.getType());
      def.getAdmin(spec, null).drop();
    }
    instances.clear();
  }
View Full Code Here

    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

    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

          String type = ((EmbeddedDataset) ann).type();
          if (EmbeddedDataset.DEFAULT_TYPE_NAME.equals(type)) {
            // default to dataset class name
            type = paramTypes[i].getName();
          }
          DatasetDefinition def = registry.get(type);
          if (def == null) {
            String msg = String.format("Unknown data set type used with @Dataset: " + type);
            LOG.error(msg);
            throw new IllegalStateException(msg);
          }
View Full Code Here

TOP

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

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.