Changeset 4115
- Timestamp:
- Jan 31, 2008, 1:55:48 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/core/net/sf/basedb/util/PluginConfigInfo.java
r3733 r4115 29 29 import java.util.Iterator; 30 30 import java.util.List; 31 import java.util.ListIterator; 31 32 32 33 import org.jdom.Document; … … 58 59 59 60 /** 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 /** 60 68 Constructor to create a new instance with information for a plugin configuration. 61 69 @param pluginClassName The class name of PluginDefinition this configuration belongs to, … … 83 91 { 84 92 List<PluginConfigInfo> configInfo = new ArrayList<PluginConfigInfo>(); 85 Iterator configs = doc.getRootElement().getChildren().iterator();93 ListIterator configs = doc.getRootElement().getChildren().listIterator(); 86 94 while (configs.hasNext()) 87 95 { 88 Object obj = configs.next(); 96 int order = configs.nextIndex(); 97 Object obj = configs.next(); 89 98 if (Element.class.isInstance(obj)) 90 99 { … … 95 104 if (pluginClassName != null && configurationName != null) 96 105 { 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); 98 109 } 99 110 } … … 129 140 return description; 130 141 } 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 } 131 150 } -
trunk/src/plugins/core/net/sf/basedb/plugins/PluginConfigurationImporter.java
r3732 r4115 436 436 this.configurationMap = configurations; 437 437 438 URL dtdURL = PluginConfigurationImporter.class.getResource("/net/sf/basedb/core/dtd/"+dtdFileName);439 440 438 JarFile jar = new JarFile(jarPath); 441 439 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));454 440 doImport(is, null); 455 441 is.close(); -
trunk/www/admin/plugindefinitions/index.jsp
r3979 r4115 238 238 { 239 239 HashMap<Integer, Boolean> configurations = new HashMap<Integer, Boolean>(); 240 int configurationNumber = 0;241 240 for (PluginConfigInfo cnfInfo : configInfos) 242 241 { 243 242 Boolean toImport = Values.getBoolean(request.getParameter(info.getClassName() + "." + cnfInfo.getName())); 244 configurations.put(configurationNumber, toImport); 245 configurationNumber++; 243 configurations.put(cnfInfo.getOrderInXml(), toImport); 246 244 } 247 245 try
Note: See TracChangeset
for help on using the changeset viewer.