This is an automated email from the ASF dual-hosted git repository. billblough pushed a commit to branch 1_7 in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-core.git
commit 4dbbca4ae302cea8b57f20dc54d8bb6e16bcabe9 Author: Andreas Veithen <veit...@apache.org> AuthorDate: Tue Dec 11 21:28:46 2018 +0000 Merge r1848535, r1848643 and r1848644 to the 1.7 branch. --- .../axis2/tool/codegen/eclipse/CodeGenWizard.java | 2 - .../{core => codegen/eclipse}/JarFileWriter.java | 2 +- .../{core => codegen/eclipse}/SrcCompiler.java | 2 +- .../apache/axis2/tool/core/ClassFileHandler.java | 65 ------------- .../org/apache/axis2/tool/core/FileCopier.java | 56 ----------- .../apache/axis2/tool/core/ServiceFileCreator.java | 107 --------------------- .../java/org/apache/axis2/tool/util/Constants.java | 32 ------ .../apache/axis2/tool/core/ServiceFileCreator.java | 103 -------------------- .../axis2/tool/service/control/Controller.java | 5 - 9 files changed, 2 insertions(+), 372 deletions(-) diff --git a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java index 06e4f58..09b4076 100644 --- a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java +++ b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/CodeGenWizard.java @@ -35,8 +35,6 @@ import org.apache.axis2.tool.codegen.eclipse.ui.WSDLFileSelectionPage; import org.apache.axis2.tool.codegen.eclipse.util.SettingsConstants; import org.apache.axis2.tool.codegen.eclipse.util.UIConstants; import org.apache.axis2.tool.codegen.eclipse.util.WSDLPropertyReader; -import org.apache.axis2.tool.core.JarFileWriter; -import org.apache.axis2.tool.core.SrcCompiler; import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; import org.apache.axis2.wsdl.codegen.CodeGenerationEngine; import org.apache.commons.logging.Log; diff --git a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/JarFileWriter.java b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/JarFileWriter.java similarity index 97% rename from modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/JarFileWriter.java rename to modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/JarFileWriter.java index c8c05a0..bd532c0 100644 --- a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/JarFileWriter.java +++ b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/JarFileWriter.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.axis2.tool.core; +package org.apache.axis2.tool.codegen.eclipse; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Jar; diff --git a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/SrcCompiler.java b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/SrcCompiler.java similarity index 97% rename from modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/SrcCompiler.java rename to modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/SrcCompiler.java index 06021f1..14eacdf 100644 --- a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/SrcCompiler.java +++ b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/SrcCompiler.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.axis2.tool.core; +package org.apache.axis2.tool.codegen.eclipse; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Javac; diff --git a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/ClassFileHandler.java b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/ClassFileHandler.java deleted file mode 100644 index c07b6b1..0000000 --- a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/ClassFileHandler.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.axis2.tool.core; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Method; -import java.net.URL; -import java.net.URLClassLoader; -import java.security.AccessController; -import java.util.ArrayList; -import java.security.PrivilegedAction; - -public class ClassFileHandler { - - - -/** - * - * @param classFileName - * @param location - * @return - * @throws IOException - * @throws ClassNotFoundException - */ - public ArrayList getMethodNamesFromClass(String classFileName,String location) throws IOException, ClassNotFoundException{ - ArrayList returnList = new ArrayList(); - File fileEndpoint = new File(location); - if (!fileEndpoint.exists()){ - throw new IOException("the location is invalid"); - } - final URL[] urlList = {fileEndpoint.toURI().toURL()}; - URLClassLoader clazzLoader = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() { - public URLClassLoader run() { - return new URLClassLoader(urlList); - } - }); - Class clazz = clazzLoader.loadClass(classFileName); - Method[] methods = clazz.getDeclaredMethods(); - - for (int i = 0; i < methods.length; i++) { - returnList.add(methods[i].getName()); - - } - return returnList; - } - -} diff --git a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/FileCopier.java b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/FileCopier.java deleted file mode 100644 index d71cb91..0000000 --- a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/FileCopier.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.axis2.tool.core; - -import org.apache.tools.ant.Project; -import org.apache.tools.ant.taskdefs.Copy; -import org.apache.tools.ant.types.FileSet; - -import java.io.File; - -public class FileCopier extends Copy{ - public FileCopier() { - this.setProject(new Project()); - this.getProject().init(); - this.setTaskType("copy"); - this.setTaskName("copy-files"); - this.setOwningTarget(new org.apache.tools.ant.Target()); - } - - public void copyFiles(File sourceFile,File destinationDirectory,String filter){ - if (sourceFile.isFile()){ - this.setFile(sourceFile); - }else { - FileSet fileset = new FileSet(); - fileset.setDir(sourceFile); - if (filter!=null){ - if (filter.matches("\\.\\w*")){ - fileset.setIncludes("*/**/*"+filter); - } - } - - this.addFileset(fileset); - } - this.setTodir(destinationDirectory); - this.perform(); - } - - -} diff --git a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/ServiceFileCreator.java b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/ServiceFileCreator.java deleted file mode 100644 index 5904c31..0000000 --- a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/core/ServiceFileCreator.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.axis2.tool.core; - -import org.apache.axis2.wsdl.codegen.writer.FileWriter; -import org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; - -public class ServiceFileCreator { - - public File createServiceFile(String serviceName,String implementationClassName,ArrayList methodList) throws Exception { - - String currentUserDir = System.getProperty("user.dir"); - String fileName = "services.xml"; - - FileWriter serviceXmlWriter = new ServiceXMLWriter(currentUserDir); - writeFile(getServiceModel(serviceName,implementationClassName,methodList),serviceXmlWriter,fileName); - - return new File(currentUserDir + File.separator + fileName); - - - - - } - - 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"); - 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"); - rootElement.setAttribute("name",methods.get(i).toString()); - rootElement.appendChild(methodElement); - } - doc.appendChild(rootElement); - return doc; - } - - /** - * A resusable method for the implementation of interface and implementation writing - * @param model - * @param writer - * @throws IOException - * @throws Exception - */ - private void writeFile(Document model, FileWriter writer,String fileName) throws IOException,Exception { - - Source source = new DOMSource(model); - ByteArrayOutputStream memoryStream = new ByteArrayOutputStream(); - 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); - } - - - -} diff --git a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/util/Constants.java b/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/util/Constants.java deleted file mode 100644 index d5c45e1..0000000 --- a/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/util/Constants.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.axis2.tool.util; - -public class Constants { - public static class UIConstants{ - public static final int LABEL_WIDTH=100; - public static final int RADIO_BUTTON_WIDTH=200; - public static final int TEXT_BOX_WIDTH=250; - public static final int BROWSE_BUTTON_WIDTH=20; - public static final int GENERAL_BUTTON_WIDTH=80; - - public static final int GENERAL_COMP_HEIGHT=20; - } -} diff --git a/modules/tool/axis2-eclipse-service-plugin/src/main/java/org/apache/axis2/tool/core/ServiceFileCreator.java b/modules/tool/axis2-eclipse-service-plugin/src/main/java/org/apache/axis2/tool/core/ServiceFileCreator.java deleted file mode 100644 index fe45454..0000000 --- a/modules/tool/axis2-eclipse-service-plugin/src/main/java/org/apache/axis2/tool/core/ServiceFileCreator.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.axis2.tool.core; - -import org.apache.axis2.wsdl.codegen.writer.FileWriter; -import org.apache.axis2.wsdl.codegen.writer.ServiceXMLWriter; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; - -public class ServiceFileCreator { - - public File createServiceFile(String serviceName,String implementationClassName,ArrayList methodList) throws Exception { - - String currentUserDir = System.getProperty("user.dir"); - String fileName = "services.xml"; - - FileWriter serviceXmlWriter = new ServiceXMLWriter(currentUserDir); - writeFile(getServiceModel(serviceName,implementationClassName,methodList),serviceXmlWriter,fileName); - - return new File(currentUserDir + File.separator + fileName); - } - - 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"); - 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"); - rootElement.setAttribute("name",methods.get(i).toString()); - rootElement.appendChild(methodElement); - } - doc.appendChild(rootElement); - return doc; - } - - /** - * A resusable method for the implementation of interface and implementation writing - * @param model - * @param writer - * @throws IOException - * @throws Exception - */ - private void writeFile(Document model, FileWriter writer,String fileName) throws IOException,Exception { - - Source source = new DOMSource(model); - ByteArrayOutputStream memoryStream = new ByteArrayOutputStream(); - 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); - } - - - -} diff --git a/modules/tool/axis2-eclipse-service-plugin/src/main/java/org/apache/axis2/tool/service/control/Controller.java b/modules/tool/axis2-eclipse-service-plugin/src/main/java/org/apache/axis2/tool/service/control/Controller.java index 8568e61..1ae1853 100644 --- a/modules/tool/axis2-eclipse-service-plugin/src/main/java/org/apache/axis2/tool/service/control/Controller.java +++ b/modules/tool/axis2-eclipse-service-plugin/src/main/java/org/apache/axis2/tool/service/control/Controller.java @@ -113,11 +113,6 @@ public class Controller { writer.write(serviceFileString) ; writer.close() ; -// new ServiceFileCreator().createServiceFile( -// page2Bean.getServiceName(), -// page2Bean.getAutomaticClassName(), -// page2Bean.getSelectedMethodNames());//create the file here - isServiceCreated = true; }