You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ha...@apache.org on 2005/12/07 17:47:49 UTC
svn commit: r354797 - in
/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws:
WSDL2Ws.java cpp/literal/AllParamWriter.java
cpp/literal/ClientStubHeaderWriter.java info/Type.java
Author: hawkeye
Date: Wed Dec 7 08:47:44 2005
New Revision: 354797
URL: http://svn.apache.org/viewcvs?rev=354797&view=rev
Log:
New variable on type - "isGenerated". This property says whether the type will be created in a seperate file. This is used when we are looking to include files. If the flag is false then the file is not included. Inquire_v2 is a test that tests this problem.
Modified:
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java?rev=354797&r1=354796&r2=354797&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java Wed Dec 7 08:47:44 2005
@@ -790,18 +790,23 @@
throw new WrapperFault("Array type found without a Ref type");
if (CUtils.isBasicType(qn))
return null;
+
QName newqn =
new QName(
type.getQName().getNamespaceURI(),
qn.getLocalPart() + "_Array");
typedata =
new Type(newqn, newqn.getLocalPart(), true, targetLanguage);
+
if (type.getRefType().getRefType() != null)
typedata.setElementType(
type.getRefType().getRefType().getQName().getLocalPart());
else
typedata.setElementType(
type.getRefType().getQName().getLocalPart());
+
+
+
typeMap.addType(newqn, typedata);
}
else
@@ -814,6 +819,9 @@
targetLanguage);
typeMap.addType(type.getQName(), typedata);
}
+
+ // work out whether this type will be generated or not
+ typedata.setGenerated(isTypeGenerated(type));
Node node = type.getNode();
@@ -1294,6 +1302,33 @@
}
}
+ return true;
+ }
+
+ /**
+ * Work out the various conditions that dictate whether this type will be generated into a new
+ * file or not.
+ * This method is only very partically implemented and will usually default to true. This is becuase we have
+ * this kind of logic already dispersed around the code (it usually just looks for a ">" in the name).
+ * But it's much better to encapsulate here.
+ *
+ * @param type
+ * @return true if the type will not be generated. False otherwise
+ *
+ */
+ private boolean isTypeGenerated(TypeEntry type)
+ {
+ // If the referenced type is actually a type that will not get generated because it's
+ // a base type array then tell other people of this case. Do this to two levels of indirection
+
+ if(type.getRefType()!=null)
+ {
+ if(type.getRefType().getRefType()!=null && type.getRefType().getRefType().isBaseType())
+ {
+ return false;
+ }
+ }
+
return true;
}
}
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java?rev=354797&r1=354796&r2=354797&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/AllParamWriter.java Wed Dec 7 08:47:44 2005
@@ -102,52 +102,6 @@
writer.writeSource();
(new ArrayParamWriter(wscontext, type)).writeSource();
}
- else
- {
- // FJP If the object is a simple type array, then there is no need to create a
- // header file for it. Unfortunately, a header file has already be
- // declared in the base class so when the project is built, the compiler
- // will complain because the <name>.h file will not be found. There are
- // at least three solutions this problem:-
- // 1. Rewrite the application to only create the class once all of the
- // associated objects have been resolved.
- // 2. Go back and modify the class to remove the #include lines that
- // contain the unnecessary types.
- // 3. Add empty files with the same filenames as the expected includes so
- // that the compiler will not complain.
- if (qname.getLocalPart().indexOf(">") == -1)
- {
- System.out.println(
- "Creating an empty "
- + qname.getLocalPart()
- + CUtils.CPP_HEADER_SUFFIX
- + " file\n");
-
- BufferedWriter bw = null;
-
- try
- {
- bw =
- new BufferedWriter(
- new FileWriter(
- getFilePath(
- qname.getLocalPart()),
- false));
- bw.write(
- "// Header file for "
- + qname.getLocalPart()
- + CUtils.CPP_HEADER_SUFFIX
- + "\n");
- bw.flush();
- bw.close();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- throw new WrapperFault(e);
- }
- }
- }
}
else
{
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java?rev=354797&r1=354796&r2=354797&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java Wed Dec 7 08:47:44 2005
@@ -205,26 +205,29 @@
while (types.hasNext())
{
atype = (Type) types.next();
- if (atype.isArray())
+ if(atype.isGenerated())
{
- if (atype.getElementType().equals("string"))
+ if (atype.isArray())
{
- removeSet.add(atype.getLanguageSpecificName());
+ if (atype.getElementType().equals("string"))
+ {
+ removeSet.add(atype.getLanguageSpecificName());
+ }
}
- }
- if (atype.getBaseType() != null)
- {
- if (atype.getBaseType().getLocalPart().equals("string"))
+ if (atype.getBaseType() != null)
{
- removeSet.add(
- atype.getLanguageSpecificName() + "_Array");
+ if (atype.getBaseType().getLocalPart().equals("string"))
+ {
+ removeSet.add(
+ atype.getLanguageSpecificName() + "_Array");
+ }
}
+ if (atype.getLanguageSpecificName().startsWith(">"))
+ {
+ continue;
+ }
+ typeSet.add(atype.getLanguageSpecificName());
}
- if (atype.getLanguageSpecificName().startsWith(">"))
- {
- continue;
- }
- typeSet.add(atype.getLanguageSpecificName());
}
Iterator ritr = removeSet.iterator();
while (ritr.hasNext())
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java?rev=354797&r1=354796&r2=354797&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java Wed Dec 7 08:47:44 2005
@@ -60,7 +60,7 @@
* Subsequent elements are values(QNames) if any.
*/
private Vector enumerationdata;
-
+
/* This can be null */
private String languageSpecificName;
/* element names and the type of the elements (QName,ElementInfo)*/
@@ -94,6 +94,12 @@
/* Is this type an attachment under the http://xml.apache.org/xml-soap namespace? */
private boolean isAttachment = false;
+ /* Should this type be generated or not */
+ /* this value is currently only used in limited places. usually we use the ">" symbol */
+ private boolean generated;
+
+
+
public Type(
QName name,
String languageSpecificName,
@@ -185,6 +191,9 @@
{
isAttachment = true;
}
+
+ // generated is always true by default so as not to break any other logic prior to this value being put in
+ generated=true;
}
/**
@@ -600,5 +609,22 @@
public boolean isAttachment()
{
return isAttachment;
+ }
+
+ /**
+ * @param b
+ */
+ public void setGenerated(boolean b)
+ {
+ generated=b;
+ }
+
+ /**
+ * Whether this type will be generated or not. NOT This is not always valid. Be sure that this is being set properly for your instance
+ * @return
+ */
+ public boolean isGenerated()
+ {
+ return generated;
}
}