You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/08/10 16:38:14 UTC

svn commit: r564607 [7/12] - in /incubator/servicemix/trunk/core/servicemix-core/src: main/java/org/apache/servicemix/ main/java/org/apache/servicemix/jbi/ main/java/org/apache/servicemix/jbi/framework/ main/java/org/apache/servicemix/jbi/framework/sup...

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaFlow.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaFlow.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaFlow.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaFlow.java Fri Aug 10 07:37:46 2007
@@ -184,8 +184,7 @@
         }
         try {
             queue.enqueue(me);
-        }
-        catch (InterruptedException e) {
+        } catch (InterruptedException e) {
             throw new MessagingException(queue + " Failed to enqueue exchange: " + me, e);
         }
     }
@@ -215,8 +214,7 @@
             try {
                 queue.shutDown();
                 unregisterQueue(queue);
-            }
-            catch (JBIException e) {
+            } catch (JBIException e) {
                 log.error("Failed to stop SedaQueue: " + queue + ": " + e);
                 if (log.isDebugEnabled()) {
                     log.debug("Failed to stop SedaQueue: " + queue, e);
@@ -254,8 +252,7 @@
             }
             queue.setObjectName(objectName);
             broker.getContainer().getManagementContext().registerMBean(objectName, queue, LifeCycleMBean.class);
-        }
-        catch (JMException e) {
+        } catch (JMException e) {
             log.error("Failed to register SedaQueue: " + queue + " with the ManagementContext: " + e);
             if (log.isDebugEnabled()) {
                 log.debug("Failed to register SedaQueue: " + queue + " with the ManagementContext", e);
@@ -266,8 +263,7 @@
     protected void unregisterQueue(SedaQueue queue) {
         try {
             broker.getContainer().getManagementContext().unregisterMBean(queue.getObjectName());
-        }
-        catch (JBIException e) {
+        } catch (JBIException e) {
             log.error("Failed to unregister SedaQueue: " + queue + " from the ManagementContext");
             if (log.isDebugEnabled()) {
                 log.debug("Failed to unregister SedaQueue: " + queue + " with the ManagementContext", e);
@@ -298,7 +294,8 @@
                     }
                     Transaction tx = tm.suspend();
                     if (tx != oldTx) {
-                        throw new IllegalStateException("the transaction context set in the messageExchange is not bound to the current thread");
+                        throw new IllegalStateException("the transaction context set in "
+                                + "the messageExchange is not bound to the current thread");
                     }
                 }
             }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaQueue.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaQueue.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaQueue.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/seda/SedaQueue.java Fri Aug 10 07:37:46 2007
@@ -39,7 +39,7 @@
  */
 public class SedaQueue extends BaseLifeCycle {
     
-    private static final Log log = LogFactory.getLog(SedaQueue.class);
+    private static final Log LOG = LogFactory.getLog(SedaQueue.class);
     
     protected SedaFlow flow;
     protected ComponentNameSpace name;
@@ -91,10 +91,10 @@
     /**
      * Initialize the Region
      * 
-     * @param flow
+     * @param seda
      */
-    public void init(SedaFlow flow) {
-        this.flow = flow;
+    public void init(SedaFlow seda) {
+        this.flow = seda;
     }
 
     /**
@@ -128,13 +128,12 @@
         executor.execute(new Runnable() {
             public void run() {
                 try {
-                    if (log.isDebugEnabled()) {
-                        log.debug(this + " dequeued exchange: " + me);
+                    if (LOG.isDebugEnabled()) {
+                        LOG.debug(this + " dequeued exchange: " + me);
                     }
                     flow.doRouting(me);
-                }
-                catch (Throwable e) {
-                    log.error(this + " got error processing " + me, e);
+                } catch (Throwable e) {
+                    LOG.error(this + " got error processing " + me, e);
                 }
             }
         });

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/st/STFlow.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/st/STFlow.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/st/STFlow.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/nmr/flow/st/STFlow.java Fri Aug 10 07:37:46 2007
@@ -16,13 +16,13 @@
  */
 package org.apache.servicemix.jbi.nmr.flow.st;
 
+import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessagingException;
+
 import org.apache.servicemix.jbi.messaging.MessageExchangeImpl;
 import org.apache.servicemix.jbi.nmr.flow.AbstractFlow;
 import org.apache.servicemix.jbi.servicedesc.AbstractServiceEndpoint;
 
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.MessagingException;
-
 /**
  * A simple Straight through flow.
  * 
@@ -53,7 +53,7 @@
      * The type of Flow
      * @return the type
      */
-    public String getDescription(){
+    public String getDescription() {
         return "st";
     }
     

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/EndpointFilter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/EndpointFilter.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/EndpointFilter.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/EndpointFilter.java Fri Aug 10 07:37:46 2007
@@ -30,5 +30,6 @@
      * Performs the filter on the endpoint returning true if the endpoint is suitable, based on some
      * capabilities evaluation or false if the endpoint should be ignored.
      */
-    public boolean evaluate(ServiceEndpoint endpoint, MessageExchange exchange);
+    boolean evaluate(ServiceEndpoint endpoint, MessageExchange exchange);
+
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/EndpointResolverSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/EndpointResolverSupport.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/EndpointResolverSupport.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/EndpointResolverSupport.java Fri Aug 10 07:37:46 2007
@@ -41,8 +41,7 @@
         if (endpoints.length == 0) {
             if (failIfUnavailable) {
                 throw createServiceUnavailableException();
-            }
-            else {
+            } else {
                 return null;
             }
         }
@@ -79,17 +78,16 @@
             ServiceEndpoint endpoint = endpoints[i];
             if (filter.evaluate(endpoint, exchange)) {
                 matches++;
-            }
-            else {
+            }  else {
                 endpoints[i] = null;
             }
         }
         if (matches == endpoints.length) {
             return endpoints;
-        }
-        else {
+        } else {
             ServiceEndpoint[] answer = new ServiceEndpoint[matches];
-            for (int i = 0, j = 0; i < endpoints.length; i++) {
+            int j = 0;
+            for (int i = 0; i < endpoints.length; i++) {
                 ServiceEndpoint endpoint = endpoints[i];
                 if (endpoint != null) {
                     answer[j++] = endpoints[i];

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ExternalInterfaceNameEndpointResolver.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ExternalInterfaceNameEndpointResolver.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ExternalInterfaceNameEndpointResolver.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ExternalInterfaceNameEndpointResolver.java Fri Aug 10 07:37:46 2007
@@ -16,13 +16,13 @@
  */
 package org.apache.servicemix.jbi.resolver;
 
-import org.apache.servicemix.jbi.NoInterfaceAvailableException;
-
 import javax.jbi.JBIException;
 import javax.jbi.component.ComponentContext;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
+
+import org.apache.servicemix.jbi.NoInterfaceAvailableException;
 
 /**
  * Resolves the endpoint using the external interface name with a pluggable {@link EndpointChooser} selection

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ExternalServiceNameEndpointResolver.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ExternalServiceNameEndpointResolver.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ExternalServiceNameEndpointResolver.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ExternalServiceNameEndpointResolver.java Fri Aug 10 07:37:46 2007
@@ -16,13 +16,13 @@
  */
 package org.apache.servicemix.jbi.resolver;
 
-import org.apache.servicemix.jbi.NoServiceAvailableException;
-
 import javax.jbi.JBIException;
 import javax.jbi.component.ComponentContext;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
+
+import org.apache.servicemix.jbi.NoServiceAvailableException;
 
 /**
  * Resolves the endpoint using the external service name with a pluggable {@link EndpointChooser} selection

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/InterfaceNameEndpointResolver.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/InterfaceNameEndpointResolver.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/InterfaceNameEndpointResolver.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/InterfaceNameEndpointResolver.java Fri Aug 10 07:37:46 2007
@@ -16,13 +16,13 @@
  */
 package org.apache.servicemix.jbi.resolver;
 
-import org.apache.servicemix.jbi.NoInterfaceAvailableException;
-
 import javax.jbi.JBIException;
 import javax.jbi.component.ComponentContext;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
+
+import org.apache.servicemix.jbi.NoInterfaceAvailableException;
 
 /**
  * Resolves the endpoint using the interface name with a pluggable {@link EndpointChooser} selection

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/NullEndpointFilter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/NullEndpointFilter.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/NullEndpointFilter.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/NullEndpointFilter.java Fri Aug 10 07:37:46 2007
@@ -25,10 +25,11 @@
  * @version $Revision$
  */
 public class NullEndpointFilter implements EndpointFilter {
-    private static final NullEndpointFilter instance = new NullEndpointFilter();
+
+    private static final NullEndpointFilter INSTANCE = new NullEndpointFilter();
 
     public static NullEndpointFilter getInstance() {
-        return instance;
+        return INSTANCE;
     }
 
     public boolean evaluate(ServiceEndpoint endpoint, MessageExchange exchange) {

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ServiceAndEndpointNameResolver.java Fri Aug 10 07:37:46 2007
@@ -30,7 +30,7 @@
  * @version $Revision$
  */
 public class ServiceAndEndpointNameResolver extends EndpointResolverSupport {
-	
+
     private QName serviceName;
     private String endpointName;
 
@@ -45,9 +45,8 @@
     public ServiceEndpoint[] resolveAvailableEndpoints(ComponentContext context, MessageExchange exchange) throws JBIException {
         ServiceEndpoint endpoint = context.getEndpoint(serviceName, endpointName);
         if (endpoint != null) {
-            return new ServiceEndpoint[]{endpoint};
-        }
-        else {
+            return new ServiceEndpoint[] {endpoint };
+        } else {
             return new ServiceEndpoint[0];
         }
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ServiceNameEndpointResolver.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ServiceNameEndpointResolver.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ServiceNameEndpointResolver.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/ServiceNameEndpointResolver.java Fri Aug 10 07:37:46 2007
@@ -16,13 +16,13 @@
  */
 package org.apache.servicemix.jbi.resolver;
 
-import org.apache.servicemix.jbi.NoServiceAvailableException;
-
 import javax.jbi.JBIException;
 import javax.jbi.component.ComponentContext;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
+
+import org.apache.servicemix.jbi.NoServiceAvailableException;
 
 /**
  * Resolves the endpoint using the service name with a pluggable {@link EndpointChooser} selection

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/SubscriptionFilter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/SubscriptionFilter.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/SubscriptionFilter.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/SubscriptionFilter.java Fri Aug 10 07:37:46 2007
@@ -31,5 +31,6 @@
      * @param exchange 
      * @return true if will accept the exchange
      */
-    public boolean matches(MessageExchange exchange);
+    boolean matches(MessageExchange exchange);
+
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/resolver/URIResolver.java Fri Aug 10 07:37:46 2007
@@ -22,13 +22,14 @@
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
 
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
-import org.apache.servicemix.jbi.util.WSAddressingConstants;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 import org.w3c.dom.Text;
 
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.util.WSAddressingConstants;
+
 public class URIResolver extends EndpointResolverSupport {
 
     /**
@@ -47,34 +48,34 @@
         return new JBIException("Unable to resolve uri: " + uri);
     }
 
-    public ServiceEndpoint[] resolveAvailableEndpoints(ComponentContext context, MessageExchange exchange)
-            throws JBIException {
+    public ServiceEndpoint[] resolveAvailableEndpoints(ComponentContext context, 
+                                                       MessageExchange exchange) throws JBIException {
         if (uri.startsWith("interface:")) {
-            String uri = this.uri.substring(10);
-            String[] parts = split2(uri);
+            String u = this.uri.substring(10);
+            String[] parts = split2(u);
             return context.getEndpoints(new QName(parts[0], parts[1]));
         } else if (uri.startsWith("operation:")) {
             // ignore operation
-            String uri = this.uri.substring(10);
-            String[] parts = split3(uri);
+            String u = this.uri.substring(10);
+            String[] parts = split3(u);
             return context.getEndpoints(new QName(parts[0], parts[1]));
         } else if (uri.startsWith("service:")) {
-            String uri = this.uri.substring(8);
-            String[] parts = split2(uri);
+            String u = this.uri.substring(8);
+            String[] parts = split2(u);
             return context.getEndpointsForService(new QName(parts[0], parts[1]));
         } else if (uri.startsWith("endpoint:")) {
-            String uri = this.uri.substring(9);
-            String[] parts = split3(uri);
+            String u = this.uri.substring(9);
+            String[] parts = split3(u);
             ServiceEndpoint se = context.getEndpoint(new QName(parts[0], parts[1]), parts[2]);
             if (se != null) {
-                return new ServiceEndpoint[] { se };
+                return new ServiceEndpoint[] {se };
             }
         // Try an EPR resolution
         } else {
             DocumentFragment epr = createWSAEPR(uri);
             ServiceEndpoint se = context.resolveEndpointReference(epr);
             if (se != null) {
-                return new ServiceEndpoint[] { se };
+                return new ServiceEndpoint[] {se };
             }
         }
         return null;
@@ -120,9 +121,15 @@
      * @param uri the target uri
      */
     public static void configureExchange(MessageExchange exchange, ComponentContext context, String uri) {
-        if (exchange == null) throw new NullPointerException("exchange is null");
-        if (context == null) throw new NullPointerException("context is null");
-        if (uri == null) throw new NullPointerException("uri is null");
+        if (exchange == null) {
+            throw new NullPointerException("exchange is null");
+        }
+        if (context == null) {
+            throw new NullPointerException("context is null");
+        }
+        if (uri == null) {
+            throw new NullPointerException("uri is null");
+        }
         if (uri.startsWith("interface:")) {
             String uri2 = uri.substring(10);
             String[] parts = URIResolver.split2(uri2);
@@ -164,7 +171,7 @@
         String epName = uri.substring(idx1 + 1);
         String svcName = uri.substring(idx2 + 1, idx1);
         String nsUri   = uri.substring(0, idx2);
-        return new String[] { nsUri, svcName, epName };
+        return new String[] {nsUri, svcName, epName };
     }
     
     public static String[] split2(String uri) {
@@ -181,7 +188,7 @@
         }
         String svcName = uri.substring(idx1 + 1);
         String nsUri   = uri.substring(0, idx1);
-        return new String[] { nsUri, svcName };
+        return new String[] {nsUri, svcName };
     }
     
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/GroupPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/GroupPrincipal.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/GroupPrincipal.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/GroupPrincipal.java Fri Aug 10 07:37:46 2007
@@ -32,7 +32,9 @@
     private transient int hash;
 
     public GroupPrincipal(String name) {
-        if (name == null) throw new IllegalArgumentException("name cannot be null");
+        if (name == null) {
+            throw new IllegalArgumentException("name cannot be null");
+        }
         this.name = name;
     }
 
@@ -41,13 +43,16 @@
     }
 
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
         final GroupPrincipal that = (GroupPrincipal) o;
-
-        if (!name.equals(that.name)) return false;
-
+        if (!name.equals(that.name)) {
+            return false;
+        }
         return true;
     }
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/UserPrincipal.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/UserPrincipal.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/UserPrincipal.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/UserPrincipal.java Fri Aug 10 07:37:46 2007
@@ -28,7 +28,9 @@
     private transient int hash;
 
     public UserPrincipal(String name) {
-        if (name == null) throw new IllegalArgumentException("name cannot be null");
+        if (name == null) {
+            throw new IllegalArgumentException("name cannot be null");
+        }
         this.name = name;
     }
 
@@ -37,12 +39,18 @@
     }
 
     public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
 
         final UserPrincipal that = (UserPrincipal) o;
 
-        if (!name.equals(that.name)) return false;
+        if (!name.equals(that.name)) {
+            return false;
+        }
 
         return true;
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/AuthorizationEntry.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/AuthorizationEntry.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/AuthorizationEntry.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/AuthorizationEntry.java Fri Aug 10 07:37:46 2007
@@ -111,8 +111,8 @@
     public void setService(QName service) {
         // Hack a bit to support wildcards
         // If the attribute was service="*:*", then the namespace is not found, but the prefix is set
-        if (XMLConstants.NULL_NS_URI.equals(service.getNamespaceURI()) &&
-            service.getPrefix() != null && service.getPrefix().length() > 0) {
+        if (XMLConstants.NULL_NS_URI.equals(service.getNamespaceURI())
+                        && service.getPrefix() != null && service.getPrefix().length() > 0) {
             service = new QName(service.getPrefix(), service.getLocalPart());
         }
         this.service = service;

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/DefaultAuthorizationMap.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/DefaultAuthorizationMap.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/DefaultAuthorizationMap.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/acl/impl/DefaultAuthorizationMap.java Fri Aug 10 07:37:46 2007
@@ -95,20 +95,20 @@
     }
 
     protected boolean match(AuthorizationEntry entry, ServiceEndpoint endpoint, QName operation) {
-        return match(entry.getService(), endpoint.getServiceName()) &&
-               match(entry.getEndpoint(), endpoint.getEndpointName()) &&
-               (entry.getOperation() == null || operation == null || match(entry.getOperation(), operation));
+        return match(entry.getService(), endpoint.getServiceName())
+            && match(entry.getEndpoint(), endpoint.getEndpointName())
+            && (entry.getOperation() == null || operation == null || match(entry.getOperation(), operation));
     }
 
     private boolean match(QName acl, QName target) {
-        return match(acl.getNamespaceURI(), target.getNamespaceURI()) &&
-               match(acl.getLocalPart(), target.getLocalPart());
+        return match(acl.getNamespaceURI(), target.getNamespaceURI())
+            && match(acl.getLocalPart(), target.getLocalPart());
     }
 
     private boolean match(String acl, String target) {
-        return acl == null ||
-               acl.equals("*") ||
-               Pattern.matches(acl, target);
+        return acl == null
+            || acl.equals("*")
+            || Pattern.matches(acl, target);
     }
 
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/auth/impl/JAASAuthenticationService.java Fri Aug 10 07:37:46 2007
@@ -40,14 +40,14 @@
  */
 public class JAASAuthenticationService implements AuthenticationService {
 
-    private static final Log log = LogFactory.getLog(JAASAuthenticationService.class);
+    private static final Log LOG = LogFactory.getLog(JAASAuthenticationService.class);
     
     public void authenticate(Subject subject,
                              String domain,
                              final String user, 
                              final Object credentials) throws GeneralSecurityException {
-        if (log.isDebugEnabled()) {
-            log.debug("Authenticating '" + user + "' with '" + credentials + "'");
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Authenticating '" + user + "' with '" + credentials + "'");
         }
         LoginContext loginContext = new LoginContext(domain, subject, new CallbackHandler() {
             public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/KeystoreInstance.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/KeystoreInstance.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/KeystoreInstance.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/KeystoreInstance.java Fri Aug 10 07:37:46 2007
@@ -26,7 +26,8 @@
 import javax.net.ssl.TrustManager;
 
 /**
- * Based on http://svn.apache.org/repos/asf/geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreInstance.java
+ * Based on http://svn.apache.org/repos/asf/geronimo/trunk/modules/management/
+ *              src/java/org/apache/geronimo/management/geronimo/KeystoreInstance.java
  * 
  * @version $Rev: $ $Date: $
  */
@@ -50,7 +51,8 @@
 
     boolean isKeyLocked(String keyAlias);
 
-    KeyManager[] getKeyManager(String algorithm, String keyAlias) throws NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeystoreIsLocked, KeystoreIsLocked;
+    KeyManager[] getKeyManager(String algorithm, String keyAlias) throws NoSuchAlgorithmException, 
+                                UnrecoverableKeyException, KeyStoreException, KeystoreIsLocked, KeystoreIsLocked;
 
     TrustManager[] getTrustManager(String algorithm) throws KeyStoreException, NoSuchAlgorithmException, KeystoreIsLocked;
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/KeystoreManager.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/KeystoreManager.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/KeystoreManager.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/KeystoreManager.java Fri Aug 10 07:37:46 2007
@@ -16,17 +16,14 @@
  */
 package org.apache.servicemix.jbi.security.keystore;
 
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.UnrecoverableKeyException;
+import java.security.GeneralSecurityException;
 
 import javax.net.ssl.SSLServerSocketFactory;
 import javax.net.ssl.SSLSocketFactory;
 
 /**
- * Based on http://svn.apache.org/repos/asf/geronimo/trunk/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreManager.java
+ * Based on http://svn.apache.org/repos/asf/geronimo/trunk/modules/management/
+ *                      src/java/org/apache/geronimo/management/geronimo/KeystoreManager.java
  * 
  */
 public interface KeystoreManager {
@@ -55,14 +52,9 @@
      *                     keystore cannot be used because it has not been
      *                     unlocked.
      */
-    public SSLServerSocketFactory createSSLServerFactory(
-                                        String provider,
-                                        String protocol, 
-                                        String algorithm,
-                                        String keyStore, 
-                                        String keyAlias, 
-                                        String trustStore)
-            throws KeystoreIsLocked, KeyIsLocked, NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeyManagementException, NoSuchProviderException;
+    SSLServerSocketFactory createSSLServerFactory(String provider, String protocol, 
+                                                  String algorithm, String keyStore, 
+                                                  String keyAlias, String trustStore) throws GeneralSecurityException;
 
     /**
      * Gets a SocketFactory using one Keystore to access the private key
@@ -85,14 +77,10 @@
      * @throws KeyIsLocked Occurs when the requested private key in the key
      *                     keystore cannot be used because it has not been
      *                     unlocked.
+     * @throws GeneralSecurityException 
      */
-    public SSLSocketFactory createSSLFactory(
-                                        String provider, 
-                                        String protocol, 
-                                        String algorithm,
-                                        String keyStore, 
-                                        String keyAlias, 
-                                        String trustStore)
-            throws KeystoreIsLocked, KeyIsLocked, NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeyManagementException, NoSuchProviderException;
+    SSLSocketFactory createSSLFactory(String provider, String protocol, 
+                                      String algorithm, String keyStore, 
+                                      String keyAlias, String trustStore) throws GeneralSecurityException;
 
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/BaseKeystoreManager.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/BaseKeystoreManager.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/BaseKeystoreManager.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/BaseKeystoreManager.java Fri Aug 10 07:37:46 2007
@@ -16,12 +16,8 @@
  */
 package org.apache.servicemix.jbi.security.keystore.impl;
 
-import java.security.KeyManagementException;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
+import java.security.GeneralSecurityException;
 import java.security.SecureRandom;
-import java.security.UnrecoverableKeyException;
 
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLServerSocketFactory;
@@ -29,7 +25,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.jbi.security.keystore.KeyIsLocked;
 import org.apache.servicemix.jbi.security.keystore.KeystoreInstance;
 import org.apache.servicemix.jbi.security.keystore.KeystoreIsLocked;
 import org.apache.servicemix.jbi.security.keystore.KeystoreManager;
@@ -84,6 +79,7 @@
      *            The class loader used to resolve factory classes.
      * 
      * @return A created SSLSocketFactory item created from the KeystoreManager.
+     * @throws GeneralSecurityException 
      * @throws KeystoreIsLocked
      *             Occurs when the requested key keystore cannot be used because
      *             it has not been unlocked.
@@ -96,15 +92,9 @@
      * @throws KeyManagementException
      * @throws NoSuchProviderException
      */
-    public SSLSocketFactory createSSLFactory(
-                                String provider, 
-                                String protocol, 
-                                String algorithm, 
-                                String keyStore,
-                                String keyAlias, 
-                                String trustStore) throws KeystoreIsLocked, KeyIsLocked,
-                    NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeyManagementException,
-                    NoSuchProviderException {
+    public SSLSocketFactory createSSLFactory(String provider, String protocol, 
+                                             String algorithm, String keyStore,
+                                             String keyAlias, String trustStore) throws GeneralSecurityException  {
         // the keyStore is optional.
         KeystoreInstance keyInstance = null;
         if (keyStore != null) {
@@ -146,7 +136,7 @@
             if (provider == null) {
                 context = SSLContext.getInstance(protocol);
             } else {
-                context= SSLContext.getInstance(protocol, provider);
+                context = SSLContext.getInstance(protocol, provider);
             }
             context.init(keyInstance == null ? null : keyInstance.getKeyManager(algorithm, keyAlias), 
                          trustInstance == null ? null : trustInstance.getTrustManager(algorithm), 
@@ -189,15 +179,9 @@
      *             Occurs when the requested private key in the key keystore
      *             cannot be used because it has not been unlocked.
      */
-    public SSLServerSocketFactory createSSLServerFactory(
-                                String provider, 
-                                String protocol, 
-                                String algorithm,
-                                String keyStore, 
-                                String keyAlias, 
-                                String trustStore) throws KeystoreIsLocked,
-                    KeyIsLocked, NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException,
-                    KeyManagementException, NoSuchProviderException {
+    public SSLServerSocketFactory createSSLServerFactory(String provider, String protocol, 
+                                                         String algorithm, String keyStore, 
+                                                         String keyAlias, String trustStore) throws GeneralSecurityException {
         KeystoreInstance keyInstance = getKeystore(keyStore);
         if (keyInstance.isKeystoreLocked()) {
             throw new KeystoreIsLocked("Keystore '" + keyStore
@@ -235,7 +219,7 @@
             if (provider == null) {
                 context = SSLContext.getInstance(protocol);
             } else {
-                context= SSLContext.getInstance(protocol, provider);
+                context = SSLContext.getInstance(protocol, provider);
             }
             context.init(keyInstance == null ? null : keyInstance.getKeyManager(algorithm, keyAlias), 
                          trustInstance == null ? null : trustInstance.getTrustManager(algorithm), 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/FileKeystoreInstance.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/FileKeystoreInstance.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/FileKeystoreInstance.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/keystore/impl/FileKeystoreInstance.java Fri Aug 10 07:37:46 2007
@@ -52,8 +52,8 @@
  */
 public class FileKeystoreInstance implements KeystoreInstance {
 
-    private static final Log log = LogFactory.getLog(FileKeystoreInstance.class);
-    private final static String JKS = "JKS";
+    private static final Log LOG = LogFactory.getLog(FileKeystoreInstance.class);
+    private static final String JKS = "JKS";
     
     private Resource path;
     private String name;
@@ -76,7 +76,7 @@
             for (int i = 0; i < keys.length; i++) {
                 String key = keys[i];
                 int pos = key.indexOf('=');
-                this.keyPasswords.put(key.substring(0, pos), key.substring(pos+1).toCharArray());
+                this.keyPasswords.put(key.substring(0, pos), key.substring(pos + 1).toCharArray());
             }
         }
     }
@@ -124,7 +124,7 @@
         try {
             return keystore.getCertificate(alias);
         } catch (KeyStoreException e) {
-            log.error("Unable to read certificate from keystore", e);
+            LOG.error("Unable to read certificate from keystore", e);
         }
         return null;
     }
@@ -136,7 +136,7 @@
         try {
             return keystore.getCertificateAlias(cert);
         } catch (KeyStoreException e) {
-            log.error("Unable to read retrieve alias for given certificate from keystore", e);
+            LOG.error("Unable to read retrieve alias for given certificate from keystore", e);
         }
         return null;
     }
@@ -148,16 +148,17 @@
         try {
             return keystore.getCertificateChain(alias);
         } catch (KeyStoreException e) {
-            log.error("Unable to read certificate chain from keystore", e);
+            LOG.error("Unable to read certificate chain from keystore", e);
         }
         return null;
     }
 
-    public KeyManager[] getKeyManager(String algorithm, String keyAlias) throws KeystoreIsLocked, NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException {
-        if(isKeystoreLocked()) {
-            throw new KeystoreIsLocked("Keystore '"+name+"' is locked; please unlock it in the console.");
+    public KeyManager[] getKeyManager(String algorithm, String keyAlias) throws KeystoreIsLocked, 
+                                    NoSuchAlgorithmException, KeyStoreException, UnrecoverableKeyException {
+        if (isKeystoreLocked()) {
+            throw new KeystoreIsLocked("Keystore '" + name + "' is locked; please unlock it in the console.");
         }
-        if(keystore == null || keystoreReadDate < keystoreFile.lastModified()) {
+        if (keystore == null || keystoreReadDate < keystoreFile.lastModified()) {
             loadKeystoreData();
         }
         KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(algorithm);
@@ -178,18 +179,19 @@
                 return (PrivateKey) key;
             }
         } catch (KeyStoreException e) {
-            log.error("Unable to read private key from keystore", e);
+            LOG.error("Unable to read private key from keystore", e);
         } catch (NoSuchAlgorithmException e) {
-            log.error("Unable to read private key from keystore", e);
+            LOG.error("Unable to read private key from keystore", e);
         } catch (UnrecoverableKeyException e) {
-            log.error("Unable to read private key from keystore", e);
+            LOG.error("Unable to read private key from keystore", e);
         }
         return null;
     }
 
-    public TrustManager[] getTrustManager(String algorithm) throws KeyStoreException, NoSuchAlgorithmException, KeystoreIsLocked {
-        if(isKeystoreLocked()) {
-            throw new KeystoreIsLocked("Keystore '"+name+"' is locked; please unlock it in the console.");
+    public TrustManager[] getTrustManager(String algorithm) throws KeyStoreException, 
+                                            NoSuchAlgorithmException, KeystoreIsLocked {
+        if (isKeystoreLocked()) {
+            throw new KeystoreIsLocked("Keystore '" + name + "' is locked; please unlock it in the console.");
         }
         if (!loadKeystoreData()) {
             return null;
@@ -237,7 +239,7 @@
             keystoreReadDate = System.currentTimeMillis();
             privateKeys.clear();
             trustCerts.clear();
-            if(keystore == null) {
+            if (keystore == null) {
                 keystore = KeyStore.getInstance(JKS);
             }
             InputStream in = new BufferedInputStream(new FileInputStream(keystoreFile));
@@ -254,13 +256,13 @@
             }
             return true;
         } catch (KeyStoreException e) {
-            log.error("Unable to open keystore with provided password", e);
+            LOG.error("Unable to open keystore with provided password", e);
         } catch (IOException e) {
-            log.error("Unable to open keystore with provided password", e);
+            LOG.error("Unable to open keystore with provided password", e);
         } catch (NoSuchAlgorithmException e) {
-            log.error("Unable to open keystore with provided password", e);
+            LOG.error("Unable to open keystore with provided password", e);
         } catch (CertificateException e) {
-            log.error("Unable to open keystore with provided password", e);
+            LOG.error("Unable to open keystore with provided password", e);
         }
         return false;
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/CertificatesLoginModule.java Fri Aug 10 07:37:46 2007
@@ -47,14 +47,13 @@
  */
 public class CertificatesLoginModule implements LoginModule {
 
-    private final String USER_FILE = "org.apache.servicemix.security.certificates.user";
-    private final String GROUP_FILE = "org.apache.servicemix.security.certificates.group";
+    private static final String USER_FILE = "org.apache.servicemix.security.certificates.user";
+    private static final String GROUP_FILE = "org.apache.servicemix.security.certificates.group";
 
-    private static final Log log = LogFactory.getLog(CertificatesLoginModule.class);
+    private static final Log LOG = LogFactory.getLog(CertificatesLoginModule.class);
 
     private Subject subject;
     private CallbackHandler callbackHandler;
-
     private boolean debug;
     private String usersFile;
     private String groupsFile;
@@ -64,27 +63,28 @@
     private Set principals = new HashSet();
     private File baseDir;
 
-    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
-        this.subject = subject;
-        this.callbackHandler = callbackHandler;
+    public void initialize(Subject sub, CallbackHandler handler, Map sharedState, Map options) {
+        this.subject = sub;
+        this.callbackHandler = handler;
 
-        if( System.getProperty("java.security.auth.login.config")!=null ) {
-            baseDir=new File(System.getProperty("java.security.auth.login.config")).getParentFile();
+        if (System.getProperty("java.security.auth.login.config") != null) {
+            baseDir = new File(System.getProperty("java.security.auth.login.config")).getParentFile();
         } else {
             baseDir = new File(".");
         }
 
         debug = "true".equalsIgnoreCase((String) options.get("debug"));
-        usersFile = (String) options.get(USER_FILE)+"";
-        groupsFile = (String) options.get(GROUP_FILE)+"";
+        usersFile = (String) options.get(USER_FILE) + "";
+        groupsFile = (String) options.get(GROUP_FILE) + "";
 
         if (debug) {
-            log.debug("Initialized debug=" + debug + " usersFile=" + usersFile + " groupsFile=" + groupsFile+" basedir="+baseDir);
+            LOG.debug("Initialized debug=" + debug + " usersFile=" + usersFile + " groupsFile=" + groupsFile
+                            + " basedir=" + baseDir);
         }
     }
 
     public boolean login() throws LoginException {
-        File f = new File(baseDir,usersFile);
+        File f = new File(baseDir, usersFile);
         try {
             users.load(new java.io.FileInputStream(f));
         } catch (IOException ioe) {
@@ -107,7 +107,9 @@
             throw new LoginException(uce.getMessage() + " not available to obtain information from user");
         }
         X509Certificate cert = ((CertificateCallback) callbacks[0]).getCertificate();
-        if (cert == null) throw new FailedLoginException("Unable to retrieve certificate");
+        if (cert == null) {
+            throw new FailedLoginException("Unable to retrieve certificate");
+        }
 
         Principal principal = cert.getSubjectX500Principal();
         String certName = principal.getName(); 
@@ -117,7 +119,7 @@
                 user = (String) entry.getKey();
                 principals.add(principal);
                 if (debug) {
-                    log.debug("login " + user);
+                    LOG.debug("login " + user);
                 }
                 return true;
             }
@@ -144,7 +146,7 @@
         clear();
 
         if (debug) {
-            log.debug("commit");
+            LOG.debug("commit");
         }
         return true;
     }
@@ -153,7 +155,7 @@
         clear();
 
         if (debug) {
-            log.debug("abort");
+            LOG.debug("abort");
         }
         return true;
     }
@@ -163,7 +165,7 @@
         principals.clear();
 
         if (debug) {
-            log.debug("logout");
+            LOG.debug("logout");
         }
         return true;
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/security/login/PropertiesLoginModule.java Fri Aug 10 07:37:46 2007
@@ -30,8 +30,8 @@
 import javax.security.auth.callback.NameCallback;
 import javax.security.auth.callback.PasswordCallback;
 import javax.security.auth.callback.UnsupportedCallbackException;
-import javax.security.auth.login.LoginException;
 import javax.security.auth.login.FailedLoginException;
+import javax.security.auth.login.LoginException;
 import javax.security.auth.spi.LoginModule;
 
 import org.apache.commons.logging.Log;
@@ -45,14 +45,12 @@
  */
 public class PropertiesLoginModule implements LoginModule {
 
-    private final String USER_FILE = "org.apache.servicemix.security.properties.user";
-    private final String GROUP_FILE = "org.apache.servicemix.security.properties.group";
-
-    private static final Log log = LogFactory.getLog(PropertiesLoginModule.class);
+    private static final String USER_FILE = "org.apache.servicemix.security.properties.user";
+    private static final String GROUP_FILE = "org.apache.servicemix.security.properties.group";
+    private static final Log LOG = LogFactory.getLog(PropertiesLoginModule.class);
 
     private Subject subject;
     private CallbackHandler callbackHandler;
-
     private boolean debug;
     private String usersFile;
     private String groupsFile;
@@ -62,27 +60,27 @@
     private Set principals = new HashSet();
     private File baseDir;
 
-    public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) {
-        this.subject = subject;
-        this.callbackHandler = callbackHandler;
+    public void initialize(Subject sub, CallbackHandler handler, Map sharedState, Map options) {
+        this.subject = sub;
+        this.callbackHandler = handler;
 
-        if( System.getProperty("java.security.auth.login.config")!=null ) {
-            baseDir=new File(System.getProperty("java.security.auth.login.config")).getParentFile();
+        if (System.getProperty("java.security.auth.login.config") != null) {
+            baseDir = new File(System.getProperty("java.security.auth.login.config")).getParentFile();
         } else {
             baseDir = new File(".");
         }
 
         debug = "true".equalsIgnoreCase((String) options.get("debug"));
-        usersFile = (String) options.get(USER_FILE)+"";
-        groupsFile = (String) options.get(GROUP_FILE)+"";
+        usersFile = (String) options.get(USER_FILE) + "";
+        groupsFile = (String) options.get(GROUP_FILE) + "";
 
         if (debug) {
-            log.debug("Initialized debug=" + debug + " usersFile=" + usersFile + " groupsFile=" + groupsFile+" basedir="+baseDir);
+            LOG.debug("Initialized debug=" + debug + " usersFile=" + usersFile + " groupsFile=" + groupsFile + " basedir=" + baseDir);
         }
     }
 
     public boolean login() throws LoginException {
-        File f = new File(baseDir,usersFile);
+        File f = new File(baseDir, usersFile);
         try {
             users.load(new java.io.FileInputStream(f));
         } catch (IOException ioe) {
@@ -108,17 +106,23 @@
         }
         user = ((NameCallback) callbacks[0]).getName();
         char[] tmpPassword = ((PasswordCallback) callbacks[1]).getPassword();
-        if (tmpPassword == null) tmpPassword = new char[0];
+        if (tmpPassword == null) {
+            tmpPassword = new char[0];
+        }
 
         String password = users.getProperty(user);
 
-        if (password == null) throw new FailedLoginException("User does not exist");
-        if (!password.equals(new String(tmpPassword))) throw new FailedLoginException("Password does not match");
+        if (password == null) {
+            throw new FailedLoginException("User does not exist");
+        }
+        if (!password.equals(new String(tmpPassword))) {
+            throw new FailedLoginException("Password does not match");
+        }
 
         users.clear();
 
         if (debug) {
-            log.debug("login " + user);
+            LOG.debug("login " + user);
         }
         return true;
     }
@@ -142,7 +146,7 @@
         clear();
 
         if (debug) {
-            log.debug("commit");
+            LOG.debug("commit");
         }
         return true;
     }
@@ -151,7 +155,7 @@
         clear();
 
         if (debug) {
-            log.debug("abort");
+            LOG.debug("abort");
         }
         return true;
     }
@@ -161,7 +165,7 @@
         principals.clear();
 
         if (debug) {
-            log.debug("logout");
+            LOG.debug("logout");
         }
         return true;
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/AbstractServiceEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/AbstractServiceEndpoint.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/AbstractServiceEndpoint.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/AbstractServiceEndpoint.java Fri Aug 10 07:37:46 2007
@@ -16,11 +16,11 @@
  */
 package org.apache.servicemix.jbi.servicedesc;
 
-import org.apache.servicemix.jbi.framework.ComponentNameSpace;
+import java.io.Serializable;
 
 import javax.jbi.servicedesc.ServiceEndpoint;
 
-import java.io.Serializable;
+import org.apache.servicemix.jbi.framework.ComponentNameSpace;
 
 public abstract class AbstractServiceEndpoint implements ServiceEndpoint, Serializable {
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/DynamicEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/DynamicEndpoint.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/DynamicEndpoint.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/DynamicEndpoint.java Fri Aug 10 07:37:46 2007
@@ -16,11 +16,12 @@
  */
 package org.apache.servicemix.jbi.servicedesc;
 
-import org.apache.servicemix.jbi.framework.ComponentNameSpace;
-import org.w3c.dom.DocumentFragment;
-
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
+
+import org.w3c.dom.DocumentFragment;
+
+import org.apache.servicemix.jbi.framework.ComponentNameSpace;
 
 /**
  * Dynamic endpoints are used to route exchanges using endpoint references.

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/EndpointReferenceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/EndpointReferenceBuilder.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/EndpointReferenceBuilder.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/EndpointReferenceBuilder.java Fri Aug 10 07:37:46 2007
@@ -18,31 +18,36 @@
 
 import javax.jbi.servicedesc.ServiceEndpoint;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.jbi.util.DOMUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 
-public class EndpointReferenceBuilder {
-    private static final Log log = LogFactory.getLog(EndpointReferenceBuilder.class);
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.jbi.util.DOMUtil;
 
+public final class EndpointReferenceBuilder {
+    
     public static final String JBI_NAMESPACE = "http://java.sun.com/jbi/end-point-reference";
     public static final String XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
     
+    private static final Log LOG = LogFactory.getLog(EndpointReferenceBuilder.class);
+
+    private EndpointReferenceBuilder() {
+    }
+    
     public static DocumentFragment getReference(ServiceEndpoint endpoint) {
         try {
             Document doc = DOMUtil.newDocument();
             DocumentFragment fragment = doc.createDocumentFragment();
             Element epr = doc.createElementNS(JBI_NAMESPACE, "jbi:end-point-reference");
-            epr.setAttributeNS(XMLNS_NAMESPACE,"xmlns:sns", endpoint.getServiceName().getNamespaceURI());
+            epr.setAttributeNS(XMLNS_NAMESPACE, "xmlns:sns", endpoint.getServiceName().getNamespaceURI());
             epr.setAttributeNS(JBI_NAMESPACE, "jbi:service-name", "sns:" + endpoint.getServiceName().getLocalPart());
             epr.setAttributeNS(JBI_NAMESPACE, "jbi:end-point-name", endpoint.getEndpointName());
             fragment.appendChild(epr);
             return fragment;
         } catch (Exception e) {
-            log.warn("Unable to create reference for ServiceEndpoint " + endpoint, e);
+            LOG.warn("Unable to create reference for ServiceEndpoint " + endpoint, e);
             return null;
         }
     }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/EndpointSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/EndpointSupport.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/EndpointSupport.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/EndpointSupport.java Fri Aug 10 07:37:46 2007
@@ -20,7 +20,10 @@
 import javax.xml.namespace.QName;
 
 
-public class EndpointSupport {
+public final class EndpointSupport {
+    
+    private EndpointSupport() {
+    }
 
     public static String getKey(QName service, String endpoint) {
         StringBuffer sb = new StringBuffer();

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/ExternalEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/ExternalEndpoint.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/ExternalEndpoint.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/ExternalEndpoint.java Fri Aug 10 07:37:46 2007
@@ -16,11 +16,12 @@
  */
 package org.apache.servicemix.jbi.servicedesc;
 
-import org.apache.servicemix.jbi.framework.ComponentNameSpace;
-import org.w3c.dom.DocumentFragment;
-
 import javax.jbi.servicedesc.ServiceEndpoint;
 import javax.xml.namespace.QName;
+
+import org.w3c.dom.DocumentFragment;
+
+import org.apache.servicemix.jbi.framework.ComponentNameSpace;
 
 /**
  * External endpoints are wrapper for endpoints registered

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/servicedesc/InternalEndpoint.java Fri Aug 10 07:37:46 2007
@@ -23,9 +23,10 @@
 
 import javax.xml.namespace.QName;
 
-import org.apache.servicemix.jbi.framework.ComponentNameSpace;
 import org.w3c.dom.DocumentFragment;
 
+import org.apache.servicemix.jbi.framework.ComponentNameSpace;
+
 /**
  * Reference generated by NMR to refer to an endpoint registration
  *
@@ -102,7 +103,7 @@
      *  @return the qualified service name.
      */
     public QName getServiceName() {
-       return serviceName; 
+        return serviceName;
     }
     
     /**
@@ -145,10 +146,10 @@
      */
     public boolean equals(Object obj) {
         boolean result = false;
-        if (obj != null && obj instanceof InternalEndpoint){
-            InternalEndpoint other = (InternalEndpoint)obj;
-            result = other.serviceName.equals(this.serviceName) &&
-                     other.endpointName.equals(this.endpointName);
+        if (obj != null && obj instanceof InternalEndpoint) {
+            InternalEndpoint other = (InternalEndpoint) obj;
+            result = other.serviceName.equals(this.serviceName)
+                     && other.endpointName.equals(this.endpointName);
         }
         return result;
     }
@@ -158,8 +159,8 @@
      * @return has code
      */
     public int hashCode() {
-        return serviceName.hashCode() ^
-               endpointName.hashCode() ;
+        return serviceName.hashCode()
+               ^ endpointName.hashCode();
     }
     
     /**

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/ByteArrayDataSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/ByteArrayDataSource.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/ByteArrayDataSource.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/ByteArrayDataSource.java Fri Aug 10 07:37:46 2007
@@ -25,30 +25,33 @@
 import javax.activation.DataSource;
 
 /**
- * Byte array DataSource for Mail and message attachments 
+ * Byte array DataSource for Mail and message attachments
+ * 
  * @author George Gastaldi
  * @since 3.0
  */
 public class ByteArrayDataSource implements DataSource, Serializable {
 
     private static final long serialVersionUID = 1L;
-    
+
     private byte[] data;
     private String type;
     private String name = "unused";
-    
+
     public ByteArrayDataSource(byte[] data, String type) {
         this.data = data;
         this.type = type;
     }
 
     public InputStream getInputStream() throws IOException {
-		if (data == null) throw new IOException("no data");
-		return new ByteArrayInputStream(data);
+        if (data == null) {
+            throw new IOException("no data");
+        }
+        return new ByteArrayInputStream(data);
     }
 
     public OutputStream getOutputStream() throws IOException {
-    	throw new IOException("getOutputStream() not supported");
+        throw new IOException("getOutputStream() not supported");
     }
 
     public String getContentType() {
@@ -58,8 +61,8 @@
     public String getName() {
         return name;
     }
-    
+
     public void setName(String name) {
-    	this.name = name;
+        this.name = name;
     }
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/DOMUtil.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/DOMUtil.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/DOMUtil.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/DOMUtil.java Fri Aug 10 07:37:46 2007
@@ -16,15 +16,7 @@
  */
 package org.apache.servicemix.jbi.util;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
+import java.io.StringWriter;
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
@@ -39,15 +31,30 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import java.io.StringWriter;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * A collection of W3C DOM helper methods
  *
  * @version $Revision$
  */
-public class DOMUtil {
-    private static final Log log = LogFactory.getLog(DOMUtil.class);
+public final class DOMUtil {
+    
+    private static final Log LOG = LogFactory.getLog(DOMUtil.class);
+    private static DocumentBuilderFactory dbf;
+    private static Queue builders = new ConcurrentLinkedQueue();
+
+    
+    private DOMUtil() {
+    }
 
     /**
      * Returns the text of the element
@@ -55,7 +62,7 @@
     public static String getElementText(Element element) {
         StringBuffer buffer = new StringBuffer();
         NodeList nodeList = element.getChildNodes();
-        for (int i = 0, size = nodeList.getLength(); i < size; i++) {
+        for (int i = 0; i < nodeList.getLength(); i++) {
             Node node = nodeList.item(i);
             if (node.getNodeType() == Node.TEXT_NODE || node.getNodeType() == Node.CDATA_SECTION_NODE) {
                 buffer.append(node.getNodeValue());
@@ -83,7 +90,7 @@
     public static void copyAttributes(Element from, Element to) {
         // lets copy across all the remainingattributes
         NamedNodeMap attributes = from.getAttributes();
-        for (int i = 0, size = attributes.getLength(); i < size; i++) {
+        for (int i = 0; i < attributes.getLength(); i++) {
             Attr node = (Attr) attributes.item(i);
             to.setAttributeNS(node.getNamespaceURI(), node.getName(), node.getValue());
         }
@@ -137,8 +144,7 @@
             String localName = qualifiedName.substring(index + 1);
             String uri = recursiveGetAttributeValue(element, "xmlns:" + prefix);
             return new QName(uri, localName, prefix);
-        }
-        else {
+        } else {
             String uri = recursiveGetAttributeValue(element, "xmlns");
             if (uri != null) {
                 return new QName(uri, qualifiedName);
@@ -154,10 +160,9 @@
         String answer = null;
         try {
             answer = element.getAttribute(attributeName);
-        }
-        catch (Exception e) {
-            if (log.isTraceEnabled()) {
-                log.trace("Caught exception looking up attribute: " + attributeName + " on element: " + element + ". Cause: " + e, e);
+        } catch (Exception e) {
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Caught exception looking up attribute: " + attributeName + " on element: " + element + ". Cause: " + e, e);
             }
         }
         if (answer == null || answer.length() == 0) {
@@ -213,9 +218,6 @@
             return new QName(el.getNamespaceURI(), el.getLocalName());
         }
     }
-
-    private static DocumentBuilderFactory dbf = null;
-    private static Queue builders = new ConcurrentLinkedQueue();
 
     public static DocumentBuilder getBuilder() throws ParserConfigurationException {
         DocumentBuilder builder = (DocumentBuilder) builders.poll();

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FastStack.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FastStack.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FastStack.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FastStack.java Fri Aug 10 07:37:46 2007
@@ -19,20 +19,20 @@
 import java.util.ArrayList;
 
 public class FastStack<T> extends ArrayList<T> {
-	
-	public void push(T o) {
-		add(o);
-	}
 
-	public T pop() {
-		return remove(size() - 1);
-	}
+    public void push(T o) {
+        add(o);
+    }
 
-	public boolean empty() {
-		return size() == 0;
-	}
+    public T pop() {
+        return remove(size() - 1);
+    }
 
-	public T peek() {
-		return get(size() - 1);
-	}
+    public boolean empty() {
+        return size() == 0;
+    }
+
+    public T peek() {
+        return get(size() - 1);
+    }
 }

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileUtil.java Fri Aug 10 07:37:46 2007
@@ -35,13 +35,16 @@
  * 
  * @version $Revision$
  */
-public class FileUtil {
+public final class FileUtil {
     
     /**
      * Buffer size used when copying the content of an input stream to
      * an output stream. 
      */
     private static final int DEFAULT_BUFFER_SIZE = 4096;
+    
+    private FileUtil() {
+    }
 
     /**
      * Move a File
@@ -51,7 +54,7 @@
      * @throws IOException 
      */
     public static void moveFile(File src, File targetDirectory) throws IOException {
-        if (!src.renameTo(new File(targetDirectory, src.getName()))){
+        if (!src.renameTo(new File(targetDirectory, src.getName()))) {
             throw new IOException("Failed to move " + src + " to " + targetDirectory);
         }
     }
@@ -65,7 +68,7 @@
      */
     public static File getDirectoryPath(File parent, String subDirectory) {
         File result = null;
-        if (parent != null){
+        if (parent != null) {
             result = new File(parent, subDirectory);
         }
         return result;
@@ -187,7 +190,7 @@
      * @return unique directory
      * @throws IOException
      */
-    public synchronized static File createUniqueDirectory(File rootDir, String seed) throws IOException {
+    public static synchronized File createUniqueDirectory(File rootDir, String seed) throws IOException {
         int index = seed.lastIndexOf('.');
         if (index > 0) {
             seed = seed.substring(0, index);
@@ -213,27 +216,29 @@
      * @return true if the File is deleted
      */
     public static boolean deleteFile(File fileToDelete) {
+        if (fileToDelete == null || !fileToDelete.exists()) {
+            return true;
+        }
         boolean result = true;
-        if (fileToDelete != null && fileToDelete.exists()) {
-            if (fileToDelete.isDirectory()) {
-                File[] files = fileToDelete.listFiles();
-                if (files == null) {
-                    result = false;
-                } else {
-                    for (int i = 0; i < files.length; i++) {
-                        File file = files[i];
-                        if (!file.getName().equals(".") && !file.getName().equals("..")) {
-                            if (file.isDirectory()) {
-                                result &= deleteFile(file);
-                            } else {
-                            	result &= file.delete();
-                            }
-                        }
+        if (fileToDelete.isDirectory()) {
+            File[] files = fileToDelete.listFiles();
+            if (files == null) {
+                result = false;
+            } else {
+                for (int i = 0; i < files.length; i++) {
+                    File file = files[i];
+                    if (file.getName().equals(".") || file.getName().equals("..")) {
+                        continue;
+                    }
+                    if (file.isDirectory()) {
+                        result &= deleteFile(file);
+                    } else {
+                        result &= file.delete();
                     }
                 }
             }
-            result &= fileToDelete.delete();
         }
+        result &= fileToDelete.delete();
         return result;
     }
 

Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileVersionUtil.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileVersionUtil.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileVersionUtil.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/FileVersionUtil.java Fri Aug 10 07:37:46 2007
@@ -18,17 +18,25 @@
 
 import java.io.File;
 import java.io.IOException;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 /**
  * Supports a simple versioning scheme using the file system
  * 
  * @version $Revision$
  */
-public class FileVersionUtil{
-    private static final Log log=LogFactory.getLog(FileVersionUtil.class);
-    private static final String VERSION_PREFIX="version_";
-    private static final String[] RESERVED= { VERSION_PREFIX };
+public final class FileVersionUtil {
+    
+    private static final Log LOG = LogFactory.getLog(FileVersionUtil.class);
+
+    private static final String VERSION_PREFIX = "version_";
+
+    private static final String[] RESERVED = {VERSION_PREFIX };
+    
+    private FileVersionUtil() {
+    }
 
     /**
      * Get the latest version number for a directory
@@ -37,13 +45,13 @@
      * @return the version number
      */
     public static int getLatestVersionNumber(File rootDirectory) {
-        int result=-1;
-        if(isVersioned(rootDirectory)){
-            File[] files=rootDirectory.listFiles();
-            for(int i=0;i<files.length;i++){
-                int version=getVersionNumber(files[i].getName());
-                if(version>result){
-                    result=version;
+        int result = -1;
+        if (isVersioned(rootDirectory)) {
+            File[] files = rootDirectory.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                int version = getVersionNumber(files[i].getName());
+                if (version > result) {
+                    result = version;
                 }
             }
         }
@@ -58,15 +66,15 @@
      * @throws IOException
      */
     public static File getLatestVersionDirectory(File rootDirectory) {
-        File result=null;
-        int highestVersion=-1;
-        if(rootDirectory != null && isVersioned(rootDirectory)){
-            File[] files=rootDirectory.listFiles();
-            for(int i=0;i<files.length;i++){
-                int version=getVersionNumber(files[i].getName());
-                if(version>highestVersion){
-                    highestVersion=version;
-                    result=files[i];
+        File result = null;
+        int highestVersion = -1;
+        if (rootDirectory != null && isVersioned(rootDirectory)) {
+            File[] files = rootDirectory.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                int version = getVersionNumber(files[i].getName());
+                if (version > highestVersion) {
+                    highestVersion = version;
+                    result = files[i];
                 }
             }
         }
@@ -75,14 +83,15 @@
 
     /**
      * Create a new version directory
+     * 
      * @param rootDirectory
      * @return the created version directory
      * @throws IOException
      */
-    public static File createNewVersionDirectory(File rootDirectory) throws IOException{
-        File result= getNewVersionDirectory(rootDirectory);
-        if(!FileUtil.buildDirectory(result)){
-            throw new IOException("Failed to build version directory: "+result);
+    public static File createNewVersionDirectory(File rootDirectory) throws IOException {
+        File result = getNewVersionDirectory(rootDirectory);
+        if (!FileUtil.buildDirectory(result)) {
+            throw new IOException("Failed to build version directory: " + result);
         }
         return result;
     }
@@ -94,20 +103,20 @@
      * @return the version directory
      * @throws IOException
      */
-    public static File getNewVersionDirectory(File rootDirectory) throws IOException{
-        File result=null;
-        if(FileUtil.buildDirectory(rootDirectory)){
-            String versionDirectoryName=VERSION_PREFIX;
-            if(isVersioned(rootDirectory)){
-                int versionNumber=getLatestVersionNumber(rootDirectory);
-                versionNumber=versionNumber>0?versionNumber+1:1;
-                versionDirectoryName+=versionNumber;
-            }else{
-                versionDirectoryName+=1;
-            }
-            result=FileUtil.getDirectoryPath(rootDirectory,versionDirectoryName);
-        }else{
-            throw new IOException("Cannot build parent directory: "+rootDirectory);
+    public static File getNewVersionDirectory(File rootDirectory) throws IOException {
+        File result = null;
+        if (FileUtil.buildDirectory(rootDirectory)) {
+            String versionDirectoryName = VERSION_PREFIX;
+            if (isVersioned(rootDirectory)) {
+                int versionNumber = getLatestVersionNumber(rootDirectory);
+                versionNumber = versionNumber > 0 ? versionNumber + 1 : 1;
+                versionDirectoryName += versionNumber;
+            } else {
+                versionDirectoryName += 1;
+            }
+            result = FileUtil.getDirectoryPath(rootDirectory, versionDirectoryName);
+        } else {
+            throw new IOException("Cannot build parent directory: " + rootDirectory);
         }
         return result;
     }
@@ -118,30 +127,29 @@
      * @param rootDirectory
      * @throws IOException
      */
-    public static void initializeVersionDirectory(File rootDirectory) throws IOException{
-        if(!isVersioned(rootDirectory)){
-            File newRoot=createNewVersionDirectory(rootDirectory);
-            File[] files=rootDirectory.listFiles();
-            for(int i=0;i<files.length;i++){
-                if(!isReserved(files[i].getName())){
-                    log.info(rootDirectory.getPath()+": moving non-versioned file "+files[i].getName()+" to "
-                                    +newRoot.getName());
+    public static void initializeVersionDirectory(File rootDirectory) throws IOException {
+        if (!isVersioned(rootDirectory)) {
+            File newRoot = createNewVersionDirectory(rootDirectory);
+            File[] files = rootDirectory.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                if (!isReserved(files[i].getName())) {
+                    LOG.info(rootDirectory.getPath() + ": moving non-versioned file " + files[i].getName() + " to " + newRoot.getName());
                     File moveTo = FileUtil.getDirectoryPath(newRoot, files[i].getName());
-                    FileUtil.moveFile(files[i],moveTo);
+                    FileUtil.moveFile(files[i], moveTo);
                 }
             }
         }
     }
 
     private static boolean isVersioned(File rootDirectory) {
-        boolean result=false;
-        if(rootDirectory.exists()&&rootDirectory.isDirectory()){
-            File[] files=rootDirectory.listFiles();
-            result=files==null||files.length==0;
-            if(!result){
-                for(int i=0;i<files.length;i++){
-                    if(isReserved(files[i].getName())){
-                        result=true;
+        boolean result = false;
+        if (rootDirectory.exists() && rootDirectory.isDirectory()) {
+            File[] files = rootDirectory.listFiles();
+            result = files == null || files.length == 0;
+            if (!result) {
+                for (int i = 0; i < files.length; i++) {
+                    if (isReserved(files[i].getName())) {
+                        result = true;
                         break;
                     }
                 }
@@ -150,12 +158,12 @@
         return result;
     }
 
-    private static boolean isReserved(String name){
-        boolean result=false;
-        if(name!=null){
-            for(int i=0;i<RESERVED.length;i++){
-                if(name.startsWith(RESERVED[i])){
-                    result=true;
+    private static boolean isReserved(String name) {
+        boolean result = false;
+        if (name != null) {
+            for (int i = 0; i < RESERVED.length; i++) {
+                if (name.startsWith(RESERVED[i])) {
+                    result = true;
                     break;
                 }
             }
@@ -163,11 +171,11 @@
         return result;
     }
 
-    private static int getVersionNumber(String name){
-        int result=-1;
-        if(name!=null&&name.startsWith(VERSION_PREFIX)){
-            String number=name.substring(VERSION_PREFIX.length());
-            result=Integer.parseInt(number);
+    private static int getVersionNumber(String name) {
+        int result = -1;
+        if (name != null && name.startsWith(VERSION_PREFIX)) {
+            String number = name.substring(VERSION_PREFIX.length());
+            result = Integer.parseInt(number);
         }
         return result;
     }