You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by da...@apache.org on 2006/12/08 21:41:27 UTC

svn commit: r484767 [3/3] - in /webservices/muse/trunk/modules/muse-tools: ./ resources/common/subscription-manager/ resources/mini/ src/org/apache/muse/tools/generator/ src/org/apache/muse/tools/generator/analyzer/ src/org/apache/muse/tools/generator/...

Added: webservices/muse/trunk/modules/muse-tools/resources/common/subscription-manager/services.xml
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/resources/common/subscription-manager/services.xml?view=auto&rev=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/resources/common/subscription-manager/services.xml (added)
+++ webservices/muse/trunk/modules/muse-tools/resources/common/subscription-manager/services.xml Fri Dec  8 12:41:25 2006
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<serviceGroup>
+
+<service name="SubscriptionManager">
+    <description>This is the Apache Muse router service.</description>
+    <parameter name="ServiceClass" locked="false">org.apache.muse.core.platform.axis2.AxisIsolationLayer</parameter>
+    <operation name="handleRequest">
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <actionMapping>http://docs.oasis-open.org/wsrf/rlw-2/ImmediateResourceTermination/DestroyRequest</actionMapping>
+        <actionMapping>http://docs.oasis-open.org/wsrf/rlw-2/ScheduledResourceTermination/SetTerminationTimeRequest</actionMapping>
+        <actionMapping>http://docs.oasis-open.org/wsrf/rpw-2/GetResourceProperty/GetResourcePropertyRequest</actionMapping>
+        <actionMapping>http://docs.oasis-open.org/wsrf/rpw-2/GetResourcePropertyDocument/GetResourcePropertyDocumentRequest</actionMapping>
+        <actionMapping>http://docs.oasis-open.org/wsrf/rpw-2/GetMultipleResourceProperties/GetMultipleResourcePropertiesRequest</actionMapping>
+    </operation>
+</service>
+
+</serviceGroup>

Added: webservices/muse/trunk/modules/muse-tools/resources/mini/build.xml
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/resources/mini/build.xml?view=auto&rev=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/resources/mini/build.xml (added)
+++ webservices/muse/trunk/modules/muse-tools/resources/mini/build.xml Fri Dec  8 12:41:25 2006
@@ -0,0 +1,48 @@
+<?xml version="1.0"?>
+<project name="J2EE WAR Project" default="war">
+	
+	<target name="init">
+		<basename property="NAME" file="${basedir}"/>
+		
+		<property name="JAVA_SRC_DIR" value="JavaSource"/>
+		<property name="WEB_SRC_DIR" value="WebContent"/>	
+		<property name="JAVA_DEST_DIR" value="JavaClasses"/>
+		
+		<property name="WAR_FILE" value="${NAME}.war"/>
+		<property name="LIB_DIR" value="${WEB_SRC_DIR}/WEB-INF/lib"/>
+		<property name="JAR_FILE" value="${LIB_DIR}/${NAME}.jar"/>
+		
+        <path id="class.path">
+            <fileset dir="${LIB_DIR}">
+                <include name="*.jar"/>
+            </fileset>
+        </path>
+		
+		<available property="JAVA_EXISTS" file="${JAVA_SRC_DIR}"/>
+	</target>
+	
+	<target name="clean" depends="init">
+		<delete dir="${JAVA_DEST_DIR}"/>
+        <delete file="${WAR_FILE}"/>
+        <delete file="${JAR_FILE}"/>		
+	</target>
+
+	<target name="java" if="JAVA_EXISTS" depends="init">
+		<mkdir dir="${JAVA_DEST_DIR}"/>
+		<javac srcdir="${JAVA_SRC_DIR}" destdir="${JAVA_DEST_DIR}" classpathref="class.path"/>
+		<jar basedir="${JAVA_DEST_DIR}" destfile="${JAR_FILE}">
+			<fileset dir="${JAVA_DEST_DIR}">
+				<include name="**/*.class"/>
+			</fileset>
+		</jar>
+	</target>
+		
+	<target name="war" depends="clean, java">	
+	    <jar destfile="${WAR_FILE}">
+			<fileset dir="${WEB_SRC_DIR}">
+				<include name="**/*"/>
+			</fileset>
+		</jar>
+	</target>
+</project>
+

Added: webservices/muse/trunk/modules/muse-tools/resources/mini/web.xml
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/resources/mini/web.xml?view=auto&rev=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/resources/mini/web.xml (added)
+++ webservices/muse/trunk/modules/muse-tools/resources/mini/web.xml Fri Dec  8 12:41:25 2006
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+	<display-name>Apache Muse Servlet</display-name>
+	<servlet>
+		<display-name>Apache Muse Servlet</display-name>
+		<servlet-name>ApacheMuseServlet</servlet-name>
+		<servlet-class>org.apache.muse.core.platform.mini.MiniServlet</servlet-class>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>ApacheMuseServlet</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+</web-app>

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Messages.properties Fri Dec  8 12:41:25 2006
@@ -27,7 +27,9 @@
 \ \ XXX CLASS\tThe Synthesizer component\n\
 \ \ XXX CLASS\tThe Projectizer component\n\
 \ \ XXX FILE\t\tDump the built-in descriptor to a file\n\
+\ \ XXX\t\t\tGenerate an Axis2 project\n\
 \ \ XXX\t\t\tGenerate an OSGi project\n\
+\ \ XXX\t\t\tGenerate a Mini SOAP Engine project\n\
 \ \ XXX\t\tGenerate a proxy project\n\
 \ \ XXX\t\tTurn off all messages\n\
 \ \ XXX\t\tTurn on verbose output\n\

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2Java.java Fri Dec  8 12:41:25 2006
@@ -22,6 +22,7 @@
 import org.apache.muse.tools.generator.analyzer.Analyzer;
 import org.apache.muse.tools.generator.analyzer.SimpleAnalyzer;
 import org.apache.muse.tools.generator.projectizer.Axis2Projectizer;
+import org.apache.muse.tools.generator.projectizer.MiniProjectizer;
 import org.apache.muse.tools.generator.projectizer.OsgiProjectizer;
 import org.apache.muse.tools.generator.projectizer.Projectizer;
 import org.apache.muse.tools.generator.projectizer.ProxyProjectizer;
@@ -167,7 +168,7 @@
 		}
 
 		if (_projectizer == null) {
-			_projectizer = new Axis2Projectizer();
+			_projectizer = new MiniProjectizer();
 		}
 
 		if (_analyzer == null) {
@@ -258,6 +259,7 @@
 		try {			
 			app.run();
 		} catch (Exception e) {
+            e.printStackTrace();
 			handleErrorAndExit(_MESSAGES.get("CodeGenFailed"), e);
 		}
 	}
@@ -301,7 +303,9 @@
 					SYNTHESIZER_FLAG,
 					PROJECTIZER_FLAG,					
 					BASE_DESCRIPTOR_FLAG,
+                    AXIS2_FLAG,
 					OSGI_FLAG,
+					MINI_FLAG,
 					PROXY_FLAG,
 					QUIET_FLAG,
 					VERBOSE_FLAG,
@@ -495,9 +499,17 @@
 		if (arguments.hasFlag(PROXY_FLAG)) {
 			return new ProxyProjectizer();
 		}
+        
+        if(arguments.hasFlag(AXIS2_FLAG)) {
+            return new Axis2Projectizer();
+        }
 		
 		if(arguments.hasFlag(OSGI_FLAG)) {
 			return new OsgiProjectizer();
+		}
+		
+		if(arguments.hasFlag(MINI_FLAG)) {
+			return new MiniProjectizer();
 		}
 		
 		String projectizerArg = arguments.getFlagValue(PROJECTIZER_FLAG);

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/Wsdl2JavaConstants.java Fri Dec  8 12:41:25 2006
@@ -52,6 +52,10 @@
 	
 	String OSGI_FLAG = "-osgi";
 	
+	String MINI_FLAG = "-mini";
+    
+    String AXIS2_FLAG = "-axis2";
+	
 	String PROXY_FLAG = "-proxy";
 	
 	String MUSE_BASE_DESCRIPTOR = "/resources/common/muse.xml";	

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/WsdlMerge.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/WsdlMerge.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/WsdlMerge.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/WsdlMerge.java Fri Dec  8 12:41:25 2006
@@ -32,13 +32,15 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.wsdl.xml.WSDLWriter;
 
+import org.w3c.dom.Document;
+
 import org.apache.muse.tools.generator.util.AbstractCommandLineApp;
 import org.apache.muse.tools.generator.util.DefinitionInfo;
 import org.apache.muse.util.CommandLine;
 import org.apache.muse.util.messages.Messages;
 import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.xml.XmlUtils;
-import org.w3c.dom.Document;
+import org.apache.muse.ws.wsdl.WsdlUtils;
 
 /**
  * Utility class to merge all the capability WSDLs into a single WSDL file 
@@ -63,6 +65,9 @@
 			_factory = WSDLFactory.newInstance();
 			_reader = _factory.newWSDLReader();
 			_writer = _factory.newWSDLWriter();
+
+            _reader.setFeature(WsdlUtils.WSDL4J_VERBOSE_FLAG, false);
+            
 		} catch (Exception e) {
 			handleErrorAndExit(_MESSAGES.get("NoFactory"), e);
 		}

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/analyzer/SimpleAnalyzer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/analyzer/SimpleAnalyzer.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/analyzer/SimpleAnalyzer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/analyzer/SimpleAnalyzer.java Fri Dec  8 12:41:25 2006
@@ -44,9 +44,11 @@
 import org.apache.muse.ws.dm.muws.impl.SimpleState;
 import org.apache.muse.ws.metadata.WsxConstants;
 import org.apache.muse.ws.notification.NotificationProducer;
+import org.apache.muse.ws.notification.SubscriptionManager;
 import org.apache.muse.ws.notification.WsnConstants;
 import org.apache.muse.ws.notification.impl.SimpleNotificationConsumer;
 import org.apache.muse.ws.notification.impl.SimpleNotificationProducer;
+import org.apache.muse.ws.notification.impl.SimpleSubscriptionManager;
 import org.apache.muse.ws.resource.lifetime.WsrlConstants;
 import org.apache.muse.ws.resource.lifetime.impl.SimpleScheduledTermination;
 import org.apache.muse.ws.resource.properties.WsrpConstants;
@@ -59,7 +61,6 @@
 import org.w3c.dom.Document;
 
 /**
- * 
  * SimpleAnalyzer is a canonical implementation of an <code>Analyzer</code>. This
  * class will take in a description of a resource (using WSDL and/or a Muse descriptor).
  * Using these documents it will create a map of <code>Capability</code> objects which
@@ -75,17 +76,19 @@
 public class SimpleAnalyzer implements Analyzer {
 	
 	/**
-	 * QName to Capability URIs for properties, operations
+	 * QName to Capability URIs for properties, operations. This
+	 * is where we keep the mapping that determines which properties
+	 * and which operations belong to which capability URIs. 
 	 */
 	static Map _qnameCapabilityMap = new HashMap();
 	
 	/**
-	 * Capability URIs to classes that implement them provided by Muse
+	 * Capability URIs to classes that implement them provided by Muse.
 	 */
 	static Map _internalImplMap = new HashMap();
 	
 	/**
-	 * QName to Action URI for operation parameters
+	 * QName to Action URI for operation parameters.
 	 */
 	static Map _internalActionMap = new HashMap();
 	
@@ -222,6 +225,9 @@
 		addProperties(SimpleRelationships.PROPERTIES,
 				MuwsConstants.RELATIONSHIPS_URI);
 		
+		_qnameCapabilityMap.put(MuwsConstants.QUERY_RELATIONSHIPS_QNAME,
+				MuwsConstants.RELATIONSHIPS_URI);
+		
 		_internalImplMap.put(MuwsConstants.RELATIONSHIPS_URI,
 				SimpleRelationships.class);
 		
@@ -284,6 +290,25 @@
 				WsnConstants.SUBSCRIBE_URI);		
 		_internalActionMap.put(WsnConstants.GET_CURRENT_QNAME,
 				WsnConstants.GET_CURRENT_URI);
+		
+		//SubscriptionManager
+		addProperties(SubscriptionManager.PROPERTIES, 
+				WsnConstants.SUBSCRIPTION_MGR_URI);
+		
+		_qnameCapabilityMap.put(WsnConstants.PAUSE_QNAME, 
+				WsnConstants.SUBSCRIPTION_MGR_URI);
+		
+		_qnameCapabilityMap.put(WsnConstants.RESUME_QNAME, 
+				WsnConstants.SUBSCRIPTION_MGR_URI);
+		
+		_internalImplMap.put(WsnConstants.SUBSCRIPTION_MGR_URI,
+				SimpleSubscriptionManager.class);
+		
+		_internalActionMap.put(WsnConstants.PAUSE_QNAME,
+				WsnConstants.PAUSE_URI);
+		
+		_internalActionMap.put(WsnConstants.RESUME_QNAME,
+				WsnConstants.RESUME_URI);
 	}
 	
 	static ConfigurationDataDescriptor[] REQUIRED_PARAMETERS = 

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/AbstractProjectizer.java Fri Dec  8 12:41:25 2006
@@ -33,6 +33,8 @@
 import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.xml.XmlUtils;
 import org.apache.muse.ws.addressing.WsaConstants;
+import org.apache.muse.ws.notification.WsnConstants;
+import org.apache.muse.ws.resource.sg.WssgConstants;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -239,7 +241,15 @@
 	 * @throws Exception
 	 * 			If anything goes wrong
 	 */
-	protected void createRouterEntries(File routerEntriesDir, String serviceName) throws Exception{
+	protected void createRouterEntries(File routerEntriesDir, String serviceName, Map capabilities) throws Exception{
+        
+        //
+        // no pre-determined instances for subscriptions or SG entries
+        //
+        if (capabilities.keySet().contains(WsnConstants.SUBSCRIPTION_MGR_URI) || 
+            capabilities.keySet().contains(WssgConstants.ENTRY_URI))
+            return;
+        
 		Document routerEntryDocument = XmlUtils.createDocument();
 		Element parametersElement = XmlUtils.createElement(routerEntryDocument, WsaConstants.PARAMETERS_QNAME);
 		routerEntryDocument.appendChild(parametersElement);

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2Projectizer.java Fri Dec  8 12:41:25 2006
@@ -28,6 +28,8 @@
 import org.apache.muse.tools.generator.util.ServicesDescriptorHelper;
 import org.apache.muse.util.FileUtils;
 import org.apache.muse.ws.wsdl.WsdlUtils;
+import org.apache.muse.ws.notification.WsnConstants;
+import org.apache.muse.ws.resource.sg.WssgConstants;
 import org.w3c.dom.Document;
 
 /**
@@ -118,7 +120,7 @@
 			Document wsdl = _wsdls[i];
 			createDescriptor(_descriptor, wsdl, descriptorFile, capabilities, Axis2ProjectizerConstants.WSDL_RELATIVE_PATH, i);						
 			createWSDLFile(wsdl, wsdldir);				
-			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()));
+			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), capabilities);
 			updateServicesDescriptor(servicesHelper, wsdl, capabilities);
 		}					
 		
@@ -165,7 +167,14 @@
 	}
 
 	protected void createDescriptor(Document descriptorDocument, Document wsdl, File descriptorFile, Map capabilities, String wsdlRelativePath, int resourceIndex) throws Exception {
-		DeploymentDescriptorHelper helper = new DeploymentDescriptorHelper(descriptorDocument, wsdl, resourceIndex);
+        //
+        // no additional muse.xml for subscriptions or SG entries
+        //
+        if (capabilities.keySet().contains(WsnConstants.SUBSCRIPTION_MGR_URI) || 
+            capabilities.keySet().contains(WssgConstants.ENTRY_URI))
+            return;
+        
+        DeploymentDescriptorHelper helper = new DeploymentDescriptorHelper(descriptorDocument, wsdl, resourceIndex);
 		
 		//update the wsdl file location
 		helper.setWsdlFile(wsdlRelativePath + WsdlUtils.getServiceName(wsdl.getDocumentElement()) + DEFAULT_WSDL_NAME_SUFFIX);			

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2ProjectizerConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2ProjectizerConstants.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2ProjectizerConstants.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/Axis2ProjectizerConstants.java Fri Dec  8 12:41:25 2006
@@ -25,7 +25,7 @@
 public interface Axis2ProjectizerConstants {		
 	String TEMPLATE_DIR = "lib/axis2";	
 	
-	String DESCRIPTOR_FILE = "WEB-INF/services/muse/muse.xml";
+	String DESCRIPTOR_FILE = "WEB-INF/classes/muse.xml";
 	
 	String SIMPLE_TEMPLATE_PATH = "WEB-INF/lib/simple.jar";
 	    
@@ -45,11 +45,11 @@
 	
 	String MUSE_HOME_PROPERTY = "MUSE_HOME";
 
-	String WSDL_DIR = "WEB-INF/services/muse/wsdl";
+	String WSDL_DIR = "WEB-INF/classes/wsdl";
 	
 	String WSDL_RELATIVE_PATH = "/wsdl/";
 
-	String ROUTER_ENTRIES_DIR = "WEB-INF/services/muse/router-entries";
+	String ROUTER_ENTRIES_DIR = "WEB-INF/classes/router-entries";
 
 	String RESOURCE_FILE = "resource-instance-XXX.xml";
 

Added: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java?view=auto&rev=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java (added)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizer.java Fri Dec  8 12:41:25 2006
@@ -0,0 +1,154 @@
+package org.apache.muse.tools.generator.projectizer;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.muse.tools.generator.util.Capability;
+import org.apache.muse.tools.generator.util.ConfigurationData;
+import org.apache.muse.tools.generator.util.ConfigurationDataDescriptor;
+import org.apache.muse.tools.generator.util.DeploymentDescriptorHelper;
+import org.apache.muse.tools.generator.util.ServicesDescriptorHelper;
+import org.apache.muse.util.FileUtils;
+import org.apache.muse.ws.wsdl.WsdlUtils;
+import org.apache.muse.ws.notification.WsnConstants;
+import org.apache.muse.ws.resource.sg.WssgConstants;
+import org.w3c.dom.Document;
+
+public class MiniProjectizer extends AbstractProjectizer {
+	
+	static ConfigurationDataDescriptor[] REQUIRED_PARAMETERS = 
+		new ConfigurationDataDescriptor[] {
+			ConfigurationData.FILES_MAP_LIST_CONFIGURATION,
+			ConfigurationData.DESCRIPTOR_DOCUMENT_CONFIGURATION,
+			ConfigurationData.WSDL_DOCUMENT_LIST_CONFIGURATION, 
+			ConfigurationData.OVERWRITE_CONFIGURATION,
+			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION
+		};
+
+
+	protected File _targetDirectory = null;
+
+	protected Map[] _capabilitiesList = null;
+
+	protected Map[] _filesMaps = null;
+
+	protected Document _descriptor = null;
+
+	protected Document[] _wsdls = null;	
+	
+	public void projectize(ConfigurationData configuration) throws Exception {
+		ConfigurationData.checkConfiguration(this, configuration);
+		
+		loadParameters(configuration);
+		
+		File webContentDir = new File(_targetDirectory,	MiniProjectizerConstants.WEB_CONTENT_DIR);
+		
+		File libDir = new File(webContentDir, MiniProjectizerConstants.LIB_DIR);
+		File modulesDir = new File(System.getProperty(Axis2ProjectizerConstants.MUSE_HOME_PROPERTY),MiniProjectizerConstants.MODULES_DIR);
+		copyJars(MiniProjectizerConstants.REQUIRED_MODULES, modulesDir, libDir);
+					
+		File descriptorFile = new File(
+				webContentDir, 
+				MiniProjectizerConstants.DESCRIPTOR_FILE);
+		
+		File javaSourceDir = new File(
+				_targetDirectory, 
+				MiniProjectizerConstants.JAVA_SRC_DIR);
+		
+		createJavaSources(javaSourceDir, _filesMaps);
+		
+		createBuildFile(_targetDirectory, MiniProjectizerConstants.BUILD_FILE_RESOURCE, MiniProjectizerConstants.BUILD_FILE);
+		
+		File wsdldir = new File(
+				webContentDir, 
+				MiniProjectizerConstants.WSDL_DIR);
+
+		File routerEntriesDir = new File(webContentDir,MiniProjectizerConstants.ROUTER_ENTRIES_DIR);
+        
+		for(int i=0; i < _capabilitiesList.length; i++) {
+			Map capabilities = _capabilitiesList[i];
+			Document wsdl = _wsdls[i];
+			createDescriptor(_descriptor, wsdl, descriptorFile, capabilities, MiniProjectizerConstants.WSDL_RELATIVE_PATH, i);						
+			createWSDLFile(wsdl, wsdldir);				
+			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), capabilities);
+		}					
+	}
+	
+	protected void loadParameters(ConfigurationData configuration) {
+		_capabilitiesList = (Map[])configuration.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
+		_filesMaps = (Map[])configuration.getParameter(ConfigurationData.FILES_MAP_LIST);
+		_overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
+		_descriptor = (Document)configuration.getParameter(ConfigurationData.DESCRIPTOR_DOCUMENT);
+		_wsdls = (Document[])configuration.getParameter(ConfigurationData.WSDL_DOCUMENT_LIST);
+		_targetDirectory = (File)configuration.getParameter(ConfigurationData.TARGET_DIRECTORY);
+		
+		if(_targetDirectory == null) {
+			_targetDirectory = FileUtils.CURRENT_DIR;
+		}		
+	}
+	
+	protected void createWSDLFile(Document wsdl, File wsdldir) throws Exception {		
+		File wsdlFile = new File(wsdldir, WsdlUtils.getServiceName(wsdl.getDocumentElement()) + DEFAULT_WSDL_NAME_SUFFIX);
+		writeToFileCheck(wsdl, wsdlFile);
+	}
+
+	protected void createBuildFile(File baseTargetDir, String buildFileResource, String buildFile) throws Exception {
+		InputStream buildTemplate = FileUtils.loadFromContext(this.getClass(),buildFileResource);
+		File build = new File(baseTargetDir, buildFile);
+		copyStreamCheck(buildTemplate, build);			
+	}
+
+
+	protected void updateServicesDescriptor(ServicesDescriptorHelper servicesHelper, Document wsdl, Map capabilities) {
+		String serviceName = WsdlUtils.getServiceName(wsdl.getDocumentElement());
+		servicesHelper.createService(serviceName);
+		
+		for (Iterator i = capabilities.values().iterator(); i.hasNext();) {				
+			servicesHelper.addActionMappings((Capability) i.next(), serviceName);
+		}
+	}
+
+	protected void createDescriptor(Document descriptorDocument, Document wsdl, File descriptorFile, Map capabilities, String wsdlRelativePath, int resourceIndex) throws Exception {
+        
+        //
+        // no additional muse.xml for subscriptions or SG entries
+        //
+        if (capabilities.keySet().contains(WsnConstants.SUBSCRIPTION_MGR_URI) || 
+            capabilities.keySet().contains(WssgConstants.ENTRY_URI))
+            return;
+        
+        DeploymentDescriptorHelper helper = new DeploymentDescriptorHelper(descriptorDocument, wsdl, resourceIndex);
+		
+		//update the wsdl file location
+		helper.setWsdlFile(wsdlRelativePath + WsdlUtils.getServiceName(wsdl.getDocumentElement()) + DEFAULT_WSDL_NAME_SUFFIX);			
+		
+		//update the service name
+		helper.setContextPath(WsdlUtils.getServiceName(wsdl.getDocumentElement()));
+					
+		//update the name of the class that is the base resource
+		helper.setJavaResourceClass(getResourceClass(capabilities).getName());			
+
+		//add the capabilities
+		for(Iterator i=capabilities.values().iterator(); i.hasNext();) {
+			helper.addCapability((Capability)i.next());
+		}
+		
+		writeToFileCheck(descriptorDocument, descriptorFile);
+	}
+
+	protected Class getResourceClass(Map capabilities) {
+		for(Iterator i = capabilities.values().iterator(); i.hasNext();) {
+			Capability capability = (Capability)i.next();
+			if(capability.getProperties().size() > 0) {
+				return org.apache.muse.ws.resource.impl.SimpleWsResource.class;
+			}
+		}
+		return org.apache.muse.core.SimpleResource.class;
+	}
+    
+	public ConfigurationDataDescriptor[] getConfigurationDataDescriptions() {
+		return REQUIRED_PARAMETERS;
+	}
+}

Added: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizerConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizerConstants.java?view=auto&rev=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizerConstants.java (added)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/MiniProjectizerConstants.java Fri Dec  8 12:41:25 2006
@@ -0,0 +1,29 @@
+package org.apache.muse.tools.generator.projectizer;
+
+
+public interface MiniProjectizerConstants {
+
+	String[] REQUIRED_MODULES = { "core", "mini", "ws-fx-api", "ws-fx-impl"};
+	
+	String WEB_CONTENT_DIR = "WebContent";
+
+	String LIB_DIR = "WEB-INF/lib";
+
+	String MODULES_DIR = "modules";
+	
+	String DESCRIPTOR_FILE = "WEB-INF/classes/muse.xml";
+	
+	String JAVA_SRC_DIR = "JavaSource";
+	
+	String BUILD_FILE = "build.xml";
+	
+	String RESOURCES_DIR = "/resources/mini/";
+	
+	String BUILD_FILE_RESOURCE = RESOURCES_DIR + "build.xml";
+
+	String WSDL_DIR = "WEB-INF/classes/wsdl";
+
+	String ROUTER_ENTRIES_DIR = "WEB-INF/classes/router-entries";
+
+	String WSDL_RELATIVE_PATH = "/wsdl/";
+}

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/OsgiProjectizer.java Fri Dec  8 12:41:25 2006
@@ -82,7 +82,7 @@
 			Document wsdl = _wsdls[i];
 			createDescriptor(_descriptor, wsdl, descriptorFile, capabilities, Axis2ProjectizerConstants.WSDL_RELATIVE_PATH, i);
 			createWSDLFile(wsdl, wsdldir);			
-			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()));
+			createRouterEntries(routerEntriesDir, WsdlUtils.getServiceName(wsdl.getDocumentElement()), capabilities);
 		}
 	}
 	

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/projectizer/ProxyProjectizer.java Fri Dec  8 12:41:25 2006
@@ -61,7 +61,7 @@
 	}
 
 	protected void loadParameters(ConfigurationData configuration) {
-		_overwrite = _overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
+		_overwrite = ((Boolean)configuration.getParameter(ConfigurationData.OVERWRITE)).booleanValue();
 		_filesMaps = (Map[])configuration.getParameter(ConfigurationData.FILES_MAP_LIST);
 		_targetDirectory = (File)configuration.getParameter(ConfigurationData.TARGET_DIRECTORY);
 		

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerSynthesizer.java Fri Dec  8 12:41:25 2006
@@ -28,6 +28,7 @@
 import org.apache.muse.tools.generator.util.Capability;
 import org.apache.muse.tools.generator.util.ConfigurationData;
 import org.apache.muse.tools.generator.util.ConfigurationDataDescriptor;
+import org.apache.muse.tools.generator.util.SubscriptionManagerHelper;
 import org.apache.muse.tools.inspector.JavaMethod;
 import org.apache.muse.tools.inspector.JavaProperty;
 import org.apache.muse.util.ReflectUtils;
@@ -88,6 +89,8 @@
 		ConfigurationData resultData = (ConfigurationData) configuration.clone();
 		resultData.addParameter(ConfigurationData.FILES_MAP_LIST, _filesMaps);
 		
+		resultData = SubscriptionManagerHelper.addSubscriptionManager(resultData); 
+		
 		return resultData;
 	}
 	
@@ -428,13 +431,14 @@
 	
 	protected String convertType(Class returnType, ClassInfo classInfo) {
 		boolean isArray = returnType.isArray();
+
 		returnType = isArray?ReflectUtils.getClassFromArrayClass(returnType):returnType;
 		
 		//Use fully-qualified name if conflict exists
 		if(classInfo.hasConflict(returnType)) {			
 			return returnType.getName();	
 		}
-        return ReflectUtils.getShortName(returnType);		
+        return ReflectUtils.getShortName(returnType) + (isArray?"[]":"");		
 	}
 
 	protected Class getBaseClass(Capability capability) {
@@ -445,7 +449,7 @@
 	}		
 	
 	protected String makeFileName(ClassInfo classInfo, boolean isInterface) {
-		String name = name = classInfo.getPackageName() + ".";
+		String name = classInfo.getPackageName() + ".";
 		if(isInterface) {
 			name += getInterfaceName(classInfo.getClassShortName());
 		} else {

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/AbstractCommandLineApp.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/AbstractCommandLineApp.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/AbstractCommandLineApp.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/AbstractCommandLineApp.java Fri Dec  8 12:41:25 2006
@@ -43,7 +43,7 @@
 
 	private static Messages _MESSAGES = MessagesFactory.get(AbstractCommandLineApp.class);
 
-	private static Logger _logger = Logger.getLogger(AbstractCommandLineApp.class.getPackage().getName());
+	protected static Logger _logger = Logger.getLogger(AbstractCommandLineApp.class.getPackage().getName());
 	
 	/**
 	 * Tell the logger to info() this message.

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/DefinitionConstants.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/DefinitionConstants.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/DefinitionConstants.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/DefinitionConstants.java Fri Dec  8 12:41:25 2006
@@ -33,7 +33,7 @@
 	
 	String DOCUMENT_STYLE = "document";
 
-	String ENCODED_USE = "encoded";
+	String LITERAL_USE = "literal";
 
 	String PREFIX = "pfx";
 

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/DefinitionInfo.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/DefinitionInfo.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/DefinitionInfo.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/DefinitionInfo.java Fri Dec  8 12:41:25 2006
@@ -51,6 +51,8 @@
 import javax.wsdl.factory.WSDLFactory;
 import javax.xml.namespace.QName;
 
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
 import org.apache.muse.util.xml.XmlUtils;
 import org.apache.muse.util.xml.XsdUtils;
 import org.apache.muse.ws.addressing.WsaConstants;
@@ -73,6 +75,8 @@
  */
 public class DefinitionInfo implements DefinitionConstants{
 
+	private static Messages _MESSAGES = MessagesFactory.get(DefinitionInfo.class);
+	
 	private Definition _definition;
 
 	private PortType _portType;
@@ -288,8 +292,9 @@
 	public void addOperation(Operation operation, Map localMessageMap) {
 		String name = operation.getName();
 	
-		if (_operationNameMap.containsKey(name)) {
-			throw new RuntimeException("Duplicate name " + name);
+		if (_operationNameMap.containsKey(name)) {			
+			Object[] filler = { name };
+			AbstractCommandLineApp.handleMessage(_MESSAGES.get("DuplicateOperation", filler));
 		}
 	
 		Operation newOperation = createOperation(operation, localMessageMap);
@@ -386,7 +391,7 @@
 		bindingFault.setName(fault.getName());
 		
 		SOAPFault soapFault = (SOAPFault)createExtension(BindingFault.class, SOAPConstants.Q_ELEM_SOAP_FAULT);
-		soapFault.setUse(ENCODED_USE);
+		soapFault.setUse(LITERAL_USE);
 		soapFault.setName(fault.getName());
 		bindingFault.addExtensibilityElement(soapFault);
 
@@ -398,7 +403,7 @@
 		bindingOutput.setName(output.getName());
 		
 		SOAPBody soapBody = (SOAPBody)createExtension(BindingOutput.class, SOAPConstants.Q_ELEM_SOAP_BODY);
-		soapBody.setUse(ENCODED_USE);
+		soapBody.setUse(LITERAL_USE);
 		
 		ArrayList list = new ArrayList();
 		list.add(ENCODING_URI);		
@@ -413,7 +418,7 @@
 		bindingInput.setName(input.getName());
 		
 		SOAPBody soapBody = (SOAPBody) createExtension(BindingInput.class, SOAPConstants.Q_ELEM_SOAP_BODY);
-		soapBody.setUse(ENCODED_USE);
+		soapBody.setUse(LITERAL_USE);
 		ArrayList list = new ArrayList();
 		list.add(ENCODING_URI);
 		soapBody.setEncodingStyles(list);
@@ -447,8 +452,7 @@
 		try {
 			return _registry.createExtension(targetClass, qname);
 		} catch (WSDLException e) {
-			//TODO
-//    		AcitLog.logError("Could not create WSDL extension", e);
+			AbstractCommandLineApp.handleErrorAndExit(_MESSAGES.get("WsdlExtensionFailed"), e);
 		}
 		return null;
 	}
@@ -500,7 +504,7 @@
 			Object next = i.next();
 			if(next instanceof Schema) {
 				Schema nextSchema = (Schema)next;
-				Element type = WsdlUtils.getTypeDeclaration(nextSchema.getElement(), qname);
+				Element type = WsdlUtils.getElementDeclaration(nextSchema.getElement(), qname);
 				if(type != null) {
 					return type;
 				}

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/Messages.properties
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/Messages.properties?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/Messages.properties (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/Messages.properties Fri Dec  8 12:41:25 2006
@@ -25,4 +25,8 @@
 RelativeWsdlFileNotFound = The WSDL file XXX was not found. The path must be relative to the descriptor document.
 
 ExceptionMessage = An exception was caught: 
-StackTrace = The exception generated the following stacktrace: 
\ No newline at end of file
+StackTrace = The exception generated the following stacktrace: 
+
+#DefinitionInfo
+DuplicateOperation = The following operation appears more than once in the WSDL files: XXX. Only the first occurence that is found will be used in the end result.
+WsdlExtensionFailed = Could not create a WSDL4J extension. This would usually because because of a missing or incorrect version of WSDL4J, check your classpath.

Added: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/SubscriptionManagerHelper.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/SubscriptionManagerHelper.java?view=auto&rev=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/SubscriptionManagerHelper.java (added)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/util/SubscriptionManagerHelper.java Fri Dec  8 12:41:25 2006
@@ -0,0 +1,185 @@
+/*=============================================================================*
+ *  Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+
+package org.apache.muse.tools.generator.util;
+
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.apache.muse.util.FileUtils;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.resource.lifetime.WsrlConstants;
+import org.apache.muse.ws.resource.lifetime.impl.SimpleImmediateTermination;
+import org.apache.muse.ws.resource.lifetime.impl.SimpleScheduledTermination;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.ws.resource.properties.get.impl.SimpleGetCapability;
+import org.apache.muse.ws.notification.SubscriptionManager;
+import org.apache.muse.ws.notification.impl.SimpleSubscriptionManager;
+import org.apache.muse.ws.notification.WsnConstants;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Endpoints that have <code>resource-type</code>s that are <code>NotificationProducer</code>s
+ * need to have a <code>SubscriptionManager</code> included as a sibling <code>resource-type</code>. 
+ * Without this <code>SubscriptionManager</code> the <code>NotificationProducer</code> capability
+ * will not function. This class will analyze the <code>ConfigurationData</code> and modify it
+ * if a <code>resource-type</code> that has a <code>SubscriptionManager</code> is not found. 
+ * 
+ * @author Andrew Eberbach (aeberbac)
+ */
+public class SubscriptionManagerHelper {
+	
+    public static final String SUBSCRIPTION_MANAGER_DIR = "/resources/common/subscription-manager";
+    public static final String SUBSCRIPTION_MANAGER_RESOURCE_TYPE = SUBSCRIPTION_MANAGER_DIR + "/muse.xml";
+    public static final String SUBSCRIPTION_MANAGER_WSDL = SUBSCRIPTION_MANAGER_DIR + "/SubscriptionManager.wsdl";
+		
+	public static ConfigurationData addSubscriptionManager(ConfigurationData data) {
+		
+		if(needsSubscriptionManager(data)) {
+			modifyDescriptorDocument(data);
+            addSubscriptionManagerCapabilities(data);
+			addSubscriptionManagerWsdl(data);
+		}
+		
+		return data;
+	}
+    
+    private static void addSubscriptionManagerCapabilities(ConfigurationData data){
+        Map[] oldCaps = (Map[])data.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
+        Map[] newCaps = new Map[oldCaps.length + 1];
+        System.arraycopy(oldCaps, 0, newCaps, 0, oldCaps.length);
+        
+        Map subMgrCaps = new HashMap();
+        
+        Capability wsrpGet = new Capability(WsrpConstants.GET_CAPABILITY);
+        wsrpGet.setBuiltIn(true);
+        wsrpGet.setImplementingClass(SimpleGetCapability.class.getName());
+        
+        Capability wsrlImmediate = new Capability(WsrlConstants.IMMEDIATE_TERMINATION_URI);
+        wsrlImmediate.setBuiltIn(true);
+        wsrlImmediate.setImplementingClass(SimpleImmediateTermination.class.getName());
+        
+        Capability wsrlScheduled = new Capability(WsrlConstants.SCHEDULED_TERMINATION_URI);
+        wsrlScheduled.setBuiltIn(true);
+        wsrlScheduled.setImplementingClass(SimpleScheduledTermination.class.getName());
+        
+        Capability subMgr = new Capability(WsnConstants.SUBSCRIPTION_MGR_URI);
+        subMgr.setBuiltIn(true);
+        subMgr.setImplementingClass(SimpleSubscriptionManager.class.getName());
+        
+        subMgrCaps.put(wsrpGet.getURI(), wsrpGet);
+        subMgrCaps.put(wsrlImmediate.getURI(), wsrlImmediate);
+        subMgrCaps.put(wsrlScheduled.getURI(), wsrlScheduled);
+        subMgrCaps.put(subMgr.getURI(), subMgr);
+        
+        newCaps[oldCaps.length] = subMgrCaps;
+        
+        data.addParameter(ConfigurationData.CAPABILITIES_MAP_LIST, newCaps);
+    }
+	
+	private static void addSubscriptionManagerWsdl(ConfigurationData data) {        
+		Document[] oldWsdls = (Document[]) data.getParameter(ConfigurationData.WSDL_DOCUMENT_LIST);
+		Document[] newWsdls = new Document[oldWsdls.length + 1];
+		System.arraycopy(oldWsdls, 0, newWsdls, 0, oldWsdls.length);
+		newWsdls[oldWsdls.length] = loadDocument(SUBSCRIPTION_MANAGER_WSDL);
+        
+        data.addParameter(ConfigurationData.WSDL_DOCUMENT_LIST, newWsdls);
+	}
+
+	private static void modifyDescriptorDocument(ConfigurationData data) {
+		Document subscriptionType = loadDocument(SUBSCRIPTION_MANAGER_RESOURCE_TYPE);
+		
+		Document descriptorDocument = (Document)data.getParameter(ConfigurationData.DESCRIPTOR_DOCUMENT);
+		
+		Node importedSubscriptionType = descriptorDocument.importNode(subscriptionType.getDocumentElement(), true);
+		
+		insertAfterLastResourceType(descriptorDocument, importedSubscriptionType);
+	}
+	
+	private static void insertAfterLastResourceType(Document descriptorDocument, Node importedSubscriptionType) {		
+		Element nodeAfterLastResourceType = getNodeAfterLastResourceType(descriptorDocument);
+		
+		if(nodeAfterLastResourceType == null) {
+			descriptorDocument.getDocumentElement().appendChild(importedSubscriptionType);
+		} else {
+			descriptorDocument.getDocumentElement().insertBefore(nodeAfterLastResourceType, importedSubscriptionType);
+		}
+	}
+
+	private static Element getNodeAfterLastResourceType(Document descriptorDocument) {
+		Element[] elements = XmlUtils.getAllElements(descriptorDocument.getDocumentElement());
+		
+		//
+		// This is the marker for the last resource-type element. We're going to do this by finding
+		// the last resource-type element and then repeatedly doing a getNextSibling, 
+		// checking to see if it's an Element until it is, or the getNextSibling is null.
+		//
+		// Remember, getNextSibling returns a *Node* so who knows if it's not a text node...
+		//
+		Node last = elements[elements.length - 1].getNextSibling();
+		
+		while(last != null) {	
+			
+			//
+			// If this is true it has to be a non-resource-type element
+			//
+			if(last instanceof Element) {
+				return (Element)last;
+			}
+			last = last.getNextSibling();
+		} 
+		
+		//
+		// We ran off the end
+		//
+		return null;
+	}
+
+	private static Document loadDocument(String path) {
+		InputStream inputStream = FileUtils.loadFromContext(SubscriptionManager.class, path);
+		try {
+			return XmlUtils.createDocument(inputStream);
+		} catch (Exception e) {
+			throw new RuntimeException(e.getMessage(), e);
+		}
+	}
+
+	private static boolean needsSubscriptionManager(ConfigurationData data) {
+		Map[] capabilityMaps = (Map[])data.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
+		
+		boolean hasNotificationProducer = false;
+		boolean hasSubscriptionManager = false;		
+		
+		for(int j=0; j < capabilityMaps.length; j++) {
+			for(Iterator i = capabilityMaps[j].values().iterator(); i.hasNext(); ) {
+				Capability capability = (Capability)i.next();				
+				String uri = capability.getURI();
+				if(uri.equals(WsnConstants.SUBSCRIPTION_MGR_URI)) {
+					hasSubscriptionManager = true;
+				}
+				if(uri.equals(WsnConstants.PRODUCER_URI)) {
+					hasNotificationProducer = true;
+				}
+			}
+		}
+		
+		return hasNotificationProducer && !hasSubscriptionManager;
+	}
+}

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java?view=diff&rev=484767&r1=484766&r2=484767
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/inspector/ResourceInspector.java Fri Dec  8 12:41:25 2006
@@ -41,6 +41,8 @@
 import javax.wsdl.xml.WSDLReader;
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Element;
+
 import org.apache.muse.core.Environment;
 import org.apache.muse.core.proxy.ProxyHandler;
 import org.apache.muse.core.proxy.ReflectionProxyHandler;
@@ -65,7 +67,6 @@
 import org.apache.muse.ws.resource.properties.schema.impl.SimpleResourcePropertiesSchema;
 import org.apache.muse.ws.resource.remote.WsResourceClient;
 import org.apache.muse.ws.wsdl.WsdlUtils;
-import org.w3c.dom.Element;
 
 /**
  *
@@ -326,7 +327,7 @@
         method.setName(getInputName(op));
         method.setReturnName(getOutputName(op));
         
-        Element inputElement = WsdlUtils.getTypeDeclaration(wsdl, method.getName());
+        Element inputElement = WsdlUtils.getElementDeclaration(wsdl, method.getName());
         if (inputElement == null)
         {
             Object[] filler = { method.getName() };
@@ -336,7 +337,7 @@
         Element outputElement = null;
         
         if (method.getReturnName() != null)
-            outputElement = WsdlUtils.getTypeDeclaration(wsdl, method.getReturnName());
+            outputElement = WsdlUtils.getElementDeclaration(wsdl, method.getReturnName());
                 
         method.setReturnSchemaType(getSchemaType(outputElement));
         method.setReturnType(getJavaType(method.getReturnSchemaType()));
@@ -729,7 +730,7 @@
     private ResourcePropertiesSchema getWsrpSchema(Element wsdl, QName portType)
     {
         QName wsrpName = WsrpUtils.getPropertiesName(wsdl, portType);
-        Element wsrp = WsdlUtils.getTypeDeclaration(wsdl, wsrpName);
+        Element wsrp = WsdlUtils.getElementDeclaration(wsdl, wsrpName);
         return new SimpleResourcePropertiesSchema(wsrpName, wsrp);
     }
     
@@ -826,6 +827,7 @@
         {
             WSDLFactory factory = WSDLFactory.newInstance();
             WSDLReader reader = factory.newWSDLReader();
+            reader.setFeature(WsdlUtils.WSDL4J_VERBOSE_FLAG, false);
             def = reader.readWSDL(path, wsdl);
         }
         



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org