Methods Summary |
---|
private void | generate(org.apache.axis.wsdl.symbolTable.SymbolTable symbolTable)Method generate
sanityCheck(symbolTable);
Definition def = symbolTable.getDefinition();
genFactory.generatorPass(def, symbolTable);
if (isDebug()) {
symbolTable.dump(System.out);
}
// Generate bindings for types
generateTypes(symbolTable);
Iterator it = symbolTable.getHashMap().values().iterator();
while (it.hasNext()) {
Vector v = (Vector) it.next();
for (int i = 0; i < v.size(); ++i) {
SymTabEntry entry = (SymTabEntry) v.elementAt(i);
Generator gen = null;
if (entry instanceof MessageEntry) {
gen = genFactory.getGenerator(
((MessageEntry) entry).getMessage(), symbolTable);
} else if (entry instanceof PortTypeEntry) {
PortTypeEntry pEntry = (PortTypeEntry) entry;
// If the portType is undefined, then we're parsing a Definition
// that didn't contain a portType, merely a binding that referred
// to a non-existent port type. Don't bother writing it.
if (pEntry.getPortType().isUndefined()) {
continue;
}
gen = genFactory.getGenerator(pEntry.getPortType(),
symbolTable);
} else if (entry instanceof BindingEntry) {
BindingEntry bEntry = (BindingEntry) entry;
Binding binding = bEntry.getBinding();
// If the binding is undefined, then we're parsing a Definition
// that didn't contain a binding, merely a service that referred
// to a non-existent binding. Don't bother writing it.
if (binding.isUndefined() || !bEntry.isReferenced()) {
continue;
}
gen = genFactory.getGenerator(binding, symbolTable);
} else if (entry instanceof ServiceEntry) {
gen = genFactory.getGenerator(
((ServiceEntry) entry).getService(), symbolTable);
}
if (gen != null) {
gen.generate();
}
}
}
// Output extra stuff (deployment files and faults)
// outside of the recursive emit method.
Generator gen = genFactory.getGenerator(def, symbolTable);
gen.generate();
|
private void | generateTypes(org.apache.axis.wsdl.symbolTable.SymbolTable symbolTable)Generate bindings (classes and class holders) for the complex types.
If generating serverside (skeleton) spit out beanmappings
Map elements = symbolTable.getElementIndex();
Collection elementCollection = elements.values();
for (Iterator i = elementCollection.iterator(); i.hasNext(); ) {
TypeEntry type = (TypeEntry) i.next();
// Write out the type if and only if:
// - we found its definition (getNode())
// - it is referenced
// - it is not a base type or an attributeGroup or xs:group
// - it is a Type (not an Element) or a CollectionElement
// (Note that types that are arrays are passed to getGenerator
// because they may require a Holder)
// A CollectionElement is an array that might need a holder
boolean isType = ((type instanceof Type)
|| (type instanceof CollectionElement));
if ((type.getNode() != null)
&& !Utils.isXsNode(type.getNode(), "attributeGroup")
&& !Utils.isXsNode(type.getNode(), "group")
&& type.isReferenced() && isType
&& (type.getBaseType() == null)) {
Generator gen = genFactory.getGenerator(type, symbolTable);
gen.generate();
}
}
Map types = symbolTable.getTypeIndex();
Collection typeCollection = types.values();
for (Iterator i = typeCollection.iterator(); i.hasNext(); ) {
TypeEntry type = (TypeEntry) i.next();
// Write out the type if and only if:
// - we found its definition (getNode())
// - it is referenced
// - it is not a base type or an attributeGroup or xs:group
// - it is a Type (not an Element) or a CollectionElement
// (Note that types that are arrays are passed to getGenerator
// because they may require a Holder)
// A CollectionElement is an array that might need a holder
boolean isType = ((type instanceof Type)
|| (type instanceof CollectionElement));
if ((type.getNode() != null)
&& !Utils.isXsNode(type.getNode(), "attributeGroup")
&& !Utils.isXsNode(type.getNode(), "group")
&& type.isReferenced() && isType
&& (type.getBaseType() == null)) {
Generator gen = genFactory.getGenerator(type, symbolTable);
gen.generate();
}
}
|
public javax.wsdl.Definition | getCurrentDefinition()Return the current definition. The current definition is
null until run is called.
return (symbolTable == null)
? null
: symbolTable.getDefinition();
|
public GeneratorFactory | getFactory()Method getFactory
return genFactory;
|
public java.lang.String | getPassword()Method getPassword
return password;
|
public org.apache.axis.wsdl.symbolTable.SymbolTable | getSymbolTable()Get the symbol table. The symbol table is null until
run is called.
return symbolTable;
|
public long | getTimeout()Return the current timeout setting
return timeoutms;
|
public java.lang.String | getUsername()Method getUsername
return username;
|
public java.lang.String | getWSDLURI()Get the current WSDL URI. The WSDL URI is null until
run is called.
return (symbolTable == null)
? null
: symbolTable.getWSDLURI();
|
public boolean | isDebug()Method isDebug
return debug;
|
public boolean | isImports()Method isImports
return imports;
|
public boolean | isNowrap()Method isNowrap
return nowrap;
|
public boolean | isQuiet()Method isQuiet
return quiet;
|
public boolean | isVerbose()Method isVerbose
return verbose;
|
public void | run(java.lang.String wsdlURI)Parse a WSDL at a given URL.
This method will time out after the number of milliseconds specified
by our timeoutms member.
if (getFactory() == null) {
setFactory(new NoopFactory());
}
symbolTable = new SymbolTable(genFactory.getBaseTypeMapping(), imports,
verbose, nowrap);
symbolTable.setQuiet(quiet);
symbolTable.setWrapArrays(wrapArrays);
// We run the actual Emitter in a thread that we can kill
WSDLRunnable runnable = new WSDLRunnable(symbolTable, wsdlURI);
Thread wsdlThread = new Thread(runnable);
wsdlThread.start();
try {
if (timeoutms > 0) {
wsdlThread.join(timeoutms);
} else {
wsdlThread.join();
}
} catch (InterruptedException e) {
}
if (wsdlThread.isAlive()) {
wsdlThread.interrupt();
throw new IOException(Messages.getMessage("timedOut"));
}
if (runnable.getFailure() != null) {
throw runnable.getFailure();
}
|
public void | run(java.lang.String context, org.w3c.dom.Document doc)Call this method if your WSDL document has already been parsed as an XML DOM document.
if (getFactory() == null) {
setFactory(new NoopFactory());
}
symbolTable = new SymbolTable(genFactory.getBaseTypeMapping(), imports,
verbose, nowrap);
symbolTable.populate(context, doc);
generate(symbolTable);
|
protected void | sanityCheck(org.apache.axis.wsdl.symbolTable.SymbolTable symbolTable)Method sanityCheck
// do nothing.
|
public void | setDebug(boolean debug)Method setDebug
this.debug = debug;
|
public void | setFactory(GeneratorFactory factory)Method setFactory
this.genFactory = factory;
|
public void | setImports(boolean imports)Method setImports
this.imports = imports;
|
public void | setNowrap(boolean nowrap)Method setNowrap
this.nowrap = nowrap;
|
public void | setPassword(java.lang.String password)Method setPassword
this.password = password;
|
public void | setQuiet(boolean quiet)Method setQuiet
this.quiet = quiet;
|
public void | setTimeout(long timeout)Set the timeout, in milliseconds
this.timeoutms = timeout;
|
public void | setUsername(java.lang.String username)Method setUsername
this.username = username;
|
public void | setVerbose(boolean verbose)Method setVerbose
this.verbose = verbose;
|