예제 #1
0
 public String getMethodDescription() {
   if (methodType != PARTITIONING_METHOD_SPECIAL) {
     return methodDescriptions[methodType];
   } else {
     return partitioner.getDescription();
   }
 }
예제 #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;
 }
예제 #3
0
 public StepPartitioningMeta(Repository rep, long id_step) throws KettleException {
   this();
   partitionSchemaName = rep.getStepAttributeString(id_step, "PARTITIONING_SCHEMA");
   String methodCode = rep.getStepAttributeString(id_step, "PARTITIONING_METHOD");
   setMethod(getMethod(methodCode));
   if (partitioner != null) {
     partitioner.loadRep(rep, id_step);
   }
   hasChanged = true;
 }
예제 #4
0
 public String getMethodCode() {
   if (methodType == PARTITIONING_METHOD_SPECIAL) {
     if (partitioner != null) {
       return partitioner.getId();
     } else {
       return methodCodes[PARTITIONING_METHOD_NONE];
     }
   }
   return methodCodes[methodType];
 }
예제 #5
0
 public StepPartitioningMeta(Node partitioningMethodNode) throws KettleXMLException {
   this();
   setMethod(getMethod(XMLHandler.getTagValue(partitioningMethodNode, "method")));
   partitionSchemaName = XMLHandler.getTagValue(partitioningMethodNode, "schema_name");
   hasChanged = false;
   if (partitioner != null) {
     partitioner.loadXML(partitioningMethodNode);
   }
   if (methodType != PARTITIONING_METHOD_NONE && Const.isEmpty(partitionSchemaName)) {
     throw new RuntimeException("bohoo!");
   }
 }
예제 #6
0
  @Override
  public String toString() {

    String description;

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

    return description;
  }
예제 #7
0
 public void createPartitioner(String method) {
   methodType = getMethodType(method);
   switch (methodType) {
     case PARTITIONING_METHOD_SPECIAL:
       {
         partitioner = StepLoader.getPartitioner(method).getInstance();
         break;
       }
     case PARTITIONING_METHOD_NONE:
     default:
       partitioner = null;
   }
   if (partitioner != null) {
     partitioner.setMeta(this);
   }
 }
예제 #8
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();
  }
예제 #9
0
 public int getPartition(RowMetaInterface rowMeta, Object[] row) throws KettleException {
   if (partitioner != null) {
     return partitioner.getPartition(rowMeta, row);
   }
   return 0;
 }