Exemplo n.º 1
0
  /**
   * Set the partitioning schema after loading from XML or repository
   *
   * @param partitionSchemas the list of partitioning schemas
   */
  public void setPartitionSchemaAfterLoading(List<PartitionSchema> partitionSchemas)
      throws KettleException {
    partitionSchema = null; // sorry, not found!

    for (int i = 0; i < partitionSchemas.size() && partitionSchema == null; i++) {
      PartitionSchema schema = partitionSchemas.get(i);
      if (schema.getName().equalsIgnoreCase(partitionSchemaName)) {
        partitionSchema = schema; // found!
      }
    }

    if (methodType != PARTITIONING_METHOD_NONE && partitionSchema == null) {
      String message =
          "Unable to set partition schema for name ["
              + partitionSchemaName
              + "], method: "
              + getMethodDescription()
              + Const.CR;
      message += "This is the list of available partition schema:" + Const.CR;
      for (int i = 0; i < partitionSchemas.size() && partitionSchema == null; i++) {
        PartitionSchema schema = partitionSchemas.get(i);
        message += "  --> " + schema.getName() + Const.CR;
      }
      throw new KettleException(message);
    }
  }
Exemplo n.º 2
0
 public StepPartitioningMeta clone() {
   StepPartitioningMeta stepPartitioningMeta =
       new StepPartitioningMeta(
           method, partitionSchema != null ? (PartitionSchema) partitionSchema.clone() : null);
   stepPartitioningMeta.partitionSchemaName = partitionSchemaName;
   stepPartitioningMeta.setMethodType(methodType);
   stepPartitioningMeta.setPartitioner(partitioner == null ? null : partitioner.clone());
   return stepPartitioningMeta;
 }
Exemplo n.º 3
0
 /**
  * Saves partitioning properties in the repository for the given step.
  *
  * @param rep the repository to save in
  * @param id_transformation the ID of the transformation
  * @param id_step the ID of the step
  * @throws KettleDatabaseException In case anything goes wrong
  */
 public void saveRep(Repository rep, long id_transformation, long id_step) throws KettleException {
   rep.saveStepAttribute(
       id_transformation,
       id_step,
       "PARTITIONING_SCHEMA",
       partitionSchema != null ? partitionSchema.getName() : ""); // selected schema
   rep.saveStepAttribute(
       id_transformation,
       id_step,
       "PARTITIONING_METHOD",
       getMethodCode()); // method of partitioning
 }
Exemplo n.º 4
0
  @Override
  public String toString() {

    String description;

    if (partitioner != null) {
      description = partitioner.getDescription();
    } else {
      description = getMethodDescription();
    }
    if (partitionSchema != null) {
      description += " / " + partitionSchema.toString();
    }

    return description;
  }
Exemplo n.º 5
0
  public String getXML() {
    StringBuffer xml = new StringBuffer(150);

    xml.append("         <partitioning>").append(Const.CR);
    xml.append("           ").append(XMLHandler.addTagValue("method", getMethodCode()));
    xml.append("           ")
        .append(
            XMLHandler.addTagValue(
                "schema_name", partitionSchema != null ? partitionSchema.getName() : ""));
    if (partitioner != null) {
      xml.append(partitioner.getXML());
    }
    xml.append("           </partitioning>").append(Const.CR);

    return xml.toString();
  }