1
22
23 package com.liferay.util.xml.descriptor;
24
25 import com.liferay.util.xml.ElementIdentifier;
26
27 import org.dom4j.Document;
28
29
34 public class WebXML23Descriptor extends SimpleXMLDescriptor {
35
36 public boolean canHandleType(String doctype, Document root) {
37 if (doctype.indexOf("web-app") != -1) {
38 return true;
39 }
40 else {
41 return false;
42 }
43 }
44
45 public String[] getRootChildrenOrder() {
46 return _ROOT_ORDERED_CHILDREN;
47 }
48
49 public ElementIdentifier[] getElementsIdentifiedByAttribute() {
50 return _ELEMENTS_IDENTIFIED_BY_ATTR;
51 }
52
53 public ElementIdentifier[] getElementsIdentifiedByChild() {
54 return _ELEMENTS_IDENTIFIED_BY_CHILD;
55 }
56
57 public String[] getUniqueElements() {
58 return _UNIQUE_ELEMENTS;
59 }
60
61 public String[] getJoinableElements() {
62 return _JOINABLE_ELEMENTS;
63 }
64
65 private static final String[] _ROOT_ORDERED_CHILDREN = {
66 "icon", "display-name", "description", "distributable", "context-param",
67 "filter", "filter-mapping", "listener", "servlet", "servlet-mapping",
68 "session-config", "mime-mapping", "welcome-file-list", "error-page",
69 "taglib", "resource-env-ref", "resource-ref", "security-constraint",
70 "login-config", "security-role", "env-entry", "ejb-ref", "ejb-local-ref"
71 };
72
73 private static final ElementIdentifier[] _ELEMENTS_IDENTIFIED_BY_ATTR = {
74 };
75
76 private static final ElementIdentifier[] _ELEMENTS_IDENTIFIED_BY_CHILD = {
77 new ElementIdentifier("context-param", "param-name"),
78 new ElementIdentifier("filter", "filter-name"),
79 new ElementIdentifier("servlet", "servlet-name"),
81 new ElementIdentifier("init-param", "param-name"),
83 new ElementIdentifier("taglib", "taglib-uri"),
84 new ElementIdentifier("resource-env-ref", "res-env-ref-name"),
85 new ElementIdentifier("resource-ref", "res-ref-name"),
86 new ElementIdentifier("ejb-local-ref", "ejb-ref-name")
87 };
88
89 private static final String[] _UNIQUE_ELEMENTS = {
90 "icon", "display-name", "description", "distributable",
91 "session-config", "welcome-file-list", "login-config"
92 };
93
94 private static final String[] _JOINABLE_ELEMENTS = {
95 "welcome-file-list"
96 };
97
98 }