svn commit: r617035 [10/22] - in /lenya/branches/revolution/1.3.x: ./ src/java/org/apache/lenya/ac/ src/java/org/apache/lenya/ac/cache/ src/java/org/apache/lenya/ac/cifs/ src/java/org/apache/lenya/ac/file/ src/java/org/apache/lenya/ac/impl/ src/java/or...

[email protected]
Newsgroups gmane.comp.cms.lenya.cvs
Message-ID <[email protected]>
Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publication/xsp/DocumentReferencesHelper.java Wed Jan 30 23:44:03 2008
@@ -14,17 +14,13 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publication.xsp;
-
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Map;
 import java.util.regex.Pattern;
-
 import org.apache.cocoon.ProcessingException;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentBuildException;
@@ -40,290 +36,183 @@
 import org.apache.lenya.cms.publication.SiteTreeException;
 import org.apache.lenya.cms.publication.SiteTreeNode;
 import org.apache.lenya.search.Grep;
-import org.apache.log4j.Category;
-
+import org.apache.log4j.Logger;
 /**
  * Helper class for finding references to the current document.
  */
 public class DocumentReferencesHelper {
-
-    private static final Category log = Category.getInstance(DocumentReferencesHelper.class);
-
-    private PageEnvelope pageEnvelope = null;
-
-    /**
-     * Create a new DocumentReferencesHelper
-     * 
-     * @param objectModel the objectModel
-     * 
-     * @throws ProcessingException if the page envelope could not be created.
-     */
-    public DocumentReferencesHelper(Map objectModel)
-        throws ProcessingException {
-        try {
-            this.pageEnvelope =
-                PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
-        } catch (PageEnvelopeException e) {
-            throw new ProcessingException(e);
-        }
-    }
-
-    /**
-     * Construct a search string for the search of references, i.e.
-     * links from other documents to the current document. This
-     * is done using the assumption that internal links look as if
-     * they were copied directly from the browser,
-     * e.g. /lenya/default/authoring/doctypes/2columns.html
-     * 
-     * @return the search string
-     */
-    protected String getReferencesSearchString() {
-        return "href\\s*=\\s*\""
-            + pageEnvelope.getContext()
-            + "/"
-            + pageEnvelope.getPublication().getId()
-            + "/"
-            + pageEnvelope.getDocument().getArea()
-            + pageEnvelope.getDocument().getId();
-    }
-
-    /**
-     * Construct a search string for the search of internal references, 
-     * i.e from the current document to others. This is done using 
-     * the assumption that internal links look as if they were copied 
-     * directly from the browser, e.g. 
-     * /lenya/default/authoring/doctypes/2columns.html
-     * 
-     * @return the search string
-     */
-    protected Pattern getInternalLinkPattern() {
-        // FIXME: The following method is not very robust and certainly 
-        // will fail if the mapping between URL and document-id changes  
-
-        // Link Management now assumes that internal links are of the
-        // form
-        // href="$CONTEXT_PREFIX/$PUBLICATION_ID/$AREA$DOCUMENT_ID(_[a-z][a-z])?.html
-        // If there is a match in a document file it is assumed that
-        // this is an internal link and is treated as such (warning if
-        // publish with unpublished internal links and warning if
-        // deactivate with internal references).
-
-        // However this is not coordinated with the
-        // DocumentToPathMapper and will probably fail if the URL
-        // looks different.
-
-        return Pattern.compile(
-            "href\\s*=\\s*\""
-                + pageEnvelope.getContext()
-                + "/"
-                + pageEnvelope.getPublication().getId()
-                + "/"
-                + pageEnvelope.getDocument().getArea()
-                + "(/[-a-zA-Z0-9_/]+?)(_[a-z][a-z])?\\.html");
-    }
-
-    /**
-     * Find a list of document-ids which have references to the current
-     * document.
-     * 
-     * @return an <code>array</code> of documents if there are references, 
-     * an empty <code>array</code> otherwise 
-     * 
-     * @throws ProcessingException if the search for references failed.
-     */
-    public Document[] getReferences(String area) throws ProcessingException {
-
-        ArrayList documents = new ArrayList();
-        Publication publication = pageEnvelope.getPublication();
-        DocumentIdToPathMapper mapper = publication.getPathMapper();
-        if (mapper instanceof PathToDocumentIdMapper) {
-            PathToDocumentIdMapper fileMapper = (PathToDocumentIdMapper)mapper;
-            String documentId = null;
-            String language = null;
-            DocumentBuilder builder = publication.getDocumentBuilder();
-            File[] inconsistentFiles;
-            try {
-                inconsistentFiles =
-                    Grep.find(
-                        publication.getContentDirectory(area),
-                        getReferencesSearchString());
-                for (int i = 0; i < inconsistentFiles.length; i++) {
-                    // for performance reasons the getReferencesSearchString() is 
-                    // constructed in a way such that it will catch all files which 
-                    // have a link to any language version of the current document.
-                    // That's why we need to do some additional tests for each hit. 
-                    String languageOfCurrentDocument =
-                        pageEnvelope.getDocument().getLanguage();
-                    String defaultLanguage =
-                        pageEnvelope.getPublication().getDefaultLanguage();
-                    Pattern referencesSearchStringWithLanguage =
-                        Pattern.compile(
-                            getReferencesSearchString()
-                                + "_"
-                                + languageOfCurrentDocument);
-                    Pattern referencesSearchStringWithOutLanguage =
-                        Pattern.compile(
-                            getReferencesSearchString() + "\\.html");
-                    log.debug(
-                        "languageOfCurrentDocument: "
-                            + languageOfCurrentDocument);
-                    log.debug("defaultLanguage: " + defaultLanguage);
-                    log.debug(
-                        "referencesSearchStringWithOutLanguage: "
-                            + referencesSearchStringWithOutLanguage.pattern());
-                    log.debug(
-                        "referencesSearchStringWithLanguage: "
-                            + referencesSearchStringWithLanguage.pattern());
-                    // a link is indeed to the current document if the following conditions
-                    // are met:
-                    // 1. the link is to foo_xx and the language of the current 
-                    //    document is xx.
-                    // 2. or the link is to foo.html and the language of the current 
-                    //    document is the default language.
-                    // Now negate the expression because we continue if above (1) and (2) are
-                    // false, and you'll get the following if statement
-                    if (!Grep
-                        .containsPattern(
-                            inconsistentFiles[i],
-                            referencesSearchStringWithLanguage)
-                        && !(Grep
-                            .containsPattern(
-                                inconsistentFiles[i],
-                                referencesSearchStringWithOutLanguage)
-                            && languageOfCurrentDocument.equals(
-                                defaultLanguage))) {
-                        // the reference foo_xx is neither to the language of the current 
-                        // document.
-                        // nor is the reference foo.html and the current document is in the 
-                        // default language.
-                        // So the reference is of no importance to us, skip 
-                        continue;
-                    }
-
-                    documentId =
-                        fileMapper.getDocumentId(
-                            publication,
-                            area,
-                            inconsistentFiles[i]);
-                    log.debug("documentId: " + documentId);
-                    language = fileMapper.getLanguage(inconsistentFiles[i]);
-                    log.debug("language: " + language);
-
-                    String url = null;
-                    if (language != null) {
-                        url =
-                            builder.buildCanonicalUrl(
-                                publication,
-                                area,
-                                documentId,
-                                language);
-                        log.debug("url: " + url);
-                    } else {
-                        url =
-                            builder.buildCanonicalUrl(
-                                publication,
-                                area,
-                                documentId);
-                        log.debug("url: " + url);
-                    }
-                    documents.add(builder.buildDocument(publication, url));
-                }
-            } catch (IOException e) {
-                throw new ProcessingException(e);
-            } catch (DocumentDoesNotExistException e) {
-                throw new ProcessingException(e);
-            } catch (DocumentBuildException e) {
-                throw new ProcessingException(e);
+   private static Logger log = Logger.getLogger(DocumentReferencesHelper.class);
+   private PageEnvelope pageEnvelope = null;
+   /**
+    * Create a new DocumentReferencesHelper
+    * 
+    * @param objectModel
+    *           the objectModel
+    * 
+    * @throws ProcessingException
+    *            if the page envelope could not be created.
+    */
+   public DocumentReferencesHelper(Map objectModel) throws ProcessingException {
+      try{
+         this.pageEnvelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
+      }catch(PageEnvelopeException e){
+         throw new ProcessingException(e);
+      }
+   }
+   /**
+    * Construct a search string for the search of references, i.e. links from other documents to the current document. This is done using the assumption that internal links look as if they were copied directly from the browser, e.g. /lenya/default/authoring/doctypes/2columns.html
+    * 
+    * @return the search string
+    */
+   protected String getReferencesSearchString() {
+      return "href\\s*=\\s*\"" + pageEnvelope.getContext() + "/" + pageEnvelope.getPublication().getId() + "/" + pageEnvelope.getDocument().getArea() + pageEnvelope.getDocument().getId();
+   }
+   /**
+    * Construct a search string for the search of internal references, i.e from the current document to others. This is done using the assumption that internal links look as if they were copied directly from the browser, e.g. /lenya/default/authoring/doctypes/2columns.html
+    * 
+    * @return the search string
+    */
+   protected Pattern getInternalLinkPattern() {
+      // FIXME: The following method is not very robust and certainly
+      // will fail if the mapping between URL and document-id changes
+      // Link Management now assumes that internal links are of the
+      // form
+      // href="$CONTEXT_PREFIX/$PUBLICATION_ID/$AREA$DOCUMENT_ID(_[a-z][a-z])?.html
+      // If there is a match in a document file it is assumed that
+      // this is an internal link and is treated as such (warning if
+      // publish with unpublished internal links and warning if
+      // deactivate with internal references).
+      // However this is not coordinated with the
+      // DocumentToPathMapper and will probably fail if the URL
+      // looks different.
+      return Pattern.compile("href\\s*=\\s*\"" + pageEnvelope.getContext() + "/" + pageEnvelope.getPublication().getId() + "/" + pageEnvelope.getDocument().getArea() + "(/[-a-zA-Z0-9_/]+?)(_[a-z][a-z])?\\.html");
+   }
+   /**
+    * Find a list of document-ids which have references to the current document.
+    * 
+    * @return an <code>array</code> of documents if there are references, an empty <code>array</code> otherwise
+    * 
+    * @throws ProcessingException
+    *            if the search for references failed.
+    */
+   public Document[] getReferences(String area) throws ProcessingException {
+      ArrayList documents = new ArrayList();
+      Publication publication = pageEnvelope.getPublication();
+      DocumentIdToPathMapper mapper = publication.getPathMapper();
+      if(mapper instanceof PathToDocumentIdMapper){
+         PathToDocumentIdMapper fileMapper = (PathToDocumentIdMapper) mapper;
+         String documentId = null;
+         String language = null;
+         DocumentBuilder builder = publication.getDocumentBuilder();
+         File[] inconsistentFiles;
+         try{
+            inconsistentFiles = Grep.find(publication.getContentDirectory(area), getReferencesSearchString());
+            for(int i = 0; i < inconsistentFiles.length; i++){
+               // for performance reasons the getReferencesSearchString() is
+               // constructed in a way such that it will catch all files which
+               // have a link to any language version of the current document.
+               // That's why we need to do some additional tests for each hit.
+               String languageOfCurrentDocument = pageEnvelope.getDocument().getLanguage();
+               String defaultLanguage = pageEnvelope.getPublication().getDefaultLanguage();
+               Pattern referencesSearchStringWithLanguage = Pattern.compile(getReferencesSearchString() + "_" + languageOfCurrentDocument);
+               Pattern referencesSearchStringWithOutLanguage = Pattern.compile(getReferencesSearchString() + "\\.html");
+               log.debug("languageOfCurrentDocument: " + languageOfCurrentDocument);
+               log.debug("defaultLanguage: " + defaultLanguage);
+               log.debug("referencesSearchStringWithOutLanguage: " + referencesSearchStringWithOutLanguage.pattern());
+               log.debug("referencesSearchStringWithLanguage: " + referencesSearchStringWithLanguage.pattern());
+               // a link is indeed to the current document if the following conditions
+               // are met:
+               // 1. the link is to foo_xx and the language of the current
+               // document is xx.
+               // 2. or the link is to foo.html and the language of the current
+               // document is the default language.
+               // Now negate the expression because we continue if above (1) and (2) are
+               // false, and you'll get the following if statement
+               if(!Grep.containsPattern(inconsistentFiles[i], referencesSearchStringWithLanguage) && !(Grep.containsPattern(inconsistentFiles[i], referencesSearchStringWithOutLanguage) && languageOfCurrentDocument.equals(defaultLanguage))){
+                  // the reference foo_xx is neither to the language of the current
+                  // document.
+                  // nor is the reference foo.html and the current document is in the
+                  // default language.
+                  // So the reference is of no importance to us, skip
+                  continue;
+               }
+               documentId = fileMapper.getDocumentId(publication, area, inconsistentFiles[i]);
+               log.debug("documentId: " + documentId);
+               language = fileMapper.getLanguage(inconsistentFiles[i]);
+               log.debug("language: " + language);
+               String url = null;
+               if(language != null){
+                  url = builder.buildCanonicalUrl(publication, area, documentId, language);
+                  log.debug("url: " + url);
+               }else{
+                  url = builder.buildCanonicalUrl(publication, area, documentId);
+                  log.debug("url: " + url);
+               }
+               documents.add(builder.buildDocument(publication, url));
             }
-        }
-        return (Document[])documents.toArray(new Document[documents.size()]);
-    }
-
-    /**
-     * Find all internal references in the current document to documents which have
-     * not been published yet.
-     * 
-     * @return an <code>array</code> of <code>Document</code> of references 
-     * from the current document to documents which have not been published yet.
-     *
-     * @throws ProcessingException if the current document cannot be opened.
-     */
-    public Document[] getInternalReferences() throws ProcessingException {
-        ArrayList unpublishedReferences = new ArrayList();
-        SiteTree sitetree;
-        Pattern internalLinkPattern = getInternalLinkPattern();
-        Publication publication = pageEnvelope.getPublication();
-        DocumentBuilder builder = publication.getDocumentBuilder();
-        try {
-            sitetree = publication.getTree(Publication.LIVE_AREA);
-            String[] internalLinks =
-                Grep.findPattern(
-                    pageEnvelope.getDocument().getFile(),
-                    internalLinkPattern,
-                    1);
-            String[] internalLinksLanguages =
-                Grep.findPattern(
-                    pageEnvelope.getDocument().getFile(),
-                    internalLinkPattern,
-                    2);
-
-            for (int i = 0; i < internalLinks.length; i++) {
-                String docId = internalLinks[i];
-                String language = null;
-
-                log.debug("docId: " + docId);
-                if (internalLinksLanguages[i] != null) {
-                    // trim the leading '_'
-                    language = internalLinksLanguages[i].substring(1);
-                }
-
-                log.debug("language: " + language);
-                SiteTreeNode documentNode = sitetree.getNode(docId);
-
-                if (language == null) {
-                    String url =
-                        "/"
-                            + publication.getId()
-                            + "/"
-                            + pageEnvelope.getDocument().getArea()
-                            + docId
-                            + ".html";
-                    language =
-                        builder.buildDocument(publication, url).getLanguage();
-                }
-                log.debug("language: " + language);
-                if (documentNode == null
-                    || documentNode.getLabel(language) == null) {
-                    // the docId has not been published for the given language
-                    String url = null;
-                    if (language != null) {
-                        url =
-                            builder.buildCanonicalUrl(
-                                publication,
-                                Publication.AUTHORING_AREA,
-                                docId,
-                                language);
-                        log.debug("url: " + url);
-                    } else {
-                        url =
-                            builder.buildCanonicalUrl(
-                                publication,
-                                Publication.AUTHORING_AREA,
-                                docId);
-                        log.debug("url: " + url);
-                    }
-                    unpublishedReferences.add(
-                        builder.buildDocument(publication, url));
-                }
-            }
-        } catch (SiteTreeException e) {
+         }catch(IOException e){
             throw new ProcessingException(e);
-        } catch (IOException e) {
+         }catch(DocumentDoesNotExistException e){
             throw new ProcessingException(e);
-        } catch (DocumentBuildException e) {
+         }catch(DocumentBuildException e){
             throw new ProcessingException(e);
-        }
-        return (Document[])unpublishedReferences.toArray(
-            new Document[unpublishedReferences.size()]);
-    }
+         }
+      }
+      return (Document[]) documents.toArray(new Document[documents.size()]);
+   }
+   /**
+    * Find all internal references in the current document to documents which have not been published yet.
+    * 
+    * @return an <code>array</code> of <code>Document</code> of references from the current document to documents which have not been published yet.
+    * 
+    * @throws ProcessingException
+    *            if the current document cannot be opened.
+    */
+   public Document[] getInternalReferences() throws ProcessingException {
+      ArrayList unpublishedReferences = new ArrayList();
+      SiteTree sitetree;
+      Pattern internalLinkPattern = getInternalLinkPattern();
+      Publication publication = pageEnvelope.getPublication();
+      DocumentBuilder builder = publication.getDocumentBuilder();
+      try{
+         sitetree = publication.getTree(Publication.LIVE_AREA);
+         String[] internalLinks = Grep.findPattern(pageEnvelope.getDocument().getFile(), internalLinkPattern, 1);
+         String[] internalLinksLanguages = Grep.findPattern(pageEnvelope.getDocument().getFile(), internalLinkPattern, 2);
+         for(int i = 0; i < internalLinks.length; i++){
+            String docId = internalLinks[i];
+            String language = null;
+            log.debug("docId: " + docId);
+            if(internalLinksLanguages[i] != null){
+               // trim the leading '_'
+               language = internalLinksLanguages[i].substring(1);
+            }
+            log.debug("language: " + language);
+            SiteTreeNode documentNode = sitetree.getNode(docId);
+            if(language == null){
+               String url = "/" + publication.getId() + "/" + pageEnvelope.getDocument().getArea() + docId + ".html";
+               language = builder.buildDocument(publication, url).getLanguage();
+            }
+            log.debug("language: " + language);
+            if(documentNode == null || documentNode.getLabel(language) == null){
+               // the docId has not been published for the given language
+               String url = null;
+               if(language != null){
+                  url = builder.buildCanonicalUrl(publication, Publication.AUTHORING_AREA, docId, language);
+                  log.debug("url: " + url);
+               }else{
+                  url = builder.buildCanonicalUrl(publication, Publication.AUTHORING_AREA, docId);
+                  log.debug("url: " + url);
+               }
+               unpublishedReferences.add(builder.buildDocument(publication, url));
+            }
+         }
+      }catch(SiteTreeException e){
+         throw new ProcessingException(e);
+      }catch(IOException e){
+         throw new ProcessingException(e);
+      }catch(DocumentBuildException e){
+         throw new ProcessingException(e);
+      }
+      return (Document[]) unpublishedReferences.toArray(new Document[unpublishedReferences.size()]);
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ExportException.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ExportException.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ExportException.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ExportException.java Wed Jan 30 23:44:03 2008
@@ -14,43 +14,42 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publishing;
-
 public class ExportException extends Exception {
-    /**
-     * Creates a new ExportException.
-     */
-    public ExportException() {
-    }
-
-    /**
-     * Creates a new ExportException.
-     * 
-     * @param message the exception message
-     */
-    public ExportException(String message) {
-        super(message);
-    }
-
-    /**
-     * Creates a new ExportException.
-     * 
-     * @param message the exception message
-     * @param cause the cause of the exception
-     */
-    public ExportException(String message, Throwable cause) {
-        super(message + " " + cause.getMessage());
-    }
-
-    /**
-     * Creates a new ExportException.
-     * 
-     * @param cause  the cause of the exception
-     */
-    public ExportException(Throwable cause) {
-        super(cause.getMessage());
-    }
+   private static final long serialVersionUID = 5082241538088335542L;
+   /**
+    * Creates a new ExportException.
+    */
+   public ExportException() {
+   }
+   /**
+    * Creates a new ExportException.
+    * 
+    * @param message
+    *           the exception message
+    */
+   public ExportException(String message) {
+      super(message);
+   }
+   /**
+    * Creates a new ExportException.
+    * 
+    * @param message
+    *           the exception message
+    * @param cause
+    *           the cause of the exception
+    */
+   public ExportException(String message, Throwable cause) {
+      super(message + " " + cause.getMessage());
+   }
+   /**
+    * Creates a new ExportException.
+    * 
+    * @param cause
+    *           the cause of the exception
+    */
+   public ExportException(Throwable cause) {
+      super(cause.getMessage());
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ParentNodeNotFoundException.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ParentNodeNotFoundException.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ParentNodeNotFoundException.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ParentNodeNotFoundException.java Wed Jan 30 23:44:03 2008
@@ -14,47 +14,45 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publishing;
-
 /**
- * Exception to indicate an error when publishing a node where its parent 
- * node has not been published yet.
+ * Exception to indicate an error when publishing a node where its parent node has not been published yet.
  */
-public class ParentNodeNotFoundException extends PublishingException{
-    /**
-     * Creates a new ParentNodeNotFoundException.
-     */
-    public ParentNodeNotFoundException() {
-    }
-
-    /**
-     * Creates a new ParentNodeNotFoundException.
-     * 
-     * @param message the exception message
-     */
-    public ParentNodeNotFoundException(String message) {
-        super(message);
-    }
-
-    /**
-     * Creates a new ParentNodeNotFoundException.
-     * 
-     * @param message the exception message
-     * @param cause the cause of the exception
-     */
-    public ParentNodeNotFoundException(String message, Throwable cause) {
-        super(message + " " + cause.getMessage());
-    }
-
-    /**
-     * Creates a new ParentNodeNotFoundException.
-     * 
-     * @param cause  the cause of the exception
-     */
-    public ParentNodeNotFoundException(Throwable cause) {
-        super(cause.getMessage());
-    }
+public class ParentNodeNotFoundException extends PublishingException {
+   private static final long serialVersionUID = 1L;
+   /**
+    * Creates a new ParentNodeNotFoundException.
+    */
+   public ParentNodeNotFoundException() {
+   }
+   /**
+    * Creates a new ParentNodeNotFoundException.
+    * 
+    * @param message
+    *           the exception message
+    */
+   public ParentNodeNotFoundException(String message) {
+      super(message);
+   }
+   /**
+    * Creates a new ParentNodeNotFoundException.
+    * 
+    * @param message
+    *           the exception message
+    * @param cause
+    *           the cause of the exception
+    */
+   public ParentNodeNotFoundException(String message, Throwable cause) {
+      super(message + " " + cause.getMessage());
+   }
+   /**
+    * Creates a new ParentNodeNotFoundException.
+    * 
+    * @param cause
+    *           the cause of the exception
+    */
+   public ParentNodeNotFoundException(Throwable cause) {
+      super(cause.getMessage());
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/PublishingEnvironment.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/PublishingEnvironment.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/PublishingEnvironment.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/PublishingEnvironment.java Wed Jan 30 23:44:03 2008
@@ -14,258 +14,215 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publishing;
-
 import java.io.File;
-
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.log4j.Category;
-
-
+import org.apache.log4j.Logger;
 public class PublishingEnvironment implements Configurable {
-    private static Category log = Category.getInstance(PublishingEnvironment.class);
-    public static final String CONFIGURATION_FILE = "config" + File.separator + "publishing" +
-        File.separator + "publisher.xconf";
-    public static final String PUBLICATION_PREFIX = "lenya" + File.separator + "pubs" +
-        File.separator;
-    public static final String PUBLICATION_PATH = "publication-path";
-    public static final String PARAMETER_AUTHORING_PATH = "authoring-path";
-    public static final String PARAMETER_TREE_AUTHORING_PATH = "tree-authoring-path";
-    public static final String PARAMETER_LIVE_PATH = "live-path";
-    public static final String PARAMETER_TREE_LIVE_PATH = "tree-live-path";
-    public static final String PARAMETER_REPLICATION_PATH = "replication-path";
-    public static final String PARAMETER_EXPORT_PATH = "export-path";
-    public static final String PARAMETER_SUBSTITUTE_REGEXP = "substitute-regexp";
-    public static final String PARAMETER_SUBSTITUTE_REPLACEMENT = "substitute-replacement";
-    private String publicationPath;
-    private String replicationDirectory;
-    private String authoringPath;
-    private String livePath;
-    private String treeAuthoringPath;
-    private String treeLivePath;
-    private String exportDirectory;
-    private String substituteExpression;
-    private String substituteReplacement;
-
-    /**
-     * Creates a new PublishingEnvironment object.
-     *
-     * @param contextPath DOCUMENT ME!
-     * @param publicationId DOCUMENT ME!
-     */
-    public PublishingEnvironment(String contextPath, String publicationId) {
-        this(PublishingEnvironment.getPublicationPath(contextPath, publicationId));
-        log.debug("Context Path and Publication Id: " + contextPath + "::" + publicationId);
-    }
-
-    /**
-     * Creates a new PublishingEnvironment object.
-     *
-     * @param publicationPath DOCUMENT ME!
-     */
-    public PublishingEnvironment(String publicationPath) {
-        setPublicationPath(publicationPath);
-
-        String configurationFilePath = publicationPath + CONFIGURATION_FILE;
-
-        File configurationFile = new File(configurationFilePath);
-
-        try {
-            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
-            Configuration configuration = builder.buildFromFile(configurationFile);
-            configure(configuration);
-        } catch (Exception e) {
-            log.info(
-                "Did not load publishing configuration from publisher.xconf (No such file or directory: " + configurationFile  + "). " +
-                "That means you can't access all PublishingEnvironment parameters and you should only " +
-                "use the AntTask. But don't panic, this file has been DEPRECATED.");
-        }
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @param configuration DOCUMENT ME!
-     *
-     * @throws org.apache.avalon.framework.configuration.ConfigurationException DOCUMENT ME!
-     */
-    public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
-        throws org.apache.avalon.framework.configuration.ConfigurationException {
-        // authoring
-        setAuthoringPath(configuration.getChild("authoring").getChild("documents").getAttribute("href"));
-        setTreeAuthoringPath(configuration.getChild("authoring").getChild("tree").getAttribute("href"));
-
-        // replication
-        setReplicationDirectory(configuration.getChild("replication").getChild("pending-documents")
-                                             .getAttribute("href"));
-
-        // live
-        setLivePath(configuration.getChild("live").getChild("documents").getAttribute("href"));
-        setTreeLivePath(configuration.getChild("live").getChild("tree").getAttribute("href"));
-
-        // export
-        setExportDirectory(configuration.getChild("export").getChild("destination").getAttribute("href"));
-        setSubstituteExpression(configuration.getChild("export").getChild("substitution")
-                                             .getAttribute("regexp"));
-        setSubstituteReplacementExpression(configuration.getChild("export").getChild("substitution")
-                                                        .getAttribute("replacement"));
-
-        log.debug("CONFIGURATION:\nauthoring path=" + getAuthoringPath() + "\nlive path=" +
-            getLivePath());
-        log.debug("CONFIGURATION:\ntree authoring path=" + getTreeAuthoringPath() +
-            "\ntree live path=" + getTreeLivePath());
-
-        log.debug("CONFIGURATION:\nDirectory Prefix: href=" + getExportDirectory());
-        log.debug("CONFIGURATION:\nPrefix Substitute: href=" + getSubstituteExpression());
-
-        log.debug("CONFIGURATION:\nReplication Directory: href=" + getReplicationDirectory());
-    }
-
-    /**
-     * Returns the publication directory.
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getPublicationPath() {
-        return publicationPath;
-    }
-
-    /**
-     * Returns the publication directory.
-     */
-    public File getPublicationDirectory() {
-        return new File(getPublicationPath());
-    }
-
-    protected void setPublicationPath(String path) {
-        publicationPath = path;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getAuthoringPath() {
-        return authoringPath;
-    }
-
-    protected void setAuthoringPath(String path) {
-        authoringPath = path;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getLivePath() {
-        return livePath;
-    }
-
-    protected void setLivePath(String path) {
-        livePath = path;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getTreeAuthoringPath() {
-        return treeAuthoringPath;
-    }
-
-    protected void setTreeAuthoringPath(String path) {
-        treeAuthoringPath = path;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getTreeLivePath() {
-        return treeLivePath;
-    }
-
-    protected void setTreeLivePath(String path) {
-        treeLivePath = path;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getReplicationDirectory() {
-        return replicationDirectory;
-    }
-
-    protected void setReplicationDirectory(String directory) {
-        replicationDirectory = directory;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getExportDirectory() {
-        return exportDirectory;
-    }
-
-    protected void setExportDirectory(String directory) {
-        exportDirectory = directory;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getSubstituteExpression() {
-        return substituteExpression;
-    }
-
-    protected void setSubstituteExpression(String substitute) {
-        substituteExpression = substitute;
-    }
-
-    /**
-     * Set replacement string, which was read from publisher.xconf
-     */
-    protected void setSubstituteReplacementExpression(String replacement) {
-        substituteReplacement = replacement;
-    }
-
-    /**
-     * Get the replacement string, which was read from publisher.xconf
-     *
-     * @return The replacement string
-     */
-    public String getSubstituteReplacement() {
-        return substituteReplacement;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @param servletContextPath DOCUMENT ME!
-     * @param publicationId DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public static String getPublicationPath(String servletContextPath, String publicationId) {
-        if (!servletContextPath.endsWith(File.separator)) {
-            servletContextPath += File.separator;
-        }
-
-        return servletContextPath + PUBLICATION_PREFIX + publicationId + File.separator;
-    }
+   private static Logger log = Logger.getLogger(PublishingEnvironment.class);
+   public static final String CONFIGURATION_FILE = "config" + File.separator + "publishing" + File.separator + "publisher.xconf";
+   public static final String PUBLICATION_PREFIX = "lenya" + File.separator + "pubs" + File.separator;
+   public static final String PUBLICATION_PATH = "publication-path";
+   public static final String PARAMETER_AUTHORING_PATH = "authoring-path";
+   public static final String PARAMETER_TREE_AUTHORING_PATH = "tree-authoring-path";
+   public static final String PARAMETER_LIVE_PATH = "live-path";
+   public static final String PARAMETER_TREE_LIVE_PATH = "tree-live-path";
+   public static final String PARAMETER_REPLICATION_PATH = "replication-path";
+   public static final String PARAMETER_EXPORT_PATH = "export-path";
+   public static final String PARAMETER_SUBSTITUTE_REGEXP = "substitute-regexp";
+   public static final String PARAMETER_SUBSTITUTE_REPLACEMENT = "substitute-replacement";
+   private String publicationPath;
+   private String replicationDirectory;
+   private String authoringPath;
+   private String livePath;
+   private String treeAuthoringPath;
+   private String treeLivePath;
+   private String exportDirectory;
+   private String substituteExpression;
+   private String substituteReplacement;
+   /**
+    * Creates a new PublishingEnvironment object.
+    * 
+    * @param contextPath
+    *           DOCUMENT ME!
+    * @param publicationId
+    *           DOCUMENT ME!
+    */
+   public PublishingEnvironment(String contextPath, String publicationId) {
+      this(PublishingEnvironment.getPublicationPath(contextPath, publicationId));
+      log.debug("Context Path and Publication Id: " + contextPath + "::" + publicationId);
+   }
+   /**
+    * Creates a new PublishingEnvironment object.
+    * 
+    * @param publicationPath
+    *           DOCUMENT ME!
+    */
+   public PublishingEnvironment(String publicationPath) {
+      setPublicationPath(publicationPath);
+      String configurationFilePath = publicationPath + CONFIGURATION_FILE;
+      File configurationFile = new File(configurationFilePath);
+      try{
+         DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+         Configuration configuration = builder.buildFromFile(configurationFile);
+         configure(configuration);
+      }catch(Exception e){
+         log.info("Did not load publishing configuration from publisher.xconf (No such file or directory: " + configurationFile + "). " + "That means you can't access all PublishingEnvironment parameters and you should only " + "use the AntTask. But don't panic, this file has been DEPRECATED.");
+      }
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @param configuration
+    *           DOCUMENT ME!
+    * 
+    * @throws org.apache.avalon.framework.configuration.ConfigurationException
+    *            DOCUMENT ME!
+    */
+   public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException {
+      // authoring
+      setAuthoringPath(configuration.getChild("authoring").getChild("documents").getAttribute("href"));
+      setTreeAuthoringPath(configuration.getChild("authoring").getChild("tree").getAttribute("href"));
+      // replication
+      setReplicationDirectory(configuration.getChild("replication").getChild("pending-documents").getAttribute("href"));
+      // live
+      setLivePath(configuration.getChild("live").getChild("documents").getAttribute("href"));
+      setTreeLivePath(configuration.getChild("live").getChild("tree").getAttribute("href"));
+      // export
+      setExportDirectory(configuration.getChild("export").getChild("destination").getAttribute("href"));
+      setSubstituteExpression(configuration.getChild("export").getChild("substitution").getAttribute("regexp"));
+      setSubstituteReplacementExpression(configuration.getChild("export").getChild("substitution").getAttribute("replacement"));
+      log.debug("CONFIGURATION:\nauthoring path=" + getAuthoringPath() + "\nlive path=" + getLivePath());
+      log.debug("CONFIGURATION:\ntree authoring path=" + getTreeAuthoringPath() + "\ntree live path=" + getTreeLivePath());
+      log.debug("CONFIGURATION:\nDirectory Prefix: href=" + getExportDirectory());
+      log.debug("CONFIGURATION:\nPrefix Substitute: href=" + getSubstituteExpression());
+      log.debug("CONFIGURATION:\nReplication Directory: href=" + getReplicationDirectory());
+   }
+   /**
+    * Returns the publication directory.
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getPublicationPath() {
+      return publicationPath;
+   }
+   /**
+    * Returns the publication directory.
+    */
+   public File getPublicationDirectory() {
+      return new File(getPublicationPath());
+   }
+   protected void setPublicationPath(String path) {
+      publicationPath = path;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getAuthoringPath() {
+      return authoringPath;
+   }
+   protected void setAuthoringPath(String path) {
+      authoringPath = path;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getLivePath() {
+      return livePath;
+   }
+   protected void setLivePath(String path) {
+      livePath = path;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getTreeAuthoringPath() {
+      return treeAuthoringPath;
+   }
+   protected void setTreeAuthoringPath(String path) {
+      treeAuthoringPath = path;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getTreeLivePath() {
+      return treeLivePath;
+   }
+   protected void setTreeLivePath(String path) {
+      treeLivePath = path;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getReplicationDirectory() {
+      return replicationDirectory;
+   }
+   protected void setReplicationDirectory(String directory) {
+      replicationDirectory = directory;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getExportDirectory() {
+      return exportDirectory;
+   }
+   protected void setExportDirectory(String directory) {
+      exportDirectory = directory;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getSubstituteExpression() {
+      return substituteExpression;
+   }
+   protected void setSubstituteExpression(String substitute) {
+      substituteExpression = substitute;
+   }
+   /**
+    * Set replacement string, which was read from publisher.xconf
+    */
+   protected void setSubstituteReplacementExpression(String replacement) {
+      substituteReplacement = replacement;
+   }
+   /**
+    * Get the replacement string, which was read from publisher.xconf
+    * 
+    * @return The replacement string
+    */
+   public String getSubstituteReplacement() {
+      return substituteReplacement;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @param servletContextPath
+    *           DOCUMENT ME!
+    * @param publicationId
+    *           DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public static String getPublicationPath(String servletContextPath, String publicationId) {
+      if(!servletContextPath.endsWith(File.separator)){
+         servletContextPath += File.separator;
+      }
+      return servletContextPath + PUBLICATION_PREFIX + publicationId + File.separator;
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/PublishingException.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/PublishingException.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/PublishingException.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/PublishingException.java Wed Jan 30 23:44:03 2008
@@ -14,43 +14,42 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publishing;
-
 public class PublishingException extends Exception {
-    /**
-     * Creates a new PublishingException.
-     */
-    public PublishingException() {
-    }
-
-    /**
-     * Creates a new PublishingException.
-     * 
-     * @param message the exception message
-     */
-    public PublishingException(String message) {
-        super(message);
-    }
-
-    /**
-     * Creates a new PublishingException.
-     * 
-     * @param message the exception message
-     * @param cause the cause of the exception
-     */
-    public PublishingException(String message, Throwable cause) {
-        super(message + " " + cause.getMessage());
-    }
-
-    /**
-     * Creates a new PublishingException.
-     * 
-     * @param cause  the cause of the exception
-     */
-    public PublishingException(Throwable cause) {
-        super(cause.getMessage());
-    }
+   private static final long serialVersionUID = 1L;
+   /**
+    * Creates a new PublishingException.
+    */
+   public PublishingException() {
+   }
+   /**
+    * Creates a new PublishingException.
+    * 
+    * @param message
+    *           the exception message
+    */
+   public PublishingException(String message) {
+      super(message);
+   }
+   /**
+    * Creates a new PublishingException.
+    * 
+    * @param message
+    *           the exception message
+    * @param cause
+    *           the cause of the exception
+    */
+   public PublishingException(String message, Throwable cause) {
+      super(message + " " + cause.getMessage());
+   }
+   /**
+    * Creates a new PublishingException.
+    * 
+    * @param cause
+    *           the cause of the exception
+    */
+   public PublishingException(Throwable cause) {
+      super(cause.getMessage());
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ResourcePublishingEnvironment.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ResourcePublishingEnvironment.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ResourcePublishingEnvironment.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/ResourcePublishingEnvironment.java Wed Jan 30 23:44:03 2008
@@ -14,100 +14,90 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publishing;
-
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.log4j.Category;
-
-
+import org.apache.log4j.Logger;
 /**
  * DOCUMENT ME!
- *
+ * 
  */
 public class ResourcePublishingEnvironment extends PublishingEnvironment {
-    private static Category log = Category.getInstance(ResourcePublishingEnvironment.class);
-    public static final String PARAMETER_RESOURCE_AUTHORING_PATH = "resources-authoring-path";
-    public static final String PARAMETER_RESOURCE_LIVE_PATH = "resources-live-path";
-    private String resourceAuthoringPath;
-    private String resourceLivePath;
-
-    /**
-     * Creates a new ResourcePublishingEnvironment object.
-     *
-     * @param contextPath DOCUMENT ME!
-     * @param publicationId DOCUMENT ME!
-     */
-    public ResourcePublishingEnvironment(String contextPath, String publicationId) {
-        super(contextPath, publicationId);
-    }
-
-    /**
-     * Creates a new ResourcePublishingEnvironment object.
-     *
-     * @param publicationPath DOCUMENT ME!
-     */
-    public ResourcePublishingEnvironment(String publicationPath) {
-        super(publicationPath);
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @param configuration DOCUMENT ME!
-     *
-     * @throws org.apache.avalon.framework.configuration.ConfigurationException DOCUMENT ME!
-     */
-    public void configure(Configuration configuration)
-        throws ConfigurationException {
-        super.configure(configuration);
-
-        // authoring
-        setResourceAuthoringPath(configuration.getChild("authoring").getChild("resource")
-                                              .getAttribute("href"));
-
-        // live
-        setResourceLivePath(configuration.getChild("live").getChild("resource").getAttribute("href"));
-        log.debug("CONFIGURATION:\nresource authoring path=" + getResourceAuthoringPath() +
-            "\nresource live path=" + getResourceLivePath());
-    }
-
-    /**
-     * Get the live resource path.
-     *
-     * @return a <code>String</code> value
-     */
-    public String getResourceLivePath() {
-        return resourceLivePath;
-    }
-
-    /**
-     * Set the live resource path.
-     *
-     * @param path a <code>String</code> value
-     */
-    protected void setResourceLivePath(String path) {
-        resourceLivePath = path;
-    }
-
-    /**
-     * Get the authoring resource path.
-     *
-     * @return a <code>String</code> value
-     */
-    public String getResourceAuthoringPath() {
-        return resourceAuthoringPath;
-    }
-
-    /**
-     * Set the authoring resource path.
-     *
-     * @param path a <code>String</code> value
-     */
-    protected void setResourceAuthoringPath(String path) {
-        resourceAuthoringPath = path;
-    }
+   private static Logger log = Logger.getLogger(ResourcePublishingEnvironment.class);
+   public static final String PARAMETER_RESOURCE_AUTHORING_PATH = "resources-authoring-path";
+   public static final String PARAMETER_RESOURCE_LIVE_PATH = "resources-live-path";
+   private String resourceAuthoringPath;
+   private String resourceLivePath;
+   /**
+    * Creates a new ResourcePublishingEnvironment object.
+    * 
+    * @param contextPath
+    *           DOCUMENT ME!
+    * @param publicationId
+    *           DOCUMENT ME!
+    */
+   public ResourcePublishingEnvironment(String contextPath, String publicationId) {
+      super(contextPath, publicationId);
+   }
+   /**
+    * Creates a new ResourcePublishingEnvironment object.
+    * 
+    * @param publicationPath
+    *           DOCUMENT ME!
+    */
+   public ResourcePublishingEnvironment(String publicationPath) {
+      super(publicationPath);
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @param configuration
+    *           DOCUMENT ME!
+    * 
+    * @throws org.apache.avalon.framework.configuration.ConfigurationException
+    *            DOCUMENT ME!
+    */
+   public void configure(Configuration configuration) throws ConfigurationException {
+      super.configure(configuration);
+      // authoring
+      setResourceAuthoringPath(configuration.getChild("authoring").getChild("resource").getAttribute("href"));
+      // live
+      setResourceLivePath(configuration.getChild("live").getChild("resource").getAttribute("href"));
+      log.debug("CONFIGURATION:\nresource authoring path=" + getResourceAuthoringPath() + "\nresource live path=" + getResourceLivePath());
+   }
+   /**
+    * Get the live resource path.
+    * 
+    * @return a <code>String</code> value
+    */
+   public String getResourceLivePath() {
+      return resourceLivePath;
+   }
+   /**
+    * Set the live resource path.
+    * 
+    * @param path
+    *           a <code>String</code> value
+    */
+   protected void setResourceLivePath(String path) {
+      resourceLivePath = path;
+   }
+   /**
+    * Get the authoring resource path.
+    * 
+    * @return a <code>String</code> value
+    */
+   public String getResourceAuthoringPath() {
+      return resourceAuthoringPath;
+   }
+   /**
+    * Set the authoring resource path.
+    * 
+    * @param path
+    *           a <code>String</code> value
+    */
+   protected void setResourceAuthoringPath(String path) {
+      resourceAuthoringPath = path;
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/StaticHTMLExporter.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/StaticHTMLExporter.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/StaticHTMLExporter.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/publishing/StaticHTMLExporter.java Wed Jan 30 23:44:03 2008
@@ -14,123 +14,89 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.publishing;
-
 import java.io.File;
 import java.net.URL;
 import java.util.StringTokenizer;
-
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.lenya.cms.task.ExecutionException;
-import org.apache.log4j.Category;
-
-
+import org.apache.log4j.Logger;
 /**
- * This Exporter uses WGet to download HTML files from URIs and saves them. The Task parameters
- * are: <code><strong>server-uri</strong></code>: the server uri<br/>
- * <code><strong>server-port</strong></code>: the server port<br/>
- * <code><strong>publication-id</strong></code>: the publication id<br/>
- * <code><strong>export-path-prefix</strong></code>: the path to save the files to<br/>
- * <code><strong>uris</strong></code>: a comma-separated list of uris to download (without server
- * + port)<br/>
- * <code><strong>substitute-regexp</strong></code>: a regular expression to substitute a part of
- * the path<br/>
+ * This Exporter uses WGet to download HTML files from URIs and saves them. The Task parameters are: <code><strong>server-uri</strong></code>: the server uri<br/> <code><strong>server-port</strong></code>: the server port<br/> <code><strong>publication-id</strong></code>: the publication id<br/> <code><strong>export-path-prefix</strong></code>: the path to save the files to<br/> <code><strong>uris</strong></code>: a comma-separated list of uris to download (without server + port)<br/> <code><strong>substitute-regexp</strong></code>: a regular expression to substitute a part of the path<br/>
  */
 public class StaticHTMLExporter extends AbstractExporter {
-    private static Category log = Category.getInstance(StaticHTMLExporter.class);
-    public static final String PARAMETER_URIS = "uris";
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @param serverURI DOCUMENT ME!
-     * @param serverPort DOCUMENT ME!
-     * @param publicationPath DOCUMENT ME!
-     * @param exportPath DOCUMENT ME!
-     * @param uris DOCUMENT ME!
-     * @param substituteExpression DOCUMENT ME!
-     *
-     * @throws ExportException DOCUMENT ME!
-     */
-    public void export(URL serverURI, int serverPort, String publicationPath, String exportPath,
-        String[] uris, String substituteExpression, String substituteReplacement)
-        throws ExportException {
-        try {
-            String exportDirectory = publicationPath + exportPath;
-
-            if (new File(exportPath).isAbsolute()) {
-                exportDirectory = exportPath;
-            }
-
-            log.info(".export(): Export directory: " + exportDirectory + " (" + publicationPath +
-                " , " + exportPath + ")");
-
-            org.apache.lenya.net.WGet wget = new org.apache.lenya.net.WGet();
-            wget.setDirectoryPrefix(exportDirectory);
-
-            String fullServerURI = serverURI + ":" + serverPort;
-
-            for (int i = 0; i < uris.length; i++) {
-                URL uri = new URL(fullServerURI + uris[i]);
-                log.info(".export(): Export static HTML: " + uri);
-
-                wget.download(uri, substituteExpression, substituteReplacement);
-            }
-        } catch (Exception e) {
-            throw new ExportException(e);
-        }
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @param contextPath DOCUMENT ME!
-     */
-    public void execute(String contextPath) throws ExecutionException {
-        try {
-            String publicationId = getParameters().getParameter(PARAMETER_PUBLICATION_ID);
-
-            Parameters taskParameters = new Parameters();
-
-            PublishingEnvironment environment = new PublishingEnvironment(contextPath, publicationId);
-
-            // read default parameters from PublishingEnvironment
-            taskParameters.setParameter(PublishingEnvironment.PARAMETER_EXPORT_PATH,
-                environment.getExportDirectory());
-            taskParameters.setParameter(PublishingEnvironment.PARAMETER_SUBSTITUTE_REGEXP,
-                environment.getSubstituteExpression());
-            taskParameters.setParameter(PublishingEnvironment.PARAMETER_SUBSTITUTE_REPLACEMENT,
-                environment.getSubstituteReplacement());
-
-            taskParameters.merge(getParameters());
-            parameterize(taskParameters);
-
-            String publicationPath = PublishingEnvironment.getPublicationPath(contextPath,
-                    publicationId);
-
-            int serverPort = getParameters().getParameterAsInteger(PARAMETER_SERVER_PORT);
-            log.debug(".execute(): Server Port: " + serverPort);
-
-            String serverURI = getParameters().getParameter(PARAMETER_SERVER_URI);
-
-            String urisString = getParameters().getParameter(PARAMETER_URIS);
-            StringTokenizer st = new StringTokenizer(urisString, ",");
-            String[] uris = new String[st.countTokens()];
-            int i = 0;
-
-            while (st.hasMoreTokens()) {
-                uris[i++] = st.nextToken();
-            }
-
-            export(new URL(serverURI), serverPort, publicationPath,
-                getParameters().getParameter(PublishingEnvironment.PARAMETER_EXPORT_PATH), uris,
-                getParameters().getParameter(PublishingEnvironment.PARAMETER_SUBSTITUTE_REGEXP),
-                getParameters().getParameter(PublishingEnvironment.PARAMETER_SUBSTITUTE_REPLACEMENT));
-        } catch (Exception e) {
-            throw new ExecutionException(e);
-        }
-    }
+   private static Logger log = Logger.getLogger(StaticHTMLExporter.class);
+   public static final String PARAMETER_URIS = "uris";
+   /**
+    * DOCUMENT ME!
+    * 
+    * @param serverURI
+    *           DOCUMENT ME!
+    * @param serverPort
+    *           DOCUMENT ME!
+    * @param publicationPath
+    *           DOCUMENT ME!
+    * @param exportPath
+    *           DOCUMENT ME!
+    * @param uris
+    *           DOCUMENT ME!
+    * @param substituteExpression
+    *           DOCUMENT ME!
+    * 
+    * @throws ExportException
+    *            DOCUMENT ME!
+    */
+   public void export(URL serverURI, int serverPort, String publicationPath, String exportPath, String[] uris, String substituteExpression, String substituteReplacement) throws ExportException {
+      try{
+         String exportDirectory = publicationPath + exportPath;
+         if(new File(exportPath).isAbsolute()){
+            exportDirectory = exportPath;
+         }
+         log.info(".export(): Export directory: " + exportDirectory + " (" + publicationPath + " , " + exportPath + ")");
+         org.apache.lenya.net.WGet wget = new org.apache.lenya.net.WGet();
+         wget.setDirectoryPrefix(exportDirectory);
+         String fullServerURI = serverURI + ":" + serverPort;
+         for(int i = 0; i < uris.length; i++){
+            URL uri = new URL(fullServerURI + uris[i]);
+            log.info(".export(): Export static HTML: " + uri);
+            wget.download(uri, substituteExpression, substituteReplacement);
+         }
+      }catch(Exception e){
+         throw new ExportException(e);
+      }
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @param contextPath
+    *           DOCUMENT ME!
+    */
+   public void execute(String contextPath) throws ExecutionException {
+      try{
+         String publicationId = getParameters().getParameter(PARAMETER_PUBLICATION_ID);
+         Parameters taskParameters = new Parameters();
+         PublishingEnvironment environment = new PublishingEnvironment(contextPath, publicationId);
+         // read default parameters from PublishingEnvironment
+         taskParameters.setParameter(PublishingEnvironment.PARAMETER_EXPORT_PATH, environment.getExportDirectory());
+         taskParameters.setParameter(PublishingEnvironment.PARAMETER_SUBSTITUTE_REGEXP, environment.getSubstituteExpression());
+         taskParameters.setParameter(PublishingEnvironment.PARAMETER_SUBSTITUTE_REPLACEMENT, environment.getSubstituteReplacement());
+         taskParameters.merge(getParameters());
+         parameterize(taskParameters);
+         String publicationPath = PublishingEnvironment.getPublicationPath(contextPath, publicationId);
+         int serverPort = getParameters().getParameterAsInteger(PARAMETER_SERVER_PORT);
+         log.debug(".execute(): Server Port: " + serverPort);
+         String serverURI = getParameters().getParameter(PARAMETER_SERVER_URI);
+         String urisString = getParameters().getParameter(PARAMETER_URIS);
+         StringTokenizer st = new StringTokenizer(urisString, ",");
+         String[] uris = new String[st.countTokens()];
+         int i = 0;
+         while(st.hasMoreTokens()){
+            uris[i++] = st.nextToken();
+         }
+         export(new URL(serverURI), serverPort, publicationPath, getParameters().getParameter(PublishingEnvironment.PARAMETER_EXPORT_PATH), uris, getParameters().getParameter(PublishingEnvironment.PARAMETER_SUBSTITUTE_REGEXP), getParameters().getParameter(PublishingEnvironment.PARAMETER_SUBSTITUTE_REPLACEMENT));
+      }catch(Exception e){
+         throw new ExecutionException(e);
+      }
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/Configuration.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/Configuration.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/Configuration.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/Configuration.java Wed Jan 30 23:44:03 2008
@@ -14,57 +14,45 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.rc;
-
 import java.util.Properties;
-
-import org.apache.log4j.Category;
-
-
+import org.apache.log4j.Logger;
 /**
  * Reads conf.properties
  */
 public class Configuration {
-    private static Category log = Category.getInstance(Configuration.class);
-    
-    private String rcmlDirectory = null;
-    private String backupDirectory = null;
-
-    /**
-     * Creates a new Configuration object.
-     */
-    public Configuration() {
-        String propertiesFileName = "conf.properties";
-        Properties properties = new Properties();
-
-        try {
-            properties.load(Configuration.class.getResourceAsStream(propertiesFileName));
-        } catch (Exception e) {
-            log.fatal(": Failed to load properties from resource: " + propertiesFileName);
-        }
-
-        rcmlDirectory = properties.getProperty("rcmlDirectory");
-        backupDirectory = properties.getProperty("backupDirectory");
-    }
-
-    /**
-     * Get the backup directory
-     * 
-     * @return the backup directory
-     */
-    public String getBackupDirectory() {
-        return backupDirectory;
-    }
-
-    /**
-     * Get the rcml directory
-     * 
-     * @return the rcml directory
-     */
-    public String getRcmlDirectory() {
-        return rcmlDirectory;
-    }
+   private static Logger log = Logger.getLogger(Configuration.class);
+   private String rcmlDirectory = null;
+   private String backupDirectory = null;
+   /**
+    * Creates a new Configuration object.
+    */
+   public Configuration() {
+      String propertiesFileName = "conf.properties";
+      Properties properties = new Properties();
+      try{
+         properties.load(Configuration.class.getResourceAsStream(propertiesFileName));
+      }catch(Exception e){
+         log.fatal(": Failed to load properties from resource: " + propertiesFileName);
+      }
+      rcmlDirectory = properties.getProperty("rcmlDirectory");
+      backupDirectory = properties.getProperty("backupDirectory");
+   }
+   /**
+    * Get the backup directory
+    * 
+    * @return the backup directory
+    */
+   public String getBackupDirectory() {
+      return backupDirectory;
+   }
+   /**
+    * Get the rcml directory
+    * 
+    * @return the rcml directory
+    */
+   public String getRcmlDirectory() {
+      return rcmlDirectory;
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/FileReservedCheckInException.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/FileReservedCheckInException.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/FileReservedCheckInException.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/FileReservedCheckInException.java Wed Jan 30 23:44:03 2008
@@ -14,95 +14,84 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.rc;
-
 import java.util.Date;
-
-
 /**
  * Reserved check-in exception
  */
 public class FileReservedCheckInException extends Exception {
-    private String source = null;
-    private Date date = null;
-    private String username = null;
-    private String typeString = null;
-    private short type;
-
-    /**
-     * Creates a new FileReservedCheckInException object.
-     *
-     * @param source DOCUMENT ME!
-     * @param rcml DOCUMENT ME!
-     *
-     * @throws Exception DOCUMENT ME!
-     */
-    public FileReservedCheckInException(String source, RCML rcml)
-        throws Exception {
-        this.source = source;
-
-        try {
-            RCMLEntry rcmlEntry = rcml.getLatestEntry();
-
-            username = rcmlEntry.getIdentity();
-            date = new Date(rcmlEntry.getTime());
-            type = rcmlEntry.getType();
-
-            if (type == RCML.co) {
-                typeString = "Checkout";
-            } else {
-                typeString = "Checkin";
-            }
-        } catch (Exception exception) {
-            throw new Exception("Unable to create FileReservedCheckInException object!");
-        }
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getMessage() {
-        return "Unable to check in the file " + this.source + " because of a " + this.typeString +
-        " by user " + this.username + " at " + this.date;
-    }
-    /**
-     * Get the date
-     * 
-     * @return the date
-     */
-    public Date getDate() {
-        return date;
-    }
-
-    /**
-     * Get the typeString
-     * 
-     * @return the type string
-     */
-    public String getTypeString() {
-        return typeString;
-    }
-
-    /**
-     * Get the user name.
-     * 
-     * @return the user name
-     */
-    public String getUsername() {
-        return username;
-    }
-
-    /**
-     * Get source
-     * 
-     * @return source
-     */
-    public String getSource() {
-        return source;
-    }
+   private static final long serialVersionUID = 1L;
+   private String source = null;
+   private Date date = null;
+   private String username = null;
+   private String typeString = null;
+   private short type;
+   /**
+    * Creates a new FileReservedCheckInException object.
+    * 
+    * @param source
+    *           DOCUMENT ME!
+    * @param rcml
+    *           DOCUMENT ME!
+    * 
+    * @throws Exception
+    *            DOCUMENT ME!
+    */
+   public FileReservedCheckInException(String source, RCML rcml) throws Exception {
+      this.source = source;
+      try{
+         RCMLEntry rcmlEntry = rcml.getLatestEntry();
+         username = rcmlEntry.getIdentity();
+         date = new Date(rcmlEntry.getTime());
+         type = rcmlEntry.getType();
+         if(type == RCML.co){
+            typeString = "Checkout";
+         }else{
+            typeString = "Checkin";
+         }
+      }catch(Exception exception){
+         throw new Exception("Unable to create FileReservedCheckInException object!");
+      }
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getMessage() {
+      return "Unable to check in the file " + this.source + " because of a " + this.typeString + " by user " + this.username + " at " + this.date;
+   }
+   /**
+    * Get the date
+    * 
+    * @return the date
+    */
+   public Date getDate() {
+      return date;
+   }
+   /**
+    * Get the typeString
+    * 
+    * @return the type string
+    */
+   public String getTypeString() {
+      return typeString;
+   }
+   /**
+    * Get the user name.
+    * 
+    * @return the user name
+    */
+   public String getUsername() {
+      return username;
+   }
+   /**
+    * Get source
+    * 
+    * @return source
+    */
+   public String getSource() {
+      return source;
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/FileReservedCheckOutException.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/FileReservedCheckOutException.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/FileReservedCheckOutException.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/FileReservedCheckOutException.java Wed Jan 30 23:44:03 2008
@@ -14,57 +14,49 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.rc;
-
 import java.util.Date;
-
-
 public class FileReservedCheckOutException extends Exception {
-    private String source = null;
-    private Date checkOutDate = null;
-    private String checkOutUsername = null;
-
-    /**
-     * Creates a new FileReservedCheckOutException object.
-     *
-     * @param source DOCUMENT ME!
-     * @param rcml DOCUMENT ME!
-     *
-     * @throws Exception DOCUMENT ME!
-     */
-    public FileReservedCheckOutException(String source, RCML rcml)
-        throws Exception {
-        this.source = source;
-
-        try {
-            CheckOutEntry coe = rcml.getLatestCheckOutEntry();
-
-            checkOutUsername = coe.getIdentity();
-            checkOutDate = new Date(coe.getTime());
-        } catch (Exception exception) {
-            throw new Exception("Unable to create FileReservedCheckOutException object!");
-        }
-    }
-    
-    /**
-     * Get the date of the checkout.
-     * 
-     * @return the date of the checkout
-     */
-    public Date getCheckOutDate() {
-        return checkOutDate;
-    }
-
-    /**
-     * Get the user name who did this checkout.
-     * 
-     * @return the user name of this checkout
-     */
-    public String getCheckOutUsername() {
-        return checkOutUsername;
-    }
-
+   private static final long serialVersionUID = 1L;
+   // private String source = null;
+   private Date checkOutDate = null;
+   private String checkOutUsername = null;
+   /**
+    * Creates a new FileReservedCheckOutException object.
+    * 
+    * @param source
+    *           DOCUMENT ME!
+    * @param rcml
+    *           DOCUMENT ME!
+    * 
+    * @throws Exception
+    *            DOCUMENT ME!
+    */
+   public FileReservedCheckOutException(String source, RCML rcml) throws Exception {
+      // this.source = source;
+      try{
+         CheckOutEntry coe = rcml.getLatestCheckOutEntry();
+         checkOutUsername = coe.getIdentity();
+         checkOutDate = new Date(coe.getTime());
+      }catch(Exception exception){
+         throw new Exception("Unable to create FileReservedCheckOutException object!");
+      }
+   }
+   /**
+    * Get the date of the checkout.
+    * 
+    * @return the date of the checkout
+    */
+   public Date getCheckOutDate() {
+      return checkOutDate;
+   }
+   /**
+    * Get the user name who did this checkout.
+    * 
+    * @return the user name of this checkout
+    */
+   public String getCheckOutUsername() {
+      return checkOutUsername;
+   }
 }

Modified: lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/RCEnvironment.java
URL: http://svn.apache.org/viewvc/lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/RCEnvironment.java?rev=617035&r1=617034&r2=617035&view=diff
==============================================================================
--- lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/RCEnvironment.java (original)
+++ lenya/branches/revolution/1.3.x/src/java/org/apache/lenya/cms/rc/RCEnvironment.java Wed Jan 30 23:44:03 2008
@@ -14,117 +14,105 @@
  *  limitations under the License.
  *
  */
-
 /* $Id$  */
-
 package org.apache.lenya.cms.rc;
-
 import java.io.File;
 import java.util.HashMap;
 import java.util.Map;
-
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
-import org.apache.log4j.Category;
-
+import org.apache.log4j.Logger;
 public class RCEnvironment implements Configurable {
-    private static Category log = Category.getInstance(RCEnvironment.class);
-    public static final String CONFIGURATION_FILE = "lenya" + File.separator + "config" +
-        File.separator + "rc" + File.separator + "revision-controller.xconf";
-    public static final String RCML_DIRECTORY = "rcml-directory";
-    public static final String BACKUP_DIRECTORY = "backup-directory";
-    private String rcmlDirectory;
-    private String backupDirectory;
-    
-    private static Map instances = new HashMap();
-    
-    /**
-     * Returns the singleton RC environment for this context path.
-     * @param contextPath The context path (the Lenya webapp directory).
-     * @return An RC environment.
-     */
-    public static RCEnvironment getInstance(String contextPath) {
-        RCEnvironment instance = (RCEnvironment) instances.get(contextPath); 
-        if (instance == null) {
-            instance = new RCEnvironment(contextPath);
-            instances.put(contextPath, instance);
-        }
-        return instance;
-    }
-
-    /**
-     * Creates a new RCEnvironment object.
-     *
-     * @param contextPath DOCUMENT ME!
-     */
-    public RCEnvironment(String contextPath) {
-        log.debug("context path:" + contextPath);
-
-        String configurationFilePath = contextPath + "/" + CONFIGURATION_FILE;
-        log.debug("configuration file path:" + configurationFilePath);
-
-        File configurationFile = new File(configurationFilePath);
-
-        try {
-            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
-            Configuration configuration = builder.buildFromFile(configurationFile);
-            configure(configuration);
-        } catch (Exception e) {
-            log.error("Cannot load revision controller configuration! ", e);
-        }
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @param configuration DOCUMENT ME!
-     *
-     * @throws org.apache.avalon.framework.configuration.ConfigurationException DOCUMENT ME!
-     */
-    public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
-        throws org.apache.avalon.framework.configuration.ConfigurationException {
-        // revision controller
-        setRCMLDirectory(configuration.getChild("rcmlDirectory").getAttribute("href"));
-        setBackupDirectory(configuration.getChild("backupDirectory").getAttribute("href"));
-
-        log.debug("CONFIGURATION:\nRCML Directory: href=" + getRCMLDirectory());
-        log.debug("CONFIGURATION:\nBackup Directory: href=" + getBackupDirectory());
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getRCMLDirectory() {
-        return rcmlDirectory;
-    }
-
-	/**
-	 * Set the rcml directory
-	 * 
-	 * @param rcmlDir the path to the rcml directory
-	 */
-    protected void setRCMLDirectory(String rcmlDir) {
-        rcmlDirectory = rcmlDir;
-    }
-
-    /**
-     * DOCUMENT ME!
-     *
-     * @return DOCUMENT ME!
-     */
-    public String getBackupDirectory() {
-        return backupDirectory;
-    }
-
-	/**
-	 * Set the backup directory
-	 * 
-	 * @param backupDir path to the backup directory
-	 */
-    protected void setBackupDirectory(String backupDir) {
-        backupDirectory = backupDir;
-    }
+   private static Logger log = Logger.getLogger(RCEnvironment.class);
+   public static final String CONFIGURATION_FILE = "lenya" + File.separator + "config" + File.separator + "rc" + File.separator + "revision-controller.xconf";
+   public static final String RCML_DIRECTORY = "rcml-directory";
+   public static final String BACKUP_DIRECTORY = "backup-directory";
+   private String rcmlDirectory;
+   private String backupDirectory;
+   private static Map instances = new HashMap();
+   /**
+    * Returns the singleton RC environment for this context path.
+    * 
+    * @param contextPath
+    *           The context path (the Lenya webapp directory).
+    * @return An RC environment.
+    */
+   public static RCEnvironment getInstance(String contextPath) {
+      RCEnvironment instance = (RCEnvironment) instances.get(contextPath);
+      if(instance == null){
+         instance = new RCEnvironment(contextPath);
+         instances.put(contextPath, instance);
+      }
+      return instance;
+   }
+   /**
+    * Creates a new RCEnvironment object.
+    * 
+    * @param contextPath
+    *           DOCUMENT ME!
+    */
+   public RCEnvironment(String contextPath) {
+      log.debug("context path:" + contextPath);
+      String configurationFilePath = contextPath + "/" + CONFIGURATION_FILE;
+      log.debug("configuration file path:" + configurationFilePath);
+      File configurationFile = new File(configurationFilePath);
+      try{
+         DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+         Configuration configuration = builder.buildFromFile(configurationFile);
+         configure(configuration);
+      }catch(Exception e){
+         log.error("Cannot load revision controller configuration! ", e);
+      }
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @param configuration
+    *           DOCUMENT ME!
+    * 
+    * @throws org.apache.avalon.framework.configuration.ConfigurationException
+    *            DOCUMENT ME!
+    */
+   public void configure(org.apache.avalon.framework.configuration.Configuration configuration) throws org.apache.avalon.framework.configuration.ConfigurationException {
+      // revision controller
+      setRCMLDirectory(configuration.getChild("rcmlDirectory").getAttribute("href"));
+      setBackupDirectory(configuration.getChild("backupDirectory").getAttribute("href"));
+      log.debug("CONFIGURATION:\nRCML Directory: href=" + getRCMLDirectory());
+      log.debug("CONFIGURATION:\nBackup Directory: href=" + getBackupDirectory());
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getRCMLDirectory() {
+      return rcmlDirectory;
+   }
+   /**
+    * Set the rcml directory
+    * 
+    * @param rcmlDir
+    *           the path to the rcml directory
+    */
+   protected void setRCMLDirectory(String rcmlDir) {
+      rcmlDirectory = rcmlDir;
+   }
+   /**
+    * DOCUMENT ME!
+    * 
+    * @return DOCUMENT ME!
+    */
+   public String getBackupDirectory() {
+      return backupDirectory;
+   }
+   /**
+    * Set the backup directory
+    * 
+    * @param backupDir
+    *           path to the backup directory
+    */
+   protected void setBackupDirectory(String backupDir) {
+      backupDirectory = backupDir;
+   }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.