servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r557551 - in /incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file: ./ src/main/java/org/apache/servicemix/file/ src/test/java/org/apache/servicemix/file/
Date Thu, 19 Jul 2007 10:08:26 GMT
Author: gertv
Date: Thu Jul 19 03:08:24 2007
New Revision: 557551

URL: http://svn.apache.org/viewvc?view=rev&rev=557551
Log:
Fix for SM-932: PMD/CheckStyle for servicemix-file

Modified:
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/pom.xml
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileComponent.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FilePollerEndpoint.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileSenderEndpoint.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/DynamicEndpointTest.java
    incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/PollDirectoryTest.java

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/pom.xml
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/pom.xml?view=diff&rev=557551&r1=557550&r2=557551
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/pom.xml (original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/pom.xml Thu Jul
19 03:08:24 2007
@@ -88,9 +88,6 @@
           <includes>
             <include>**/*Test.*</include>
           </includes>
-          <excludes>
-            <exclude>**/PollDirectoryTest.*</exclude>
-          </excludes>
         </configuration>
       </plugin>
     </plugins>

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileComponent.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileComponent.java?view=diff&rev=557551&r1=557550&r2=557551
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileComponent.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileComponent.java
Thu Jul 19 03:08:24 2007
@@ -52,7 +52,7 @@
     }
 
     protected Class[] getEndpointClasses() {
-        return new Class[]{ FilePollerEndpoint.class, FileSenderEndpoint.class };
+        return new Class[] {FilePollerEndpoint.class, FileSenderEndpoint.class};
     }
 
     protected Endpoint getResolvedEPR(ServiceEndpoint ep) throws Exception {
@@ -72,16 +72,13 @@
             if (path != null) {
                 // lets assume host really is a relative directory
                 file = host + File.separator + path;
-            }
-            else {
+            } else {
                 file = host;
             }
-        }
-        else {
+        } else {
             if (path != null) {
                 file = path;
-            }
-            else {
+            } else {
                 // must be an absolute URI
                 file = uri.getSchemeSpecificPart();
             }
@@ -92,8 +89,7 @@
 
         if (file != null) {
             fileEp.setDirectory(new File(file));
-        }
-        else {
+        } else {
             throw new IllegalArgumentException("No file defined for URL: " + uri);
         }
         fileEp.activate();

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FilePollerEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FilePollerEndpoint.java?view=diff&rev=557551&r1=557550&r2=557551
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FilePollerEndpoint.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FilePollerEndpoint.java
Thu Jul 19 03:08:24 2007
@@ -23,6 +23,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 
+import java.util.concurrent.locks.Lock;
+
 import javax.jbi.JBIException;
 import javax.jbi.management.DeploymentException;
 import javax.jbi.messaging.ExchangeStatus;
@@ -40,8 +42,6 @@
 import org.apache.servicemix.locks.LockManager;
 import org.apache.servicemix.locks.impl.SimpleLockManager;
 
-import java.util.concurrent.locks.Lock;
-
 /**
  * A polling endpoint which looks for a file or files in a directory
  * and sends the files into the JBI bus as messages, deleting the files
@@ -180,15 +180,13 @@
     protected void pollFileOrDirectory(File fileOrDirectory, boolean processDir) {
         if (!fileOrDirectory.isDirectory()) {
             pollFile(fileOrDirectory); // process the file
-        }
-        else if (processDir) {
+        } else if (processDir) {
             logger.debug("Polling directory " + fileOrDirectory);
             File[] files = fileOrDirectory.listFiles(getFilter());
             for (int i = 0; i < files.length; i++) {
                 pollFileOrDirectory(files[i], isRecursive()); // self-recursion
             }
-        }
-        else {
+        } else {
             logger.debug("Skipping directory " + fileOrDirectory);
         }
     }
@@ -205,8 +203,7 @@
                     boolean unlock = true;
                     try {
                         unlock = processFileAndDelete(aFile);
-                    }
-                    finally {
+                    } finally {
                         if (unlock) {
                             lock.unlock();
                         }
@@ -236,8 +233,7 @@
                     unlock = true;
                 }
             }
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             logger.error("Failed to process file: " + aFile + ". Reason: " + e, e);
         }
         return unlock;

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileSenderEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileSenderEndpoint.java?view=diff&rev=557551&r1=557550&r2=557551
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileSenderEndpoint.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/main/java/org/apache/servicemix/file/FileSenderEndpoint.java
Thu Jul 19 03:08:24 2007
@@ -16,15 +16,15 @@
  */
 package org.apache.servicemix.file;
 
-import org.apache.servicemix.components.util.DefaultFileMarshaler;
-import org.apache.servicemix.components.util.FileMarshaler;
-import org.apache.servicemix.common.endpoints.ProviderEndpoint;
-
+import java.io.*;
 import javax.jbi.management.DeploymentException;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.NormalizedMessage;
 import javax.jbi.servicedesc.ServiceEndpoint;
-import java.io.*;
+
+import org.apache.servicemix.common.endpoints.ProviderEndpoint;
+import org.apache.servicemix.components.util.DefaultFileMarshaler;
+import org.apache.servicemix.components.util.FileMarshaler;
 
 /**
  * An endpoint which receives a message and writes the content to a file.
@@ -70,8 +70,7 @@
             String name = marshaler.getOutputName(exchange, in);
             if (name == null) {
                 newFile = File.createTempFile(tempFilePrefix, tempFileSuffix, directory);
-            }
-            else {
+            } else {
                 newFile = new File(directory, name);
             }
             if (!newFile.getParentFile().exists() && isAutoCreateDirectory()) {

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/DynamicEndpointTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/DynamicEndpointTest.java?view=diff&rev=557551&r1=557550&r2=557551
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/DynamicEndpointTest.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/DynamicEndpointTest.java
Thu Jul 19 03:08:24 2007
@@ -1,5 +1,4 @@
-/**
- *
+/*
  * 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.
@@ -7,7 +6,7 @@
  * (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
+ *      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,
@@ -58,12 +57,10 @@
         if (me.getStatus() == ExchangeStatus.ERROR) {
             if (me.getError() != null) {
                 throw me.getError();
-            }
-            else {
+            } else {
                 fail("Received ERROR status");
             }
-        }
-        else if (me.getFault() != null) {
+        } else if (me.getFault() != null) {
             fail("Received fault: " + new SourceTransformer().toString(me.getFault().getContent()));
         }
     }

Modified: incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/PollDirectoryTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/PollDirectoryTest.java?view=diff&rev=557551&r1=557550&r2=557551
==============================================================================
--- incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/PollDirectoryTest.java
(original)
+++ incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-file/src/test/java/org/apache/servicemix/file/PollDirectoryTest.java
Thu Jul 19 03:08:24 2007
@@ -1,5 +1,4 @@
-/**
- *
+/*
  * 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.
@@ -7,7 +6,7 @@
  * (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
+ *      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,
@@ -33,12 +32,12 @@
 import org.springframework.context.support.AbstractXmlApplicationContext;
 
 public class PollDirectoryTest extends SpringTestSupport {
+
+    private static final int NUMBER = 10;
+    
     protected String directoryName = "target/pollDirectory";
     protected String dynamicURI = "file:" + directoryName;
-
-
-    private int NUMBER = 10;
-
+    
     public void testSendToWriterSoItCanBePolled() throws Exception {
         // now lets make a request on this endpoint
         DefaultServiceMixClient client = new DefaultServiceMixClient(jbi);
@@ -62,12 +61,10 @@
         if (me.getStatus() == ExchangeStatus.ERROR) {
             if (me.getError() != null) {
                 throw me.getError();
-            }
-            else {
+            } else {
                 fail("Received ERROR status");
             }
-        }
-        else if (me.getFault() != null) {
+        } else if (me.getFault() != null) {
             fail("Received fault: " + new SourceTransformer().toString(me.getFault().getContent()));
         }
     }



Mime
View raw message