public void setDefault() { schemaName = ""; // $NON-NLS-1$ tablename = Messages.getString( "ConcurrentCombinationLookupMeta.DimensionTableName.Label"); //$NON-NLS-1$ databaseReadMeta = null; databaseWriteMeta = null; commitSize = 100; cacheSize = DEFAULT_CACHE_SIZE; replaceFields = false; useHash = false; hashField = "hashcode"; // $NON-NLS-1$ int nrkeys = 0; allocate(nrkeys); // Read keys to dimension for (int i = 0; i < nrkeys; i++) { keyField[i] = "key" + i; // $NON-NLS-1$ keyLookup[i] = "keylookup" + i; // $NON-NLS-1$ } technicalKeyField = "technical/surrogate key field"; // $NON-NLS-1$ useAutoinc = false; }
private void readData(Node stepnode, List<? extends SharedObjectInterface> databases) throws KettleXMLException { try { String commit, csize; schemaName = XMLHandler.getTagValue(stepnode, "schema"); // $NON-NLS-1$ tablename = XMLHandler.getTagValue(stepnode, "table"); // $NON-NLS-1$ String con = XMLHandler.getTagValue(stepnode, "connectionRead"); // $NON-NLS-1$ databaseReadMeta = DatabaseMeta.findDatabase(databases, con); con = XMLHandler.getTagValue(stepnode, "connectionWrite"); // $NON-NLS-1$ databaseWriteMeta = DatabaseMeta.findDatabase(databases, con); commit = XMLHandler.getTagValue(stepnode, "commit"); // $NON-NLS-1$ commitSize = Const.toInt(commit, 0); csize = XMLHandler.getTagValue(stepnode, "cache_size"); // $NON-NLS-1$ cacheSize = Const.toInt(csize, 0); replaceFields = "Y" .equalsIgnoreCase( XMLHandler.getTagValue(stepnode, "replace")); // $NON-NLS-1$ //$NON-NLS-2$ useHash = "Y" .equalsIgnoreCase( XMLHandler.getTagValue(stepnode, "crc")); // $NON-NLS-1$ //$NON-NLS-2$ hashField = XMLHandler.getTagValue(stepnode, "crcfield"); // $NON-NLS-1$ Node keys = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$ int nrkeys = XMLHandler.countNodes(keys, "key"); // $NON-NLS-1$ allocate(nrkeys); // Read keys to dimension for (int i = 0; i < nrkeys; i++) { Node knode = XMLHandler.getSubNodeByNr(keys, "key", i); // $NON-NLS-1$ keyField[i] = XMLHandler.getTagValue(knode, "name"); // $NON-NLS-1$ keyLookup[i] = XMLHandler.getTagValue(knode, "lookup"); // $NON-NLS-1$ } // If this is empty: use auto-increment field! sequenceFrom = XMLHandler.getTagValue(stepnode, "sequence"); // $NON-NLS-1$ Node fields = XMLHandler.getSubNode(stepnode, "fields"); // $NON-NLS-1$ Node retkey = XMLHandler.getSubNode(fields, "return"); // $NON-NLS-1$ technicalKeyField = XMLHandler.getTagValue(retkey, "name"); // $NON-NLS-1$ useAutoinc = !"N" .equalsIgnoreCase( XMLHandler.getTagValue(retkey, "use_autoinc")); // $NON-NLS-1$ //$NON-NLS-2$ lastUpdateField = XMLHandler.getTagValue(stepnode, "last_update_field"); // $NON-NLS-1$ setTechKeyCreation(XMLHandler.getTagValue(retkey, "creation_method")); // $NON-NLS-1$ } catch (Exception e) { throw new KettleXMLException( Messages.getString("ConcurrentCombinationLookupMeta.Exception.UnableToLoadStepInfo"), e); //$NON-NLS-1$ } }
public Object clone() { CombinationLookupMeta retval = (CombinationLookupMeta) super.clone(); int nrkeys = keyField.length; retval.allocate(nrkeys); // Read keys to dimension for (int i = 0; i < nrkeys; i++) { retval.keyField[i] = keyField[i]; retval.keyLookup[i] = keyLookup[i]; } return retval; }
public void readRep( Repository rep, long id_step, List<DatabaseMeta> databases, Map<String, Counter> counters) throws KettleException { try { long id_connection = rep.getStepAttributeInteger(id_step, "id_connection_read"); // $NON-NLS-1$ databaseReadMeta = DatabaseMeta.findDatabase(databases, id_connection); id_connection = rep.getStepAttributeInteger(id_step, "id_connection_write"); // $NON-NLS-1$ databaseWriteMeta = DatabaseMeta.findDatabase(databases, id_connection); schemaName = rep.getStepAttributeString(id_step, "schema"); // $NON-NLS-1$ tablename = rep.getStepAttributeString(id_step, "table"); // $NON-NLS-1$ commitSize = (int) rep.getStepAttributeInteger(id_step, "commit"); // $NON-NLS-1$ cacheSize = (int) rep.getStepAttributeInteger(id_step, "cache_size"); // $NON-NLS-1$ replaceFields = rep.getStepAttributeBoolean(id_step, "replace"); // $NON-NLS-1$ useHash = rep.getStepAttributeBoolean(id_step, "crc"); // $NON-NLS-1$ hashField = rep.getStepAttributeString(id_step, "crcfield"); // $NON-NLS-1$ int nrkeys = rep.countNrStepAttributes(id_step, "lookup_key_name"); // $NON-NLS-1$ allocate(nrkeys); for (int i = 0; i < nrkeys; i++) { keyField[i] = rep.getStepAttributeString(id_step, i, "lookup_key_name"); // $NON-NLS-1$ keyLookup[i] = rep.getStepAttributeString(id_step, i, "lookup_key_field"); // $NON-NLS-1$ } technicalKeyField = rep.getStepAttributeString(id_step, "return_name"); // $NON-NLS-1$ useAutoinc = rep.getStepAttributeBoolean(id_step, "use_autoinc"); // $NON-NLS-1$ sequenceFrom = rep.getStepAttributeString(id_step, "sequence"); // $NON-NLS-1$ techKeyCreation = rep.getStepAttributeString(id_step, "creation_method"); // $NON-NLS-1$ lastUpdateField = rep.getStepAttributeString(id_step, "last_update_field"); // $NON-NLS-1$ } catch (Exception e) { throw new KettleException( Messages.getString( "ConcurrentCombinationLookupMeta.Exception.UnexpectedErrorWhileReadingStepInfo"), e); //$NON-NLS-1$ } }