mirror of https://github.com/apache/openjpa.git
improved trace messages
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@496914 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
97b23ebb90
commit
3edddc6125
openjpa-kernel/src/main
java/org/apache/openjpa/meta
resources/org/apache/openjpa/meta
|
@ -578,7 +578,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
Set names = parsePersistentTypeNames(loader);
|
||||
if (names.isEmpty() && devpath)
|
||||
scan(new ClasspathMetaDataIterator(null, newMetaDataFilter()),
|
||||
newClassArgParser(), names, false);
|
||||
newClassArgParser(), names, false, null);
|
||||
else // we don't cache a full dev cp scan
|
||||
_typeNames = names;
|
||||
|
||||
|
@ -607,17 +607,19 @@ public abstract class AbstractCFMetaDataFactory
|
|||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scanning-directory", file));
|
||||
scan(new FileMetaDataIterator(dir, newMetaDataFilter()),
|
||||
cparser, names, true);
|
||||
cparser, names, true, file);
|
||||
} else if (file.getName().endsWith(".jar")) {
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scanning-jar", file));
|
||||
scan(new ZipFileMetaDataIterator(new ZipFile(file),
|
||||
newMetaDataFilter()), cparser, names, true);
|
||||
newMetaDataFilter()), cparser, names, true, file);
|
||||
} else {
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scanning-file", file));
|
||||
clss = cparser.parseTypeNames(new FileMetaDataIterator
|
||||
(file));
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scan-found-names", clss, file));
|
||||
names.addAll(Arrays.asList(clss));
|
||||
mapPersistentTypeNames(file.getAbsoluteFile().toURL(),
|
||||
clss);
|
||||
|
@ -633,17 +635,19 @@ public abstract class AbstractCFMetaDataFactory
|
|||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scanning-jar-url", url));
|
||||
scan(new ZipFileMetaDataIterator(url,
|
||||
newMetaDataFilter()), cparser, names, true);
|
||||
newMetaDataFilter()), cparser, names, true, url);
|
||||
} else if (url.getPath().endsWith(".jar")) {
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scanning-jar-at-url", url));
|
||||
scan(new ZipStreamMetaDataIterator(
|
||||
new ZipInputStream(url.openStream()),
|
||||
newMetaDataFilter()), cparser, names, true);
|
||||
newMetaDataFilter()), cparser, names, true, url);
|
||||
} else {
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scanning-url", url));
|
||||
clss = cparser.parseTypeNames(new URLMetaDataIterator(url));
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scan-found-names", clss, url));
|
||||
names.addAll(Arrays.asList(clss));
|
||||
mapPersistentTypeNames(url, clss);
|
||||
}
|
||||
|
@ -661,7 +665,8 @@ public abstract class AbstractCFMetaDataFactory
|
|||
log.trace(_loc.get("scanning-jar-stream-url", url));
|
||||
scan(new ZipStreamMetaDataIterator
|
||||
(new ZipInputStream(url.openStream()),
|
||||
newMetaDataFilter()), cparser, names, true);
|
||||
newMetaDataFilter()), cparser, names, true,
|
||||
url);
|
||||
}
|
||||
} else {
|
||||
if (log.isTraceEnabled())
|
||||
|
@ -671,6 +676,8 @@ public abstract class AbstractCFMetaDataFactory
|
|||
url = (URL) mitr.next();
|
||||
clss = cparser.parseTypeNames(new URLMetaDataIterator
|
||||
(url));
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scan-found-names", clss, rsrc));
|
||||
names.addAll(Arrays.asList(clss));
|
||||
mapPersistentTypeNames(url, clss);
|
||||
}
|
||||
|
@ -681,10 +688,14 @@ public abstract class AbstractCFMetaDataFactory
|
|||
if (cpath != null) {
|
||||
String[] dirs = (String[]) cpath.toArray(new String[cpath.size()]);
|
||||
scan(new ClasspathMetaDataIterator(dirs, newMetaDataFilter()),
|
||||
cparser, names, true);
|
||||
cparser, names, true, dirs);
|
||||
}
|
||||
if (types != null)
|
||||
names.addAll(types);
|
||||
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("parse-found-names", names));
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
|
@ -692,7 +703,7 @@ public abstract class AbstractCFMetaDataFactory
|
|||
* Scan for persistent type names using the given metadata iterator.
|
||||
*/
|
||||
private void scan(MetaDataIterator mitr, ClassArgParser cparser, Set names,
|
||||
boolean mapNames)
|
||||
boolean mapNames, Object debugContext)
|
||||
throws IOException {
|
||||
Map map;
|
||||
try {
|
||||
|
@ -707,7 +718,10 @@ public abstract class AbstractCFMetaDataFactory
|
|||
if (mapNames)
|
||||
mapPersistentTypeNames(entry.getKey(), (String[])
|
||||
entry.getValue());
|
||||
names.addAll(Arrays.asList((String[]) entry.getValue()));
|
||||
List newNames = Arrays.asList((String[]) entry.getValue());
|
||||
if (log.isTraceEnabled())
|
||||
log.trace(_loc.get("scan-found-names", newNames, debugContext));
|
||||
names.addAll(newNames);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -290,3 +290,5 @@ scanning-url: Scanning URL "{0}" for persistent types.
|
|||
scanning-zip-stream-url: Scanning jar in stream from URL "{0}" for persistent \
|
||||
types.
|
||||
scanning-resource: Scanning resource "{0}" for persistent types.
|
||||
scan-found-names: Scan of "{1}" found persistent types {0}.
|
||||
parse-found-names: parsePersistentTypeNames() found {0}.
|
||||
|
|
Loading…
Reference in New Issue