diff options
Diffstat (limited to 'bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal')
6 files changed, 419 insertions, 5 deletions
diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/Java2WSDLCommand.java b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/Java2WSDLCommand.java index ae62c0448..41e72f630 100644 --- a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/Java2WSDLCommand.java +++ b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/Java2WSDLCommand.java @@ -10,6 +10,7 @@ * yyyymmdd bug Email and other contact information * -------- -------- ----------------------------------------------------------- * 20060106 121199 jesper@selskabet.org - Jesper Møller + * 20060329 127016 andyzhai@ca.ibm.com - Andy Zhai *******************************************************************************/ package org.eclipse.jst.ws.internal.axis.consumption.core.command; @@ -34,6 +35,8 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.jst.ws.internal.axis.consumption.core.AxisConsumptionCoreMessages; import org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParameter; +import org.eclipse.jst.ws.internal.axis.consumption.core.context.AxisEmitterContext; +import org.eclipse.jst.ws.internal.axis.consumption.core.context.AxisEmitterDefaults; import org.eclipse.jst.ws.internal.axis.consumption.core.plugin.WebServiceAxisConsumptionCorePlugin; import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; import org.eclipse.osgi.util.NLS; @@ -148,6 +151,14 @@ public class Java2WSDLCommand extends AbstractDataModelOperation emitter.setImplClass(javaWSDLParam_.getBeanName()); + AxisEmitterContext context = WebServiceAxisConsumptionCorePlugin.getInstance().getAxisEmitterContext(); + + if (context.isUseInheritedMethodsEnabled() != AxisEmitterDefaults.getUseInheritedMethodsDefault()) + { + emitter.setUseInheritedMethods(context.isUseInheritedMethodsEnabled()); + environment.getLog().log(ILog.INFO, 5099, this, "executeAntTask", " set UseInheritedMethods : " + context.isUseInheritedMethodsEnabled() ); + } + HashMap mappings = javaWSDLParam_.getMappings(); if(mappings != null){ Iterator keys = mappings.keySet().iterator(); diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/WSDL2JavaCommand.java b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/WSDL2JavaCommand.java index 9e794ca27..24a7c6a11 100644 --- a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/WSDL2JavaCommand.java +++ b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/command/WSDL2JavaCommand.java @@ -7,6 +7,9 @@ * * Contributors: * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060329 127016 andyzhai@ca.ibm.com - Andy Zhai *******************************************************************************/ package org.eclipse.jst.ws.internal.axis.consumption.core.command; @@ -18,6 +21,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import org.apache.axis.constants.Scope; import org.apache.axis.wsdl.toJava.Emitter; import org.apache.axis.wsdl.toJava.GeneratedFileInfo; import org.eclipse.core.runtime.IAdaptable; @@ -28,6 +32,8 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.jst.ws.internal.axis.consumption.core.AxisConsumptionCoreMessages; import org.eclipse.jst.ws.internal.axis.consumption.core.common.JavaWSDLParameter; +import org.eclipse.jst.ws.internal.axis.consumption.core.context.AxisEmitterContext; +import org.eclipse.jst.ws.internal.axis.consumption.core.context.AxisEmitterDefaults; import org.eclipse.jst.ws.internal.axis.consumption.core.plugin.WebServiceAxisConsumptionCorePlugin; import org.eclipse.jst.ws.internal.common.ResourceUtils; import org.eclipse.jst.ws.internal.plugin.WebServicePlugin; @@ -133,19 +139,60 @@ public class WSDL2JavaCommand extends AbstractDataModelOperation { // // eclipse -vmargs "-DAxisWsdl2JavaTimeout=60000" // - + // When AxisWsdl2JavaTimeout is set, the Axis emitter preference page timeout setting is ignored + AxisEmitterContext context = WebServiceAxisConsumptionCorePlugin.getInstance().getAxisEmitterContext(); String wsdl2JavaTimeoutProperty = System.getProperty("AxisWsdl2JavaTimeout"); + long timeout; if (wsdl2JavaTimeoutProperty != null) { - long timeout; timeout = new Integer(wsdl2JavaTimeoutProperty).longValue(); wsdl2Java.setTimeout(timeout); - environment.getLog().log(ILog.INFO, 5091, this, "execute", "Timeout = " + timeout); + environment.getLog().log(ILog.INFO, 5091, this, "execute", "AxisWsdl2JavaTimeout = " + timeout); + } + else if(context.getTimeOut() != AxisEmitterDefaults.getTimeOutDefault()) + { + timeout = context.getTimeOut() * 1000; + wsdl2Java.setTimeout(timeout); + environment.getLog().log(ILog.INFO, 5100, this, "execute", "Timeout = " + timeout); } + if (context.getDeployScopeType() != AxisEmitterDefaults.getDeployScopeDefault()) + { + switch (context.getDeployScopeType()) + { + case AxisEmitterContext.DEPLOY_SCOPE_TYPE_APPLICATION: + wsdl2Java.setScope(Scope.APPLICATION); + environment.getLog().log(ILog.INFO, 5101, this, "execute", " Deploy Scope: Application" ); + break; + case AxisEmitterContext.DEPLOY_SCOPE_TYPE_REQUEST: + wsdl2Java.setScope(Scope.REQUEST); + environment.getLog().log(ILog.INFO, 5102, this, "execute", " Deploy Scope: Request" ); + break; + case AxisEmitterContext.DEPLOY_SCOPE_TYPE_SESSTION: + wsdl2Java.setScope(Scope.SESSION); + environment.getLog().log(ILog.INFO, 5103, this, "execute", " Deploy Scope: Session" ); + break; + default: + } + } + + if (context.isAllWantedEnabled() != AxisEmitterDefaults.getAllWantedDefault()) + { + wsdl2Java.setAllWanted(context.isAllWantedEnabled()); + environment.getLog().log(ILog.INFO, 5104, this, "execute", " set AllWanted : " + context.isAllWantedEnabled() ); + } + + if (context.isHelperWantedEnabled() != AxisEmitterDefaults.getHelperWantedDefault()) + { + wsdl2Java.setHelperWanted(context.isHelperWantedEnabled()); + environment.getLog().log(ILog.INFO, 5105, this, "execute", " set HelperWanted : " + context.isHelperWantedEnabled() ); + } + if (context.isWrapArraysEnabled() != AxisEmitterDefaults.getWrapArraysDefault()) + { + wsdl2Java.setWrapArrays(context.isWrapArraysEnabled()); + environment.getLog().log(ILog.INFO, 5106, this, "execute", " set WrapArrays : " + context.isWrapArraysEnabled() ); + } ProgressUtils.report(monitor, NLS.bind(AxisConsumptionCoreMessages.MSG_PARSING_WSDL, javaWSDLParam.getInputWsdlLocation() ) ); - - wsdl2Java.run(javaWSDLParam.getInputWsdlLocation()); javaFiles = wsdl2Java.getGeneratedFileNames(); diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/AxisEmitterContext.java b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/AxisEmitterContext.java new file mode 100644 index 000000000..6f39617b0 --- /dev/null +++ b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/AxisEmitterContext.java @@ -0,0 +1,160 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060329 127016 andyzhai@ca.ibm.com - Andy Zhai + *******************************************************************************/ +package org.eclipse.jst.ws.internal.axis.consumption.core.context; + +public interface AxisEmitterContext { + /** + * This constant string is used to lookup the all_wanted general preference + * from the plugins local preferences store. + */ + public static final String PREFERENCE_ALL_WANTED = "allWanted"; + + /** + * This constant string is used to lookup the helper_wanted general + * preference from the plugins local preferences store. + */ + public static final String PREFERENCE_HELPER_WANTED = "helperWanted"; + + /** + * This constant string is used to lookup the wrap_arrays general preference + * from the plugins local preferences store. + */ + public static final String PREFERENCE_WRAP_ARRAYS = "wrapArrays"; + + /** + * This constant string is used to lookup the deploy_scope general + * preference from the plugins local preferences store. + */ + public static final String PREFERENCE_DEPLOY_SCOPE = "deployScope"; + + /** + * This constant string is used to lookup the time_out general preference + * from the plugins local preferences store. + */ + public static final String PREFERENCE_TIME_OUT = "timeOut"; + + /* + * Ensure the order is the same as it in deployScopeTypes.setItems(...) for + * class + * org.eclipse.jst.ws.internal.axis.consumption.ui.preferences.AxisEmitterPreferencePage. + */ + public static final int DEPLOY_SCOPE_TYPE_APPLICATION = 0; + + public static final int DEPLOY_SCOPE_TYPE_REQUEST = 1; + + public static final int DEPLOY_SCOPE_TYPE_SESSTION = 2; + + /** + * This constant string is used to lookup the use_inherited_methods general + * preference from the plugins local preferences store. + */ + public static final String PREFERENCE_USE_INHERITED_METHODS = "useInheritedMethods"; + + /** + * + * @param enable + * set whether generating code for all elements is enabled. + */ + public void setAllWantedEnabled(boolean enable); + + /** + * + * @return returns whether generating code for all elements is enabled. + */ + public boolean isAllWantedEnabled(); + + /** + * + * @param enable + * set whether emitting separate Helper classes for meta data is + * enabled. + */ + public void setHelperWantedEnabled(boolean enable); + + /** + * + * @param returns + * whether emitting separate Helper classes for meta data is + * enabled. + */ + public boolean isHelperWantedEnabled(); + + /** + * + * @param enable + * set whether wrapping arrays is enabled. + */ + + public void setWrapArraysEnabled(boolean enable); + + /** + * + * @param returns + * whether wrapping arrays is enabled. + */ + + public boolean isWrapArraysEnabled(); + + /** + * + * @param enable + * set whether using inherited methods is enabled. + */ + public void setUseInheritedMethodsEnabled(boolean enable); + + /** + * + * @param returns + * whether using inherited methods is enabled. + */ + + public boolean isUseInheritedMethodsEnabled(); + + /** + * + * @param selection + * set the deploy scope type. + */ + + public void selectDeployScopeType(int selection); + + /** + * + * @param returns + * the deploy scope type. + */ + + public int getDeployScopeType(); + + /** + * + * @param seconds + * set the time out. + */ + + public void setTimeOut(int seconds); + + /** + * + * @param returns + * the time out. + */ + + public int getTimeOut(); + + /** + * + * @return returns a copy of this AxisEmitterContext. + */ +} diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/AxisEmitterDefaults.java b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/AxisEmitterDefaults.java new file mode 100644 index 000000000..f9ad3c010 --- /dev/null +++ b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/AxisEmitterDefaults.java @@ -0,0 +1,78 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060329 127016 andyzhai@ca.ibm.com - Andy Zhai + *******************************************************************************/ +package org.eclipse.jst.ws.internal.axis.consumption.core.context; + +public class AxisEmitterDefaults +{ + private static final boolean PREFERENCE_ALL_WANTED_DEFAULT = false; + private static final boolean PREFERENCE_HELPER_WANTED_DEFAULT = false; + private static final boolean PREFERENCE_WRAP_ARRAYS_DEFAULT = false; + private static final boolean PREFERENCE_USE_INHERITED_METHODS_DEFAULT = false; + private static final int DEPLOY_SCOPE_DEFAULT = AxisEmitterContext.DEPLOY_SCOPE_TYPE_REQUEST; + private static final int TIME_OUT_DEFAULT = 45; + + /** + * + * @return returns the default setting for generating code for all elements. + */ + public static boolean getAllWantedDefault () + { + return PREFERENCE_ALL_WANTED_DEFAULT; + } + + /** + * + * @return returns the default setting for emitting seperate helpser class for metadata. + */ + public static boolean getHelperWantedDefault () + { + return PREFERENCE_HELPER_WANTED_DEFAULT; + } + + /** + * + * @return returns the default seting for wrapping arrays. + */ + public static boolean getWrapArraysDefault() + { + return PREFERENCE_WRAP_ARRAYS_DEFAULT; + } + + /** + * + * @return returns the default setting for using inherited methods. + */ + public static boolean getUseInheritedMethodsDefault() + { + return PREFERENCE_USE_INHERITED_METHODS_DEFAULT; + } + + /** + * + * @return returns the default setting for deploy scope type. + */ + public static int getDeployScopeDefault() + { + return DEPLOY_SCOPE_DEFAULT; + } + + /** + * + * @return returns the default setting for time out. + */ + public static int getTimeOutDefault() + { + return TIME_OUT_DEFAULT; + } +} diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/PersistentAxisEmitterContext.java b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/PersistentAxisEmitterContext.java new file mode 100644 index 000000000..92b76edec --- /dev/null +++ b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/context/PersistentAxisEmitterContext.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060329 127016 andyzhai@ca.ibm.com - Andy Zhai + *******************************************************************************/ +package org.eclipse.jst.ws.internal.axis.consumption.core.context; + +import org.eclipse.jst.ws.internal.axis.consumption.core.plugin.WebServiceAxisConsumptionCorePlugin; +import org.eclipse.wst.command.internal.env.context.PersistentContext; + +public class PersistentAxisEmitterContext extends PersistentContext implements AxisEmitterContext +{ + private static PersistentAxisEmitterContext context_ = null; + + public static PersistentAxisEmitterContext getInstance() + { + if (context_ == null) { + context_ = new PersistentAxisEmitterContext(); + context_.load(); + } + + return context_; + } + + private PersistentAxisEmitterContext() + { + super(WebServiceAxisConsumptionCorePlugin.getInstance()); + } + + public void load() + { + setDefault(PREFERENCE_ALL_WANTED, AxisEmitterDefaults.getAllWantedDefault()); + setDefault(PREFERENCE_HELPER_WANTED, AxisEmitterDefaults.getHelperWantedDefault()); + setDefault(PREFERENCE_WRAP_ARRAYS, AxisEmitterDefaults.getWrapArraysDefault()); + setDefault(PREFERENCE_USE_INHERITED_METHODS, AxisEmitterDefaults.getUseInheritedMethodsDefault()); + setDefault(PREFERENCE_DEPLOY_SCOPE, AxisEmitterDefaults.getDeployScopeDefault()); + setDefault(PREFERENCE_TIME_OUT, AxisEmitterDefaults.getTimeOutDefault()); + } + + public void setAllWantedEnabled(boolean enable) + { + setValue(PREFERENCE_ALL_WANTED, enable); + } + + public boolean isAllWantedEnabled() + { + return getValueAsBoolean(PREFERENCE_ALL_WANTED); + } + + public void setHelperWantedEnabled(boolean enable) + { + setValue(PREFERENCE_HELPER_WANTED, enable); + } + + public boolean isHelperWantedEnabled() + { + return getValueAsBoolean(PREFERENCE_HELPER_WANTED); + } + + public void setWrapArraysEnabled(boolean enable) + { + setValue(PREFERENCE_WRAP_ARRAYS, enable); + } + + public boolean isWrapArraysEnabled() + { + return getValueAsBoolean(PREFERENCE_WRAP_ARRAYS); + } + + public void setUseInheritedMethodsEnabled(boolean enable) + { + setValue(PREFERENCE_USE_INHERITED_METHODS, enable); + } + + public boolean isUseInheritedMethodsEnabled() + { + return getValueAsBoolean(PREFERENCE_USE_INHERITED_METHODS); + } + + public void selectDeployScopeType(int selection) { + setValue(PREFERENCE_DEPLOY_SCOPE, selection); + } + + public int getDeployScopeType() { + return getValueAsInt(PREFERENCE_DEPLOY_SCOPE); + } + + public void setTimeOut(int seconds) { + setValue(PREFERENCE_TIME_OUT, seconds); + } + + public int getTimeOut() { + return getValueAsInt(PREFERENCE_TIME_OUT); + } +} diff --git a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/plugin/WebServiceAxisConsumptionCorePlugin.java b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/plugin/WebServiceAxisConsumptionCorePlugin.java index 695f7a81b..47ab0321c 100644 --- a/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/plugin/WebServiceAxisConsumptionCorePlugin.java +++ b/bundles/org.eclipse.jst.ws.axis.consumption.core/src/org/eclipse/jst/ws/internal/axis/consumption/core/plugin/WebServiceAxisConsumptionCorePlugin.java @@ -7,12 +7,19 @@ * * Contributors: * IBM Corporation - initial API and implementation + * yyyymmdd bug Email and other contact information + * -------- -------- ----------------------------------------------------------- + * 20060329 127016 andyzhai@ca.ibm.com - Andy Zhai *******************************************************************************/ package org.eclipse.jst.ws.internal.axis.consumption.core.plugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Plugin; +import org.eclipse.jst.ws.internal.axis.consumption.core.context.AxisEmitterContext; +import org.eclipse.jst.ws.internal.axis.consumption.core.context.PersistentAxisEmitterContext; +import org.eclipse.wst.command.internal.env.context.PersistentResourceContext; +import org.eclipse.wst.command.internal.env.core.context.ResourceContext; import org.eclipse.wst.common.environment.EnvironmentService; import org.eclipse.wst.common.environment.ILog; import org.osgi.framework.BundleContext; @@ -39,6 +46,7 @@ public class WebServiceAxisConsumptionCorePlugin extends Plugin private static WebServiceAxisConsumptionCorePlugin instance_; private ILog log_; + private PersistentAxisEmitterContext axisEmitterContext_; /** * Constructs a runtime plugin object for this plugin. * The "plugin" element in plugin.xml should include the attribute @@ -68,6 +76,13 @@ public class WebServiceAxisConsumptionCorePlugin extends Plugin static public WebServiceAxisConsumptionCorePlugin getInstance() { return instance_; } + + public AxisEmitterContext getAxisEmitterContext() + { + if (axisEmitterContext_ == null) + axisEmitterContext_ = PersistentAxisEmitterContext.getInstance(); + return axisEmitterContext_; + } /** * Called once by the platform when this plugin is first loaded. |