1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package de.mindcrimeilab.xsanalyzer.model;
19
20 import java.io.File;
21 import java.util.Map;
22 import java.util.Set;
23
24 import javax.xml.namespace.QName;
25
26 import org.apache.xerces.xs.XSModel;
27 import org.apache.xerces.xs.XSNamespaceItem;
28 import org.apache.xerces.xs.XSObject;
29 import org.apache.xerces.xs.XSObjectList;
30 import org.apache.xerces.xs.XSTypeDefinition;
31
32 import de.mindcrimeilab.xsanalyzer.util.XSModelHelper;
33
34
35
36
37
38
39
40 public class XsAnalyzerApplicationModel {
41
42 private File schemaFile;
43
44 private XSModel schemaModel;
45
46 private XSNamespaceItem targetNamespace = null;
47
48 private Map<XSObject, ? extends XSObjectList> usedTypes;
49
50 private Set<XSTypeDefinition> unusedTypes;
51
52 private Map<String, XSObjectList> similarTypes;
53
54 private Map<QName, XSObjectList> sameNamesDifferentTypes;
55
56 public XsAnalyzerApplicationModel() {
57 schemaFile = null;
58 usedTypes = null;
59 unusedTypes = null;
60 similarTypes = null;
61 sameNamesDifferentTypes = null;
62 }
63
64
65
66
67 public File getSchemaFile() {
68 return schemaFile;
69 }
70
71
72
73
74
75 public void setSchemaFile(File schemaFile) {
76 this.schemaFile = schemaFile;
77 }
78
79
80
81
82 public XSModel getSchemaModel() {
83 return schemaModel;
84 }
85
86
87
88
89
90 public void setSchemaModel(XSModel schemaModel) {
91 this.schemaModel = schemaModel;
92 updateTargetNamespace();
93 }
94
95
96
97
98 public Map<XSObject, ? extends XSObjectList> getUsedTypes() {
99 return usedTypes;
100 }
101
102
103
104
105
106 public void setUsedTypes(Map<XSObject, ? extends XSObjectList> usedTypes) {
107 this.usedTypes = usedTypes;
108 }
109
110
111
112
113
114 public Set<XSTypeDefinition> getUnusedTypes() {
115 return unusedTypes;
116 }
117
118
119
120
121
122 public void setUnusedTypes(Set<XSTypeDefinition> unusedTypes) {
123 this.unusedTypes = unusedTypes;
124 }
125
126
127
128
129 public Map<String, XSObjectList> getSimilarTypes() {
130 return similarTypes;
131 }
132
133 public void setSimilarTypes(Map<String, XSObjectList> similarTypes) {
134 this.similarTypes = similarTypes;
135 }
136
137
138
139
140 public Map<QName, XSObjectList> getSameNamesDifferentTypes() {
141 return sameNamesDifferentTypes;
142 }
143
144 public void setSameNamesDifferentTypes(Map<QName, XSObjectList> sameNames) {
145 this.sameNamesDifferentTypes = sameNames;
146 }
147
148 public XSNamespaceItem getTargetNamespace() {
149 if (null == targetNamespace) {
150 updateTargetNamespace();
151 }
152 return targetNamespace;
153 }
154
155
156
157
158 private void updateTargetNamespace() {
159 targetNamespace = XSModelHelper.getTargetNamespace(schemaModel, schemaFile);
160 }
161 }