ws-wsrf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r225811 - in /webservices/wsrf/trunk/src/java/org/apache/ws/resource: impl/ResourceDefinitionImpl.java tool/Wsdl2Java.java
Date Thu, 28 Jul 2005 16:20:07 GMT
Author: ips
Date: Thu Jul 28 09:20:04 2005
New Revision: 225811

URL: http://svn.apache.org/viewcvs?rev=225811&view=rev
Log:
fixed bug in how service name is generated

Modified:
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java?rev=225811&r1=225810&r2=225811&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/impl/ResourceDefinitionImpl.java
Thu Jul 28 09:20:04 2005
@@ -17,7 +17,6 @@
 
 import org.apache.ws.resource.InvalidWsrfWsdlException;
 import org.apache.ws.resource.ResourceDefinition;
-import org.apache.xmlbeans.impl.common.NameUtil;
 
 import javax.wsdl.Binding;
 import javax.wsdl.Definition;
@@ -25,9 +24,8 @@
 import javax.wsdl.PortType;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.xml.namespace.QName;
-import java.util.List;
 import java.net.URL;
+import java.util.List;
 
 /**
  * A {@link ResourceDefinition} implementation.
@@ -46,29 +44,10 @@
     {
         super( def, getResourcePortType( port ), baseUrl);
         m_port = port;
-        m_name = getValidJavaName(port, def.getTargetNamespace());
+        m_name = port.getName();
         m_endpointURL = extractEndpointURL( m_port );
     }
 
-
-
-    /**
-     * Method to ensure the service name (and thereby the generated class names)
-     * contain only characters which are valid for Java Class Names...
-     *
-     * Note: If a character is encountered which is not valid, it is replaced with an underscore.
-     *
-     * @param port
-     * @param targetNamespace
-     * @return A valid Java name based on the original, only the invalid chars are replaced
with underscores.
-     */
-    private String getValidJavaName(Port port, String targetNamespace)
-    {
-        String className = NameUtil.getClassNameFromQName(new QName(targetNamespace, m_port.getName()));
-        return className.substring(className.lastIndexOf(".") + 1);
-    }
-
-
     private static PortType getResourcePortType( Port port ) throws InvalidWsrfWsdlException
     {
         Binding binding = port.getBinding();
@@ -100,16 +79,6 @@
     public String getEndpointURL()
     {
         return m_endpointURL;
-    }
-
-    private String extractName( String endpointURL )
-    {
-        if ( endpointURL.endsWith( "/" ) )
-        {
-            endpointURL = endpointURL.substring( 0, endpointURL.length() - 1 );
-        }
-        String name = endpointURL.substring( endpointURL.lastIndexOf( "/" ) + 1 );
-        return name;
     }
 
     private String extractEndpointURL(Port port) throws InvalidWsrfWsdlException

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java?rev=225811&r1=225810&r2=225811&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java Thu Jul 28
09:20:04 2005
@@ -366,8 +366,8 @@
         String targetNamespace = resourceDef.getDefinition().getTargetNamespace();
         props.setPackageName(GenerationUtils.getJavaPackageName(targetNamespace));
         String serviceName = resourceDef.getName();
-        String capitalizedServiceName = StringUtils.capitalize(serviceName);
-        props.setServiceName(capitalizedServiceName);
+        String javaServiceName = getValidJavaName( new QName(targetNamespace, serviceName
) );
+        props.setServiceName(javaServiceName);
         props.setSrcDir(new File(serviceDir, "src/java").getAbsolutePath());
         props.setJarDir(new File(m_xmlbeansDir, "lib").getAbsolutePath());
         props.setJarFileName(getJarFileName(wsdlFile));
@@ -461,6 +461,12 @@
         QName serviceQname = new QName(targetNamespace, serviceName);
         props.setServiceQName(serviceQname);
         return props;
+    }
+
+    private String getValidJavaName(QName qName)
+    {
+        String qualifiedClassName = NameUtil.getClassNameFromQName(qName);
+        return qualifiedClassName.substring(qualifiedClassName.lastIndexOf(".") + 1);
     }
 
     private boolean hasScheduledResourceTerminationPortType(ResourceDefinition resourceDef)



Mime
View raw message