JamService service = factory.createService(jam_service_parms);
QName extraSchemaTypeName = null;
JamClassIterator jClassIter = service.getClasses();
// all most all the time the ittr will have only one class in it
while (jClassIter.hasNext()) {
JClass jclass = (JClass)jClassIter.next();
// serviceName = jclass.getSimpleName();
// todo in the future , when we support annotation we can use this
// JAnnotation[] annotations = jclass.getAnnotations();
if (jclass.getQualifiedName().equals(generationParams.getSourceClassName())) {
/**
* Schema generation done in two stage 1. Load all the methods
* and create type for methods parameters (if the parameters are
* Bean then it will create Complex types for those , and if the
* parameters are simple type which describe in SimpleTypeTable
* nothing will happen) 2. In the next stage for all the methods
* messages and port types will be created
*/
methods = jclass.getDeclaredMethods();
// short the elements in the array
Arrays.sort(methods);
// since we do not support overload
HashMap uniqueMethods = new HashMap();
XmlSchemaComplexType methodSchemaType;
XmlSchemaSequence sequence = null;
for (int i = 0; i < methods.length; i++) {
JMethod jMethod = methods[i];
String methodName = methods[i].getSimpleName();
// no need to think about this method , since that is system
// config method
if (excludeMethods.contains(jMethod.getSimpleName())) {
continue;
}
if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
throw new Exception(" Sorry we don't support methods overloading !!!! ");
}
if (!jMethod.isPublic()) {
// no need to generate Schema for non public methods
continue;
}
uniqueMethods.put(jMethod.getSimpleName(), jMethod);
// create the schema type for the method wrapper
uniqueMethods.put(jMethod.getSimpleName(), jMethod);
JParameter[] paras = jMethod.getParameters();
String parameterNames[] = null;
// better to handle void types too
parameterNames = methodTable.getParameterNames(methodName);
sequence = new XmlSchemaSequence();
methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName());
methodSchemaType.setParticle(sequence);
for (int j = 0; j < paras.length; j++) {
JParameter methodParameter = paras[j];
JClass paraType = methodParameter.getType();
generateSchemaForType(sequence, paraType, (parameterNames != null && parameterNames[j] != null)
? parameterNames[j] : methodParameter.getSimpleName());
}
// for its return type
JClass returnType = jMethod.getReturnType();
// better to handle void types too
methodSchemaType = createSchemaTypeForMethodPart(jMethod.getSimpleName() + RESPONSE);
sequence = new XmlSchemaSequence();
methodSchemaType.setParticle(sequence);