You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrf-commits@ws.apache.org by sc...@apache.org on 2005/08/02 18:30:44 UTC
svn commit: r227033 [17/27] - in /webservices/wsrf/trunk: ./
src/java/org/apache/ws/ src/java/org/apache/ws/addressing/
src/java/org/apache/ws/addressing/v2003_03/
src/java/org/apache/ws/addressing/v2004_08_10/
src/java/org/apache/ws/resource/ src/java...
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java Tue Aug 2 09:28:49 2005
@@ -1,412 +1,771 @@
-package org.apache.ws.resource.tool.velocity;
-
-import org.apache.ws.resource.ResourceDefinition;
-import org.apache.ws.util.XmlBeanNameUtils;
-
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * A bean that contains all properties that are needed by our Velocity templates.
- *
- * @author Sal Campana
- */
-public class ServiceProperties
-{
- String m_packageName;
- String m_serviceName;
- String m_serviceImplements;
- String m_namespace;
- String m_prefix;
- Map m_customMappings;
- Map m_propertyMap;
- String m_resourceImplements;
- String m_propertyDocumentName;
- String m_wsdlName;
- QName m_resourcekey;
- List m_resourceIncludes = new ArrayList();
- List m_serviceIncludes = new ArrayList();
- List m_resourceInitIncludes = new ArrayList();
- List m_abstractResourceInitIncludes = new ArrayList();
- private boolean m_hasProperties;
- private String m_endpointServiceName;
- private String m_endpointURL;
- private String m_jarDir;
- private String m_classesDir;
- private String m_srcDir;
- private String m_jarFileName;
- private ResourceDefinition m_resourceDef;
- private String m_namespaceVersionHolder;
- public static final String SPEC_NAMESPACE_MEMBER_NAME = "SPEC_NAMESPACE_SET";
- private QName m_serviceQName;
- private String m_portName;
- private QName m_portTypeQName;
- private List m_implementedProps = new ArrayList();
- private String m_webbAppName;
- private String m_namespaceVersionHolderClassName;
- private String m_port;
-
- public ServiceProperties(ResourceDefinition resourceDef)
- {
- m_resourceDef = resourceDef;
- }
-
- public String getSrcDir()
- {
- return m_srcDir;
- }
-
- public void setSrcDir(String srcDir)
- {
- m_srcDir = srcDir;
- }
-
- public String getClassesDir()
- {
- return m_classesDir;
- }
-
- public void setClassesDir(String classesDir)
- {
- m_classesDir = classesDir;
- }
-
- public String getJarDir()
- {
- return m_jarDir;
- }
-
- public void setJarDir(String jarDir)
- {
- m_jarDir = jarDir;
- }
-
- public List getResourceIncludeFiles()
- {
- return m_resourceIncludes;
- }
-
- public void addResourceIncludeFile( String resourceInclude )
- {
- m_resourceIncludes.add( resourceInclude );
- }
-
- public List getServiceIncludeFiles()
- {
- return m_serviceIncludes;
- }
-
- public void addServiceIncludeFile( String serviceInclude )
- {
- m_serviceIncludes.add( serviceInclude );
- }
-
- public String getPackageName()
- {
- return m_packageName;
- }
-
- public void setPackageName(String packageName)
- {
- this.m_packageName = packageName;
- }
-
- public String getServiceName()
- {
- return m_serviceName;
- }
-
- public void setServiceName(String serviceName)
- {
- this.m_serviceName = serviceName;
- }
-
- public String getServiceImplements()
- {
- return m_serviceImplements;
- }
-
- public void setServiceImplements(String serviceImplements)
- {
- this.m_serviceImplements = serviceImplements;
- }
-
- public String getNamespace()
- {
- return m_namespace;
- }
-
- public void setNamespace(String namespace)
- {
- this.m_namespace = namespace;
- }
-
- public String getPrefix()
- {
- return m_prefix;
- }
-
- public void setPrefix(String prefix)
- {
- this.m_prefix = prefix;
- }
-
- public Map getCustomMappings()
- {
- return m_customMappings;
- }
-
- public void setCustomMappings(Map customMappings)
- {
- this.m_customMappings = customMappings;
- }
-
- public Map getPropertyMap()
- {
- return m_propertyMap;
- }
-
- public void setPropertyMap(Map propertyMap)
- {
- this.m_propertyMap = propertyMap;
- }
-
- public String getResourceImplements()
- {
- return m_resourceImplements;
- }
-
- public void setResourceImplements(String resourceImplements)
- {
- this.m_resourceImplements = resourceImplements;
- }
-
- public String getPropertyDocumentName()
- {
- return m_propertyDocumentName;
- }
-
- public void setPropertyDocumentName(String propertyDocumentName)
- {
- this.m_propertyDocumentName = propertyDocumentName;
- }
-
- public String getWsdlName()
- {
- return m_wsdlName;
- }
-
- public void setWsdlName(String wsdlName)
- {
- this.m_wsdlName = wsdlName;
- }
-
- public QName getResourcekey()
- {
- return m_resourcekey;
- }
-
- public void setResourcekey(QName resourcekey)
- {
- this.m_resourcekey = resourcekey;
- }
-
- public void setHasProperties(boolean hasProps)
- {
- m_hasProperties = hasProps;
- }
-
- public boolean getHasProperties()
- {
- return m_hasProperties;
- }
-
- public void setEndpointServiceName(String serviceName)
- {
- m_endpointServiceName = serviceName;
- }
-
- public String getEndpointServiceName()
- {
- return m_endpointServiceName;
- }
-
- public void setEndpointURL(String endpointURL)
- {
- m_endpointURL = endpointURL;
- try
- {
- setPort(Integer.toString(new java.net.URL(endpointURL).getPort()));
- }
- catch (java.net.MalformedURLException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public void setPort(String port)
- {
- m_port = port;
- }
-
- public String getPort()
- {
- return m_port;
- }
- public String getEndpointURL()
- {
- return m_endpointURL;
- }
-
- public String getJarFileName()
- {
- return m_jarFileName;
- }
-
- public void setJarFileName( String jarFileName )
- {
- m_jarFileName = jarFileName;
- }
-
- public boolean implementsResourceCapability(QName capability)
- {
- return m_resourceDef.implementsResourceCapability(capability);
- }
-
- public List getResourceInitIncludeLocations()
- {
- return m_resourceInitIncludes;
- }
-
- public void addResourceInitIncludeLocation( String resourceInitInclude )
- {
- m_resourceInitIncludes.add( resourceInitInclude );
- }
-
- public List getAbstractResourceInitIncludeLocations()
- {
- return m_abstractResourceInitIncludes;
- }
-
- public void addAbstractResourceInitIncludeLocation( String abstractResourceInitInclude )
- {
- m_abstractResourceInitIncludes.add( abstractResourceInitInclude );
- }
-
- public String getNamespaceVersionHolder()
- {
- return m_namespaceVersionHolder;
- }
-
- public void setNamespaceVersionHolder(Class namespaceValueHolder)
- {
- if(namespaceValueHolder != null)
- {
- setNamespaceVersionHolderClassName(namespaceValueHolder);
- String className = namespaceValueHolder.getName();
- m_namespaceVersionHolder = "public static final "+className+" "+SPEC_NAMESPACE_MEMBER_NAME+" = new " + className + "();";
- }
- }
- public void setNamespaceVersionHolderClassName(Class namespaceValueHolder)
- {
- m_namespaceVersionHolderClassName = namespaceValueHolder.getName();
- }
-
- public String getNamespaceVersionHolderClassName()
- {
- return m_namespaceVersionHolderClassName;
- }
-
- public void setPortName(String portName)
- {
- m_portName = portName;
- }
-
- public void setPortTypeQName(QName portTypeQName)
- {
- m_portTypeQName = portTypeQName;
- }
-
- public void setServiceQName(QName serviceQname)
- {
- m_serviceQName = serviceQname;
- }
-
- public String getPortName()
- {
- return m_portName;
- }
-
- public QName getPortTypeQName()
- {
- return m_portTypeQName;
- }
-
- public QName getServiceQName()
- {
- return m_serviceQName;
- }
-
- public String getDocumentElementXmlBeanClassName(QName prop_qname)
- {
- return XmlBeanNameUtils.getDocumentElementXmlBeanClassName(prop_qname);
- }
-
- /**
- * Use this method to tell the ServiceProperties which ResourceProperties we implement for the user.
- *
- * @param propQnameTerminationTime
- */
- public void addImplementedProperty(QName propQnameTerminationTime)
- {
- m_implementedProps.add(propQnameTerminationTime);
- }
-
- /**
- * Returns a list of only the properties which the implementor has defined
- * in their wsdl AND that ARE implemented for them.
- *
- * @return A list of the props which the implementor will not need to implement.
- */
- public List getImplementedProperties()
- {
- List list = new ArrayList();
- for (int i = 0; i < m_implementedProps.size(); i++)
- {
- if (m_propertyMap.values().contains(m_implementedProps.get(i)))
- {
- list.add(m_implementedProps.get(i));
- }
- }
- return list;
- }
-
- /**
- * Returns a Map of the properties which the implementor will
- * need to implement.
- *
- * @return The Map of props which need to be implenmented/
- */
- public Map getImplementableProperties()
- {
- Map implementableMap = new HashMap(m_propertyMap);
- for (int i = 0; i < m_implementedProps.size(); i++)
- {
- implementableMap.remove( ((QName)m_implementedProps.get(i)).getLocalPart().toUpperCase());
- }
- return implementableMap;
- }
-
- public void setWebappName(String name)
- {
- m_webbAppName = name;
- }
-
- public String getWebappName()
- {
- return m_webbAppName;
- }
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.tool.velocity;
+
+import org.apache.ws.resource.ResourceDefinition;
+import org.apache.ws.util.XmlBeanNameUtils;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A bean that contains all properties that are needed by our Velocity templates.
+ *
+ * @author Sal Campana
+ */
+public class ServiceProperties
+{
+ /** DOCUMENT_ME */
+ public static final String SPEC_NAMESPACE_MEMBER_NAME = "SPEC_NAMESPACE_SET";
+
+ /** DOCUMENT_ME */
+ String m_packageName;
+
+ /** DOCUMENT_ME */
+ String m_serviceName;
+
+ /** DOCUMENT_ME */
+ String m_serviceImplements;
+
+ /** DOCUMENT_ME */
+ String m_namespace;
+
+ /** DOCUMENT_ME */
+ String m_prefix;
+
+ /** DOCUMENT_ME */
+ Map m_customMappings;
+
+ /** DOCUMENT_ME */
+ Map m_propertyMap;
+
+ /** DOCUMENT_ME */
+ String m_resourceImplements;
+
+ /** DOCUMENT_ME */
+ String m_propertyDocumentName;
+
+ /** DOCUMENT_ME */
+ String m_wsdlName;
+
+ /** DOCUMENT_ME */
+ QName m_resourcekey;
+
+ /** DOCUMENT_ME */
+ List m_resourceIncludes = new ArrayList( );
+
+ /** DOCUMENT_ME */
+ List m_serviceIncludes = new ArrayList( );
+
+ /** DOCUMENT_ME */
+ List m_resourceInitIncludes = new ArrayList( );
+
+ /** DOCUMENT_ME */
+ List m_abstractResourceInitIncludes = new ArrayList( );
+ private boolean m_hasProperties;
+ private String m_endpointServiceName;
+ private String m_endpointURL;
+ private String m_jarDir;
+ private String m_classesDir;
+ private String m_srcDir;
+ private String m_jarFileName;
+ private ResourceDefinition m_resourceDef;
+ private String m_namespaceVersionHolder;
+ private QName m_serviceQName;
+ private String m_portName;
+ private QName m_portTypeQName;
+ private List m_implementedProps = new ArrayList( );
+ private String m_webbAppName;
+ private String m_namespaceVersionHolderClassName;
+ private String m_port;
+
+ /**
+ * Creates a new {@link ServiceProperties} object.
+ *
+ * @param resourceDef DOCUMENT_ME
+ */
+ public ServiceProperties( ResourceDefinition resourceDef )
+ {
+ m_resourceDef = resourceDef;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public List getAbstractResourceInitIncludeLocations( )
+ {
+ return m_abstractResourceInitIncludes;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param classesDir DOCUMENT_ME
+ */
+ public void setClassesDir( String classesDir )
+ {
+ m_classesDir = classesDir;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getClassesDir( )
+ {
+ return m_classesDir;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param customMappings DOCUMENT_ME
+ */
+ public void setCustomMappings( Map customMappings )
+ {
+ this.m_customMappings = customMappings;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Map getCustomMappings( )
+ {
+ return m_customMappings;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param prop_qname DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getDocumentElementXmlBeanClassName( QName prop_qname )
+ {
+ return XmlBeanNameUtils.getDocumentElementXmlBeanClassName( prop_qname );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param serviceName DOCUMENT_ME
+ */
+ public void setEndpointServiceName( String serviceName )
+ {
+ m_endpointServiceName = serviceName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getEndpointServiceName( )
+ {
+ return m_endpointServiceName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param endpointURL DOCUMENT_ME
+ */
+ public void setEndpointURL( String endpointURL )
+ {
+ m_endpointURL = endpointURL;
+ try
+ {
+ setPort( Integer.toString( new java.net.URL( endpointURL ).getPort( ) ) );
+ }
+ catch ( java.net.MalformedURLException e )
+ {
+ throw new RuntimeException( e );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getEndpointURL( )
+ {
+ return m_endpointURL;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param hasProps DOCUMENT_ME
+ */
+ public void setHasProperties( boolean hasProps )
+ {
+ m_hasProperties = hasProps;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public boolean getHasProperties( )
+ {
+ return m_hasProperties;
+ }
+
+ /**
+ * Returns a Map of the properties which the implementor will
+ * need to implement.
+ *
+ * @return The Map of props which need to be implenmented/
+ */
+ public Map getImplementableProperties( )
+ {
+ Map implementableMap = new HashMap( m_propertyMap );
+ for ( int i = 0; i < m_implementedProps.size( ); i++ )
+ {
+ implementableMap.remove( ( (QName) m_implementedProps.get( i ) ).getLocalPart( ).toUpperCase( ) );
+ }
+
+ return implementableMap;
+ }
+
+ /**
+ * Returns a list of only the properties which the implementor has defined
+ * in their wsdl AND that ARE implemented for them.
+ *
+ * @return A list of the props which the implementor will not need to implement.
+ */
+ public List getImplementedProperties( )
+ {
+ List list = new ArrayList( );
+ for ( int i = 0; i < m_implementedProps.size( ); i++ )
+ {
+ if ( m_propertyMap.values( ).contains( m_implementedProps.get( i ) ) )
+ {
+ list.add( m_implementedProps.get( i ) );
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param jarDir DOCUMENT_ME
+ */
+ public void setJarDir( String jarDir )
+ {
+ m_jarDir = jarDir;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getJarDir( )
+ {
+ return m_jarDir;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param jarFileName DOCUMENT_ME
+ */
+ public void setJarFileName( String jarFileName )
+ {
+ m_jarFileName = jarFileName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getJarFileName( )
+ {
+ return m_jarFileName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param namespace DOCUMENT_ME
+ */
+ public void setNamespace( String namespace )
+ {
+ this.m_namespace = namespace;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getNamespace( )
+ {
+ return m_namespace;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param namespaceValueHolder DOCUMENT_ME
+ */
+ public void setNamespaceVersionHolder( Class namespaceValueHolder )
+ {
+ if ( namespaceValueHolder != null )
+ {
+ setNamespaceVersionHolderClassName( namespaceValueHolder );
+ String className = namespaceValueHolder.getName( );
+ m_namespaceVersionHolder =
+ "public static final " + className + " " + SPEC_NAMESPACE_MEMBER_NAME + " = new " + className + "();";
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getNamespaceVersionHolder( )
+ {
+ return m_namespaceVersionHolder;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param namespaceValueHolder DOCUMENT_ME
+ */
+ public void setNamespaceVersionHolderClassName( Class namespaceValueHolder )
+ {
+ m_namespaceVersionHolderClassName = namespaceValueHolder.getName( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getNamespaceVersionHolderClassName( )
+ {
+ return m_namespaceVersionHolderClassName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param packageName DOCUMENT_ME
+ */
+ public void setPackageName( String packageName )
+ {
+ this.m_packageName = packageName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getPackageName( )
+ {
+ return m_packageName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param port DOCUMENT_ME
+ */
+ public void setPort( String port )
+ {
+ m_port = port;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getPort( )
+ {
+ return m_port;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param portName DOCUMENT_ME
+ */
+ public void setPortName( String portName )
+ {
+ m_portName = portName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getPortName( )
+ {
+ return m_portName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param portTypeQName DOCUMENT_ME
+ */
+ public void setPortTypeQName( QName portTypeQName )
+ {
+ m_portTypeQName = portTypeQName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getPortTypeQName( )
+ {
+ return m_portTypeQName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param prefix DOCUMENT_ME
+ */
+ public void setPrefix( String prefix )
+ {
+ this.m_prefix = prefix;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getPrefix( )
+ {
+ return m_prefix;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propertyDocumentName DOCUMENT_ME
+ */
+ public void setPropertyDocumentName( String propertyDocumentName )
+ {
+ this.m_propertyDocumentName = propertyDocumentName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getPropertyDocumentName( )
+ {
+ return m_propertyDocumentName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propertyMap DOCUMENT_ME
+ */
+ public void setPropertyMap( Map propertyMap )
+ {
+ this.m_propertyMap = propertyMap;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Map getPropertyMap( )
+ {
+ return m_propertyMap;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param resourceImplements DOCUMENT_ME
+ */
+ public void setResourceImplements( String resourceImplements )
+ {
+ this.m_resourceImplements = resourceImplements;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getResourceImplements( )
+ {
+ return m_resourceImplements;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public List getResourceIncludeFiles( )
+ {
+ return m_resourceIncludes;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public List getResourceInitIncludeLocations( )
+ {
+ return m_resourceInitIncludes;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param resourcekey DOCUMENT_ME
+ */
+ public void setResourcekey( QName resourcekey )
+ {
+ this.m_resourcekey = resourcekey;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getResourcekey( )
+ {
+ return m_resourcekey;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param serviceImplements DOCUMENT_ME
+ */
+ public void setServiceImplements( String serviceImplements )
+ {
+ this.m_serviceImplements = serviceImplements;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceImplements( )
+ {
+ return m_serviceImplements;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public List getServiceIncludeFiles( )
+ {
+ return m_serviceIncludes;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param serviceName DOCUMENT_ME
+ */
+ public void setServiceName( String serviceName )
+ {
+ this.m_serviceName = serviceName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceName( )
+ {
+ return m_serviceName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param serviceQname DOCUMENT_ME
+ */
+ public void setServiceQName( QName serviceQname )
+ {
+ m_serviceQName = serviceQname;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getServiceQName( )
+ {
+ return m_serviceQName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param srcDir DOCUMENT_ME
+ */
+ public void setSrcDir( String srcDir )
+ {
+ m_srcDir = srcDir;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getSrcDir( )
+ {
+ return m_srcDir;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param name DOCUMENT_ME
+ */
+ public void setWebappName( String name )
+ {
+ m_webbAppName = name;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getWebappName( )
+ {
+ return m_webbAppName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param wsdlName DOCUMENT_ME
+ */
+ public void setWsdlName( String wsdlName )
+ {
+ this.m_wsdlName = wsdlName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getWsdlName( )
+ {
+ return m_wsdlName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param abstractResourceInitInclude DOCUMENT_ME
+ */
+ public void addAbstractResourceInitIncludeLocation( String abstractResourceInitInclude )
+ {
+ m_abstractResourceInitIncludes.add( abstractResourceInitInclude );
+ }
+
+ /**
+ * Use this method to tell the ServiceProperties which ResourceProperties we implement for the user.
+ *
+ * @param propQnameTerminationTime
+ */
+ public void addImplementedProperty( QName propQnameTerminationTime )
+ {
+ m_implementedProps.add( propQnameTerminationTime );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param resourceInclude DOCUMENT_ME
+ */
+ public void addResourceIncludeFile( String resourceInclude )
+ {
+ m_resourceIncludes.add( resourceInclude );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param resourceInitInclude DOCUMENT_ME
+ */
+ public void addResourceInitIncludeLocation( String resourceInitInclude )
+ {
+ m_resourceInitIncludes.add( resourceInitInclude );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param serviceInclude DOCUMENT_ME
+ */
+ public void addServiceIncludeFile( String serviceInclude )
+ {
+ m_serviceIncludes.add( serviceInclude );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param capability DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public boolean implementsResourceCapability( QName capability )
+ {
+ return m_resourceDef.implementsResourceCapability( capability );
+ }
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/v2004_06/WsrfConstants.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/v2004_06/WsrfConstants.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/v2004_06/WsrfConstants.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/v2004_06/WsrfConstants.java Tue Aug 2 09:28:49 2005
@@ -1,29 +1,28 @@
-/*=============================================================================*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.v2004_06;
-
-/**
- * Constants that are applicable to all of the Jun 2004 WSRF specifications.
- */
-public interface WsrfConstants
-{
-
- /**
- * The base URI for all URIs defined by the WSRF specs.
- */
- String BASE_URI_WSRF = "http://docs.oasis-open.org/wsrf/2004/06/";
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.v2004_06;
+
+
+/**
+ * Constants that are applicable to all of the Jun 2004 WSRF specifications.
+ */
+public interface WsrfConstants
+{
+ /**
+ * The base URI for all URIs defined by the WSRF specs.
+ */
+ String BASE_URI_WSRF = "http://docs.oasis-open.org/wsrf/2004/06/";
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/v2004_11/WsrfConstants.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/v2004_11/WsrfConstants.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/v2004_11/WsrfConstants.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/v2004_11/WsrfConstants.java Tue Aug 2 09:28:49 2005
@@ -1,29 +1,28 @@
-/*=============================================================================*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.v2004_11;
-
-/**
- * Constants that are applicable to all of the Nov 2004 WSRF specifications.
- */
-public interface WsrfConstants
-{
-
- /**
- * The base URI for all URIs defined by the WSRF specs.
- */
- String BASE_URI_WSRF = "http://docs.oasis-open.org/wsrf/2004/11/";
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.v2004_11;
+
+
+/**
+ * Constants that are applicable to all of the Nov 2004 WSRF specifications.
+ */
+public interface WsrfConstants
+{
+ /**
+ * The base URI for all URIs defined by the WSRF specs.
+ */
+ String BASE_URI_WSRF = "http://docs.oasis-open.org/wsrf/2004/11/";
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/webapp/WsrfServer.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/webapp/WsrfServer.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/webapp/WsrfServer.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/webapp/WsrfServer.java Tue Aug 2 09:28:49 2005
@@ -1,164 +1,168 @@
-/*=============================================================================*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.webapp;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.PosixParser;
-import org.mortbay.http.SocketListener;
-import org.mortbay.jetty.Server;
-import org.mortbay.util.MultiException;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * A standalone WSRF server that uses Jetty as the HTTP server and servlet container
- * and uses Axis as the SOAP engine.
- *
- * @author Ian Springer
- */
-public class WsrfServer
-{
-
- protected static final org.apache.commons.cli.Options CMD_LINE_OPTIONS = new org.apache.commons.cli.Options();
-
- static
- {
- initCmdLineOptions();
- }
-
- /**
- * Jetty HTTP server / servlet container
- */
- private Server m_server;
-
- private SocketListener m_listener = new SocketListener();
-
- private File m_webappPath;
-
- /**
- * Creates a WsrfServer for running the specified web application.
- *
- * @param webappPath the path to an Apache-WSRF-based webapp (directory or warfile)
- *
- * @throws IOException if the webapp path is invalid
- */
- public WsrfServer( File webappPath ) throws IOException
- {
- m_webappPath = webappPath;
- m_server = new Server();
- m_server.addListener(m_listener);
- String contextName = m_webappPath.getName();
- m_server.addWebApplication( "/" + contextName + "/*", m_webappPath.getAbsolutePath() );
- }
-
- /**
- * Sets the HTTP listen port.
- *
- * @param port the port number
- */
- public void setPort(int port) {
- m_listener.setPort(port);
- }
-
- /**
- * Gets the HTTP listen port.
- */
- public int getPort() {
- return m_listener.getPort();
- }
-
- /**
- * Gets the webapp path.
- */
- public File getWebappPath()
- {
- return m_webappPath;
- }
-
- /**
- * Starts the server.
- *
- * @throws MultiException
- */
- public void start() throws MultiException {
- m_server.start();
- }
-
- /**
- * Stops the server.
- *
- * @throws InterruptedException
- */
- public void stop() throws InterruptedException {
- m_server.stop();
- }
-
- private static void initCmdLineOptions()
- {
- CMD_LINE_OPTIONS.addOption(Opts.PORT,
- LongOpts.PORT,
- true,
- "server listen port");
- }
-
- /**
- * DOCUMENT_ME
- */
- static interface LongOpts
- {
- /**
- * DOCUMENT_ME
- */
- String PORT = "port";
- }
-
- /**
- * DOCUMENT_ME
- */
- static interface Opts
- {
- /**
- * DOCUMENT_ME
- */
- String PORT = "p";
- }
-
- /**
- * A main method for starting a server instance.
- * Usage: org.apache.ws.resource.webapp.WsrfServer [-p port] webappPath
- *
- * @param args command-line arguments
- *
- * @throws Exception on any error
- */
- public static void main(String[] args) throws Exception
- {
- CommandLine cmdLine = new PosixParser().parse(CMD_LINE_OPTIONS, args, true);
- if ( cmdLine.getArgs().length != 1 )
- {
- throw new IllegalArgumentException( "Usage: " + WsrfServer.class.getName() + " [-p port] webappPath");
- }
- File webappPath = new File( cmdLine.getArgs()[0] );
- WsrfServer server = new WsrfServer( webappPath );
- if (cmdLine.hasOption(Opts.PORT))
- {
- server.setPort( Integer.valueOf( cmdLine.getOptionValue( Opts.PORT ) ).intValue() );
- }
- server.start();
- }
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.webapp;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.PosixParser;
+import org.mortbay.http.SocketListener;
+import org.mortbay.jetty.Server;
+import org.mortbay.util.MultiException;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * A standalone WSRF server that uses Jetty as the HTTP server and servlet container
+ * and uses Axis as the SOAP engine.
+ *
+ * @author Ian Springer
+ */
+public class WsrfServer
+{
+ /** DOCUMENT_ME */
+ protected static final org.apache.commons.cli.Options CMD_LINE_OPTIONS = new org.apache.commons.cli.Options( );
+
+ static
+ {
+ initCmdLineOptions( );
+ }
+
+ /**
+ * Jetty HTTP server / servlet container
+ */
+ private Server m_server;
+ private SocketListener m_listener = new SocketListener( );
+ private File m_webappPath;
+
+ /**
+ * Creates a WsrfServer for running the specified web application.
+ *
+ * @param webappPath the path to an Apache-WSRF-based webapp (directory or warfile)
+ *
+ * @throws IOException if the webapp path is invalid
+ */
+ public WsrfServer( File webappPath )
+ throws IOException
+ {
+ m_webappPath = webappPath;
+ m_server = new Server( );
+ m_server.addListener( m_listener );
+ String contextName = m_webappPath.getName( );
+ m_server.addWebApplication( "/" + contextName + "/*",
+ m_webappPath.getAbsolutePath( ) );
+ }
+
+ /**
+ * Sets the HTTP listen port.
+ *
+ * @param port the port number
+ */
+ public void setPort( int port )
+ {
+ m_listener.setPort( port );
+ }
+
+ /**
+ * Gets the HTTP listen port.
+ */
+ public int getPort( )
+ {
+ return m_listener.getPort( );
+ }
+
+ /**
+ * Gets the webapp path.
+ */
+ public File getWebappPath( )
+ {
+ return m_webappPath;
+ }
+
+ /**
+ * A main method for starting a server instance.
+ * Usage: org.apache.ws.resource.webapp.WsrfServer [-p port] webappPath
+ *
+ * @param args command-line arguments
+ *
+ * @throws Exception on any error
+ */
+ public static void main( String[] args )
+ throws Exception
+ {
+ CommandLine cmdLine = new PosixParser( ).parse( CMD_LINE_OPTIONS, args, true );
+ if ( cmdLine.getArgs( ).length != 1 )
+ {
+ throw new IllegalArgumentException( "Usage: " + WsrfServer.class.getName( ) + " [-p port] webappPath" );
+ }
+
+ File webappPath = new File( cmdLine.getArgs( )[0] );
+ WsrfServer server = new WsrfServer( webappPath );
+ if ( cmdLine.hasOption( Opts.PORT ) )
+ {
+ server.setPort( Integer.valueOf( cmdLine.getOptionValue( Opts.PORT ) ).intValue( ) );
+ }
+
+ server.start( );
+ }
+
+ /**
+ * Starts the server.
+ *
+ * @throws MultiException
+ */
+ public void start( )
+ throws MultiException
+ {
+ m_server.start( );
+ }
+
+ /**
+ * Stops the server.
+ *
+ * @throws InterruptedException
+ */
+ public void stop( )
+ throws InterruptedException
+ {
+ m_server.stop( );
+ }
+
+ private static void initCmdLineOptions( )
+ {
+ CMD_LINE_OPTIONS.addOption( Opts.PORT, LongOpts.PORT, true, "server listen port" );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ static interface LongOpts
+ {
+ /**
+ * DOCUMENT_ME
+ */
+ String PORT = "port";
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ static interface Opts
+ {
+ /**
+ * DOCUMENT_ME
+ */
+ String PORT = "p";
+ }
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/resource/webapp/WsrfServletContextListener.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/resource/webapp/WsrfServletContextListener.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/resource/webapp/WsrfServletContextListener.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/resource/webapp/WsrfServletContextListener.java Tue Aug 2 09:28:49 2005
@@ -1,68 +1,76 @@
-/*=============================================================================*
- * Copyright 2005 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.resource.webapp;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ws.resource.i18n.Keys;
-import org.apache.ws.resource.i18n.MessagesImpl;
-import org.apache.ws.util.i18n.Messages;
-import org.apache.ws.util.jndi.XmlBeanJndiUtils;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import java.io.InputStream;
-
-/**
- * A servlet context listener for the WSRF webapp that provides the hook for
- * initializing the WSRF JNDI context. Note, to configure this listener, add
- * the following lines to web.xml:
- *
- * <listener>
- * <listener-class>org.apache.ws.resource.webapp.WsrfServletContextListener</listener-class>
- * </listener>
- *
- * @author Ian Springer
- */
-public class WsrfServletContextListener implements ServletContextListener
-{
-
- private static final Log LOG = LogFactory.getLog( WsrfServletContextListener.class );
- private static final Messages MSG = MessagesImpl.getInstance();
-
- public void contextInitialized( ServletContextEvent contextEvent )
- {
- String contextName = contextEvent.getServletContext().getServletContextName();
- LOG.info( "Initializing the " + contextName + " webapp..." );
- LOG.info( MSG.getMessage( Keys.POPULATING_JNDI, XmlBeanJndiUtils.JNDI_CONFIG_FILENAME ) );
- try
- {
- InputStream jndiConfigStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(
- XmlBeanJndiUtils.JNDI_CONFIG_FILENAME );
- XmlBeanJndiUtils.initFromInputStream( jndiConfigStream );
- }
- catch ( Exception e )
- {
- throw new RuntimeException( "Fatal error! Failed to initialize WSRF JNDI context.", e );
- }
- }
-
- public void contextDestroyed( ServletContextEvent contextEvent )
- {
- // intentionally empty
- }
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.resource.webapp;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.ws.util.jndi.XmlBeanJndiUtils;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import java.io.InputStream;
+
+/**
+ * A servlet context listener for the WSRF webapp that provides the hook for
+ * initializing the WSRF JNDI context. Note, to configure this listener, add
+ * the following lines to web.xml:
+ *
+ * <listener>
+ * <listener-class>org.apache.ws.resource.webapp.WsrfServletContextListener</listener-class>
+ * </listener>
+ *
+ * @author Ian Springer
+ */
+public class WsrfServletContextListener
+ implements ServletContextListener
+{
+ private static final Log LOG = LogFactory.getLog( WsrfServletContextListener.class );
+ private static final Messages MSG = MessagesImpl.getInstance( );
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param contextEvent DOCUMENT_ME
+ */
+ public void contextDestroyed( ServletContextEvent contextEvent )
+ {
+ // intentionally empty
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param contextEvent DOCUMENT_ME
+ */
+ public void contextInitialized( ServletContextEvent contextEvent )
+ {
+ String contextName = contextEvent.getServletContext( ).getServletContextName( );
+ LOG.info( "Initializing the " + contextName + " webapp..." );
+ LOG.info( MSG.getMessage( Keys.POPULATING_JNDI, XmlBeanJndiUtils.JNDI_CONFIG_FILENAME ) );
+ try
+ {
+ InputStream jndiConfigStream =
+ Thread.currentThread( ).getContextClassLoader( ).getResourceAsStream( XmlBeanJndiUtils.JNDI_CONFIG_FILENAME );
+ XmlBeanJndiUtils.initFromInputStream( jndiConfigStream );
+ }
+ catch ( Exception e )
+ {
+ throw new RuntimeException( "Fatal error! Failed to initialize WSRF JNDI context.", e );
+ }
+ }
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/IoUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/IoUtils.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/IoUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/IoUtils.java Tue Aug 2 09:28:49 2005
@@ -20,7 +20,6 @@
import org.apache.ws.util.i18n.Keys;
import org.apache.ws.util.i18n.Messages;
import org.apache.ws.util.i18n.MessagesImpl;
-
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
@@ -37,84 +36,85 @@
*/
public abstract class IoUtils
{
+ private static final Log LOG = LogFactory.getLog( IoUtils.class );
+ private static final Messages MSG = MessagesImpl.getInstance( );
- private static final Log LOG = LogFactory.getLog( IoUtils.class );
- private static final Messages MSG = MessagesImpl.getInstance();
-
- /**
- * Copies an input stream to an output stream.
- *
- * @param in an input stream; must not be null
- * @param out an output stream; must not be null
- *
- * @throws IOException if the copy fails
- */
- public static void copy( InputStream in,
- OutputStream out )
- throws IOException
- {
- if ( in == null )
- {
- throw new IllegalArgumentException( MSG.getMessage( Keys.INPUTSTRM_MST_NOT_B_NULL ) );
- }
- if ( out == null )
- {
- throw new IllegalArgumentException( MSG.getMessage( Keys.OUTSTRM_MST_NOT_B_NULL ) );
- }
- // use Buffered streams for better performance
- in = new BufferedInputStream( in );
- out = new BufferedOutputStream( out );
-
- // do not allow other threads to read from the input or write to
- // the output while copying is taking place
- synchronized ( in )
- {
- synchronized ( out )
+ /**
+ * Copies an input stream to an output stream.
+ *
+ * @param in an input stream; must not be null
+ * @param out an output stream; must not be null
+ *
+ * @throws IOException if the copy fails
+ */
+ public static void copy( InputStream in,
+ OutputStream out )
+ throws IOException
+ {
+ if ( in == null )
+ {
+ throw new IllegalArgumentException( MSG.getMessage( Keys.INPUTSTRM_MST_NOT_B_NULL ) );
+ }
+
+ if ( out == null )
+ {
+ throw new IllegalArgumentException( MSG.getMessage( Keys.OUTSTRM_MST_NOT_B_NULL ) );
+ }
+
+ // use Buffered streams for better performance
+ in = new BufferedInputStream( in );
+ out = new BufferedOutputStream( out );
+
+ // do not allow other threads to read from the input or write to
+ // the output while copying is taking place
+ synchronized ( in )
+ {
+ synchronized ( out )
+ {
+ byte[] bytes = new byte[8192];
+ int bytesRead;
+ while ( ( bytesRead = in.read( bytes ) ) != -1 )
{
- byte[] bytes = new byte[8192];
- int bytesRead;
- while ( ( bytesRead = in.read( bytes ) ) != -1 )
- {
- out.write( bytes, 0, bytesRead );
- }
- out.flush();
+ out.write( bytes, 0, bytesRead );
}
- }
- }
-
- /**
- * Converts a ByteArrayOutputStream into a ByteArrayInputStream.
- *
- * @param out
- *
- * @return ByteArrayInputStream
- */
- public static ByteArrayInputStream toByteArrayInputStream( ByteArrayOutputStream out )
- {
- return new ByteArrayInputStream( out.toByteArray() );
- }
-
- /**
- * Convert the specified string to an input stream.
- *
- * @param str a string
- *
- * @return an input stream
- */
- public static InputStream toInputStream( String str )
- {
- LOG.debug( MSG.getMessage( Keys.ATTMPT_CNVRT_STRING_TO_INPTSTRM, str ) );
- try
- {
- return ( new ByteArrayInputStream( str.getBytes( "UTF-8" ) ) );
- }
- catch ( UnsupportedEncodingException uee )
- { // this should never occur - UTF-8 is always supported
- uee.printStackTrace();
-
- // return using the current locale encoding
- return ( new ByteArrayInputStream( str.getBytes() ) );
- }
- }
-}
+ out.flush( );
+ }
+ }
+ }
+
+ /**
+ * Converts a ByteArrayOutputStream into a ByteArrayInputStream.
+ *
+ * @param out
+ *
+ * @return ByteArrayInputStream
+ */
+ public static ByteArrayInputStream toByteArrayInputStream( ByteArrayOutputStream out )
+ {
+ return new ByteArrayInputStream( out.toByteArray( ) );
+ }
+
+ /**
+ * Convert the specified string to an input stream.
+ *
+ * @param str a string
+ *
+ * @return an input stream
+ */
+ public static InputStream toInputStream( String str )
+ {
+ LOG.debug( MSG.getMessage( Keys.ATTMPT_CNVRT_STRING_TO_INPTSTRM, str ) );
+ try
+ {
+ return ( new ByteArrayInputStream( str.getBytes( "UTF-8" ) ) );
+ }
+ catch ( UnsupportedEncodingException uee )
+ { // this should never occur - UTF-8 is always supported
+ uee.printStackTrace( );
+
+ // return using the current locale encoding
+ return ( new ByteArrayInputStream( str.getBytes( ) ) );
+ }
+ }
+}
\ No newline at end of file
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/JaxpUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/JaxpUtils.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/JaxpUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/JaxpUtils.java Tue Aug 2 09:28:49 2005
@@ -24,7 +24,6 @@
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -44,164 +43,166 @@
*/
public abstract class JaxpUtils
{
- private static final Log LOG = LogFactory.getLog( JaxpUtils.class );
- public static final Messages MSG = MessagesImpl.getInstance();
+ private static final Log LOG = LogFactory.getLog( JaxpUtils.class );
+
+ /** DOCUMENT_ME */
+ public static final Messages MSG = MessagesImpl.getInstance( );
- /**
- * DOCUMENT_ME
- */
- private static final Object TRANSFORMER_LOCK = new Object();
-
- /**
- * DOCUMENT_ME
- */
- private static final String INDENT_SPACES = "2";
-
- /**
- * thread local that gives each thread its own TransformerFactory (since it is not thread-safe)
- */
- public static ThreadLocal TRANSFORMER_FACTORIES =
- new ThreadLocal()
- {
- protected synchronized Object initialValue()
- {
- return TransformerFactory.newInstance();
- }
- };
-
- /**
- * thread local that gives each thread its own DocumentBuilderFactory (since it is not thread-safe)
- */
- public static ThreadLocal DOCUMENT_BUILDER_FACTORIES =
- new ThreadLocal()
- {
- protected synchronized Object initialValue()
- {
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setNamespaceAware( true );
-
- return ( dbf );
- }
- };
-
- /**
- * Loads a DOM Document from an InputSource.
- *
- * @param in_source
- *
- * @return Document
- *
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws IOException
- */
- public static Document loadDocument( InputSource in_source )
- throws ParserConfigurationException,
- SAXException,
- IOException
- {
- DocumentBuilderFactory dbf = (DocumentBuilderFactory) DOCUMENT_BUILDER_FACTORIES.get();
- DocumentBuilder db = dbf.newDocumentBuilder();
-
- return ( db.parse( in_source ) );
- }
-
- /**
- * Method to load a DOM Document from an InputStream.
- *
- * @param in_stream
- *
- * @return Document
- *
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws IOException
- */
- public static Document loadDocument( InputStream in_stream )
- throws ParserConfigurationException,
- SAXException,
- IOException
- {
- InputStreamReader utf8_stream = new InputStreamReader( in_stream, "UTF-8" );
- Document doc = loadDocument( new InputSource( utf8_stream ) );
- utf8_stream.close();
-
- return ( doc );
- }
-
- /**
- * Converts a string containing an XML document into a {@link Document}.
- *
- * @param xmlString
- *
- * @return the W3C DOM document
- *
- * @throws ParserConfigurationException
- * @throws SAXException
- * @throws IOException
- */
- public static Document toDocument( String xmlString )
- throws ParserConfigurationException,
- SAXException,
- IOException
- {
- LOG.debug( MSG.getMessage( Keys.LOAD_XML_STRING, xmlString ) );
- return ( loadDocument( IoUtils.toInputStream( xmlString ) ) );
- }
-
- /**
- * Converts an XML {@link Node} into a string containing the corresponding XML. ***NOTE*** requires an XSLT
- * implementation (ie - Xalan) in the classpath at runtime
- *
- * @param node a DOM node
- *
- * @return String representation of the node
- *
- * @throws Exception
- */
- public static String toString( Node node )
- throws Exception
- {
- return ( toString( node, false ) );
- }
-
- /**
- * Converts an XML {@link Node} into a string containing the corresponding XML, optionally pretty-printed with
- * indenting and newlines. ***NOTE*** requires an XSLT implementation (ie - Xalan) in the classpath at runtime
- *
- * @param node a DOM node
- * @param indentOutput whether or not to indent the output XML
- *
- * @return String representation of the node
- *
- * @throws Exception
- */
- public static String toString( Node node,
- boolean indentOutput )
- throws Exception
- {
- /**
- * Due to a bug in the Transformer implementation we need to
- * synchronize access to the transform() method.
- */
- synchronized ( TRANSFORMER_LOCK )
- {
- TransformerFactory transformer_factory = (TransformerFactory) TRANSFORMER_FACTORIES.get();
- Transformer transformer = transformer_factory.newTransformer();
-
- if ( indentOutput )
- {
- transformer.setOutputProperty( TransformConstants.OUTPUT_PROP_INDENT, "yes" );
- transformer.setOutputProperty( TransformConstants.OUTPUT_PROP_INDENT_AMOUNT, INDENT_SPACES );
- }
-
- DOMSource dom_source = new DOMSource( node );
- ByteArrayOutputStream doc_stream = new ByteArrayOutputStream();
- StreamResult result = new StreamResult( doc_stream );
-
- transformer.transform( dom_source, result );
-
- return ( doc_stream.toString() );
- }
- }
+ /**
+ * DOCUMENT_ME
+ */
+ private static final Object TRANSFORMER_LOCK = new Object( );
+
+ /**
+ * DOCUMENT_ME
+ */
+ private static final String INDENT_SPACES = "2";
+
+ /**
+ * thread local that gives each thread its own TransformerFactory (since it is not thread-safe)
+ */
+ public static ThreadLocal TRANSFORMER_FACTORIES =
+ new ThreadLocal( )
+ {
+ protected synchronized Object initialValue( )
+ {
+ return TransformerFactory.newInstance( );
+ }
+ };
+
+ /**
+ * thread local that gives each thread its own DocumentBuilderFactory (since it is not thread-safe)
+ */
+ public static ThreadLocal DOCUMENT_BUILDER_FACTORIES =
+ new ThreadLocal( )
+ {
+ protected synchronized Object initialValue( )
+ {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance( );
+ dbf.setNamespaceAware( true );
+
+ return ( dbf );
+ }
+ };
+
+ /**
+ * Loads a DOM Document from an InputSource.
+ *
+ * @param in_source
+ *
+ * @return Document
+ *
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static Document loadDocument( InputSource in_source )
+ throws ParserConfigurationException,
+ SAXException,
+ IOException
+ {
+ DocumentBuilderFactory dbf = (DocumentBuilderFactory) DOCUMENT_BUILDER_FACTORIES.get( );
+ DocumentBuilder db = dbf.newDocumentBuilder( );
+
+ return ( db.parse( in_source ) );
+ }
+
+ /**
+ * Method to load a DOM Document from an InputStream.
+ *
+ * @param in_stream
+ *
+ * @return Document
+ *
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static Document loadDocument( InputStream in_stream )
+ throws ParserConfigurationException,
+ SAXException,
+ IOException
+ {
+ InputStreamReader utf8_stream = new InputStreamReader( in_stream, "UTF-8" );
+ Document doc = loadDocument( new InputSource( utf8_stream ) );
+ utf8_stream.close( );
+
+ return ( doc );
+ }
+
+ /**
+ * Converts a string containing an XML document into a {@link Document}.
+ *
+ * @param xmlString
+ *
+ * @return the W3C DOM document
+ *
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static Document toDocument( String xmlString )
+ throws ParserConfigurationException,
+ SAXException,
+ IOException
+ {
+ LOG.debug( MSG.getMessage( Keys.LOAD_XML_STRING, xmlString ) );
+ return ( loadDocument( IoUtils.toInputStream( xmlString ) ) );
+ }
+
+ /**
+ * Converts an XML {@link Node} into a string containing the corresponding XML. ***NOTE*** requires an XSLT
+ * implementation (ie - Xalan) in the classpath at runtime
+ *
+ * @param node a DOM node
+ *
+ * @return String representation of the node
+ *
+ * @throws Exception
+ */
+ public static String toString( Node node )
+ throws Exception
+ {
+ return ( toString( node, false ) );
+ }
+
+ /**
+ * Converts an XML {@link Node} into a string containing the corresponding XML, optionally pretty-printed with
+ * indenting and newlines. ***NOTE*** requires an XSLT implementation (ie - Xalan) in the classpath at runtime
+ *
+ * @param node a DOM node
+ * @param indentOutput whether or not to indent the output XML
+ *
+ * @return String representation of the node
+ *
+ * @throws Exception
+ */
+ public static String toString( Node node,
+ boolean indentOutput )
+ throws Exception
+ {
+ /**
+ * Due to a bug in the Transformer implementation we need to
+ * synchronize access to the transform() method.
+ */
+ synchronized ( TRANSFORMER_LOCK )
+ {
+ TransformerFactory transformer_factory = (TransformerFactory) TRANSFORMER_FACTORIES.get( );
+ Transformer transformer = transformer_factory.newTransformer( );
+
+ if ( indentOutput )
+ {
+ transformer.setOutputProperty( TransformConstants.OUTPUT_PROP_INDENT, "yes" );
+ transformer.setOutputProperty( TransformConstants.OUTPUT_PROP_INDENT_AMOUNT, INDENT_SPACES );
+ }
+
+ DOMSource dom_source = new DOMSource( node );
+ ByteArrayOutputStream doc_stream = new ByteArrayOutputStream( );
+ StreamResult result = new StreamResult( doc_stream );
+
+ transformer.transform( dom_source, result );
+
+ return ( doc_stream.toString( ) );
+ }
+ }
}
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/NameUtils.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/NameUtils.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/NameUtils.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/NameUtils.java Tue Aug 2 09:28:49 2005
@@ -20,7 +20,6 @@
import org.apache.ws.util.i18n.Keys;
import org.apache.ws.util.i18n.Messages;
import org.apache.ws.util.i18n.MessagesImpl;
-
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPException;
@@ -33,10 +32,11 @@
*/
public abstract class NameUtils
{
- private static final Log LOG = LogFactory.getLog( NameUtils.class );
- public static final Messages MSG = MessagesImpl.getInstance();
+ private static final Log LOG = LogFactory.getLog( NameUtils.class );
- private static Map s_namespace_to_prefix_map = new Hashtable( );
+ /** DOCUMENT_ME */
+ public static final Messages MSG = MessagesImpl.getInstance( );
+ private static Map s_namespace_to_prefix_map = new Hashtable( );
/**
* Builds a valid concise prefix for the specified namespace URI.
@@ -47,7 +47,7 @@
*/
public static String getNamespacePrefix( String nsURI )
{
- LOG.debug(MSG.getMessage( Keys.BLD_PREFIX_FOR_NAMESPC,nsURI));
+ LOG.debug( MSG.getMessage( Keys.BLD_PREFIX_FOR_NAMESPC, nsURI ) );
if ( nsURI == null )
{
return "";
@@ -78,7 +78,7 @@
{
start_index = prefix.lastIndexOf( ':' );
}
-
+
prefix = prefix.substring( start_index + 1 );
String newPrefix = prefix;
@@ -106,7 +106,7 @@
String uri )
throws SOAPException
{
- LOG.debug(MSG.getMessage( Keys.CREATING_NAME,localpart,prefix,uri));
+ LOG.debug( MSG.getMessage( Keys.CREATING_NAME, localpart, prefix, uri ) );
return ( SOAPFactory.newInstance( ).createName( localpart, prefix, uri ) );
}
@@ -120,7 +120,8 @@
public static Name toName( QName qname )
throws SOAPException
{
- LOG.debug(MSG.getMessage( Keys.CONVRT_QNAME_TO_NAME,qname.toString()));
+ LOG.debug( MSG.getMessage( Keys.CONVRT_QNAME_TO_NAME,
+ qname.toString( ) ) );
return createName( qname.getLocalPart( ),
qname.getPrefix( ),
qname.getNamespaceURI( ) );
@@ -135,7 +136,8 @@
*/
public static QName toQName( Name name )
{
- LOG.debug(MSG.getMessage( Keys.CONVRT_NAME_TO_QNAME,name.getQualifiedName()));
+ LOG.debug( MSG.getMessage( Keys.CONVRT_NAME_TO_QNAME,
+ name.getQualifiedName( ) ) );
return ( name != null ) ? new QName( name.getURI( ),
name.getLocalName( ) ) : null;
}
Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/OperationInfo.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/OperationInfo.java?rev=227033&r1=227032&r2=227033&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/OperationInfo.java (original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/OperationInfo.java Tue Aug 2 09:28:49 2005
@@ -1,182 +1,239 @@
-/*=============================================================================*
- * Copyright 2004 The Apache Software Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *=============================================================================*/
-package org.apache.ws.util;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.ws.resource.tool.GenerationUtils;
-
-import javax.wsdl.Input;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.Fault;
-import javax.xml.namespace.QName;
-import java.util.Map;
-import java.util.Iterator;
-
-/**
- * The Java method signature info for a WSDL operation.
- *
- * @author Ian Springer (ian DOT springer AT hp DOT com)
- */
-public class OperationInfo
-{
-
- private String m_methodName;
- private String m_methodSig;
- private QName m_requestElemName;
- private Map m_faults;
- private String m_fullyQualifiedResponseClassName;
- private String m_fullyQualifiedRequestClassName;
-
- public OperationInfo(Operation op, String targetNamespace)
- {
- m_methodName = StringUtils.uncapitalize( op.getName() );
- Input input = op.getInput();
- if ( input != null )
- {
- Map inputParts = input.getMessage().getParts();
- if ( inputParts.size() > 1 )
- {
- throw new RuntimeException( "WSDL input message named " + input.getMessage().getQName() + " has more than one part - input messages must have at most one part." );
- }
- if ( inputParts.size() == 1 )
- {
- Part inputPart = (Part) inputParts.values().iterator().next();
- m_requestElemName = inputPart.getElementName();
- m_fullyQualifiedRequestClassName = XmlBeanNameUtils.getDocumentElementXmlBeanClassName( m_requestElemName );
- }
- else // no input parts
- {
- m_fullyQualifiedRequestClassName = "";
- }
- }
- else
- {
- m_fullyQualifiedRequestClassName = "";
- }
- Output output = op.getOutput();
- if ( output != null )
- {
- Map outputParts = output.getMessage().getParts();
- if ( outputParts.size() > 1 )
- {
- throw new RuntimeException( "WSDL output message named " + input.getMessage().getQName() + " has more than one part - output messages must have at most one part." );
- }
- if ( outputParts.size() == 1)
- {
- Part outputPart = (Part) outputParts.values().iterator().next();
- m_fullyQualifiedResponseClassName = XmlBeanNameUtils.getDocumentElementXmlBeanClassName( outputPart.getElementName() );
- }
- else // no output parts
- {
- m_fullyQualifiedResponseClassName = "void";
- }
- }
- else // no output
- {
- m_fullyQualifiedResponseClassName = "void";
- }
- m_methodSig = m_fullyQualifiedResponseClassName + " " + m_methodName + "( " + m_fullyQualifiedRequestClassName + " requestDoc )";
-
- //add faults to signature....
- m_faults = op.getFaults();
- if(!m_faults.isEmpty())
- {
- m_methodSig += " throws ";
- Iterator iterator = m_faults.keySet().iterator();
- while (iterator.hasNext())
- {
- String faultName = (String) iterator.next();
- Fault fault = (Fault) m_faults.get(faultName);
- Part part = (Part) fault.getMessage().getParts().values().iterator().next();
- String javaPackageName = GenerationUtils.getJavaPackageName( targetNamespace );
- if(part.getElementName() == null)
- {
- //its a type..get the name of the type
- faultName = part.getTypeName().getLocalPart();
- }
- faultName = javaPackageName + "." + faultName + "Exception";
- m_methodSig += faultName;
- if(iterator.hasNext())
- {
- m_methodSig += ", ";
- }
- }
- }
- }
-
- public String getJavaMethodName()
- {
- return m_methodName;
- }
-
- public String getJavaMethodSignature()
- {
- return m_methodSig;
- }
-
- public QName getRequestElementName()
- {
- return m_requestElemName;
- }
-
- public Map getFaults()
- {
- return m_faults;
- }
-
- public String getFullyQualifiedResponseClassName()
- {
- return m_fullyQualifiedResponseClassName;
- }
-
- public String getFullyQualifiedRequestClassName()
- {
- return m_fullyQualifiedRequestClassName;
- }
-
- /**
- * Returns the class name without the package
- *
- * @return Class name without the package
- */
- public String getUnqualifiedResponseClassName()
- {
- return m_fullyQualifiedResponseClassName.substring(m_fullyQualifiedResponseClassName.lastIndexOf(".") + 1);
- }
-
- /**
- * Returns the class name without the package
- *
- * @return class name without the package
- */
- public String getUnqualifiedRequestClassName()
- {
- return m_fullyQualifiedRequestClassName.substring(m_fullyQualifiedRequestClassName.lastIndexOf(".") + 1);
- }
-
- public String getUnqualifiedResponseTypeName()
- {
- return getUnqualifiedResponseClassName().substring(0, getUnqualifiedResponseClassName().lastIndexOf("Document"));
- }
-
- public String getUnqualifiedRequestTypeName()
- {
- return getUnqualifiedRequestClassName().substring(0, getUnqualifiedRequestClassName().lastIndexOf("Document"));
- }
-
-}
+/*=============================================================================*
+ * Copyright 2004 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.util;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.ws.resource.tool.GenerationUtils;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * The Java method signature info for a WSDL operation.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class OperationInfo
+{
+ private String m_methodName;
+ private String m_methodSig;
+ private QName m_requestElemName;
+ private Map m_faults;
+ private String m_fullyQualifiedResponseClassName;
+ private String m_fullyQualifiedRequestClassName;
+
+ /**
+ * Creates a new {@link OperationInfo} object.
+ *
+ * @param op DOCUMENT_ME
+ * @param targetNamespace DOCUMENT_ME
+ */
+ public OperationInfo( Operation op,
+ String targetNamespace )
+ {
+ m_methodName = StringUtils.uncapitalize( op.getName( ) );
+ Input input = op.getInput( );
+ if ( input != null )
+ {
+ Map inputParts = input.getMessage( ).getParts( );
+ if ( inputParts.size( ) > 1 )
+ {
+ throw new RuntimeException( "WSDL input message named " + input.getMessage( ).getQName( )
+ + " has more than one part - input messages must have at most one part." );
+ }
+
+ if ( inputParts.size( ) == 1 )
+ {
+ Part inputPart = (Part) inputParts.values( ).iterator( ).next( );
+ m_requestElemName = inputPart.getElementName( );
+ m_fullyQualifiedRequestClassName =
+ XmlBeanNameUtils.getDocumentElementXmlBeanClassName( m_requestElemName );
+ }
+ else // no input parts
+ {
+ m_fullyQualifiedRequestClassName = "";
+ }
+ }
+ else
+ {
+ m_fullyQualifiedRequestClassName = "";
+ }
+
+ Output output = op.getOutput( );
+ if ( output != null )
+ {
+ Map outputParts = output.getMessage( ).getParts( );
+ if ( outputParts.size( ) > 1 )
+ {
+ throw new RuntimeException( "WSDL output message named " + input.getMessage( ).getQName( )
+ + " has more than one part - output messages must have at most one part." );
+ }
+
+ if ( outputParts.size( ) == 1 )
+ {
+ Part outputPart = (Part) outputParts.values( ).iterator( ).next( );
+ m_fullyQualifiedResponseClassName =
+ XmlBeanNameUtils.getDocumentElementXmlBeanClassName( outputPart.getElementName( ) );
+ }
+ else // no output parts
+ {
+ m_fullyQualifiedResponseClassName = "void";
+ }
+ }
+ else // no output
+ {
+ m_fullyQualifiedResponseClassName = "void";
+ }
+
+ m_methodSig =
+ m_fullyQualifiedResponseClassName + " " + m_methodName + "( " + m_fullyQualifiedRequestClassName
+ + " requestDoc )";
+
+ //add faults to signature....
+ m_faults = op.getFaults( );
+ if ( !m_faults.isEmpty( ) )
+ {
+ m_methodSig += " throws ";
+ Iterator iterator = m_faults.keySet( ).iterator( );
+ while ( iterator.hasNext( ) )
+ {
+ String faultName = (String) iterator.next( );
+ Fault fault = (Fault) m_faults.get( faultName );
+ Part part = (Part) fault.getMessage( ).getParts( ).values( ).iterator( ).next( );
+ String javaPackageName = GenerationUtils.getJavaPackageName( targetNamespace );
+ if ( part.getElementName( ) == null )
+ {
+ //its a type..get the name of the type
+ faultName = part.getTypeName( ).getLocalPart( );
+ }
+
+ faultName = javaPackageName + "." + faultName + "Exception";
+ m_methodSig += faultName;
+ if ( iterator.hasNext( ) )
+ {
+ m_methodSig += ", ";
+ }
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Map getFaults( )
+ {
+ return m_faults;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getFullyQualifiedRequestClassName( )
+ {
+ return m_fullyQualifiedRequestClassName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getFullyQualifiedResponseClassName( )
+ {
+ return m_fullyQualifiedResponseClassName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getJavaMethodName( )
+ {
+ return m_methodName;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getJavaMethodSignature( )
+ {
+ return m_methodSig;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getRequestElementName( )
+ {
+ return m_requestElemName;
+ }
+
+ /**
+ * Returns the class name without the package
+ *
+ * @return class name without the package
+ */
+ public String getUnqualifiedRequestClassName( )
+ {
+ return m_fullyQualifiedRequestClassName.substring( m_fullyQualifiedRequestClassName.lastIndexOf( "." ) + 1 );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getUnqualifiedRequestTypeName( )
+ {
+ return getUnqualifiedRequestClassName( ).substring( 0,
+ getUnqualifiedRequestClassName( ).lastIndexOf( "Document" ) );
+ }
+
+ /**
+ * Returns the class name without the package
+ *
+ * @return Class name without the package
+ */
+ public String getUnqualifiedResponseClassName( )
+ {
+ return m_fullyQualifiedResponseClassName.substring( m_fullyQualifiedResponseClassName.lastIndexOf( "." ) + 1 );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getUnqualifiedResponseTypeName( )
+ {
+ return getUnqualifiedResponseClassName( ).substring( 0,
+ getUnqualifiedResponseClassName( ).lastIndexOf( "Document" ) );
+ }
+}
\ No newline at end of file