Andreas Hartmann wrote:
Hi Michi,
thanks for your commits - but I have some comments:
+import org.apache.log4j.Category;
please don't introduce a custom logging concept for single classes.
DefaultDocument is already LogEnabled.
I know, but the current logging concept really sucks if I might say so.
If you are able to show how one can configure it in a better way, then I
am fine,
but the logging information as it is just doesn't help at all.
+
+ if (languages.length > 0) {
+ log.warn("Document (" + this + ") exists in at least
one language: " + languages.length);
This warning message is not appropriate. Please use debug instead.
agreed
Too many warning logs will affect performance.
+ String[] allLanguages =
getPublication().getLanguages();
+ if (languages.length == allLanguages.length)
log.warn("Document (" + this + ") exists even in all languages of
this publication");
+ return true;
+ } else {
+ log.warn("Document (" + this + ") does NOT exist in
any language");
Same here. A warning is not appropriate here, because it is normal
behaviour.
Even if it's normal behaviour I think a WARNING makes perfect sense,
because no language exists
and I think it makes a lot of sense to tell where it is being determined
to figure out what might
be the reason for this
Michi
-- Andreas
+ return false;
+ }
+
+// NOTE: This seems to be unecessary because getLanguage() already
creates these documents
+/*
try {
String[] languages = getLanguages();
for (int i = 0; i < languages.length; i++) {
@@ -274,6 +299,7 @@
throw new DocumentException(e);
}
return exists;
+*/
}
protected DocumentIdentifier getIdentifier() {
@@ -341,16 +367,22 @@
* @see
org.apache.lenya.cms.metadata.MetaDataOwner#getMetaDataManager()
*/
public MetaDataManager getMetaDataManager() {
+ log.debug("getSourceURI(): " +
getPublication().getSourceURI());
if (this.metaDataManager == null) {
SourceResolver resolver = null;
RepositorySource source = null;
try {
resolver = (SourceResolver)
this.manager.lookup(SourceResolver.ROLE);
+
+ // TODO: This needs to be improved ...
String sourceUri = getPublication().getSourceURI() +
"/content/" + getArea()
+ getId() + "/index_" + getLanguage() + ".xml";
+
+ log.debug("Source URI: " + sourceUri);
source = (RepositorySource)
resolver.resolveURI(sourceUri);
this.metaDataManager =
source.getNode().getMetaDataManager();
} catch (Exception e) {
+ log.warn(e.getMessage());
throw new RuntimeException(e);
} finally {
if (resolver != null) {
--
Michael Wechner
Wyona - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
[EMAIL PROTECTED] [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]