Author: ropalka
Date: 2012-03-30 09:38:48 -0400 (Fri, 30 Mar 2012)
New Revision: 16073
Removed:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/Configuration.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/HeaderUtil.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/HolderWriter.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaKeywords.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL20.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaWriter.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/NamespacePackageMapping.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/RPCSignature.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ToolsUtils.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSDLToJava.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSTools.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSToolsConstants.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WebservicesXMLCreatorImpl.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XMLNameUtil.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XSDToJava.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XSDTypeToJava.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ant/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/client/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/config/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/exceptions/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/factories/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/SecurityActions.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/ServiceCreatorIntf.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/WSDLToJavaIntf.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/WebservicesXMLCreator.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/XSDToJavaIntf.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/jaxws/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/mapping/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/metadata/
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java
stack/native/trunk/modules/testsuite/native-tests/scripts/antrun-wstools.xml
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
stack/native/trunk/modules/testsuite/native-tests/scripts/build-samples-jaxrpc.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/jbossxb/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/wsdl11/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/samples/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxws/
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/tools/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/jbossxb/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/common/wsdl11/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxrpc/samples/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/jaxws/
stack/native/trunk/modules/testsuite/native-tests/src/test/resources/tools/
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
stack/native/trunk/modules/testsuite/native-tests/pom.xml
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/utils/JavaUtilsTestCase.java
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws1384/JBWS1384TestCase.java
Log:
[JBWS-3474] removing tools, their tests & jaxws tests
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -21,10 +21,8 @@
*/
package org.jboss.ws.metadata.builder.jaxws;
-import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
-import java.io.Writer;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -40,7 +38,6 @@
import org.jboss.ws.WSException;
import org.jboss.ws.api.util.BundleUtils;
import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.IOUtils;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
@@ -52,11 +49,6 @@
import org.jboss.ws.metadata.wsdl.WSDLService;
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.tools.ToolsUtils;
-import org.jboss.ws.tools.wsdl.JAXBWSDLGenerator;
-import org.jboss.ws.tools.wsdl.WSDLGenerator;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
-import org.jboss.ws.tools.wsdl.WSDLWriterResolver;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
@@ -75,10 +67,6 @@
public class JAXWSWebServiceMetaDataBuilder extends JAXWSServerMetaDataBuilder
{
private static final ResourceBundle bundle =
BundleUtils.getBundle(JAXWSWebServiceMetaDataBuilder.class);
- private boolean generateWsdl = true;
- private boolean extension;
- private boolean toolMode = false;
- private File wsdlDirectory = null;
private PrintStream messageStream = null;
private static class EndpointResult
@@ -89,16 +77,6 @@
private URL wsdlLocation;
}
- public void setGenerateWsdl(boolean generateWsdl)
- {
- this.generateWsdl = generateWsdl;
- }
-
- public void setExtension(boolean extension)
- {
- this.extension = extension;
- }
-
public ServerEndpointMetaData buildWebServiceMetaData(Deployment dep, UnifiedMetaData
wsMetaData, Class<?> sepClass, String linkName)
{
try
@@ -130,10 +108,7 @@
// process config
processEndpointConfig(dep, sepMetaData, sepClass, linkName);
- if (!toolMode)
- {
- setupOperationsFromWSDL(serviceMetaData, sepMetaData);
- }
+ setupOperationsFromWSDL(serviceMetaData, sepMetaData);
// Process web methods
processWebMethods(sepMetaData, seiClass);
@@ -147,14 +122,6 @@
createJAXBContext(sepMetaData);
populateXmlTypes(sepMetaData);
- // The server must always generate WSDL
- if (generateWsdl || !toolMode)
- generateWSDL(seiClass, serviceMetaData, sepMetaData);
-
- // No need to process endpoint items if we are in tool mode
- if (toolMode)
- return sepMetaData;
-
// Sanity check: read the generated WSDL and initialize the schema model
// Note, this should no longer be needed, look into removing it
WSDLDefinitions wsdlDefinitions = serviceMetaData.getWsdlDefinitions();
@@ -344,91 +311,12 @@
return result;
}
- private void generateWSDL(Class wsClass, ServiceMetaData serviceMetaData,
EndpointMetaData epMetaData)
- {
- final URL wsdlLocation = serviceMetaData.getWsdlLocation();
-
- if (wsdlLocation == null)
- {
- try
- {
- WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
- generator.setExtension(extension);
-
- WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
- writeWsdl(serviceMetaData, wsdlDefinitions, epMetaData);
- }
- catch (IOException e)
- {
- throw new WSException(BundleUtils.getMessage(bundle,
"CANNOT_WRITE_GENERATED_WSDL"), e);
- }
- }
- }
-
- private void writeWsdl(ServiceMetaData serviceMetaData, WSDLDefinitions
wsdlDefinitions, EndpointMetaData epMetaData) throws IOException
- {
- // The RI uses upper case, and the TCK expects it, so we just mimic this even
though we don't really have to
- String wsdlName =
ToolsUtils.firstLetterUpperCase(serviceMetaData.getServiceName().getLocalPart());
- // Ensure that types are only in the interface qname
-
wsdlDefinitions.getWsdlTypes().setNamespace(epMetaData.getPortTypeName().getNamespaceURI());
-
- final File dir, wsdlFile;
-
- if (wsdlDirectory != null)
- {
- dir = wsdlDirectory;
- wsdlFile = new File(dir, wsdlName + ".wsdl");
- }
- else
- {
- dir = IOUtils.createTempDirectory();
- wsdlFile = File.createTempFile(wsdlName, ".wsdl", dir);
- wsdlFile.deleteOnExit();
- }
-
- message(wsdlFile.getName());
- Writer writer = IOUtils.getCharsetFileWriter(wsdlFile,
Constants.DEFAULT_XML_CHARSET);
- new WSDLWriter(wsdlDefinitions).write(writer, Constants.DEFAULT_XML_CHARSET, new
WSDLWriterResolver() {
- public WSDLWriterResolver resolve(String suggestedFile) throws IOException
- {
- File file;
- if (wsdlDirectory != null)
- {
- file = new File(dir, suggestedFile + ".wsdl");
- }
- else
- {
- file = File.createTempFile(suggestedFile, ".wsdl", dir);
- file.deleteOnExit();
- }
- actualFile = file.getName();
- message(actualFile);
- charset = Constants.DEFAULT_XML_CHARSET;
- writer = IOUtils.getCharsetFileWriter(file, Constants.DEFAULT_XML_CHARSET);
- return this;
- }
- });
- writer.close();
-
- serviceMetaData.setWsdlLocation(wsdlFile.toURL());
- }
-
private void message(String msg)
{
if (messageStream != null)
messageStream.println(msg);
}
- public void setToolMode(boolean toolMode)
- {
- this.toolMode = toolMode;
- }
-
- public void setWsdlDirectory(File wsdlDirectory)
- {
- this.wsdlDirectory = wsdlDirectory;
- }
-
public void setMessageStream(PrintStream messageStream)
{
this.messageStream = messageStream;
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/Configuration.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/Configuration.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/Configuration.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,190 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-/**
- * Configuration driving jbossws
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Aug 11, 2005
- */
-public class Configuration
-{
- private JavaToWSDLConfig j2wc;
- private WSDLToJavaConfig w2jc;
- private GlobalConfig globalConfig;
-
- public Configuration()
- {
- }
-
- public JavaToWSDLConfig getJavaToWSDLConfig(boolean createNew)
- {
- if (createNew && j2wc == null)
- j2wc = new JavaToWSDLConfig();
- return j2wc;
- }
-
- public WSDLToJavaConfig getWSDLToJavaConfig(boolean createNew)
- {
- if (createNew && w2jc == null)
- w2jc = new WSDLToJavaConfig();
- return w2jc;
- }
-
- /**
- * @return Returns the globalConfig.
- */
- public GlobalConfig getGlobalConfig(boolean createNew)
- {
- if (createNew && globalConfig == null)
- globalConfig = new GlobalConfig();
- return globalConfig;
- }
-
- public void setGlobalConfig(GlobalConfig globalConfig)
- {
- this.globalConfig = globalConfig;
- }
-
- public void setJavaToWSDLConfig(JavaToWSDLConfig j2wc2)
- {
- this.j2wc = j2wc2;
- }
-
- public void setWSDLToJavaConfig(WSDLToJavaConfig wsdl2jc)
- {
- w2jc = wsdl2jc;
- }
-
- /**
- * Configuration for JavaToWSDL
- */
- public class JavaToWSDLConfig
- {
- // Is a jaxrpc-mapping file needed?
- public boolean mappingFileNeeded;
- // Name of the jaxrpc-mapping file
- public String mappingFileName;
- // Need webservices.xml file?
- public boolean wsxmlFileNeeded;
- // Target Namespace
- public String targetNamespace;
- // Type Namespace
- public String typeNamespace;
- // Service Name
- public String serviceName;
- // Endpoint Name
- public String endpointName;
- // Style of WSDL. {"rpc","doc"}
- public String wsdlStyle = "document";
- // Parameter style {"wrapped", "bare"}
- public String parameterStyle = "wrapped";
- // WSDL Version {"1.1","2.0"}
- public String wsdlVersion = "1.1";
- // Should Schema be included in the wsdl
- public boolean includeSchemaInWSDL = true;
- public boolean restrictSchemaToTargetNS;
- public String servletLink;
- public String ejbLink;
- public boolean wsxmlFileAppend;
-
- public Map<String, List<OperationConfig>> operations = new
HashMap<String, List<OperationConfig>>();
-
- public OperationConfig createOperationConfig()
- {
- return new OperationConfig();
- }
-
- /**Configuration at the operation level*/
- /*public OperationConfig opConfig;
-
- public OperationConfig getOperationConfig(boolean createNew)
- {
- if(j2wc.opConfig == null)
- j2wc.opConfig = new OperationConfig();
- return j2wc.opConfig;
- }*/
- }
-
- /**
- * Configuration for WSDL To Java
- */
- public class WSDLToJavaConfig
- {
- public String wsdlLocation;
- // Parameter style {"wrapped", "bare"}
- public String parameterStyle = "wrapped";
- // Should generated types be Serializable?
- public boolean serializableTypes;
- // Is a jaxrpc-mapping file needed?
- public boolean mappingFileNeeded;
- // Name of the jaxrpc-mapping file
- public String mappingFileName;
- // Need webservices.xml file?
- public boolean wsxmlFileNeeded;
- public String servletLink;
- public String ejbLink;
- }
-
- /**
- * Global Configuration
- */
- public class GlobalConfig
- {
- public String nscollide = "Array";
- public Map<String, String> packageNamespaceMap = new HashMap<String,
String>();
- }
-
- /**
- * Configuration at the operation/method level
- */
- public class OperationConfig
- {
- public String name;
- public boolean isOneWay = false;
- public List<ParameterConfig> params = new
ArrayList<ParameterConfig>();
- public QName returnXmlName;
-
- public ParameterConfig createParameterConfig()
- {
- return new ParameterConfig();
- }
- }
-
- /**
- * A ParameterConfig.
- */
- public class ParameterConfig
- {
- public String javaType;
- public QName xmlName;
- public String mode;
- public boolean header;
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/HeaderUtil.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/HeaderUtil.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/HeaderUtil.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.util.ArrayList;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader;
-
-/**
- * Collection of static methods required for processing
- * bound headers in WSDL to Java so they can be re-used for
- * the JAX-RPC generation.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 29 May 2007
- */
-public class HeaderUtil
-{
-
- public static WSDLBindingOperation getWSDLBindingOperation(final WSDLDefinitions wsdl,
final WSDLInterfaceOperation operation)
- {
- WSDLBindingOperation bindingOperation = null;
-
- WSDLInterface wsdlInterface = operation.getWsdlInterface();
- QName operationName = operation.getName();
-
- WSDLBinding binding = wsdl.getBindingByInterfaceName(wsdlInterface.getName());
- bindingOperation = binding.getOperationByRef(operationName);
-
- return bindingOperation;
- }
-
- public static WSDLSOAPHeader[] getSignatureHeaders(final WSDLBindingMessageReference[]
refs)
- {
- ArrayList<WSDLSOAPHeader> headers = new ArrayList<WSDLSOAPHeader>();
-
- if (refs != null)
- {
- for (WSDLBindingMessageReference current : refs)
- {
- for (WSDLSOAPHeader header : current.getSoapHeaders())
- {
- headers.add(header);
- }
- }
- }
-
- return headers.toArray(new WSDLSOAPHeader[headers.size()]);
- }
-
- public static boolean containsMatchingPart(WSDLSOAPHeader[] headers, WSDLSOAPHeader
header)
- {
- for (WSDLSOAPHeader current : headers)
- {
- if (current.getPartName().equals(header.getPartName()))
- {
- if (current.getElement().equals(header.getElement()))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/HolderWriter.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/HolderWriter.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/HolderWriter.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,124 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.io.File;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.HashMap;
-
-import javax.xml.rpc.holders.Holder;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-
-/**
- * Utility class to write JAX-RPC holders.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 11 Apr 2007
- */
-public class HolderWriter
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(HolderWriter.class);
-
- private static final WSDLUtils utils = WSDLUtils.getInstance();
-
- private static final String newline = "\n";
-
- /**
- * HashMap of the holders already generated so they do not need to be
- * generated again.
- */
- private HashMap<String, String> createdHolders = new HashMap<String,
String>();
-
- String getOrCreateHolder(final String type, final File pkgLoc)
- {
-
- String fullHolderName = createdHolders.get(type);
- if (fullHolderName == null)
- {
- StringBuilder buf = new StringBuilder();
- fullHolderName = writeHolder(type, buf);
-
- createdHolders.put(type, fullHolderName);
-
- String holderName =
fullHolderName.substring(fullHolderName.lastIndexOf('.') + 1);
-
- try
- {
- File sei = utils.createPhysicalFile(pkgLoc, holderName);
- FileWriter writer = new FileWriter(sei);
- writer.write(buf.toString());
- writer.flush();
- writer.close();
- }
- catch (IOException e)
- {
- throw new WSException(BundleUtils.getMessage(bundle,
"UNABLE_TO_CREATE_JAX_RPC_HOLDER"), e);
- }
- }
-
- return fullHolderName;
- }
-
- private String writeHolder(final String type, final StringBuilder buf)
- {
- String pkg = type.substring(0, type.lastIndexOf('.'));
- String typeName = type.substring(type.lastIndexOf('.') + 1);
- String holderName = typeName + "Holder";
-
- utils.writeJbossHeader(buf);
- buf.append(newline);
- buf.append("package
").append(pkg).append(";").append(newline);
-
- buf.append(newline);
- buf.append("public class ").append(holderName).append(" implements
").append(Holder.class.getName());
- buf.append(newline).append("{").append(newline);
-
- // Add the public member variable.
- buf.append(newline);
- buf.append(" public ").append(type).append(" value;");
- buf.append(newline);
-
- // Add the default constructor.
- buf.append(newline);
- buf.append(" ").append("public
").append(holderName).append("()").append(newline);
- buf.append(" {").append(newline);
- buf.append(" this.value = new
").append(type).append("();").append(newline);
- buf.append(" }").append(newline);
-
- // Add the second constructor.
- buf.append(newline);
- buf.append(" ").append("public
").append(holderName).append("(final ").append(type).append("
value)").append(newline);
- buf.append(" {").append(newline);
- buf.append(" this.value = value;").append(newline);
- buf.append(" }").append(newline);
- buf.append(newline);
-
- buf.append("}").append(newline);
- return pkg + "." + holderName;
- }
-
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaKeywords.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaKeywords.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaKeywords.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * Singleton to check if a specified work is a restricted keyword.
- *
- * This list also includes the boolean literals and the null literal.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 5 Mar 2007
- */
-public class JavaKeywords
-{
-
- private static final JavaKeywords keywords = new JavaKeywords();
-
- private final String[] keywordsArray = { "abstract", "assert",
"boolean", "break", "byte", "case",
"catch", "char", "class", "const",
"continue", "default", "do",
- "double", "else", "enum", "extends",
"final", "finally", "float", "for",
"if", "goto", "implements", "import",
"instanceof", "int", "interface", "long",
- "native", "new", "package", "private",
"protected", "public", "return", "short",
"static", "strictfp", "super", "switch",
"synchronized", "this", "throw",
- "throws", "transient", "try", "void",
"volatile", "while" };
-
- private final String[] restrictedLiteralsArray = { "true",
"false", "null" };
-
- private final Set<String> restrictedKeywords;
-
- private JavaKeywords()
- {
- int keywordsSize = keywordsArray.length + restrictedLiteralsArray.length;
- keywordsSize = (int)((double)keywordsSize / 0.75) + 1;
-
- restrictedKeywords = new HashSet<String>(keywordsSize);
- addAll(restrictedKeywords, keywordsArray);
- addAll(restrictedKeywords, restrictedLiteralsArray);
- }
-
- private void addAll(final Set<String> set, final String[] data)
- {
- for (String current : data)
- {
- set.add(current);
- }
- }
-
- /**
- * The internal method to check if the keyword is a restricted
- * keyword.
- *
- * @param name
- * @return
- */
- private boolean internalIsRestrictedKeyword(final String name)
- {
- return restrictedKeywords.contains(name);
- }
-
- /**
- * Check is the passed in name is a reserved Java keyword.
- *
- * @param name
- * @return
- */
- public static boolean isJavaKeyword(final String name)
- {
- return keywords.internalIsRestrictedKeyword(name);
- }
-
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,364 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.io.StringWriter;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.rpc.encoding.TypeMapping;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.DOMUtils;
-import org.jboss.ws.common.DOMWriter;
-import org.jboss.ws.core.soap.Style;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.Configuration.OperationConfig;
-import org.jboss.ws.tools.metadata.ToolsUnifiedMetaDataBuilder;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
-import org.w3c.dom.Element;
-
-/**
- * Generates a WSDL for a service endpoint.
- *
- * <BR/> This is the main entry point for all Java To WSDL needs.
- * <BR/> Features that can be set are derived from
org.jboss.ws.tools.WSToolsConstants
- * <p/>
- * Notable ones are:<br/>
- * @see org.jboss.ws.tools.WSToolsConstants.WSTOOLS_FEATURE_RESTRICT_TO_TARGET_NS
- * @see org.jboss.ws.tools.WSToolsConstants.WSTOOLS_FEATURE_INCLUDE_SCHEMA_IN_WSDL
- * @see org.jboss.ws.tools.WSToolsConstants.WSTOOLS_FEATURE_USE_ANNOTATIONS
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 24-Jul-2005
- */
-public class JavaToWSDL
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(JavaToWSDL.class);
- // provide logging
- private static final Logger log = Logger.getLogger(JavaToWSDL.class);
-
- // The required wsdl namespace URI
- private String wsdlNamespace;
- // The target namespace
- private String targetNamespace;
- //The type namespace (it can be different from the target namespace)
- private String typeNamespace;
- // The service name
- private String serviceName;
- // The portType name
- private String portTypeName;
-
- private Style style;
-
- private ParameterStyle parameterStyle;
-
- // Features as represented by Constants
- private Map<String, Boolean> features = new HashMap<String, Boolean>();
-
- // A Map of package/namespace mapping that needs to be passed onto types generator
- private Map<String,String> packageNamespaceMap = new HashMap<String,
String>();
-
- private TypeMapping typeMapping = null;
-
- private JavaWsdlMapping javaWsdlMapping = null;
-
- private UnifiedMetaData umd = null;
-
- private boolean qualifiedElements = false;
-
- private Map<String, List<OperationConfig>> operationMap = null;
-
- /** Contruct a java to wsdl generator for a given wsdl version.
- * <p/>
- * WSDL-1.1 namespace URI:
http://schemas.xmlsoap.org/wsdl/<br/>
- * WSDL-2.0 namespace URI:
http://www.w3.org/2003/11/wsdl
- *
- * @param namespace wsdl namespace URI
- */
- public JavaToWSDL(String namespace)
- {
- if (Constants.NS_WSDL11.equals(namespace) == false)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"UNSUPPORTED_WSDL_VERSION", namespace));
-
- this.wsdlNamespace = namespace;
- }
-
- /**
- * Add a feature to this subsystem
- * @see org.jboss.ws.tools.WSToolsConstants
- * @param name
- * @param value
- */
- public void addFeature(String name, boolean value)
- {
- features.put(name, new Boolean(value));
- }
-
- /**
- * Return a feature if set
- * @see org.jboss.ws.tools.WSToolsConstants
- * @param name
- * @return boolean value representing the feature, if not
- * @throws IllegalStateException Feature unrecognized
- */
- public boolean getFeature(String name)
- {
- Boolean val = features.get(name);
- if (val == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"FEATURE_VALUE_NOT_AVAILABLE", name));
-
- return val.booleanValue();
- }
-
- /** Get the immutable wsdl namespace URI
- */
- public String getWsdlNamespace()
- {
- return wsdlNamespace;
- }
-
- /** Get the wsdl target namespace
- */
- public String getTargetNamespace()
- {
- return targetNamespace;
- }
-
- /** Set the wsdl target namespace
- */
- public void setTargetNamespace(String targetNamespace)
- {
- this.targetNamespace = targetNamespace;
- }
-
- /** Get the type Namespace */
- public String getTypeNamespace()
- {
- return typeNamespace;
- }
-
- /** Set the Type Namespace */
- public void setTypeNamespace(String typeNamespace)
- {
- this.typeNamespace = typeNamespace;
- }
-
- /** Get the wsdl service name
- */
- public String getServiceName()
- {
- return serviceName;
- }
-
- /** Set the wsdl service name
- */
- public void setServiceName(String serviceName)
- {
- this.serviceName = serviceName;
- }
-
- /** Get the wsdl service endpoint name
- */
- public String getPortTypeName()
- {
- return portTypeName;
- }
-
- /** Set the wsdl service PortType Name
- */
- public void setPortTypeName(String endpointName)
- {
- this.portTypeName = endpointName;
- }
-
- /**
- * During the WSDL generation process, a typeMapping will be
- * created that maps xml types -> java types
- *
- * @return typeMapping
- * @exception IllegalStateException If typeMapping has not been generated
- */
- public TypeMapping getTypeMapping()
- {
- if(typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_GENERATED"));
- return typeMapping;
- }
-
- public Style getStyle()
- {
- return style;
- }
-
- public void setStyle(Style style)
- {
- this.style = style;
- }
-
- public ParameterStyle getParameterStyle()
- {
- return parameterStyle;
- }
-
- public void setParameterStyle(ParameterStyle parameterStyle)
- {
- this.parameterStyle = parameterStyle;
- }
-
- /**
- * Users can customize a java package->xml namespace map
- * that will be used in the Java to WSDL process.
- * <br/>The package representing the endpoint will always be mapped
- * to the target namespace, irrespective of an attempt to
- * customize that in the map. If you desire to change that, then
- * think about changing just the type namespace as the types are
- * generated using the typenamespace.
- *
- * @param map The Map
- */
- public void setPackageNamespaceMap(Map<String,String> map)
- {
- //Lets convert the namespace->package map to package->namespace map
- Set<String> keys = map.keySet();
- Iterator<String> iter = keys.iterator();
- while (iter != null && iter.hasNext())
- {
- String pkg = iter.next();
- packageNamespaceMap.put(map.get(pkg), pkg);
- }
- }
-
- public void setOperationMap(Map<String, List<OperationConfig>>
operationMap)
- {
- this.operationMap = operationMap;
- }
-
- /**
- * Clients of Tools can build a UnifiedMetaData externally
- * and pass it to the Java To WSDL subsystem [Optional]
- *
- * @param um
- */
- public void setUnifiedMetaData(UnifiedMetaData um)
- {
- this.umd = um;
- }
-
- public UnifiedMetaData getUnifiedMetaData()
- {
- return umd;
- }
-
- public void setUmd(UnifiedMetaData umd)
- {
- this.umd = umd;
- }
-
- public boolean isQualifiedElements()
- {
- return qualifiedElements;
- }
-
- public void setQualifiedElements(boolean qualifiedElements)
- {
- this.qualifiedElements = qualifiedElements;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- /** Generate the common WSDL definition for a given endpoint
- */
- public WSDLDefinitions generate(Class endpoint)
- {
- if(log.isDebugEnabled()) log.debug("generate [endpoint=" +
endpoint.getName() + ",tnsURI=" + targetNamespace + ",service=" +
serviceName
- + ",portType=" + portTypeName + "]");
-
- if( umd == null)
- {
- umd = new ToolsUnifiedMetaDataBuilder(endpoint, targetNamespace,
- typeNamespace, serviceName, style, parameterStyle,
operationMap).getUnifiedMetaData();
- }
-
- if (typeNamespace != null)
- packageNamespaceMap.put(endpoint.getPackage().getName(), typeNamespace);
-
- WSDLDefinitions wsdlDefinitions = null;
- try
- {
- if (Constants.NS_WSDL11.equals(wsdlNamespace))
- {
- JavaToWSDL11 javaWSDL11 = new JavaToWSDL11();
- javaWSDL11.addFeatures(features);
- javaWSDL11.setPackageNamespaceMap(packageNamespaceMap);
- javaWSDL11.addFeatures(features);
- if( umd != null )
- javaWSDL11.setUnifiedMetaData(umd);
- javaWSDL11.setQualifiedElements(qualifiedElements);
-
- wsdlDefinitions = javaWSDL11.generate(endpoint);
- typeMapping = javaWSDL11.getTypeMapping();
- javaWsdlMapping = javaWSDL11.getJavaWsdlMapping();
- }
- if (wsdlDefinitions == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"CANNOT_GENERATE_WSDL_DEFINITIONS"));
-
- // Debug the generated wsdl
- StringWriter sw = new StringWriter();
- new WSDLWriter(wsdlDefinitions).write(sw, Constants.DEFAULT_XML_CHARSET);
- if(log.isDebugEnabled()) log.debug("Generated WSDL:\n" +
sw.toString());
-
- // Debug the generated mapping file
- String jaxrpcMappingStr = null;
- if (javaWsdlMapping != null)
- {
- Element root = DOMUtils.parse(javaWsdlMapping.serialize());
- jaxrpcMappingStr = DOMWriter.printNode(root, true);
- }
- if(log.isDebugEnabled()) log.debug("Generated Mapping:\n" +
jaxrpcMappingStr);
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception e)
- {
- log.error(BundleUtils.getMessage(bundle, "CANNOT_GENERATE_WSDL"), e);
- throw new WSException(BundleUtils.getMessage(bundle,
"CANNOT_GENERATE_WSDL_FROM", endpoint));
- }
- return wsdlDefinitions;
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,220 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import javax.xml.rpc.encoding.TypeMapping;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.tools.helpers.JavaToWSDLHelper;
-
-/**
- * Java To WSDL11 Converter
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Jul 24, 2005
- */
-
-public class JavaToWSDL11
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(JavaToWSDL11.class);
- // provide logging
- private static final Logger log = Logger.getLogger(JavaToWSDL11.class);
-
- // The required wsdl namespace URI
- private final String wsdlNamespace = Constants.NS_WSDL11;
-
- /** Features as represented by Constants*/
- private HashMap<String, Boolean> features = new HashMap<String,
Boolean>();
-
- // A Map of package/namespace mapping that needs to be passed onto types generator
- private Map<String, String> packageNamespaceMap = null;
-
- private TypeMapping typeMapping = null;
-
- private JavaWsdlMapping javaWsdlMapping = null;
-
- private UnifiedMetaData umd = null;
-
- private boolean qualifiedElements = false;
-
- /**
- * Default Constructor
- */
- public JavaToWSDL11()
- {
- if(log.isDebugEnabled()) log.debug("Creating JavaToWSDL11 instance");
- }
-
- /**
- * Add a feature to this subsystem
- * @see org.jboss.ws.tools.WSToolsConstants
- * @param name
- * @param value
- */
- public void addFeature(String name, boolean value)
- {
- features.put(name, new Boolean(value));
- }
-
- /**
- * Append features
- * @see org.jboss.ws.tools.WSToolsConstants
- * @param map
- */
- public void addFeatures(Map<String, Boolean> map)
- {
- features.putAll(map);
- }
-
- /**
- * Return a feature if set
- * @see org.jboss.ws.tools.WSToolsConstants
- * @param name
- * @return boolean value representing the feature, if not
- * @throws IllegalStateException Feature unrecognized
- */
- public boolean getFeature(String name)
- {
- Boolean val = features.get(name);
- if (val != null)
- return val.booleanValue();
- throw new WSException(BundleUtils.getMessage(bundle,
"FEATURE_UNRECOGNIZED"));
- }
-
- /**
- * A customized Package->Namespace map
- *
- * @param map
- */
- public void setPackageNamespaceMap(Map<String, String> map)
- {
- packageNamespaceMap = map;
- }
-
- /**
- * During the WSDL generation process, a typeMapping will be
- * created that maps xml types -> java types
- *
- * @return typeMapping
- * @exception IllegalStateException If typeMapping has not been generated
- */
- public TypeMapping getTypeMapping()
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_GENERATED"));
- return typeMapping;
- }
-
- /**
- * Clients of Tools can build a UnifiedMetaData externally
- * and pass it to the Java To WSDL subsystem [Optional]
- *
- * @param um
- */
- public void setUnifiedMetaData(UnifiedMetaData um)
- {
- this.umd = um;
- }
-
- /**
- * Generate the common WSDL definition for a given endpoint
- */
- public WSDLDefinitions generate(Class endpoint)
- {
- WSDLDefinitions wsdl = null;
-
- if (umd != null)
- {
- JavaToWSDLHelper helper = new JavaToWSDLHelper();
- try
- {
- helper.setPackageNamespaceMap(packageNamespaceMap);
- wsdl = handleJavaToWSDLGeneration(helper, endpoint.getName());
-
- typeMapping = helper.getTypeMapping();
- }
- catch (IOException e)
- {
- log.error(BundleUtils.getMessage(bundle,
"ERROR_DURING_GENERATION"), e);
- }
- }
-
- // This is somewhat of a hack
- if (qualifiedElements)
- {
- JBossXSModel schemaModel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- if (schemaModel != null)
- schemaModel.setQualifiedElements(true);
- }
-
- return wsdl;
- }
-
- public boolean isQualifiedElements()
- {
- return qualifiedElements;
- }
-
- public void setQualifiedElements(boolean qualifiedElements)
- {
- this.qualifiedElements = qualifiedElements;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- //PRIVATE METHODS
- private WSDLDefinitions handleJavaToWSDLGeneration(JavaToWSDLHelper helper, String
endpointName) throws IOException
- {
- WSDLDefinitions wsdl = null;
- if (umd == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"UNIFIED_META_DATA_MODEL_IS_NULL"));
-
- for (ServiceMetaData service : umd.getServices())
- {
- EndpointMetaData epMetaData =
service.getEndpointByServiceEndpointInterface(endpointName);
- if (epMetaData != null)
- {
- wsdl = helper.generate(service);
- break;
- }
- }
- javaWsdlMapping = helper.getJavaWsdlMapping();
- return wsdl;
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL20.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL20.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaToWSDL20.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,229 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-
-/**
- * Generates a WSDL-2.0 from a Service Endpoint Interface
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 10-Oct-2004
- */
-public class JavaToWSDL20
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(JavaToWSDL20.class);
- // provide logging
- private static final Logger log = Logger.getLogger(JavaToWSDL20.class);
-
- // The required wsdl namespace URI
- private final String wsdlNamespace = Constants.NS_WSDL11;
- // The target namespace
- private String targetNamespace;
- //The type namespace (it can be different from the target namespace)
- private String typeNamespace;
- // The service name
- private String serviceName;
-
- /** Name of the PortType*/
- private String portTypeName;
-
- /** Features as represented by Constants*/
- private HashMap<String,Boolean> features = new HashMap<String,Boolean>();
-
- // A Map of package/namespace mapping that needs to be passed onto types generator
- private Map<String,String> packageNamespaceMap = null;
-
- /**
- * CTR in the simplest form
- * @param sei Class that represents the SEI
- * @param targetNS Target Namespace
- * @param typeNS Type Namespace
- */
- /*public JavaToWSDL20(Class sei, String targetNS, String typeNS )
- {
- super(sei,targetNS, typeNS);
- this.wsdlNamespace = Constants.NS_WSDL20;
- }*/
-
- /**
- * Default Constructor
- */
- public JavaToWSDL20()
- {
- if(log.isDebugEnabled()) log.debug("Creating JavaToWSDL20 instance");
- }
-
- /**
- * Add a feature to this subsystem
- * @param name
- * @param value
- */
- public void addFeature(String name, boolean value)
- {
- features.put(name,new Boolean(value));
- }
-
- /**
- * Append features
- * @param map
- */
- public void addFeatures(Map<String,Boolean> map)
- {
- features.putAll(map);
- }
-
- /**
- * Return a feature if set
- * @param name
- * @return boolean value representing the feature, if not
- * @throws IllegalStateException Feature unrecognized
- */
- public boolean getFeature(String name)
- {
- Boolean val = features.get(name);
- if(val != null) return val.booleanValue();
- throw new WSException(BundleUtils.getMessage(bundle,
"FEATURE_UNRECOGNIZED"));
- }
-
- /**
- * @return Returns the endpointName.
- */
- public String getPortTypeName()
- {
- return portTypeName;
- }
-
-
-
- /**
- * @param endpointName The endpointName to set.
- */
- public void setPortTypeName(String endpointName)
- {
- this.portTypeName = endpointName;
- }
-
- /**
- * A customized Package->Namespace map
- *
- * @param map
- */
- public void setPackageNamespaceMap(Map<String,String> map)
- {
- packageNamespaceMap = map;
- }
-
-
-
- /**
- * @return Returns the serviceName.
- */
- public String getServiceName()
- {
- return serviceName;
- }
-
-
- /**
- * @param serviceName The serviceName to set.
- */
- public void setServiceName(String serviceName)
- {
- this.serviceName = serviceName;
- }
-
-
- /**
- * @return Returns the targetNamespace.
- */
- public String getTargetNamespace()
- {
- return targetNamespace;
- }
-
-
- /**
- * @param targetNamespace The targetNamespace to set.
- */
- public void setTargetNamespace(String targetNamespace)
- {
- this.targetNamespace = targetNamespace;
- }
-
- /**
- * Get the TypeNamespace
- *
- * @return
- */
- public String getTypeNamespace()
- {
- return typeNamespace;
- }
-
- /**
- *
- * Set the TypeNamespace
- * @param typeNamespace
- */
- public void setTypeNamespace(String typeNamespace)
- {
- this.typeNamespace = typeNamespace;
- }
-
- /**
- * Generate the common WSDL definition for a given endpoint
- */
- public WSDLDefinitions generate(Class endpoint)
- {
-// WSDLDefinitions wsdl = new WSDLDefinitions();
-// wsdl.setWsdlNamespace(this.wsdlNamespace);
-// //Delegate the generation of WSDL to a Helper class
-// JavaToWSDLHelper helper = new
JavaToWSDLHelper(wsdl,this.wsdlNamespace,this.targetNamespace);
-// if(typeNamespace == null ) typeNamespace = targetNamespace;
-// helper.setTypeNamespace(typeNamespace);
-// JavaToXSDIntf jxsd = new JavaToXSD(null);
-// if(packageNamespaceMap != null)
-// jxsd.setPackageNamespaceMap(packageNamespaceMap);
-// jxsd.addFeatures(features);
-// helper.setJavaToXSD(jxsd);
-// helper.setEndpoint(endpoint);
-// helper.appendDefinitions();
-// //TODO: Revisit when wsdl 2.0 support is provided
-// /*helper.generateTypesForXSD();
-// helper.generateInterfaces(portTypeName);
-// helper.generateBindings();
-// helper.generateServices(this.serviceName); */
-// return wsdl;
-
- return null;
- }
-
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaWriter.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaWriter.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/JavaWriter.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,401 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.xerces.xs.StringList;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.tools.XSDTypeToJava.VAR;
-
-/**
- * Handles writing of Java source files (XSD-> Java)
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since May 6, 2005
- */
-public class JavaWriter
-{
- private String newline = "\n";
-
- protected WSDLUtils utils = WSDLUtils.getInstance();
-
- public JavaWriter()
- {
- }
-
- /**
- * Creates a Java Class that represents a Simple Type restricted by enumeration
- * @param fname
- * @param lst List of enumerated values (we support Strings only)
- * @param loc Location where the file has to be created
- * @param pkgname Package Name
- * @throws IOException
- */
-
- public void createJavaFileForEnumeratedValues(String fname, StringList lst, File loc,
String pkgname, XSSimpleTypeDefinition type) throws IOException
- {
- List importList = new ArrayList();
- importList.add("java.util.Map");
- importList.add("java.util.HashMap");
- File sei = utils.createPhysicalFile(loc, fname);
- StringBuilder buf = utils.createClassBasicStructure(pkgname, fname, type,
importList, null);
-
- buf.append("private java.lang.String value;" + newline);
- buf.append("private static Map valueMap = new HashMap();" + newline);
-
- //For now, we will support Strings only
- int lenOfArr = lst != null ? lst.getLength() : 0;
- for (int i = 0; i < lenOfArr; i++)
- {
- String str = lst.item(i);
- buf.append("public static final String _" + str + "String =
\"" + str + "\";" + newline);
- }
-
- for (int i = 0; i < lenOfArr; i++)
- {
- String str = lst.item(i);
- buf.append("public static final java.lang.String _" + str + " =
new java.lang.String(_" + str + "String);");
- buf.append(newline);
- }
-
- for (int i = 0; i < lenOfArr; i++)
- {
- String str = lst.item(i);
- buf.append("public static final " + fname + " " + str +
" = new " + fname + "(_" + str + ");");
- buf.append(newline);
- }
-
- //Create CTR
- buf.append(newline + newline + "protected " + fname +
"(java.lang.String value) { " + newline);
-
- buf.append("this.value = value;valueMap.put(this.toString(), this); " +
newline + "}");
-
- buf.append(newline + newline);
-
- //Create getValue method
- buf.append(newline + " public java.lang.String getValue() {" + newline +
" return value;" + newline + "}");
-
- buf.append(newline + newline);
-
- //Create fromValue method
- buf.append(newline + "public static " + fname + "
fromValue(java.lang.String value)" + newline);
-
- buf.append(" throws java.lang.IllegalStateException {" + newline);
-
- for (int i = 0; i < lenOfArr; i++)
- {
- String str = lst.item(i);
- if (i > 0)
- buf.append("else ");
-
- buf.append("if (" + str + ".value.equals(value)) {" +
newline);
-
- buf.append("return " + str + ";" + newline);
-
- buf.append("}" + newline);
- }
-
- buf.append(" throw new IllegalArgumentException();" + newline +
"}" + newline + newline);
-
- //End- fromValue method
- //create- fromString method
-
- buf.append(newline + "public static " + fname + " fromString(String
value)" + newline);
-
- buf.append(" throws java.lang.IllegalStateException {" + newline);
-
- buf.append(fname + " ret = (" + fname + ")valueMap.get(value);"
+ newline);
-
- buf.append("if (ret != null) {" + newline + " return ret;" +
newline + " }" + newline + newline);
-
- for (int i = 0; i < lenOfArr; i++)
- {
- String str = lst.item(i);
- if (i > 0)
- buf.append("else ");
- buf.append("if (value.equals(_" + str + "String)) {" +
newline);
- buf.append("return " + str + ";" + newline +
"}");
- }
-
- buf.append(newline + " throw new IllegalArgumentException();" + newline +
"}" + newline + newline);
-
- //End- fromString method
- //create - toString method
-
- buf.append(newline + " public String toString() {" + newline + "
return value.toString();" + newline + "}" + newline);
-
- //End - toString method
-
- //create -readResolve method
-
- buf.append(newline + "private Object readResolve()" + newline + "
throws java.io.ObjectStreamException {" + newline
- + " return fromValue(getValue());" + newline + " }
" + newline);
- //End - readResolve method
-
- //create - equals method
-
- buf.append(newline + "private boolean equals(Object obj){" + newline +
" if (!(obj instanceof " + fname + ")) {" + newline + "
return false;"
- + newline + " } " + newline);
- buf.append("return ((" + fname + ")obj).value.equals(value);" +
newline + "}" + newline);
- //End - equals method
-
- //create - hashCode method
-
- buf.append(newline + " public int hashCode() { " + newline + "
return value.hashCode(); " + newline + " }" + newline);
- //End - hashCode method
- buf.append("}" + newline); //end of class
-
- FileWriter writer = new FileWriter(sei);
- writer.write(buf.toString());
- writer.flush();
- writer.close();
- }
-
- /**
- * A simple utility method that just creates a Java source file
- *
- * @param location Location where the Java source file needs to be written
- * @param filename File Name of the Java source
- * @param packageName
- * @param vars
- * @param importList List of strings that represent imports
- * @param baseTypeName Name of base class
- * @param isExceptionType Exception types need special treatment
- * @param typeNameToBaseVARList Needed if we are dealing with an exception type
- * @throws IOException
- */
- public void createJavaFile(File location, String filename, String packageName,
List<VAR> vars, List<String> importList, String baseTypeName,
- boolean isExceptionType, boolean isSerializable, Map<String, List>
typeNameToBaseVARList) throws IOException
- {
- File newLoc = null;
- if (needToCreatePackageStructure(location, packageName))
- newLoc = utils.createPackage(location.getPath(), packageName);
- else newLoc = location;
- String classname = ToolsUtils.convertInvalidCharacters(utils.chop(filename,
".java"));
- File sei = utils.createPhysicalFile(newLoc, classname);
- StringBuilder buffer = new StringBuilder();
- utils.writeJbossHeader(buffer);
-
- //Create the package Name
- buffer.append(newline).append("package
").append(packageName).append(";");
-
- if (importList != null)
- {
- for (String imp : importList)
- {
- buffer.append(newline).append("import
").append(imp).append(";");
- }
- }
- buffer.append(newline).append(newline);
- buffer.append(newline).append("public class
").append(classname).append(newline);
- if (baseTypeName != null && baseTypeName.length() > 0)
- buffer.append(" extends ").append(baseTypeName);
- if (isSerializable)
- buffer.append(" implements java.io.Serializable");
- buffer.append("{").append(newline);
- createVariables(buffer, vars, isExceptionType);
- createCTR(buffer, classname, vars, isExceptionType, typeNameToBaseVARList);
- buffer.append(newline);
- createAccessors(buffer, vars, isExceptionType);
- buffer.append("}").append(newline);
- //Create a FileWriter
- FileWriter writer = new FileWriter(sei);
- writer.write(buffer.toString());
- writer.flush();
- writer.close();
- }
-
- //PRIVATE METHODS
- private void createCTR(StringBuilder buf, String cname, List vars, boolean
isExceptionType, Map<String, List> typeNameToBaseVARList)
- {
- if (vars.size() > 0 && isExceptionType == false)
- {
- buf.append("public " + cname + "(){}"); //Empty CTR
- buf.append(newline);
- buf.append(newline);
- }
-
- StringBuilder ctrvarbuf = new StringBuilder();
- StringBuilder ctrintbuf = new StringBuilder();
-
- boolean calledSuper = false;
- if (isExceptionType)
- {
- List<VAR> baseList = typeNameToBaseVARList.get(cname);
- int baseLen = baseList != null ? baseList.size() : 0;
- String arrStr = "[]";
-
- if (baseLen > 0)
- {
- calledSuper = true;
- ctrintbuf.append("super(");
- for (int i = 0; i < baseLen; i++)
- {
-
- if (i > 0)
- {
- ctrvarbuf.append(", ");
- ctrintbuf.append(", ");
- }
- VAR v = baseList.get(i);
- ctrvarbuf.append(v.getVartype());
- if (v.isArrayType)
- ctrvarbuf.append(arrStr);
-
- ctrvarbuf.append(" ").append(v.getVarname());
- ctrintbuf.append(v.getVarname());
- }
- ctrintbuf.append(");").append(newline);
- }
- }
- Iterator iter = vars.iterator();
- int index = 0;
- while (iter.hasNext())
- {
- if (index++ > 0 || calledSuper)
- {
- ctrvarbuf.append(", ");
- }
- VAR v = (VAR)iter.next();
- String name = v.getVarname();
- if (JavaKeywords.isJavaKeyword(name))
- {
- name = "_" + name;
- }
-
- String type = v.getVartype();
- boolean isArr = v.isArrayType();
- ctrvarbuf.append(type);
- if (isArr)
- ctrvarbuf.append("[]");
- ctrvarbuf.append(" " + name);
- if (isExceptionType && calledSuper == false && index == 1
&& v.getVartype().equals("java.lang.String"))
- {
-
ctrintbuf.append("super(").append(v.getVarname()).append(");").append(newline);
- calledSuper = true;
- }
-
- ctrintbuf.append("this." + name + "=" + name +
";");
- ctrintbuf.append(newline);
- }
- buf.append("public " + cname + "(" + ctrvarbuf.toString() +
"){");
- buf.append(newline);
- buf.append(ctrintbuf.toString());
- buf.append("}");
- }
-
- private void createAccessors(StringBuilder buf, List vars, boolean isExceptionType)
- {
- Iterator iter = vars.iterator();
- while (iter.hasNext())
- {
- VAR v = (VAR)iter.next();
- String name = v.getVarname();
- String internalName = name;
- if (JavaKeywords.isJavaKeyword(internalName))
- {
- internalName = "_" + internalName;
- }
-
- String type = v.getVartype();
- boolean isArr = v.isArrayType();
- //Add getter/setter also
- buf.append("public " + type);
- if (isArr)
- buf.append("[] ");
- String str = " get";
- //boolean case
- if (type.equals("boolean"))
- str = " is";
- buf.append(str + utils.getMixedCase(name) + "() { return " +
internalName + " ;}");
- buf.append(newline);
- buf.append(newline);
- if (isExceptionType == false)
- writeSetter(buf, name, internalName, type, isArr);
- buf.append(newline);
- buf.append(newline);
- }
- }
-
- private List createVariables(StringBuilder buf, List vars, boolean isExceptionType)
- {
- if (vars == null)
- return vars;
- Iterator iter = vars.iterator();
- while (iter.hasNext())
- {
- VAR v = (VAR)iter.next();
- String name = v.getVarname();
- // JBWS-1170 Convert characters which are illegal in Java identifiers
- name = ToolsUtils.convertInvalidCharacters(name);
-
- if (JavaKeywords.isJavaKeyword(name))
- {
- name = "_" + name;
- }
-
- String type = v.getVartype();
- boolean isArr = v.isArrayType();
- buf.append(newline);
- if (isExceptionType)
- buf.append("private " + type);
- else buf.append("protected " + type);
- if (isArr)
- buf.append("[] ");
- buf.append(" " + name).append(";").append(newline);
- }
- return vars;
- }
-
- private boolean needToCreatePackageStructure(File location, String packageName)
- {
- packageName = packageName.replace('.', '/');
- try
- {
- String externalForm = location.toURL().toExternalForm();
- return externalForm.indexOf(packageName) < 0;
- }
- catch (MalformedURLException e)
- {
- // ignore
- return false;
- }
- }
-
- private void writeSetter(StringBuilder buf, String name, String internalName, String
type, boolean isArr)
- {
- buf.append("public void ");
- buf.append("set" + utils.getMixedCase(name) + "(" + type);
- if (isArr)
- buf.append("[]");
-
- buf.append(" " + internalName + "){ this." + internalName +
"=" + internalName + "; }");
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/NamespacePackageMapping.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/NamespacePackageMapping.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/NamespacePackageMapping.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,237 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.util.HashSet;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import org.jboss.ws.api.util.BundleUtils;
-
-/**
- * Utility class for mapping an XML namespace to a Java package.
- *
- * This mapping is performed according to the algorith defined in section D.5.1
- * of the JAXB 2.0 specification.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 18-Jul-2006
- */
-public class NamespacePackageMapping
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(NamespacePackageMapping.class);
-
- private static final NamespacePackageMapping npm = new NamespacePackageMapping();
-
- /*
- * The JAXB specification says to use the list of country codes as defined in ISO-3166
1981 to identify the top
- * level domains.
- *
- * The recommendations in the Java Language Specification for selecting unique package
names is based around
- * choosing package names using the domain name of your organisation.
- *
- * Not all countries use the country code listed in ISO-3166 as their top level
domain. As an example 'The United
- * Kingdom of Great Britain and Northern Ireland' uses .uk as the top level
domain, however ISO-3166 lists the
- * country code as gb.
- *
- * For this reason I have used the list of country codes available from here: -
- *
- *
http://www.iana.org/cctld/cctld-whois.htm
- */
- private final String[] countryCodesArray = { "ac", "ad",
"ae", "af", "ag", "ai", "al",
"am", "an", "ao", "aq", "ar",
"as", "at", "au", "aw", "az",
"ax", "ba", "bb",
- "bd", "be", "bf", "bg", "bh",
"bi", "bj", "bm", "bn", "bo",
"br", "bs", "bt", "bv", "bw",
"by", "bz", "ca", "cc", "cd",
"cf", "cg", "ch", "ci", "ck",
"cl",
- "cm", "cn", "co", "cr", "cs",
"cu", "cv", "cx", "cy", "cz",
"de", "dj", "dk", "dm", "do",
"dz", "ec", "ee", "eg", "eh",
"er", "es", "et", "eu", "fi",
"fj",
- "fk", "fm", "fo", "fr", "ga",
"gb", "gd", "ge", "gf", "gg",
"gh", "gi", "gl", "gm", "gn",
"gp", "gq", "gr", "gs", "gt",
"gu", "gw", "gy", "hk", "hm",
"hn",
- "hr", "ht", "hu", "id", "ie",
"il", "im", "in", "io", "iq",
"ir", "is", "it", "je", "jm",
"jo", "jp", "ke", "kg", "kh",
"ki", "km", "kn", "kp", "kr",
"kw",
- "ky", "kz", "la", "lb", "lc",
"li", "lk", "lr", "ls", "lt",
"lu", "lv", "ly", "ma", "mc",
"md", "mg", "mh", "mk", "ml",
"mm", "mn", "mo", "mp", "mq",
"mr",
- "ms", "mt", "mu", "mv", "mw",
"mx", "my", "mz", "na", "nc",
"ne", "nf", "ng", "ni", "nl",
"no", "np", "nr", "nu", "nz",
"om", "pa", "pe", "pf", "pg",
"ph",
- "pk", "pl", "pm", "pn", "pr",
"ps", "pt", "pw", "py", "qa",
"re", "ro", "ru", "rw", "sa",
"sb", "sc", "sd", "se", "sg",
"sh", "si", "sj", "sk", "sl",
"sm",
- "sn", "so", "sr", "st", "sv",
"sy", "sz", "tc", "td", "tf",
"tg", "th", "tj", "tk", "tl",
"tm", "tn", "to", "tp", "tr",
"tt", "tv", "tw", "tz", "ua",
"ug",
- "uk", "um", "us", "uy", "uz",
"va", "vc", "ve", "vg", "vi",
"vn", "vu", "wf", "ws", "ye",
"yt", "yu", "za", "zm", "zw" };
-
- private final String[] topLevelDomainsArray = { "com", "gov",
"net", "org", "edu" };
-
- private final Set<String> topLevelDomains;
-
- /**
- * Convert an XML namespace to a Java package using the algorithm defined in section
- * D.5.1 of the JAXB specification.
- *
- * @param targetNS
- * @return
- */
- public static String getJavaPackageName(final String targetNS)
- {
- return npm.convertNamespaceToPackage(targetNS);
- }
-
- private NamespacePackageMapping()
- {
- int topLevelSize = countryCodesArray.length + topLevelDomainsArray.length;
- topLevelSize = (int)((double)topLevelSize / 0.75) + 1;
-
- topLevelDomains = new HashSet<String>(topLevelSize);
- addAll(topLevelDomains, countryCodesArray);
- addAll(topLevelDomains, topLevelDomainsArray);
- }
-
- private void addAll(final Set<String> set, final String[] data)
- {
- for (String current : data)
- {
- set.add(current);
- }
- }
-
- private String convertNamespaceToPackage(final String targetNS)
- {
- String workingNS = targetNS;
-
- boolean schemeIsURN = workingNS.startsWith("urn:");
-
- if (workingNS.startsWith("http://"))
- {
- workingNS = workingNS.substring(7);
- }
- else if (workingNS.startsWith("https://"))
- {
- workingNS = workingNS.substring(8);
- }
- else if (workingNS.startsWith("urn:"))
- {
- workingNS = workingNS.substring(4);
- }
- else
- {
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"TARGETNS_SHOULD_START_WITH"));
- }
-
- // Test for an ending .?? .??? or .html
- boolean hasExtension =
workingNS.matches("^.*\\/.*\\.((.{2,3})|(html))$");
- if (hasExtension)
- {
- workingNS = workingNS.substring(0, workingNS.lastIndexOf("."));
- }
-
- String[] tokens = workingNS.split("[\\/\\:]+");
-
- if (schemeIsURN)
- {
- tokens[0] = tokens[0].replace('-', '.');
- }
-
- String[] packagePrefix = convertDomainToPackage(tokens[0]);
- String[] temp = tokens;
-
- tokens = new String[packagePrefix.length + temp.length - 1];
- System.arraycopy(packagePrefix, 0, tokens, 0, packagePrefix.length);
- System.arraycopy(temp, 1, tokens, packagePrefix.length, temp.length - 1);
-
- StringBuilder packageName = new StringBuilder();
-
- for (int i = 0; i < tokens.length; i++)
- {
- String current = tokens[i];
- current = current.toLowerCase();
- current = convertReserved(current);
- current = convertStart(current);
- current = ToolsUtils.convertInvalidCharacters(current);
-
- packageName.append(current);
- if (i < tokens.length - 1)
- {
- packageName.append(".");
- }
- }
-
- return packageName.toString();
- }
-
- /**
- * Check if the passed in component is a reserved keyword,
- * if it is append and underscore and return.
- */
- private String convertReserved(final String component)
- {
- String result = component;
- if (JavaKeywords.isJavaKeyword(result))
- {
- result = result + "_";
- }
-
- return result;
- }
-
- /**
- * Check if the first character of the component is a valid character to
- * start an identifier, if it is not prefix it with an underscore and return.
- */
- private String convertStart(final String component)
- {
- String result = component;
-
- if (Character.isJavaIdentifierStart(result.charAt(0)) == false)
- {
- result = "_" + result;
- }
-
- return result;
- }
-
- /**
- * Given a domain name split it into the corresponding parts, and convert
- * into the order suitable for creating a package name.
- *
- * The transposition is only performed if the last element is a top level domain
- * ("com", "gov", "net", "org",
"edu" or a country code used as a top level domain).
- */
- private String[] convertDomainToPackage(final String domain)
- {
- String[] parts = domain.split("\\.");
-
- String[] packge;
-
- if (topLevelDomains.contains(parts[parts.length - 1]))
- {
- if (parts[0].equals("www"))
- {
- packge = new String[parts.length - 1];
- }
- else
- {
- packge = new String[parts.length];
- }
-
- for (int i = 0; i < packge.length; i++)
- {
- packge[i] = parts[parts.length - i - 1];
- }
- }
- else
- {
- packge = parts;
- }
-
- return packge;
- }
-
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/RPCSignature.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/RPCSignature.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/RPCSignature.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,101 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLRPCPart;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-
-public class RPCSignature
-{
- private Collection<WSDLRPCPart> parameters = new
ArrayList<WSDLRPCPart>();
- private WSDLRPCPart returnParameter;
-
- public Collection<WSDLRPCPart> parameters()
- {
- return parameters;
- }
-
- public WSDLRPCPart returnParameter()
- {
- return returnParameter;
- }
-
- public RPCSignature(WSDLInterfaceOperation operation)
- {
- WSDLInterfaceOperationInput input = WSDLUtils.getWsdl11Input(operation);
- WSDLInterfaceOperationOutput output = WSDLUtils.getWsdl11Output(operation);
- for (WSDLRPCSignatureItem item : operation.getRpcSignatureItems())
- {
- if (item.getDirection() == Direction.RETURN)
- {
- if (output != null)
- returnParameter = output.getChildPart(item.getName());
- continue;
- }
-
- WSDLRPCPart part = null;
- if (input != null)
- part = input.getChildPart(item.getName());
- if (output != null && part == null)
- part = output.getChildPart(item.getName());
-
- if (part != null)
- parameters.add(part);
- }
-
- for (WSDLRPCPart part : input.getChildParts())
- {
- if (operation.getRpcSignatureitem(part.getName()) == null)
- parameters.add(part);
- }
-
- if (output != null)
- {
- for (WSDLRPCPart part : output.getChildParts())
- {
- if (operation.getRpcSignatureitem(part.getName()) == null)
- {
- // Filter in-outs
- if (input.getChildPart(part.getName()) != null)
- continue;
-
- if (returnParameter == null)
- {
- returnParameter = part;
- }
- else
- {
- parameters.add(part);
- }
- }
- }
- }
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ToolsUtils.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ToolsUtils.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/ToolsUtils.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,513 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.beans.BeanInfo;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URI;
-import java.rmi.Remote;
-import java.util.Calendar;
-import java.util.Date;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.holders.ByteArrayHolder;
-import javax.xml.rpc.holders.Holder;
-
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.core.jaxrpc.binding.SimpleDeserializerFactory;
-import org.jboss.ws.core.jaxrpc.binding.SimpleSerializerFactory;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.common.JavaUtils;
-
-/**
- * Util class for the JBossWS Tools project
- * Contains important methods that deal with JAXB 1, JAXB2
- * and JAXWS 2.0 specs
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Jun 25, 2005
- */
-public class ToolsUtils
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(ToolsUtils.class);
-
- /**
- * Maintains a static reference to the TypeMapping just for
- * the standard type mappings
- */
- private static LiteralTypeMapping mapping = new LiteralTypeMapping();
-
- //Hide the constructor - this is a class with static methods
- private ToolsUtils()
- {
- throw new WSException(BundleUtils.getMessage(bundle,
"CANNOT_INSTANTIATE_TOOLSUTILS"));
- }
-
- /**
- * Checks whether the class extends java.rmi.Remote
- *
- * @param paramType
- */
- public static void checkParameterType( Class paramType)
- {
- if (Remote.class.isAssignableFrom(paramType))
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"METHOD_PARAM_SHOULDN_NOT_EXTEND_REMOTE"));
- }
-
- /**
- * Ensure that the first alphabet is uppercase
- * @param fname
- * @return String that has first character upper case
- */
- public static String firstLetterUpperCase(String fname)
- {
- if (fname == null || fname.length() == 0)
- throw new WSException(BundleUtils.getMessage(bundle,
"STRING_PASSED_IS_NULL"));
- //Ensure that the first character is uppercase
- if (Character.isLowerCase(fname.charAt(0)))
- {
- char[] chars = fname.toCharArray();
- char f = Character.toUpperCase(chars[0]);
- chars[0] = f;
- fname = new String(chars);
- }
- return fname;
- }
-
- /**
- * Ensure that the first alphabet is lowercase
- * @param fname
- * @return String that has first character lower case
- */
- public static String firstLetterLowerCase(String fname)
- {
- if (fname == null || fname.length() == 0)
- throw new WSException(BundleUtils.getMessage(bundle,
"STRING_PASSED_IS_NULL"));
- //Ensure that the first character is lowercase
- if (Character.isUpperCase(fname.charAt(0)))
- {
- char[] chars = fname.toCharArray();
- char f = Character.toLowerCase(chars[0]);
- chars[0] = f;
- fname = new String(chars);
- }
- return fname;
- }
-
- /**
- * Returns a Java Identifier from a XML Name
- * as specified by both JAXB 1 and JAXB 2 specs.
- * Used for deriving class names, method names etc
- * @param xmlName XML Name
- * @return Legal Java Identifier
- */
- public static String getJavaIdentifier(String xmlName)
- {
- if(xmlName == null || xmlName.length() == 0)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"XMLNAME_IS_NULL"));
- xmlName = xmlName.trim(); //Get rid of whitespaces
-
- //Remove leading and trailing punctuation marks
- xmlName = trimPunctuationMarks( xmlName);
-
- if(xmlName == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"XMLNAME_IS_NULL"));
-
- //Get rid of characters that are not legal characters
- int lenStr = xmlName.length();
- char[] mainArr = new char[lenStr];
- int j = 0;
- for(int i = 0; i < lenStr;i++)
- {
- char ch = xmlName.charAt(i);
- if(Character.isJavaIdentifierPart(ch))
- {
- mainArr[j] = ch;
- j++;
- }
- }
-
- //Copy into a new array
- char[] secArr = new char[j];
- for(int x = 0; x < j ; x++)
- {
- secArr[x] = mainArr[x];
- }
-
- return new String(secArr);
- }
-
- /**
- * Get valid Java Method name as per JAXB 1 and JAXB2.0 spec
- * @param xmlName XML Name
- * @param setter is this method for which the name is sought, a setter?
- * @return Valid Java method name
- */
- public static String getJavaMethodName( String xmlName, boolean setter)
- {
- xmlName = getJavaIdentifier(xmlName);
- xmlName = firstLetterUpperCase(xmlName);
- String lcase = xmlName.toLowerCase();
- if( setter && !lcase.startsWith("set"))
- {
- xmlName = "set" + xmlName;
- }
- else
- if(!setter && !lcase.startsWith("get"))
- {
- xmlName = "get" + xmlName;
- }
- return firstLetterLowerCase(xmlName);
- }
-
-
- /**
- * Get a valid Java class name as per JAXB 1 and JAXB2.0 spec
- * @param xmlName XML Name
- * @return Valid class name
- */
- public static String getValidClassName( String xmlName)
- {
- xmlName = getJavaIdentifier(xmlName);
- //Ensure the first character is uppercase
- return firstLetterUpperCase(xmlName);
- }
-
- /**
- * Given a Java Class, return the xmlType
- *
- * @param javaClass
- * @param ns
- * @return
- */
- public static QName getXMLType(Class javaClass, String ns)
- {
- WSDLUtils utils = WSDLUtils.getInstance();
- QName xmlType = null;
- if(void.class == javaClass)
- return null;
-
- /**
- * Special boundary condition: When the javaClass is ByteArrayHolder,
- * the xmlType should be xsd:base64Binary, but because of our algorithm,
- * it will become xsd:byte - so need to bypass this.
- */
- if(ByteArrayHolder.class == javaClass)
- {
- return Constants.TYPE_LITERAL_BASE64BINARY;
- }
-
- if(Holder.class.isAssignableFrom(javaClass))
- javaClass = utils.getJavaTypeForHolder(javaClass);
- xmlType = SchemaUtils.getInstance().getToolsOverrideInTypeMapping(javaClass);
- if(xmlType != null)
- return xmlType;
-
- // Byte[] should always be mapped to an array of bytes
- // String[] should always be mapped to an array of strings
- if (javaClass != Byte[].class && javaClass != String[].class)
- {
- xmlType = mapping.getXMLType(javaClass,false);
- if(xmlType != null)
- return xmlType;
- }
- //Else create a QName
- String typeName = utils.getJustClassName(javaClass);;
- if(javaClass.isArray())
- {
- int dim = utils.getArrayDimension(javaClass);
- Class cls = javaClass;
- while(cls.isArray())
- {
- cls = cls.getComponentType();
- }
- typeName = WSDLUtils.getInstance().getJustClassName(cls);
- while(dim-- > 0)
- typeName += ".Array";
- }
-
- return new QName(ns, typeName);
-
- /*SchemaCreatorIntf sc = new SchemaTypeCreator();
- sc.setRestrictToTargetNamespace(restrictNS);
- //For basic types, the following algorithm will return the simple types
- JBossXSTypeDefinition xt = sc.generateTypeWithoutRegistration(null, javaClass,ns);
- return new QName(xt.getNamespace(), xt.getName());*/
- }
-
- /**
- * Get the XML Type for an attachment mime type
- * (will be xsd:hexbinary)
- *
- * @param mimetype
- * @return
- */
- public static QName getXMLTypeForAttachmentType( String mimetype)
- {
- return Constants.TYPE_LITERAL_HEXBINARY;
- }
-
-
- /**
- * Returns whether a character is a punctuation
- * @param c
- * @return true:if punctuation, false - otherwise
- */
- public static boolean isPunctuation(char c)
- {
- boolean ret = true;
- //Idea is if it is not a letter, a digit, a white space, it is a punct
- if(Character.isDigit(c)) ret = false;
- else
- if(Character.isLetter(c)) ret = false;
- else
- if(Character.isISOControl(c)) ret = false;
- else
- if(Character.isWhitespace(c)) ret = false;
- return ret;
- }
-
- /**
- * Checks whether a class is a legal jaxrpc value type
- * as defined by jaxrpc 1.l specification
- *
- * @param cls
- * @return
- */
- public static boolean isJaxrpcValueType(Class cls)
- {
- boolean result = true;
- if(isJaxrpcRegularType(cls))
- return false;
- boolean defaultCTR = false;
-
- //Does it define a default constructor?
- Constructor[] cons = cls.getDeclaredConstructors();
- for (int i=0; i<cons.length; i++)
- {
- Class[] paramTypes = cons[i].getParameterTypes();
- if(paramTypes == null || paramTypes.length == 0)
- {
- defaultCTR = true;
- break;
- }
- }
- if(defaultCTR == false)
- return false;
-
- //Does the class extend Remote?
- if(Remote.class.isAssignableFrom(cls))
- return false;
-
- //Check the public fields are Jaxprc types
- Field[] fieldArr = cls.getDeclaredFields();
- int length = Array.getLength(fieldArr);
- for(int i = 0 ; i < length ; i++)
- {
- if(!isJaxrpcPermittedType(fieldArr[i].getType()) )
- return false;
- }
- return result;
- }
-
-
- /**
- * Basic check whether the passed argument: class
- * contain properties
- *
- * @param cls
- * @return
- */
- public static boolean isJavaBean(Class cls)
- {
- boolean result = false;
- if(isJaxrpcRegularType(cls))
- return false;
- try
- {
- BeanInfo bi = Introspector.getBeanInfo(cls);
- PropertyDescriptor[] pds = bi.getPropertyDescriptors();
- if(pds != null && pds.length > 0)
- result = true;
- }
- catch (java.beans.IntrospectionException e)
- {
- }
- return result;
- }
-
- public static int getNumberOfParticles(Class javaBean)
- {
- if(isJavaBean(javaBean) == false)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"ILLEGAL_JAVABEAN_ARGUMENT"));
-
- //Get number of public fields
- Field[] pubFields = javaBean.getFields();
- int pub = pubFields != null ? pubFields.length : 0;
-
- int props = 0;
- //Get number of properties via bean introspection
- try
- {
- BeanInfo bi = Introspector.getBeanInfo(javaBean);
- PropertyDescriptor[] pds = bi.getPropertyDescriptors();
- props = pds != null ? Array.getLength(pds) : 0;
- int len = 0;
- for(int i = 0; i < props ; i++)
- {
- PropertyDescriptor pd = pds[i];
- Method readMethod = pd.getReadMethod();
- if("getClass".equals(readMethod.getName()))
- continue;
- len++;
- }
- props = len;
- }
- catch (java.beans.IntrospectionException e)
- {
- }
-
- return pub + props;
- }
-
- /**
- * Determines whether a Java Class can be unwrapped
- *
- * @param javaType
- * @param isReturnType Does the javaType represent a return type
- * of a method?
- * @return
- */
- public static boolean canUnWrap(Class javaType, boolean isReturnType)
- {
- boolean bool = false;
-
- if(isReturnType)
- {
- bool = ( ToolsUtils.isJavaBean(javaType)
- && ToolsUtils.getNumberOfParticles(javaType) == 1 );
- }
- else
- bool = ToolsUtils.isJaxrpcValueType(javaType);
-
- return bool;
- }
-
- /**
- * Checks whether the class type that is passed as argument is
- * a legal Jaxrpc type as defined by jaxrpc 1.1 spec
- *
- * @param type
- * @return
- */
- public static boolean isJaxrpcPermittedType(Class type)
- {
- if(isJaxrpcRegularType(type) == false)
- return isJaxrpcValueType(type);
- else
- return true;
- }
-
- /**
- * Checks whether the class type that is passed as argument is
- * a legal Jaxrpc type (and not a Value Type) as defined by jaxrpc 1.1 spec
- *
- * @param type
- * @return
- */
- public static boolean isJaxrpcRegularType(Class type)
- {
- boolean result = false;
- //Check if it is a primitive type
- if(JavaUtils.isPrimitive(type))
- return true;
- //Check if it is an array of primitive types
- Class wrapperType = JavaUtils.getWrapperType(type);
- if( wrapperType != null && wrapperType != type )
- return true;
- //Check if it is a wrapper type or array
- Class primType = JavaUtils.getPrimitiveType(type);
- if( primType != null && primType != type)
- return true;
- //Check standard jaxrpc 1.1 classes
- if(String.class == type || Date.class == type || Calendar.class == type ||
- BigInteger.class == type || BigDecimal.class == type || QName.class == type
||
- URI.class == type)
- return true;
- return result;
- }
-
- public synchronized static void registerJavaType(LiteralTypeMapping typeMapping,
- Class clazz, QName xmlType)
- {
- if(typeMapping.isRegistered(clazz,xmlType) == false )
- typeMapping.register(clazz,xmlType, new SimpleSerializerFactory(), new
SimpleDeserializerFactory());
- }
-
- /**
- * Check all of the characters in the component and for any that are not valid
- * in Java identifiers replace with an underscore.
- */
- public static String convertInvalidCharacters(final String component)
- {
- String result = component;
- for (int i = 0; i < result.length(); i++)
- {
- if (Character.isJavaIdentifierPart(result.charAt(i)) == false)
- {
- result = result.replace(result.charAt(i), '_');
- }
- }
-
- return result;
- }
-
- //Private methods
- private static String trimPunctuationMarks( String str)
- {
- if(str == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"STR_IS_NULL"));
- //Check if the first character is permissible
- if(Character.isJavaIdentifierStart(str.charAt(0)) == false)
- str = str.substring(1);
- else
- //Check if the first character is a punctuation
- if(isPunctuation(str.charAt( 0 )) )
- str = str.substring(1);
- int len = str.length();
- //Check if the last character is a punctuation
- if(isPunctuation(str.charAt( len -1 )) )
- str = str.substring(0,len-1);
- return str;
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSDLToJava.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSDLToJava.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,858 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTerm;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.JavaUtils;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLException;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLRPCPart;
-import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader;
-import org.jboss.ws.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.tools.helpers.ReturnTypeUnwrapper;
-import org.jboss.ws.tools.interfaces.WSDLToJavaIntf;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
-import org.w3c.dom.Element;
-
-/**
- * Class that acts as the front door to all wsdl2java needs<br>
- *
- * <br>Note: (Web Services Layer)<br>
- * Method to generate Java SEI is as follows<br>
- * <br>{@link #generateSEI(URL wsdlFile, File dir, boolean annotate) generateSEI}
- * <br>
- * <br> Please also have a look at the features that can be passed via {@link
#setFeature(String name, boolean value) setFeature}
- * <br>
- * <br>Features are:
- * <br>@see org.jboss.ws.common.Constants.USE_ANNOTATIONS : Should the generated
Java Types use annotations
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Dec 28, 2004
- */
-public class WSDLToJava implements WSDLToJavaIntf
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(WSDLToJava.class);
- private String newline = "\n";
-
- protected LiteralTypeMapping typeMapping = null;
-
- protected WSDLDefinitions wsdl = null;
-
- /**
- * Singleton class that handle many utility functions
- */
- protected WSDLUtils utils = WSDLUtils.getInstance();
-
- //Feature Set
- protected boolean annotate = false;
-
- protected Map<String, String> namespacePackageMap = null;
- protected boolean generateSerializableTypes = false;
-
- protected HolderWriter holderWriter = new HolderWriter();
-
- private String seiPkgName = "";
-
- private String directoryToGenerate = "";
-
- private String style;
- private String parameterStyle;
-
- public WSDLToJava()
- {
- }
-
- /* (non-Javadoc)
- * @see org.jboss.ws.tools.WSDLToJavaIntf#convertWSDL2Java(java.net.URL)
- */
- public WSDLDefinitions convertWSDL2Java(URL wsdlfileurl) throws WSDLException
- {
- checkTypeMapping();
- WSDLDefinitionsFactory wsdlFactory = WSDLDefinitionsFactory.newInstance();
- wsdl = wsdlFactory.parse(wsdlfileurl);
-
- return wsdl;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.ws.tools.WSDLToJavaIntf#getFeature(java.lang.String)
- */
- public boolean getFeature(String name)
- {
- if (name == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"ILLEGAL_NULL_ARGUMENT", "name"));
-
- if (name.equalsIgnoreCase(WSToolsConstants.WSTOOLS_FEATURE_USE_ANNOTATIONS))
- return annotate;
-
- throw new WSException(BundleUtils.getMessage(bundle,
"FEATURE_NOT_RECOGNIZED", name ));
- }
-
- /* (non-Javadoc)
- * @see org.jboss.ws.tools.WSDLToJavaIntf#setFeature(java.lang.String, boolean)
- */
- public void setFeature(String name, boolean value)
- {
- if (name == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"ILLEGAL_NULL_ARGUMENT", "name"));
-
- if (name.equalsIgnoreCase(WSToolsConstants.WSTOOLS_FEATURE_USE_ANNOTATIONS))
- annotate = value;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.ws.tools.WSDLToJavaIntf#generateSEI(java.net.URL, java.io.File,
boolean)
- */
- public void generateSEI(URL wsdlFile, File dir, boolean annotate) throws IOException
- {
- checkTypeMapping();
- WSDLDefinitions wsdl = convertWSDL2Java(wsdlFile);
- this.annotate = annotate;
- this.directoryToGenerate = dir.getAbsolutePath();
- generateSEI(wsdl, dir);
- }
-
- /* (non-Javadoc)
- * @see
org.jboss.ws.tools.WSDLToJavaIntf#generateSEI(org.jboss.ws.metadata.wsdl.WSDLDefinitions,
java.io.File)
- */
- public void generateSEI(WSDLDefinitions wsdl, File dir) throws IOException
- {
- checkTypeMapping();
- this.directoryToGenerate = dir.getAbsolutePath();
- this.wsdl = wsdl;
- style = utils.getWSDLStyle(wsdl);
-
- //TODO: Handle annotations flag, as per JAX-WS 2.0 Spec.
- //Given the WSDL Object Tree, generate the SEI
- //Also take in the location where the SEI should be written
- // String typeNS = wsdl.getNamespaceURI(WSDLConstants.PREFIX_TNS);
- String targetNS = wsdl.getTargetNamespace();
- //Check if there is an user override
- String packageName = namespacePackageMap != null ?
namespacePackageMap.get(targetNS) : null;
- if (packageName == null || packageName.length() == 0)
- packageName = NamespacePackageMapping.getJavaPackageName(targetNS);
-
- this.seiPkgName = packageName;
-
- File dirloc = utils.createPackage(dir.getAbsolutePath(), packageName);
- createSEI(dirloc, wsdl);
- }
-
- public Map<String, String> getNamespacePackageMap()
- {
- return namespacePackageMap;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.ws.tools.WSDLToJavaIntf#setPackageNamespaceMap(java.util.Map)
- */
- public void setNamespacePackageMap(Map<String, String> map)
- {
- //Lets convert the package->namespace map to namespace->package map
- Set<String> keys = map.keySet();
- Iterator<String> iter = keys.iterator();
- while (iter != null && iter.hasNext())
- {
- if (namespacePackageMap == null)
- namespacePackageMap = new HashMap<String, String>();
- String pkg = iter.next();
- namespacePackageMap.put(pkg, map.get(pkg));
- }
- }
-
- public boolean isGenerateSerializableTypes()
- {
- return generateSerializableTypes;
- }
-
- public void setGenerateSerializableTypes(boolean generateSerializableTypes)
- {
- this.generateSerializableTypes = generateSerializableTypes;
- }
-
- public void setTypeMapping(LiteralTypeMapping tm)
- {
- this.typeMapping = tm;
- }
-
- private class WrappedArray
- {
- public QName xmlType;
- public XSTypeDefinition xt;
- public String suffix;
- public boolean nillable;
-
- public WrappedArray(XSTypeDefinition xt)
- {
- this.xt = xt;
- }
-
- public boolean unwrap()
- {
- if (!Constants.DOCUMENT_LITERAL.equals(style))
- {
- XSElementDeclaration unwrapped = SchemaUtils.unwrapArrayType(xt);
- StringBuilder builder = new StringBuilder();
- while (unwrapped != null)
- {
- xt = unwrapped.getTypeDefinition();
- nillable = unwrapped.getNillable();
- builder.append("[]");
- unwrapped = SchemaUtils.unwrapArrayType(xt);
- }
- if (builder.length() > 0)
- {
- xmlType = new QName(xt.getNamespace(), xt.getName());
- suffix = builder.toString();
- return true;
- }
- }
-
- return false;
- }
- }
-
- //***************************************************************************
- // PRIVATE METHODS
- //***************************************************************************
-
- private boolean isDocument()
- {
- return Constants.DOCUMENT_LITERAL.equals(style);
- }
-
- private boolean isWrapped()
- {
- return "wrapped".equals(parameterStyle) &&
Constants.DOCUMENT_LITERAL.equals(style);
- }
-
- private void appendMethods(WSDLInterface intf, StringBuilder buf) throws IOException
- {
- buf.append(newline);
- String itfname = intf.getName().getLocalPart();
- WSDLInterfaceOperation[] ops = intf.getOperations();
- if (ops == null || ops.length == 0)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"INTERFACE_NO_OPERATIONS", itfname ));
- int len = ops != null ? ops.length : 0;
-
- for (int i = 0; i < len; i++)
- {
- WSDLInterfaceOperation op = ops[i];
-
- WSDLBindingOperation bindingOperation = HeaderUtil.getWSDLBindingOperation(wsdl,
op);
-
- //TODO: Take care of multiple outputs
- String returnType = null;
-
- StringBuilder paramBuffer = new StringBuilder();
-
- WSDLInterfaceOperationInput input = WSDLUtils.getWsdl11Input(op);
- WSDLInterfaceOperationOutput output = WSDLUtils.getWsdl11Output(op);
- if (isDocument())
- {
- returnType = appendDocParameters(paramBuffer, input, output,
bindingOperation);
- }
- else
- {
- returnType = appendRpcParameters(paramBuffer, op, output, bindingOperation);
- }
-
- if (returnType == null)
- returnType = "void";
-
- buf.append(" public " + returnType + " ");
- buf.append(ToolsUtils.firstLetterLowerCase(op.getName().getLocalPart()));
- buf.append("(").append(paramBuffer);
-
- buf.append(") throws ");
- //Generate the Exception Types
- WSDLInterfaceOperationOutfault[] outfaults = op.getOutfaults();
- for (int k = 0; k < outfaults.length; k++)
- {
- WSDLInterfaceOperationOutfault fault = outfaults[k];
- QName faultName = fault.getRef();
-
- //Get the main fault from the wsdlInterface
- WSDLInterfaceFault intfFault =
fault.getWsdlInterfaceOperation().getWsdlInterface().getFault(faultName);
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- QName faultXMLName = intfFault.getElement();
- QName faultXMLType = intfFault.getXmlType();
- XSElementDeclaration xe =
xsmodel.getElementDeclaration(faultXMLName.getLocalPart(),
faultXMLName.getNamespaceURI());
- XSTypeDefinition xt = xe.getTypeDefinition();
- if (!xt.getAnonymous())
- xt = xsmodel.getTypeDefinition(xt.getName(), xt.getNamespace());
- if (xt instanceof XSComplexTypeDefinition)
- generateJavaSource((XSComplexTypeDefinition)xt, xsmodel,
faultXMLName.getLocalPart(), true);
-
- Class cl = getJavaType(faultXMLType, false);
- if (cl == null)
- {
- String faultTypeName = (!xt.getAnonymous()) ? faultXMLType.getLocalPart()
: faultXMLName.getLocalPart();
- String packageName = getPackageName(xt.getNamespace());
- buf.append(packageName + "." +
JavaUtils.capitalize(faultTypeName));
- }
- else buf.append(cl.getName());
- buf.append(",");
- }
- buf.append(" java.rmi.RemoteException");
- buf.append(";");
- buf.append(newline);
- }
- }
-
- private String appendRpcParameters(StringBuilder paramBuffer, WSDLInterfaceOperation
op, WSDLInterfaceOperationOutput output, WSDLBindingOperation bindingOperation)
- throws IOException
- {
- String returnType = null;
- boolean first = true;
-
- RPCSignature signature = new RPCSignature(op);
- for (WSDLRPCPart part : signature.parameters())
- {
-
- if (first)
- first = false;
- else paramBuffer.append(", ");
-
- QName xmlName = new QName(part.getName());
- QName xmlType = part.getType();
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
-
- boolean holder = output != null && output.getChildPart(part.getName())
!= null;
- generateParameter(paramBuffer, xmlName.getLocalPart(), xmlType, xsmodel, xt,
false, true, holder);
- paramBuffer.append("
").append(getMethodParam(xmlName.getLocalPart()));
- }
-
- if (signature.returnParameter() != null)
- {
- QName xmlName = new QName(signature.returnParameter().getName());
- QName xmlType = signature.returnParameter().getType();
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
- returnType = getReturnType(xmlName, xmlType, xt);
- }
-
- if (bindingOperation != null)
- {
- appendHeaderParameters(paramBuffer, bindingOperation);
- }
-
- return returnType;
- }
-
- private String appendDocParameters(StringBuilder paramBuffer,
WSDLInterfaceOperationInput input, WSDLInterfaceOperationOutput output,
- WSDLBindingOperation bindingOperation) throws IOException
- {
- String returnType = null;
- boolean holder = false;
- if (input != null && input.getElement() != null)
- {
- QName xmlName = input.getElement();
- holder = output != null && xmlName.equals(output.getElement());
-
- appendParameters(paramBuffer, input, output, xmlName.getLocalPart());
- }
-
- if (!holder && output != null && output.getElement() != null)
- {
- QName xmlName = output.getElement();
- QName xmlType = output.getXMLType();
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
-
- returnType = getReturnType(xmlName, xmlType, xt);
- }
-
- if (bindingOperation != null)
- {
- appendHeaderParameters(paramBuffer, bindingOperation);
- }
-
- return returnType;
- }
-
- private void appendHeaderParameters(StringBuilder buf, WSDLBindingOperation
bindingOperation) throws IOException
- {
- WSDLSOAPHeader[] inputHeaders =
HeaderUtil.getSignatureHeaders(bindingOperation.getInputs());
- WSDLSOAPHeader[] outputHeaders =
HeaderUtil.getSignatureHeaders(bindingOperation.getOutputs());
-
- // Process Inputs First
- for (WSDLSOAPHeader currentInput : inputHeaders)
- {
- boolean holder = HeaderUtil.containsMatchingPart(outputHeaders, currentInput);
- appendHeaderParameter(buf, currentInput, holder);
- }
-
- for (WSDLSOAPHeader currentOutput : outputHeaders)
- {
- boolean input = HeaderUtil.containsMatchingPart(inputHeaders, currentOutput);
-
- if (input == true)
- continue;
-
- appendHeaderParameter(buf, currentOutput, true);
- }
- }
-
- private void appendHeaderParameter(StringBuilder buf, WSDLSOAPHeader header, boolean
holder) throws IOException
- {
- QName elementName = header.getElement();
-
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- XSElementDeclaration xe = xsmodel.getElementDeclaration(elementName.getLocalPart(),
elementName.getNamespaceURI());
- XSTypeDefinition xt = xe.getTypeDefinition();
- WSDLTypes wsdlTypes = wsdl.getWsdlTypes();
- QName xmlType = wsdlTypes.getXMLType(header.getElement());
-
- // Replace the xt with the real type from the schema.
- xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
-
- if (buf.length() > 0)
- {
- buf.append(", ");
- }
-
- generateParameter(buf, xe.getName(), xmlType, xsmodel, xt, false, true, holder);
- buf.append(" ").append(header.getPartName());
- }
-
- private void appendParameters(StringBuilder buf, WSDLInterfaceOperationInput in,
WSDLInterfaceOperationOutput output, String containingElement) throws IOException
- {
-
- QName xmlType = in.getXMLType();
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
-
- boolean wrapped = isWrapped();
-
- if (wrapped)
- {
- int inputs = in.getWsdlOperation().getInputs().length;
- if (inputs > 1)
- throw new WSException(BundleUtils.getMessage(bundle,
"JAXRPC_CAN_NOT_UNWRAP_MUTLIPLE_INPUTS", inputs));
-
- String operationName = in.getWsdlOperation().getName().getLocalPart();
- String elementName = in.getElement().getLocalPart();
-
- if (elementName.equals(operationName) == false)
- throw new
WSException(BundleUtils.getMessage(bundle,"WRAPPER_ELEMENT_MUST_MATCH"));
-
- wrapped = unwrapElementParameters(buf, containingElement, xt);
- }
-
- if (wrapped == false)
- {
- QName xmlName = in.getElement();
- boolean holder = output != null && xmlName.equals(output.getElement());
- generateParameter(buf, containingElement, xmlType, xsmodel, xt, false, true,
holder);
- buf.append(" ").append(getMethodParam(containingElement));
- }
-
- }
-
- private boolean unwrapElementParameters(StringBuilder buf, String containingElement,
XSTypeDefinition xt) throws IOException
- {
- // If at any point parameter unwrapping can not happen return false so we drop back
to not unwrapping.
-
- if (xt instanceof XSComplexTypeDefinition == false)
- return false;
-
- StringBuilder tempBuf = new StringBuilder();
- XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt;
-
- boolean hasAttributes = wrapper.getAttributeUses().getLength() > 0;
- if (hasAttributes)
- throw new WSException(BundleUtils.getMessage(bundle,
"COMPLEX_TYPE_CONTAINS_ATTRIBUTES"));
-
- boolean unwrappedElement = false;
-
- XSParticle particle = wrapper.getParticle();
- if (particle == null)
- {
- unwrappedElement = true;
- }
- else
- {
- XSTerm term = particle.getTerm();
- if (term instanceof XSModelGroup)
- {
- unwrappedElement = unwrapGroup(tempBuf, containingElement,
(XSModelGroup)term);
- }
- }
-
- if (unwrappedElement)
- {
- buf.append(tempBuf);
- // We need a wrapper class generated
- generateJavaSource(wrapper, WSDLUtils.getSchemaModel(wsdl.getWsdlTypes()),
containingElement);
-
- return true;
- }
-
- return false;
- }
-
- public boolean unwrapGroup(StringBuilder buf, String containingElement, XSModelGroup
group) throws IOException
- {
- if (group.getCompositor() != XSModelGroup.COMPOSITOR_SEQUENCE)
- return false;
-
- XSObjectList particles = group.getParticles();
- for (int i = 0; i < particles.getLength(); i++)
- {
- XSParticle particle = (XSParticle)particles.item(i);
- XSTerm term = particle.getTerm();
- if (term instanceof XSModelGroup)
- {
- if (unwrapGroup(buf, containingElement, (XSModelGroup)term) == false)
- return false;
- }
- else if (term instanceof XSElementDeclaration)
- {
- if (buf.length() > 0)
- buf.append(", ");
-
- XSElementDeclaration element = (XSElementDeclaration)term;
- XSTypeDefinition type = element.getTypeDefinition();
- String tempContainingElement = containingElement +
ToolsUtils.firstLetterUpperCase(element.getName());
-
- QName xmlType = null;
- if (type.getAnonymous() == false)
- xmlType = new QName(type.getNamespace(), type.getName());
-
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs()
> 1;
- boolean primitive = !(element.getNillable() || (particle.getMinOccurs() == 0
&& particle.getMaxOccurs() == 1));
- generateParameter(buf, tempContainingElement, xmlType, xsmodel, type, array,
primitive, false);
-
- String paramName;
- if (type.getAnonymous())
- {
- paramName = containingElement;
- }
- else
- {
- paramName = element.getName();
- }
-
- buf.append(" ").append(getMethodParam(paramName));
- }
- }
-
- // If we reach here we must have successfully unwrapped the parameters.
- return true;
- }
-
- private void generateParameter(StringBuilder buf, String containingElement, QName
xmlType, JBossXSModel xsmodel, XSTypeDefinition xt, boolean array,
- boolean primitive, boolean holder) throws IOException
- {
- WrappedArray wrappedArray = new WrappedArray(xt);
- String arraySuffix = (array) ? "[]" : "";
- if (wrappedArray.unwrap())
- {
- xt = wrappedArray.xt;
- xmlType = wrappedArray.xmlType;
- primitive = !wrappedArray.nillable;
- arraySuffix = wrappedArray.suffix;
- }
-
- if (xt instanceof XSSimpleTypeDefinition)
- xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt);
-
- Class cl = null;
-
- if (xmlType != null)
- cl = getJavaType(xmlType, primitive);
-
- if (cl != null)
- {
- if (holder)
- cl = utils.getHolder(cl);
-
- buf.append(JavaUtils.getSourceName(cl) + arraySuffix);
- }
- else
- {
- String className;
- if (xt == null || xt.getAnonymous())
- {
- className = containingElement;
- }
- else
- {
- className = xmlType.getLocalPart();
- }
-
- if (className.charAt(0) == '>')
- className = className.substring(1);
- className = ToolsUtils.convertInvalidCharacters(className);
- className = utils.firstLetterUpperCase(className);
-
- String packageName = getPackageName(xt.getNamespace());
- className = packageName + "." + className + arraySuffix;
- if (holder)
- {
- className = holderWriter.getOrCreateHolder(className,
getLocationForJavaGeneration(packageName));
- }
-
- buf.append(className);
-
- if (xt instanceof XSComplexTypeDefinition)
- generateJavaSource((XSComplexTypeDefinition)xt, xsmodel, containingElement);
- }
- }
-
- private void createSEIFile(WSDLInterface intf, File loc) throws IOException
- {
- String seiName = getServiceEndpointInterfaceName(intf);
-
- StringBuilder buf = new StringBuilder();
- utils.writeJbossHeader(buf);
- buf.append("package " + seiPkgName + ";" + newline);
- buf.append("public interface " + seiName + " extends
java.rmi.Remote" + newline + "{" + newline);
- appendMethods(intf, buf);
- buf.append("}" + newline);
-
- File sei = utils.createPhysicalFile(loc, seiName);
- FileWriter writer = new FileWriter(sei);
- writer.write(buf.toString());
- writer.flush();
- writer.close();
- }
-
- public String getServiceEndpointInterfaceName(WSDLInterface wsdlInterface)
- {
- String seiName = utils.chopPortType(wsdlInterface.getName().getLocalPart());
-
- //Check if the portType name conflicts with a service name
- if (wsdl.getService(seiName) != null)
- seiName += "_PortType";
-
- seiName = JavaUtils.capitalize(seiName);
- seiName = ToolsUtils.convertInvalidCharacters(seiName);
-
- return seiName;
- }
-
- private void createSEI(File loc, WSDLDefinitions wsdl) throws IOException
- {
- WSDLInterface[] intarr = wsdl.getInterfaces();
- if (intarr == null || intarr.length == 0)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"INTERFACES_CANNOT_BE_ZERO"));
- int len = intarr.length;
- for (int i = 0; i < len; i++)
- {
- WSDLInterface intf = intarr[i];
- createSEIFile(intf, loc);
- }
- }
-
- private String getReturnType(QName xmlName, QName xmlType, XSTypeDefinition xt) throws
IOException
- {
- String containingElement = xmlName.getLocalPart();
- String arraySuffix = "";
- boolean primitive = true;
-
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdl.getWsdlTypes());
- xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
-
- ReturnTypeUnwrapper unwrapper = new ReturnTypeUnwrapper(xmlType, xsmodel,
isWrapped());
- if (unwrapper.unwrap())
- {
- // Need to generate wrapper class as well.
- if (xt instanceof XSComplexTypeDefinition)
- generateJavaSource((XSComplexTypeDefinition)xt, xsmodel, containingElement);
-
- if (unwrapper.unwrappedElement != null)
- {
- XSElementDeclaration element = unwrapper.unwrappedElement;
- xt = element.getTypeDefinition();
- primitive = unwrapper.primitive;
-
- if (unwrapper.xmlType != null)
- xmlType = unwrapper.xmlType;
-
- containingElement = containingElement +
ToolsUtils.firstLetterUpperCase(unwrapper.unwrappedElement.getName());
-
- if (unwrapper.array)
- arraySuffix = "[]";
- }
- }
-
- WrappedArray wrappedArray = new WrappedArray(xt);
- if (wrappedArray.unwrap())
- {
- xt = wrappedArray.xt;
- xmlType = wrappedArray.xmlType;
- primitive = !wrappedArray.nillable;
- arraySuffix = wrappedArray.suffix;
- }
-
- if (xt instanceof XSSimpleTypeDefinition)
- xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt);
-
- Class cls = getJavaType(xmlType, primitive);
-
- if (xt instanceof XSComplexTypeDefinition)
- generateJavaSource((XSComplexTypeDefinition)xt, xsmodel, containingElement);
-
- if (cls == null)
- {
- String className;
- if (xt.getAnonymous() == true)
- {
- className = containingElement;
- }
- else
- {
- className = xmlType.getLocalPart();
- }
-
- if (className.charAt(0) == '>')
- className = className.substring(1);
- className = ToolsUtils.convertInvalidCharacters(className);
- className = utils.firstLetterUpperCase(className);
- String packageName = getPackageName(xt.getNamespace());
- return packageName + "." + className + arraySuffix;
- }
-
- if (cls.isArray())
- return JavaUtils.getSourceName(cls);
- return cls.getName() + arraySuffix;
- }
-
- private void checkTypeMapping()
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_SET"));
- }
-
- private Class getJavaType(QName qname, boolean primitive)
- {
- Class cls = typeMapping.getJavaType(qname, primitive);
- /**
- * Special case - when qname=xsd:anyType && cls == Element
- * then cls has to be javax.xml.soap.SOAPElement
- */
- if (qname.getNamespaceURI().equals(Constants.NS_SCHEMA_XSD) &&
"anyType".equals(qname.getLocalPart()) && cls == Element.class)
- cls = SOAPElement.class;
- return cls;
- }
-
- /**
- * Make sure the first character is lower case and if the
- * parameter is a reserved word prefix it with '_'.
- *
- * @param containingElement
- * @return
- */
- private String getMethodParam(String name)
- {
- String paramName = ToolsUtils.firstLetterLowerCase(name);
- if (JavaKeywords.isJavaKeyword(paramName))
- {
- paramName = "_" + paramName;
- }
-
- return paramName;
- }
-
- private File getLocationForJavaGeneration(String packageName)
- {
- return new File(this.directoryToGenerate + "/" +
packageName.replace('.', '/'));
- }
-
- private void generateJavaSource(XSComplexTypeDefinition xt, JBossXSModel xsmodel,
String containingElement) throws IOException
- {
- generateJavaSource(xt, xsmodel, containingElement, false);
- }
-
- private void generateJavaSource(XSComplexTypeDefinition xt, JBossXSModel xsmodel,
String containingElement, boolean exception) throws IOException
- {
- XSDTypeToJava xtj = new XSDTypeToJava(namespacePackageMap,
generateSerializableTypes);
- xtj.setTypeMapping(this.typeMapping);
- String targetNS = wsdl.getTargetNamespace();
- String tgtNS = xt.getNamespace();
- String packName = getPackageName(tgtNS);
- if(!tgtNS.equals(targetNS))
- {
- File dir = utils.createPackage(this.directoryToGenerate, packName);
- }
- xtj.createJavaFile((XSComplexTypeDefinition)xt, containingElement,
this.directoryToGenerate, packName, xsmodel, exception);
- }
-
- public void setParameterStyle(String paramStyle)
- {
- this.parameterStyle = paramStyle;
- }
-
- private String getPackageName(String targetNamespace)
- {
- //Get it from global config
- if (namespacePackageMap != null)
- {
- String pkg = namespacePackageMap.get(targetNamespace);
- if (pkg != null)
- {
- return pkg;
- }
- }
- //return NamespacePackageMapping.getJavaPackageName(targetNamespace);
- //Default behaviour will always generate all classes in the SEI package only
- return seiPkgName;
- }
-}
-
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSTools.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSTools.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSTools.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,168 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ResourceBundle;
-import java.util.StringTokenizer;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.tools.config.ToolsSchemaConfigReader;
-import org.jboss.ws.tools.helpers.ToolsHelper;
-
-/**
- * Main Class for WSTools
- *
- * @author Anil.Saldhana(a)jboss.org
- * @author Thomas.Diesler(a)jboss.org
- * @since 19-Aug-2005
- */
-public class WSTools
-{
- private static final ResourceBundle bundle = BundleUtils.getBundle(WSTools.class);
- private static Logger log = Logger.getLogger(WSTools.class);
-
- /**
- * Entry point for the command line scripts.
- * Just passes the arguments to
- * @see generate(String)
- * @param args
- * @throws IOException
- */
- public static void main(String[] args) throws IOException
- {
- WSTools tools = new WSTools();
- boolean success = false;
- try
- {
- success = tools.generate(args);
- } catch (Throwable e)
- {
- e.printStackTrace( new PrintWriter(System.err) );
- }
-
- if(success)
- System.exit(0);
- else
- System.exit(1);
- }
-
- /**
- * Entry point for the programmatic use
- */
- public boolean generate(String configLocation, String outputDir) throws IOException
- {
- ToolsSchemaConfigReader configReader = new ToolsSchemaConfigReader();
- Configuration config = configReader.readConfig(configLocation);
-
- return process(config, outputDir);
- }
-
- /**
- * Entry point for the programmatic use
- */
- public boolean generate(String[] args) throws IOException
- {
- String configLocation = null;
- String outputDir = null;
- if(args.length==0)
- {
- usage();
- }
-
- for (int i = 0; i < args.length; i++)
- {
- String arg = args[i];
-
- if ("-config".equals(arg))
- {
- configLocation = args[i + 1];
- i++;
- }
-
- else if ("-dest".equals(arg))
- {
- outputDir = args[i + 1];
- i++;
- }
-
- else if ("-classpath".equals(arg) || "-cp".equals(arg))
- {
- StringTokenizer st = new StringTokenizer(args[i + 1], File.pathSeparator);
-
- int tokens = st.countTokens();
- URL[] urls = new URL[tokens];
- for (int j = 0; j < tokens; j++)
- {
- String token = st.nextToken();
- urls[j] = new File(token).toURL();
- }
-
- ClassLoader ctxLoader = SecurityActions.getContextClassLoader();
- URLClassLoader urlLoader = new URLClassLoader(urls, ctxLoader);
- SecurityActions.setContextClassLoader(urlLoader);
- i++;
- }
- else
- {
- usage();
- }
- }
-
- return generate(configLocation, outputDir);
- }
-
- private void usage()
- {
- System.out.println("Usage: wstools (-classpath|-cp) <classpath> -config
<config> [-dest <destination path>]");
- System.exit(1);
- }
-
- private boolean process(Configuration config, String outputDir) throws IOException
- {
- if (config == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"CONFIGURATION_IS_NULL"));
-
- if (outputDir == null)
- outputDir = ".";
-
- ToolsHelper helper = new ToolsHelper();
- if (config.getJavaToWSDLConfig(false) != null)
- {
- helper.handleJavaToWSDLGeneration(config, outputDir);
- }
- else if (config.getWSDLToJavaConfig(false) != null)
- {
- helper.handleWSDLToJavaGeneration(config, outputDir);
- }
- else
- {
- throw new IOException(BundleUtils.getMessage(bundle,
"CONFIGURATION_ERROR"));
- }
- return true;
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSToolsConstants.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSToolsConstants.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WSToolsConstants.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import org.jboss.ws.common.Constants;
-
-
-/**
- * A collection of constants relevant to JBossWS Tools
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author Anil.Saldhana(a)jboss.org
- * @since 01-Aug-2005
- */
-public interface WSToolsConstants extends Constants
-{
- String BASE = "http://www.jboss.org/wstools/";
-
- /** Tools Constants */
- /**
- * Option used to inform the tools subsytems that all the xml types that are
generated
- * should be generated under the xml target namespace, irrespective of the java
packages
- * from where the Java types come
- */
- static final String WSTOOLS_FEATURE_RESTRICT_TO_TARGET_NS = BASE +
"restrict_types_to_TargetNamespace";
-
- /**
- * Should the schema definitions be included in the wsdl file or they should be
generated
- * in different files.
- */
- static final String WSTOOLS_FEATURE_INCLUDE_SCHEMA_IN_WSDL = BASE +
"include_schema_in_WSDL";
-
- /**
- * Flag to tools that the generated Java Artifacts can contain Java Annotations
- */
- static final String WSTOOLS_FEATURE_USE_ANNOTATIONS = BASE +
"Use_Annotations";
-
- /**
- * Constant - Not a feature
- */
- static final String WSTOOLS_CONSTANT_MAPPING_SERVICE_PREFIX = "serviceNS";
-
- /**
- * Constant - Not a feature
- */
- static final String WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS = "wsdlMsgNS";
-
- /**
- * Constant - Not a feature
- */
- static final String WSTOOLS_CONSTANT_MAPPING_IN_OUT_HOLDER_PARAM_MODE =
"INOUT";
-
- /**
- * Constant - Not a feature
- */
- static final String WSTOOLS_CONSTANT_MAPPING_OUT_HOLDER_PARAM_MODE = "OUT";
-
- /**
- * Constant - Not a feature
- */
- static final String WSTOOLS_CONSTANT_MAPPING_IN_PARAM_MODE = "IN";
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WebservicesXMLCreatorImpl.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WebservicesXMLCreatorImpl.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/WebservicesXMLCreatorImpl.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,205 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ResourceBundle;
-
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.DOMUtils;
-import org.jboss.ws.common.DOMWriter;
-import org.jboss.ws.tools.interfaces.WebservicesXMLCreator;
-import org.jboss.wsf.spi.metadata.webservices.PortComponentMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebserviceDescriptionMetaData;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesFactory;
-import org.jboss.wsf.spi.metadata.webservices.WebservicesMetaData;
-import org.w3c.dom.Element;
-
-/**
- * Creates the webservices.xml deployment descriptor
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Jun 20, 2005
- */
-public class WebservicesXMLCreatorImpl implements WebservicesXMLCreator
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(WebservicesXMLCreatorImpl.class);
- // provide logging
- protected static final Logger log =
Logger.getLogger(WebservicesXMLCreatorImpl.class);
- protected String targetNamespace = null;
-
- protected String seiName = null;
-
- protected String portName = null;
-
- protected String serviceName = null;
-
- protected String servletLink = null;
-
- protected String ejbLink = null;
-
- protected String wsdlFile = null;
- protected String mappingFile = null;
-
- protected boolean append = false;
-
- public WebservicesXMLCreatorImpl()
- {
- }
-
- public void setTargetNamespace(String targetNamespace)
- {
- this.targetNamespace = targetNamespace;
- }
-
- public void setSeiName(String seiName)
- {
- this.seiName = seiName;
- }
-
- public void setPortName(String portName)
- {
- this.portName = portName;
- }
-
- public void setServiceName(String serviceName)
- {
- this.serviceName = serviceName;
- }
-
- public void setEjbLink(String ejbLink)
- {
- this.ejbLink = ejbLink;
- }
-
- public void setServletLink(String servletLink)
- {
- this.servletLink = servletLink;
- }
-
- public void setMappingFile(String mappingFile)
- {
- this.mappingFile = mappingFile;
- }
-
- public void setWsdlFile(String wsdlFile)
- {
- this.wsdlFile = wsdlFile;
- }
-
- public void setAppend(boolean append)
- {
- this.append = append;
- }
-
- public void generateWSXMLDescriptor(File wsXmlFile) throws IOException
- {
- WebservicesMetaData webservices = constructWSMetaData();
-
- // handle append flag
- if (append && wsXmlFile.exists())
- {
- WebservicesMetaData existingWebservices;
-
- // parse existing webservices descriptor
- InputStream wsXmlStream = new FileInputStream(wsXmlFile);
- try
- {
- existingWebservices = WebservicesFactory.parse(wsXmlStream,
wsXmlFile.toURI().toURL());
- }
- catch (Exception e)
- {
- throw new WSException(BundleUtils.getMessage(bundle,
"COULD_NOT_UNMARSHAL_DESCRIPTOR", wsXmlFile), e);
- }
- finally
- {
- wsXmlStream.close();
- }
-
- // append generated webservice-descriptions to existing descriptor
- for (WebserviceDescriptionMetaData webserviceDescription :
webservices.getWebserviceDescriptions())
- existingWebservices.addWebserviceDescription(webserviceDescription);
-
- webservices = existingWebservices;
- }
-
- // (re-)write generated webservices descriptor to file
- Element root = DOMUtils.parse(webservices.serialize());
- FileWriter fwriter = new FileWriter(wsXmlFile);
- new DOMWriter(fwriter).setPrettyprint(true).print(root);
- fwriter.close();
- }
-
- //PRIVATE METHODS
-
- private WebservicesMetaData constructWSMetaData()
- {
- WebservicesMetaData wm = new WebservicesMetaData();
- WebserviceDescriptionMetaData wsdm = new WebserviceDescriptionMetaData(wm);
- populateWebserviceDescriptionMetaData(wsdm);
- wm.addWebserviceDescription(wsdm);
- return wm;
- }
-
- private void populateWebserviceDescriptionMetaData(WebserviceDescriptionMetaData
wsdm)
- {
- checkEssentials();
- wsdm.setWebserviceDescriptionName(this.serviceName);
- wsdm.setWsdlFile(this.wsdlFile);
- wsdm.setJaxrpcMappingFile(this.mappingFile);
- PortComponentMetaData pm1 = new PortComponentMetaData(wsdm);
- pm1.setPortComponentName(portName);
- pm1.setWsdlPort(new QName(this.targetNamespace, portName, "portNS"));
- pm1.setServiceEndpointInterface(seiName);
- if (this.servletLink != null && this.servletLink.length() > 0)
- pm1.setServletLink(this.servletLink);
- else pm1.setEjbLink(this.ejbLink);
- wsdm.addPortComponent(pm1);
- }
-
- private void checkEssentials()
- {
- if (serviceName == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"SERVICENAME_IS_NULL"));
- if (wsdlFile == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"WSDLFILE_IS_NULL"));
- if (mappingFile == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"MAPPINGFILE_IS_NULL"));
- if (targetNamespace == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TARGETNAMESPACE_IS_NULL"));
- if (portName == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"PORTNAME_IS_NULL"));
- if (seiName == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"SEINAME_IS_NULL"));
- if (servletLink == null && ejbLink == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"EITHER_SERVLETLINK_OR_EJBLINK_SHOULD_NOT_BE_NULL"));
- if (servletLink != null && ejbLink != null)
- throw new WSException(BundleUtils.getMessage(bundle,
"ONE_OF_SERVLETLINK_OR_EJBLINK_SHOULD_BE_NULL"));
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XMLNameUtil.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XMLNameUtil.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XMLNameUtil.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import javax.xml.namespace.QName;
-
-/**
- * Translates XML names to Java and back
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 10-Oct-2004
- */
-public class XMLNameUtil
-{
-
- /**
- * Translate a Java name to an XML name.
- * [TODO]
- */
- public static String toXMLName(String javaName)
- {
- return javaName;
- }
-
- /**
- * Translate an XML name to a Java name.
- * [TODO]
- */
- public static String toJavaName(QName xmlName)
- {
- return xmlName.getLocalPart();
- }
-}
Deleted: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XSDToJava.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XSDToJava.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XSDToJava.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,164 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSLoader;
-import org.apache.xerces.xs.XSModel;
-import org.apache.xerces.xs.XSNamedMap;
-import org.apache.xerces.xs.XSObject;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.tools.interfaces.XSDToJavaIntf;
-
-/**
- * Generates Java Types given a schema file
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since May 11, 2005
- */
-
-public class XSDToJava implements XSDToJavaIntf
-{
- /**
- * Singleton class that handle many utility functions
- */
- protected WSDLUtils utils = WSDLUtils.getInstance();
-
- /**
- * Utility class that converts a XSD Type into a Java class
- */
- protected final XSDTypeToJava xsdJava = new XSDTypeToJava(null, false);
-
-
- /*
- * @see org.jboss.ws.tools.interfaces.JavaToXSDIntf#generateSEI(java.lang.String,
java.io.File, java.lang.String, boolean)
- */
- public void generateJavaSource(String schemaFile, File dirloc, String packageName,
- boolean createPackageDir)
- throws IOException
- {
- XSLoader xsloader = SchemaUtils.getInstance().getXSLoader();
- XSModel xsmodel = xsloader.loadURI(schemaFile);
- generateJavaSource(xsmodel, dirloc, packageName, createPackageDir);
- }
-
-
- /*
- * @see
org.jboss.ws.tools.interfaces.JavaToXSDIntf#generateSEI(org.apache.xerces.xs.XSModel,
java.io.File, java.lang.String, boolean)
- */
- public void generateJavaSource(XSModel xsmodel, File dirloc, String packageName,
- boolean createPackageDir)
- throws IOException
- {
- if (createPackageDir)
- {
- utils.createPackage(dirloc.getAbsolutePath(), packageName);
- }
- generateJavaSource(xsmodel, dirloc, packageName);
- }
-
- /*
- * @see
org.jboss.ws.tools.interfaces.JavaToXSDIntf#generateSEI(org.apache.xerces.xs.XSModel,
java.io.File, java.lang.String)
- */
- public void generateJavaSource(XSModel xsmodel, File dirloc, String packageName)
- throws IOException
- {
- //Now that we have the schema, lets build the types for the schema
- XSNamedMap xsnamedmap = xsmodel.getComponents(XSConstants.TYPE_DEFINITION);
- int len = xsnamedmap != null ? xsnamedmap.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- XSObject type = xsnamedmap.item(i);
- if (type instanceof XSComplexTypeDefinition)
- {
- XSComplexTypeDefinition ctype = (XSComplexTypeDefinition)type;
- //Ignore xsd:anyType
- String nsuri = type.getNamespace();
- String tname = type.getName();
- if (Constants.NS_SCHEMA_XSD.equals(nsuri) &&
"anyType".equals(tname)) continue;
- xsdJava.createJavaFile(ctype, dirloc.getPath(), packageName, xsmodel);
- }
- else if (type instanceof XSSimpleTypeDefinition)
- {
- XSSimpleTypeDefinition stype = (XSSimpleTypeDefinition)type;
- //Ignore xsd:anyType
- String nsuri = type.getNamespace();
- String tname = type.getName();
- if (Constants.NS_SCHEMA_XSD.equals(nsuri) &&
"anyType".equals(tname)) continue;
- xsdJava.createJavaFile(stype, dirloc.getPath(), packageName, xsmodel);
- }
- }
-
- //Consider Global Element Declarations that may have anonymous complex types
- xsnamedmap = xsmodel.getComponents(XSConstants.ELEMENT_DECLARATION);
- len = xsnamedmap != null ? xsnamedmap.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- XSElementDeclaration elm = (XSElementDeclaration)xsnamedmap.item(i);
- String elmname = elm.getName();
- XSTypeDefinition elmtype = elm.getTypeDefinition();
- if (elmtype != null && elmtype instanceof XSComplexTypeDefinition)
- {
- XSComplexTypeDefinition ctype = (XSComplexTypeDefinition)elmtype;
- String nsuri = elmtype.getNamespace();
- String tname = elmtype.getName();
- if (tname != null) continue; //Consider only anon complex types
-
- createJavaFile(ctype, dirloc, packageName, xsmodel, elmname);
- }
- }
- }
-
- /**
- * Set the type mapping to be used in the generation
- *
- * @param tm
- */
- public void setTypeMapping(LiteralTypeMapping tm)
- {
- xsdJava.setTypeMapping(tm);
- }
-
- private void createJavaFile(XSComplexTypeDefinition type, File loc,
- String pkgname, XSModel schema, String outerElementName)
- throws IOException
- {
- String str = "Method should be used for anon complex types only";
- if (type.getName() != null)
- throw new IllegalArgumentException(str);
- xsdJava.createJavaFile(type,outerElementName,loc.getPath(),pkgname,schema, false);
- }
-
-}
-
-
-
-
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XSDTypeToJava.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XSDTypeToJava.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/XSDTypeToJava.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,815 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools;
-
-import java.beans.Introspector;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.StringList;
-import org.apache.xerces.xs.XSAttributeDeclaration;
-import org.apache.xerces.xs.XSAttributeUse;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSModel;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTerm;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.apache.xerces.xs.XSWildcard;
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.common.JavaUtils;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-
-/** Class that converts a XSD Type into Java class
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @author mageshbk(a)jboss.com
- * @since Apr 4, 2005
- */
-public class XSDTypeToJava
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(XSDTypeToJava.class);
- protected LiteralTypeMapping typeMapping = null;
- protected WSDLUtils utils = WSDLUtils.getInstance();
- protected SchemaUtils schemautils = SchemaUtils.getInstance();
- protected WSDLUtils wsdlUtils = WSDLUtils.getInstance();
-
- protected JavaWriter jwriter = new JavaWriter();
-
- //Additional variables
- protected String containingElement = "";
- protected String fname = "";
- protected String loc = null;
- protected String pkgname = "";
-
- private Set<String> generatedFiles = new HashSet<String>();
-
- protected Map<String, String> namespacePackageMap = null;
- protected boolean serializableTypes;
-
- /**
- * List that is used for exception inheritance case wherein the variables
- * obtained from the base class go into the generated constructor alone and
- * not as accessors
- */
- private Map<String, List> typeNameToBaseVARList = new HashMap<String,
List>();
-
- public XSDTypeToJava(Map<String, String> map, boolean serializableTypes)
- {
- this.namespacePackageMap = map;
- this.serializableTypes = serializableTypes;
- }
-
- public void createJavaFile(XSComplexTypeDefinition type, String loc, String pkgname,
XSModel schema) throws IOException
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_SET"));
- this.fname = type.getName();
- if (fname == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"FILE_NAME_IS_NULL"));
- this.loc = loc;
- this.pkgname = pkgname;
-
- createJavaFile(type, schema, false);
- }
-
- public void createJavaFile(XSComplexTypeDefinition type, String containingElement,
String loc, String pkgname, XSModel schema, boolean isExceptionType)
- throws IOException
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_SET"));
- this.fname = type.getName();
- this.containingElement = containingElement;
- if (fname == null)
- fname = containingElement;
- this.loc = loc;
- this.pkgname = pkgname;
-
- createJavaFile(type, schema, isExceptionType);
- }
-
- public void createJavaFile(XSSimpleTypeDefinition type, String loc, String pkgname,
XSModel schema) throws IOException
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_SET"));
- this.fname = type.getName();
- this.loc = loc;
- this.pkgname = pkgname;
-
- createJavaFile(type, schema);
- }
-
- public void createJavaFile(XSComplexTypeDefinition type, XSModel schema, boolean
isExceptionType) throws IOException
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_SET"));
- XSTypeDefinition baseType = type.getBaseType();
- // Ensure the characters in the name are valid
- fname = ToolsUtils.convertInvalidCharacters(fname);
- //Ensure that the first character is uppercase
- fname = utils.firstLetterUpperCase(fname);
- List vars = new ArrayList();
-
- String baseName = getBaseTypeName(type);
- if (baseName != null && baseType != null &&
!generatedFiles.contains(baseName))
- {
- if (baseType instanceof XSComplexTypeDefinition)
- {
- generatedFiles.add(baseName);
- String pushName = fname;
- fname = baseName;
- this.createJavaFile((XSComplexTypeDefinition)baseType, schema,
isExceptionType);
- fname = pushName;
- }
- }
-
- vars = this.getVARList(type, schema, isExceptionType);
-
- if (baseName == null && isExceptionType)
- {
- baseName = "Exception";
- }
- else if (baseName != null)
- {
- baseName = getPackageName(baseType.getNamespace()) + "." + baseName;
- }
- String packageName = getPackageName(type.getNamespace());
- jwriter.createJavaFile(getLocationForJavaGeneration(packageName), fname,
packageName, vars, null, baseName, isExceptionType, serializableTypes,
- typeNameToBaseVARList);
- }
-
- public void createJavaFile(XSSimpleTypeDefinition xsSimple, XSModel schema) throws
IOException
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_SET"));
- XSTypeDefinition baseType = xsSimple.getBaseType();
-
- short variety = xsSimple.getVariety();
- if (XSSimpleTypeDefinition.VARIETY_ATOMIC == variety)
- {
- //If the simple type has an enumerated list, then just use its type
- StringList slist = xsSimple.getLexicalEnumeration();
- if (slist != null && slist.getLength() > 0)
- {
- //Enumerated List
- String packageName = getPackageName(xsSimple.getNamespace());
- jwriter.createJavaFileForEnumeratedValues(fname, slist,
getLocationForJavaGeneration(packageName), packageName, xsSimple);
- }
- else
- {
- if (Constants.NS_SCHEMA_XSD.equals(xsSimple.getNamespace()))
- return;
- //TODO: Take care of other cases
- return;
- }
- }
- }
-
- public List<VAR> getVARList(XSComplexTypeDefinition type, XSModel schema,
boolean isExceptionType) throws IOException
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_HAS_NOT_BEEN_SET"));
- XSTypeDefinition baseType = type.getBaseType();
- List vars = new ArrayList();
-
- vars = handleAttributes(type, vars);
- //TODO:Handle xsd:group
-
- short contentType = type.getContentType();
-
- //simplecontenttype
- if (XSComplexTypeDefinition.CONTENTTYPE_SIMPLE == contentType)
- {
- short der = type.getDerivationMethod();
-
- if (XSConstants.DERIVATION_EXTENSION == der)
- {
- XSSimpleTypeDefinition xssimple = type.getSimpleType();
- QName q = new QName(xssimple.getNamespace(), xssimple.getName());
- QName qn = schemautils.patchXSDQName(q);
- Class javaType = typeMapping.getJavaType(qn);
- String jtype = null;
- if (javaType.isArray())
- {
- jtype = JavaUtils.getSourceName(javaType);
- }
- else
- {
- jtype = javaType.getName();
- }
- VAR v = new VAR("_value", jtype, false);
- vars.add(v);
- }
- }
- else if (XSComplexTypeDefinition.CONTENTTYPE_EMPTY == contentType)
- {
- short der = type.getDerivationMethod();
-
- if (XSConstants.DERIVATION_RESTRICTION == der)
- {
- vars.addAll(createVARsforXSParticle(type, schema));
- }
- }
- else if (XSComplexTypeDefinition.CONTENTTYPE_ELEMENT == contentType)
- { //Element Only content type
- if (!utils.isBaseTypeIgnorable(baseType, type))
- {
- short der = type.getDerivationMethod();
-
- if (XSConstants.DERIVATION_NONE == der)
- {
- handleContentTypeElementsWithDerivationNone(type, schema, isExceptionType,
vars, type.getParticle());
- }
- if (XSConstants.DERIVATION_EXTENSION == der)
- {
- handleContentTypeElementsWithDerivationExtension(type, schema,
isExceptionType, vars, type.getParticle());
- }
- else if (XSConstants.DERIVATION_RESTRICTION == der)
- {
- handleContentTypeElementsWithDerivationRestriction(type, schema, vars,
type.getParticle());
- }
- }
- else
- {
- //Base Type is ignorable
- vars.addAll(createVARsforXSParticle(type, schema));
- }
- }
-
- return vars;
-
- }
-
- public void setPackageName(String packageName)
- {
- this.pkgname = packageName;
- }
-
- public void setTypeMapping(LiteralTypeMapping tm)
- {
- this.typeMapping = tm;
- }
-
- public Map<String, String> getNamespacePackageMap()
- {
- return namespacePackageMap;
- }
-
- public void setNamespacePackageMap(Map<String, String> map)
- {
- this.namespacePackageMap = map;
- }
-
- //PRIVATE METHODS
-
- private void
handleContentTypeElementsWithDerivationRestriction(XSComplexTypeDefinition type, XSModel
schema, List vars, XSParticle xsparticle) throws IOException
- {
- if (xsparticle != null)
- {
- XSTerm xsterm = xsparticle.getTerm();
- if (xsterm instanceof XSModelGroup)
- {
- XSModelGroup xsm = (XSModelGroup)xsterm;
- XSObjectList xparts = xsm.getParticles();
- //Ignore the first item - that will be a modelgroup for basetype
- XSParticle xspar = (XSParticle)xparts.item(1);
- XSTerm xterm = xspar.getTerm();
- if (xterm instanceof XSElementDeclaration)
- {
- vars.addAll(createVARforXSElementDeclaration(xterm,
schemautils.isArrayType(xspar), schema, type));
- }
- else if (xterm instanceof XSModelGroup)
- {
- XSModelGroup xsmodelgrp = (XSModelGroup)xterm;
- vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
- }
- }
- }
- }
-
- private void handleContentTypeElementsWithDerivationExtension(XSComplexTypeDefinition
type, XSModel schema, boolean isExceptionType, List vars, XSParticle xsparticle)
- throws IOException
- {
- if (xsparticle != null)
- {
- XSTerm xsterm = xsparticle.getTerm();
- if (xsterm instanceof XSModelGroup)
- {
- XSModelGroup xsm = (XSModelGroup)xsterm;
- XSObjectList xparts = xsm.getParticles();
-
- int length = xparts.getLength();
-
- XSTypeDefinition baseType = type.getBaseType();
-
- if (baseType instanceof XSComplexTypeDefinition &&
((XSComplexTypeDefinition)baseType).getContentType() !=
XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
- {
- XSTerm baseTerm =
((XSComplexTypeDefinition)baseType).getParticle().getTerm();
- if (isExceptionType && baseTerm instanceof XSModelGroup)
- {
- typeNameToBaseVARList.put(type.getName(),
createVARsforXSModelGroup((XSModelGroup)baseTerm, schema, type));
- }
-
- // HACK - The only way to know what elements are local to the subclass,
and not inherited, is to compare to the base class
- // THIS TIES US TO XERCES
- if (baseType instanceof XSComplexTypeDefinition == false ||
((XSComplexTypeDefinition)baseType).getParticle().getTerm() == xsterm)
- return;
- }
-
- XSParticle xspar;
-
- if (baseType instanceof XSComplexTypeDefinition &&
((XSComplexTypeDefinition)baseType).getContentType() ==
XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
- {
- // If the base type is empty there will not have been a particle to
ignore.
- xspar = xsparticle;
- }
- else
- {
- xspar = (XSParticle)xparts.item(length - 1);
- }
-
- XSTerm xsparTerm = xspar.getTerm();
- if (xsparTerm instanceof XSModelGroup)
- {
- XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm();
- vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
- }
- else if (xsparTerm instanceof XSElementDeclaration)
- vars.addAll(createVARforXSElementDeclaration(xsparTerm,
schemautils.isArrayType(xspar), schema, type));
-
- }
- }
- }
-
- private void handleContentTypeElementsWithDerivationNone(XSComplexTypeDefinition type,
XSModel schema, boolean isExceptionType, List vars, XSParticle xsparticle)
- throws IOException
- {
- if (xsparticle != null)
- {
- XSTerm xsterm = xsparticle.getTerm();
- if (xsterm instanceof XSModelGroup)
- {
- XSModelGroup xsm = (XSModelGroup)xsterm;
- XSObjectList xparts = xsm.getParticles();
- int len = xparts != null ? xparts.getLength() : 0;
- int diff = len - 0;
-
- for (int i = 0; i < len; i++)
- {
- if (isExceptionType && type.getBaseType() != null)
- {
- List<VAR> baseList = new ArrayList<VAR>();
-
- //The first few xsterms are modelgroups for base class
- for (int j = 0; j < diff - 1; j++)
- {
- XSParticle xspar = (XSParticle)xparts.item(j);
- XSTerm xsparTerm = xspar.getTerm();
- if (xsparTerm instanceof XSModelGroup)
- {
- XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm();
- baseList.addAll(createVARsforXSModelGroup(xsmodelgrp, schema,
type));
- }
-
- }
- if (baseList.size() > 0)
- this.typeNameToBaseVARList.put(type.getName(), baseList);
- //Now take the modelgroup for the type in question
- XSParticle xspar = (XSParticle)xparts.item(len - 1);
- XSTerm xsparTerm = xspar.getTerm();
- if (xsparTerm instanceof XSModelGroup)
- {
- XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm();
- vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
- }
- break;
- }
- XSParticle xspar = (XSParticle)xparts.item(i);
- XSTerm xsparTerm = xspar.getTerm();
- if (xsparTerm instanceof XSModelGroup)
- {
- XSModelGroup xsmodelgrp = (XSModelGroup)xspar.getTerm();
- vars.addAll(createVARsforXSModelGroup(xsmodelgrp, schema, type));
- }
- else if (xsparTerm instanceof XSElementDeclaration)
- vars.addAll(createVARforXSElementDeclaration(xsparTerm,
schemautils.isArrayType(xspar), schema, type));
- }
- }
- else if (xsterm instanceof XSElementDeclaration)
- {
- vars.addAll(createVARforXSElementDeclaration(xsterm,
schemautils.isArrayType(xsparticle), schema, type));
- }
- else throw new WSException(BundleUtils.getMessage(bundle,
"UNHANDLED_TYPE"));
- }
-
- }
-
- private List handleAttributes(XSComplexTypeDefinition type, List vars)
- {
- XSObjectList xsobjlist = type.getAttributeUses();
- if (xsobjlist != null)
- {
- int len = xsobjlist.getLength();
- for (int i = 0; i < len; i++)
- {
- XSAttributeUse obj = (XSAttributeUse)xsobjlist.item(i);
- XSAttributeDeclaration att = obj.getAttrDeclaration();
- XSSimpleTypeDefinition xstype = att.getTypeDefinition();
- QName qn = SchemaUtils.handleSimpleType(xstype);
- boolean primitive = obj.getRequired();
- VAR v = createVAR(qn, att.getName(), getPackageName(xstype.getNamespace()),
primitive);
- if (vars == null)
- vars = new ArrayList();
- vars.add(v);
- }
- }
- return vars;
- }
-
- private List createVARsforXSParticle(XSComplexTypeDefinition type, XSModel schema)
throws IOException
- {
- List<VAR> list = new ArrayList<VAR>();
- XSParticle xsparticle = type.getParticle();
-
- if (xsparticle != null)
- {
- short xsptype = xsparticle.getType();
- XSTerm xsterm = xsparticle.getTerm();
- if (xsptype == XSConstants.ELEMENT_DECLARATION)
- {
-
- }
- else if (xsterm instanceof XSModelGroup)
- {
- XSModelGroup xsm = (XSModelGroup)xsterm;
- XSObjectList xparts = xsm.getParticles();
- list.addAll(createVARsForElements(xparts, schema, type));
- }
- }
- return list;
- }
-
- private List<VAR> createVARsforXSModelGroup(XSModelGroup xsm, XSModel schema,
XSComplexTypeDefinition origType) throws IOException
- {
- List<VAR> vars = new ArrayList<VAR>();
- short compositor = xsm.getCompositor();
-
- if (XSModelGroup.COMPOSITOR_SEQUENCE == compositor)
- {
- XSObjectList xsobjlist = xsm.getParticles();
- int len = xsobjlist.getLength();
-
- for (int i = 0; i < len; i++)
- {
- XSParticle xsparticle = (XSParticle)xsobjlist.item(i);
- XSTerm term = xsparticle.getTerm();
-
- if (term instanceof XSElementDeclaration)
- {
- vars.addAll(createVARforXSElementDeclaration(term,
schemautils.isArrayType(xsparticle), schema, origType));
- }
- else if (term instanceof XSModelGroup)
- {
- vars.addAll(createVARsforXSModelGroup((XSModelGroup)term, schema,
origType));
- }
- }
- }
-
- return vars;
- }
-
- private VAR createVAR(QName qn, String varstr, String pkgname, boolean primitive)
- {
- String clname = "";
- Class cls = typeMapping.getJavaType(qn);
- VAR v = null;
- if (cls != null)
- {
- clname = cls.getName();
- if (primitive)
- {
- String primName = utils.getPrimitive(clname);
- if (primName != null)
- clname = primName;
- }
-
- }
- else
- {
- if (qn != null)
- {
- if (!Constants.NS_SCHEMA_XSD.equals(qn.getNamespaceURI()))
- clname = pkgname + ".";
- clname += qn.getLocalPart();
- }
- }
- v = new VAR(varstr, clname, false);
- return v;
- }
-
- private List createVARsForElements(XSObjectList xsobjlist, XSModel schema,
XSComplexTypeDefinition origType) throws IOException
- {
- List<VAR> list = new ArrayList<VAR>();
- int len = xsobjlist.getLength();
- for (int i = 0; i < len; i++)
- {
- XSParticle xsparticle = (XSParticle)xsobjlist.item(i);
- XSTerm xsterm = xsparticle.getTerm();
-
- list.addAll(createVARforXSElementDeclaration(xsterm,
schemautils.isArrayType(xsparticle), schema, origType));
- continue;
- }
-
- return list;
- }
-
- private List createVARforXSElementDeclaration(XSTerm xsterm, boolean arrayType,
XSModel schema, XSComplexTypeDefinition origType) throws IOException
- {
- List<VAR> vars = new ArrayList<VAR>();
- // Handle xsd:any elements
- if (xsterm instanceof XSWildcard)
- {
- VAR v = new VAR("_any", "javax.xml.soap.SOAPElement",
arrayType);
- vars.add(v);
- return vars;
- }
-
- // Handle xsd:group
- if (xsterm instanceof XSModelGroup)
- {
- vars.addAll(createVARsforXSModelGroup((XSModelGroup)xsterm, schema, origType));
- return vars;
- }
-
- XSElementDeclaration elem = (XSElementDeclaration)xsterm;
-
- // TODO: Check if the element contains any anon complex type
- // TODO: If yes, create class that is ComplexTypeName+ElementName
- // TODO: ItemsItem If the elem contains anon simpletype
- // TODO: No need to create seperate Java class
-
- String tname = elem.getName();
- XSTypeDefinition xstypedef = elem.getTypeDefinition();
-
- String xstypename = xstypedef.getName();
- // Check if it is a composite type
- if (xstypename != null && xstypedef.getName().equals(origType.getName())
&& xstypedef.getNamespace().equals(origType.getNamespace()))
- {
- // it is a composite type
- QName qn = new QName(origType.getNamespace(), origType.getName());
- VAR vr = createVAR(qn, elem, (XSComplexTypeDefinition)xstypedef, tname,
getPackageName(origType.getNamespace()), arrayType);
- vars.add(vr);
- return vars;
- }
- else
-
- if (xstypename == null && xstypedef instanceof XSComplexTypeDefinition)
- {
- XSComplexTypeDefinition xsc = (XSComplexTypeDefinition)xstypedef;
- String subname = utils.firstLetterUpperCase(tname);
- // Save the fname in a temp var
- String tempfname = this.fname;
- // it will be an anonymous type
- if (containingElement == null || containingElement.length() == 0)
- containingElement = origType.getName();
-
- String anonName;
- if (elem.getScope() == XSConstants.SCOPE_GLOBAL)
- {
- anonName = subname;
- }
- else
- {
- anonName = containingElement + subname;
- }
-
- anonName = utils.firstLetterUpperCase(anonName);
- this.fname = anonName;
-
- if (!generatedFiles.contains(this.fname))
- {
- generatedFiles.add(this.fname);
- this.createJavaFile((XSComplexTypeDefinition)xstypedef, schema, false);
- }
-
- // Restore the fname
- this.fname = tempfname;
- // Bypass rest of processing
- QName anonqn = new QName(anonName);
- VAR vr = createVAR(anonqn, elem, xsc, tname, getPackageName(xsc.getNamespace()),
arrayType);
- vars.add(vr);
- return vars;
- }
- else
- {
- String temp = this.fname;
- // Unwrap any array wrappers
- if (SchemaUtils.isWrapperArrayType(xstypedef))
- {
- XSComplexTypeDefinition complex = (XSComplexTypeDefinition)xstypedef;
- XSModelGroup group = (XSModelGroup)complex.getParticle().getTerm();
- XSElementDeclaration element =
(XSElementDeclaration)((XSParticle)group.getParticles().item(0)).getTerm();
- xstypedef = element.getTypeDefinition();
- xstypename = xstypedef.getName();
- arrayType = true;
- }
-
- QName qn = null;
- if (xstypedef instanceof XSSimpleTypeDefinition)
- {
- qn = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xstypedef);
- }
- else
- {
- qn = new QName(xstypedef.getNamespace(), xstypename);
- }
-
- if (xstypename != null && xstypedef instanceof XSComplexTypeDefinition)
- {
- this.fname =
ToolsUtils.convertInvalidCharacters(utils.firstLetterUpperCase(xstypename));
- if (!generatedFiles.contains(this.fname))
- {
- generatedFiles.add(this.fname);
- this.createJavaFile((XSComplexTypeDefinition)xstypedef, schema, false);
- }
- this.fname = temp;
- }
-
- VAR v = createVAR(qn, elem, xstypedef, tname,
getPackageName(xstypedef.getNamespace()), arrayType);
- vars.add(v);
- }
- return vars;
- }
-
- private VAR createVAR(QName qn, XSElementDeclaration elem, XSTypeDefinition t, String
varstr, String pkgname, boolean arrayType)
- {
- if (t instanceof XSSimpleTypeDefinition)
- {
- QName tempqn = schemautils.handleSimpleType((XSSimpleTypeDefinition)t);
- if (tempqn != null)
- qn = tempqn;
- }
- String qualifiedClassName = "";
- Class cls = typeMapping.getJavaType(qn);
- VAR v = null;
- if (cls != null)
- {
- qualifiedClassName = JavaUtils.getSourceName(cls);
- String primitive = utils.getPrimitive(qualifiedClassName);
- if ((!elem.getNillable()) && primitive != null)
- qualifiedClassName = primitive;
- }
- else
- {
- QName typename = null;
-
- if (t.getName() == null)
- typename = qn;
- else typename = new QName(t.getName());
- if (typename != null)
- {
- String nsuri = typename.getNamespaceURI();
- if (!nsuri.equals(Constants.NS_SCHEMA_XSD))
- qualifiedClassName = pkgname + ".";
- String className =
wsdlUtils.firstLetterUpperCase(ToolsUtils.convertInvalidCharacters(typename.getLocalPart()));
- qualifiedClassName += className;
- }
- else if (qn != null)
- qualifiedClassName = qn.getLocalPart();
- }
-
- v = new VAR(Introspector.decapitalize(varstr), qualifiedClassName, arrayType);
- return v;
- }
-
- private String getBaseTypeName(XSComplexTypeDefinition type)
- {
- String baseName = null;
- XSTypeDefinition baseType = null;
- if (type instanceof XSComplexTypeDefinition)
- {
- XSComplexTypeDefinition t = (XSComplexTypeDefinition)type;
-
- baseType = t.getBaseType();
- //Check baseType is xsd:anyType
- if (baseType != null)
- {
- if (baseType.getNamespace() == Constants.NS_SCHEMA_XSD &&
baseType.getName().equals("anyType"))
- baseType = null; //Ignore this baseType
- }
- if (XSComplexTypeDefinition.CONTENTTYPE_SIMPLE == t.getContentType())
- {
- baseType = null; //ComplexType has a simplecontent
- }
- }
-
- if (baseName == null && baseType != null)
- baseName = ToolsUtils.firstLetterUpperCase(baseType.getName());
-
- return baseName;
- }
-
- /**
- * Inner Class that just stores a custom object called VAR
- * that is used in creating of the Java class
- */
- public static class VAR
- {
- String varname;
- String vartype;
- boolean isArrayType = false;
-
- public VAR(String varname, String vartype, boolean arrayType)
- {
- this.varname = varname;
- this.vartype = vartype;
- isArrayType = arrayType;
- }
-
- public String getVarname()
- {
- return varname;
- }
-
- public void setVarname(String varname)
- {
- this.varname = varname;
- }
-
- public String getVartype()
- {
- return vartype;
- }
-
- public void setVartype(String vartype)
- {
- this.vartype = vartype;
- }
-
- public boolean isArrayType()
- {
- return isArrayType;
- }
-
- public void setArrayType(boolean arrayType)
- {
- isArrayType = arrayType;
- }
- }
-
- private File getLocationForJavaGeneration(String packageName)
- {
- File locdir = new File(this.loc);
- locdir = wsdlUtils.createPackage(locdir.getAbsolutePath(), packageName);
- return locdir;
- }
-
- private String getPackageName(String targetNamespace)
- {
- //Get it from global config
- if (namespacePackageMap != null)
- {
- String pkg = namespacePackageMap.get(targetNamespace);
- if (pkg != null)
- {
- return pkg;
- }
- }
- return this.pkgname;
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,485 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.helpers;
-
-import java.io.IOException;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.encoding.TypeMapping;
-import javax.xml.rpc.holders.Holder;
-
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.soap.Style;
-import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PortMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceInterfaceMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.FaultMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.metadata.umdm.WrappedParameter;
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.XSModelTypes;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSElementDeclaration;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.tools.JavaToXSD;
-import org.jboss.ws.tools.interfaces.JavaToXSDIntf;
-import org.jboss.ws.tools.interfaces.SchemaCreatorIntf;
-import org.jboss.ws.tools.wsdl.WSDLGenerator;
-import org.jboss.ws.common.JavaUtils;
-
-/**
- * Java To WSDL Helper which uses UnifiedMetaData
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Oct 7, 2005
- */
-public class JavaToWSDLHelper extends WSDLGenerator
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(JavaToWSDLHelper.class);
- private JavaToXSDIntf javaToXSD = new JavaToXSD();
- private JavaWsdlMapping javaWsdlMapping = new JavaWsdlMapping();
- private Map<QName, JavaXmlTypeMapping> mappedTypes = new HashMap<QName,
JavaXmlTypeMapping>();
- private Set<String> mappedPackages = new HashSet<String>();
- private Set<String> mappedExceptions = new HashSet<String>();
-
- protected void processTypes()
- {
- // All type processing is done in processService()
- wsdl.setWsdlTypes(new XSModelTypes());
- }
-
- @Override
- protected void processOperation(WSDLInterface wsdlInterface, WSDLBinding wsdlBinding,
OperationMetaData operation)
- {
- super.processOperation(wsdlInterface, wsdlBinding, operation);
-
- try
- {
- //Generate Types for the individual parameters, faults and return value
- for (ParameterMetaData paramMetaData : operation.getParameters())
- {
- generateTypesForXSD(paramMetaData);
- }
-
- for (FaultMetaData faultMetaData : operation.getFaults())
- {
- generateTypesForXSD(faultMetaData);
- }
-
- ParameterMetaData returnMetaData = operation.getReturnParameter();
- if (returnMetaData != null)
- {
- generateTypesForXSD(returnMetaData);
- }
- }
- catch (IOException io)
- {
- throw new WSException(io);
- }
- }
-
- public void generateTypesForXSD(ParameterMetaData pmd) throws IOException
- {
- //Types always deals with TypeNamespace
- QName xmlType = pmd.getXmlType();
- if(xmlType.getNamespaceURI().equals(Constants.NS_SCHEMA_XSD) == false)
- generateType(xmlType, pmd.getJavaType(), buildElementNameMap(pmd));
-
- if (pmd.getOperationMetaData().getStyle() == Style.DOCUMENT || pmd.isInHeader())
- generateElement(pmd.getXmlName(), xmlType);
-
- //Attachment type
- if(pmd.isSwA())
- wsdl.registerNamespaceURI(Constants.NS_SWA_MIME, "mime");
- }
-
- private Map<String, QName> buildElementNameMap(ParameterMetaData pmd)
- {
- List<WrappedParameter> wrappedParameters = pmd.getWrappedParameters();
-
- if (wrappedParameters == null)
- return null;
-
- Map<String, QName> map = new LinkedHashMap<String,
QName>(wrappedParameters.size());
-
- for (WrappedParameter param : wrappedParameters)
- map.put(param.getVariable(), param.getName());
-
- return map;
- }
-
- public void generateTypesForXSD(FaultMetaData fmd) throws IOException
- {
- //Types always deals with TypeNamespace
- SchemaCreatorIntf sc = javaToXSD.getSchemaCreator();
- //Look at the features
- QName xmlType = fmd.getXmlType();
- if(xmlType.getNamespaceURI().equals(Constants.NS_SCHEMA_XSD) == false)
- generateType(xmlType ,fmd.getJavaType(), null);
- }
-
- public void processEndpoint(WSDLService service, EndpointMetaData endpoint)
- {
- super.processEndpoint(service, endpoint);
-
- // build JAX-RPC mapping info
- buildServiceMapping(endpoint);
- }
-
- /*
- * Currently we only handle 1 endpoint on 1 service, this is the way everything
- * else is handled anyway.
- */
- private void buildServiceMapping(EndpointMetaData endpoint)
- {
- QName origQName = endpoint.getServiceMetaData().getServiceName();
- String serviceInterfaceName =
endpoint.getServiceEndpointInterface().getPackage().getName() + "." +
origQName.getLocalPart();
- QName serviceQName = new QName(origQName.getNamespaceURI(),
origQName.getLocalPart(), "serviceNS");
-
- ServiceInterfaceMapping serviceMapping = new
ServiceInterfaceMapping(javaWsdlMapping);
- serviceMapping.setServiceInterface(serviceInterfaceName);
- serviceMapping.setWsdlServiceName(serviceQName);
-
- String endpointName = endpoint.getPortName().getLocalPart();
- PortMapping portMapping = new PortMapping(serviceMapping);
- portMapping.setJavaPortName(endpointName);
- portMapping.setPortName(endpointName);
- serviceMapping.addPortMapping(portMapping);
-
- javaWsdlMapping.addServiceInterfaceMappings(serviceMapping);
-
- String interfaceName = endpoint.getPortTypeName().getLocalPart();
- ServiceEndpointInterfaceMapping seiMapping = new
ServiceEndpointInterfaceMapping(javaWsdlMapping);
-
seiMapping.setServiceEndpointInterface(endpoint.getServiceEndpointInterfaceName());
- seiMapping.setWsdlPortType(new QName(wsdl.getTargetNamespace(), interfaceName,
"portTypeNS"));
- seiMapping.setWsdlBinding(new QName(wsdl.getTargetNamespace(), interfaceName +
"Binding", "bindingNS"));
- for (OperationMetaData operation : endpoint.getOperations())
- {
- ServiceEndpointMethodMapping methodMapping = new
ServiceEndpointMethodMapping(seiMapping);
- methodMapping.setJavaMethodName(operation.getJavaName());
- methodMapping.setWsdlOperation(operation.getQName().getLocalPart());
- boolean isWrapped = operation.isDocumentWrapped();
- methodMapping.setWrappedElement(isWrapped);
- int i = 0;
- for (ParameterMetaData param : operation.getParameters())
- {
- if (isWrapped && param.isInHeader() == false)
- {
- List<WrappedParameter> wrappedParameters =
param.getWrappedParameters();
- for (WrappedParameter wrapped : wrappedParameters)
- {
- String type = JavaUtils.convertJVMNameToSourceName(wrapped.getType(),
endpoint.getClassLoader());
- String name = wrapped.getName().getLocalPart();
-
- buildParamMapping(methodMapping, interfaceName, operation, name, type,
"IN", false, i++);
- }
- }
- else
- {
- String name = param.getXmlName().getLocalPart();
- String type =
JavaUtils.convertJVMNameToSourceName(param.getJavaTypeName(), endpoint.getClassLoader());
- buildParamMapping(methodMapping, interfaceName, operation, name, type,
param.getMode().toString(), param.isInHeader(), i++);
- }
- }
-
- ParameterMetaData returnParam = operation.getReturnParameter();
- if (returnParam != null && ((! isWrapped) || (!
returnParam.getWrappedParameters().isEmpty())))
- {
- String name, type;
- if (isWrapped)
- {
- WrappedParameter wrappedParameter =
returnParam.getWrappedParameters().get(0);
- name = wrappedParameter.getName().getLocalPart();
- type = wrappedParameter.getType();
- }
- else
- {
- name = returnParam.getXmlName().getLocalPart();
- type = returnParam.getJavaTypeName();
- }
-
- type = JavaUtils.convertJVMNameToSourceName(type,
endpoint.getClassLoader());
-
- buildReturnParamMapping(methodMapping, interfaceName, operation, name,
type);
- }
- seiMapping.addServiceEndpointMethodMapping(methodMapping);
-
- for(FaultMetaData fmd : operation.getFaults())
- {
- String ns = getNamespace(fmd.getJavaType(),
fmd.getXmlType().getNamespaceURI());
- QName newXmlType = new QName(ns, fmd.getXmlType().getLocalPart());
- JavaXmlTypeMapping typeMapping = mappedTypes.get(newXmlType);
- if (typeMapping == null)
- continue;
-
- String javaTypeName = fmd.getJavaTypeName();
- if (mappedExceptions.contains(javaTypeName))
- continue;
-
- mappedExceptions.add(javaTypeName);
-
- ExceptionMapping mapping = new ExceptionMapping(javaWsdlMapping);
-
- mapping.setExceptionType(javaTypeName);
- QName name = new QName(wsdl.getTargetNamespace(),
fmd.getXmlName().getLocalPart());
- mapping.setWsdlMessage(name);
-
- // Variable mappings generated from SchemaTypesCreater have their order
preserved
- for (VariableMapping variableMapping : typeMapping.getVariableMappings())
- mapping.addConstructorParameter(variableMapping.getXmlElementName());
-
- javaWsdlMapping.addExceptionMappings(mapping);
- }
- }
-
- javaWsdlMapping.addServiceEndpointInterfaceMappings(seiMapping);
-
- // Add package mapping for SEI
- String name = endpoint.getServiceEndpointInterface().getPackage().getName();
- String namespace = getNamespace(name);
- if (namespace == null)
- namespace = WSDLUtils.getInstance().getTypeNamespace(name);
- addPackageMapping(name, namespace);
- }
-
- private void buildParamMapping(ServiceEndpointMethodMapping methodMapping, String
interfaceName, OperationMetaData operation,
- String name, String type, String mode, boolean header,
int position)
- {
- MethodParamPartsMapping paramMapping = new MethodParamPartsMapping(methodMapping);
- paramMapping.setParamPosition(position);
- paramMapping.setParamType(type);
-
- WsdlMessageMapping messageMapping = new WsdlMessageMapping(paramMapping);
- messageMapping.setWsdlMessagePartName(name);
- String messageName = interfaceName + "_" +
operation.getQName().getLocalPart();
- if ("OUT".equals(mode))
- messageName += "Response";
- QName messageQName = new QName(wsdl.getTargetNamespace(), messageName,
"wsdlMsgNS");
-
- messageMapping.setWsdlMessage(messageQName);
- messageMapping.setParameterMode(mode);
- messageMapping.setSoapHeader(header);
- paramMapping.setWsdlMessageMapping(messageMapping);
- methodMapping.addMethodParamPartsMapping(paramMapping);
- }
-
- private void buildReturnParamMapping(ServiceEndpointMethodMapping methodMapping,
String interfaceName, OperationMetaData operation, String name, String type)
- {
- WsdlReturnValueMapping returnMapping = new WsdlReturnValueMapping(methodMapping);
- returnMapping.setMethodReturnValue(type);
- returnMapping.setWsdlMessagePartName(name);
- String messageName = interfaceName + "_" +
operation.getQName().getLocalPart() + "Response";
- QName messageQName = new QName(wsdl.getTargetNamespace(), messageName,
"wsdlMsgNS");
- returnMapping.setWsdlMessage(messageQName);
- methodMapping.setWsdlReturnValueMapping(returnMapping);
- }
-
- /**
- * During the WSDL generation process, a typeMapping will be
- * created that maps xml types -> java types
- *
- * @return typeMapping
- */
- public TypeMapping getTypeMapping()
- {
- return this.javaToXSD.getSchemaCreator().getTypeMapping();
- }
-
- /**
- * A customized Package->Namespace map
- *
- * @param map
- */
- public void setPackageNamespaceMap(Map<String,String> map)
- {
- this.packageNamespaceMap = map;
- this.javaToXSD.setPackageNamespaceMap(map);
- }
-
- public void setJavaToXSD(JavaToXSDIntf jxsd)
- {
- this.javaToXSD = jxsd;
- }
-
- public JavaWsdlMapping getJavaWsdlMapping()
- {
- return javaWsdlMapping;
- }
-
- //************************************************************************
- //
- //**************************PRIVATE METHODS*****************************
- //
- //************************************************************************
-
- protected void generateType(QName xmlType, Class javaType, Map<String, QName>
elementNames) throws IOException
- {
- if(Holder.class.isAssignableFrom(javaType))
- javaType = WSDLUtils.getInstance().getJavaTypeForHolder(javaType);
- JBossXSModel xsModel = javaToXSD.generateForSingleType(xmlType, javaType,
elementNames);
- String namespace = getNamespace(javaType, xmlType.getNamespaceURI());
- // Now that the schema object graph is built,
- // ask JavaToXSD to provide a list of xsmodels to be plugged
- // into WSDLTypes
- if (xsModel == null)
- throw new WSException(BundleUtils.getMessage(bundle, "IS_NULL",
"xsModel"));
-
- WSDLTypes wsdlTypes = wsdl.getWsdlTypes();
- WSDLUtils.addSchemaModel(wsdlTypes, namespace, xsModel);
- wsdl.registerNamespaceURI(namespace, null);
-
- //Also get any custom namespaces
- SchemaCreatorIntf schemaCreator = javaToXSD.getSchemaCreator();
- mergeJavaWsdlMapping(schemaCreator.getJavaWsdlMapping());
-
- //Register the global config namespaces
- /*Map<String, String> nsmap = schemaCreator.getPackageNamespaceMap();
- Set keys = nsmap != null ? nsmap.keySet() : null;
- Iterator iter = (keys != null && !keys.isEmpty()) ? keys.iterator() :
null;
- while (iter != null && iter.hasNext())
- {
- String pkg = (String)iter.next();
- String ns = nsmap.get(pkg);
- if (ns != null)
- wsdl.registerNamespaceURI(ns, null);
- }*/
- //Register the custom generated namespaces
- Map<String, String> nsmap = schemaCreator.getCustomNamespaceMap();
- Set keys = nsmap != null ? nsmap.keySet() : null;
- Iterator iter = (keys != null && !keys.isEmpty()) ? keys.iterator() :
null;
- while (iter != null && iter.hasNext())
- {
- String prefix = (String)iter.next();
- String ns = nsmap.get(prefix);
- if (ns != null)
- wsdl.registerNamespaceURI(ns, null);
- }
- }
-
- private void mergeJavaWsdlMapping(JavaWsdlMapping source)
- {
- // For now we just merge types and packages
- for (PackageMapping packageMapping : source.getPackageMappings())
- {
- String name = packageMapping.getPackageType();
- String namespaceURI = getNamespace(name, packageMapping.getNamespaceURI());
-
- addPackageMapping(name, namespaceURI);
- }
-
- for (JavaXmlTypeMapping type : source.getJavaXmlTypeMappings())
- {
- QName name = type.getRootTypeQName();
- if (name == null)
- name = type.getAnonymousTypeQName();
-
- //override namespace from globalconfig
- String pkgName = getJustPackageName(type.getJavaType());
- String ns = getNamespace(pkgName, name.getNamespaceURI());
- name = new QName(ns, name.getLocalPart(), name.getPrefix());
-
- if (mappedTypes.containsKey(name))
- continue;
-
- addPackageMapping(pkgName, ns);
- mappedTypes.put(name, type);
-
- JavaXmlTypeMapping typeCopy = new JavaXmlTypeMapping(javaWsdlMapping);
- typeCopy.setQNameScope(type.getQnameScope());
- typeCopy.setAnonymousTypeQName(type.getAnonymousTypeQName());
- typeCopy.setJavaType(type.getJavaType());
- typeCopy.setRootTypeQName(name);
- for (VariableMapping variable : type.getVariableMappings())
- {
- VariableMapping variableCopy = new VariableMapping(typeCopy);
- variableCopy.setDataMember(variable.isDataMember());
- variableCopy.setJavaVariableName(variable.getJavaVariableName());
- variableCopy.setXmlAttributeName(variable.getXmlAttributeName());
- variableCopy.setXmlElementName(variable.getXmlElementName());
- variableCopy.setXmlWildcard(variable.getXmlWildcard());
-
- typeCopy.addVariableMapping(variableCopy);
- }
-
- javaWsdlMapping.addJavaXmlTypeMappings(typeCopy);
- }
- }
-
- private void addPackageMapping(String name, String namespaceURI)
- {
- if (mappedPackages.contains(name))
- return;
-
- mappedPackages.add(name);
- PackageMapping copy = new PackageMapping(javaWsdlMapping);
- copy.setPackageType(name);
-
- copy.setNamespaceURI(namespaceURI);
- javaWsdlMapping.addPackageMapping(copy);
- }
-
- protected void generateElement(QName xmlName, QName xmlType)
- {
- WSDLTypes types = wsdl.getWsdlTypes();
- String namespaceURI = xmlType.getNamespaceURI();
- JBossXSModel schemaModel = WSDLUtils.getSchemaModel(types);
-
- XSTypeDefinition type;
- if (Constants.NS_SCHEMA_XSD.equals(namespaceURI))
- type = SchemaUtils.getInstance().getSchemaBasicType(xmlType.getLocalPart());
- else
- type = schemaModel.getTypeDefinition(xmlType.getLocalPart(), namespaceURI);
-
- WSSchemaUtils utils = WSSchemaUtils.getInstance(schemaModel.getNamespaceRegistry(),
null);
- JBossXSElementDeclaration element =
- utils.createGlobalXSElementDeclaration(xmlName.getLocalPart(), type,
xmlName.getNamespaceURI());
- schemaModel.addXSElementDeclaration(element);
-
- wsdl.registerNamespaceURI(xmlName.getNamespaceURI(), null);
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/MappingFileGeneratorHelper.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,1011 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.helpers;
-
-import java.beans.Introspector;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-
-import org.apache.xerces.xs.XSAttributeDeclaration;
-import org.apache.xerces.xs.XSAttributeUse;
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSSimpleTypeDefinition;
-import org.apache.xerces.xs.XSTerm;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ExceptionMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.MethodParamPartsMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PackageMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.PortMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointInterfaceMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceEndpointMethodMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.ServiceInterfaceMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.VariableMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.WsdlMessageMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.WsdlReturnValueMapping;
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceMessageReference;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLProperty;
-import org.jboss.ws.metadata.wsdl.WSDLRPCPart;
-import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.metadata.wsdl.WSDLTypes;
-import org.jboss.ws.metadata.wsdl.WSDLUtils;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
-import org.jboss.ws.tools.HeaderUtil;
-import org.jboss.ws.tools.NamespacePackageMapping;
-import org.jboss.ws.tools.RPCSignature;
-import org.jboss.ws.tools.ToolsUtils;
-import org.jboss.ws.tools.WSToolsConstants;
-import org.jboss.ws.tools.mapping.MappingFileGenerator;
-import org.jboss.ws.common.JavaUtils;
-import org.w3c.dom.Element;
-
-/**
- * Helper class for MappingFileGenerator (only client of this class)
- * @see MappingFileGenerator
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Sep 18, 2005
- */
-public class MappingFileGeneratorHelper
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(MappingFileGeneratorHelper.class);
- // provide logging
- private static final Logger log = Logger.getLogger(MappingFileGeneratorHelper.class);
- private WSDLDefinitions wsdlDefinitions = null;
- private String typeNamespace;
- private String serviceName = null;
- private String packageName = null;
- private Map<String, String> namespacePackageMap = new HashMap<String,
String>();
- private Set<String> registeredTypes = new HashSet<String>();
- private Set<String> registeredExceptions = new HashSet<String>();
-
- private LiteralTypeMapping typeMapping = null;
- private String wsdlStyle;
-
- private WSDLUtils utils = WSDLUtils.getInstance();
-
- private String parameterStyle;
-
- public MappingFileGeneratorHelper(WSDLDefinitions wsdl, String sname, Map<String,
String> map, Class seiClass, LiteralTypeMapping ltm, String paramStyle)
- {
- this.wsdlDefinitions = wsdl;
- this.serviceName = sname;
- String targetNS = wsdl.getTargetNamespace();
- packageName = NamespacePackageMapping.getJavaPackageName(targetNS);
- this.namespacePackageMap = map;
- this.typeMapping = ltm;
-
- this.wsdlStyle = utils.getWSDLStyle(wsdl);
- this.parameterStyle = paramStyle;
- checkEssentials();
- }
-
- /**
- * Returns the type namespace that was discovered during generation.
- */
- public String getTypeNamespace()
- {
- return typeNamespace;
- }
-
- public PackageMapping constructPackageMapping(JavaWsdlMapping jwm, String packageType,
String ns)
- {
- PackageMapping pk = new PackageMapping(jwm);
- pk.setPackageType(packageType);
- pk.setNamespaceURI(ns);
- return pk;
- }
-
- public ServiceInterfaceMapping constructServiceInterfaceMapping(JavaWsdlMapping jwm,
WSDLService ser)
- {
- serviceName = ser.getName().getLocalPart();
- String javaServiceName = serviceName;
- //Check if the serviceName conflicts with a portType or interface name
- if (wsdlDefinitions.getInterface(new QName(wsdlDefinitions.getTargetNamespace(),
serviceName)) != null)
- javaServiceName += "_Service";
-
- if (this.serviceName == null || serviceName.length() == 0)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"IS_NULL", "serviceName"));
-
- String targetNS = wsdlDefinitions.getTargetNamespace();
- String prefix = WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_SERVICE_PREFIX;
- ServiceInterfaceMapping sim = new ServiceInterfaceMapping(jwm);
- String className = ToolsUtils.firstLetterUpperCase(javaServiceName);
- sim.setServiceInterface(getPackageName(targetNS) + "." + className);
- sim.setWsdlServiceName(new QName(targetNS, serviceName, prefix));
-
- WSDLEndpoint[] endpoints = ser.getEndpoints();
- int lenendpoints = 0;
- if (endpoints != null)
- lenendpoints = endpoints.length;
- for (int j = 0; j < lenendpoints; j++)
- {
- WSDLEndpoint endpt = endpoints[j];
- String portname = endpt.getName().getLocalPart();
- //port mapping
- PortMapping pm = new PortMapping(sim);
- pm.setPortName(portname);
- pm.setJavaPortName(portname);
- sim.addPortMapping(pm);
- }
- return sim;
- }
-
- public void constructServiceEndpointInterfaceMapping(JavaWsdlMapping jwm, WSDLService
ser)
- {
- serviceName = ser.getName().getLocalPart();
- if (this.serviceName == null || serviceName.length() == 0)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"IS_NULL", "serviceName"));
-
- String targetNS = wsdlDefinitions.getTargetNamespace();
-
- WSDLEndpoint[] endpoints = ser.getEndpoints();
- int lenendpoints = 0;
- if (endpoints != null)
- lenendpoints = endpoints.length;
- for (int j = 0; j < lenendpoints; j++)
- {
- WSDLEndpoint endpt = endpoints[j];
- QName binding = endpt.getBinding();
- WSDLBinding wsdlbind = wsdlDefinitions.getBinding(binding);
- String bindName = wsdlbind.getName().getLocalPart();
- QName portTypeName = wsdlbind.getInterfaceName();
- WSDLInterface wsdlintf = wsdlDefinitions.getInterface(portTypeName);
- String portName = wsdlintf.getName().getLocalPart();
- String javaPortName = utils.chopPortType(portName);
- if (wsdlDefinitions.getService(javaPortName) != null)
- javaPortName += "_PortType";
- javaPortName = ToolsUtils.convertInvalidCharacters(javaPortName);
-
- ServiceEndpointInterfaceMapping seim = new
ServiceEndpointInterfaceMapping(jwm);
- String className = ToolsUtils.firstLetterUpperCase(javaPortName);
- seim.setServiceEndpointInterface(getPackageName(targetNS) + "." +
className);
- seim.setWsdlPortType(new QName(targetNS, portName, "portTypeNS"));
- seim.setWsdlBinding(new QName(targetNS, bindName, "bindingNS"));
- constructServiceEndpointMethodMapping(seim, wsdlintf);
-
- jwm.addServiceEndpointInterfaceMappings(seim);
- }
- }
-
- public void constructServiceEndpointMethodMapping(ServiceEndpointInterfaceMapping
seim, WSDLInterface intf)
- {
- WSDLInterfaceOperation[] wioparr = intf.getOperations();
- int len = 0;
- if (wioparr != null)
- len = wioparr.length;
- for (int j = 0; j < len; j++)
- {
- WSDLInterfaceOperation wiop = wioparr[j];
- String opname = wiop.getName().getLocalPart();
- ServiceEndpointMethodMapping semm = new ServiceEndpointMethodMapping(seim);
- semm.setJavaMethodName(ToolsUtils.firstLetterLowerCase(opname));
- semm.setWsdlOperation(opname);
- semm.setWrappedElement(isWrapped());
-
- WSDLBindingOperation bindingOperation =
HeaderUtil.getWSDLBindingOperation(wsdlDefinitions, wiop);
-
- if (isDocStyle())
- {
- constructDOCParameters(semm, wiop, bindingOperation);
- }
- else
- {
- constructRPCParameters(semm, wiop, bindingOperation);
- }
-
- seim.addServiceEndpointMethodMapping(semm);
- }
- }
-
- private void constructDOCParameters(ServiceEndpointMethodMapping semm,
WSDLInterfaceOperation wiop, WSDLBindingOperation bindingOperation)
- {
- WSDLInterfaceOperationInput win = WSDLUtils.getWsdl11Input(wiop);
- WSDLInterfaceOperationOutput output = WSDLUtils.getWsdl11Output(wiop);
-
- JBossXSModel schemaModel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
- MethodParamPartsMapping mpin = null;
-
- boolean holder = false;
-
- if (win != null)
- {
- QName xmlName = win.getElement();
- QName xmlType = win.getXMLType();
- String partName = win.getPartName();
- String wsdlMessageName = win.getMessageName().getLocalPart();
- XSTypeDefinition xt = schemaModel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
-
- boolean wrapped = isWrapped();
-
- if (wrapped)
- {
- wrapped = unwrapRequest(semm, wsdlMessageName, xmlName.getLocalPart(), xt);
- }
-
- if (wrapped == false)
- {
- if (xt instanceof XSSimpleTypeDefinition)
- xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt);
- String paramMode = "IN";
- holder = output != null && xmlName.equals(output.getElement());
- if (holder == true)
- {
- paramMode = "INOUT";
- }
-
- mpin = getMethodParamPartsMapping(semm, xmlName, xmlType, 0, wsdlMessageName,
paramMode, partName, false, true);
- semm.addMethodParamPartsMapping(mpin);
- }
- }
-
- if (holder == false && output != null)
- {
- QName xmlName = output.getElement();
- QName xmlType = output.getXMLType();
- boolean primitive = true;
-
- String targetNS = wsdlDefinitions.getTargetNamespace();
- QName messageName = new QName(targetNS, output.getMessageName().getLocalPart(),
WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS);
-
- String partName = output.getPartName();
- String containingElement = xmlName.getLocalPart();
- boolean array = false;
- XSTypeDefinition xt = schemaModel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
-
- ReturnTypeUnwrapper unwrapper = new ReturnTypeUnwrapper(xmlType, schemaModel,
isWrapped());
- if (unwrapper.unwrap())
- {
- if (unwrapper.unwrappedElement != null)
- {
- XSElementDeclaration element = unwrapper.unwrappedElement;
- xt = element.getTypeDefinition();
- primitive = unwrapper.primitive;
- partName = element.getName();
- containingElement = containingElement +
ToolsUtils.firstLetterUpperCase(unwrapper.unwrappedElement.getName());
- array = unwrapper.array;
- if (xt.getAnonymous())
- {
- xmlType = new QName(containingElement);
- }
- else if (unwrapper.xmlType != null)
- {
- xmlType = unwrapper.xmlType;
- }
- }
- }
-
- //Check it is a holder.
- if (wiop.getInputByPartName(xmlName.getLocalPart()) == null)
- {
- String nameSpace = null;
- if (xt != null)
- {
- nameSpace = xt.getNamespace();
- }
- if (xt instanceof XSSimpleTypeDefinition)
- xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt);
-
- String javaType = getJavaTypeAsString(xmlName, xmlType, nameSpace, array,
primitive);
-
- if ((isDocStyle() == false && "void".equals(javaType)) ==
false)
- {
- WsdlReturnValueMapping wrvm = new WsdlReturnValueMapping(semm);
- wrvm.setMethodReturnValue(javaType);
- wrvm.setWsdlMessage(messageName);
- wrvm.setWsdlMessagePartName(partName);
- semm.setWsdlReturnValueMapping(wrvm);
- }
- }
- }
-
- if (bindingOperation != null)
- {
- constructHeaderParameters(semm, wiop, bindingOperation);
- }
- }
-
- private void constructHeaderParameters(ServiceEndpointMethodMapping semm,
WSDLInterfaceOperation wiop, WSDLBindingOperation bindingOperation)
- {
- WSDLSOAPHeader[] inputHeaders =
HeaderUtil.getSignatureHeaders(bindingOperation.getInputs());
- WSDLSOAPHeader[] outputHeaders =
HeaderUtil.getSignatureHeaders(bindingOperation.getOutputs());
-
- String wsdlMessageName =
bindingOperation.getWsdlBinding().getInterface().getName().getLocalPart();
- int paramPosition = 1;
-
- for (WSDLSOAPHeader currentInput : inputHeaders)
- {
- boolean inOutput = HeaderUtil.containsMatchingPart(outputHeaders,
currentInput);
- String mode = getMode(true, inOutput);
-
- constructHeaderParameter(semm, currentInput, paramPosition++, wsdlMessageName,
mode);
- }
-
- for (WSDLSOAPHeader currentOutput : outputHeaders)
- {
- boolean inInput = HeaderUtil.containsMatchingPart(inputHeaders, currentOutput);
-
- if (inInput == true)
- continue;
-
- constructHeaderParameter(semm, currentOutput, paramPosition++, wsdlMessageName,
"OUT");
- }
- }
-
- private void constructHeaderParameter(ServiceEndpointMethodMapping semm,
WSDLSOAPHeader header, int paramPosition, String wsdlMessageName, String mode)
- {
- QName elementName = header.getElement();
-
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
- XSElementDeclaration xe = xsmodel.getElementDeclaration(elementName.getLocalPart(),
elementName.getNamespaceURI());
- XSTypeDefinition xt = xe.getTypeDefinition();
- WSDLTypes wsdlTypes = wsdlDefinitions.getWsdlTypes();
- QName xmlType = wsdlTypes.getXMLType(header.getElement());
-
- // Replace the xt with the real type from the schema.
- xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(), xmlType.getNamespaceURI());
- if (xt instanceof XSSimpleTypeDefinition)
- xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt);
- String partName = header.getPartName();
-
- MethodParamPartsMapping mpin = getMethodParamPartsMapping(semm, elementName,
xmlType, paramPosition, wsdlMessageName, mode, partName, false, true);
- semm.addMethodParamPartsMapping(mpin);
- }
-
- private String getMode(final boolean input, final boolean output)
- {
- if (input == true & output == true)
- {
- return "INOUT";
- }
- else if (input == true)
- {
- return "IN";
- }
- else if (output == true)
- {
- return "OUT";
- }
-
- return "";
- }
-
- private String getMode(WSDLInterfaceOperation op, String name)
- {
- WSDLInterfaceOperationInput in = WSDLUtils.getWsdl11Input(op);
- WSDLInterfaceOperationOutput out = WSDLUtils.getWsdl11Output(op);
-
- boolean i = false, o = false;
- if (in != null && in.getChildPart(name) != null)
- i = true;
- if (out != null && out.getChildPart(name) != null)
- o = true;
-
- if (i && o)
- return "INOUT";
-
- if (o)
- return "OUT";
-
- return "IN";
- }
-
- private void constructRPCParameters(ServiceEndpointMethodMapping semm,
WSDLInterfaceOperation wiop, WSDLBindingOperation bindingOperation)
- {
- WSDLInterfaceOperationInput win = WSDLUtils.getWsdl11Input(wiop);
- if (win == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"RPC_ENDPOINTS_REQUIRE_INPUT_MESSAGE"));
- String wsdlMessageName = win.getMessageName().getLocalPart();
- JBossXSModel schemaModel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
-
- RPCSignature signature = new RPCSignature(wiop);
- int i = 0;
- for (WSDLRPCPart part : signature.parameters())
- {
- String partName = part.getName();
- QName xmlName = new QName(partName);
- QName xmlType = part.getType();
-
- XSTypeDefinition xt = schemaModel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
- if (xt instanceof XSSimpleTypeDefinition)
- xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt);
-
- MethodParamPartsMapping mpin = getMethodParamPartsMapping(semm, xmlName,
xmlType, i++, wsdlMessageName, getMode(wiop, part.getName()), partName, false, true);
-
- semm.addMethodParamPartsMapping(mpin);
- }
-
- WSDLRPCPart returnParameter = signature.returnParameter();
- if (returnParameter != null)
- {
- String partName = returnParameter.getName();
- QName xmlName = new QName(partName);
- QName xmlType = returnParameter.getType();
-
- XSTypeDefinition xt = schemaModel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
- String nameSpace = null;
- if (xt != null)
- {
- nameSpace = xt.getNamespace();
- }
- if (xt instanceof XSSimpleTypeDefinition)
- {
- xmlType = SchemaUtils.handleSimpleType((XSSimpleTypeDefinition)xt);
- }
-
- WsdlReturnValueMapping wrvm = new WsdlReturnValueMapping(semm);
- wrvm.setMethodReturnValue(getJavaTypeAsString(xmlName, xmlType, nameSpace,
false, true));
- QName messageName = WSDLUtils.getWsdl11Output(wiop).getMessageName();
-
- wrvm.setWsdlMessage(new QName(messageName.getNamespaceURI(),
messageName.getLocalPart(), WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS));
- wrvm.setWsdlMessagePartName(partName);
- semm.setWsdlReturnValueMapping(wrvm);
- }
-
- if (bindingOperation != null)
- {
- constructHeaderParameters(semm, wiop, bindingOperation);
- }
- }
-
- public void constructJavaXmlTypeMapping(JavaWsdlMapping jwm)
- {
- WSDLInterface[] intfArr = wsdlDefinitions.getInterfaces();
- int len = intfArr != null ? intfArr.length : 0;
- for (int i = 0; i < len; i++)
- {
- WSDLInterface wi = intfArr[i];
- WSDLInterfaceOperation[] ops = wi.getOperations();
- int lenOps = ops.length;
- for (int j = 0; j < lenOps; j++)
- {
- WSDLInterfaceOperation op = ops[j];
- for (WSDLInterfaceOperationInput input : op.getInputs())
- {
- if (isDocStyle())
- {
- XSTypeDefinition xt = getXSType(input);
- // Don't unwrap the actual parameter.
- addJavaXMLTypeMap(xt, input.getElement().getLocalPart(), "",
"", jwm, false);
- }
- else
- {
- for (WSDLRPCPart part : input.getChildParts())
- addJavaXMLTypeMap(getXSType(part.getType()),
input.getElement().getLocalPart(), "", "", jwm, true);
- }
- }
-
- for (WSDLInterfaceOperationOutput output : op.getOutputs())
- {
- if (isDocStyle())
- {
- XSTypeDefinition xt = getXSType(output);
- // Don't unwrap the response type.
- addJavaXMLTypeMap(xt, output.getElement().getLocalPart(), "",
"", jwm, false);
- }
- else
- {
- for (WSDLRPCPart part : output.getChildParts())
- addJavaXMLTypeMap(getXSType(part.getType()),
output.getElement().getLocalPart(), "", "", jwm, true);
- }
- }
-
- for (WSDLInterfaceFault fault : wi.getFaults())
- {
- QName xmlType = fault.getXmlType();
- QName xmlName = fault.getElement();
-
- WSDLTypes types = wsdlDefinitions.getWsdlTypes();
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
- XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
- addJavaXMLTypeMap(xt, xmlName.getLocalPart(), "", "",
jwm, true);
-
- String exceptionType = getJavaTypeAsString(null, xmlType,
xt.getNamespace(), false, true);
-
- if (registeredExceptions.contains(exceptionType) == false)
- {
- registeredExceptions.add(exceptionType);
- ExceptionMapping exceptionMapping = new ExceptionMapping(jwm);
- exceptionMapping.setExceptionType(exceptionType);
- exceptionMapping.setWsdlMessage(fault.getName());
- jwm.addExceptionMappings(exceptionMapping);
- }
- }
-
- WSDLBindingOperation bindingOperation =
HeaderUtil.getWSDLBindingOperation(wsdlDefinitions, op);
- if (bindingOperation != null)
- {
- constructHeaderJavaXmlTypeMapping(jwm,
HeaderUtil.getSignatureHeaders(bindingOperation.getInputs()));
- constructHeaderJavaXmlTypeMapping(jwm,
HeaderUtil.getSignatureHeaders(bindingOperation.getOutputs()));
- }
-
- }//end for
- }
- }
-
- public void constructHeaderJavaXmlTypeMapping(JavaWsdlMapping jwm, WSDLSOAPHeader[]
headers)
- {
- for (WSDLSOAPHeader current : headers)
- {
- QName elementName = current.getElement();
-
- JBossXSModel xsmodel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
- XSElementDeclaration xe =
xsmodel.getElementDeclaration(elementName.getLocalPart(), elementName.getNamespaceURI());
- XSTypeDefinition xt = xe.getTypeDefinition();
-
- addJavaXMLTypeMap(xt, elementName.getLocalPart(), "", "",
jwm, true);
- }
- }
-
- private boolean unwrapRequest(ServiceEndpointMethodMapping methodMapping, String
messageName, String containingElement, XSTypeDefinition xt)
- {
- if (xt instanceof XSComplexTypeDefinition == false)
- throw new WSException(BundleUtils.getMessage(bundle,
"TRIED_TO_UNWRAP"));
-
- List<MethodParamPartsMapping> partsMappings = new
ArrayList<MethodParamPartsMapping>();
-
- XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt;
-
- if (wrapper.getAttributeUses().getLength() > 0)
- return false;
-
- boolean unwrappedElement = false;
-
- XSParticle particle = wrapper.getParticle();
- if (particle == null)
- {
- return true;
- }
- else
- {
- XSTerm term = particle.getTerm();
- if (term instanceof XSModelGroup)
- {
- unwrappedElement = unwrapGroup(partsMappings, methodMapping, messageName,
containingElement, (XSModelGroup)term);
- }
- }
-
- if (unwrappedElement)
- {
- addMethodParamPartsMappings(partsMappings, methodMapping);
-
- return true;
- }
-
- return false;
- }
-
- private void addMethodParamPartsMappings(List<MethodParamPartsMapping>
partsMappings, ServiceEndpointMethodMapping methodMapping)
- {
- for (MethodParamPartsMapping current : partsMappings)
- {
- methodMapping.addMethodParamPartsMapping(current);
- }
- }
-
- private boolean unwrapGroup(List<MethodParamPartsMapping> partsMappings,
ServiceEndpointMethodMapping methodMapping, String messageName, String containingElement,
- XSModelGroup group)
- {
- if (group.getCompositor() != XSModelGroup.COMPOSITOR_SEQUENCE)
- return false;
-
- XSObjectList particles = group.getParticles();
- for (int i = 0; i < particles.getLength(); i++)
- {
- XSParticle particle = (XSParticle)particles.item(i);
- XSTerm term = particle.getTerm();
- if (term instanceof XSModelGroup)
- {
- if (unwrapGroup(partsMappings, methodMapping, messageName, containingElement,
(XSModelGroup)term) == false)
- return false;
- }
- else if (term instanceof XSElementDeclaration)
- {
- XSElementDeclaration element = (XSElementDeclaration)term;
- XSTypeDefinition type = element.getTypeDefinition();
-
- QName xmlName = new QName(element.getNamespace(), element.getName());
- QName xmlType;
- if (type.getAnonymous())
- {
- String tempName = ToolsUtils.firstLetterUpperCase(containingElement) +
ToolsUtils.firstLetterUpperCase(element.getName());
- xmlType = new QName(type.getNamespace(), tempName);
- }
- else
- {
- xmlType = new QName(type.getNamespace(), type.getName());
- }
-
- boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs()
> 1;
- boolean primitive = !(element.getNillable() || (particle.getMinOccurs() == 0
&& particle.getMaxOccurs() == 1));
-
- MethodParamPartsMapping part = getMethodParamPartsMapping(methodMapping,
xmlName, xmlType, partsMappings.size(), messageName, "IN",
xmlName.getLocalPart(),
- array, primitive);
- partsMappings.add(part);
- }
- }
-
- // If we reach here we must have successfully unwrapped the parameters.
- return true;
- }
-
- private void checkEssentials()
- {
- if (typeMapping == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"TYPEMAPPING_IS_NULL"));
- }
-
- private XSTypeDefinition getXSType(WSDLInterfaceMessageReference part)
- {
- //Check if there are any custom properties
- WSDLInterfaceOperation op = part.getWsdlOperation();
- String zeroarg1 = null;
- String zeroarg2 = null;
- WSDLProperty prop1 = op.getProperty(Constants.WSDL_PROPERTY_ZERO_ARGS);
- if (prop1 != null)
- zeroarg1 = prop1.getValue();
- if (zeroarg1 != null && zeroarg2 != null &&
zeroarg1.equals(zeroarg2) == false)
- return null;
- if (zeroarg1 != null && "true".equals(zeroarg1))
- return null;
-
- QName xmlType = part.getXMLType();
-
- WSDLTypes types = wsdlDefinitions.getWsdlTypes();
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
- return xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
- }
-
- private XSTypeDefinition getXSType(QName xmlType)
- {
- WSDLTypes types = wsdlDefinitions.getWsdlTypes();
- JBossXSModel xsmodel = WSDLUtils.getSchemaModel(types);
- return xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
- }
-
- private void addJavaXMLTypeMap(XSTypeDefinition xt, String name, String
containingElement, String containingType, JavaWsdlMapping jwm, boolean skipWrapperArray)
- {
- JavaXmlTypeMapping jxtm = null;
-
- if (xt instanceof XSComplexTypeDefinition)
- {
- XSModelGroup xm = null;
- XSComplexTypeDefinition xc = (XSComplexTypeDefinition)xt;
- XSTypeDefinition baseType = xc.getBaseType();
- short der = xc.getDerivationMethod();
- String typeQName = "";
-
- if ((baseType != null) && !utils.isBaseTypeIgnorable(baseType, xc))
- {
- addJavaXMLTypeMap(baseType, baseType.getName(), "", "",
jwm, skipWrapperArray); //Recurse for base types
- }
-
- // handleContentTypeElementsWithDerivationNone
- if (xc.getContentType() != XSComplexTypeDefinition.CONTENTTYPE_EMPTY)
- {
- XSParticle xp = xc.getParticle();
- if (xp != null)
- {
- XSTerm xterm = xp.getTerm();
- if (xterm instanceof XSModelGroup)
- xm = (XSModelGroup)xterm;
- }
- }
-
- if ((skipWrapperArray && SchemaUtils.isWrapperArrayType(xt)) == false)
- {
- jxtm = new JavaXmlTypeMapping(jwm);
- String javaType;
- String localName = xt.getName();
-
- // Anonymous
- if (localName == null)
- {
- String tempName = containingElement +
ToolsUtils.firstLetterUpperCase(name);
- javaType = getJavaTypeAsString(null, new QName(tempName),
xt.getNamespace(), false, true);
- StringBuilder temp = new StringBuilder();
- if (containingType != null && containingType.length() > 0)
- temp.append(containingType);
- temp.append(">").append(name);
- localName = temp.toString();
- jxtm.setAnonymousTypeQName(new QName(xt.getNamespace(), localName,
"typeNS"));
- typeQName = localName;
- }
- else
- {
- javaType = getJavaTypeAsString(null, new QName(localName),
xt.getNamespace(), false, true);
- jxtm.setRootTypeQName(new QName(xt.getNamespace(), xt.getName(),
"typeNS"));
- typeQName = xc.getName();
- }
-
- if (typeNamespace == null)
- {
- typeNamespace = xt.getNamespace();
- }
-
- if (registeredTypes.contains(javaType))
- return;
-
- jxtm.setJavaType(javaType);
- jxtm.setQNameScope("complexType");
-
- registeredTypes.add(javaType);
- jwm.addJavaXmlTypeMappings(jxtm);
- // addJavaXMLTypeMapping(jwm, jxtm
-
- if (xm != null)
- {
- addVariableMappingMap(xm, jxtm, javaType);
- }
-
- // Add simple content if it exists
- XSSimpleTypeDefinition simple = xc.getSimpleType();
- if (simple != null)
- {
- addJavaXMLTypeMap(simple, xc.getName(), "", "", jwm,
skipWrapperArray);
- }
-
- // Add attributes
- XSObjectList attributeUses =
((XSComplexTypeDefinition)xc).getAttributeUses();
- if (attributeUses != null)
- addAttributeMappings(attributeUses, jxtm);
- }
-
- if (xm != null)
- {
- String container = containingElement;
- if (container == null || container.length() == 0)
- {
- container = name;
- }
-
- addGroup(xm, container, typeQName, jwm);
- }
- }
-
- // Add enum simpleType support
- }
-
- private void addVariableMappingMap(XSModelGroup xm, JavaXmlTypeMapping jxtm, String
javaType)
- {
- XSObjectList xo = xm.getParticles();
- int len = xo != null ? xo.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm();
- if (xsterm instanceof XSModelGroup)
- {
- addVariableMappingMap((XSModelGroup)xsterm, jxtm, javaType);
- }
- else if (xsterm instanceof XSElementDeclaration)
- {
- XSElementDeclaration xe = (XSElementDeclaration)xsterm;
- VariableMapping vm = new VariableMapping(jxtm);
- String name = xe.getName();
-
- // JBWS-1170 Convert characters which are illegal in Java identifiers
-
vm.setJavaVariableName(ToolsUtils.convertInvalidCharacters(Introspector.decapitalize(name)));
- vm.setXmlElementName(name);
- jxtm.addVariableMapping(vm);
- }
- }
- }
-
- private void addAttributeMappings(XSObjectList attributes, JavaXmlTypeMapping jxtm)
- {
- for (int i = 0; i < attributes.getLength(); i++)
- {
- XSAttributeUse obj = (XSAttributeUse)attributes.item(i);
- XSAttributeDeclaration att = obj.getAttrDeclaration();
- XSSimpleTypeDefinition simple = att.getTypeDefinition();
- addJavaXMLTypeMap(simple, "none", "", "",
jxtm.getJavaWsdlMapping(), true);
- VariableMapping vm = new VariableMapping(jxtm);
- String name = att.getName();
- vm.setXmlAttributeName(name);
- // JBWS-1170 Convert characters which are illegal in Java identifiers
-
vm.setJavaVariableName(ToolsUtils.convertInvalidCharacters(Introspector.decapitalize(name)));
- jxtm.addVariableMapping(vm);
- }
- }
-
- private void addGroup(XSModelGroup xm, String containingElement, String
containingType, JavaWsdlMapping jwm)
- {
- XSObjectList xo = xm.getParticles();
- int len = xo != null ? xo.getLength() : 0;
- for (int i = 0; i < len; i++)
- {
- XSTerm xsterm = ((XSParticle)xo.item(i)).getTerm();
- if (xsterm instanceof XSModelGroup)
- {
- addGroup((XSModelGroup)xsterm, containingElement, containingType, jwm);
- }
- else if (xsterm instanceof XSElementDeclaration)
- {
- XSElementDeclaration xe = (XSElementDeclaration)xsterm;
- XSTypeDefinition typeDefinition = xe.getTypeDefinition();
- String tempContainingElement = "";
- String tempContainingType = "";
- if (xe.getScope() != XSConstants.SCOPE_GLOBAL)
- {
- tempContainingElement = containingElement;
- tempContainingType = containingType;
- }
-
- addJavaXMLTypeMap(typeDefinition, xe.getName(), tempContainingElement,
tempContainingType, jwm, !isWrapped());
- }
- }
- }
-
- private String getJavaTypeAsString(QName xmlName, QName xmlType, String targetNS,
boolean array, boolean primitive)
- {
- String jtype = null;
-
- String arraySuffix = (array) ? "[]" : "";
- if (!isDocStyle())
- {
- JBossXSModel xsmodel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
- XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
-
- XSElementDeclaration unwrapped = SchemaUtils.unwrapArrayType(xt);
- StringBuilder builder = new StringBuilder();
-
- while (unwrapped != null)
- {
- xt = unwrapped.getTypeDefinition();
- primitive = !unwrapped.getNillable();
- builder.append("[]");
- unwrapped = SchemaUtils.unwrapArrayType(xt);
- }
- if (builder.length() > 0)
- {
- xmlType = new QName(xt.getNamespace(), xt.getName());
- arraySuffix = builder.toString();
- }
- }
-
- //First try to get it from the typeMapping
- Class javaType = typeMapping.getJavaType(xmlType, primitive);
- /**
- * Special case - when qname=xsd:anyType && javaType == Element
- * then cls has to be javax.xml.soap.SOAPElement
- */
- if (xmlType.getNamespaceURI().equals(Constants.NS_SCHEMA_XSD) &&
"anyType".equals(xmlType.getLocalPart()) && javaType == Element.class)
- javaType = SOAPElement.class;
- javaType = this.makeCustomDecisions(javaType, xmlType);
-
- if (javaType == null)
- {
- if (log.isDebugEnabled())
- {
- log.debug("Typemapping lookup failed for " + xmlName);
- log.debug("Falling back to identifier generation");
- }
- String className = xmlType.getLocalPart();
- if (className.charAt(0) == '>')
- className = className.substring(1);
- className = ToolsUtils.convertInvalidCharacters(className);
- jtype = getPackageName(targetNS) + "." +
utils.firstLetterUpperCase(className);
- }
- else
- {
- //Handle arrays
- if (javaType.isArray())
- {
- jtype = JavaUtils.getSourceName(javaType);
- }
- else
- jtype = javaType.getName();
- }
-
- return jtype + arraySuffix;
- }
-
- private boolean isDocStyle()
- {
- return Constants.DOCUMENT_LITERAL.equals(wsdlStyle);
- }
-
- /**
- * Any custom decisions that need to be made will be done here
- *
- * @param javaType
- * @param xmlName
- * @param xmlType
- */
- private Class makeCustomDecisions(Class javaType, QName xmlType)
- {
- if (javaType != null && xmlType != null)
- {
- if (Byte[].class == javaType &&
Constants.NS_SCHEMA_XSD.equals(xmlType.getNamespaceURI()) &&
"base64Binary".equals(xmlType.getLocalPart()))
- javaType = byte[].class;
- }
- return javaType;
- }
-
- private boolean isWrapped()
- {
- return "wrapped".equals(parameterStyle) &&
Constants.DOCUMENT_LITERAL.equals(wsdlStyle);
- }
-
- private MethodParamPartsMapping
getMethodParamPartsMapping(ServiceEndpointMethodMapping semm, QName xmlName, QName
xmlType, int paramPosition,
- String wsdlMessageName, String paramMode, String wsdlMessagePartName, boolean
array, boolean primitive)
- {
- String targetNS = wsdlDefinitions.getTargetNamespace();
- MethodParamPartsMapping mppm = new MethodParamPartsMapping(semm);
- mppm.setParamPosition(paramPosition);
- String javaType = getJavaTypeAsString(xmlName, xmlType, xmlType.getNamespaceURI(),
array, primitive);
- mppm.setParamType(javaType);
-
- //WSDL Message Mapping
- WsdlMessageMapping wmm = new WsdlMessageMapping(mppm);
- wmm.setParameterMode(paramMode);
- String wsdlNS = WSToolsConstants.WSTOOLS_CONSTANT_MAPPING_WSDL_MESSAGE_NS;
- wmm.setWsdlMessage(new QName(targetNS, wsdlMessageName, wsdlNS));
- wmm.setWsdlMessagePartName(wsdlMessagePartName);
- mppm.setWsdlMessageMapping(wmm);
- return mppm;
- }
-
- private String getPackageName(String targetNamespace)
- {
- //Get it from global config
- if (namespacePackageMap != null)
- {
- String pkg = namespacePackageMap.get(targetNamespace);
- if (pkg != null)
- {
- return pkg;
- }
- }
- //Default behaviour will always generate all classes in the SEI package only
- return packageName;
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ReformatXML.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,64 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.helpers;
-
-import java.io.FileInputStream;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-import org.jboss.ws.common.DOMUtils;
-import org.jboss.ws.common.DOMWriter;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Heiko Braun <heiko.braun(a)jboss.com>
- * @since Sep 27, 2006
- */
-public class ReformatXML {
- private static final ResourceBundle bundle =
BundleUtils.getBundle(ReformatXML.class);
-
- public static void main(String[] args) throws Exception
- {
- if(args.length == 0)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"SPECIFY_A_FILENAME"));
-
- ReformatXML formatter = new ReformatXML();
- try
- {
- FileInputStream in = new FileInputStream(args[0]);
- System.out.println( formatter.reformat(in));
- }
- catch (FileNotFoundException e)
- {
- System.err.println("Failed to read from file " + args[0] +":
"+e.getMessage());
- }
- }
-
- public String reformat(InputStream in) throws Exception
- {
- Element root = DOMUtils.parse(in);
- return DOMWriter.printNode(root, true);
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ReturnTypeUnwrapper.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,129 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.helpers;
-
-import javax.xml.namespace.QName;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSTerm;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-
-/**
- * A helper class to unwrap a return type is possible.
- *
- * @author darran.lofthouse(a)jboss.com
- * @since 10 Dec 2006
- */
-public class ReturnTypeUnwrapper
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(ReturnTypeUnwrapper.class);
-
- public JBossXSModel xsmodel;
- public QName xmlType;
- public XSElementDeclaration unwrappedElement;
- public boolean array = false;
- public boolean primitive = false;
- private boolean wrapped;
-
- public ReturnTypeUnwrapper(QName xmlType, JBossXSModel xsmodel, boolean wrapped)
- {
- this.xmlType = xmlType;
- this.xsmodel = xsmodel;
- this.wrapped = wrapped;
- }
-
- public boolean unwrap()
- {
- if (wrapped == false)
- return false;
-
- XSTypeDefinition xt = xsmodel.getTypeDefinition(xmlType.getLocalPart(),
xmlType.getNamespaceURI());
-
- if (xt instanceof XSComplexTypeDefinition == false)
- throw new WSException(BundleUtils.getMessage(bundle,
"UNWRAP_NON_COMPLEX_TYPE"));
-
- XSComplexTypeDefinition wrapper = (XSComplexTypeDefinition)xt;
-
- boolean hasAttributes = wrapper.getAttributeUses().getLength() > 0;
- if (hasAttributes)
- throw new WSException(BundleUtils.getMessage(bundle,
"CAN_NOT_UNWRAP"));
-
- boolean unwrapped = false;
-
- XSParticle particle = wrapper.getParticle();
- if (particle != null)
- {
- XSTerm term = particle.getTerm();
-
- if (term instanceof XSModelGroup == false)
- throw new WSException(BundleUtils.getMessage(bundle,
"EXPECTED_MODEL_GROUP"));
-
- XSModelGroup group = (XSModelGroup)term;
-
- unwrapped = unwrapModelGroup(group);
- }
-
- return unwrapped;
- }
-
- private boolean unwrapModelGroup(XSModelGroup group)
- {
- XSObjectList particles = group.getParticles();
- if (particles.getLength() == 1)
- {
- XSParticle particle = (XSParticle)particles.item(0);
- boolean array = particle.getMaxOccursUnbounded() || particle.getMaxOccurs() >
1;
- XSTerm term = particle.getTerm();
-
- if (term instanceof XSModelGroup)
- {
- return unwrapModelGroup((XSModelGroup)term);
- }
- else if (term instanceof XSElementDeclaration)
- {
- unwrappedElement = (XSElementDeclaration)term;
- XSTypeDefinition type = unwrappedElement.getTypeDefinition();
- if (type.getAnonymous() == false)
- xmlType = new QName(unwrappedElement.getTypeDefinition().getNamespace(),
unwrappedElement.getTypeDefinition().getName());
-
- this.array = array;
- primitive = !(unwrappedElement.getNillable() || (particle.getMinOccurs() == 0
&& particle.getMaxOccurs() == 1));
- }
-
- }
- else
- {
- throw new WSException(BundleUtils.getMessage(bundle,
"UNABLE_TO_UNWRAP_MODEL"));
- }
-
- return unwrappedElement != null;
- }
-
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/SecurityActions.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/SecurityActions.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/SecurityActions.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.helpers;
-
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-/**
- * Security actions for this package
- *
- * @author alessio.soldano(a)jboss.com
- * @since 19-Jun-2009
- *
- */
-class SecurityActions
-{
- /**
- * Get context classloader.
- *
- * @return the current context classloader
- */
- static ClassLoader getContextClassLoader()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return Thread.currentThread().getContextClassLoader();
- }
- else
- {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
- public ClassLoader run()
- {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- }
- }
-
- static URL getResource(final ClassLoader cl, final String filename)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return cl.getResource(filename);
- }
- else
- {
- return AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run()
- {
- return cl.getResource(filename);
- }
- });
- }
- }
-
- /**
- * Load a class using the provided classloader
- *
- * @param name
- * @return
- * @throws PrivilegedActionException
- */
- static Class<?> loadClass(final ClassLoader cl, final String name) throws
PrivilegedActionException, ClassNotFoundException
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm == null)
- {
- return cl.loadClass(name);
- }
- else
- {
- return AccessController.doPrivileged(new
PrivilegedExceptionAction<Class<?>>() {
- public Class<?> run() throws PrivilegedActionException
- {
- try
- {
- return cl.loadClass(name);
- }
- catch (Exception e)
- {
- throw new PrivilegedActionException(e);
- }
- }
- });
- }
- }
-}
\ No newline at end of file
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/helpers/ToolsHelper.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,423 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.helpers;
-
-import java.io.File;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-import java.io.IOException;
-import java.io.Writer;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.namespace.QName;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.core.soap.Style;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaXmlTypeMapping;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.umdm.UnifiedMetaData;
-import org.jboss.ws.metadata.umdm.WrappedParameter;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.tools.Configuration;
-import org.jboss.ws.tools.JavaToWSDL;
-import org.jboss.ws.tools.JavaWriter;
-import org.jboss.ws.tools.NamespacePackageMapping;
-import org.jboss.ws.tools.WSDLToJava;
-import org.jboss.ws.tools.WebservicesXMLCreatorImpl;
-import org.jboss.ws.tools.Configuration.GlobalConfig;
-import org.jboss.ws.tools.Configuration.JavaToWSDLConfig;
-import org.jboss.ws.tools.Configuration.WSDLToJavaConfig;
-import org.jboss.ws.tools.XSDTypeToJava.VAR;
-import org.jboss.ws.tools.client.ServiceCreator;
-import org.jboss.ws.tools.interfaces.WebservicesXMLCreator;
-import org.jboss.ws.tools.mapping.MappingFileGenerator;
-import org.jboss.ws.tools.wsdl.WSDLWriter;
-import org.jboss.ws.common.DOMUtils;
-import org.jboss.ws.common.DOMWriter;
-import org.jboss.ws.common.IOUtils;
-import org.jboss.ws.common.JavaUtils;
-
-/**
- * Helper class used by the cmd line tool "jbossws"
- * and ant task "wstools"
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Aug 19, 2005
- */
-public class ToolsHelper
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(ToolsHelper.class);
- private static Logger log = Logger.getLogger(ToolsHelper.class);
-
- /**
- * Java To WSDL Generation [Serverside Generation]
- *
- * @param config
- * @param outDir
- * @throws IOException
- */
- public void handleJavaToWSDLGeneration(Configuration config, String outDir) throws
IOException
- {
- JavaToWSDLConfig j2wc = config.getJavaToWSDLConfig(false);
- JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
- jwsdl.setServiceName(j2wc.serviceName);
- jwsdl.setTargetNamespace(j2wc.targetNamespace);
- jwsdl.setTypeNamespace(j2wc.typeNamespace);
- jwsdl.setOperationMap(j2wc.operations);
-
- if ("document".equals(j2wc.wsdlStyle))
- jwsdl.setStyle(Style.DOCUMENT);
- else if ("rpc".equals(j2wc.wsdlStyle))
- jwsdl.setStyle(Style.RPC);
- else throw new WSException(BundleUtils.getMessage(bundle,
"UNRECOGNIZED_STYLE", j2wc.wsdlStyle));
-
- if ("wrapped".equals(j2wc.parameterStyle))
- jwsdl.setParameterStyle(ParameterStyle.WRAPPED);
- else if ("bare".equals(j2wc.parameterStyle))
- jwsdl.setParameterStyle(ParameterStyle.BARE);
- else throw new WSException(BundleUtils.getMessage(bundle,
"UNRECOGNIZED_PARAMETER_STYLE", j2wc.parameterStyle));
-
- Class endpointClass = loadClass(j2wc.endpointName);
-
- if (endpointClass == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"ENDPOINT_CANNOT_BE_LOADED", j2wc.endpointName ));
-
- //Take care of passing global config details
- GlobalConfig gcfg = config.getGlobalConfig(false);
- if (gcfg != null)
- {
- if (gcfg.packageNamespaceMap != null)
- jwsdl.setPackageNamespaceMap(gcfg.packageNamespaceMap);
- }
- WSDLDefinitions wsdl = jwsdl.generate(endpointClass);
- //Create the WSDL Directory
- createDir(outDir + "/wsdl");
- String wsdlPath = outDir + "/wsdl/" + j2wc.serviceName +
".wsdl";
- //Generate the WSDL
- Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath),
Constants.DEFAULT_XML_CHARSET);
- new WSDLWriter(wsdl).write(fw, Constants.DEFAULT_XML_CHARSET);
- fw.close();
-
- //Generate the Mapping File
- if (j2wc.mappingFileNeeded)
- {
- UnifiedMetaData unifiedMetaData = jwsdl.getUnifiedMetaData();
- JavaWsdlMapping mapping = jwsdl.getJavaWsdlMapping();
-
- createWrapperTypes(j2wc, outDir, unifiedMetaData, mapping, endpointClass);
- Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" +
j2wc.mappingFileName), Constants.DEFAULT_XML_CHARSET);
- writer.write(Constants.XML_HEADER);
- writer.write(DOMWriter.printNode(DOMUtils.parse(mapping.serialize()), true));
- writer.close();
- }
-
- //Generate the webservices.xml file
- if (j2wc.wsxmlFileNeeded)
- {
- WebservicesXMLCreator wscr = new WebservicesXMLCreatorImpl();
- wscr.setTargetNamespace(j2wc.targetNamespace);
- //wscr.setLocation(new File(outDir).toURL());
- wscr.setSeiName(j2wc.endpointName);
- wscr.setServiceName(j2wc.serviceName);
- //Get the portname from wsdl definitions
- WSDLService wsdlService = wsdl.getService(j2wc.serviceName);
- String portName = wsdlService.getEndpoints()[0].getName().getLocalPart();
- //wscr.setPortName(j2wc.serviceName + "Port");
- wscr.setPortName(portName);
- //wscr.setMappingFileName(j2wc.mappingFileName);
- if (j2wc.servletLink != null)
- {
- wscr.setMappingFile("WEB-INF/" + j2wc.mappingFileName);
- wscr.setWsdlFile("WEB-INF/wsdl/" + j2wc.serviceName +
".wsdl");
- wscr.setServletLink(j2wc.servletLink);
- }
- else
- {
- wscr.setMappingFile("META-INF/" + j2wc.mappingFileName);
- wscr.setWsdlFile("META-INF/wsdl/" + j2wc.serviceName +
".wsdl");
- wscr.setEjbLink(j2wc.ejbLink);
- }
- wscr.setAppend(j2wc.wsxmlFileAppend);
- wscr.generateWSXMLDescriptor(new File(outDir + "/webservices.xml"));
- }
- }
-
- private void createWrapperTypes(JavaToWSDLConfig j2wc, String outDir, UnifiedMetaData
wsMetaData, JavaWsdlMapping mapping, Class endpointClass) throws IOException
- {
- Map<QName, JavaXmlTypeMapping> index = indexMappingTypes(mapping);
-
- EndpointMetaData epMetaData = null;
- for (ServiceMetaData service : wsMetaData.getServices())
- {
- epMetaData = service.getEndpointByServiceEndpointInterface(j2wc.endpointName);
- if (epMetaData != null)
- break;
- }
-
- if (epMetaData == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"COULD_NOT_FIND_ENDPOINT_IN_METADATA", j2wc.endpointName));
-
- String packageName = endpointClass.getPackage().getName();
- ClassLoader classLoader = wsMetaData.getClassLoader();
-
- for (OperationMetaData opMetaData : epMetaData.getOperations())
- {
- if (opMetaData.isDocumentWrapped())
- {
- for (ParameterMetaData parameter : opMetaData.getParameters())
- {
- String name = endpointClass.getSimpleName() + "_" +
opMetaData.getQName().getLocalPart() + "_RequestStruct";
- createWrapperType(parameter, name, packageName, index, classLoader,
outDir);
- }
-
- ParameterMetaData returnParameter = opMetaData.getReturnParameter();
- if (returnParameter != null)
- {
- String name = endpointClass.getSimpleName() + "_" +
opMetaData.getQName().getLocalPart() + "_ResponseStruct";
- createWrapperType(returnParameter, name, packageName, index, classLoader,
outDir);
- }
- }
- }
- }
-
- private void createWrapperType(ParameterMetaData parameter, String name, String
packageName, Map<QName, JavaXmlTypeMapping> mappingIndex, ClassLoader classLoader,
- String outDir) throws IOException
- {
- List<WrappedParameter> wrappedParameters = parameter.getWrappedParameters();
-
- if (wrappedParameters == null)
- return;
-
- List<VAR> vars = new ArrayList<VAR>();
- for (WrappedParameter wrapped : wrappedParameters)
- {
- String typeName = JavaUtils.convertJVMNameToSourceName(wrapped.getType(),
classLoader);
- vars.add(new VAR(wrapped.getVariable(), typeName, false));
- }
-
- JavaWriter writer = new JavaWriter();
- writer.createJavaFile(new File(outDir), name + ".java", packageName,
vars, null, null, false, false, null);
-
- JavaXmlTypeMapping type = mappingIndex.get(parameter.getXmlType());
- if (type == null)
- throw new WSException(BundleUtils.getMessage(bundle,
"MISSING_A_WRAPPER_TYPE", parameter.getXmlType()));
-
- type.setJavaType(packageName + "." + name);
- }
-
- private Map<QName, JavaXmlTypeMapping> indexMappingTypes(JavaWsdlMapping
mapping)
- {
- Map<QName, JavaXmlTypeMapping> index = new HashMap<QName,
JavaXmlTypeMapping>();
- for (JavaXmlTypeMapping type : mapping.getJavaXmlTypeMappings())
- {
- QName qname = type.getRootTypeQName();
- if (qname == null)
- continue;
-
- index.put(qname, type);
- }
-
- return index;
- }
-
- /**
- * Client Side Generation [WSDL To Java]
- *
- * @param config
- * @param outDir
- */
- public void handleWSDLToJavaGeneration(Configuration config, String outDir)
- {
- WSDLToJavaConfig w2jc = config.getWSDLToJavaConfig(false);
- GlobalConfig glc = config.getGlobalConfig(false);
-
- WSDLToJava wsdlToJava = new WSDLToJava();
- wsdlToJava.setTypeMapping(new LiteralTypeMapping());
- wsdlToJava.setGenerateSerializableTypes(w2jc.serializableTypes);
-
- WSDLDefinitions wsdl = null;
- try
- {
- URL wsdlURL = null;
- try
- {
- wsdlURL = new URL(w2jc.wsdlLocation);
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
-
- if (wsdlURL == null)
- {
- File wsdlFile = new File(w2jc.wsdlLocation);
- if (wsdlFile.exists())
- {
- wsdlURL = wsdlFile.toURL();
- }
- }
-
- if (wsdlURL == null)
- {
- ClassLoader ctxLoader = SecurityActions.getContextClassLoader();
- wsdlURL = SecurityActions.getResource(ctxLoader, w2jc.wsdlLocation);
- }
-
- if (wsdlURL == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"CANNOT_LOAD_WSDL", w2jc.wsdlLocation));
-
- wsdl = wsdlToJava.convertWSDL2Java(wsdlURL);
- if (glc != null)
- wsdlToJava.setNamespacePackageMap(glc.packageNamespaceMap);
-
- wsdlToJava.setParameterStyle(w2jc.parameterStyle);
- wsdlToJava.generateSEI(wsdl, new File(outDir));
-
- //Generate the Service File
- this.generateServiceFile(getPackageName(wsdl, glc), wsdl, outDir);
-
- //Generate the Mapping File
- if (w2jc.mappingFileNeeded)
- {
- MappingFileGenerator mgf = new MappingFileGenerator(wsdl, new
LiteralTypeMapping());
- if (glc != null && glc.packageNamespaceMap != null)
- mgf.setNamespacePackageMap(glc.packageNamespaceMap);
- mgf.setServiceName(wsdl.getServices()[0].getName().getLocalPart());
- mgf.setParameterStyle(w2jc.parameterStyle);
-
- JavaWsdlMapping jwm = mgf.generate();
- Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/"
+ w2jc.mappingFileName), Constants.DEFAULT_XML_CHARSET);
- writer.write(Constants.XML_HEADER);
- writer.write(DOMWriter.printNode(DOMUtils.parse(jwm.serialize()), true));
- writer.close();
- }
-
- //Generate the webservices.xml file
- if (w2jc.wsxmlFileNeeded)
- {
- String seiName = "mypackage.MyServiceEndpointInterface";
- String serviceName = "MyServiceName";
-
- if (wsdl.getServices().length == 1)
- serviceName = wsdl.getServices()[0].getName().getLocalPart();
-
- if (wsdl.getInterfaces().length == 1)
- {
- String seiPackage = getPackageName(wsdl, glc);
- seiName = seiPackage + "." +
wsdlToJava.getServiceEndpointInterfaceName(wsdl.getInterfaces()[0]);
- }
-
- WebservicesXMLCreator wscr = new WebservicesXMLCreatorImpl();
- wscr.setTargetNamespace(wsdl.getTargetNamespace());
- wscr.setSeiName(seiName);
- wscr.setServiceName(serviceName);
- WSDLService wsdlService = wsdl.getService(serviceName);
- String portName = wsdlService.getEndpoints()[0].getName().getLocalPart();
- wscr.setPortName(portName);
-
- String wsdlShortName = wsdlURL.getPath();
- wsdlShortName =
wsdlShortName.substring(wsdlShortName.lastIndexOf("/"));
-
- if (w2jc.servletLink != null)
- {
- wscr.setMappingFile("WEB-INF/" + w2jc.mappingFileName);
- wscr.setWsdlFile("WEB-INF/wsdl" + wsdlShortName);
- wscr.setServletLink(w2jc.servletLink);
- }
- else
- {
- wscr.setMappingFile("META-INF/" + w2jc.mappingFileName);
- wscr.setWsdlFile("META-INF/wsdl" + wsdlShortName);
- wscr.setEjbLink(w2jc.ejbLink);
- }
- wscr.generateWSXMLDescriptor(new File(outDir +
"/webservices.xml"));
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new WSException(ex);
- }
- }
-
- //PRIVATE METHODS
- private Class loadClass(String cls)
- {
- Class clazz = null;
- try
- {
- clazz = SecurityActions.loadClass(SecurityActions.getContextClassLoader(),
cls);
- }
- catch (Exception e)
- {
- log.error(BundleUtils.getMessage(bundle, "CANNOT_LOAD_ENDPOINT",
e.getLocalizedMessage()));
- }
- return clazz;
- }
-
- private void generateServiceFile(String packageName, WSDLDefinitions wsdl, String
location) throws IOException
- {
- ServiceCreator sc = new ServiceCreator();
- sc.setPackageName(packageName);
- sc.setDirLocation(new File(location));
- sc.setWsdl(wsdl);
- sc.createServiceDescriptor();
- }
-
- private String getPackageName(WSDLDefinitions wsdl, GlobalConfig glc)
- {
- String targetNamespace = wsdl.getTargetNamespace();
- //Get it from global config if it is overriden
- if (glc != null && glc.packageNamespaceMap != null)
- {
- String pkg = glc.packageNamespaceMap.get(targetNamespace);
- if (pkg != null)
- {
- return pkg;
- }
- }
- return NamespacePackageMapping.getJavaPackageName(targetNamespace);
- }
-
- private void createDir(String path)
- {
- File file = new File(path);
- if (file.exists() == false)
- file.mkdirs();
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/ServiceCreatorIntf.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/ServiceCreatorIntf.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/ServiceCreatorIntf.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.interfaces;
-
-import java.io.IOException;
-
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-
-/**
- * Defines the contract for creation of java.xml.rpc.Service Interface
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Jul 23, 2005
- */
-
-public interface ServiceCreatorIntf
-{
- /**
- * @return Returns the packageName.
- */
- public String getPackageName();
-
- /**
- * @param packageName The packageName to set.
- */
- public void setPackageName(String packageName);
-
- /**
- * @return the WSDL Definitions
- */
- public WSDLDefinitions getWsdl();
-
- /**
- * Set the WSDL Definitions
- *
- * @param wsdl
- */
- public void setWsdl(WSDLDefinitions wsdl);
-
- /**
- * Create the Service Interface for the endpoint
- * @throws IOException
- *
- */
- public void createServiceDescriptor() throws IOException;
-
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/WSDLToJavaIntf.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/WSDLToJavaIntf.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/WSDLToJavaIntf.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.interfaces;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Map;
-
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLException;
-
-/**
- * Defines the contract for WSDL To Java Converters
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Jul 23, 2005
- */
-
-public interface WSDLToJavaIntf
-{
-
- /**
- * Provide a WSDLFile and get back the WSDL20 Object Graph
- * @param wsdlfileurl
- * @return
- * @throws org.jboss.ws.metadata.wsdl.WSDLException
- */
- public WSDLDefinitions convertWSDL2Java(URL wsdlfileurl)
- throws WSDLException;
-
- /**
- * Get the features
- * <br>
- * <br>Features are:
- * <br>USE_ANNOTATIONS : Should the generated Java Types use annotations
- * @throws IllegalStateException feature unrecognized
- */
- public boolean getFeature(String name);
-
- /**
- * Set one or more features of the WSDLToJava tool
- * <br>
- * <br>Features are:
- * <br>USE_ANNOTATIONS : Should the generated Java Types use annotations
- * @param name
- * @param value
- */
- public void setFeature(String name, boolean value);
-
- /**
- * Method for use by the Web Services Layer
- * @param wsdlFile URL to the WSDL file
- * @param dir Directory where the generated files should be stored
- * @param annotate Is JAX-WS 2.0 compliance needed ie. annotations needed?
- * @throws IOException
- */
- public void generateSEI(URL wsdlFile, File dir, boolean annotate)
- throws IOException;
-
- /**
- * Generate the SEI
- * @param wsdl The WSDL20Definitions (root of the object tree)
- * @param dir The directory where the SEI files will be written
- * @throws IOException
- * @throws Exception
- */
- public void generateSEI(WSDLDefinitions wsdl, File dir) throws IOException;
-
- /**
- * Global configuration from user that defines a map of package->Namespace
- *
- * @param map
- */
- public void setNamespacePackageMap(Map<String,String> map);
-
- /**
- * The client can provide a type mapping
- * @param typeMapping
- */
- public void setTypeMapping(LiteralTypeMapping typeMapping);
-
- public void setParameterStyle(String paramStyle);
-
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/WebservicesXMLCreator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/WebservicesXMLCreator.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/WebservicesXMLCreator.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.interfaces;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Defines the contract for webservices.xml creating agents
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Jul 23, 2005
- */
-
-public interface WebservicesXMLCreator
-{
-
- /**
- * Generate the webservices.xml file
- * @throws IOException
- */
- public void generateWSXMLDescriptor(File file) throws IOException;
-
- /**
- * @param targetNamespace The targetNamespace to set.
- */
- public void setTargetNamespace(String targetNamespace);
-
- /**
- * @param seiName The seiName to set.
- */
- public void setSeiName(String seiName);
-
- /**
- * @param portName The portName to set.
- */
- public void setPortName(String portName);
-
- /**
- * @param serviceName The serviceName to set.
- */
- public void setServiceName(String serviceName);
-
- /**
- * @param ejbLink The ejbLink to set.
- */
- public void setEjbLink(String ejbLink);
-
- /**
- * @param servletLink The servletLink to set.
- */
- public void setServletLink(String servletLink);
-
- /**
- * @param mappingFileEntry The mapping file entry
- */
- public void setMappingFile(String mappingFileEntry);
-
- /**
- *
- * @param wsdlFileEntry The wsdl-file entry
- */
- public void setWsdlFile(String wsdlFileEntry);
-
- /**
- *
- * @param append add ws descriptions to existing webservices.xml file, if any
- */
- public void setAppend(boolean append);
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/XSDToJavaIntf.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/XSDToJavaIntf.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/interfaces/XSDToJavaIntf.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.interfaces;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.xerces.xs.XSModel;
-import org.jboss.ws.core.jaxrpc.LiteralTypeMapping;
-
-/**
- * Defines the contract for all Schema Types to Java Types converters
- * @author <mailto:Anil.Saldhana@jboss.org>Anil Saldhana
- * @since Jul 20, 2005
- */
-
-public interface XSDToJavaIntf
-{
- /**
- * Generate the Java Types given the XSD Schema file
- * @param schemaFile String representing FQN of a schema file
- * @param dirloc location to place the generated java source files
- * @param packageName package name for the types
- * @param createPackageDir Should the package structure be created
- * @throws IOException
- */
- public void generateJavaSource(
- String schemaFile,
- File dirloc,
- String packageName,
- boolean createPackageDir) throws IOException;
-
- /**
- * Generate the Java Types given the XSD Schema object graph
- * @param xsmodel xml schema object graph based on Xerces Schema API
- * @param dirloc location to place the generated java source files
- * @param packageName package name for the types
- * @param createPackageDir Should the package structure be created
- * @throws IOException
- */
- public void generateJavaSource(
- XSModel xsmodel,
- File dirloc,
- String packageName,
- boolean createPackageDir) throws IOException;
-
- /**
- * Generate the Java Types given the XSD Schema object graph
- * @param xsmodel xml schema object graph based on Xerces Schema API
- * @param dirloc location to place the generated java source files
- * @param packageName package name for the types
- * @throws IOException
- */
- public void generateJavaSource(XSModel xsmodel, File dirloc, String packageName)
- throws IOException;
-
- /**
- * Set the type mapping to be used in the generation
- *
- * @param tm
- */
- public void setTypeMapping(LiteralTypeMapping tm);
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/JAXBWSDLGenerator.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,152 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.wsdl;
-
-import java.io.IOException;
-import java.util.ResourceBundle;
-
-import javax.xml.bind.SchemaOutputResolver;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Result;
-import javax.xml.transform.dom.DOMResult;
-
-import org.jboss.ws.WSException;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.metadata.wsdl.DOMTypes;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import com.sun.xml.bind.api.JAXBRIContext;
-
-/**
- * JAXBWSDLGenerator provides a JAXB based WSDLGenerator.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- */
-public class JAXBWSDLGenerator extends WSDLGenerator
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(JAXBWSDLGenerator.class);
- private JAXBRIContext ctx;
-
- public JAXBWSDLGenerator(JAXBRIContext ctx)
- {
- super();
- this.ctx = ctx;
- }
-
- /**
- * Delegate schema generation to JAXB RI
- */
- protected void processTypes()
- {
- // Register namespaces
- for (String ns : ctx.getKnownNamespaceURIs())
- if (ns.length() > 0)
- wsdl.registerNamespaceURI(ns, null);
-
- try
- {
- DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document doc = builder.newDocument();
- DOMTypes types = new DOMTypes(doc);
- final Element element = types.getElement();
- final Element throwAway = doc.createElement("throw-away");
-
- ctx.generateSchema(new SchemaOutputResolver() {
- @Override
- public Result createOutput(String namespace, String file) throws IOException
- {
- // JBWS-1295, getKnownNamespaceURIs is not accurate
- if (namespace != null && namespace.length() > 0 &&
wsdl.getPrefix(namespace) == null)
- wsdl.registerNamespaceURI(namespace, null);
-
- // JAXB creates an empty namespace due to type references, ignore it
- DOMResult result = null;
- if (namespace == null || namespace.length() == 0)
- {
- result = new DOMResult(throwAway);
- result.setSystemId("remove-me");
- }
- else
- {
- result = new DOMResult(element);
- result.setSystemId("replace-me");
- }
-
- return result;
- }
- });
-
- // Until we stop inlining schema, we will need to filter schemaLocations since
JAXB requires them
- removeSchemaLocations(element);
-
- wsdl.setWsdlTypes(types);
- }
- catch (Exception exception)
- {
- throw new WSException(BundleUtils.getMessage(bundle,
"COULD_NOT_GENERATE_SCHEMA", exception.getMessage()), exception);
- }
- }
-
- private void removeSchemaLocations(Element element)
- {
- for (Element child = getFirstChildElement(element); child != null; child =
getNextSiblingElement(child))
- {
- if ("import".equals(child.getLocalName()) &&
Constants.NS_SCHEMA_XSD.equals(child.getNamespaceURI())
- &&
"replace-me".equals(child.getAttribute("schemaLocation")))
- {
- child.removeAttribute("schemaLocation");
- }
- else if ("import".equals(child.getLocalName()) &&
Constants.NS_SCHEMA_XSD.equals(child.getNamespaceURI())
- &&
"remove-me".equals(child.getAttribute("schemaLocation")))
- {
- element.removeChild(child);
- }
- else
- {
- removeSchemaLocations(child);
- }
- }
- }
-
- public static Element getFirstChildElement(Node node)
- {
- Node child = node.getFirstChild();
- while (child != null && child.getNodeType() != Node.ELEMENT_NODE)
- child = child.getNextSibling();
-
- return (Element)child;
- }
-
- public static Element getNextSiblingElement(Element element)
- {
- Node sibling = element.getNextSibling();
- while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE)
- sibling = sibling.getNextSibling();
-
- return (Element)sibling;
- }
-
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11DefinitionFactory.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,99 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.wsdl;
-
-import java.net.URL;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.common.utils.JBossWSEntityResolver;
-import org.xml.sax.EntityResolver;
-
-/**
- * A factory that creates a WSDL-1.1 <code>Definition</code> from an URL.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 15-April-2004
- */
-public class WSDL11DefinitionFactory
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(WSDL11DefinitionFactory.class);
- // provide logging
- private static Logger log = Logger.getLogger(WSDL11DefinitionFactory.class);
-
- // This feature is set by default in wsdl4j, it means the object structore contains
the imported arguments
- public static final String FEATURE_IMPORT_DOCUMENTS =
"javax.wsdl.importDocuments";
- // Set this feature for additional debugging output
- public static final String FEATURE_VERBOSE = "javax.wsdl.verbose";
-
- // The WSDLReader that is used by this factory
- private WSDLReader wsdlReader;
-
- // Hide constructor
- private WSDL11DefinitionFactory() throws WSDLException
- {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- wsdlReader = wsdlFactory.newWSDLReader();
- // Allow unknown extensions (jaxws/jaxb binding elements)
- wsdlReader.setExtensionRegistry(new ExtensionRegistry());
- wsdlReader.setFeature(WSDL11DefinitionFactory.FEATURE_VERBOSE, false);
- }
-
- /** Create a new instance of a wsdl factory */
- public static WSDL11DefinitionFactory newInstance() throws WSDLException
- {
- return new WSDL11DefinitionFactory();
- }
-
- /** Set a feature on the underlying reader */
- public void setFeature(String name, boolean value) throws IllegalArgumentException
- {
- wsdlReader.setFeature(name, value);
- }
-
- /**
- * Read the wsdl document from the given URL
- */
- public Definition parse(URL wsdlLocation) throws WSDLException
- {
- if (wsdlLocation == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"URL_CANNOT_BE_NULL"));
-
- log.trace("parse: " + wsdlLocation.toExternalForm());
-
- EntityResolver entityResolver = new JBossWSEntityResolver();
-
- // Set EntityResolver in patched version of wsdl4j-1.5.2jboss
- // [TODO] show the usecase that needs this
- // ((WSDLReaderImpl)wsdlReader).setEntityResolver(entityResolver);
- Definition wsdlDefinition = wsdlReader.readWSDL(new WSDLLocatorImpl(entityResolver,
wsdlLocation));
-
- return wsdlDefinition;
- }
-}
Deleted:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDLGenerator.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,454 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.tools.wsdl;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.ParameterMode;
-import javax.xml.ws.soap.SOAPBinding;
-
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.Constants;
-import org.jboss.ws.core.soap.Style;
-import org.jboss.ws.metadata.umdm.EndpointMetaData;
-import org.jboss.ws.metadata.umdm.FaultMetaData;
-import org.jboss.ws.metadata.umdm.OperationMetaData;
-import org.jboss.ws.metadata.umdm.ParameterMetaData;
-import org.jboss.ws.metadata.umdm.ServiceMetaData;
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLBindingFault;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperationInput;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLImport;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationInput;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutput;
-import org.jboss.ws.metadata.wsdl.WSDLRPCPart;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem;
-import org.jboss.ws.metadata.wsdl.WSDLRPCSignatureItem.Direction;
-import org.jboss.ws.metadata.wsdl.WSDLSOAPHeader;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-
-/**
- * Generates a WSDL object model.
- *
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- */
-public abstract class WSDLGenerator
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(WSDLGenerator.class);
- protected WSDLDefinitions wsdl;
-
- protected boolean extension;
-
- protected abstract void processTypes();
-
- protected Map<String,String> packageNamespaceMap = new
HashMap<String,String>();
-
- protected void processEndpoint(WSDLService service, EndpointMetaData endpoint)
- {
- WSDLEndpoint wsdlEndpoint = new WSDLEndpoint(service, endpoint.getPortName());
- String address = endpoint.getEndpointAddress();
- wsdlEndpoint.setAddress(address == null ? "REPLACE_WITH_ACTUAL_URL" :
address);
- service.addEndpoint(wsdlEndpoint);
-
- QName interfaceQName = endpoint.getPortTypeName();
- WSDLInterface wsdlInterface = new WSDLInterface(wsdl, interfaceQName);
- wsdl.addInterface(wsdlInterface);
-
- // Add imports
- if
(!interfaceQName.getNamespaceURI().equals(endpoint.getServiceMetaData().getServiceName().getNamespaceURI()))
- {
- WSDLImport wsdlImport = new WSDLImport(wsdl);
- wsdlImport.setLocation(interfaceQName.getLocalPart() + "_PortType");
- wsdlImport.setNamespace(interfaceQName.getNamespaceURI());
- wsdl.addImport(wsdlImport);
- wsdl.registerNamespaceURI(interfaceQName.getNamespaceURI(), null);
- }
-
- QName bindingQName = new QName(interfaceQName.getNamespaceURI(),
interfaceQName.getLocalPart() + "Binding");
- WSDLBinding wsdlBinding = new WSDLBinding(wsdl, bindingQName);
- wsdlBinding.setInterfaceName(interfaceQName);
- if (extension)
- endpoint.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
- wsdlBinding.setType(endpoint.getBindingId());
- wsdl.addBinding(wsdlBinding);
- wsdlEndpoint.setBinding(bindingQName);
-
- for (OperationMetaData operation : endpoint.getOperations())
- {
- processOperation(wsdlInterface, wsdlBinding, operation);
- }
- }
-
- protected void processOperation(WSDLInterface wsdlInterface, WSDLBinding wsdlBinding,
OperationMetaData operation)
- {
- WSDLInterfaceOperation interfaceOperation = new
WSDLInterfaceOperation(wsdlInterface, operation.getQName());
- WSDLBindingOperation bindingOperation = new WSDLBindingOperation(wsdlBinding);
-
- interfaceOperation.setPattern(operation.isOneWay() ?
Constants.WSDL20_PATTERN_IN_ONLY
- : Constants.WSDL20_PATTERN_IN_OUT);
-
- bindingOperation.setRef(operation.getQName());
- bindingOperation.setSOAPAction(operation.getSOAPAction());
-
- if (operation.getStyle() == Style.DOCUMENT)
- processOperationDOC(interfaceOperation, bindingOperation, operation);
- else
- processOperationRPC(interfaceOperation, bindingOperation, operation);
-
- for (FaultMetaData fault : operation.getFaults())
- {
- QName faultName = new QName(operation.getQName().getNamespaceURI(),
fault.getXmlName().getLocalPart());
- WSDLInterfaceFault interfaceFault = new WSDLInterfaceFault(wsdlInterface,
faultName);
- interfaceFault.setElement(fault.getXmlName());
- wsdlInterface.addFault(interfaceFault);
-
- WSDLInterfaceOperationOutfault outfault = new
WSDLInterfaceOperationOutfault(interfaceOperation);
- String ns = getNamespace(fault.getJavaType(),
fault.getXmlName().getNamespaceURI());
- QName outFaultName = new QName(ns, fault.getXmlName().getLocalPart());
- outfault.setRef(outFaultName);
- interfaceOperation.addOutfault(outfault);
-
- WSDLBindingFault bindingFault = new WSDLBindingFault(wsdlBinding);
- bindingFault.setRef(faultName);
- wsdlBinding.addFault(bindingFault);
- }
-
- wsdlInterface.addOperation(interfaceOperation);
- wsdlBinding.addOperation(bindingOperation);
- }
-
- protected void addSignatureItem(WSDLInterfaceOperation operation, ParameterMetaData
param, boolean isReturn)
- {
- Direction direction;
- if (isReturn)
- {
- direction = Direction.RETURN;
- }
- else if (param.getMode() == ParameterMode.INOUT)
- {
- direction = Direction.INOUT;
- }
- else if (param.getMode() == ParameterMode.OUT)
- {
- direction = Direction.OUT;
- }
- else
- {
- direction = Direction.IN;
- }
-
- operation.addRpcSignatureItem(new WSDLRPCSignatureItem(param.getPartName(),
direction));
- }
-
- protected void processOperationDOC(WSDLInterfaceOperation interfaceOperation,
WSDLBindingOperation bindingOperation, OperationMetaData operation)
- {
- interfaceOperation.setStyle(Constants.URI_STYLE_DOCUMENT);
-
- WSDLInterfaceOperationInput input = new
WSDLInterfaceOperationInput(interfaceOperation);
- WSDLBindingOperationInput bindingInput = new
WSDLBindingOperationInput(bindingOperation);
-
- WSDLInterfaceOperationOutput output = null;
- WSDLBindingOperationOutput bindingOutput = null;
-
- boolean twoWay = !operation.isOneWay();
- if (twoWay)
- {
- output = new WSDLInterfaceOperationOutput(interfaceOperation);
- bindingOutput = new WSDLBindingOperationOutput(bindingOperation);
-
- ParameterMetaData returnParameter = operation.getReturnParameter();
- if (returnParameter != null)
- {
- QName xmlName = returnParameter.getXmlName();
- String partName = returnParameter.getPartName();
- if (returnParameter.isInHeader())
- {
- WSDLSOAPHeader header = new WSDLSOAPHeader(xmlName, partName);
- header.setIncludeInSignature(true);
- bindingOutput.addSoapHeader(header);
- }
- else
- {
- output.setElement(xmlName);
- output.setPartName(partName);
- }
- addSignatureItem(interfaceOperation, returnParameter, true);
- }
-
- // If there is no return parameter, it will most likely be set later with an
INOUT or OUT parameter.
- // Otherwise, a null element means there is a 0 body element part, which is
allowed by BP 1.0
- interfaceOperation.addOutput(output);
- bindingOperation.addOutput(bindingOutput);
- }
-
- for (ParameterMetaData param : operation.getParameters())
- {
- if (param.isInHeader())
- {
- WSDLSOAPHeader header = new WSDLSOAPHeader(param.getXmlName(),
param.getPartName());
- header.setIncludeInSignature(true);
- if (param.getMode() != ParameterMode.OUT)
- bindingInput.addSoapHeader(header);
- if (twoWay && param.getMode() != ParameterMode.IN)
- bindingOutput.addSoapHeader(header);
- }
- else
- {
- if (param.getMode() != ParameterMode.OUT)
- {
- input.setElement(param.getXmlName());
- input.setPartName(param.getPartName());
- }
- if (twoWay && param.getMode() != ParameterMode.IN)
- {
- output.setElement(param.getXmlName());
- output.setPartName(param.getPartName());
- }
- }
- addSignatureItem(interfaceOperation, param, false);
- }
-
- interfaceOperation.addInput(input);
- bindingOperation.addInput(bindingInput);
- }
-
- protected void processOperationRPC(WSDLInterfaceOperation interfaceOperation,
WSDLBindingOperation bindingOperation, OperationMetaData operation)
- {
- interfaceOperation.setStyle(Constants.URI_STYLE_RPC);
-
- WSDLInterfaceOperationInput input = new
WSDLInterfaceOperationInput(interfaceOperation);
- WSDLBindingOperationInput bindingInput = new
WSDLBindingOperationInput(bindingOperation);
- QName operationName = operation.getQName();
- input.setElement(operationName);
-
- WSDLInterfaceOperationOutput output = null;
- WSDLBindingOperationOutput bindingOutput = null;
-
- boolean twoWay = !operation.isOneWay();
- if (twoWay)
- {
- output = new WSDLInterfaceOperationOutput(interfaceOperation);
- bindingOutput = new WSDLBindingOperationOutput(bindingOperation);
- output.setElement(new QName(operationName.getNamespaceURI(),
operationName.getLocalPart() + "Response"));
-
- ParameterMetaData returnParameter = operation.getReturnParameter();
- if (returnParameter != null)
- {
- QName xmlName = returnParameter.getXmlName();
- String partName = returnParameter.getPartName();
- if (returnParameter.isInHeader())
- {
- WSDLSOAPHeader header = new WSDLSOAPHeader(xmlName, partName);
- header.setIncludeInSignature(true);
- bindingOutput.addSoapHeader(header);
- }
- else
- {
- QName xmlType = returnParameter.getXmlType();
- String ns = getNamespace(returnParameter.getJavaType(),
xmlType.getNamespaceURI());
- QName newXmlType = new QName(ns, xmlType.getLocalPart());
- WSDLRPCPart part = new WSDLRPCPart(partName, newXmlType);
-
- output.addChildPart(part);
- }
- addSignatureItem(interfaceOperation, returnParameter, true);
- }
-
- interfaceOperation.addOutput(output);
- bindingOperation.addOutput(bindingOutput);
- }
-
- for (ParameterMetaData param : operation.getParameters())
- {
- if (param.isInHeader())
- {
- WSDLSOAPHeader header = new WSDLSOAPHeader(param.getXmlName(),
param.getPartName());
- header.setIncludeInSignature(true);
- if (param.getMode() != ParameterMode.OUT)
- bindingInput.addSoapHeader(header);
- if (twoWay && param.getMode() != ParameterMode.IN)
- bindingOutput.addSoapHeader(header);
- }
- else
- {
- QName xmlType = param.getXmlType();
-
- String ns = getNamespace(param.getJavaType(), xmlType.getNamespaceURI());
- QName newXmlType = new QName(ns, xmlType.getLocalPart());
- WSDLRPCPart part = new WSDLRPCPart(param.getPartName(), newXmlType);
- if (param.getMode() != ParameterMode.OUT)
- input.addChildPart(part);
- if (twoWay && param.getMode() != ParameterMode.IN)
- output.addChildPart(part);
- }
- addSignatureItem(interfaceOperation, param, false);
- }
-
- interfaceOperation.addInput(input);
- bindingOperation.addInput(bindingInput);
- }
-
- protected void processService(ServiceMetaData service)
- {
-
- WSDLService wsdlService = new WSDLService(wsdl, service.getServiceName());
- wsdl.addService(wsdlService);
-
- EndpointMetaData endpoint = null;
- for (Iterator<EndpointMetaData> iter = service.getEndpoints().iterator();
iter.hasNext();)
- {
- endpoint = iter.next();
- processEndpoint(wsdlService, endpoint);
- }
-
- if (endpoint == null)
- throw new IllegalStateException(BundleUtils.getMessage(bundle,
"A_SERVICE_MUST_HAVE_AN_ENDPOINT"));
-
- wsdlService.setInterfaceName(endpoint.getPortName());
- }
-
- /**
- * Whether to force SOAP 1.2
- *
- * @param extension whether to force SOAP 1.2
- */
- public void setExtension(boolean extension)
- {
- this.extension = extension;
- }
-
- /**
- * Generate a WSDL object model from the passed in ServiceMetaData.
- *
- * @param service the service
- * @return the WSDL object model
- */
- public WSDLDefinitions generate(ServiceMetaData service)
- {
- // For now only WSDL 1.1
- wsdl = new WSDLDefinitions();
- wsdl.setWsdlNamespace(Constants.NS_WSDL11);
-
- // One WSDL per service
- String ns = service.getServiceName().getNamespaceURI();
- wsdl.setTargetNamespace(ns);
- wsdl.registerNamespaceURI(ns, "tns");
- wsdl.registerNamespaceURI(Constants.NS_SCHEMA_XSD, "xsd");
-
- // Register global namespaces
- if (packageNamespaceMap != null)
- {
- Set<String> keys = packageNamespaceMap.keySet();
- Iterator<String> iter = keys.iterator();
- while (iter != null && iter.hasNext())
- {
- String pkg = iter.next();
- wsdl.registerNamespaceURI(packageNamespaceMap.get(pkg), null);
- }
- }
-
- String soapPrefix = extension ? "soap12" : null;
- String soapURI = extension ? Constants.NS_SOAP12 : null;
- if (!extension)
- {
- for (EndpointMetaData ep : service.getEndpoints())
- {
- String bindingId = ep.getBindingId();
- if (bindingId.startsWith(SOAPBinding.SOAP11HTTP_BINDING))
- {
- soapPrefix = "soap";
- soapURI = Constants.NS_SOAP11;
- }
- else if (bindingId.startsWith(SOAPBinding.SOAP12HTTP_BINDING))
- {
- soapPrefix = "soap12";
- soapURI = Constants.NS_SOAP12;
- }
-
- }
- }
-
- if (soapURI != null && soapPrefix != null)
- wsdl.registerNamespaceURI(soapURI, soapPrefix);
-
- processTypes();
- processService(service);
-
- return wsdl;
- }
-
- protected String getNamespace(String packageName, String defaultNS)
- {
- String retNS = defaultNS;
- //Get it from global config if it is overriden
- if (packageNamespaceMap != null)
- {
- String ns = packageNamespaceMap.get(packageName);
- if (ns != null)
- {
- retNS = ns;
- }
- }
- return retNS;
- }
-
- protected String getNamespace(String packageName)
- {
- return getNamespace(packageName, wsdl.getTargetNamespace());
- }
-
- protected String getNamespace(Class type, String defaultNS)
- {
- while (type.isArray())
- {
- type = type.getComponentType();
- }
- Package pkg = type.getPackage();
- String pkgName = null;
- if (pkg != null)
- {
- pkgName = pkg.getName();
- }
- return getNamespace(pkgName, defaultNS);
- }
-
- protected String getJustPackageName(String classname)
- {
- int index = classname.lastIndexOf(".");
- if (index < 0)
- index = classname.length();
- return classname.substring(0,index);
- }
-}
Modified: stack/native/trunk/modules/testsuite/native-tests/pom.xml
===================================================================
--- stack/native/trunk/modules/testsuite/native-tests/pom.xml 2012-03-30 04:54:23 UTC (rev
16072)
+++ stack/native/trunk/modules/testsuite/native-tests/pom.xml 2012-03-30 13:38:48 UTC (rev
16073)
@@ -43,24 +43,6 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
- <id>wstools</id>
- <phase>test-compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.test.classpath"
refid="maven.test.classpath" />
- <property name="tests.resources.dir"
value="${test.resources.directory}" />
- <property name="tests.output.dir"
value="${project.build.directory}" />
- <property name="jboss.bind.address"
value="${jboss.bind.address}" />
- <property name="log4j.output.dir"
value="${log4j.output.dir}"/>
- <property name="jboss.home"
value="${jboss.home}"/>
- <ant antfile="scripts/antrun-wstools.xml"
target="wstools" />
- </tasks>
- </configuration>
- </execution>
- <execution>
<id>build-jars</id>
<phase>test-compile</phase>
<goals>
@@ -73,8 +55,6 @@
<property name="log4j.output.dir"
value="${log4j.output.dir}"/>
<property name="jboss.home"
value="${jboss.home}"/>
<ant antfile="scripts/build-jars-jaxrpc.xml"
target="build-jars-jaxrpc" />
- <ant antfile="scripts/build-samples-jaxrpc.xml"
target="build-samples-jaxrpc" />
- <ant antfile="scripts/build-jars-jaxws.xml"
target="build-jars-jaxws" />
</tasks>
</configuration>
</execution>
Deleted: stack/native/trunk/modules/testsuite/native-tests/scripts/antrun-wstools.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/scripts/antrun-wstools.xml 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/testsuite/native-tests/scripts/antrun-wstools.xml 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,110 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- -->
-
-<project>
-
- <!-- ================================================================== -->
- <!-- Generating sources -->
- <!-- ================================================================== -->
-
- <target name="wstools" description="Generate the JAX-RPC
artifacts.">
- <antcall target="generate-sources"/>
- <antcall target="compile-sources"/>
- <antcall target="copy-resources"/>
- </target>
-
- <!-- Generate JAX-RPC artifacts -->
- <target name="generate-sources">
-
- <taskdef name="wstools"
classname="org.jboss.ws.tools.ant.wstools">
- <classpath>
- <pathelement path="${maven.test.classpath}"/>
- </classpath>
- </taskdef>
-
- <macro-wstools dest="jaxrpc/samples/docstyle/wrapped/WEB-INF"
config="jaxrpc/samples/docstyle/wrapped/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/docstyle/bare/WEB-INF"
config="jaxrpc/samples/docstyle/bare/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/dynamichandler/WEB-INF"
config="jaxrpc/samples/dynamichandler/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/exception/WEB-INF"
config="jaxrpc/samples/exception/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/handler/WEB-INF"
config="jaxrpc/samples/handler/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/holder/WEB-INF"
config="jaxrpc/samples/holder/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/jsr109ejb/doclit/META-INF"
config="jaxrpc/samples/jsr109ejb/doclit/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/jsr109ejb/rpclit/META-INF"
config="jaxrpc/samples/jsr109ejb/rpclit/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/jsr109pojo/doclit/WEB-INF"
config="jaxrpc/samples/jsr109pojo/doclit/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/jsr109pojo/rpclit/WEB-INF"
config="jaxrpc/samples/jsr109pojo/rpclit/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/message/WEB-INF"
config="jaxrpc/samples/message/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/oneway/WEB-INF"
config="jaxrpc/samples/oneway/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/rpcstyle/WEB-INF"
config="jaxrpc/samples/rpcstyle/wstools-config.xml"/>
- <macro-wstools dest="jaxrpc/samples/secureejb/META-INF"
config="jaxrpc/samples/secureejb/wstools-config.xml"/>
-
- </target>
-
- <target name="compile-sources">
-
- <mkdir dir="${tests.output.dir}/wstools/java"/>
- <move todir="${tests.output.dir}/wstools/java">
- <fileset
dir="${tests.output.dir}/wstools/resources/jaxrpc/samples/docstyle/wrapped/WEB-INF"
includes="org/**"/>
- </move>
-
- <!--
- Cannot run javac from tasks
-
http://jira.codehaus.org/browse/MANTRUN-91
- -->
- <javac destdir="${tests.output.dir}/test-classes" debug="true"
encoding="utf-8" deprecation="true" fork="true"
- source="1.5" target="1.5">
- <src path="${tests.output.dir}/wstools/java"/>
- <classpath>
- <pathelement path="${maven.test.classpath}"/>
- </classpath>
- </javac>
- </target>
-
- <target name="copy-resources">
-
- <copy todir="${tests.output.dir}/test-resources">
- <fileset dir="${tests.output.dir}/wstools/resources">
- <include name="**/*.wsdl"/>
- <include name="**/*.xml"/>
- </fileset>
- </copy>
-
- <copy todir="${tests.output.dir}/test-resources/jaxrpc/samples"
overwrite="true">
- <fileset dir="${tests.resources.dir}/jaxrpc/samples-override"/>
- <filterset>
- <filter token="jboss.bind.address"
value="${jboss.bind.address}"/>
- </filterset>
- </copy>
- </target>
-
- <macrodef name="macro-wstools">
- <attribute name="dest"/>
- <attribute name="config"/>
- <sequential>
- <wstools dest="${tests.output.dir}/wstools/resources/@{dest}"
config="${tests.resources.dir}/@{config}">
- <sysproperty key="log4j.output.dir"
value="${tests.output.dir}"/>
- </wstools>
- </sequential>
- </macrodef>
-
-</project>
Deleted: stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/testsuite/native-tests/scripts/build-jars-jaxws.xml 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,337 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- -->
-
-<project>
-
- <description>JBossWS test archive builder</description>
-
- <target name="build-jars-jaxws" description="Build the
deployments.">
-
- <mkdir dir="${tests.output.dir}/test-libs" />
-
- <!-- jaxws-jbws1909 -->
- <jar destfile="${tests.output.dir}/test-libs/jaxws-jbws1909.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws1909/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws1909/*TestCase.class" />
- </fileset>
- <manifest>
- <attribute name="Dependencies"
value="org.jboss.logging,org.jboss.ws.common"/>
- </manifest>
- </jar>
-
- <!-- jaxws-jbws2221 -->
- <jar destfile="${tests.output.dir}/test-libs/jaxws-jbws2221.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2221/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2221/*TestCase.class" />
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/jbws2221/META-INF">
- <include name="wsdl/**" />
- </metainf>
- </jar>
-
- <!-- jaxws-jbws2234 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2234.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2234/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2234/*.class" />
- <include name="org/jboss/test/ws/jaxws/jbws2234/JBWS2234TestCase.class"
/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2234/WEB-INF">
- <include name="jboss-web.xml" />
- <include name="wsdl/*" />
- </webinf>
- </war>
-
- <!-- jaxws-jbws2248 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2248.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2248/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2248/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2248/JBWS2248TestCase.class"
/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2248/WEB-INF">
- <include name="wsdl/*" />
- </webinf>
- </war>
-
- <!-- jaxws-jbws2437 -->
- <jar destfile="${tests.output.dir}/test-libs/jaxws-jbws2437.jar"
manifest="${tests.output.dir}/test-resources/jaxws/jbws2437/META-INF/MANIFEST.MF">
- <fileset dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2437/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2437/*TestCase.class" />
- </fileset>
- </jar>
-
- <!-- jaxws-jbws2565 -->
- <jar jarfile="${tests.output.dir}/test-libs/jaxws-jbws2565.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2565/MyWebServiceBean.class"
/>
- </fileset>
- </jar>
- <jar jarfile="${tests.output.dir}/test-libs/jaxws-jbws2565.ear">
- <fileset dir="${tests.output.dir}/test-libs">
- <include name="jaxws-jbws2565.jar" />
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/jbws2565/correct/META-INF">
- <include name="application.xml" />
- <include name="jboss-app.xml" />
- </metainf>
- </jar>
-
- <!-- jaxws-jbws2637-->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2637.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2637/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2637/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2637/*TestCase.class" />
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2637/WEB-INF">
- <include name="*" />
- </webinf>
- </war>
-
- <!-- jaxws-jbws2682 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2682.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2682/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2682/Endpoint.class" />
- <include name="org/jboss/test/ws/jaxws/jbws2682/EndpointImpl.class"
/>
- </classes>
- </war>
-
- <!-- jaxws-jbws2698 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2698.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2698/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2698/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2698/JBWS2698TestCase.class"
/>
- <include name="org/jboss/test/ws/jaxws/jbws2698/server-handlers.xml"
/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2698/WEB-INF">
- <include name="jboss-web.xml" />
- </webinf>
- </war>
-
- <!-- jaxws-jbws2706 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2706.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2706/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2706/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2698/JBWS2706TestCase.class"
/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2706/WEB-INF">
- <include name="wsdl/SwaTestService.wsdl" />
- <include name="jboss-web.xml" />
- </webinf>
- </war>
-
- <!-- jaxws-jbws2784 -->
- <jar destfile="${tests.output.dir}/test-libs/jaxws-jbws2784.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2784/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2784/*TestCase.class" />
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/jbws2784/META-INF">
- <include name="wsdl/**" />
- </metainf>
- </jar>
-
- <!-- jaxws-jbws2845 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2845.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2845/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2845/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2845/JBWS2845TestCase.class"
/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2845/WEB-INF">
- <include name="jboss-web.xml" />
- </webinf>
- </war>
-
- <!-- jaxws-jbws2969 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2969.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2969/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2969/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2969/JBWS2969TestCase.class"
/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws2969/WEB-INF">
- <include name="jboss-web.xml" />
- </webinf>
- </war>
-
- <!-- jaxws-jbws2982 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws2982.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws2982/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws2982/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws2982/*TestCase*.class" />
- </classes>
- </war>
-
- <!-- jaxws-jbws3070 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws3070.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws3070/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws3070/*.class" />
- <exclude name="org/jboss/test/ws/jaxws/jbws3070/*TestCase*.class" />
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/jbws3070/WEB-INF">
- <include name="**/*.wsdl" />
- <include name="**/*.xsd" />
- </webinf>
- </war>
-
- <!-- jaxws-jbws3071 -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-jbws3071.war"
webxml="${tests.output.dir}/test-resources/jaxws/jbws3071/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/jbws3071/TestEndpointImpl.class"
/>
- <include name="org/jboss/test/ws/jaxws/jbws3071/TestException.class"
/>
- </classes>
- </war>
-
- <!-- jaxws-webserviceref -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-webserviceref.war"
webxml="${tests.output.dir}/test-resources/jaxws/webserviceref/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointImpl.class" />
- </classes>
- </war>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientOne.class" />
- <include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointService.class" />
- <include name="org/jboss/test/ws/jaxws/webserviceref/TestEndpoint.class"
/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/webserviceref/META-INF">
- <include name="application-client.xml" />
- <include name="jboss-client.xml" />
- <include name="wsdl/**" />
- </metainf>
- <manifest>
- <attribute name="main-class"
value="org.jboss.test.ws.jaxws.samples.webserviceref.TestEndpointClientOne"
/>
- </manifest>
- </jar>
- <war
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-servlet-client.war"
webxml="${tests.output.dir}/test-resources/jaxws/webserviceref/WEB-INF-client/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/webserviceref/ServletClient.class" />
- <include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointService.class" />
- <include name="org/jboss/test/ws/jaxws/webserviceref/TestEndpoint.class"
/>
- <include name="org/jboss/test/ws/jaxws/webserviceref/EchoResponse.class"
/>
- <include name="org/jboss/test/ws/jaxws/webserviceref/Echo.class" />
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/webserviceref/META-INF">
- <include name="wsdl/**" />
- </webinf>
- <webinf
dir="${tests.output.dir}/test-resources/jaxws/webserviceref/WEB-INF-client">
- <include name="jboss-web.xml" />
- </webinf>
- </war>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-ejb3-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/webserviceref/EJB3Client.class"
/>
- <include name="org/jboss/test/ws/jaxws/webserviceref/EJB3Remote.class"
/>
- <include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointService.class" />
- <include name="org/jboss/test/ws/jaxws/webserviceref/TestEndpoint.class"
/>
- <include name="org/jboss/test/ws/jaxws/webserviceref/EchoResponse.class"
/>
- <include name="org/jboss/test/ws/jaxws/webserviceref/Echo.class" />
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/webserviceref/META-INF">
- <include name="jboss.xml" />
- <include name="wsdl/**" />
- </metainf>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-secure.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointImpl.class" />
- </fileset>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-secure-appclient.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.class" />
- <include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointService.class" />
- <include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpoint.class" />
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/webserviceref/META-INF-secure">
- <include name="application-client.xml" />
- <include name="jboss-client.xml" />
- </metainf>
- <manifest>
- <attribute name="main-class"
value="org.jboss.test.ws.jaxws.webserviceref.SecureEndpointClient" />
- </manifest>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-secure-appclient.ear">
- <fileset dir="${tests.output.dir}/test-libs">
- <include name="jaxws-webserviceref-secure-appclient.jar"/>
- </fileset>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-override-appclient.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.class" />
- <include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpointService.class" />
- <include name="org/jboss/test/ws/jaxws/webserviceref/TestEndpoint.class"
/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/webserviceref/META-INF-override">
- <include name="jbossws-client-config.xml" />
- <include name="application-client.xml" />
- <include name="jboss-client.xml" />
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/webserviceref/META-INF">
- <include name="wsdl/**" />
- </metainf>
- <manifest>
- <attribute name="main-class"
value="org.jboss.test.ws.jaxws.webserviceref.TestEndpointClientTwo" />
- </manifest>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-override-appclient.ear">
- <fileset dir="${tests.output.dir}/test-libs">
- <include name="jaxws-webserviceref-override-appclient.jar"/>
- </fileset>
- </jar>
-
- <!-- jaxws-webserviceref-secure -->
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-webserviceref-secure.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointImpl.class" />
- </fileset>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxws-secure-webserviceref-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointClient.class" />
- <include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpointService.class" />
- <include
name="org/jboss/test/ws/jaxws/webserviceref/SecureEndpoint.class" />
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxws/webserviceref/META-INF-secure">
- <include name="application-client.xml" />
- <include name="jboss-client.xml" />
- </metainf>
- <manifest>
- <attribute name="main-class"
value="org.jboss.test.ws.jaxws.webserviceref.SecureEndpointClient" />
- </manifest>
- </jar>
-
- <!-- jaxws-wsdd -->
- <war warfile="${tests.output.dir}/test-libs/jaxws-wsdd.war"
webxml="${tests.output.dir}/test-resources/jaxws/wsdd/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include name="org/jboss/test/ws/jaxws/wsdd/*.class" />
- </classes>
- <webinf dir="${tests.output.dir}/test-resources/jaxws/wsdd/WEB-INF">
- <include name="webservices.xml" />
- </webinf>
- </war>
-
- </target>
-
-</project>
Deleted:
stack/native/trunk/modules/testsuite/native-tests/scripts/build-samples-jaxrpc.xml
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/scripts/build-samples-jaxrpc.xml 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/testsuite/native-tests/scripts/build-samples-jaxrpc.xml 2012-03-30
13:38:48 UTC (rev 16073)
@@ -1,552 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- ~ JBoss, Home of Professional Open Source.
- ~ Copyright 2011, Red Hat, Inc., and individual contributors
- ~ as indicated by the @author tags. See the copyright.txt file in the
- ~ distribution for a full listing of individual contributors.
- ~
- ~ This is free software; you can redistribute it and/or modify it
- ~ under the terms of the GNU Lesser General Public License as
- ~ published by the Free Software Foundation; either version 2.1 of
- ~ the License, or (at your option) any later version.
- ~
- ~ This software is distributed in the hope that it will be useful,
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- ~ Lesser General Public License for more details.
- ~
- ~ You should have received a copy of the GNU Lesser General Public
- ~ License along with this software; if not, write to the Free
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- -->
-
-<project>
-
- <!-- ================================================================== -->
- <!-- Building -->
- <!-- ================================================================== -->
-
- <target name="build-samples-jaxrpc" description="Build the jaxrpc
samples deployments">
-
- <mkdir dir="${tests.output.dir}/test-libs"/>
-
- <!-- jaxrpc-samples-docstyle-bare -->
- <war
warfile="${tests.output.dir}/test-libs/jaxrpc-samples-docstyle-bare.war"
-
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/docstyle/bare/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialEndpointJSE.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialOrder.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialOrderResponse.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/docstyle/bare/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-docstyle-bare-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialOrder.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/bare/TrivialOrderResponse.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/docstyle/bare/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/docstyle/bare/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-docstyle-wrapped -->
- <war
warfile="${tests.output.dir}/test-libs/jaxrpc-samples-docstyle-wrapped.war"
-
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/docstyle/wrapped/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialEndpointJSE.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialService*RequestStruct.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialService*ResponseStruct.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/docstyle/wrapped/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-docstyle-wrapped-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialService*RequestStruct.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/docstyle/wrapped/TrivialService*ResponseStruct.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/docstyle/wrapped/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/docstyle/wrapped/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-dynamichandler -->
- <war
warfile="${tests.output.dir}/test-libs/jaxrpc-samples-dynamichandler.war"
-
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/dynamichandler/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/dynamichandler/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/dynamichandler/*ServiceBean.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/dynamichandler/*Handler.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/dynamichandler/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-dynamichandler-appclient.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/dynamichandler/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/dynamichandler/*Handler.class"/>
- <include
name="org/jboss/test/ws/appclient/AppclientKiller.class"/>
- </fileset>
- <manifest>
- <attribute name="main-class"
value="org.jboss.test.ws.appclient.AppclientKiller"/>
- </manifest>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/dynamichandler/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/dynamichandler/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-dynamichandler-appclient.ear">
- <fileset dir="${tests.output.dir}/test-libs">
- <include name="jaxrpc-samples-dynamichandler-appclient.jar"/>
- </fileset>
- </jar>
-
- <!-- jaxrpc-samples-exception -->
- <war
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-exception.war"
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/exception/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/exception/*Exception.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/exception/ServerHandler.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/exception/ExceptionServiceInterface.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/exception/ExceptionBeanImpl.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/exception/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-exception-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/exception/*Exception.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/exception/ExceptionServiceInterface.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/exception/ExceptionService.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/exception/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/exception/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-handler -->
- <war warfile="${tests.output.dir}/test-libs/jaxrpc-samples-handler.war"
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/handler/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/handler/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/handler/*ServiceBean.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/handler/ServerSideHandler.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/handler/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-handler-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/handler/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/handler/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/handler/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-holder -->
- <war warfile="${tests.output.dir}/test-libs/jaxrpc-samples-holder.war"
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/holder/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/holder/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/holder/*ServiceBean.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/holder/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-holder-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/holder/*Service.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/holder/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/holder/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-jsr109ejb-rpc -->
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-jsr109ejb-rpc.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Type.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*EJBEndpoint.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109ejb/rpclit/META-INF">
- <include name="ejb-jar.xml"/>
- <include name="jboss-webservices.xml"/>
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-jsr109ejb-rpc-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Type.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Service.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109ejb/rpclit/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-jsr109ejb-doc -->
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-jsr109ejb-doc.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Type.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Struct.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*EJBEndpoint.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109ejb/doclit/META-INF">
- <include name="ejb-jar.xml"/>
- <include name="jboss-webservices.xml"/>
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-jsr109ejb-doc-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Type.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Struct.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109ejb/*Service.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109ejb/doclit/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-jsr109pojo-rpc -->
- <war
warfile="${tests.output.dir}/test-libs/jaxrpc-samples-jsr109pojo-rpc.war"
-
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109pojo/rpclit/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Type.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*JSEEndpoint.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109pojo/rpclit/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="jboss-webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-jsr109pojo-rpc-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Type.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Service.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109pojo/rpclit/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109pojo/rpclit/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-jsr109pojo-doc -->
- <war
warfile="${tests.output.dir}/test-libs/jaxrpc-samples-jsr109pojo-doc.war"
-
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109pojo/doclit/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Type.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Struct.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*JSEEndpoint.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109pojo/doclit/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-jsr109pojo-doc-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Type.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Struct.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/jsr109pojo/*Service.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109pojo/doclit/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/jsr109pojo/doclit/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-message -->
- <war warfile="${tests.output.dir}/test-libs/jaxrpc-samples-message.war"
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/message/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/message/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/message/*ServiceBean.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/message/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- <manifest>
- <attribute name="Dependencies"
value="org.jboss.ws.common"/>
- </manifest>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-message-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/message/*Service.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/message/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/message/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-oneway -->
- <war warfile="${tests.output.dir}/test-libs/jaxrpc-samples-oneway.war"
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/oneway/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/oneway/*Service.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/oneway/*ServiceBean.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/oneway/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-oneway-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/oneway/*Service.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/oneway/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/oneway/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-rpcstyle -->
- <war warfile="${tests.output.dir}/test-libs/jaxrpc-samples-rpcstyle.war"
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/rpcstyle/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/rpcstyle/TrivialEndpointJSE.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/rpcstyle/TrivialService.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/rpcstyle/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-rpcstyle-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/rpcstyle/TrivialService.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/rpcstyle/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/rpcstyle/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-secureejb -->
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-secureejb.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/secureejb/OrganizationService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/secureejb/OrganizationHome.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/secureejb/OrganizationRemote.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/secureejb/OrganizationImpl.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/secureejb/META-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="ejb-jar.xml"/>
- <include name="jboss.xml"/>
- <include name="jboss-ejb3.xml"/>
- <include name="jboss-webservices.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
- <jar
jarfile="${tests.output.dir}/test-libs/jaxrpc-samples-secureejb-appclient.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/secureejb/OrganizationService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/secureejb/OrganizationHome.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/secureejb/OrganizationRemote.class"/>
- <include
name="org/jboss/test/ws/appclient/AppclientKiller.class"/>
- </fileset>
- <manifest>
- <attribute name="main-class"
value="org.jboss.test.ws.appclient.AppclientKiller"/>
- </manifest>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/secureejb/META-INF">
- <include name="application-client.xml"/>
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-secureejb-appclient.ear">
- <fileset dir="${tests.output.dir}/test-libs">
- <include name="jaxrpc-samples-secureejb-appclient.jar"/>
- </fileset>
- </jar>
-
- <!-- jaxrpc-samples-serviceref -->
- <war
warfile="${tests.output.dir}/test-libs/jaxrpc-samples-serviceref.war"
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/serviceref/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/TestEndpointImpl.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/TestEndpoint.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/serviceref/META-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/serviceref/WEB-INF">
- <include name="webservices.xml"/>
- </webinf>
- </war>
- <jar
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-serviceref-appclient.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/ApplicationClient.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/TestEndpointService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/TestEndpoint.class"/>
- <include
name="org/jboss/test/ws/appclient/AppclientKiller.class"/>
- </fileset>
- <manifest>
- <attribute name="main-class"
value="org.jboss.test.ws.appclient.AppclientKiller"/>
- </manifest>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/serviceref/META-INF">
- <include name="application-client.xml"/>
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
- <jar
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-serviceref-appclient.ear">
- <fileset dir="${tests.output.dir}/test-libs">
- <include name="jaxrpc-samples-serviceref-appclient.jar"/>
- </fileset>
- </jar>
- <war
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-serviceref-servlet-client.war"
-
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/serviceref/servlet-client/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/ServletClient.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/TestEndpointService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/TestEndpoint.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/ExampleHandler.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/serviceref/META-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-serviceref-ejbclient.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/EJBClient.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/EJBRemote.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/EJBRemoteHome.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/TestEndpointService.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/serviceref/TestEndpoint.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/serviceref/META-INF">
- <include name="ejb-jar.xml"/>
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- jaxrpc-samples-swa -->
- <war warfile="${tests.output.dir}/test-libs/jaxrpc-samples-swa.war"
webxml="${tests.output.dir}/test-resources/jaxrpc/samples/swa/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/swa/AttachmentImpl.class"/>
- <include
name="org/jboss/test/ws/jaxrpc/samples/swa/Attachment.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/swa/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="webservices.xml"/>
- <include name="wsdl/**"/>
- </webinf>
- </war>
- <jar
destfile="${tests.output.dir}/test-libs/jaxrpc-samples-swa-client.jar">
- <fileset dir="${tests.output.dir}/test-classes">
- <include
name="org/jboss/test/ws/jaxrpc/samples/swa/Attachment.class"/>
- </fileset>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/swa/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- </metainf>
- <metainf
dir="${tests.output.dir}/test-resources/jaxrpc/samples/swa/WEB-INF">
- <include name="jaxrpc-mapping.xml"/>
- <include name="wsdl/**"/>
- </metainf>
- </jar>
-
- <!-- Please add alphabetically -->
-
- </target>
-
-</project>
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/utils/JavaUtilsTestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/utils/JavaUtilsTestCase.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/common/utils/JavaUtilsTestCase.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.ws.common.utils;
-import org.jboss.test.ws.tools.jbws_161.custom.HelloObj;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.ws.common.JavaUtils;
@@ -33,14 +32,6 @@
*/
public class JavaUtilsTestCase extends JBossWSTest
{
- public void testLoadArrayType() throws Exception
- {
- String javaTypeName = HelloObj.class.getName();
- Class javaType = JavaUtils.loadJavaType(javaTypeName + "[]");
- assertNotNull("Unexpected null type", javaType);
- assertEquals("[L" + javaTypeName + ";", javaType.getName());
- }
-
public void testGetMultipleArrayWrapperValue() throws Exception
{
int[][] primParams = new int[][] { { 0, 1, 2 }, { 1, 2, 3 }, { 2, 3, 4 } };
Modified:
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws1384/JBWS1384TestCase.java
===================================================================
---
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws1384/JBWS1384TestCase.java 2012-03-30
04:54:23 UTC (rev 16072)
+++
stack/native/trunk/modules/testsuite/native-tests/src/test/java/org/jboss/test/ws/jaxrpc/jbws1384/JBWS1384TestCase.java 2012-03-30
13:38:48 UTC (rev 16073)
@@ -31,7 +31,6 @@
import junit.framework.Test;
import org.jboss.ws.core.jaxrpc.client.ServiceFactoryImpl;
-import org.jboss.ws.tools.WSTools;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
@@ -50,14 +49,6 @@
return new JBossWSTestSetup(JBWS1384TestCase.class,
"jaxrpc-jbws1384.war");
}
- public void testWsdlToJava() throws Exception
- {
- WSTools wstools = new WSTools();
- String configPath =
getResourceFile("jaxrpc/jbws1384/wstools-config.xml").getPath();
- boolean ret = wstools.generate(configPath, "./wstools/jbws1384");
- assertTrue("wstools success", ret);
- }
-
public void testEndpoint() throws Exception
{
ServiceFactoryImpl factory = (ServiceFactoryImpl)ServiceFactory.newInstance();