View Javadoc

1   package com.atlassian.plugin.loaders;
2   
3   import com.atlassian.plugin.elements.ResourceDescriptor;
4   import com.atlassian.plugin.PluginParseException;
5   import com.atlassian.plugin.Resources;
6   import org.dom4j.Element;
7   
8   import java.util.*;
9   
10  public class LoaderUtils
11  {
12      /**
13       * @deprecated use {@link com.atlassian.plugin.Resources#fromXml}
14       */
15      public static List<ResourceDescriptor> getResourceDescriptors(Element element) throws PluginParseException
16      {
17          return Resources.fromXml(element).getResourceDescriptors();
18      }
19  
20      public static Map<String,String> getParams(Element element)
21      {
22          List<Element> elements = element.elements("param");
23  
24          Map<String,String> params = new HashMap<String,String>(elements.size());
25  
26          for (Element paramEl : elements)
27          {
28              String name = paramEl.attributeValue("name");
29              String value = paramEl.attributeValue("value");
30  
31              if (value == null && paramEl.getTextTrim() != null && !"".equals(paramEl.getTextTrim()))
32              {
33                  value = paramEl.getTextTrim();
34              }
35  
36              params.put(name, value);
37          }
38  
39          return params;
40      }
41  }