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

svn commit: r1182455 - in /cxf/trunk/services/wsn: wsn-core/src/main/java/org/apache/cxf/wsn/ wsn-core/src/main/java/org/apache/cxf/wsn/util/ wsn-osgi/ wsn-osgi/src/main/java/ wsn-osgi/src/main/java/org/ wsn-osgi/src/main/java/org/apache/ wsn-osgi/src/...

Author: gnodet
Date: Wed Oct 12 16:02:38 2011
New Revision: 1182455

URL: http://svn.apache.org/viewvc?rev=1182455&view=rev
Log:
Minimize dependencies for OSGi

Added:
    cxf/trunk/services/wsn/wsn-osgi/src/main/java/
    cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/
    cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/
    cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/cxf/
    cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/cxf/common/
    cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/cxf/common/logging/
    cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/cxf/common/logging/LogUtils.java
Modified:
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
    cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java
    cxf/trunk/services/wsn/wsn-osgi/pom.xml

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java?rev=1182455&r1=1182454&r2=1182455&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/AbstractCreatePullPoint.java Wed Oct 12 16:02:38 2011
@@ -18,7 +18,6 @@
  */
 package org.apache.cxf.wsn;
 
-import java.util.Iterator;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Level;
@@ -29,10 +28,7 @@ import javax.jws.WebParam;
 import javax.jws.WebResult;
 import javax.jws.WebService;
 
-import org.w3c.dom.Element;
-
 import org.apache.cxf.common.logging.LogUtils;
-import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.wsn.util.IdGenerator;
 import org.oasis_open.docs.wsn.b_2.CreatePullPointResponse;
 import org.oasis_open.docs.wsn.b_2.UnableToCreatePullPointFaultType;
@@ -113,20 +109,7 @@ public abstract class AbstractCreatePull
     }
 
     protected String createPullPointName(org.oasis_open.docs.wsn.b_2.CreatePullPoint createPullPointRequest) {
-        // Let the creator decide which pull point name to use
-        String name = null;
-        for (Iterator it = createPullPointRequest.getAny().iterator(); it.hasNext();) {
-            Element el = (Element) it.next();
-            if ("name".equals(el.getLocalName())
-                    && "http://cxf.apache.org/wsn2005/1.0".equals(el.getNamespaceURI())) {
-                name = DOMUtils.getContent(el).trim();
-            }
-        }
-        if (name == null) {
-            // If no name is given, just generate one
-            name = idGenerator.generateSanitizedId();
-        }
-        return name;
+        return idGenerator.generateSanitizedId();
     }
 
     public void destroyPullPoint(String address) throws UnableToDestroyPullPointFault {

Modified: cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java?rev=1182455&r1=1182454&r2=1182455&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java (original)
+++ cxf/trunk/services/wsn/wsn-core/src/main/java/org/apache/cxf/wsn/util/IdGenerator.java Wed Oct 12 16:02:38 2011
@@ -21,9 +21,10 @@ package org.apache.cxf.wsn.util;
 
 import java.net.InetAddress;
 import java.net.ServerSocket;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.common.logging.LogUtils;
 
 /**
  * Generator for Globally unique Strings.
@@ -31,7 +32,7 @@ import org.apache.commons.logging.LogFac
 
 public class IdGenerator {
 
-    private static final Log LOG = LogFactory.getLog(IdGenerator.class);
+    private static final Logger LOGGER = LogUtils.getL7dLogger(IdGenerator.class);
 
     private static final String UNIQUE_STUB;
 
@@ -79,7 +80,7 @@ public class IdGenerator {
                 Thread.sleep(100);
                 ss.close();
             } catch (Exception ioe) {
-                LOG.warn("Could not generate unique stub", ioe);
+                LOGGER.log(Level.WARNING, "Could not generate unique stub", ioe);
             }
         } else {
             hostName = "localhost";

Modified: cxf/trunk/services/wsn/wsn-osgi/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-osgi/pom.xml?rev=1182455&r1=1182454&r2=1182455&view=diff
==============================================================================
--- cxf/trunk/services/wsn/wsn-osgi/pom.xml (original)
+++ cxf/trunk/services/wsn/wsn-osgi/pom.xml Wed Oct 12 16:02:38 2011
@@ -37,6 +37,12 @@
             <groupId>org.apache.cxf.services.wsn</groupId>
             <artifactId>cxf-services-wsn-core</artifactId>
             <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.apache.cxf</groupId>
+                    <artifactId>cxf-common-utilities</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
     </dependencies>
 
@@ -52,6 +58,10 @@
                             org.apache.activemq.activemq-core
                         </Require-Bundle>
                         <Import-Package>
+                            !org.apache.cxf.*,
+                            !org.apache.activemq*,
+                            !org.apache.log4j.*,
+                            !org.slf4j.*,
                             javax.xml.bind*;version="[0.0,3)",
                             javax.jws*;version="[0.0,3)",
                             javax.xml.ws*;version="[0.0,3)",
@@ -63,7 +73,8 @@
                             org.apache.cxf.wsn.client;version=${project.version}
                         </Export-Package>
                         <Private-Package>
-                            org.apache.cxf.wsn.*
+                            org.apache.cxf.wsn.*,
+                            org.apache.cxf.common.logging
                         </Private-Package>
                         <DynamicImport-Package>*</DynamicImport-Package>
                         <_versionpolicy>[$(version;==;$(@)),$(version;+;$(@)))</_versionpolicy>

Added: cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/cxf/common/logging/LogUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/cxf/common/logging/LogUtils.java?rev=1182455&view=auto
==============================================================================
--- cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/cxf/common/logging/LogUtils.java (added)
+++ cxf/trunk/services/wsn/wsn-osgi/src/main/java/org/apache/cxf/common/logging/LogUtils.java Wed Oct 12 16:02:38 2011
@@ -0,0 +1,36 @@
+/**
+ * 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.
+ */
+package org.apache.cxf.common.logging;
+
+import java.util.logging.Logger;
+
+/**
+ * Simple replacement class for CXF logging utility.
+ * When deployed in OSGi, projects such as pax-logging can be used to redirect easily
+ * JUL to another framework such as log4j.
+ */
+public final class LogUtils {
+
+    private LogUtils() { }
+
+    public static Logger getL7dLogger(Class<?> cls) {
+        return Logger.getLogger(cls.getName(), null); //NOPMD
+    }
+
+}