Changeset 6473
- Timestamp:
- Jun 11, 2014, 3:48:39 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 1 deleted
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/.classpath
r6470 r6473 23 23 <classpathentry kind="lib" path="lib/dist/httpcore-4.2.3.jar"/> 24 24 <classpathentry kind="lib" path="lib/dist/jcommon-1.0.17.jar"/> 25 <classpathentry kind="lib" path="lib/dist/jdom-1.1.3.jar"/>26 25 <classpathentry kind="lib" path="lib/dist/jfreechart-1.0.14.jar"/> 27 26 <classpathentry kind="lib" path="lib/dist/json-simple-1.1.1.jar"/> … … 32 31 <classpathentry kind="lib" path="lib/dist/hibernate-core-4.3.5.Final.jar"/> 33 32 <classpathentry kind="lib" path="lib/dist/postgresql-9.3-1101.jdbc41.jar"/> 33 <classpathentry kind="lib" path="lib/dist/jdom-2.0.5.jar"/> 34 <classpathentry kind="lib" path="lib/dist/jdom-1.1.3.jar"/> 34 35 <classpathentry kind="output" path="xbin"/> 35 36 </classpath> -
trunk/doc/3rd-party-components.txt
r6471 r6473 79 79 80 80 More info : http://www.jdom.org/ 81 Version : 1.1.381 Version : 2.0.5 and 1.1.3 (deprecated) 82 82 License : Apache-style open source license (jdom.license.txt) 83 Jar files : jdom- 1.1.3.jar, jaxen-1.1.1.jar83 Jar files : jdom-2.0.5.jar, jdom-1.1.3.jar, jaxen-1.1.6.jar 84 84 85 85 -
trunk/src/clients/web/net/sf/basedb/clients/web/extensions/ServletLoader.java
r5689 r6473 31 31 import net.sf.basedb.util.ClassUtil; 32 32 import net.sf.basedb.util.Values; 33 import net.sf.basedb.util.X MLUtil;33 import net.sf.basedb.util.XmlUtil2; 34 34 import net.sf.basedb.util.extensions.xml.XmlLoader; 35 35 36 import org.jdom .Document;37 import org.jdom .Element;38 import org.jdom .JDOMException;39 import org.jdom .Namespace;36 import org.jdom2.Document; 37 import org.jdom2.Element; 38 import org.jdom2.JDOMException; 39 import org.jdom2.Namespace; 40 40 41 41 /** … … 107 107 public void loadXmlFile(InputStream xmlFile, String filename, 108 108 ClassLoader classLoader, boolean clear) 109 throws JDOMException,IOException, ClassNotFoundException, NoSuchMethodException,109 throws IOException, ClassNotFoundException, NoSuchMethodException, 110 110 IllegalAccessException 111 111 { … … 126 126 */ 127 127 public void validateXmlFile(InputStream xmlFile, String filename) 128 throws IOException , JDOMException128 throws IOException 129 129 { 130 130 validatedDom = null; … … 195 195 */ 196 196 protected Document loadDocument(InputStream xmlFile, String filename) 197 throws IOException , JDOMException198 { 199 return X MLUtil.getSchemaValidatedXML(xmlFile, filename, namespace, schemaFileURL);197 throws IOException 198 { 199 return XmlUtil2.getSchemaValidatedXML(xmlFile, filename, namespace, schemaFileURL); 200 200 } 201 201 … … 203 203 Load the servlet definitions from an XML document. 204 204 */ 205 @SuppressWarnings("unchecked")206 205 protected int loadServlets(Document dom, ClassLoader classLoader) 207 206 throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException -
trunk/src/clients/web/net/sf/basedb/clients/web/plugins/XMLTemplate.java
r6127 r6473 30 30 import net.sf.basedb.core.Item; 31 31 32 import org.jdom .DocType;33 import org.jdom .Element;34 import org.jdom .output.Format;35 import org.jdom .output.XMLOutputter;32 import org.jdom2.DocType; 33 import org.jdom2.Element; 34 import org.jdom2.output.Format; 35 import org.jdom2.output.XMLOutputter; 36 36 37 37 /** -
trunk/src/clients/web/net/sf/basedb/clients/web/servlet/RssNewsFeed.java
r5479 r6473 35 35 import javax.servlet.http.HttpServletResponse; 36 36 37 import org.jdom .Document;38 import org.jdom .Element;39 import org.jdom .output.Format;40 import org.jdom .output.XMLOutputter;37 import org.jdom2.Document; 38 import org.jdom2.Element; 39 import org.jdom2.output.Format; 40 import org.jdom2.output.XMLOutputter; 41 41 42 42 import net.sf.basedb.core.Application; -
trunk/src/core/net/sf/basedb/core/ExtendedProperties.java
r6444 r6473 26 26 import net.sf.basedb.core.dbengine.DbEngine; 27 27 import net.sf.basedb.util.Values; 28 import net.sf.basedb.util.X MLUtil;28 import net.sf.basedb.util.XmlUtil2; 29 29 30 30 import java.util.HashSet; … … 37 37 import java.net.URL; 38 38 39 import org.jdom .Document;40 import org.jdom .Element;39 import org.jdom2.Document; 40 import org.jdom2.Element; 41 41 42 42 /** … … 120 120 { 121 121 log.debug("Loading extended properties from file: " + xmlFile); 122 Document dom = X MLUtil.getValidatedXml(ExtendedProperties.class.getResource(xmlFile), dtdFile);122 Document dom = XmlUtil2.getValidatedXml(ExtendedProperties.class.getResource(xmlFile), dtdFile); 123 123 loadClasses(usedNames, dom, xmlFile); 124 124 log.info("Loaded extended properties from file: " + xmlFile); … … 200 200 variable. 201 201 */ 202 @SuppressWarnings("unchecked")203 202 private static void loadClasses(Set<String> usedNames, Document dom, String xmlFile) 204 203 { 205 List<Element> classTags = (List<Element>)dom.getRootElement().getChildren("class");204 List<Element> classTags = dom.getRootElement().getChildren("class"); 206 205 for (Element el : classTags) 207 206 { … … 220 219 put the list in the {@link #allProperties} variable. 221 220 */ 222 @SuppressWarnings("unchecked")223 221 private static void loadProperties(Set<String> usedNames, Element classElement, String xmlFile) 224 222 { 225 223 String className = classElement.getAttributeValue("name"); 226 224 List<ExtendedProperty> properties = allProperties.get(className); 227 List<Element> children = (List<Element>)classElement.getChildren("property");225 List<Element> children = classElement.getChildren("property"); 228 226 DbEngine engine = HibernateUtil.getDbEngine(); 229 227 for (Element property : children) … … 258 256 usedNames.add(idColumn); 259 257 String description = Values.getStringOrNull(property.getAttributeValue("description")); 260 int length = X MLUtil.getIntAttribute(property, "length", 255);258 int length = XmlUtil2.getIntAttribute(property, "length", 255); 261 259 Type type = Type.fromValue(property.getAttributeValue("type")); 262 260 if (type == Type.STRING && length > 255) type = Type.TEXT; 263 boolean nullable = X MLUtil.getBooleanAttribute(property, "null", true);264 boolean insertable = X MLUtil.getBooleanAttribute(property, "insert", true);265 boolean updateable = X MLUtil.getBooleanAttribute(property, "update", true);266 boolean restrictedEdit = X MLUtil.getBooleanAttribute(property, "restricted-edit", false);261 boolean nullable = XmlUtil2.getBooleanAttribute(property, "null", true); 262 boolean insertable = XmlUtil2.getBooleanAttribute(property, "insert", true); 263 boolean updateable = XmlUtil2.getBooleanAttribute(property, "update", true); 264 boolean restrictedEdit = XmlUtil2.getBooleanAttribute(property, "restricted-edit", false); 267 265 String avgMethod = property.getAttributeValue("averagemethod"); 268 266 Formula.AverageMethod averageMethod = null; … … 280 278 } 281 279 282 List<Element> links = (List<Element>)property.getChildren("link");280 List<Element> links = property.getChildren("link"); 283 281 List<ExtendedPropertyLinker> epLinks = null; 284 282 if (links != null && links.size() > 0) -
trunk/src/core/net/sf/basedb/core/HibernateUtil.java
r6469 r6473 50 50 import net.sf.basedb.util.FileUtil; 51 51 import net.sf.basedb.util.RegexpFileFilter; 52 import net.sf.basedb.util.X MLUtil;52 import net.sf.basedb.util.XmlUtil2; 53 53 54 54 import java.util.ArrayList; … … 68 68 import java.net.URL; 69 69 70 import org.jdom .Document;71 import org.jdom .Element;72 import org.jdom .output.DOMOutputter;70 import org.jdom2.Document; 71 import org.jdom2.Element; 72 import org.jdom2.output.DOMOutputter; 73 73 import org.hibernate.Hibernate; 74 74 import org.hibernate.Interceptor; … … 307 307 { 308 308 log.info("Loading mapping file: " + url); 309 Document dom = X MLUtil.getValidatedXml(url, dtdFile);309 Document dom = XmlUtil2.getValidatedXml(url, dtdFile); 310 310 manipulateDocument(dom); 311 311 cfg.addDocument(out.output(dom)); … … 513 513 try 514 514 { 515 Document dom = X MLUtil.getValidatedXml(templateFile, dtdFile);515 Document dom = XmlUtil2.getValidatedXml(templateFile, dtdFile); 516 516 Element clazz = dom.getRootElement().getChild("class"); 517 517 // Specify an entity name and database table for the raw data type … … 581 581 582 582 // Find the class/property/column[name=`symbol`] tag 583 Iterator match = classTag.getDescendants(584 new org.jdom .filter.Filter()583 Iterator<Element> match = classTag.getDescendants( 584 new org.jdom2.filter.AbstractFilter<Element>() 585 585 { 586 586 private static final long serialVersionUID = -2876632679035736428L; 587 587 @Override 588 public boolean matches(Object obj)588 public Element filter(Object obj) 589 589 { 590 if (!(obj instanceof Element)) return false;590 if (!(obj instanceof Element)) return null; 591 591 592 592 Element e = (Element)obj; 593 return e.getName().equals("column") && e.getAttributeValue("name").equals("`symbol`") ;593 return e.getName().equals("column") && e.getAttributeValue("name").equals("`symbol`") ? e : null; 594 594 } 595 595 }); 596 596 Element col = (Element)match.next(); 597 String sqlType = dbEngine.getCaseSensitiveVarchar(X MLUtil.getIntAttribute(col, "length", 255));597 String sqlType = dbEngine.getCaseSensitiveVarchar(XmlUtil2.getIntAttribute(col, "length", 255)); 598 598 if (sqlType != null) 599 599 { -
trunk/src/core/net/sf/basedb/core/Install.java
r6468 r6473 69 69 import net.sf.basedb.util.FileUtil; 70 70 import net.sf.basedb.util.Values; 71 import net.sf.basedb.util.X MLUtil;71 import net.sf.basedb.util.XmlUtil2; 72 72 import net.sf.basedb.util.extensions.manager.Settings; 73 73 import net.sf.basedb.util.extensions.xml.PluginInfo; … … 86 86 import java.util.Set; 87 87 88 import org.jdom .Document;89 import org.jdom .Element;90 import org.jdom .Namespace;88 import org.jdom2.Document; 89 import org.jdom2.Element; 90 import org.jdom2.Namespace; 91 91 92 92 /** … … 1392 1392 } 1393 1393 1394 @SuppressWarnings("unchecked")1395 1394 private static void installUnits(String xmlFile, boolean update) 1396 1395 { … … 1402 1401 try 1403 1402 { 1404 doc = X MLUtil.getSchemaValidatedXML(fileURL, namespace, schemaFileURL);1403 doc = XmlUtil2.getSchemaValidatedXML(fileURL, namespace, schemaFileURL); 1405 1404 } 1406 1405 catch (Exception ex) … … 1413 1412 Namespace ns = root.getNamespace(); 1414 1413 1415 for (Element quantityElement : (List<Element>)root.getChildren("quantity", ns))1414 for (Element quantityElement : root.getChildren("quantity", ns)) 1416 1415 { 1417 1416 String systemId = quantityElement.getAttributeValue("system-id"); … … 2459 2458 Create {@link PluginConfiguration}s from a XML file. 2460 2459 */ 2461 @SuppressWarnings("unchecked")2462 2460 private static void createPluginConfigurations(String filePath, boolean update) 2463 2461 throws BaseException … … 2484 2482 } 2485 2483 2486 List<Element> configurations = PluginConfiguration.loadXmlFile (Install.class.getResource(filePath).openStream(), filePath);2484 List<Element> configurations = PluginConfiguration.loadXmlFile2(Install.class.getResource(filePath).openStream(), filePath); 2487 2485 2488 2486 for (Element configuration : configurations) … … 2520 2518 config.setName(name); 2521 2519 config.setDescription(description); 2522 config.setParameterValues ((List<Element>)configuration.getChildren("parameter"));2520 config.setParameterValues2((List<Element>)configuration.getChildren("parameter")); 2523 2521 } 2524 2522 catch(Throwable ex) -
trunk/src/core/net/sf/basedb/core/PluginConfiguration.java
r6444 r6473 35 35 import net.sf.basedb.core.query.Hql; 36 36 import net.sf.basedb.core.query.Expressions; 37 import net.sf.basedb.util.X MLUtil;37 import net.sf.basedb.util.XmlUtil2; 38 38 39 39 import java.io.IOException; … … 48 48 import java.util.Collections; 49 49 50 import org.jdom .Document;51 import org.jdom .Element;52 import org.jdom.JDOMException;50 import org.jdom2.Document; 51 import org.jdom2.Element; 52 //import org.jdom2.JDOMException; 53 53 54 54 /** … … 182 182 @return A list with all <configuration> elements in the file 183 183 @since 3.0 184 @deprecated In 3.4, use {@link #loadXmlFile2(InputStream, String)} instead 184 185 */ 185 186 @SuppressWarnings("unchecked") 186 public static List<Element> loadXmlFile(InputStream in, String fileName) 187 throws IOException, JDOMException 187 @Deprecated 188 public static List<org.jdom.Element> loadXmlFile(InputStream in, String fileName) 189 throws IOException, org.jdom.JDOMException 188 190 { 189 191 URL dtdURL = PluginConfiguration.class.getResource("/net/sf/basedb/core/dtd/plugin-configuration-file.dtd"); 190 Document doc = XMLUtil.getValidatedXML(in, dtdURL, fileName); 192 org.jdom.Document doc = net.sf.basedb.util.XMLUtil.getValidatedXML(in, dtdURL, fileName); 193 org.jdom.Element rootElement = doc.getRootElement(); 194 return (List<org.jdom.Element>)rootElement.getChildren(); 195 } 196 197 /** 198 Load a configurations xml file from the given stream. 199 @param in The input stream to read from 200 @param fileName The name of the originating file (optional) 201 @return A list with all <configuration> elements in the file 202 @since 3.4 203 */ 204 public static List<Element> loadXmlFile2(InputStream in, String fileName) 205 throws IOException 206 { 207 URL dtdURL = PluginConfiguration.class.getResource("/net/sf/basedb/core/dtd/plugin-configuration-file.dtd"); 208 Document doc = XmlUtil2.getValidatedXML(in, dtdURL, fileName); 191 209 Element rootElement = doc.getRootElement(); 192 210 return (List<Element>)rootElement.getChildren(); … … 706 724 @throws ClassNotFoundException If there is an error while trying to find the type of the parameters. 707 725 @since 3.0 726 @deprecated In 3.4, use {@link #setParameterValues2} instead 708 727 */ 709 728 @SuppressWarnings("unchecked") 710 public void setParameterValues(List<Element> parameters) 729 @Deprecated 730 public void setParameterValues(List<org.jdom.Element> parameters) 711 731 throws ClassNotFoundException 712 732 { 713 733 checkPermission(Permission.WRITE); 714 734 // Set each configuration parameter for the plugin. 715 for ( Element parameter : parameters)735 for (org.jdom.Element parameter : parameters) 716 736 { 717 737 String name = parameter.getChildText("name"); … … 734 754 735 755 /** 756 Sets parameters for a PluginConfiguration from the elements in a xml 757 configurations file. 758 759 @param parameters A list of the parameters that shall be set to the configuration 760 @throws ClassNotFoundException If there is an error while trying to find the type of the parameters. 761 @since 3.4 762 */ 763 @SuppressWarnings("unchecked") 764 public void setParameterValues2(List<Element> parameters) 765 throws ClassNotFoundException 766 { 767 checkPermission(Permission.WRITE); 768 // Set each configuration parameter for the plugin. 769 for (Element parameter : parameters) 770 { 771 String name = parameter.getChildText("name"); 772 String cl = parameter.getChildText("class"); 773 String label = parameter.getChildText("label"); 774 if (label == null || label.length() == 0) label = name; 775 String description = parameter.getChildText("description"); 776 Class clazz = null; 777 List values = null; 778 779 if (cl.length() > 0) 780 { 781 clazz = Class.forName(cl); 782 values = getValueList2(parameter, clazz); 783 ParameterType pType = getParameterType(clazz, values); 784 setParameterValues(name,label, description, pType, values); 785 } 786 } 787 } 788 789 790 /** 736 791 Gets the list of values for a parameter from the XML-file. 737 792 Returns a list with parameter values. 738 793 */ 739 794 @SuppressWarnings("unchecked") 740 private <T> List<T> getValueList(Element parameter, Class<T> classType) 795 @Deprecated 796 private <T> List<T> getValueList(org.jdom.Element parameter, Class<T> classType) 741 797 { 742 List< Element> children = (List<Element>)parameter.getChildren("value");798 List<org.jdom.Element> children = (List<org.jdom.Element>)parameter.getChildren("value"); 743 799 List<T> values = new ArrayList<T>(); 744 for ( Object ch : children)745 { 746 String text = ((Element)ch).getText();800 for (org.jdom.Element ch : children) 801 { 802 String text = ch.getText(); 747 803 if (classType.equals(Boolean.class)) values.add((T)Boolean.valueOf(text)); 748 804 else if (classType.equals(Date.class)) values.add((T)DateUtil.parseString(text)); … … 755 811 } 756 812 813 /** 814 Gets the list of values for a parameter from the XML-file. 815 Returns a list with parameter values. 816 */ 817 @SuppressWarnings("unchecked") 818 private <T> List<T> getValueList2(Element parameter, Class<T> classType) 819 { 820 List<Element> children = parameter.getChildren("value"); 821 List<T> values = new ArrayList<T>(); 822 for (Element ch : children) 823 { 824 String text = ch.getText(); 825 if (classType.equals(Boolean.class)) values.add((T)Boolean.valueOf(text)); 826 else if (classType.equals(Date.class)) values.add((T)DateUtil.parseString(text)); 827 else if (classType.equals(Double.class)) values.add((T)Double.valueOf(text)); 828 else if (classType.equals(Float.class)) values.add((T)Float.valueOf(text)); 829 else if (classType.equals(Long.class)) values.add((T)Long.valueOf(text)); 830 else if (classType.equals(String.class)) values.add((T)text); 831 } 832 return values; 833 } 834 757 835 /** 758 836 Gets the ParameterType to use with a class. -
trunk/src/core/net/sf/basedb/core/PredefinedQuery.java
r6444 r6473 23 23 package net.sf.basedb.core; 24 24 25 import net.sf.basedb.util.X MLUtil;25 import net.sf.basedb.util.XmlUtil2; 26 26 27 27 import java.net.URL; 28 28 import java.util.Arrays; 29 29 30 import org.jdom .Document;31 import org.jdom .Element;32 import org.jdom .JDOMException;33 import org.jdom .xpath.XPath;30 import org.jdom2.Document; 31 import org.jdom2.Element; 32 import org.jdom2.xpath.XPathExpression; 33 import org.jdom2.xpath.XPathFactory; 34 34 35 35 /** … … 106 106 try 107 107 { 108 commonDom = X MLUtil.getValidatedXml(PredefinedQuery.class.getResource(commonQueryFile), dtdFile);108 commonDom = XmlUtil2.getValidatedXml(PredefinedQuery.class.getResource(commonQueryFile), dtdFile); 109 109 log.info("Loaded predefined queries from file: " + commonQueryFile); 110 110 if (dialectQueryFile != null) 111 111 { 112 dialectDom = X MLUtil.getValidatedXml(PredefinedQuery.class.getResource(dialectQueryFile), dtdFile);112 dialectDom = XmlUtil2.getValidatedXml(PredefinedQuery.class.getResource(dialectQueryFile), dtdFile); 113 113 log.info("Loaded predefined queries from file: " + dialectQueryFile); 114 114 } … … 142 142 throws BaseException 143 143 { 144 XPathExpression findQuery = XPathFactory.instance().compile("//query[@id='"+name+"']"); 145 144 146 Element query = null; 145 try 146 { 147 XPath findQuery = XPath.newInstance("//query[@id='"+name+"']"); 148 149 if (dialectDom != null) query = (Element)findQuery.selectSingleNode(dialectDom); 150 if (query == null) query = (Element)findQuery.selectSingleNode(commonDom); 151 } 152 catch (JDOMException ex) 153 { 154 throw new BaseException(ex); 155 } 147 if (dialectDom != null) query = (Element)findQuery.evaluateFirst(dialectDom); 148 if (query == null) query = (Element)findQuery.evaluateFirst(commonDom); 149 156 150 if (query == null) 157 151 { -
trunk/src/core/net/sf/basedb/core/Presets.java
r6127 r6473 22 22 package net.sf.basedb.core; 23 23 24 import net.sf.basedb.util.X MLUtil;24 import net.sf.basedb.util.XmlUtil2; 25 25 26 26 import java.util.ArrayList; … … 34 34 import java.net.URL; 35 35 36 import org.jdom .Document;37 import org.jdom .Element;38 import org.jdom .output.Format;39 import org.jdom .output.XMLOutputter;36 import org.jdom2.Document; 37 import org.jdom2.Element; 38 import org.jdom2.output.Format; 39 import org.jdom2.output.XMLOutputter; 40 40 41 41 /** … … 95 95 try 96 96 { 97 Document dom = X MLUtil.getValidatedXml(xml, dtdFile);97 Document dom = XmlUtil2.getValidatedXml(xml, dtdFile); 98 98 loadPresets(dom); 99 99 } … … 115 115 try 116 116 { 117 Document dom = X MLUtil.getValidatedXML(in, dtdFile, filename);117 Document dom = XmlUtil2.getValidatedXML(in, dtdFile, filename); 118 118 loadPresets(dom); 119 119 } … … 156 156 private Document buildDocument() 157 157 { 158 Document dom = X MLUtil.createDom("presets", "presets.dtd");158 Document dom = XmlUtil2.createDom("presets", "presets.dtd"); 159 159 Element root = dom.getRootElement(); 160 160 if (defaultPreset != null) … … 212 212 Parse an XML Document and load all presets. 213 213 */ 214 @SuppressWarnings("unchecked")215 214 private void loadPresets(Document dom) 216 215 { … … 263 262 @param preset 264 263 */ 265 @SuppressWarnings("unchecked")266 264 private Preset(Element preset) 267 265 { -
trunk/src/core/net/sf/basedb/core/RawDataTypes.java
r6444 r6473 28 28 import net.sf.basedb.core.dbengine.DbEngine; 29 29 import net.sf.basedb.util.Values; 30 import net.sf.basedb.util.X MLUtil;30 import net.sf.basedb.util.XmlUtil2; 31 31 32 32 import java.util.Comparator; … … 43 43 import java.util.Collection; 44 44 45 import org.jdom .Document;46 import org.jdom .Element;45 import org.jdom2.Document; 46 import org.jdom2.Element; 47 47 48 48 /** … … 165 165 for (String xmlFile : files) 166 166 { 167 Document dom = X MLUtil.getValidatedXml(RawDataTypes.class.getResource(xmlFile), dtdFile);167 Document dom = XmlUtil2.getValidatedXml(RawDataTypes.class.getResource(xmlFile), dtdFile); 168 168 loadRawDataTypes(dom, xmlFile); 169 169 log.info("Loaded raw data types from file: " + xmlFile); … … 334 334 {@link #rawDataTypes} map. 335 335 */ 336 @SuppressWarnings({"unchecked"})337 336 private static void loadRawDataTypes(Document dom, String xmlFile) 338 337 { … … 346 345 String description = Values.getStringOrNull(el.getAttributeValue("description")); 347 346 String table = Values.getStringOrNull(el.getAttributeValue("table")); 348 int channels = X MLUtil.getIntAttribute(el, "channels", 2);347 int channels = XmlUtil2.getIntAttribute(el, "channels", 2); 349 348 350 349 if (!ExtendedProperty.isValidName(id)) … … 396 395 return a list of {@link RawDataProperty} objects. 397 396 */ 398 @SuppressWarnings({"unchecked"})399 397 private static List<RawDataProperty> loadProperties(Element rawDataTypeElement, int channels, String xmlFile) 400 398 { … … 434 432 String description = Values.getStringOrNull(property.getAttributeValue("description")); 435 433 Type type = Type.fromValue(property.getAttributeValue("type")); 436 int length = X MLUtil.getIntAttribute(property, "length", 255);434 int length = XmlUtil2.getIntAttribute(property, "length", 255); 437 435 if (type == Type.STRING && length > 255) type = Type.TEXT; 438 boolean nullable = X MLUtil.getBooleanAttribute(property, "null", true);436 boolean nullable = XmlUtil2.getBooleanAttribute(property, "null", true); 439 437 String avgMethod = property.getAttributeValue("averagemethod"); 440 438 Formula.AverageMethod averageMethod = null; … … 451 449 averageMethod = Formula.AverageMethod.NONE; 452 450 } 453 int channel = X MLUtil.getIntAttribute(property, "channel", 0);451 int channel = XmlUtil2.getIntAttribute(property, "channel", 0); 454 452 if (channel < 0 || channel > channels) 455 453 { … … 467 465 return a list of {@link IntensityFormula} objects. 468 466 */ 469 @SuppressWarnings({"unchecked"})470 467 private static List<IntensityFormula> loadIntensityFormulas(Element rawDataTypeElement, int channels, String xmlFile) 471 468 { … … 494 491 for (Element expression : (List<Element>)formula.getChildren("formula")) 495 492 { 496 int channel = X MLUtil.getIntAttribute(expression, "channel", 0);493 int channel = XmlUtil2.getIntAttribute(expression, "channel", 0); 497 494 String exp = Values.getStringOrNull(expression.getAttributeValue("expression")); 498 495 if (channel <= 0 || channel > channels) -
trunk/src/core/net/sf/basedb/util/XMLUtil.java
r6444 r6473 53 53 @version 2.0 54 54 @base.modified $Date$ 55 @deprecated In 3.4, use {@link XmlUtil2} instead 55 56 */ 57 @Deprecated 56 58 public class XMLUtil 57 59 { -
trunk/src/core/net/sf/basedb/util/extensions/manager/processor/PluginInstallationProcessor.java
r6444 r6473 27 27 import java.util.Map; 28 28 29 import org.jdom .Element;29 import org.jdom2.Element; 30 30 31 31 import net.sf.basedb.core.DbControl; … … 100 100 } 101 101 102 @SuppressWarnings("unchecked")103 102 @Override 104 103 public void processFile(ExtensionsManager manager, WriteableExtensionsFile wFile) … … 166 165 if (in != null) 167 166 { 168 List<Element> configurations = PluginConfiguration.loadXmlFile (in, "META-INF/plugin-configurations.xml");167 List<Element> configurations = PluginConfiguration.loadXmlFile2(in, "META-INF/plugin-configurations.xml"); 169 168 FileUtil.close(in); 170 169 for (Element configuration : configurations) … … 199 198 config.setName(name); 200 199 config.setDescription(description); 201 config.setParameterValues ((List<Element>)configuration.getChildren("parameter"));200 config.setParameterValues2((List<Element>)configuration.getChildren("parameter")); 202 201 numConfigurations++; 203 202 } -
trunk/src/core/net/sf/basedb/util/extensions/xml/ExtensionPointFilter.java
r5598 r6473 24 24 import java.util.regex.Pattern; 25 25 26 import org.jdom .Element;26 import org.jdom2.Element; 27 27 28 28 import net.sf.basedb.util.Values; -
trunk/src/core/net/sf/basedb/util/extensions/xml/PluginDefinitionFilter.java
r5617 r6473 22 22 package net.sf.basedb.util.extensions.xml; 23 23 24 import org.jdom .Element;24 import org.jdom2.Element; 25 25 26 26 import net.sf.basedb.util.filter.Filter; -
trunk/src/core/net/sf/basedb/util/extensions/xml/XmlLoader.java
r6444 r6473 34 34 import java.util.Set; 35 35 36 import org.jdom.Attribute; 37 import org.jdom.Document; 38 import org.jdom.Element; 39 import org.jdom.JDOMException; 40 import org.jdom.Namespace; 41 import org.jdom.output.Format; 42 import org.jdom.output.XMLOutputter; 36 import org.jdom2.Attribute; 37 import org.jdom2.Document; 38 import org.jdom2.Element; 39 import org.jdom2.JDOMException; 40 //import org.jdom2.JDOMException; 41 import org.jdom2.Namespace; 42 import org.jdom2.output.Format; 43 import org.jdom2.output.XMLOutputter; 43 44 44 45 import net.sf.basedb.core.BaseException; … … 49 50 import net.sf.basedb.util.ClassUtil; 50 51 import net.sf.basedb.util.Values; 51 import net.sf.basedb.util.X MLUtil;52 import net.sf.basedb.util.XmlUtil2; 52 53 import net.sf.basedb.util.extensions.AboutBean; 53 54 import net.sf.basedb.util.extensions.Action; … … 258 259 public About loadXmlFile(InputStream xmlFile, String filename, 259 260 ClassLoader classLoader, boolean clear) 260 throws JDOMException,IOException, ClassNotFoundException, NoSuchMethodException,261 throws IOException, ClassNotFoundException, NoSuchMethodException, 261 262 IllegalAccessException, InstantiationException 262 263 { … … 279 280 */ 280 281 public About validateXmlFile(InputStream xmlFile, String filename) 281 throws IOException , JDOMException282 throws IOException 282 283 { 283 284 validatedDom = null; … … 465 466 */ 466 467 protected Document loadDocument(InputStream xmlFile, String filename) 467 throws IOException , JDOMException468 throws IOException 468 469 { 469 470 log.debug("Validating file: " + filename); 470 Document dom = XMLUtil.getSchemaValidatedXML(xmlFile, filename, NAMESPACE, SCHEMA_FILE_URL); 471 return dom; 471 return XmlUtil2.getSchemaValidatedXML(xmlFile, filename, NAMESPACE, SCHEMA_FILE_URL); 472 472 } 473 473 … … 511 511 @param aboutTag The about tag 512 512 */ 513 @SuppressWarnings("unchecked")514 513 protected AboutBean loadAbout(Element aboutTag) 515 514 { … … 529 528 about.setUrl(Values.getStringOrNull(aboutTag.getChildText("url", ns))); 530 529 531 List<Attribute> attributes = (List<Attribute>)aboutTag.getAttributes();530 List<Attribute> attributes = aboutTag.getAttributes(); 532 531 for (Attribute a : attributes) 533 532 { … … 800 799 @since 3.0 801 800 */ 802 @SuppressWarnings("unchecked")803 801 protected int loadPluginDefinitions(Document dom, ClassLoader classLoader, About globalAbout) 804 802 throws ClassNotFoundException, NoSuchMethodException, … … 873 871 if (settingsTag != null) 874 872 { 875 for (Element propertyTag : (List<Element>)settingsTag.getChildren("property", ns))873 for (Element propertyTag : settingsTag.getChildren("property", ns)) 876 874 { 877 875 String name = propertyTag.getAttributeValue("name"); … … 929 927 @param root The root element, if null nothing is done 930 928 */ 931 @SuppressWarnings("unchecked")932 929 protected void initBeanWithReflection(Object bean, Element root) 933 930 { … … 935 932 Class<?> beanClass = bean.getClass(); 936 933 937 List<Element> parameters = (List<Element>)root.getChildren();934 List<Element> parameters = root.getChildren(); 938 935 factoryParameters.put(bean, xmlOut.outputString(root)); 939 936 -
trunk/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java
r6372 r6473 73 73 import net.sf.basedb.util.FileUtil; 74 74 import net.sf.basedb.util.Values; 75 import net.sf.basedb.util.X MLUtil;75 import net.sf.basedb.util.XmlUtil2; 76 76 import net.sf.basedb.util.basefile.BaseFileWriter; 77 77 import net.sf.basedb.util.export.spotdata.Base1FieldConverter; … … 87 87 import net.sf.basedb.util.parser.FlatFileParser; 88 88 89 import org.jdom .Document;90 import org.jdom .Element;91 import org.jdom.JDOMException;92 import org.jdom .filter.ElementFilter;93 import org.jdom .output.Format;94 import org.jdom .output.XMLOutputter;89 import org.jdom2.Document; 90 import org.jdom2.Element; 91 //import org.jdom2.JDOMException; 92 import org.jdom2.filter.ElementFilter; 93 import org.jdom2.output.Format; 94 import org.jdom2.output.XMLOutputter; 95 95 96 96 import java.io.ByteArrayOutputStream; … … 1018 1018 } 1019 1019 1020 1021 @SuppressWarnings({ "unchecked" })1022 1020 private Map<String, JobParameter> getJobParameterObjectsFromXML(String xml, boolean hideRemoved) 1023 1021 { … … 1025 1023 { 1026 1024 String doctype = "<!DOCTYPE jobparameters SYSTEM \"base1-plugin-configuration-file.dtd\">"; 1027 Document doc = X MLUtil.getValidatedXml(doctype+xml, dtdFile);1025 Document doc = XmlUtil2.getValidatedXml(doctype+xml, dtdFile); 1028 1026 Iterator<Element> it = doc.getDescendants(new ElementFilter("parameter")); 1029 1027 Map<String, JobParameter> pars = new TreeMap<String, JobParameter>(); … … 1044 1042 return pars; 1045 1043 } 1046 catch (JDOMException e1)1047 {1048 throw new BaseException(e1.getCause());1049 }1050 1044 catch (IOException e1) 1051 1045 { … … 1054 1048 } 1055 1049 1056 1057 @SuppressWarnings({ "unchecked" })1058 1050 private List<PluginParameter<?>> getJobParametersFromXML(String xml, boolean hideRemoved) 1059 1051 { … … 1061 1053 { 1062 1054 String doctype = "<!DOCTYPE jobparameters SYSTEM \"base1-plugin-configuration-file.dtd\">"; 1063 Document doc = X MLUtil.getValidatedXml(doctype+xml, dtdFile);1055 Document doc = XmlUtil2.getValidatedXml(doctype+xml, dtdFile); 1064 1056 Iterator<Element> it = doc.getDescendants(new ElementFilter("parameter")); 1065 1057 Map<Integer, PluginParameter<?>> positionParameter = … … 1080 1072 } 1081 1073 return new ArrayList<PluginParameter<?>>(positionParameter.values()); 1082 }1083 catch (JDOMException e1)1084 {1085 throw new BaseException(e1.getCause());1086 1074 } 1087 1075 catch (IOException e1) … … 1577 1565 } 1578 1566 1579 @SuppressWarnings({ "unchecked" })1580 1567 JobParameter(Element e) 1581 1568 { 1582 try 1583 { 1584 position = e.getAttribute("position").getIntValue(); 1569 position = XmlUtil2.getIntAttribute(e, "position", 1); 1585 1570 type = Base1JobParameterType.get(e.getAttribute("type").getValue().charAt(0)); 1586 1571 Iterator<Element> it = e.getDescendants(new ElementFilter()); … … 1624 1609 } 1625 1610 } 1626 }1627 catch (JDOMException ex)1628 {1629 throw new BaseException(ex);1630 }1631 1611 } 1632 1612 -
trunk/src/plugins/core/net/sf/basedb/plugins/HelpExporter.java
r6127 r6473 61 61 import java.util.Set; 62 62 63 import org.jdom .DocType;64 import org.jdom .Element;65 import org.jdom .output.Format;66 import org.jdom .output.XMLOutputter;63 import org.jdom2.DocType; 64 import org.jdom2.Element; 65 import org.jdom2.output.Format; 66 import org.jdom2.output.XMLOutputter; 67 67 68 68 /** -
trunk/src/plugins/core/net/sf/basedb/plugins/HelpImporter.java
r6127 r6473 66 66 import net.sf.basedb.core.signal.SignalTarget; 67 67 import net.sf.basedb.core.signal.ThreadSignalHandler; 68 import net.sf.basedb.util.X MLUtil;69 70 import org.jdom .Document;71 import org.jdom .Element;68 import net.sf.basedb.util.XmlUtil2; 69 70 import org.jdom2.Document; 71 import org.jdom2.Element; 72 72 73 73 /** … … 325 325 326 326 @Override 327 @SuppressWarnings("unchecked")328 327 public void doImport(InputStream in, ProgressReporter progress) 329 328 throws BaseException … … 343 342 filename = f.getPath().toString(); 344 343 } 345 Document doc = X MLUtil.getValidatedXML(in, dtdURL, filename);344 Document doc = XmlUtil2.getValidatedXML(in, dtdURL, filename); 346 345 Element rootElement = doc.getRootElement(); 347 346 String clientExternalID = rootElement.getAttributeValue("clientExternalID"); … … 349 348 if(client.getExternalId().equals(clientExternalID)) 350 349 { 351 List<Element> helpElements = (List<Element>)rootElement.getChildren();350 List<Element> helpElements = rootElement.getChildren(); 352 351 float percentPerItem = 100.0f / helpElements.size(); 353 352 -
trunk/src/plugins/core/net/sf/basedb/plugins/PluginConfigurationExporter.java
r6127 r6473 66 66 import java.util.Set; 67 67 68 import org.jdom .DocType;69 import org.jdom .Element;70 import org.jdom .output.Format;71 import org.jdom .output.XMLOutputter;68 import org.jdom2.DocType; 69 import org.jdom2.Element; 70 import org.jdom2.output.Format; 71 import org.jdom2.output.XMLOutputter; 72 72 73 73 /** -
trunk/src/plugins/core/net/sf/basedb/plugins/PluginConfigurationImporter.java
r6127 r6473 65 65 import java.util.jar.JarFile; 66 66 67 import org.jdom.Element; 68 import org.jdom.JDOMException; 67 import org.jdom2.Element; 69 68 70 69 /** … … 339 338 340 339 @Override 341 @SuppressWarnings("unchecked")342 340 public void doImport(InputStream in, ProgressReporter progress) 343 341 throws BaseException … … 354 352 } 355 353 356 List<Element> configurations = PluginConfiguration.loadXmlFile (in, filePath);354 List<Element> configurations = PluginConfiguration.loadXmlFile2(in, filePath); 357 355 int parameternumber = 0; 358 356 for (Element configuration : configurations) … … 378 376 config.setName(name); 379 377 config.setDescription(description); 380 config.setParameterValues ((List<Element>)configuration.getChildren("parameter"));378 config.setParameterValues2((List<Element>)configuration.getChildren("parameter")); 381 379 dc.saveItem(config); 382 380 } … … 434 432 public void importPluginConfigurationsFromJar(String jarPath, String xmlPath, 435 433 HashMap<Integer, Boolean> configurations, boolean importAll, boolean setPermissions) 436 throws IOException, JDOMException,BaseException434 throws IOException, BaseException 437 435 { 438 436 this.importAll = importAll; … … 490 488 491 489 in = file.getDownloadStream(0); 492 List<Element> configurations = PluginConfiguration.loadXmlFile (in, filePath);490 List<Element> configurations = PluginConfiguration.loadXmlFile2(in, filePath); 493 491 FileUtil.close(in); 494 492 -
trunk/src/plugins/core/net/sf/basedb/plugins/executor/ParameterDefinition.java
r5384 r6473 34 34 import java.util.Set; 35 35 36 import org.jdom.Document; 37 import org.jdom.Element; 38 import org.jdom.JDOMException; 39 import org.jdom.filter.ElementFilter; 40 import org.jdom.output.Format; 41 import org.jdom.output.XMLOutputter; 36 import org.jdom2.Document; 37 import org.jdom2.Element; 38 import org.jdom2.filter.ElementFilter; 39 import org.jdom2.output.Format; 40 import org.jdom2.output.XMLOutputter; 42 41 43 42 import net.sf.basedb.core.AnnotationType; … … 59 58 import net.sf.basedb.core.query.Orders; 60 59 import net.sf.basedb.util.Values; 61 import net.sf.basedb.util.X MLUtil;60 import net.sf.basedb.util.XmlUtil2; 62 61 63 62 /** … … 102 101 @return A list with parameter definition 103 102 */ 104 @SuppressWarnings("unchecked")105 103 public static List<ParameterDefinition> parseXml(String xml, boolean validate) 106 104 { … … 114 112 try 115 113 { 116 Document doc = X MLUtil.getXml(xml, dtdFile, validate);114 Document doc = XmlUtil2.getXml(xml, dtdFile, validate); 117 115 parameters = new ArrayList<ParameterDefinition>(doc.getContentSize()); 118 116 Iterator<Element> it = doc.getDescendants(new ElementFilter("parameter")); … … 124 122 pd.setType(e.getAttributeValue("type")); 125 123 pd.setName(e.getAttributeValue("name")); 126 pd.setRequired(X MLUtil.getBooleanAttribute(e, "required", false));127 pd.setMultiple(X MLUtil.getBooleanAttribute(e, "multiple", false));124 pd.setRequired(XmlUtil2.getBooleanAttribute(e, "required", false)); 125 pd.setMultiple(XmlUtil2.getBooleanAttribute(e, "multiple", false)); 128 126 pd.setDefaultValue(Values.getStringOrNull(e.getChildText("default"))); 129 127 pd.setDescription(Values.getStringOrNull(e.getChildText("description"))); … … 144 142 parameters.add(pd); 145 143 } 146 }147 catch (JDOMException e)148 {149 throw new BaseException(e);150 144 } 151 145 catch (IOException e) -
trunk/src/test/TestXMLUtil.java
r4889 r6473 21 21 along with BASE. If not, see <http://www.gnu.org/licenses/>. 22 22 */ 23 import net.sf.basedb.util.X MLUtil;23 import net.sf.basedb.util.XmlUtil2; 24 24 25 25 public class TestXMLUtil … … 53 53 try 54 54 { 55 org.jdom .Document dom = XMLUtil.getValidatedXml(xmlFile, dtdFile);55 org.jdom2.Document dom = XmlUtil2.getValidatedXml(xmlFile, dtdFile); 56 56 if (!TestUtil.getSilent()) write(dom.toString()); 57 57 write("--Create DOM OK"); … … 69 69 try 70 70 { 71 org.jdom .Document dom = XMLUtil.getSchemaValidatedXML(xmlFile, schemaFiles);71 org.jdom2.Document dom = XmlUtil2.getSchemaValidatedXML(xmlFile, schemaFiles); 72 72 if (!TestUtil.getSilent()) write(dom.toString()); 73 73 write("--Create schema validated DOM OK"); -
trunk/src/test/data/JarPluginManifest.txt
r5612 r6473 1 1 Class-Path: ../../lib/dist/AffxFusion.jar 2 ../../lib/dist/hibernate 3.jar2 ../../lib/dist/hibernate-core-4.3.5.Final.jar
Note: See TracChangeset
for help on using the changeset viewer.