You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by ae...@apache.org on 2007/01/25 02:18:18 UTC
svn commit: r499635 [2/2] - in
/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools:
generator/synthesizer/ generator/util/ inspector/
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java?view=diff&rev=499635&r1=499634&r2=499635
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaMethod.java Wed Jan 24 17:18:17 2007
@@ -40,6 +40,8 @@
private QName _returnSchemaType = null;
private Class _returnType = null;
+
+ private String _javaName;
public String getActionURI() {
return _actionURI;
@@ -50,6 +52,10 @@
return _name;
}
+ public String getJavaName() {
+ return _javaName;
+ }
+
public QName[] getParameterSchemaTypes()
{
return _parameterSchemaTypes;
@@ -87,6 +93,7 @@
public void setName(QName name)
{
_name = name;
+ _javaName = ResourceInspector.getLowerCamelName(_name.getLocalPart());
}
public void setParameterSchemaTypes(QName[] parameterSchemaTypes)
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java?view=diff&rev=499635&r1=499634&r2=499635
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/JavaProperty.java Wed Jan 24 17:18:17 2007
@@ -31,6 +31,10 @@
private Class _type = null;
+ private boolean _appendable = false;
+
+ private boolean _mutable = false;
+
public Class getJavaType()
{
return _type;
@@ -49,5 +53,13 @@
public void setQName(QName property)
{
_name = property;
+ }
+
+ public boolean isAppendable() {
+ return _appendable;
+ }
+
+ public boolean isMutable() {
+ return _mutable;
}
}
Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java?view=diff&rev=499635&r1=499634&r2=499635
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java Wed Jan 24 17:18:17 2007
@@ -228,7 +228,7 @@
_JAVA_TYPES.put(WsaConstants.EPR_TYPE_QNAME, EndpointReference.class);
}
- public static String getMethodName(String operationName)
+ public static String getLowerCamelName(String operationName)
{
if (operationName == null)
throw new NullPointerException(_MESSAGES.get("NullOperationName"));
@@ -323,8 +323,9 @@
private JavaMethod createJavaMethod(Element wsdl, Operation op)
{
JavaMethod method = new JavaMethod();
-
method.setName(getInputName(op));
+
+ // set to the element name that's on the only message part
method.setReturnName(getOutputName(op));
Element inputElement = WsdlUtils.getElementDeclaration(wsdl, method.getName());
@@ -334,14 +335,18 @@
throw new RuntimeException(_MESSAGES.get("NoTypeDef", filler));
}
+ //if this is null then we've got a void method
Element outputElement = null;
if (method.getReturnName() != null)
outputElement = WsdlUtils.getElementDeclaration(wsdl, method.getReturnName());
method.setReturnSchemaType(getSchemaType(outputElement));
- method.setReturnType(getJavaType(method.getReturnSchemaType()));
+ //get the java type using the outputElement declaration because it
+ //might have minOccurs/maxOccurs data
+ method.setReturnType(getJavaType(outputElement));
+
Element[] paramXML = XmlUtils.findInSubTree(inputElement, XsdUtils.ELEMENT_QNAME);
Element schema = (Element)inputElement.getParentNode();
@@ -364,7 +369,10 @@
}
parameterSchemaTypes[n] = getSchemaType(paramXML[n]);
- parameterTypes[n] = getJavaType(parameterSchemaTypes[n]);
+
+ //get the java type using the paramXML Element declaration because it
+ //might have minOccurs/maxOccurs data
+ parameterTypes[n] = getJavaType(paramXML[n]);
}
Object actionURI = op.getInput().getExtensionAttribute(WsaConstants.ACTION_QNAME);
@@ -466,7 +474,7 @@
ProxyHandler handler = createReflectionHandler(method);
- String javaName = getMethodName(method.getName().getLocalPart());
+ String javaName = method.getJavaName();
handlers.put(javaName, handler);
}
@@ -496,16 +504,40 @@
return _javaMethodsByName;
}
- private Class getJavaType(QName schemaType)
+ private Class getJavaType(Element outputElement)
{
- if (schemaType == null)
+ if (outputElement == null)
return Void.TYPE;
+
+ String typeName = outputElement.getAttribute(XsdUtils.TYPE);
+ QName typeQName = XmlUtils.parseQName(typeName, outputElement);
- Class type = getXsdJavaType(schemaType);
+ Class type = getXsdJavaType(typeQName);
+
+ if(isArrayType(outputElement)) {
+ return ReflectUtils.getArrayClassFromClass(type);
+ }
+
return type == null ? Element.class : type;
}
- public Collection getOperations()
+ private boolean isArrayType(Element element) {
+ String minOccursAttr = element.getAttribute(XsdUtils.MIN_OCCURS);
+ int minOccurs = 1;
+ if(minOccursAttr != null && minOccursAttr.length() > 0) {
+ minOccurs = Integer.valueOf(minOccursAttr).intValue();
+ }
+
+ String maxOccursAttr = element.getAttribute(XsdUtils.MAX_OCCURS);
+ int maxOccurs = 1;
+ if(maxOccursAttr != null && maxOccursAttr.length() > 0) {
+ maxOccurs = Integer.valueOf(maxOccursAttr).intValue();
+ }
+
+ return maxOccurs > 1 || minOccurs > 1;
+ }
+
+ public Collection getOperations()
{
Collection ops = new HashSet(_handlersByName.keySet());
@@ -562,7 +594,7 @@
String[] names = new String[qnames.length];
for (int n = 0; n < qnames.length; ++n) {
- names[n] = getMethodName(qnames[n].getLocalPart());
+ names[n] = getLowerCamelName(qnames[n].getLocalPart());
}
return names;
@@ -720,14 +752,15 @@
return null;
String typeName = element.getAttribute(XsdUtils.TYPE);
-
- if (typeName == null || typeName.length() == 0)
- return XsdUtils.ANY_TYPE_QNAME;
-
- return XmlUtils.parseQName(typeName, element);
+
+ if (typeName == null || typeName.length() == 0) {
+ return XsdUtils.ANY_TYPE_QNAME;
+ } else {
+ return XmlUtils.parseQName(typeName, element);
+ }
}
-
- private ResourcePropertiesSchema getWsrpSchema(Element wsdl, QName portType)
+
+ private ResourcePropertiesSchema getWsrpSchema(Element wsdl, QName portType)
{
QName wsrpName = WsrpUtils.getPropertiesName(wsdl, portType);
Element wsrp = WsdlUtils.getElementDeclaration(wsdl, wsrpName);
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org