Java Code Examples for org.pentaho.di.core.xml.XMLHandler#getTagValue()

The following examples show how to use org.pentaho.di.core.xml.XMLHandler#getTagValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClusterSchema.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public ClusterSchema( Node clusterSchemaNode, List<SlaveServer> referenceSlaveServers ) {
  this();

  name = XMLHandler.getTagValue( clusterSchemaNode, "name" );
  basePort = XMLHandler.getTagValue( clusterSchemaNode, "base_port" );
  socketsBufferSize = XMLHandler.getTagValue( clusterSchemaNode, "sockets_buffer_size" );
  socketsFlushInterval = XMLHandler.getTagValue( clusterSchemaNode, "sockets_flush_interval" );
  socketsCompressed = "Y".equalsIgnoreCase( XMLHandler.getTagValue( clusterSchemaNode, "sockets_compressed" ) );
  dynamic = "Y".equalsIgnoreCase( XMLHandler.getTagValue( clusterSchemaNode, "dynamic" ) );

  Node slavesNode = XMLHandler.getSubNode( clusterSchemaNode, "slaveservers" );
  int nrSlaves = XMLHandler.countNodes( slavesNode, "name" );
  for ( int i = 0; i < nrSlaves; i++ ) {
    Node serverNode = XMLHandler.getSubNodeByNr( slavesNode, "name", i );
    String serverName = XMLHandler.getNodeValue( serverNode );
    SlaveServer slaveServer = SlaveServer.findSlaveServer( referenceSlaveServers, serverName );
    if ( slaveServer != null ) {
      slaveServers.add( slaveServer );
    }
  }
}
 
Example 2
Source File: JobEntryFoldersCompare.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
  Repository rep, IMetaStore metaStore ) throws KettleXMLException {
  try {
    super.loadXML( entrynode, databases, slaveServers );
    includesubfolders = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "include_subfolders" ) );
    comparefilecontent = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "compare_filecontent" ) );
    comparefilesize = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "compare_filesize" ) );

    compareonly = XMLHandler.getTagValue( entrynode, "compareonly" );
    wildcard = XMLHandler.getTagValue( entrynode, "wildcard" );
    filename1 = XMLHandler.getTagValue( entrynode, "filename1" );
    filename2 = XMLHandler.getTagValue( entrynode, "filename2" );
  } catch ( KettleXMLException xe ) {
    throw new KettleXMLException( BaseMessages.getString( PKG, "JobFoldersCompare.Meta.UnableLoadXML", xe
      .getMessage() ) );
  }
}
 
Example 3
Source File: AbortMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void readData( Node stepnode ) throws KettleXMLException {
  try {
    rowThreshold = XMLHandler.getTagValue( stepnode, "row_threshold" );
    message = XMLHandler.getTagValue( stepnode, "message" );
    alwaysLogRows = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "always_log_rows" ) );
    String abortOptionString = XMLHandler.getTagValue( stepnode, "abort_option" );
    if ( !isEmpty( abortOptionString ) ) {
      abortOption = AbortOption.valueOf( abortOptionString );
    } else {
      // Backwards compatibility
      String awe = XMLHandler.getTagValue( stepnode, "abort_with_error" );
      if ( awe == null ) {
        awe = "Y"; // existing transformations will have to maintain backward compatibility with yes
      }
      abortOption = "Y".equalsIgnoreCase( awe ) ? AbortOption.ABORT_WITH_ERROR : AbortOption.ABORT;
    }
  } catch ( Exception e ) {
    throw new KettleXMLException( BaseMessages.getString(
      PKG, "AbortMeta.Exception.UnexpectedErrorInReadingStepInfoFromRepository" ), e );
  }
}
 
Example 4
Source File: XsdValidatorMeta.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
private void readData( Node stepnode ) throws KettleXMLException {
  try {

    xsdFilename = XMLHandler.getTagValue( stepnode, "xdsfilename" );
    xmlStream = XMLHandler.getTagValue( stepnode, "xmlstream" );
    resultFieldname = XMLHandler.getTagValue( stepnode, "resultfieldname" );
    xsdDefinedField = XMLHandler.getTagValue( stepnode, "xsddefinedfield" );
    xsdSource = XMLHandler.getTagValue( stepnode, "xsdsource" );

    addValidationMessage = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "addvalidationmsg" ) );

    validationMessageField = XMLHandler.getTagValue( stepnode, "validationmsgfield" );
    ifXmlValid = XMLHandler.getTagValue( stepnode, "ifxmlvalid" );
    ifXmlInvalid = XMLHandler.getTagValue( stepnode, "ifxmlunvalid" );
    outputStringField = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "outputstringfield" ) );
    xmlSourceFile = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "xmlsourcefile" ) );
    allowExternalEntities = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "allowExternalEntities" ) );

  } catch ( Exception e ) {
    throw new KettleXMLException( BaseMessages.getString( PKG,
        "XsdValidatorMeta.Exception.UnableToLoadStepInfoFromXML" ), e );
  }
}
 
Example 5
Source File: JobEntryExportRepository.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
  Repository rep, IMetaStore metaStore ) throws KettleXMLException {
  try {
    super.loadXML( entrynode, databases, slaveServers );
    repositoryname = XMLHandler.getTagValue( entrynode, "repositoryname" );
    username = XMLHandler.getTagValue( entrynode, "username" );
    password = Encr.decryptPasswordOptionallyEncrypted( XMLHandler.getTagValue( entrynode, "password" ) );
    targetfilename = XMLHandler.getTagValue( entrynode, "targetfilename" );
    iffileexists = XMLHandler.getTagValue( entrynode, "iffileexists" );
    export_type = XMLHandler.getTagValue( entrynode, "export_type" );
    directoryPath = XMLHandler.getTagValue( entrynode, "directoryPath" );
    add_date = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "add_date" ) );
    add_time = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "add_time" ) );
    SpecifyFormat = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "SpecifyFormat" ) );
    date_time_format = XMLHandler.getTagValue( entrynode, "date_time_format" );
    createfolder = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "createfolder" ) );
    newfolder = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "newfolder" ) );
    add_result_filesname = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "add_result_filesname" ) );
    nr_errors_less_than = XMLHandler.getTagValue( entrynode, "nr_errors_less_than" );
    success_condition = XMLHandler.getTagValue( entrynode, "success_condition" );

  } catch ( KettleXMLException xe ) {
    throw new KettleXMLException( BaseMessages.getString( PKG, "JobExportRepository.Meta.UnableLoadXML" ), xe );
  }
}
 
Example 6
Source File: JobEntryColumnsExist.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
public void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
  Repository rep, IMetaStore metaStore ) throws KettleXMLException {
  try {
    super.loadXML( entrynode, databases, slaveServers );
    tablename = XMLHandler.getTagValue( entrynode, "tablename" );
    schemaname = XMLHandler.getTagValue( entrynode, "schemaname" );

    String dbname = XMLHandler.getTagValue( entrynode, "connection" );
    connection = DatabaseMeta.findDatabase( databases, dbname );

    Node fields = XMLHandler.getSubNode( entrynode, "fields" );

    // How many field arguments?
    int nrFields = XMLHandler.countNodes( fields, "field" );
    allocate( nrFields );

    // Read them all...
    for ( int i = 0; i < nrFields; i++ ) {
      Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );
      arguments[i] = XMLHandler.getTagValue( fnode, "name" );
    }

  } catch ( KettleException e ) {
    throw new KettleXMLException( BaseMessages.getString( PKG, "JobEntryColumnsExist.Meta.UnableLoadXml" ), e );
  }
}
 
Example 7
Source File: JobEntryWaitForFile.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
  Repository rep, IMetaStore metaStore ) throws KettleXMLException {
  try {
    super.loadXML( entrynode, databases, slaveServers );
    filename = XMLHandler.getTagValue( entrynode, "filename" );
    maximumTimeout = XMLHandler.getTagValue( entrynode, "maximum_timeout" );
    checkCycleTime = XMLHandler.getTagValue( entrynode, "check_cycle_time" );
    successOnTimeout = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "success_on_timeout" ) );
    fileSizeCheck = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "file_size_check" ) );
    addFilenameToResult = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "add_filename_result" ) );
  } catch ( KettleXMLException xe ) {
    throw new KettleXMLException( "Unable to load job entry of type 'wait for file' from XML node", xe );
  }
}
 
Example 8
Source File: JobEntryDTDValidator.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, Repository rep,
    IMetaStore metaStore ) throws KettleXMLException {

  try {
    super.loadXML( entrynode, databases, slaveServers );
    xmlfilename = XMLHandler.getTagValue( entrynode, "xmlfilename" );
    dtdfilename = XMLHandler.getTagValue( entrynode, "dtdfilename" );
    dtdintern = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "dtdintern" ) );

  } catch ( KettleXMLException xe ) {
    throw new KettleXMLException( "Unable to load job entry of type 'DTDvalidator' from XML node", xe );
  }
}
 
Example 9
Source File: ReplaceStringMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void readData( Node stepnode, List<? extends SharedObjectInterface> databases ) throws KettleXMLException {
  try {
    int nrkeys;

    Node lookup = XMLHandler.getSubNode( stepnode, "fields" );
    nrkeys = XMLHandler.countNodes( lookup, "field" );

    allocate( nrkeys );

    for ( int i = 0; i < nrkeys; i++ ) {
      Node fnode = XMLHandler.getSubNodeByNr( lookup, "field", i );

      fieldInStream[i] = Const.NVL( XMLHandler.getTagValue( fnode, "in_stream_name" ), "" );
      fieldOutStream[i] = Const.NVL( XMLHandler.getTagValue( fnode, "out_stream_name" ), "" );
      useRegEx[i] = getFlagFromString( Const.NVL( XMLHandler.getTagValue( fnode, "use_regex" ), "" ) );
      replaceString[i] = Const.NVL( XMLHandler.getTagValue( fnode, "replace_string" ), "" );
      replaceByString[i] = Const.NVL( XMLHandler.getTagValue( fnode, "replace_by_string" ), "" );
      String emptyString = XMLHandler.getTagValue( fnode, "set_empty_string" );

      setEmptyString[i] = !Utils.isEmpty( emptyString ) && "Y".equalsIgnoreCase( emptyString );
      replaceFieldByString[i] = Const.NVL( XMLHandler.getTagValue( fnode, "replace_field_by_string" ), "" );
      wholeWord[i] = getFlagFromString( Const.NVL( XMLHandler.getTagValue( fnode, "whole_word" ), "" ) );
      caseSensitive[i] =
        getFlagFromString( Const.NVL( XMLHandler.getTagValue( fnode, "case_sensitive" ), "" ) );
      isUnicode[i] =
        getFlagFromString( Const.NVL( XMLHandler.getTagValue( fnode, "is_unicode" ), "" ) );

    }
  } catch ( Exception e ) {
    throw new KettleXMLException( BaseMessages.getString(
      PKG, "ReplaceStringMeta.Exception.UnableToReadStepInfoFromXML" ), e );
  }
}
 
Example 10
Source File: ConcatFieldsMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
@Override
public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException {
  super.loadXML( stepnode, databases, metaStore );
  targetFieldName = XMLHandler.getTagValue( stepnode, ConcatFieldsNodeNameSpace, "targetFieldName" );
  targetFieldLength =
    Const.toInt( XMLHandler.getTagValue( stepnode, ConcatFieldsNodeNameSpace, "targetFieldLength" ), 0 );
  removeSelectedFields =
    "Y"
      .equalsIgnoreCase( XMLHandler
        .getTagValue( stepnode, ConcatFieldsNodeNameSpace, "removeSelectedFields" ) );

  // PDI-18028: Avoid fileName handling!
  super.setFileName( StringUtil.EMPTY_STRING );
  super.setFileNameInField( false );
}
 
Example 11
Source File: SalesforceUpdateMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void readData( Node stepnode ) throws KettleXMLException {
  try {
    setBatchSize( XMLHandler.getTagValue( stepnode, "batchSize" ) );

    Node fields = XMLHandler.getSubNode( stepnode, "fields" );
    int nrFields = XMLHandler.countNodes( fields, "field" );

    allocate( nrFields );

    for ( int i = 0; i < nrFields; i++ ) {
      Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );

      updateLookup[i] = XMLHandler.getTagValue( fnode, "name" );
      updateStream[i] = XMLHandler.getTagValue( fnode, "field" );
      if ( updateStream[i] == null ) {
        updateStream[i] = updateLookup[i]; // default: the same name!
      }
      String updateValue = XMLHandler.getTagValue( fnode, "useExternalId" );
      if ( updateValue == null ) {
        // default FALSE
        useExternalId[i] = Boolean.FALSE;
      } else {
        if ( updateValue.equalsIgnoreCase( "Y" ) ) {
          useExternalId[i] = Boolean.TRUE;
        } else {
          useExternalId[i] = Boolean.FALSE;
        }
      }

    }
    setRollbackAllChangesOnError(
      "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, "rollbackAllChangesOnError" ) ) );
  } catch ( Exception e ) {
    throw new KettleXMLException( "Unable to load step info from XML", e );
  }
}
 
Example 12
Source File: PrioritizeStreamsMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void readData( Node stepnode, List<? extends SharedObjectInterface> databases ) throws KettleXMLException {
  try {
    Node steps = XMLHandler.getSubNode( stepnode, "steps" );
    int nrsteps = XMLHandler.countNodes( steps, "step" );

    allocate( nrsteps );

    for ( int i = 0; i < nrsteps; i++ ) {
      Node fnode = XMLHandler.getSubNodeByNr( steps, "step", i );
      stepName[i] = XMLHandler.getTagValue( fnode, "name" );
    }
  } catch ( Exception e ) {
    throw new KettleXMLException( "Unable to load step info from XML", e );
  }
}
 
Example 13
Source File: MultiMergeJoinMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void readData( Node stepnode ) throws KettleXMLException {
  try {

    Node keysNode = XMLHandler.getSubNode( stepnode, "keys" );

    int nrKeys = XMLHandler.countNodes( keysNode, "key" );

    allocateKeys( nrKeys );

    for ( int i = 0; i < nrKeys; i++ ) {
      Node keynode = XMLHandler.getSubNodeByNr( keysNode, "key", i );
      keyFields[i] = XMLHandler.getNodeValue( keynode );
    }

    int nInputStreams = Integer.parseInt( XMLHandler.getTagValue( stepnode, "number_input" ) );

    allocateInputSteps( nInputStreams );

    for ( int i = 0; i < nInputStreams; i++ ) {
      inputSteps[i] = XMLHandler.getTagValue( stepnode, "step" + i );
    }

    joinType = XMLHandler.getTagValue( stepnode, "join_type" );
  } catch ( Exception e ) {
    throw new KettleXMLException( BaseMessages.getString( PKG, "MultiMergeJoinMeta.Exception.UnableToLoadStepInfo" ),
        e );
  }
}
 
Example 14
Source File: JobEntryMSAccessBulkLoad.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void loadXML( Node entrynode, List<DatabaseMeta> databases, List<SlaveServer> slaveServers,
  Repository rep, IMetaStore metaStore ) throws KettleXMLException {
  try {
    super.loadXML( entrynode, databases, slaveServers );
    include_subfolders = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "include_subfolders" ) );
    add_result_filenames = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "add_result_filenames" ) );
    is_args_from_previous = "Y".equalsIgnoreCase( XMLHandler.getTagValue( entrynode, "is_args_from_previous" ) );

    limit = XMLHandler.getTagValue( entrynode, "limit" );
    success_condition = XMLHandler.getTagValue( entrynode, "success_condition" );
    Node fields = XMLHandler.getSubNode( entrynode, "fields" );

    // How many field arguments?
    int nrFields = XMLHandler.countNodes( fields, "field" );
    source_filefolder = new String[nrFields];
    delimiter = new String[nrFields];
    source_wildcard = new String[nrFields];
    target_Db = new String[nrFields];
    target_table = new String[nrFields];

    // Read them all...
    for ( int i = 0; i < nrFields; i++ ) {
      Node fnode = XMLHandler.getSubNodeByNr( fields, "field", i );

      source_filefolder[i] = XMLHandler.getTagValue( fnode, "source_filefolder" );
      source_wildcard[i] = XMLHandler.getTagValue( fnode, "source_wildcard" );
      delimiter[i] = XMLHandler.getTagValue( fnode, "delimiter" );
      target_Db[i] = XMLHandler.getTagValue( fnode, "target_db" );
      target_table[i] = XMLHandler.getTagValue( fnode, "target_table" );
    }
  } catch ( KettleXMLException xe ) {
    throw new KettleXMLException( BaseMessages.getString( PKG, "JobEntryMSAccessBulkLoad.Meta.UnableLoadXML", xe
      .getMessage() ), xe );
  }
}
 
Example 15
Source File: Result.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Instantiates a new Result object from a DOM node
 *
 * @param node
 *          the DOM root node representing the desired Result
 * @throws KettleException
 *           if any errors occur during instantiation
 */
public Result( Node node ) throws KettleException {
  this();

  // First we read the metrics...
  //
  nrLinesInput = Const.toLong( XMLHandler.getTagValue( node, "lines_input" ), 0L );
  nrLinesOutput = Const.toLong( XMLHandler.getTagValue( node, "lines_output" ), 0L );
  nrLinesRead = Const.toLong( XMLHandler.getTagValue( node, "lines_read" ), 0L );
  nrLinesWritten = Const.toLong( XMLHandler.getTagValue( node, "lines_written" ), 0L );
  nrLinesUpdated = Const.toLong( XMLHandler.getTagValue( node, "lines_updated" ), 0L );
  nrLinesRejected = Const.toLong( XMLHandler.getTagValue( node, "lines_rejected" ), 0L );
  nrLinesDeleted = Const.toLong( XMLHandler.getTagValue( node, "lines_deleted" ), 0L );
  nrErrors = Const.toLong( XMLHandler.getTagValue( node, "nr_errors" ), 0L );
  nrFilesRetrieved = Const.toLong( XMLHandler.getTagValue( node, "nr_files_retrieved" ), 0L );
  entryNr = Const.toLong( XMLHandler.getTagValue( node, "entry_nr" ), 0L );

  // The high level results...
  //
  result = "Y".equalsIgnoreCase( XMLHandler.getTagValue( node, "result" ) );
  exitStatus = Integer.parseInt( XMLHandler.getTagValue( node, "exit_status" ) );
  stopped = "Y".equalsIgnoreCase( XMLHandler.getTagValue( node, "is_stopped" ) );

  logChannelId = XMLHandler.getTagValue( node, "log_channel_id" );
  logText = XMLHandler.getTagValue( node, "log_text" );

  elapsedTimeMillis = Const.toLong( XMLHandler.getTagValue( node, "elapsedTimeMillis" ), 0L );
  executionId = XMLHandler.getTagValue( node, "executionId" );

  // Now read back the result files...
  //
  Node resultFilesNode = XMLHandler.getSubNode( node, XML_FILES_TAG );
  int nrResultFiles = XMLHandler.countNodes( resultFilesNode, XML_FILE_TAG );
  for ( int i = 0; i < nrResultFiles; i++ ) {
    try {
      ResultFile resultFile = new ResultFile( XMLHandler.getSubNodeByNr( resultFilesNode, XML_FILE_TAG, i ) );
      resultFiles.put( resultFile.getFile().toString(), resultFile );
    } catch ( KettleFileException e ) {
      throw new KettleException( "Unexpected error reading back a ResultFile object from XML", e );
    }
  }

  // Let's also read back the result rows...
  //
  Node resultRowsNode = XMLHandler.getSubNode( node, XML_ROWS_TAG );
  List<Node> resultNodes = XMLHandler.getNodes( resultRowsNode, RowMeta.XML_DATA_TAG );
  if ( !resultNodes.isEmpty() ) {
    // OK, get the metadata first...
    //
    RowMeta rowMeta = new RowMeta( XMLHandler.getSubNode( resultRowsNode, RowMeta.XML_META_TAG ) );
    for ( Node resultNode : resultNodes ) {
      Object[] rowData = rowMeta.getRow( resultNode );
      rows.add( new RowMetaAndData( rowMeta, rowData ) );
    }
  }

}
 
Example 16
Source File: DatabaseMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
/**
 * Reads the information from an XML Node into this new database connection.
 *
 * @param con
 *          The Node to read the data from
 * @throws KettleXMLException
 */
public DatabaseMeta( Node con ) throws KettleXMLException {
  this();

  try {
    String type = XMLHandler.getTagValue( con, "type" );
    try {
      databaseInterface = getDatabaseInterface( type );

    } catch ( KettleDatabaseException kde ) {
      throw new KettleXMLException( "Unable to create new database interface", kde );
    }

    setName( XMLHandler.getTagValue( con, "name" ) );
    setDisplayName( getName() );
    setHostname( XMLHandler.getTagValue( con, "server" ) );
    String acc = XMLHandler.getTagValue( con, "access" );
    setAccessType( getAccessType( acc ) );

    setDBName( XMLHandler.getTagValue( con, "database" ) );

    // The DB port is read here too for backward compatibility! getName()
    //
    setDBPort( XMLHandler.getTagValue( con, "port" ) );
    setUsername( XMLHandler.getTagValue( con, "username" ) );
    setPassword( Encr.decryptPasswordOptionallyEncrypted( XMLHandler.getTagValue( con, "password" ) ) );
    setServername( XMLHandler.getTagValue( con, "servername" ) );
    setDataTablespace( XMLHandler.getTagValue( con, "data_tablespace" ) );
    setIndexTablespace( XMLHandler.getTagValue( con, "index_tablespace" ) );

    setReadOnly( Boolean.valueOf( XMLHandler.getTagValue( con, "read_only" ) ) );

    // Also, read the database attributes...
    Node attrsnode = XMLHandler.getSubNode( con, "attributes" );
    if ( attrsnode != null ) {
      List<Node> attrnodes = XMLHandler.getNodes( attrsnode, "attribute" );
      for ( Node attrnode : attrnodes ) {
        String code = XMLHandler.getTagValue( attrnode, "code" );
        String attribute = XMLHandler.getTagValue( attrnode, "attribute" );
        if ( code != null && attribute != null ) {
          databaseInterface.addAttribute( code, attribute );
        }
        getDatabasePortNumberString();
      }
    }
  } catch ( Exception e ) {
    throw new KettleXMLException( "Unable to load database connection info from XML node", e );
  }
}
 
Example 17
Source File: BeamTimestampMeta.java    From kettle-beam with Apache License 2.0 4 votes vote down vote up
@Override public void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException {
  fieldName = XMLHandler.getTagValue( stepnode, FIELD_NAME );
  readingTimestamp = "Y".equalsIgnoreCase( XMLHandler.getTagValue( stepnode, READ_TIMESTAMP ) );
}
 
Example 18
Source File: GaInputStepMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private boolean getBooleanAttributeFromNode( Node node, String tag ) {
  String sValue = XMLHandler.getTagValue( node, tag );
  return ( sValue != null && sValue.equalsIgnoreCase( "Y" ) );

}
 
Example 19
Source File: NotePadMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public NotePadMeta( Node notepadnode ) throws KettleXMLException {
  try {
    note = XMLHandler.getTagValue( notepadnode, "note" );
    String sxloc = XMLHandler.getTagValue( notepadnode, "xloc" );
    String syloc = XMLHandler.getTagValue( notepadnode, "yloc" );
    String swidth = XMLHandler.getTagValue( notepadnode, "width" );
    String sheight = XMLHandler.getTagValue( notepadnode, "heigth" );
    int x = Const.toInt( sxloc, 0 );
    int y = Const.toInt( syloc, 0 );
    this.location = new Point( x, y );
    this.width = Const.toInt( swidth, 0 );
    this.height = Const.toInt( sheight, 0 );
    this.selected = false;
    this.fontname = XMLHandler.getTagValue( notepadnode, "fontname" );
    this.fontsize = Const.toInt( XMLHandler.getTagValue( notepadnode, "fontsize" ), -1 );
    this.fontbold = "Y".equalsIgnoreCase( XMLHandler.getTagValue( notepadnode, "fontbold" ) );
    this.fontitalic = "Y".equalsIgnoreCase( XMLHandler.getTagValue( notepadnode, "fontitalic" ) );
    // font color
    this.fontcolorred = Const.toInt( XMLHandler.getTagValue( notepadnode, "fontcolorred" ), COLOR_RGB_BLACK_RED );
    this.fontcolorgreen =
      Const.toInt( XMLHandler.getTagValue( notepadnode, "fontcolorgreen" ), COLOR_RGB_BLACK_GREEN );
    this.fontcolorblue =
      Const.toInt( XMLHandler.getTagValue( notepadnode, "fontcolorblue" ), COLOR_RGB_BLACK_BLUE );
    // background color
    this.backgroundcolorred =
      Const.toInt( XMLHandler.getTagValue( notepadnode, "backgroundcolorred" ), COLOR_RGB_DEFAULT_BG_RED );
    this.backgroundcolorgreen =
      Const.toInt( XMLHandler.getTagValue( notepadnode, "backgroundcolorgreen" ), COLOR_RGB_DEFAULT_BG_GREEN );
    this.backgroundcolorblue =
      Const.toInt( XMLHandler.getTagValue( notepadnode, "backgroundcolorblue" ), COLOR_RGB_DEFAULT_BG_BLUE );
    // border color
    this.bordercolorred =
      Const.toInt( XMLHandler.getTagValue( notepadnode, "bordercolorred" ), COLOR_RGB_DEFAULT_BORDER_RED );
    this.bordercolorgreen =
      Const.toInt( XMLHandler.getTagValue( notepadnode, "bordercolorgreen" ), COLOR_RGB_DEFAULT_BORDER_GREEN );
    this.bordercolorblue =
      Const.toInt( XMLHandler.getTagValue( notepadnode, "bordercolorblue" ), COLOR_RGB_DEFAULT_BORDER_BLUE );
    this.drawshadow = "Y".equalsIgnoreCase( XMLHandler.getTagValue( notepadnode, "drawshadow" ) );
  } catch ( Exception e ) {
    throw new KettleXMLException( "Unable to read Notepad info from XML", e );
  }
}
 
Example 20
Source File: BooleanPluginProperty.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see at.aschauer.commons.pentaho.plugin.PluginProperty#loadXml(org.w3c.dom.Node)
 */
public void loadXml( final Node node ) {
  final String stringValue = XMLHandler.getTagValue( node, this.getKey() );
  this.setValue( BOOLEAN_STRING_TRUE.equalsIgnoreCase( stringValue ) );
}