Changeset 4115


Ignore:
Timestamp:
Jan 31, 2008, 1:55:48 PM (15 years ago)
Author:
Martin Svensson
Message:

Fixes #912 Plugin auto-install can not perform import when not all configurations in the import file are selected

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/util/PluginConfigInfo.java

    r3733 r4115  
    2929import java.util.Iterator;
    3030import java.util.List;
     31import java.util.ListIterator;
    3132
    3233import org.jdom.Document;
     
    5859 
    5960  /**
     61    In which place the configuration comes in the file.
     62    This is <0 if it hasn't been defined.
     63   */
     64  private int orderInXml = -1;
     65 
     66 
     67  /**
    6068    Constructor to create a new instance with information for a plugin configuration.
    6169      @param pluginClassName The class name of PluginDefinition this configuration belongs to,
     
    8391  {
    8492    List<PluginConfigInfo> configInfo = new ArrayList<PluginConfigInfo>();   
    85     Iterator configs = doc.getRootElement().getChildren().iterator();   
     93    ListIterator configs = doc.getRootElement().getChildren().listIterator();   
    8694    while (configs.hasNext())
    8795    {     
    88       Object obj = configs.next();
     96      int order = configs.nextIndex();
     97      Object obj = configs.next();     
    8998      if (Element.class.isInstance(obj))
    9099      {
     
    95104          if (pluginClassName != null && configurationName != null)
    96105          {
    97             configInfo.add(new PluginConfigInfo(pluginClassName, configurationName, e.getChildText("description")));
     106            PluginConfigInfo info = new PluginConfigInfo(pluginClassName, configurationName, e.getChildText("description"));
     107            info.orderInXml = order;
     108            configInfo.add(info);
    98109          }
    99110        }
     
    129140    return description;
    130141  }
     142
     143  /** Gets in wich order the configuration comes in the import file.
     144    @return Returns order/position in the xml file or <0 if not defined.
     145  */
     146  public int getOrderInXml()
     147  {
     148    return orderInXml;
     149  }
    131150}
  • trunk/src/plugins/core/net/sf/basedb/plugins/PluginConfigurationImporter.java

    r3732 r4115  
    436436    this.configurationMap = configurations;
    437437   
    438     URL dtdURL = PluginConfigurationImporter.class.getResource("/net/sf/basedb/core/dtd/"+dtdFileName);
    439    
    440438    JarFile jar = new JarFile(jarPath);
    441439    InputStream is = jar.getInputStream(new JarEntry(xmlPath));
    442     Document doc = XMLUtil.getValidatedXML(is, dtdURL, null);
    443     is.close();
    444     Element rootElement = doc.getRootElement();
    445     List children = rootElement.getChildren();   
    446    
    447     if (children.size() != configurations.size())
    448     {
    449       throw new BaseException("The list of configuration to import or not does'n " +
    450           "have the same size as the list of available plugins");
    451     }
    452    
    453     is = jar.getInputStream(new JarEntry(xmlPath));
    454440    doImport(is, null);
    455441    is.close();
  • trunk/www/admin/plugindefinitions/index.jsp

    r3979 r4115  
    238238      {
    239239        HashMap<Integer, Boolean> configurations = new HashMap<Integer, Boolean>();
    240         int configurationNumber = 0;
    241240        for (PluginConfigInfo cnfInfo : configInfos)
    242241        {
    243242          Boolean toImport = Values.getBoolean(request.getParameter(info.getClassName() + "." + cnfInfo.getName()));
    244           configurations.put(configurationNumber, toImport);
    245           configurationNumber++;
     243          configurations.put(cnfInfo.getOrderInXml(), toImport);
    246244        }
    247245        try
Note: See TracChangeset for help on using the changeset viewer.