Fields Summary |
---|
public static final String | DEFAULT_NSTOPKG_FILEField DEFAULT_NSTOPKG_FILE |
protected HashMap | namespaceMapField namespaceMap |
protected String | typeMappingVersionField typeMappingVersion |
protected org.apache.axis.wsdl.symbolTable.BaseTypeMapping | baseTypeMappingField baseTypeMapping |
protected Namespaces | namespacesField namespaces |
protected String | NStoPkgFilenameField NStoPkgFilename |
private boolean | bEmitServerField bEmitServer |
private boolean | bDeploySkeletonField bDeploySkeleton |
private boolean | bEmitTestCaseField bEmitTestCase |
private boolean | bGenerateAllField bGenerateAll |
private boolean | bHelperGenerationField bHelperGeneration |
private boolean | bBuildFileGeneration |
private boolean | typeCollisionProtection |
private boolean | allowInvalidURLCheck if URL endpoints are valid or not |
private String | packageNameField packageName |
private org.apache.axis.constants.Scope | scopeField scope |
private GeneratedFileInfo | fileInfoField fileInfo |
private HashMap | delayedNamespacesMapField delayedNamespacesMap |
private String | outputDirField outputDir |
protected List | nsIncludesField nsIncludes - defines a list of namespaces to specifically
include in the generated source code. If non-empty, anything
not in this list should be excluded. If empty, everything in this
and not specifically excluded should be generated. |
protected List | nsExcludesField nsIncludes - defines a list of namespaces to specifically
exclude from generated source code. Any entry in this list that
is in conflict with the includes list should be ignored and
generated. |
protected List | propertiesField properties - defines a set of general purpose properties
that can be used by custom JavaGeneratorFactories. |
private String | implementationClassNameField implementationClassName - defines a non default classname for the actual
implementation class. Particularly useful when exporting a webservice directly
from the java implementation. |
private org.apache.axis.encoding.TypeMapping | defaultTMField defaultTM |
private org.apache.axis.encoding.TypeMappingRegistryImpl | tmr |
private HashMap | qName2ClassMapThe mapping of qname to its corresponding java type generated by Java2Wsdl emitter. For deploy mode roundtripping use. |
private org.apache.axis.description.ServiceDesc | serviceDescThe ServiceDesc. For deploy mode roundtripping use. |
private boolean | isDeployThe deploy mode flag |
Methods Summary |
---|
public void | debug(boolean value)Turn on/off debug messages.
setDebug(value);
|
public void | deploySkeleton(boolean value)Turn on/off server skeleton deploy
setSkeletonWanted(value);
|
protected boolean | doesExist(java.lang.String className)Check if the className exists.
try {
ClassUtils.forName(className);
} catch (ClassNotFoundException e) {
return false;
}
return true;
|
public void | emit(java.lang.String uri)Call this method if you have a uri for the WSDL document
run(uri);
|
public void | emit(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.
run(context, doc);
|
public void | generateAll(boolean all)
setAllWanted(all);
|
public void | generateImports(boolean generateImports)Turn on/off generation of elements from imported files.
setImports(generateImports);
|
public void | generateServerSide(boolean value)Turn on/off server-side binding generation
setServerSide(value);
|
public void | generateTestCase(boolean value)Turn on/off test case creation
setTestCaseWanted(value);
|
public boolean | getDebug()Return the status of the debug switch.
return isDebug();
|
public org.apache.axis.encoding.TypeMapping | getDefaultTypeMapping()Returns the default TypeMapping used by the service
if (defaultTM == null) {
defaultTM =
(TypeMapping)tmr.getTypeMapping(Constants.URI_SOAP11_ENC);
}
return defaultTM;
|
public boolean | getDeploySkeleton()Indicate if we should be deploying skeleton or implementation
return isSkeletonWanted();
|
public boolean | getGenerateServerSide()Indicate if we should be emitting server side code and deploy/undeploy
return isServerSide();
|
public java.util.List | getGeneratedClassNames()This method returns a list of all generated class names.
return fileInfo.getClassNames();
|
public GeneratedFileInfo | getGeneratedFileInfo()Returns an object which contains of information on all generated files
including the class name, filename and a type string.
return fileInfo;
|
public java.util.List | getGeneratedFileNames()This method returns a list of all generated file names.
return fileInfo.getFileNames();
|
public boolean | getHelperGeneration()Indicate if we should be generating Helper classes
return isHelperWanted();
|
public java.lang.String | getImplementationClassName()Get an implementation classname to use instead of the default.
return implementationClassName;
|
public java.lang.String | getJavaName(javax.xml.namespace.QName qName)Convert the specified QName into a full Java Name.
// If this is one of our special 'collection' qnames.
// get the element type and append []
if (qName.getLocalPart().indexOf("[") > 0) {
String localPart = qName.getLocalPart().substring(0,
qName.getLocalPart().indexOf("["));
QName eQName = new QName(qName.getNamespaceURI(), localPart);
return getJavaName(eQName) + "[]";
}
// Handle the special "java" namespace for types
if (qName.getNamespaceURI().equalsIgnoreCase("java")) {
return qName.getLocalPart();
}
// The QName may represent a base java name, so check this first
String fullJavaName =
getFactory().getBaseTypeMapping().getBaseName(qName);
if (fullJavaName != null) {
return fullJavaName;
}
fullJavaName = getJavaNameHook(qName);
if (fullJavaName != null) {
return fullJavaName;
}
// Use the namespace uri to get the appropriate package
String pkg = getPackage(qName.getNamespaceURI());
if (pkg != null && pkg.length() > 0) {
fullJavaName = pkg + "."
+ Utils.xmlNameToJavaClass(qName.getLocalPart());
} else {
fullJavaName = Utils.xmlNameToJavaClass(qName.getLocalPart());
}
return fullJavaName;
|
protected java.lang.String | getJavaNameHook(javax.xml.namespace.QName qname) return null;
|
public java.lang.String | getJavaVariableName(javax.xml.namespace.QName typeQName, javax.xml.namespace.QName xmlName, boolean isElement)
String javaName = getJavaVariableNameHook(typeQName, xmlName, isElement);
if (javaName == null) {
String elemName = Utils.getLastLocalPart(xmlName.getLocalPart());
javaName = Utils.xmlNameToJava(elemName);
}
return javaName;
|
protected java.lang.String | getJavaVariableNameHook(javax.xml.namespace.QName typeQName, javax.xml.namespace.QName xmlName, boolean isElement)
return null;
|
private void | getNStoPkgFromPropsFile(java.util.HashMap namespaces)Tries to load the namespace-to-package mapping file.
- if a file name is explicitly set using
setNStoPkg() , tries
to load the mapping from this file. If this fails, the built-in default
mapping is used.
- if no file name is set, tries to load the file
DEFAULT_NSTOPKG_FILE
as a java resource. If this fails, the built-in dfault mapping is used.
Properties mappings = new Properties();
if (NStoPkgFilename != null) {
try {
mappings.load(new FileInputStream(NStoPkgFilename));
if (verbose) {
System.out.println(
Messages.getMessage(
"nsToPkgFileLoaded00", NStoPkgFilename));
}
} catch (Throwable t) {
// loading the custom mapping file failed. We do not try
// to load the mapping from a default mapping file.
throw new IOException(
Messages.getMessage(
"nsToPkgFileNotFound00", NStoPkgFilename));
}
} else {
try {
mappings.load(new FileInputStream(DEFAULT_NSTOPKG_FILE));
if (verbose) {
System.out.println(
Messages.getMessage(
"nsToPkgFileLoaded00", DEFAULT_NSTOPKG_FILE));
}
} catch (Throwable t) {
try {
mappings.load(ClassUtils.getResourceAsStream(Emitter.class,
DEFAULT_NSTOPKG_FILE));
if (verbose) {
System.out.println(
Messages.getMessage(
"nsToPkgDefaultFileLoaded00",
DEFAULT_NSTOPKG_FILE));
}
} catch (Throwable t1) {
// loading the default mapping file failed.
// The built-in default mapping is used
// No message is given, since this is generally what happens
}
}
}
Enumeration keys = mappings.propertyNames();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
namespaces.put(key, mappings.getProperty(key));
}
|
public java.util.List | getNamespaceExcludes()Returns the list of excludes to specifically exclude
from the generated source.
return this.nsExcludes;
|
public java.util.List | getNamespaceIncludes()Returns the list of namespaces specifically excluded
from the generated code.
return this.nsIncludes;
|
public java.util.HashMap | getNamespaceMap()Get the map of namespace -> Java package names
return delayedNamespacesMap;
|
public Namespaces | getNamespaces()Method getNamespaces
return namespaces;
|
public java.lang.String | getOutputDir()Get the output directory to use for emitted source files
return outputDir;
|
public java.lang.String | getPackage(java.lang.String namespace)Get the Package name for the specified namespace
return namespaces.getCreate(namespace);
|
public java.lang.String | getPackage(javax.xml.namespace.QName qName)Get the Package name for the specified QName
return getPackage(qName.getNamespaceURI());
|
public java.lang.String | getPackageName()Get global package name to use instead of mapping namespaces
return packageName;
|
public java.util.List | getProperties()Gets the list of extension properties for custom
JavaGeneratorFactories.
return this.properties;
|
public java.util.HashMap | getQName2ClassMap()Get the type qname to java class map
return qName2ClassMap;
|
public org.apache.axis.constants.Scope | getScope()Get the scope for the deploy.xml file.
return scope;
|
public org.apache.axis.description.ServiceDesc | getServiceDesc()Retruns the SericeDesc object
return serviceDesc;
|
public java.lang.String | getTypeMappingVersion()Get the typemapping version
return typeMappingVersion;
|
public boolean | getVerbose()Return the status of the verbose switch
return isVerbose();
|
public org.apache.axis.wsdl.gen.GeneratorFactory | getWriterFactory()Get the GeneratorFactory.
return getFactory();
|
public boolean | isAllWanted()Method isAllWanted
return bGenerateAll;
|
public boolean | isAllowInvalidURL()
return allowInvalidURL;
|
public boolean | isBuildFileWanted()get the build file genaeration state
return bBuildFileGeneration;
|
public boolean | isDeploy()Returns the deploy mode flag
return isDeploy;
|
public boolean | isHelperWanted()Indicate if we should be generating Helper classes
return bHelperGeneration;
|
public boolean | isServerSide()Indicate if we should be emitting server side code and deploy/undeploy
return bEmitServer;
|
public boolean | isSkeletonWanted()Indicate if we should be deploying skeleton or implementation
return bDeploySkeleton;
|
public boolean | isTestCaseWanted()Method isTestCaseWanted
return bEmitTestCase;
|
public boolean | isTypeCollisionProtection()Get the type collision protection setting
return this.typeCollisionProtection;
|
public void | run(java.lang.String wsdlURL)Emit appropriate Java files for a WSDL at a given URL.
This method will time out after the number of milliseconds specified
by our timeoutms member.
setup();
super.run(wsdlURL);
|
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.
setup();
super.run(context, doc);
|
protected void | sanityCheck(org.apache.axis.wsdl.symbolTable.SymbolTable symbolTable)Method sanityCheck
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);
String namespace = entry.getQName().getNamespaceURI();
String packageName =
org.apache.axis.wsdl.toJava.Utils.makePackageName(
namespace);
String localName = entry.getQName().getLocalPart();
if (localName.equals(packageName)
&& packageName.equals(
namespaces.getCreate(namespace))) {
packageName += "_pkg";
namespaces.put(namespace, packageName);
}
}
}
|
public void | setAllWanted(boolean all)By default, code is generated only for referenced elements.
Call bGenerateAll(true) and WSDL2Java will generate code for all
elements in the scope regardless of whether they are
referenced. Scope means: by default, all WSDL files; if
generateImports(false), then only the immediate WSDL file.
bGenerateAll = all;
|
public void | setAllowInvalidURL(boolean allowInvalidURL)
this.allowInvalidURL = allowInvalidURL;
|
public void | setBuildFileWanted(boolean value)turn the build file genaration ON
bBuildFileGeneration = value;
|
public void | setDefaultTypeMapping(org.apache.axis.encoding.TypeMapping defaultTM)Sets the default TypeMapping used by the service
this.defaultTM = defaultTM;
|
public void | setDeploy(boolean isDeploy)Sets the deploy mode flag
this.isDeploy = isDeploy;
|
public void | setFactory(java.lang.String factory)Sets the WriterFactory Class to use
try {
Class clazz = ClassUtils.forName(factory);
GeneratorFactory genFac;
try {
Constructor ctor = clazz.getConstructor(new Class[]{
getClass()});
genFac = (GeneratorFactory) ctor.newInstance(new Object[]{
this});
} catch (NoSuchMethodException ex) {
genFac = (GeneratorFactory) clazz.newInstance();
}
setFactory(genFac);
} catch (Exception ex) {
ex.printStackTrace();
}
|
public void | setHelperGeneration(boolean value)Turn on/off Helper class generation
setHelperWanted(value);
|
public void | setHelperWanted(boolean value)Turn on/off Helper class generation
bHelperGeneration = value;
|
public void | setImplementationClassName(java.lang.String implementationClassName)Set an implementation classname to use instead of the default.
this.implementationClassName = implementationClassName;
|
public void | setNStoPkg(java.lang.String NStoPkgFilename)Set the NStoPkg mappings filename.
if (NStoPkgFilename != null) {
this.NStoPkgFilename = NStoPkgFilename;
}
|
public void | setNamespaceExcludes(java.util.List nsExcludes)Sets the list of namespaces to specifically exclude
from the generated source.
this.nsExcludes = nsExcludes;
|
public void | setNamespaceIncludes(java.util.List nsIncludes)Sets the list of namespaces to specifically include
in the generated code.
this.nsIncludes = nsIncludes;
|
public void | setNamespaceMap(java.util.HashMap map)Set a map of namespace -> Java package names
delayedNamespacesMap = map;
|
public void | setOutputDir(java.lang.String outputDir)Set the output directory to use in emitted source files
this.outputDir = outputDir;
|
public void | setPackageName(java.lang.String packageName)Set a global package name to use instead of mapping namespaces
this.packageName = packageName;
|
public void | setProperties(java.util.List properties)Sets the list of extension properties for custom
JavaGeneratorFactories.
this.properties = properties;
|
public void | setQName2ClassMap(java.util.HashMap map)Set the type qname to java class map
qName2ClassMap = map;
|
public void | setScope(org.apache.axis.constants.Scope scope)Set the scope for the deploy.xml file.
this.scope = scope;
|
public void | setServerSide(boolean value)Turn on/off server skeleton creation
this.bEmitServer = value;
|
public void | setServiceDesc(org.apache.axis.description.ServiceDesc serviceDesc)Sets the ServicdDesc object
this.serviceDesc = serviceDesc;
|
public void | setSkeletonWanted(boolean value)Turn on/off server skeleton deploy
bDeploySkeleton = value;
|
public void | setTestCaseWanted(boolean value)Turn on/off test case creation
this.bEmitTestCase = value;
|
public void | setTypeCollisionProtection(boolean value)Enable/disable type collision protection
this.typeCollisionProtection = value;
|
public void | setTypeMappingVersion(java.lang.String typeMappingVersion)Method setTypeMappingVersion
this.typeMappingVersion = typeMappingVersion;
tmr.doRegisterFromVersion(typeMappingVersion);
baseTypeMapping = new BaseTypeMapping() {
final TypeMapping defaultTM = getDefaultTypeMapping();
public String getBaseName(QName qNameIn) {
javax.xml.namespace.QName qName =
new javax.xml.namespace.QName(qNameIn.getNamespaceURI(),
qNameIn.getLocalPart());
Class cls =
defaultTM.getClassForQName(qName);
if (cls == null) {
return null;
} else {
return JavaUtils.getTextClassName(cls.getName());
}
}
};
|
public void | setWrapArrays(boolean wrapArrays)
this.wrapArrays = wrapArrays;
|
private void | setup()Method setup
if (baseTypeMapping == null) {
setTypeMappingVersion(typeMappingVersion);
}
getFactory().setBaseTypeMapping(baseTypeMapping);
namespaces = new Namespaces(outputDir);
if (packageName != null) {
namespaces.setDefaultPackage(packageName);
} else {
// First, read the namespace mapping file - configurable, by default
// NStoPkg.properties - if it exists, and load the namespaceMap HashMap
// with its data.
getNStoPkgFromPropsFile(namespaces);
if (delayedNamespacesMap != null) {
namespaces.putAll(delayedNamespacesMap);
}
}
|
public void | verbose(boolean value)Turn on/off verbose messages
setVerbose(value);
|