You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2005/02/21 09:39:21 UTC
svn commit: r154654 - in webservices/axis/trunk/java/modules/tool: ./ src/
src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/axis/
src/java/org/apache/axis/tool/ src/java/org/apache/axis/tool/bean/
src/java/org/apache/axis/tool/control/ src/java/org/apache/axis/tool/core/
src/java/org/apache/axis/tool/ui/ src/java/org/apache/axis/tool/util/
src/script/ src/test/
Author: ajith
Date: Mon Feb 21 00:39:15 2005
New Revision: 154654
URL: http://svn.apache.org/viewcvs?view=rev&rev=154654
Log:
adding the service jar file builder tool. All the sources are present but needs several more scripts to run the tool
Added:
webservices/axis/trunk/java/modules/tool/
webservices/axis/trunk/java/modules/tool/project.properties
webservices/axis/trunk/java/modules/tool/project.xml
webservices/axis/trunk/java/modules/tool/src/
webservices/axis/trunk/java/modules/tool/src/java/
webservices/axis/trunk/java/modules/tool/src/java/org/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page1Bean.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page2Bean.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page3Bean.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/WizardBean.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/Controller.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/ProcessException.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ClassFileHandler.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/FileCopier.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/JarFileWriter.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ServiceFileCreator.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/MainWindow.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane1.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane2.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane3.java
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/util/
webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/util/Constants.java
webservices/axis/trunk/java/modules/tool/src/script/
webservices/axis/trunk/java/modules/tool/src/test/
Added: webservices/axis/trunk/java/modules/tool/project.properties
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/project.properties?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/project.properties (added)
+++ webservices/axis/trunk/java/modules/tool/project.properties Mon Feb 21 00:39:15 2005
@@ -0,0 +1,18 @@
+# -------------------------------------------------------------------
+# Copyright 2001-2004 The Apache Software Foundation.
+#
+# Licensed 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.
+# -------------------------------------------------------------------
+
+maven.repo.remote=http://cvs.apache.org/repository/, http://www.ibiblio.org/maven,http://www.apache.org/dist/java-repository/
+maven.multiproject.type=jar
Added: webservices/axis/trunk/java/modules/tool/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/project.xml?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/project.xml (added)
+++ webservices/axis/trunk/java/modules/tool/project.xml Mon Feb 21 00:39:15 2005
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../../etc/project.xml</extend>
+ <id>axis2-tools</id>
+ <name>tool</name>
+ <dependencies>
+ <!-- external JARs -->
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.2</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ <!--url>http://dist.codehaus.org/stax/jars/</url-->
+ </dependency>
+ </dependencies>
+</project>
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page1Bean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page1Bean.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page1Bean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page1Bean.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,28 @@
+package org.apache.axis.tool.bean;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class Page1Bean {
+ private String fileLocation;
+
+ public String getFileLocation() {
+ return fileLocation;
+ }
+
+ public void setFileLocation(String fileLocation) {
+ this.fileLocation = fileLocation;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page2Bean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page2Bean.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page2Bean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page2Bean.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,90 @@
+package org.apache.axis.tool.bean;
+
+import java.util.ArrayList;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class Page2Bean {
+ private boolean manual;
+ private boolean automatic;
+
+ private String manualFileName;
+ private String automaticClassName;
+ private String providerClassName;
+
+ private ArrayList selectedMethodNames;
+
+ public String getProviderClassName() {
+ return providerClassName;
+ }
+
+ public void setProviderClassName(String providerClassName) {
+ this.providerClassName = providerClassName;
+ }
+
+ public Page2Bean() {
+ selectedMethodNames = new ArrayList();
+ }
+
+ public boolean isManual() {
+ return manual;
+ }
+
+ public void setManual(boolean manual) {
+ this.manual = manual;
+ }
+
+ public boolean isAutomatic() {
+ return automatic;
+ }
+
+ public void setAutomatic(boolean automatic) {
+ this.automatic = automatic;
+ }
+
+ public String getManualFileName() {
+ return manualFileName;
+ }
+
+ public void setManualFileName(String manualFileName) {
+ this.manualFileName = manualFileName;
+ }
+
+ public String getAutomaticClassName() {
+ return automaticClassName;
+ }
+
+ public void setAutomaticClassName(String automaticClassName) {
+ this.automaticClassName = automaticClassName;
+ }
+ public int getMethodNameCount(){
+ return selectedMethodNames.size();
+ }
+ public void setSelectedMethodNames(ArrayList list){
+ this.selectedMethodNames = list;
+ }
+ public String getMethodName(int index) {
+ return selectedMethodNames.get(index).toString();
+ }
+
+ public void addMethodName(String selectedMethodName) {
+ this.selectedMethodNames.add(selectedMethodNames);
+ }
+
+ public ArrayList getSelectedMethodNames() {
+ return selectedMethodNames;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page3Bean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page3Bean.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page3Bean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/Page3Bean.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,38 @@
+package org.apache.axis.tool.bean;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class Page3Bean {
+ private String outputFolderName;
+ private String outputFileName;
+
+ public String getOutputFolderName() {
+ return outputFolderName;
+ }
+
+ public void setOutputFolderName(String outputFolderName) {
+ this.outputFolderName = outputFolderName;
+ }
+
+ public String getOutputFileName() {
+ return outputFileName;
+ }
+
+ public void setOutputFileName(String outputFileName) {
+ this.outputFileName = outputFileName;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/WizardBean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/WizardBean.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/WizardBean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/bean/WizardBean.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,47 @@
+package org.apache.axis.tool.bean;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class WizardBean {
+ private Page1Bean page1bean;
+ private Page2Bean page2bean;
+ private Page3Bean page3bean;
+
+ public Page1Bean getPage1bean() {
+ return page1bean;
+ }
+
+ public void setPage1bean(Page1Bean page1bean) {
+ this.page1bean = page1bean;
+ }
+
+ public Page2Bean getPage2bean() {
+ return page2bean;
+ }
+
+ public void setPage2bean(Page2Bean page2bean) {
+ this.page2bean = page2bean;
+ }
+
+ public Page3Bean getPage3bean() {
+ return page3bean;
+ }
+
+ public void setPage3bean(Page3Bean page3bean) {
+ this.page3bean = page3bean;
+ }
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/Controller.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/Controller.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/Controller.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/Controller.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,117 @@
+package org.apache.axis.tool.control;
+
+import org.apache.axis.tool.bean.Page1Bean;
+import org.apache.axis.tool.bean.Page2Bean;
+import org.apache.axis.tool.bean.Page3Bean;
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.core.ClassFileHandler;
+import org.apache.axis.tool.core.FileCopier;
+import org.apache.axis.tool.core.JarFileWriter;
+import org.apache.axis.tool.core.ServiceFileCreator;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class Controller {
+
+ public ArrayList getMethodList(WizardBean bean) throws ProcessException{
+ ArrayList returnList = null;
+ try {
+ returnList = new ClassFileHandler().getMethodNamesFromClass(bean.getPage2bean().getAutomaticClassName(),
+ bean.getPage1bean().getFileLocation());
+ } catch (IOException e) {
+ throw new ProcessException("IO Error, The class file location may be faulty!",e);
+ } catch (ClassNotFoundException e) {
+ throw new ProcessException(" The specified class does not exist!!!");
+ } catch (Exception e){
+ throw new ProcessException("Unknown Error! See whether all parameters are available");
+ }
+ return returnList;
+ }
+
+
+ public void process(WizardBean bean) throws ProcessException,Exception{
+
+ Page1Bean page1Bean = bean.getPage1bean();
+ Page2Bean page2Bean = bean.getPage2bean();
+ Page3Bean page3Bean = bean.getPage3bean();
+
+ File serviceFile = null;
+ File classFileFolder = null;
+ File outputFolder =null;
+ String outputFileName = null;
+ boolean isServiceCreated = false;
+
+ //see if the class file location is valid
+ classFileFolder = new File(page1Bean.getFileLocation());
+ if (!classFileFolder.exists()){
+ throw new ProcessException("Specified Class file location is empty!!");
+ }
+ if (!classFileFolder.isDirectory()){
+ throw new ProcessException("The class file location must be a folder!");
+ }
+
+ //see if the service.xml file is valid
+ if (page2Bean.isManual()){
+ serviceFile = new File(page2Bean.getManualFileName());
+ if (!serviceFile.exists()){
+ throw new ProcessException("Specified Service XML file is missing!");
+ }
+ }else{
+ ArrayList methodList = page2Bean.getSelectedMethodNames();
+ if (methodList.isEmpty()){
+ throw new ProcessException("There are no methods selected to generate the service!!");
+ }
+ serviceFile=new ServiceFileCreator().createServiceFile(page2Bean.getProviderClassName(),
+ page2Bean.getAutomaticClassName(),
+ page2Bean.getSelectedMethodNames());//create the file here
+ isServiceCreated = true;
+ }
+
+ outputFolder = new File(page3Bean.getOutputFolderName());
+ outputFileName = page3Bean.getOutputFileName();
+ if (!outputFileName.toLowerCase().endsWith(".jar")){
+ outputFileName = outputFileName + ".jar";
+ }
+
+ File tempFileFolder =null;
+
+ try {
+ //create a temporary directory and copy the files
+ tempFileFolder = new File("Service-copy");
+ tempFileFolder.mkdir();
+ File metaInfFolder = new File(tempFileFolder,"META-INF");
+ metaInfFolder.mkdir();
+
+ new FileCopier().copyFiles(classFileFolder,tempFileFolder);
+ new FileCopier().copyFiles(serviceFile,metaInfFolder);
+
+ //jar the temp directory. the output folder will be created if missing
+ new JarFileWriter().writeJarFile(outputFolder,outputFileName,tempFileFolder);
+ } catch (Exception e) {
+ throw new ProcessException(e);
+ } finally {
+ tempFileFolder.delete();
+ if (isServiceCreated)
+ serviceFile.delete();
+
+
+ }
+
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/ProcessException.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/ProcessException.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/ProcessException.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/control/ProcessException.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,33 @@
+package org.apache.axis.tool.control;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class ProcessException extends Exception{
+ public ProcessException() {
+ }
+
+ public ProcessException(String message) {
+ super(message);
+ }
+
+ public ProcessException(Throwable cause) {
+ super(cause);
+ }
+
+ public ProcessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ClassFileHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ClassFileHandler.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ClassFileHandler.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ClassFileHandler.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,71 @@
+package org.apache.axis.tool.core;
+
+import sun.misc.URLClassPath;
+
+import java.io.File;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class ClassFileHandler {
+
+
+ /**
+ * @deprecated
+ * This needs to be written in a functional manner
+ * @param location
+ * @return
+ * @throws IOException
+ */
+ //todo see whether this is possible
+ public ArrayList getClassesAtLocation(String location) throws IOException {
+ File fileEndpoint = new File(location);
+ if (!fileEndpoint.exists())
+ throw new IOException("the location is invalid");
+ URL[] urlList = {fileEndpoint.toURL()};
+ URLClassPath classLoader = new URLClassPath(urlList);
+ Enumeration enum = classLoader.getResources("");
+
+ while (enum.hasMoreElements()) {
+ Object o = enum.nextElement();
+ System.out.println("o = " + o);
+ }
+ return null;
+
+ }
+
+ 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");
+ URL[] urlList = {fileEndpoint.toURL()};
+ URLClassLoader clazzLoader = 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;
+ }
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/FileCopier.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/FileCopier.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/FileCopier.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/FileCopier.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,52 @@
+package org.apache.axis.tool.core;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.taskdefs.Copy;
+import org.apache.tools.ant.types.FileSet;
+
+import java.io.File;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class FileCopier extends Copy{
+ public FileCopier() {
+ this.setProject(new Project());
+ this.getProject().init();
+ this.setTaskType("copy");
+ this.setTaskName("copy-files");
+ this.setOwningTarget(new Target());
+ }
+
+ public void copyFiles(File sourceFile,File destinationDirectory){
+
+ this.filesets.clear();
+
+ if (sourceFile.isFile())
+ this.setFile(sourceFile);
+ else {
+ FileSet fileset = new FileSet();
+ fileset.setDir(sourceFile);
+ fileset.setIncludes("*/**");
+ this.addFileset(fileset);
+ }
+ this.setTodir(destinationDirectory);
+ this.perform();
+ }
+
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/JarFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/JarFileWriter.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/JarFileWriter.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/JarFileWriter.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,56 @@
+package org.apache.axis.tool.core;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Target;
+import org.apache.tools.ant.taskdefs.Jar;
+
+import java.io.File;
+import java.io.IOException;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class JarFileWriter extends Jar{
+
+
+ public JarFileWriter() {
+ this.setProject(new Project());
+ this.getProject().init();
+ this.setTaskType("jar");
+ this.setTaskName("jar");
+ this.setOwningTarget(new Target());
+ }
+
+ public void writeJarFile(File outputFolder,String outputFileName,File inputFileFolder) throws IOException,Exception {
+
+ if (!outputFolder.exists()){
+ outputFolder.mkdir(); //create the output path
+ }else{
+ if (!outputFolder.isDirectory())
+ return;
+ }
+
+ File targetFile = new File(outputFolder,outputFileName);
+ this.setBasedir(inputFileFolder);
+ this.setDestFile(targetFile);
+
+ //run the task
+ this.perform();
+
+
+ }
+
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ServiceFileCreator.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ServiceFileCreator.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ServiceFileCreator.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/core/ServiceFileCreator.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,63 @@
+package org.apache.axis.tool.core;
+
+import org.apache.axis.tool.control.ProcessException;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.util.ArrayList;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class ServiceFileCreator {
+ public File createServiceFile(String providerClassName,String serviceClass,ArrayList methodList) throws ProcessException {
+
+ try {
+ String content = this.getFileString(providerClassName,serviceClass,methodList);
+ File serviceFile = new File("service.xml");
+
+ FileWriter fileWriter = new FileWriter(serviceFile);
+ fileWriter.write(content);
+ fileWriter.flush();
+
+ return serviceFile;
+
+ } catch (Exception e) {
+ throw new ProcessException(e);
+ }
+
+
+ }
+
+ private String getFileString(String providerClassName,String serviceClass,ArrayList methodList){
+ String str = "<service provider=\"" +
+ providerClassName + "\" >" +
+ " <java:implementation class=\"" +
+ serviceClass + "\" " +
+ "xmlns:java=\"http://ws.apache.org/axis2/deployment/java\"/>\n" ;
+ for (int i = 0; i < methodList.size(); i++) {
+ str = str + " <operation name=\"" +
+ methodList.get(i).toString() +
+ "\" qname=\"" +
+ methodList.get(i).toString() +
+ "\" >\n";
+
+ }
+ str = str + "</service>";
+ return str;
+ }
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/MainWindow.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/MainWindow.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/MainWindow.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/MainWindow.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,197 @@
+package org.apache.axis.tool.ui;
+
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.control.Controller;
+import org.apache.axis.tool.control.ProcessException;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class MainWindow extends JFrame {
+
+ private JPanel wizardPaneContainer;
+ private JButton nextButton;
+ private JButton previousButton;
+ private JButton cancelButton;
+ private JButton finishButton;
+ private int currentPage;
+ private WizardPane currentWizardPane;
+
+ private static final int PAGE_1=1;
+ private static final int PAGE_2=2;
+ private static final int PAGE_3=3;
+ //private static final int PAGE_4=4;
+
+
+ private WizardBean wizardBean = new WizardBean();
+
+ public MainWindow() throws HeadlessException {
+ super("Axis 2 - Service Jar Builder");
+ init();
+
+ }
+
+ private void init(){
+ this.getContentPane().setLayout(null);
+
+ this.setBounds((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth()/2 - 400/2,
+ (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight()/2 - 360/2,
+ 400,360);
+ this.setResizable(false);
+ this.setDefaultCloseOperation(EXIT_ON_CLOSE);
+
+ int hgap = 5;
+ int vgap = 5;
+ int bWidth = 80;
+ int bHeight = 20;
+
+ this.wizardPaneContainer = new JPanel(null);
+ this.getContentPane().add(this.wizardPaneContainer);
+ this.wizardPaneContainer.setBounds(0,0,400,300);
+
+ this.previousButton = new JButton("Previous");
+ this.getContentPane().add(this.previousButton);
+ this.previousButton.setBounds(hgap,300+vgap,bWidth,bHeight);
+ this.previousButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ moveBackWard();
+ }
+
+ });
+//
+ this.nextButton= new JButton("Next");
+ this.getContentPane().add(this.nextButton);
+ this.nextButton.setBounds(hgap +bWidth + hgap,300 + vgap,bWidth,bHeight);
+ this.nextButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ moveForward();
+ }
+ });
+
+ this.cancelButton= new JButton("Close");
+ this.getContentPane().add(this.cancelButton) ;
+ this.cancelButton.setBounds(hgap + (bWidth + hgap)*2,300 + vgap,bWidth,bHeight);
+ this.cancelButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ if (confirmExit())
+ System.exit(0);
+ }
+ });
+
+ this.finishButton= new JButton("Finish");
+ this.getContentPane().add(this.finishButton) ;
+ this.finishButton.setBounds(hgap + (bWidth + hgap)*3,300 + vgap,bWidth,bHeight);
+ this.finishButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ processFinish();
+ }
+ });
+
+
+
+ this.currentPage = PAGE_1;
+ moveToPage(currentPage); //add the first page as default
+ }
+
+ private void showErrorMessage(){
+ JOptionPane.showMessageDialog(this,"Required Value Not set!!!","Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+ private void showErrorMessage(String message){
+ JOptionPane.showMessageDialog(this,message,"Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+ private void showSuccessMessage(String message){
+ JOptionPane.showMessageDialog(this,message,"Error",JOptionPane.INFORMATION_MESSAGE);
+ }
+
+ private boolean confirmExit(){
+ int returnType = JOptionPane.showOptionDialog(this,
+ "Are you sure you want to exit?",
+ "Exit service builder",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE,
+ null,null,null);
+ return (returnType==JOptionPane.YES_OPTION);
+ }
+
+ private void moveForward(){
+ if (currentWizardPane.validateValues()){
+ this.currentPage ++;
+ moveToPage(this.currentPage);
+ }else{
+ showErrorMessage();
+ }
+ }
+
+ private void moveBackWard(){
+ this.currentPage --;
+ moveToPage(this.currentPage);
+
+ }
+
+ private void moveToPage(int page){
+ switch(page){
+ case PAGE_1:
+ processPage(new WizardPane1(this.wizardBean, this),false,true,false);
+ break;
+ case PAGE_2:
+ processPage(new WizardPane2(this.wizardBean, this),true,true,false);
+ break;
+ case PAGE_3:
+ processPage(new WizardPane3(this.wizardBean, this),true,false,true);
+ break;
+ default:
+ return;
+ }
+ }
+ private void processFinish(){
+ if (currentWizardPane.validateValues()){
+ try {
+ new Controller().process(wizardBean);
+ showSuccessMessage(" jar file creation successful! ");
+ } catch (ProcessException e) {
+ showErrorMessage(e.getMessage());
+ } catch (Exception e) {
+ showErrorMessage("Unknown Error! " +e.getMessage() );
+ }
+ }else{
+ showErrorMessage();
+ }
+ }
+
+ private void processPage(WizardPane pane,boolean prevButtonState,boolean nextButtonState,boolean finishButtonState){
+ this.wizardPaneContainer.removeAll();
+ currentWizardPane = pane;
+ this.wizardPaneContainer.add(pane);
+ this.previousButton.setEnabled(prevButtonState);
+ this.nextButton.setEnabled(nextButtonState);
+ this.finishButton.setEnabled(finishButtonState);
+ this.repaint();
+ }
+
+
+ public static void main(String[] args) {
+ new MainWindow().show();
+ }
+
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,103 @@
+package org.apache.axis.tool.ui;
+
+import javax.swing.*;
+import javax.swing.filechooser.FileFilter;
+import java.awt.*;
+import java.io.File;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public abstract class WizardPane extends JPanel {
+ protected JTextArea descriptionLabel;
+ protected JFrame ownerFrame;
+
+ protected int descWidth=400;
+ protected int descHeight=100;
+ protected int width=400;
+ protected int height=300;
+ protected int hgap=5;
+ protected int vgap=5;
+
+ protected WizardPane() {
+ }
+
+ protected WizardPane(JFrame ownerFrame) {
+ this.ownerFrame = ownerFrame;
+ }
+
+ protected WizardPane(boolean isDoubleBuffered) {
+ super(isDoubleBuffered);
+ }
+
+ protected WizardPane(LayoutManager layout) {
+ super(layout);
+ }
+
+ protected WizardPane(LayoutManager layout, boolean isDoubleBuffered) {
+ super(layout, isDoubleBuffered);
+ }
+
+ protected void initDescription(String desc){
+ this.descriptionLabel = new JTextArea(desc);
+ this.descriptionLabel.setOpaque(false);
+ this.descriptionLabel.setEditable(false);
+ this.descriptionLabel.setAutoscrolls(true);
+ this.descriptionLabel.setBounds(0,0,descWidth,descHeight);
+ this.add(this.descriptionLabel);
+ }
+
+ public abstract boolean validateValues();
+
+ protected void showErrorMessage(String message){
+ JOptionPane.showMessageDialog(this,message,"Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+
+ protected String browseForAFile(final String extension){
+ String str="";
+ JFileChooser fc=new JFileChooser();
+ fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+ fc.addChoosableFileFilter(new FileFilter(){
+ public boolean accept(File f) {
+ if (f.getName().endsWith(extension) || f.isDirectory())
+ return true;
+ else
+ return false;
+ }
+
+ public String getDescription() {
+ return extension + " file filter ";
+ }
+ });
+
+ int returnVal = fc.showOpenDialog(this);
+ if(returnVal == JFileChooser.APPROVE_OPTION) {
+ str=fc.getSelectedFile().getAbsolutePath().trim();
+ }
+ return str;
+ }
+
+ protected String browseForAFolder(){
+ String str="";
+ JFileChooser fc=new JFileChooser();
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int returnVal = fc.showOpenDialog(this);
+ if(returnVal == JFileChooser.APPROVE_OPTION) {
+ str=fc.getSelectedFile().getAbsolutePath().trim();
+ }
+ return str;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane1.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane1.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane1.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane1.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,105 @@
+package org.apache.axis.tool.ui;
+
+import org.apache.axis.tool.bean.Page1Bean;
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.util.Constants;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class WizardPane1 extends WizardPane{
+
+ private Page1Bean myBean = null;
+
+ private JLabel classFileLocationLabel;
+ private JTextField classFileLocationTextBox;
+ private JButton browseButton;
+
+ public WizardPane1(WizardBean wizardBean, JFrame ownerFrame) {
+
+ super(ownerFrame);
+
+ init();
+
+ if (wizardBean.getPage1bean()!= null){
+ myBean = wizardBean.getPage1bean();
+ this.classFileLocationTextBox.setText(myBean.getFileLocation());
+ }else{
+ myBean = new Page1Bean();
+ wizardBean.setPage1bean(myBean);
+ }
+
+
+ }
+
+ public boolean validateValues() {
+ String text = myBean.getFileLocation();
+ return (text!=null && text.trim().length()>0);
+ }
+
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,height);
+
+ initDescription("Welcome to the new AXIS Service packager Wizard Interface.\n\n " +
+ "Insert the location for the class files here.This should be a folder with \n" +
+ " the compiled classes");
+
+
+ this.classFileLocationLabel = new JLabel("class file location");
+ this.add(this.classFileLocationLabel);
+ this.classFileLocationLabel.setBounds(hgap,descHeight,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.classFileLocationTextBox = new JTextField();
+ this.add(this.classFileLocationTextBox);
+ this.classFileLocationTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,descHeight,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.classFileLocationTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ handleTextBoxChange();
+ }
+ });
+ this.classFileLocationTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) { }
+ public void keyPressed(KeyEvent e) { }
+ public void keyReleased(KeyEvent e) { handleTextBoxChange();}
+ });
+
+ this.browseButton = new JButton(".");
+ this.add(this.browseButton);
+ this.browseButton.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap +Constants.UIConstants.TEXT_BOX_WIDTH,descHeight,Constants.UIConstants.BROWSE_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.browseButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ classFileLocationTextBox.setText(browseForAFolder());
+ handleTextBoxChange();
+ }
+ });
+ }
+
+
+ private void handleTextBoxChange() {
+ String text = classFileLocationTextBox.getText();
+ if (text!=null){
+ this.myBean.setFileLocation(text);
+ }
+ }
+
+
+}
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane2.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane2.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane2.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane2.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,446 @@
+package org.apache.axis.tool.ui;
+
+import org.apache.axis.tool.bean.Page2Bean;
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.control.Controller;
+import org.apache.axis.tool.control.ProcessException;
+import org.apache.axis.tool.util.Constants;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.util.ArrayList;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class WizardPane2 extends WizardPane {
+
+ private WizardBean parentBean;
+ private Page2Bean myBean;
+
+ private JRadioButton selectManualFileRadioButton;
+ private JRadioButton createAutomaticFileRadioButton;
+ private JPanel selectionPanel;
+
+
+ public WizardPane2(WizardBean wizardBean, JFrame ownerFrame) {
+ super(ownerFrame);
+
+ init();
+
+ parentBean = wizardBean;
+
+ if (wizardBean.getPage2bean()!=null){
+ myBean = wizardBean.getPage2bean();
+ //set the initial settings from the bean
+ setBeanValues();
+
+ }else{
+ myBean = new Page2Bean();
+ wizardBean.setPage2bean(myBean);
+ setDefaultValues();
+ }
+
+ }
+
+ public void setBeanValues(){
+ if (myBean.isManual()){
+ this.selectManualFileRadioButton.setSelected(true);
+ loadScreen(new ManualSelectionPanel(true));
+ }else{
+ this.createAutomaticFileRadioButton.setSelected(true);
+ loadScreen(new AutomaticSelectionPanel(true));
+ }
+ }
+
+
+ public boolean validateValues() {
+ String text = "";
+ String text2="";
+ boolean returnValue = false;
+ if (myBean.isManual()){
+ text = myBean.getManualFileName();
+ returnValue = (text!=null && text.trim().length()>0);
+ }else{
+ text = myBean.getAutomaticClassName();
+ text2 = myBean.getProviderClassName();
+ returnValue = (text!=null && text.trim().length()>0) &&
+ (text2!=null && text2.trim().length()>0) ;
+ }
+
+ return returnValue;
+ }
+
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,height);
+
+ initDescription("\n Select either the service xml file or the class that you want to \n " +
+ " expose as the service to auto generate a service.xml. \n " +
+ " Only the class files that are in the previously selected location can\n" +
+ " be laded from here");
+
+ ButtonGroup group = new ButtonGroup();
+
+ this.selectManualFileRadioButton = new JRadioButton("Select a file manually");
+ this.selectManualFileRadioButton.setBounds(hgap,descHeight,Constants.UIConstants.RADIO_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.add(this.selectManualFileRadioButton);
+ group.add(selectManualFileRadioButton);
+ this.selectManualFileRadioButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ changeSelectionScreen();
+ }
+ });
+ this.createAutomaticFileRadioButton = new JRadioButton("Create a file automatically");
+ this.createAutomaticFileRadioButton.setBounds(hgap,descHeight+vgap +Constants.UIConstants.GENERAL_COMP_HEIGHT ,Constants.UIConstants.RADIO_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.add(this.createAutomaticFileRadioButton);
+ group.add(createAutomaticFileRadioButton);
+ this.createAutomaticFileRadioButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ changeSelectionScreen();
+ }
+ });
+
+ this.selectionPanel = new JPanel();
+ this.selectionPanel.setLayout(null);
+ this.selectionPanel.setBounds(0,descHeight + 2*Constants.UIConstants.GENERAL_COMP_HEIGHT +2*vgap,width,100);
+ this.add(this.selectionPanel);
+
+ //select manual option by default
+
+
+
+ }
+ private void setDefaultValues(){
+ this.selectManualFileRadioButton.setSelected(true);
+ loadScreen(new ManualSelectionPanel());
+ updateBeanFlags(true);
+ }
+ private void changeSelectionScreen(){
+ if (selectManualFileRadioButton.isSelected()){
+ loadScreen(new ManualSelectionPanel(true));
+ updateBeanFlags(true);
+ } else{
+ loadScreen(new AutomaticSelectionPanel(true));
+ updateBeanFlags(false);
+ }
+ }
+ private void updateBeanFlags(boolean flag){
+ myBean.setManual(flag);myBean.setAutomatic(!flag);
+ }
+
+ private void loadScreen(JPanel panel){
+ this.selectionPanel.removeAll();
+ this.selectionPanel.add(panel);
+ this.repaint();
+ }
+
+
+
+ private class ManualSelectionPanel extends JPanel{
+
+ private JLabel serverXMLFileLocationLabel;
+ private JTextField serverXMLFileLocationTextBox;
+ private JButton browseButton;
+
+ public ManualSelectionPanel() {
+ init();
+ }
+
+ public ManualSelectionPanel(boolean loadVals) {
+ init();
+ if (loadVals){
+ this.serverXMLFileLocationTextBox.setText(myBean.getManualFileName());
+ }
+ }
+
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,100);
+
+ this.serverXMLFileLocationLabel = new JLabel("Service File");
+ this.add(this.serverXMLFileLocationLabel);
+ this.serverXMLFileLocationLabel.setBounds(hgap,vgap,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.serverXMLFileLocationTextBox = new JTextField();
+ this.add(this.serverXMLFileLocationTextBox);
+ this.serverXMLFileLocationTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,vgap,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.serverXMLFileLocationTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ setOutFileName();
+ }
+ });
+ this.serverXMLFileLocationTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) { }
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) { setOutFileName();}
+ });
+
+ this.browseButton = new JButton(".");
+ this.add(this.browseButton);
+ this.browseButton.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap +Constants.UIConstants.TEXT_BOX_WIDTH,vgap,Constants.UIConstants.BROWSE_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.browseButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ serverXMLFileLocationTextBox.setText(browseForAFile("xml"));
+ setOutFileName();
+ }
+ });
+
+ }
+
+ private void setOutFileName(){
+ myBean.setManualFileName(serverXMLFileLocationTextBox.getText());
+ }
+ }
+
+ private class AutomaticSelectionPanel extends JPanel{
+
+ private JLabel classFileListLable;
+ private JLabel providerClassLable;
+ private JTextField classFileNameTextBox;
+ private JTextField providerClassNameTextBox;
+ private JButton loadButton;
+ private JButton advancedButton;
+
+ public AutomaticSelectionPanel() {
+ init();
+ }
+
+ public AutomaticSelectionPanel(boolean loadVals) {
+ init();
+ if (loadVals){
+ this.classFileNameTextBox.setText(myBean.getAutomaticClassName());
+ this.providerClassNameTextBox.setText(myBean.getProviderClassName());
+ }
+ }
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,100);
+
+ this.classFileListLable = new JLabel("Class Name");
+ this.add(this.classFileListLable);
+ this.classFileListLable.setBounds(hgap,vgap,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.classFileNameTextBox = new JTextField();
+ this.add(this.classFileNameTextBox);
+ this.classFileNameTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,vgap,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.classFileNameTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ setClassName();
+ }
+ });
+ this.classFileNameTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {setClassName();}
+ });
+
+ this.providerClassLable = new JLabel("Provider Class Name");
+ this.add(this.providerClassLable);
+ this.providerClassLable.setBounds(hgap,(Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap),Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.providerClassNameTextBox = new JTextField();
+ this.add(this.providerClassNameTextBox);
+ this.providerClassNameTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,(Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap*2),Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.providerClassNameTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ setProviderClassName();
+ }
+ });
+ this.providerClassNameTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {setProviderClassName();}
+ });
+
+ this.loadButton = new JButton("Load");
+ this.add(this.loadButton);
+ this.loadButton.setBounds(hgap,(Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap)*2 + vgap,
+ Constants.UIConstants.GENERAL_BUTTON_WIDTH,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.loadButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ loadAllMethods();
+ }
+ });
+ loadButton.setEnabled(false);
+
+ this.advancedButton = new JButton("Advanced");
+ this.add(this.advancedButton);
+ this.advancedButton.setBounds(2*hgap +Constants.UIConstants.GENERAL_BUTTON_WIDTH
+ ,(Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap)*2 + vgap,
+ Constants.UIConstants.GENERAL_BUTTON_WIDTH,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.advancedButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ openDialog();
+ }
+ });
+ this.advancedButton.setEnabled(false);
+ }
+
+ private void loadAllMethods(){
+ try {
+ ArrayList methodList = new Controller().getMethodList(parentBean);
+ myBean.setSelectedMethodNames(methodList);
+ loadButton.setEnabled(false);
+ advancedButton.setEnabled(true);
+ } catch (ProcessException e) {
+ showErrorMessage(e.getMessage());
+ }
+ }
+
+ private void openDialog(){
+ try {
+ new AdvancedSelectionDialog().show();
+ } catch (ProcessException e) {
+ showErrorMessage(e.getMessage());
+ }
+ }
+ private void setClassName(){
+ loadButton.setEnabled(true);
+ advancedButton.setEnabled(false);
+ myBean.setAutomaticClassName(classFileNameTextBox.getText());
+ }
+
+ private void setProviderClassName(){
+ //loadButton.setEnabled(true);
+ //advancedButton.setEnabled(false);
+ myBean.setProviderClassName(providerClassNameTextBox.getText());
+ }
+
+
+
+ }
+
+
+ private class AdvancedSelectionDialog extends JDialog{
+
+ private JPanel lablePanel;
+ private JButton okButton;
+ private JButton cancelButton;
+ private boolean[] selectedValues;
+ private ArrayList completeMethodList;
+
+
+ public AdvancedSelectionDialog() throws HeadlessException,ProcessException {
+ super();
+ super.setModal(true);
+ super.setTitle("Select Methods");
+ this.getContentPane().setLayout(null);
+ init();
+ }
+
+ private void init() throws ProcessException{
+ //load the class file list
+ this.completeMethodList = new Controller().getMethodList(parentBean);
+ int methodCount = this.completeMethodList.size();
+ int panelHeight = methodCount*(Constants.UIConstants.GENERAL_COMP_HEIGHT + vgap);
+
+ this.lablePanel = new JPanel();
+ this.lablePanel.setLayout(null);
+ this.lablePanel.setBounds(0,0,width,panelHeight);
+ this.getContentPane().add(this.lablePanel);
+
+ ArrayList currentSelectedList = myBean.getSelectedMethodNames();
+ //create check boxes for all the methods and add them to the panel
+ JCheckBox tempCheckBox;
+ boolean currentSelection;
+ this.selectedValues = new boolean[methodCount];
+
+ for (int i = 0; i < methodCount; i++) {
+ tempCheckBox = new JCheckBox(this.completeMethodList.get(i).toString());
+ currentSelection = currentSelectedList.contains(this.completeMethodList.get(i));
+ tempCheckBox.setSelected(currentSelection);
+ selectedValues[i] = currentSelection;
+ tempCheckBox.setBounds(hgap,vgap + (Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap)*i,
+ Constants.UIConstants.LABEL_WIDTH*3,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ tempCheckBox.addActionListener(new CheckBoxActionListner(tempCheckBox,i));
+ this.lablePanel.add(tempCheckBox);
+
+ }
+
+ okButton = new JButton("OK");
+ this.getContentPane().add (this.okButton);
+ this.okButton.setBounds(hgap,panelHeight+vgap,
+ Constants.UIConstants.GENERAL_BUTTON_WIDTH,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.okButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ loadValuesToBean();
+ closeMe();
+ }
+ });
+
+ cancelButton = new JButton("Cancel");
+ this.getContentPane().add (this.cancelButton);
+ this.cancelButton.setBounds(hgap*2 +Constants.UIConstants.GENERAL_BUTTON_WIDTH ,panelHeight+vgap,
+ Constants.UIConstants.GENERAL_BUTTON_WIDTH,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.cancelButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ closeMe();
+ }
+ });
+
+ this.setSize(width,panelHeight+2*Constants.UIConstants.GENERAL_COMP_HEIGHT + 30);
+ this.setResizable(false);
+ }
+
+ private void updateSelection(JCheckBox checkBox,int index){
+ if (checkBox.isSelected()){
+ selectedValues[index] = true;
+ }else{
+ selectedValues[index] = false;
+ }
+
+ }
+
+ private void loadValuesToBean(){
+ ArrayList modifiedMethodList = new ArrayList();
+ for (int i = 0; i < selectedValues.length; i++) {
+ if( selectedValues[i])
+ modifiedMethodList.add(completeMethodList.get(i));
+ }
+
+ myBean.setSelectedMethodNames(modifiedMethodList);
+ }
+ private void closeMe(){
+ this.dispose();
+ }
+
+ private class CheckBoxActionListner implements ActionListener{
+ private JCheckBox checkBox;
+ private int index;
+
+ public CheckBoxActionListner(JCheckBox checkBox,int index) {
+ this.index = index;
+ this.checkBox = checkBox;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ updateSelection(checkBox,index);
+ }
+
+ }
+ }
+
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane3.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane3.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane3.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/ui/WizardPane3.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,136 @@
+package org.apache.axis.tool.ui;
+
+import org.apache.axis.tool.bean.Page3Bean;
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.util.Constants;
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class WizardPane3 extends WizardPane{
+
+ private Page3Bean myBean;
+
+ private JLabel outputFileLocationLabel;
+ private JTextField outputFileLocationTextBox;
+ private JButton browseButton;
+
+ private JLabel outputFileNameLabel;
+ private JTextField outputFileNameTextBox;
+
+ public WizardPane3(WizardBean bean, JFrame ownerFrame) {
+ super(ownerFrame);
+ init();
+ if (bean.getPage3bean()!=null){
+ this.myBean = bean.getPage3bean();
+ setBeanValues();
+ }else{
+ this.myBean = new Page3Bean();
+ bean.setPage3bean(myBean);
+ }
+ }
+
+ public boolean validateValues() {
+ String text1 = myBean.getOutputFileName();
+ String text2 = myBean.getOutputFolderName();
+ boolean text1Validity = (text1!=null && text1.trim().length()>0);
+ boolean text2Validity = (text2!=null && text2.trim().length()>0);
+
+ return text1Validity && text2Validity;
+ }
+
+ private void setBeanValues(){
+ this.outputFileLocationTextBox.setText(myBean.getOutputFolderName());
+ this.outputFileNameTextBox.setText(myBean.getOutputFileName());
+ }
+
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,height);
+
+ initDescription("\nInput the location for the output file and the name for \n" +
+ "the compiled jar file " );
+
+
+ this.outputFileLocationLabel = new JLabel("Output Folder");
+ this.add(this.outputFileLocationLabel);
+ this.outputFileLocationLabel.setBounds(hgap,descHeight,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.outputFileLocationTextBox = new JTextField();
+ this.add(this.outputFileLocationTextBox);
+ this.outputFileLocationTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,descHeight,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.outputFileLocationTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ handleLocationChange();
+ }
+ });
+ this.outputFileLocationTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) { }
+ public void keyPressed(KeyEvent e) {
+ handleLocationChange();
+ }
+ public void keyReleased(KeyEvent e) {}
+ });
+
+
+ this.browseButton = new JButton(".");
+ this.add(this.browseButton);
+ this.browseButton.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap +Constants.UIConstants.TEXT_BOX_WIDTH,descHeight,Constants.UIConstants.BROWSE_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.browseButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ outputFileLocationTextBox.setText(browseForAFolder());
+ handleLocationChange();
+
+ }
+ });
+
+
+
+ this.outputFileNameLabel = new JLabel("Out File Name");
+ this.add(this.outputFileNameLabel);
+ this.outputFileNameLabel.setBounds(hgap,descHeight +Constants.UIConstants.GENERAL_COMP_HEIGHT +vgap,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.outputFileNameTextBox = new JTextField();
+ this.add(this.outputFileNameTextBox);
+ this.outputFileNameTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,descHeight+Constants.UIConstants.GENERAL_COMP_HEIGHT +vgap,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.outputFileNameTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ handleFileNameChange();
+ }
+ });
+ this.outputFileNameTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) { }
+ public void keyPressed(KeyEvent e) { }
+ public void keyReleased(KeyEvent e) { handleFileNameChange();}
+ });
+
+ }
+
+ private void handleLocationChange(){
+ myBean.setOutputFolderName(outputFileLocationTextBox.getText());
+ }
+
+ private void handleFileNameChange(){
+ myBean.setOutputFileName(outputFileNameTextBox.getText());
+ }
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/util/Constants.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/util/Constants.java?view=auto&rev=154654
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/util/Constants.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/java/org/apache/axis/tool/util/Constants.java Mon Feb 21 00:39:15 2005
@@ -0,0 +1,28 @@
+package org.apache.axis.tool.util;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class Constants {
+ public 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;
+ }
+}