Skip to content

Commit

Permalink
Eclipse is puking, I need to re-check out the whole project. I think.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn2.assembla.com/svn/romraider/branches/dev_xmlmerge@319 38686702-15cf-42e4-a595-3071df8bf5ea
  • Loading branch information
qoncept96 committed Jan 31, 2011
1 parent 260e4ff commit 6768bf9
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 56 deletions.
46 changes: 46 additions & 0 deletions settings.xml
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<settings>
<window>
<maximized value="false"/>
<size x="600" y="800"/>
<location x="400" y="150"/>
<splitpane location="150"/>
</window>
<files>
<image_dir path="C:\workspace\romraider\images"/>
</files>
<options>
<obsoletewarning value="true"/>
<calcconflictwarning value="true"/>
<debug value="false"/>
<userlevel value="1"/>
<tableclickcount value="1"/>
<version value="0.5.3 Beta RC7"/>
<savedebugtables value="true"/>
<displayhightables value="true"/>
<valuelimitwarning value="true"/>
</options>
<tabledisplay>
<font face="Arial" size="11" decoration="1"/>
<cellsize height="18" width="42"/>
<colors>
<max r="255" g="102" b="102"/>
<min r="153" g="153" b="255"/>
<highlight r="204" g="204" b="204"/>
<increaseborder r="255" g="0" b="0"/>
<decreaseborder r="0" g="0" b="255"/>
<axis r="255" g="255" b="255"/>
<warning r="255" g="0" b="0"/>
</colors>
</tabledisplay>
<logger>
<serial port="" refresh="true"/>
<maximized value="false"/>
<size x="600" y="1000"/>
<location x="0" y="0"/>
<tabs selected="0" showlist="true"/>
<definition path=""/>
<profile path=""/>
<filelogging path="C:\Users\owner" switchid="S20" active="true" absolutetimestamp="false"/>
</logger>
</settings>
2 changes: 1 addition & 1 deletion src/com/romraider/maps/Rom.java
Expand Up @@ -21,8 +21,8 @@


import com.romraider.editor.ecu.ECUEditor; import com.romraider.editor.ecu.ECUEditor;
import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler; import com.romraider.logger.ecu.ui.handler.table.TableUpdateHandler;
import com.romraider.metadata.exception.TableNotFoundException;
import com.romraider.swing.JProgressPane; import com.romraider.swing.JProgressPane;
import com.romraider.xml.TableNotFoundException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import java.io.File; import java.io.File;
Expand Down
9 changes: 9 additions & 0 deletions src/com/romraider/metadata/AbstractTableMetadata.java
Expand Up @@ -2,4 +2,13 @@


public abstract class AbstractTableMetadata { public abstract class AbstractTableMetadata {


private String name;

public String getName() {
return this.name;
}

public void setName(String name) {
this.name = name;
}
} }
2 changes: 2 additions & 0 deletions src/com/romraider/metadata/RomMetadataHandler.java
Expand Up @@ -9,6 +9,8 @@
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;

import com.romraider.metadata.exception.RomNotFoundException;
import com.romraider.xml.DOMRomMetadataRefactorUtil; import com.romraider.xml.DOMRomMetadataRefactorUtil;
import com.romraider.xml.DOMRomMetadataUnmarshaller; import com.romraider.xml.DOMRomMetadataUnmarshaller;
import com.sun.org.apache.xerces.internal.parsers.DOMParser; import com.sun.org.apache.xerces.internal.parsers.DOMParser;
Expand Down
2 changes: 2 additions & 0 deletions src/com/romraider/metadata/RomMetadataIndex.java
@@ -1,5 +1,7 @@
package com.romraider.metadata; package com.romraider.metadata;


import com.romraider.metadata.exception.RomNotFoundException;



public class RomMetadataIndex { public class RomMetadataIndex {


Expand Down
55 changes: 4 additions & 51 deletions src/com/romraider/metadata/RomMetadataIndexBuilder.java
@@ -1,28 +1,12 @@
package com.romraider.metadata; package com.romraider.metadata;


import java.io.BufferedWriter;

import com.sun.org.apache.xml.internal.serialize.OutputFormat;
import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.FileWriter;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import javax.management.modelmbean.XMLParseException;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import ch.elca.el4j.services.xmlmerge.XmlMerge;
import ch.elca.el4j.services.xmlmerge.merge.DefaultXmlMerge;
import com.romraider.maps.Rom;
import com.romraider.swing.JProgressPane;
import com.romraider.util.FileListing; import com.romraider.util.FileListing;
import com.romraider.xml.DOMRomMetadataUnmarshaller; import com.romraider.xml.DOMRomMetadataUnmarshaller;
import com.sun.org.apache.xerces.internal.parsers.DOMParser; import com.sun.org.apache.xerces.internal.parsers.DOMParser;
Expand All @@ -39,7 +23,7 @@ public static RomMetadataIndex createIndex(File path) throws FileNotFoundExcepti
if (f.isFile()) { if (f.isFile()) {


try { try {
romVector.addAll(DOMRomMetadataUnmarshaller.unmarshallRomIDIndex(f)); //romVector.addAll(DOMRomMetadataUnmarshaller.unmarshallRomIDIndex(f));


} catch (Exception x) { } catch (Exception x) {
// TODO: Handle invalid definitions // TODO: Handle invalid definitions
Expand All @@ -66,7 +50,7 @@ public static void main(String[] args) {
} }




/*long time1 = System.currentTimeMillis(); long time1 = System.currentTimeMillis();
try { try {


File testdir = new File("c:\\users\\owner\\desktop\\rommetadata"); File testdir = new File("c:\\users\\owner\\desktop\\rommetadata");
Expand All @@ -75,43 +59,12 @@ public static void main(String[] args) {
long time2 = System.currentTimeMillis(); long time2 = System.currentTimeMillis();
System.out.println(romIndex.size() + " index built in " + (time2 - time1) + "ms"); System.out.println(romIndex.size() + " index built in " + (time2 - time1) + "ms");


RomMetadataHandler.getMetadata(input, romIndex);*/ RomMetadataHandler.getMetadata(input, romIndex);



/*InputSource src1 = new InputSource(new FileInputStream(new File("c:\\users\\owner\\desktop\\16BITBASE.xml")));
DOMParser parser = new DOMParser();
parser.parse(src1);
Document root1 = parser.getDocument();
InputSource src2 = new InputSource(new FileInputStream(new File("c:\\users\\owner\\desktop\\A4TF400E.xml")));
parser.parse(src2);
Document root2 = parser.getDocument();
Document[] docs = new Document[] {root1, root2};
XmlMerge merge = new DefaultXmlMerge();
Document mergedDoc = merge.merge(docs);
File output = new File("c:\\users\\owner\\desktop\\new.xml");
FileOutputStream fos = new FileOutputStream(output);
OutputFormat of = new OutputFormat("XML", "ISO-8859-1", true);
of.setIndent(1);
of.setIndenting(true);
try {
XMLSerializer serializer = new XMLSerializer(fos, of);
serializer.serialize(mergedDoc);
fos.flush();
} finally {
fos.close();
}




} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}*/ }


} }


Expand Down
13 changes: 13 additions & 0 deletions src/com/romraider/metadata/ScalingMetadata.java
@@ -0,0 +1,13 @@
package com.romraider.metadata;

public class ScalingMetadata {
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
}
14 changes: 14 additions & 0 deletions src/com/romraider/metadata/ScalingMetadataList.java
@@ -0,0 +1,14 @@
package com.romraider.metadata;

import java.util.ArrayList;
import com.romraider.metadata.exception.ScalingNotFoundException;

public class ScalingMetadataList<ScalingMetadata> extends ArrayList<ScalingMetadata> {

public ScalingMetadata get(String name) {
for (ScalingMetadata s : this) {
if (s.getName().equalsIgnoreCase(name)) return s;
}
throw new ScalingNotFoundException();
}
}
2 changes: 1 addition & 1 deletion src/com/romraider/metadata/Table1DMetadata.java
Expand Up @@ -2,4 +2,4 @@


public class Table1DMetadata extends AbstractTableMetadata { public class Table1DMetadata extends AbstractTableMetadata {


} }
15 changes: 15 additions & 0 deletions src/com/romraider/metadata/TableMetadataList.java
@@ -0,0 +1,15 @@
package com.romraider.metadata;

import java.util.ArrayList;

import com.romraider.metadata.exception.TableNotFoundException;

public class TableMetadataList<TableMetadata> extends ArrayList<AbstractTableMetadata> {

public AbstractTableMetadata get(String name) throws TableNotFoundException {
for (AbstractTableMetadata t : this) {
if (t.getName().equalsIgnoreCase(name)) return t;
}
throw new TableNotFoundException();
}
}
@@ -1,4 +1,4 @@
package com.romraider.metadata; package com.romraider.metadata.exception;


public class RomNotFoundException extends Exception { public class RomNotFoundException extends Exception {


Expand Down
29 changes: 29 additions & 0 deletions src/com/romraider/metadata/exception/ScalingNotFoundException.java
@@ -0,0 +1,29 @@
/*
* RomRaider Open-Source Tuning, Logging and Reflashing
* Copyright (C) 2006-2010 RomRaider.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

package com.romraider.metadata.exception;

public final class ScalingNotFoundException extends Exception {

private static final long serialVersionUID = -7492075561444288417L;

public String getMessage() {
return "Scaling not found.";
}
}
Expand Up @@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */


package com.romraider.xml; package com.romraider.metadata.exception;


public final class TableNotFoundException extends Exception { public final class TableNotFoundException extends Exception {


Expand Down
9 changes: 8 additions & 1 deletion src/com/romraider/xml/DOMRomMetadataUnmarshaller.java
Expand Up @@ -12,11 +12,18 @@
import org.xml.sax.InputSource; import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import com.romraider.metadata.RomIndexID; import com.romraider.metadata.RomIndexID;
import com.romraider.metadata.RomMetadata;
import com.sun.org.apache.xerces.internal.parsers.DOMParser; import com.sun.org.apache.xerces.internal.parsers.DOMParser;


public class DOMRomMetadataUnmarshaller { public class DOMRomMetadataUnmarshaller {

private RomMetadata r;

public DOMRomMetadataUnmarshaller() {
r = new RomMetadata();
}


public static Vector<RomIndexID> unmarshallRomIDIndex(File file) throws SAXException, IOException { public Vector<RomIndexID> unmarshallRomIDIndex(File file) throws SAXException, IOException {


Vector<RomIndexID> romVector = new Vector<RomIndexID>(); Vector<RomIndexID> romVector = new Vector<RomIndexID>();
InputSource src = new InputSource(new FileInputStream(file)); InputSource src = new InputSource(new FileInputStream(file));
Expand Down
1 change: 1 addition & 0 deletions src/com/romraider/xml/DOMRomUnmarshaller.java
Expand Up @@ -32,6 +32,7 @@
import com.romraider.maps.Table2D; import com.romraider.maps.Table2D;
import com.romraider.maps.Table3D; import com.romraider.maps.Table3D;
import com.romraider.maps.TableSwitch; import com.romraider.maps.TableSwitch;
import com.romraider.metadata.exception.TableNotFoundException;
import com.romraider.swing.DebugPanel; import com.romraider.swing.DebugPanel;
import com.romraider.swing.JProgressPane; import com.romraider.swing.JProgressPane;
import com.romraider.util.LogManager; import com.romraider.util.LogManager;
Expand Down
37 changes: 37 additions & 0 deletions xmlmerge.properties
@@ -0,0 +1,37 @@
action.default=MERGE

xpath.path1=/rom/romid/xmlid
action.path1=REPLACE

xpath.path2=/rom/romid/internalidaddress
action.path2=REPLACE

xpath.path3=/rom/romid/inernalidstring
action.path3=REPLACE

xpath.path4=/rom/romid/ecuid
action.path4=REPLACE

xpath.path5=/rom/romid/year
action.path5=REPLACE

xpath.path6=/rom/romid/market
action.path6=REPLACE

xpath.make=/rom/romid/make
action.make=REPLACE

xpath.path8=/rom/romid/model
action.path8=REPLACE

xpath.path8=/rom/romid/submodel
action.path8=REPLACE

xpath.path9=/rom/romid/transmission
action.path1=REPLACE

xpath.path9=/rom/romid/memmodel
action.path1=REPLACE

xpath.path10=/rom/romid/flashmethod
action.path10=REPLACE

0 comments on commit 6768bf9

Please sign in to comment.