当前位置: 首页>>代码示例>>Java>>正文


Java KettleAttributeInterface类代码示例

本文整理汇总了Java中org.pentaho.di.core.KettleAttributeInterface的典型用法代码示例。如果您正苦于以下问题:Java KettleAttributeInterface类的具体用法?Java KettleAttributeInterface怎么用?Java KettleAttributeInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KettleAttributeInterface类属于org.pentaho.di.core包,在下文中一共展示了KettleAttributeInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStepInjectionMetadataEntries

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
/**
 * Describe the metadata attributes that can be injected into this step metadata object.
 */
public List<StepInjectionMetaEntry> getStepInjectionMetadataEntries(Class<?> PKG) {
  List<StepInjectionMetaEntry> entries = new ArrayList<StepInjectionMetaEntry>();
  
  for (KettleAttributeInterface attr : attributes) {
    if (attr.getParent()==null) {
      entries.add(createEntry(attr, PKG));
    } else {
      StepInjectionMetaEntry entry = createEntry(attr, PKG);
      StepInjectionMetaEntry parentEntry = findParentEntry(entries, attr.getParent().getKey());
      if (parentEntry==null) {
        throw new RuntimeException("An error was detected in the step attributes' definition: the parent was not found for attribute "+attr);
      }
      parentEntry.getDetails().add(entry);
    }
  }
  
  return entries;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:22,代码来源:BaseStepMeta.java

示例2: loadStepAttributes

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
protected void loadStepAttributes() throws KettleException {
  try {
    InputStream inputStream = getClass().getResourceAsStream(STEP_ATTRIBUTES_FILE);
    if (inputStream!=null) {
      Document document = XMLHandler.loadXMLFile(inputStream);
      Node attrsNode = XMLHandler.getSubNode(document, "attributes");
      List<Node> nodes = XMLHandler.getNodes(attrsNode, "attribute");
      attributes = new ArrayList<KettleAttributeInterface>();
      for (Node node : nodes) {
        String key = XMLHandler.getTagAttribute(node, "id");
        String xmlCode = XMLHandler.getTagValue(node, "xmlcode");
        String repCode = XMLHandler.getTagValue(node, "repcode");
        String description = XMLHandler.getTagValue(node, "description");
        String tooltip = XMLHandler.getTagValue(node, "tooltip");
        int valueType = ValueMeta.getType( XMLHandler.getTagValue(node, "valuetype") );
        String parentId =  XMLHandler.getTagValue(node, "parentid");
        
        KettleAttribute attribute = new KettleAttribute(key, xmlCode, repCode, description, tooltip, valueType, findParent(attributes, parentId));
        attributes.add(attribute);
      }
    }
  } catch(Exception e) {
    throw new KettleException("Unable to load file "+STEP_ATTRIBUTES_FILE, e);
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:26,代码来源:BaseStepMeta.java

示例3: loadStepAttributes

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
/**
 * Load step attributes.
 *
 * @throws KettleException the kettle exception
 */
protected void loadStepAttributes() throws KettleException {
  try {
    InputStream inputStream = getClass().getResourceAsStream(STEP_ATTRIBUTES_FILE);
    if (inputStream!=null) {
      Document document = XMLHandler.loadXMLFile(inputStream);
      Node attrsNode = XMLHandler.getSubNode(document, "attributes");
      List<Node> nodes = XMLHandler.getNodes(attrsNode, "attribute");
      attributes = new ArrayList<KettleAttributeInterface>();
      for (Node node : nodes) {
        String key = XMLHandler.getTagAttribute(node, "id");
        String xmlCode = XMLHandler.getTagValue(node, "xmlcode");
        String repCode = XMLHandler.getTagValue(node, "repcode");
        String description = XMLHandler.getTagValue(node, "description");
        String tooltip = XMLHandler.getTagValue(node, "tooltip");
        int valueType = ValueMeta.getType( XMLHandler.getTagValue(node, "valuetype") );
        String parentId =  XMLHandler.getTagValue(node, "parentid");
        
        KettleAttribute attribute = new KettleAttribute(key, xmlCode, repCode, description, tooltip, valueType, findParent(attributes, parentId));
        attributes.add(attribute);
      }
    }
  } catch(Exception e) {
    throw new KettleException("Unable to load file "+STEP_ATTRIBUTES_FILE, e);
  }
}
 
开发者ID:bsspirit,项目名称:kettle-4.4.0-stable,代码行数:31,代码来源:BaseStepMeta.java

示例4: getStepInjectionMetadataEntries

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
/**
 * Describe the metadata attributes that can be injected into this step metadata object.
 */
public List<StepInjectionMetaEntry> getStepInjectionMetadataEntries( Class<?> PKG ) {
  List<StepInjectionMetaEntry> entries = new ArrayList<StepInjectionMetaEntry>();

  for ( KettleAttributeInterface attr : attributes ) {
    if ( attr.getParent() == null ) {
      entries.add( createEntry( attr, PKG ) );
    } else {
      StepInjectionMetaEntry entry = createEntry( attr, PKG );
      StepInjectionMetaEntry parentEntry = findParentEntry( entries, attr.getParent().getKey() );
      if ( parentEntry == null ) {
        throw new RuntimeException(
          "An error was detected in the step attributes' definition: the parent was not found for attribute "
            + attr );
      }
      parentEntry.getDetails().add( entry );
    }
  }

  return entries;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:24,代码来源:BaseStepMeta.java

示例5: findParent

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
public KettleAttributeInterface findParent(List<KettleAttributeInterface> attributes, String parentId) {
  if (Const.isEmpty(parentId)) {
    return null;
  }
  for (KettleAttributeInterface attribute : attributes) {
    if (attribute.getKey().equals(parentId)) {
      return attribute;
    }
  }
  return null;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:12,代码来源:BaseStepMeta.java

示例6: findAttribute

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
public KettleAttributeInterface findAttribute(String key) {
  for (KettleAttributeInterface attribute : attributes) {
    if (attribute.getKey().equals(key)) {
      return attribute;
    }
  }
  return null;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:9,代码来源:BaseStepMeta.java

示例7: loadStepAttributes

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
/**
 * Load step attributes.
 *
 * @throws KettleException
 *           the kettle exception
 */
protected void loadStepAttributes() throws KettleException {
  try {
    InputStream inputStream = getClass().getResourceAsStream( STEP_ATTRIBUTES_FILE );
    if ( inputStream != null ) {
      Document document = XMLHandler.loadXMLFile( inputStream );
      Node attrsNode = XMLHandler.getSubNode( document, "attributes" );
      List<Node> nodes = XMLHandler.getNodes( attrsNode, "attribute" );
      attributes = new ArrayList<KettleAttributeInterface>();
      for ( Node node : nodes ) {
        String key = XMLHandler.getTagAttribute( node, "id" );
        String xmlCode = XMLHandler.getTagValue( node, "xmlcode" );
        String repCode = XMLHandler.getTagValue( node, "repcode" );
        String description = XMLHandler.getTagValue( node, "description" );
        String tooltip = XMLHandler.getTagValue( node, "tooltip" );
        int valueType = ValueMetaFactory.getIdForValueMeta( XMLHandler.getTagValue( node, "valuetype" ) );
        String parentId = XMLHandler.getTagValue( node, "parentid" );

        KettleAttribute attribute =
          new KettleAttribute( key, xmlCode, repCode, description, tooltip, valueType, findParent(
            attributes, parentId ) );
        attributes.add( attribute );
      }
    }
  } catch ( Exception e ) {
    throw new KettleException( "Unable to load file " + STEP_ATTRIBUTES_FILE, e );
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:34,代码来源:BaseStepMeta.java

示例8: findParent

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
@Override
public KettleAttributeInterface findParent( List<KettleAttributeInterface> attributes, String parentId ) {
  if ( Utils.isEmpty( parentId ) ) {
    return null;
  }
  for ( KettleAttributeInterface attribute : attributes ) {
    if ( attribute.getKey().equals( parentId ) ) {
      return attribute;
    }
  }
  return null;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:13,代码来源:BaseStepMeta.java

示例9: findAttribute

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
@Override
public KettleAttributeInterface findAttribute( String key ) {
  for ( KettleAttributeInterface attribute : attributes ) {
    if ( attribute.getKey().equals( key ) ) {
      return attribute;
    }
  }
  return null;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:10,代码来源:BaseStepMeta.java

示例10: createEntry

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
@Override protected StepInjectionMetaEntry createEntry( KettleAttributeInterface attr, Class<?> PKG ) {
  return super.createEntry( attr, PKG );
}
 
开发者ID:pentaho-labs,项目名称:pentaho-cpython-plugin,代码行数:4,代码来源:CPythonScriptExecutorMeta.java

示例11: injectStepMetadataEntries

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
public void injectStepMetadataEntries(List<StepInjectionMetaEntry> metadata) {
  for (StepInjectionMetaEntry entry : metadata) {
    KettleAttributeInterface attr = findAttribute(entry.getKey());
    
    // Set top level attributes...
    //
    if (entry.getValueType()!=ValueMetaInterface.TYPE_NONE) {
      if (attr.getKey().equals("FILENAME")) { filename = (String) entry.getValue(); } else
      if (attr.getKey().equals("FILENAME_FIELD")) { filenameField = (String) entry.getValue(); } else
      if (attr.getKey().equals("ROW_NUM_FIELD")) { rowNumField = (String) entry.getValue(); } else
      if (attr.getKey().equals("HEADER_PRESENT")) { headerPresent = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("DELIMITER")) { delimiter = (String) entry.getValue(); } else
      if (attr.getKey().equals("ENCLOSURE")) { enclosure = (String) entry.getValue(); } else
      if (attr.getKey().equals("BUFFERSIZE")) { bufferSize = (String) entry.getValue(); } else
      if (attr.getKey().equals("LAZY_CONVERSION")) { lazyConversionActive = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("PARALLEL")) { runningInParallel = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("NEWLINE_POSSIBLE")) { newlinePossibleInFields = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("ADD_FILENAME_RESULT")) { isaddresult = (Boolean) entry.getValue(); } else
      if (attr.getKey().equals("ENCODING")) { encoding = (String) entry.getValue(); } else
      { 
        throw new RuntimeException("Unhandled metadata injection of attribute: "+attr.toString()+" - "+attr.getDescription());
      }
    } else {
      if (attr.getKey().equals("FIELDS")) {
        // This entry contains a list of lists...
        // Each list contains a single CSV input field definition (one line in the dialog)
        //
        List<StepInjectionMetaEntry> inputFieldEntries = entry.getDetails();
        inputFields = new TextFileInputField[inputFieldEntries.size()];
        for (int row=0;row<inputFieldEntries.size();row++) {
          StepInjectionMetaEntry inputFieldEntry = inputFieldEntries.get(row);
          TextFileInputField inputField = new TextFileInputField();

          List<StepInjectionMetaEntry> fieldAttributes = inputFieldEntry.getDetails();
          for (int i=0;i<fieldAttributes.size();i++) {
            StepInjectionMetaEntry fieldAttribute = fieldAttributes.get(i);
            KettleAttributeInterface fieldAttr = findAttribute(fieldAttribute.getKey());

            String attributeValue = (String)fieldAttribute.getValue();
            if (fieldAttr.getKey().equals("FIELD_NAME")) { inputField.setName(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_TYPE")) { inputField.setType(ValueMeta.getType(attributeValue)); } else 
            if (fieldAttr.getKey().equals("FIELD_FORMAT")) { inputField.setFormat(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_LENGTH")) { inputField.setLength(attributeValue==null ? -1 : Integer.parseInt(attributeValue)); } else 
            if (fieldAttr.getKey().equals("FIELD_PRECISION")) { inputField.setPrecision(attributeValue==null ? -1 : Integer.parseInt(attributeValue)); } else 
            if (fieldAttr.getKey().equals("FIELD_CURRENCY")) { inputField.setCurrencySymbol(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_DECIMAL")) { inputField.setDecimalSymbol(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_GROUP")) { inputField.setGroupSymbol(attributeValue); } else 
            if (fieldAttr.getKey().equals("FIELD_TRIM_TYPE")) { inputField.setTrimType(ValueMeta.getTrimTypeByCode(attributeValue)); } else
            {
              throw new RuntimeException("Unhandled metadata injection of attribute: "+fieldAttr.toString()+" - "+fieldAttr.getDescription());
            }
          }
          
          inputFields[row] = inputField;
        }
      }
    }
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:60,代码来源:CsvInputMeta.java

示例12: createEntry

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
protected StepInjectionMetaEntry createEntry(KettleAttributeInterface attr, Class<?> PKG) {
  return new StepInjectionMetaEntry(attr.getKey(), attr.getType(), BaseMessages.getString(PKG, attr.getDescription()));
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:4,代码来源:BaseStepMeta.java

示例13: getRepCode

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
public String getRepCode(String attributeKey) {
  KettleAttributeInterface attr = findAttribute(attributeKey);
  return Const.isEmpty(attr.getRepCode())?attr.getXmlCode():attr.getRepCode();
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:5,代码来源:BaseStepMeta.java

示例14: injectStepMetadataEntries

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
public void injectStepMetadataEntries( List<StepInjectionMetaEntry> metadata ) {
  for ( StepInjectionMetaEntry entry : metadata ) {
    KettleAttributeInterface attr = findAttribute( entry.getKey() );

    // Set top level attributes...
    //
    if ( entry.getValueType() != ValueMetaInterface.TYPE_NONE ) {

      if ( entry.getKey().equals( "SCHEMA" ) ) {
        schemaName = (String) entry.getValue();
      } else if ( entry.getKey().equals( "TABLE" ) ) {
        tableName = (String) entry.getValue();
      } else if ( entry.getKey().equals( "LOADACTION" ) ) {
        loadAction = (String) entry.getValue();
      } else if ( entry.getKey().equals( "DBNAMEOVERRIDE" ) ) {
        dbNameOverride = (String) entry.getValue();
      } else if ( entry.getKey().equals( "ENCLOSURE" ) ) {
        enclosure = (String) entry.getValue();
      } else if ( entry.getKey().equals( "DELIMITER" ) ) {
        delimiter = (String) entry.getValue();
      } else if ( entry.getKey().equals( "STOPONERROR" ) ) {
        stopOnError = (Boolean) entry.getValue();
      } else {
        throw new RuntimeException( "Unhandled metadata injection of attribute: "
          + attr.toString() + " - " + attr.getDescription() );
      }
    } else {
      // The data sets...
      //
      if ( attr.getKey().equals( "MAPPINGS" ) ) {
        List<StepInjectionMetaEntry> selectMappings = entry.getDetails();

        fieldTable = new String[selectMappings.size()];
        fieldStream = new String[selectMappings.size()];
        dateMask = new String[selectMappings.size()];

        for ( int row = 0; row < selectMappings.size(); row++ ) {
          StepInjectionMetaEntry selectField = selectMappings.get( row );

          List<StepInjectionMetaEntry> fieldAttributes = selectField.getDetails();
          //CHECKSTYLE:Indentation:OFF
          for ( int i = 0; i < fieldAttributes.size(); i++ ) {
            StepInjectionMetaEntry fieldAttribute = fieldAttributes.get( i );
            KettleAttributeInterface fieldAttr = findAttribute( fieldAttribute.getKey() );

            String attributeValue = (String) fieldAttribute.getValue();
            if ( fieldAttr.getKey().equals( "STREAMNAME" ) ) {
              getFieldStream()[row] = attributeValue;
            } else if ( fieldAttr.getKey().equals( "FIELDNAME" ) ) {
              getFieldTable()[row] = attributeValue;
            } else if ( fieldAttr.getKey().equals( "DATEMASK" ) ) {
              getDateMask()[row] = attributeValue;
            } else {
              throw new RuntimeException( "Unhandled metadata injection of attribute: "
                + fieldAttr.toString() + " - " + fieldAttr.getDescription() );
            }
          }
        }
      }
      if ( !Utils.isEmpty( getFieldStream() ) ) {
        for ( int i = 0; i < getFieldStream().length; i++ ) {
          logDetailed( "row " + Integer.toString( i ) + ": stream=" + getFieldStream()[i]
            + " : table=" + getFieldTable()[i] );
        }
      }

    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:70,代码来源:PGBulkLoaderMeta.java

示例15: injectStepMetadataEntries

import org.pentaho.di.core.KettleAttributeInterface; //导入依赖的package包/类
public void injectStepMetadataEntries( List<StepInjectionMetaEntry> metadata ) {
  for ( StepInjectionMetaEntry entry : metadata ) {
    KettleAttributeInterface attr = findAttribute( entry.getKey() );

    // Set top level attributes...
    //
    if ( entry.getValueType() != ValueMetaInterface.TYPE_NONE ) {

      if ( entry.getKey().equals( "SCHEMA" ) ) {
        schemaName = (String) entry.getValue();
      } else if ( entry.getKey().equals( "TABLE" ) ) {
        tableName = (String) entry.getValue();
      } else if ( entry.getKey().equals( "LOGFILE" ) ) {
        logFile = (String) entry.getValue();
      } else if ( entry.getKey().equals( "FIELD_SEPARATOR" ) ) {
        fieldSeparator = (String) entry.getValue();
      } else if ( entry.getKey().equals( "FIELD_ENCLOSURE" ) ) {
        fieldEnclosure = (String) entry.getValue();
      } else if ( entry.getKey().equals( "NULL_REPRESENTATION" ) ) {
        setNULLrepresentation( (String) entry.getValue() );
      } else if ( entry.getKey().equals( "ENCODING" ) ) {
        encoding = (String) entry.getValue();
      } else if ( entry.getKey().equals( "BUFFER_SIZE" ) ) {
        bufferSize = (String) entry.getValue();
      } else if ( entry.getKey().equals( "TRUNCATE" ) ) {
        truncate = (Boolean) entry.getValue();
      } else if ( entry.getKey().equals( "FULLY_QUOTE_SQL" ) ) {
        fullyQuoteSQL = (Boolean) entry.getValue();
      } else {
        throw new RuntimeException( "Unhandled metadata injection of attribute: "
            + attr.toString() + " - " + attr.getDescription() );
      }
    } else {
      // The data sets...
      //
      if ( attr.getKey().equals( "MAPPINGS" ) ) {
        List<StepInjectionMetaEntry> selectMappings = entry.getDetails();

        fieldTable = new String[selectMappings.size()];
        fieldStream = new String[selectMappings.size()];
        fieldFormatOk = new boolean[selectMappings.size()];

        for ( int row = 0; row < selectMappings.size(); row++ ) {
          StepInjectionMetaEntry selectField = selectMappings.get( row );

          List<StepInjectionMetaEntry> fieldAttributes = selectField.getDetails();
          //CHECKSTYLE:Indentation:OFF
          for ( int i = 0; i < fieldAttributes.size(); i++ ) {
            StepInjectionMetaEntry fieldAttribute = fieldAttributes.get( i );
            KettleAttributeInterface fieldAttr = findAttribute( fieldAttribute.getKey() );

            Object attributeValue = fieldAttribute.getValue();

            if ( attributeValue == null ) {
              continue;
            }

            if ( fieldAttr.getKey().equals( "STREAMNAME" ) ) {
              getFieldStream()[row] = (String) attributeValue;
            } else if ( fieldAttr.getKey().equals( "FIELDNAME" ) ) {
              getFieldTable()[row] = (String) attributeValue;
            } else if ( fieldAttr.getKey().equals( "FIELD_FORMAT_OK" ) ) {
              getFieldFormatOk()[row] = (Boolean) attributeValue;
            } else {
              throw new RuntimeException( "Unhandled metadata injection of attribute: "
                  + fieldAttr.toString() + " - " + fieldAttr.getDescription() );
            }
          }
        }
      }
      if ( !Utils.isEmpty( getFieldStream() ) ) {
        for ( int i = 0; i < getFieldStream().length; i++ ) {
          logDetailed( "row " + Integer.toString( i ) + ": stream=" + getFieldStream()[i]
              + " : table=" + getFieldTable()[i] );
        }
      }

    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:81,代码来源:MonetDBBulkLoaderMeta.java


注:本文中的org.pentaho.di.core.KettleAttributeInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。