TreeWalker wlkr = new TreeWalker(null, new SchemaContextTracker());
for (Iterator iter = resolves.iterator(); iter.hasNext();) {
SchemaElement schema = vctx.getSchemaById(((ISchemaResolver)iter.next()).getId());
exists.add(schema);
final SchemaHolder holder = new SchemaHolder(schema);
SchemaVisitor visitor = new SchemaVisitor() {
public boolean visit(SchemaBase node) {
return false;
}
public boolean visit(ComplexTypeElement node) {
typeschemas.put(node.getQName(), holder);
return false;
}
public boolean visit(ElementElement node) {
elemschemas.put(node.getQName(), holder);
return false;
}
};
wlkr.walkChildren(schema, visitor);
}
// build set of binding definitions provided on command line
final Set bindings = new HashSet();
errors = ResourceMatcher.matchPaths(new File("."), null, parms.getUseBindings(),
new ResourceMatcher.ReportMatch() {
public void foundMatch(String path, URL url) {
bindings.add(url);
}
});
if (errors.size() > 0) {
for (Iterator iter = errors.iterator(); iter.hasNext();) {
System.err.println(iter.next());
}
System.exit(3);
}
// build maps of type and element mappings from bindings
Map classelems = new HashMap();
Map classtypes = new HashMap();
for (Iterator iter = bindings.iterator(); iter.hasNext();) {
URL url = (URL)iter.next();
processPregeneratedBinding(url, classelems, classtypes);
}
// generate services, bindings, and WSDLs
Jibx2Wsdl inst = new Jibx2Wsdl(parms);
ArrayList extras = new ArrayList(parms.getExtraTypes());
ArrayList classes = parms.getGlobal().getUnmarshalledClasses();
for (int i = 0; i < classes.size(); i++) {
ClassCustom clas = (ClassCustom)classes.get(i);
if (clas.isForceMapping()) {
extras.add(clas.getName());
}
}
List wsdls = inst.generate(parms.getExtraArgs(), extras, classelems, elemschemas, classtypes, typeschemas,
exists);
if (wsdls != null) {
// write the schemas and WSDLS
SchemaGen.writeSchemas(parms.getGeneratePath(), inst.m_uriSchemaMap.values());
WsdlWriter writer = new WsdlWriter();
for (Iterator iter = wsdls.iterator(); iter.hasNext();) {
Definitions def = (Definitions)iter.next();
File file = new File(parms.getGeneratePath(), def.getServiceName() + ".wsdl");
writer.writeWSDL(def, new FileOutputStream(file));
}
// find existing schemas referenced (directly or indirectly) from WSDL schemas
final Set needschemas = new HashSet();
SchemaVisitor visitor = new SchemaVisitor() {
private int m_existsDepth;
public void exit(SchemaElement node) {
if (exists.contains(node)) {