openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r719292 - in /openjpa/branches/1.3.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ openjpa-kernel/src/main/java/org/apache/openjpa/meta/ openjpa-lib/src/main/java/org/ap...
Date Thu, 20 Nov 2008 17:15:13 GMT
Author: faywang
Date: Thu Nov 20 09:15:12 2008
New Revision: 719292

URL: http://svn.apache.org/viewvc?rev=719292&view=rev
Log:
OPENJPA-742: add get lineNumber/columnNumber to SourceTracker

Modified:
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Sequence.java
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Table.java
    openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaParser.java
    openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
    openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java
    openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
    openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
    openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTracker.java
    openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
    openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java
    openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java
    openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
    openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataSerializer.java

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/ClassMappingInfo.java
Thu Nov 20 09:15:12 2008
@@ -67,6 +67,9 @@
     private File _file = null;
     private int _srcType = SRC_OTHER;
     private String[] _comments = null;
+    private int _lineNum = 0;  
+    private int _colNum = 0;  
+    
     // Unique constraints indexed by primary or secondary table name
     private Map<String,List<Unique>> _uniques;
 
@@ -471,4 +474,21 @@
     public void setComments(String[] comments) {
         _comments = comments;
     }
+    
+    public int getLineNumber() {
+        return _lineNum;
+    }
+
+    public void setLineNumber(int lineNum) {
+        _lineNum = lineNum;
+    }
+
+    public int getColNumber() {
+        return _colNum;
+    }
+
+    public void setColNumber(int colNum) {
+        _colNum = colNum;
+    }
+    
 }

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/QueryResultMapping.java
Thu Nov 20 09:15:12 2008
@@ -57,6 +57,8 @@
     private File _file = null;
     private Object _scope = null;
     private int _srcType = SRC_OTHER;
+    private int _lineNum = 0;  
+    private int _colNum = 0;  
     private int _mode = MODE_QUERY;
     private Class _class = null;
     private int _idx = 0;
@@ -224,6 +226,22 @@
     public String getResourceName() {
         return (_class == null) ? _name : _class.getName() + ":" + _name;
     }
+    
+    public int getLineNumber() {
+        return _lineNum;
+    }
+
+    public void setLineNumber(int lineNum) {
+        _lineNum = lineNum;
+    }
+
+    public int getColNumber() {
+        return _colNum;
+    }
+
+    public void setColNumber(int colNum) {
+        _colNum = colNum;
+    }
 
     /**
      * A persistence-capable result.

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Sequence.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Sequence.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Sequence.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Sequence.java
Thu Nov 20 09:15:12 2008
@@ -38,6 +38,8 @@
     private int _initial = 1;
     private int _increment = 1;
     private int _cache = 0;
+    private int _lineNum = 0;  
+    private int _colNum = 0;  
 
     // keep track of source
     private File _source = null;
@@ -206,4 +208,20 @@
     public String toString() {
         return getFullName();
     }
+    
+    public int getLineNumber() {
+        return _lineNum;
+    }
+
+    public void setLineNumber(int lineNum) {
+        _lineNum = lineNum;
+    }
+
+    public int getColNumber() {
+        return _colNum;
+    }
+
+    public void setColNumber(int colNum) {
+        _colNum = colNum;
+    }
 }

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Table.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Table.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Table.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Table.java
Thu Nov 20 09:15:12 2008
@@ -61,6 +61,8 @@
     private Index[] _idxs = null;
     private Unique[] _unqs = null;
     private String _comment = null;
+    private int _lineNum = 0;  
+    private int _colNum = 0;  
 
     /**
      * Default constructor.
@@ -718,4 +720,20 @@
     public void setComment(String comment) {
         _comment = comment;
     }
+    
+    public int getLineNumber() {
+        return _lineNum;
+    }
+
+    public void setLineNumber(int lineNum) {
+        _lineNum = lineNum;
+    }
+
+    public int getColNumber() {
+        return _colNum;
+    }
+
+    public void setColNumber(int colNum) {
+        _colNum = colNum;
+    }
 }

Modified: openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaParser.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaParser.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaParser.java
(original)
+++ openjpa/branches/1.3.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/XMLSchemaParser.java
Thu Nov 20 09:15:12 2008
@@ -26,6 +26,7 @@
 import java.util.LinkedList;
 
 import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
@@ -34,6 +35,8 @@
 import org.apache.openjpa.lib.util.Localizer.Message;
 import org.apache.openjpa.util.UserException;
 
+import serp.util.Numbers;
+
 /**
  * Custom SAX parser used to parse {@link Schema} objects. The parser
  * will place all parsed schemas into the current {@link SchemaGroup}, set
@@ -404,6 +407,11 @@
 
     private void startSequence(Attributes attrs) {
         Sequence seq = _schema.addSequence(attrs.getValue("name"));
+        Locator locator = getLocation().getLocator();
+        if (locator != null) {
+            seq.setLineNumber(Numbers.valueOf(locator.getLineNumber()));
+            seq.setColNumber(Numbers.valueOf(locator.getColumnNumber()));
+        }
         seq.setSource(getSourceFile(), seq.SRC_XML);
         try {
             String val = attrs.getValue("initial-value");
@@ -423,6 +431,11 @@
     private void startTable(Attributes attrs) {
         _table = _schema.addTable(attrs.getValue("name"));
         _table.setSource(getSourceFile(), _table.SRC_XML);
+        Locator locator = getLocation().getLocator();
+        if (locator != null) {
+            _table.setLineNumber(Numbers.valueOf(locator.getLineNumber()));
+            _table.setColNumber(Numbers.valueOf(locator.getColumnNumber()));
+        }
     }
 
     private void endTable() {

Modified: openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
(original)
+++ openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ClassMetaData.java
Thu Nov 20 09:15:12 2008
@@ -135,6 +135,8 @@
     private final LifecycleMetaData _lifeMeta = new LifecycleMetaData(this);
     private File _srcFile = null;
     private int _srcType = SRC_OTHER;
+    private int _lineNum = 0;  
+    private int _colNum = 0;  
     private String[] _comments = null;
     private int _listIndex = -1;
     private int _srcMode = MODE_META | MODE_MAPPING;
@@ -2173,6 +2175,23 @@
     public String getResourceName() {
         return _type.getName();
     }
+    
+    public int getLineNumber() {
+        return _lineNum;
+    }
+
+    public void setLineNumber(int lineNum) {
+        _lineNum = lineNum;
+    }
+
+    public int getColNumber() {
+        return _colNum;
+    }
+
+    public void setColNumber(int colNum) {
+        _colNum = colNum;
+    }
+    
 
     /**
      * The source mode this metadata has been loaded under.

Modified: openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java
(original)
+++ openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java
Thu Nov 20 09:15:12 2008
@@ -40,6 +40,9 @@
     private final int _type;
 	
     private File _srcFile = null;
+    private int _lineNum = 0;  
+    private int _colNum = 0;  
+    
     private int _srcType = SRC_OTHER;
     private String[] _comments = null;
     private int _listIndex = -1;
@@ -105,6 +108,22 @@
         _srcType = srcType;
     }
 
+    public int getLineNumber() {
+        return _lineNum;
+    }
+
+    public void setLineNumber(int lineNum) {
+        _lineNum = lineNum;
+    }
+
+    public int getColNumber() {
+        return _colNum;
+    }
+
+    public void setColNumber(int colNum) {
+        _colNum = colNum;
+    }
+    
     public String getResourceName() {
         return _class.getName();
     }

Modified: openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
(original)
+++ openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
Thu Nov 20 09:15:12 2008
@@ -56,6 +56,9 @@
     private List _hintKeys;
     private List _hintVals;
     private String _resultSetMappingName;
+    private int _lineNum;  
+    private int _colNum;  
+
     /**
      * Construct with the given name.
      */
@@ -274,4 +277,20 @@
     public String getResourceName() {
         return (_class == null) ? _name : _class.getName () + ":" + _name;
 	}
+    
+    public int getLineNumber() {
+        return _lineNum;
+    }
+
+    public void setLineNumber(int lineNum) {
+        _lineNum = lineNum;
+    }
+
+    public int getColNumber() {
+        return _colNum;
+    }
+
+    public void setColNumber(int colNum) {
+        _colNum = colNum;
+    }
 }

Modified: openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
(original)
+++ openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
Thu Nov 20 09:15:12 2008
@@ -80,6 +80,8 @@
     private File _source = null;
     private Object _scope = null;
     private int _srcType = SRC_OTHER;
+    private int _lineNum = 0;  
+    private int _colNum = 0;  
     private String[] _comments = null;
     private String _sequence = null;
     private int _increment = -1;
@@ -129,6 +131,22 @@
         _srcType = srcType;
     }
 
+    public int getLineNumber() {
+        return _lineNum;
+    }
+
+    public void setLineNumber(int lineNum) {
+        _lineNum = lineNum;
+    }
+
+    public int getColNumber() {
+        return _colNum;
+    }
+
+    public void setColNumber(int colNum) {
+        _colNum = colNum;
+    }
+    
     public String getResourceName() {
         return _name;
     }

Modified: openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTracker.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTracker.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTracker.java
(original)
+++ openjpa/branches/1.3.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/meta/SourceTracker.java
Thu Nov 20 09:15:12 2008
@@ -53,4 +53,15 @@
      * class, this would return the name of the class.
      */
     public String getResourceName();
+    
+    /**
+     * Return the line number of the file at which this instance was parsed.
+     */
+    public int getLineNumber();
+
+    /**
+     * Return the column number in the line of the file at which this
+     * instance was parsed.
+     */
+    public int getColNumber();
 }

Modified: openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
(original)
+++ openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/XMLPersistenceMappingParser.java
Thu Nov 20 09:15:12 2008
@@ -33,6 +33,7 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.meta.ClassMapping;
@@ -61,7 +62,7 @@
 import org.apache.openjpa.util.InternalException;
 
 import static org.apache.openjpa.persistence.jdbc.MappingTag.*;
-
+import serp.util.Numbers;
 /**
  * Custom SAX parser used by the system to parse persistence mapping files.
  *
@@ -414,6 +415,11 @@
         Object scope = (cur instanceof ClassMetaData)
             ? ((ClassMetaData) cur).getDescribedType() : null;
         seq.setSource(getSourceFile(), scope, seq.SRC_XML);
+        Locator locator = getLocation().getLocator();
+        if (locator != null) {
+            seq.setLineNumber(Numbers.valueOf(locator.getLineNumber()));
+            seq.setColNumber(Numbers.valueOf(locator.getColumnNumber()));
+        }
         pushElement(seq);
         return true;
     }
@@ -829,7 +835,11 @@
         Object scope = (cur instanceof ClassMetaData)
             ? ((ClassMetaData) cur).getDescribedType() : null;
         result.setSource(getSourceFile(), scope, result.SRC_XML);
-
+        Locator locator = getLocation().getLocator();
+        if (locator != null) {
+            result.setLineNumber(Numbers.valueOf(locator.getLineNumber()));
+            result.setColNumber(Numbers.valueOf(locator.getColumnNumber()));
+        }
         pushElement(result);
         return true;
     }

Modified: openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java
(original)
+++ openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataSerializer.java
Thu Nov 20 09:15:12 2008
@@ -1277,6 +1277,14 @@
             return _seqs[0].getResourceName();
         }
 
+        public int getLineNumber() {
+            return _seqs[0].getLineNumber();
+        }
+
+        public int getColNumber() {
+            return _seqs[0].getColNumber();
+        }
+        
         public int compareTo(ClassSeqs other) {
             if (other == this)
                 return 0;
@@ -1346,6 +1354,14 @@
             return _queries[0].getResourceName();
         }
 
+        public int getLineNumber() {
+            return _queries[0].getLineNumber();
+        }
+
+        public int getColNumber() {
+            return _queries[0].getColNumber();
+        }
+        
         public int compareTo(ClassQueries other) {
             if (other == this)
                 return 0;

Modified: openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java
(original)
+++ openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceUnitInfoImpl.java
Thu Nov 20 09:15:12 2008
@@ -471,6 +471,14 @@
     public int getSourceType() {
         return SRC_XML;
     }
+    
+    public int getLineNumber() {
+        return 0;
+    }
+        
+    public int getColNumber() {
+        return 0;
+    }
 
     public String getResourceName() {
         return "PersistenceUnitInfo:" + _name;

Modified: openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
(original)
+++ openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Thu Nov 20 09:15:12 2008
@@ -36,6 +36,7 @@
 
 import org.apache.commons.lang.StringUtils;
 import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.apache.openjpa.conf.OpenJPAConfiguration;
 import org.apache.openjpa.enhance.PersistenceCapable;
@@ -67,6 +68,8 @@
 import static org.apache.openjpa.persistence.PersistenceStrategy.*;
 import org.apache.openjpa.util.ImplHelper;
 
+import serp.util.Numbers;
+
 /**
  * Custom SAX parser used by the system to quickly parse persistence i
  * metadata files.
@@ -790,6 +793,11 @@
         if (isMetaDataMode()) {
             meta.setSource(getSourceFile(), meta.SRC_XML);
             meta.setSourceMode(MODE_META, true);
+            Locator locator = getLocation().getLocator();
+            if (locator != null) {
+                meta.setLineNumber(Numbers.valueOf(locator.getLineNumber()));
+                meta.setColNumber(Numbers.valueOf(locator.getColumnNumber()));
+            }
             meta.setListingIndex(_clsPos);
             String name = attrs.getValue("name");
             if (!StringUtils.isEmpty(name))
@@ -912,6 +920,11 @@
         Object scope = (cur instanceof ClassMetaData)
             ? ((ClassMetaData) cur).getDescribedType() : null;
         meta.setSource(getSourceFile(), scope, meta.SRC_XML);
+        Locator locator = getLocation().getLocator();
+        if (locator != null) {
+            meta.setLineNumber(Numbers.valueOf(locator.getLineNumber()));
+            meta.setColNumber(Numbers.valueOf(locator.getColumnNumber()));
+        }
         return true;
     }
 
@@ -1421,7 +1434,11 @@
         meta.setDefiningType(_cls);
         meta.setQueryString(attrs.getValue("query"));
         meta.setLanguage(JPQLParser.LANG_JPQL);
-
+        Locator locator = getLocation().getLocator();
+        if (locator != null) {
+            meta.setLineNumber(Numbers.valueOf(locator.getLineNumber()));
+            meta.setColNumber(Numbers.valueOf(locator.getColumnNumber()));
+        }
         Object cur = currentElement();
         Object scope = (cur instanceof ClassMetaData)
             ? ((ClassMetaData) cur).getDescribedType() : null;
@@ -1504,6 +1521,11 @@
         Object scope = (cur instanceof ClassMetaData)
             ? ((ClassMetaData) cur).getDescribedType() : null;
         meta.setSource(getSourceFile(), scope, meta.SRC_XML);
+        Locator locator = getLocation().getLocator();
+        if (locator != null) {
+            meta.setLineNumber(Numbers.valueOf(locator.getLineNumber()));
+            meta.setColNumber(Numbers.valueOf(locator.getColumnNumber()));
+        }
         if (isMetaDataMode())
             meta.setSourceMode(MODE_META);
         else if (isMappingMode())

Modified: openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataSerializer.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataSerializer.java?rev=719292&r1=719291&r2=719292&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataSerializer.java
(original)
+++ openjpa/branches/1.3.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataSerializer.java
Thu Nov 20 09:15:12 2008
@@ -1229,6 +1229,14 @@
             return _seqs[0].getResourceName();
         }
 
+        public int getLineNumber() {
+            return _seqs[0].getLineNumber();
+        }
+
+        public int getColNumber() {
+            return _seqs[0].getColNumber();
+        }
+        
         public int compareTo(ClassSeqs other) {
             if (other == this)
                 return 0;
@@ -1298,6 +1306,14 @@
             return _queries[0].getResourceName();
         }
 
+        public int getLineNumber() {
+            return _queries[0].getLineNumber();
+        }
+
+        public int getColNumber() {
+            return _queries[0].getColNumber();
+        }
+
         public int compareTo(ClassQueries other) {
             if (other == this)
                 return 0;



Mime
View raw message