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 2007/03/24 14:14:24 UTC

svn commit: r522019 [6/12] - in /webservices/muse/trunk/modules: muse-tools/src/org/apache/muse/tools/generator/ muse-tools/src/org/apache/muse/tools/generator/analyzer/ muse-tools/src/org/apache/muse/tools/generator/projectizer/ muse-tools/src/org/apa...

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ProxyInterfaceSynthesizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ProxyInterfaceSynthesizer.java?view=diff&rev=522019&r1=522018&r2=522019
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ProxyInterfaceSynthesizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ProxyInterfaceSynthesizer.java Sat Mar 24 06:14:20 2007
@@ -1,517 +1,521 @@
-/*=============================================================================*
- *  Copyright 2007 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.synthesizer;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-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.inspector.JavaMethod;
-import org.apache.muse.tools.inspector.JavaProperty;
-import org.apache.muse.tools.inspector.ResourceInspector;
-import org.apache.muse.util.ReflectUtils;
-import org.apache.muse.util.xml.XmlUtils;
-import org.apache.muse.ws.addressing.soap.SoapFault;
-import org.apache.muse.ws.metadata.WsxConstants;
-import org.apache.muse.ws.notification.WsnConstants;
-import org.apache.muse.ws.notification.remote.NotificationConsumerClient;
-import org.apache.muse.ws.notification.remote.NotificationProducerClient;
-import org.apache.muse.ws.resource.lifetime.WsrlConstants;
-import org.apache.muse.ws.resource.properties.WsrpConstants;
-import org.apache.muse.ws.resource.remote.WsResourceClient;
-import org.apache.muse.ws.wsdl.WsdlUtils;
-import org.w3c.dom.Document;
-
-public class ProxyInterfaceSynthesizer extends AbstractSynthesizer {
-
-	private static final String TARGET_NS_ATTR = "targetNamespace";
-
-	protected static final String PARAM_NAME = "param";
-	
-	static ConfigurationDataDescriptor[] REQUIRED_PARAMETERS = 
-		new ConfigurationDataDescriptor[] {
-			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION,
-			ConfigurationData.GENERATE_CUSTOM_HEADERS_CONFIGURATION,
-			ConfigurationData.WSDL_DOCUMENT_LIST_CONFIGURATION
-		};
-	
-	protected static Set _ignoredCapabilitySet;
-	
-	static {
-		_ignoredCapabilitySet = new HashSet();
-		
-		_ignoredCapabilitySet.add(WsxConstants.GET_METADATA_CAPABILITY);
-	}
-	
-	protected static Map _clientCapabilitiesMap;
-	
-	static {
-		_clientCapabilitiesMap = new HashMap();
-		
-		Set baseClientset = new HashSet();
-		baseClientset.add(WsrpConstants.GET_CAPABILITY);
-		baseClientset.add(WsrpConstants.QUERY_CAPABILITY);
-		baseClientset.add(WsrpConstants.SET_CAPABILITY);
-		baseClientset.add(WsrlConstants.IMMEDIATE_TERMINATION_URI);
-		baseClientset.add(WsrlConstants.SCHEDULED_TERMINATION_URI);
-		_clientCapabilitiesMap.put(WsResourceClient.class, baseClientset);
-		
-		Set set = new HashSet();	
-		set.add(WsnConstants.PRODUCER_URI);
-		set.addAll(baseClientset);
-		_clientCapabilitiesMap.put(NotificationProducerClient.class, set);
-		
-		set = new HashSet();
-		set.add(WsnConstants.CONSUMER_URI);
-		set.addAll(baseClientset);
-		_clientCapabilitiesMap.put(NotificationConsumerClient.class, set);
-	}
-	
-	protected StringBuffer _headerCode;
-
-	protected StringBuffer _operationsCode;
-
-	protected StringBuffer _propertiesCode;
-	
-	String _className;
-
-	protected Set _importSet;
-
-	private boolean _hasProperties;
-
-	protected boolean _generateCustomHeaders;
-
-	private Map[] _capabilityMaps;
-
-	private Document[] _wsdlDocuments;
-	
-	protected Class _baseClientClass;
-
-	private Map[] _filesMaps;
-
-	private int _index = 0;
-
-	public ConfigurationData synthesize(ConfigurationData data)
-			throws Exception {
-		ConfigurationData.checkConfiguration(this, data);
-		loadParameters(data);
-
-		for (int i = 0; i < _capabilityMaps.length; i++) {			
-			if (_filesMaps[i] == null) {
-				_filesMaps[i] = new HashMap();
-			}
-			
-			generateCode(_wsdlDocuments[i], _capabilityMaps[i], _filesMaps[i]);
-		}
-
-		return data;
-	}
-
-	protected void loadParameters(ConfigurationData data) {
-		_generateCustomHeaders = ((Boolean)data.getParameter(ConfigurationData.GENERATE_CUSTOM_HEADERS)).booleanValue();
-		_capabilityMaps = (Map[])data.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
-		_wsdlDocuments = (Document[])data.getParameter(ConfigurationData.WSDL_DOCUMENT_LIST);		        
-		_filesMaps = (Map[])data.getParameter(ConfigurationData.FILES_MAP_LIST);
-		
-		if(_filesMaps == null) {
-			_filesMaps = new HashMap[_capabilityMaps.length];			
-			data.addParameter(ConfigurationData.FILES_MAP_LIST, _filesMaps);
-		}               
-	}
-	
-	protected void generateCode(Document wsdl, Map capabilityMap, Map files) {
-		String className = generateClassName(wsdl);
-
-		_baseClientClass = getBaseClientClass(capabilityMap);
-		initializeCode(className);
-		
-		ClassInfo classInfo = new ClassInfo();
-		
-		for (Iterator i = capabilityMap.values().iterator(); i.hasNext();) {
-			Capability capability = (Capability)i.next();
-								
-			if(needsGeneratedCode(_baseClientClass, capability)) {
-				classInfo.setCapability(capability);
-				updateCode(classInfo);
-			}
-		}
-
-		files.put(createFileName(className), generateCombinedCode(classInfo));
-	}
-	
-	private boolean needsGeneratedCode(Class clientClass, Capability capability) {
-		boolean needsGeneratedCode = true;
-		String uri = capability.getURI();
-		Class clazz = null;
-		
-		if(NotificationProducerClient.class.isAssignableFrom(clientClass)) {
-			clazz = NotificationProducerClient.class;
-		} else if(NotificationConsumerClient.class.isAssignableFrom(clientClass)) {
-			clazz = NotificationConsumerClient.class;
-		} else { // if(WsResourceClient.class.isAssignableFrom(clientClass)) {
-			clazz = WsResourceClient.class;
-		}
-
-		if(clazz != null) {
-			Set set = (Set)_clientCapabilitiesMap.get(clazz);
-			if(set.contains(uri) || _ignoredCapabilitySet.contains(uri)) {
-				needsGeneratedCode = false;
-			}
-		}
-		
-		return needsGeneratedCode;
-	}
-
-	private Class getBaseClientClass(Map capabilityMap) {
-		if(capabilityMap.containsKey(WsnConstants.PRODUCER_URI)) {
-			return NotificationProducerClient.class;
-		} else if(capabilityMap.containsKey(WsnConstants.CONSUMER_URI)) {
-			return NotificationConsumerClient.class;
-		} else {
-			return WsResourceClient.class;
-		}
-	}
-
-	protected String generateClassName(Document wsdlDocument) {
-		String packageName = ClassInfo.getPackageName(wsdlDocument
-				.getDocumentElement().getAttribute(TARGET_NS_ATTR));
-		return packageName
-				+ "."
-				+ WsdlUtils.getServiceName(XmlUtils
-						.getDocumentRoot(wsdlDocument));
-	}
-	
-	protected void initializeCode(String className) {
-		_className = className;
-		_headerCode = beginHeaderCode(_className);
-		_operationsCode = beginOperationsCode();
-		_propertiesCode = beginPropertiesCode();
-		_importSet = new HashSet();
-		_hasProperties = false;
-		resetIndex();
-	}
-
-	protected void resetIndex() {
-		_index = 0;
-	}
-
-	private StringBuffer beginOperationsCode() {
-		return new StringBuffer();
-	}
-	
-	private StringBuffer beginPropertiesCode() {
-		StringBuffer code = new StringBuffer();
-
-		indent(code);
-		code.append("QName[] PROPERTIES = {");
-
-		return code;
-	}
-
-	protected void updateCode(ClassInfo classInfo) {
-		Capability capability = classInfo.getCapability();
-		
-		updateMethods(classInfo, _operationsCode);
-
-		if (!capability.getProperties().isEmpty()) {
-			_hasProperties = true;
-			updateProperties(classInfo, _propertiesCode);
-		}
-
-		classInfo.addImports(_importSet);
-	}
-	
-	protected void updateMethods(ClassInfo classInfo, StringBuffer code) {
-		Iterator i = classInfo.getCapability().getOperations().iterator();
-
-		while (i.hasNext()) {
-			JavaMethod method = (JavaMethod) i.next();
-			generateMethod(method, classInfo, code);
-		}
-
-		i = classInfo.getCapability().getProperties().iterator();
-
-		while (i.hasNext()) {
-			JavaProperty property = (JavaProperty) i.next();
-
-			generatePropertyGet(property, classInfo, getIndex(), code);
-			if (property.isAppendable())
-				generatePropertyInsert(property, classInfo, getIndex(), code);
-
-			if (property.isMutable()) {
-				generatePropertyUpdate(property, classInfo, getIndex(), code);
-				generatePropertyDelete(property, classInfo, getIndex(), code);
-			}
-
-			incrementIndex();
-		}
-	}
-
-	private void incrementIndex() {
-		_index++;
-	}
-
-	private int getIndex() {
-		return _index;
-	}
-
-	private void generateMethod(JavaMethod method, ClassInfo classInfo,
-			StringBuffer code) {
-		newLine(2, code);
-		indent(code);
-
-		generateMethodQualifier(code);
-
-		Class returnType = method.getReturnType();
-		code.append(ReflectUtils.getShortName(returnType));
-
-		code.append(' ');
-		code.append(method.getJavaName());
-
-		QName[] paramNames = method.getParameterTypeNames();
-		Class[] paramTypes = method.getParameterTypes();
-		generateParamList(paramNames, paramTypes, code);
-
-		newLine(code);
-		indent(2, code);
-		code.append("throws SoapFault");
-		addImport(SoapFault.class);
-
-		generateMethodBody(method, classInfo, code);
-		
-		newLine(code);
-	}
-		
-	protected void addImports(Class[] classes) {
-		for(int i=0; i < classes.length; i++) {
-			addImport(classes[i]);
-		}
-	}
-		
-	protected void addImport(Class className) {
-		_importSet.add(className);
-	}
-	
-	protected void generateMethodQualifier(StringBuffer code) {
-		//Do nothing 
-	}
-	
-	protected void generateParamList(QName[] paramNames, Class[] paramTypes,
-			StringBuffer code) {
-		code.append('(');
-
-		for (int n = 0; n < paramTypes.length; ++n) {
-			code.append(ReflectUtils.getShortName(paramTypes[n]));
-			code.append(' ');
-
-			if (paramNames != null)
-				code.append(ResourceInspector.getLowerCamelName(paramNames[n]
-						.getLocalPart()));
-
-			else
-				code.append(PARAM_NAME + n);
-
-			if (n != paramTypes.length - 1)
-				code.append(", ");
-		}
-
-		if (_generateCustomHeaders) {
-			if (paramTypes.length > 0) {
-				code.append(", ");
-			}
-
-			code.append("Element[] customHeaders");
-		}
-
-		code.append(")");
-	}
-	
-	protected void generateMethodBody(JavaMethod method, ClassInfo classInfo, StringBuffer code) {
-		code.append(';');
-	}
-	
-	private void generatePropertyGet(JavaProperty property,
-			ClassInfo classInfo, int propertyIndex, StringBuffer code) {
-		newLine(code);
-		indent(code);
-
-		generateMethodQualifier(code);
-			
-		Class type = property.getJavaType();
-		code.append(convertType(type, classInfo));
-
-		code.append(' ');
-		code.append("get" + property.getName().getLocalPart());
-		code.append("()");
-		newLine(code);
-		indent(2, code);
-		code.append("throws SoapFault");
-		addImport(SoapFault.class);
-
-		generatePropertyGetBody(property, classInfo, propertyIndex, code);
-		
-		newLine(code);
-	}
-	
-	protected void generatePropertyGetBody(JavaProperty property, ClassInfo classInfo, int propertyIndex, StringBuffer code) {
-		code.append(';');
-	}
-	
-	private void generatePropertyUpdate(JavaProperty property,
-			ClassInfo classInfo, int propertyIndex, StringBuffer code) {
-		generatePropertySet(property, classInfo, propertyIndex, "update", code);
-	}
-
-	private void generatePropertyInsert(JavaProperty property,
-			ClassInfo classInfo, int propertyIndex, StringBuffer code) {
-		generatePropertySet(property, classInfo, propertyIndex, "insert", code);
-	}
-	
-	private void generatePropertySet(JavaProperty property,
-			ClassInfo classInfo, int propertyIndex, String setType, StringBuffer code) {
-		newLine(code);
-		indent(code);
-
-		generateMethodQualifier(code);
-
-		Class type = property.getJavaType();
-		if(type.isArray()) {
-			type = ReflectUtils.getClassFromArrayClass(type);
-		}
-
-		code.append("void ");
-		code.append(setType);
-		code.append(property.getName().getLocalPart());
-		code.append('(');
-		code.append(ReflectUtils.getShortName(type));
-		code.append(" value)");
-		newLine(code);
-		indent(2, code);
-		code.append("throws SoapFault");
-		addImport(SoapFault.class);
-
-		generatePropertySetBody(property, classInfo, propertyIndex, setType, code);
-
-		newLine(code);
-	}
-	
-	protected void generatePropertySetBody(JavaProperty property, ClassInfo classInfo, int propertyIndex, String setType, StringBuffer code) {
-		code.append(';');
-	}
-	
-	private void generatePropertyDelete(JavaProperty property,
-			ClassInfo classInfo, int propertyIndex, StringBuffer code) {
-
-		newLine(code);
-		indent(code);
-
-		generateMethodQualifier(code);
-
-		code.append("void delete" + property.getName().getLocalPart());
-		code.append("()");
-		newLine(code);
-		indent(2, code);
-		code.append("throws SoapFault");
-		addImport(SoapFault.class);
-
-		generatePropertyDeleteBody(property, classInfo, propertyIndex, code);
-
-		newLine(code);
-	}
-	
-	protected void generatePropertyDeleteBody(JavaProperty property, ClassInfo classInfo, int propertyIndex, StringBuffer code) {
-		code.append(';');
-	}
-	
-	private void updateProperties(ClassInfo classInfo, StringBuffer code) {
-		Iterator i = classInfo.getCapability().getProperties().iterator();
-
-		if (i.hasNext()) {
-			addImport(QName.class);
-		}
-
-		while (i.hasNext()) {
-			generatePropertyConstant((JavaProperty) i.next(), code);
-		}
-	}
-	
-	private void generatePropertyConstant(JavaProperty property,
-			StringBuffer code) {
-		newLine(code);
-		indent(2, code);
-		generateQName(property.getName(), code);
-		code.append(",");
-	}
-
-	protected String generateCombinedCode(ClassInfo classInfo) {
-		endHeaderCode(classInfo);
-		endOperationsCode();
-		endPropertiesCode();
-
-		StringBuffer code = new StringBuffer();
-
-		code.append(_headerCode);
-		code.append(_operationsCode);
-
-		if (_hasProperties) {
-			code.append(_propertiesCode);
-		}
-
-		return code.append(generateFooterCode()).toString();
-	}
-
-	protected void endHeaderCode(ClassInfo classInfo) {
-		generateImports(classInfo, _headerCode);
-		generateClassDef(_className, true, _headerCode);
-	}
-	
-	private void endOperationsCode() {
-		newLine(_operationsCode);
-	}
-	
-	private void endPropertiesCode() {
-		int length = _propertiesCode.length();
-		_propertiesCode.delete(length - 1, length);
-
-		newLine(_propertiesCode);
-		indent(_propertiesCode);
-		generateCloseBlock(_propertiesCode);
-		_propertiesCode.append(";");
-		newLine(_propertiesCode);
-	}
-
-	private StringBuffer generateFooterCode() {
-		StringBuffer code = new StringBuffer();
-
-		newLine(code);
-		generateCloseBlock(code);
-		newLine(code);
-
-		return code;
-	}
-
-	public ConfigurationDataDescriptor[] getConfigurationDataDescriptions() {
-		return REQUIRED_PARAMETERS;
-	}
-}
\ No newline at end of file
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.synthesizer;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+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.inspector.JavaMethod;
+import org.apache.muse.tools.inspector.JavaProperty;
+import org.apache.muse.tools.inspector.ResourceInspector;
+import org.apache.muse.util.ReflectUtils;
+import org.apache.muse.util.xml.XmlUtils;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+import org.apache.muse.ws.metadata.WsxConstants;
+import org.apache.muse.ws.notification.WsnConstants;
+import org.apache.muse.ws.notification.remote.NotificationConsumerClient;
+import org.apache.muse.ws.notification.remote.NotificationProducerClient;
+import org.apache.muse.ws.resource.lifetime.WsrlConstants;
+import org.apache.muse.ws.resource.properties.WsrpConstants;
+import org.apache.muse.ws.resource.remote.WsResourceClient;
+import org.apache.muse.ws.wsdl.WsdlUtils;
+import org.w3c.dom.Document;
+
+public class ProxyInterfaceSynthesizer extends AbstractSynthesizer {
+
+	private static final String TARGET_NS_ATTR = "targetNamespace";
+
+	protected static final String PARAM_NAME = "param";
+	
+	static ConfigurationDataDescriptor[] REQUIRED_PARAMETERS = 
+		new ConfigurationDataDescriptor[] {
+			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION,
+			ConfigurationData.GENERATE_CUSTOM_HEADERS_CONFIGURATION,
+			ConfigurationData.WSDL_DOCUMENT_LIST_CONFIGURATION
+		};
+	
+	protected static Set _ignoredCapabilitySet;
+	
+	static {
+		_ignoredCapabilitySet = new HashSet();
+		
+		_ignoredCapabilitySet.add(WsxConstants.GET_METADATA_CAPABILITY);
+	}
+	
+	protected static Map _clientCapabilitiesMap;
+	
+	static {
+		_clientCapabilitiesMap = new HashMap();
+		
+		Set baseClientset = new HashSet();
+		baseClientset.add(WsrpConstants.GET_CAPABILITY);
+		baseClientset.add(WsrpConstants.QUERY_CAPABILITY);
+		baseClientset.add(WsrpConstants.SET_CAPABILITY);
+		baseClientset.add(WsrlConstants.IMMEDIATE_TERMINATION_URI);
+		baseClientset.add(WsrlConstants.SCHEDULED_TERMINATION_URI);
+		_clientCapabilitiesMap.put(WsResourceClient.class, baseClientset);
+		
+		Set set = new HashSet();	
+		set.add(WsnConstants.PRODUCER_URI);
+		set.addAll(baseClientset);
+		_clientCapabilitiesMap.put(NotificationProducerClient.class, set);
+		
+		set = new HashSet();
+		set.add(WsnConstants.CONSUMER_URI);
+		set.addAll(baseClientset);
+		_clientCapabilitiesMap.put(NotificationConsumerClient.class, set);
+	}
+	
+	protected StringBuffer _headerCode;
+
+	protected StringBuffer _operationsCode;
+
+	protected StringBuffer _propertiesCode;
+	
+	String _className;
+
+	protected Set _importSet;
+
+	private boolean _hasProperties;
+
+	protected boolean _generateCustomHeaders;
+
+	private Map[] _capabilityMaps;
+
+	private Document[] _wsdlDocuments;
+	
+	protected Class _baseClientClass;
+
+	private Map[] _filesMaps;
+
+	private int _index = 0;
+
+	public ConfigurationData synthesize(ConfigurationData data)
+			throws Exception {
+		ConfigurationData.checkConfiguration(this, data);
+		loadParameters(data);
+
+		for (int i = 0; i < _capabilityMaps.length; i++) {			
+			if (_filesMaps[i] == null) {
+				_filesMaps[i] = new HashMap();
+			}
+			
+			generateCode(_wsdlDocuments[i], _capabilityMaps[i], _filesMaps[i]);
+		}
+
+		return data;
+	}
+
+	protected void loadParameters(ConfigurationData data) {
+		_generateCustomHeaders = ((Boolean)data.getParameter(ConfigurationData.GENERATE_CUSTOM_HEADERS)).booleanValue();
+		_capabilityMaps = (Map[])data.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
+		_wsdlDocuments = (Document[])data.getParameter(ConfigurationData.WSDL_DOCUMENT_LIST);		        
+		_filesMaps = (Map[])data.getParameter(ConfigurationData.FILES_MAP_LIST);
+		
+		if(_filesMaps == null) {
+			_filesMaps = new HashMap[_capabilityMaps.length];			
+			data.addParameter(ConfigurationData.FILES_MAP_LIST, _filesMaps);
+		}               
+	}
+	
+	protected void generateCode(Document wsdl, Map capabilityMap, Map files) {
+		String className = generateClassName(wsdl);
+
+		_baseClientClass = getBaseClientClass(capabilityMap);
+		initializeCode(className);
+		
+		ClassInfo classInfo = new ClassInfo();
+		
+		for (Iterator i = capabilityMap.values().iterator(); i.hasNext();) {
+			Capability capability = (Capability)i.next();
+								
+			if(needsGeneratedCode(_baseClientClass, capability)) {
+				classInfo.setCapability(capability);
+				updateCode(classInfo);
+			}
+		}
+
+		files.put(createFileName(className), generateCombinedCode(classInfo));
+	}
+	
+	private boolean needsGeneratedCode(Class clientClass, Capability capability) {
+		boolean needsGeneratedCode = true;
+		String uri = capability.getURI();
+		Class clazz = null;
+		
+		if(NotificationProducerClient.class.isAssignableFrom(clientClass)) {
+			clazz = NotificationProducerClient.class;
+		} else if(NotificationConsumerClient.class.isAssignableFrom(clientClass)) {
+			clazz = NotificationConsumerClient.class;
+		} else { // if(WsResourceClient.class.isAssignableFrom(clientClass)) {
+			clazz = WsResourceClient.class;
+		}
+
+		if(clazz != null) {
+			Set set = (Set)_clientCapabilitiesMap.get(clazz);
+			if(set.contains(uri) || _ignoredCapabilitySet.contains(uri)) {
+				needsGeneratedCode = false;
+			}
+		}
+		
+		return needsGeneratedCode;
+	}
+
+	private Class getBaseClientClass(Map capabilityMap) {
+		if(capabilityMap.containsKey(WsnConstants.PRODUCER_URI)) {
+			return NotificationProducerClient.class;
+		} else if(capabilityMap.containsKey(WsnConstants.CONSUMER_URI)) {
+			return NotificationConsumerClient.class;
+		} else {
+			return WsResourceClient.class;
+		}
+	}
+
+	protected String generateClassName(Document wsdlDocument) {
+		String packageName = ClassInfo.getPackageName(wsdlDocument
+				.getDocumentElement().getAttribute(TARGET_NS_ATTR));
+		return packageName
+				+ "."
+				+ WsdlUtils.getServiceName(XmlUtils
+						.getDocumentRoot(wsdlDocument));
+	}
+	
+	protected void initializeCode(String className) {
+		_className = className;
+		_headerCode = beginHeaderCode(_className);
+		_operationsCode = beginOperationsCode();
+		_propertiesCode = beginPropertiesCode();
+		_importSet = new HashSet();
+		_hasProperties = false;
+		resetIndex();
+	}
+
+	protected void resetIndex() {
+		_index = 0;
+	}
+
+	private StringBuffer beginOperationsCode() {
+		return new StringBuffer();
+	}
+	
+	private StringBuffer beginPropertiesCode() {
+		StringBuffer code = new StringBuffer();
+
+		indent(code);
+		code.append("QName[] PROPERTIES = {");
+
+		return code;
+	}
+
+	protected void updateCode(ClassInfo classInfo) {
+		Capability capability = classInfo.getCapability();
+		
+		updateMethods(classInfo, _operationsCode);
+
+		if (!capability.getProperties().isEmpty()) {
+			_hasProperties = true;
+			updateProperties(classInfo, _propertiesCode);
+		}
+
+		classInfo.addImports(_importSet);
+	}
+	
+	protected void updateMethods(ClassInfo classInfo, StringBuffer code) {
+		Iterator i = classInfo.getCapability().getOperations().iterator();
+
+		while (i.hasNext()) {
+			JavaMethod method = (JavaMethod) i.next();
+			generateMethod(method, classInfo, code);
+		}
+
+		i = classInfo.getCapability().getProperties().iterator();
+
+		while (i.hasNext()) {
+			JavaProperty property = (JavaProperty) i.next();
+
+			generatePropertyGet(property, classInfo, getIndex(), code);
+			if (property.isAppendable())
+				generatePropertyInsert(property, classInfo, getIndex(), code);
+
+			if (property.isMutable()) {
+				generatePropertyUpdate(property, classInfo, getIndex(), code);
+				generatePropertyDelete(property, classInfo, getIndex(), code);
+			}
+
+			incrementIndex();
+		}
+	}
+
+	private void incrementIndex() {
+		_index++;
+	}
+
+	private int getIndex() {
+		return _index;
+	}
+
+	private void generateMethod(JavaMethod method, ClassInfo classInfo,
+			StringBuffer code) {
+		newLine(2, code);
+		indent(code);
+
+		generateMethodQualifier(code);
+
+		Class returnType = method.getReturnType();
+		code.append(ReflectUtils.getShortName(returnType));
+
+		code.append(' ');
+		code.append(method.getJavaName());
+
+		QName[] paramNames = method.getParameterTypeNames();
+		Class[] paramTypes = method.getParameterTypes();
+		generateParamList(paramNames, paramTypes, code);
+
+		newLine(code);
+		indent(2, code);
+		code.append("throws SoapFault");
+		addImport(SoapFault.class);
+
+		generateMethodBody(method, classInfo, code);
+		
+		newLine(code);
+	}
+		
+	protected void addImports(Class[] classes) {
+		for(int i=0; i < classes.length; i++) {
+			addImport(classes[i]);
+		}
+	}
+		
+	protected void addImport(Class className) {
+		_importSet.add(className);
+	}
+	
+	protected void generateMethodQualifier(StringBuffer code) {
+		//Do nothing 
+	}
+	
+	protected void generateParamList(QName[] paramNames, Class[] paramTypes,
+			StringBuffer code) {
+		code.append('(');
+
+		for (int n = 0; n < paramTypes.length; ++n) {
+			code.append(ReflectUtils.getShortName(paramTypes[n]));
+			code.append(' ');
+
+			if (paramNames != null)
+				code.append(ResourceInspector.getLowerCamelName(paramNames[n]
+						.getLocalPart()));
+
+			else
+				code.append(PARAM_NAME + n);
+
+			if (n != paramTypes.length - 1)
+				code.append(", ");
+		}
+
+		if (_generateCustomHeaders) {
+			if (paramTypes.length > 0) {
+				code.append(", ");
+			}
+
+			code.append("Element[] customHeaders");
+		}
+
+		code.append(")");
+	}
+	
+	protected void generateMethodBody(JavaMethod method, ClassInfo classInfo, StringBuffer code) {
+		code.append(';');
+	}
+	
+	private void generatePropertyGet(JavaProperty property,
+			ClassInfo classInfo, int propertyIndex, StringBuffer code) {
+		newLine(code);
+		indent(code);
+
+		generateMethodQualifier(code);
+			
+		Class type = property.getJavaType();
+		code.append(convertType(type, classInfo));
+
+		code.append(' ');
+		code.append("get" + property.getName().getLocalPart());
+		code.append("()");
+		newLine(code);
+		indent(2, code);
+		code.append("throws SoapFault");
+		addImport(SoapFault.class);
+
+		generatePropertyGetBody(property, classInfo, propertyIndex, code);
+		
+		newLine(code);
+	}
+	
+	protected void generatePropertyGetBody(JavaProperty property, ClassInfo classInfo, int propertyIndex, StringBuffer code) {
+		code.append(';');
+	}
+	
+	private void generatePropertyUpdate(JavaProperty property,
+			ClassInfo classInfo, int propertyIndex, StringBuffer code) {
+		generatePropertySet(property, classInfo, propertyIndex, "update", code);
+	}
+
+	private void generatePropertyInsert(JavaProperty property,
+			ClassInfo classInfo, int propertyIndex, StringBuffer code) {
+		generatePropertySet(property, classInfo, propertyIndex, "insert", code);
+	}
+	
+	private void generatePropertySet(JavaProperty property,
+			ClassInfo classInfo, int propertyIndex, String setType, StringBuffer code) {
+		newLine(code);
+		indent(code);
+
+		generateMethodQualifier(code);
+
+		Class type = property.getJavaType();
+		if(type.isArray()) {
+			type = ReflectUtils.getClassFromArrayClass(type);
+		}
+
+		code.append("void ");
+		code.append(setType);
+		code.append(property.getName().getLocalPart());
+		code.append('(');
+		code.append(ReflectUtils.getShortName(type));
+		code.append(" value)");
+		newLine(code);
+		indent(2, code);
+		code.append("throws SoapFault");
+		addImport(SoapFault.class);
+
+		generatePropertySetBody(property, classInfo, propertyIndex, setType, code);
+
+		newLine(code);
+	}
+	
+	protected void generatePropertySetBody(JavaProperty property, ClassInfo classInfo, int propertyIndex, String setType, StringBuffer code) {
+		code.append(';');
+	}
+	
+	private void generatePropertyDelete(JavaProperty property,
+			ClassInfo classInfo, int propertyIndex, StringBuffer code) {
+
+		newLine(code);
+		indent(code);
+
+		generateMethodQualifier(code);
+
+		code.append("void delete" + property.getName().getLocalPart());
+		code.append("()");
+		newLine(code);
+		indent(2, code);
+		code.append("throws SoapFault");
+		addImport(SoapFault.class);
+
+		generatePropertyDeleteBody(property, classInfo, propertyIndex, code);
+
+		newLine(code);
+	}
+	
+	protected void generatePropertyDeleteBody(JavaProperty property, ClassInfo classInfo, int propertyIndex, StringBuffer code) {
+		code.append(';');
+	}
+	
+	private void updateProperties(ClassInfo classInfo, StringBuffer code) {
+		Iterator i = classInfo.getCapability().getProperties().iterator();
+
+		if (i.hasNext()) {
+			addImport(QName.class);
+		}
+
+		while (i.hasNext()) {
+			generatePropertyConstant((JavaProperty) i.next(), code);
+		}
+	}
+	
+	private void generatePropertyConstant(JavaProperty property,
+			StringBuffer code) {
+		newLine(code);
+		indent(2, code);
+		generateQName(property.getName(), code);
+		code.append(",");
+	}
+
+	protected String generateCombinedCode(ClassInfo classInfo) {
+		endHeaderCode(classInfo);
+		endOperationsCode();
+		endPropertiesCode();
+
+		StringBuffer code = new StringBuffer();
+
+		code.append(_headerCode);
+		code.append(_operationsCode);
+
+		if (_hasProperties) {
+			code.append(_propertiesCode);
+		}
+
+		return code.append(generateFooterCode()).toString();
+	}
+
+	protected void endHeaderCode(ClassInfo classInfo) {
+		generateImports(classInfo, _headerCode);
+		generateClassDef(_className, true, _headerCode);
+	}
+	
+	private void endOperationsCode() {
+		newLine(_operationsCode);
+	}
+	
+	private void endPropertiesCode() {
+		int length = _propertiesCode.length();
+		_propertiesCode.delete(length - 1, length);
+
+		newLine(_propertiesCode);
+		indent(_propertiesCode);
+		generateCloseBlock(_propertiesCode);
+		_propertiesCode.append(";");
+		newLine(_propertiesCode);
+	}
+
+	private StringBuffer generateFooterCode() {
+		StringBuffer code = new StringBuffer();
+
+		newLine(code);
+		generateCloseBlock(code);
+		newLine(code);
+
+		return code;
+	}
+
+	public ConfigurationDataDescriptor[] getConfigurationDataDescriptions() {
+		return REQUIRED_PARAMETERS;
+	}
+}

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ProxySynthesizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ProxySynthesizer.java?view=diff&rev=522019&r1=522018&r2=522019
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ProxySynthesizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ProxySynthesizer.java Sat Mar 24 06:14:20 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- *  Copyright 2006 The Apache Software Foundation
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
  *
- *  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.synthesizer;
 

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerClassSynthesizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerClassSynthesizer.java?view=diff&rev=522019&r1=522018&r2=522019
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerClassSynthesizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerClassSynthesizer.java Sat Mar 24 06:14:20 2007
@@ -1,278 +1,282 @@
-/*=============================================================================*
- *  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.synthesizer;
-
-import java.io.File;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.muse.tools.generator.util.Capability;
-import org.apache.muse.tools.inspector.JavaMethod;
-import org.apache.muse.tools.inspector.JavaProperty;
-import org.apache.muse.util.ReflectUtils;
-import org.apache.muse.util.messages.Messages;
-import org.apache.muse.util.messages.MessagesFactory;
-import org.apache.muse.ws.addressing.soap.SoapFault;
-
-public class ServerClassSynthesizer extends ServerInterfaceSynthesizer {
-
-	private static Messages _MESSAGES = MessagesFactory.get(ServerClassSynthesizer.class);
-	
-	protected void generateCapability(Capability capability, Map files, Set ignoreSet) {
-		ClassInfo classInfo = new ClassInfo(capability);
-		String className = generateClassName(capability);
-		initializeCode(className, classInfo);
-		
-		addImport(getBaseClass(capability));
-		
-		if(classInfo.needsInitializer()) {
-			generateInitialize(classInfo, _bodyCode);
-		}
-				
-		if(!capability.isEmpty()) {
-			generatePropertiesDeclarations(classInfo, _bodyCode);
-			generatePropertyOperations(classInfo, _bodyCode);
-			generateOperations(classInfo, _bodyCode);
-		}
-		
-		classInfo.addImports(_importSet);
-		capability.setImplementingClass(className);
-		String classFileName = createFileName(className);		
-		files.put(classFileName, generateCombinedCode(classInfo));
-		ignoreSet.add(new File(classFileName));
-	}
-	
-	protected void endHeaderCode(ClassInfo classInfo) {
-		generateImports(classInfo, _headerCode);
-		Capability capability = classInfo.getCapability();	
-		String[] interfaces = null;
-		if(!capability.isEmpty()) {
-			interfaces = new String[]{ ReflectUtils.getShortName(generateClassName(INTERFACE_PREFIX,capability)) };
-		}
-		String parentClass = convertType(getBaseClass(capability), classInfo);
-		generateClassDef(_className, parentClass, interfaces , false, _headerCode);	
-	}
-	
-	protected void generatePropertiesDeclarations(ClassInfo classInfo, StringBuffer code) {
-		Capability capability = classInfo.getCapability();
-		
-		if(capability.getProperties().size() == 0) {
-			return;
-		}
-		
-		indent(code);
-		code.append("private static final " 
-			+ convertType(QName.class, classInfo) 
-			+ "[] _PROPERTIES = new " 
-			+ convertType(QName.class, classInfo) 
-			+ "[]");
-		newLine(code);
-		addImport(QName.class);
-		
-		indent(code);
-		generateOpenBlock(code);
-		newLine(code);
-		
-		for(Iterator i=capability.getProperties().iterator(); i.hasNext();) {
-			JavaProperty property = (JavaProperty)i.next();
-			indent(2,code);
-			code.append("new " 
-				+ convertType(QName.class, classInfo) 
-				+ "(NAMESPACE_URI, \"" 
-				+ getPropertyName(property, false) 
-				+ "\", PREFIX)");
-			if(i.hasNext()) {
-				code.append(",");
-			}
-			newLine(code);
-		}
-		
-		indent(code);
-		generateCloseBlock(code);
-		statement(";",code);
-		newLine(2,code);
-		
-		indent(code);
-		code.append("public " 
-			+ convertType(QName.class, classInfo) 
-			+ "[] getPropertyNames()");
-		newLine(code);
-		
-		indent(code);
-		generateOpenBlock(code);
-		newLine(code);
-		
-		indent(2,code);
-		code.append("return _PROPERTIES;");
-		
-		newLine(code);
-		indent(code);
-		generateCloseBlock(code);
-		newLine(2,code);
-		
-		for(Iterator i=capability.getProperties().iterator(); i.hasNext();) {
-			JavaProperty property = (JavaProperty)i.next();
-			indent(code);
-			code.append("private " 
-				+ convertType(property.getJavaType(), classInfo) 
-				+ " _" 
-				+ getPropertyName(property, false) 
-				+ ";");
-			newLine(2, code);
-		}
-	}
-	
-	protected void generateInitialize(ClassInfo classInfo, StringBuffer code) {				
-		indent(code);
-		code.append("public void initialize() throws SoapFault ");
-		newLine(code);
-		indent(code);
-		generateOpenBlock(code);		
-		addImport(SoapFault.class);
-    
-        generateSuperInitialize(code);
-
-        newLine(code);
-        
-		if(classInfo.getCapability().isEmpty()) {
-			generateEmptyInitTodo(code);
-		} else {
-			generatePropertyInitTodo(classInfo, code);
-		}
-		
-		indent(code);
-		generateCloseBlock(code);
-		newLine(2, code);
-	}
-
-	private void generateSuperInitialize(StringBuffer code) {
-		newLine(code);
-		
-		indent(2, code);
-		code.append("//");
-		newLine(code);
-		
-		indent(2, code);
-		code.append("//" +_MESSAGES.get("InitializeComment", false));
-		newLine(code);
-		
-		indent(2, code);
-		code.append("//");
-		newLine(code);
-		
-		indent(2, code);
-		code.append("super.initialize();");		
-		newLine(code);
-	}
-
-	protected void generateEmptyInitTodo(StringBuffer code) {
-		indent(2, code);
-		code.append("//");
-		newLine(code);
-		
-		indent(2, code);		
-		code.append("//" + _MESSAGES.get("InitEmptyTODO", false));
-		newLine(code);
-		
-		indent(2, code);
-		code.append("//");
-		newLine(code);
-	}
-
-	protected void generatePropertyInitTodo(ClassInfo classInfo, StringBuffer code) {
-		indent(2, code);
-		code.append("//");
-		newLine(code);
-
-		indent(2, code);		
-		code.append("//" + _MESSAGES.get("InitTODO", false));
-		newLine(code);
-		
-		indent(2, code);
-		code.append("//");
-		newLine(code);
-		
-		for(Iterator i = classInfo.getCapability().getProperties().iterator(); i.hasNext(); ) {
-			JavaProperty property = (JavaProperty)i.next();
-			if(!property.getJavaType().isPrimitive()) {
-				indent(2, code);
-				code.append("// " + property.getName().getLocalPart());
-				newLine(code);		
-			}
-		}
-		
-		indent(2, code);
-		code.append("//");
-		newLine(2, code);
-		
-		indent(2, code);		
-		code.append("throw new RuntimeException(\"" + _MESSAGES.get("InitThrow", false) + "\");");
-		newLine(code);
-	}
-
-	protected void generateGetOperationBody(JavaProperty property, StringBuffer code) {
-		newLine(code);
-		indent(code);
-		generateOpenBlock(code);
-		newLine(code);
-		
-		indent(2,code);
-		statement("return _" 
-			+ getPropertyName(property, false) 
-			+  ";",code);
-		newLine(code);
-		
-		indent(code);
-		generateCloseBlock(code);
-	}
-
-	protected void generateOperationBody(JavaMethod method, StringBuffer code) {
-		indent(code);
-		generateOpenBlock(code);
-		newLine(code);
-		
-		indent(2,code);
-		code.append("//TODO implement " + getMethodName(method));
-		newLine(code);
-		
-		indent(2,code);
-		code.append("throw new RuntimeException(\"Unimplemented Method: " + getMethodName(method) + "\");");
-		newLine(code);
-		
-		indent(code);
-		generateCloseBlock(code);
-	}
-
-	protected void generateSetOperationBody(JavaProperty property, StringBuffer code) {
-		newLine(code);
-		indent(code);
-		generateOpenBlock(code);
-		newLine(code);
-		
-		indent(2,code);
-		statement("_" 
-			+ getPropertyName(property, false) 
-			+ " = param0;",code);				
-		newLine(code);
-		
-		indent(code);
-		generateCloseBlock(code);	
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.synthesizer;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.tools.generator.util.Capability;
+import org.apache.muse.tools.inspector.JavaMethod;
+import org.apache.muse.tools.inspector.JavaProperty;
+import org.apache.muse.util.ReflectUtils;
+import org.apache.muse.util.messages.Messages;
+import org.apache.muse.util.messages.MessagesFactory;
+import org.apache.muse.ws.addressing.soap.SoapFault;
+
+public class ServerClassSynthesizer extends ServerInterfaceSynthesizer {
+
+	private static Messages _MESSAGES = MessagesFactory.get(ServerClassSynthesizer.class);
+	
+	protected void generateCapability(Capability capability, Map files, Set ignoreSet) {
+		ClassInfo classInfo = new ClassInfo(capability);
+		String className = generateClassName(capability);
+		initializeCode(className, classInfo);
+		
+		addImport(getBaseClass(capability));
+		
+		if(classInfo.needsInitializer()) {
+			generateInitialize(classInfo, _bodyCode);
+		}
+				
+		if(!capability.isEmpty()) {
+			generatePropertiesDeclarations(classInfo, _bodyCode);
+			generatePropertyOperations(classInfo, _bodyCode);
+			generateOperations(classInfo, _bodyCode);
+		}
+		
+		classInfo.addImports(_importSet);
+		capability.setImplementingClass(className);
+		String classFileName = createFileName(className);		
+		files.put(classFileName, generateCombinedCode(classInfo));
+		ignoreSet.add(new File(classFileName));
+	}
+	
+	protected void endHeaderCode(ClassInfo classInfo) {
+		generateImports(classInfo, _headerCode);
+		Capability capability = classInfo.getCapability();	
+		String[] interfaces = null;
+		if(!capability.isEmpty()) {
+			interfaces = new String[]{ ReflectUtils.getShortName(generateClassName(INTERFACE_PREFIX,capability)) };
+		}
+		String parentClass = convertType(getBaseClass(capability), classInfo);
+		generateClassDef(_className, parentClass, interfaces , false, _headerCode);	
+	}
+	
+	protected void generatePropertiesDeclarations(ClassInfo classInfo, StringBuffer code) {
+		Capability capability = classInfo.getCapability();
+		
+		if(capability.getProperties().size() == 0) {
+			return;
+		}
+		
+		indent(code);
+		code.append("private static final " 
+			+ convertType(QName.class, classInfo) 
+			+ "[] _PROPERTIES = new " 
+			+ convertType(QName.class, classInfo) 
+			+ "[]");
+		newLine(code);
+		addImport(QName.class);
+		
+		indent(code);
+		generateOpenBlock(code);
+		newLine(code);
+		
+		for(Iterator i=capability.getProperties().iterator(); i.hasNext();) {
+			JavaProperty property = (JavaProperty)i.next();
+			indent(2,code);
+			code.append("new " 
+				+ convertType(QName.class, classInfo) 
+				+ "(NAMESPACE_URI, \"" 
+				+ getPropertyName(property, false) 
+				+ "\", PREFIX)");
+			if(i.hasNext()) {
+				code.append(",");
+			}
+			newLine(code);
+		}
+		
+		indent(code);
+		generateCloseBlock(code);
+		statement(";",code);
+		newLine(2,code);
+		
+		indent(code);
+		code.append("public " 
+			+ convertType(QName.class, classInfo) 
+			+ "[] getPropertyNames()");
+		newLine(code);
+		
+		indent(code);
+		generateOpenBlock(code);
+		newLine(code);
+		
+		indent(2,code);
+		code.append("return _PROPERTIES;");
+		
+		newLine(code);
+		indent(code);
+		generateCloseBlock(code);
+		newLine(2,code);
+		
+		for(Iterator i=capability.getProperties().iterator(); i.hasNext();) {
+			JavaProperty property = (JavaProperty)i.next();
+			indent(code);
+			code.append("private " 
+				+ convertType(property.getJavaType(), classInfo) 
+				+ " _" 
+				+ getPropertyName(property, false) 
+				+ ";");
+			newLine(2, code);
+		}
+	}
+	
+	protected void generateInitialize(ClassInfo classInfo, StringBuffer code) {				
+		indent(code);
+		code.append("public void initialize() throws SoapFault ");
+		newLine(code);
+		indent(code);
+		generateOpenBlock(code);		
+		addImport(SoapFault.class);
+    
+        generateSuperInitialize(code);
+
+        newLine(code);
+        
+		if(classInfo.getCapability().isEmpty()) {
+			generateEmptyInitTodo(code);
+		} else {
+			generatePropertyInitTodo(classInfo, code);
+		}
+		
+		indent(code);
+		generateCloseBlock(code);
+		newLine(2, code);
+	}
+
+	private void generateSuperInitialize(StringBuffer code) {
+		newLine(code);
+		
+		indent(2, code);
+		code.append("//");
+		newLine(code);
+		
+		indent(2, code);
+		code.append("//" +_MESSAGES.get("InitializeComment", false));
+		newLine(code);
+		
+		indent(2, code);
+		code.append("//");
+		newLine(code);
+		
+		indent(2, code);
+		code.append("super.initialize();");		
+		newLine(code);
+	}
+
+	protected void generateEmptyInitTodo(StringBuffer code) {
+		indent(2, code);
+		code.append("//");
+		newLine(code);
+		
+		indent(2, code);		
+		code.append("//" + _MESSAGES.get("InitEmptyTODO", false));
+		newLine(code);
+		
+		indent(2, code);
+		code.append("//");
+		newLine(code);
+	}
+
+	protected void generatePropertyInitTodo(ClassInfo classInfo, StringBuffer code) {
+		indent(2, code);
+		code.append("//");
+		newLine(code);
+
+		indent(2, code);		
+		code.append("//" + _MESSAGES.get("InitTODO", false));
+		newLine(code);
+		
+		indent(2, code);
+		code.append("//");
+		newLine(code);
+		
+		for(Iterator i = classInfo.getCapability().getProperties().iterator(); i.hasNext(); ) {
+			JavaProperty property = (JavaProperty)i.next();
+			if(!property.getJavaType().isPrimitive()) {
+				indent(2, code);
+				code.append("// " + property.getName().getLocalPart());
+				newLine(code);		
+			}
+		}
+		
+		indent(2, code);
+		code.append("//");
+		newLine(2, code);
+		
+		indent(2, code);		
+		code.append("throw new RuntimeException(\"" + _MESSAGES.get("InitThrow", false) + "\");");
+		newLine(code);
+	}
+
+	protected void generateGetOperationBody(JavaProperty property, StringBuffer code) {
+		newLine(code);
+		indent(code);
+		generateOpenBlock(code);
+		newLine(code);
+		
+		indent(2,code);
+		statement("return _" 
+			+ getPropertyName(property, false) 
+			+  ";",code);
+		newLine(code);
+		
+		indent(code);
+		generateCloseBlock(code);
+	}
+
+	protected void generateOperationBody(JavaMethod method, StringBuffer code) {
+		indent(code);
+		generateOpenBlock(code);
+		newLine(code);
+		
+		indent(2,code);
+		code.append("//TODO implement " + getMethodName(method));
+		newLine(code);
+		
+		indent(2,code);
+		code.append("throw new RuntimeException(\"Unimplemented Method: " + getMethodName(method) + "\");");
+		newLine(code);
+		
+		indent(code);
+		generateCloseBlock(code);
+	}
+
+	protected void generateSetOperationBody(JavaProperty property, StringBuffer code) {
+		newLine(code);
+		indent(code);
+		generateOpenBlock(code);
+		newLine(code);
+		
+		indent(2,code);
+		statement("_" 
+			+ getPropertyName(property, false) 
+			+ " = param0;",code);				
+		newLine(code);
+		
+		indent(code);
+		generateCloseBlock(code);	
+	}
+}

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerInterfaceSynthesizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerInterfaceSynthesizer.java?view=diff&rev=522019&r1=522018&r2=522019
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerInterfaceSynthesizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/ServerInterfaceSynthesizer.java Sat Mar 24 06:14:20 2007
@@ -1,284 +1,288 @@
-/*=============================================================================*
- *  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.synthesizer;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.muse.core.AbstractCapability;
-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.inspector.JavaMethod;
-import org.apache.muse.tools.inspector.JavaProperty;
-import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
-
-public class ServerInterfaceSynthesizer extends AbstractSynthesizer {
-
-	static ConfigurationDataDescriptor[] REQUIRED_PARAMETERS = 
-		new ConfigurationDataDescriptor[] {
-			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION,
-		};
-
-	protected StringBuffer _headerCode;
-
-	protected StringBuffer _bodyCode;
-
-	protected String _className;
-
-	protected Set _importSet;
-
-	private Map[] _capabilityMaps;
-
-	private Set[] _ignoreSets;
-
-	private Map[] _filesMaps;
-	
-	public ConfigurationData synthesize(ConfigurationData configuration) throws Exception {
-		ConfigurationData.checkConfiguration(this, configuration);
-
-		loadParameters(configuration);		
-		
-		for(int i = 0; i < _capabilityMaps.length; i++) {
-			
-			Map capabilities = _capabilityMaps[i];
-			if(_filesMaps[i] == null) {
-				_filesMaps[i] = new HashMap();
-			}
-			
-			if(_ignoreSets[i] == null) {
-				_ignoreSets[i] = new HashSet();
-			}
-			
-			for (Iterator j = capabilities.values().iterator(); j.hasNext();) {
-				Capability capability = (Capability)j.next();
-				if(!capability.isBuiltIn()) {
-					generateCapability(capability, _filesMaps[i], _ignoreSets[i]);
-				}
-			}
-		}
-		
-		ConfigurationData resultData = (ConfigurationData) configuration.clone();
-		resultData.addParameter(ConfigurationData.FILES_MAP_LIST, _filesMaps);
-		resultData.addParameter(ConfigurationData.IGNORE_SET_LIST, _ignoreSets);		 
-		
-		return resultData;
-	}
-	
-	private void loadParameters(ConfigurationData configuration) {
-		_capabilityMaps = (Map[])configuration.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
-		_ignoreSets = (Set[])configuration.getParameter(ConfigurationData.IGNORE_SET_LIST);
-		_filesMaps = (Map[])configuration.getParameter(ConfigurationData.FILES_MAP_LIST);
-		
-		if(_filesMaps == null) {
-			_filesMaps = new HashMap[_capabilityMaps.length];
-		}
-		
-		if(_ignoreSets == null) {
-			_ignoreSets = new HashSet[_capabilityMaps.length];
-		}
-	}
-
-	protected void generateCapability(Capability capability, Map files, Set ignoreSet) {
-		if(capability.isEmpty()) {
-			return;
-		}
-		
-		ClassInfo classInfo = new ClassInfo(capability);
-		String className = generateClassName(INTERFACE_PREFIX, capability);
-		initializeCode(className, classInfo);
-		
-		generateNSDeclarations(classInfo, _bodyCode);
-		generatePropertyOperations(classInfo, _bodyCode);
-		generateOperations(classInfo, _bodyCode);
-		
-		classInfo.addImports(_importSet);
-		
-		String classFileName = createFileName(className);		
-		files.put(classFileName, generateCombinedCode(classInfo));
-	}
-	
-	protected String generateCombinedCode(ClassInfo classInfo) {
-		endHeaderCode(classInfo);
-		endBodyCode();
-
-		StringBuffer code = new StringBuffer();
-
-		code.append(_headerCode);
-		code.append(_bodyCode);
-
-		return code.append(generateFooterCode()).toString();
-	}
-
-	protected void endBodyCode() {
-		//do nothing
-	}
-
-	protected void endHeaderCode(ClassInfo classInfo) {
-		generateImports(classInfo, _headerCode);
-		generateClassDef(_className, true, _headerCode);	
-	}
-
-	protected StringBuffer generateFooterCode() {
-		StringBuffer footer = new StringBuffer();
-		generateCloseBlock(footer);
-		return footer;
-	}
-
-	protected void initializeCode(String className, ClassInfo classInfo) {
-		_className = className;
-		_headerCode = beginHeaderCode(_className);
-		_bodyCode = beginBodyCode();
-		_importSet = new HashSet();
-	}
-	
-	protected StringBuffer beginBodyCode() {
-		StringBuffer code = new StringBuffer();
-		return code;
-	}
-	
-	protected void generateOperations(ClassInfo classInfo, StringBuffer code) {
-		Capability capability = classInfo.getCapability();
-		
-		for(Iterator i=capability.getOperations().iterator(); i.hasNext();) {
-			JavaMethod method = (JavaMethod)i.next();		
-			
-			indent(code);
-			code.append("public "
-				+ convertType(method.getReturnType(), classInfo) 
-				+ " " + getMethodName(method));
-			
-			Class[] params = method.getParameterTypes();
-			QName[] paramNames = method.getParameterTypeNames();
-			code.append("(");
-			
-			if (params.length > 0) {
-				int j;
-				
-				for (j = 0; j < params.length - 1; j++) {
-										
-					code.append(convertType(params[j], classInfo)							
-						+ " "
-						+ getParamName(paramNames[j], j)
-						+ ", ");
-				}
-				
-				code.append(convertType(params[j], classInfo) 
-					+ " "
-					+ getParamName(paramNames[j], j));
-			}
-			
-			code.append(") throws Exception");	
-			
-			generateOperationBody(method, code);
-
-			newLine(2,code);
-		}
-	}
-
-	protected void generateOperationBody(JavaMethod method, StringBuffer code) {
-		code.append(";");
-	}
-
-	protected void generatePropertyOperations(ClassInfo classInfo, StringBuffer code) {
-		Capability capability = classInfo.getCapability();
-		
-		if(capability.getProperties().size() == 0) {
-			return;
-		}
-		
-		for(Iterator i=capability.getProperties().iterator(); i.hasNext();) {
-			JavaProperty property = (JavaProperty)i.next();
-			
-			generateGetOperation(property, classInfo, code);
-			genereateSetOperation(property, classInfo, code);
-
-		}
-	}
-
-	protected void genereateSetOperation(JavaProperty property, ClassInfo classInfo, StringBuffer code) {		
-		indent(code);
-		code.append("public void");
-		code.append(" set" 
-			+ getPropertyName(property, true) 
-			+ "(" 
-			+ convertType(property.getJavaType(), classInfo) 
-			+ " param0)");
-		
-		generateSetOperationBody(property, code);
-		
-		newLine(2,code);
-	}
-
-	protected void generateSetOperationBody(JavaProperty property, StringBuffer code) {
-		code.append(";");
-	}
-
-	protected void generateGetOperation(JavaProperty property, ClassInfo classInfo, StringBuffer code) {
-		indent(code);
-		code.append("public "
-			+ convertType(property.getJavaType(), classInfo)
-			+ " get" 
-			+ getPropertyName(property, true) 
-			+ "()");
-		
-		generateGetOperationBody(property, code);
-
-		newLine(2,code);
-	}
-
-	protected void generateGetOperationBody(JavaProperty property, StringBuffer code) {
-		code.append(";");
-	}
-
-	protected void generateNSDeclarations(ClassInfo classInfo, StringBuffer code) {
-		Capability capability = classInfo.getCapability();
-		indent(code);
-		statement("String PREFIX = \"tns\";", code);
-		newLine(2,code);
-		
-		indent(code);
-		statement("String NAMESPACE_URI = \""+ capability.getURI() +"\";", code);
-		newLine(2,code);
-	}
-
-	protected Class getBaseClass(Capability capability) {
-		if(capability.getProperties().size() > 0) {
-			return AbstractWsResourceCapability.class;
-		}
-        return AbstractCapability.class;
-	}
-	
-	protected void addImports(Class[] classes) {
-		for(int i=0; i < classes.length; i++) {
-			addImport(classes[i]);
-		}
-	}
-		
-	protected void addImport(Class className) {
-		_importSet.add(className);
-	}
-
-	public ConfigurationDataDescriptor[] getConfigurationDataDescriptions() {
-		return REQUIRED_PARAMETERS;
-	}
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.synthesizer;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.muse.core.AbstractCapability;
+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.inspector.JavaMethod;
+import org.apache.muse.tools.inspector.JavaProperty;
+import org.apache.muse.ws.resource.impl.AbstractWsResourceCapability;
+
+public class ServerInterfaceSynthesizer extends AbstractSynthesizer {
+
+	static ConfigurationDataDescriptor[] REQUIRED_PARAMETERS = 
+		new ConfigurationDataDescriptor[] {
+			ConfigurationData.CAPABILITIES_MAP_LIST_CONFIGURATION,
+		};
+
+	protected StringBuffer _headerCode;
+
+	protected StringBuffer _bodyCode;
+
+	protected String _className;
+
+	protected Set _importSet;
+
+	private Map[] _capabilityMaps;
+
+	private Set[] _ignoreSets;
+
+	private Map[] _filesMaps;
+	
+	public ConfigurationData synthesize(ConfigurationData configuration) throws Exception {
+		ConfigurationData.checkConfiguration(this, configuration);
+
+		loadParameters(configuration);		
+		
+		for(int i = 0; i < _capabilityMaps.length; i++) {
+			
+			Map capabilities = _capabilityMaps[i];
+			if(_filesMaps[i] == null) {
+				_filesMaps[i] = new HashMap();
+			}
+			
+			if(_ignoreSets[i] == null) {
+				_ignoreSets[i] = new HashSet();
+			}
+			
+			for (Iterator j = capabilities.values().iterator(); j.hasNext();) {
+				Capability capability = (Capability)j.next();
+				if(!capability.isBuiltIn()) {
+					generateCapability(capability, _filesMaps[i], _ignoreSets[i]);
+				}
+			}
+		}
+		
+		ConfigurationData resultData = (ConfigurationData) configuration.clone();
+		resultData.addParameter(ConfigurationData.FILES_MAP_LIST, _filesMaps);
+		resultData.addParameter(ConfigurationData.IGNORE_SET_LIST, _ignoreSets);		 
+		
+		return resultData;
+	}
+	
+	private void loadParameters(ConfigurationData configuration) {
+		_capabilityMaps = (Map[])configuration.getParameter(ConfigurationData.CAPABILITIES_MAP_LIST);
+		_ignoreSets = (Set[])configuration.getParameter(ConfigurationData.IGNORE_SET_LIST);
+		_filesMaps = (Map[])configuration.getParameter(ConfigurationData.FILES_MAP_LIST);
+		
+		if(_filesMaps == null) {
+			_filesMaps = new HashMap[_capabilityMaps.length];
+		}
+		
+		if(_ignoreSets == null) {
+			_ignoreSets = new HashSet[_capabilityMaps.length];
+		}
+	}
+
+	protected void generateCapability(Capability capability, Map files, Set ignoreSet) {
+		if(capability.isEmpty()) {
+			return;
+		}
+		
+		ClassInfo classInfo = new ClassInfo(capability);
+		String className = generateClassName(INTERFACE_PREFIX, capability);
+		initializeCode(className, classInfo);
+		
+		generateNSDeclarations(classInfo, _bodyCode);
+		generatePropertyOperations(classInfo, _bodyCode);
+		generateOperations(classInfo, _bodyCode);
+		
+		classInfo.addImports(_importSet);
+		
+		String classFileName = createFileName(className);		
+		files.put(classFileName, generateCombinedCode(classInfo));
+	}
+	
+	protected String generateCombinedCode(ClassInfo classInfo) {
+		endHeaderCode(classInfo);
+		endBodyCode();
+
+		StringBuffer code = new StringBuffer();
+
+		code.append(_headerCode);
+		code.append(_bodyCode);
+
+		return code.append(generateFooterCode()).toString();
+	}
+
+	protected void endBodyCode() {
+		//do nothing
+	}
+
+	protected void endHeaderCode(ClassInfo classInfo) {
+		generateImports(classInfo, _headerCode);
+		generateClassDef(_className, true, _headerCode);	
+	}
+
+	protected StringBuffer generateFooterCode() {
+		StringBuffer footer = new StringBuffer();
+		generateCloseBlock(footer);
+		return footer;
+	}
+
+	protected void initializeCode(String className, ClassInfo classInfo) {
+		_className = className;
+		_headerCode = beginHeaderCode(_className);
+		_bodyCode = beginBodyCode();
+		_importSet = new HashSet();
+	}
+	
+	protected StringBuffer beginBodyCode() {
+		StringBuffer code = new StringBuffer();
+		return code;
+	}
+	
+	protected void generateOperations(ClassInfo classInfo, StringBuffer code) {
+		Capability capability = classInfo.getCapability();
+		
+		for(Iterator i=capability.getOperations().iterator(); i.hasNext();) {
+			JavaMethod method = (JavaMethod)i.next();		
+			
+			indent(code);
+			code.append("public "
+				+ convertType(method.getReturnType(), classInfo) 
+				+ " " + getMethodName(method));
+			
+			Class[] params = method.getParameterTypes();
+			QName[] paramNames = method.getParameterTypeNames();
+			code.append("(");
+			
+			if (params.length > 0) {
+				int j;
+				
+				for (j = 0; j < params.length - 1; j++) {
+										
+					code.append(convertType(params[j], classInfo)							
+						+ " "
+						+ getParamName(paramNames[j], j)
+						+ ", ");
+				}
+				
+				code.append(convertType(params[j], classInfo) 
+					+ " "
+					+ getParamName(paramNames[j], j));
+			}
+			
+			code.append(") throws Exception");	
+			
+			generateOperationBody(method, code);
+
+			newLine(2,code);
+		}
+	}
+
+	protected void generateOperationBody(JavaMethod method, StringBuffer code) {
+		code.append(";");
+	}
+
+	protected void generatePropertyOperations(ClassInfo classInfo, StringBuffer code) {
+		Capability capability = classInfo.getCapability();
+		
+		if(capability.getProperties().size() == 0) {
+			return;
+		}
+		
+		for(Iterator i=capability.getProperties().iterator(); i.hasNext();) {
+			JavaProperty property = (JavaProperty)i.next();
+			
+			generateGetOperation(property, classInfo, code);
+			genereateSetOperation(property, classInfo, code);
+
+		}
+	}
+
+	protected void genereateSetOperation(JavaProperty property, ClassInfo classInfo, StringBuffer code) {		
+		indent(code);
+		code.append("public void");
+		code.append(" set" 
+			+ getPropertyName(property, true) 
+			+ "(" 
+			+ convertType(property.getJavaType(), classInfo) 
+			+ " param0)");
+		
+		generateSetOperationBody(property, code);
+		
+		newLine(2,code);
+	}
+
+	protected void generateSetOperationBody(JavaProperty property, StringBuffer code) {
+		code.append(";");
+	}
+
+	protected void generateGetOperation(JavaProperty property, ClassInfo classInfo, StringBuffer code) {
+		indent(code);
+		code.append("public "
+			+ convertType(property.getJavaType(), classInfo)
+			+ " get" 
+			+ getPropertyName(property, true) 
+			+ "()");
+		
+		generateGetOperationBody(property, code);
+
+		newLine(2,code);
+	}
+
+	protected void generateGetOperationBody(JavaProperty property, StringBuffer code) {
+		code.append(";");
+	}
+
+	protected void generateNSDeclarations(ClassInfo classInfo, StringBuffer code) {
+		Capability capability = classInfo.getCapability();
+		indent(code);
+		statement("String PREFIX = \"tns\";", code);
+		newLine(2,code);
+		
+		indent(code);
+		statement("String NAMESPACE_URI = \""+ capability.getURI() +"\";", code);
+		newLine(2,code);
+	}
+
+	protected Class getBaseClass(Capability capability) {
+		if(capability.getProperties().size() > 0) {
+			return AbstractWsResourceCapability.class;
+		}
+        return AbstractCapability.class;
+	}
+	
+	protected void addImports(Class[] classes) {
+		for(int i=0; i < classes.length; i++) {
+			addImport(classes[i]);
+		}
+	}
+		
+	protected void addImport(Class className) {
+		_importSet.add(className);
+	}
+
+	public ConfigurationDataDescriptor[] getConfigurationDataDescriptions() {
+		return REQUIRED_PARAMETERS;
+	}
+}

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=522019&r1=522018&r2=522019
==============================================================================
--- 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 Sat Mar 24 06:14:20 2007
@@ -1,18 +1,22 @@
-/*=============================================================================*
- *  Copyright 2006 The Apache Software Foundation
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
  *
- *  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.synthesizer;
 

Modified: webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/Synthesizer.java
URL: http://svn.apache.org/viewvc/webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/Synthesizer.java?view=diff&rev=522019&r1=522018&r2=522019
==============================================================================
--- webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/Synthesizer.java (original)
+++ webservices/muse/trunk/modules/muse-tools/src/org/apache/muse/tools/generator/synthesizer/Synthesizer.java Sat Mar 24 06:14:20 2007
@@ -1,30 +1,34 @@
-/*=============================================================================*
- *  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.synthesizer;
-
-import org.apache.muse.tools.generator.util.Configurable;
-import org.apache.muse.tools.generator.util.ConfigurationData;
-
-/**
- * The second phase of code generation that takes a
- * set of capabilities and creates the code that implements them.
- * 
- * @author Andrew Eberbach (aeberbac)
- */
-public interface Synthesizer extends Configurable {	
-	ConfigurationData synthesize(ConfigurationData data) throws Exception;
-}
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.synthesizer;
+
+import org.apache.muse.tools.generator.util.Configurable;
+import org.apache.muse.tools.generator.util.ConfigurationData;
+
+/**
+ * The second phase of code generation that takes a
+ * set of capabilities and creates the code that implements them.
+ * 
+ * @author Andrew Eberbach (aeberbac)
+ */
+public interface Synthesizer extends Configurable {	
+	ConfigurationData synthesize(ConfigurationData data) throws Exception;
+}



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