ws-wsrf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r326147 - in /webservices/wsrf/trunk/src: java/org/apache/ws/resource/tool/Wsdl2Java.java java/org/apache/ws/resource/tool/velocity/ServiceProperties.java java/org/apache/ws/util/spring/SpringBeansXmlMergeTask.java templates/wsrf-config.xml.vm
Date Tue, 18 Oct 2005 16:51:32 GMT
Author: ips
Date: Tue Oct 18 09:51:24 2005
New Revision: 326147

URL: http://svn.apache.org/viewcvs?rev=326147&view=rev
Log:
codegen stuff

Modified:
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/Wsdl2Java.java
    webservices/wsrf/trunk/src/java/org/apache/ws/resource/tool/velocity/ServiceProperties.java
    webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/SpringBeansXmlMergeTask.java
    webservices/wsrf/trunk/src/templates/wsrf-config.xml.vm

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=326147&r1=326146&r2=326147&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 Tue Oct 18
09:51:24 2005
@@ -316,8 +316,8 @@
             String propName = getJavaConstantName( propertyName, propMap );
             propMap.put( propName, propertyName );
          }
-
          props.setPropertyMap( propMap );
+         props.setCustomPropertyNames( resourceDef.getCustomPropertyNames() );
       }
 
       // define the names of the resource props that we initialize for the user...

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=326147&r1=326146&r2=326147&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 Oct 18 09:51:24 2005
@@ -34,51 +34,38 @@
 
    private static final String NAMESPACE_SET_CONSTANT_NAME = "SPEC_NAMESPACE_SET";
 
-   /** DOCUMENT_ME */
-   String m_packageName;
+   private String m_packageName;
 
-   /** DOCUMENT_ME */
-   String m_serviceName;
+   private String m_serviceName;
 
-   /** DOCUMENT_ME */
-   String m_serviceImplements;
+   private String m_serviceImplements;
 
-   /** DOCUMENT_ME */
-   String m_namespace;
+   private String m_namespace;
 
-   /** DOCUMENT_ME */
-   String m_prefix;
+   private String m_prefix;
 
-   /** DOCUMENT_ME */
-   Map m_customMappings;
+   private Map m_customMappings;
 
-   /** DOCUMENT_ME */
-   Map m_propertyMap;
+   private QName[] m_customPropNames;
 
-   /** DOCUMENT_ME */
-   String m_resourceImplements;
+   private Map m_propertyMap;
 
-   /** DOCUMENT_ME */
-   String m_propertyDocumentName;
+   private String m_resourceImplements;
 
-   /** DOCUMENT_ME */
-   String m_wsdlName;
+   private String m_propertyDocumentName;
 
-   /** DOCUMENT_ME */
-   QName m_resourcekey;
+   private String m_wsdlName;
 
-   /** DOCUMENT_ME */
-   List m_resourceIncludes = new ArrayList(  );
+   private QName m_resourcekey;
 
-   /** DOCUMENT_ME */
-   List m_serviceIncludes = new ArrayList(  );
+   private List m_resourceIncludes = new ArrayList(  );
 
-   /** DOCUMENT_ME */
-   List m_resourceInitIncludes = new ArrayList(  );
+   private List m_serviceIncludes = new ArrayList(  );
 
-   /** DOCUMENT_ME */
-   List                       m_abstractResourceInitIncludes    = new ArrayList(  );
-   List                       m_springBeanDefIncludeLocations   = new ArrayList(  );
+   private List m_resourceInitIncludes = new ArrayList(  );
+
+   private List                       m_abstractResourceInitIncludes    = new ArrayList(
 );
+   private List                       m_springBeanDefIncludeLocations   = new ArrayList(
 );
    private boolean            m_hasProperties;
    private String             m_endpointServiceName;
    private String             m_endpointURL;
@@ -106,6 +93,16 @@
     public ServiceProperties( ResourceDefinition resourceDef )
     {
        m_resourceDef = resourceDef;
+    }
+
+    public QName[] getCustomPropertyNames()
+    {
+        return m_customPropNames;
+    }
+
+    public void setCustomPropertyNames( QName[] customPropNames )
+    {
+        m_customPropNames = customPropNames;
     }
 
     public List getSpringBeanDefIncludeLocations()

Modified: webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/SpringBeansXmlMergeTask.java
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/SpringBeansXmlMergeTask.java?rev=326147&r1=326146&r2=326147&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/SpringBeansXmlMergeTask.java
(original)
+++ webservices/wsrf/trunk/src/java/org/apache/ws/util/spring/SpringBeansXmlMergeTask.java
Tue Oct 18 09:51:24 2005
@@ -36,7 +36,9 @@
 import java.io.FileOutputStream;
 import java.io.StringWriter;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 /**
  * An Ant task that merges one or more source spring-beans.xml's into a target spring-beans.xml.
@@ -53,7 +55,7 @@
     }
 
     /**
-     * Adds the specified file to the list of source web.xml's.
+     * Adds the specified file to the list of source spring-beans.xml's.
      *
      * @param srcFile
      */
@@ -63,7 +65,7 @@
     }
 
     /**
-     * Adds the files in the specified fileset to the list of source web.xml's.
+     * Adds the files in the specified fileset to the list of source spring-beans.xml's.
      *
      * @param fileSet DOCUMENT_ME
      */
@@ -79,7 +81,7 @@
     }
 
     /**
-     * Sets the target web.xml (i.e. the web.xml to be merged into).
+     * Sets the target spring-beans.xml (i.e. the spring-beans.xml to be merged into).
      *
      * @param targetFile
      */
@@ -147,8 +149,15 @@
             Node importedSrcBeanElem = targetBeansElem.getOwnerDocument().importNode( srcBeanElem,
true );
             if ( existingBeanElem != null )
             {
-                System.out.println( "Replacing existing bean element with id '" + srcBeanId
+ "' ..." );
-                targetBeansElem.replaceChild( importedSrcBeanElem, existingBeanElem );
+                if ( srcBeanId.equals( "TopicNamespaceRegistry" ) )
+                {
+                    updateTopicNamespaceRegistryBeanDef( srcBeanElem, existingBeanElem );
+                }
+                else
+                {
+                    System.out.println( "Replacing existing bean element with id '" + srcBeanId
+ "' ..." );
+                    targetBeansElem.replaceChild( importedSrcBeanElem, existingBeanElem );
+                }
             }
             else
             {
@@ -158,6 +167,59 @@
         }
     }
 
+    private void updateTopicNamespaceRegistryBeanDef( Element srcBeanElem, Element existingBeanElem
)
+    {
+        System.out.println( "Merging topic namespace values into existing TopicNamespaceRegistry
bean definition..." );
+        Element srcSetElem = getTopicNamespaceSetElem( srcBeanElem );
+        Element[] srcValueElems = getChildElementsByTagName( srcSetElem, "value" );
+        Element targetSetElem = getTopicNamespaceSetElem( existingBeanElem );
+        Element[] existingValueElems = getChildElementsByTagName( targetSetElem, "value"
);
+        Set existingValues = new HashSet();
+        for ( int j = 0; j < existingValueElems.length; j++ )
+        {
+            existingValues.add( getTextValue( existingValueElems[j] ) );
+        }
+        for ( int j = 0; j < srcValueElems.length; j++ )
+        {
+            Element srcValueElem = srcValueElems[j];
+            if ( ! existingValues.contains( getTextValue( srcValueElem ) ) )
+            {
+                Node importedSrcValueElem = targetSetElem.getOwnerDocument().importNode(
srcValueElem, true );
+                targetSetElem.appendChild( importedSrcValueElem );
+            }
+        }
+    }
+
+    private String getTextValue( Element elem )
+    {
+        String textValue = null;
+        NodeList childNodes = elem.getChildNodes();
+        if ( childNodes.getLength() == 1 )
+        {
+            Node node = childNodes.item( 0 );
+            if ( node.getNodeType() == Node.TEXT_NODE )
+            {
+                textValue = node.getNodeValue();
+            }
+        }
+        return textValue;
+    }
+
+    private Element getTopicNamespaceSetElem( Element targetBeansElem )
+    {
+        Element setElem = null;
+        Element[] constructorArgElems = getChildElementsByTagName( targetBeansElem, "constructor-arg"
);
+        if ( constructorArgElems.length == 1 )
+        {
+            Element[] setElems = getChildElementsByTagName( constructorArgElems[0], "set"
);
+            if ( setElems.length == 1 )
+            {
+                setElem = setElems[0];
+            }
+        }
+        return setElem;
+    }
+
     private Element getBeanElementById( Element beansElem, String beanId )
     {
         if ( beanId == null )
@@ -207,21 +269,22 @@
         return ! value.equals( "" ) ? value : null;
     }
 
-   private static String toString( Node node )
-   throws Exception
-   {
-         TransformerFactory transformerFactory = TransformerFactory.newInstance();
-         Transformer        transformer = transformerFactory.newTransformer();
-         transformer.setOutputProperty( OutputKeys.DOCTYPE_PUBLIC, "-//SPRING//DTD BEAN//EN");
-         transformer.setOutputProperty( OutputKeys.DOCTYPE_SYSTEM, "http://www.springframework.org/dtd/spring-beans.dtd");
-         transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
-         transformer.setOutputProperty( XalanOutputKeys.OUTPUT_PROP_INDENT_AMOUNT, "2" );
-         DOMSource             domSource    = new DOMSource( node );
-         StringWriter          stringWriter = new StringWriter(  );
-         StreamResult          result       = new StreamResult( stringWriter );
-         transformer.transform( domSource, result );
-         return ( stringWriter.toString(  ) );
-   }
+    private static String toString( Node node )
+            throws Exception
+    {
+        TransformerFactory transformerFactory = TransformerFactory.newInstance();
+        Transformer transformer = transformerFactory.newTransformer();
+        transformer.setOutputProperty( OutputKeys.DOCTYPE_PUBLIC, "-//SPRING//DTD BEAN//EN"
);
+        transformer
+                .setOutputProperty( OutputKeys.DOCTYPE_SYSTEM, "http://www.springframework.org/dtd/spring-beans.dtd"
);
+        transformer.setOutputProperty( OutputKeys.INDENT, "yes" );
+        transformer.setOutputProperty( XalanOutputKeys.OUTPUT_PROP_INDENT_AMOUNT, "2" );
+        DOMSource domSource = new DOMSource( node );
+        StringWriter stringWriter = new StringWriter();
+        StreamResult result = new StreamResult( stringWriter );
+        transformer.transform( domSource, result );
+        return ( stringWriter.toString() );
+    }
 
     private void initContextClassLoader()
     {

Modified: webservices/wsrf/trunk/src/templates/wsrf-config.xml.vm
URL: http://svn.apache.org/viewcvs/webservices/wsrf/trunk/src/templates/wsrf-config.xml.vm?rev=326147&r1=326146&r2=326147&view=diff
==============================================================================
--- webservices/wsrf/trunk/src/templates/wsrf-config.xml.vm (original)
+++ webservices/wsrf/trunk/src/templates/wsrf-config.xml.vm Tue Oct 18 09:51:24 2005
@@ -8,7 +8,7 @@
 
 <beans>
 
-  <bean name="${serviceName}Home" class="${package}.${serviceName}Home" init-method="init">
+  <bean id="${serviceName}Home" class="${package}.${serviceName}Home" init-method="init">
     <property name="portComponentName"><value>${endpointServiceName}</value></property>
     <property name="serviceClass"><value>${package}.${serviceName}Service</value></property>
     <property name="resourceClass"><value>${package}.${serviceName}Resource</value></property>



Mime
View raw message