Hi Gregory,

On 10/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>   Revision 12086 Author gjoseph Date 2007-10-28 19:36:10 +0100 (Sun, 28 Oct 
> 2007)
> Log Message reverting r12067 which apparently broke bootstraping over 
> existing nodes

rolling back this patch solves part of the problems for me (sorting of
bootstrap files, files from classpath didn't work properly), but after
the latest changes the automatic update (setting magnolia.update.auto)
looks totally broken.

I just get an IllegalStateException
(java.lang.IllegalStateException: This implementation of
ModuleManagerUI is only meant to be used at startup)
or blocking errors for missing nodes like:
info.magnolia.module.delta.TaskExecutionException: Could not execute
task: modules/cache/config
Caused by: javax.jcr.PathNotFoundException: modules/cache/config
        
could you please check with a clean repository (testing with an
in-memory only repository is the best option) and magnolia.update.auto
set to true?


fabrizio





>
> Modified Paths
>
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/beans/config/BootstrapFilesComparator.java
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/beans/config/Bootstrapper.java
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/core/ie/DataTransporter.java
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/module/ModuleUtil.java
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/module/delta/BootstrapResourcesTask.java
> Removed Paths
>
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/util/BootstrapUtil.java
>
> Diff
>
> Modified: 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/beans/config/BootstrapFilesComparator.java
>  (12085 => 12086)
> --- 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/beans/config/BootstrapFilesComparator.java
>    2007-10-28 16:17:59 UTC (rev 12085)
> +++ 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/beans/config/BootstrapFilesComparator.java
>    2007-10-28 18:36:10 UTC (rev 12086)
> @@ -13,22 +13,21 @@
>  package info.magnolia.cms.beans.config;
>
>  import info.magnolia.cms.core.ie.DataTransporter;
> +import org.apache.commons.lang.StringUtils;
>
>  import java.io.File;
>  import java.util.Comparator;
>
> -import org.apache.commons.lang.StringUtils;
> -
>  /**
>   * @author gjoseph
>   * @version $Revision: $ ($Author: $)
>   */
> -public class BootstrapFilesComparator implements Comparator {
> +class BootstrapFilesComparator implements Comparator {
>
>      // remove file with the same name in different dirs
>      public int compare(Object file1obj, Object file2obj) {
> -        String file1 = file1obj instanceof File ? ((File) 
> file1obj).getName() : StringUtils.substringAfterLast((String) file1obj, "/");
> -        String file2 = file2obj instanceof File ? ((File) 
> file2obj).getName() : StringUtils.substringAfterLast((String) file2obj, "/");
> +        File file1 = (File) file1obj;
> +        File file2 = (File) file2obj;
>
>          String name1 = getName(file1);
>          String name2 = getName(file2);
> @@ -53,18 +52,18 @@
>          return name1.compareTo(name2);
>      }
>
> -    private static String getExtension(String filename) {
> -        String ext = StringUtils.substringAfterLast(filename, ".");
> +    private static String getExtension(File file) {
> +        String ext = StringUtils.substringAfterLast(file.getName(), ".");
>          if (("." + ext).equals(DataTransporter.GZ) || ("." + 
> ext).equals(DataTransporter.ZIP)) {
> -            ext = 
> StringUtils.substringAfterLast(StringUtils.substringBeforeLast(filename, 
> "."), ".");
> +            ext = 
> StringUtils.substringAfterLast(StringUtils.substringBeforeLast(file.getName(),
>  "."), ".");
>          }
> -        return ext;
> +        return ext;
>      }
>
> -    private static String getName(String filename) {
> -        String name = StringUtils.substringBeforeLast(filename, ".");
> +    private static String getName(File file) {
> +        String name = StringUtils.substringBeforeLast(file.getName(), ".");
>          if (name.endsWith(DataTransporter.XML) || 
> name.endsWith(DataTransporter.PROPERTIES)) {
> -            name = StringUtils.substringBeforeLast(filename, ".");
> +            name = StringUtils.substringBeforeLast(file.getName(), ".");
>          }
>          return name;
>      }
>
>
>
> Modified: 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/beans/config/Bootstrapper.java
>  (12085 => 12086)
> --- 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/beans/config/Bootstrapper.java
>        2007-10-28 16:17:59 UTC (rev 12085)
> +++ 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/beans/config/Bootstrapper.java
>        2007-10-28 18:36:10 UTC (rev 12086)
> @@ -14,9 +14,9 @@
>  import info.magnolia.cms.core.Path;
>  import info.magnolia.cms.core.SystemProperty;
>  import info.magnolia.cms.core.ie.DataTransporter;
> -import info.magnolia.cms.util.BootstrapUtil;
>
>  import java.io.File;
> +import java.io.IOException;
>  import java.util.Collection;
>  import java.util.Iterator;
>  import java.util.Set;
> @@ -118,7 +118,7 @@
>          log.info("Trying to import content from {} files into repository 
> [{}]", //$NON-NLS-1$
>                  Integer.toString(xmlfileset.size()), repositoryName);
>
> -        return BootstrapUtil.bootstrap(repositoryName, (File[]) 
> xmlfileset.toArray(new File[xmlfileset.size()]));
> +        return bootstrapFiles(repositoryName, xmlfileset);
>      }
>
>      /**
> @@ -126,11 +126,10 @@
>       * @param repositoryName
>       * @param filesSet
>       * @return
> -     * @deprecated use [EMAIL PROTECTED] BootstrapUtil#bootstrap(String, 
> File[])} instead
>       */
>      public static boolean bootstrapFiles(String repositoryName, Set 
> filesSet) {
>          File[] files = (File[]) filesSet.toArray(new File[filesSet.size()]);
> -        return BootstrapUtil.bootstrap(repositoryName, files);
> +        return bootstrapFiles(repositoryName, files);
>      }
>
>      /**
> @@ -138,10 +137,30 @@
>       * @param repositoryName
>       * @param files
>       * @return
> -     * @deprecated use [EMAIL PROTECTED] BootstrapUtil#bootstrap(String, 
> File[])} instead
>       */
>      public static boolean bootstrapFiles(String repositoryName, File[] 
> files) {
> -        return BootstrapUtil.bootstrap(repositoryName, files);
> +        try {
> +            for (int k = 0; k < files.length; k++) {
> +                File xmlFile = files[k];
> +                if(log.isDebugEnabled()){
> +                    log.debug("execute importfile {}", xmlFile);
> +                }
> +                DataTransporter.executeBootstrapImport(xmlFile, 
> repositoryName);
> +            }
> +        }
> +        catch (IOException ioe) {
> +            log.error(ioe.getMessage(), ioe);
> +        }
> +        catch (OutOfMemoryError e) {
> +            int maxMem = (int) (Runtime.getRuntime().maxMemory() / 1024 / 
> 1024);
> +            int needed = Math.max(256, maxMem + 128);
> +            log.error("Unable to complete bootstrapping: out of memory.\n" 
> //$NON-NLS-1$
> +                    + "{} MB were not enough, try to increase the amount of 
> memory available by adding the -Xmx{}m parameter to the server startup 
> script.\n" //$NON-NLS-1$
> +                    + "You will need to completely remove the magnolia 
> webapp before trying again", //$NON-NLS-1$
> +                    Integer.toString(maxMem), Integer.toString(needed));
> +            return false;
> +        }
> +        return true;
>      }
>
>      /**
>
>
>
> Modified: 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/core/ie/DataTransporter.java
>  (12085 => 12086)
> --- 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/core/ie/DataTransporter.java
>  2007-10-28 16:17:59 UTC (rev 12085)
> +++ 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/core/ie/DataTransporter.java
>  2007-10-28 18:36:10 UTC (rev 12086)
> @@ -8,7 +8,6 @@
>  import info.magnolia.cms.core.ie.filters.MagnoliaV2Filter;
>  import info.magnolia.cms.core.ie.filters.MetadataUuidFilter;
>  import info.magnolia.cms.core.ie.filters.VersionFilter;
> -import info.magnolia.cms.util.BootstrapUtil;
>  import info.magnolia.cms.util.ContentUtil;
>  import info.magnolia.cms.util.NodeDataUtil;
>  import info.magnolia.context.MgnlContext;
> @@ -64,7 +63,7 @@
>
>      private static Logger log = 
> LoggerFactory.getLogger(DataTransporter.class.getName());
>
> -    public final static int BOOTSTRAP_IMPORT_MODE = 
> ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING;
> +    final static int BOOTSTRAP_IMPORT_MODE = 
> ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING;
>
>      public static final String ZIP = ".zip";
>
> @@ -128,10 +127,25 @@
>       * @param xmlFile
>       * @param repositoryName
>       * @throws IOException
> -     * @deprecated use [EMAIL PROTECTED] BootstrapUtil#bootstrap(String, 
> File)} instead
>       */
>      public static void executeBootstrapImport(File xmlFile, String 
> repositoryName) throws IOException {
> -        BootstrapUtil.bootstrap(repositoryName, xmlFile);
> +        String filenameWithoutExt = 
> StringUtils.substringBeforeLast(xmlFile.getName(), DOT);
> +        if (filenameWithoutExt.endsWith(XML)) {
> +            // if file ends in .xml.gz or .xml.zip
> +            // need to keep the .xml to be able to view it after 
> decompression
> +            filenameWithoutExt = 
> StringUtils.substringBeforeLast(xmlFile.getName(), DOT);
> +        }
> +        String pathName = 
> StringUtils.substringAfter(StringUtils.substringBeforeLast(filenameWithoutExt,
>  DOT), DOT);
> +        String basepath = SLASH + StringUtils.replace(pathName, DOT, SLASH);
> +
> +        if(xmlFile.getName().endsWith(PROPERTIES)){
> +            Properties properties = new Properties();
> +            properties.load(new FileInputStream(xmlFile));
> +            importProperties(properties , repositoryName);
> +        }
> +        else{
> +            DataTransporter.importFile(xmlFile, repositoryName, basepath, 
> false, BOOTSTRAP_IMPORT_MODE, true, true);
> +        }
>      }
>
>      /**
>
>
>
> Modified: 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/module/ModuleUtil.java
>  (12085 => 12086)
> --- 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/module/ModuleUtil.java
>        2007-10-28 16:17:59 UTC (rev 12085)
> +++ 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/module/ModuleUtil.java
>        2007-10-28 18:36:10 UTC (rev 12086)
> @@ -12,12 +12,12 @@
>   */
>  package info.magnolia.cms.module;
>
> -import info.magnolia.cms.beans.config.BootstrapFilesComparator;
>  import info.magnolia.cms.beans.config.ContentRepository;
>  import info.magnolia.cms.core.Content;
>  import info.magnolia.cms.core.HierarchyManager;
>  import info.magnolia.cms.core.ItemType;
>  import info.magnolia.cms.core.Path;
> +import info.magnolia.cms.core.ie.DataTransporter;
>  import info.magnolia.cms.exchange.ActivationManager;
>  import info.magnolia.cms.exchange.ActivationManagerFactory;
>  import info.magnolia.cms.exchange.Subscriber;
> @@ -25,11 +25,9 @@
>  import info.magnolia.cms.security.Permission;
>  import info.magnolia.cms.security.Role;
>  import info.magnolia.cms.security.Security;
> -import info.magnolia.cms.util.BootstrapUtil;
>  import info.magnolia.cms.util.ContentUtil;
>  import info.magnolia.cms.util.WebXmlUtil;
>  import info.magnolia.context.MgnlContext;
> -import info.magnolia.module.delta.BootstrapResourcesTask;
>  import info.magnolia.module.files.BasicFileExtractor;
>
>  import java.io.File;
> @@ -38,13 +36,16 @@
>  import java.io.InputStream;
>  import java.io.InputStreamReader;
>  import java.io.LineNumberReader;
> +import java.util.ArrayList;
>  import java.util.Arrays;
> +import java.util.Collections;
> +import java.util.Comparator;
>  import java.util.Hashtable;
>  import java.util.Iterator;
> +import java.util.List;
>  import java.util.Map;
> -import java.util.SortedSet;
> -import java.util.TreeSet;
>
> +import javax.jcr.ImportUUIDBehavior;
>  import javax.jcr.PathNotFoundException;
>  import javax.jcr.RepositoryException;
>
> @@ -133,22 +134,38 @@
>          bootstrap(resourceNames, true);
>      }
>
> -    /**
> -     * @param resourceNames
> -     * @param saveAfterImport
> -     * @throws IOException
> -     * @throws RegisterException
> -     * @deprecated use [EMAIL PROTECTED] BootstrapResourcesTask}
> -     */
>      public static void bootstrap(String[] resourceNames, boolean 
> saveAfterImport) throws IOException, RegisterException {
> -        SortedSet files = new TreeSet(new BootstrapFilesComparator());
> -        files.addAll(Arrays.asList(resourceNames));
> -
> -        for (Iterator iter = files.iterator(); iter.hasNext();) {
> -            final String filename = (String) iter.next();
> -            final String repository = 
> BootstrapUtil.determineRepository(filename);
> -            final String fullPath = BootstrapUtil.determinePath(filename);
> +        // sort by length --> import parent node first
> +        List list = new ArrayList(Arrays.asList(resourceNames));
>
> +        Collections.sort(list, new Comparator() {
> +
> +            public int compare(Object name1, Object name2) {
> +                return ((String) name1).length() - ((String) name2).length();
> +            }
> +        });
> +
> +        for (Iterator iter = list.iterator(); iter.hasNext();) {
> +            String resourceName = (String) iter.next();
> +
> +            // windows again
> +            resourceName = StringUtils.replace(resourceName, "\\", "/");
> +
> +            String name = 
> StringUtils.removeEnd(StringUtils.substringAfterLast(resourceName, "/"), 
> ".xml");
> +
> +            String repository = StringUtils.substringBefore(name, ".");
> +            String pathName = 
> StringUtils.substringAfter(StringUtils.substringBeforeLast(name, "."), "."); 
> //$NON-NLS-1$
> +            String nodeName = StringUtils.substringAfterLast(name, ".");
> +            String fullPath;
> +            if (StringUtils.isEmpty(pathName)) {
> +                pathName = "/";
> +                fullPath = "/" + nodeName;
> +            }
> +            else {
> +                pathName = "/" + StringUtils.replace(pathName, ".", "/");
> +                fullPath = pathName + "/" + nodeName;
> +            }
> +
>              // if the path already exists --> delete it
>              try {
>                  final HierarchyManager hm = 
> MgnlContext.getHierarchyManager(repository);
> @@ -157,16 +174,20 @@
>                  if (hm != null && hm.isExist(fullPath)) {
>                      hm.delete(fullPath);
>                      if (log.isDebugEnabled()) {
> -                        log.debug("Already existing node [{}] deleted", 
> fullPath);
> +                        log.debug("already existing node [{}] deleted", 
> fullPath);
>                      }
>                  }
> -
> -                log.debug("Will bootstrap {}", filename);
> -                BootstrapUtil.bootstrap(repository, new File(filename), 
> saveAfterImport);
>              }
>              catch (Exception e) {
> -                throw new RegisterException("Can't register bootstrap file: 
> [" + filename + "]", e);
> +                throw new RegisterException("can't register bootstrap file: 
> [" + name + "]", e);
>              }
> +            log.debug("Will bootstrap {}", resourceName);
> +            InputStream stream = 
> ModuleUtil.class.getResourceAsStream(resourceName);
> +            DataTransporter.importXmlStream(stream, repository, pathName, 
> name, false,
> +            // TODO !! this ImportUUIDBehavior might import nodes in the 
> wrong place !!!
> +                ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING,
> +                saveAfterImport,
> +                true);
>          }
>      }
>
>
>
>
> Deleted: 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/util/BootstrapUtil.java
>  (12085 => 12086)
> --- 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/util/BootstrapUtil.java
>       2007-10-28 16:17:59 UTC (rev 12085)
> +++ 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/cms/util/BootstrapUtil.java
>       2007-10-28 18:36:10 UTC (rev 12086)
> @@ -1,214 +0,0 @@
> -/**
> - * Magnolia and its source-code is licensed under the LGPL.
> - * You may copy, adapt, and redistribute this file for commercial or 
> non-commercial use.
> - * When copying, adapting, or redistributing this document in keeping with 
> the guidelines above,
> - * you are required to provide proper attribution to obinary.
> - * If you reproduce or distribute the document without making any 
> substantive modifications to its content,
> - * please use the following attribution line:
> - *
> - * Copyright 1993-2006 obinary Ltd. (http://www.obinary.com) All rights 
> reserved.
> - */
> -package info.magnolia.cms.util;
> -
> -import info.magnolia.cms.core.ie.DataTransporter;
> -
> -import java.io.File;
> -import java.io.FileInputStream;
> -import java.io.FileNotFoundException;
> -import java.io.IOException;
> -import java.io.InputStream;
> -import java.util.Iterator;
> -import java.util.Properties;
> -import java.util.Set;
> -
> -import javax.jcr.ImportUUIDBehavior;
> -
> -import org.apache.commons.lang.StringUtils;
> -import org.slf4j.Logger;
> -import org.slf4j.LoggerFactory;
> -
> -
> -/**
> - * @author vsteller
> - * @version $Id$
> - *
> - */
> -public class BootstrapUtil {
> -
> -    /**
> -     * Logger.
> -     */
> -    private static Logger log = LoggerFactory.getLogger(BootstrapUtil.class);
> -
> -    /**
> -     * Bootstraps content from the given set of files. Repository name and 
> base path will be determined from filenames directly.
> -     * @return success
> -     * @throws FileNotFoundException
> -     */
> -    public static boolean bootstrap(Set filenames) {
> -        return bootstrap(filenames, true);
> -    }
> -
> -    public static boolean bootstrap(Set filenames, boolean saveAfterImport) {
> -        for (Iterator iter = filenames.iterator(); iter.hasNext(); ) {
> -            final String filename = (String) iter.next();
> -            boolean success = bootstrap(new File(filename), saveAfterImport);
> -
> -            if (!success)
> -                return false;
> -        }
> -        return true;
> -    }
> -
> -    public static boolean bootstrap(File[] files) {
> -        return bootstrap(files, true);
> -    }
> -
> -    public static boolean bootstrap(File[] files, boolean saveAfterImport) {
> -        for (int k = 0; k < files.length; k++) {
> -            boolean success = bootstrap(files[k], saveAfterImport);
> -
> -            if (!success)
> -                return false;
> -        }
> -        return true;
> -    }
> -
> -    /**
> -     * Bootstraps content from the given file. Repository name and base path 
> will be determined from filename directly.
> -     * @return success
> -     * @throws FileNotFoundException
> -     */
> -    public static boolean bootstrap(File file) {
> -        return bootstrap(file, true);
> -    }
> -
> -    public static boolean bootstrap(File file, boolean saveAfterImport) {
> -        final String filename = file.getName();
> -        final String repositoryName = determineRepository(filename);
> -        final String basePath = determineBasePath(filename);
> -
> -        return bootstrap(repositoryName, basePath, file, true);
> -    }
> -
> -    /**
> -     * Bootstraps content from the given files. Base path will be determined 
> from filenames directly.
> -     * @return success
> -     * @throws FileNotFoundException
> -     */
> -    public static boolean bootstrap(String repositoryName, File[] files) {
> -        return bootstrap(repositoryName, files, true);
> -    }
> -
> -    public static boolean bootstrap(String repositoryName, File[] files, 
> boolean saveAfterImport) {
> -        for (int k = 0; k < files.length; k++) {
> -            boolean success = bootstrap(repositoryName, files[k], 
> saveAfterImport);
> -
> -            if (!success)
> -                return false;
> -        }
> -        return true;
> -    }
> -
> -    /**
> -     * Bootstraps content from the given file. Base path will be determined 
> from filename directly.
> -     * @return success
> -     * @throws FileNotFoundException
> -     */
> -    public static boolean bootstrap(String repositoryName, File file) {
> -        return bootstrap(repositoryName, file, true);
> -    }
> -
> -    public static boolean bootstrap(String repositoryName, File file, 
> boolean saveAfterImport) {
> -        return bootstrap(repositoryName, determineBasePath(file.getName()), 
> file, saveAfterImport);
> -    }
> -
> -    /**
> -     * Bootstraps content from the given file.
> -     * @param saveAfterImport TODO
> -     * @return success
> -     * @throws FileNotFoundException
> -     */
> -    public static boolean bootstrap(String repositoryName, String basePath, 
> File file, boolean saveAfterImport) {
> -        try {
> -            return bootstrap(repositoryName, basePath, new 
> FileInputStream(file), file.getName(), saveAfterImport);
> -        }
> -        catch (FileNotFoundException e) {
> -            log.error("Cannot create stream for file " + file.getPath(), e);
> -        }
> -        return false;
> -    }
> -
> -    public static boolean bootstrap(String repositoryName, String basePath, 
> InputStream input, String filename, boolean saveAfterImport) {
> -        try {
> -            if (log.isDebugEnabled()) {
> -                log.debug("Bootstrapping file " + filename + " into " + 
> repositoryName + " repository, with base path " + basePath);
> -            }
> -
> -            if (filename.endsWith(DataTransporter.PROPERTIES)){
> -                Properties properties = new Properties();
> -                properties.load(input);
> -                DataTransporter.importProperties(properties, repositoryName);
> -            }
> -            else {
> -                // TODO !! this ImportUUIDBehavior might import nodes in the 
> wrong place !!!
> -                DataTransporter.importXmlStream(input, repositoryName, 
> basePath, filename, false, 
> ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING, saveAfterImport, 
> true);
> -            }
> -        }
> -        catch (IOException e) {
> -            log.error("Cannot bootstrap from file " + filename, e);
> -        }
> -        catch (OutOfMemoryError e) {
> -            int maxMem = (int) (Runtime.getRuntime().maxMemory() / 1024 / 
> 1024);
> -            int needed = Math.max(256, maxMem + 128);
> -            log.error("Unable to complete bootstrapping: out of memory.\n" 
> //$NON-NLS-1$
> -                + "{} MB were not enough, try to increase the amount of 
> memory available by adding the -Xmx{}m parameter to the server startup 
> script.\n" //$NON-NLS-1$
> -                + "You will need to completely remove the magnolia webapp 
> before trying again", //$NON-NLS-1$
> -                Integer.toString(maxMem), Integer.toString(needed));
> -            return false;
> -        }
> -        return true;
> -    }
> -
> -    public static String determineRepository(String filename) {
> -        return StringUtils.substringBefore(cleanupFilename(filename), ".");
> -    }
> -
> -    public static String determinePath(String filename) {
> -        String withoutExtensionAndRepository = 
> StringUtils.substringAfter(cleanupFilename(filename), ".");
> -        String path = StringUtils.replace(withoutExtensionAndRepository, 
> ".", "/");
> -        return (StringUtils.isEmpty(path) ? "/" : "/" + path);
> -    }
> -
> -    public static String determineBasePath(String filename) {
> -        final String fullPath = determinePath(filename);
> -        final String basePath = StringUtils.substringBeforeLast(fullPath, 
> "/");
> -        return (StringUtils.isEmpty(basePath) ? "/" : basePath);
> -    }
> -
> -    public static String determineNodeName(String filename) {
> -        final String fullPath = determinePath(filename);
> -        return StringUtils.substringAfterLast(fullPath, "/");
> -    }
> -
> -    public static String[] determinePaths(String[] filenames) {
> -        String[] paths = new String[filenames.length];
> -        for (int i = 0; i < filenames.length; i++) {
> -            paths[i] = determinePath(filenames[i]);
> -        }
> -        return paths;
> -    }
> -
> -    /**
> -     * Cleans up the filename. Takes extensions like ".properties", ".xml", 
> ".xml.gz" into account
> -     * @param filename
> -     * @return
> -     */
> -    private static String cleanupFilename(String filename) {
> -        filename = StringUtils.replace(filename, "\\", "/");
> -        filename = StringUtils.substringAfterLast(filename, "/");
> -        filename = StringUtils.substringBeforeLast(filename, ".");
> -
> -        return StringUtils.removeEnd(filename, DataTransporter.XML);
> -    }
> -}
>
>
>
> Modified: 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/module/delta/BootstrapResourcesTask.java
>  (12085 => 12086)
> --- 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/module/delta/BootstrapResourcesTask.java
>  2007-10-28 16:17:59 UTC (rev 12085)
> +++ 
> magnolia/trunk/magnolia-core/src/main/java/info/magnolia/module/delta/BootstrapResourcesTask.java
>  2007-10-28 18:36:10 UTC (rev 12086)
> @@ -12,16 +12,12 @@
>   */
>  package info.magnolia.module.delta;
>
> -import info.magnolia.cms.beans.config.BootstrapFilesComparator;
> -import info.magnolia.cms.util.BootstrapUtil;
> +import info.magnolia.cms.module.ModuleUtil;
> +import info.magnolia.cms.module.RegisterException;
>  import info.magnolia.cms.util.ClasspathResourcesUtil;
>  import info.magnolia.module.InstallContext;
>
> -import java.io.InputStream;
> -import java.util.Arrays;
> -import java.util.Iterator;
> -import java.util.SortedSet;
> -import java.util.TreeSet;
> +import java.io.IOException;
>
>  /**
>   *
> @@ -30,36 +26,19 @@
>   */
>  public abstract class BootstrapResourcesTask extends AbstractTask {
>
> -    private boolean backup;
> -
>      public BootstrapResourcesTask(String name, String description) {
> -        this(name, description, false);
> -    }
> -
> -    public BootstrapResourcesTask(String name, String description, boolean 
> backup) {
>          super(name, description);
> -
> -        setBackup(backup);
>      }
>
>      // TODO : check if nodes were already there
>      public void execute(final InstallContext installContext) throws 
> TaskExecutionException {
>          try {
>              final String[] resourcesToBootstrap = 
> getResourcesToBootstrap(installContext);
> -            final SortedSet files = new TreeSet(new 
> BootstrapFilesComparator());
> -            files.addAll(Arrays.asList(resourcesToBootstrap));
> -
> -            for (Iterator iter = files.iterator(); iter.hasNext();) {
> -                final String resourceName = (String) iter.next();
> -                final String repositoryName = 
> BootstrapUtil.determineRepository(resourceName);
> -                final String basePath = 
> BootstrapUtil.determineBasePath(resourceName);
> -                final InputStream resource = 
> BootstrapResourcesTask.class.getResourceAsStream(resourceName);
> -
> -                BootstrapUtil.bootstrap(repositoryName, basePath, resource, 
> resourceName, false);
> -            }
> -
> -        } catch (Exception e) {
> -            throw new TaskExecutionException("Could not bootstrap: " + 
> e.getMessage().toString(), e);
> +            ModuleUtil.bootstrap(resourcesToBootstrap, false);
> +        } catch (IOException e) {
> +            throw new TaskExecutionException("Could not bootstrap: " + 
> e.getMessage());
> +        } catch (RegisterException e) {
> +            throw new TaskExecutionException("Could not bootstrap: " + 
> e.getMessage());
>          }
>      }
>
> @@ -73,6 +52,7 @@
>              }
>          });
>          return resourcesToBootstrap;
> +
>      }
>
>      /**
> @@ -81,12 +61,4 @@
>      protected boolean acceptResource(final InstallContext installContext, 
> final String resourceName) {
>          return false;
>      }
> -
> -    public boolean isBackup() {
> -        return backup;
> -    }
> -
> -    public void setBackup(boolean backup) {
> -        this.backup = backup;
> -    }
>  }
>
>

----------------------------------------------------------------
for list details see
http://documentation.magnolia.info/docs/en/editor/stayupdated.html
----------------------------------------------------------------

Reply via email to