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.reader;
|
11
|
|
|
12
|
|
import java.net.URL;
|
13
|
|
|
14
|
|
import org.jbind.xml.core.cmp.IComponent;
|
15
|
|
import org.jbind.xml.msg.IConstraintViolations;
|
16
|
|
import org.jbind.xml.schema.instantiation.IComponentJobHelper;
|
17
|
|
import org.jbind.xml.schema.instantiation.IComponentSetter;
|
18
|
|
import org.jbind.xml.schema.instantiation.IImportJobHelper;
|
19
|
|
import org.jbind.xml.schema.instantiation.IIncludeJobHelper;
|
20
|
|
import org.jbind.xml.schema.instantiation.IJobRefs;
|
21
|
|
import org.jbind.xml.schema.instantiation.IRedefineJobHelper;
|
22
|
|
import org.jbind.xml.schema.instantiation.ISchemaElement;
|
23
|
|
|
24
|
|
public class SchemaJob extends Job implements ISchemaJob {
|
25
|
|
|
26
|
|
private IInstantiator myInstantiator = null;
|
27
|
|
private ISchemaElement mySchemaElement = null;
|
28
|
|
private URL myUrl = null;
|
29
|
|
|
30
|
|
private IComponentSetter myAfterCreation = null;
|
31
|
|
private IComponentSetter myAfterValidation = null;
|
32
|
|
|
33
|
204
|
public SchemaJob(final IInstantiator anInstantiator, ISchemaElement aSchemaElement, URL anUrl) {
|
34
|
204
|
super(aSchemaElement);
|
35
|
204
|
myInstantiator = anInstantiator;
|
36
|
204
|
mySchemaElement = aSchemaElement;
|
37
|
204
|
myUrl = anUrl;
|
38
|
|
|
39
|
204
|
myAfterCreation = new IComponentSetter() {
|
40
|
946
|
public void set(IComponent aComponent, IConstraintViolations aViolations) {
|
41
|
946
|
addCreatedComponent(aComponent, aViolations);
|
42
|
|
}
|
43
|
|
};
|
44
|
|
|
45
|
204
|
myAfterValidation = new IComponentSetter() {
|
46
|
933
|
public void set(IComponent aComponent, IConstraintViolations aViolations) {
|
47
|
933
|
addValidatedComponent(aComponent, aViolations);
|
48
|
|
}
|
49
|
|
};
|
50
|
|
|
51
|
|
|
52
|
|
}
|
53
|
|
|
54
|
13209
|
public IInstantiator getInstantiator() {
|
55
|
13209
|
return myInstantiator;
|
56
|
|
}
|
57
|
|
|
58
|
40
|
public URL getUrl() {
|
59
|
40
|
return myUrl;
|
60
|
|
}
|
61
|
|
|
62
|
946
|
public void addCreatedComponent(IComponent aComponent, IConstraintViolations aViolations) {
|
63
|
946
|
getInstantiator().addCreatedComponent(aComponent, aViolations);
|
64
|
|
}
|
65
|
|
|
66
|
933
|
public void addValidatedComponent(IComponent aComponent, IConstraintViolations aViolations) {
|
67
|
933
|
getInstantiator().addValidatedComponent(aComponent, aViolations);
|
68
|
|
}
|
69
|
|
|
70
|
204
|
public void collectRefsForCreation(IJobRefs aJobRefs) {}
|
71
|
382
|
public void collectRefsForCompletion(IJobRefs aJobRefs) {}
|
72
|
0
|
public void collectRefsForValidation(IJobRefs aJobRefs) {}
|
73
|
|
|
74
|
204
|
public void doExecuteCreation(IConstraintViolations aViolations) {
|
75
|
204
|
mySchemaElement.createJobs(this);
|
76
|
|
}
|
77
|
|
|
78
|
178
|
public void doExecuteCompletion(IConstraintViolations aViolations) {}
|
79
|
178
|
public void doExecuteValidation(IConstraintViolations aViolations) {}
|
80
|
|
|
81
|
26
|
public String getDescription() {
|
82
|
26
|
return "schemaJob: " + getLocation();
|
83
|
|
}
|
84
|
|
|
85
|
26
|
public void addImportJob(IImportJobHelper aHelper) {
|
86
|
26
|
addSubJob(new ImportJob(aHelper, mySchemaElement));
|
87
|
|
}
|
88
|
10
|
public void addIncludeJob(IIncludeJobHelper aHelper) {
|
89
|
10
|
addSubJob(new IncludeJob(aHelper, mySchemaElement));
|
90
|
|
}
|
91
|
10
|
public void addRedefineJob(IRedefineJobHelper aHelper) {
|
92
|
10
|
addSubJob(new RedefineJob(aHelper, mySchemaElement));
|
93
|
|
}
|
94
|
967
|
public void addComponentJob(IComponentJobHelper aHelper) {
|
95
|
967
|
addSubJob(new ComponentJob(aHelper, myAfterCreation, myAfterValidation));
|
96
|
|
}
|
97
|
|
|
98
|
|
}
|
99
|
|
|