1
|
|
/*
|
2
|
|
* JBind
|
3
|
|
*
|
4
|
|
* Copyright (c) by Stefan Wachter. All rights reserved.
|
5
|
|
*
|
6
|
|
* Usage, modification, and redistribution is subject to license terms that are
|
7
|
|
* available at 'http://www.jbind.org'. The JBind license is like the
|
8
|
|
* 'Apache Software License V 1.1'.
|
9
|
|
*/
|
10
|
|
package org.jbind.xml.schema.element;
|
11
|
|
|
12
|
|
import org.jbind.xml.base.IAttribute;
|
13
|
|
import org.jbind.xml.base.ISymbolspace;
|
14
|
|
import org.jbind.xml.base.ISymbolspaces;
|
15
|
|
import org.jbind.xml.core.cmp.IComponent;
|
16
|
|
import org.jbind.xml.core.cmp.IComponentStore;
|
17
|
|
import org.jbind.xml.msg.IConstraintViolations;
|
18
|
|
import org.jbind.xml.msg.XmlException;
|
19
|
|
import org.jbind.xml.msg.XmlMessages;
|
20
|
|
import org.jbind.xml.schema.instantiation.IElemValHelper;
|
21
|
|
import org.jbind.xml.schema.instantiation.IElementHelper;
|
22
|
|
import org.jbind.xml.schema.instantiation.IJobRefs;
|
23
|
|
|
24
|
|
public class Notation extends Named implements INotation {
|
25
|
|
|
26
|
|
private String myPublicId = null;
|
27
|
|
private String mySystemId = null;
|
28
|
|
|
29
|
4
|
public Notation(CreationParams aCreationParams) {
|
30
|
4
|
super(aCreationParams);
|
31
|
|
}
|
32
|
|
|
33
|
12
|
protected IAttribute doCreateAttribute(ACParams anACParams) throws XmlException {
|
34
|
12
|
IAttribute res = null;
|
35
|
12
|
String an = NameUtil.getSchemaAttributeName(anACParams);
|
36
|
12
|
if ("public".equals(an)) {
|
37
|
4
|
res = new Attribute(anACParams);
|
38
|
4
|
myPublicId = res.getStringValue();
|
39
|
8
|
} else if ("system".equals(an)) {
|
40
|
4
|
res = new Attribute(anACParams);
|
41
|
4
|
mySystemId = res.getStringValue();
|
42
|
|
} else {
|
43
|
4
|
res = super.doCreateAttribute(anACParams);
|
44
|
|
}
|
45
|
12
|
return res;
|
46
|
|
}
|
47
|
|
|
48
|
4
|
public void validateElement(IElemValHelper aHelper, IConstraintViolations aViolations) {
|
49
|
4
|
super.validateElement(aHelper, aViolations);
|
50
|
4
|
if (null == getName()) {
|
51
|
0
|
aViolations.add(XmlMessages.missingName(this));
|
52
|
|
}
|
53
|
4
|
if (null == myPublicId) {
|
54
|
0
|
aViolations.add(XmlMessages.missingPublicId(this));
|
55
|
|
}
|
56
|
|
}
|
57
|
|
|
58
|
|
|
59
|
0
|
public String getSystem() {
|
60
|
0
|
return mySystemId;
|
61
|
|
}
|
62
|
|
|
63
|
|
|
64
|
0
|
public String getPublic() {
|
65
|
0
|
return myPublicId;
|
66
|
|
}
|
67
|
|
|
68
|
|
|
69
|
0
|
public ISymbolspace getSymbolSpace() {
|
70
|
0
|
return ISymbolspaces.NOTATION;
|
71
|
|
}
|
72
|
|
|
73
|
|
|
74
|
|
//
|
75
|
|
// Implementation of IComponentJobHelper
|
76
|
|
//
|
77
|
|
|
78
|
0
|
public void collectRefsForCreation(IJobRefs aJobRefs) {}
|
79
|
|
|
80
|
|
|
81
|
0
|
public void collectRefsForCompletion(IElementHelper anElementHelper, IJobRefs aJobRefs) {}
|
82
|
0
|
public void collectRefsForValidation(IElementHelper anElementHelper, IJobRefs aJobRefs) {}
|
83
|
|
|
84
|
|
|
85
|
0
|
public IComponent createComponent(IElementHelper anElementHelper, IConstraintViolations aViolations) {
|
86
|
0
|
return new org.jbind.xml.schema.cmp.Notation(this, getSchemaElement().getTargetNamespace(), getName(), myPublicId, mySystemId);
|
87
|
|
}
|
88
|
|
|
89
|
0
|
public void completeComponent(IElementHelper anElementHelper, IComponent aComponent, IConstraintViolations aViolations) {}
|
90
|
|
|
91
|
0
|
public void addSchemaData(IComponentStore aComponentStore, IComponent aComponent, IConstraintViolations aViolations) {}
|
92
|
|
|
93
|
|
}
|
94
|
|
|