You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2006/03/13 18:13:53 UTC

svn commit: r385601 - /lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java

Author: andreas
Date: Mon Mar 13 09:13:48 2006
New Revision: 385601

URL: http://svn.apache.org/viewcvs?rev=385601&view=rev
Log:
[minor change] fixed some logging issues, removed dead code

Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java?rev=385601&r1=385600&r2=385601&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/publication/DefaultDocument.java Mon Mar 13 09:13:48 2006
@@ -35,7 +35,6 @@
 import org.apache.lenya.cms.publication.util.DocumentVisitor;
 import org.apache.lenya.cms.repository.Node;
 import org.apache.lenya.cms.site.SiteManager;
-import org.apache.log4j.Category;
 
 /**
  * A typical CMS document.
@@ -43,8 +42,6 @@
  */
 public class DefaultDocument extends AbstractLogEnabled implements Document {
 
-    private Category log = Category.getInstance(DefaultDocument.class);
-
     private DocumentIdentifier identifier;
     private String sourceURI;
     private DocumentIdentityMap identityMap;
@@ -137,15 +134,16 @@
         List documentLanguages = new ArrayList();
         String[] allLanguages = getPublication().getLanguages();
 
-        log.debug("Number of languages of this publication: " + allLanguages.length);
+        getLogger().debug("Number of languages of this publication: " + allLanguages.length);
 
         for (int i = 0; i < allLanguages.length; i++) {
             Document version;
             try {
-                log.debug("Try to create document: " + allLanguages[i] + " " + this);
+                if (getLogger().isDebugEnabled()) {
+                    getLogger().debug("Try to create document: " + allLanguages[i] + " " + this);
+                }
                 version = getIdentityMap().getLanguageVersion(this, allLanguages[i]);
             } catch (DocumentBuildException e) {
-                log.warn(e.getMessage());
                 throw new DocumentException(e);
             }
             if (version.exists()) {
@@ -278,28 +276,24 @@
         String[] languages = getLanguages();
 
         if (languages.length > 0) {
-                log.warn("Document (" + this + ") exists in at least one language: " + languages.length);
-                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");
-                return false;
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Document (" + this + ") exists in at least one language: "
+                        + languages.length);
             }
-
-// NOTE: This seems to be unecessary because getLanguage() already creates these documents
-/*
-        try {
-            String[] languages = getLanguages();
-            for (int i = 0; i < languages.length; i++) {
-                Document languageVersion = getIdentityMap().getLanguageVersion(this, languages[i]);
-                exists = exists || languageVersion.exists();
+            String[] allLanguages = getPublication().getLanguages();
+            if (languages.length == allLanguages.length)
+                if (getLogger().isDebugEnabled()) {
+                    getLogger().warn("Document (" + this
+                            + ") exists even in all languages of this publication");
+                }
+            return true;
+        } else {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Document (" + this + ") does NOT exist in any language");
             }
-        } catch (DocumentBuildException e) {
-            throw new DocumentException(e);
+            return false;
         }
-        return exists;
-*/
+
     }
 
     protected DocumentIdentifier getIdentifier() {
@@ -367,7 +361,9 @@
      * @see org.apache.lenya.cms.metadata.MetaDataOwner#getMetaDataManager()
      */
     public MetaDataManager getMetaDataManager() {
-        log.debug("getSourceURI(): " + getPublication().getSourceURI());
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Publication source URI: " + getPublication().getSourceURI());
+        }
         if (this.metaDataManager == null) {
             SourceResolver resolver = null;
             RepositorySource source = null;
@@ -378,11 +374,9 @@
                 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) {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org