You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/02/16 00:46:12 UTC

svn commit: r1071108 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/common/util/ rt/bindings/corba/src/main/resources/META-INF/cxf/ rt/bindings/xml/src/main/resources/META-INF/cxf/ rt/core/src/main/java/org/apache/cxf/wsdl11/ rt/transports...

Author: dkulp
Date: Tue Feb 15 23:46:11 2011
New Revision: 1071108

URL: http://svn.apache.org/viewvc?rev=1071108&view=rev
Log:
Change from using XML to straight text files for wsdl extensions.
Much faster for startup.

Added:
    cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/wsdl-extensions.txt   (with props)
    cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/wsdl-extensions.txt   (with props)
    cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/wsdl-extensions.txt   (with props)
    cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/wsdl-extensions.txt   (with props)
    cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/wsdl-extensions.txt   (with props)
    cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/wsdl-extensions.txt   (with props)
Removed:
    cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/extensions.xml
    cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/extensions.xml
    cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/extensions.xml
    cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/extensions.xml
    cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/extensions.xml
    cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/extensions.xml
Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PropertiesLoaderUtils.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PropertiesLoaderUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PropertiesLoaderUtils.java?rev=1071108&r1=1071107&r2=1071108&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PropertiesLoaderUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/PropertiesLoaderUtils.java Tue Feb 15 23:46:11 2011
@@ -27,6 +27,8 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Enumeration;
 import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * Replace by org.springframework.core.io.support.PropertiesLoaderUtils
@@ -57,14 +59,20 @@ public final class PropertiesLoaderUtils
      */
     public static Properties loadAllProperties(String resourceName, ClassLoader classLoader)
         throws IOException {
-
-        
+        return loadAllProperties(resourceName, classLoader, null, null, null);
+    }        
+    public static Properties loadAllProperties(String resourceName, ClassLoader classLoader,
+                                               Logger logger, Level level, String msg)
+        throws IOException {
         Properties properties = new Properties();
         Enumeration<URL> urls = classLoader.getResources(resourceName);
 
         while (urls.hasMoreElements()) {
             URL url = urls.nextElement();
-            // TODO: May need a log here, instead of the system.out
+            if (logger != null) {
+                logger.log(level, msg, url.toString());
+            }
+            
             InputStream is = null;
             try {
                 is = url.openStream();

Added: cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/wsdl-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/wsdl-extensions.txt?rev=1071108&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/wsdl-extensions.txt (added)
+++ cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/wsdl-extensions.txt Tue Feb 15 23:46:11 2011
@@ -0,0 +1,21 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements. See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership. The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License. You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+# 
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied. See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+javax.wsdl.Binding=org.apache.cxf.binding.corba.wsdl.BindingType
+javax.wsdl.BindingOperation=org.apache.cxf.binding.corba.wsdl.OperationType
+javax.wsdl.Definition=org.apache.cxf.binding.corba.wsdl.TypeMappingType
+javax.wsdl.Port=org.apache.cxf.binding.corba.wsdl.AddressType
+javax.wsdl.Port=org.apache.cxf.binding.corba.wsdl.PolicyType

Propchange: cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/wsdl-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/wsdl-extensions.txt?rev=1071108&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/wsdl-extensions.txt (added)
+++ cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/wsdl-extensions.txt Tue Feb 15 23:46:11 2011
@@ -0,0 +1,20 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements. See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership. The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License. You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+# 
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied. See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+javax.wsdl.BindingInput=org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
+javax.wsdl.BindingOutput=org.apache.cxf.bindings.xformat.XMLBindingMessageFormat
+javax.wsdl.Binding=org.apache.cxf.bindings.xformat.XMLFormatBinding
+

Propchange: cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java?rev=1071108&r1=1071107&r2=1071108&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLManagerImpl.java Tue Feb 15 23:46:11 2011
@@ -19,7 +19,9 @@
 
 package org.apache.cxf.wsdl11;
 
+import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -54,10 +56,12 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
 import org.apache.cxf.catalog.CatalogWSDLLocator;
 import org.apache.cxf.common.WSDLConstants;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.CacheMap;
 import org.apache.cxf.common.util.PropertiesLoaderUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.ConfiguredBeanLocator;
 import org.apache.cxf.service.model.ServiceSchemaInfo;
 import org.apache.cxf.staxutils.StaxUtils;
@@ -75,7 +79,8 @@ public class WSDLManagerImpl implements 
 
     private static final Logger LOG = LogUtils.getL7dLogger(WSDLManagerImpl.class);
 
-    private static final String EXTENSIONS_RESOURCE = "META-INF/cxf/extensions.xml";
+    private static final String EXTENSIONS_RESOURCE = "META-INF/cxf/wsdl-extensions.txt";
+    private static final String EXTENSIONS_RESOURCE_XML = "META-INF/cxf/extensions.xml";
     private static final String EXTENSIONS_RESOURCE_COMPAT = "META-INF/extensions.xml";
 
     final ExtensionRegistry registry;
@@ -246,15 +251,51 @@ public class WSDLManagerImpl implements 
     }
 
     private void registerInitialExtensions() throws BusException {
-        registerInitialExtensions(EXTENSIONS_RESOURCE_COMPAT);
+        registerInitialXmlExtensions(EXTENSIONS_RESOURCE_COMPAT);
+        registerInitialXmlExtensions(EXTENSIONS_RESOURCE_XML);
         registerInitialExtensions(EXTENSIONS_RESOURCE);
     }
     private void registerInitialExtensions(String resource) throws BusException {
+        try {
+            for (URL url : ClassLoaderUtils.getResources(resource, this.getClass())) {
+                BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "utf-8"));
+                String line = reader.readLine();
+                while (line != null) {
+                    line = line.trim();
+                    if (!line.startsWith("#")
+                        && !StringUtils.isEmpty(line)) {
+                        try {
+                            int idx = line.indexOf('=');
+                            String parentType = line.substring(0, idx);
+                            String elementType = line.substring(idx + 1);
+                            if (LOG.isLoggable(Level.FINE)) {
+                                LOG.fine("Registering extension: " + elementType 
+                                         + " for parent: " + parentType);
+                            }
+                            JAXBExtensionHelper.addExtensions(registry, parentType, elementType);
+                        } catch (ClassNotFoundException ex) {
+                            LOG.log(Level.WARNING, "EXTENSION_ADD_FAILED_MSG", ex);
+                        } catch (JAXBException ex) {
+                            LOG.log(Level.WARNING, "EXTENSION_ADD_FAILED_MSG", ex);
+                        }
+                    }
+                    line = reader.readLine();
+                }
+                reader.close();
+            }
+        } catch (IOException ex) {
+            throw new BusException(ex);
+        }
+    }
+    private void registerInitialXmlExtensions(String resource) throws BusException {
         Properties initialExtensions = null;
         try {
             initialExtensions = PropertiesLoaderUtils.loadAllProperties(resource, 
                                                                         Thread.currentThread()
-                                                                              .getContextClassLoader());
+                                                                              .getContextClassLoader(),
+                                                                        LOG,
+                                                                        Level.WARNING,
+                                                                        "Use of {0} is deprecated.");
         } catch (IOException ex) {
             throw new BusException(ex);
         }

Added: cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/wsdl-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/wsdl-extensions.txt?rev=1071108&view=auto
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/wsdl-extensions.txt (added)
+++ cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/wsdl-extensions.txt Tue Feb 15 23:46:11 2011
@@ -0,0 +1,20 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements. See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership. The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License. You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+# 
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied. See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+javax.wsdl.Port=org.apache.cxf.transports.http.configuration.HTTPClientPolicy
+javax.wsdl.Port=org.apache.cxf.transports.http.configuration.HTTPServerPolicy
+javax.wsdl.Port=org.apache.cxf.wsdl.http.AddressType
+

Propchange: cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/wsdl-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/wsdl-extensions.txt?rev=1071108&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/wsdl-extensions.txt (added)
+++ cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/wsdl-extensions.txt Tue Feb 15 23:46:11 2011
@@ -0,0 +1,17 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements. See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership. The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License. You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+# 
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied. See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+javax.wsdl.Port=org.apache.cxf.transports.jbi.AddressType

Propchange: cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jbi/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/wsdl-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/wsdl-extensions.txt?rev=1071108&view=auto
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/wsdl-extensions.txt (added)
+++ cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/wsdl-extensions.txt Tue Feb 15 23:46:11 2011
@@ -0,0 +1,50 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements. See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership. The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License. You may obtain a copy of the License at
+# 
+#  http://www.apache.org/licenses/LICENSE-2.0
+# 
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied. See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+javax.wsdl.Port=org.apache.cxf.transport.jms.AddressType
+javax.wsdl.Port=org.apache.cxf.transport.jms.ClientBehaviorPolicyType
+javax.wsdl.Port=org.apache.cxf.transport.jms.ServerBehaviorPolicyType
+javax.wsdl.Port=org.apache.cxf.transport.jms.ClientConfig
+javax.wsdl.Port=org.apache.cxf.transport.jms.ServerConfig
+javax.wsdl.Port=org.apache.cxf.transport.jms.SessionPoolType
+
+javax.wsdl.Binding=org.apache.cxf.transport.jms.wsdl.JndiContextParameterType
+javax.wsdl.Binding=org.apache.cxf.transport.jms.wsdl.JndiConnectionFactoryNameType
+javax.wsdl.Binding=org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType
+javax.wsdl.Binding=org.apache.cxf.transport.jms.wsdl.JndiURLType
+javax.wsdl.Binding=org.apache.cxf.transport.jms.wsdl.DeliveryModeType
+javax.wsdl.Binding=org.apache.cxf.transport.jms.wsdl.PriorityType
+javax.wsdl.Binding=org.apache.cxf.transport.jms.wsdl.TimeToLiveType
+javax.wsdl.Binding=org.apache.cxf.transport.jms.wsdl.ReplyToNameType
+
+javax.wsdl.Port=org.apache.cxf.transport.jms.wsdl.JndiContextParameterType
+javax.wsdl.Port=org.apache.cxf.transport.jms.wsdl.JndiConnectionFactoryNameType
+javax.wsdl.Port=org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType
+javax.wsdl.Port=org.apache.cxf.transport.jms.wsdl.JndiURLType
+javax.wsdl.Port=org.apache.cxf.transport.jms.wsdl.DeliveryModeType
+javax.wsdl.Port=org.apache.cxf.transport.jms.wsdl.PriorityType
+javax.wsdl.Port=org.apache.cxf.transport.jms.wsdl.TimeToLiveType
+javax.wsdl.Port=org.apache.cxf.transport.jms.wsdl.ReplyToNameType
+    
+javax.wsdl.Service=org.apache.cxf.transport.jms.wsdl.JndiContextParameterType
+javax.wsdl.Service=org.apache.cxf.transport.jms.wsdl.JndiConnectionFactoryNameType
+javax.wsdl.Service=org.apache.cxf.transport.jms.wsdl.JndiInitialContextFactoryType
+javax.wsdl.Service=org.apache.cxf.transport.jms.wsdl.JndiURLType
+javax.wsdl.Service=org.apache.cxf.transport.jms.wsdl.DeliveryModeType
+javax.wsdl.Service=org.apache.cxf.transport.jms.wsdl.PriorityType
+javax.wsdl.Service=org.apache.cxf.transport.jms.wsdl.TimeToLiveType
+javax.wsdl.Service=org.apache.cxf.transport.jms.wsdl.ReplyToNameType
+

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/transports/jms/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/wsdl-extensions.txt
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/wsdl-extensions.txt?rev=1071108&view=auto
==============================================================================
--- cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/wsdl-extensions.txt (added)
+++ cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/wsdl-extensions.txt Tue Feb 15 23:46:11 2011
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+javax.wsdl.Binding=org.apache.cxf.ws.addressing.wsdl.UsingAddressing

Propchange: cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/rt/ws/addr/src/main/resources/META-INF/cxf/wsdl-extensions.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain