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 de...@apache.org on 2006/04/29 07:16:20 UTC
svn commit: r398091 - in /webservices/axis2/trunk/java/modules:
core/src/org/apache/axis2/context/ core/src/org/apache/axis2/deployment/util/
core/src/org/apache/axis2/engine/ java2wsdl/src/org/apache/ws/java2wsdl/
tool/ideaplugin/plugin/org/apache/axi...
Author: deepal
Date: Fri Apr 28 22:16:18 2006
New Revision: 398091
URL: http://svn.apache.org/viewcvs?rev=398091&view=rev
Log:
fixed http://issues.apache.org/jira/browse/AXIS2-633
fixing idea plug-in compile errors
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DependencyManager.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java
webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
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/axis2/tools/idea/SecondPanel.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java?rev=398091&r1=398090&r2=398091&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ConfigurationContext.java Fri Apr 28 22:16:18 2006
@@ -344,4 +344,22 @@
}
}
}
+
+ public void cleanupContexts() {
+ if (applicationSessionServiceGroupContextTable.size() > 0) {
+ Iterator applicationScopeSgs = applicationSessionServiceGroupContextTable.values().iterator();
+ while (applicationScopeSgs.hasNext()) {
+ ServiceGroupContext serviceGroupContext =
+ (ServiceGroupContext) applicationScopeSgs.next();
+ cleanupServiceContextes(serviceGroupContext);
+ }
+ }
+ if (serviceGroupContextMap.size() > 0) {
+ Iterator sopaSessionSgs = serviceGroupContextMap.values().iterator();
+ while (sopaSessionSgs.hasNext()) {
+ ServiceGroupContext serviceGroupContext = (ServiceGroupContext) sopaSessionSgs.next();
+ cleanupServiceContextes(serviceGroupContext);
+ }
+ }
+ }
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java?rev=398091&r1=398090&r2=398091&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java Fri Apr 28 22:16:18 2006
@@ -183,8 +183,9 @@
// no need to expose , private and protected methods
continue;
}
- if (jmethod.getSimpleName().equals("init") ||
- DependencyManager.MESSAGE_CONTEXT_INJECTION_METHOD.equals(jmethod.getSimpleName()))
+ if (jmethod.getSimpleName().equals("init")
+ || DependencyManager.MESSAGE_CONTEXT_INJECTION_METHOD.equals(jmethod.getSimpleName())
+ || DependencyManager.SERVICE_DESTROY_METHOD.equals(jmethod.getSimpleName()))
continue;
String opName = jmethod.getSimpleName();
AxisOperation operation = axisService.getOperation(new QName(opName));
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DependencyManager.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DependencyManager.java?rev=398091&r1=398090&r2=398091&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DependencyManager.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/DependencyManager.java Fri Apr 28 22:16:18 2006
@@ -30,8 +30,8 @@
*/
public class DependencyManager {
public final static String MESSAGE_CONTEXT_INJECTION_METHOD = "setOperationContext";
- private final static String SERVICE_INIT_METHOD = "init";
- private final static String SERVICE_DESTROY_METHOD = "destroy";
+ public final static String SERVICE_INIT_METHOD = "init";
+ public final static String SERVICE_DESTROY_METHOD = "destroy";
public static void configureBusinessLogicProvider(Object obj,
OperationContext opCtx)
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java?rev=398091&r1=398090&r2=398091&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java Fri Apr 28 22:16:18 2006
@@ -144,6 +144,7 @@
}
}
}
+ configctx.cleanupContexts();
stopped = true;
}
Modified: webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java?rev=398091&r1=398090&r2=398091&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java (original)
+++ webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java Fri Apr 28 22:16:18 2006
@@ -148,8 +148,8 @@
// no need to think abt this method , since that is system
// config method
if (jMethod.getSimpleName().equals("init")
- || "setOperationContext"
- .equals(jMethod.getSimpleName()))
+ || "setOperationContext".equals(jMethod.getSimpleName())
+ || "destroy".equals(jMethod.getSimpleName()))
continue;
if (uniqueMethods.get(jMethod.getSimpleName()) != null) {
throw new Exception(
@@ -221,8 +221,9 @@
private void generateWrapperElements(JMethod methods[]) throws Exception {
for (int i = 0; i < methods.length; i++) {
JMethod method = methods[i];
- if (method.getSimpleName().equals("init") ||
- method.getSimpleName().equals("setOperationContext"))
+ if (method.getSimpleName().equals("init")
+ || method.getSimpleName().equals("setOperationContext")
+ || method.getSimpleName().equals("destroy"))
continue;
if (!method.isPublic())
continue;
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=398091&r1=398090&r2=398091&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 Fri Apr 28 22:16:18 2006
@@ -1,19 +1,17 @@
package org.apache.axis2.tools.bean;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.WSDL2AxisServiceBuilder;
import org.apache.axis2.util.URLProcessor;
-import org.apache.axis2.wsdl.builder.WOMBuilderFactory;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
import org.apache.axis2.wsdl.util.CommandLineOption;
import org.apache.axis2.wsdl.util.CommandLineOptionConstants;
-import org.apache.axis2.wsdl.util.CommandLineOptionParser;
-import org.apache.wsdl.WSDLConstants;
-import org.apache.wsdl.WSDLDescription;
-import javax.wsdl.WSDLException;
import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
-import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.HashMap;
import java.util.Map;
@@ -35,11 +33,6 @@
*
*/
-/**
- * Author : Deepal Jayasinghe
- * Date: Jul 21, 2005
- * Time: 2:41:26 PM
- */
public class CodegenBean {
private String WSDLFileName = null;
@@ -52,95 +45,201 @@
private boolean serverSide = true;
private boolean testcase = true;
private boolean generateServerXml = true;
- private String dbType = "";
+ private boolean isServerXML;
+ private boolean isGenerateAll;
+ private boolean isTestCase;
+ private String serviceName;
+ private String portName;
+ private String databindingName;
+
+ public boolean isServerXML() {
+ return isServerXML;
+ }
+
+ public void setServerXML(boolean serverXML) {
+ isServerXML = serverXML;
+ }
+
+ public boolean isGenerateAll() {
+ return isGenerateAll;
+ }
+
+ public void setGenerateAll(boolean generateAll) {
+ isGenerateAll = generateAll;
+ }
+
+ public boolean isTestCase() {
+ return isTestCase;
+ }
+
+ public void setTestCase(boolean testCase) {
+ isTestCase = testCase;
+ }
+
+ public String getServiceName() {
+ return serviceName;
+ }
+
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public String getPortName() {
+ return portName;
+ }
+
+ public void setPortName(String portName) {
+ this.portName = portName;
+ }
+
+ public String getDatabindingName() {
+ return databindingName;
+ }
+
+ public void setDatabindingName(String databindingName) {
+ this.databindingName = databindingName;
+ }
/**
+ * Maps a string containing the name of a language to a constant defined in CommandLineOptionConstants.LanguageNames
*
+ * @param UILangValue a string containg a language, e.g. "java", "cs", "cpp" or "vb"
+ * @return a normalized string constant
+ */
+ private String mapLanguagesWithCombo(String UILangValue) {
+ return UILangValue;
+ }
+
+ /**
+ * Creates a list of parameters for the code generator based on the decisions made by the user on the OptionsPage
+ * (page2). For each setting, there is a Command-Line option for the Axis2 code generator.
+ *
+ * @return a Map with keys from CommandLineOptionConstants with the values entered by the user on the Options Page.
*/
public Map fillOptionMap() {
Map optionMap = new HashMap();
//WSDL file name
- optionMap.put(CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.WSDL_LOCATION_URI_OPTION,
- getStringArray(WSDLFileName)));
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION, getStringArray(WSDLFileName)));
//Async only
if (asyncOnly) {
- optionMap.put(CommandLineOptionConstants.CODEGEN_ASYNC_ONLY_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.CODEGEN_ASYNC_ONLY_OPTION,
- new String[0]));
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION, new String[0]));
}
//sync only
if (syncOnly) {
- optionMap.put(CommandLineOptionConstants.CODEGEN_SYNC_ONLY_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.CODEGEN_SYNC_ONLY_OPTION,
- new String[0]));
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION, new String[0]));
}
//serverside
if (serverSide) {
- optionMap.put(CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.SERVER_SIDE_CODE_OPTION,
- new String[0]));
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION, new String[0]));
//server xml
- if (generateServerXml) {
- optionMap.put(
- CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.GENERATE_SERVICE_DESCRIPTION_OPTION,
- new String[0]));
+ if (isServerXML) {
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_SERVICE_DESCRIPTION_OPTION, new String[0]));
+ }
+ if (isGenerateAll) {
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_ALL_OPTION, new String[0]));
}
}
//test case
- if (testcase) {
- optionMap.put(CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.GENERATE_TEST_CASE_OPTION,
- new String[0]));
+ if (isTestCase) {
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.GENERATE_TEST_CASE_OPTION, new String[0]));
}
//package name
- optionMap.put(CommandLineOptionConstants.PACKAGE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.PACKAGE_OPTION,
- getStringArray(packageName)));
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION, getStringArray(packageName)));
//selected language
- optionMap.put(CommandLineOptionConstants.STUB_LANGUAGE_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.STUB_LANGUAGE_OPTION,
- getStringArray(language)));
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION, getStringArray(mapLanguagesWithCombo(language))));
//output location
- optionMap.put(CommandLineOptionConstants.OUTPUT_LOCATION_OPTION,
- new CommandLineOption(
- CommandLineOptionConstants.OUTPUT_LOCATION_OPTION,
- getStringArray(output)));
-
- // System.out.println(page3.getOutputLocation());
- optionMap.put(CommandLineOptionConstants.DATA_BINDING_TYPE_OPTION, new CommandLineOption(
- CommandLineOptionConstants.DATA_BINDING_TYPE_OPTION, getStringArray(dbType)));
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION, getStringArray(output)));
+
+ //databinding
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.DATA_BINDING_TYPE_OPTION, getStringArray(databindingName)));
+
+ //port name
+ if (portName != null) {
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.PORT_NAME_OPTION, getStringArray(portName)));
+ }
+ //service name
+ if (serviceName != null) {
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION, new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.SERVICE_NAME_OPTION, getStringArray(serviceName)));
+ }
return optionMap;
+
}
+ public String getBaseUri(String wsdlURI) {
- private String[] getStringArray(String value) {
- String[] values = new String[1];
- values[0] = value;
- return values;
+ try {
+ URL url;
+ if (wsdlURI.indexOf("://") == -1) {
+ url = new URL("file", "", wsdlURI);
+ } else {
+ url = new URL(wsdlURI);
+ }
+
+
+ String baseUri;
+ if ("file".equals(url.getProtocol())) {
+ baseUri = new File(url.getFile()).getParentFile().toURL().toExternalForm();
+ } else {
+ baseUri = url.toExternalForm().substring(0,
+ url.toExternalForm().lastIndexOf("/")
+ );
+ }
+
+
+ return baseUri;
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
}
- public WSDLDescription getWOM(String wsdlLocation) throws WSDLException,
- IOException {
- InputStream in = new FileInputStream(new File(wsdlLocation));
- return WOMBuilderFactory.getBuilder(WSDLConstants.WSDL_1_1).build(in).getDescription();
+ /**
+ * Reads the WSDL Object Model from the given location.
+ *
+ * @param wsdlURI the filesystem location (full path) of the WSDL file to read in.
+ * @return the WSDLDescription object containing the WSDL Object Model of the given WSDL file
+ * @throws IOException on errors reading the WSDL file
+ */
+ public AxisService getAxisService(String wsdlURI) throws Exception {
+
+ URL url;
+ if (wsdlURI.indexOf("://") == -1) {
+ url = new URL("file", "", wsdlURI);
+ } else {
+ url = new URL(wsdlURI);
+ }
+
+
+ WSDL2AxisServiceBuilder builder =
+ new WSDL2AxisServiceBuilder(url.openConnection().getInputStream());
+
+ builder.setBaseUri(getBaseUri(wsdlURI));
+ return builder.populateService();
}
- public void execute() throws Exception {
- Map optionsMap = fillOptionMap();
- CommandLineOptionParser parser = new CommandLineOptionParser(optionsMap);
- CodeGenerationEngine codegen = new CodeGenerationEngine(parser);
- codegen.generate();
+ /**
+ * Converts a single String into a String Array
+ *
+ * @param value a single string
+ * @return an array containing only one element
+ */
+ private String[] getStringArray(String value) {
+ String[] values = new String[1];
+ values[0] = value;
+ return values;
}
public String getWSDLFileName() {
@@ -215,12 +314,10 @@
this.testcase = testcase;
}
- public String getDbType() {
- return dbType;
+ public void generate() throws Exception {
+ CodeGenConfiguration codegenConfig = new CodeGenConfiguration(getAxisService(WSDLFileName), fillOptionMap());
+ //set the baseURI
+ codegenConfig.setBaseURI(getBaseUri(WSDLFileName));
+ new CodeGenerationEngine(codegenConfig).generate();
}
-
- public void setDbType(String dbType) {
- this.dbType = dbType;
- }
-
}
Modified: webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/idea/SecondPanel.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/idea/SecondPanel.java?rev=398091&r1=398090&r2=398091&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/idea/SecondPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/ideaplugin/plugin/org/apache/axis2/tools/idea/SecondPanel.java Fri Apr 28 22:16:18 2006
@@ -62,7 +62,7 @@
add(lblol);
comlanguage = new JComboBox();
- comlanguage.addItem("Java");
+ comlanguage.addItem("java");
comlanguage.addItem("C#");
add(comlanguage);
@@ -114,15 +114,15 @@
index = databindingType.getSelectedIndex();
switch (index) {
case 0: {
- codegenBean.setDbType("adb");
+ codegenBean.setDatabindingName("adb");
break;
}
case 1: {
- codegenBean.setDbType("xmlbeans");
+ codegenBean.setDatabindingName("xmlbeans");
break;
}
case 2: {
- codegenBean.setDbType("none");
+ codegenBean.setDatabindingName("none");
break;
}
}