org.pentaho.di.core.Counter Java Examples

The following examples show how to use org.pentaho.di.core.Counter. 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: KafkaProducerMeta.java    From pentaho-kafka-producer with Apache License 2.0 6 votes vote down vote up
public void readRep(Repository rep, ObjectId stepId, List<DatabaseMeta> databases, Map<String, Counter> counters)
		throws KettleException {
	try {
		topic = rep.getStepAttributeString(stepId, "TOPIC");
		messageField = rep.getStepAttributeString(stepId, "FIELD");
		keyField = rep.getStepAttributeString(stepId, "KEYFIELD");
		String kafkaPropsXML = rep.getStepAttributeString(stepId, "KAFKA");
		if (kafkaPropsXML != null) {
			kafkaProperties.loadFromXML(new ByteArrayInputStream(kafkaPropsXML.getBytes()));
		}
		// Support old versions:
		for (String name : KAFKA_PROPERTIES_NAMES) {
			String value = rep.getStepAttributeString(stepId, name);
			if (value != null) {
				kafkaProperties.put(name, value);
			}
		}
	} catch (Exception e) {
		throw new KettleException("KafkaProducerMeta.Exception.loadRep", e);
	}
}
 
Example #2
Source File: KafkaProducerMeta.java    From pentaho-kafka-producer with Apache License 2.0 6 votes vote down vote up
public void loadXML(Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters)
		throws KettleXMLException {

	try {
		topic = XMLHandler.getTagValue(stepnode, "TOPIC");
		messageField = XMLHandler.getTagValue(stepnode, "FIELD");
		keyField = XMLHandler.getTagValue(stepnode, "KEYFIELD");
		Node kafkaNode = XMLHandler.getSubNode(stepnode, "KAFKA");
		String[] kafkaElements = XMLHandler.getNodeElements(kafkaNode);
		if (kafkaElements != null) {
			for (String propName : kafkaElements) {
				String value = XMLHandler.getTagValue(kafkaNode, propName);
				if (value != null) {
					kafkaProperties.put(propName, value);
				}
			}
		}
	} catch (Exception e) {
		throw new KettleXMLException(Messages.getString("KafkaProducerMeta.Exception.loadXml"), e);
	}
}
 
Example #3
Source File: CassandraInputMeta.java    From learning-hadoop with Apache License 2.0 6 votes vote down vote up
public void readRep(Repository rep, ObjectId id_step,
    List<DatabaseMeta> databases, Map<String, Counter> counters)
    throws KettleException {
  m_cassandraHost = rep.getStepAttributeString(id_step, 0, "cassandra_host");
  m_cassandraPort = rep.getStepAttributeString(id_step, 0, "cassandra_port");
  m_username = rep.getStepAttributeString(id_step, 0, "username");
  m_password = rep.getStepAttributeString(id_step, 0, "password");
  if (!Const.isEmpty(m_password)) {
    m_password = Encr.decryptPasswordOptionallyEncrypted(m_password);
  }
  m_cassandraKeyspace = rep.getStepAttributeString(id_step, 0,
      "cassandra_keyspace");
  m_cqlSelectQuery = rep.getStepAttributeString(id_step, 0,
      "cql_select_query");
  m_useCompression = rep.getStepAttributeBoolean(id_step, 0,
      "use_compression");

  m_outputKeyValueTimestampTuples = rep.getStepAttributeBoolean(id_step, 0,
      "output_key_value_timestamp_tuples");
  m_useThriftIO = rep.getStepAttributeBoolean(id_step, 0, "use_thrift_io");

  m_socketTimeout = rep.getStepAttributeString(id_step, 0, "socket_timeout");
}
 
Example #4
Source File: CassandraOutputMeta.java    From learning-hadoop with Apache License 2.0 5 votes vote down vote up
public void readRep(Repository rep, ObjectId id_step,
    List<DatabaseMeta> databases, Map<String, Counter> counters)
    throws KettleException {
  m_cassandraHost = rep.getStepAttributeString(id_step, 0, "cassandra_host");
  m_cassandraPort = rep.getStepAttributeString(id_step, 0, "cassandra_port");
  m_schemaHost = rep.getStepAttributeString(id_step, 0, "schema_host");
  m_schemaPort = rep.getStepAttributeString(id_step, 0, "schema_port");
  m_socketTimeout = rep.getStepAttributeString(id_step, 0, "socket_timeout");
  m_username = rep.getStepAttributeString(id_step, 0, "username");
  m_password = rep.getStepAttributeString(id_step, 0, "password");
  if (!Const.isEmpty(m_password)) {
    m_password = Encr.decryptPasswordOptionallyEncrypted(m_password);
  }
  m_cassandraKeyspace = rep.getStepAttributeString(id_step, 0,
      "cassandra_keyspace");
  m_columnFamily = rep.getStepAttributeString(id_step, 0, "column_family");
  m_keyField = rep.getStepAttributeString(id_step, 0, "key_field");
  m_consistency = rep.getStepAttributeString(id_step, 0, "consistency");
  m_batchSize = rep.getStepAttributeString(id_step, 0, "batch_size");
  m_cqlBatchTimeout = rep.getStepAttributeString(id_step, 0,
      "cql_batch_timeout");
  m_cqlSubBatchSize = rep.getStepAttributeString(id_step, 0,
      "cql_sub_batch_size");

  m_createColumnFamily = rep.getStepAttributeBoolean(id_step, 0,
      "create_column_family");
  m_useCompression = rep.getStepAttributeBoolean(id_step, 0,
      "use_compression");
  m_insertFieldsNotInMeta = rep.getStepAttributeBoolean(id_step, 0,
      "insert_fields_not_in_meta");
  m_updateCassandraMeta = rep.getStepAttributeBoolean(id_step, 0,
      "update_cassandra_meta");
  m_truncateColumnFamily = rep.getStepAttributeBoolean(id_step, 0,
      "truncate_column_family");

  m_aprioriCQL = rep.getStepAttributeString(id_step, 0, "apriori_cql");

  m_useThriftIO = rep.getStepAttributeBoolean(id_step, 0, "use_thrift_io");
  asIndexColumn = rep.getStepAttributeBoolean(id_step, 0, "asIndexColumn");
}
 
Example #5
Source File: ShapeFileReaderMeta.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
public void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases, Map<String, Counter> counters )
  throws KettleException {
  try {
    shapeFilename = rep.getStepAttributeString( id_step, "shapefilename" );
    dbfFilename = rep.getStepAttributeString( id_step, "dbffilename" );
    encoding = rep.getStepAttributeString( id_step, "encoding" );
  } catch ( Exception e ) {
    throw new KettleException( "Unexpected error reading step information from the repository", e );
  }

}
 
Example #6
Source File: CassandraInputMeta.java    From learning-hadoop with Apache License 2.0 5 votes vote down vote up
public void loadXML(Node stepnode, List<DatabaseMeta> databases,
    Map<String, Counter> counters) throws KettleXMLException {
  m_cassandraHost = XMLHandler.getTagValue(stepnode, "cassandra_host");
  m_cassandraPort = XMLHandler.getTagValue(stepnode, "cassandra_port");
  m_username = XMLHandler.getTagValue(stepnode, "username");
  m_password = XMLHandler.getTagValue(stepnode, "password");
  if (!Const.isEmpty(m_password)) {
    m_password = Encr.decryptPasswordOptionallyEncrypted(m_password);
  }
  m_cassandraKeyspace = XMLHandler
      .getTagValue(stepnode, "cassandra_keyspace");
  m_cqlSelectQuery = XMLHandler.getTagValue(stepnode, "cql_select_query");
  m_useCompression = XMLHandler.getTagValue(stepnode, "use_compression")
      .equalsIgnoreCase("Y");

  String kV = XMLHandler.getTagValue(stepnode,
      "output_key_value_timestamp_tuples");

  if (kV != null) {
    m_outputKeyValueTimestampTuples = kV.equalsIgnoreCase("Y");
  }

  String thrift = XMLHandler.getTagValue(stepnode, "use_thrift_io");
  if (thrift != null) {
    m_useThriftIO = thrift.equalsIgnoreCase("Y");
  }

  m_socketTimeout = XMLHandler.getTagValue(stepnode, "socket_timeout");
}
 
Example #7
Source File: SSTableOutputMeta.java    From learning-hadoop with Apache License 2.0 5 votes vote down vote up
public void readRep(Repository rep, ObjectId id_step,
    List<DatabaseMeta> databases, Map<String, Counter> counters)
    throws KettleException {
  m_yamlPath = rep.getStepAttributeString(id_step, 0, "yaml_path");
  directory = rep.getStepAttributeString(id_step, 0, "output_directory");
  cassandraKeyspace = rep.getStepAttributeString(id_step, 0,
      "cassandra_keyspace");
  columnFamily = rep.getStepAttributeString(id_step, 0, "column_family");
  keyField = rep.getStepAttributeString(id_step, 0, "key_field");
  bufferSize = rep.getStepAttributeString(id_step, 0, "buffer_size_mb");
}
 
Example #8
Source File: SSTableOutputMeta.java    From learning-hadoop with Apache License 2.0 5 votes vote down vote up
public void loadXML(Node stepnode, List<DatabaseMeta> databases,
    Map<String, Counter> counters) throws KettleXMLException {
  m_yamlPath = XMLHandler.getTagValue(stepnode, "yaml_path");
  directory = XMLHandler.getTagValue(stepnode, "output_directory");
  cassandraKeyspace = XMLHandler.getTagValue(stepnode, "cassandra_keyspace");
  columnFamily = XMLHandler.getTagValue(stepnode, "column_family");
  keyField = XMLHandler.getTagValue(stepnode, "key_field");
  bufferSize = XMLHandler.getTagValue(stepnode, "buffer_size_mb");
}
 
Example #9
Source File: CassandraOutputMeta.java    From learning-hadoop with Apache License 2.0 5 votes vote down vote up
public void loadXML(Node stepnode, List<DatabaseMeta> databases,
    Map<String, Counter> counters) throws KettleXMLException {
  m_cassandraHost = XMLHandler.getTagValue(stepnode, "cassandra_host");
  m_cassandraPort = XMLHandler.getTagValue(stepnode, "cassandra_port");
  m_schemaHost = XMLHandler.getTagValue(stepnode, "schema_host");
  m_schemaPort = XMLHandler.getTagValue(stepnode, "schema_port");
  m_socketTimeout = XMLHandler.getTagValue(stepnode, "socket_timeout");
  m_username = XMLHandler.getTagValue(stepnode, "username");
  m_password = XMLHandler.getTagValue(stepnode, "password");
  m_cassandraKeyspace = XMLHandler
      .getTagValue(stepnode, "cassandra_keyspace");
  m_columnFamily = XMLHandler.getTagValue(stepnode, "column_family");
  m_keyField = XMLHandler.getTagValue(stepnode, "key_field");
  m_consistency = XMLHandler.getTagValue(stepnode, "consistency");
  m_batchSize = XMLHandler.getTagValue(stepnode, "batch_size");
  m_cqlBatchTimeout = XMLHandler.getTagValue(stepnode, "cql_batch_timeout");
  m_cqlSubBatchSize = XMLHandler.getTagValue(stepnode, "cql_sub_batch_size");

  m_createColumnFamily = XMLHandler.getTagValue(stepnode,
      "create_column_family").equalsIgnoreCase("Y");
  m_useCompression = XMLHandler.getTagValue(stepnode, "use_compression")
      .equalsIgnoreCase("Y");
  m_insertFieldsNotInMeta = XMLHandler.getTagValue(stepnode,
      "insert_fields_not_in_meta").equalsIgnoreCase("Y");
  m_updateCassandraMeta = XMLHandler.getTagValue(stepnode,
      "update_cassandra_meta").equalsIgnoreCase("Y");
  m_truncateColumnFamily = XMLHandler.getTagValue(stepnode,
      "truncate_column_family").equalsIgnoreCase("Y");

  m_aprioriCQL = XMLHandler.getTagValue(stepnode, "apriori_cql");

  String useThrift = XMLHandler.getTagValue(stepnode, "use_thrift_io");
  if (!Const.isEmpty(useThrift)) {
    m_useThriftIO = useThrift.equalsIgnoreCase("Y");
  }
  
  asIndexColumn = XMLHandler.getTagValue(stepnode, "asIndexColumn").
	      equalsIgnoreCase("Y");
}
 
Example #10
Source File: Trans.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public Hashtable<String, Counter> getCounters() {
  return counters;
}
 
Example #11
Source File: Trans.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void setCounters( Hashtable<String, Counter> counters ) {
  this.counters = counters;
}
 
Example #12
Source File: BaseStepMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
@Deprecated
public void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases,
                     Map<String, Counter> counters ) throws KettleException {
  // provided for API (compile & runtime) compatibility with v4
}
 
Example #13
Source File: Database.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public synchronized Long getNextValue( Hashtable<String, Counter> counters, String tableName, String valKey )
  throws KettleDatabaseException {
  return getNextValue( counters, null, tableName, valKey );
}
 
Example #14
Source File: ShapeFileReaderMeta.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
public void loadXML( Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters )
  throws KettleXMLException {
  readData( stepnode );
}
 
Example #15
Source File: StepMetaInterface.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * Load the values for this step from an XML Node
 *
 * @param stepnode
 *          the Node to get the info from
 * @param databases
 *          The available list of databases to reference to
 * @param counters
 *          Counters to reference.
 * @throws KettleXMLException
 *           When an unexpected XML error occurred. (malformed etc.)
 * @deprecated use {@link #loadXML(Node, List, IMetaStore)}
 */
@Deprecated
void loadXML( Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters ) throws KettleXMLException;
 
Example #16
Source File: StepMetaInterface.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * Read the steps information from a Kettle repository
 *
 * @param rep
 *          The repository to read from
 * @param id_step
 *          The step ID
 * @param databases
 *          The databases to reference
 * @param counters
 *          The counters to reference
 * @throws KettleException
 *           When an unexpected error occurred (database, network, etc)
 * @deprecated use {@link #readRep(Repository, IMetaStore, ObjectId, List)}
 */
@Deprecated
void readRep( Repository rep, ObjectId id_step, List<DatabaseMeta> databases,
  Map<String, Counter> counters ) throws KettleException;
 
Example #17
Source File: StepMeta.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * Read the step data from XML
 *
 * @param stepnode
 *          The XML step node.
 * @param databases
 *          A list of databases
 * @param counters
 *          A map with all defined counters.
 * @deprecated use {@link #StepMeta(Node, List, IMetaStore)}
 */
@Deprecated
public StepMeta( Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters )
  throws KettleXMLException, KettlePluginLoaderException {
  this( stepnode, databases, (IMetaStore) null );
}
 
Example #18
Source File: StepMeta.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * Just in case we missed a v4 plugin using deprecated methods.
 *
 * @param stepMetaInterface2
 * @param stepnode
 * @param databases
 * @throws KettleXMLException
 */
@SuppressWarnings( "deprecation" )
private void loadXmlCompatibleStepMeta( StepMetaInterface stepMetaInterface2, Node stepnode,
    List<DatabaseMeta> databases ) throws KettleXMLException {
  stepMetaInterface.loadXML( stepnode, databases, new HashMap<String, Counter>() );
}
 
Example #19
Source File: BaseStepMeta.java    From pentaho-kettle with Apache License 2.0 2 votes vote down vote up
/**
 * @param stepnode
 * @param databases
 * @throws KettleXMLException
 * @deprecated use {@link #loadXML(Node, List, IMetaStore)}
 */
@Deprecated
public void loadXML( Node stepnode, List<DatabaseMeta> databases, Map<String, Counter> counters )
  throws KettleXMLException {
  // provided for API (compile & runtime) compatibility with v4
}