git://wamblee.org
/
utils
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8e8ee09
)
(no commit message)
author
Erik Brakkee
<erik@brakkee.org>
Thu, 22 Jul 2010 11:53:47 +0000
(11:53 +0000)
committer
Erik Brakkee
<erik@brakkee.org>
Thu, 22 Jul 2010 11:53:47 +0000
(11:53 +0000)
support/general/pom.xml
patch
|
blob
|
history
support/general/src/main/java/org/wamblee/io/DirectoryMonitor.java
patch
|
blob
|
history
support/general/src/main/java/org/wamblee/io/SimpleProcess.java
patch
|
blob
|
history
support/general/src/main/java/org/wamblee/ioc/BeanKernel.java
patch
|
blob
|
history
support/general/src/main/java/org/wamblee/persistence/JpaMergeSupport.java
patch
|
blob
|
history
support/general/src/main/java/org/wamblee/xml/DomUtils.java
patch
|
blob
|
history
support/general/src/site/xdoc/index.xml
patch
|
blob
|
history
support/general/src/test/java/org/wamblee/io/FileSystemUtils.java
patch
|
blob
|
history
support/general/src/test/java/org/wamblee/test/AssertionUtils.java
patch
|
blob
|
history
support/general/src/test/java/org/wamblee/test/EventTracker.java
patch
|
blob
|
history
diff --git
a/support/general/pom.xml
b/support/general/pom.xml
index 36e1e5a6a3c1f310b41174bbae1324844566cf57..367da6e5c9340072d3f8bc08eb78ca4c830f176e 100644
(file)
--- a/
support/general/pom.xml
+++ b/
support/general/pom.xml
@@
-44,14
+44,17
@@
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
+ <optional>true</optional>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
+ <optional>true</optional>
</dependency>
</dependencies>
</dependency>
</dependencies>
diff --git
a/support/general/src/main/java/org/wamblee/io/DirectoryMonitor.java
b/support/general/src/main/java/org/wamblee/io/DirectoryMonitor.java
index 13181975068e0233f122411942d49e1ab319fab8..a258f0984ae346cdfd9ab347380f5c7e970dbb32 100644
(file)
--- a/
support/general/src/main/java/org/wamblee/io/DirectoryMonitor.java
+++ b/
support/general/src/main/java/org/wamblee/io/DirectoryMonitor.java
@@
-15,8
+15,6
@@
*/
package org.wamblee.io;
*/
package org.wamblee.io;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import java.io.File;
import java.io.FileFilter;
import java.io.File;
import java.io.FileFilter;
@@
-26,6
+24,7
@@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.logging.Logger;
/**
* Monitors a directory for changes.
/**
* Monitors a directory for changes.
@@
-35,7
+34,7
@@
import java.util.Set;
* @author Erik Brakkee
*/
public class DirectoryMonitor {
* @author Erik Brakkee
*/
public class DirectoryMonitor {
- private static final Log
LOG = LogFactory.getLog(DirectoryMonitor.class
);
+ private static final Log
ger LOG = Logger.getLogger(DirectoryMonitor.class.getName()
);
private File directory;
private File directory;
@@
-70,7
+69,7
@@
public class DirectoryMonitor {
* for the same changes.
*/
public void poll() {
* for the same changes.
*/
public void poll() {
- LOG.
debug
("Polling " + directory);
+ LOG.
fine
("Polling " + directory);
Map<File, Date> newContents = new HashMap<File, Date>();
File[] files = directory.listFiles(filter);
Map<File, Date> newContents = new HashMap<File, Date>();
File[] files = directory.listFiles(filter);
diff --git
a/support/general/src/main/java/org/wamblee/io/SimpleProcess.java
b/support/general/src/main/java/org/wamblee/io/SimpleProcess.java
index 5e18b16cb7a97c7375fb4b0842e962f3a4c74680..c08f001da84910d26e8b74a2be72968f78503a26 100644
(file)
--- a/
support/general/src/main/java/org/wamblee/io/SimpleProcess.java
+++ b/
support/general/src/main/java/org/wamblee/io/SimpleProcess.java
@@
-23,9
+23,8
@@
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Arrays;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Arrays;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
*
/**
*
@@
-33,7
+32,7
@@
import org.apache.commons.logging.LogFactory;
* @version $Revision$
*/
public class SimpleProcess {
* @version $Revision$
*/
public class SimpleProcess {
- private static final Log
LOG = LogFactory.getLog(SimpleProcess.class
);
+ private static final Log
ger LOG = Logger.getLogger(SimpleProcess.class.getName()
);
private File directory;
private File directory;
@@
-88,7
+87,7
@@
public class SimpleProcess {
fullcmd.append(" " + part);
}
fullcmd.append(" " + part);
}
- LOG.
debug
("Executing '" + fullcmd + "' in directory '" + directory +
+ LOG.
fine
("Executing '" + fullcmd + "' in directory '" + directory +
"'");
java.lang.Process proc = Runtime.getRuntime().exec(cmd, null,
"'");
java.lang.Process proc = Runtime.getRuntime().exec(cmd, null,
@@
-119,9
+118,9
@@
public class SimpleProcess {
stderr = myStderr.toString();
if (proc.exitValue() != 0) {
stderr = myStderr.toString();
if (proc.exitValue() != 0) {
- LOG.warn("Exit value was non-zero: " + this);
+ LOG.warn
ing
("Exit value was non-zero: " + this);
} else {
} else {
- LOG.
debug
("Process finished");
+ LOG.
fine
("Process finished");
}
return proc.exitValue();
}
return proc.exitValue();
@@
-138,8
+137,8
@@
public class SimpleProcess {
aReaderThread.join();
} catch (InterruptedException e) {
LOG
aReaderThread.join();
} catch (InterruptedException e) {
LOG
- .
warn(
this +
- ": error waiting for output stream reader of process to finish");
+ .
log(Level.WARNING,
this +
+ ": error waiting for output stream reader of process to finish"
, e
);
}
}
}
}
@@
-156,18
+155,18
@@
public class SimpleProcess {
String str;
while ((str = br.readLine()) != null) {
String str;
while ((str = br.readLine()) != null) {
- LOG.
debug
(aPrefix + str);
+ LOG.
fine
(aPrefix + str);
aOutput.write(str);
}
} catch (IOException e) {
aOutput.write(str);
}
} catch (IOException e) {
- LOG.
warn(
SimpleProcess.this +
+ LOG.
log(Level.FINE,
SimpleProcess.this +
": error reading input stream", e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
": error reading input stream", e);
} finally {
if (br != null) {
try {
br.close();
} catch (IOException e) {
- LOG.
warn("Error closing stream " + aPrefix
);
+ LOG.
log(Level.WARNING, "Error closing stream " + aPrefix, e
);
}
}
}
}
}
}
diff --git
a/support/general/src/main/java/org/wamblee/ioc/BeanKernel.java
b/support/general/src/main/java/org/wamblee/ioc/BeanKernel.java
index 3118b5d5344856882131e1f0f15193dd82da35f9..54f7b3f3567bb43dd427ec38487fa44943fee27d 100644
(file)
--- a/
support/general/src/main/java/org/wamblee/ioc/BeanKernel.java
+++ b/
support/general/src/main/java/org/wamblee/ioc/BeanKernel.java
@@
-12,12
+12,9
@@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
package org.wamblee.ioc;
package org.wamblee.ioc;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.wamblee.io.ClassPathResource;
import org.wamblee.io.InputResource;
import org.wamblee.io.ClassPathResource;
import org.wamblee.io.InputResource;
@@
-25,6
+22,8
@@
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.io.InputStream;
import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
* The standard means to obtain the bean factory. This works by reading a
/**
* The standard means to obtain the bean factory. This works by reading a
@@
-34,7
+33,8
@@
import java.util.Properties;
* a no-arg constructor.
*/
public final class BeanKernel {
* a no-arg constructor.
*/
public final class BeanKernel {
- private static final Log LOG = LogFactory.getLog(BeanKernel.class);
+ private static final Logger LOG = Logger.getLogger(BeanKernel.class
+ .getName());
/**
* Bean factory kernel properties file.
/**
* Bean factory kernel properties file.
@@
-120,7
+120,7
@@
public final class BeanKernel {
is.close();
} catch (IOException e) {
// last resort cannot do much now.
is.close();
} catch (IOException e) {
// last resort cannot do much now.
- LOG.
error("Error closing resource " + resourc
e);
+ LOG.
log(Level.WARNING, "Error closing resource " + resource,
e);
}
}
}
}
}
}
diff --git
a/support/general/src/main/java/org/wamblee/persistence/JpaMergeSupport.java
b/support/general/src/main/java/org/wamblee/persistence/JpaMergeSupport.java
index 4254dad6649820ad5c8d2ee295c245ec2e40e09e..5105d767b9772753ccdea1b0e328608b2cccf49d 100644
(file)
--- a/
support/general/src/main/java/org/wamblee/persistence/JpaMergeSupport.java
+++ b/
support/general/src/main/java/org/wamblee/persistence/JpaMergeSupport.java
@@
-24,11
+24,10
@@
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.logging.Logger;
import javax.persistence.EntityManager;
import javax.persistence.EntityManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.wamblee.reflection.ReflectionUtils;
/**
import org.wamblee.reflection.ReflectionUtils;
/**
@@
-54,7
+53,7
@@
import org.wamblee.reflection.ReflectionUtils;
* @author Erik Brakkee
*/
public class JpaMergeSupport {
* @author Erik Brakkee
*/
public class JpaMergeSupport {
- private static final Log
LOG = LogFactory.getLog(JpaMergeSupport.class
);
+ private static final Log
ger LOG = Logger.getLogger(JpaMergeSupport.class.getName()
);
/**
* Constructs the object.
/**
* Constructs the object.
@@
-112,7
+111,7
@@
public class JpaMergeSupport {
aProcessed.add(elem);
aProcessed.add(elem);
- LOG.
debug
("Setting pk/version on " + aPersistent + " from " + aMerged);
+ LOG.
fine
("Setting pk/version on " + aPersistent + " from " + aMerged);
Persistent persistentWrapper = PersistentFactory.create(aPersistent);
Persistent mergedWrapper = PersistentFactory.create(aMerged);
Persistent persistentWrapper = PersistentFactory.create(aPersistent);
Persistent mergedWrapper = PersistentFactory.create(aMerged);
diff --git
a/support/general/src/main/java/org/wamblee/xml/DomUtils.java
b/support/general/src/main/java/org/wamblee/xml/DomUtils.java
index 356fd34279bce5d091c617f4b5213c73572fa066..8c8128c42f67360bcb9695796d4f852087850d1d 100644
(file)
--- a/
support/general/src/main/java/org/wamblee/xml/DomUtils.java
+++ b/
support/general/src/main/java/org/wamblee/xml/DomUtils.java
@@
-15,9
+15,6
@@
*/
package org.wamblee.xml;
*/
package org.wamblee.xml;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.XMLSerializer;
@@
-45,6
+42,8
@@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
@@
-60,7
+59,7
@@
import javax.xml.validation.SchemaFactory;
* @author Erik Brakkee
*/
public final class DomUtils {
* @author Erik Brakkee
*/
public final class DomUtils {
- private static final Log
LOG = LogFactory.getLog(DomUtils.class
);
+ private static final Log
ger LOG = Logger.getLogger(DomUtils.class.getName()
);
/**
* Disabled default constructor.
/**
* Disabled default constructor.
@@
-110,7
+109,7
@@
public final class DomUtils {
try {
aIs.close();
} catch (Exception e) {
try {
aIs.close();
} catch (Exception e) {
- LOG.
warn(
"Error closing XML file", e);
+ LOG.
log(Level.WARNING,
"Error closing XML file", e);
}
}
}
}
}
}
@@
-150,13
+149,13
@@
public final class DomUtils {
try {
aSchema.close();
} catch (Exception e) {
try {
aSchema.close();
} catch (Exception e) {
- LOG.
warn(
"Error closing schema", e);
+ LOG.
log(Level.WARNING,
"Error closing schema", e);
}
try {
aIs.close();
} catch (Exception e) {
}
try {
aIs.close();
} catch (Exception e) {
- LOG.
warn(
"Error closing XML file", e);
+ LOG.
log(Level.WARNING,
"Error closing XML file", e);
}
}
}
}
}
}
diff --git
a/support/general/src/site/xdoc/index.xml
b/support/general/src/site/xdoc/index.xml
index e6056775b11f1ee6fa93d4958e121132825ef965..0d0bd3ea805c0b7449a40b5f9b0748c976d4f41d 100644
(file)
--- a/
support/general/src/site/xdoc/index.xml
+++ b/
support/general/src/site/xdoc/index.xml
@@
-28,6
+28,7
@@
</section>
<section name="Maven POM configuration">
</section>
<section name="Maven POM configuration">
+ <p>The following maven dependency must be used:</p>
<table>
<tr>
<th>groupId</th>
<table>
<tr>
<th>groupId</th>
@@
-38,6
+39,26
@@
<td>wamblee-support-general</td>
</tr>
</table>
<td>wamblee-support-general</td>
</tr>
</table>
+ <p>In addition there are optional dependencies on the following maven artifacts that need only
+ be used when Dom4j or EhCache utlities are used: </p>
+ <table>
+ <tr>
+ <th>groupId</th>
+ <th>artifactId</th>
+ </tr>
+ <tr>
+ <td>dom4j</td>
+ <td>dom4j</td>
+ </tr>
+ <tr>
+ <td>jaxen</td>
+ <td>jaxen</td>
+ </tr>
+ <tr>
+ <td>net.sf.ehcache</td>
+ <td>ehcache</td>
+ </tr>
+ </table>
</section>
</body>
</section>
</body>
diff --git
a/support/general/src/test/java/org/wamblee/io/FileSystemUtils.java
b/support/general/src/test/java/org/wamblee/io/FileSystemUtils.java
index 4be787e791899be20eed098e532e1eab24fb341a..7145c7f8dcc5b604e34274470d4bfdaeb4a72b6e 100644
(file)
--- a/
support/general/src/test/java/org/wamblee/io/FileSystemUtils.java
+++ b/
support/general/src/test/java/org/wamblee/io/FileSystemUtils.java
@@
-15,12
+15,6
@@
*/
package org.wamblee.io;
*/
package org.wamblee.io;
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@
-28,14
+22,16
@@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
-
import java.net.URL;
import java.net.URLDecoder;
import java.net.URL;
import java.net.URLDecoder;
-
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
-
import java.security.CodeSource;
import java.security.CodeSource;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
/**
* File system utilities.
/**
* File system utilities.
@@
-43,7
+39,7
@@
import java.security.CodeSource;
* @author Erik Brakkee
*/
public final class FileSystemUtils {
* @author Erik Brakkee
*/
public final class FileSystemUtils {
- private static final Log
LOG = LogFactory.getLog(FileSystemUtils.class
);
+ private static final Log
ger LOG = Logger.getLogger(FileSystemUtils.class.getName()
);
/**
* Test output directory relative to the sub project.
/**
* Test output directory relative to the sub project.
@@
-119,7
+115,7
@@
public final class FileSystemUtils {
CodeSource source = aTestClass.getProtectionDomain().getCodeSource();
if (source == null) {
CodeSource source = aTestClass.getProtectionDomain().getCodeSource();
if (source == null) {
- LOG.warn("Could not obtain path for '" + aRelativePath +
+ LOG.warn
ing
("Could not obtain path for '" + aRelativePath +
"' for class " + aTestClass + ", using relative path as is");
return new File(aRelativePath);
"' for class " + aTestClass + ", using relative path as is");
return new File(aRelativePath);
@@
-129,7
+125,7
@@
public final class FileSystemUtils {
String protocol = location.getProtocol();
if (!protocol.equals("file")) {
String protocol = location.getProtocol();
if (!protocol.equals("file")) {
- LOG.warn("protocol is not 'file': " + location);
+ LOG.warn
ing
("protocol is not 'file': " + location);
return new File(aRelativePath);
}
return new File(aRelativePath);
}
@@
-140,7
+136,7
@@
public final class FileSystemUtils {
path = URLDecoder.decode(location.getPath(), "UTF-8");
} catch (UnsupportedEncodingException e) {
// ignore it.. just don't decode
path = URLDecoder.decode(location.getPath(), "UTF-8");
} catch (UnsupportedEncodingException e) {
// ignore it.. just don't decode
- LOG.
warn(
"Decoding path failed: '" + location.getPath() + "'", e);
+ LOG.
log(Level.WARNING,
"Decoding path failed: '" + location.getPath() + "'", e);
}
return new File(new File(path).getParentFile(), aRelativePath);
}
return new File(new File(path).getParentFile(), aRelativePath);
diff --git
a/support/general/src/test/java/org/wamblee/test/AssertionUtils.java
b/support/general/src/test/java/org/wamblee/test/AssertionUtils.java
index 9c211b7ad5ea8ce4a9afd66556600f56f875ae52..b23eee933ecb6fbf3cc2878381a759e52c6797c8 100644
(file)
--- a/
support/general/src/test/java/org/wamblee/test/AssertionUtils.java
+++ b/
support/general/src/test/java/org/wamblee/test/AssertionUtils.java
@@
-19,19
+19,17
@@
import java.util.Arrays;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
+import java.util.logging.Logger;
import junit.framework.TestCase;
import junit.framework.TestCase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
* Useful assertions for use in test cases.
*
* @author Erik Brakkee
*/
public final class AssertionUtils {
/**
* Useful assertions for use in test cases.
*
* @author Erik Brakkee
*/
public final class AssertionUtils {
- private static final Log
LOG = LogFactory.getLog(AssertionUtils.class
);
+ private static final Log
ger LOG = Logger.getLogger(AssertionUtils.class.getName()
);
/**
* Disabled constructor.
/**
* Disabled constructor.
diff --git
a/support/general/src/test/java/org/wamblee/test/EventTracker.java
b/support/general/src/test/java/org/wamblee/test/EventTracker.java
index e66d01475e08a50ee3f18c15ad451506f2ecbe0b..c2b18f6d0c4ded723a6f0a7ee0622edf1fc748d1 100644
(file)
--- a/
support/general/src/test/java/org/wamblee/test/EventTracker.java
+++ b/
support/general/src/test/java/org/wamblee/test/EventTracker.java
@@
-15,14
+15,12
@@
*/
package org.wamblee.test;
*/
package org.wamblee.test;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.logging.Logger;
/**
* Tracks the occurence of certain events in a test environment. Threads in a
/**
* Tracks the occurence of certain events in a test environment. Threads in a
@@
-41,7
+39,7
@@
import java.util.Map;
* @author Erik Brakkee
*/
public class EventTracker<Event> {
* @author Erik Brakkee
*/
public class EventTracker<Event> {
- private static final Log
LOG = LogFactory.getLog(EventTracker.class
);
+ private static final Log
ger LOG = Logger.getLogger(EventTracker.class.getName()
);
/**
* Map of Thread object to a list of events.
/**
* Map of Thread object to a list of events.