[savara-commits] savara SVN: r484 - in trunk: bundles/org.jboss.savara.bpel/META-INF and 31 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Nov 19 06:47:30 EST 2010


Author: objectiser
Date: 2010-11-19 06:47:22 -0500 (Fri, 19 Nov 2010)
New Revision: 484

Added:
   trunk/bundles/org.jboss.savara.core/
   trunk/bundles/org.jboss.savara.core/.classpath
   trunk/bundles/org.jboss.savara.core/.project
   trunk/bundles/org.jboss.savara.core/.settings/
   trunk/bundles/org.jboss.savara.core/.settings/org.eclipse.jdt.core.prefs
   trunk/bundles/org.jboss.savara.core/.settings/org.eclipse.pde.core.prefs
   trunk/bundles/org.jboss.savara.core/META-INF/
   trunk/bundles/org.jboss.savara.core/META-INF/MANIFEST.MF
   trunk/bundles/org.jboss.savara.core/build.properties
   trunk/bundles/org.jboss.savara.core/pom.xml
   trunk/bundles/org.jboss.savara.core/src/
   trunk/bundles/org.jboss.savara.core/src/java/
   trunk/bundles/org.jboss.savara.core/src/java/org/
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/core/
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/core/osgi/
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/core/osgi/Activator.java
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/resources/
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/resources/Resource.java
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/util/
   trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/util/XMLUtils.java
   trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorFactory.java
   trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/impl/
   trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/impl/WSDLGeneratorImpl.java
   trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/util/WSDLGeneratorUtil.java
Removed:
   trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/util/
   trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/
   trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorUtil.java
   trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/util/XMLUtils.java
   trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/AbstractBuildSystem.java
   trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/AntBuildSystem.java
   trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/BuildSystem.java
   trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/MavenBuildSystem.java
   trunk/tools/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/generator/
Modified:
   trunk/bundles/org.jboss.savara.bpel/META-INF/MANIFEST.MF
   trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/export/BPELLanguageModelStreamExportRule.java
   trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/change/ConversationInteractionModelChangeRule.java
   trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/change/IfModelChangeRule.java
   trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/BPELElement.java
   trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Invoke.java
   trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Process.java
   trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Scope.java
   trunk/bundles/org.jboss.savara.wsdl/META-INF/MANIFEST.MF
   trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGenerator.java
   trunk/bundles/pom.xml
   trunk/tools/features/org.jboss.savara.tools.feature/feature.xml
   trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF
   trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/dialogs/GenerateDialog.java
   trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
   trunk/tools/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
   trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF
   trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util/XMLUtilsTest.java
   trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java
   trunk/tools/tests/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java
Log:
Create savara core OSGi bundle - initially just with XML utils. Change WSDL generator to be an interface with separate factory and implementation. Issue is that WSDL tests are in separate plugin (for Tycho tests), and so need visibility of implementation package.

Modified: trunk/bundles/org.jboss.savara.bpel/META-INF/MANIFEST.MF
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/META-INF/MANIFEST.MF	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.bpel/META-INF/MANIFEST.MF	2010-11-19 11:47:22 UTC (rev 484)
@@ -16,7 +16,8 @@
  org.scribble.expression.xpath;bundle-version="[1.0.0,2.0.0)",
  org.jboss.savara.pi4soa.cdm;resolution:=optional,
  org.jboss.savara.contract.model,
- org.jboss.savara.wsdl
+ org.jboss.savara.wsdl,
+ org.jboss.savara.core
 Scribble-Extensions: org.jboss.savara.bpel.parser.BPELTokenizer,
   org.jboss.savara.bpel.parser.BPELModelParserRule,
   org.jboss.savara.bpel.model.BPELNotation,
@@ -30,5 +31,4 @@
   org.jboss.savara.bpel.model.change.ConversationInteractionModelChangeRule
 Export-Package: org.jboss.savara.bpel.model;x-friends:="org.jboss.savara.tools.bpel.tests",
  org.jboss.savara.bpel.model.change;x-friends:="org.jboss.savara.tools.bpel.tests",
- org.jboss.savara.bpel.model.component;x-friends:="org.jboss.savara.tools.bpel.tests",
- org.jboss.savara.bpel.util;x-friends:="org.jboss.savara.tools.bpel.tests"
+ org.jboss.savara.bpel.model.component;x-friends:="org.jboss.savara.tools.bpel.tests"

Modified: trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/export/BPELLanguageModelStreamExportRule.java
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/export/BPELLanguageModelStreamExportRule.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/export/BPELLanguageModelStreamExportRule.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -21,7 +21,7 @@
 
 import org.jboss.savara.bpel.model.BPELLanguageModel;
 import org.jboss.savara.bpel.model.BPELNotation;
-import org.jboss.savara.bpel.util.XMLUtils;
+import org.jboss.savara.util.XMLUtils;
 import org.scribble.export.ExportRule;
 import org.scribble.export.ExporterContext;
 import org.scribble.export.Formatter;

Modified: trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/change/ConversationInteractionModelChangeRule.java
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/change/ConversationInteractionModelChangeRule.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/change/ConversationInteractionModelChangeRule.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -22,7 +22,7 @@
 import org.jboss.savara.bpel.model.*;
 import org.jboss.savara.bpel.model.component.*;
 import org.jboss.savara.bpel.model.util.*;
-import org.jboss.savara.wsdl.generator.WSDLGeneratorUtil;
+import org.jboss.savara.wsdl.util.WSDLGeneratorUtil;
 import org.scribble.model.*;
 import org.scribble.model.change.*;
 import org.jboss.savara.contract.model.Contract;

Modified: trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/change/IfModelChangeRule.java
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/change/IfModelChangeRule.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/change/IfModelChangeRule.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -22,7 +22,7 @@
 import org.jboss.savara.bpel.model.*;
 import org.jboss.savara.bpel.model.component.*;
 import org.jboss.savara.bpel.model.util.InteractionUtil;
-import org.jboss.savara.wsdl.generator.WSDLGeneratorUtil;
+import org.jboss.savara.wsdl.util.WSDLGeneratorUtil;
 import org.scribble.model.*;
 import org.scribble.model.change.*;
 import org.jboss.savara.contract.model.Contract;

Modified: trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/BPELElement.java
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/BPELElement.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/BPELElement.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -21,7 +21,7 @@
 import org.scribble.model.admin.ModelListener;
 import org.apache.commons.logging.*;
 import org.jboss.savara.bpel.model.*;
-import org.jboss.savara.bpel.util.XMLUtils;
+import org.jboss.savara.util.XMLUtils;
 
 /**
  * This is the generic BPEL element class.

Modified: trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Invoke.java
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Invoke.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Invoke.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -22,7 +22,7 @@
 import org.scribble.model.admin.ModelListener;
 import org.jboss.savara.bpel.model.*;
 import org.jboss.savara.bpel.model.util.TypeReferenceUtil;
-import org.jboss.savara.bpel.util.XMLUtils;
+import org.jboss.savara.util.XMLUtils;
 
 /**
  * This class represents an unsupported (or custom) action within

Modified: trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Process.java
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Process.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Process.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -30,7 +30,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.jboss.savara.bpel.model.*;
 import org.jboss.savara.bpel.model.util.InteractionUtil;
-import org.jboss.savara.bpel.util.XMLUtils;
+import org.jboss.savara.util.XMLUtils;
 
 /**
  * This class represents a BPEL process.

Modified: trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Scope.java
===================================================================
--- trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Scope.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.bpel/src/java/org/jboss/savara/bpel/model/component/Scope.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -22,7 +22,7 @@
 import org.scribble.model.admin.ModelListener;
 import org.jboss.savara.bpel.model.*;
 import org.jboss.savara.bpel.model.util.InteractionUtil;
-import org.jboss.savara.bpel.util.XMLUtils;
+import org.jboss.savara.util.XMLUtils;
 
 /**
  * This class represents a scope grouping activity.

Added: trunk/bundles/org.jboss.savara.core/.classpath
===================================================================
--- trunk/bundles/org.jboss.savara.core/.classpath	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/.classpath	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src/java"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: trunk/bundles/org.jboss.savara.core/.project
===================================================================
--- trunk/bundles/org.jboss.savara.core/.project	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/.project	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.jboss.savara.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/bundles/org.jboss.savara.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/bundles/org.jboss.savara.core/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/.settings/org.eclipse.jdt.core.prefs	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,8 @@
+#Thu Nov 18 14:28:42 GMT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Added: trunk/bundles/org.jboss.savara.core/.settings/org.eclipse.pde.core.prefs
===================================================================
--- trunk/bundles/org.jboss.savara.core/.settings/org.eclipse.pde.core.prefs	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/.settings/org.eclipse.pde.core.prefs	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,5 @@
+#Thu Nov 18 14:28:45 GMT 2010
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false

Added: trunk/bundles/org.jboss.savara.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/bundles/org.jboss.savara.core/META-INF/MANIFEST.MF	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/META-INF/MANIFEST.MF	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: JBoss SAVARA Core
+Bundle-SymbolicName: org.jboss.savara.core
+Bundle-Version: 1.2.0.qualifier
+Bundle-Activator: org.jboss.savara.core.osgi.Activator
+Bundle-Vendor: www.savara.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.osgi.framework;version="1.3.0"
+Require-Bundle: org.scribble.core;bundle-version="[1.0.0,2.0.0)"
+Export-Package: org.jboss.savara.util

Added: trunk/bundles/org.jboss.savara.core/build.properties
===================================================================
--- trunk/bundles/org.jboss.savara.core/build.properties	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/build.properties	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,4 @@
+source.. = src/java/
+output.. = bin/
+bin.includes = META-INF/,\
+               .

Added: trunk/bundles/org.jboss.savara.core/pom.xml
===================================================================
--- trunk/bundles/org.jboss.savara.core/pom.xml	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/pom.xml	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.jboss.savara.bundles</groupId>
+	<artifactId>org.jboss.savara.core</artifactId> 
+	<version>1.2.0-SNAPSHOT</version>
+	<packaging>eclipse-plugin</packaging>
+	<name>Savara::Bundles::Core</name>
+
+	<parent>
+		<groupId>org.jboss.savara</groupId>
+		<artifactId>bundles</artifactId>
+		<version>1.2.0-SNAPSHOT</version>
+	</parent>
+  
+</project>

Added: trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/core/osgi/Activator.java
===================================================================
--- trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/core/osgi/Activator.java	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/core/osgi/Activator.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,30 @@
+package org.jboss.savara.core.osgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+	private static BundleContext context;
+
+	static BundleContext getContext() {
+		return context;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(BundleContext bundleContext) throws Exception {
+		Activator.context = bundleContext;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext bundleContext) throws Exception {
+		Activator.context = null;
+	}
+
+}

Added: trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/resources/Resource.java
===================================================================
--- trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/resources/Resource.java	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/resources/Resource.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.savara.resources;
+
+/**
+ * This interface represents a context independent resource, that can be used by
+ * Savara capabilities.
+ *
+ */
+public interface Resource {
+
+	/**
+	 * This method returns the resource name.
+	 * 
+	 * @return The resource name
+	 */
+	public String getName();
+	
+	/**
+	 * This method returns an input stream that can be used to read
+	 * the contents of the resource.
+	 * 
+	 * @return The contents as an input stream
+	 * @throws Exception Failed to get the contents
+	 */
+	public java.io.InputStream getContents() throws Exception;
+	
+	/**
+	 * This method sets the contents of the resource based on the information
+	 * contained in the supplied input stream.
+	 * 
+	 * @param is The contents to be written to the resource
+	 * @throws Exception Failed to set the contents
+	 */
+	public void setContents(java.io.InputStream is) throws Exception;
+	
+}

Added: trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/util/XMLUtils.java
===================================================================
--- trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/util/XMLUtils.java	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.core/src/java/org/jboss/savara/util/XMLUtils.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,300 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.savara.util;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.scribble.model.ModelObject;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/**
+ * This class defines a set of XML related utility functions.
+ */
+public final class XMLUtils {
+	
+	private static final String NS_LABEL = "ns";
+
+	/**
+	 * This class converts a DOM representation node to text.
+	 * @param node
+	 * @return
+	 * @throws Exception
+	 */
+	public static final String toText(Node node) throws Exception {
+		String ret = null;
+		try {
+			// Transform the DOM represent to text
+			ByteArrayOutputStream xmlstr= new ByteArrayOutputStream();
+			DOMSource source=new DOMSource(node);
+			//source.setNode(node);
+			
+			StreamResult result=new StreamResult(xmlstr);			
+			Transformer trans= TransformerFactory.newInstance().newTransformer();
+			trans.transform(source, result);
+			
+			xmlstr.close();
+			
+			ret = new String(xmlstr.toByteArray());
+			
+			if ((node instanceof Document) == false) {				
+				// Strip off any <?xml> header
+				int index=ret.indexOf("<?xml");
+				if (index != -1) {
+					index = ret.indexOf("<", 1);
+					if (index != -1) {
+						ret = ret.substring(index);
+					} else {
+						index = ret.indexOf("?>");
+						if (index != -1) {
+							index += 2;
+							
+							// Remove any trailing whitespaces after XML header
+							while (index < ret.length() &&
+									Character.isWhitespace(ret.charAt(index))) {
+								index++;
+							}
+							
+							ret = ret.substring(index);
+						}
+					}
+				}
+			}
+
+		} catch(Exception e) {
+			throw new Exception("Failed to transform DOM representation into text", e);
+		}
+		if (ret != null) {
+			 return format(ret);
+		}
+		return ret;
+	}
+	
+	
+	/**
+	 * Format the xml to well print.
+	 * 
+	 * @param xmltext
+	 * @return
+	 */
+	public static final String format(String xmltext) {
+		String ret=xmltext;
+		int pos=0;
+		int prevpos=0;
+		StringBuffer buf=new StringBuffer();
+		int level=0;
+		
+		while ((pos=ret.indexOf('<', prevpos)) != -1) {
+			
+			if (prevpos < pos &&
+					ret.substring(prevpos, pos).trim().length() > 0 &&
+					ret.charAt(prevpos-1) != '?') {
+				
+				if (ret.charAt(prevpos) == '\r' &&
+						ret.charAt(prevpos+1) == '\n') {
+					prevpos += 2;
+				}
+				for (int i=0; i < level; i++) {
+					buf.append("    ");
+				}
+				
+				buf.append(ret.substring(prevpos, pos).trim());
+				buf.append("\r\n");
+			}
+			
+			int endpos=ret.indexOf('>', pos);
+		
+			if (endpos > 0) {
+				boolean noreturn=false;
+				
+				if (pos > 0 && ret.charAt(pos+1) == '/') {
+					level--;
+				}
+				
+				for (int i=0; i < level; i++) {
+					buf.append("    ");
+				}
+				buf.append(ret.substring(pos, endpos+1));
+				
+				if (ret.charAt(endpos-1)== '?') {
+					//noreturn = true;
+					
+				} else if (ret.charAt(endpos-1) == '/') {
+					// Ignore
+				} else if (pos > 0 && ret.charAt(pos+1) == '/') {
+					// Ignore
+					
+				} else if (pos > 0 && ret.charAt(pos+1) == '!') {
+					// Ignore
+					
+				} else {
+					level++;
+				}
+							
+				if (noreturn == false) {
+					buf.append("\r\n");
+				}
+				
+				pos = endpos+1;
+			}
+			
+			prevpos = pos;
+		}
+		
+		if (prevpos != -1 &&
+				ret.substring(prevpos).trim().length() > 0) {
+			buf.append(ret.substring(prevpos));
+		}
+		
+		ret = buf.toString();
+		
+		return(ret);
+	}
+	
+	public static Node getNode(String text) throws Exception {
+		Node ret=null;
+		
+		// Transform the text representation to DOM
+		DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
+		fact.setNamespaceAware(true);
+		
+		java.io.InputStream xmlstr=
+			new java.io.ByteArrayInputStream(text.getBytes());
+
+		DocumentBuilder builder=fact.newDocumentBuilder();
+		org.w3c.dom.Document doc=builder.parse(xmlstr);
+		
+		ret = doc.getDocumentElement();
+
+		return(ret);
+	}
+
+	/**
+	 * This method returns the localname part of the supplied
+	 * qualified name.
+	 * 
+	 * @param qname The qualified name
+	 * @return The localname part
+	 */
+	public static String getLocalname(String qname) {
+		String ret=qname;
+		int pos=0;
+		
+		if (qname != null && ((pos=qname.indexOf(':')) != -1)) {
+			ret = qname.substring(pos+1);
+		}
+		
+		return(ret);
+	}
+	
+	/**
+	 * This method returns the prefix associated with the supplied namespace.
+	 * 
+	 * @param namespace The namespace
+	 * @param nsMap The existing namespace prefix mappings
+	 * @return The prefix
+	 */
+	public static String getPrefix(String namespace, java.util.Map<String,String> nsMap) {
+		String prefix=null;
+		
+		prefix = nsMap.get(namespace);
+		
+		if (prefix == null) {
+			prefix = NS_LABEL+(nsMap.size()+1);
+			nsMap.put(namespace, prefix);
+		}
+
+		return(prefix);
+	}
+	
+	/**
+	 * This method calculates the start and end position of a supplied DOM element, within
+	 * the supplied text contents, and sets the values on the supplied ModelObject.
+	 * 
+	 * @param obj The ModelObject to be initialized
+	 * @param contents The text contents
+	 * @param elem The DOM element to be located in the text
+	 */
+	public static void setStartAndEndPosition(ModelObject obj, String contents, org.w3c.dom.Element elem) {
+
+		if (contents != null) {
+			org.w3c.dom.NodeList nl=elem.getOwnerDocument().getElementsByTagName(elem.getNodeName());
+			int elempos=-1;
+			
+			for (int i=0; elempos == -1 && i < nl.getLength(); i++) {
+				if (nl.item(i) == elem) {
+					elempos = i;
+				}
+			}
+			
+			if (elempos != -1) {
+				int startpos=-1;
+					
+				for (int i=0; i <= elempos; i++) {
+					int val1=contents.indexOf("<"+elem.getNodeName()+">", startpos+1);
+					int val2=contents.indexOf("<"+elem.getNodeName()+" ", startpos+1);
+					
+					if (val1 == -1 && val2 != -1) {
+						startpos = val2;
+					} else if (val1 != -1 && val2 == -1) {
+						startpos = val1;
+					} else if (val1 == -1 && val2 == -1) {
+						// TODO: Error condition
+						break;
+					} else if (val1 > val2) {
+						startpos = val2;
+					} else {
+						startpos = val1;
+					}
+				}
+				
+				if (startpos != -1) {
+					obj.getSource().setStartPosition(startpos);
+					
+					// Check if single node
+					int p1=contents.indexOf('>', startpos);
+					
+					if (p1 != -1 && contents.charAt(p1-1) == '/') {
+						obj.getSource().setEndPosition(p1);
+					} else {
+					
+						org.w3c.dom.NodeList enl=elem.getElementsByTagName(elem.getNodeName());
+						
+						int endpos=startpos;
+						String nodetxt="</"+elem.getNodeName()+">";
+						
+						for (int i=0; endpos != -1 && i <= enl.getLength(); i++) {
+							endpos = contents.indexOf(nodetxt, endpos+1);
+						}
+						
+						if (endpos != -1) {
+							obj.getSource().setEndPosition(endpos+nodetxt.length()-1);
+						}
+					}
+				}
+			}
+		}
+	}
+}

Modified: trunk/bundles/org.jboss.savara.wsdl/META-INF/MANIFEST.MF
===================================================================
--- trunk/bundles/org.jboss.savara.wsdl/META-INF/MANIFEST.MF	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.wsdl/META-INF/MANIFEST.MF	2010-11-19 11:47:22 UTC (rev 484)
@@ -14,4 +14,6 @@
  org.scribble.eclipse;bundle-version="[1.0.0,2.0.0)",
  org.scribble.conversation.model;bundle-version="[1.0.0,2.0.0)"
 Export-Package: org.jboss.savara.wsdl.generator,
- org.jboss.savara.wsdl.generator.soap
+ org.jboss.savara.wsdl.generator.impl,
+ org.jboss.savara.wsdl.generator.soap,
+ org.jboss.savara.wsdl.util

Modified: trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGenerator.java
===================================================================
--- trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGenerator.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGenerator.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -17,32 +17,12 @@
  */
 package org.jboss.savara.wsdl.generator;
 
-import javax.wsdl.Part;
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jboss.savara.contract.model.FaultDetails;
-import org.jboss.savara.contract.model.Interface;
-import org.jboss.savara.contract.model.Namespace;
-import org.jboss.savara.contract.model.RequestResponseMEP;
-import org.jboss.savara.contract.model.Type;
-import org.jboss.savara.contract.model.TypeDefinition;
-import org.scribble.model.TypeReference;
-
 /**
- * This class generates a WSDL definition from a Contract model.
+ * This interface generates a WSDL definition from a Contract model.
  *
  */
-public class WSDLGenerator {
+public interface WSDLGenerator {
 
-	public static final String BINDING_SUFFIX = "Binding";
-	
-	private static Log logger = LogFactory.getLog(WSDLGenerator.class);
-	
-	public WSDLGenerator() {
-	}
-	
 	/**
 	 * This method generates a WSDL definition from a Scribble contract model.
 	 * 
@@ -50,486 +30,7 @@
 	 * @param wsdlBinding The WSDL binding to use, or null if no binding
 	 * @return The WSDL definition
 	 */
-	public java.util.List<javax.wsdl.Definition> generateDefinitions(org.jboss.savara.contract.model.Contract contract,
-								WSDLBinding wsdlBinding) {
-		java.util.List<javax.wsdl.Definition> ret=new java.util.Vector<javax.wsdl.Definition>();
-		
-		try {
-			// Create definition for contract's target namespace
-			javax.wsdl.Definition main=getDefinition(ret, contract, contract.getNamespace(), wsdlBinding);
-			
-			// If no definition, then return
-			if (main == null) {
-				return(ret);
-			}
-			
-			// Create service
-			javax.wsdl.Service service=main.createService();
-			service.setQName(new javax.xml.namespace.QName(contract.getNamespace(),
-								contract.getName()+"Service"));
+	public java.util.List<javax.wsdl.Definition> generate(org.jboss.savara.contract.model.Contract contract,
+								WSDLBinding wsdlBinding);
 
-			main.addService(service);
-			
-			// Define a port type per interface
-			java.util.Iterator<Interface> iter=contract.getInterfaces().iterator();
-			
-			while (iter.hasNext()) {
-				Interface intf=iter.next();
-				
-				javax.wsdl.PortType portType=
-							createPortType(ret, contract, intf, wsdlBinding);
-				
-				javax.wsdl.Binding binding=
-							createBinding(ret, contract, intf, portType, wsdlBinding);
-				
-				// Create service port for interface
-				javax.wsdl.Port port=main.createPort();
-				
-				port.setName(intf.getName()+"Port");
-				port.setBinding(binding);
-				
-				service.addPort(port);
-				
-				if (wsdlBinding != null) {
-					wsdlBinding.updatePort(main, port);
-				}
-			}
-			
-		} catch(Exception e) {
-			logger.error("Failed to generate WSDL", e);
-		}
-		
-		return(ret);
-	}
-	
-	/**
-	 * This method returns the definition associated with the supplied target namespace.
-	 * 
-	 * @param wsdls The list of current WSDL definitions
-	 * @param contract The contract
-	 * @param targetNamespace The target namespace
-	 * @param wsdlBinding The WSDL binding to use, or null if no binding
-	 * @return The WSDL definition for the target namespace, or null if unable to find or create
-	 */
-	protected javax.wsdl.Definition getDefinition(java.util.List<javax.wsdl.Definition> wsdls,
-				org.jboss.savara.contract.model.Contract contract, String targetNamespace,
-				WSDLBinding wsdlBinding) {
-		javax.wsdl.Definition ret=null;
-		
-		if (targetNamespace != null) {
-			for (int i=0; ret == null && i < wsdls.size(); i++) {
-				ret = wsdls.get(i);
-				
-				if (ret.getTargetNamespace() == null || 
-						ret.getTargetNamespace().equals(targetNamespace) == false) {
-					ret = null;
-				}
-			}
-			
-			if (ret == null) {
-				ret = createDefinition(contract, targetNamespace);
-				
-				if (ret != null) {
-					
-					// Initialize definition using the WSDL binding
-					if (wsdlBinding != null) {
-						wsdlBinding.initDefinition(ret);
-					}
-					
-					wsdls.add(ret);
-				}
-			}
-		}
-		
-		return(ret);
-	}
-	
-	/**
-	 * This method creates a new WSDL definition associated with the supplied
-	 * target namespace.
-	 * 
-	 * @param contract The contract
-	 * @param targetNamespace The target namespace
-	 * @return The WSDL definition
-	 */
-	protected javax.wsdl.Definition createDefinition(org.jboss.savara.contract.model.Contract contract,
-									String targetNamespace) {
-		javax.wsdl.Definition ret=null;
-		
-		try {
-			javax.wsdl.factory.WSDLFactory fact=
-				javax.wsdl.factory.WSDLFactory.newInstance();
-	
-			ret = fact.newDefinition();
-			
-			// Set details on the definition
-			if (contract.getName() != null) {
-				ret.setQName(new javax.xml.namespace.QName(contract.getName()));
-			}
-			ret.setTargetNamespace(targetNamespace);
-			
-			// Set up namespace mappings
-			java.util.Iterator<Namespace> iter=contract.getNamespaces().iterator();
-			
-			while (iter.hasNext()) {
-				Namespace ns=iter.next();
-				
-				ret.addNamespace(ns.getPrefix(), ns.getURI());
-			}
-
-		} catch(Exception e) {
-			logger.error("Failed to create WSDL definition for target namespace '"+targetNamespace+"'", e);
-		}
-
-		return(ret);
-	}
-
-	/**
-	 * This method generates a port type, using the supplied WSDL definition,
-	 * based on the information in the supplied interface definition.
-	 * 
-	 * @param wsdls The list of current WSDL definitions
-	 * @param contract The contract
-	 * @param intf The interface model
-	 * @return The WSDL port type
-	 */
-	public javax.wsdl.PortType createPortType(java.util.List<javax.wsdl.Definition> wsdls,
-						org.jboss.savara.contract.model.Contract contract,
-								org.jboss.savara.contract.model.Interface intf,
-								WSDLBinding wsdlBinding) {
-		javax.wsdl.PortType ret=null;
-		
-		if (intf != null) {
-			javax.wsdl.Definition defn=getDefinition(wsdls, contract, intf.getNamespace(), wsdlBinding);
-
-			if (defn != null) {
-				ret = defn.createPortType();
-				ret.setUndefined(false);
-				
-				if (intf.getName() != null) {
-					ret.setQName(new javax.xml.namespace.QName(intf.getNamespace(), intf.getName()));
-				}
-				
-				for (int i=0; i < intf.getMessageExchangePatterns().size(); i++) {
-					createOperation(wsdls, contract, ret,
-								intf.getMessageExchangePatterns().get(i), wsdlBinding);
-				}
-
-				// Only add portType to definition if they have atleast one operation
-				if (ret != null && ret.getOperations().size() > 0) {
-					defn.addPortType(ret);
-				}
-			}
-		}
-		
-		return(ret);
-	}
-	
-	/**
-	 * This method generates a port type binding, using the supplied WSDL definition,
-	 * based on the information in the supplied interface definition.
-	 * 
-	 * @param wsdls The list of current WSDL definitions
-	 * @param contract The contract
-	 * @param intf The interface model
-	 * @param portType The port type
-	 * @return The WSDL port type binding
-	 */
-	public javax.wsdl.Binding createBinding(java.util.List<javax.wsdl.Definition> wsdls,
-						org.jboss.savara.contract.model.Contract contract,
-								org.jboss.savara.contract.model.Interface intf,
-								javax.wsdl.PortType portType,
-								WSDLBinding wsdlBinding) {
-		javax.wsdl.Binding ret=null;
-		
-		if (intf != null) {
-			javax.wsdl.Definition defn=getDefinition(wsdls, contract, intf.getNamespace(), wsdlBinding);
-
-			if (defn != null) {
-				ret = defn.createBinding();
-				ret.setUndefined(false);
-				
-				// Check if WSDL binding details
-				if (wsdlBinding != null) {
-					wsdlBinding.updateBinding(defn, ret);
-				}
-				
-				if (intf.getName() != null) {
-					ret.setQName(new javax.xml.namespace.QName(intf.getNamespace(), 
-							intf.getName()+BINDING_SUFFIX));
-				}
-				
-				ret.setPortType(portType);
-				
-				for (int i=0; i < intf.getMessageExchangePatterns().size(); i++) {
-					createBindingOperation(wsdls, contract, ret,
-								intf.getMessageExchangePatterns().get(i), wsdlBinding);
-				}
-
-				// Only add portType to definition if they have atleast one operation
-				if (ret != null && ret.getBindingOperations().size() > 0) {
-					defn.addBinding(ret);
-				}
-			}
-		}
-		
-		return(ret);
-	}
-	
-	/**
-	 * This method generates an operation, using the supplied WSDL definition,
-	 * based on the information in the supplied message exchange pattern.
-	 * 
-	 * @param wsdls The list of current WSDL definitions
-	 * @param contract The contract
-	 * @param portType The port type
-	 * @param mep The message exchange pattern
-	 * @return The WSDL operation
-	 */
-	public javax.wsdl.Operation createOperation(java.util.List<javax.wsdl.Definition> wsdls,
-			org.jboss.savara.contract.model.Contract contract, javax.wsdl.PortType portType,
-								org.jboss.savara.contract.model.MessageExchangePattern mep,
-								WSDLBinding wsdlBinding) {
-		javax.wsdl.Operation ret=null;
-		
-		javax.wsdl.Definition defn=null;
-		
-		if (portType != null) {
-			defn = getDefinition(wsdls, contract, portType.getQName().getNamespaceURI(), wsdlBinding);
-		}
-
-		if (defn != null && mep != null) {
-			ret = defn.createOperation();
-			ret.setUndefined(false);
-			
-			ret.setName(mep.getOperation());
-			
-			QName msgname=WSDLGeneratorUtil.getRequestMessageType(portType.getQName().getNamespaceURI(),
-								mep.getOperation());
-			
-			javax.wsdl.Message mesg=getMessage(wsdls, contract, msgname,
-								mep.getTypes(), wsdlBinding);
-			
-			if (mesg != null) {
-				javax.wsdl.Input input=defn.createInput();
-				input.setMessage(mesg);
-				ret.setInput(input);
-			}
-			
-			// Check if a request/response MEP
-			if (mep instanceof RequestResponseMEP) {
-				RequestResponseMEP rr=(RequestResponseMEP)mep;
-				
-				msgname=WSDLGeneratorUtil.getResponseMessageType(portType.getQName().getNamespaceURI(),
-								mep.getOperation());
-			
-				javax.wsdl.Message om=getMessage(wsdls, contract, msgname,
-									rr.getResponseTypes(), wsdlBinding);
-				if (om != null) {
-					javax.wsdl.Output output=defn.createOutput();
-					output.setMessage(om);
-					ret.setOutput(output);
-				}
-				
-				// Generate fault details
-				if (rr.getFaultDetails() != null) {
-					for (int i=0; i < rr.getFaultDetails().size(); i++) {
-						FaultDetails fd=rr.getFaultDetails().get(i);
-						
-						msgname = WSDLGeneratorUtil.getFaultMessageType(portType.getQName().getNamespaceURI(),
-												fd.getName());
-					
-						javax.wsdl.Message fm=getMessage(wsdls, contract, msgname,
-											fd.getTypes(), wsdlBinding);
-						if (fm != null) {
-							javax.wsdl.Fault fault=defn.createFault();
-							fault.setName(fd.getName());
-							fault.setMessage(fm);
-							
-							ret.addFault(fault);
-						}
-					}
-				}
-			}
-			
-			portType.addOperation(ret);
-		}
-		
-		return(ret);
-	}
-	
-	/**
-	 * This method generates a binding operation, using the supplied WSDL definition,
-	 * based on the information in the supplied message exchange pattern.
-	 * 
-	 * @param wsdls The list of current WSDL definitions
-	 * @param contract The contract
-	 * @param binding The port type binding
-	 * @param mep The message exchange pattern
-	 * @return The WSDL binding operation
-	 */
-	public javax.wsdl.BindingOperation createBindingOperation(java.util.List<javax.wsdl.Definition> wsdls,
-			org.jboss.savara.contract.model.Contract contract, javax.wsdl.Binding binding,
-								org.jboss.savara.contract.model.MessageExchangePattern mep,
-								WSDLBinding wsdlBinding) {
-		javax.wsdl.BindingOperation ret=null;
-		
-		javax.wsdl.Definition defn=null;
-		
-		if (binding != null) {
-			defn = getDefinition(wsdls, contract, binding.getQName().getNamespaceURI(), wsdlBinding);
-		}
-
-		if (defn != null && mep != null) {
-			ret = defn.createBindingOperation();
-			//ret.setUndefined(false);
-			
-			// Check if WSDL operation details
-			if (wsdlBinding != null) {
-				wsdlBinding.updateOperation(defn, mep, ret);
-			}
-			
-			ret.setName(mep.getOperation());
-			
-			QName msgname=WSDLGeneratorUtil.getRequestMessageType(binding.getQName().getNamespaceURI(),
-											mep.getOperation());
-		
-			javax.wsdl.Message mesg=getMessage(wsdls, contract,msgname,
-								mep.getTypes(), wsdlBinding);
-			
-			if (mesg != null) {
-				javax.wsdl.BindingInput input=defn.createBindingInput();
-				
-				// Check if WSDL operation details
-				if (wsdlBinding != null) {
-					wsdlBinding.updateInput(defn, input);
-				}
-
-				ret.setBindingInput(input);
-			}
-			
-			// Check if a request/response MEP
-			if (mep instanceof RequestResponseMEP) {
-				RequestResponseMEP rr=(RequestResponseMEP)mep;
-				
-				msgname=WSDLGeneratorUtil.getResponseMessageType(binding.getQName().getNamespaceURI(),
-										mep.getOperation());
-	
-				javax.wsdl.Message om=getMessage(wsdls, contract, msgname,
-									rr.getResponseTypes(), wsdlBinding);
-				if (om != null) {
-					javax.wsdl.BindingOutput output=defn.createBindingOutput();
-					
-					// Check if WSDL operation details
-					if (wsdlBinding != null) {
-						wsdlBinding.updateOutput(defn, output);
-					}
-
-					ret.setBindingOutput(output);
-				}
-				
-				// Generate fault details
-				if (rr.getFaultDetails() != null) {
-					for (int i=0; i < rr.getFaultDetails().size(); i++) {
-						FaultDetails fd=rr.getFaultDetails().get(i);
-						
-						msgname = WSDLGeneratorUtil.getFaultMessageType(binding.getQName().getNamespaceURI(),
-												fd.getName());
-			
-						javax.wsdl.Message fm=getMessage(wsdls, contract, msgname,
-									fd.getTypes(), wsdlBinding);
-						if (fm != null) {
-							javax.wsdl.BindingFault fault=defn.createBindingFault();
-							fault.setName(fd.getName());
-							
-							// Check if WSDL operation details
-							if (wsdlBinding != null) {
-								wsdlBinding.updateFault(defn, fault);
-							}
-
-							ret.addBindingFault(fault);
-						}
-					}
-				}
-			}
-			
-			binding.addBindingOperation(ret);
-		}
-		
-		return(ret);
-	}
-	
-	/**
-	 * This method returns a message, using the supplied WSDL definition,
-	 * based on the information supplied in the list of type references. If
-	 * a single type reference is supplied, this will be the message type,
-	 * if multiple type references are supplied, then these will be considered
-	 * the message parts.<p>
-	 * <p>
-	 * The returned message will be part of the supplied definition. If it
-	 * does not exist prior to the call to this method, then it will be
-	 * created and added to the definition upon returning the message.
-	 * 
-	 * @param wsdls The list of current WSDL definitions
-	 * @param contract The contract
-	 * @param msgname The message name
-	 * @param types The list of type references
-	 * @return The WSDL message
-	 */
-	public javax.wsdl.Message getMessage(java.util.List<javax.wsdl.Definition> wsdls,
-						org.jboss.savara.contract.model.Contract contract,
-						javax.xml.namespace.QName msgname,
-						java.util.List<org.jboss.savara.contract.model.Type> types,
-								WSDLBinding wsdlBinding) {
-		javax.wsdl.Message ret=null;
-		
-		if (types == null || types.size() == 0) {
-			throw new UnsupportedOperationException("Expecting single type reference");
-		} else if (types.size() > 1) {
-			throw new UnsupportedOperationException("Currently only supports single type reference");			
-		} else {
-			Type ref=types.get(0);
-			
-			java.util.Iterator<TypeDefinition> iter=ref.getTypeDefinitions().iterator();
-			boolean f_done=false;
-			
-			while (f_done == false && iter.hasNext()) {
-				TypeDefinition td=iter.next();
-				
-				if (TypeDefinition.XSD_ELEMENT.equals(td.getTypeSystem()) ||
-						TypeDefinition.XSD_TYPE.equals(td.getTypeSystem())) {
-					javax.xml.namespace.QName qname=
-						new javax.xml.namespace.QName(td.getNamespace(),td.getName());
-					javax.wsdl.Definition defn=
-						getDefinition(wsdls, contract, msgname.getNamespaceURI(), wsdlBinding);
-							
-					if (defn != null && qname != null &&
-							(ret = defn.getMessage(msgname)) == null) {
-						ret = defn.createMessage();
-						ret.setUndefined(false);
-						
-						ret.setQName(msgname);
-						
-						// Create single part for type or element
-						Part part=defn.createPart();
-						part.setName("content");
-						
-						if (TypeDefinition.XSD_ELEMENT.equals(td.getTypeSystem())) {
-							part.setElementName(qname);					
-						} else {
-							part.setTypeName(qname);
-						}
-						
-						ret.addPart(part);
-						
-						defn.addMessage(ret);
-						
-						f_done = true;
-					}
-				}
-			}
-		}
-		
-		return(ret);
-	}
 }

Added: trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorFactory.java
===================================================================
--- trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorFactory.java	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorFactory.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.savara.wsdl.generator;
+
+import org.jboss.savara.wsdl.generator.impl.WSDLGeneratorImpl;
+
+/**
+ * This class provides a factory for WSDL Generators.
+ *
+ */
+public class WSDLGeneratorFactory {
+
+	/**
+	 * This method returns a WSDL generator.
+	 * 
+	 * @return The WSDL generator
+	 */
+	public static WSDLGenerator getWSDLGenerator() {
+		return(new WSDLGeneratorImpl());
+	}
+
+}

Deleted: trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorUtil.java
===================================================================
--- trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorUtil.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorUtil.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.savara.wsdl.generator;
-
-/**
- * This class provides general utility functions for
- * use when generating artefacts.
- */
-public class WSDLGeneratorUtil {
-
-	private static final String RESPONSE = "Response";
-	private static final String FAULT = "Fault";
-	private static final String REQUEST = "Request";
-
-	/**
-	 * This method returns the request message type QName.
-	 * 
-	 * @param intfNamespace The interface namespace
-	 * @param op The operation name
-	 * @return The request message type
-	 */
-	public static javax.xml.namespace.QName getRequestMessageType(String intfNamespace, String op) {
-		return(new javax.xml.namespace.QName(intfNamespace, op+REQUEST));
-	}
-
-	/**
-	 * This method returns the response message type QName.
-	 * 
-	 * @param intfNamespace The interface namespace
-	 * @param op The operation name
-	 * @return The response message type
-	 */
-	public static javax.xml.namespace.QName getResponseMessageType(String intfNamespace, String op) {
-		return(new javax.xml.namespace.QName(intfNamespace, op+RESPONSE));
-	}
-
-	/**
-	 * This method returns the fault message type QName.
-	 * 
-	 * @param intfNamespace The interface namespace
-	 * @param faultName The fault name
-	 * @return The fault message type
-	 */
-	public static javax.xml.namespace.QName getFaultMessageType(String intfNamespace, String faultName) {
-		return(new javax.xml.namespace.QName(intfNamespace, faultName+FAULT));
-	}
-}

Added: trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/impl/WSDLGeneratorImpl.java
===================================================================
--- trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/impl/WSDLGeneratorImpl.java	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/impl/WSDLGeneratorImpl.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,537 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.savara.wsdl.generator.impl;
+
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.savara.contract.model.FaultDetails;
+import org.jboss.savara.contract.model.Interface;
+import org.jboss.savara.contract.model.Namespace;
+import org.jboss.savara.contract.model.RequestResponseMEP;
+import org.jboss.savara.contract.model.Type;
+import org.jboss.savara.contract.model.TypeDefinition;
+import org.jboss.savara.wsdl.generator.WSDLBinding;
+import org.jboss.savara.wsdl.generator.WSDLGenerator;
+import org.jboss.savara.wsdl.util.WSDLGeneratorUtil;
+
+/**
+ * This class generates a WSDL definition from a Contract model.
+ *
+ */
+public class WSDLGeneratorImpl implements WSDLGenerator {
+
+	public static final String BINDING_SUFFIX = "Binding";
+	
+	private static Log logger = LogFactory.getLog(WSDLGeneratorImpl.class);
+	
+	public WSDLGeneratorImpl() {
+	}
+	
+	/**
+	 * This method generates a WSDL definition from a Scribble contract model.
+	 * 
+	 * @param contract The contract model
+	 * @param wsdlBinding The WSDL binding to use, or null if no binding
+	 * @return The WSDL definition
+	 */
+	public java.util.List<javax.wsdl.Definition> generate(org.jboss.savara.contract.model.Contract contract,
+								WSDLBinding wsdlBinding) {
+		java.util.List<javax.wsdl.Definition> ret=new java.util.Vector<javax.wsdl.Definition>();
+		
+		try {
+			// Create definition for contract's target namespace
+			javax.wsdl.Definition main=getDefinition(ret, contract, contract.getNamespace(), wsdlBinding);
+			
+			// If no definition, then return
+			if (main == null) {
+				return(ret);
+			}
+			
+			// Create service
+			javax.wsdl.Service service=main.createService();
+			service.setQName(new javax.xml.namespace.QName(contract.getNamespace(),
+								contract.getName()+"Service"));
+
+			main.addService(service);
+			
+			// Define a port type per interface
+			java.util.Iterator<Interface> iter=contract.getInterfaces().iterator();
+			
+			while (iter.hasNext()) {
+				Interface intf=iter.next();
+				
+				javax.wsdl.PortType portType=
+							createPortType(ret, contract, intf, wsdlBinding);
+				
+				javax.wsdl.Binding binding=
+							createBinding(ret, contract, intf, portType, wsdlBinding);
+				
+				// Create service port for interface
+				javax.wsdl.Port port=main.createPort();
+				
+				port.setName(intf.getName()+"Port");
+				port.setBinding(binding);
+				
+				service.addPort(port);
+				
+				if (wsdlBinding != null) {
+					wsdlBinding.updatePort(main, port);
+				}
+			}
+			
+		} catch(Exception e) {
+			logger.error("Failed to generate WSDL", e);
+		}
+		
+		return(ret);
+	}
+	
+	/**
+	 * This method returns the definition associated with the supplied target namespace.
+	 * 
+	 * @param wsdls The list of current WSDL definitions
+	 * @param contract The contract
+	 * @param targetNamespace The target namespace
+	 * @param wsdlBinding The WSDL binding to use, or null if no binding
+	 * @return The WSDL definition for the target namespace, or null if unable to find or create
+	 */
+	protected javax.wsdl.Definition getDefinition(java.util.List<javax.wsdl.Definition> wsdls,
+				org.jboss.savara.contract.model.Contract contract, String targetNamespace,
+				WSDLBinding wsdlBinding) {
+		javax.wsdl.Definition ret=null;
+		
+		if (targetNamespace != null) {
+			for (int i=0; ret == null && i < wsdls.size(); i++) {
+				ret = wsdls.get(i);
+				
+				if (ret.getTargetNamespace() == null || 
+						ret.getTargetNamespace().equals(targetNamespace) == false) {
+					ret = null;
+				}
+			}
+			
+			if (ret == null) {
+				ret = createDefinition(contract, targetNamespace);
+				
+				if (ret != null) {
+					
+					// Initialize definition using the WSDL binding
+					if (wsdlBinding != null) {
+						wsdlBinding.initDefinition(ret);
+					}
+					
+					wsdls.add(ret);
+				}
+			}
+		}
+		
+		return(ret);
+	}
+	
+	/**
+	 * This method creates a new WSDL definition associated with the supplied
+	 * target namespace.
+	 * 
+	 * @param contract The contract
+	 * @param targetNamespace The target namespace
+	 * @return The WSDL definition
+	 */
+	protected javax.wsdl.Definition createDefinition(org.jboss.savara.contract.model.Contract contract,
+									String targetNamespace) {
+		javax.wsdl.Definition ret=null;
+		
+		try {
+			javax.wsdl.factory.WSDLFactory fact=
+				javax.wsdl.factory.WSDLFactory.newInstance();
+	
+			ret = fact.newDefinition();
+			
+			// Set details on the definition
+			if (contract.getName() != null) {
+				ret.setQName(new javax.xml.namespace.QName(contract.getName()));
+			}
+			ret.setTargetNamespace(targetNamespace);
+			
+			// Set up namespace mappings
+			java.util.Iterator<Namespace> iter=contract.getNamespaces().iterator();
+			
+			while (iter.hasNext()) {
+				Namespace ns=iter.next();
+				
+				ret.addNamespace(ns.getPrefix(), ns.getURI());
+			}
+
+		} catch(Exception e) {
+			logger.error("Failed to create WSDL definition for target namespace '"+targetNamespace+"'", e);
+		}
+
+		return(ret);
+	}
+
+	/**
+	 * This method generates a port type, using the supplied WSDL definition,
+	 * based on the information in the supplied interface definition.
+	 * 
+	 * @param wsdls The list of current WSDL definitions
+	 * @param contract The contract
+	 * @param intf The interface model
+	 * @return The WSDL port type
+	 */
+	public javax.wsdl.PortType createPortType(java.util.List<javax.wsdl.Definition> wsdls,
+						org.jboss.savara.contract.model.Contract contract,
+								org.jboss.savara.contract.model.Interface intf,
+								WSDLBinding wsdlBinding) {
+		javax.wsdl.PortType ret=null;
+		
+		if (intf != null) {
+			javax.wsdl.Definition defn=getDefinition(wsdls, contract, intf.getNamespace(), wsdlBinding);
+
+			if (defn != null) {
+				ret = defn.createPortType();
+				ret.setUndefined(false);
+				
+				if (intf.getName() != null) {
+					ret.setQName(new javax.xml.namespace.QName(intf.getNamespace(), intf.getName()));
+				}
+				
+				for (int i=0; i < intf.getMessageExchangePatterns().size(); i++) {
+					createOperation(wsdls, contract, ret,
+								intf.getMessageExchangePatterns().get(i), wsdlBinding);
+				}
+
+				// Only add portType to definition if they have atleast one operation
+				if (ret != null && ret.getOperations().size() > 0) {
+					defn.addPortType(ret);
+				}
+			}
+		}
+		
+		return(ret);
+	}
+	
+	/**
+	 * This method generates a port type binding, using the supplied WSDL definition,
+	 * based on the information in the supplied interface definition.
+	 * 
+	 * @param wsdls The list of current WSDL definitions
+	 * @param contract The contract
+	 * @param intf The interface model
+	 * @param portType The port type
+	 * @return The WSDL port type binding
+	 */
+	public javax.wsdl.Binding createBinding(java.util.List<javax.wsdl.Definition> wsdls,
+						org.jboss.savara.contract.model.Contract contract,
+								org.jboss.savara.contract.model.Interface intf,
+								javax.wsdl.PortType portType,
+								WSDLBinding wsdlBinding) {
+		javax.wsdl.Binding ret=null;
+		
+		if (intf != null) {
+			javax.wsdl.Definition defn=getDefinition(wsdls, contract, intf.getNamespace(), wsdlBinding);
+
+			if (defn != null) {
+				ret = defn.createBinding();
+				ret.setUndefined(false);
+				
+				// Check if WSDL binding details
+				if (wsdlBinding != null) {
+					wsdlBinding.updateBinding(defn, ret);
+				}
+				
+				if (intf.getName() != null) {
+					ret.setQName(new javax.xml.namespace.QName(intf.getNamespace(), 
+							intf.getName()+BINDING_SUFFIX));
+				}
+				
+				ret.setPortType(portType);
+				
+				for (int i=0; i < intf.getMessageExchangePatterns().size(); i++) {
+					createBindingOperation(wsdls, contract, ret,
+								intf.getMessageExchangePatterns().get(i), wsdlBinding);
+				}
+
+				// Only add portType to definition if they have atleast one operation
+				if (ret != null && ret.getBindingOperations().size() > 0) {
+					defn.addBinding(ret);
+				}
+			}
+		}
+		
+		return(ret);
+	}
+	
+	/**
+	 * This method generates an operation, using the supplied WSDL definition,
+	 * based on the information in the supplied message exchange pattern.
+	 * 
+	 * @param wsdls The list of current WSDL definitions
+	 * @param contract The contract
+	 * @param portType The port type
+	 * @param mep The message exchange pattern
+	 * @return The WSDL operation
+	 */
+	public javax.wsdl.Operation createOperation(java.util.List<javax.wsdl.Definition> wsdls,
+			org.jboss.savara.contract.model.Contract contract, javax.wsdl.PortType portType,
+								org.jboss.savara.contract.model.MessageExchangePattern mep,
+								WSDLBinding wsdlBinding) {
+		javax.wsdl.Operation ret=null;
+		
+		javax.wsdl.Definition defn=null;
+		
+		if (portType != null) {
+			defn = getDefinition(wsdls, contract, portType.getQName().getNamespaceURI(), wsdlBinding);
+		}
+
+		if (defn != null && mep != null) {
+			ret = defn.createOperation();
+			ret.setUndefined(false);
+			
+			ret.setName(mep.getOperation());
+			
+			QName msgname=WSDLGeneratorUtil.getRequestMessageType(portType.getQName().getNamespaceURI(),
+								mep.getOperation());
+			
+			javax.wsdl.Message mesg=getMessage(wsdls, contract, msgname,
+								mep.getTypes(), wsdlBinding);
+			
+			if (mesg != null) {
+				javax.wsdl.Input input=defn.createInput();
+				input.setMessage(mesg);
+				ret.setInput(input);
+			}
+			
+			// Check if a request/response MEP
+			if (mep instanceof RequestResponseMEP) {
+				RequestResponseMEP rr=(RequestResponseMEP)mep;
+				
+				msgname=WSDLGeneratorUtil.getResponseMessageType(portType.getQName().getNamespaceURI(),
+								mep.getOperation());
+			
+				javax.wsdl.Message om=getMessage(wsdls, contract, msgname,
+									rr.getResponseTypes(), wsdlBinding);
+				if (om != null) {
+					javax.wsdl.Output output=defn.createOutput();
+					output.setMessage(om);
+					ret.setOutput(output);
+				}
+				
+				// Generate fault details
+				if (rr.getFaultDetails() != null) {
+					for (int i=0; i < rr.getFaultDetails().size(); i++) {
+						FaultDetails fd=rr.getFaultDetails().get(i);
+						
+						msgname = WSDLGeneratorUtil.getFaultMessageType(portType.getQName().getNamespaceURI(),
+												fd.getName());
+					
+						javax.wsdl.Message fm=getMessage(wsdls, contract, msgname,
+											fd.getTypes(), wsdlBinding);
+						if (fm != null) {
+							javax.wsdl.Fault fault=defn.createFault();
+							fault.setName(fd.getName());
+							fault.setMessage(fm);
+							
+							ret.addFault(fault);
+						}
+					}
+				}
+			}
+			
+			portType.addOperation(ret);
+		}
+		
+		return(ret);
+	}
+	
+	/**
+	 * This method generates a binding operation, using the supplied WSDL definition,
+	 * based on the information in the supplied message exchange pattern.
+	 * 
+	 * @param wsdls The list of current WSDL definitions
+	 * @param contract The contract
+	 * @param binding The port type binding
+	 * @param mep The message exchange pattern
+	 * @return The WSDL binding operation
+	 */
+	public javax.wsdl.BindingOperation createBindingOperation(java.util.List<javax.wsdl.Definition> wsdls,
+			org.jboss.savara.contract.model.Contract contract, javax.wsdl.Binding binding,
+								org.jboss.savara.contract.model.MessageExchangePattern mep,
+								WSDLBinding wsdlBinding) {
+		javax.wsdl.BindingOperation ret=null;
+		
+		javax.wsdl.Definition defn=null;
+		
+		if (binding != null) {
+			defn = getDefinition(wsdls, contract, binding.getQName().getNamespaceURI(), wsdlBinding);
+		}
+
+		if (defn != null && mep != null) {
+			ret = defn.createBindingOperation();
+			//ret.setUndefined(false);
+			
+			// Check if WSDL operation details
+			if (wsdlBinding != null) {
+				wsdlBinding.updateOperation(defn, mep, ret);
+			}
+			
+			ret.setName(mep.getOperation());
+			
+			QName msgname=WSDLGeneratorUtil.getRequestMessageType(binding.getQName().getNamespaceURI(),
+											mep.getOperation());
+		
+			javax.wsdl.Message mesg=getMessage(wsdls, contract,msgname,
+								mep.getTypes(), wsdlBinding);
+			
+			if (mesg != null) {
+				javax.wsdl.BindingInput input=defn.createBindingInput();
+				
+				// Check if WSDL operation details
+				if (wsdlBinding != null) {
+					wsdlBinding.updateInput(defn, input);
+				}
+
+				ret.setBindingInput(input);
+			}
+			
+			// Check if a request/response MEP
+			if (mep instanceof RequestResponseMEP) {
+				RequestResponseMEP rr=(RequestResponseMEP)mep;
+				
+				msgname=WSDLGeneratorUtil.getResponseMessageType(binding.getQName().getNamespaceURI(),
+										mep.getOperation());
+	
+				javax.wsdl.Message om=getMessage(wsdls, contract, msgname,
+									rr.getResponseTypes(), wsdlBinding);
+				if (om != null) {
+					javax.wsdl.BindingOutput output=defn.createBindingOutput();
+					
+					// Check if WSDL operation details
+					if (wsdlBinding != null) {
+						wsdlBinding.updateOutput(defn, output);
+					}
+
+					ret.setBindingOutput(output);
+				}
+				
+				// Generate fault details
+				if (rr.getFaultDetails() != null) {
+					for (int i=0; i < rr.getFaultDetails().size(); i++) {
+						FaultDetails fd=rr.getFaultDetails().get(i);
+						
+						msgname = WSDLGeneratorUtil.getFaultMessageType(binding.getQName().getNamespaceURI(),
+												fd.getName());
+			
+						javax.wsdl.Message fm=getMessage(wsdls, contract, msgname,
+									fd.getTypes(), wsdlBinding);
+						if (fm != null) {
+							javax.wsdl.BindingFault fault=defn.createBindingFault();
+							fault.setName(fd.getName());
+							
+							// Check if WSDL operation details
+							if (wsdlBinding != null) {
+								wsdlBinding.updateFault(defn, fault);
+							}
+
+							ret.addBindingFault(fault);
+						}
+					}
+				}
+			}
+			
+			binding.addBindingOperation(ret);
+		}
+		
+		return(ret);
+	}
+	
+	/**
+	 * This method returns a message, using the supplied WSDL definition,
+	 * based on the information supplied in the list of type references. If
+	 * a single type reference is supplied, this will be the message type,
+	 * if multiple type references are supplied, then these will be considered
+	 * the message parts.<p>
+	 * <p>
+	 * The returned message will be part of the supplied definition. If it
+	 * does not exist prior to the call to this method, then it will be
+	 * created and added to the definition upon returning the message.
+	 * 
+	 * @param wsdls The list of current WSDL definitions
+	 * @param contract The contract
+	 * @param msgname The message name
+	 * @param types The list of type references
+	 * @return The WSDL message
+	 */
+	public javax.wsdl.Message getMessage(java.util.List<javax.wsdl.Definition> wsdls,
+						org.jboss.savara.contract.model.Contract contract,
+						javax.xml.namespace.QName msgname,
+						java.util.List<org.jboss.savara.contract.model.Type> types,
+								WSDLBinding wsdlBinding) {
+		javax.wsdl.Message ret=null;
+		
+		if (types == null || types.size() == 0) {
+			throw new UnsupportedOperationException("Expecting single type reference");
+		} else if (types.size() > 1) {
+			throw new UnsupportedOperationException("Currently only supports single type reference");			
+		} else {
+			Type ref=types.get(0);
+			
+			java.util.Iterator<TypeDefinition> iter=ref.getTypeDefinitions().iterator();
+			boolean f_done=false;
+			
+			while (f_done == false && iter.hasNext()) {
+				TypeDefinition td=iter.next();
+				
+				if (TypeDefinition.XSD_ELEMENT.equals(td.getTypeSystem()) ||
+						TypeDefinition.XSD_TYPE.equals(td.getTypeSystem())) {
+					javax.xml.namespace.QName qname=
+						new javax.xml.namespace.QName(td.getNamespace(),td.getName());
+					javax.wsdl.Definition defn=
+						getDefinition(wsdls, contract, msgname.getNamespaceURI(), wsdlBinding);
+							
+					if (defn != null && qname != null &&
+							(ret = defn.getMessage(msgname)) == null) {
+						ret = defn.createMessage();
+						ret.setUndefined(false);
+						
+						ret.setQName(msgname);
+						
+						// Create single part for type or element
+						Part part=defn.createPart();
+						part.setName("content");
+						
+						if (TypeDefinition.XSD_ELEMENT.equals(td.getTypeSystem())) {
+							part.setElementName(qname);					
+						} else {
+							part.setTypeName(qname);
+						}
+						
+						ret.addPart(part);
+						
+						defn.addMessage(ret);
+						
+						f_done = true;
+					}
+				}
+			}
+		}
+		
+		return(ret);
+	}
+}

Copied: trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/util/WSDLGeneratorUtil.java (from rev 478, trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/generator/WSDLGeneratorUtil.java)
===================================================================
--- trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/util/WSDLGeneratorUtil.java	                        (rev 0)
+++ trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/util/WSDLGeneratorUtil.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ */
+package org.jboss.savara.wsdl.util;
+
+/**
+ * This class provides general utility functions for
+ * use when generating artefacts.
+ */
+public class WSDLGeneratorUtil {
+
+	private static final String RESPONSE = "Response";
+	private static final String FAULT = "Fault";
+	private static final String REQUEST = "Request";
+
+	/**
+	 * This method returns the request message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param op The operation name
+	 * @return The request message type
+	 */
+	public static javax.xml.namespace.QName getRequestMessageType(String intfNamespace, String op) {
+		return(new javax.xml.namespace.QName(intfNamespace, op+REQUEST));
+	}
+
+	/**
+	 * This method returns the response message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param op The operation name
+	 * @return The response message type
+	 */
+	public static javax.xml.namespace.QName getResponseMessageType(String intfNamespace, String op) {
+		return(new javax.xml.namespace.QName(intfNamespace, op+RESPONSE));
+	}
+
+	/**
+	 * This method returns the fault message type QName.
+	 * 
+	 * @param intfNamespace The interface namespace
+	 * @param faultName The fault name
+	 * @return The fault message type
+	 */
+	public static javax.xml.namespace.QName getFaultMessageType(String intfNamespace, String faultName) {
+		return(new javax.xml.namespace.QName(intfNamespace, faultName+FAULT));
+	}
+}

Deleted: trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/util/XMLUtils.java
===================================================================
--- trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/util/XMLUtils.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/org.jboss.savara.wsdl/src/java/org/jboss/savara/wsdl/util/XMLUtils.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -1,300 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.savara.wsdl.util;
-
-import java.io.ByteArrayOutputStream;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.scribble.model.ModelObject;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * This class defines a set of XML related utility functions.
- */
-public final class XMLUtils {
-	
-	private static final String NS_LABEL = "ns";
-
-	/**
-	 * This class converts a DOM representation node to text.
-	 * @param node
-	 * @return
-	 * @throws Exception
-	 */
-	public static final String toText(Node node) throws Exception {
-		String ret = null;
-		try {
-			// Transform the DOM represent to text
-			ByteArrayOutputStream xmlstr= new ByteArrayOutputStream();
-			DOMSource source=new DOMSource(node);
-			//source.setNode(node);
-			
-			StreamResult result=new StreamResult(xmlstr);			
-			Transformer trans= TransformerFactory.newInstance().newTransformer();
-			trans.transform(source, result);
-			
-			xmlstr.close();
-			
-			ret = new String(xmlstr.toByteArray());
-			
-			if ((node instanceof Document) == false) {				
-				// Strip off any <?xml> header
-				int index=ret.indexOf("<?xml");
-				if (index != -1) {
-					index = ret.indexOf("<", 1);
-					if (index != -1) {
-						ret = ret.substring(index);
-					} else {
-						index = ret.indexOf("?>");
-						if (index != -1) {
-							index += 2;
-							
-							// Remove any trailing whitespaces after XML header
-							while (index < ret.length() &&
-									Character.isWhitespace(ret.charAt(index))) {
-								index++;
-							}
-							
-							ret = ret.substring(index);
-						}
-					}
-				}
-			}
-
-		} catch(Exception e) {
-			throw new Exception("Failed to transform DOM representation into text", e);
-		}
-		if (ret != null) {
-			 return format(ret);
-		}
-		return ret;
-	}
-	
-	
-	/**
-	 * Format the xml to well print.
-	 * 
-	 * @param xmltext
-	 * @return
-	 */
-	public static final String format(String xmltext) {
-		String ret=xmltext;
-		int pos=0;
-		int prevpos=0;
-		StringBuffer buf=new StringBuffer();
-		int level=0;
-		
-		while ((pos=ret.indexOf('<', prevpos)) != -1) {
-			
-			if (prevpos < pos &&
-					ret.substring(prevpos, pos).trim().length() > 0 &&
-					ret.charAt(prevpos-1) != '?') {
-				
-				if (ret.charAt(prevpos) == '\r' &&
-						ret.charAt(prevpos+1) == '\n') {
-					prevpos += 2;
-				}
-				for (int i=0; i < level; i++) {
-					buf.append("    ");
-				}
-				
-				buf.append(ret.substring(prevpos, pos).trim());
-				buf.append("\r\n");
-			}
-			
-			int endpos=ret.indexOf('>', pos);
-		
-			if (endpos > 0) {
-				boolean noreturn=false;
-				
-				if (pos > 0 && ret.charAt(pos+1) == '/') {
-					level--;
-				}
-				
-				for (int i=0; i < level; i++) {
-					buf.append("    ");
-				}
-				buf.append(ret.substring(pos, endpos+1));
-				
-				if (ret.charAt(endpos-1)== '?') {
-					//noreturn = true;
-					
-				} else if (ret.charAt(endpos-1) == '/') {
-					// Ignore
-				} else if (pos > 0 && ret.charAt(pos+1) == '/') {
-					// Ignore
-					
-				} else if (pos > 0 && ret.charAt(pos+1) == '!') {
-					// Ignore
-					
-				} else {
-					level++;
-				}
-							
-				if (noreturn == false) {
-					buf.append("\r\n");
-				}
-				
-				pos = endpos+1;
-			}
-			
-			prevpos = pos;
-		}
-		
-		if (prevpos != -1 &&
-				ret.substring(prevpos).trim().length() > 0) {
-			buf.append(ret.substring(prevpos));
-		}
-		
-		ret = buf.toString();
-		
-		return(ret);
-	}
-	
-	public static Node getNode(String text) throws Exception {
-		Node ret=null;
-		
-		// Transform the text representation to DOM
-		DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
-		fact.setNamespaceAware(true);
-		
-		java.io.InputStream xmlstr=
-			new java.io.ByteArrayInputStream(text.getBytes());
-
-		DocumentBuilder builder=fact.newDocumentBuilder();
-		org.w3c.dom.Document doc=builder.parse(xmlstr);
-		
-		ret = doc.getDocumentElement();
-
-		return(ret);
-	}
-
-	/**
-	 * This method returns the localname part of the supplied
-	 * qualified name.
-	 * 
-	 * @param qname The qualified name
-	 * @return The localname part
-	 */
-	public static String getLocalname(String qname) {
-		String ret=qname;
-		int pos=0;
-		
-		if (qname != null && ((pos=qname.indexOf(':')) != -1)) {
-			ret = qname.substring(pos+1);
-		}
-		
-		return(ret);
-	}
-	
-	/**
-	 * This method returns the prefix associated with the supplied namespace.
-	 * 
-	 * @param namespace The namespace
-	 * @param nsMap The existing namespace prefix mappings
-	 * @return The prefix
-	 */
-	public static String getPrefix(String namespace, java.util.Map<String,String> nsMap) {
-		String prefix=null;
-		
-		prefix = nsMap.get(namespace);
-		
-		if (prefix == null) {
-			prefix = NS_LABEL+(nsMap.size()+1);
-			nsMap.put(namespace, prefix);
-		}
-
-		return(prefix);
-	}
-	
-	/**
-	 * This method calculates the start and end position of a supplied DOM element, within
-	 * the supplied text contents, and sets the values on the supplied ModelObject.
-	 * 
-	 * @param obj The ModelObject to be initialized
-	 * @param contents The text contents
-	 * @param elem The DOM element to be located in the text
-	 */
-	public static void setStartAndEndPosition(ModelObject obj, String contents, org.w3c.dom.Element elem) {
-
-		if (contents != null) {
-			org.w3c.dom.NodeList nl=elem.getOwnerDocument().getElementsByTagName(elem.getNodeName());
-			int elempos=-1;
-			
-			for (int i=0; elempos == -1 && i < nl.getLength(); i++) {
-				if (nl.item(i) == elem) {
-					elempos = i;
-				}
-			}
-			
-			if (elempos != -1) {
-				int startpos=-1;
-					
-				for (int i=0; i <= elempos; i++) {
-					int val1=contents.indexOf("<"+elem.getNodeName()+">", startpos+1);
-					int val2=contents.indexOf("<"+elem.getNodeName()+" ", startpos+1);
-					
-					if (val1 == -1 && val2 != -1) {
-						startpos = val2;
-					} else if (val1 != -1 && val2 == -1) {
-						startpos = val1;
-					} else if (val1 == -1 && val2 == -1) {
-						// TODO: Error condition
-						break;
-					} else if (val1 > val2) {
-						startpos = val2;
-					} else {
-						startpos = val1;
-					}
-				}
-				
-				if (startpos != -1) {
-					obj.getSource().setStartPosition(startpos);
-					
-					// Check if single node
-					int p1=contents.indexOf('>', startpos);
-					
-					if (p1 != -1 && contents.charAt(p1-1) == '/') {
-						obj.getSource().setEndPosition(p1);
-					} else {
-					
-						org.w3c.dom.NodeList enl=elem.getElementsByTagName(elem.getNodeName());
-						
-						int endpos=startpos;
-						String nodetxt="</"+elem.getNodeName()+">";
-						
-						for (int i=0; endpos != -1 && i <= enl.getLength(); i++) {
-							endpos = contents.indexOf(nodetxt, endpos+1);
-						}
-						
-						if (endpos != -1) {
-							obj.getSource().setEndPosition(endpos+nodetxt.length()-1);
-						}
-					}
-				}
-			}
-		}
-	}
-}

Modified: trunk/bundles/pom.xml
===================================================================
--- trunk/bundles/pom.xml	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/bundles/pom.xml	2010-11-19 11:47:22 UTC (rev 484)
@@ -31,6 +31,7 @@
 	</properties>
 
 	<modules>
+		<module>org.jboss.savara.core</module>
 		<module>org.jboss.savara.wsdl</module>
 		<module>org.jboss.savara.bpel</module>
 	</modules>

Modified: trunk/tools/features/org.jboss.savara.tools.feature/feature.xml
===================================================================
--- trunk/tools/features/org.jboss.savara.tools.feature/feature.xml	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/features/org.jboss.savara.tools.feature/feature.xml	2010-11-19 11:47:22 UTC (rev 484)
@@ -194,6 +194,13 @@
          unpack="false"/>
 
    <plugin
+         id="org.jboss.savara.core"
+         download-size="0"
+         install-size="0"
+         version="0.0.0"
+         unpack="false"/>
+
+   <plugin
          id="org.jboss.savara.tools.bpel"
          download-size="0"
          install-size="0"

Modified: trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/META-INF/MANIFEST.MF	2010-11-19 11:47:22 UTC (rev 484)
@@ -24,7 +24,8 @@
  org.eclipse.wst.common.frameworks,
  org.eclipse.wst.common.project.facet.core,
  org.jboss.savara.wsdl,
- org.jboss.savara.bpel
+ org.jboss.savara.bpel,
+ org.jboss.savara.core
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-Vendor: www.jboss.org

Modified: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/dialogs/GenerateDialog.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/dialogs/GenerateDialog.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/dialogs/GenerateDialog.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -47,9 +47,6 @@
 		
 		m_file = file;
 		
-		m_buildSystems.add(new AntBuildSystem());
-		m_buildSystems.add(new MavenBuildSystem());
-		
 		initialize(m_file);
 	}
 	
@@ -227,27 +224,6 @@
 			}			
 		});
 		
-		label = new Label(group, SWT.RIGHT);
-		label.setText("Build: ");
-		
-		gd = new GridData();
-		gd.horizontalSpan = 1;
-		gd.widthHint = 100;
-		label.setLayoutData(gd);
-		
-		m_build=new Combo(group, SWT.DROP_DOWN);
-		
-		for (int i=0; i < m_buildSystems.size(); i++) {
-			m_build.add(m_buildSystems.get(i).getName());
-		}
-		
-		m_build.select(0);
-		
-		gd = new GridData();
-		gd.horizontalSpan = 1;
-		gd.widthHint = 100;
-		m_build.setLayoutData(gd);
-
 		return(composite);
 	}
 
@@ -324,8 +300,7 @@
 	public void okPressed() {
 		
 		try {
-			Generator generator=new Generator(m_file,
-						getSelectedBuildSystem());
+			Generator generator=new Generator(m_file);
 			
 			for (int i=0; i < m_localModelRefs.size(); i++) {
 				
@@ -341,10 +316,6 @@
 		}
 	}
 	
-	protected BuildSystem getSelectedBuildSystem() {
-		return(m_buildSystems.get(m_build.getSelectionIndex()));
-	}
-		
 	/**
 	 * This method is used to report an error.
 	 * 
@@ -370,6 +341,4 @@
 	private java.util.List<ModelReference> m_localModelRefs=null;
 	private java.util.List<Button> m_roleButtons=new java.util.Vector<Button>();
 	private java.util.List<Text> m_projectNames=new java.util.Vector<Text>();
-	private Combo m_build=null;
-	private java.util.List<BuildSystem> m_buildSystems=new java.util.Vector<BuildSystem>();
 }

Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/AbstractBuildSystem.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/AbstractBuildSystem.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/AbstractBuildSystem.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.savara.tools.bpel.generator;
-
-/**
- * This class represents an abstract build system.
- */
-public abstract class AbstractBuildSystem implements BuildSystem {
-
-	private static final String TEMPLATE_SUFFIX = ".template";
-	private static final String TEMPLATE_PREFIX = "template/";
-
-	/**
-	 * This method returns the contents for the build
-	 * configuration file.
-	 * 
-	 * @param projectName The project name
-	 * @return The build file contents
-	 */
-	public String getBuildFileContents(String projectName) {
-		String ret=null;
-		
-		java.io.InputStream is=
-				AbstractBuildSystem.class.getResourceAsStream(
-						TEMPLATE_PREFIX+getName()+TEMPLATE_SUFFIX);
-		
-		if (is != null) {
-			
-			try {
-				byte[] b=new byte[is.available()];
-				is.read(b);
-			
-				ret = new String(b);
-				
-				ret = ret.replaceAll("%PROJECT%", projectName);
-			} catch(Exception e) {
-				e.printStackTrace();
-			}
-		}
-		
-		return(ret);
-	}	
-}

Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/AntBuildSystem.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/AntBuildSystem.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/AntBuildSystem.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.savara.tools.bpel.generator;
-
-/**
- * This class represents the Ant build system.
- */
-public class AntBuildSystem extends AbstractBuildSystem {
-
-	private static final String BUILD_FILE = "build.xml";
-	private static final String ANT = "Ant";
-	private static final String BPEL_PATH = "bpelContent";
-
-	/**
-	 * This method represents the name of the build
-	 * system.
-	 * 
-	 * @return The name
-	 */
-	public String getName() {
-		return(ANT);
-	}
-	
-	/**
-	 * This method returns the build configuration file
-	 * path.
-	 * 
-	 * @return The build configuration file path
-	 */
-	public String getBuildFilePath() {
-		return(BUILD_FILE);
-	}
-		
-	/**
-	 * This method returns the BPEL file
-	 * path.
-	 * 
-	 * @return The BPEL file path
-	 */
-	public String getBPELFilePath() {
-		return(BPEL_PATH);
-	}
-	
-}

Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/BuildSystem.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/BuildSystem.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/BuildSystem.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.savara.tools.bpel.generator;
-
-/**
- * This interface represents a build system used when
- * generating the ESB projects.
- */
-public interface BuildSystem {
-
-	/**
-	 * This method represents the name of the build
-	 * system.
-	 * 
-	 * @return The name
-	 */
-	public String getName();
-	
-	/**
-	 * This method returns the build configuration file
-	 * path.
-	 * 
-	 * @return The build configuration file path
-	 */
-	public String getBuildFilePath();
-	
-	/**
-	 * This method returns the contents for the build
-	 * configuration file.
-	 * 
-	 * @param projectName The project name
-	 * @return The build file contents
-	 */
-	public String getBuildFileContents(String projectName);
-	
-	/**
-	 * This method returns the BPEL file path.
-	 * 
-	 * @return The BPEL file path
-	 */
-	public String getBPELFilePath();
-		
-}

Modified: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/Generator.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -30,10 +30,10 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.resources.IResource;
-import org.jboss.savara.tools.bpel.generator.BuildSystem;
 import org.jboss.savara.bpel.model.*;
 import org.jboss.savara.bpel.model.component.PartnerLink;
-import org.jboss.savara.bpel.util.XMLUtils;
+import org.jboss.savara.util.XMLUtils;
+import org.jboss.savara.wsdl.generator.WSDLGeneratorFactory;
 import org.jboss.savara.wsdl.generator.soap.SOAPDocLitWSDLBinding;
 import org.jboss.savara.contract.model.Contract;
 import org.jboss.savara.contract.model.Interface;
@@ -105,13 +105,14 @@
 
 	private static final String XMLNS_PLNK = "xmlns:plnk";
 	
+	private static final String BPEL_PATH = "bpelContent";
+
 	/**
 	 * This is the constructor for the generator.
 	 * 
 	 */
-	public Generator(IFile file, BuildSystem buildSystem) {
+	public Generator(IFile file) {
 		m_file = file;
-		m_buildSystem = buildSystem;
 		
 		initialize(m_file);
 	}
@@ -239,7 +240,7 @@
 
 			// Store BPEL configuration
 			IPath bpelPath=proj.getFullPath().append(
-					new Path(getBuildSystem().getBPELFilePath())).
+					new Path(BPEL_PATH)).
 						append(localcm.getModelName().getName()+"_"+
 							localcm.getModelName().getRole().getName()+".bpel");
 			
@@ -281,19 +282,19 @@
 			javax.wsdl.xml.WSDLWriter writer=
 				javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
 			org.jboss.savara.wsdl.generator.WSDLGenerator generator=
-						new org.jboss.savara.wsdl.generator.WSDLGenerator();
+						WSDLGeneratorFactory.getWSDLGenerator();
 			Contract contract=(Contract)role.getAnnotations().get(Contract.class.getName());
 
 			// Generate BPEL folder
 			IPath bpelFolderPath=proj.getFullPath().append(
-					new Path(getBuildSystem().getBPELFilePath()));
+					new Path(BPEL_PATH));
 
 			IFolder wsdlFolder=proj.getProject().getWorkspace().getRoot().getFolder(bpelFolderPath);
 			
 			createFolder(wsdlFolder);
 			
 			// Generate definition
-			java.util.List<javax.wsdl.Definition> defns=generator.generateDefinitions(contract,
+			java.util.List<javax.wsdl.Definition> defns=generator.generate(contract,
 									new SOAPDocLitWSDLBinding());
 			
 			// Check if contract has atleast one message exchange pattern
@@ -639,7 +640,7 @@
 		String filename=getWSDLFileName(role, localcm.getModelName().getName(), "Artifacts");
 		
 		IPath wsdlPath=proj.getFullPath().append(
-				new Path(getBuildSystem().getBPELFilePath())).
+				new Path(BPEL_PATH)).
 					append(filename);
 		
 		IFile wsdlFile=proj.getProject().getWorkspace().getRoot().getFile(wsdlPath);
@@ -745,7 +746,7 @@
 		
 		// Write partner link types to file
 		IPath wsdlPath=proj.getFullPath().append(
-				new Path(getBuildSystem().getBPELFilePath())).
+				new Path(BPEL_PATH)).
 					append(BPEL_DEPLOY_DESCRIPTOR_FILENAME);
 		
 		IFile wsdlFile=proj.getProject().getWorkspace().getRoot().getFile(wsdlPath);
@@ -849,14 +850,16 @@
 		}
 	}
 
+	/*
 	public BuildSystem getBuildSystem() {
 		return(m_buildSystem);
 	}
+	*/
 
 	private static Log logger = LogFactory.getLog(Generator.class);
 
 	private IFile m_file=null;
 	private java.util.List<ModelReference> m_localModelRefs=null;
 	private ConversationModel m_conversationModel=null;
-	private BuildSystem m_buildSystem=null;
+	//private BuildSystem m_buildSystem=null;
 }

Deleted: trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/MavenBuildSystem.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/MavenBuildSystem.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/plugins/org.jboss.savara.tools.bpel/src/java/org/jboss/savara/tools/bpel/generator/MavenBuildSystem.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.savara.tools.bpel.generator;
-
-/**
- * This class represents the Ant build system.
- */
-public class MavenBuildSystem extends AbstractBuildSystem {
-
-	private static final String BUILD_FILE = "pom.xml";
-	private static final String MAVEN = "Maven";
-	private static final String BPEL_PATH = "src/main/resources/bpelContent";
-
-	/**
-	 * This method represents the name of the build
-	 * system.
-	 * 
-	 * @return The name
-	 */
-	public String getName() {
-		return(MAVEN);
-	}
-	
-	/**
-	 * This method returns the build configuration file
-	 * path.
-	 * 
-	 * @return The build configuration file path
-	 */
-	public String getBuildFilePath() {
-		return(BUILD_FILE);
-	}
-	
-	/**
-	 * This method returns the BPEL file
-	 * path.
-	 * 
-	 * @return The BPEL file path
-	 */
-	public String getBPELFilePath() {
-		return(BPEL_PATH);
-	}
-		
-}

Modified: trunk/tools/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java
===================================================================
--- trunk/tools/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/plugins/org.jboss.savara.tools.wsdl/src/java/org/jboss/savara/tools/wsdl/actions/GenerateAction.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -30,6 +30,7 @@
 import org.eclipse.ui.IObjectActionDelegate;
 import org.eclipse.ui.IWorkbenchPart;
 import org.jboss.savara.tools.wsdl.util.XMLUtils;
+import org.jboss.savara.wsdl.generator.WSDLGeneratorFactory;
 import org.jboss.savara.wsdl.generator.soap.SOAPDocLitWSDLBinding;
 
 import javax.xml.transform.Transformer;
@@ -133,14 +134,14 @@
 			javax.wsdl.xml.WSDLWriter writer=
 				javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
 			org.jboss.savara.wsdl.generator.WSDLGenerator generator=
-				new org.jboss.savara.wsdl.generator.WSDLGenerator();
+							WSDLGeneratorFactory.getWSDLGenerator();
 			Contract contract=(Contract)ref.getAnnotations().get(Contract.class.getName());
 		
 			// Generate WSDL folder
 			IPath wsdlFolderPath=cdmResource.getParent().getFullPath();
 
 			// Generate definition
-			java.util.List<javax.wsdl.Definition> defns=generator.generateDefinitions(contract,
+			java.util.List<javax.wsdl.Definition> defns=generator.generate(contract,
 						new SOAPDocLitWSDLBinding());
 		
 			// Check if contract has atleast one message exchange pattern

Modified: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/META-INF/MANIFEST.MF	2010-11-19 11:47:22 UTC (rev 484)
@@ -28,4 +28,5 @@
  org.eclipse.wst.common.frameworks,
  org.eclipse.wst.common.project.facet.core,
  org.scribble.conversation.projector;bundle-version="[1.0.0,2.0.0)",
- org.jboss.savara.bpel
+ org.jboss.savara.bpel,
+ org.jboss.savara.core

Modified: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util/XMLUtilsTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util/XMLUtilsTest.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/bpel/util/XMLUtilsTest.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -17,7 +17,7 @@
  */
 package org.jboss.savara.bpel.util;
 
-import org.jboss.savara.bpel.util.XMLUtils;
+import org.jboss.savara.util.XMLUtils;
 import org.scribble.model.ModelObject;
 
 import junit.framework.TestCase;

Modified: trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/tests/org.jboss.savara.tools.bpel.tests/src/java/org/jboss/savara/tools/bpel/generator/GeneratorTest.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -24,7 +24,7 @@
 
 import org.jboss.savara.bpel.model.BPELNotation;
 import org.jboss.savara.bpel.model.DefaultBPELLanguageModel;
-import org.jboss.savara.bpel.util.XMLUtils;
+import org.jboss.savara.util.XMLUtils;
 import org.jboss.savara.pi4soa.cdm.model.CDMNotation;
 import org.scribble.extensions.RegistryFactory;
 import org.scribble.model.Definition;

Modified: trunk/tools/tests/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java
===================================================================
--- trunk/tools/tests/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java	2010-11-18 14:10:07 UTC (rev 483)
+++ trunk/tools/tests/org.jboss.savara.tools.wsdl.tests/src/java/org/jboss/savara/tools/wsdl/tests/WSDLGeneratorTest.java	2010-11-19 11:47:22 UTC (rev 484)
@@ -21,6 +21,8 @@
 import javax.xml.namespace.QName;
 
 import org.jboss.savara.wsdl.generator.WSDLGenerator;
+import org.jboss.savara.wsdl.generator.WSDLGeneratorFactory;
+import org.jboss.savara.wsdl.generator.impl.WSDLGeneratorImpl;
 import org.jboss.savara.contract.model.*;
 
 import junit.framework.TestCase;
@@ -43,9 +45,9 @@
 		c.setName(TEST_NAME);
 		c.setNamespace(TEST_NAME_SPACE);
 		
-		WSDLGenerator gen=new WSDLGenerator();
+		WSDLGeneratorImpl gen=new WSDLGeneratorImpl();
 		
-		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c, null);
+		java.util.List<javax.wsdl.Definition> defns=gen.generate(c, null);
 		
 		if (defns.size() != 1) {
 			fail("Only one Definition found: "+defns.size());
@@ -80,7 +82,7 @@
 		src.setName(TEST_NAME);
 		src.setNamespace(TEST_NAME_SPACE);
 		
-		WSDLGenerator gen=new WSDLGenerator();
+		WSDLGeneratorImpl gen=new WSDLGeneratorImpl();
 		
 		java.util.List<javax.wsdl.Definition> defns=new java.util.Vector<javax.wsdl.Definition>();
 		
@@ -117,7 +119,7 @@
 		src.setName(TEST_NAME);
 		src.setNamespace(TEST_NAME_SPACE);
 		
-		WSDLGenerator gen=new WSDLGenerator();
+		WSDLGeneratorImpl gen=new WSDLGeneratorImpl();
 		
 		java.util.List<javax.wsdl.Definition> defns=new java.util.Vector<javax.wsdl.Definition>();
 		
@@ -143,7 +145,7 @@
 			fail("QName localpart not set");
 		}
 		
-		if (result.getQName().getLocalPart().equals(TEST_NAME+WSDLGenerator.BINDING_SUFFIX) == false) {
+		if (result.getQName().getLocalPart().equals(TEST_NAME+WSDLGeneratorImpl.BINDING_SUFFIX) == false) {
 			fail("QName localpart not correct: "+result.getQName().getLocalPart());
 		}
 	}
@@ -213,9 +215,9 @@
 		c.getInterfaces().add(i2);
 		c.getInterfaces().add(i3);
 		
-		WSDLGenerator gen=new WSDLGenerator();
+		WSDLGeneratorImpl gen=new WSDLGeneratorImpl();
 		
-		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c, null);
+		java.util.List<javax.wsdl.Definition> defns=gen.generate(c, null);
 		
 		if (defns.size() != 1) {
 			fail("Only one Definition found: "+defns.size());
@@ -261,7 +263,7 @@
 		tref.setName(ref.getName());
 		src.getTypes().add(tref);
 		
-		WSDLGenerator gen=new WSDLGenerator();
+		WSDLGeneratorImpl gen=new WSDLGeneratorImpl();
 		
 		java.util.List<javax.wsdl.Definition> defns=new java.util.Vector<javax.wsdl.Definition>();
 		defns.add(defn);
@@ -352,7 +354,7 @@
 		
 		src.getFaultDetails().add(fd2);
 		
-		WSDLGenerator gen=new WSDLGenerator();
+		WSDLGeneratorImpl gen=new WSDLGeneratorImpl();
 		
 		java.util.List<javax.wsdl.Definition> defns=new java.util.Vector<javax.wsdl.Definition>();
 		defns.add(defn);
@@ -409,7 +411,7 @@
 		java.util.List<Type> refs=new java.util.Vector<Type>();
 		refs.add(t);
 		
-		WSDLGenerator gen=new WSDLGenerator();
+		WSDLGeneratorImpl gen=new WSDLGeneratorImpl();
 		
 		java.util.List<javax.wsdl.Definition> defns=new java.util.Vector<javax.wsdl.Definition>();
 		
@@ -529,9 +531,9 @@
 		c.getInterfaces().add(i2);
 		c.getInterfaces().add(i3);
 		
-		WSDLGenerator gen=new WSDLGenerator();
+		WSDLGeneratorImpl gen=new WSDLGeneratorImpl();
 		
-		java.util.List<javax.wsdl.Definition> defns=gen.generateDefinitions(c, null);
+		java.util.List<javax.wsdl.Definition> defns=gen.generate(c, null);
 		
 		if (defns.size() != 2) {
 			fail("Two Definitions expected, but got: "+defns.size());



More information about the savara-commits mailing list