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 di...@apache.org on 2005/12/04 06:16:42 UTC
svn commit: r353817 - in /webservices/axis2/trunk/java/modules/tool:
ideaplugin/plugin/org/apache/axis2/tools/bean/
ideaplugin/plugin/org/apache/ideaplugin/frames/
ideaplugin/wsdl2java/src/org/apache/axis2/tools/bean/
src/org/apache/axis2/tool/core/
Author: dims
Date: Sat Dec 3 21:16:34 2005
New Revision: 353817
URL: http://svn.apache.org/viewcvs?rev=353817&view=rev
Log:
- fix broken code (bad import, updated constants)
- s/enum/enumerator for j2se 1.5
- Remove reference to crimson (code seems incomplete, added a TODO)
NOTES:
- code directory hierarchy leaves much to be desired. we need more cleanup.
Modified:
webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/bean/CodegenBean.java
webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/ideaplugin/frames/ResourceChooser.java
webservices/axis2/trunk/java/modules/tool/ideaplugin/wsdl2java/src/org/apache/axis2/tools/bean/CodegenBean.java
webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java
webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java
Modified: webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/bean/CodegenBean.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/bean/CodegenBean.java?rev=353817&r1=353816&r2=353817&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/bean/CodegenBean.java (original)
+++ webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/bean/CodegenBean.java Sat Dec 3 21:16:34 2005
@@ -1,8 +1,8 @@
package org.apache.axis2.tools.bean;
-import org.apache.axis2.wsdl.util.URLProcessor;
import org.apache.axis2.wsdl.codegen.*;
import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
+import org.apache.axis2.util.URLProcessor;
import org.apache.wsdl.WSDLDescription;
import javax.wsdl.WSDLException;
@@ -135,7 +135,7 @@
public WSDLDescription getWOM(String wsdlLocation) throws WSDLException,
IOException {
InputStream in = new FileInputStream(new File(wsdlLocation));
- return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in).getDescription();
+ return WOMBuilderFactory.getBuilder(org.apache.axis2.wsdl.WSDLConstants.WSDL_1_1).build(in).getDescription();
}
public void execute() throws Exception {
Modified: webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/ideaplugin/frames/ResourceChooser.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/ideaplugin/frames/ResourceChooser.java?rev=353817&r1=353816&r2=353817&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/ideaplugin/frames/ResourceChooser.java (original)
+++ webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/ideaplugin/frames/ResourceChooser.java Sat Dec 3 21:16:34 2005
@@ -143,12 +143,12 @@
public void fillBean(ArchiveBean bean) {
- Enumeration enum =listModellibs.elements();
+ Enumeration enumerator =listModellibs.elements();
ArrayList libs = new ArrayList();
URL urllist [] = new URL[listModellibs.size() +1];
int count = 0;
- while (enum.hasMoreElements()) {
- String s = (String) enum.nextElement();
+ while (enumerator.hasMoreElements()) {
+ String s = (String) enumerator.nextElement();
File file = new File(s);
if(file.exists()){
try {
@@ -167,17 +167,17 @@
}
ClassLoader cls = new URLClassLoader(urllist,ResourceChooser.class.getClassLoader());
bean.setClassLoader(cls);
-// Enumeration enum =listModellibs.elements();
+// Enumeration enumerator =listModellibs.elements();
// ArrayList libs = new ArrayList();
-// while (enum.hasMoreElements()) {
-// String s = (String) enum.nextElement();
+// while (enumerator.hasMoreElements()) {
+// String s = (String) enumerator.nextElement();
// libs.add(s);
// }
bean.setLibs(libs);
- enum =listModellwsdls.elements();
+ enumerator =listModellwsdls.elements();
ArrayList wsdls = new ArrayList();
- while (enum.hasMoreElements()) {
- String s = (String) enum.nextElement();
+ while (enumerator.hasMoreElements()) {
+ String s = (String) enumerator.nextElement();
wsdls.add(s);
}
bean.setWsdls(wsdls);
Modified: webservices/axis2/trunk/java/modules/tool/ideaplugin/wsdl2java/src/org/apache/axis2/tools/bean/CodegenBean.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/ideaplugin/wsdl2java/src/org/apache/axis2/tools/bean/CodegenBean.java?rev=353817&r1=353816&r2=353817&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/ideaplugin/wsdl2java/src/org/apache/axis2/tools/bean/CodegenBean.java (original)
+++ webservices/axis2/trunk/java/modules/tool/ideaplugin/wsdl2java/src/org/apache/axis2/tools/bean/CodegenBean.java Sat Dec 3 21:16:34 2005
@@ -1,8 +1,9 @@
package org.apache.axis2.tools.bean;
-import org.apache.axis2.wsdl.util.URLProcessor;
import org.apache.axis2.wsdl.codegen.*;
import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
+import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.util.URLProcessor;
import org.apache.wsdl.WSDLDescription;
import javax.wsdl.WSDLException;
@@ -135,7 +136,7 @@
public WSDLDescription getWOM(String wsdlLocation) throws WSDLException,
IOException {
InputStream in = new FileInputStream(new File(wsdlLocation));
- return WOMBuilderFactory.getBuilder(WOMBuilderFactory.WSDL11).build(in).getDescription();
+ return WOMBuilderFactory.getBuilder(WSDLConstants.WSDL_1_1).build(in).getDescription();
}
public void execute() throws Exception {
Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java?rev=353817&r1=353816&r2=353817&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ClassFileHandler.java Sat Dec 3 21:16:34 2005
@@ -41,10 +41,10 @@
throw new IOException("the location is invalid");
URL[] urlList = {fileEndpoint.toURL()};
URLClassPath classLoader = new URLClassPath(urlList);
- Enumeration enum = classLoader.getResources("");
+ Enumeration enumerator = classLoader.getResources("");
- while (enum.hasMoreElements()) {
- Object o = enum.nextElement();
+ while (enumerator.hasMoreElements()) {
+ Object o = enumerator.nextElement();
System.out.println("o = " + o);
}
return null;
Modified: webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java?rev=353817&r1=353816&r2=353817&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java (original)
+++ webservices/axis2/trunk/java/modules/tool/src/org/apache/axis2/tool/core/ServiceFileCreator.java Sat Dec 3 21:16:34 2005
@@ -2,10 +2,19 @@
import org.apache.axis2.wsdl.codegen.writer.ClassWriter;
import org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter;
-import org.apache.crimson.tree.XmlDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
+import org.w3c.dom.Document;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.dom.DOMSource;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
@@ -43,30 +52,32 @@
}
- //todo Fix this!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- private XmlDocument getServiceModel(String serviceName,String className,ArrayList methods){
- XmlDocument doc = new XmlDocument();
+
+ private Document getServiceModel(String serviceName,String className,ArrayList methods){
+
+ DocumentBuilder builder = null;
+ try {
+ builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+ Document doc = builder.newDocument();
+
Element rootElement = doc.createElement("interface");
- addAttribute(doc,"classpackage","", rootElement);
- addAttribute(doc,"name",className,rootElement);
- addAttribute(doc,"servicename",serviceName,rootElement);
+ rootElement.setAttribute("classpackage","");
+ rootElement.setAttribute("name",className);
+ rootElement.setAttribute("servicename",serviceName);
Element methodElement = null;
int size = methods.size();
for(int i=0;i<size;i++){
methodElement = doc.createElement("method");
- addAttribute(doc,"name",methods.get(i).toString(),methodElement);
+ rootElement.setAttribute("name",methods.get(i).toString());
rootElement.appendChild(methodElement);
}
doc.appendChild(rootElement);
return doc;
}
- private void addAttribute(XmlDocument document,String AttribName, String attribValue, Element element){
- Attr attribute = document.createAttribute(AttribName);
- attribute.setValue(attribValue);
- element.setAttributeNode(attribute);
- }
-
/**
* A resusable method for the implementation of interface and implementation writing
* @param model
@@ -74,13 +85,19 @@
* @throws IOException
* @throws Exception
*/
- private void writeClass(XmlDocument model, ClassWriter writer,String fileName) throws IOException,Exception {
+ private void writeClass(Document model, ClassWriter writer,String fileName) throws IOException,Exception {
+
+ Source source = new DOMSource(model);
ByteArrayOutputStream memoryStream = new ByteArrayOutputStream();
- model.write(memoryStream);
+ Result result = new StreamResult(memoryStream);
+ Transformer xformer = TransformerFactory.newInstance().newTransformer();
+ xformer.transform(source, result);
+
+ //TODO: Doesn't really output stuff from the memorystream to file...hmm.
+
writer.loadTemplate();
writer.createOutFile(null,
fileName);
-// writer.writeOutFile(new ByteArrayInputStream(memoryStream.toByteArray()));
}