[prev in list] [next in list] [prev in thread] [next in thread]
List: wsf-java-dev
Subject: [wsf-java-dev] svn commit r1840 - in
From: svn () wso2 ! org (svn () wso2 ! org)
Date: 2007-04-16 4:34:01
Message-ID: E1HdPT5-0002WJ-Ec () wso2 ! org
[Download RAW message or body]
Author: sandakith
Date: Mon Apr 16 04:33:17 2007
New Revision: 1840
Added:
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.classpath \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.project \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.settings/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.settings/org.eclipse.jdt.core.prefs \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/META-INF/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/META-INF/MANIFEST.MF \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/build.properties \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/plugin.properties \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/plugin.xml \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/ \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/ \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASClientCodegenCommand.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASClientDefaultingCommand.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASWebservicesServerCommand.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/data/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/data/DataModel.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/data/Model.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/messages/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/messages/WSASConsumptionUI.properties \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/messages/WSASConsumptionUIMessages.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/plugin/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/plugin/WebServiceWSASConsumptionCorePlugin.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/ContentCopyUtils.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/DefaultCodegenUtil.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/FileUtils.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/WSDL2JavaGenerator.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/WSDLPropertyReader.java \
(contents, props changed) \
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/creation/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/creation/core/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/creation/core/data/
trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/creation/core/data/DataModel.java \
(contents, props changed) Log:
wsf eclipse consumtion core plugin
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.classpath
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.classpath Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.project
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.project Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.wso2.wsf.wtp.consumption.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.settings/org.eclipse.jdt.core.prefs
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/.settings/org.eclipse.jdt.core.prefs Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,52 @@
+#Tue Feb 13 11:08:51 LKT 2007
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=ignore
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/META-INF/MANIFEST.MF
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/META-INF/MANIFEST.MF Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,33 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: WSAS WTP Consumption Core Plug-in
+Bundle-SymbolicName: org.wso2.wsf.wtp.consumption.core
+Bundle-Version: 1.0.0
+Bundle-Activator: org.wso2.wsf.wtp.consumption.core.plugin.WebServiceWSASConsumptionCorePlugin
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.ide,
+ org.eclipse.core.resources,
+ org.eclipse.jdt.core,
+ org.eclipse.wst.ws.parser,
+ org.eclipse.jst.ws,
+ org.eclipse.jst.ws.ui,
+ org.eclipse.jst.ws.consumption,
+ org.eclipse.jst.ws.consumption.ui,
+ org.eclipse.wst.ws,
+ org.eclipse.wst.command.env,
+ org.eclipse.wst.command.env.core,
+ org.eclipse.wst.command.env.ui,
+ org.eclipse.wst.server.core,
+ org.eclipse.wst.wsdl,
+ org.eclipse.wst.common.frameworks,
+ org.eclipse.wst.common.environment,
+ org.wso2.wsas
+Eclipse-LazyStart: true
+Export-Package: org.wso2.wsf.wtp.consumption.core.command,
+ org.wso2.wsf.wtp.consumption.core.data,
+ org.wso2.wsf.wtp.consumption.core.messages,
+ org.wso2.wsf.wtp.consumption.core.plugin,
+ org.wso2.wsf.wtp.consumption.core.utils,
+ org.wso2.wsf.wtp.creation.core.data
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/build.properties
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/build.properties Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/plugin.properties
==============================================================================
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/plugin.xml
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/plugin.xml Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="org.wso2.wsf.wtp.consumption.core"
+ name="WSF Consumtion Core Plugin"
+ version="1.0"
+>
+ <requires>
+ <import plugin="org.apache.axis2"/>
+ </requires>
+
+
+</plugin>
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASClientCodegenCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASClientCodegenCommand.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,126 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.command;
+
+import java.io.File;
+import java.util.Map;
+
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.common.environment.IEnvironment;
+import org.eclipse.wst.common.environment.IStatusHandler;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.wso2.wsf.wtp.consumption.core.data.DataModel;
+import org.wso2.wsf.wtp.consumption.core.messages.WSASConsumptionUIMessages;
+import org.wso2.wsf.wtp.consumption.core.utils.ContentCopyUtils;
+import org.wso2.wsf.wtp.consumption.core.utils.FileUtils;
+import org.wso2.wsf.wtp.consumption.core.utils.WSDL2JavaGenerator;
+
+public class WSASClientCodegenCommand extends AbstractDataModelOperation {
+
+ private DataModel model;
+
+ public WSASClientCodegenCommand( DataModel model ){
+ this.model = model;
+ }
+
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ IStatus status = Status.OK_STATUS;
+ IEnvironment environment = getEnvironment();
+ IStatusHandler statusHandler = environment.getStatusHandler();
+
+ String workspaceDirectory = ResourcesPlugin.getWorkspace().getRoot().
+ getLocation().toOSString();
+ String currentDynamicWebProjectDir = FileUtils.addAnotherNodeToPath(
+ workspaceDirectory,
+ model.getWebProjectName());
+ String matadataDir = FileUtils.addAnotherNodeToPath(
+ workspaceDirectory,
+ WSASConsumptionUIMessages.DIR_DOT_METADATA);
+ String matadataPluginsDir = FileUtils.addAnotherNodeToPath(
+ matadataDir,
+ WSASConsumptionUIMessages.DIR_DOT_PLUGINS);
+ String matadataWSASDir = FileUtils.addAnotherNodeToPath(
+ matadataPluginsDir,
+ WSASConsumptionUIMessages.AXIS2_PROJECT);
+ String tempCodegenOutputLocation = FileUtils.addAnotherNodeToPath(
+ matadataWSASDir,
+ WSASConsumptionUIMessages.CODEGEN_RESULTS);
+ File tempCodegenOutputLocationFile = new File(tempCodegenOutputLocation);
+ if (tempCodegenOutputLocationFile.exists()){
+ FileUtils.deleteDirectories(tempCodegenOutputLocation);
+ }
+ FileUtils.createDirectorys(tempCodegenOutputLocation);
+ WSDL2JavaGenerator generator = new WSDL2JavaGenerator();
+
+ AxisService service;
+ try {
+ service = generator.getAxisService(model.getWsdlURI());
+ Map optionsMap = generator.fillOptionMap(
+ model.isASync(), //async
+ model.isSync(), //sync
+ false, //servirside false always
+ false, //services.xml false always
+ false, //model.isTestCaseCheck(),
+ model.isGenerateAllCheck(),
+ (model.getServiceName()!=null)?model.getServiceName():null,
+ (model.getPortName()!=null)?model.getPortName():null,
+ (model.getDatabindingType().toLowerCase()!=null)?model.getDatabindingType().toLowerCase():null,
+ (model.getWsdlURI()!=null)?model.getWsdlURI():null,
+ (model.getPackageText()!=null)?model.getPackageText():null,
+ "java",
+ tempCodegenOutputLocation,
+ model.getNamespaseToPackageMapping(),
+ false //Serverside interface always false
+ );
+
+ CodeGenConfiguration codegenConfig = new CodeGenConfiguration(service, \
optionsMap); + //set the baseURI
+ codegenConfig.setBaseURI(generator.getBaseUri(model.getWsdlURI()));
+
+ new CodeGenerationEngine(codegenConfig).generate();
+
+ //Copy the existing codegen results to the current project
+ ContentCopyUtils contentCopyUtils = new ContentCopyUtils();
+ status = contentCopyUtils.copyDirectoryRecursivelyIntoWorkspace(
+ tempCodegenOutputLocation,
+ currentDynamicWebProjectDir,
+ monitor,
+ statusHandler);
+
+ } catch (Exception e) {
+ status = StatusUtils.errorStatus(NLS.bind(
+ WSASConsumptionUIMessages.ERROR_CODEGEN_EXCEPTION,
+ new String[]{e.getLocalizedMessage()}),
+ e);
+ environment.getStatusHandler().reportError(status);
+ }
+
+ return status;
+ }
+
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASClientDefaultingCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASClientDefaultingCommand.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,59 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.command;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.eclipse.wst.ws.internal.wsrt.IWebServiceClient;
+import org.wso2.wsf.wtp.consumption.core.data.DataModel;
+import org.wso2.wsf.wtp.consumption.core.messages.WSASConsumptionUIMessages;
+import org.wso2.wsf.wtp.consumption.core.utils.DefaultCodegenUtil;
+
+public class WSASClientDefaultingCommand extends AbstractDataModelOperation {
+
+ DataModel model;
+ private IWebServiceClient ws;
+ IStatus status;
+
+ public WSASClientDefaultingCommand(DataModel model, IWebServiceClient ws){
+ this.model=model;
+ this.ws=ws;
+ }
+
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ //Default Settings for the Codegeneration
+ model.setWsdlURI(ws.getWebServiceClientInfo().getWsdlURL());
+ model.setDatabindingType(WSASConsumptionUIMessages.DATA_BINDING_ADB);
+ model.setASync(true);
+ model.setSync(true);
+
+ DefaultCodegenUtil defaultCodegenUtil = new DefaultCodegenUtil(model);
+ defaultCodegenUtil.populateModelParamsFromWSDL();
+
+ status = Status.OK_STATUS;
+ return status;
+ }
+
+ public DataModel getWebServiceDataModel(){
+ return model;
+ }
+
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASWebservicesServerCommand.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/command/WSASWebservicesServerCommand.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,88 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.command;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.common.environment.IEnvironment;
+import org.eclipse.wst.common.environment.IStatusHandler;
+import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
+import org.wso2.wsf.wtp.consumption.core.data.DataModel;
+import org.wso2.wsf.wtp.consumption.core.messages.WSASConsumptionUIMessages;
+import org.wso2.wsf.wtp.consumption.core.utils.ContentCopyUtils;
+import org.wso2.wsf.wtp.consumption.core.utils.FileUtils;
+
+public class WSASWebservicesServerCommand extends
+AbstractDataModelOperation {
+
+ String project;
+ DataModel model;
+ public WSASWebservicesServerCommand(DataModel model, String project){
+ this.model=model;
+ this.project = project;
+ }
+
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ //Copy the axis2 libs in to this client project
+ IStatus status = Status.OK_STATUS;
+ IEnvironment environment = getEnvironment();
+ IStatusHandler statusHandler = environment.getStatusHandler();
+
+ String web_infLib[] \
={WSASConsumptionUIMessages.DIR_WEB_INF,WSASConsumptionUIMessages.DIR_LIB}; +
+
+ String workspaceDirectory = ResourcesPlugin.getWorkspace().getRoot()
+ .getLocation().toOSString();
+ String currentDynamicWebProjectDir = \
FileUtils.addAnotherNodeToPath(workspaceDirectory, + project);
+ model.setWebProjectName(project);
+
+ // Location of the axis2 plugin to copy tho the current project
+ String correctUserDir = \
Platform.getInstallLocation().getURL().getPath().toString(); +
+ //TODO The Web content directory can be different. cater that also
+ String webContainerDirString = \
FileUtils.addAnotherNodeToPath(currentDynamicWebProjectDir, \
+ WSASConsumptionUIMessages.DIR_WEBCONTENT); +// String webContainerLibDirString \
= FileUtils.addAnotherNodeToPath(webContainerDirString, \
+// WSASConsumptionUIMessages.WEB_INF_LIB); + String \
webContainerLibDirString = FileUtils.addNodesToPath(webContainerDirString, \
web_infLib); +
+// String axis2LibLocation = FileUtils.addAnotherNodeToPath(correctUserDir,
+// WSASConsumptionUIMessages.PATH_TO_AXIS2_LIBS);
+
+
+ String axis2plugin[] = \
{WSASConsumptionUIMessages.AXIS2_PLUGIN,WSASConsumptionUIMessages.DIR_AXIS2}; \
+ String axis2ProjectDir = FileUtils.addNodesToPath(workspaceDirectory, \
axis2plugin); + String axis2LibLocation = FileUtils.addNodesToPath(axis2ProjectDir, \
web_infLib); +
+
+
+
+ ContentCopyUtils contentCopyUtils = new ContentCopyUtils();
+ status = contentCopyUtils.copyDirectoryRecursivelyIntoWorkspace(axis2LibLocation,
+ webContainerLibDirString,
+ monitor,
+ statusHandler);
+ return status;
+ }
+
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/data/DataModel.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/data/DataModel.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,114 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.data;
+
+public class DataModel extends Model{
+
+ //Consumption DataModel Parameters
+ private String webProjectName;
+ private String serviceClass;
+ private String databindingType;
+ private String namespaseToPackageMapping;
+ private boolean Sync;
+ private boolean ASync;
+ private boolean generateAllCheck;
+ private boolean testCaseCheck;
+
+
+ public String getDatabindingType() {
+ return databindingType;
+ }
+ public void setDatabindingType(String databindingType) {
+ this.databindingType = databindingType;
+ }
+ public boolean isGenerateAllCheck() {
+ return generateAllCheck;
+ }
+ public void setGenerateAllCheck(boolean generateAllCheck) {
+ this.generateAllCheck = generateAllCheck;
+ }
+ public String getNamespaseToPackageMapping() {
+ return namespaseToPackageMapping;
+ }
+ public void setNamespaseToPackageMapping(String namespaseToPackageMapping) {
+ this.namespaseToPackageMapping = namespaseToPackageMapping;
+ }
+
+ public String getPackageText() {
+ return super.getPackageText();
+ }
+
+ public void setPackageText(String packageText) {
+ super.setPackageText(packageText);
+ }
+
+ public String getPortName() {
+ return super.getPortName();
+ }
+
+ public void setPortName(String portName) {
+ super.setPortName(portName);
+ }
+
+ public String getServiceClass() {
+ return serviceClass;
+ }
+ public void setServiceClass(String serviceClass) {
+ this.serviceClass = serviceClass;
+ }
+
+ public String getServiceName() {
+ return super.getServiceName();
+ }
+
+ public void setServiceName(String serviceName) {
+ super.setServiceName(serviceName);
+ }
+
+ public String getWsdlURI() {
+ return super.getWsdlURI();
+ }
+
+ public void setWsdlURI(String wsdlURI) {
+ super.setWsdlURI(wsdlURI);
+ }
+
+ public String getWebProjectName() {
+ return webProjectName;
+ }
+ public void setWebProjectName(String webProjectName) {
+ this.webProjectName = webProjectName;
+ }
+ public boolean isASync() {
+ return ASync;
+ }
+ public void setASync(boolean sync) {
+ ASync = sync;
+ }
+ public boolean isSync() {
+ return Sync;
+ }
+ public void setSync(boolean sync) {
+ Sync = sync;
+ }
+ public boolean isTestCaseCheck() {
+ return testCaseCheck;
+ }
+ public void setTestCaseCheck(boolean testCaseCheck) {
+ this.testCaseCheck = testCaseCheck;
+ }
+
+}
\ No newline at end of file
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/data/Model.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/data/Model.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,57 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.data;
+
+public class Model {
+
+ private boolean serverStatus;
+ private String wsdlURI;
+ private String portName;
+ private String serviceName;
+ private String packageText;
+
+ public String getPackageText() {
+ return packageText;
+ }
+ public void setPackageText(String packageText) {
+ this.packageText = packageText;
+ }
+ public String getPortName() {
+ return portName;
+ }
+ public void setPortName(String portName) {
+ this.portName = portName;
+ }
+ public String getServiceName() {
+ return serviceName;
+ }
+ public void setServiceName(String serviceName) {
+ this.serviceName = serviceName;
+ }
+ public String getWsdlURI() {
+ return wsdlURI;
+ }
+ public void setWsdlURI(String wsdlURI) {
+ this.wsdlURI = wsdlURI;
+ }
+ public boolean getServerStatus() {
+ return serverStatus;
+ }
+ public void setServerStatus(boolean b) {
+ this.serverStatus = b;
+ }
+
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/messages/WSASConsumptionUI.properties
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/messages/WSASConsumptionUI.properties Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,80 @@
+###############################################################################
+# Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+#
+# 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.
+###############################################################################
+
+LABEL_SERVICE_NAME_CAPTION=Service Name
+LABEL_GENERATE_TESTCASE_CAPTION=Generate test case
+LABEL_DATABINDING_CAPTION=Databinding Name
+LABEL_PORTNAME=Port Name
+LABEL_GENERATE_ALL=Generate All
+LABEL_PACKEGE_NAME=Custom package name
+LABEL_NAMESPACE=Namespace
+LABEL_PACKAGE=Package
+LABEL_NAMESPACE_TO_PACKAGE=Namespace to package mappings
+LABEL_CLIENT_SIDE=Client mode
+LABEL_SYNC_AND_ASYNC=Generate both sync and async
+LABEL_SYNC=Generate sync style only
+LABEL_ASYNC=Generate async style only
+LABEL_DATA_MODEL=WebServiceDataModel
+
+ERROR_WSDL_NOT_FOUND=Specified WSDL is not found!, Please Check whether you have \
entered the correct path to a *.wsdl on previous page. +ERROR_WSDL_INVALID=Specified \
WSDL is invalid!, Please select a validated *.wsdl/*.xml file on previous page. \
+ERROR_NO_PORTS_IN_SERVICE=No ports found in the specified service \
+ERROR_CODEGEN_EXCEPTION=Exception occured while code generation the wsdl +
+MSG_ERROR_DEFAULT=error occured during the operation
+TOOLTIP_PPAE_PAGE=test tooltip
+BUTTON_ALL_WANTED=test button
+
+PAGE_TITLE_WS_WSAS_PROXY=WSAS Client Creation Preference
+PAGE_DESC_WS_WSAS_PROXY=Please select the appropriate Codegen settings
+
+DATA_BINDING_ADB=ADB
+DATA_BINDING_NONE=NONE
+
+DIR_META_INF=META-INF
+DIR_BUILD=build
+DIR_SRC=src
+DIR_LIB=lib
+DIR_CLASSES=classes
+DIR_RESOURCES=resources
+DIR_AAR=aar
+DIR_WEB_INF=WEB-INF
+DIR_SERVICES=services
+DIR_WEBSERVICES=webservices
+DIR_WEBCONTENT=WebContent
+DIR_WORKSPACE=workspace
+DIR_AXIS2=axis2
+DIR_PLUGINS=plugins
+DIR_DOT_METADATA=.metadata
+DIR_DOT_PLUGINS=.plugins
+DIR_LIB=lib
+
+ERROR_INVALID_FILE_READ_WRITEL=Exception occured while file read wrote
+ERROR_INVALID_WSDL_FILE_READ_WRITEL=Exception occured while wsdl file read wrote
+
+#AXIS2_RUNTIME=org.apache.axis2_1.0.0
+AXIS2_RUNTIME=org.apache.axis2
+AXIS2_PROJECT=org.eclipse.jst.ws.axis2
+#PATH_TO_AXIS2_LIBS=/workspace/org.apache.axis2/axis2/WEB-INF/lib
+PATH_TO_AXIS2_LIBS=/plugins/org.apache.axis2_1.0.0/axis2/WEB-INF/lib
+USER_WORK_DIRECTORY=user.dir
+SPLIT_WORKSPACE=/workspace
+WEB_INF_LIB=/WEB-INF/lib
+CODEGEN_RESULTS=codegen
+
+AXIS2_PLUGIN=org.apache.axis2
+
+
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/messages/WSASConsumptionUIMessages.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/messages/WSASConsumptionUIMessages.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,91 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public final class WSASConsumptionUIMessages extends NLS {
+
+ private static final String BUNDLE_NAME = \
"org.wso2.wsf.wtp.consumption.core.messages.WSASConsumptionUI";//$NON-NLS-1$ +
+ private WSASConsumptionUIMessages() {
+ // Do not instantiate
+ }
+
+ public static String LABEL_SERVICE_NAME_CAPTION;
+ public static String LABEL_GENERATE_TESTCASE_CAPTION;
+ public static String LABEL_DATABINDING_CAPTION;
+ public static String LABEL_PORTNAME;
+ public static String LABEL_GENERATE_ALL;
+ public static String LABEL_PACKEGE_NAME;
+ public static String LABEL_NAMESPACE;
+ public static String LABEL_PACKAGE;
+ public static String LABEL_NAMESPACE_TO_PACKAGE;
+ public static String LABEL_CLIENT_SIDE;
+ public static String LABEL_SYNC_AND_ASYNC;
+ public static String LABEL_SYNC;
+ public static String LABEL_ASYNC;
+ public static String LABEL_DATA_MODEL;
+
+ public static String MSG_ERROR_DEFAULT;
+
+ public static String PAGE_TITLE_WS_AXIS2_PROXY;
+ public static String PAGE_DESC_WS_AXIS2_PROXY;
+
+
+
+ public static String TOOLTIP_PPAE_PAGE;
+ public static String BUTTON_ALL_WANTED;
+
+ public static String DIR_DYNAMIC_PROJECT_WEBSERVICES;
+ public static String DIR_BUILD;
+ public static String DIR_SRC;
+ public static String DIR_CLASSES;
+ public static String DIR_RESOURCES;
+ public static String DIR_AAR;
+ public static String DIR_META_INF;
+ public static String DIR_WEB_INF;
+ public static String DIR_SERVICES;
+ public static String DIR_WEBSERVICES;
+ public static String DIR_WEBCONTENT;
+ public static String DIR_WORKSPACE;
+ public static String DIR_AXIS2;
+ public static String DIR_PLUGINS;
+ public static String DIR_DOT_METADATA;
+ public static String DIR_DOT_PLUGINS;
+ public static String DIR_LIB;
+
+ public static String ERROR_INVALID_FILE_READ_WRITEL;
+ public static String ERROR_INVALID_WSDL_FILE_READ_WRITEL;
+ public static String ERROR_CODEGEN_EXCEPTION;
+
+ public static String AXIS2_RUNTIME;
+ public static String AXIS2_PROJECT;
+ public static String PATH_TO_AXIS2_LIBS;
+ public static String USER_WORK_DIRECTORY;
+ public static String SPLIT_WORKSPACE;
+ public static String WEB_INF_LIB;
+ public static String CODEGEN_RESULTS;
+
+ public static String DATA_BINDING_ADB;
+ public static String DATA_BINDING_NONE;
+
+ public static String AXIS2_PLUGIN;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, WSASConsumptionUIMessages.class);
+ }
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/sr \
c/org/wso2/wsf/wtp/consumption/core/plugin/WebServiceWSASConsumptionCorePlugin.java \
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/o \
rg/wso2/wsf/wtp/consumption/core/plugin/WebServiceWSASConsumptionCorePlugin.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,65 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.plugin;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class WebServiceWSASConsumptionCorePlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.wso2.wsf.wtp.consumption.core.plugin";
+
+ // The shared instance
+ private static WebServiceWSASConsumptionCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public WebServiceWSASConsumptionCorePlugin() {
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static WebServiceWSASConsumptionCorePlugin getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/ContentCopyUtils.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/ContentCopyUtils.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,128 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jst.ws.internal.plugin.WebServicePlugin;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.eclipse.wst.command.internal.env.core.context.ResourceContext;
+import org.eclipse.wst.common.environment.IStatusHandler;
+import org.wso2.wsf.wtp.consumption.core.messages.WSASConsumptionUIMessages;
+
+public class ContentCopyUtils {
+
+ private List fileAndDirectoriesList = new ArrayList();
+ FileInputStream finStream = null;
+
+ /**
+ * This method will copy the source directory into the eclipse workspace according \
to the Eclipse Framework API + * @param sourceDir
+ * @param destinationDir
+ * @param monitor
+ * @param statusHandler
+ * @return
+ */
+ public IStatus copyDirectoryRecursivelyIntoWorkspace(String sourceDir, String \
destinationDir,IProgressMonitor monitor,IStatusHandler statusHandler) { + IStatus \
status = Status.OK_STATUS; + fileAndDirectoriesList.clear();
+ File axis2WebappFolder = new File(sourceDir);
+ visitAllDirsAndFiles(axis2WebappFolder);
+ List deployFiles = new ArrayList();
+ deployFiles= fileAndDirectoriesList;
+
+ try {
+
+ //Import the axis2 dependency plugin according to the Resources API of eclipse
+ ResourceContext context = WebServicePlugin.getInstance().getResourceContext();
+
+ IPath outputPath = new Path (destinationDir);
+
+ String fileName;
+ IPath targetPath=null;
+ boolean isDirectory = false;
+
+ String deployFile;
+ Iterator iterator;
+
+ String tempOutputDir = axis2WebappFolder.toString();
+ iterator = deployFiles.iterator();
+ while (iterator.hasNext()) {
+ deployFile = (String) iterator.next();
+ File source = new File(deployFile);
+ if (source.isDirectory()) {
+ isDirectory =true;
+ }else{
+ isDirectory=false;
+ finStream = new FileInputStream(source);
+ }
+
+ if (deployFile.startsWith(tempOutputDir)) {
+ fileName = deployFile.substring(tempOutputDir.length());
+ targetPath = outputPath.append(fileName).makeAbsolute();
+ if (isDirectory){
+ org.eclipse.wst.command.internal.env.common.FileResourceUtils.makeFolderPathAtLocation(context, \
+ targetPath,
+ monitor,
+ statusHandler);
+ }else{
+ if (finStream != null) {
+ org.eclipse.wst.command.internal.env.common.FileResourceUtils.createFileAtLocation(context, \
+ targetPath,
+ finStream,
+ monitor,
+ statusHandler);
+ }
+ finStream.close();
+ }
+ }
+ }
+ } catch (IOException e) {
+ status = StatusUtils.errorStatus(NLS.bind(WSASConsumptionUIMessages.ERROR_INVALID_FILE_READ_WRITEL,new \
String[]{e.getLocalizedMessage()}), e); + } catch (CoreException e) {
+ status = StatusUtils.errorStatus(NLS.bind(WSASConsumptionUIMessages.ERROR_INVALID_FILE_READ_WRITEL,new \
String[]{e.getLocalizedMessage()}), e); + }
+
+ return status;
+
+ }
+
+ // Process all files and directories under dir
+ private void visitAllDirsAndFiles(File dir) {
+
+ fileAndDirectoriesList.add(dir.getAbsolutePath());
+
+ if (dir.isDirectory()) {
+ String[] children = dir.list();
+ for (int i=0; i<children.length; i++) {
+ visitAllDirsAndFiles(new File(dir, children[i]));
+ }
+ }
+ }
+
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/DefaultCodegenUtil.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/DefaultCodegenUtil.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,93 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.utils;
+
+import java.util.List;
+
+import javax.wsdl.WSDLException;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.wst.command.internal.env.core.common.StatusUtils;
+import org.wso2.wsf.wtp.consumption.core.data.Model;
+import org.wso2.wsf.wtp.consumption.core.messages.WSASConsumptionUIMessages;
+
+public class DefaultCodegenUtil {
+
+ private WSDLPropertyReader reader;
+ private Model model;
+ private List serviceQNameList = null;
+ IStatus status;
+
+ public DefaultCodegenUtil(org.wso2.wsf.wtp.consumption.core.data.DataModel model){
+ this.model=model;
+ }
+
+ public DefaultCodegenUtil(org.wso2.wsf.wtp.creation.core.data.DataModel model){
+ this.model=model;
+ }
+
+ /**
+ * populate the model for the default scenario from the wsdl url
+ */
+ public void populateModelParamsFromWSDL() {
+ status = Status.OK_STATUS;
+ if (reader == null)
+ reader = new WSDLPropertyReader();
+ try {
+ String lname = model.getWsdlURI();
+ if (!"".equals(lname.trim())) {
+
+ reader.readWSDL(lname);
+
+ this.serviceQNameList = reader.getServiceList();
+ if (!serviceQNameList.isEmpty()) {
+ // add the local part of the
+ model.setServiceName((((QName) serviceQNameList.get(0))
+ .getLocalPart()));
+
+ // load the ports
+ loadPortNames();
+
+ }
+
+ populatePackageName();
+
+ //populate the namespacess
+ //loadNamespaces(reader.getDefinitionNamespaceMap());
+ }
+ } catch (WSDLException e) {
+ status = StatusUtils.errorStatus(NLS.bind(
+ WSASConsumptionUIMessages.ERROR_INVALID_WSDL_FILE_READ_WRITEL,
+ new String[]{e.getLocalizedMessage()}), e);
+ }
+ }
+
+
+ private void loadPortNames() {
+ java.util.List ports = reader.getPortNameList((QName) serviceQNameList
+ .get(0));
+ // add the local part of the
+ model.setPortName(ports.get(0).toString());
+ }
+
+ private void populatePackageName() {
+ model.setPackageText(reader.packageFromTargetNamespace());
+ }
+
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/FileUtils.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/FileUtils.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,172 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class FileUtils
+{
+ public FileUtils(){
+ super();
+ }
+
+ public static void copyFile(String src, String dest) {
+ InputStream is = null;
+ FileOutputStream fos = null;
+
+ try
+ {
+ is = new FileInputStream(src);
+ fos = new FileOutputStream(dest);
+ int c = 0;
+ byte[] array = new byte[1024];
+ while ((c = is.read(array)) >= 0){
+ fos.write(array, 0, c);
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+ try {
+ fos.close();
+ is.close();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static File createFileAndParentDirectories(String fileName) throws Exception \
{ + File file = new File(fileName);
+ File parent = file.getParentFile();
+ if (!parent.exists()){
+ parent.mkdirs();
+ }
+ file.createNewFile();
+ return file;
+ }
+
+ public static void deleteDirectories(File dir) {
+ File[] children = dir.listFiles();
+ for (int i = 0; i < children.length; i++){
+ if (children[i].list() != null && children[i].list().length > 0){
+ deleteDirectories(children[i]);
+ }
+ else{
+ children[i].delete();
+ }
+ }
+ dir.delete();
+ }
+
+ public static void deleteDirectories(String dir) {
+ File directory = new File(dir);
+ deleteDirectories(directory);
+ }
+
+ public static void createTargetFile(String sourceFileName, String targetFileName) \
throws Exception { + createTargetFile(sourceFileName, targetFileName, false);
+ }
+
+ public static void createTargetFile(String sourceFileName, String targetFileName, \
boolean overwrite) throws Exception{ + File idealResultFile = new \
File(targetFileName); + if (overwrite || !idealResultFile.exists())
+ {
+ FileUtils.createFileAndParentDirectories(targetFileName);
+ FileUtils.copyFile(sourceFileName, targetFileName);
+ }
+ }
+
+ public static boolean createDirectory(String directory){
+ // Create a directory; all ancestor directories must exist
+ boolean success = (new File(directory)).mkdir();
+ if (!success) {
+ // Directory creation failed
+ }
+ return success;
+ }
+
+ public static boolean createDirectorys(String directory){
+ // Create a directory; all ancestor directories must exist
+ boolean success = (new File(directory)).mkdirs();
+ if (!success) {
+ // Directory creation failed
+ }
+ return success;
+ }
+
+ //Copies all files under srcDir to dstDir.
+ // If dstDir does not exist, it will be created.
+ public static void copyDirectory(File srcDir, File dstDir) throws IOException {
+ if (srcDir.isDirectory()) {
+ if (!dstDir.exists()) {
+ dstDir.mkdir();
+ }
+
+ String[] children = srcDir.list();
+ for (int i=0; i<children.length; i++) {
+ copyDirectory(new File(srcDir, children[i]),
+ new File(dstDir, children[i]));
+ }
+ } else {
+ copy(srcDir, dstDir);
+ }
+ }
+
+ //Copies src file to dst file.
+ // If the dst file does not exist, it is created
+ public static void copy(File src, File dst) throws IOException {
+ InputStream in = new FileInputStream(src);
+ OutputStream out = new FileOutputStream(dst);
+
+ // Transfer bytes from in to out
+ byte[] buf = new byte[1024];
+ int len;
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ in.close();
+ out.close();
+ }
+
+ public static String addAnotherNodeToPath(String currentPath, String newNode) {
+ return currentPath + File.separator + newNode;
+ }
+
+ public static String addNodesToPath(String currentPath, String[] newNode) {
+ String returnPath=currentPath;
+ for (int i = 0; i < newNode.length; i++) {
+ returnPath = returnPath + File.separator + newNode[i];
+ }
+ return returnPath;
+ }
+
+ public static String addNodesToPath(StringBuffer currentPath, String[] pathNodes) {
+ for (int i = 0; i < pathNodes.length; i++){
+ currentPath.append(File.separator);
+ currentPath.append(pathNodes[i]);
+ }
+ return currentPath.toString();
+ }
+
+}
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/WSDL2JavaGenerator.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/WSDL2JavaGenerator.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,248 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.utils;
+
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
+import org.apache.axis2.util.CommandLineOption;
+import org.apache.axis2.util.CommandLineOptionConstants;
+import javax.wsdl.WSDLException;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+
+public class WSDL2JavaGenerator {
+
+ /**
+ * 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 WSAS code generator.
+ * @return a Map with keys from CommandLineOptionConstants with the values \
entered + * by the user on the Options Page.
+ */
+ public Map fillOptionMap(boolean isAyncOnly,
+ boolean isSyncOnly,
+ boolean isServerSide,
+ boolean isServerXML,
+ boolean isTestCase,
+ boolean isGenerateAll,
+ String serviceName,
+ String portName,
+ String databindingName,
+ String WSDLURI,
+ String packageName,
+ String selectedLanguage,
+ String outputLocation,
+ String namespace2packageList,
+ boolean isServerSideInterface
+ ){
+ Map optionMap = new HashMap();
+ //WSDL file name
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION, \
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION,
+ getStringArray(WSDLURI)));
+
+ //Async only
+ if (isAyncOnly)
+ {
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION, \
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_ASYNC_ONLY_OPTION,
+ new String[0]));
+ }
+ //sync only
+ if (isSyncOnly)
+ {
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION, \
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.CODEGEN_SYNC_ONLY_OPTION,
+ new String[0]));
+ }
+ //serverside
+ if (isServerSide)
+ {
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION, \
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_CODE_OPTION,
+ new String[0]));
+ //server xml
+ 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 (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.WSDL2JavaConstants.PACKAGE_OPTION,
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION,
+ getStringArray(packageName)));
+ //selected language
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION,
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.STUB_LANGUAGE_OPTION,
+ getStringArray(mapLanguagesWithCombo(selectedLanguage))));
+ //output location
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION,
+ getStringArray(outputLocation)));
+
+ //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)));
+ }
+ //ns2pkg mapping
+ if (namespace2packageList!= null){
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION,
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.NAME_SPACE_TO_PACKAGE_OPTION
+ , getStringArray(namespace2packageList)));
+ }
+
+ //server side interface mapping
+ if (isServerSideInterface){
+ optionMap.put(CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION,
+ new CommandLineOption(
+ CommandLineOptionConstants.WSDL2JavaConstants.SERVER_SIDE_INTERFACE_OPTION,
+ new String[0]));
+ }
+ return optionMap;
+
+ }
+
+ public String getBaseUri(String wsdlURI){
+
+ 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);
+ }
+ }
+ /**
+ * 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 WSDLException when WSDL File is invalid
+ * @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);
+ }if (wsdlURI.indexOf(":/")==-1){
+ url = new URL("file","",wsdlURI);
+ }
+ else{
+ url = new URL(wsdlURI);
+ }
+
+ //FIXME @author soi -
+ // This quick fix assume that the wsdlURI points to a wsdl 1.1 version.
+ // A better fix should be to determine which builder to use based on the wsdl \
version. + // The current implementation of the wsdl builder classes did not allow \
for this. + // I will suggestthat the determination of which builder to use should \
be done in + // the builder classes, preferably in the parent builder class. \
Accessable through a + // static reference to a method like \
getBuilderInstance(String wsdlURI) in the parent + //builder class or through a \
builder Abstract Factor or Abstract factory methods. +
+ WSDL11ToAxisServiceBuilder builder = new \
WSDL11ToAxisServiceBuilder(url.openConnection() \
+ .getInputStream()); + builder.setBaseUri(getBaseUri(wsdlURI));
+ return builder.populateService();
+ }
+
+ /**
+ * 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;
+ }
+}
+
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/WSDLPropertyReader.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/consumption/core/utils/WSDLPropertyReader.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,110 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.consumption.core.utils;
+
+import org.apache.axis2.util.URLProcessor;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.WSDLException;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * This class presents a convenient way of reading the
+ * WSDL file(url) and producing a useful set of information
+ * It does NOT use any of the standard WSDL classes from
+ * WSAS, rather it uses wsdl4j to read the wsdl and extract
+ * the properties (This is meant as a convenience for the UI
+ * only. We may not need the whole conversion the WSDLpump
+ * goes through)
+ * One would need to change this to suit a proper WSDL
+ */
+public class WSDLPropertyReader {
+ private Definition wsdlDefinition = null;
+
+ public void readWSDL(String filepath) throws WSDLException {
+ WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ wsdlDefinition = reader.readWSDL(filepath);
+ }
+
+ /**
+ * Returns the namespace map from definition
+ * @return
+ */
+ public Map getDefinitionNamespaceMap(){
+ return wsdlDefinition.getNamespaces();
+ }
+
+ /**
+ * get the default package derived by the targetNamespace
+ */
+ public String packageFromTargetNamespace(){
+ return URLProcessor.makePackageName(wsdlDefinition.getTargetNamespace());
+
+ }
+
+ /**
+ * Returns a list of service names
+ * the names are QNames
+ * @return
+ */
+ public List getServiceList(){
+ List returnList = new ArrayList();
+ Service service = null;
+ Map serviceMap = wsdlDefinition.getServices();
+ if(serviceMap!=null && !serviceMap.isEmpty()){
+ Iterator serviceIterator = serviceMap.values().iterator();
+ while(serviceIterator.hasNext()){
+ service = (Service)serviceIterator.next();
+ returnList.add(service.getQName());
+ }
+ }
+
+ return returnList;
+ }
+
+ /**
+ * Returns a list of ports for a particular service
+ * the names are QNames
+ * @return
+ */
+ public List getPortNameList(QName serviceName){
+ List returnList = new ArrayList();
+ Service service = wsdlDefinition.getService(serviceName);
+ Port port = null;
+ if(service!=null){
+ Map portMap = service.getPorts();
+ if (portMap!=null && !portMap.isEmpty()){
+ Iterator portIterator = portMap.values().iterator();
+ while(portIterator.hasNext()){
+ port = (Port)portIterator.next();
+ returnList.add(port.getName());
+ }
+ }
+
+ }
+
+ return returnList;
+ }
+}
+
Added: trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/creation/core/data/DataModel.java
==============================================================================
--- (empty file)
+++ trunk/wsf/java/modules/eclipse-wtp-plugins/org.wso2.wsf.wtp.consumption.core/src/org/wso2/wsf/wtp/creation/core/data/DataModel.java Mon \
Apr 16 04:33:17 2007 @@ -0,0 +1,177 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * 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.
+ */
+package org.wso2.wsf.wtp.creation.core.data;
+
+import org.wso2.wsf.wtp.consumption.core.data.Model;
+
+public class DataModel extends Model{
+
+ private String webProjectName;
+
+ //Client Side
+ private String serviceClass;
+ private boolean generateServicesXML;
+ private boolean servicesXML;
+ private boolean generateAAR;
+ private String pathToServicesXML;
+ private String pathToWebServicesTempDir;
+
+ //Server Side
+ private boolean generateServerSideInterface;
+ private boolean serverXMLCheck;
+ private boolean generateAllCheck;
+ private boolean testCaseCheck;
+ private String databindingType;
+ private String namespaseToPackageMapping;
+
+
+ public boolean isGenerateServicesXML(){
+ return generateServicesXML;
+ }
+
+ public void setGenerateServicesXML(boolean generateServicesXML){
+ this.generateServicesXML = generateServicesXML;
+ }
+
+ public String getPathToServicesXML(){
+ return pathToServicesXML;
+ }
+
+ public void setPathToServicesXML(String pathToServicesXML){
+ this.pathToServicesXML = pathToServicesXML;
+ }
+
+ public boolean isGenerateAAR() {
+ return generateAAR;
+ }
+
+ public void setGenerateAAR(boolean generateAAR) {
+ this.generateAAR = generateAAR;
+ }
+
+ public String getWebProjectName() {
+ return webProjectName;
+ }
+
+ public void setWebProjectName(String webProjectName) {
+ this.webProjectName = webProjectName;
+ }
+
+ public boolean isServicesXML() {
+ return servicesXML;
+ }
+
+ public void setServicesXML(boolean servicesXML) {
+ this.servicesXML = servicesXML;
+ }
+
+ public String getPathToWebServicesTempDir() {
+ return pathToWebServicesTempDir;
+ }
+
+ public void setPathToWebServicesTempDir(String pathToWebServicesTempDir) {
+ this.pathToWebServicesTempDir = pathToWebServicesTempDir;
+ }
+
+ public String getWsdlURI() {
+ return super.getWsdlURI();
+ }
+
+ public void setWsdlURI(String wsdlURI) {
+ super.setWsdlURI(wsdlURI);
+ }
+
+ public String getDatabindingType() {
+ return databindingType;
+ }
+
+ public void setDatabindingType(String databindingType) {
+ this.databindingType = databindingType;
+ }
+
+ public boolean isGenerateAllCheck() {
+ return generateAllCheck;
+ }
+
+ public void setGenerateAllCheck(boolean generateAllCheck) {
+ this.generateAllCheck = generateAllCheck;
+ }
+
+ public boolean isGenerateServerSideInterface() {
+ return generateServerSideInterface;
+ }
+
+ public void setGenerateServerSideInterface(boolean generateServerSideInterface) {
+ this.generateServerSideInterface = generateServerSideInterface;
+ }
+
+ public String getPortName() {
+ return super.getPortName();
+ }
+
+ public void setPortName(String portName) {
+ super.setPortName(portName);
+ }
+
+ public boolean isServerXMLCheck() {
+ return serverXMLCheck;
+ }
+
+ public void setServerXMLCheck(boolean serverXMLCheck) {
+ this.serverXMLCheck = serverXMLCheck;
+ }
+
+ public String getServiceName() {
+ return super.getServiceName();
+ }
+
+ public void setServiceName(String serviceName) {
+ super.setServiceName(serviceName);
+ }
+
+ public boolean isTestCaseCheck() {
+ return testCaseCheck;
+ }
+
+ public void setTestCaseCheck(boolean testCaseCheck) {
+ this.testCaseCheck = testCaseCheck;
+ }
+
+ public String getPackageText() {
+ return super.getPackageText();
+ }
+
+ public void setPackageText(String packageText) {
+ super.setPackageText(packageText);
+ }
+
+ public String getServiceClass() {
+ return serviceClass;
+ }
+
+ public void setServiceClass(String serviceClass) {
+ this.serviceClass = serviceClass;
+ }
+
+ public String getNamespaseToPackageMapping() {
+ return namespaseToPackageMapping;
+ }
+
+ public void setNamespaseToPackageMapping(String namespaseToPackageMapping) {
+ this.namespaseToPackageMapping = namespaseToPackageMapping;
+ }
+
+}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic