diff --git a/specification/marc21Loader/build.xml b/specification/marc21Loader/build.xml
deleted file mode 100644
index a24d7a0..0000000
--- a/specification/marc21Loader/build.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
- Build file for a PDI step plugin
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/specification/marc21Loader/pom.xml b/specification/marc21Loader/pom.xml
deleted file mode 100644
index 078cb55..0000000
--- a/specification/marc21Loader/pom.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-
- 4.0.0
-
-
- com.ucuenca
- specification
- 0.0.1-SNAPSHOT
-
-
- com.ucuenca.specification
- marc21-loader
- jar
-
- MARC21 Loader
-
-
-
- UTF-8
-
-
-
-
- default
- http://repo1.maven.org/maven2/
-
- false
-
-
-
-
- false
-
- central
- repo
- http://nexus.pentaho.org/content/groups/omni
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-antrun-plugin
- 1.7
-
-
- deploy-plugin
- package
-
- run
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 2.8
-
-
- copy
- prepare-package
-
- copy
-
-
-
-
- info.freelibrary
- freelib-marc4j
-
- 2.6.4-SNAPSHOT
- jar
- false
- ${project.build.directory}/lib
-
-
-
-
-
-
-
-
-
-
-
-
-
- src/main/resources
-
- plugin/*.*
-
-
-
- src/main/java
-
- **/*.properties
-
-
-
-
-
-
-
-
- junit
- junit
- 3.8.1
- test
-
-
-
- pentaho-kettle
- kettle-core
- ${pentaho.kettle.version}
-
-
-
- pentaho-kettle
- kettle-engine
- ${pentaho.kettle.version}
-
-
-
- pentaho-kettle
- kettle-ui-swt
- ${pentaho.kettle.version}
-
-
-
- xml-apis
- xml-apis
- ${xml.apis.version}
-
-
-
- org.eclipse.swt
- swt-linux-x86_64
- ${org.eclipse.swt.version}
-
-
-
- info.freelibrary
- freelib-marc4j
-
- 2.6.4-SNAPSHOT
-
-
-
-
diff --git a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21Loader.java b/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21Loader.java
deleted file mode 100755
index 06d4e8c..0000000
--- a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21Loader.java
+++ /dev/null
@@ -1,457 +0,0 @@
-package com.ucuenca.pentaho.plugin.step.marc21loader;
-
-import info.freelibrary.marc4j.converter.impl.AnselToUnicode;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.marc4j.MarcDirStreamReader;
-import org.marc4j.MarcStreamReader;
-import org.marc4j.MarcStreamWriter;
-import org.marc4j.MarcXmlWriter;
-import org.marc4j.marc.ControlField;
-import org.marc4j.marc.DataField;
-import org.marc4j.marc.Leader;
-import org.marc4j.marc.Record;
-import org.marc4j.marc.Subfield;
-import org.marc4j.util.MarcXmlDriver;
-import org.pentaho.di.core.Const;
-import org.pentaho.di.core.exception.KettleStepException;
-import org.pentaho.di.core.row.RowDataUtil;
-import org.pentaho.di.core.row.RowMeta;
-import org.pentaho.di.trans.Trans;
-import org.pentaho.di.trans.TransMeta;
-import org.pentaho.di.trans.step.BaseStep;
-import org.pentaho.di.trans.step.StepDataInterface;
-import org.pentaho.di.trans.step.StepInterface;
-import org.pentaho.di.trans.step.StepMeta;
-import org.pentaho.di.trans.step.StepMetaInterface;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.ucuenca.pentaho.plugin.step.marc21loader.util.MARC;
-import com.ucuenca.pentaho.plugin.step.marc21loader.util.MARC21;
-
-/**
- * This class is part of the demo step plug-in implementation.
- * It demonstrates the basics of developing a plug-in step for PDI.
- *
- * The demo step adds a new string field to the row stream and sets its
- * value to "Hello World!". The user may select the name of the new field.
- *
- * This class is the implementation of StepInterface.
- * Classes implementing this interface need to:
- *
- * - initialize the step
- * - execute the row processing logic
- * - dispose of the step
- *
- * Please do not create any local fields in a StepInterface class. Store any
- * information related to the processing logic in the supplied step data interface
- * instead.
- *
- */
-public class MARC21Loader extends BaseStep implements StepInterface {
-
- private MARC21LoaderMeta meta;
- private MARC21LoaderData data;
- private String mfn;
- DOMResult source;
- Result result;
-
- //private MarcStreamWriter writer;
-
- /**
- * The constructor should simply pass on its arguments to the parent class.
- *
- * @param s step description
- * @param stepDataInterface step data class
- * @param c step copy
- * @param t transformation description
- * @param dis transformation executing
- */
- public MARC21Loader(StepMeta s, StepDataInterface stepDataInterface, int c, TransMeta t, Trans dis)
- {
- super(s,stepDataInterface,c,t,dis);
- }
-
- /**
- * This method is called by PDI during transformation startup.
- *
- * It should initialize required for step execution.
- *
- * The meta and data implementations passed in can safely be cast
- * to the step's respective implementations.
- *
- * It is mandatory that super.init() is called to ensure correct behavior.
- *
- * Typical tasks executed here are establishing the connection to a database,
- * as wall as obtaining resources, like file handles.
- *
- * @param smi step meta interface implementation, containing the step settings
- * @param sdi step data interface implementation, used to store runtime information
- *
- * @return true if initialization completed successfully, false if there was an error preventing the step from working.
- *
- */
- public boolean init(StepMetaInterface smi, StepDataInterface sdi)
- {
- meta = (MARC21LoaderMeta)smi;
- data = (MARC21LoaderData)sdi;
-
-
- if (super.init(meta, data))
- {
- if (meta.getmarcFilename()==null ||
- meta.getmarcFields()==null ||
- meta.getmarcFilename().length()==0 ||
- meta.getmarcFields().length()==0
- )
- {
- logError("We need both a path file and a fields to search.");
- return false;
- }
- //marcfiles validation and listing
- meta.marcFilesValidator();
-
-
- //Lectura del archivo MARC
- FileInputStream in=null;
- try {
- for(File file:meta.getMarcfiles()) {
- logBasic("File to be processed: "+ file.getAbsoluteFile());
- in = new FileInputStream(file);
- data.marcfiles.add(new MarcStreamReader(in));
- }
- if(meta.getGenMARCXML()) {
- //String stylesheetUrl = "http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3.xsl";
- //Source stylesheet = new StreamSource(stylesheetUrl);
- logBasic("Step will Generate MARCXML from input");
- String out = meta.getmarcFilename().substring(0,
- meta.getmarcFilename().lastIndexOf(System.getProperty("file.separator"))+1);
-
- data.marcXmlOutfile = new MarcXmlWriter(new FileOutputStream(out + meta.getMarcxmlFilename()), true);
- result = new StreamResult(new FileOutputStream(out + meta.getMarcxmlFilename()));
- //data.marcXmlOutfile = new MarcXmlWriter(result, stylesheet);
- //source = new DOMResult();
- //data.marcXmlOutfile = new MarcXmlWriter(source);
- //AnselToUnicode converter = new AnselToUnicode();
- //data.marcXmlOutfile.setConverter(converter);
- //data.marcXmlOutfile.setUnicodeNormalization(true);
-
- //this.writer = new MarcStreamWriter(new FileOutputStream(out + "marcReg.mrc"));
- }
-
-
- } catch (FileNotFoundException e1) {
- // TODO Auto-generated catch block
- logError("FileNotFoundException " + e1);
- return false;
- }/*finally {
- try {
- in.close();
-
- } catch (IOException ex) {
- logError("IOException " + ex);
- //Logger.getLogger(PruebaMarc21.class.getName()).log(Level.SEVERE, null, ex);
- }
- }*/
- data.marcfilesIterator = data.marcfiles.iterator();
- data.processingMarcfile = data.marcfilesIterator.next();
- }
- return true;
- }
-
- /**
- * Once the transformation starts executing, the processRow() method is called repeatedly
- * by PDI for as long as it returns true. To indicate that a step has finished processing rows
- * this method must call setOutputDone() and return false;
- *
- * Steps which process incoming rows typically call getRow() to read a single row from the
- * input stream, change or add row content, call putRow() to pass the changed row on
- * and return true. If getRow() returns null, no more rows are expected to come in,
- * and the processRow() implementation calls setOutputDone() and returns false to
- * indicate that it is done too.
- *
- * Steps which generate rows typically construct a new row Object[] using a call to
- * RowDataUtil.allocateRowData(numberOfFields), add row content, and call putRow() to
- * pass the new row on. Above process may happen in a loop to generate multiple rows,
- * at the end of which processRow() would call setOutputDone() and return false;
- *
- * @param smi the step meta interface containing the step settings
- * @param sdi the step data interface that should be used to store
- *
- * @return true to indicate that the function should be called again, false if the step is done
- */
- public synchronized boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleStepException
- {
- meta = (MARC21LoaderMeta)smi;
- data = (MARC21LoaderData)sdi;
-
- boolean retval=true;
-
- data.processingMarcfile = !data.processingMarcfile.hasNext()
- && data.marcfilesIterator.hasNext() ?
- data.marcfilesIterator.next():data.processingMarcfile;
-
- if (!data.processingMarcfile.hasNext() && !data.marcfilesIterator.hasNext())
- {
- if(meta.getGenMARCXML()) {
- logBasic("MARCXML file generated with name: " + meta.getMarcxmlFilename());
- //writer.close();
- data.marcXmlOutfile.close();
- }
- setOutputDone();
- return false;
- }
-
- if (first)
- {
- first=false;
-
- // the size of the incoming rows
- //data.inputSize = getInputRowMeta().size();
-
- // determine output field structure
- data.outputRowMeta = new RowMeta();//(RowMetaInterface) getInputRowMeta().clone();
- meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
-
- }
-
- // building new row
- Object[] outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
- Integer outputIndex = 0;
-
- Record record = data.processingMarcfile.next();
- if(meta.getGenMARCXML()) {
- //writer.write(record);
- data.marcXmlOutfile.write(record);
- }
-
- this.getBasicControlFields(record, outputIndex);
- if(mfn.equals("000002") && log.isDebug()) {
- if(meta.getGenMARCXML()) {
- logDebug("Sample MARCXML file generated with name: " + meta.getMarcxmlFilename());
- //writer.close();
- data.marcXmlOutfile.close();
- }
- setOutputDone();
- return false;
- }
-
- //MARC fields reading
-
- String leer_campos = meta.getmarcFields();
- String[] campos = leer_campos.split("@");
- MARC21 obj_marc = new MARC21();
- int mfnInt=Integer.parseInt(mfn);
- String currentField = "";
- String subfields = "";
- for (int i = 0; i < campos.length; i++) {
- outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
- if (campos[i].length() == 4) {
- subfields = !currentField.equals(campos[i].substring(0, 3)) ? "":subfields;
- currentField = campos[i].substring(0, 3);
- subfields += campos[i].charAt(3);
-
- obj_marc=this.obtainField(record, mfnInt, currentField, subfields, campos[i].charAt(3));
- outputIndex=0;
- outputRow[outputIndex++] = mfn;
- outputRow[outputIndex++] = new Long(obj_marc.getField());
- outputRow[outputIndex++] = obj_marc.getIndicators();
- outputRow[outputIndex++] = obj_marc.getLeadersubfields()+"";
- outputRow[outputIndex++] = obj_marc.getValue()+"";
- putRow(data.outputRowMeta, outputRow);
- logRowlevel("Processed field: " + campos[i]);
- } else {
- logBasic("Field {0} is not well formatted. Omitting", campos[i]);
- }
- }
-
-
- //if ((linesInput%Const.ROWS_UPDATE)==0) logBasic("linenr "+linesInput);
- return retval;
- }
-
- /**
- * Lectura de campos básicos del leader del registro MARC
- * @param record
- * @param outputIndex
- * @throws KettleStepException
- */
- private void getBasicControlFields(Record record, Integer outputIndex) throws KettleStepException {
- Object[] outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
- ControlField field;
- //Muestra el lenguaje de cada registro
- // get control field with tag 001/005/008
- field = (ControlField) record.getVariableField("001");
- mfn=field.getData();
-
- //Atributos del ControlField 005
- //Date and Time of Latest Transaction
- field = (ControlField) record.getVariableField("005");
- outputRow[outputIndex++] = mfn;
- outputRow[outputIndex++] = new Long(5); // ???
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = field!=null ? field.getData():"";
-
- putRow(data.outputRowMeta, outputRow);
-
-
- //CAMPOS DE LA CABECERA
- Leader leader = record.getLeader();
-
- //1005 Estado del registro
- outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
- outputIndex=0;
- outputRow[outputIndex++] = mfn;
- outputRow[outputIndex++] = new Long(1005);
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = leader.getRecordStatus()+"";
- putRow(data.outputRowMeta, outputRow);
-
-
- //1006 Tipo de registro
- outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
- outputIndex=0;
- outputRow[outputIndex++] = mfn;
- outputRow[outputIndex++] = new Long(1006);
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = leader.getTypeOfRecord()+"";
- putRow(data.outputRowMeta, outputRow);
-
- //1007
- outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
- outputIndex=0;
- outputRow[outputIndex++] = mfn;
- outputRow[outputIndex++] = new Long(1007);
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = leader.toString().charAt(6)+"";
- putRow(data.outputRowMeta, outputRow);
-
- //1017
- outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
- outputIndex=0;
- outputRow[outputIndex++] = mfn;
- outputRow[outputIndex++] = new Long(1017);
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = leader.toString().charAt(16)+"";
- putRow(data.outputRowMeta, outputRow);
-
-
- //1018
- outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
- outputIndex=0;
- outputRow[outputIndex++] = mfn;
- outputRow[outputIndex++] = new Long(1018);
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = "";
- outputRow[outputIndex++] = leader.toString().charAt(17)+"";
- putRow(data.outputRowMeta, outputRow);
-
- }
-
- /**
- * Obtencion de Datos de un Campo MARC21
- * @param record
- * @param mfn
- * @param field
- * @paman leaderSubfields
- * @param subfield
- * @return
- */
- private MARC21 obtainField(Record record, int mfn, String field, String leaderSubfields, char subfield) {
- //Tomo todos los subcampos del campo
- String data= "";
- MARC21 objMarc=new MARC21();
- DataField marcField = (DataField) record.getVariableField(field);
- String tag = "";
- String indicators = "";
- if(marcField!=null){
- tag = marcField.getTag();
- indicators = ""+ marcField.getIndicator1() + marcField.getIndicator2();
- indicators.trim();
- try {
- List subfields = marcField.getSubfields(subfield);
- for(Subfield marcSubfield:subfields) {
- char code =marcSubfield.getCode();
- String fullCode = marcSubfield.toString().substring(0, 2);
- data = marcSubfield.getData();
- }
- } catch (NullPointerException e) {
- // System.out.println("VACIO SUMCAMPO----" + tag);
- //System.out.println(mfn+ "//" + campo + "//" + subcampo + "//" + "");
- }
- }
- objMarc=new MARC21(mfn, field, indicators, subfield, leaderSubfields, data);
- return objMarc;
- }
-
- /**
- * This method is called by PDI once the step is done processing.
- *
- * The dispose() method is the counterpart to init() and should release any resources
- * acquired for step execution like file handles or database connections.
- *
- * The meta and data implementations passed in can safely be cast
- * to the step's respective implementations.
- *
- * It is mandatory that super.dispose() is called to ensure correct behavior.
- *
- * @param smi step meta interface implementation, containing the step settings
- * @param sdi step data interface implementation, used to store runtime information
- */
- public void dispose(StepMetaInterface smi, StepDataInterface sdi)
- {
- meta = (MARC21LoaderMeta)smi;
- data = (MARC21LoaderData)sdi;
-
- super.dispose(smi, sdi);
- }
-
- //
- // Run is were the action happens!
- //
- //
-
- public void run()
- {
- logBasic("Starting to run...");
-
- try
- {
- while (processRow(meta, data) && !isStopped());
- }
- catch(Exception e)
- {
- logError("Unexpected error", e);
- setErrors(1);
- stopAll();
- }
- finally
- {
- dispose(meta, data);
- logBasic("Finished, processed "+linesInput+" rows, written "+linesWritten+" lines.");
- markStop();
- }
- }
-}
diff --git a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/util/MARC.java b/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/util/MARC.java
deleted file mode 100755
index 06dbe49..0000000
--- a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/util/MARC.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.ucuenca.pentaho.plugin.step.marc21loader.util;
-
-public class MARC {
-
- private int numero_registro;
- private String campo;
- private char subcampo;
- private String valor;
-
- public MARC() {
-
- }
-
- public MARC(int numero_registro, String campo, char subcampo, String valor) {
- this.numero_registro = numero_registro;
- this.campo = campo;
- this.subcampo = subcampo;
- this.valor = valor;
- }
-
-
- public int getNumero_registro() {
- return numero_registro;
- }
-
- public void setNumero_registro(int numero_registro) {
- this.numero_registro = numero_registro;
- }
-
- public String getCampo() {
- return campo;
- }
-
- public void setCampo(String campo) {
- this.campo = campo;
- }
-
- public char getSubcampo() {
- return subcampo;
- }
-
- public void setSubcampo(char subcampo) {
- this.subcampo = subcampo;
- }
-
- public String getValor() {
- return valor;
- }
-
- public void setValor(String valor) {
- this.valor = valor;
- }
-
-}
diff --git a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/util/MARC21.java b/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/util/MARC21.java
deleted file mode 100644
index ec3842c..0000000
--- a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/util/MARC21.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package com.ucuenca.pentaho.plugin.step.marc21loader.util;
-
-public class MARC21 {
-
- private int recordNumber;
- private String field;
- private String indicators;
- private char subfield;
- private String leadersubfields;
- private String value;
-
- public MARC21() {
-
- }
-
- public MARC21(int recordNumber, String field, String indicators, char subfield, String leaderSubfields, String value) {
- this.recordNumber = recordNumber;
- this.field = field;
- this.indicators = indicators;
- this.subfield = subfield;
- this.leadersubfields = leaderSubfields;
- this.value = value;
- }
-
- public int getRecordNumber() {
- return recordNumber;
- }
-
- public void setRecordNumber(int recordNumber) {
- this.recordNumber = recordNumber;
- }
-
- public String getField() {
- return field;
- }
-
- public void setField(String field) {
- this.field = field;
- }
-
- public String getIndicators() {
- return indicators;
- }
-
- public void setIndicators(String indicators) {
- this.indicators = indicators;
- }
-
- public char getSubfield() {
- return subfield;
- }
-
- public void setSubfield(char subfield) {
- this.subfield = subfield;
- }
-
- public String getLeadersubfields() {
- return leadersubfields;
- }
-
- public void setLeadersubfields(String leadersubfields) {
- this.leadersubfields = leadersubfields;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
-}
diff --git a/specification/marc21Loader/src/main/resources/plugin/icon.png b/specification/marc21Loader/src/main/resources/plugin/icon.png
deleted file mode 100644
index 2c6bce1..0000000
Binary files a/specification/marc21Loader/src/main/resources/plugin/icon.png and /dev/null differ
diff --git a/specification/marc21Loader/src/main/resources/plugin/plugin.xml b/specification/marc21Loader/src/main/resources/plugin/plugin.xml
deleted file mode 100644
index 193d149..0000000
--- a/specification/marc21Loader/src/main/resources/plugin/plugin.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/specification/marc21loader/MARC21Loader.java b/specification/marc21loader/MARC21Loader.java
new file mode 100755
index 0000000..152dbc2
--- /dev/null
+++ b/specification/marc21loader/MARC21Loader.java
@@ -0,0 +1,441 @@
+package com.ucuenca.pentaho.plugin.step.marc21loader;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamResult;
+import org.marc4j.MarcStreamReader;
+import org.marc4j.MarcXmlWriter;
+import org.marc4j.marc.ControlField;
+import org.marc4j.marc.DataField;
+import org.marc4j.marc.Leader;
+import org.marc4j.marc.Record;
+import org.marc4j.marc.Subfield;
+import org.pentaho.di.core.exception.KettleStepException;
+import org.pentaho.di.core.row.RowDataUtil;
+import org.pentaho.di.core.row.RowMeta;
+import org.pentaho.di.trans.Trans;
+import org.pentaho.di.trans.TransMeta;
+import org.pentaho.di.trans.step.BaseStep;
+import org.pentaho.di.trans.step.StepDataInterface;
+import org.pentaho.di.trans.step.StepInterface;
+import org.pentaho.di.trans.step.StepMeta;
+import org.pentaho.di.trans.step.StepMetaInterface;
+import com.ucuenca.pentaho.plugin.step.marc21loader.util.MARC21;
+import org.marc4j.marc.VariableField;
+
+/**
+ * This class is part of the demo step plug-in implementation. It demonstrates
+ * the basics of developing a plug-in step for PDI.
+ *
+ * The demo step adds a new string field to the row stream and sets its value to
+ * "Hello World!". The user may select the name of the new field.
+ *
+ * This class is the implementation of StepInterface. Classes implementing this
+ * interface need to:
+ *
+ * - initialize the step - execute the row processing logic - dispose of the
+ * step
+ *
+ * Please do not create any local fields in a StepInterface class. Store any
+ * information related to the processing logic in the supplied step data
+ * interface instead.
+ *
+ */
+public class MARC21Loader extends BaseStep implements StepInterface {
+
+ private MARC21LoaderMeta meta;
+ private MARC21LoaderData data;
+ private String mfn;
+ DOMResult source;
+ Result result;
+
+ //private MarcStreamWriter writer;
+ /**
+ * The constructor should simply pass on its arguments to the parent class.
+ *
+ * @param s step description
+ * @param stepDataInterface step data class
+ * @param c step copy
+ * @param t transformation description
+ * @param dis transformation executing
+ */
+ public MARC21Loader(StepMeta s, StepDataInterface stepDataInterface, int c, TransMeta t, Trans dis) {
+ super(s, stepDataInterface, c, t, dis);
+ }
+
+ /**
+ * This method is called by PDI during transformation startup.
+ *
+ * It should initialize required for step execution.
+ *
+ * The meta and data implementations passed in can safely be cast to the
+ * step's respective implementations.
+ *
+ * It is mandatory that super.init() is called to ensure correct behavior.
+ *
+ * Typical tasks executed here are establishing the connection to a
+ * database, as wall as obtaining resources, like file handles.
+ *
+ * @param smi step meta interface implementation, containing the step
+ * settings
+ * @param sdi step data interface implementation, used to store runtime
+ * information
+ *
+ * @return true if initialization completed successfully, false if there was
+ * an error preventing the step from working.
+ *
+ */
+ public boolean init(StepMetaInterface smi, StepDataInterface sdi) {
+ meta = (MARC21LoaderMeta) smi;
+ data = (MARC21LoaderData) sdi;
+
+ if (super.init(meta, data)) {
+ if (meta.getmarcFilename() == null
+ || meta.getmarcFields() == null
+ || meta.getmarcFilename().length() == 0
+ || meta.getmarcFields().length() == 0) {
+ logError("We need both a path file and a fields to search.");
+ return false;
+ }
+ //marcfiles validation and listing
+ meta.marcFilesValidator();
+
+ //Lectura del archivo MARC
+ FileInputStream in = null;
+ try {
+ for (File file : meta.getMarcfiles()) {
+ logBasic("File to be processed: " + file.getAbsoluteFile());
+ in = new FileInputStream(file);
+ data.marcfiles.add(new MarcStreamReader(in));
+ }
+ if (meta.getGenMARCXML()) {
+ //String stylesheetUrl = "http://www.loc.gov/standards/mods/v3/MARC21slim2MODS3.xsl";
+ //Source stylesheet = new StreamSource(stylesheetUrl);
+ logBasic("Step will Generate MARCXML from input");
+ String out = meta.getmarcFilename().substring(0,
+ meta.getmarcFilename().lastIndexOf(System.getProperty("file.separator")) + 1);
+
+ data.marcXmlOutfile = new MarcXmlWriter(new FileOutputStream(out + meta.getMarcxmlFilename()), true);
+ result = new StreamResult(new FileOutputStream(out + meta.getMarcxmlFilename()));
+ //data.marcXmlOutfile = new MarcXmlWriter(result, stylesheet);
+ //source = new DOMResult();
+ //data.marcXmlOutfile = new MarcXmlWriter(source);
+ //AnselToUnicode converter = new AnselToUnicode();
+ //data.marcXmlOutfile.setConverter(converter);
+ //data.marcXmlOutfile.setUnicodeNormalization(true);
+
+ //this.writer = new MarcStreamWriter(new FileOutputStream(out + "marcReg.mrc"));
+ }
+
+ } catch (FileNotFoundException e1) {
+ // TODO Auto-generated catch block
+ logError("FileNotFoundException " + e1);
+ return false;
+ }/*finally {
+ try {
+ in.close();
+
+ } catch (IOException ex) {
+ logError("IOException " + ex);
+ //Logger.getLogger(PruebaMarc21.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ }*/
+
+ data.marcfilesIterator = data.marcfiles.iterator();
+ data.processingMarcfile = data.marcfilesIterator.next();
+ }
+ return true;
+ }
+
+ /**
+ * Once the transformation starts executing, the processRow() method is
+ * called repeatedly by PDI for as long as it returns true. To indicate that
+ * a step has finished processing rows this method must call setOutputDone()
+ * and return false;
+ *
+ * Steps which process incoming rows typically call getRow() to read a
+ * single row from the input stream, change or add row content, call
+ * putRow() to pass the changed row on and return true. If getRow() returns
+ * null, no more rows are expected to come in, and the processRow()
+ * implementation calls setOutputDone() and returns false to indicate that
+ * it is done too.
+ *
+ * Steps which generate rows typically construct a new row Object[] using a
+ * call to RowDataUtil.allocateRowData(numberOfFields), add row content, and
+ * call putRow() to pass the new row on. Above process may happen in a loop
+ * to generate multiple rows, at the end of which processRow() would call
+ * setOutputDone() and return false;
+ *
+ * @param smi the step meta interface containing the step settings
+ * @param sdi the step data interface that should be used to store
+ *
+ * @return true to indicate that the function should be called again, false
+ * if the step is done
+ */
+ public synchronized boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleStepException {
+ meta = (MARC21LoaderMeta) smi;
+ data = (MARC21LoaderData) sdi;
+
+ boolean retval = true;
+
+ data.processingMarcfile = !data.processingMarcfile.hasNext()
+ && data.marcfilesIterator.hasNext()
+ ? data.marcfilesIterator.next() : data.processingMarcfile;
+
+ if (!data.processingMarcfile.hasNext() && !data.marcfilesIterator.hasNext()) {
+ if (meta.getGenMARCXML()) {
+ logBasic("MARCXML file generated with name: " + meta.getMarcxmlFilename());
+ //writer.close();
+ data.marcXmlOutfile.close();
+ }
+ setOutputDone();
+ return false;
+ }
+
+ if (first) {
+ first = false;
+
+ // the size of the incoming rows
+ //data.inputSize = getInputRowMeta().size();
+ // determine output field structure
+ data.outputRowMeta = new RowMeta();//(RowMetaInterface) getInputRowMeta().clone();
+ meta.getFields(data.outputRowMeta, getStepname(), null, null, this);
+
+ }
+
+ // building new row
+ Object[] outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
+ Integer outputIndex = 0;
+
+ Record record = data.processingMarcfile.next();
+ if (meta.getGenMARCXML()) {
+ //writer.write(record);
+ data.marcXmlOutfile.write(record);
+ }
+
+ this.getBasicControlFields(record, outputIndex);
+ if (mfn.equals("000002") && log.isDebug()) {
+ if (meta.getGenMARCXML()) {
+ logDebug("Sample MARCXML file generated with name: " + meta.getMarcxmlFilename());
+ //writer.close();
+ data.marcXmlOutfile.close();
+ }
+ setOutputDone();
+ return false;
+ }
+
+ //MARC fields reading
+ String leer_campos = meta.getmarcFields();
+ String[] campos = leer_campos.split("@");
+ List obj_marcAux = new ArrayList();
+ int mfnInt = Integer.parseInt(mfn);
+ String currentField = "";
+ String subfields = "";
+ for (int i = 0; i < campos.length; i++) {
+ if (campos[i].length() == 4) {
+ subfields = !currentField.equals(campos[i].substring(0, 3)) ? "" : subfields;
+ currentField = campos[i].substring(0, 3);
+ subfields += campos[i].charAt(3);
+
+ obj_marcAux = this.obtainField(record, mfnInt, currentField, subfields, campos[i].charAt(3));
+ for (MARC21 obj_marc : obj_marcAux) {
+ outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
+ outputIndex = 0;
+ outputRow[outputIndex++] = mfn;
+ outputRow[outputIndex++] = obj_marc.getSecuence();
+ outputRow[outputIndex++] = new Long(obj_marc.getField());
+ outputRow[outputIndex++] = obj_marc.getIndicators();
+ outputRow[outputIndex++] = obj_marc.getLeadersubfields() + "";
+ outputRow[outputIndex++] = obj_marc.getValue() + "";
+ putRow(data.outputRowMeta, outputRow);
+
+ }
+ } else {
+ logBasic("Field {0} is not well formatted. Omitting", campos[i]);
+ }
+ }
+
+ //if ((linesInput%Const.ROWS_UPDATE)==0) logBasic("linenr "+linesInput);
+ return retval;
+ }
+
+ /**
+ * Lectura de campos básicos del leader del registro MARC
+ *
+ * @param record
+ * @param outputIndex
+ * @throws KettleStepException
+ */
+ private void getBasicControlFields(Record record, Integer outputIndex) throws KettleStepException {
+ Object[] outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
+ ControlField field;
+ //Muestra el lenguaje de cada registro
+ // get control field with tag 001/005/008
+ field = (ControlField) record.getVariableField("001");
+ mfn = field.getData();
+
+ //Atributos del ControlField 005
+ //Date and Time of Latest Transaction
+ field = (ControlField) record.getVariableField("005");
+ outputRow[outputIndex++] = mfn;
+ outputRow[outputIndex++] = "0";
+ outputRow[outputIndex++] = new Long(5); // ???
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = field != null ? field.getData() : "";
+
+ putRow(data.outputRowMeta, outputRow);
+
+ //CAMPOS DE LA CABECERA
+ Leader leader = record.getLeader();
+
+ //1005 Estado del registro
+ outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
+ outputIndex = 0;
+ outputRow[outputIndex++] = mfn;
+ outputRow[outputIndex++] = "0";
+ outputRow[outputIndex++] = new Long(1005);
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = leader.getRecordStatus() + "";
+ putRow(data.outputRowMeta, outputRow);
+
+ //1006 Tipo de registro
+ outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
+ outputIndex = 0;
+ outputRow[outputIndex++] = mfn;
+ outputRow[outputIndex++] = "0";
+ outputRow[outputIndex++] = new Long(1006);
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = leader.getTypeOfRecord() + "";
+ putRow(data.outputRowMeta, outputRow);
+
+ //1007
+ outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
+ outputIndex = 0;
+ outputRow[outputIndex++] = mfn;
+ outputRow[outputIndex++] = "0";
+ outputRow[outputIndex++] = new Long(1007);
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = leader.toString().charAt(6) + "";
+ putRow(data.outputRowMeta, outputRow);
+
+ //1017
+ outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
+ outputIndex = 0;
+ outputRow[outputIndex++] = mfn;
+ outputRow[outputIndex++] = "0";
+ outputRow[outputIndex++] = new Long(1017);
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = leader.toString().charAt(16) + "";
+ putRow(data.outputRowMeta, outputRow);
+
+ //1018
+ outputRow = RowDataUtil.allocateRowData(data.outputRowMeta.size());
+ outputIndex = 0;
+ outputRow[outputIndex++] = mfn;
+ outputRow[outputIndex++] = "0";
+ outputRow[outputIndex++] = new Long(1018);
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = "";
+ outputRow[outputIndex++] = leader.toString().charAt(17) + "";
+ putRow(data.outputRowMeta, outputRow);
+
+ }
+
+ /**
+ * Obtencion de Datos de un Campo MARC21
+ *
+ * @param record
+ * @param mfn
+ * @param field
+ * @paman leaderSubfields
+ * @param subfield
+ * @return
+ */
+ private List obtainField(Record record, int mfn, String field, String leaderSubfields, char subfield) {
+ //Tomo todos los subcampos del campo
+ List objMarc = new ArrayList();
+ List marcFields = record.getVariableFields(field);
+ int cont = 0;
+ for (VariableField marcFieldAux : marcFields) {
+ String data = "";
+ DataField marcField = (DataField) marcFieldAux;
+ String tag = "";
+ String indicators = "";
+ if (marcField != null) {
+ tag = marcField.getTag();
+ indicators = "" + marcField.getIndicator1() + marcField.getIndicator2();
+ indicators.trim();
+ try {
+ List subfields = marcField.getSubfields(subfield);
+ for (Subfield marcSubfield : subfields) {
+ char code = marcSubfield.getCode();
+ String fullCode = marcSubfield.toString().substring(0, 2);
+ data = marcSubfield.getData();
+
+ }
+ } catch (NullPointerException e) {
+
+ }
+ }
+ objMarc.add(new MARC21(mfn, String.valueOf(cont++), field, indicators, subfield, leaderSubfields, data));
+ }
+ return objMarc;
+ }
+
+ /**
+ * This method is called by PDI once the step is done processing.
+ *
+ * The dispose() method is the counterpart to init() and should release any
+ * resources acquired for step execution like file handles or database
+ * connections.
+ *
+ * The meta and data implementations passed in can safely be cast to the
+ * step's respective implementations.
+ *
+ * It is mandatory that super.dispose() is called to ensure correct
+ * behavior.
+ *
+ * @param smi step meta interface implementation, containing the step
+ * settings
+ * @param sdi step data interface implementation, used to store runtime
+ * information
+ */
+ public void dispose(StepMetaInterface smi, StepDataInterface sdi) {
+ meta = (MARC21LoaderMeta) smi;
+ data = (MARC21LoaderData) sdi;
+
+ super.dispose(smi, sdi);
+ }
+
+ //
+ // Run is were the action happens!
+ //
+ //
+ public void run() {
+ logBasic("Starting to run...");
+
+ try {
+ while (processRow(meta, data) && !isStopped());
+ } catch (Exception e) {
+ logError("Unexpected error", e);
+ setErrors(1);
+ stopAll();
+ } finally {
+ dispose(meta, data);
+ logBasic("Finished, processed " + linesInput + " rows, written " + linesWritten + " lines.");
+ markStop();
+ }
+ }
+}
diff --git a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21LoaderData.java b/specification/marc21loader/MARC21LoaderData.java
similarity index 100%
rename from specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21LoaderData.java
rename to specification/marc21loader/MARC21LoaderData.java
diff --git a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21LoaderDialog.java b/specification/marc21loader/MARC21LoaderDialog.java
similarity index 94%
rename from specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21LoaderDialog.java
rename to specification/marc21loader/MARC21LoaderDialog.java
index ad43665..f7ec4f6 100755
--- a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21LoaderDialog.java
+++ b/specification/marc21loader/MARC21LoaderDialog.java
@@ -317,7 +317,7 @@ public void widgetSelected(SelectionEvent e)
{
String str = dialog.getFilterPath()+System.getProperty("file.separator")+dialog.getFileName();
wMarcURL.setText(str);
- wMarcFields.setText("020a@022a@040a@040b@041a@082a@082c@100a@100b@100d@110a@110e@110g@245a@245b@245c@245h@245n@245p@246a@246b@246f@246g@250a@250b@300a@300b@300c@300e@310a@362a@490a@490n@490p@490v@490x@500a@502a@504a@520a@653a@700a@700b@700d@700e@710a@710b@710e@710g@773g@773t@856a@856u@900a@900f@900k@900l@900m@900n@900o@900p@900q@900r@900y");
+ wMarcFields.setText("5@020a@022a@40b@040a@040b@041a@082a@082c@100a@100b@100d@110a@110e@110g@245a@245b@245c@245h@245n@245p@246a@246b@246f@246g@250a@250b@260a@260b@260c@300a@300b@300c@300e@310a@362a@490a@490n@490p@490v@490x@500a@502a@504a@505a@520a@650a@653a@700a@700b@700d@700e@710a@710b@710e@710g@773g@773t@852a@852c@852f@852k@852l@852m@852p@852q@852r@852t@856a@856u@900a@900f@900k@900l@900m@900n@900o@900p@900q@900r@900y@980d@980o@998a");
/*if (str.toUpperCase().endsWith(".MRC") && (wMarcFields.getText()==null || wMarcFields.getText().length()==0) )
{
String strdbf = str.substring(0,str.length()-4);
@@ -338,7 +338,7 @@ public void widgetSelected(SelectionEvent e)
{
String str = dialog.getFilterPath();
wMarcURL.setText(str);
- wMarcFields.setText("020a@022a@040a@040b@041a@082a@082c@100a@100b@100d@110a@110e@110g@245a@245b@245c@245h@245n@245p@246a@246b@246f@246g@250a@250b@300a@300b@300c@300e@310a@362a@490a@490n@490p@490v@490x@500a@502a@504a@520a@653a@700a@700b@700d@700e@710a@710b@710e@710g@773g@773t@856a@856u@900a@900f@900k@900l@900m@900n@900o@900p@900q@900r@900y");
+ wMarcFields.setText("5@020a@022a@40b@040a@040b@041a@082a@082c@100a@100b@100d@110a@110e@110g@245a@245b@245c@245h@245n@245p@246a@246b@246f@246g@250a@250b@260a@260b@260c@300a@300b@300c@300e@310a@362a@490a@490n@490p@490v@490x@500a@502a@504a@505a@520a@650a@653a@700a@700b@700d@700e@710a@710b@710e@710g@773g@773t@852a@852c@852f@852k@852l@852m@852p@852q@852r@852t@856a@856u@900a@900f@900k@900l@900m@900n@900o@900p@900q@900r@900y@980d@980o@998a");
/*if (str.toUpperCase().endsWith(".MRC") && (wMarcFields.getText()==null || wMarcFields.getText().length()==0) )
{
String strdbf = str.substring(0,str.length()-4);
diff --git a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21LoaderMeta.java b/specification/marc21loader/MARC21LoaderMeta.java
similarity index 95%
rename from specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21LoaderMeta.java
rename to specification/marc21loader/MARC21LoaderMeta.java
index fe6d948..0841793 100755
--- a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/MARC21LoaderMeta.java
+++ b/specification/marc21loader/MARC21LoaderMeta.java
@@ -3,35 +3,35 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.List;
+import java.util.Map;
import org.eclipse.swt.widgets.Shell;
-import org.pentaho.di.core.CheckResult;
-import org.pentaho.di.core.CheckResultInterface;
-import org.pentaho.di.core.Counter;
-import org.pentaho.di.core.database.DatabaseMeta;
-import org.pentaho.di.core.exception.KettleException;
-import org.pentaho.di.core.exception.KettleStepException;
-import org.pentaho.di.core.exception.KettleXMLException;
-import org.pentaho.di.core.row.RowMetaInterface;
-import org.pentaho.di.core.row.ValueMeta;
-import org.pentaho.di.core.row.ValueMetaInterface;
-import org.pentaho.di.core.variables.VariableSpace;
-import org.pentaho.di.core.xml.XMLHandler;
-import org.pentaho.di.repository.ObjectId;
-import org.pentaho.di.repository.Repository;
-import org.pentaho.di.trans.Trans;
-import org.pentaho.di.trans.TransMeta;
-import org.pentaho.di.trans.step.BaseStepMeta;
-import org.pentaho.di.trans.step.StepDataInterface;
+import org.pentaho.di.core.CheckResult;
+import org.pentaho.di.core.CheckResultInterface;
+import org.pentaho.di.core.Counter;
+import org.pentaho.di.core.database.DatabaseMeta;
+import org.pentaho.di.core.exception.KettleException;
+import org.pentaho.di.core.exception.KettleStepException;
+import org.pentaho.di.core.exception.KettleXMLException;
+import org.pentaho.di.core.row.RowMetaInterface;
+import org.pentaho.di.core.row.ValueMeta;
+import org.pentaho.di.core.row.ValueMetaInterface;
+import org.pentaho.di.core.variables.VariableSpace;
+import org.pentaho.di.core.xml.XMLHandler;
+import org.pentaho.di.repository.ObjectId;
+import org.pentaho.di.repository.Repository;
+import org.pentaho.di.trans.Trans;
+import org.pentaho.di.trans.TransMeta;
+import org.pentaho.di.trans.step.BaseStepMeta;
+import org.pentaho.di.trans.step.StepDataInterface;
import org.pentaho.di.trans.step.StepDialogInterface;
-import org.pentaho.di.trans.step.StepInterface;
-import org.pentaho.di.trans.step.StepMeta;
-import org.pentaho.di.trans.step.StepMetaInterface;
-import org.pentaho.di.trans.steps.xbaseinput.XBase;
-import org.w3c.dom.Node;
-
+import org.pentaho.di.trans.step.StepInterface;
+import org.pentaho.di.trans.step.StepMeta;
+import org.pentaho.di.trans.step.StepMetaInterface;
+import org.pentaho.di.trans.steps.xbaseinput.XBase;
+import org.w3c.dom.Node;
+
/**
* This class is part of the demo step plug-in implementation.
* It demonstrates the basics of developing a plug-in step for PDI.
@@ -57,7 +57,7 @@ public class MARC21LoaderMeta extends BaseStepMeta implements StepMetaInterface
* {the package of the class specified}/messages/messages_{locale}.properties
*/
private static Class> PKG = MARC21LoaderMeta.class; // for i18n purposes
-
+
/** MARC file URL */
private String marcFilename;
@@ -71,8 +71,8 @@ public class MARC21LoaderMeta extends BaseStepMeta implements StepMetaInterface
private Boolean genMARCXML;
/** MARCXML Output Filename **/
- private String marcxmlFilename = "marc21loader.xml";
-
+ private String marcxmlFilename = "marc21loader.xml";
+
/** MARC fields to be extracted */
private String marcFields;
@@ -131,39 +131,39 @@ public void setDefault()
marcFilename = "";
marcFields = "";
}
-
- /**
- * @return Returns the marcFilename.
- */
- public String getmarcFilename()
- {
- return marcFilename;
- }
-
- /**
- * @param marcFilename The marcFilename to set.
- */
- public void setmarcFilename(String marcFilename)
- {
- this.marcFilename = marcFilename;
- }
-
- /**
- * @return Returns the marcFields.
- */
- public String getmarcFields()
- {
- return marcFields;
- }
-
- /**
- * @param marcFields The marcFields to set.
- */
- public void setmarcFields(String marcFields)
- {
- this.marcFields = marcFields;
+
+ /**
+ * @return Returns the marcFilename.
+ */
+ public String getmarcFilename()
+ {
+ return marcFilename;
+ }
+
+ /**
+ * @param marcFilename The marcFilename to set.
+ */
+ public void setmarcFilename(String marcFilename)
+ {
+ this.marcFilename = marcFilename;
+ }
+
+ /**
+ * @return Returns the marcFields.
+ */
+ public String getmarcFields()
+ {
+ return marcFields;
}
-
+
+ /**
+ * @param marcFields The marcFields to set.
+ */
+ public void setmarcFields(String marcFields)
+ {
+ this.marcFields = marcFields;
+ }
+
public Boolean getBatchMode() {
return batchMode;
@@ -261,7 +261,7 @@ private void readData(Node stepnode) throws KettleXMLException
marcFilename = XMLHandler.getTagValue(stepnode, "marcFilename");
marcFields = XMLHandler.getTagValue(stepnode, "marcFields");
batchMode = XMLHandler.getTagValue(stepnode, "batchMode").equals("Y");
- genMARCXML = XMLHandler.getTagValue(stepnode, "genMARCXML").equals("Y");
+ genMARCXML = XMLHandler.getTagValue(stepnode, "genMARCXML").equals("Y");
}
catch(Exception e)
{
@@ -315,7 +315,7 @@ public void readRep(Repository rep, ObjectId id_step, List databas
throw new KettleException("Unexpected error reading step information from the repository", e);
}
- }
+ }
/**
* This method is called to determine the changes the step is making to the row-stream.
@@ -328,107 +328,112 @@ public void readRep(Repository rep, ObjectId id_step, List databas
* @param info row structures of any info steps coming in
* @param nextStep the description of a step this step is passing rows to
* @param space the variable space for resolving variables
- */
- public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException {
-
- // Atributo MFN...
- ValueMetaInterface mfn = new ValueMeta("MFN", ValueMetaInterface.TYPE_STRING);
- mfn.setLength(50);
- mfn.setOrigin(name);
- row.addValueMeta(mfn);
-
- // Atributo Campo
- ValueMetaInterface campo = new ValueMeta("Campo", ValueMetaInterface.TYPE_INTEGER);
- campo.setOrigin(name);
+ */
+ public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException {
+
+ // Atributo MFN...
+ ValueMetaInterface mfn = new ValueMeta("MFN", ValueMetaInterface.TYPE_STRING);
+ mfn.setLength(50);
+ mfn.setOrigin(name);
+ row.addValueMeta(mfn);
+
+ ValueMetaInterface secuencia = new ValueMeta("Secuencia", ValueMetaInterface.TYPE_STRING);
+ secuencia.setLength(2);
+ secuencia.setOrigin(name);
+ row.addValueMeta(secuencia);
+
+ // Atributo Campo
+ ValueMetaInterface campo = new ValueMeta("Campo", ValueMetaInterface.TYPE_INTEGER);
+ campo.setOrigin(name);
row.addValueMeta(campo);
// Atributo Indicadores
ValueMetaInterface indicadores = new ValueMeta("Indicadores", ValueMetaInterface.TYPE_STRING);
indicadores.setLength(2);
indicadores.setOrigin(name);
- row.addValueMeta(indicadores);
-
- // Atributo Subcampo
- ValueMetaInterface subcampo = new ValueMeta("Subcampo", ValueMetaInterface.TYPE_STRING);
- subcampo.setLength(50);
- subcampo.setOrigin(name);
- row.addValueMeta(subcampo);
-
- //Atributo dato
- ValueMetaInterface dato = new ValueMeta("dato", ValueMetaInterface.TYPE_STRING);
- dato.setLength(5000);
- dato.setOrigin(name);
- row.addValueMeta( dato );
-
- /* // The shape nr
- ValueMetaInterface shnr = new ValueMeta("shapenr", ValueMetaInterface.TYPE_INTEGER);
- shnr.setOrigin(name);
- row.addValueMeta( shnr );
-
- // The part nr
- ValueMetaInterface pnr = new ValueMeta("partnr", ValueMetaInterface.TYPE_INTEGER);
- pnr.setOrigin(name);
- row.addValueMeta( pnr );
-
- // The part nr
- ValueMetaInterface nrp = new ValueMeta("nrparts", ValueMetaInterface.TYPE_INTEGER);
- nrp.setOrigin(name);
- row.addValueMeta( nrp );
-
- // The point nr
- ValueMetaInterface ptnr = new ValueMeta("pointnr", ValueMetaInterface.TYPE_INTEGER);
- ptnr.setOrigin(name);
- row.addValueMeta( ptnr );
-
- // The nr of points
- ValueMetaInterface nrpt = new ValueMeta("nrpointS", ValueMetaInterface.TYPE_INTEGER);
- nrpt.setOrigin(name);
- row.addValueMeta( nrpt );
-
- // The X coordinate
- ValueMetaInterface x = new ValueMeta("x", ValueMetaInterface.TYPE_NUMBER);
- x.setOrigin(name);
- row.addValueMeta( x );
-
- // The Y coordinate
- ValueMetaInterface y = new ValueMeta("y", ValueMetaInterface.TYPE_NUMBER);
- y.setOrigin(name);
- row.addValueMeta( y );
-
- // The measure
- ValueMetaInterface m = new ValueMeta("measure", ValueMetaInterface.TYPE_NUMBER);
- m.setOrigin(name);
- row.addValueMeta( m );
- */
-
- /*if (getmarcFields()!=null)
- {
- XBase xbase = new XBase(log, getmarcFields());
- try
- {
- xbase.open();
- RowMetaInterface fields = xbase.getFields();
- for (int i=0;i remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info)
- {
+ */
+ public void check(List remarks, TransMeta transMeta, StepMeta stepinfo, RowMetaInterface prev, String[] input, String[] output, RowMetaInterface info)
+ {
CheckResult cr;
// See if we get input...
diff --git a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/messages/messages_en_US.properties b/specification/marc21loader/messages/messages_en_US.properties
old mode 100644
new mode 100755
similarity index 100%
rename from specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/messages/messages_en_US.properties
rename to specification/marc21loader/messages/messages_en_US.properties
diff --git a/specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/messages/messages_es_ES.properties b/specification/marc21loader/messages/messages_es_ES.properties
old mode 100644
new mode 100755
similarity index 100%
rename from specification/marc21Loader/src/main/java/com/ucuenca/pentaho/plugin/step/marc21loader/messages/messages_es_ES.properties
rename to specification/marc21loader/messages/messages_es_ES.properties
diff --git a/specification/marc21loader/util/MARC.java b/specification/marc21loader/util/MARC.java
new file mode 100755
index 0000000..3666da8
--- /dev/null
+++ b/specification/marc21loader/util/MARC.java
@@ -0,0 +1,63 @@
+package com.ucuenca.pentaho.plugin.step.marc21loader.util;
+
+public class MARC {
+
+ private int numero_registro;
+ private String campo;
+ private String secuencia;
+ private char subcampo;
+ private String valor;
+
+ public MARC() {
+
+ }
+
+ public MARC(int numero_registro, String secuencia, String campo, char subcampo, String valor) {
+ this.numero_registro = numero_registro;
+ this.secuencia = secuencia;
+ this.campo = campo;
+ this.subcampo = subcampo;
+ this.valor = valor;
+ }
+
+ public int getNumero_registro() {
+ return numero_registro;
+ }
+
+ public void setNumero_registro(int numero_registro) {
+ this.numero_registro = numero_registro;
+ }
+
+ public String getCampo() {
+ return campo;
+ }
+
+ public void setCampo(String campo) {
+ this.campo = campo;
+ }
+
+ public char getSubcampo() {
+ return subcampo;
+ }
+
+ public void setSubcampo(char subcampo) {
+ this.subcampo = subcampo;
+ }
+
+ public String getValor() {
+ return valor;
+ }
+
+ public void setValor(String valor) {
+ this.valor = valor;
+ }
+
+ public String getSecuencia() {
+ return secuencia;
+ }
+
+ public void setSecuencia(String secuencia) {
+ this.secuencia = secuencia;
+ }
+
+}
diff --git a/specification/marc21loader/util/MARC21.java b/specification/marc21loader/util/MARC21.java
new file mode 100755
index 0000000..24dfa59
--- /dev/null
+++ b/specification/marc21loader/util/MARC21.java
@@ -0,0 +1,84 @@
+package com.ucuenca.pentaho.plugin.step.marc21loader.util;
+
+public class MARC21 {
+
+ private int recordNumber;
+ private String secuence;
+ private String field;
+ private String indicators;
+ private char subfield;
+ private String leadersubfields;
+ private String value;
+
+ public MARC21() {
+
+ }
+
+ public MARC21(int recordNumber, String secuence, String field, String indicators, char subfield, String leaderSubfields, String value) {
+ this.recordNumber = recordNumber;
+ this.secuence = secuence;
+ this.field = field;
+ this.indicators = indicators;
+ this.subfield = subfield;
+ this.leadersubfields = leaderSubfields;
+ this.value = value;
+ }
+
+ public int getRecordNumber() {
+ return recordNumber;
+ }
+
+ public void setRecordNumber(int recordNumber) {
+ this.recordNumber = recordNumber;
+ }
+
+ public String getField() {
+ return field;
+ }
+
+ public void setField(String field) {
+ this.field = field;
+ }
+
+ public String getIndicators() {
+ return indicators;
+ }
+
+ public void setIndicators(String indicators) {
+ this.indicators = indicators;
+ }
+
+ public char getSubfield() {
+ return subfield;
+ }
+
+ public void setSubfield(char subfield) {
+ this.subfield = subfield;
+ }
+
+ public String getLeadersubfields() {
+ return leadersubfields;
+ }
+
+ public void setLeadersubfields(String leadersubfields) {
+ this.leadersubfields = leadersubfields;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getSecuence() {
+ return secuence;
+ }
+
+ public void setSecuence(String secuence) {
+ this.secuence = secuence;
+ }
+
+
+}